@nanahoshi/mona-ui 0.18.5 → 0.19.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/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 +122 -48
- 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 +199 -77
- 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 +28 -16
- package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +74 -51
- 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-Bg7rckst.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-BSSpaCLL.mjs} +2 -2
- package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-D9AwQFDV.mjs +145 -0
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-toggle.component-hc-LeIb0.mjs → nanahoshi-mona-ui-grid-grid-toggle.component-Byb9iTes.mjs} +21 -17
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-virtual-list.component-DYajpOb9.mjs → nanahoshi-mona-ui-grid-grid-virtual-list.component-CBmdtrXm.mjs} +5 -5
- package/fesm2022/{nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-Pm8Fbp6M.mjs → nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-DPmJmCap.mjs} +90 -42
- package/fesm2022/nanahoshi-mona-ui-grid.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-i18n.mjs +1168 -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-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 +46 -19
- 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 +32 -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 +33 -19
- 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/package.json +5 -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 +13 -3
- 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 +14 -5
- 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 +7 -2
- package/types/nanahoshi-mona-ui-datetime-picker.d.ts +33 -8
- 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 +38 -1
- package/types/nanahoshi-mona-ui-i18n.d.ts +633 -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-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 +19 -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 +9 -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 +7 -2
- 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
|
@@ -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
|
|
@@ -8,6 +8,7 @@ import { ColorGradientComponent } from '@nanahoshi/mona-ui/color-gradient';
|
|
|
8
8
|
import { ColorPaletteComponent } from '@nanahoshi/mona-ui/color-palette';
|
|
9
9
|
import { themeControlSurfaceClasses, themeOverlaySurfaceClasses, createElementControlId } from '@nanahoshi/mona-ui/internal';
|
|
10
10
|
import { IndicatorIconComponent } from '@nanahoshi/mona-ui/internal/indicator-icon';
|
|
11
|
+
import { MonaI18nService } from '@nanahoshi/mona-ui/i18n';
|
|
11
12
|
import { PopupService, dropdownPopupAnimation } from '@nanahoshi/mona-ui/popup';
|
|
12
13
|
import { take, fromEvent, takeUntil } from 'rxjs';
|
|
13
14
|
import { twMerge } from 'tailwind-merge';
|
|
@@ -24,6 +25,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
24
25
|
}]
|
|
25
26
|
}] });
|
|
26
27
|
|
|
28
|
+
const COLOR_PICKER_DEFAULT_MESSAGES = {
|
|
29
|
+
clearColor: "Clear color",
|
|
30
|
+
colorGradientPicker: "Color gradient picker",
|
|
31
|
+
colorPalettePicker: "Color palette picker",
|
|
32
|
+
colorPicker: "Color picker"
|
|
33
|
+
};
|
|
34
|
+
|
|
27
35
|
const colorPickerBaseThemeVariants = cva(`
|
|
28
36
|
flex items-center
|
|
29
37
|
cursor-pointer
|
|
@@ -99,9 +107,10 @@ class ColorPickerComponent {
|
|
|
99
107
|
constructor() {
|
|
100
108
|
this.#destroyRef = inject(DestroyRef);
|
|
101
109
|
this.#hostElementRef = inject(ElementRef);
|
|
102
|
-
this.#
|
|
110
|
+
this.#i18n = inject(MonaI18nService);
|
|
103
111
|
this.#popupRef = signal(null, /* @ts-ignore */
|
|
104
112
|
...(ngDevMode ? [{ debugName: "#popupRef" }] : /* istanbul ignore next */ []));
|
|
113
|
+
this.#popupService = inject(PopupService);
|
|
105
114
|
this.baseClasses = computed(() => {
|
|
106
115
|
const expanded = this.expanded();
|
|
107
116
|
const rounded = this.rounded();
|
|
@@ -117,14 +126,20 @@ class ColorPickerComponent {
|
|
|
117
126
|
...(ngDevMode ? [{ debugName: "colorClasses" }] : /* istanbul ignore next */ []));
|
|
118
127
|
this.expanded = computed(() => this.#popupRef() !== null, /* @ts-ignore */
|
|
119
128
|
...(ngDevMode ? [{ debugName: "expanded" }] : /* istanbul ignore next */ []));
|
|
129
|
+
this.gradientPopupClasses = `${themeOverlaySurfaceClasses} border border-border shadow-(--shadow-overlay)`;
|
|
120
130
|
this.invalidState = computed(() => this.touched() && (this.invalid() || (this.required() && !this.value())), /* @ts-ignore */
|
|
121
131
|
...(ngDevMode ? [{ debugName: "invalidState" }] : /* istanbul ignore next */ []));
|
|
122
|
-
this.
|
|
132
|
+
this.messages = this.#i18n.componentMessages("colorPicker", COLOR_PICKER_DEFAULT_MESSAGES);
|
|
123
133
|
this.palettePopupClasses = `flex flex-col p-0.5 ${themeOverlaySurfaceClasses} border border-border shadow-(--shadow-overlay) outline-none`;
|
|
124
134
|
this.popupId = createElementControlId();
|
|
125
135
|
this.popupTemplate = viewChild.required("popupTemplate", /* @ts-ignore */
|
|
126
136
|
...(ngDevMode ? [{ debugName: "popupTemplate" }] : /* istanbul ignore next */ []));
|
|
127
137
|
this.valueTemplate = contentChild(ColorPickerValueTemplateDirective, { ...(ngDevMode ? { debugName: "valueTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
|
|
138
|
+
/**
|
|
139
|
+
* @description Accessible label for the color picker combobox.
|
|
140
|
+
* @default ""
|
|
141
|
+
*/
|
|
142
|
+
this.ariaLabel = input("", { ...(ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {}), alias: "aria-label" });
|
|
128
143
|
/**
|
|
129
144
|
* @description Whether to close the color picker when a color is selected.
|
|
130
145
|
* Only applies when the view is set to "palette".
|
|
@@ -174,6 +189,13 @@ class ColorPickerComponent {
|
|
|
174
189
|
*/
|
|
175
190
|
this.readonly = input(false, /* @ts-ignore */
|
|
176
191
|
...(ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []));
|
|
192
|
+
/**
|
|
193
|
+
* @description Sets whether the color picker is required. When bound to a signal form field via `[formField]`,
|
|
194
|
+
* this is written by the `FormField` directive.
|
|
195
|
+
* @default false
|
|
196
|
+
*/
|
|
197
|
+
this.required = input(false, /* @ts-ignore */
|
|
198
|
+
...(ngDevMode ? [{ debugName: "required" }] : /* istanbul ignore next */ []));
|
|
177
199
|
/**
|
|
178
200
|
* @description Border-radius preset applied to the color picker.
|
|
179
201
|
* @default "medium"
|
|
@@ -193,20 +215,6 @@ class ColorPickerComponent {
|
|
|
193
215
|
*/
|
|
194
216
|
this.size = input("medium", /* @ts-ignore */
|
|
195
217
|
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
196
|
-
/**
|
|
197
|
-
* @description The view mode of the color picker.
|
|
198
|
-
* This can be either "palette" or "gradient".
|
|
199
|
-
* @default "gradient"
|
|
200
|
-
*/
|
|
201
|
-
this.view = input("gradient", /* @ts-ignore */
|
|
202
|
-
...(ngDevMode ? [{ debugName: "view" }] : /* istanbul ignore next */ []));
|
|
203
|
-
/**
|
|
204
|
-
* @description Sets whether the color picker is required. When bound to a signal form field via `[formField]`,
|
|
205
|
-
* this is written by the `FormField` directive.
|
|
206
|
-
* @default false
|
|
207
|
-
*/
|
|
208
|
-
this.required = input(false, /* @ts-ignore */
|
|
209
|
-
...(ngDevMode ? [{ debugName: "required" }] : /* istanbul ignore next */ []));
|
|
210
218
|
/**
|
|
211
219
|
* @description Emitted when the color picker is interacted with on blur or color selection.
|
|
212
220
|
* The `FormField` directive listens to this to mark the field as touched.
|
|
@@ -225,11 +233,19 @@ class ColorPickerComponent {
|
|
|
225
233
|
*/
|
|
226
234
|
this.value = model(null, /* @ts-ignore */
|
|
227
235
|
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
236
|
+
/**
|
|
237
|
+
* @description The view mode of the color picker.
|
|
238
|
+
* This can be either "palette" or "gradient".
|
|
239
|
+
* @default "gradient"
|
|
240
|
+
*/
|
|
241
|
+
this.view = input("gradient", /* @ts-ignore */
|
|
242
|
+
...(ngDevMode ? [{ debugName: "view" }] : /* istanbul ignore next */ []));
|
|
228
243
|
}
|
|
229
244
|
#destroyRef;
|
|
230
245
|
#hostElementRef;
|
|
231
|
-
#
|
|
246
|
+
#i18n;
|
|
232
247
|
#popupRef;
|
|
248
|
+
#popupService;
|
|
233
249
|
ngOnInit() {
|
|
234
250
|
this.setEventListeners();
|
|
235
251
|
this.setKeyboardEventListeners();
|
|
@@ -250,6 +266,9 @@ class ColorPickerComponent {
|
|
|
250
266
|
onColorGradientCancel() {
|
|
251
267
|
this.#popupRef()?.close();
|
|
252
268
|
}
|
|
269
|
+
onColorGradientTouch() {
|
|
270
|
+
this.touch.emit();
|
|
271
|
+
}
|
|
253
272
|
onColorGradientValueChange(value) {
|
|
254
273
|
if (value === undefined) {
|
|
255
274
|
return;
|
|
@@ -259,7 +278,7 @@ class ColorPickerComponent {
|
|
|
259
278
|
}
|
|
260
279
|
this.value.set(value);
|
|
261
280
|
}
|
|
262
|
-
|
|
281
|
+
onColorPaletteTouch() {
|
|
263
282
|
this.touch.emit();
|
|
264
283
|
}
|
|
265
284
|
onColorPaletteValueChange(value) {
|
|
@@ -271,9 +290,6 @@ class ColorPickerComponent {
|
|
|
271
290
|
this.#popupRef()?.close();
|
|
272
291
|
}
|
|
273
292
|
}
|
|
274
|
-
onColorPaletteTouch() {
|
|
275
|
-
this.touch.emit();
|
|
276
|
-
}
|
|
277
293
|
onPaletteContainerKeyDown(event) {
|
|
278
294
|
switch (event.key) {
|
|
279
295
|
case "ArrowDown":
|
|
@@ -447,7 +463,7 @@ class ColorPickerComponent {
|
|
|
447
463
|
});
|
|
448
464
|
}
|
|
449
465
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ColorPickerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
450
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: ColorPickerComponent, isStandalone: true, selector: "mona-color-picker", inputs: { closeOnSelect: { classPropertyName: "closeOnSelect", publicName: "closeOnSelect", 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 }, opacity: { classPropertyName: "opacity", publicName: "opacity", 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 },
|
|
466
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: ColorPickerComponent, isStandalone: true, selector: "mona-color-picker", inputs: { ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, closeOnSelect: { classPropertyName: "closeOnSelect", publicName: "closeOnSelect", 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 }, opacity: { classPropertyName: "opacity", publicName: "opacity", 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 }, showClearButton: { classPropertyName: "showClearButton", publicName: "showClearButton", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", 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 }, view: { classPropertyName: "view", publicName: "view", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { touch: "touch", value: "valueChange" }, host: { properties: { "class": "baseClasses()", "attr.tabindex": "disabled() ? -1 : 0", "attr.data-disabled": "disabled()", "attr.data-invalid": "invalidState() || null", "attr.data-open": "expanded() || null", "attr.data-readonly": "readonly()", "attr.data-required": "required() || null", "attr.role": "'combobox'", "attr.aria-controls": "popupId", "attr.aria-expanded": "expanded() || null", "attr.aria-haspopup": "'dialog'", "attr.aria-label": "ariaLabel() || messages().colorPicker", "attr.aria-disabled": "disabled()", "attr.aria-invalid": "invalidState() ? 'true' : null", "attr.aria-readonly": "readonly()", "attr.aria-required": "required()" } }, queries: [{ propertyName: "valueTemplate", first: true, predicate: ColorPickerValueTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }], viewQueries: [{ propertyName: "popupTemplate", first: true, predicate: ["popupTemplate"], descendants: true, isSignal: true }], ngImport: i0, template: "@if (valueTemplate()) {\n <ng-container\n [ngTemplateOutlet]=\"valueTemplate() ?? null\"\n [ngTemplateOutletContext]=\"{ $implicit: value() }\"></ng-container>\n} @else {\n <div [style.background]=\"value()\" [class]=\"colorClasses()\">\n @if (!value()) {\n <svg lucideXCircle [size]=\"16\"></svg>\n }\n </div>\n}\n<mona-indicator-icon preset=\"dropdown\" [size]=\"18\"></mona-indicator-icon>\n\n<ng-template #popupTemplate>\n @if (view() === \"palette\") {\n <div\n [id]=\"popupId\"\n [class]=\"palettePopupClasses\"\n tabindex=\"0\"\n role=\"dialog\"\n [attr.aria-label]=\"messages().colorPalettePicker\"\n data-palette-container\n (keydown)=\"onPaletteContainerKeyDown($event)\">\n @if (showClearButton()) {\n <div class=\"flex items-center justify-end p-1\">\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 }\n <mona-color-palette\n [palette]=\"palette()\"\n [columns]=\"columns()\"\n [readonly]=\"readonly()\"\n [value]=\"value()\"\n (valueChange)=\"onColorPaletteValueChange($event)\"\n (touch)=\"onColorPaletteTouch()\"></mona-color-palette>\n </div>\n } @else if (view() === \"gradient\") {\n <div\n [id]=\"popupId\"\n [class]=\"gradientPopupClasses\"\n tabindex=\"0\"\n role=\"dialog\"\n [attr.aria-label]=\"messages().colorGradientPicker\">\n <mona-color-gradient\n [opacity]=\"opacity()\"\n [rounded]=\"rounded()\"\n [disabled]=\"disabled() || readonly()\"\n [value]=\"value()\"\n (valueChange)=\"onColorGradientValueChange($event)\"\n (touch)=\"onColorGradientTouch()\"\n (apply)=\"onColorGradientApply()\"\n (cancel)=\"onColorGradientCancel()\"></mona-color-gradient>\n </div>\n }\n</ng-template>\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: "component", type: ColorPaletteComponent, selector: "mona-color-palette", inputs: ["aria-label", "columns", "disabled", "invalid", "palette", "readonly", "required", "rounded", "tileSize", "touched", "value"], outputs: ["touch", "valueChange"] }, { kind: "component", type: ColorGradientComponent, selector: "mona-color-gradient", inputs: ["disabled", "format", "invalid", "opacity", "required", "rounded", "showButtons", "showHexInput", "showColorInputs", "touched", "value"], outputs: ["apply", "cancel", "touch", "valueChange"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: LucideCircleX, selector: "svg[lucideCircleX], svg[lucideXCircle]" }, { kind: "component", type: IndicatorIconComponent, selector: "mona-indicator-icon", inputs: ["icon", "interactive", "label", "preset", "size", "class"], outputs: ["activate"] }] }); }
|
|
451
467
|
}
|
|
452
468
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ColorPickerComponent, decorators: [{
|
|
453
469
|
type: Component,
|
|
@@ -470,13 +486,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
470
486
|
"[attr.aria-controls]": "popupId",
|
|
471
487
|
"[attr.aria-expanded]": "expanded() || null",
|
|
472
488
|
"[attr.aria-haspopup]": "'dialog'",
|
|
473
|
-
"[attr.aria-label]": "
|
|
489
|
+
"[attr.aria-label]": "ariaLabel() || messages().colorPicker",
|
|
474
490
|
"[attr.aria-disabled]": "disabled()",
|
|
475
491
|
"[attr.aria-invalid]": "invalidState() ? 'true' : null",
|
|
476
492
|
"[attr.aria-readonly]": "readonly()",
|
|
477
493
|
"[attr.aria-required]": "required()"
|
|
478
|
-
}, template: "@if (valueTemplate()) {\n <ng-container\n [ngTemplateOutlet]=\"valueTemplate() ?? null\"\n [ngTemplateOutletContext]=\"{ $implicit: value() }\"></ng-container>\n} @else {\n <div [style.background]=\"value()\" [class]=\"colorClasses()\">\n @if (!value()) {\n <svg lucideXCircle [size]=\"16\"></svg>\n }\n </div>\n}\n<mona-indicator-icon preset=\"dropdown\" [size]=\"18\"></mona-indicator-icon>\n\n<ng-template #popupTemplate>\n @if (view() === \"palette\") {\n <div\n [id]=\"popupId\"\n [class]=\"palettePopupClasses\"\n tabindex=\"0\"\n role=\"dialog\"\n aria-label=\"
|
|
479
|
-
}], propDecorators: { popupTemplate: [{ type: i0.ViewChild, args: ["popupTemplate", { isSignal: true }] }], valueTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => ColorPickerValueTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }],
|
|
494
|
+
}, template: "@if (valueTemplate()) {\n <ng-container\n [ngTemplateOutlet]=\"valueTemplate() ?? null\"\n [ngTemplateOutletContext]=\"{ $implicit: value() }\"></ng-container>\n} @else {\n <div [style.background]=\"value()\" [class]=\"colorClasses()\">\n @if (!value()) {\n <svg lucideXCircle [size]=\"16\"></svg>\n }\n </div>\n}\n<mona-indicator-icon preset=\"dropdown\" [size]=\"18\"></mona-indicator-icon>\n\n<ng-template #popupTemplate>\n @if (view() === \"palette\") {\n <div\n [id]=\"popupId\"\n [class]=\"palettePopupClasses\"\n tabindex=\"0\"\n role=\"dialog\"\n [attr.aria-label]=\"messages().colorPalettePicker\"\n data-palette-container\n (keydown)=\"onPaletteContainerKeyDown($event)\">\n @if (showClearButton()) {\n <div class=\"flex items-center justify-end p-1\">\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 }\n <mona-color-palette\n [palette]=\"palette()\"\n [columns]=\"columns()\"\n [readonly]=\"readonly()\"\n [value]=\"value()\"\n (valueChange)=\"onColorPaletteValueChange($event)\"\n (touch)=\"onColorPaletteTouch()\"></mona-color-palette>\n </div>\n } @else if (view() === \"gradient\") {\n <div\n [id]=\"popupId\"\n [class]=\"gradientPopupClasses\"\n tabindex=\"0\"\n role=\"dialog\"\n [attr.aria-label]=\"messages().colorGradientPicker\">\n <mona-color-gradient\n [opacity]=\"opacity()\"\n [rounded]=\"rounded()\"\n [disabled]=\"disabled() || readonly()\"\n [value]=\"value()\"\n (valueChange)=\"onColorGradientValueChange($event)\"\n (touch)=\"onColorGradientTouch()\"\n (apply)=\"onColorGradientApply()\"\n (cancel)=\"onColorGradientCancel()\"></mona-color-gradient>\n </div>\n }\n</ng-template>\n" }]
|
|
495
|
+
}], propDecorators: { popupTemplate: [{ type: i0.ViewChild, args: ["popupTemplate", { isSignal: true }] }], valueTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => ColorPickerValueTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }], closeOnSelect: [{ type: i0.Input, args: [{ isSignal: true, alias: "closeOnSelect", 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 }] }], opacity: [{ type: i0.Input, args: [{ isSignal: true, alias: "opacity", 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 }] }], showClearButton: [{ type: i0.Input, args: [{ isSignal: true, alias: "showClearButton", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", 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"] }], view: [{ type: i0.Input, args: [{ isSignal: true, alias: "view", required: false }] }] } });
|
|
480
496
|
|
|
481
497
|
/*
|
|
482
498
|
* Public API Surface of @nanahoshi/mona-ui/color-picker
|
|
@@ -486,5 +502,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
486
502
|
* Generated bundle index. Do not edit.
|
|
487
503
|
*/
|
|
488
504
|
|
|
489
|
-
export { ColorPickerComponent, ColorPickerValueTemplateDirective };
|
|
505
|
+
export { COLOR_PICKER_DEFAULT_MESSAGES, ColorPickerComponent, ColorPickerValueTemplateDirective };
|
|
490
506
|
//# sourceMappingURL=nanahoshi-mona-ui-color-picker.mjs.map
|