@ojiepermana/angular-component 22.0.44 → 22.0.45
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/fesm2022/ojiepermana-angular-component-accordion.mjs +9 -11
- package/fesm2022/ojiepermana-angular-component-alert-dialog.mjs +93 -32
- package/fesm2022/ojiepermana-angular-component-alert.mjs +5 -9
- package/fesm2022/ojiepermana-angular-component-aspect-ratio.mjs +2 -3
- package/fesm2022/ojiepermana-angular-component-avatar.mjs +7 -13
- package/fesm2022/ojiepermana-angular-component-badge.mjs +2 -3
- package/fesm2022/ojiepermana-angular-component-breadcrumb.mjs +16 -19
- package/fesm2022/ojiepermana-angular-component-button-group.mjs +4 -7
- package/fesm2022/ojiepermana-angular-component-button.mjs +2 -3
- package/fesm2022/ojiepermana-angular-component-calendar.mjs +7 -5
- package/fesm2022/ojiepermana-angular-component-card.mjs +8 -15
- package/fesm2022/ojiepermana-angular-component-carousel.mjs +15 -18
- package/fesm2022/ojiepermana-angular-component-checkbox.mjs +40 -11
- package/fesm2022/ojiepermana-angular-component-collapsible.mjs +8 -6
- package/fesm2022/ojiepermana-angular-component-combobox.mjs +28 -15
- package/fesm2022/ojiepermana-angular-component-command.mjs +9 -17
- package/fesm2022/ojiepermana-angular-component-composer.mjs +15 -18
- package/fesm2022/ojiepermana-angular-component-date-picker.mjs +36 -11
- package/fesm2022/ojiepermana-angular-component-dialog.mjs +85 -30
- package/fesm2022/ojiepermana-angular-component-dropdown-menu.mjs +31 -26
- package/fesm2022/ojiepermana-angular-component-editor.mjs +37 -28
- package/fesm2022/ojiepermana-angular-component-empty.mjs +7 -13
- package/fesm2022/ojiepermana-angular-component-form.mjs +14 -22
- package/fesm2022/ojiepermana-angular-component-hover-card.mjs +2 -3
- package/fesm2022/ojiepermana-angular-component-icon.mjs +51 -6
- package/fesm2022/ojiepermana-angular-component-input-group.mjs +17 -15
- package/fesm2022/ojiepermana-angular-component-input-otp.mjs +15 -14
- package/fesm2022/ojiepermana-angular-component-input.mjs +2 -3
- package/fesm2022/ojiepermana-angular-component-item.mjs +11 -21
- package/fesm2022/ojiepermana-angular-component-kanban.mjs +27 -26
- package/fesm2022/ojiepermana-angular-component-kbd.mjs +3 -5
- package/fesm2022/ojiepermana-angular-component-label.mjs +2 -3
- package/fesm2022/ojiepermana-angular-component-menubar.mjs +6 -6
- package/fesm2022/ojiepermana-angular-component-native-select.mjs +3 -3
- package/fesm2022/ojiepermana-angular-component-navigation-menu.mjs +25 -12
- package/fesm2022/ojiepermana-angular-component-pagination.mjs +22 -13
- package/fesm2022/ojiepermana-angular-component-pillbox.mjs +64 -36
- package/fesm2022/ojiepermana-angular-component-progress.mjs +7 -5
- package/fesm2022/ojiepermana-angular-component-radio.mjs +12 -8
- package/fesm2022/ojiepermana-angular-component-resizable.mjs +22 -11
- package/fesm2022/ojiepermana-angular-component-scroll-area.mjs +8 -6
- package/fesm2022/ojiepermana-angular-component-select.mjs +29 -17
- package/fesm2022/ojiepermana-angular-component-separator.mjs +2 -3
- package/fesm2022/ojiepermana-angular-component-sheet.mjs +86 -30
- package/fesm2022/ojiepermana-angular-component-skeleton.mjs +2 -3
- package/fesm2022/ojiepermana-angular-component-slider.mjs +25 -13
- package/fesm2022/ojiepermana-angular-component-spinner.mjs +6 -5
- package/fesm2022/ojiepermana-angular-component-switch.mjs +17 -8
- package/fesm2022/ojiepermana-angular-component-table.mjs +9 -17
- package/fesm2022/ojiepermana-angular-component-tabs.mjs +5 -9
- package/fesm2022/ojiepermana-angular-component-textarea.mjs +2 -3
- package/fesm2022/ojiepermana-angular-component-timeline.mjs +16 -16
- package/fesm2022/ojiepermana-angular-component-toggle-group.mjs +10 -5
- package/fesm2022/ojiepermana-angular-component-toggle.mjs +2 -3
- package/fesm2022/ojiepermana-angular-component-tooltip.mjs +7 -6
- package/package.json +10 -1
- package/types/ojiepermana-angular-component-alert-dialog.d.ts +42 -3
- package/types/ojiepermana-angular-component-dialog.d.ts +33 -3
- package/types/ojiepermana-angular-component-icon.d.ts +48 -1
- package/types/ojiepermana-angular-component-sheet.d.ts +33 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, ViewContainerRef, DestroyRef, ElementRef, model, input, output,
|
|
2
|
+
import { inject, ViewContainerRef, DestroyRef, ElementRef, model, input, output, signal, computed, viewChild, effect, Component, Directive } from '@angular/core';
|
|
3
3
|
import { Overlay } from '@angular/cdk/overlay';
|
|
4
4
|
import { TemplatePortal } from '@angular/cdk/portal';
|
|
5
5
|
import { FocusTrapFactory } from '@angular/cdk/a11y';
|
|
@@ -7,7 +7,7 @@ import { DOCUMENT } from '@angular/common';
|
|
|
7
7
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
8
8
|
import { filter } from 'rxjs/operators';
|
|
9
9
|
import { ButtonComponent } from '@ojiepermana/angular-component/button';
|
|
10
|
-
import { cn, radiusBaseValue, densityBaseValue } from '@ojiepermana/angular-component/utils';
|
|
10
|
+
import { cn, radiusBaseValue, densityBaseValue, uniqueId } from '@ojiepermana/angular-component/utils';
|
|
11
11
|
|
|
12
12
|
const SIDE_BASE = {
|
|
13
13
|
top: 'inset-x-0 top-0 border-b border-border',
|
|
@@ -51,6 +51,9 @@ class SheetComponent {
|
|
|
51
51
|
...(ngDevMode ? [{ debugName: "closeButtonLabel" }] : /* istanbul ignore next */ []));
|
|
52
52
|
labelledBy = input(null, { ...(ngDevMode ? { debugName: "labelledBy" } : /* istanbul ignore next */ {}), alias: 'aria-labelledby' });
|
|
53
53
|
describedBy = input(null, { ...(ngDevMode ? { debugName: "describedBy" } : /* istanbul ignore next */ {}), alias: 'aria-describedby' });
|
|
54
|
+
/** ARIA role for the surface. Defaults to `'dialog'`. */
|
|
55
|
+
role = input('dialog', /* @ts-ignore */
|
|
56
|
+
...(ngDevMode ? [{ debugName: "role" }] : /* istanbul ignore next */ []));
|
|
54
57
|
class = input('', /* @ts-ignore */
|
|
55
58
|
...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
56
59
|
radius = input('inherit', /* @ts-ignore */
|
|
@@ -58,6 +61,16 @@ class SheetComponent {
|
|
|
58
61
|
density = input('inherit', /* @ts-ignore */
|
|
59
62
|
...(ngDevMode ? [{ debugName: "density" }] : /* istanbul ignore next */ []));
|
|
60
63
|
openedChange = output();
|
|
64
|
+
registeredTitleId = signal(null, /* @ts-ignore */
|
|
65
|
+
...(ngDevMode ? [{ debugName: "registeredTitleId" }] : /* istanbul ignore next */ []));
|
|
66
|
+
registeredDescriptionId = signal(null, /* @ts-ignore */
|
|
67
|
+
...(ngDevMode ? [{ debugName: "registeredDescriptionId" }] : /* istanbul ignore next */ []));
|
|
68
|
+
/** Explicit `aria-labelledby` wins; otherwise a projected `SheetTitle` supplies the id. */
|
|
69
|
+
resolvedLabelledBy = computed(() => this.labelledBy() ?? this.registeredTitleId(), /* @ts-ignore */
|
|
70
|
+
...(ngDevMode ? [{ debugName: "resolvedLabelledBy" }] : /* istanbul ignore next */ []));
|
|
71
|
+
/** Explicit `aria-describedby` wins; otherwise a projected `SheetDescription` supplies the id. */
|
|
72
|
+
resolvedDescribedBy = computed(() => this.describedBy() ?? this.registeredDescriptionId(), /* @ts-ignore */
|
|
73
|
+
...(ngDevMode ? [{ debugName: "resolvedDescribedBy" }] : /* istanbul ignore next */ []));
|
|
61
74
|
tpl = viewChild.required('tpl');
|
|
62
75
|
overlayRef = null;
|
|
63
76
|
focusTrap = null;
|
|
@@ -124,6 +137,26 @@ class SheetComponent {
|
|
|
124
137
|
close() {
|
|
125
138
|
this.open.set(false);
|
|
126
139
|
}
|
|
140
|
+
/** Called by a projected `SheetTitle` so default usage has an accessible name (AXE-safe). */
|
|
141
|
+
registerTitleId(id) {
|
|
142
|
+
this.registeredTitleId.set(id);
|
|
143
|
+
}
|
|
144
|
+
/** Cleared by a `SheetTitle` on destroy so a closed/reopened sheet never points at a stale id. */
|
|
145
|
+
unregisterTitleId(id) {
|
|
146
|
+
if (this.registeredTitleId() === id) {
|
|
147
|
+
this.registeredTitleId.set(null);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
/** Called by a projected `SheetDescription`. */
|
|
151
|
+
registerDescriptionId(id) {
|
|
152
|
+
this.registeredDescriptionId.set(id);
|
|
153
|
+
}
|
|
154
|
+
/** Cleared by a `SheetDescription` on destroy. */
|
|
155
|
+
unregisterDescriptionId(id) {
|
|
156
|
+
if (this.registeredDescriptionId() === id) {
|
|
157
|
+
this.registeredDescriptionId.set(null);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
127
160
|
isDrawerHost() {
|
|
128
161
|
const variant = this.variant();
|
|
129
162
|
if (variant) {
|
|
@@ -134,18 +167,19 @@ class SheetComponent {
|
|
|
134
167
|
return this.host.nativeElement.localName === 'drawer';
|
|
135
168
|
}
|
|
136
169
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.4", ngImport: i0, type: SheetComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
137
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.4", type: SheetComponent, isStandalone: true, selector: "Sheet, Drawer", inputs: { open: { classPropertyName: "open", publicName: "open", isSignal: true, isRequired: false, transformFunction: null }, side: { classPropertyName: "side", publicName: "side", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, closeOnEscape: { classPropertyName: "closeOnEscape", publicName: "closeOnEscape", isSignal: true, isRequired: false, transformFunction: null }, closeOnBackdropClick: { classPropertyName: "closeOnBackdropClick", publicName: "closeOnBackdropClick", isSignal: true, isRequired: false, transformFunction: null }, showCloseButton: { classPropertyName: "showCloseButton", publicName: "showCloseButton", isSignal: true, isRequired: false, transformFunction: null }, closeButtonLabel: { classPropertyName: "closeButtonLabel", publicName: "closeButtonLabel", isSignal: true, isRequired: false, transformFunction: null }, labelledBy: { classPropertyName: "labelledBy", publicName: "aria-labelledby", isSignal: true, isRequired: false, transformFunction: null }, describedBy: { classPropertyName: "describedBy", publicName: "aria-describedby", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, radius: { classPropertyName: "radius", publicName: "radius", isSignal: true, isRequired: false, transformFunction: null }, density: { classPropertyName: "density", publicName: "density", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { open: "openChange", openedChange: "openedChange" }, viewQueries: [{ propertyName: "tpl", first: true, predicate: ["tpl"], descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
170
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.4", type: SheetComponent, isStandalone: true, selector: "Sheet, Drawer", inputs: { open: { classPropertyName: "open", publicName: "open", isSignal: true, isRequired: false, transformFunction: null }, side: { classPropertyName: "side", publicName: "side", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, closeOnEscape: { classPropertyName: "closeOnEscape", publicName: "closeOnEscape", isSignal: true, isRequired: false, transformFunction: null }, closeOnBackdropClick: { classPropertyName: "closeOnBackdropClick", publicName: "closeOnBackdropClick", isSignal: true, isRequired: false, transformFunction: null }, showCloseButton: { classPropertyName: "showCloseButton", publicName: "showCloseButton", isSignal: true, isRequired: false, transformFunction: null }, closeButtonLabel: { classPropertyName: "closeButtonLabel", publicName: "closeButtonLabel", isSignal: true, isRequired: false, transformFunction: null }, labelledBy: { classPropertyName: "labelledBy", publicName: "aria-labelledby", isSignal: true, isRequired: false, transformFunction: null }, describedBy: { classPropertyName: "describedBy", publicName: "aria-describedby", isSignal: true, isRequired: false, transformFunction: null }, role: { classPropertyName: "role", publicName: "role", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, radius: { classPropertyName: "radius", publicName: "radius", isSignal: true, isRequired: false, transformFunction: null }, density: { classPropertyName: "density", publicName: "density", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { open: "openChange", openedChange: "openedChange" }, viewQueries: [{ propertyName: "tpl", first: true, predicate: ["tpl"], descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
138
171
|
<ng-template #tpl>
|
|
139
172
|
<div
|
|
140
173
|
class="sheet-surface fixed z-50 bg-background shadow-lg transition ease-in-out"
|
|
141
|
-
role="
|
|
174
|
+
[attr.role]="role()"
|
|
142
175
|
aria-modal="true"
|
|
143
|
-
[attr.aria-labelledby]="
|
|
144
|
-
[attr.aria-describedby]="
|
|
176
|
+
[attr.aria-labelledby]="resolvedLabelledBy()"
|
|
177
|
+
[attr.aria-describedby]="resolvedDescribedBy()"
|
|
145
178
|
[class]="surfaceClasses()"
|
|
146
179
|
[style.--sheet-from]="enterFrom()"
|
|
147
180
|
[style.--radius-base]="radiusBase()"
|
|
148
|
-
[style.--spacing-base]="densityBase()"
|
|
181
|
+
[style.--spacing-base]="densityBase()"
|
|
182
|
+
>
|
|
149
183
|
@if (showCloseButton()) {
|
|
150
184
|
<button
|
|
151
185
|
type="button"
|
|
@@ -154,7 +188,8 @@ class SheetComponent {
|
|
|
154
188
|
size="icon-sm"
|
|
155
189
|
class="sheet-close-button absolute right-4 top-4 h-8 w-8 rounded-md p-0 text-muted-foreground opacity-70 transition-opacity hover:opacity-100 focus-visible:ring-2 focus-visible:ring-ring"
|
|
156
190
|
[attr.aria-label]="closeButtonLabel()"
|
|
157
|
-
(click)="close()"
|
|
191
|
+
(click)="close()"
|
|
192
|
+
>
|
|
158
193
|
<span aria-hidden="true">X</span>
|
|
159
194
|
<span class="sr-only">{{ closeButtonLabel() }}</span>
|
|
160
195
|
</button>
|
|
@@ -162,22 +197,23 @@ class SheetComponent {
|
|
|
162
197
|
<ng-content />
|
|
163
198
|
</div>
|
|
164
199
|
</ng-template>
|
|
165
|
-
`, isInline: true, styles: [".sheet-surface{animation:sheet-in .3s cubic-bezier(.2,0,0,1)}@keyframes sheet-in{0%{transform:var(--sheet-from)}to{transform:translate(0)}}@media(prefers-reduced-motion:reduce){.sheet-surface{animation-duration:0ms}}\n"], dependencies: [{ kind: "component", type: ButtonComponent, selector: "button[Button], a[Button]", inputs: ["variant", "size", "class", "radius", "density"] }]
|
|
200
|
+
`, isInline: true, styles: [".sheet-surface{animation:sheet-in .3s cubic-bezier(.2,0,0,1)}@keyframes sheet-in{0%{transform:var(--sheet-from)}to{transform:translate(0)}}@media(prefers-reduced-motion:reduce){.sheet-surface{animation-duration:0ms}}\n"], dependencies: [{ kind: "component", type: ButtonComponent, selector: "button[Button], a[Button]", inputs: ["variant", "size", "class", "radius", "density"] }] });
|
|
166
201
|
}
|
|
167
202
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.4", ngImport: i0, type: SheetComponent, decorators: [{
|
|
168
203
|
type: Component,
|
|
169
|
-
args: [{ selector: 'Sheet, Drawer',
|
|
204
|
+
args: [{ selector: 'Sheet, Drawer', imports: [ButtonComponent], template: `
|
|
170
205
|
<ng-template #tpl>
|
|
171
206
|
<div
|
|
172
207
|
class="sheet-surface fixed z-50 bg-background shadow-lg transition ease-in-out"
|
|
173
|
-
role="
|
|
208
|
+
[attr.role]="role()"
|
|
174
209
|
aria-modal="true"
|
|
175
|
-
[attr.aria-labelledby]="
|
|
176
|
-
[attr.aria-describedby]="
|
|
210
|
+
[attr.aria-labelledby]="resolvedLabelledBy()"
|
|
211
|
+
[attr.aria-describedby]="resolvedDescribedBy()"
|
|
177
212
|
[class]="surfaceClasses()"
|
|
178
213
|
[style.--sheet-from]="enterFrom()"
|
|
179
214
|
[style.--radius-base]="radiusBase()"
|
|
180
|
-
[style.--spacing-base]="densityBase()"
|
|
215
|
+
[style.--spacing-base]="densityBase()"
|
|
216
|
+
>
|
|
181
217
|
@if (showCloseButton()) {
|
|
182
218
|
<button
|
|
183
219
|
type="button"
|
|
@@ -186,7 +222,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.4", ngImpor
|
|
|
186
222
|
size="icon-sm"
|
|
187
223
|
class="sheet-close-button absolute right-4 top-4 h-8 w-8 rounded-md p-0 text-muted-foreground opacity-70 transition-opacity hover:opacity-100 focus-visible:ring-2 focus-visible:ring-ring"
|
|
188
224
|
[attr.aria-label]="closeButtonLabel()"
|
|
189
|
-
(click)="close()"
|
|
225
|
+
(click)="close()"
|
|
226
|
+
>
|
|
190
227
|
<span aria-hidden="true">X</span>
|
|
191
228
|
<span class="sr-only">{{ closeButtonLabel() }}</span>
|
|
192
229
|
</button>
|
|
@@ -195,7 +232,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.4", ngImpor
|
|
|
195
232
|
</div>
|
|
196
233
|
</ng-template>
|
|
197
234
|
`, styles: [".sheet-surface{animation:sheet-in .3s cubic-bezier(.2,0,0,1)}@keyframes sheet-in{0%{transform:var(--sheet-from)}to{transform:translate(0)}}@media(prefers-reduced-motion:reduce){.sheet-surface{animation-duration:0ms}}\n"] }]
|
|
198
|
-
}], ctorParameters: () => [], propDecorators: { open: [{ type: i0.Input, args: [{ isSignal: true, alias: "open", required: false }] }, { type: i0.Output, args: ["openChange"] }], side: [{ type: i0.Input, args: [{ isSignal: true, alias: "side", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], closeOnEscape: [{ type: i0.Input, args: [{ isSignal: true, alias: "closeOnEscape", required: false }] }], closeOnBackdropClick: [{ type: i0.Input, args: [{ isSignal: true, alias: "closeOnBackdropClick", required: false }] }], showCloseButton: [{ type: i0.Input, args: [{ isSignal: true, alias: "showCloseButton", required: false }] }], closeButtonLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "closeButtonLabel", required: false }] }], labelledBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-labelledby", required: false }] }], describedBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-describedby", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], radius: [{ type: i0.Input, args: [{ isSignal: true, alias: "radius", required: false }] }], density: [{ type: i0.Input, args: [{ isSignal: true, alias: "density", required: false }] }], openedChange: [{ type: i0.Output, args: ["openedChange"] }], tpl: [{ type: i0.ViewChild, args: ['tpl', { isSignal: true }] }] } });
|
|
235
|
+
}], ctorParameters: () => [], propDecorators: { open: [{ type: i0.Input, args: [{ isSignal: true, alias: "open", required: false }] }, { type: i0.Output, args: ["openChange"] }], side: [{ type: i0.Input, args: [{ isSignal: true, alias: "side", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], closeOnEscape: [{ type: i0.Input, args: [{ isSignal: true, alias: "closeOnEscape", required: false }] }], closeOnBackdropClick: [{ type: i0.Input, args: [{ isSignal: true, alias: "closeOnBackdropClick", required: false }] }], showCloseButton: [{ type: i0.Input, args: [{ isSignal: true, alias: "showCloseButton", required: false }] }], closeButtonLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "closeButtonLabel", required: false }] }], labelledBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-labelledby", required: false }] }], describedBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-describedby", required: false }] }], role: [{ type: i0.Input, args: [{ isSignal: true, alias: "role", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], radius: [{ type: i0.Input, args: [{ isSignal: true, alias: "radius", required: false }] }], density: [{ type: i0.Input, args: [{ isSignal: true, alias: "density", required: false }] }], openedChange: [{ type: i0.Output, args: ["openedChange"] }], tpl: [{ type: i0.ViewChild, args: ['tpl', { isSignal: true }] }] } });
|
|
199
236
|
|
|
200
237
|
class SheetCloseDirective {
|
|
201
238
|
sheet = inject(SheetComponent);
|
|
@@ -221,64 +258,84 @@ class SheetHeaderComponent {
|
|
|
221
258
|
classes = computed(() => cn('flex flex-col gap-2 text-center sm:text-left', this.class()), /* @ts-ignore */
|
|
222
259
|
...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
|
|
223
260
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.4", ngImport: i0, type: SheetHeaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
224
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.4", type: SheetHeaderComponent, isStandalone: true, selector: "SheetHeader, DrawerHeader", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "classes()" } }, ngImport: i0, template: `<ng-content />`, isInline: true
|
|
261
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.4", type: SheetHeaderComponent, isStandalone: true, selector: "SheetHeader, DrawerHeader", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "classes()" } }, ngImport: i0, template: `<ng-content />`, isInline: true });
|
|
225
262
|
}
|
|
226
263
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.4", ngImport: i0, type: SheetHeaderComponent, decorators: [{
|
|
227
264
|
type: Component,
|
|
228
265
|
args: [{
|
|
229
266
|
selector: 'SheetHeader, DrawerHeader',
|
|
230
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
231
267
|
host: { '[class]': 'classes()' },
|
|
232
268
|
template: `<ng-content />`,
|
|
233
269
|
}]
|
|
234
270
|
}], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
235
271
|
class SheetTitleComponent {
|
|
272
|
+
/** Explicit id override; when omitted a document-unique id is generated. */
|
|
273
|
+
id = input(null, /* @ts-ignore */
|
|
274
|
+
...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
236
275
|
class = input('', /* @ts-ignore */
|
|
237
276
|
...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
277
|
+
autoId = uniqueId('sheet-title');
|
|
278
|
+
sheet = inject(SheetComponent, { optional: true });
|
|
279
|
+
/** The id rendered on the element, used by the parent sheet for aria-labelledby. */
|
|
280
|
+
resolvedId = computed(() => this.id() ?? this.autoId, /* @ts-ignore */
|
|
281
|
+
...(ngDevMode ? [{ debugName: "resolvedId" }] : /* istanbul ignore next */ []));
|
|
238
282
|
classes = computed(() => cn('text-lg font-semibold text-foreground', this.class()), /* @ts-ignore */
|
|
239
283
|
...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
|
|
284
|
+
constructor() {
|
|
285
|
+
effect(() => this.sheet?.registerTitleId(this.resolvedId()));
|
|
286
|
+
inject(DestroyRef).onDestroy(() => this.sheet?.unregisterTitleId(this.resolvedId()));
|
|
287
|
+
}
|
|
240
288
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.4", ngImport: i0, type: SheetTitleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
241
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.4", type: SheetTitleComponent, isStandalone: true, selector: "SheetTitle, DrawerTitle, h2[SheetTitle], h2[DrawerTitle]", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "classes()" } }, ngImport: i0, template: `<ng-content />`, isInline: true
|
|
289
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.4", type: SheetTitleComponent, isStandalone: true, selector: "SheetTitle, DrawerTitle, h2[SheetTitle], h2[DrawerTitle]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "classes()", "attr.id": "resolvedId()" } }, ngImport: i0, template: `<ng-content />`, isInline: true });
|
|
242
290
|
}
|
|
243
291
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.4", ngImport: i0, type: SheetTitleComponent, decorators: [{
|
|
244
292
|
type: Component,
|
|
245
293
|
args: [{
|
|
246
294
|
selector: 'SheetTitle, DrawerTitle, h2[SheetTitle], h2[DrawerTitle]',
|
|
247
|
-
|
|
248
|
-
host: { '[class]': 'classes()' },
|
|
295
|
+
host: { '[class]': 'classes()', '[attr.id]': 'resolvedId()' },
|
|
249
296
|
template: `<ng-content />`,
|
|
250
297
|
}]
|
|
251
|
-
}], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
298
|
+
}], ctorParameters: () => [], propDecorators: { id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
252
299
|
class SheetDescriptionComponent {
|
|
300
|
+
/** Explicit id override; when omitted a document-unique id is generated. */
|
|
301
|
+
id = input(null, /* @ts-ignore */
|
|
302
|
+
...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
253
303
|
class = input('', /* @ts-ignore */
|
|
254
304
|
...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
305
|
+
autoId = uniqueId('sheet-description');
|
|
306
|
+
sheet = inject(SheetComponent, { optional: true });
|
|
307
|
+
/** The id rendered on the element, used by the parent sheet for aria-describedby. */
|
|
308
|
+
resolvedId = computed(() => this.id() ?? this.autoId, /* @ts-ignore */
|
|
309
|
+
...(ngDevMode ? [{ debugName: "resolvedId" }] : /* istanbul ignore next */ []));
|
|
255
310
|
classes = computed(() => cn('text-sm text-muted-foreground', this.class()), /* @ts-ignore */
|
|
256
311
|
...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
|
|
312
|
+
constructor() {
|
|
313
|
+
effect(() => this.sheet?.registerDescriptionId(this.resolvedId()));
|
|
314
|
+
inject(DestroyRef).onDestroy(() => this.sheet?.unregisterDescriptionId(this.resolvedId()));
|
|
315
|
+
}
|
|
257
316
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.4", ngImport: i0, type: SheetDescriptionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
258
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.4", type: SheetDescriptionComponent, isStandalone: true, selector: "SheetDescription, DrawerDescription, p[SheetDescription], p[DrawerDescription]", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "classes()" } }, ngImport: i0, template: `<ng-content />`, isInline: true
|
|
317
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.4", type: SheetDescriptionComponent, isStandalone: true, selector: "SheetDescription, DrawerDescription, p[SheetDescription], p[DrawerDescription]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "classes()", "attr.id": "resolvedId()" } }, ngImport: i0, template: `<ng-content />`, isInline: true });
|
|
259
318
|
}
|
|
260
319
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.4", ngImport: i0, type: SheetDescriptionComponent, decorators: [{
|
|
261
320
|
type: Component,
|
|
262
321
|
args: [{
|
|
263
322
|
selector: 'SheetDescription, DrawerDescription, p[SheetDescription], p[DrawerDescription]',
|
|
264
|
-
|
|
265
|
-
host: { '[class]': 'classes()' },
|
|
323
|
+
host: { '[class]': 'classes()', '[attr.id]': 'resolvedId()' },
|
|
266
324
|
template: `<ng-content />`,
|
|
267
325
|
}]
|
|
268
|
-
}], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
326
|
+
}], ctorParameters: () => [], propDecorators: { id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
269
327
|
class SheetContentComponent {
|
|
270
328
|
class = input('', /* @ts-ignore */
|
|
271
329
|
...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
272
330
|
classes = computed(() => cn('flex-1 overflow-auto', this.class()), /* @ts-ignore */
|
|
273
331
|
...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
|
|
274
332
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.4", ngImport: i0, type: SheetContentComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
275
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.4", type: SheetContentComponent, isStandalone: true, selector: "SheetContent, DrawerContent", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "classes()" } }, ngImport: i0, template: `<ng-content />`, isInline: true
|
|
333
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.4", type: SheetContentComponent, isStandalone: true, selector: "SheetContent, DrawerContent", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "classes()" } }, ngImport: i0, template: `<ng-content />`, isInline: true });
|
|
276
334
|
}
|
|
277
335
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.4", ngImport: i0, type: SheetContentComponent, decorators: [{
|
|
278
336
|
type: Component,
|
|
279
337
|
args: [{
|
|
280
338
|
selector: 'SheetContent, DrawerContent',
|
|
281
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
282
339
|
host: { '[class]': 'classes()' },
|
|
283
340
|
template: `<ng-content />`,
|
|
284
341
|
}]
|
|
@@ -289,13 +346,12 @@ class SheetFooterComponent {
|
|
|
289
346
|
classes = computed(() => cn('flex flex-col-reverse gap-2 sm:flex-row sm:justify-end', this.class()), /* @ts-ignore */
|
|
290
347
|
...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
|
|
291
348
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.4", ngImport: i0, type: SheetFooterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
292
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.4", type: SheetFooterComponent, isStandalone: true, selector: "SheetFooter, DrawerFooter", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "classes()" } }, ngImport: i0, template: `<ng-content />`, isInline: true
|
|
349
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.4", type: SheetFooterComponent, isStandalone: true, selector: "SheetFooter, DrawerFooter", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "classes()" } }, ngImport: i0, template: `<ng-content />`, isInline: true });
|
|
293
350
|
}
|
|
294
351
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.4", ngImport: i0, type: SheetFooterComponent, decorators: [{
|
|
295
352
|
type: Component,
|
|
296
353
|
args: [{
|
|
297
354
|
selector: 'SheetFooter, DrawerFooter',
|
|
298
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
299
355
|
host: { '[class]': 'classes()' },
|
|
300
356
|
template: `<ng-content />`,
|
|
301
357
|
}]
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { input, computed,
|
|
2
|
+
import { input, computed, Component } from '@angular/core';
|
|
3
3
|
import { cn } from '@ojiepermana/angular-component/utils';
|
|
4
4
|
|
|
5
5
|
class SkeletonComponent {
|
|
@@ -8,13 +8,12 @@ class SkeletonComponent {
|
|
|
8
8
|
classes = computed(() => cn('block animate-pulse rounded-md bg-muted', this.class()), /* @ts-ignore */
|
|
9
9
|
...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
|
|
10
10
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.4", ngImport: i0, type: SkeletonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
11
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.4", type: SkeletonComponent, isStandalone: true, selector: "Skeleton", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "classes()", "attr.aria-hidden": "\"true\"" } }, ngImport: i0, template: '', isInline: true
|
|
11
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.4", type: SkeletonComponent, isStandalone: true, selector: "Skeleton", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "classes()", "attr.aria-hidden": "\"true\"" } }, ngImport: i0, template: '', isInline: true });
|
|
12
12
|
}
|
|
13
13
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.4", ngImport: i0, type: SkeletonComponent, decorators: [{
|
|
14
14
|
type: Component,
|
|
15
15
|
args: [{
|
|
16
16
|
selector: 'Skeleton',
|
|
17
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
18
17
|
host: {
|
|
19
18
|
'[class]': 'classes()',
|
|
20
19
|
'[attr.aria-hidden]': '"true"',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, ElementRef, input, computed,
|
|
2
|
+
import { inject, ElementRef, input, computed, Component, viewChild, numberAttribute, booleanAttribute, output, signal, effect, untracked } from '@angular/core';
|
|
3
3
|
import { cn } from '@ojiepermana/angular-component/utils';
|
|
4
4
|
import { DOCUMENT } from '@angular/common';
|
|
5
5
|
|
|
@@ -17,11 +17,11 @@ class SliderComponent {
|
|
|
17
17
|
this.el.nativeElement.focus();
|
|
18
18
|
}
|
|
19
19
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.4", ngImport: i0, type: SliderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
20
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.4", type: SliderComponent, isStandalone: true, selector: "input[type=range][Slider]", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "classes()" } }, ngImport: i0, template: '', isInline: true, styles: [":host.Slider{height:1.25rem;cursor:pointer}:host.Slider::-webkit-slider-runnable-track{height:.5rem;border-radius:var(--radius-lg);background:hsl(var(--secondary))}:host.Slider::-moz-range-track{height:.5rem;border-radius:var(--radius-lg);background:hsl(var(--secondary))}:host.Slider::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;margin-top:-.25rem;width:1rem;height:1rem;border-radius:var(--radius-lg);background:hsl(var(--background));border:var(--border-width) solid hsl(var(--primary));transition:box-shadow .15s cubic-bezier(.4,0,.2,1)}:host.Slider::-moz-range-thumb{width:1rem;height:1rem;border-radius:var(--radius-lg);background:hsl(var(--background));border:var(--border-width) solid hsl(var(--primary));transition:box-shadow .15s cubic-bezier(.4,0,.2,1)}:host.Slider:focus-visible::-webkit-slider-thumb{box-shadow:0 0 0 calc(var(--border-width) + 3px) hsl(var(--ring) / .3)}:host.Slider:focus-visible::-moz-range-thumb{box-shadow:0 0 0 calc(var(--border-width) + 3px) hsl(var(--ring) / .3)}:host.Slider:disabled::-webkit-slider-thumb{cursor:not-allowed}:host.Slider:disabled::-moz-range-thumb{cursor:not-allowed}\n"]
|
|
20
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.4", type: SliderComponent, isStandalone: true, selector: "input[type=range][Slider]", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "classes()" } }, ngImport: i0, template: '', isInline: true, styles: [":host.Slider{height:1.25rem;cursor:pointer}:host.Slider::-webkit-slider-runnable-track{height:.5rem;border-radius:var(--radius-lg);background:hsl(var(--secondary))}:host.Slider::-moz-range-track{height:.5rem;border-radius:var(--radius-lg);background:hsl(var(--secondary))}:host.Slider::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;margin-top:-.25rem;width:1rem;height:1rem;border-radius:var(--radius-lg);background:hsl(var(--background));border:var(--border-width) solid hsl(var(--primary));transition:box-shadow .15s cubic-bezier(.4,0,.2,1)}:host.Slider::-moz-range-thumb{width:1rem;height:1rem;border-radius:var(--radius-lg);background:hsl(var(--background));border:var(--border-width) solid hsl(var(--primary));transition:box-shadow .15s cubic-bezier(.4,0,.2,1)}:host.Slider:focus-visible::-webkit-slider-thumb{box-shadow:0 0 0 calc(var(--border-width) + 3px) hsl(var(--ring) / .3)}:host.Slider:focus-visible::-moz-range-thumb{box-shadow:0 0 0 calc(var(--border-width) + 3px) hsl(var(--ring) / .3)}:host.Slider:disabled::-webkit-slider-thumb{cursor:not-allowed}:host.Slider:disabled::-moz-range-thumb{cursor:not-allowed}\n"] });
|
|
21
21
|
}
|
|
22
22
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.4", ngImport: i0, type: SliderComponent, decorators: [{
|
|
23
23
|
type: Component,
|
|
24
|
-
args: [{ selector: 'input[type=range][Slider]',
|
|
24
|
+
args: [{ selector: 'input[type=range][Slider]', host: { '[class]': 'classes()' }, template: '', styles: [":host.Slider{height:1.25rem;cursor:pointer}:host.Slider::-webkit-slider-runnable-track{height:.5rem;border-radius:var(--radius-lg);background:hsl(var(--secondary))}:host.Slider::-moz-range-track{height:.5rem;border-radius:var(--radius-lg);background:hsl(var(--secondary))}:host.Slider::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;margin-top:-.25rem;width:1rem;height:1rem;border-radius:var(--radius-lg);background:hsl(var(--background));border:var(--border-width) solid hsl(var(--primary));transition:box-shadow .15s cubic-bezier(.4,0,.2,1)}:host.Slider::-moz-range-thumb{width:1rem;height:1rem;border-radius:var(--radius-lg);background:hsl(var(--background));border:var(--border-width) solid hsl(var(--primary));transition:box-shadow .15s cubic-bezier(.4,0,.2,1)}:host.Slider:focus-visible::-webkit-slider-thumb{box-shadow:0 0 0 calc(var(--border-width) + 3px) hsl(var(--ring) / .3)}:host.Slider:focus-visible::-moz-range-thumb{box-shadow:0 0 0 calc(var(--border-width) + 3px) hsl(var(--ring) / .3)}:host.Slider:disabled::-webkit-slider-thumb{cursor:not-allowed}:host.Slider:disabled::-moz-range-thumb{cursor:not-allowed}\n"] }]
|
|
25
25
|
}], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
26
26
|
|
|
27
27
|
class SliderRootComponent {
|
|
@@ -161,10 +161,14 @@ class SliderRootComponent {
|
|
|
161
161
|
let nextValue = null;
|
|
162
162
|
switch (event.key) {
|
|
163
163
|
case 'ArrowRight':
|
|
164
|
-
nextValue =
|
|
164
|
+
nextValue =
|
|
165
|
+
current +
|
|
166
|
+
(direction === 'rtl' && this.orientation() === 'horizontal' ? -config.step : config.step);
|
|
165
167
|
break;
|
|
166
168
|
case 'ArrowLeft':
|
|
167
|
-
nextValue =
|
|
169
|
+
nextValue =
|
|
170
|
+
current +
|
|
171
|
+
(direction === 'rtl' && this.orientation() === 'horizontal' ? config.step : -config.step);
|
|
168
172
|
break;
|
|
169
173
|
case 'ArrowUp':
|
|
170
174
|
nextValue = current + config.step;
|
|
@@ -261,7 +265,9 @@ class SliderRootComponent {
|
|
|
261
265
|
return this.orientation() === 'horizontal' && this.resolvedDirection() === 'rtl' ? 100 : 0;
|
|
262
266
|
}
|
|
263
267
|
const logicalRatio = (value - config.min) / range;
|
|
264
|
-
const physicalRatio = this.orientation() === 'horizontal' && this.resolvedDirection() === 'rtl'
|
|
268
|
+
const physicalRatio = this.orientation() === 'horizontal' && this.resolvedDirection() === 'rtl'
|
|
269
|
+
? 1 - logicalRatio
|
|
270
|
+
: logicalRatio;
|
|
265
271
|
return clamp(physicalRatio * 100, 0, 100);
|
|
266
272
|
}
|
|
267
273
|
thumbLabel(index, count) {
|
|
@@ -297,7 +303,8 @@ class SliderRootComponent {
|
|
|
297
303
|
[style.left.%]="orientation() === 'horizontal' ? rangeOffset() : null"
|
|
298
304
|
[style.width.%]="orientation() === 'horizontal' ? rangeSize() : null"
|
|
299
305
|
[style.bottom.%]="orientation() === 'vertical' ? rangeOffset() : null"
|
|
300
|
-
[style.height.%]="orientation() === 'vertical' ? rangeSize() : null"
|
|
306
|
+
[style.height.%]="orientation() === 'vertical' ? rangeSize() : null"
|
|
307
|
+
></div>
|
|
301
308
|
|
|
302
309
|
@for (thumb of thumbs(); track thumb.index) {
|
|
303
310
|
<button
|
|
@@ -320,14 +327,15 @@ class SliderRootComponent {
|
|
|
320
327
|
role="slider"
|
|
321
328
|
(focus)="onThumbFocus(thumb.index)"
|
|
322
329
|
(keydown)="onThumbKeydown($event, thumb.index)"
|
|
323
|
-
(pointerdown)="onThumbPointerDown($event, thumb.index)"
|
|
330
|
+
(pointerdown)="onThumbPointerDown($event, thumb.index)"
|
|
331
|
+
></button>
|
|
324
332
|
}
|
|
325
333
|
</div>
|
|
326
|
-
`, isInline: true, styles: [":host.slider-root{--slider-thumb-size: 1rem;--slider-track-size: .5rem;display:block}.slider__track{position:relative;flex:1 1 auto;border-radius:9999px;background:hsl(var(--secondary))}:host[data-orientation=horizontal] .slider__track{height:var(--slider-track-size);width:100%}:host[data-orientation=vertical] .slider__track{height:100%;width:var(--slider-track-size)}.slider__range{position:absolute;border-radius:inherit;background:hsl(var(--primary))}:host[data-orientation=horizontal] .slider__range{top:0;height:100%}:host[data-orientation=vertical] .slider__range{left:0;width:100%}.slider__thumb{position:absolute;height:var(--slider-thumb-size);width:var(--slider-thumb-size);border:var(--border-width) solid hsl(var(--primary));border-radius:9999px;background:hsl(var(--background));box-shadow:0 1px 2px hsl(var(--foreground) / .14);transition:box-shadow .15s cubic-bezier(.4,0,.2,1),border-color .15s cubic-bezier(.4,0,.2,1),background-color .15s cubic-bezier(.4,0,.2,1)}:host[data-orientation=horizontal] .slider__thumb{transform:translate(-50%,-50%)}:host[data-orientation=vertical] .slider__thumb{transform:translate(-50%,50%)}.slider__thumb:focus-visible{outline:none;box-shadow:0 0 0 calc(var(--border-width) + 3px) hsl(var(--ring) / .3)}:host[data-disabled] .slider__track,:host[data-disabled] .slider__thumb{cursor:not-allowed}\n"]
|
|
334
|
+
`, isInline: true, styles: [":host.slider-root{--slider-thumb-size: 1rem;--slider-track-size: .5rem;display:block}.slider__track{position:relative;flex:1 1 auto;border-radius:9999px;background:hsl(var(--secondary))}:host[data-orientation=horizontal] .slider__track{height:var(--slider-track-size);width:100%}:host[data-orientation=vertical] .slider__track{height:100%;width:var(--slider-track-size)}.slider__range{position:absolute;border-radius:inherit;background:hsl(var(--primary))}:host[data-orientation=horizontal] .slider__range{top:0;height:100%}:host[data-orientation=vertical] .slider__range{left:0;width:100%}.slider__thumb{position:absolute;height:var(--slider-thumb-size);width:var(--slider-thumb-size);border:var(--border-width) solid hsl(var(--primary));border-radius:9999px;background:hsl(var(--background));box-shadow:0 1px 2px hsl(var(--foreground) / .14);transition:box-shadow .15s cubic-bezier(.4,0,.2,1),border-color .15s cubic-bezier(.4,0,.2,1),background-color .15s cubic-bezier(.4,0,.2,1)}:host[data-orientation=horizontal] .slider__thumb{transform:translate(-50%,-50%)}:host[data-orientation=vertical] .slider__thumb{transform:translate(-50%,50%)}.slider__thumb:focus-visible{outline:none;box-shadow:0 0 0 calc(var(--border-width) + 3px) hsl(var(--ring) / .3)}:host[data-disabled] .slider__track,:host[data-disabled] .slider__thumb{cursor:not-allowed}\n"] });
|
|
327
335
|
}
|
|
328
336
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.4", ngImport: i0, type: SliderRootComponent, decorators: [{
|
|
329
337
|
type: Component,
|
|
330
|
-
args: [{ selector: 'Slider',
|
|
338
|
+
args: [{ selector: 'Slider', host: {
|
|
331
339
|
'[class]': 'hostClasses()',
|
|
332
340
|
'[attr.data-disabled]': 'isDisabled() ? "" : null',
|
|
333
341
|
'[attr.data-orientation]': 'orientation()',
|
|
@@ -341,7 +349,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.4", ngImpor
|
|
|
341
349
|
[style.left.%]="orientation() === 'horizontal' ? rangeOffset() : null"
|
|
342
350
|
[style.width.%]="orientation() === 'horizontal' ? rangeSize() : null"
|
|
343
351
|
[style.bottom.%]="orientation() === 'vertical' ? rangeOffset() : null"
|
|
344
|
-
[style.height.%]="orientation() === 'vertical' ? rangeSize() : null"
|
|
352
|
+
[style.height.%]="orientation() === 'vertical' ? rangeSize() : null"
|
|
353
|
+
></div>
|
|
345
354
|
|
|
346
355
|
@for (thumb of thumbs(); track thumb.index) {
|
|
347
356
|
<button
|
|
@@ -364,7 +373,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.4", ngImpor
|
|
|
364
373
|
role="slider"
|
|
365
374
|
(focus)="onThumbFocus(thumb.index)"
|
|
366
375
|
(keydown)="onThumbKeydown($event, thumb.index)"
|
|
367
|
-
(pointerdown)="onThumbPointerDown($event, thumb.index)"
|
|
376
|
+
(pointerdown)="onThumbPointerDown($event, thumb.index)"
|
|
377
|
+
></button>
|
|
368
378
|
}
|
|
369
379
|
</div>
|
|
370
380
|
`, styles: [":host.slider-root{--slider-thumb-size: 1rem;--slider-track-size: .5rem;display:block}.slider__track{position:relative;flex:1 1 auto;border-radius:9999px;background:hsl(var(--secondary))}:host[data-orientation=horizontal] .slider__track{height:var(--slider-track-size);width:100%}:host[data-orientation=vertical] .slider__track{height:100%;width:var(--slider-track-size)}.slider__range{position:absolute;border-radius:inherit;background:hsl(var(--primary))}:host[data-orientation=horizontal] .slider__range{top:0;height:100%}:host[data-orientation=vertical] .slider__range{left:0;width:100%}.slider__thumb{position:absolute;height:var(--slider-thumb-size);width:var(--slider-thumb-size);border:var(--border-width) solid hsl(var(--primary));border-radius:9999px;background:hsl(var(--background));box-shadow:0 1px 2px hsl(var(--foreground) / .14);transition:box-shadow .15s cubic-bezier(.4,0,.2,1),border-color .15s cubic-bezier(.4,0,.2,1),background-color .15s cubic-bezier(.4,0,.2,1)}:host[data-orientation=horizontal] .slider__thumb{transform:translate(-50%,-50%)}:host[data-orientation=vertical] .slider__thumb{transform:translate(-50%,50%)}.slider__thumb:focus-visible{outline:none;box-shadow:0 0 0 calc(var(--border-width) + 3px) hsl(var(--ring) / .3)}:host[data-disabled] .slider__track,:host[data-disabled] .slider__thumb{cursor:not-allowed}\n"] }]
|
|
@@ -382,7 +392,9 @@ function decimalPlaces(value) {
|
|
|
382
392
|
}
|
|
383
393
|
function normalizeSliderValues(values, config) {
|
|
384
394
|
const incoming = values.length ? [...values] : [config.min];
|
|
385
|
-
const sorted = incoming
|
|
395
|
+
const sorted = incoming
|
|
396
|
+
.map((value) => snapToStep(value, config))
|
|
397
|
+
.sort((left, right) => left - right);
|
|
386
398
|
const gap = config.step * config.minStepsBetweenThumbs;
|
|
387
399
|
const normalized = [];
|
|
388
400
|
sorted.forEach((value, index) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { input, booleanAttribute, computed,
|
|
2
|
+
import { input, booleanAttribute, computed, Component } from '@angular/core';
|
|
3
3
|
import { cn } from '@ojiepermana/angular-component/utils';
|
|
4
4
|
|
|
5
5
|
class SpinnerComponent {
|
|
@@ -18,17 +18,17 @@ class SpinnerComponent {
|
|
|
18
18
|
viewBox="0 0 24 24"
|
|
19
19
|
fill="none"
|
|
20
20
|
stroke="currentColor"
|
|
21
|
-
stroke-width="2"
|
|
21
|
+
stroke-width="2"
|
|
22
|
+
>
|
|
22
23
|
<circle cx="12" cy="12" r="9" class="opacity-20" />
|
|
23
24
|
<path d="M21 12a9 9 0 0 0-9-9" stroke-linecap="round" />
|
|
24
25
|
</svg>
|
|
25
|
-
`, isInline: true
|
|
26
|
+
`, isInline: true });
|
|
26
27
|
}
|
|
27
28
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.4", ngImport: i0, type: SpinnerComponent, decorators: [{
|
|
28
29
|
type: Component,
|
|
29
30
|
args: [{
|
|
30
31
|
selector: 'Spinner',
|
|
31
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
32
32
|
host: {
|
|
33
33
|
'[class]': 'classes()',
|
|
34
34
|
'[attr.role]': 'decorative() ? null : "status"',
|
|
@@ -44,7 +44,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.4", ngImpor
|
|
|
44
44
|
viewBox="0 0 24 24"
|
|
45
45
|
fill="none"
|
|
46
46
|
stroke="currentColor"
|
|
47
|
-
stroke-width="2"
|
|
47
|
+
stroke-width="2"
|
|
48
|
+
>
|
|
48
49
|
<circle cx="12" cy="12" r="9" class="opacity-20" />
|
|
49
50
|
<path d="M21 12a9 9 0 0 0-9-9" stroke-linecap="round" />
|
|
50
51
|
</svg>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { input, booleanAttribute, output, viewChild, signal, computed, forwardRef,
|
|
2
|
+
import { input, booleanAttribute, output, viewChild, signal, computed, forwardRef, Component } from '@angular/core';
|
|
3
3
|
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
4
4
|
import { uniqueId, cn } from '@ojiepermana/angular-component/utils';
|
|
5
5
|
|
|
@@ -42,7 +42,11 @@ class SwitchComponent {
|
|
|
42
42
|
...(ngDevMode ? [{ debugName: "hostClasses" }] : /* istanbul ignore next */ []));
|
|
43
43
|
labelClasses = computed(() => cn('inline-flex select-none items-center gap-2 text-sm font-medium leading-none', this.isDisabled() ? 'cursor-not-allowed opacity-50' : 'cursor-pointer'), /* @ts-ignore */
|
|
44
44
|
...(ngDevMode ? [{ debugName: "labelClasses" }] : /* istanbul ignore next */ []));
|
|
45
|
-
trackClasses = computed(() => cn('inline-flex shrink-0 items-center rounded-full border-2 border-transparent shadow-sm transition-colors', 'peer-focus-visible:ring-2 peer-focus-visible:ring-ring peer-focus-visible:ring-offset-2 peer-focus-visible:ring-offset-background', this.size() === 'sm' ? 'h-4 w-7' : 'h-5 w-9', this.ariaInvalidAttr() === 'true'
|
|
45
|
+
trackClasses = computed(() => cn('inline-flex shrink-0 items-center rounded-full border-2 border-transparent shadow-sm transition-colors', 'peer-focus-visible:ring-2 peer-focus-visible:ring-ring peer-focus-visible:ring-offset-2 peer-focus-visible:ring-offset-background', this.size() === 'sm' ? 'h-4 w-7' : 'h-5 w-9', this.ariaInvalidAttr() === 'true'
|
|
46
|
+
? 'bg-destructive'
|
|
47
|
+
: this.checked()
|
|
48
|
+
? 'bg-primary'
|
|
49
|
+
: 'bg-input'), /* @ts-ignore */
|
|
46
50
|
...(ngDevMode ? [{ debugName: "trackClasses" }] : /* istanbul ignore next */ []));
|
|
47
51
|
thumbClasses = computed(() => cn('pointer-events-none block rounded-full bg-background shadow-lg ring-0 transition-transform', this.size() === 'sm' ? 'size-3' : 'size-4', this.checked() ? (this.size() === 'sm' ? 'translate-x-3' : 'translate-x-4') : 'translate-x-0'), /* @ts-ignore */
|
|
48
52
|
...(ngDevMode ? [{ debugName: "thumbClasses" }] : /* istanbul ignore next */ []));
|
|
@@ -73,7 +77,9 @@ class SwitchComponent {
|
|
|
73
77
|
this.disabledState.set(d);
|
|
74
78
|
}
|
|
75
79
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.4", ngImport: i0, type: SwitchComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
76
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.0.4", type: SwitchComponent, isStandalone: true, selector: "Switch", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, ariaDescribedby: { classPropertyName: "ariaDescribedby", publicName: "aria-describedby", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelledby: { classPropertyName: "ariaLabelledby", publicName: "aria-labelledby", isSignal: true, isRequired: false, transformFunction: null }, ariaInvalid: { classPropertyName: "ariaInvalid", publicName: "aria-invalid", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { checkedChange: "checkedChange" }, host: { properties: { "class": "hostClasses()" } }, providers: [
|
|
80
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.0.4", type: SwitchComponent, isStandalone: true, selector: "Switch", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, ariaDescribedby: { classPropertyName: "ariaDescribedby", publicName: "aria-describedby", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelledby: { classPropertyName: "ariaLabelledby", publicName: "aria-labelledby", isSignal: true, isRequired: false, transformFunction: null }, ariaInvalid: { classPropertyName: "ariaInvalid", publicName: "aria-invalid", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { checkedChange: "checkedChange" }, host: { properties: { "class": "hostClasses()" } }, providers: [
|
|
81
|
+
{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => SwitchComponent), multi: true },
|
|
82
|
+
], viewQueries: [{ propertyName: "ref", first: true, predicate: ["ref"], descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
77
83
|
<label [class]="labelClasses()" [attr.for]="id()">
|
|
78
84
|
<input
|
|
79
85
|
#ref
|
|
@@ -90,20 +96,22 @@ class SwitchComponent {
|
|
|
90
96
|
[attr.aria-labelledby]="ariaLabelledby()"
|
|
91
97
|
[attr.aria-invalid]="ariaInvalidAttr()"
|
|
92
98
|
(change)="handleChange($event)"
|
|
93
|
-
(blur)="handleBlur()"
|
|
99
|
+
(blur)="handleBlur()"
|
|
100
|
+
/>
|
|
94
101
|
<span aria-hidden="true" [class]="trackClasses()">
|
|
95
102
|
<span [class]="thumbClasses()"></span>
|
|
96
103
|
</span>
|
|
97
104
|
<ng-content />
|
|
98
105
|
</label>
|
|
99
|
-
`, isInline: true
|
|
106
|
+
`, isInline: true });
|
|
100
107
|
}
|
|
101
108
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.4", ngImport: i0, type: SwitchComponent, decorators: [{
|
|
102
109
|
type: Component,
|
|
103
110
|
args: [{
|
|
104
111
|
selector: 'Switch',
|
|
105
|
-
|
|
106
|
-
|
|
112
|
+
providers: [
|
|
113
|
+
{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => SwitchComponent), multi: true },
|
|
114
|
+
],
|
|
107
115
|
host: { '[class]': 'hostClasses()' },
|
|
108
116
|
template: `
|
|
109
117
|
<label [class]="labelClasses()" [attr.for]="id()">
|
|
@@ -122,7 +130,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.4", ngImpor
|
|
|
122
130
|
[attr.aria-labelledby]="ariaLabelledby()"
|
|
123
131
|
[attr.aria-invalid]="ariaInvalidAttr()"
|
|
124
132
|
(change)="handleChange($event)"
|
|
125
|
-
(blur)="handleBlur()"
|
|
133
|
+
(blur)="handleBlur()"
|
|
134
|
+
/>
|
|
126
135
|
<span aria-hidden="true" [class]="trackClasses()">
|
|
127
136
|
<span [class]="thumbClasses()"></span>
|
|
128
137
|
</span>
|