@ojiepermana/angular-component 22.0.27
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 +82 -0
- package/accordion/README.md +193 -0
- package/alert/README.md +180 -0
- package/alert-dialog/README.md +239 -0
- package/aspect-ratio/README.md +112 -0
- package/avatar/README.md +176 -0
- package/badge/README.md +133 -0
- package/breadcrumb/README.md +216 -0
- package/button/README.md +139 -0
- package/button-group/README.md +208 -0
- package/calendar/README.md +135 -0
- package/card/README.md +220 -0
- package/carousel/README.md +276 -0
- package/checkbox/README.md +149 -0
- package/collapsible/README.md +195 -0
- package/combobox/README.md +198 -0
- package/command/README.md +275 -0
- package/composer/README.md +235 -0
- package/context-menu/README.md +267 -0
- package/date-picker/README.md +179 -0
- package/dialog/README.md +235 -0
- package/drawer/README.md +145 -0
- package/dropdown-menu/README.md +311 -0
- package/editor/README.md +136 -0
- package/empty/README.md +183 -0
- package/fesm2022/ojiepermana-angular-component-accordion.mjs +186 -0
- package/fesm2022/ojiepermana-angular-component-accordion.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-component-alert-dialog.mjs +276 -0
- package/fesm2022/ojiepermana-angular-component-alert-dialog.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-component-alert.mjs +99 -0
- package/fesm2022/ojiepermana-angular-component-alert.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-component-aspect-ratio.mjs +37 -0
- package/fesm2022/ojiepermana-angular-component-aspect-ratio.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-component-avatar.mjs +139 -0
- package/fesm2022/ojiepermana-angular-component-avatar.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-component-badge.mjs +50 -0
- package/fesm2022/ojiepermana-angular-component-badge.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-component-breadcrumb.mjs +200 -0
- package/fesm2022/ojiepermana-angular-component-breadcrumb.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-component-button-group.mjs +103 -0
- package/fesm2022/ojiepermana-angular-component-button-group.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-component-button.mjs +68 -0
- package/fesm2022/ojiepermana-angular-component-button.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-component-calendar.mjs +103 -0
- package/fesm2022/ojiepermana-angular-component-calendar.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-component-card.mjs +152 -0
- package/fesm2022/ojiepermana-angular-component-card.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-component-carousel.mjs +334 -0
- package/fesm2022/ojiepermana-angular-component-carousel.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-component-checkbox.mjs +165 -0
- package/fesm2022/ojiepermana-angular-component-checkbox.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-component-collapsible.mjs +121 -0
- package/fesm2022/ojiepermana-angular-component-collapsible.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-component-combobox.mjs +274 -0
- package/fesm2022/ojiepermana-angular-component-combobox.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-component-command.mjs +297 -0
- package/fesm2022/ojiepermana-angular-component-command.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-component-composer.mjs +352 -0
- package/fesm2022/ojiepermana-angular-component-composer.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-component-context-menu.mjs +108 -0
- package/fesm2022/ojiepermana-angular-component-context-menu.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-component-date-picker.mjs +186 -0
- package/fesm2022/ojiepermana-angular-component-date-picker.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-component-dialog.mjs +283 -0
- package/fesm2022/ojiepermana-angular-component-dialog.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-component-drawer.mjs +6 -0
- package/fesm2022/ojiepermana-angular-component-drawer.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-component-dropdown-menu.mjs +494 -0
- package/fesm2022/ojiepermana-angular-component-dropdown-menu.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-component-editor.mjs +680 -0
- package/fesm2022/ojiepermana-angular-component-editor.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-component-empty.mjs +145 -0
- package/fesm2022/ojiepermana-angular-component-empty.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-component-form.mjs +364 -0
- package/fesm2022/ojiepermana-angular-component-form.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-component-hover-card.mjs +275 -0
- package/fesm2022/ojiepermana-angular-component-hover-card.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-component-icon.mjs +86 -0
- package/fesm2022/ojiepermana-angular-component-icon.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-component-input-group.mjs +179 -0
- package/fesm2022/ojiepermana-angular-component-input-group.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-component-input-otp.mjs +517 -0
- package/fesm2022/ojiepermana-angular-component-input-otp.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-component-input.mjs +45 -0
- package/fesm2022/ojiepermana-angular-component-input.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-component-item.mjs +264 -0
- package/fesm2022/ojiepermana-angular-component-item.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-component-kanban.mjs +314 -0
- package/fesm2022/ojiepermana-angular-component-kanban.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-component-kbd.mjs +55 -0
- package/fesm2022/ojiepermana-angular-component-kbd.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-component-label.mjs +33 -0
- package/fesm2022/ojiepermana-angular-component-label.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-component-menubar.mjs +311 -0
- package/fesm2022/ojiepermana-angular-component-menubar.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-component-native-select.mjs +67 -0
- package/fesm2022/ojiepermana-angular-component-native-select.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-component-navigation-menu.mjs +408 -0
- package/fesm2022/ojiepermana-angular-component-navigation-menu.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-component-pagination.mjs +226 -0
- package/fesm2022/ojiepermana-angular-component-pagination.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-component-pillbox.mjs +810 -0
- package/fesm2022/ojiepermana-angular-component-pillbox.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-component-popover.mjs +145 -0
- package/fesm2022/ojiepermana-angular-component-popover.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-component-progress.mjs +60 -0
- package/fesm2022/ojiepermana-angular-component-progress.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-component-radio.mjs +173 -0
- package/fesm2022/ojiepermana-angular-component-radio.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-component-resizable.mjs +478 -0
- package/fesm2022/ojiepermana-angular-component-resizable.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-component-scroll-area.mjs +54 -0
- package/fesm2022/ojiepermana-angular-component-scroll-area.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-component-select.mjs +297 -0
- package/fesm2022/ojiepermana-angular-component-select.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-component-separator.mjs +37 -0
- package/fesm2022/ojiepermana-angular-component-separator.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-component-sheet.mjs +297 -0
- package/fesm2022/ojiepermana-angular-component-sheet.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-component-skeleton.mjs +31 -0
- package/fesm2022/ojiepermana-angular-component-skeleton.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-component-slider.mjs +423 -0
- package/fesm2022/ojiepermana-angular-component-slider.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-component-spinner.mjs +60 -0
- package/fesm2022/ojiepermana-angular-component-spinner.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-component-switch.mjs +140 -0
- package/fesm2022/ojiepermana-angular-component-switch.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-component-table.mjs +155 -0
- package/fesm2022/ojiepermana-angular-component-table.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-component-tabs.mjs +271 -0
- package/fesm2022/ojiepermana-angular-component-tabs.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-component-textarea.mjs +39 -0
- package/fesm2022/ojiepermana-angular-component-textarea.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-component-timeline.mjs +237 -0
- package/fesm2022/ojiepermana-angular-component-timeline.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-component-toast.mjs +161 -0
- package/fesm2022/ojiepermana-angular-component-toast.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-component-toggle-group.mjs +289 -0
- package/fesm2022/ojiepermana-angular-component-toggle-group.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-component-toggle.mjs +82 -0
- package/fesm2022/ojiepermana-angular-component-toggle.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-component-tooltip.mjs +410 -0
- package/fesm2022/ojiepermana-angular-component-tooltip.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-component-utils.mjs +81 -0
- package/fesm2022/ojiepermana-angular-component-utils.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-component.mjs +11 -0
- package/fesm2022/ojiepermana-angular-component.mjs.map +1 -0
- package/form/README.md +210 -0
- package/hover-card/README.md +142 -0
- package/icon/README.md +25 -0
- package/input/README.md +159 -0
- package/input-group/README.md +237 -0
- package/input-otp/README.md +278 -0
- package/item/README.md +247 -0
- package/kanban/README.md +81 -0
- package/kbd/README.md +139 -0
- package/label/README.md +135 -0
- package/menubar/README.md +269 -0
- package/native-select/README.md +176 -0
- package/navigation-menu/README.md +160 -0
- package/package.json +291 -0
- package/pagination/README.md +144 -0
- package/pillbox/README.md +67 -0
- package/popover/README.md +43 -0
- package/progress/README.md +160 -0
- package/radio/README.md +209 -0
- package/resizable/README.md +168 -0
- package/scroll-area/README.md +143 -0
- package/select/README.md +174 -0
- package/separator/README.md +170 -0
- package/sheet/README.md +183 -0
- package/skeleton/README.md +158 -0
- package/slider/README.md +207 -0
- package/spinner/README.md +160 -0
- package/switch/README.md +166 -0
- package/table/README.md +291 -0
- package/tabs/README.md +214 -0
- package/textarea/README.md +153 -0
- package/timeline/README.md +94 -0
- package/toast/README.md +321 -0
- package/toggle/README.md +131 -0
- package/toggle-group/README.md +206 -0
- package/tooltip/README.md +207 -0
- package/types/ojiepermana-angular-component-accordion.d.ts +51 -0
- package/types/ojiepermana-angular-component-alert-dialog.d.ts +93 -0
- package/types/ojiepermana-angular-component-alert.d.ts +37 -0
- package/types/ojiepermana-angular-component-aspect-ratio.d.ts +12 -0
- package/types/ojiepermana-angular-component-avatar.d.ts +51 -0
- package/types/ojiepermana-angular-component-badge.d.ts +19 -0
- package/types/ojiepermana-angular-component-breadcrumb.d.ts +46 -0
- package/types/ojiepermana-angular-component-button-group.d.ts +26 -0
- package/types/ojiepermana-angular-component-button.d.ts +22 -0
- package/types/ojiepermana-angular-component-calendar.d.ts +39 -0
- package/types/ojiepermana-angular-component-card.d.ts +60 -0
- package/types/ojiepermana-angular-component-carousel.d.ts +86 -0
- package/types/ojiepermana-angular-component-checkbox.d.ts +42 -0
- package/types/ojiepermana-angular-component-collapsible.d.ts +42 -0
- package/types/ojiepermana-angular-component-combobox.d.ts +53 -0
- package/types/ojiepermana-angular-component-command.d.ts +102 -0
- package/types/ojiepermana-angular-component-composer.d.ts +90 -0
- package/types/ojiepermana-angular-component-context-menu.d.ts +36 -0
- package/types/ojiepermana-angular-component-date-picker.d.ts +48 -0
- package/types/ojiepermana-angular-component-dialog.d.ts +87 -0
- package/types/ojiepermana-angular-component-drawer.d.ts +1 -0
- package/types/ojiepermana-angular-component-dropdown-menu.d.ts +140 -0
- package/types/ojiepermana-angular-component-editor.d.ts +126 -0
- package/types/ojiepermana-angular-component-empty.d.ts +50 -0
- package/types/ojiepermana-angular-component-form.d.ts +140 -0
- package/types/ojiepermana-angular-component-hover-card.d.ts +75 -0
- package/types/ojiepermana-angular-component-icon.d.ts +31 -0
- package/types/ojiepermana-angular-component-input-group.d.ts +51 -0
- package/types/ojiepermana-angular-component-input-otp.d.ts +142 -0
- package/types/ojiepermana-angular-component-input.d.ts +16 -0
- package/types/ojiepermana-angular-component-item.d.ts +88 -0
- package/types/ojiepermana-angular-component-kanban.d.ts +70 -0
- package/types/ojiepermana-angular-component-kbd.d.ts +16 -0
- package/types/ojiepermana-angular-component-label.d.ts +11 -0
- package/types/ojiepermana-angular-component-menubar.d.ts +69 -0
- package/types/ojiepermana-angular-component-native-select.d.ts +26 -0
- package/types/ojiepermana-angular-component-navigation-menu.d.ts +98 -0
- package/types/ojiepermana-angular-component-pagination.d.ts +33 -0
- package/types/ojiepermana-angular-component-pillbox.d.ts +156 -0
- package/types/ojiepermana-angular-component-popover.d.ts +50 -0
- package/types/ojiepermana-angular-component-progress.d.ts +17 -0
- package/types/ojiepermana-angular-component-radio.d.ts +57 -0
- package/types/ojiepermana-angular-component-resizable.d.ts +99 -0
- package/types/ojiepermana-angular-component-scroll-area.d.ts +19 -0
- package/types/ojiepermana-angular-component-select.d.ts +56 -0
- package/types/ojiepermana-angular-component-separator.d.ts +14 -0
- package/types/ojiepermana-angular-component-sheet.d.ts +78 -0
- package/types/ojiepermana-angular-component-skeleton.d.ts +10 -0
- package/types/ojiepermana-angular-component-slider.d.ts +74 -0
- package/types/ojiepermana-angular-component-spinner.d.ts +13 -0
- package/types/ojiepermana-angular-component-switch.d.ts +44 -0
- package/types/ojiepermana-angular-component-table.d.ts +52 -0
- package/types/ojiepermana-angular-component-tabs.d.ts +92 -0
- package/types/ojiepermana-angular-component-textarea.d.ts +12 -0
- package/types/ojiepermana-angular-component-timeline.d.ts +63 -0
- package/types/ojiepermana-angular-component-toast.d.ts +51 -0
- package/types/ojiepermana-angular-component-toggle-group.d.ts +89 -0
- package/types/ojiepermana-angular-component-toggle.d.ts +25 -0
- package/types/ojiepermana-angular-component-tooltip.d.ts +101 -0
- package/types/ojiepermana-angular-component-utils.d.ts +30 -0
- package/types/ojiepermana-angular-component.d.ts +2 -0
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
import { isPlatformBrowser } from '@angular/common';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { Directive, input, output, signal, inject, PLATFORM_ID, computed, effect, forwardRef, ChangeDetectionStrategy, Component, viewChild } from '@angular/core';
|
|
4
|
+
import EmblaCarousel from 'embla-carousel';
|
|
5
|
+
import { cn } from '@ojiepermana/angular-component/utils';
|
|
6
|
+
|
|
7
|
+
class CarouselContextBase {
|
|
8
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CarouselContextBase, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
9
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.2", type: CarouselContextBase, isStandalone: true, ngImport: i0 });
|
|
10
|
+
}
|
|
11
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CarouselContextBase, decorators: [{
|
|
12
|
+
type: Directive
|
|
13
|
+
}] });
|
|
14
|
+
class CarouselComponent extends CarouselContextBase {
|
|
15
|
+
orientation = input('horizontal', /* @ts-ignore */
|
|
16
|
+
...(ngDevMode ? [{ debugName: "orientation" }] : /* istanbul ignore next */ []));
|
|
17
|
+
opts = input({}, /* @ts-ignore */
|
|
18
|
+
...(ngDevMode ? [{ debugName: "opts" }] : /* istanbul ignore next */ []));
|
|
19
|
+
plugins = input([], /* @ts-ignore */
|
|
20
|
+
...(ngDevMode ? [{ debugName: "plugins" }] : /* istanbul ignore next */ []));
|
|
21
|
+
keyboard = input(true, /* @ts-ignore */
|
|
22
|
+
...(ngDevMode ? [{ debugName: "keyboard" }] : /* istanbul ignore next */ []));
|
|
23
|
+
label = input('Carousel', /* @ts-ignore */
|
|
24
|
+
...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
25
|
+
class = input('', /* @ts-ignore */
|
|
26
|
+
...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
27
|
+
apiReady = output();
|
|
28
|
+
apiChange = output();
|
|
29
|
+
selectedIndex = signal(0, /* @ts-ignore */
|
|
30
|
+
...(ngDevMode ? [{ debugName: "selectedIndex" }] : /* istanbul ignore next */ []));
|
|
31
|
+
slideCount = signal(0, /* @ts-ignore */
|
|
32
|
+
...(ngDevMode ? [{ debugName: "slideCount" }] : /* istanbul ignore next */ []));
|
|
33
|
+
canScrollPrev = signal(false, /* @ts-ignore */
|
|
34
|
+
...(ngDevMode ? [{ debugName: "canScrollPrev" }] : /* istanbul ignore next */ []));
|
|
35
|
+
canScrollNext = signal(false, /* @ts-ignore */
|
|
36
|
+
...(ngDevMode ? [{ debugName: "canScrollNext" }] : /* istanbul ignore next */ []));
|
|
37
|
+
isBrowser = isPlatformBrowser(inject(PLATFORM_ID));
|
|
38
|
+
viewport = signal(null, /* @ts-ignore */
|
|
39
|
+
...(ngDevMode ? [{ debugName: "viewport" }] : /* istanbul ignore next */ []));
|
|
40
|
+
api = null;
|
|
41
|
+
classes = computed(() => cn('relative block', this.class()), /* @ts-ignore */
|
|
42
|
+
...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
|
|
43
|
+
constructor() {
|
|
44
|
+
super();
|
|
45
|
+
effect((onCleanup) => {
|
|
46
|
+
const viewport = this.viewport();
|
|
47
|
+
const orientation = this.orientation();
|
|
48
|
+
const opts = this.opts();
|
|
49
|
+
const plugins = this.plugins();
|
|
50
|
+
if (!this.isBrowser || !viewport) {
|
|
51
|
+
this.api = null;
|
|
52
|
+
this.resetState();
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
const carousel = EmblaCarousel(viewport, { ...opts, axis: orientation === 'horizontal' ? 'x' : 'y' }, [
|
|
56
|
+
...plugins,
|
|
57
|
+
]);
|
|
58
|
+
const updateState = () => this.updateState(carousel);
|
|
59
|
+
this.api = carousel;
|
|
60
|
+
this.apiChange.emit(carousel);
|
|
61
|
+
this.apiReady.emit(carousel);
|
|
62
|
+
updateState();
|
|
63
|
+
carousel.on('select', updateState);
|
|
64
|
+
carousel.on('reInit', updateState);
|
|
65
|
+
carousel.on('resize', updateState);
|
|
66
|
+
onCleanup(() => {
|
|
67
|
+
carousel.destroy();
|
|
68
|
+
if (this.api === carousel) {
|
|
69
|
+
this.api = null;
|
|
70
|
+
this.apiChange.emit(null);
|
|
71
|
+
this.resetState();
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
registerViewport(viewport) {
|
|
77
|
+
this.viewport.set(viewport);
|
|
78
|
+
}
|
|
79
|
+
unregisterViewport(viewport) {
|
|
80
|
+
if (this.viewport() === viewport) {
|
|
81
|
+
this.viewport.set(null);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
scrollPrev() {
|
|
85
|
+
this.api?.scrollPrev();
|
|
86
|
+
}
|
|
87
|
+
scrollNext() {
|
|
88
|
+
this.api?.scrollNext();
|
|
89
|
+
}
|
|
90
|
+
scrollTo(index) {
|
|
91
|
+
this.api?.scrollTo(index);
|
|
92
|
+
}
|
|
93
|
+
onKeydown(event) {
|
|
94
|
+
if (!this.keyboard())
|
|
95
|
+
return;
|
|
96
|
+
const horizontal = this.orientation() === 'horizontal';
|
|
97
|
+
const previousKey = horizontal ? 'ArrowLeft' : 'ArrowUp';
|
|
98
|
+
const nextKey = horizontal ? 'ArrowRight' : 'ArrowDown';
|
|
99
|
+
if (event.key === previousKey) {
|
|
100
|
+
event.preventDefault();
|
|
101
|
+
this.scrollPrev();
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
if (event.key === nextKey) {
|
|
105
|
+
event.preventDefault();
|
|
106
|
+
this.scrollNext();
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
if (event.key === 'Home') {
|
|
110
|
+
event.preventDefault();
|
|
111
|
+
this.scrollTo(0);
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
if (event.key === 'End') {
|
|
115
|
+
event.preventDefault();
|
|
116
|
+
this.scrollTo(Math.max(0, this.slideCount() - 1));
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
updateState(carousel) {
|
|
120
|
+
this.slideCount.set(carousel.scrollSnapList().length);
|
|
121
|
+
this.selectedIndex.set(carousel.selectedScrollSnap());
|
|
122
|
+
this.canScrollPrev.set(carousel.canScrollPrev());
|
|
123
|
+
this.canScrollNext.set(carousel.canScrollNext());
|
|
124
|
+
}
|
|
125
|
+
resetState() {
|
|
126
|
+
this.selectedIndex.set(0);
|
|
127
|
+
this.slideCount.set(0);
|
|
128
|
+
this.canScrollPrev.set(false);
|
|
129
|
+
this.canScrollNext.set(false);
|
|
130
|
+
}
|
|
131
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CarouselComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
132
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.2", type: CarouselComponent, isStandalone: true, selector: "Carousel", inputs: { orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null }, opts: { classPropertyName: "opts", publicName: "opts", isSignal: true, isRequired: false, transformFunction: null }, plugins: { classPropertyName: "plugins", publicName: "plugins", isSignal: true, isRequired: false, transformFunction: null }, keyboard: { classPropertyName: "keyboard", publicName: "keyboard", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { apiReady: "apiReady", apiChange: "apiChange" }, host: { listeners: { "keydown": "onKeydown($event)" }, properties: { "class": "classes()", "attr.role": "\"region\"", "attr.aria-roledescription": "\"carousel\"", "attr.aria-label": "label()", "attr.data-orientation": "orientation()", "attr.tabindex": "keyboard() ? 0 : null" } }, providers: [{ provide: CarouselContextBase, useExisting: forwardRef(() => CarouselComponent) }], usesInheritance: true, ngImport: i0, template: `<ng-content />`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
133
|
+
}
|
|
134
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CarouselComponent, decorators: [{
|
|
135
|
+
type: Component,
|
|
136
|
+
args: [{
|
|
137
|
+
selector: 'Carousel',
|
|
138
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
139
|
+
providers: [{ provide: CarouselContextBase, useExisting: forwardRef(() => CarouselComponent) }],
|
|
140
|
+
host: {
|
|
141
|
+
'[class]': 'classes()',
|
|
142
|
+
'[attr.role]': '"region"',
|
|
143
|
+
'[attr.aria-roledescription]': '"carousel"',
|
|
144
|
+
'[attr.aria-label]': 'label()',
|
|
145
|
+
'[attr.data-orientation]': 'orientation()',
|
|
146
|
+
'[attr.tabindex]': 'keyboard() ? 0 : null',
|
|
147
|
+
'(keydown)': 'onKeydown($event)',
|
|
148
|
+
},
|
|
149
|
+
template: `<ng-content />`,
|
|
150
|
+
}]
|
|
151
|
+
}], ctorParameters: () => [], propDecorators: { orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "orientation", required: false }] }], opts: [{ type: i0.Input, args: [{ isSignal: true, alias: "opts", required: false }] }], plugins: [{ type: i0.Input, args: [{ isSignal: true, alias: "plugins", required: false }] }], keyboard: [{ type: i0.Input, args: [{ isSignal: true, alias: "keyboard", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], apiReady: [{ type: i0.Output, args: ["apiReady"] }], apiChange: [{ type: i0.Output, args: ["apiChange"] }] } });
|
|
152
|
+
class CarouselContentComponent {
|
|
153
|
+
ctx = inject(CarouselContextBase);
|
|
154
|
+
viewport = viewChild('viewport', /* @ts-ignore */
|
|
155
|
+
...(ngDevMode ? [{ debugName: "viewport" }] : /* istanbul ignore next */ []));
|
|
156
|
+
class = input('', /* @ts-ignore */
|
|
157
|
+
...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
158
|
+
contentClasses = computed(() => cn('flex', this.ctx.orientation() === 'horizontal' ? '-ml-4' : '-mt-4 flex-col', this.class()), /* @ts-ignore */
|
|
159
|
+
...(ngDevMode ? [{ debugName: "contentClasses" }] : /* istanbul ignore next */ []));
|
|
160
|
+
ngAfterViewInit() {
|
|
161
|
+
const viewport = this.viewport()?.nativeElement;
|
|
162
|
+
if (viewport)
|
|
163
|
+
this.ctx.registerViewport(viewport);
|
|
164
|
+
}
|
|
165
|
+
ngOnDestroy() {
|
|
166
|
+
const viewport = this.viewport()?.nativeElement;
|
|
167
|
+
if (viewport)
|
|
168
|
+
this.ctx.unregisterViewport(viewport);
|
|
169
|
+
}
|
|
170
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CarouselContentComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
171
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.0.2", type: CarouselContentComponent, isStandalone: true, selector: "CarouselContent", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "\"block\"" } }, viewQueries: [{ propertyName: "viewport", first: true, predicate: ["viewport"], descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
172
|
+
<div #viewport class="overflow-hidden">
|
|
173
|
+
<div [class]="contentClasses()"><ng-content /></div>
|
|
174
|
+
</div>
|
|
175
|
+
`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
176
|
+
}
|
|
177
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CarouselContentComponent, decorators: [{
|
|
178
|
+
type: Component,
|
|
179
|
+
args: [{
|
|
180
|
+
selector: 'CarouselContent',
|
|
181
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
182
|
+
host: {
|
|
183
|
+
'[class]': '"block"',
|
|
184
|
+
},
|
|
185
|
+
template: `
|
|
186
|
+
<div #viewport class="overflow-hidden">
|
|
187
|
+
<div [class]="contentClasses()"><ng-content /></div>
|
|
188
|
+
</div>
|
|
189
|
+
`,
|
|
190
|
+
}]
|
|
191
|
+
}], propDecorators: { viewport: [{ type: i0.ViewChild, args: ['viewport', { isSignal: true }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
192
|
+
class CarouselItemComponent {
|
|
193
|
+
ctx = inject(CarouselContextBase);
|
|
194
|
+
ariaLabel = input(null, /* @ts-ignore */
|
|
195
|
+
...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
196
|
+
class = input('', /* @ts-ignore */
|
|
197
|
+
...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
198
|
+
classes = computed(() => cn('min-w-0 shrink-0 grow-0 basis-full', this.ctx.orientation() === 'horizontal' ? 'pl-4' : 'pt-4', this.class()), /* @ts-ignore */
|
|
199
|
+
...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
|
|
200
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CarouselItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
201
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.2", type: CarouselItemComponent, isStandalone: true, selector: "CarouselItem", inputs: { ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "classes()", "attr.role": "\"group\"", "attr.aria-roledescription": "\"slide\"", "attr.aria-label": "ariaLabel()" } }, ngImport: i0, template: `<ng-content />`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
202
|
+
}
|
|
203
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CarouselItemComponent, decorators: [{
|
|
204
|
+
type: Component,
|
|
205
|
+
args: [{
|
|
206
|
+
selector: 'CarouselItem',
|
|
207
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
208
|
+
host: {
|
|
209
|
+
'[class]': 'classes()',
|
|
210
|
+
'[attr.role]': '"group"',
|
|
211
|
+
'[attr.aria-roledescription]': '"slide"',
|
|
212
|
+
'[attr.aria-label]': 'ariaLabel()',
|
|
213
|
+
},
|
|
214
|
+
template: `<ng-content />`,
|
|
215
|
+
}]
|
|
216
|
+
}], propDecorators: { ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
217
|
+
class CarouselPreviousComponent {
|
|
218
|
+
ctx = inject(CarouselContextBase);
|
|
219
|
+
label = input('Previous slide', /* @ts-ignore */
|
|
220
|
+
...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
221
|
+
class = input('', /* @ts-ignore */
|
|
222
|
+
...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
223
|
+
classes = computed(() => cn(carouselButtonClasses, carouselPreviousPlacement(this.ctx.orientation()), this.class()), /* @ts-ignore */
|
|
224
|
+
...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
|
|
225
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CarouselPreviousComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
226
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.2", type: CarouselPreviousComponent, isStandalone: true, selector: "button[CarouselPrevious]", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "type": "button" }, listeners: { "click": "ctx.scrollPrev()" }, properties: { "class": "classes()", "attr.aria-label": "label()", "disabled": "!ctx.canScrollPrev() || null" } }, ngImport: i0, template: `
|
|
227
|
+
<svg
|
|
228
|
+
aria-hidden="true"
|
|
229
|
+
class="h-4 w-4"
|
|
230
|
+
viewBox="0 0 24 24"
|
|
231
|
+
fill="none"
|
|
232
|
+
stroke="currentColor"
|
|
233
|
+
stroke-width="2"
|
|
234
|
+
stroke-linecap="round"
|
|
235
|
+
stroke-linejoin="round">
|
|
236
|
+
<path d="m15 18-6-6 6-6" />
|
|
237
|
+
</svg>
|
|
238
|
+
`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
239
|
+
}
|
|
240
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CarouselPreviousComponent, decorators: [{
|
|
241
|
+
type: Component,
|
|
242
|
+
args: [{
|
|
243
|
+
selector: 'button[CarouselPrevious]',
|
|
244
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
245
|
+
host: {
|
|
246
|
+
'[class]': 'classes()',
|
|
247
|
+
type: 'button',
|
|
248
|
+
'[attr.aria-label]': 'label()',
|
|
249
|
+
'[disabled]': '!ctx.canScrollPrev() || null',
|
|
250
|
+
'(click)': 'ctx.scrollPrev()',
|
|
251
|
+
},
|
|
252
|
+
template: `
|
|
253
|
+
<svg
|
|
254
|
+
aria-hidden="true"
|
|
255
|
+
class="h-4 w-4"
|
|
256
|
+
viewBox="0 0 24 24"
|
|
257
|
+
fill="none"
|
|
258
|
+
stroke="currentColor"
|
|
259
|
+
stroke-width="2"
|
|
260
|
+
stroke-linecap="round"
|
|
261
|
+
stroke-linejoin="round">
|
|
262
|
+
<path d="m15 18-6-6 6-6" />
|
|
263
|
+
</svg>
|
|
264
|
+
`,
|
|
265
|
+
}]
|
|
266
|
+
}], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
267
|
+
class CarouselNextComponent {
|
|
268
|
+
ctx = inject(CarouselContextBase);
|
|
269
|
+
label = input('Next slide', /* @ts-ignore */
|
|
270
|
+
...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
271
|
+
class = input('', /* @ts-ignore */
|
|
272
|
+
...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
273
|
+
classes = computed(() => cn(carouselButtonClasses, carouselNextPlacement(this.ctx.orientation()), this.class()), /* @ts-ignore */
|
|
274
|
+
...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
|
|
275
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CarouselNextComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
276
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.2", type: CarouselNextComponent, isStandalone: true, selector: "button[CarouselNext]", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "type": "button" }, listeners: { "click": "ctx.scrollNext()" }, properties: { "class": "classes()", "attr.aria-label": "label()", "disabled": "!ctx.canScrollNext() || null" } }, ngImport: i0, template: `
|
|
277
|
+
<svg
|
|
278
|
+
aria-hidden="true"
|
|
279
|
+
class="h-4 w-4"
|
|
280
|
+
viewBox="0 0 24 24"
|
|
281
|
+
fill="none"
|
|
282
|
+
stroke="currentColor"
|
|
283
|
+
stroke-width="2"
|
|
284
|
+
stroke-linecap="round"
|
|
285
|
+
stroke-linejoin="round">
|
|
286
|
+
<path d="m9 18 6-6-6-6" />
|
|
287
|
+
</svg>
|
|
288
|
+
`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
289
|
+
}
|
|
290
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CarouselNextComponent, decorators: [{
|
|
291
|
+
type: Component,
|
|
292
|
+
args: [{
|
|
293
|
+
selector: 'button[CarouselNext]',
|
|
294
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
295
|
+
host: {
|
|
296
|
+
'[class]': 'classes()',
|
|
297
|
+
type: 'button',
|
|
298
|
+
'[attr.aria-label]': 'label()',
|
|
299
|
+
'[disabled]': '!ctx.canScrollNext() || null',
|
|
300
|
+
'(click)': 'ctx.scrollNext()',
|
|
301
|
+
},
|
|
302
|
+
template: `
|
|
303
|
+
<svg
|
|
304
|
+
aria-hidden="true"
|
|
305
|
+
class="h-4 w-4"
|
|
306
|
+
viewBox="0 0 24 24"
|
|
307
|
+
fill="none"
|
|
308
|
+
stroke="currentColor"
|
|
309
|
+
stroke-width="2"
|
|
310
|
+
stroke-linecap="round"
|
|
311
|
+
stroke-linejoin="round">
|
|
312
|
+
<path d="m9 18 6-6-6-6" />
|
|
313
|
+
</svg>
|
|
314
|
+
`,
|
|
315
|
+
}]
|
|
316
|
+
}], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
317
|
+
const carouselButtonClasses = 'absolute inline-flex h-8 w-8 items-center justify-center rounded-full border border-border bg-background p-0 text-foreground shadow-sm transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50';
|
|
318
|
+
function carouselPreviousPlacement(orientation) {
|
|
319
|
+
return orientation === 'horizontal'
|
|
320
|
+
? '-left-12 top-1/2 -translate-y-1/2'
|
|
321
|
+
: '-top-12 left-1/2 -translate-x-1/2 rotate-90';
|
|
322
|
+
}
|
|
323
|
+
function carouselNextPlacement(orientation) {
|
|
324
|
+
return orientation === 'horizontal'
|
|
325
|
+
? '-right-12 top-1/2 -translate-y-1/2'
|
|
326
|
+
: '-bottom-12 left-1/2 -translate-x-1/2 rotate-90';
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* Generated bundle index. Do not edit.
|
|
331
|
+
*/
|
|
332
|
+
|
|
333
|
+
export { CarouselComponent, CarouselContentComponent, CarouselContextBase, CarouselItemComponent, CarouselNextComponent, CarouselPreviousComponent };
|
|
334
|
+
//# sourceMappingURL=ojiepermana-angular-component-carousel.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ojiepermana-angular-component-carousel.mjs","sources":["../../../library/component/carousel/carousel.component.ts","../../../library/component/carousel/ojiepermana-angular-component-carousel.ts"],"sourcesContent":["import { isPlatformBrowser } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n Directive,\n ElementRef,\n PLATFORM_ID,\n computed,\n effect,\n forwardRef,\n inject,\n input,\n output,\n signal,\n viewChild,\n type InputSignal,\n type Signal,\n} from '@angular/core';\nimport EmblaCarousel, { type EmblaCarouselType, type EmblaOptionsType, type EmblaPluginType } from 'embla-carousel';\nimport { cn } from '@ojiepermana/angular-component/utils';\n\nexport type CarouselApi = EmblaCarouselType;\nexport type CarouselOptions = EmblaOptionsType;\nexport type CarouselPlugin = EmblaPluginType;\nexport type CarouselOrientation = 'horizontal' | 'vertical';\n\n@Directive()\nexport abstract class CarouselContextBase {\n abstract readonly orientation: Signal<CarouselOrientation>;\n abstract readonly canScrollPrev: Signal<boolean>;\n abstract readonly canScrollNext: Signal<boolean>;\n\n abstract registerViewport(viewport: HTMLElement): void;\n abstract unregisterViewport(viewport: HTMLElement): void;\n abstract scrollPrev(): void;\n abstract scrollNext(): void;\n abstract scrollTo(index: number): void;\n}\n\n@Component({\n selector: 'Carousel',\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [{ provide: CarouselContextBase, useExisting: forwardRef(() => CarouselComponent) }],\n host: {\n '[class]': 'classes()',\n '[attr.role]': '\"region\"',\n '[attr.aria-roledescription]': '\"carousel\"',\n '[attr.aria-label]': 'label()',\n '[attr.data-orientation]': 'orientation()',\n '[attr.tabindex]': 'keyboard() ? 0 : null',\n '(keydown)': 'onKeydown($event)',\n },\n template: `<ng-content />`,\n})\nexport class CarouselComponent extends CarouselContextBase {\n override readonly orientation = input<CarouselOrientation>('horizontal');\n readonly opts: InputSignal<CarouselOptions> = input<CarouselOptions>({});\n readonly plugins: InputSignal<readonly CarouselPlugin[]> = input<readonly CarouselPlugin[]>([]);\n readonly keyboard = input<boolean>(true);\n readonly label = input<string>('Carousel');\n readonly class = input<string>('');\n\n readonly apiReady = output<CarouselApi>();\n readonly apiChange = output<CarouselApi | null>();\n\n readonly selectedIndex = signal(0);\n readonly slideCount = signal(0);\n override readonly canScrollPrev = signal(false);\n override readonly canScrollNext = signal(false);\n\n private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n private readonly viewport = signal<HTMLElement | null>(null);\n private api: CarouselApi | null = null;\n\n protected readonly classes = computed(() => cn('relative block', this.class()));\n\n constructor() {\n super();\n\n effect((onCleanup) => {\n const viewport = this.viewport();\n const orientation = this.orientation();\n const opts = this.opts();\n const plugins = this.plugins();\n\n if (!this.isBrowser || !viewport) {\n this.api = null;\n this.resetState();\n return;\n }\n\n const carousel = EmblaCarousel(viewport, { ...opts, axis: orientation === 'horizontal' ? 'x' : 'y' }, [\n ...plugins,\n ]);\n const updateState = (): void => this.updateState(carousel);\n\n this.api = carousel;\n this.apiChange.emit(carousel);\n this.apiReady.emit(carousel);\n\n updateState();\n carousel.on('select', updateState);\n carousel.on('reInit', updateState);\n carousel.on('resize', updateState);\n\n onCleanup(() => {\n carousel.destroy();\n if (this.api === carousel) {\n this.api = null;\n this.apiChange.emit(null);\n this.resetState();\n }\n });\n });\n }\n\n override registerViewport(viewport: HTMLElement): void {\n this.viewport.set(viewport);\n }\n\n override unregisterViewport(viewport: HTMLElement): void {\n if (this.viewport() === viewport) {\n this.viewport.set(null);\n }\n }\n\n override scrollPrev(): void {\n this.api?.scrollPrev();\n }\n\n override scrollNext(): void {\n this.api?.scrollNext();\n }\n\n override scrollTo(index: number): void {\n this.api?.scrollTo(index);\n }\n\n protected onKeydown(event: KeyboardEvent): void {\n if (!this.keyboard()) return;\n\n const horizontal = this.orientation() === 'horizontal';\n const previousKey = horizontal ? 'ArrowLeft' : 'ArrowUp';\n const nextKey = horizontal ? 'ArrowRight' : 'ArrowDown';\n\n if (event.key === previousKey) {\n event.preventDefault();\n this.scrollPrev();\n return;\n }\n\n if (event.key === nextKey) {\n event.preventDefault();\n this.scrollNext();\n return;\n }\n\n if (event.key === 'Home') {\n event.preventDefault();\n this.scrollTo(0);\n return;\n }\n\n if (event.key === 'End') {\n event.preventDefault();\n this.scrollTo(Math.max(0, this.slideCount() - 1));\n }\n }\n\n private updateState(carousel: CarouselApi): void {\n this.slideCount.set(carousel.scrollSnapList().length);\n this.selectedIndex.set(carousel.selectedScrollSnap());\n this.canScrollPrev.set(carousel.canScrollPrev());\n this.canScrollNext.set(carousel.canScrollNext());\n }\n\n private resetState(): void {\n this.selectedIndex.set(0);\n this.slideCount.set(0);\n this.canScrollPrev.set(false);\n this.canScrollNext.set(false);\n }\n}\n\n@Component({\n selector: 'CarouselContent',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n '[class]': '\"block\"',\n },\n template: `\n <div #viewport class=\"overflow-hidden\">\n <div [class]=\"contentClasses()\"><ng-content /></div>\n </div>\n `,\n})\nexport class CarouselContentComponent {\n private readonly ctx = inject(CarouselContextBase);\n private readonly viewport = viewChild<ElementRef<HTMLElement>>('viewport');\n\n readonly class = input<string>('');\n\n protected readonly contentClasses = computed(() =>\n cn('flex', this.ctx.orientation() === 'horizontal' ? '-ml-4' : '-mt-4 flex-col', this.class()),\n );\n\n ngAfterViewInit(): void {\n const viewport = this.viewport()?.nativeElement;\n if (viewport) this.ctx.registerViewport(viewport);\n }\n\n ngOnDestroy(): void {\n const viewport = this.viewport()?.nativeElement;\n if (viewport) this.ctx.unregisterViewport(viewport);\n }\n}\n\n@Component({\n selector: 'CarouselItem',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n '[class]': 'classes()',\n '[attr.role]': '\"group\"',\n '[attr.aria-roledescription]': '\"slide\"',\n '[attr.aria-label]': 'ariaLabel()',\n },\n template: `<ng-content />`,\n})\nexport class CarouselItemComponent {\n private readonly ctx = inject(CarouselContextBase);\n\n readonly ariaLabel = input<string | null>(null);\n readonly class = input<string>('');\n\n protected readonly classes = computed(() =>\n cn('min-w-0 shrink-0 grow-0 basis-full', this.ctx.orientation() === 'horizontal' ? 'pl-4' : 'pt-4', this.class()),\n );\n}\n\n@Component({\n selector: 'button[CarouselPrevious]',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n '[class]': 'classes()',\n type: 'button',\n '[attr.aria-label]': 'label()',\n '[disabled]': '!ctx.canScrollPrev() || null',\n '(click)': 'ctx.scrollPrev()',\n },\n template: `\n <svg\n aria-hidden=\"true\"\n class=\"h-4 w-4\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\">\n <path d=\"m15 18-6-6 6-6\" />\n </svg>\n `,\n})\nexport class CarouselPreviousComponent {\n protected readonly ctx = inject(CarouselContextBase);\n\n readonly label = input<string>('Previous slide');\n readonly class = input<string>('');\n\n protected readonly classes = computed(() =>\n cn(carouselButtonClasses, carouselPreviousPlacement(this.ctx.orientation()), this.class()),\n );\n}\n\n@Component({\n selector: 'button[CarouselNext]',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n '[class]': 'classes()',\n type: 'button',\n '[attr.aria-label]': 'label()',\n '[disabled]': '!ctx.canScrollNext() || null',\n '(click)': 'ctx.scrollNext()',\n },\n template: `\n <svg\n aria-hidden=\"true\"\n class=\"h-4 w-4\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\">\n <path d=\"m9 18 6-6-6-6\" />\n </svg>\n `,\n})\nexport class CarouselNextComponent {\n protected readonly ctx = inject(CarouselContextBase);\n\n readonly label = input<string>('Next slide');\n readonly class = input<string>('');\n\n protected readonly classes = computed(() =>\n cn(carouselButtonClasses, carouselNextPlacement(this.ctx.orientation()), this.class()),\n );\n}\n\nconst carouselButtonClasses =\n 'absolute inline-flex h-8 w-8 items-center justify-center rounded-full border border-border bg-background p-0 text-foreground shadow-sm transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50';\n\nfunction carouselPreviousPlacement(orientation: CarouselOrientation): string {\n return orientation === 'horizontal'\n ? '-left-12 top-1/2 -translate-y-1/2'\n : '-top-12 left-1/2 -translate-x-1/2 rotate-90';\n}\n\nfunction carouselNextPlacement(orientation: CarouselOrientation): string {\n return orientation === 'horizontal'\n ? '-right-12 top-1/2 -translate-y-1/2'\n : '-bottom-12 left-1/2 -translate-x-1/2 rotate-90';\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;MA2BsB,mBAAmB,CAAA;uGAAnB,mBAAmB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;2FAAnB,mBAAmB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;2FAAnB,mBAAmB,EAAA,UAAA,EAAA,CAAA;kBADxC;;AA4BK,MAAO,iBAAkB,SAAQ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EAAA,EAAA,IAAA,EAAA,EAAA,UAAA,EAAA,EAAA,MAAA,EAAA,QAAA,EAAA,EAAA,SAAA,EAAA,EAAA,OAAA,EAAA,kBAAA,EAAA,EAAA,UAAA,EAAA,EAAA,OAAA,EAAA,WAAA,EAAA,iBAAA,EAAA,SAAA,EAAA,UAAA,EAAA,8BAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,EAdtB;;;;;;;;;;;;AAYT,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;2FAEU,qBAAqB,EAAA,UAAA,EAAA,CAAA;kBAxBjC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,sBAAsB;oBAChC,eAAe,EAAE,uBAAuB,CAAC,MAAM;AAC/C,oBAAA,IAAI,EAAE;AACJ,wBAAA,SAAS,EAAE,WAAW;AACtB,wBAAA,IAAI,EAAE,QAAQ;AACd,wBAAA,mBAAmB,EAAE,SAAS;AAC9B,wBAAA,YAAY,EAAE,8BAA8B;AAC5C,wBAAA,SAAS,EAAE,kBAAkB;AAC9B,qBAAA;AACD,oBAAA,QAAQ,EAAE;;;;;;;;;;;;AAYT,EAAA,CAAA;AACF,iBAAA;;AAYD,MAAM,qBAAqB,GACzB,gUAAgU;AAElU,SAAS,yBAAyB,CAAC,WAAgC,EAAA;IACjE,OAAO,WAAW,KAAK;AACrB,UAAE;UACA,6CAA6C;AACnD;AAEA,SAAS,qBAAqB,CAAC,WAAgC,EAAA;IAC7D,OAAO,WAAW,KAAK;AACrB,UAAE;UACA,gDAAgD;AACtD;;AClUA;;AAEG;;;;"}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { input, booleanAttribute, output, viewChild, signal, computed, forwardRef, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
+
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
4
|
+
import { uniqueId, cn } from '@ojiepermana/angular-component/utils';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Checkbox built on a native `<input type="checkbox">` (shadcn pattern) — no
|
|
8
|
+
* Material dependency. Projected content renders as the clickable label.
|
|
9
|
+
*/
|
|
10
|
+
class CheckboxComponent {
|
|
11
|
+
id = input(uniqueId('Checkbox'), /* @ts-ignore */
|
|
12
|
+
...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
13
|
+
name = input(null, /* @ts-ignore */
|
|
14
|
+
...(ngDevMode ? [{ debugName: "name" }] : /* istanbul ignore next */ []));
|
|
15
|
+
disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
16
|
+
indeterminate = input(false, /* @ts-ignore */
|
|
17
|
+
...(ngDevMode ? [{ debugName: "indeterminate" }] : /* istanbul ignore next */ []));
|
|
18
|
+
required = input(false, /* @ts-ignore */
|
|
19
|
+
...(ngDevMode ? [{ debugName: "required" }] : /* istanbul ignore next */ []));
|
|
20
|
+
ariaLabel = input(null, { ...(ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {}), alias: 'aria-label' });
|
|
21
|
+
ariaDescribedby = input(null, { ...(ngDevMode ? { debugName: "ariaDescribedby" } : /* istanbul ignore next */ {}), alias: 'aria-describedby' });
|
|
22
|
+
ariaLabelledby = input(null, { ...(ngDevMode ? { debugName: "ariaLabelledby" } : /* istanbul ignore next */ {}), alias: 'aria-labelledby' });
|
|
23
|
+
ariaInvalid = input(null, { ...(ngDevMode ? { debugName: "ariaInvalid" } : /* istanbul ignore next */ {}), alias: 'aria-invalid' });
|
|
24
|
+
class = input('', /* @ts-ignore */
|
|
25
|
+
...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
26
|
+
checkedChange = output();
|
|
27
|
+
ref = viewChild.required('ref');
|
|
28
|
+
checked = signal(false, /* @ts-ignore */
|
|
29
|
+
...(ngDevMode ? [{ debugName: "checked" }] : /* istanbul ignore next */ []));
|
|
30
|
+
disabledState = signal(false, /* @ts-ignore */
|
|
31
|
+
...(ngDevMode ? [{ debugName: "disabledState" }] : /* istanbul ignore next */ []));
|
|
32
|
+
ariaInvalidAttr = computed(() => {
|
|
33
|
+
const value = this.ariaInvalid();
|
|
34
|
+
if (value === false || value === 'false' || value == null) {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
return value === true || value === '' ? 'true' : `${value}`;
|
|
38
|
+
}, /* @ts-ignore */
|
|
39
|
+
...(ngDevMode ? [{ debugName: "ariaInvalidAttr" }] : /* istanbul ignore next */ []));
|
|
40
|
+
isDisabled = computed(() => this.disabled() || this.disabledState(), /* @ts-ignore */
|
|
41
|
+
...(ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []));
|
|
42
|
+
hostClasses = computed(() => cn('Checkbox inline-flex', this.class()), /* @ts-ignore */
|
|
43
|
+
...(ngDevMode ? [{ debugName: "hostClasses" }] : /* istanbul ignore next */ []));
|
|
44
|
+
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 */
|
|
45
|
+
...(ngDevMode ? [{ debugName: "labelClasses" }] : /* istanbul ignore next */ []));
|
|
46
|
+
boxClasses = computed(() => cn('inline-flex size-4 shrink-0 items-center justify-center rounded-sm border 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.invalid()
|
|
47
|
+
? 'border-destructive'
|
|
48
|
+
: this.checked() || this.indeterminate()
|
|
49
|
+
? 'border-primary'
|
|
50
|
+
: 'border-input', this.checked() || this.indeterminate()
|
|
51
|
+
? this.invalid()
|
|
52
|
+
? 'bg-destructive text-destructive-foreground'
|
|
53
|
+
: 'bg-primary text-primary-foreground'
|
|
54
|
+
: 'bg-background'), /* @ts-ignore */
|
|
55
|
+
...(ngDevMode ? [{ debugName: "boxClasses" }] : /* istanbul ignore next */ []));
|
|
56
|
+
invalid = computed(() => this.ariaInvalidAttr() === 'true', /* @ts-ignore */
|
|
57
|
+
...(ngDevMode ? [{ debugName: "invalid" }] : /* istanbul ignore next */ []));
|
|
58
|
+
onChange = () => { };
|
|
59
|
+
onTouched = () => { };
|
|
60
|
+
handleChange(event) {
|
|
61
|
+
const next = event.target.checked;
|
|
62
|
+
this.checked.set(next);
|
|
63
|
+
this.onChange(next);
|
|
64
|
+
this.checkedChange.emit(next);
|
|
65
|
+
}
|
|
66
|
+
handleBlur() {
|
|
67
|
+
this.onTouched();
|
|
68
|
+
}
|
|
69
|
+
focus() {
|
|
70
|
+
this.ref().nativeElement.focus();
|
|
71
|
+
}
|
|
72
|
+
writeValue(v) {
|
|
73
|
+
this.checked.set(!!v);
|
|
74
|
+
}
|
|
75
|
+
registerOnChange(fn) {
|
|
76
|
+
this.onChange = fn;
|
|
77
|
+
}
|
|
78
|
+
registerOnTouched(fn) {
|
|
79
|
+
this.onTouched = fn;
|
|
80
|
+
}
|
|
81
|
+
setDisabledState(d) {
|
|
82
|
+
this.disabledState.set(d);
|
|
83
|
+
}
|
|
84
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CheckboxComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
85
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.2", type: CheckboxComponent, isStandalone: true, selector: "Checkbox", 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 }, indeterminate: { classPropertyName: "indeterminate", publicName: "indeterminate", 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 }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { checkedChange: "checkedChange" }, host: { properties: { "class": "hostClasses()" } }, providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => CheckboxComponent), multi: true }], viewQueries: [{ propertyName: "ref", first: true, predicate: ["ref"], descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
86
|
+
<label [class]="labelClasses()" [attr.for]="id()">
|
|
87
|
+
<input
|
|
88
|
+
#ref
|
|
89
|
+
type="checkbox"
|
|
90
|
+
class="peer sr-only"
|
|
91
|
+
[id]="id()"
|
|
92
|
+
[attr.name]="name()"
|
|
93
|
+
[checked]="checked()"
|
|
94
|
+
[indeterminate]="indeterminate()"
|
|
95
|
+
[disabled]="isDisabled()"
|
|
96
|
+
[required]="required()"
|
|
97
|
+
[attr.aria-label]="ariaLabel()"
|
|
98
|
+
[attr.aria-describedby]="ariaDescribedby()"
|
|
99
|
+
[attr.aria-labelledby]="ariaLabelledby()"
|
|
100
|
+
[attr.aria-invalid]="ariaInvalidAttr()"
|
|
101
|
+
(change)="handleChange($event)"
|
|
102
|
+
(blur)="handleBlur()" />
|
|
103
|
+
<span aria-hidden="true" [class]="boxClasses()">
|
|
104
|
+
@if (indeterminate()) {
|
|
105
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" class="size-3">
|
|
106
|
+
<path d="M5 12h14" />
|
|
107
|
+
</svg>
|
|
108
|
+
} @else if (checked()) {
|
|
109
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" class="size-3">
|
|
110
|
+
<path d="M20 6 9 17l-5-5" />
|
|
111
|
+
</svg>
|
|
112
|
+
}
|
|
113
|
+
</span>
|
|
114
|
+
<ng-content />
|
|
115
|
+
</label>
|
|
116
|
+
`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
117
|
+
}
|
|
118
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: CheckboxComponent, decorators: [{
|
|
119
|
+
type: Component,
|
|
120
|
+
args: [{
|
|
121
|
+
selector: 'Checkbox',
|
|
122
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
123
|
+
providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => CheckboxComponent), multi: true }],
|
|
124
|
+
host: { '[class]': 'hostClasses()' },
|
|
125
|
+
template: `
|
|
126
|
+
<label [class]="labelClasses()" [attr.for]="id()">
|
|
127
|
+
<input
|
|
128
|
+
#ref
|
|
129
|
+
type="checkbox"
|
|
130
|
+
class="peer sr-only"
|
|
131
|
+
[id]="id()"
|
|
132
|
+
[attr.name]="name()"
|
|
133
|
+
[checked]="checked()"
|
|
134
|
+
[indeterminate]="indeterminate()"
|
|
135
|
+
[disabled]="isDisabled()"
|
|
136
|
+
[required]="required()"
|
|
137
|
+
[attr.aria-label]="ariaLabel()"
|
|
138
|
+
[attr.aria-describedby]="ariaDescribedby()"
|
|
139
|
+
[attr.aria-labelledby]="ariaLabelledby()"
|
|
140
|
+
[attr.aria-invalid]="ariaInvalidAttr()"
|
|
141
|
+
(change)="handleChange($event)"
|
|
142
|
+
(blur)="handleBlur()" />
|
|
143
|
+
<span aria-hidden="true" [class]="boxClasses()">
|
|
144
|
+
@if (indeterminate()) {
|
|
145
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" class="size-3">
|
|
146
|
+
<path d="M5 12h14" />
|
|
147
|
+
</svg>
|
|
148
|
+
} @else if (checked()) {
|
|
149
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" class="size-3">
|
|
150
|
+
<path d="M20 6 9 17l-5-5" />
|
|
151
|
+
</svg>
|
|
152
|
+
}
|
|
153
|
+
</span>
|
|
154
|
+
<ng-content />
|
|
155
|
+
</label>
|
|
156
|
+
`,
|
|
157
|
+
}]
|
|
158
|
+
}], propDecorators: { id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], indeterminate: [{ type: i0.Input, args: [{ isSignal: true, alias: "indeterminate", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }], ariaDescribedby: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-describedby", required: false }] }], ariaLabelledby: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-labelledby", required: false }] }], ariaInvalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-invalid", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], checkedChange: [{ type: i0.Output, args: ["checkedChange"] }], ref: [{ type: i0.ViewChild, args: ['ref', { isSignal: true }] }] } });
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Generated bundle index. Do not edit.
|
|
162
|
+
*/
|
|
163
|
+
|
|
164
|
+
export { CheckboxComponent };
|
|
165
|
+
//# sourceMappingURL=ojiepermana-angular-component-checkbox.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ojiepermana-angular-component-checkbox.mjs","sources":["../../../library/component/checkbox/checkbox.component.ts","../../../library/component/checkbox/ojiepermana-angular-component-checkbox.ts"],"sourcesContent":["import {\n booleanAttribute,\n ChangeDetectionStrategy,\n Component,\n computed,\n forwardRef,\n input,\n output,\n signal,\n viewChild,\n type ElementRef,\n} from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { cn, uniqueId } from '@ojiepermana/angular-component/utils';\n\n/**\n * Checkbox built on a native `<input type=\"checkbox\">` (shadcn pattern) — no\n * Material dependency. Projected content renders as the clickable label.\n */\n@Component({\n selector: 'Checkbox',\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => CheckboxComponent), multi: true }],\n host: { '[class]': 'hostClasses()' },\n template: `\n <label [class]=\"labelClasses()\" [attr.for]=\"id()\">\n <input\n #ref\n type=\"checkbox\"\n class=\"peer sr-only\"\n [id]=\"id()\"\n [attr.name]=\"name()\"\n [checked]=\"checked()\"\n [indeterminate]=\"indeterminate()\"\n [disabled]=\"isDisabled()\"\n [required]=\"required()\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-describedby]=\"ariaDescribedby()\"\n [attr.aria-labelledby]=\"ariaLabelledby()\"\n [attr.aria-invalid]=\"ariaInvalidAttr()\"\n (change)=\"handleChange($event)\"\n (blur)=\"handleBlur()\" />\n <span aria-hidden=\"true\" [class]=\"boxClasses()\">\n @if (indeterminate()) {\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"3\" class=\"size-3\">\n <path d=\"M5 12h14\" />\n </svg>\n } @else if (checked()) {\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"3\" class=\"size-3\">\n <path d=\"M20 6 9 17l-5-5\" />\n </svg>\n }\n </span>\n <ng-content />\n </label>\n `,\n})\nexport class CheckboxComponent implements ControlValueAccessor {\n readonly id = input<string>(uniqueId('Checkbox'));\n readonly name = input<string | null>(null);\n readonly disabled = input(false, { transform: booleanAttribute });\n readonly indeterminate = input<boolean>(false);\n readonly required = input<boolean>(false);\n readonly ariaLabel = input<string | null>(null, { alias: 'aria-label' });\n readonly ariaDescribedby = input<string | null>(null, { alias: 'aria-describedby' });\n readonly ariaLabelledby = input<string | null>(null, { alias: 'aria-labelledby' });\n readonly ariaInvalid = input<boolean | string | null>(null, { alias: 'aria-invalid' });\n readonly class = input<string>('');\n\n readonly checkedChange = output<boolean>();\n\n private readonly ref = viewChild.required<ElementRef<HTMLInputElement>>('ref');\n\n protected readonly checked = signal<boolean>(false);\n protected readonly disabledState = signal(false);\n protected readonly ariaInvalidAttr = computed(() => {\n const value = this.ariaInvalid();\n\n if (value === false || value === 'false' || value == null) {\n return null;\n }\n\n return value === true || value === '' ? 'true' : `${value}`;\n });\n protected readonly isDisabled = computed(() => this.disabled() || this.disabledState());\n protected readonly hostClasses = computed(() => cn('Checkbox inline-flex', this.class()));\n protected readonly labelClasses = computed(() =>\n cn(\n 'inline-flex select-none items-center gap-2 text-sm font-medium leading-none',\n this.isDisabled() ? 'cursor-not-allowed opacity-50' : 'cursor-pointer',\n ),\n );\n protected readonly boxClasses = computed(() =>\n cn(\n 'inline-flex size-4 shrink-0 items-center justify-center rounded-sm border shadow-sm transition-colors',\n 'peer-focus-visible:ring-2 peer-focus-visible:ring-ring peer-focus-visible:ring-offset-2 peer-focus-visible:ring-offset-background',\n this.invalid()\n ? 'border-destructive'\n : this.checked() || this.indeterminate()\n ? 'border-primary'\n : 'border-input',\n this.checked() || this.indeterminate()\n ? this.invalid()\n ? 'bg-destructive text-destructive-foreground'\n : 'bg-primary text-primary-foreground'\n : 'bg-background',\n ),\n );\n\n private readonly invalid = computed(() => this.ariaInvalidAttr() === 'true');\n\n private onChange: (v: boolean) => void = () => {};\n private onTouched: () => void = () => {};\n\n protected handleChange(event: Event): void {\n const next = (event.target as HTMLInputElement).checked;\n this.checked.set(next);\n this.onChange(next);\n this.checkedChange.emit(next);\n }\n\n protected handleBlur(): void {\n this.onTouched();\n }\n\n focus(): void {\n this.ref().nativeElement.focus();\n }\n\n writeValue(v: boolean): void {\n this.checked.set(!!v);\n }\n registerOnChange(fn: (v: boolean) => void): void {\n this.onChange = fn;\n }\n registerOnTouched(fn: () => void): void {\n this.onTouched = fn;\n }\n setDisabledState(d: boolean): void {\n this.disabledState.set(d);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAeA;;;AAGG;MAuCU,iBAAiB,CAAA;AACnB,IAAA,EAAE,GAAG,KAAK,CAAS,QAAQ,CAAC,UAAU,CAAC;2EAAC;IACxC,IAAI,GAAG,KAAK,CAAgB,IAAI;6EAAC;IACjC,QAAQ,GAAG,KAAK,CAAC,KAAK,gFAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;IACxD,aAAa,GAAG,KAAK,CAAU,KAAK;sFAAC;IACrC,QAAQ,GAAG,KAAK,CAAU,KAAK;iFAAC;IAChC,SAAS,GAAG,KAAK,CAAgB,IAAI,iFAAI,KAAK,EAAE,YAAY,EAAA,CAAG;IAC/D,eAAe,GAAG,KAAK,CAAgB,IAAI,uFAAI,KAAK,EAAE,kBAAkB,EAAA,CAAG;IAC3E,cAAc,GAAG,KAAK,CAAgB,IAAI,sFAAI,KAAK,EAAE,iBAAiB,EAAA,CAAG;IACzE,WAAW,GAAG,KAAK,CAA0B,IAAI,mFAAI,KAAK,EAAE,cAAc,EAAA,CAAG;IAC7E,KAAK,GAAG,KAAK,CAAS,EAAE;8EAAC;IAEzB,aAAa,GAAG,MAAM,EAAW;AAEzB,IAAA,GAAG,GAAG,SAAS,CAAC,QAAQ,CAA+B,KAAK,CAAC;IAE3D,OAAO,GAAG,MAAM,CAAU,KAAK;gFAAC;IAChC,aAAa,GAAG,MAAM,CAAC,KAAK;sFAAC;AAC7B,IAAA,eAAe,GAAG,QAAQ,CAAC,MAAK;AACjD,QAAA,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,EAAE;AAEhC,QA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