shirkasoft-ui-components 1.3.8 → 1.3.10
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 +60 -14
- package/fesm2022/shirkasoft-ui-components-button.mjs +2 -2
- package/fesm2022/shirkasoft-ui-components-button.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-confirm-dialog.mjs +2 -2
- package/fesm2022/shirkasoft-ui-components-confirm-dialog.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-date-picker.mjs +206 -15
- package/fesm2022/shirkasoft-ui-components-date-picker.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-file-upload.mjs +2 -2
- package/fesm2022/shirkasoft-ui-components-file-upload.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-loading.mjs +2 -2
- package/fesm2022/shirkasoft-ui-components-loading.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-modal.mjs +2 -2
- package/fesm2022/shirkasoft-ui-components-modal.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-notification.mjs +2 -2
- package/fesm2022/shirkasoft-ui-components-notification.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-price-input.mjs +37 -2
- package/fesm2022/shirkasoft-ui-components-price-input.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-select.mjs +15 -5
- package/fesm2022/shirkasoft-ui-components-select.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-table.mjs +200 -13
- package/fesm2022/shirkasoft-ui-components-table.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-tabs.mjs +7 -12
- package/fesm2022/shirkasoft-ui-components-tabs.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-tag.mjs +3 -3
- package/fesm2022/shirkasoft-ui-components-tag.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-text-field.mjs +2 -2
- package/fesm2022/shirkasoft-ui-components-text-field.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-toggle.mjs +61 -24
- package/fesm2022/shirkasoft-ui-components-toggle.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-utils.mjs +62 -1
- package/fesm2022/shirkasoft-ui-components-utils.mjs.map +1 -1
- package/package.json +1 -1
- package/src/theme.css +89 -0
- package/types/shirkasoft-ui-components-date-picker.d.ts +42 -2
- package/types/shirkasoft-ui-components-price-input.d.ts +10 -0
- package/types/shirkasoft-ui-components-select.d.ts +2 -0
- package/types/shirkasoft-ui-components-table.d.ts +86 -9
- package/types/shirkasoft-ui-components-toggle.d.ts +7 -1
- package/types/shirkasoft-ui-components-utils.d.ts +44 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { input, output, signal, effect, forwardRef, Component } from '@angular/core';
|
|
2
|
+
import { input, output, signal, computed, effect, forwardRef, Component } from '@angular/core';
|
|
3
3
|
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
4
4
|
import { CommonModule } from '@angular/common';
|
|
5
5
|
|
|
@@ -22,10 +22,14 @@ class ToggleComponent {
|
|
|
22
22
|
this.checked = input(undefined, ...(ngDevMode ? [{ debugName: "checked" }] : /* istanbul ignore next */ []));
|
|
23
23
|
/** Emitted with the new value when the user toggles the control. */
|
|
24
24
|
this.checkedChange = output();
|
|
25
|
+
/** Disables the control (also settable through reactive forms). */
|
|
26
|
+
this.disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
25
27
|
/** Internal controlled/reactive value. */
|
|
26
28
|
this._value = signal(false, ...(ngDevMode ? [{ debugName: "_value" }] : /* istanbul ignore next */ []));
|
|
27
29
|
/** Reactive disabled state. */
|
|
28
30
|
this._disabled = signal(false, ...(ngDevMode ? [{ debugName: "_disabled" }] : /* istanbul ignore next */ []));
|
|
31
|
+
/** Disabled through the `disabled` input or the form control. */
|
|
32
|
+
this.isDisabled = computed(() => this.disabled() || this._disabled(), ...(ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []));
|
|
29
33
|
/** Callback notified with the new value on change (ControlValueAccessor). */
|
|
30
34
|
this.onChange = () => { };
|
|
31
35
|
/** Callback notified when the control loses focus or is touched. */
|
|
@@ -57,8 +61,15 @@ class ToggleComponent {
|
|
|
57
61
|
* Inverts the current value (unless disabled), notifies the form control,
|
|
58
62
|
* marks the control as touched and emits `checkedChange`.
|
|
59
63
|
*/
|
|
64
|
+
/** Space/Enter toggles the focused switch or checkbox. */
|
|
65
|
+
onKeydown(event) {
|
|
66
|
+
if (event.key === ' ' || event.key === 'Enter') {
|
|
67
|
+
event.preventDefault();
|
|
68
|
+
this.toggle();
|
|
69
|
+
}
|
|
70
|
+
}
|
|
60
71
|
toggle() {
|
|
61
|
-
if (this.
|
|
72
|
+
if (this.isDisabled())
|
|
62
73
|
return;
|
|
63
74
|
const newValue = !this._value();
|
|
64
75
|
this._value.set(newValue);
|
|
@@ -67,7 +78,7 @@ class ToggleComponent {
|
|
|
67
78
|
this.checkedChange.emit(newValue);
|
|
68
79
|
}
|
|
69
80
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: ToggleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
70
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.23", type: ToggleComponent, isStandalone: true, selector: "shk-toggle", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: false, transformFunction: null }, checked: { classPropertyName: "checked", publicName: "checked", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { checkedChange: "checkedChange" }, providers: [
|
|
81
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.23", type: ToggleComponent, isStandalone: true, selector: "shk-toggle", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: false, transformFunction: null }, checked: { classPropertyName: "checked", publicName: "checked", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { checkedChange: "checkedChange" }, providers: [
|
|
71
82
|
{
|
|
72
83
|
provide: NG_VALUE_ACCESSOR,
|
|
73
84
|
useExisting: forwardRef(() => ToggleComponent),
|
|
@@ -77,11 +88,21 @@ class ToggleComponent {
|
|
|
77
88
|
<div class="relative">
|
|
78
89
|
<label
|
|
79
90
|
class="inline-flex items-center gap-3 cursor-pointer select-none"
|
|
80
|
-
[class.opacity-50]="
|
|
81
|
-
[class.cursor-not-allowed]="
|
|
91
|
+
[class.opacity-50]="isDisabled()"
|
|
92
|
+
[class.cursor-not-allowed]="isDisabled()"
|
|
93
|
+
[class.shk-toggle-disabled]="isDisabled()"
|
|
82
94
|
>
|
|
83
95
|
@if (mode() === 'toggle') {
|
|
84
|
-
<div
|
|
96
|
+
<div
|
|
97
|
+
class="shk-toggle-control relative flex-shrink-0 rounded-full"
|
|
98
|
+
role="switch"
|
|
99
|
+
[attr.aria-checked]="_value()"
|
|
100
|
+
[attr.aria-disabled]="isDisabled() || null"
|
|
101
|
+
[attr.aria-label]="label() || null"
|
|
102
|
+
[attr.tabindex]="isDisabled() ? -1 : 0"
|
|
103
|
+
(keydown)="onKeydown($event)"
|
|
104
|
+
(click)="toggle()"
|
|
105
|
+
>
|
|
85
106
|
<div
|
|
86
107
|
class="w-10 h-6 rounded-full transition-colors duration-200"
|
|
87
108
|
[class._shk-bg-primary]="_value()"
|
|
@@ -89,13 +110,19 @@ class ToggleComponent {
|
|
|
89
110
|
[class._shk-dark-bg-surface-600]="!_value()"
|
|
90
111
|
></div>
|
|
91
112
|
<div
|
|
92
|
-
class="absolute top-0.5 left-0.5 w-5 h-5 _shk-bg-white rounded-full shadow transition-transform duration-200"
|
|
113
|
+
class="shk-toggle-thumb absolute top-0.5 left-0.5 w-5 h-5 _shk-bg-white rounded-full shadow transition-transform duration-200"
|
|
93
114
|
[class.translate-x-4]="_value()"
|
|
94
115
|
></div>
|
|
95
116
|
</div>
|
|
96
117
|
} @else {
|
|
97
118
|
<div
|
|
98
|
-
class="flex-shrink-0 w-4 h-4 rounded border-2 transition-colors duration-200 flex items-center justify-center"
|
|
119
|
+
class="shk-toggle-control shk-toggle-box flex-shrink-0 w-4 h-4 rounded border-2 transition-colors duration-200 flex items-center justify-center"
|
|
120
|
+
role="checkbox"
|
|
121
|
+
[attr.aria-checked]="_value()"
|
|
122
|
+
[attr.aria-disabled]="isDisabled() || null"
|
|
123
|
+
[attr.aria-label]="label() || null"
|
|
124
|
+
[attr.tabindex]="isDisabled() ? -1 : 0"
|
|
125
|
+
(keydown)="onKeydown($event)"
|
|
99
126
|
[class._shk-bg-primary]="_value()"
|
|
100
127
|
[class._shk-border-primary]="_value()"
|
|
101
128
|
[class._shk-border-surface-300]="!_value()"
|
|
@@ -116,23 +143,29 @@ class ToggleComponent {
|
|
|
116
143
|
}
|
|
117
144
|
</label>
|
|
118
145
|
</div>
|
|
119
|
-
`, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }] }); }
|
|
146
|
+
`, isInline: true, styles: [".shk-toggle-control{outline:none;transition:box-shadow .15s ease}.shk-toggle-control:focus-visible{box-shadow:0 0 0 3px color-mix(in srgb,var(--shk-primary-500) 30%,transparent)}.shk-toggle-box{border-radius:.3rem}label:not(.shk-toggle-disabled):hover .shk-toggle-box[aria-checked=false]{border-color:var(--shk-primary-400)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }] }); }
|
|
120
147
|
}
|
|
121
148
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: ToggleComponent, decorators: [{
|
|
122
149
|
type: Component,
|
|
123
|
-
args: [{
|
|
124
|
-
selector: 'shk-toggle',
|
|
125
|
-
standalone: true,
|
|
126
|
-
imports: [CommonModule],
|
|
127
|
-
template: `
|
|
150
|
+
args: [{ selector: 'shk-toggle', standalone: true, imports: [CommonModule], template: `
|
|
128
151
|
<div class="relative">
|
|
129
152
|
<label
|
|
130
153
|
class="inline-flex items-center gap-3 cursor-pointer select-none"
|
|
131
|
-
[class.opacity-50]="
|
|
132
|
-
[class.cursor-not-allowed]="
|
|
154
|
+
[class.opacity-50]="isDisabled()"
|
|
155
|
+
[class.cursor-not-allowed]="isDisabled()"
|
|
156
|
+
[class.shk-toggle-disabled]="isDisabled()"
|
|
133
157
|
>
|
|
134
158
|
@if (mode() === 'toggle') {
|
|
135
|
-
<div
|
|
159
|
+
<div
|
|
160
|
+
class="shk-toggle-control relative flex-shrink-0 rounded-full"
|
|
161
|
+
role="switch"
|
|
162
|
+
[attr.aria-checked]="_value()"
|
|
163
|
+
[attr.aria-disabled]="isDisabled() || null"
|
|
164
|
+
[attr.aria-label]="label() || null"
|
|
165
|
+
[attr.tabindex]="isDisabled() ? -1 : 0"
|
|
166
|
+
(keydown)="onKeydown($event)"
|
|
167
|
+
(click)="toggle()"
|
|
168
|
+
>
|
|
136
169
|
<div
|
|
137
170
|
class="w-10 h-6 rounded-full transition-colors duration-200"
|
|
138
171
|
[class._shk-bg-primary]="_value()"
|
|
@@ -140,13 +173,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.23", ngImpo
|
|
|
140
173
|
[class._shk-dark-bg-surface-600]="!_value()"
|
|
141
174
|
></div>
|
|
142
175
|
<div
|
|
143
|
-
class="absolute top-0.5 left-0.5 w-5 h-5 _shk-bg-white rounded-full shadow transition-transform duration-200"
|
|
176
|
+
class="shk-toggle-thumb absolute top-0.5 left-0.5 w-5 h-5 _shk-bg-white rounded-full shadow transition-transform duration-200"
|
|
144
177
|
[class.translate-x-4]="_value()"
|
|
145
178
|
></div>
|
|
146
179
|
</div>
|
|
147
180
|
} @else {
|
|
148
181
|
<div
|
|
149
|
-
class="flex-shrink-0 w-4 h-4 rounded border-2 transition-colors duration-200 flex items-center justify-center"
|
|
182
|
+
class="shk-toggle-control shk-toggle-box flex-shrink-0 w-4 h-4 rounded border-2 transition-colors duration-200 flex items-center justify-center"
|
|
183
|
+
role="checkbox"
|
|
184
|
+
[attr.aria-checked]="_value()"
|
|
185
|
+
[attr.aria-disabled]="isDisabled() || null"
|
|
186
|
+
[attr.aria-label]="label() || null"
|
|
187
|
+
[attr.tabindex]="isDisabled() ? -1 : 0"
|
|
188
|
+
(keydown)="onKeydown($event)"
|
|
150
189
|
[class._shk-bg-primary]="_value()"
|
|
151
190
|
[class._shk-border-primary]="_value()"
|
|
152
191
|
[class._shk-border-surface-300]="!_value()"
|
|
@@ -167,16 +206,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.23", ngImpo
|
|
|
167
206
|
}
|
|
168
207
|
</label>
|
|
169
208
|
</div>
|
|
170
|
-
`,
|
|
171
|
-
providers: [
|
|
209
|
+
`, providers: [
|
|
172
210
|
{
|
|
173
211
|
provide: NG_VALUE_ACCESSOR,
|
|
174
212
|
useExisting: forwardRef(() => ToggleComponent),
|
|
175
213
|
multi: true,
|
|
176
214
|
},
|
|
177
|
-
],
|
|
178
|
-
|
|
179
|
-
}], ctorParameters: () => [], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], mode: [{ type: i0.Input, args: [{ isSignal: true, alias: "mode", required: false }] }], checked: [{ type: i0.Input, args: [{ isSignal: true, alias: "checked", required: false }] }], checkedChange: [{ type: i0.Output, args: ["checkedChange"] }] } });
|
|
215
|
+
], styles: [".shk-toggle-control{outline:none;transition:box-shadow .15s ease}.shk-toggle-control:focus-visible{box-shadow:0 0 0 3px color-mix(in srgb,var(--shk-primary-500) 30%,transparent)}.shk-toggle-box{border-radius:.3rem}label:not(.shk-toggle-disabled):hover .shk-toggle-box[aria-checked=false]{border-color:var(--shk-primary-400)}\n"] }]
|
|
216
|
+
}], ctorParameters: () => [], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], mode: [{ type: i0.Input, args: [{ isSignal: true, alias: "mode", required: false }] }], checked: [{ type: i0.Input, args: [{ isSignal: true, alias: "checked", required: false }] }], checkedChange: [{ type: i0.Output, args: ["checkedChange"] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }] } });
|
|
180
217
|
|
|
181
218
|
/**
|
|
182
219
|
* Generated bundle index. Do not edit.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shirkasoft-ui-components-toggle.mjs","sources":["../../../projects/ui-components/toggle/toggle.component.ts","../../../projects/ui-components/toggle/shirkasoft-ui-components-toggle.ts"],"sourcesContent":["import { Component, forwardRef, input, output, signal, effect } from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { CommonModule } from '@angular/common';\n\n/**\n * Shirkasoft UI Components.\n * Authors: Roberto Valladares Martin (Ansem13), Julio César García García (Sanjuli14).\n * Belongs to Shirkasoft.\n */\n\n/**\n * Switch / checkbox component that implements ControlValueAccessor so it can\n * be used with reactive and template-driven forms.\n */\n@Component({\n selector: 'shk-toggle',\n standalone: true,\n imports: [CommonModule],\n template: `\n <div class=\"relative\">\n <label\n class=\"inline-flex items-center gap-3 cursor-pointer select-none\"\n [class.opacity-50]=\"
|
|
1
|
+
{"version":3,"file":"shirkasoft-ui-components-toggle.mjs","sources":["../../../projects/ui-components/toggle/toggle.component.ts","../../../projects/ui-components/toggle/shirkasoft-ui-components-toggle.ts"],"sourcesContent":["import { Component, forwardRef, input, output, signal, effect, computed } from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { CommonModule } from '@angular/common';\n\n/**\n * Shirkasoft UI Components.\n * Authors: Roberto Valladares Martin (Ansem13), Julio César García García (Sanjuli14).\n * Belongs to Shirkasoft.\n */\n\n/**\n * Switch / checkbox component that implements ControlValueAccessor so it can\n * be used with reactive and template-driven forms.\n */\n@Component({\n selector: 'shk-toggle',\n standalone: true,\n imports: [CommonModule],\n template: `\n <div class=\"relative\">\n <label\n class=\"inline-flex items-center gap-3 cursor-pointer select-none\"\n [class.opacity-50]=\"isDisabled()\"\n [class.cursor-not-allowed]=\"isDisabled()\"\n [class.shk-toggle-disabled]=\"isDisabled()\"\n >\n @if (mode() === 'toggle') {\n <div\n class=\"shk-toggle-control relative flex-shrink-0 rounded-full\"\n role=\"switch\"\n [attr.aria-checked]=\"_value()\"\n [attr.aria-disabled]=\"isDisabled() || null\"\n [attr.aria-label]=\"label() || null\"\n [attr.tabindex]=\"isDisabled() ? -1 : 0\"\n (keydown)=\"onKeydown($event)\"\n (click)=\"toggle()\"\n >\n <div\n class=\"w-10 h-6 rounded-full transition-colors duration-200\"\n [class._shk-bg-primary]=\"_value()\"\n [class._shk-bg-surface-300]=\"!_value()\"\n [class._shk-dark-bg-surface-600]=\"!_value()\"\n ></div>\n <div\n class=\"shk-toggle-thumb absolute top-0.5 left-0.5 w-5 h-5 _shk-bg-white rounded-full shadow transition-transform duration-200\"\n [class.translate-x-4]=\"_value()\"\n ></div>\n </div>\n } @else {\n <div\n class=\"shk-toggle-control shk-toggle-box flex-shrink-0 w-4 h-4 rounded border-2 transition-colors duration-200 flex items-center justify-center\"\n role=\"checkbox\"\n [attr.aria-checked]=\"_value()\"\n [attr.aria-disabled]=\"isDisabled() || null\"\n [attr.aria-label]=\"label() || null\"\n [attr.tabindex]=\"isDisabled() ? -1 : 0\"\n (keydown)=\"onKeydown($event)\"\n [class._shk-bg-primary]=\"_value()\"\n [class._shk-border-primary]=\"_value()\"\n [class._shk-border-surface-300]=\"!_value()\"\n [class._shk-dark-border-surface-600]=\"!_value()\"\n (click)=\"toggle()\"\n >\n @if (_value()) {\n <svg class=\"w-3 h-3 text-white\" viewBox=\"0 0 12 12\" fill=\"none\">\n <path d=\"M2 6l3 3 5-5\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n </svg>\n }\n </div>\n }\n @if (label()) {\n <span class=\"text-sm _shk-text-surface-700 _shk-dark-text-surface-300\">\n {{ label() }}\n </span>\n }\n </label>\n </div>\n `,\n styles: [\n `\n .shk-toggle-control {\n outline: none;\n transition: box-shadow 0.15s ease;\n }\n .shk-toggle-control:focus-visible {\n box-shadow: 0 0 0 3px color-mix(in srgb, var(--shk-primary-500) 30%, transparent);\n }\n .shk-toggle-box {\n border-radius: 0.3rem;\n }\n label:not(.shk-toggle-disabled):hover .shk-toggle-box[aria-checked='false'] {\n border-color: var(--shk-primary-400);\n }\n `,\n ],\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => ToggleComponent),\n multi: true,\n },\n ],\n})\nexport class ToggleComponent implements ControlValueAccessor {\n /** Text displayed next to the control. */\n label = input<string>('');\n /** Visual style: 'toggle' (switch) or 'checkbox'. Defaults to 'toggle'. */\n mode = input<'toggle' | 'checkbox'>('toggle');\n /** Manually controlled checked state (supports one-way binding). */\n checked = input<boolean | undefined>(undefined);\n /** Emitted with the new value when the user toggles the control. */\n checkedChange = output<boolean>();\n /** Disables the control (also settable through reactive forms). */\n disabled = input<boolean>(false);\n\n /** Internal controlled/reactive value. */\n _value = signal(false);\n /** Reactive disabled state. */\n _disabled = signal(false);\n /** Disabled through the `disabled` input or the form control. */\n isDisabled = computed(() => this.disabled() || this._disabled());\n\n /** Callback notified with the new value on change (ControlValueAccessor). */\n private onChange: (value: boolean) => void = () => {};\n\n /** Callback notified when the control loses focus or is touched. */\n private onTouched: () => void = () => {};\n\n constructor() {\n effect(() => {\n const manual = this.checked();\n if (manual !== undefined) {\n this._value.set(manual);\n }\n });\n }\n\n /** Sets the value from the form control. */\n writeValue(value: any): void {\n this._value.set(!!value);\n }\n\n /** Registers the callback invoked on value changes (ControlValueAccessor). */\n registerOnChange(fn: any): void {\n this.onChange = fn;\n }\n\n /** Registers the callback invoked when the control is touched. */\n registerOnTouched(fn: any): void {\n this.onTouched = fn;\n }\n\n /** Reflects the disabled state of the form control. */\n setDisabledState(isDisabled: boolean): void {\n this._disabled.set(isDisabled);\n }\n\n /**\n * Inverts the current value (unless disabled), notifies the form control,\n * marks the control as touched and emits `checkedChange`.\n */\n /** Space/Enter toggles the focused switch or checkbox. */\n onKeydown(event: KeyboardEvent): void {\n if (event.key === ' ' || event.key === 'Enter') {\n event.preventDefault();\n this.toggle();\n }\n }\n\n toggle(): void {\n if (this.isDisabled()) return;\n const newValue = !this._value();\n this._value.set(newValue);\n this.onChange(newValue);\n this.onTouched();\n this.checkedChange.emit(newValue);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAIA;;;;AAIG;AAEH;;;AAGG;MA0FU,eAAe,CAAA;AAyB1B,IAAA,WAAA,GAAA;;AAvBA,QAAA,IAAA,CAAA,KAAK,GAAG,KAAK,CAAS,EAAE,4EAAC;;AAEzB,QAAA,IAAA,CAAA,IAAI,GAAG,KAAK,CAAwB,QAAQ,2EAAC;;AAE7C,QAAA,IAAA,CAAA,OAAO,GAAG,KAAK,CAAsB,SAAS,8EAAC;;QAE/C,IAAA,CAAA,aAAa,GAAG,MAAM,EAAW;;AAEjC,QAAA,IAAA,CAAA,QAAQ,GAAG,KAAK,CAAU,KAAK,+EAAC;;AAGhC,QAAA,IAAA,CAAA,MAAM,GAAG,MAAM,CAAC,KAAK,6EAAC;;AAEtB,QAAA,IAAA,CAAA,SAAS,GAAG,MAAM,CAAC,KAAK,gFAAC;;AAEzB,QAAA,IAAA,CAAA,UAAU,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,QAAQ,EAAE,IAAI,IAAI,CAAC,SAAS,EAAE,iFAAC;;AAGxD,QAAA,IAAA,CAAA,QAAQ,GAA6B,MAAK,EAAE,CAAC;;AAG7C,QAAA,IAAA,CAAA,SAAS,GAAe,MAAK,EAAE,CAAC;QAGt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A,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EA5DS,YAAY,EAAA,CAAA,EAAA,CAAA,CAAA;;4FAsFX,eAAe,EAAA,UAAA,EAAA,CAAA;kBAzF3B,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,YAAY,cACV,IAAI,EAAA,OAAA,EACP,CAAC,YAAY,CAAC,EAAA,QAAA,EACb;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DT,EAAA,SAAA,EAkBU;AACT,wBAAA;AACE,4BAAA,OAAO,EAAE,iBAAiB;AAC1B,4BAAA,WAAW,EAAE,UAAU,CAAC,qBAAqB,CAAC;AAC9C,4BAAA,KAAK,EAAE,IAAI;AACZ,yBAAA;AACF,qBAAA,EAAA,MAAA,EAAA,CAAA,wUAAA,CAAA,EAAA;;;ACrGH;;AAEG;;;;"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { LucideX, LucideUpload, LucideTriangleAlert, LucideTrash2, LucideSearch, LucideRefreshCw, LucidePlus, LucidePanelRight, LucideMinimize2, LucideMenu, LucideMaximize2, LucideLogOut, LucideLoaderCircle, LucideLoader, LucideInfo, LucideInbox, LucideGlobe, LucideFunnel, LucideFileText, LucideFileSpreadsheet, LucideFile, LucideEyeOff, LucideEye, LucideEllipsisVertical, LucideDownload, LucideCirclePlus, LucideCircleQuestionMark, LucideChevronsRight, LucideChevronsLeft, LucideChevronRight, LucideChevronLeft, LucideChevronDown, LucideCalendarDays, LucideCheck, LucideArrowUpDown, LucideArrowUp, LucideArrowDown, LucideArrowLeft } from '@lucide/angular';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { inject, ElementRef, afterNextRender, DestroyRef, Directive } from '@angular/core';
|
|
2
4
|
|
|
3
5
|
/**
|
|
4
6
|
* Shirkasoft UI Components.
|
|
@@ -62,9 +64,68 @@ function getIcon(icon, fallback = LucideCircleQuestionMark) {
|
|
|
62
64
|
return fallback;
|
|
63
65
|
}
|
|
64
66
|
|
|
67
|
+
/**
|
|
68
|
+
* Shirkasoft UI Components.
|
|
69
|
+
* Authors: Roberto Valladares Martin (Ansem13), Julio César García García (Sanjuli14).
|
|
70
|
+
* Belongs to Shirkasoft.
|
|
71
|
+
*/
|
|
72
|
+
/**
|
|
73
|
+
* Moves a floating element (dropdown panel, popup, overlay) to `document.body`
|
|
74
|
+
* so it always renders above the rest of the page.
|
|
75
|
+
*
|
|
76
|
+
* `position: fixed` + a high `z-index` is not enough on its own: an ancestor
|
|
77
|
+
* with `transform`, `filter`, `backdrop-filter`, `contain`, or its own stacking
|
|
78
|
+
* context (`z-index` + `position`, `sticky`, `opacity < 1`...) traps the element
|
|
79
|
+
* inside it. Rendering it as a direct child of `body` avoids all of that.
|
|
80
|
+
*
|
|
81
|
+
* The element keeps being managed by Angular (bindings and listeners keep
|
|
82
|
+
* working, and Angular removes it with `node.remove()` when it is hidden).
|
|
83
|
+
* If the anchor lives inside a `.dark` container, the class is copied onto the
|
|
84
|
+
* element so the dark theme (CSS variables, Tailwind `dark:` variants and
|
|
85
|
+
* component `.dark .x` rules) still applies once it is outside the host.
|
|
86
|
+
*
|
|
87
|
+
* Returns a function that removes the element from the DOM; call it when the
|
|
88
|
+
* owner component is destroyed so the element does not stay orphaned in `body`.
|
|
89
|
+
*/
|
|
90
|
+
function portalToBody(element, anchor) {
|
|
91
|
+
const doc = element.ownerDocument;
|
|
92
|
+
if (element.parentNode !== doc.body) {
|
|
93
|
+
doc.body.appendChild(element);
|
|
94
|
+
}
|
|
95
|
+
element.classList.toggle('dark', !!anchor?.closest('.dark'));
|
|
96
|
+
return () => element.remove();
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Renders the host element in `document.body` (see `portalToBody`) once it is
|
|
100
|
+
* rendered, and removes it when the element or its owner is destroyed.
|
|
101
|
+
*
|
|
102
|
+
* ```html
|
|
103
|
+
* @if (isOpen()) {
|
|
104
|
+
* <div shkPortal class="fixed z-[9999]" [style.top.px]="top">...</div>
|
|
105
|
+
* }
|
|
106
|
+
* ```
|
|
107
|
+
*/
|
|
108
|
+
class PortalDirective {
|
|
109
|
+
constructor() {
|
|
110
|
+
this.el = inject(ElementRef);
|
|
111
|
+
let remove = null;
|
|
112
|
+
afterNextRender(() => {
|
|
113
|
+
const node = this.el.nativeElement;
|
|
114
|
+
remove = portalToBody(node, node.parentElement);
|
|
115
|
+
});
|
|
116
|
+
inject(DestroyRef).onDestroy(() => remove?.());
|
|
117
|
+
}
|
|
118
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: PortalDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
119
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.23", type: PortalDirective, isStandalone: true, selector: "[shkPortal]", ngImport: i0 }); }
|
|
120
|
+
}
|
|
121
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: PortalDirective, decorators: [{
|
|
122
|
+
type: Directive,
|
|
123
|
+
args: [{ selector: '[shkPortal]', standalone: true }]
|
|
124
|
+
}], ctorParameters: () => [] });
|
|
125
|
+
|
|
65
126
|
/**
|
|
66
127
|
* Generated bundle index. Do not edit.
|
|
67
128
|
*/
|
|
68
129
|
|
|
69
|
-
export { ICONS, getIcon };
|
|
130
|
+
export { ICONS, PortalDirective, getIcon, portalToBody };
|
|
70
131
|
//# sourceMappingURL=shirkasoft-ui-components-utils.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shirkasoft-ui-components-utils.mjs","sources":["../../../projects/ui-components/utils/icons.ts","../../../projects/ui-components/utils/shirkasoft-ui-components-utils.ts"],"sourcesContent":["/**\n * Shirkasoft UI Components.\n * Authors: Roberto Valladares Martin (Ansem13), Julio César García García (Sanjuli14).\n * Belongs to Shirkasoft.\n */\nimport {\n LucideArrowDown,\n LucideArrowLeft,\n LucideArrowUp,\n LucideArrowUpDown,\n LucideCalendarDays,\n LucideCheck,\n LucideChevronDown,\n LucideChevronLeft,\n LucideChevronRight,\n LucideChevronsLeft,\n LucideChevronsRight,\n LucideCircleQuestionMark,\n LucideCirclePlus,\n LucideDownload,\n LucideEllipsisVertical,\n LucideEye,\n LucideEyeOff,\n LucideFile,\n LucideFileSpreadsheet,\n LucideFileText,\n LucideFunnel,\n LucideGlobe,\n LucideInbox,\n LucideInfo,\n LucideLoader,\n LucideLoaderCircle,\n LucideLogOut,\n LucideMaximize2,\n LucideMenu,\n LucideMinimize2,\n LucidePanelRight,\n LucidePlus,\n LucideRefreshCw,\n LucideSearch,\n LucideTrash2,\n LucideTriangleAlert,\n LucideUpload,\n LucideX,\n} from '@lucide/angular';\n\n/** Maps the icon names used across the library to their Lucide component. */\nexport const ICONS: Record<string, any> = {\n 'arrow-left': LucideArrowLeft,\n 'arrow-down': LucideArrowDown,\n 'arrow-up': LucideArrowUp,\n 'arrow-up-down': LucideArrowUpDown,\n check: LucideCheck,\n 'calendar-days': LucideCalendarDays,\n 'chevron-down': LucideChevronDown,\n 'chevron-left': LucideChevronLeft,\n 'chevron-right': LucideChevronRight,\n 'chevrons-left': LucideChevronsLeft,\n 'chevrons-right': LucideChevronsRight,\n 'circle-help': LucideCircleQuestionMark,\n 'circle-plus': LucideCirclePlus,\n download: LucideDownload,\n 'ellipsis-vertical': LucideEllipsisVertical,\n eye: LucideEye,\n 'eye-off': LucideEyeOff,\n file: LucideFile,\n 'file-spreadsheet': LucideFileSpreadsheet,\n 'file-text': LucideFileText,\n filter: LucideFunnel,\n globe: LucideGlobe,\n inbox: LucideInbox,\n info: LucideInfo,\n loader: LucideLoader,\n 'loader-circle': LucideLoaderCircle,\n 'log-out': LucideLogOut,\n 'maximize-2': LucideMaximize2,\n menu: LucideMenu,\n 'minimize-2': LucideMinimize2,\n 'panel-right': LucidePanelRight,\n plus: LucidePlus,\n refresh: LucideRefreshCw,\n search: LucideSearch,\n 'trash-2': LucideTrash2,\n 'triangle-alert': LucideTriangleAlert,\n upload: LucideUpload,\n x: LucideX,\n};\n\n/**\n * Resolves the icon passed to a component into a lucide component.\n * Accepts a registered string name, an existing lucide component or a LucideIconData object.\n */\nexport function getIcon(icon?: any, fallback: any = LucideCircleQuestionMark): any {\n if (!icon) return null;\n if (typeof icon === 'string') {\n return ICONS[icon] ?? fallback;\n }\n if (typeof icon === 'function') {\n return icon;\n }\n return fallback;\n}","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"shirkasoft-ui-components-utils.mjs","sources":["../../../projects/ui-components/utils/icons.ts","../../../projects/ui-components/utils/portal.ts","../../../projects/ui-components/utils/shirkasoft-ui-components-utils.ts"],"sourcesContent":["/**\n * Shirkasoft UI Components.\n * Authors: Roberto Valladares Martin (Ansem13), Julio César García García (Sanjuli14).\n * Belongs to Shirkasoft.\n */\nimport {\n LucideArrowDown,\n LucideArrowLeft,\n LucideArrowUp,\n LucideArrowUpDown,\n LucideCalendarDays,\n LucideCheck,\n LucideChevronDown,\n LucideChevronLeft,\n LucideChevronRight,\n LucideChevronsLeft,\n LucideChevronsRight,\n LucideCircleQuestionMark,\n LucideCirclePlus,\n LucideDownload,\n LucideEllipsisVertical,\n LucideEye,\n LucideEyeOff,\n LucideFile,\n LucideFileSpreadsheet,\n LucideFileText,\n LucideFunnel,\n LucideGlobe,\n LucideInbox,\n LucideInfo,\n LucideLoader,\n LucideLoaderCircle,\n LucideLogOut,\n LucideMaximize2,\n LucideMenu,\n LucideMinimize2,\n LucidePanelRight,\n LucidePlus,\n LucideRefreshCw,\n LucideSearch,\n LucideTrash2,\n LucideTriangleAlert,\n LucideUpload,\n LucideX,\n} from '@lucide/angular';\n\n/** Maps the icon names used across the library to their Lucide component. */\nexport const ICONS: Record<string, any> = {\n 'arrow-left': LucideArrowLeft,\n 'arrow-down': LucideArrowDown,\n 'arrow-up': LucideArrowUp,\n 'arrow-up-down': LucideArrowUpDown,\n check: LucideCheck,\n 'calendar-days': LucideCalendarDays,\n 'chevron-down': LucideChevronDown,\n 'chevron-left': LucideChevronLeft,\n 'chevron-right': LucideChevronRight,\n 'chevrons-left': LucideChevronsLeft,\n 'chevrons-right': LucideChevronsRight,\n 'circle-help': LucideCircleQuestionMark,\n 'circle-plus': LucideCirclePlus,\n download: LucideDownload,\n 'ellipsis-vertical': LucideEllipsisVertical,\n eye: LucideEye,\n 'eye-off': LucideEyeOff,\n file: LucideFile,\n 'file-spreadsheet': LucideFileSpreadsheet,\n 'file-text': LucideFileText,\n filter: LucideFunnel,\n globe: LucideGlobe,\n inbox: LucideInbox,\n info: LucideInfo,\n loader: LucideLoader,\n 'loader-circle': LucideLoaderCircle,\n 'log-out': LucideLogOut,\n 'maximize-2': LucideMaximize2,\n menu: LucideMenu,\n 'minimize-2': LucideMinimize2,\n 'panel-right': LucidePanelRight,\n plus: LucidePlus,\n refresh: LucideRefreshCw,\n search: LucideSearch,\n 'trash-2': LucideTrash2,\n 'triangle-alert': LucideTriangleAlert,\n upload: LucideUpload,\n x: LucideX,\n};\n\n/**\n * Resolves the icon passed to a component into a lucide component.\n * Accepts a registered string name, an existing lucide component or a LucideIconData object.\n */\nexport function getIcon(icon?: any, fallback: any = LucideCircleQuestionMark): any {\n if (!icon) return null;\n if (typeof icon === 'string') {\n return ICONS[icon] ?? fallback;\n }\n if (typeof icon === 'function') {\n return icon;\n }\n return fallback;\n}","import { Directive, DestroyRef, ElementRef, afterNextRender, inject } from '@angular/core';\n\n/**\n * Shirkasoft UI Components.\n * Authors: Roberto Valladares Martin (Ansem13), Julio César García García (Sanjuli14).\n * Belongs to Shirkasoft.\n */\n\n/**\n * Moves a floating element (dropdown panel, popup, overlay) to `document.body`\n * so it always renders above the rest of the page.\n *\n * `position: fixed` + a high `z-index` is not enough on its own: an ancestor\n * with `transform`, `filter`, `backdrop-filter`, `contain`, or its own stacking\n * context (`z-index` + `position`, `sticky`, `opacity < 1`...) traps the element\n * inside it. Rendering it as a direct child of `body` avoids all of that.\n *\n * The element keeps being managed by Angular (bindings and listeners keep\n * working, and Angular removes it with `node.remove()` when it is hidden).\n * If the anchor lives inside a `.dark` container, the class is copied onto the\n * element so the dark theme (CSS variables, Tailwind `dark:` variants and\n * component `.dark .x` rules) still applies once it is outside the host.\n *\n * Returns a function that removes the element from the DOM; call it when the\n * owner component is destroyed so the element does not stay orphaned in `body`.\n */\nexport function portalToBody(element: HTMLElement, anchor?: HTMLElement | null): () => void {\n const doc = element.ownerDocument;\n if (element.parentNode !== doc.body) {\n doc.body.appendChild(element);\n }\n element.classList.toggle('dark', !!anchor?.closest('.dark'));\n return () => element.remove();\n}\n\n/**\n * Renders the host element in `document.body` (see `portalToBody`) once it is\n * rendered, and removes it when the element or its owner is destroyed.\n *\n * ```html\n * @if (isOpen()) {\n * <div shkPortal class=\"fixed z-[9999]\" [style.top.px]=\"top\">...</div>\n * }\n * ```\n */\n@Directive({ selector: '[shkPortal]', standalone: true })\nexport class PortalDirective {\n private readonly el = inject<ElementRef<HTMLElement>>(ElementRef);\n\n constructor() {\n let remove: (() => void) | null = null;\n afterNextRender(() => {\n const node = this.el.nativeElement;\n remove = portalToBody(node, node.parentElement);\n });\n inject(DestroyRef).onDestroy(() => remove?.());\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AAAA;;;;AAIG;AA0CH;AACO,MAAM,KAAK,GAAwB;AACxC,IAAA,YAAY,EAAE,eAAe;AAC7B,IAAA,YAAY,EAAE,eAAe;AAC7B,IAAA,UAAU,EAAE,aAAa;AACzB,IAAA,eAAe,EAAE,iBAAiB;AAClC,IAAA,KAAK,EAAE,WAAW;AAClB,IAAA,eAAe,EAAE,kBAAkB;AACnC,IAAA,cAAc,EAAE,iBAAiB;AACjC,IAAA,cAAc,EAAE,iBAAiB;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AAE,UAAU,EAAE,IAAI,EAAE;;;AC7CxD;;AAEG;;;;"}
|
package/package.json
CHANGED
package/src/theme.css
CHANGED
|
@@ -460,3 +460,92 @@
|
|
|
460
460
|
._shk-scrollbar::-webkit-scrollbar-corner {
|
|
461
461
|
background: transparent;
|
|
462
462
|
}
|
|
463
|
+
|
|
464
|
+
/* ============================================================
|
|
465
|
+
Form controls (text-field, price-input, select trigger…)
|
|
466
|
+
Soft focus ring + clearly distinguishable disabled state.
|
|
467
|
+
Element-qualified selectors so they win over the Tailwind
|
|
468
|
+
utilities used in the templates regardless of import order.
|
|
469
|
+
============================================================ */
|
|
470
|
+
:root {
|
|
471
|
+
--shk-ring: color-mix(in srgb, var(--shk-primary-500) 22%, transparent);
|
|
472
|
+
--shk-ring-error: color-mix(in srgb, var(--shk-error-500) 22%, transparent);
|
|
473
|
+
}
|
|
474
|
+
input.shk-control,
|
|
475
|
+
textarea.shk-control,
|
|
476
|
+
div.shk-control {
|
|
477
|
+
transition:
|
|
478
|
+
border-color 0.15s ease,
|
|
479
|
+
box-shadow 0.15s ease,
|
|
480
|
+
background-color 0.15s ease;
|
|
481
|
+
}
|
|
482
|
+
input.shk-control:focus,
|
|
483
|
+
textarea.shk-control:focus,
|
|
484
|
+
div.shk-control:focus,
|
|
485
|
+
div.shk-control:focus-within,
|
|
486
|
+
div.shk-control.open {
|
|
487
|
+
outline: none;
|
|
488
|
+
border-color: var(--shk-primary-500);
|
|
489
|
+
box-shadow: 0 0 0 3px var(--shk-ring);
|
|
490
|
+
}
|
|
491
|
+
/* Lift the focused field over an attached button (search, currency…) so
|
|
492
|
+
the ring isn't hidden on that side. */
|
|
493
|
+
input.shk-control.shk-control-addon:focus {
|
|
494
|
+
position: relative;
|
|
495
|
+
z-index: 1;
|
|
496
|
+
}
|
|
497
|
+
/* Field whose error was just fixed keeps its green state while focused. */
|
|
498
|
+
input.shk-control.shk-control-valid:focus,
|
|
499
|
+
textarea.shk-control.shk-control-valid:focus {
|
|
500
|
+
border-color: var(--shk-success-600);
|
|
501
|
+
box-shadow: 0 0 0 3px color-mix(in srgb, var(--shk-success-600) 22%, transparent);
|
|
502
|
+
}
|
|
503
|
+
/* Invalid field (validation error): red border in every state and theme.
|
|
504
|
+
Specificity (0,2,1) beats Tailwind `dark:[border-color:…]` utilities. */
|
|
505
|
+
input.shk-control[aria-invalid='true'],
|
|
506
|
+
textarea.shk-control[aria-invalid='true'],
|
|
507
|
+
div.shk-control[aria-invalid='true'],
|
|
508
|
+
div.shk-dropzone[aria-invalid='true'],
|
|
509
|
+
div.shk-dropzone[aria-invalid='true']:hover {
|
|
510
|
+
border-color: var(--shk-error-500);
|
|
511
|
+
}
|
|
512
|
+
input.shk-control[aria-invalid='true']:focus,
|
|
513
|
+
textarea.shk-control[aria-invalid='true']:focus,
|
|
514
|
+
div.shk-control[aria-invalid='true']:focus-within,
|
|
515
|
+
div.shk-control[aria-invalid='true'].open {
|
|
516
|
+
border-color: var(--shk-error-500);
|
|
517
|
+
box-shadow: 0 0 0 3px var(--shk-ring-error);
|
|
518
|
+
}
|
|
519
|
+
input.shk-control:disabled,
|
|
520
|
+
textarea.shk-control:disabled,
|
|
521
|
+
div.shk-control.shk-control-disabled {
|
|
522
|
+
background-color: var(--shk-surface-100);
|
|
523
|
+
border-color: var(--shk-surface-200);
|
|
524
|
+
color: var(--shk-surface-500);
|
|
525
|
+
cursor: not-allowed;
|
|
526
|
+
box-shadow: none;
|
|
527
|
+
}
|
|
528
|
+
.dark input.shk-control:disabled,
|
|
529
|
+
.dark textarea.shk-control:disabled,
|
|
530
|
+
.dark div.shk-control.shk-control-disabled {
|
|
531
|
+
background-color: var(--shk-surface-50);
|
|
532
|
+
color: var(--shk-surface-400);
|
|
533
|
+
}
|
|
534
|
+
div.shk-control.shk-control-disabled * {
|
|
535
|
+
cursor: not-allowed;
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
/* ============================================================
|
|
539
|
+
Reduced motion: honour the OS setting in every component.
|
|
540
|
+
Loading indicators (spinners, dots, bars) are essential feedback
|
|
541
|
+
and keep animating, otherwise the UI looks frozen.
|
|
542
|
+
============================================================ */
|
|
543
|
+
@media (prefers-reduced-motion: reduce) {
|
|
544
|
+
[class*='shk-']:not([class*='spin']):not([class*='shk-loading']),
|
|
545
|
+
[class*='shk-']:not([class*='spin']):not([class*='shk-loading'])::before,
|
|
546
|
+
[class*='shk-']:not([class*='spin']):not([class*='shk-loading'])::after {
|
|
547
|
+
animation-duration: 0.01ms !important;
|
|
548
|
+
animation-iteration-count: 1 !important;
|
|
549
|
+
transition-duration: 0.01ms !important;
|
|
550
|
+
}
|
|
551
|
+
}
|
|
@@ -30,8 +30,10 @@ declare class DatePickerComponent implements ControlValueAccessor {
|
|
|
30
30
|
label: _angular_core.InputSignal<string>;
|
|
31
31
|
/** Placeholder of the input. */
|
|
32
32
|
placeholder: _angular_core.InputSignal<string>;
|
|
33
|
-
/** FormGroup used to resolve the control from `label
|
|
33
|
+
/** FormGroup used to resolve the control from `controlName` (or `label`). */
|
|
34
34
|
formGroup: _angular_core.InputSignal<FormGroup<any> | undefined>;
|
|
35
|
+
/** Name of the control inside `formGroup`. Takes precedence over `label`. */
|
|
36
|
+
controlName: _angular_core.InputSignal<string>;
|
|
35
37
|
/** Directly bound FormControl. */
|
|
36
38
|
control: _angular_core.InputSignal<FormControl<any> | undefined>;
|
|
37
39
|
/** Disables the picker. */
|
|
@@ -58,6 +60,15 @@ declare class DatePickerComponent implements ControlValueAccessor {
|
|
|
58
60
|
showSeconds: _angular_core.InputSignal<boolean>;
|
|
59
61
|
/** Step (in minutes) for the minute selector. */
|
|
60
62
|
minuteStep: _angular_core.InputSignal<number>;
|
|
63
|
+
/**
|
|
64
|
+
* Format of the value received from and emitted to the form control.
|
|
65
|
+
* Tokens: YYYY, MM, DD, HH, mm, ss (e.g. 'DD-MM-YYYY', 'DD/MM/YYYY HH:mm').
|
|
66
|
+
* Empty (default) keeps the ISO format ('YYYY-MM-DD', 'YYYY-MM', 'YYYY',
|
|
67
|
+
* 'YYYY-MM-DDTHH:mm', 'HH:mm').
|
|
68
|
+
*/
|
|
69
|
+
valueFormat: _angular_core.InputSignal<string>;
|
|
70
|
+
/** Overlay (backdrop + calendar), rendered in <body> while open (shkPortal). */
|
|
71
|
+
private overlay;
|
|
61
72
|
/** Whether the dropdown calendar is open. */
|
|
62
73
|
isOpen: _angular_core.WritableSignal<boolean>;
|
|
63
74
|
/** Year currently displayed in the calendar. */
|
|
@@ -298,11 +309,40 @@ declare class DatePickerComponent implements ControlValueAccessor {
|
|
|
298
309
|
isSelectedYear(year: number): boolean;
|
|
299
310
|
isCurrentYear(year: number): boolean;
|
|
300
311
|
writeValue(value: any): void;
|
|
312
|
+
/**
|
|
313
|
+
* Normalizes an incoming value to the internal ISO string format expected
|
|
314
|
+
* for the current configuration:
|
|
315
|
+
* - date/week: "YYYY-MM-DD" (or "YYYY-MM-DDTHH:mm[:ss]" with showTime)
|
|
316
|
+
* - month: "YYYY-MM"
|
|
317
|
+
* - year: "YYYY"
|
|
318
|
+
* - timeOnly: "HH:mm[:ss]"
|
|
319
|
+
*
|
|
320
|
+
* Accepts ISO strings, `Date` objects, timestamps and day-first strings
|
|
321
|
+
* ("DD-MM-YYYY", "DD/MM/YYYY", "DD.MM.YYYY"; month-first when locale is
|
|
322
|
+
* 'en'). Values that cannot be interpreted are discarded (returns null)
|
|
323
|
+
* instead of breaking the formatted label.
|
|
324
|
+
*/
|
|
325
|
+
private normalizeValue;
|
|
326
|
+
/** Matches the tokens supported by `valueFormat`. */
|
|
327
|
+
private static readonly FORMAT_TOKENS;
|
|
328
|
+
/**
|
|
329
|
+
* Parses a string using the `valueFormat` pattern and returns the internal
|
|
330
|
+
* ISO value, or null if it does not match.
|
|
331
|
+
*/
|
|
332
|
+
private parseWithFormat;
|
|
333
|
+
/** Converts the internal ISO value to the configured `valueFormat`. */
|
|
334
|
+
private toOutputValue;
|
|
335
|
+
/** Builds the internal value from a Date according to the configuration. */
|
|
336
|
+
private fromDate;
|
|
337
|
+
/** Formats "HH:mm[:ss]" honoring the showSeconds option. */
|
|
338
|
+
private buildTime;
|
|
339
|
+
/** Warns about an unparseable value and discards it. */
|
|
340
|
+
private invalidValue;
|
|
301
341
|
registerOnChange(fn: any): void;
|
|
302
342
|
registerOnTouched(fn: any): void;
|
|
303
343
|
setDisabledState(isDisabled: boolean): void;
|
|
304
344
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<DatePickerComponent, never>;
|
|
305
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<DatePickerComponent, "shk-date-picker", never, { "id": { "alias": "id"; "required": false; "isSignal": true; }; "view": { "alias": "view"; "required": false; "isSignal": true; }; "weekStart": { "alias": "weekStart"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "formGroup": { "alias": "formGroup"; "required": false; "isSignal": true; }; "control": { "alias": "control"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "errorMessage": { "alias": "errorMessage"; "required": false; "isSignal": true; }; "errorMessages": { "alias": "errorMessages"; "required": false; "isSignal": true; }; "minValue": { "alias": "minValue"; "required": false; "isSignal": true; }; "maxValue": { "alias": "maxValue"; "required": false; "isSignal": true; }; "locale": { "alias": "locale"; "required": false; "isSignal": true; }; "timeOnly": { "alias": "timeOnly"; "required": false; "isSignal": true; }; "showTime": { "alias": "showTime"; "required": false; "isSignal": true; }; "hourFormat": { "alias": "hourFormat"; "required": false; "isSignal": true; }; "showSeconds": { "alias": "showSeconds"; "required": false; "isSignal": true; }; "minuteStep": { "alias": "minuteStep"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
345
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<DatePickerComponent, "shk-date-picker", never, { "id": { "alias": "id"; "required": false; "isSignal": true; }; "view": { "alias": "view"; "required": false; "isSignal": true; }; "weekStart": { "alias": "weekStart"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "formGroup": { "alias": "formGroup"; "required": false; "isSignal": true; }; "controlName": { "alias": "controlName"; "required": false; "isSignal": true; }; "control": { "alias": "control"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "errorMessage": { "alias": "errorMessage"; "required": false; "isSignal": true; }; "errorMessages": { "alias": "errorMessages"; "required": false; "isSignal": true; }; "minValue": { "alias": "minValue"; "required": false; "isSignal": true; }; "maxValue": { "alias": "maxValue"; "required": false; "isSignal": true; }; "locale": { "alias": "locale"; "required": false; "isSignal": true; }; "timeOnly": { "alias": "timeOnly"; "required": false; "isSignal": true; }; "showTime": { "alias": "showTime"; "required": false; "isSignal": true; }; "hourFormat": { "alias": "hourFormat"; "required": false; "isSignal": true; }; "showSeconds": { "alias": "showSeconds"; "required": false; "isSignal": true; }; "minuteStep": { "alias": "minuteStep"; "required": false; "isSignal": true; }; "valueFormat": { "alias": "valueFormat"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
306
346
|
}
|
|
307
347
|
|
|
308
348
|
export { DatePickerComponent };
|
|
@@ -50,6 +50,7 @@ declare class PriceInputComponent implements ControlValueAccessor {
|
|
|
50
50
|
/** Message rendered when the field is in error state. */
|
|
51
51
|
errorMessage: _angular_core.InputSignal<string>;
|
|
52
52
|
private destroyRef;
|
|
53
|
+
private transloco;
|
|
53
54
|
/** Text currently shown in the input (raw while focused, formatted on blur). */
|
|
54
55
|
displayText: _angular_core.WritableSignal<string>;
|
|
55
56
|
/** Whether the native input currently has focus. */
|
|
@@ -58,6 +59,15 @@ declare class PriceInputComponent implements ControlValueAccessor {
|
|
|
58
59
|
private controlDisabled;
|
|
59
60
|
/** Prevents re-subscribing to the same form control. */
|
|
60
61
|
private ctrlSubscribed;
|
|
62
|
+
/** Bumped on control status changes / blur so error computeds refresh. */
|
|
63
|
+
private statusTick;
|
|
64
|
+
/**
|
|
65
|
+
* Whether the error state is shown: forced with `showError`, or when the
|
|
66
|
+
* bound `control` is invalid and has been touched or modified.
|
|
67
|
+
*/
|
|
68
|
+
hasError: _angular_core.Signal<boolean>;
|
|
69
|
+
/** Message shown under the field: `errorMessage` or one derived from the control errors. */
|
|
70
|
+
errorText: _angular_core.Signal<string>;
|
|
61
71
|
/** Effective disabled state combining the input and the form binding. */
|
|
62
72
|
isDisabled: _angular_core.Signal<boolean>;
|
|
63
73
|
/** Callbacks used by the ControlValueAccessor contract. */
|
|
@@ -162,6 +162,8 @@ declare class SelectComponent implements ControlValueAccessor {
|
|
|
162
162
|
nextPage(): void;
|
|
163
163
|
/** Goes to the previous options page when possible. */
|
|
164
164
|
previousPage(): void;
|
|
165
|
+
/** Whether a node belongs to the component or to its (portaled) dropdown panel. */
|
|
166
|
+
private isInsideComponent;
|
|
165
167
|
/** Closes the dropdown when a click happens outside the component. */
|
|
166
168
|
onClickOutside(event: MouseEvent): void;
|
|
167
169
|
/** Selects a typed free-text value as a new custom entry. */
|