@nanahoshi/mona-ui 0.18.6 → 0.20.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/README.md +71 -13
- package/THIRD_PARTY_NOTICES.md +60 -0
- package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +11 -3
- package/fesm2022/nanahoshi-mona-ui-breadcrumb.mjs +17 -9
- package/fesm2022/nanahoshi-mona-ui-button-group.mjs +16 -7
- package/fesm2022/nanahoshi-mona-ui-calendar.mjs +196 -101
- package/fesm2022/nanahoshi-mona-ui-card.mjs +22 -14
- package/fesm2022/nanahoshi-mona-ui-chart.mjs +78 -18
- package/fesm2022/nanahoshi-mona-ui-check-box.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-chip.mjs +11 -3
- package/fesm2022/nanahoshi-mona-ui-circular-progress-bar.mjs +1 -2
- package/fesm2022/nanahoshi-mona-ui-color-gradient.mjs +23 -5
- package/fesm2022/nanahoshi-mona-ui-color-palette.mjs +49 -28
- package/fesm2022/nanahoshi-mona-ui-color-picker.mjs +42 -26
- package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +11 -3
- package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +39 -21
- package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +88 -55
- package/fesm2022/nanahoshi-mona-ui-dialog.mjs +57 -25
- package/fesm2022/nanahoshi-mona-ui-dropdown-list.mjs +13 -5
- package/fesm2022/nanahoshi-mona-ui-dropdowns.mjs +17 -6
- package/fesm2022/nanahoshi-mona-ui-editor.mjs +178 -59
- package/fesm2022/nanahoshi-mona-ui-filter.mjs +137 -54
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-footer-cell.component-WEDbZ5vy.mjs → nanahoshi-mona-ui-grid-grid-footer-cell.component-BuybF7tX.mjs} +2 -2
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-footer-table-cell.directive-ibH5osCg.mjs → nanahoshi-mona-ui-grid-grid-footer-table-cell.directive-Dj-SaNzk.mjs} +2 -2
- package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-CYAm4l84.mjs +145 -0
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-toggle.component-hc-LeIb0.mjs → nanahoshi-mona-ui-grid-grid-toggle.component-B_Gm--X6.mjs} +46 -31
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-virtual-list.component-DYajpOb9.mjs → nanahoshi-mona-ui-grid-grid-virtual-list.component-X0X487Rm.mjs} +5 -5
- package/fesm2022/{nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-Pm8Fbp6M.mjs → nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-CyzJFQIy.mjs} +99 -42
- package/fesm2022/nanahoshi-mona-ui-grid.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-i18n.mjs +4874 -0
- package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +12 -4
- package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +48 -21
- package/fesm2022/nanahoshi-mona-ui-list-box.mjs +33 -18
- package/fesm2022/nanahoshi-mona-ui-list-view.mjs +10 -10
- package/fesm2022/nanahoshi-mona-ui-list.mjs +2 -0
- package/fesm2022/nanahoshi-mona-ui-locales.mjs +4973 -0
- package/fesm2022/nanahoshi-mona-ui-menubar.mjs +29 -16
- package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +12 -3
- package/fesm2022/nanahoshi-mona-ui-notification.mjs +23 -18
- package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +211 -106
- package/fesm2022/nanahoshi-mona-ui-otp-input.mjs +14 -6
- package/fesm2022/nanahoshi-mona-ui-pager.mjs +66 -29
- package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +57 -46
- package/fesm2022/nanahoshi-mona-ui-popup.mjs +35 -15
- package/fesm2022/nanahoshi-mona-ui-progress-bar.mjs +38 -17
- package/fesm2022/nanahoshi-mona-ui-rating.mjs +25 -7
- package/fesm2022/nanahoshi-mona-ui-scroll-view.mjs +431 -101
- package/fesm2022/nanahoshi-mona-ui-segmented.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-sheet.mjs +26 -8
- package/fesm2022/nanahoshi-mona-ui-sidebar.mjs +222 -28
- package/fesm2022/nanahoshi-mona-ui-slider.mjs +91 -36
- package/fesm2022/nanahoshi-mona-ui-spinner.mjs +34 -15
- package/fesm2022/nanahoshi-mona-ui-split-button.mjs +39 -23
- package/fesm2022/nanahoshi-mona-ui-splitter.mjs +50 -25
- package/fesm2022/nanahoshi-mona-ui-stepper.mjs +41 -14
- package/fesm2022/nanahoshi-mona-ui-switch.mjs +9 -9
- package/fesm2022/nanahoshi-mona-ui-tabs.mjs +74 -56
- package/fesm2022/nanahoshi-mona-ui-text-box.mjs +16 -8
- package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +47 -24
- package/fesm2022/nanahoshi-mona-ui-time-selector.mjs +66 -27
- package/fesm2022/nanahoshi-mona-ui-tree-view.mjs +23 -15
- package/fesm2022/nanahoshi-mona-ui-window.mjs +71 -40
- package/i18n/package.json +4 -0
- package/locales/package.json +4 -0
- package/package.json +9 -1
- package/types/nanahoshi-mona-ui-auto-complete.d.ts +6 -1
- package/types/nanahoshi-mona-ui-breadcrumb.d.ts +9 -3
- package/types/nanahoshi-mona-ui-button-group.d.ts +9 -3
- package/types/nanahoshi-mona-ui-calendar.d.ts +29 -15
- package/types/nanahoshi-mona-ui-card.d.ts +8 -2
- package/types/nanahoshi-mona-ui-chart.d.ts +10 -1
- package/types/nanahoshi-mona-ui-chip.d.ts +7 -1
- package/types/nanahoshi-mona-ui-color-gradient.d.ts +6 -1
- package/types/nanahoshi-mona-ui-color-palette.d.ts +21 -10
- package/types/nanahoshi-mona-ui-color-picker.d.ts +30 -20
- package/types/nanahoshi-mona-ui-combo-box.d.ts +6 -1
- package/types/nanahoshi-mona-ui-date-picker.d.ts +14 -6
- package/types/nanahoshi-mona-ui-datetime-picker.d.ts +40 -12
- package/types/nanahoshi-mona-ui-dialog.d.ts +16 -7
- package/types/nanahoshi-mona-ui-dropdown-list.d.ts +6 -1
- package/types/nanahoshi-mona-ui-dropdowns.d.ts +4 -1
- package/types/nanahoshi-mona-ui-editor.d.ts +6 -1
- package/types/nanahoshi-mona-ui-filter.d.ts +16 -10
- package/types/nanahoshi-mona-ui-grid.d.ts +50 -2
- package/types/nanahoshi-mona-ui-i18n.d.ts +680 -0
- package/types/nanahoshi-mona-ui-internal-list.d.ts +7 -2
- package/types/nanahoshi-mona-ui-internal-tree.d.ts +7 -3
- package/types/nanahoshi-mona-ui-list-box.d.ts +9 -4
- package/types/nanahoshi-mona-ui-list-view.d.ts +6 -6
- package/types/nanahoshi-mona-ui-list.d.ts +1 -1
- package/types/nanahoshi-mona-ui-locales.d.ts +4889 -0
- package/types/nanahoshi-mona-ui-menubar.d.ts +59 -58
- package/types/nanahoshi-mona-ui-multi-select.d.ts +6 -1
- package/types/nanahoshi-mona-ui-notification.d.ts +11 -5
- package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +24 -15
- package/types/nanahoshi-mona-ui-otp-input.d.ts +9 -3
- package/types/nanahoshi-mona-ui-pager.d.ts +20 -6
- package/types/nanahoshi-mona-ui-popup.d.ts +2 -1
- package/types/nanahoshi-mona-ui-progress-bar.d.ts +9 -7
- package/types/nanahoshi-mona-ui-rating.d.ts +19 -12
- package/types/nanahoshi-mona-ui-scroll-view.d.ts +34 -28
- package/types/nanahoshi-mona-ui-sheet.d.ts +8 -2
- package/types/nanahoshi-mona-ui-sidebar.d.ts +3 -0
- package/types/nanahoshi-mona-ui-slider.d.ts +44 -26
- package/types/nanahoshi-mona-ui-spinner.d.ts +13 -4
- package/types/nanahoshi-mona-ui-split-button.d.ts +62 -56
- package/types/nanahoshi-mona-ui-splitter.d.ts +9 -6
- package/types/nanahoshi-mona-ui-stepper.d.ts +10 -3
- package/types/nanahoshi-mona-ui-switch.d.ts +1 -1
- package/types/nanahoshi-mona-ui-tabs.d.ts +96 -35
- package/types/nanahoshi-mona-ui-text-box.d.ts +11 -5
- package/types/nanahoshi-mona-ui-time-picker.d.ts +11 -4
- package/types/nanahoshi-mona-ui-time-selector.d.ts +16 -5
- package/types/nanahoshi-mona-ui-tree-view.d.ts +15 -10
- package/types/nanahoshi-mona-ui-window.d.ts +26 -20
- package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-ZM3CneJ0.mjs +0 -145
|
@@ -8,7 +8,7 @@ import { themeControlSurfaceClasses } from '@nanahoshi/mona-ui/internal';
|
|
|
8
8
|
const checkboxInputThemeVariants = cva(`sr-only appearance-none outline-none peer`);
|
|
9
9
|
const checkmarkThemeVariants = cva(`
|
|
10
10
|
flex items-center justify-center
|
|
11
|
-
h-4.5 w-4.5
|
|
11
|
+
h-4.5 w-4.5 ps-0.25
|
|
12
12
|
cursor-pointer overflow-hidden
|
|
13
13
|
${themeControlSurfaceClasses}
|
|
14
14
|
border border-input-border
|
|
@@ -5,11 +5,16 @@ import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
|
5
5
|
import { RouterLink } from '@angular/router';
|
|
6
6
|
import { LucideCircleX } from '@lucide/angular';
|
|
7
7
|
import { ButtonDirective } from '@nanahoshi/mona-ui/button';
|
|
8
|
+
import { MonaI18nService } from '@nanahoshi/mona-ui/i18n';
|
|
8
9
|
import { fromEvent, filter } from 'rxjs';
|
|
9
10
|
import { twMerge } from 'tailwind-merge';
|
|
10
11
|
import { cva } from 'class-variance-authority';
|
|
11
12
|
import { themeRaisedSurfaceClasses } from '@nanahoshi/mona-ui/internal';
|
|
12
13
|
|
|
14
|
+
const CHIP_DEFAULT_MESSAGES = {
|
|
15
|
+
removeLabel: (label) => (label ? `Remove, ${label}` : "Remove, item")
|
|
16
|
+
};
|
|
17
|
+
|
|
13
18
|
/**
|
|
14
19
|
* @description Apply to an `<ng-template>` directly inside `<mona-chip>` to render prefix content
|
|
15
20
|
* (e.g., an avatar or icon) before the chip label or projected content. The template receives no context.
|
|
@@ -320,10 +325,12 @@ const chipThemeVariants = cva(`
|
|
|
320
325
|
class ChipComponent {
|
|
321
326
|
#destroyRef;
|
|
322
327
|
#elementRef;
|
|
328
|
+
#i18n;
|
|
323
329
|
#routerLink;
|
|
324
330
|
constructor() {
|
|
325
331
|
this.#destroyRef = inject(DestroyRef);
|
|
326
332
|
this.#elementRef = inject(ElementRef);
|
|
333
|
+
this.#i18n = inject(MonaI18nService);
|
|
327
334
|
this.#routerLink = inject(RouterLink, { optional: true });
|
|
328
335
|
this.ariaChecked = computed(() => {
|
|
329
336
|
if (!this.toggleable()) {
|
|
@@ -388,6 +395,7 @@ class ChipComponent {
|
|
|
388
395
|
...(ngDevMode ? [{ debugName: "iconSize" }] : /* istanbul ignore next */ []));
|
|
389
396
|
this.isLink = computed(() => !!this.#routerLink, /* @ts-ignore */
|
|
390
397
|
...(ngDevMode ? [{ debugName: "isLink" }] : /* istanbul ignore next */ []));
|
|
398
|
+
this.messages = this.#i18n.componentMessages("chip", CHIP_DEFAULT_MESSAGES);
|
|
391
399
|
this.prefixTemplate = contentChild(ChipPrefixTemplateDirective, { ...(ngDevMode ? { debugName: "prefixTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
|
|
392
400
|
this.role = computed(() => {
|
|
393
401
|
if (this.toggleable()) {
|
|
@@ -532,7 +540,7 @@ class ChipComponent {
|
|
|
532
540
|
});
|
|
533
541
|
}
|
|
534
542
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ChipComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
535
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: ChipComponent, isStandalone: true, selector: "mona-chip", inputs: { ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, look: { classPropertyName: "look", publicName: "look", isSignal: true, isRequired: false, transformFunction: null }, removable: { classPropertyName: "removable", publicName: "removable", isSignal: true, isRequired: false, transformFunction: null }, removeLabel: { classPropertyName: "removeLabel", publicName: "removeLabel", isSignal: true, isRequired: false, transformFunction: null }, removeTabIndex: { classPropertyName: "removeTabIndex", publicName: "removeTabIndex", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, selected: { classPropertyName: "selected", publicName: "selected", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, tabindex: { classPropertyName: "tabindex", publicName: "tabindex", isSignal: true, isRequired: false, transformFunction: null }, toggleable: { classPropertyName: "toggleable", publicName: "toggleable", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { contentClick: "contentClick", remove: "remove", selected: "selectedChange" }, host: { properties: { "class": "baseClass()", "attr.tabindex": "effectiveTabIndex()", "attr.aria-disabled": "disabled() ? 'true' : undefined", "attr.role": "role()", "attr.aria-checked": "ariaChecked()", "attr.aria-label": "effectiveAriaLabel()" } }, queries: [{ propertyName: "prefixTemplate", first: true, predicate: ChipPrefixTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }], ngImport: i0, template: "@if (prefixTemplate()) {\n <ng-container [ngTemplateOutlet]=\"prefixTemplate()\"></ng-container>\n}\n\n@if (label()) {\n <span>{{ label() }}</span>\n} @else {\n <ng-content></ng-content>\n}\n\n@if (removable()) {\n @let removeAriaLabel = removeLabel() ??
|
|
543
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: ChipComponent, isStandalone: true, selector: "mona-chip", inputs: { ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, look: { classPropertyName: "look", publicName: "look", isSignal: true, isRequired: false, transformFunction: null }, removable: { classPropertyName: "removable", publicName: "removable", isSignal: true, isRequired: false, transformFunction: null }, removeLabel: { classPropertyName: "removeLabel", publicName: "removeLabel", isSignal: true, isRequired: false, transformFunction: null }, removeTabIndex: { classPropertyName: "removeTabIndex", publicName: "removeTabIndex", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, selected: { classPropertyName: "selected", publicName: "selected", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, tabindex: { classPropertyName: "tabindex", publicName: "tabindex", isSignal: true, isRequired: false, transformFunction: null }, toggleable: { classPropertyName: "toggleable", publicName: "toggleable", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { contentClick: "contentClick", remove: "remove", selected: "selectedChange" }, host: { properties: { "class": "baseClass()", "attr.tabindex": "effectiveTabIndex()", "attr.aria-disabled": "disabled() ? 'true' : undefined", "attr.role": "role()", "attr.aria-checked": "ariaChecked()", "attr.aria-label": "effectiveAriaLabel()" } }, queries: [{ propertyName: "prefixTemplate", first: true, predicate: ChipPrefixTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }], ngImport: i0, template: "@if (prefixTemplate()) {\n <ng-container [ngTemplateOutlet]=\"prefixTemplate()\"></ng-container>\n}\n\n@if (label()) {\n <span>{{ label() }}</span>\n} @else {\n <ng-content></ng-content>\n}\n\n@if (removable()) {\n @let removeAriaLabel = removeLabel() ?? messages().removeLabel(label());\n <button\n monaButton\n look=\"link\"\n [iconOnly]=\"true\"\n [size]=\"'small'\"\n [attr.aria-label]=\"removeAriaLabel\"\n [tabindex]=\"removeTabIndex()\"\n [disabled]=\"disabled()\"\n (click)=\"onRemoveClick($event)\"\n [attr.data-chip-remove]=\"true\">\n <svg lucideCircleX [size]=\"iconSize()\"></svg>\n </button>\n}\n", dependencies: [{ kind: "directive", type: ButtonDirective, selector: "button[monaButton]", inputs: ["aria-haspopup", "disabled", "iconOnly", "loading", "look", "rounded", "selected", "size", "tabindex", "type", "toggleable", "class"], outputs: ["disabledChange", "loadingChange", "lookChange", "selectedChange"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: LucideCircleX, selector: "svg[lucideCircleX], svg[lucideXCircle]" }] }); }
|
|
536
544
|
}
|
|
537
545
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ChipComponent, decorators: [{
|
|
538
546
|
type: Component,
|
|
@@ -543,7 +551,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
543
551
|
"[attr.role]": "role()",
|
|
544
552
|
"[attr.aria-checked]": "ariaChecked()",
|
|
545
553
|
"[attr.aria-label]": "effectiveAriaLabel()"
|
|
546
|
-
}, template: "@if (prefixTemplate()) {\n <ng-container [ngTemplateOutlet]=\"prefixTemplate()\"></ng-container>\n}\n\n@if (label()) {\n <span>{{ label() }}</span>\n} @else {\n <ng-content></ng-content>\n}\n\n@if (removable()) {\n @let removeAriaLabel = removeLabel() ??
|
|
554
|
+
}, template: "@if (prefixTemplate()) {\n <ng-container [ngTemplateOutlet]=\"prefixTemplate()\"></ng-container>\n}\n\n@if (label()) {\n <span>{{ label() }}</span>\n} @else {\n <ng-content></ng-content>\n}\n\n@if (removable()) {\n @let removeAriaLabel = removeLabel() ?? messages().removeLabel(label());\n <button\n monaButton\n look=\"link\"\n [iconOnly]=\"true\"\n [size]=\"'small'\"\n [attr.aria-label]=\"removeAriaLabel\"\n [tabindex]=\"removeTabIndex()\"\n [disabled]=\"disabled()\"\n (click)=\"onRemoveClick($event)\"\n [attr.data-chip-remove]=\"true\">\n <svg lucideCircleX [size]=\"iconSize()\"></svg>\n </button>\n}\n" }]
|
|
547
555
|
}], ctorParameters: () => [], propDecorators: { prefixTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => ChipPrefixTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }], contentClick: [{ type: i0.Output, args: ["contentClick"] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], look: [{ type: i0.Input, args: [{ isSignal: true, alias: "look", required: false }] }], removable: [{ type: i0.Input, args: [{ isSignal: true, alias: "removable", required: false }] }], remove: [{ type: i0.Output, args: ["remove"] }], removeLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "removeLabel", required: false }] }], removeTabIndex: [{ type: i0.Input, args: [{ isSignal: true, alias: "removeTabIndex", required: false }] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }], selected: [{ type: i0.Input, args: [{ isSignal: true, alias: "selected", required: false }] }, { type: i0.Output, args: ["selectedChange"] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], tabindex: [{ type: i0.Input, args: [{ isSignal: true, alias: "tabindex", required: false }] }], toggleable: [{ type: i0.Input, args: [{ isSignal: true, alias: "toggleable", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }] } });
|
|
548
556
|
|
|
549
557
|
/*
|
|
@@ -554,5 +562,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
554
562
|
* Generated bundle index. Do not edit.
|
|
555
563
|
*/
|
|
556
564
|
|
|
557
|
-
export { ChipComponent, ChipPrefixTemplateDirective };
|
|
565
|
+
export { CHIP_DEFAULT_MESSAGES, ChipComponent, ChipPrefixTemplateDirective };
|
|
558
566
|
//# sourceMappingURL=nanahoshi-mona-ui-chip.mjs.map
|
|
@@ -22,9 +22,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
22
22
|
const circularProgressBarBaseThemeVariants = cva(`
|
|
23
23
|
relative flex items-center justify-center select-none
|
|
24
24
|
text-foreground
|
|
25
|
-
[&_svg]:absolute [&_svg]:
|
|
25
|
+
[&_svg]:absolute [&_svg]:inset-0
|
|
26
26
|
[&_svg]:h-full [&_svg]:w-full
|
|
27
|
-
[&_svg]:-translate-x-1/2 [&_svg]:-translate-y-1/2
|
|
28
27
|
[&_svg_circle]:origin-center
|
|
29
28
|
[&_svg_circle]:-rotate-90
|
|
30
29
|
[&_svg_circle]:transition-[stroke-dashoffset,stroke] duration-(--mona-motion-fast) ease-in
|
|
@@ -10,9 +10,24 @@ import { DropdownButtonComponent, DropdownButtonItemComponent } from '@nanahoshi
|
|
|
10
10
|
import { NumericTextBoxComponent, NumericTextBoxPrefixTemplateDirective } from '@nanahoshi/mona-ui/numeric-text-box';
|
|
11
11
|
import { SliderComponent } from '@nanahoshi/mona-ui/slider';
|
|
12
12
|
import { TextBoxComponent, TextBoxPrefixTemplateDirective, TextBoxSuffixTemplateDirective } from '@nanahoshi/mona-ui/text-box';
|
|
13
|
+
import { MonaI18nService } from '@nanahoshi/mona-ui/i18n';
|
|
13
14
|
import { Subject, fromEvent, switchMap, takeUntil, distinctUntilChanged } from 'rxjs';
|
|
14
15
|
import { cva } from 'class-variance-authority';
|
|
15
16
|
|
|
17
|
+
const COLOR_GRADIENT_DEFAULT_MESSAGES = {
|
|
18
|
+
apply: "Apply",
|
|
19
|
+
cancel: "Cancel",
|
|
20
|
+
clearColor: "Clear color",
|
|
21
|
+
copyAsHex: "Copy as HEX",
|
|
22
|
+
copyAsRgb: "Copy as RGB",
|
|
23
|
+
copyColor: "Copy color",
|
|
24
|
+
currentColor: "Current color",
|
|
25
|
+
previousColor: "Previous color",
|
|
26
|
+
saturationAndValue: "Color saturation and value",
|
|
27
|
+
saturationAndValueText: (saturation, value) => `Saturation ${saturation}%, Value ${value}%`,
|
|
28
|
+
switchColorMode: "Switch color mode"
|
|
29
|
+
};
|
|
30
|
+
|
|
16
31
|
const colorGradientBaseThemeVariants = cva(`
|
|
17
32
|
flex flex-col min-w-64
|
|
18
33
|
gap-2 p-2
|
|
@@ -86,6 +101,7 @@ const colorGradientSliderHandleThemeVariants = cva(`
|
|
|
86
101
|
class ColorGradientComponent {
|
|
87
102
|
#clipboard;
|
|
88
103
|
#destroyRef;
|
|
104
|
+
#i18n;
|
|
89
105
|
#injector;
|
|
90
106
|
#valueChange$;
|
|
91
107
|
#viewReady;
|
|
@@ -95,6 +111,7 @@ class ColorGradientComponent {
|
|
|
95
111
|
constructor() {
|
|
96
112
|
this.#clipboard = inject(Clipboard);
|
|
97
113
|
this.#destroyRef = inject(DestroyRef);
|
|
114
|
+
this.#i18n = inject(MonaI18nService);
|
|
98
115
|
this.#injector = inject(Injector);
|
|
99
116
|
this.#valueChange$ = new Subject();
|
|
100
117
|
this.#viewReady = signal(false, /* @ts-ignore */
|
|
@@ -145,12 +162,12 @@ class ColorGradientComponent {
|
|
|
145
162
|
{
|
|
146
163
|
type: "current",
|
|
147
164
|
color: this.selectedColor(),
|
|
148
|
-
title:
|
|
165
|
+
title: this.messages().currentColor
|
|
149
166
|
},
|
|
150
167
|
{
|
|
151
168
|
type: "last",
|
|
152
169
|
color: this.lastSelectedColor(),
|
|
153
|
-
title:
|
|
170
|
+
title: this.messages().previousColor,
|
|
154
171
|
onClick: () => this.onResetColorClick()
|
|
155
172
|
}
|
|
156
173
|
], /* @ts-ignore */
|
|
@@ -200,6 +217,7 @@ class ColorGradientComponent {
|
|
|
200
217
|
...(ngDevMode ? [{ debugName: "invalidState" }] : /* istanbul ignore next */ []));
|
|
201
218
|
this.lastSelectedColor = signal("", /* @ts-ignore */
|
|
202
219
|
...(ngDevMode ? [{ debugName: "lastSelectedColor" }] : /* istanbul ignore next */ []));
|
|
220
|
+
this.messages = this.#i18n.componentMessages("colorGradient", COLOR_GRADIENT_DEFAULT_MESSAGES);
|
|
203
221
|
this.rgb = signal({ r: 255, g: 255, b: 255 }, /* @ts-ignore */
|
|
204
222
|
...(ngDevMode ? [{ debugName: "rgb" }] : /* istanbul ignore next */ []));
|
|
205
223
|
this.selectedColor = computed(() => {
|
|
@@ -766,7 +784,7 @@ class ColorGradientComponent {
|
|
|
766
784
|
}
|
|
767
785
|
}
|
|
768
786
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ColorGradientComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
769
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: ColorGradientComponent, isStandalone: true, selector: "mona-color-gradient", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, format: { classPropertyName: "format", publicName: "format", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, opacity: { classPropertyName: "opacity", publicName: "opacity", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, showButtons: { classPropertyName: "showButtons", publicName: "showButtons", isSignal: true, isRequired: false, transformFunction: null }, showHexInput: { classPropertyName: "showHexInput", publicName: "showHexInput", isSignal: true, isRequired: false, transformFunction: null }, showColorInputs: { classPropertyName: "showColorInputs", publicName: "showColorInputs", isSignal: true, isRequired: false, transformFunction: null }, touched: { classPropertyName: "touched", publicName: "touched", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { apply: "apply", cancel: "cancel", touch: "touch", value: "valueChange" }, host: { properties: { "class": "baseClasses()", "attr.data-disabled": "disabled()", "attr.data-invalid": "invalidState() || null", "attr.aria-invalid": "invalidState() ? 'true' : null" } }, viewQueries: [{ propertyName: "hsvHandle", first: true, predicate: ["hsvPointer"], descendants: true, isSignal: true }, { propertyName: "hsvRectangle", first: true, predicate: ["hsvRectangle"], descendants: true, isSignal: true }], ngImport: i0, template: "<div [class]=\"hsvRectangleClasses()\" [style.background-color]=\"hsvRectangleBackground()\" #hsvRectangle>\n <div\n [class]=\"hsvRectangleHandleClasses()\"\n [style.left.px]=\"hsvHandleLeft()\"\n [style.top.px]=\"hsvHandleTop()\"\n [attr.tabindex]=\"disabled() ? -1 : 0\"\n [attr.role]=\"'slider'\"\n [attr.aria-label]=\"'Color saturation and value'\"\n [attr.aria-valuemin]=\"0\"\n [attr.aria-valuemax]=\"100\"\n [attr.aria-valuenow]=\"hsv().s\"\n [attr.aria-valuetext]=\"'Saturation ' + hsv().s + '%, Value ' + hsv().v + '%'\"\n [attr.aria-disabled]=\"disabled() || null\"\n (keydown)=\"onHsvHandleKeyDown($event)\"\n (blur)=\"onHsvHandleBlur()\"\n #hsvPointer></div>\n</div>\n<div class=\"flex items-center gap-2\">\n <div class=\"flex flex-1 flex-col gap-1 mr-2\">\n <mona-slider\n [minValue]=\"0\"\n [maxValue]=\"360\"\n [trackBackground]=\"'linear-gradient(to right, #ff0000, #ffff00, #00ff00, #00ffff, #0000ff, #ff00ff, #ff0000)'\"\n [selectionBackground]=\"'transparent'\"\n [handleClasses]=\"sliderHandleClasses()\"\n [trackSize]=\"sliderHeight\"\n [rounded]=\"rounded()\"\n [value]=\"hsv().h ?? 0\"\n (valueChange)=\"hueValue$.next($event)\"\n (touch)=\"onSliderBlur()\"></mona-slider>\n @if (opacity()) {\n <mona-slider\n [minValue]=\"0\"\n [maxValue]=\"255\"\n [trackBackground]=\"alphaSliderBackground()\"\n [selectionBackground]=\"'transparent'\"\n [handleClasses]=\"sliderHandleClasses()\"\n [trackSize]=\"sliderHeight\"\n [rounded]=\"rounded()\"\n [value]=\"alpha()\"\n (valueChange)=\"onAlphaChange($event)\"\n (touch)=\"onSliderBlur()\"></mona-slider>\n }\n </div>\n @for (preview of colorPreviews(); track preview.type) {\n <div\n [class]=\"colorPreviewClasses()\"\n [class.cursor-pointer]=\"$index === 1\"\n [style.background-color]=\"preview.color\"\n [attr.title]=\"$index === 1 ? preview.title : null\"\n [attr.aria-label]=\"$index === 1 ? preview.title : null\"\n [attr.aria-hidden]=\"$index === 0 ? 'true' : null\"\n [attr.role]=\"$index === 1 ? 'button' : null\"\n [attr.tabindex]=\"$index === 1 ? 0 : null\"\n (click)=\"preview.onClick?.()\"\n (keydown)=\"onPreviousColorKeyDown($event, preview.onClick)\"></div>\n }\n <button monaButton look=\"ghost\" size=\"small\" aria-label=\"Clear color\" (click)=\"onClearClick()\">\n <i class=\"ri-blur-off-line\"></i>\n </button>\n</div>\n<div class=\"flex flex-col gap-2\">\n @if (showColorInputs()) {\n <div class=\"flex gap-2\">\n <div class=\"flex gap-1\">\n @for (input of colorInputs(); track input.key) {\n <mona-numeric-text-box\n [value]=\"input.value\"\n [minValue]=\"input.min\"\n [maxValue]=\"input.max\"\n [decimals]=\"0\"\n [spinners]=\"false\"\n [nullable]=\"false\"\n [rounded]=\"rounded()\"\n [size]=\"'small'\"\n class=\"w-18\"\n (valueChange)=\"input.change($event)\"\n (inputBlur)=\"onNumericInputBlur()\">\n <ng-template monaNumericTextBoxPrefixTemplate>\n <ng-container\n [ngTemplateOutlet]=\"numericInputPrefixTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: input.label }\"></ng-container>\n </ng-template>\n </mona-numeric-text-box>\n }\n </div>\n <div class=\"flex flex-1 items-center justify-end\">\n <button\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n size=\"small\"\n aria-label=\"Switch color mode\"\n (click)=\"onSwitchColorModeClick()\">\n <i class=\"ri-expand-up-down-line\"></i>\n </button>\n </div>\n </div>\n }\n @if (showHexInput()) {\n <mona-text-box\n [rounded]=\"rounded()\"\n [value]=\"hex()\"\n (valueChange)=\"onHexChange($event)\"\n (inputBlur)=\"onHexInputBlur()\"\n (inputFocus)=\"onHexInputFocus()\"\n class=\"w-full\">\n <ng-template monaTextBoxPrefixTemplate>\n <ng-container\n [ngTemplateOutlet]=\"numericInputPrefixTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: 'HEX', classes: 'w-auto px-2' }\"></ng-container>\n </ng-template>\n <ng-template monaTextBoxSuffixTemplate>\n <mona-dropdown-button look=\"ghost\" aria-label=\"Copy color\" class=\"h-full\">\n <svg lucideCopy [size]=\"12\"></svg>\n <mona-dropdown-button-item\n label=\"Copy as HEX\"\n (menuClick)=\"onCopyColorSelect('hex')\"></mona-dropdown-button-item>\n <mona-dropdown-button-item\n label=\"Copy as RGB\"\n (menuClick)=\"onCopyColorSelect('rgb')\"></mona-dropdown-button-item>\n </mona-dropdown-button>\n </ng-template>\n </mona-text-box>\n }\n @if (showButtons()) {\n <div class=\"flex items-center justify-end gap-2\">\n <button monaButton [rounded]=\"rounded()\" look=\"primary\" (click)=\"onApply()\">Apply</button>\n <button monaButton [rounded]=\"rounded()\" (click)=\"onCancel()\">Cancel</button>\n </div>\n }\n</div>\n\n<ng-template #numericInputPrefixTemplate let-text let-classes=\"classes\">\n <span\n [class]=\"classes\"\n class=\"inline-flex items-center justify-center select-none w-7.5 [background-color:var(--mona-input-addon-background,var(--color-secondary))] h-full text-foreground text-xs font-semibold border-r border-r-input-border\"\n >{{ text }}</span\n >\n</ng-template>\n", dependencies: [{ kind: "component", type: NumericTextBoxComponent, selector: "mona-numeric-text-box", inputs: ["aria-label", "decimals", "disabled", "formatter", "maxValue", "minValue", "nullable", "readonly", "required", "invalid", "rounded", "size", "spinners", "step", "tabindex", "touched", "class", "value"], outputs: ["inputBlur", "inputFocus", "inputFocusOut", "touch", "valueChange"] }, { kind: "directive", type: NumericTextBoxPrefixTemplateDirective, selector: "ng-template[monaNumericTextBoxPrefixTemplate]" }, { kind: "directive", type: ButtonDirective, selector: "button[monaButton]", inputs: ["aria-haspopup", "disabled", "iconOnly", "loading", "look", "rounded", "selected", "size", "tabindex", "type", "toggleable", "class"], outputs: ["disabledChange", "loadingChange", "lookChange", "selectedChange"] }, { kind: "component", type: TextBoxComponent, selector: "mona-text-box", inputs: ["clearButton", "disabled", "inputAttributes", "inputClass", "inputStyle", "invalid", "placeholder", "readonly", "required", "rounded", "size", "touched", "type", "class", "value"], outputs: ["inputBlur", "inputFocus", "touch", "valueChange"] }, { kind: "directive", type: TextBoxPrefixTemplateDirective, selector: "ng-template[monaTextBoxPrefixTemplate]" }, { kind: "directive", type: TextBoxSuffixTemplateDirective, selector: "ng-template[monaTextBoxSuffixTemplate]" }, { kind: "component", type: SliderComponent, selector: "mona-slider", inputs: ["aria-label", "aria-labelledby", "value"], outputs: ["valueChange"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: DropdownButtonComponent, selector: "mona-dropdown-button", inputs: ["aria-label", "aria-labelledby", "iconOnly", "disabled", "loading", "look", "rounded", "size", "text", "class"], outputs: ["menuItemClick"] }, { kind: "component", type: DropdownButtonItemComponent, selector: "mona-dropdown-button-item" }, { kind: "component", type: LucideCopy, selector: "svg[lucideCopy]" }] }); }
|
|
787
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: ColorGradientComponent, isStandalone: true, selector: "mona-color-gradient", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, format: { classPropertyName: "format", publicName: "format", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, opacity: { classPropertyName: "opacity", publicName: "opacity", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, showButtons: { classPropertyName: "showButtons", publicName: "showButtons", isSignal: true, isRequired: false, transformFunction: null }, showHexInput: { classPropertyName: "showHexInput", publicName: "showHexInput", isSignal: true, isRequired: false, transformFunction: null }, showColorInputs: { classPropertyName: "showColorInputs", publicName: "showColorInputs", isSignal: true, isRequired: false, transformFunction: null }, touched: { classPropertyName: "touched", publicName: "touched", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { apply: "apply", cancel: "cancel", touch: "touch", value: "valueChange" }, host: { properties: { "class": "baseClasses()", "attr.data-disabled": "disabled()", "attr.data-invalid": "invalidState() || null", "attr.aria-invalid": "invalidState() ? 'true' : null" } }, viewQueries: [{ propertyName: "hsvHandle", first: true, predicate: ["hsvPointer"], descendants: true, isSignal: true }, { propertyName: "hsvRectangle", first: true, predicate: ["hsvRectangle"], descendants: true, isSignal: true }], ngImport: i0, template: "<div [class]=\"hsvRectangleClasses()\" [style.background-color]=\"hsvRectangleBackground()\" #hsvRectangle>\n <div\n [class]=\"hsvRectangleHandleClasses()\"\n [style.left.px]=\"hsvHandleLeft()\"\n [style.top.px]=\"hsvHandleTop()\"\n [attr.tabindex]=\"disabled() ? -1 : 0\"\n [attr.role]=\"'slider'\"\n [attr.aria-label]=\"messages().saturationAndValue\"\n [attr.aria-valuemin]=\"0\"\n [attr.aria-valuemax]=\"100\"\n [attr.aria-valuenow]=\"hsv().s\"\n [attr.aria-valuetext]=\"messages().saturationAndValueText(hsv().s ?? 0, hsv().v ?? 0)\"\n [attr.aria-disabled]=\"disabled() || null\"\n (keydown)=\"onHsvHandleKeyDown($event)\"\n (blur)=\"onHsvHandleBlur()\"\n #hsvPointer></div>\n</div>\n<div class=\"flex items-center gap-2\">\n <div class=\"flex flex-1 flex-col gap-1 me-2\">\n <mona-slider\n [minValue]=\"0\"\n [maxValue]=\"360\"\n [trackBackground]=\"'linear-gradient(to right, #ff0000, #ffff00, #00ff00, #00ffff, #0000ff, #ff00ff, #ff0000)'\"\n [selectionBackground]=\"'transparent'\"\n [handleClasses]=\"sliderHandleClasses()\"\n [trackSize]=\"sliderHeight\"\n [rounded]=\"rounded()\"\n [value]=\"hsv().h ?? 0\"\n (valueChange)=\"hueValue$.next($event)\"\n (touch)=\"onSliderBlur()\"></mona-slider>\n @if (opacity()) {\n <mona-slider\n [minValue]=\"0\"\n [maxValue]=\"255\"\n [trackBackground]=\"alphaSliderBackground()\"\n [selectionBackground]=\"'transparent'\"\n [handleClasses]=\"sliderHandleClasses()\"\n [trackSize]=\"sliderHeight\"\n [rounded]=\"rounded()\"\n [value]=\"alpha()\"\n (valueChange)=\"onAlphaChange($event)\"\n (touch)=\"onSliderBlur()\"></mona-slider>\n }\n </div>\n @for (preview of colorPreviews(); track preview.type) {\n <div\n [class]=\"colorPreviewClasses()\"\n [class.cursor-pointer]=\"$index === 1\"\n [style.background-color]=\"preview.color\"\n [attr.title]=\"$index === 1 ? preview.title : null\"\n [attr.aria-label]=\"$index === 1 ? preview.title : null\"\n [attr.aria-hidden]=\"$index === 0 ? 'true' : null\"\n [attr.role]=\"$index === 1 ? 'button' : null\"\n [attr.tabindex]=\"$index === 1 ? 0 : null\"\n (click)=\"preview.onClick?.()\"\n (keydown)=\"onPreviousColorKeyDown($event, preview.onClick)\"></div>\n }\n <button monaButton look=\"ghost\" size=\"small\" [attr.aria-label]=\"messages().clearColor\" (click)=\"onClearClick()\">\n <i class=\"ri-blur-off-line\"></i>\n </button>\n</div>\n<div class=\"flex flex-col gap-2\">\n @if (showColorInputs()) {\n <div class=\"flex gap-2\">\n <div class=\"flex gap-1\">\n @for (input of colorInputs(); track input.key) {\n <mona-numeric-text-box\n [value]=\"input.value\"\n [minValue]=\"input.min\"\n [maxValue]=\"input.max\"\n [decimals]=\"0\"\n [spinners]=\"false\"\n [nullable]=\"false\"\n [rounded]=\"rounded()\"\n [size]=\"'small'\"\n class=\"w-18\"\n (valueChange)=\"input.change($event)\"\n (inputBlur)=\"onNumericInputBlur()\">\n <ng-template monaNumericTextBoxPrefixTemplate>\n <ng-container\n [ngTemplateOutlet]=\"numericInputPrefixTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: input.label }\"></ng-container>\n </ng-template>\n </mona-numeric-text-box>\n }\n </div>\n <div class=\"flex flex-1 items-center justify-end\">\n <button\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n size=\"small\"\n [attr.aria-label]=\"messages().switchColorMode\"\n (click)=\"onSwitchColorModeClick()\">\n <i class=\"ri-expand-up-down-line\"></i>\n </button>\n </div>\n </div>\n }\n @if (showHexInput()) {\n <mona-text-box\n [rounded]=\"rounded()\"\n [value]=\"hex()\"\n (valueChange)=\"onHexChange($event)\"\n (inputBlur)=\"onHexInputBlur()\"\n (inputFocus)=\"onHexInputFocus()\"\n class=\"w-full\">\n <ng-template monaTextBoxPrefixTemplate>\n <ng-container\n [ngTemplateOutlet]=\"numericInputPrefixTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: 'HEX', classes: 'w-auto px-2' }\"></ng-container>\n </ng-template>\n <ng-template monaTextBoxSuffixTemplate>\n <mona-dropdown-button look=\"ghost\" [attr.aria-label]=\"messages().copyColor\" class=\"h-full\">\n <svg lucideCopy [size]=\"12\"></svg>\n <mona-dropdown-button-item\n [label]=\"messages().copyAsHex\"\n (menuClick)=\"onCopyColorSelect('hex')\"></mona-dropdown-button-item>\n <mona-dropdown-button-item\n [label]=\"messages().copyAsRgb\"\n (menuClick)=\"onCopyColorSelect('rgb')\"></mona-dropdown-button-item>\n </mona-dropdown-button>\n </ng-template>\n </mona-text-box>\n }\n @if (showButtons()) {\n <div class=\"flex items-center justify-end gap-2\">\n <button monaButton [rounded]=\"rounded()\" look=\"primary\" (click)=\"onApply()\">{{ messages().apply }}</button>\n <button monaButton [rounded]=\"rounded()\" (click)=\"onCancel()\">{{ messages().cancel }}</button>\n </div>\n }\n</div>\n\n<ng-template #numericInputPrefixTemplate let-text let-classes=\"classes\">\n <span\n [class]=\"classes\"\n class=\"inline-flex items-center justify-center select-none w-7.5 [background-color:var(--mona-input-addon-background,var(--color-secondary))] h-full text-foreground text-xs font-semibold border-e border-e-input-border\"\n >{{ text }}</span\n >\n</ng-template>\n", dependencies: [{ kind: "component", type: NumericTextBoxComponent, selector: "mona-numeric-text-box", inputs: ["aria-label", "decimals", "disabled", "formatter", "invalid", "maxValue", "minValue", "nullable", "readonly", "required", "rounded", "size", "spinners", "step", "tabindex", "touched", "class", "value"], outputs: ["inputBlur", "inputFocus", "inputFocusOut", "touch", "valueChange"] }, { kind: "directive", type: NumericTextBoxPrefixTemplateDirective, selector: "ng-template[monaNumericTextBoxPrefixTemplate]" }, { kind: "directive", type: ButtonDirective, selector: "button[monaButton]", inputs: ["aria-haspopup", "disabled", "iconOnly", "loading", "look", "rounded", "selected", "size", "tabindex", "type", "toggleable", "class"], outputs: ["disabledChange", "loadingChange", "lookChange", "selectedChange"] }, { kind: "component", type: TextBoxComponent, selector: "mona-text-box", inputs: ["clearButton", "disabled", "inputAttributes", "inputClass", "inputStyle", "invalid", "placeholder", "readonly", "required", "rounded", "size", "touched", "type", "class", "value"], outputs: ["inputBlur", "inputFocus", "touch", "valueChange"] }, { kind: "directive", type: TextBoxPrefixTemplateDirective, selector: "ng-template[monaTextBoxPrefixTemplate]" }, { kind: "directive", type: TextBoxSuffixTemplateDirective, selector: "ng-template[monaTextBoxSuffixTemplate]" }, { kind: "component", type: SliderComponent, selector: "mona-slider", inputs: ["aria-label", "aria-labelledby", "value"], outputs: ["valueChange"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: DropdownButtonComponent, selector: "mona-dropdown-button", inputs: ["aria-label", "aria-labelledby", "iconOnly", "disabled", "loading", "look", "rounded", "size", "text", "class"], outputs: ["menuItemClick"] }, { kind: "component", type: DropdownButtonItemComponent, selector: "mona-dropdown-button-item" }, { kind: "component", type: LucideCopy, selector: "svg[lucideCopy]" }] }); }
|
|
770
788
|
}
|
|
771
789
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ColorGradientComponent, decorators: [{
|
|
772
790
|
type: Component,
|
|
@@ -787,7 +805,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
787
805
|
"[attr.data-disabled]": "disabled()",
|
|
788
806
|
"[attr.data-invalid]": "invalidState() || null",
|
|
789
807
|
"[attr.aria-invalid]": "invalidState() ? 'true' : null"
|
|
790
|
-
}, template: "<div [class]=\"hsvRectangleClasses()\" [style.background-color]=\"hsvRectangleBackground()\" #hsvRectangle>\n <div\n [class]=\"hsvRectangleHandleClasses()\"\n [style.left.px]=\"hsvHandleLeft()\"\n [style.top.px]=\"hsvHandleTop()\"\n [attr.tabindex]=\"disabled() ? -1 : 0\"\n [attr.role]=\"'slider'\"\n [attr.aria-label]=\"
|
|
808
|
+
}, template: "<div [class]=\"hsvRectangleClasses()\" [style.background-color]=\"hsvRectangleBackground()\" #hsvRectangle>\n <div\n [class]=\"hsvRectangleHandleClasses()\"\n [style.left.px]=\"hsvHandleLeft()\"\n [style.top.px]=\"hsvHandleTop()\"\n [attr.tabindex]=\"disabled() ? -1 : 0\"\n [attr.role]=\"'slider'\"\n [attr.aria-label]=\"messages().saturationAndValue\"\n [attr.aria-valuemin]=\"0\"\n [attr.aria-valuemax]=\"100\"\n [attr.aria-valuenow]=\"hsv().s\"\n [attr.aria-valuetext]=\"messages().saturationAndValueText(hsv().s ?? 0, hsv().v ?? 0)\"\n [attr.aria-disabled]=\"disabled() || null\"\n (keydown)=\"onHsvHandleKeyDown($event)\"\n (blur)=\"onHsvHandleBlur()\"\n #hsvPointer></div>\n</div>\n<div class=\"flex items-center gap-2\">\n <div class=\"flex flex-1 flex-col gap-1 me-2\">\n <mona-slider\n [minValue]=\"0\"\n [maxValue]=\"360\"\n [trackBackground]=\"'linear-gradient(to right, #ff0000, #ffff00, #00ff00, #00ffff, #0000ff, #ff00ff, #ff0000)'\"\n [selectionBackground]=\"'transparent'\"\n [handleClasses]=\"sliderHandleClasses()\"\n [trackSize]=\"sliderHeight\"\n [rounded]=\"rounded()\"\n [value]=\"hsv().h ?? 0\"\n (valueChange)=\"hueValue$.next($event)\"\n (touch)=\"onSliderBlur()\"></mona-slider>\n @if (opacity()) {\n <mona-slider\n [minValue]=\"0\"\n [maxValue]=\"255\"\n [trackBackground]=\"alphaSliderBackground()\"\n [selectionBackground]=\"'transparent'\"\n [handleClasses]=\"sliderHandleClasses()\"\n [trackSize]=\"sliderHeight\"\n [rounded]=\"rounded()\"\n [value]=\"alpha()\"\n (valueChange)=\"onAlphaChange($event)\"\n (touch)=\"onSliderBlur()\"></mona-slider>\n }\n </div>\n @for (preview of colorPreviews(); track preview.type) {\n <div\n [class]=\"colorPreviewClasses()\"\n [class.cursor-pointer]=\"$index === 1\"\n [style.background-color]=\"preview.color\"\n [attr.title]=\"$index === 1 ? preview.title : null\"\n [attr.aria-label]=\"$index === 1 ? preview.title : null\"\n [attr.aria-hidden]=\"$index === 0 ? 'true' : null\"\n [attr.role]=\"$index === 1 ? 'button' : null\"\n [attr.tabindex]=\"$index === 1 ? 0 : null\"\n (click)=\"preview.onClick?.()\"\n (keydown)=\"onPreviousColorKeyDown($event, preview.onClick)\"></div>\n }\n <button monaButton look=\"ghost\" size=\"small\" [attr.aria-label]=\"messages().clearColor\" (click)=\"onClearClick()\">\n <i class=\"ri-blur-off-line\"></i>\n </button>\n</div>\n<div class=\"flex flex-col gap-2\">\n @if (showColorInputs()) {\n <div class=\"flex gap-2\">\n <div class=\"flex gap-1\">\n @for (input of colorInputs(); track input.key) {\n <mona-numeric-text-box\n [value]=\"input.value\"\n [minValue]=\"input.min\"\n [maxValue]=\"input.max\"\n [decimals]=\"0\"\n [spinners]=\"false\"\n [nullable]=\"false\"\n [rounded]=\"rounded()\"\n [size]=\"'small'\"\n class=\"w-18\"\n (valueChange)=\"input.change($event)\"\n (inputBlur)=\"onNumericInputBlur()\">\n <ng-template monaNumericTextBoxPrefixTemplate>\n <ng-container\n [ngTemplateOutlet]=\"numericInputPrefixTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: input.label }\"></ng-container>\n </ng-template>\n </mona-numeric-text-box>\n }\n </div>\n <div class=\"flex flex-1 items-center justify-end\">\n <button\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n size=\"small\"\n [attr.aria-label]=\"messages().switchColorMode\"\n (click)=\"onSwitchColorModeClick()\">\n <i class=\"ri-expand-up-down-line\"></i>\n </button>\n </div>\n </div>\n }\n @if (showHexInput()) {\n <mona-text-box\n [rounded]=\"rounded()\"\n [value]=\"hex()\"\n (valueChange)=\"onHexChange($event)\"\n (inputBlur)=\"onHexInputBlur()\"\n (inputFocus)=\"onHexInputFocus()\"\n class=\"w-full\">\n <ng-template monaTextBoxPrefixTemplate>\n <ng-container\n [ngTemplateOutlet]=\"numericInputPrefixTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: 'HEX', classes: 'w-auto px-2' }\"></ng-container>\n </ng-template>\n <ng-template monaTextBoxSuffixTemplate>\n <mona-dropdown-button look=\"ghost\" [attr.aria-label]=\"messages().copyColor\" class=\"h-full\">\n <svg lucideCopy [size]=\"12\"></svg>\n <mona-dropdown-button-item\n [label]=\"messages().copyAsHex\"\n (menuClick)=\"onCopyColorSelect('hex')\"></mona-dropdown-button-item>\n <mona-dropdown-button-item\n [label]=\"messages().copyAsRgb\"\n (menuClick)=\"onCopyColorSelect('rgb')\"></mona-dropdown-button-item>\n </mona-dropdown-button>\n </ng-template>\n </mona-text-box>\n }\n @if (showButtons()) {\n <div class=\"flex items-center justify-end gap-2\">\n <button monaButton [rounded]=\"rounded()\" look=\"primary\" (click)=\"onApply()\">{{ messages().apply }}</button>\n <button monaButton [rounded]=\"rounded()\" (click)=\"onCancel()\">{{ messages().cancel }}</button>\n </div>\n }\n</div>\n\n<ng-template #numericInputPrefixTemplate let-text let-classes=\"classes\">\n <span\n [class]=\"classes\"\n class=\"inline-flex items-center justify-center select-none w-7.5 [background-color:var(--mona-input-addon-background,var(--color-secondary))] h-full text-foreground text-xs font-semibold border-e border-e-input-border\"\n >{{ text }}</span\n >\n</ng-template>\n" }]
|
|
791
809
|
}], ctorParameters: () => [], propDecorators: { hsvHandle: [{ type: i0.ViewChild, args: ["hsvPointer", { isSignal: true }] }], hsvRectangle: [{ type: i0.ViewChild, args: ["hsvRectangle", { isSignal: true }] }], apply: [{ type: i0.Output, args: ["apply"] }], cancel: [{ type: i0.Output, args: ["cancel"] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], format: [{ type: i0.Input, args: [{ isSignal: true, alias: "format", required: false }] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], opacity: [{ type: i0.Input, args: [{ isSignal: true, alias: "opacity", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }], showButtons: [{ type: i0.Input, args: [{ isSignal: true, alias: "showButtons", required: false }] }], showHexInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "showHexInput", required: false }] }], showColorInputs: [{ type: i0.Input, args: [{ isSignal: true, alias: "showColorInputs", required: false }] }], touch: [{ type: i0.Output, args: ["touch"] }], touched: [{ type: i0.Input, args: [{ isSignal: true, alias: "touched", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }] } });
|
|
792
810
|
|
|
793
811
|
/*
|
|
@@ -798,5 +816,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
798
816
|
* Generated bundle index. Do not edit.
|
|
799
817
|
*/
|
|
800
818
|
|
|
801
|
-
export { ColorGradientComponent };
|
|
819
|
+
export { COLOR_GRADIENT_DEFAULT_MESSAGES, ColorGradientComponent };
|
|
802
820
|
//# sourceMappingURL=nanahoshi-mona-ui-color-gradient.mjs.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { inject, ElementRef, computed, signal, input, output, model, Component } from '@angular/core';
|
|
3
|
+
import { injectComponentDirection, MonaI18nService } from '@nanahoshi/mona-ui/i18n';
|
|
3
4
|
import { count } from '@mirei/ts-collections';
|
|
4
5
|
import { cva } from 'class-variance-authority';
|
|
5
6
|
|
|
@@ -41,6 +42,11 @@ const colorPaletteItemThemeVariants = cva(`
|
|
|
41
42
|
}
|
|
42
43
|
});
|
|
43
44
|
|
|
45
|
+
const COLOR_PALETTE_DEFAULT_MESSAGES = {
|
|
46
|
+
color: (color) => `Color ${color}`,
|
|
47
|
+
colorPalette: "Color palette"
|
|
48
|
+
};
|
|
49
|
+
|
|
44
50
|
const flatColorScheme = {
|
|
45
51
|
name: "flat",
|
|
46
52
|
columns: 20,
|
|
@@ -668,11 +674,26 @@ const websafeColorScheme = {
|
|
|
668
674
|
|
|
669
675
|
class ColorPaletteComponent {
|
|
670
676
|
constructor() {
|
|
677
|
+
this.#direction = injectComponentDirection();
|
|
671
678
|
this.#elementRef = inject((ElementRef));
|
|
679
|
+
this.#i18n = inject(MonaI18nService);
|
|
680
|
+
this.isRtl = computed(() => this.#direction() === "rtl", /* @ts-ignore */
|
|
681
|
+
...(ngDevMode ? [{ debugName: "isRtl" }] : /* istanbul ignore next */ []));
|
|
682
|
+
this.activeColorIndex = computed(() => this.focusedColorIndex() === -1 ? 0 : this.focusedColorIndex(), /* @ts-ignore */
|
|
683
|
+
...(ngDevMode ? [{ debugName: "activeColorIndex" }] : /* istanbul ignore next */ []));
|
|
672
684
|
this.baseClasses = computed(() => {
|
|
673
685
|
return colorPaletteBaseThemeVariants();
|
|
674
686
|
}, /* @ts-ignore */
|
|
675
687
|
...(ngDevMode ? [{ debugName: "baseClasses" }] : /* istanbul ignore next */ []));
|
|
688
|
+
this.colorRows = computed(() => {
|
|
689
|
+
const { colors, columns } = this.colorScheme();
|
|
690
|
+
const rows = [];
|
|
691
|
+
for (let i = 0; i < colors.length; i += columns) {
|
|
692
|
+
rows.push(colors.slice(i, i + columns));
|
|
693
|
+
}
|
|
694
|
+
return rows;
|
|
695
|
+
}, /* @ts-ignore */
|
|
696
|
+
...(ngDevMode ? [{ debugName: "colorRows" }] : /* istanbul ignore next */ []));
|
|
676
697
|
this.colorScheme = computed(() => {
|
|
677
698
|
const palette = this.palette();
|
|
678
699
|
const columns = this.columns();
|
|
@@ -693,26 +714,21 @@ class ColorPaletteComponent {
|
|
|
693
714
|
};
|
|
694
715
|
}, /* @ts-ignore */
|
|
695
716
|
...(ngDevMode ? [{ debugName: "colorScheme" }] : /* istanbul ignore next */ []));
|
|
717
|
+
this.focusedColorIndex = signal(-1, /* @ts-ignore */
|
|
718
|
+
...(ngDevMode ? [{ debugName: "focusedColorIndex" }] : /* istanbul ignore next */ []));
|
|
719
|
+
this.invalidState = computed(() => this.touched() && (this.invalid() || (this.required() && !this.value())), /* @ts-ignore */
|
|
720
|
+
...(ngDevMode ? [{ debugName: "invalidState" }] : /* istanbul ignore next */ []));
|
|
721
|
+
this.messages = this.#i18n.componentMessages("colorPalette", COLOR_PALETTE_DEFAULT_MESSAGES);
|
|
696
722
|
this.paletteItemClasses = computed(() => {
|
|
697
723
|
const rounded = this.rounded();
|
|
698
724
|
return colorPaletteItemThemeVariants({ rounded });
|
|
699
725
|
}, /* @ts-ignore */
|
|
700
726
|
...(ngDevMode ? [{ debugName: "paletteItemClasses" }] : /* istanbul ignore next */ []));
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
}
|
|
707
|
-
return rows;
|
|
708
|
-
}, /* @ts-ignore */
|
|
709
|
-
...(ngDevMode ? [{ debugName: "colorRows" }] : /* istanbul ignore next */ []));
|
|
710
|
-
this.focusedColorIndex = signal(-1, /* @ts-ignore */
|
|
711
|
-
...(ngDevMode ? [{ debugName: "focusedColorIndex" }] : /* istanbul ignore next */ []));
|
|
712
|
-
this.activeColorIndex = computed(() => this.focusedColorIndex() === -1 ? 0 : this.focusedColorIndex(), /* @ts-ignore */
|
|
713
|
-
...(ngDevMode ? [{ debugName: "activeColorIndex" }] : /* istanbul ignore next */ []));
|
|
714
|
-
this.invalidState = computed(() => this.touched() && (this.invalid() || (this.required() && !this.value())), /* @ts-ignore */
|
|
715
|
-
...(ngDevMode ? [{ debugName: "invalidState" }] : /* istanbul ignore next */ []));
|
|
727
|
+
/**
|
|
728
|
+
* @description Accessible label for the color palette grid.
|
|
729
|
+
* @default ""
|
|
730
|
+
*/
|
|
731
|
+
this.ariaLabel = input("", { ...(ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {}), alias: "aria-label" });
|
|
716
732
|
/**
|
|
717
733
|
* @description The number of columns in the color palette grid.
|
|
718
734
|
* Only applicable when using a custom palette.
|
|
@@ -747,12 +763,6 @@ class ColorPaletteComponent {
|
|
|
747
763
|
*/
|
|
748
764
|
this.readonly = input(false, /* @ts-ignore */
|
|
749
765
|
...(ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []));
|
|
750
|
-
/**
|
|
751
|
-
* @description Border-radius preset applied to the color palette items.
|
|
752
|
-
* @default "none"
|
|
753
|
-
*/
|
|
754
|
-
this.rounded = input("none", /* @ts-ignore */
|
|
755
|
-
...(ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []));
|
|
756
766
|
/**
|
|
757
767
|
* @description Sets whether the color palette is required. When bound to a signal form field via `[formField]`,
|
|
758
768
|
* this is written by the `FormField` directive.
|
|
@@ -760,6 +770,12 @@ class ColorPaletteComponent {
|
|
|
760
770
|
*/
|
|
761
771
|
this.required = input(false, /* @ts-ignore */
|
|
762
772
|
...(ngDevMode ? [{ debugName: "required" }] : /* istanbul ignore next */ []));
|
|
773
|
+
/**
|
|
774
|
+
* @description Border-radius preset applied to the color palette items.
|
|
775
|
+
* @default "none"
|
|
776
|
+
*/
|
|
777
|
+
this.rounded = input("none", /* @ts-ignore */
|
|
778
|
+
...(ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []));
|
|
763
779
|
/**
|
|
764
780
|
* @description The size of each tile in the color palette grid.
|
|
765
781
|
* @default 18
|
|
@@ -785,7 +801,9 @@ class ColorPaletteComponent {
|
|
|
785
801
|
this.value = model(null, /* @ts-ignore */
|
|
786
802
|
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
787
803
|
}
|
|
804
|
+
#direction;
|
|
788
805
|
#elementRef;
|
|
806
|
+
#i18n;
|
|
789
807
|
focusColorTile(index) {
|
|
790
808
|
setTimeout(() => {
|
|
791
809
|
const colorTiles = this.#elementRef.nativeElement.querySelectorAll("[data-color-index]");
|
|
@@ -815,14 +833,17 @@ class ColorPaletteComponent {
|
|
|
815
833
|
}
|
|
816
834
|
const colors = this.colorScheme().colors;
|
|
817
835
|
const columns = this.colorScheme().columns;
|
|
836
|
+
const isRtl = this.isRtl();
|
|
837
|
+
const prevKey = isRtl ? "ArrowRight" : "ArrowLeft";
|
|
838
|
+
const nextKey = isRtl ? "ArrowLeft" : "ArrowRight";
|
|
818
839
|
let newIndex = colorIndex;
|
|
819
840
|
let handled = false;
|
|
820
841
|
switch (event.key) {
|
|
821
|
-
case
|
|
842
|
+
case prevKey:
|
|
822
843
|
newIndex = Math.max(0, colorIndex - 1);
|
|
823
844
|
handled = true;
|
|
824
845
|
break;
|
|
825
|
-
case
|
|
846
|
+
case nextKey:
|
|
826
847
|
newIndex = Math.min(colors.length - 1, colorIndex + 1);
|
|
827
848
|
handled = true;
|
|
828
849
|
break;
|
|
@@ -868,7 +889,7 @@ class ColorPaletteComponent {
|
|
|
868
889
|
}
|
|
869
890
|
}
|
|
870
891
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ColorPaletteComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
871
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: ColorPaletteComponent, isStandalone: true, selector: "mona-color-palette", inputs: { columns: { classPropertyName: "columns", publicName: "columns", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, palette: { classPropertyName: "palette", publicName: "palette", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null },
|
|
892
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: ColorPaletteComponent, isStandalone: true, selector: "mona-color-palette", inputs: { ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, columns: { classPropertyName: "columns", publicName: "columns", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, palette: { classPropertyName: "palette", publicName: "palette", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, tileSize: { classPropertyName: "tileSize", publicName: "tileSize", isSignal: true, isRequired: false, transformFunction: null }, touched: { classPropertyName: "touched", publicName: "touched", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { touch: "touch", value: "valueChange" }, host: { properties: { "class": "baseClasses()", "style.grid-template-columns": "'repeat('+colorScheme().columns+', minmax('+tileSize()+'px, 1fr))'", "style.grid-auto-rows": "tileSize()+'px'", "attr.data-disabled": "disabled()", "attr.data-invalid": "invalidState() || null", "attr.data-readonly": "readonly()", "attr.data-required": "required() || null", "attr.role": "'grid'", "attr.aria-label": "ariaLabel() || messages().colorPalette", "attr.aria-disabled": "disabled()", "attr.aria-invalid": "invalidState() ? 'true' : null", "attr.aria-readonly": "readonly()", "attr.aria-required": "required()" } }, ngImport: i0, template: "@for (row of colorRows(); track $index; let rowIndex = $index) {\n <div class=\"contents\" role=\"row\">\n @for (color of row; track $index; let colIndex = $index) {\n @let i = rowIndex * colorScheme().columns + colIndex;\n <div\n [class]=\"paletteItemClasses()\"\n [attr.data-selected]=\"color === value()\"\n [attr.data-color-index]=\"i\"\n [attr.data-readonly]=\"readonly()\"\n [attr.tabindex]=\"disabled() ? -1 : i === activeColorIndex() ? 0 : -1\"\n [attr.role]=\"'gridcell'\"\n [attr.aria-label]=\"messages().color(color)\"\n [attr.aria-disabled]=\"disabled()\"\n [attr.aria-readonly]=\"readonly()\"\n [attr.aria-selected]=\"color === value()\"\n [style.background-color]=\"color\"\n (click)=\"onColorSelect(color)\"\n (keydown)=\"onKeyDown($event, i)\"\n (focus)=\"onColorFocus(i)\"\n (blur)=\"onColorBlur()\"></div>\n }\n </div>\n}\n" }); }
|
|
872
893
|
}
|
|
873
894
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ColorPaletteComponent, decorators: [{
|
|
874
895
|
type: Component,
|
|
@@ -881,13 +902,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
881
902
|
"[attr.data-readonly]": "readonly()",
|
|
882
903
|
"[attr.data-required]": "required() || null",
|
|
883
904
|
"[attr.role]": "'grid'",
|
|
884
|
-
"[attr.aria-label]": "
|
|
905
|
+
"[attr.aria-label]": "ariaLabel() || messages().colorPalette",
|
|
885
906
|
"[attr.aria-disabled]": "disabled()",
|
|
886
907
|
"[attr.aria-invalid]": "invalidState() ? 'true' : null",
|
|
887
908
|
"[attr.aria-readonly]": "readonly()",
|
|
888
909
|
"[attr.aria-required]": "required()"
|
|
889
|
-
}, template: "@for (row of colorRows(); track $index; let rowIndex = $index) {\n <div class=\"contents\" role=\"row\">\n @for (color of row; track $index; let colIndex = $index) {\n @let i = rowIndex * colorScheme().columns + colIndex;\n <div\n [class]=\"paletteItemClasses()\"\n [attr.data-selected]=\"color === value()\"\n [attr.data-color-index]=\"i\"\n [attr.data-readonly]=\"readonly()\"\n [attr.tabindex]=\"disabled() ? -1 : i === activeColorIndex() ? 0 : -1\"\n [attr.role]=\"'gridcell'\"\n [attr.aria-label]=\"
|
|
890
|
-
}], propDecorators: { columns: [{ type: i0.Input, args: [{ isSignal: true, alias: "columns", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], palette: [{ type: i0.Input, args: [{ isSignal: true, alias: "palette", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }],
|
|
910
|
+
}, template: "@for (row of colorRows(); track $index; let rowIndex = $index) {\n <div class=\"contents\" role=\"row\">\n @for (color of row; track $index; let colIndex = $index) {\n @let i = rowIndex * colorScheme().columns + colIndex;\n <div\n [class]=\"paletteItemClasses()\"\n [attr.data-selected]=\"color === value()\"\n [attr.data-color-index]=\"i\"\n [attr.data-readonly]=\"readonly()\"\n [attr.tabindex]=\"disabled() ? -1 : i === activeColorIndex() ? 0 : -1\"\n [attr.role]=\"'gridcell'\"\n [attr.aria-label]=\"messages().color(color)\"\n [attr.aria-disabled]=\"disabled()\"\n [attr.aria-readonly]=\"readonly()\"\n [attr.aria-selected]=\"color === value()\"\n [style.background-color]=\"color\"\n (click)=\"onColorSelect(color)\"\n (keydown)=\"onKeyDown($event, i)\"\n (focus)=\"onColorFocus(i)\"\n (blur)=\"onColorBlur()\"></div>\n }\n </div>\n}\n" }]
|
|
911
|
+
}], propDecorators: { ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }], columns: [{ type: i0.Input, args: [{ isSignal: true, alias: "columns", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], palette: [{ type: i0.Input, args: [{ isSignal: true, alias: "palette", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }], tileSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "tileSize", required: false }] }], touch: [{ type: i0.Output, args: ["touch"] }], touched: [{ type: i0.Input, args: [{ isSignal: true, alias: "touched", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }] } });
|
|
891
912
|
|
|
892
913
|
/*
|
|
893
914
|
* Public API Surface of @nanahoshi/mona-ui/color-palette
|
|
@@ -897,5 +918,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
897
918
|
* Generated bundle index. Do not edit.
|
|
898
919
|
*/
|
|
899
920
|
|
|
900
|
-
export { ColorPaletteComponent };
|
|
921
|
+
export { COLOR_PALETTE_DEFAULT_MESSAGES, ColorPaletteComponent };
|
|
901
922
|
//# sourceMappingURL=nanahoshi-mona-ui-color-palette.mjs.map
|