@daffodil/storefront 0.93.0 → 0.93.1

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.
@@ -6,8 +6,8 @@ import { faChevronRight, faChevronLeft } from '@fortawesome/free-solid-svg-icons
6
6
  import { register } from 'swiper/element/bundle';
7
7
 
8
8
  class DaffSfCarouselItemDirective {
9
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffSfCarouselItemDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
10
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.9", type: DaffSfCarouselItemDirective, isStandalone: true, selector: "[daffSfCarouselItem]", host: { classAttribute: "daff-sf-carousel-item" }, ngImport: i0 }); }
9
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffSfCarouselItemDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
10
+ /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.9", type: DaffSfCarouselItemDirective, isStandalone: true, selector: "[daffSfCarouselItem]", host: { classAttribute: "daff-sf-carousel-item" }, ngImport: i0 }); }
11
11
  }
12
12
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffSfCarouselItemDirective, decorators: [{
13
13
  type: Directive,
@@ -84,8 +84,8 @@ class DaffSfCarouselComponent {
84
84
  set options(val) {
85
85
  this._options = val;
86
86
  }
87
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffSfCarouselComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
88
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.9", type: DaffSfCarouselComponent, isStandalone: true, selector: "daff-sf-carousel", inputs: { options: "options" }, host: { attributes: { "ngSkipHydration": "true", "tabindex": "0" }, classAttribute: "daff-sf-carousel" }, queries: [{ propertyName: "items", predicate: DaffSfCarouselItemDirective, read: TemplateRef, isSignal: true }], viewQueries: [{ propertyName: "swiperElement", first: true, predicate: ["swiperElement"], descendants: true, read: ElementRef, isSignal: true }], ngImport: i0, template: "<div class=\"daff-sf-carousel__heading\">\n <ng-content select=\"[daffSfCarouselTitle]\"></ng-content>\n\t<div class=\"daff-sf-carousel__nav\">\n\t\t<button class=\"daff-sf-carousel__button\" aria-hidden=\"true\" tabindex=\"-1\" (click)=\"swiperRef.slidePrev()\" [disabled]=\"swiperRef?.isBeginning\">\n\t\t\t<fa-icon [icon]=\"faChevronLeft\"></fa-icon>\n\t\t</button>\n\t\t<button class=\"daff-sf-carousel__button\" aria-hidden=\"true\" tabindex=\"-1\" (click)=\"swiperRef.slideNext()\" [disabled]=\"swiperRef?.isEnd\">\n\t\t\t<fa-icon [icon]=\"faChevronRight\"></fa-icon>\n\t\t</button>\n\t</div>\n</div>\n\n<swiper-container init=\"false\" #swiperElement>\n\t@for (item of items(); track item) {\n\t\t <swiper-slide>\n\t\t\t\t<ng-container\n\t\t\t\t\t*ngTemplateOutlet=\"item\">\n\t\t\t\t</ng-container>\n\t\t\t</swiper-slide>\n\t}\n</swiper-container>", styles: [":root{--swiper-theme-color: #007aff}:host{position:relative;display:block;margin-left:auto;margin-right:auto;z-index:1}.swiper{margin-left:auto;margin-right:auto;position:relative;overflow:hidden;list-style:none;padding:0;z-index:1;display:block}.swiper-vertical>.swiper-wrapper{flex-direction:column}.swiper-wrapper{position:relative;width:100%;height:100%;z-index:1;display:flex;transition-property:transform;transition-timing-function:var(--swiper-wrapper-transition-timing-function, initial);box-sizing:content-box}.swiper-android .swiper-slide,.swiper-ios .swiper-slide,.swiper-wrapper{transform:translateZ(0)}.swiper-horizontal{touch-action:pan-y}.swiper-vertical{touch-action:pan-x}.swiper-slide{flex-shrink:0;width:100%;height:100%;position:relative;transition-property:transform;display:block}.swiper-slide-invisible-blank{visibility:hidden}.swiper-autoheight,.swiper-autoheight .swiper-slide{height:auto}.swiper-autoheight .swiper-wrapper{align-items:flex-start;transition-property:transform,height}.swiper-backface-hidden .swiper-slide{transform:translateZ(0);backface-visibility:hidden}.swiper-3d.swiper-css-mode .swiper-wrapper{perspective:1200px}.swiper-3d .swiper-wrapper{transform-style:preserve-3d}.swiper-3d{perspective:1200px}.swiper-3d .swiper-slide,.swiper-3d .swiper-cube-shadow{transform-style:preserve-3d}.swiper-css-mode>.swiper-wrapper{overflow:auto;scrollbar-width:none;-ms-overflow-style:none}.swiper-css-mode>.swiper-wrapper::-webkit-scrollbar{display:none}.swiper-css-mode>.swiper-wrapper>.swiper-slide{scroll-snap-align:start start}.swiper-css-mode.swiper-horizontal>.swiper-wrapper{scroll-snap-type:x mandatory}.swiper-css-mode.swiper-vertical>.swiper-wrapper{scroll-snap-type:y mandatory}.swiper-css-mode.swiper-free-mode>.swiper-wrapper{scroll-snap-type:none}.swiper-css-mode.swiper-free-mode>.swiper-wrapper>.swiper-slide{scroll-snap-align:none}.swiper-css-mode.swiper-centered>.swiper-wrapper:before{content:\"\";flex-shrink:0;order:9999}.swiper-css-mode.swiper-centered>.swiper-wrapper>.swiper-slide{scroll-snap-align:center center;scroll-snap-stop:always}.swiper-css-mode.swiper-centered.swiper-horizontal>.swiper-wrapper>.swiper-slide:first-child{margin-inline-start:var(--swiper-centered-offset-before)}.swiper-css-mode.swiper-centered.swiper-horizontal>.swiper-wrapper:before{height:100%;min-height:1px;width:var(--swiper-centered-offset-after)}.swiper-css-mode.swiper-centered.swiper-vertical>.swiper-wrapper>.swiper-slide:first-child{margin-block-start:var(--swiper-centered-offset-before)}.swiper-css-mode.swiper-centered.swiper-vertical>.swiper-wrapper:before{width:100%;min-width:1px;height:var(--swiper-centered-offset-after)}.swiper-3d .swiper-slide-shadow,.swiper-3d .swiper-slide-shadow-left,.swiper-3d .swiper-slide-shadow-right,.swiper-3d .swiper-slide-shadow-top,.swiper-3d .swiper-slide-shadow-bottom{position:absolute;left:0;top:0;width:100%;height:100%;pointer-events:none;z-index:10}.swiper-3d .swiper-slide-shadow{background:#00000026}.swiper-3d .swiper-slide-shadow-left{background-image:linear-gradient(to left,#00000080,#0000)}.swiper-3d .swiper-slide-shadow-right{background-image:linear-gradient(to right,#00000080,#0000)}.swiper-3d .swiper-slide-shadow-top{background-image:linear-gradient(to top,#00000080,#0000)}.swiper-3d .swiper-slide-shadow-bottom{background-image:linear-gradient(to bottom,#00000080,#0000)}.swiper-lazy-preloader{width:42px;height:42px;position:absolute;left:50%;top:50%;margin-left:-21px;margin-top:-21px;z-index:10;transform-origin:50%;box-sizing:border-box;border:4px solid var(--swiper-preloader-color, var(--swiper-theme-color));border-radius:50%;border-top-color:transparent}:is(.swiper:not(.swiper-watch-progress),.swiper-watch-progress .swiper-slide-visible) .swiper-lazy-preloader{animation:swiper-preloader-spin 1s infinite linear}.swiper-lazy-preloader-white{--swiper-preloader-color: #fff}.swiper-lazy-preloader-black{--swiper-preloader-color: #000}@keyframes swiper-preloader-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.swiper .swiper-notification{position:absolute;left:0;top:0;pointer-events:none;opacity:0;z-index:-1000}swiper-container:not(.swiper-initialized){display:flex;overflow:hidden;gap:.5rem}swiper-slide{display:inline-block;width:max-content}.daff-sf-carousel{display:block}.daff-sf-carousel__heading{display:flex;align-items:center;justify-content:space-between;margin:0 0 1.5rem}.daff-sf-carousel__nav{display:flex;align-items:center}.daff-sf-carousel__button{cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;display:inline-block;appearance:none;background:none;border:0;flex-shrink:0;font-size:1rem;font-weight:500;height:2.5rem;width:2.5rem;line-height:2.5rem;padding:0;position:relative;text-align:center;text-decoration:none;vertical-align:baseline;box-sizing:border-box}.daff-sf-carousel__button[disabled]{cursor:not-allowed;pointer-events:none}\n"], dependencies: [{ kind: "component", type: FaIconComponent, selector: "fa-icon", inputs: ["icon", "title", "animation", "mask", "flip", "size", "pull", "border", "inverse", "symbol", "rotate", "fixedWidth", "transform", "a11yRole"], outputs: ["iconChange", "titleChange", "animationChange", "maskChange", "flipChange", "sizeChange", "pullChange", "borderChange", "inverseChange", "symbolChange", "rotateChange", "fixedWidthChange", "transformChange", "a11yRoleChange"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
87
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffSfCarouselComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
88
+ /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.9", type: DaffSfCarouselComponent, isStandalone: true, selector: "daff-sf-carousel", inputs: { options: "options" }, host: { attributes: { "ngSkipHydration": "true", "tabindex": "0" }, classAttribute: "daff-sf-carousel" }, queries: [{ propertyName: "items", predicate: DaffSfCarouselItemDirective, read: TemplateRef, isSignal: true }], viewQueries: [{ propertyName: "swiperElement", first: true, predicate: ["swiperElement"], descendants: true, read: ElementRef, isSignal: true }], ngImport: i0, template: "<div class=\"daff-sf-carousel__heading\">\n <ng-content select=\"[daffSfCarouselTitle]\"></ng-content>\n\t<div class=\"daff-sf-carousel__nav\">\n\t\t<button class=\"daff-sf-carousel__button\" aria-hidden=\"true\" tabindex=\"-1\" (click)=\"swiperRef.slidePrev()\" [disabled]=\"swiperRef?.isBeginning\">\n\t\t\t<fa-icon [icon]=\"faChevronLeft\"></fa-icon>\n\t\t</button>\n\t\t<button class=\"daff-sf-carousel__button\" aria-hidden=\"true\" tabindex=\"-1\" (click)=\"swiperRef.slideNext()\" [disabled]=\"swiperRef?.isEnd\">\n\t\t\t<fa-icon [icon]=\"faChevronRight\"></fa-icon>\n\t\t</button>\n\t</div>\n</div>\n\n<swiper-container init=\"false\" #swiperElement>\n\t@for (item of items(); track item) {\n\t\t <swiper-slide>\n\t\t\t\t<ng-container\n\t\t\t\t\t*ngTemplateOutlet=\"item\">\n\t\t\t\t</ng-container>\n\t\t\t</swiper-slide>\n\t}\n</swiper-container>", styles: [":root{--swiper-theme-color: #007aff}:host{position:relative;display:block;margin-left:auto;margin-right:auto;z-index:1}.swiper{margin-left:auto;margin-right:auto;position:relative;overflow:hidden;list-style:none;padding:0;z-index:1;display:block}.swiper-vertical>.swiper-wrapper{flex-direction:column}.swiper-wrapper{position:relative;width:100%;height:100%;z-index:1;display:flex;transition-property:transform;transition-timing-function:var(--swiper-wrapper-transition-timing-function, initial);box-sizing:content-box}.swiper-android .swiper-slide,.swiper-ios .swiper-slide,.swiper-wrapper{transform:translateZ(0)}.swiper-horizontal{touch-action:pan-y}.swiper-vertical{touch-action:pan-x}.swiper-slide{flex-shrink:0;width:100%;height:100%;position:relative;transition-property:transform;display:block}.swiper-slide-invisible-blank{visibility:hidden}.swiper-autoheight,.swiper-autoheight .swiper-slide{height:auto}.swiper-autoheight .swiper-wrapper{align-items:flex-start;transition-property:transform,height}.swiper-backface-hidden .swiper-slide{transform:translateZ(0);backface-visibility:hidden}.swiper-3d.swiper-css-mode .swiper-wrapper{perspective:1200px}.swiper-3d .swiper-wrapper{transform-style:preserve-3d}.swiper-3d{perspective:1200px}.swiper-3d .swiper-slide,.swiper-3d .swiper-cube-shadow{transform-style:preserve-3d}.swiper-css-mode>.swiper-wrapper{overflow:auto;scrollbar-width:none;-ms-overflow-style:none}.swiper-css-mode>.swiper-wrapper::-webkit-scrollbar{display:none}.swiper-css-mode>.swiper-wrapper>.swiper-slide{scroll-snap-align:start start}.swiper-css-mode.swiper-horizontal>.swiper-wrapper{scroll-snap-type:x mandatory}.swiper-css-mode.swiper-vertical>.swiper-wrapper{scroll-snap-type:y mandatory}.swiper-css-mode.swiper-free-mode>.swiper-wrapper{scroll-snap-type:none}.swiper-css-mode.swiper-free-mode>.swiper-wrapper>.swiper-slide{scroll-snap-align:none}.swiper-css-mode.swiper-centered>.swiper-wrapper:before{content:\"\";flex-shrink:0;order:9999}.swiper-css-mode.swiper-centered>.swiper-wrapper>.swiper-slide{scroll-snap-align:center center;scroll-snap-stop:always}.swiper-css-mode.swiper-centered.swiper-horizontal>.swiper-wrapper>.swiper-slide:first-child{margin-inline-start:var(--swiper-centered-offset-before)}.swiper-css-mode.swiper-centered.swiper-horizontal>.swiper-wrapper:before{height:100%;min-height:1px;width:var(--swiper-centered-offset-after)}.swiper-css-mode.swiper-centered.swiper-vertical>.swiper-wrapper>.swiper-slide:first-child{margin-block-start:var(--swiper-centered-offset-before)}.swiper-css-mode.swiper-centered.swiper-vertical>.swiper-wrapper:before{width:100%;min-width:1px;height:var(--swiper-centered-offset-after)}.swiper-3d .swiper-slide-shadow,.swiper-3d .swiper-slide-shadow-left,.swiper-3d .swiper-slide-shadow-right,.swiper-3d .swiper-slide-shadow-top,.swiper-3d .swiper-slide-shadow-bottom{position:absolute;left:0;top:0;width:100%;height:100%;pointer-events:none;z-index:10}.swiper-3d .swiper-slide-shadow{background:#00000026}.swiper-3d .swiper-slide-shadow-left{background-image:linear-gradient(to left,#00000080,#0000)}.swiper-3d .swiper-slide-shadow-right{background-image:linear-gradient(to right,#00000080,#0000)}.swiper-3d .swiper-slide-shadow-top{background-image:linear-gradient(to top,#00000080,#0000)}.swiper-3d .swiper-slide-shadow-bottom{background-image:linear-gradient(to bottom,#00000080,#0000)}.swiper-lazy-preloader{width:42px;height:42px;position:absolute;left:50%;top:50%;margin-left:-21px;margin-top:-21px;z-index:10;transform-origin:50%;box-sizing:border-box;border:4px solid var(--swiper-preloader-color, var(--swiper-theme-color));border-radius:50%;border-top-color:transparent}:is(.swiper:not(.swiper-watch-progress),.swiper-watch-progress .swiper-slide-visible) .swiper-lazy-preloader{animation:swiper-preloader-spin 1s infinite linear}.swiper-lazy-preloader-white{--swiper-preloader-color: #fff}.swiper-lazy-preloader-black{--swiper-preloader-color: #000}@keyframes swiper-preloader-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.swiper .swiper-notification{position:absolute;left:0;top:0;pointer-events:none;opacity:0;z-index:-1000}swiper-container:not(.swiper-initialized){display:flex;overflow:hidden;gap:.5rem}swiper-slide{display:inline-block;width:max-content}.daff-sf-carousel{display:block}.daff-sf-carousel__heading{display:flex;align-items:center;justify-content:space-between;margin:0 0 1.5rem}.daff-sf-carousel__nav{display:flex;align-items:center}.daff-sf-carousel__button{cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;display:inline-block;appearance:none;background:none;border:0;flex-shrink:0;font-size:1rem;font-weight:500;height:2.5rem;width:2.5rem;line-height:2.5rem;padding:0;position:relative;text-align:center;text-decoration:none;vertical-align:baseline;box-sizing:border-box}.daff-sf-carousel__button[disabled]{cursor:not-allowed;pointer-events:none}\n"], dependencies: [{ kind: "component", type: FaIconComponent, selector: "fa-icon", inputs: ["icon", "title", "animation", "mask", "flip", "size", "pull", "border", "inverse", "symbol", "rotate", "fixedWidth", "transform", "a11yRole"], outputs: ["iconChange", "titleChange", "animationChange", "maskChange", "flipChange", "sizeChange", "pullChange", "borderChange", "inverseChange", "symbolChange", "rotateChange", "fixedWidthChange", "transformChange", "a11yRoleChange"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
89
89
  }
90
90
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffSfCarouselComponent, decorators: [{
91
91
  type: Component,
@@ -1 +1 @@
1
- {"version":3,"file":"daffodil-storefront-carousel.mjs","sources":["../../../libs/storefront/carousel/src/carousel-item/carousel-item.directive.ts","../../../libs/storefront/carousel/src/provider.ts","../../../libs/storefront/carousel/src/carousel/carousel.component.ts","../../../libs/storefront/carousel/src/carousel/carousel.component.html","../../../libs/storefront/carousel/src/carousel.ts","../../../libs/storefront/carousel/src/daffodil-storefront-carousel.ts"],"sourcesContent":["import { Directive } from '@angular/core';\n\n@Directive({\n selector: '[daffSfCarouselItem]',\n host: {\n class: 'daff-sf-carousel-item',\n },\n})\nexport class DaffSfCarouselItemDirective {}\n","import { InjectionToken } from '@angular/core';\nimport { register } from 'swiper/element/bundle';\n\nlet registered = false;\n\n/**\n * Injection token for DaffSfCarouselComponent initialization\n * Automatically registers Swiper custom elements once globally when first injected\n */\nexport const DAFF_SF_CAROUSEL_INIT = new InjectionToken<true>(\n 'DAFF_SF_CAROUSEL_INIT',\n {\n providedIn: 'root',\n factory: () => {\n if (!registered) {\n register();\n registered = true;\n }\n return true;\n },\n },\n);\n\n","\n\nimport { NgTemplateOutlet } from '@angular/common';\nimport {\n afterNextRender,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n contentChildren,\n CUSTOM_ELEMENTS_SCHEMA,\n effect,\n ElementRef,\n inject,\n Input,\n TemplateRef,\n viewChild,\n ViewEncapsulation,\n} from '@angular/core';\nimport { FaIconComponent } from '@fortawesome/angular-fontawesome';\nimport {\n faChevronRight,\n faChevronLeft,\n} from '@fortawesome/free-solid-svg-icons';\nimport { Swiper } from 'swiper/types';\n\nimport { SwiperNativeElement } from './swiper-native-element';\nimport { DaffSfCarouselItemDirective } from '../carousel-item/carousel-item.directive';\nimport { DaffSfCarouselOptions } from '../options';\nimport { DAFF_SF_CAROUSEL_INIT } from '../provider';\n\n@Component({\n selector: 'daff-sf-carousel',\n templateUrl: './carousel.component.html',\n styleUrls: ['./carousel.component.scss'],\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n ngSkipHydration: 'true',\n class: 'daff-sf-carousel',\n tabindex: '0',\n },\n imports: [\n FaIconComponent,\n NgTemplateOutlet,\n ],\n schemas: [\n CUSTOM_ELEMENTS_SCHEMA,\n ],\n})\nexport class DaffSfCarouselComponent {\n readonly faChevronRight = faChevronRight;\n readonly faChevronLeft = faChevronLeft;\n\n private _options: DaffSfCarouselOptions;\n\n items = contentChildren(DaffSfCarouselItemDirective, { read: TemplateRef<any> });\n\n swiperElement = viewChild<unknown,ElementRef<SwiperNativeElement>>('swiperElement', { read: ElementRef<any> });\n\n swiperRef: Swiper = undefined;\n\n private initCarousel = inject(DAFF_SF_CAROUSEL_INIT);\n\n constructor(private cdr: ChangeDetectorRef) {\n this.options = {};\n\n afterNextRender({\n write: () => {\n Object.assign(this.swiperElement().nativeElement, this.options);\n this.swiperElement().nativeElement.initialize();\n this.swiperElement().nativeElement.classList.add('swiper-initialized');\n this.swiperRef = this.swiperElement().nativeElement.swiper;\n this.swiperRef.on('slideChange', () => {\n this.cdr.detectChanges();\n });\n // Force Angular to update the bindings\n\n this.cdr.detectChanges();\n },\n });\n\n effect(() => {\n const currentSlides = this.items();\n const swiper = this.swiperRef;\n if (!swiper) {\n return;\n };\n\n queueMicrotask(() => {\n swiper.update();\n this.cdr.detectChanges();\n });\n });\n }\n\n @Input()\n get options(): DaffSfCarouselOptions {\n return {\n ...{\n slidesPerView: 'auto',\n spaceBetween: 16,\n keyboard: true,\n },\n ...this._options,\n };\n }\n set options(val: DaffSfCarouselOptions) {\n this._options = val;\n }\n}\n","<div class=\"daff-sf-carousel__heading\">\n <ng-content select=\"[daffSfCarouselTitle]\"></ng-content>\n\t<div class=\"daff-sf-carousel__nav\">\n\t\t<button class=\"daff-sf-carousel__button\" aria-hidden=\"true\" tabindex=\"-1\" (click)=\"swiperRef.slidePrev()\" [disabled]=\"swiperRef?.isBeginning\">\n\t\t\t<fa-icon [icon]=\"faChevronLeft\"></fa-icon>\n\t\t</button>\n\t\t<button class=\"daff-sf-carousel__button\" aria-hidden=\"true\" tabindex=\"-1\" (click)=\"swiperRef.slideNext()\" [disabled]=\"swiperRef?.isEnd\">\n\t\t\t<fa-icon [icon]=\"faChevronRight\"></fa-icon>\n\t\t</button>\n\t</div>\n</div>\n\n<swiper-container init=\"false\" #swiperElement>\n\t@for (item of items(); track item) {\n\t\t <swiper-slide>\n\t\t\t\t<ng-container\n\t\t\t\t\t*ngTemplateOutlet=\"item\">\n\t\t\t\t</ng-container>\n\t\t\t</swiper-slide>\n\t}\n</swiper-container>","import { DaffSfCarouselComponent } from './carousel/carousel.component';\nimport { DaffSfCarouselItemDirective } from './carousel-item/carousel-item.directive';\n\nexport const DAFF_SF_CAROUSEL_COMPONENTS = <const> [\n DaffSfCarouselComponent,\n DaffSfCarouselItemDirective,\n];\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;;MAQa,2BAA2B,CAAA;8GAA3B,2BAA2B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;kGAA3B,2BAA2B,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,sBAAA,EAAA,IAAA,EAAA,EAAA,cAAA,EAAA,uBAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;2FAA3B,2BAA2B,EAAA,UAAA,EAAA,CAAA;kBANvC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,sBAAsB;AAChC,oBAAA,IAAI,EAAE;AACJ,wBAAA,KAAK,EAAE,uBAAuB;AAC/B,qBAAA;AACF,iBAAA;;;ACJD,IAAI,UAAU,GAAG,KAAK;AAEtB;;;AAGG;AACI,MAAM,qBAAqB,GAAG,IAAI,cAAc,CACrD,uBAAuB,EACvB;AACE,IAAA,UAAU,EAAE,MAAM;IAClB,OAAO,EAAE,MAAK;QAC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AI,mBACpB,uBAAuB,CAAC,MAAM,EAAA,IAAA,EACzC;AACJ,wBAAA,eAAe,EAAE,MAAM;AACvB,wBAAA,KAAK,EAAE,kBAAkB;AACzB,wBAAA,QAAQ,EAAE,GAAG;qBACd,EAAA,OAAA,EACQ;wBACP,eAAe;wBACf,gBAAgB;qBACjB,EAAA,OAAA,EACQ;wBACP,sBAAsB;AACvB,qBAAA,EAAA,QAAA,EAAA,21BAAA,EAAA,MAAA,EAAA,CAAA,u0JAAA,CAAA,EAAA;AAQuB,SAAA,CAAA,EAAA,cAAA,EAAA,MAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,iBAAA,EAAA,CAAA,EAAA,cAAA,EAAA,EAAA,KAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,eAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,UAAA,CAAA,MAAA,2BAA2B,QAAE,EAAE,IAAI,GAAE,WAAgB,CAAA,EAAE,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,aAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,SAAA,EAAA,IAAA,EAAA,CAEZ,eAAe,OAAE,EAAE,IAAI,GAAE,UAAe,CAAA,EAAE,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,OAAA,EAAA,CAAA;sBAsC5G;;;AE5FI,MAAM,2BAA2B,GAAW;IACjD,uBAAuB;IACvB,2BAA2B;;;ACL7B;;AAEG;;;;"}
1
+ {"version":3,"file":"daffodil-storefront-carousel.mjs","sources":["../../../libs/storefront/carousel/src/carousel-item/carousel-item.directive.ts","../../../libs/storefront/carousel/src/provider.ts","../../../libs/storefront/carousel/src/carousel/carousel.component.ts","../../../libs/storefront/carousel/src/carousel/carousel.component.html","../../../libs/storefront/carousel/src/carousel.ts","../../../libs/storefront/carousel/src/daffodil-storefront-carousel.ts"],"sourcesContent":["import { Directive } from '@angular/core';\n\n@Directive({\n selector: '[daffSfCarouselItem]',\n host: {\n class: 'daff-sf-carousel-item',\n },\n})\nexport class DaffSfCarouselItemDirective {}\n","import { InjectionToken } from '@angular/core';\nimport { register } from 'swiper/element/bundle';\n\nlet registered = false;\n\n/**\n * Injection token for DaffSfCarouselComponent initialization\n * Automatically registers Swiper custom elements once globally when first injected\n */\nexport const DAFF_SF_CAROUSEL_INIT = new InjectionToken<true>(\n 'DAFF_SF_CAROUSEL_INIT',\n {\n providedIn: 'root',\n factory: () => {\n if (!registered) {\n register();\n registered = true;\n }\n return true;\n },\n },\n);\n\n","\n\nimport { NgTemplateOutlet } from '@angular/common';\nimport {\n afterNextRender,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n contentChildren,\n CUSTOM_ELEMENTS_SCHEMA,\n effect,\n ElementRef,\n inject,\n Input,\n TemplateRef,\n viewChild,\n ViewEncapsulation,\n} from '@angular/core';\nimport { FaIconComponent } from '@fortawesome/angular-fontawesome';\nimport {\n faChevronRight,\n faChevronLeft,\n} from '@fortawesome/free-solid-svg-icons';\nimport { Swiper } from 'swiper/types';\n\nimport { SwiperNativeElement } from './swiper-native-element';\nimport { DaffSfCarouselItemDirective } from '../carousel-item/carousel-item.directive';\nimport { DaffSfCarouselOptions } from '../options';\nimport { DAFF_SF_CAROUSEL_INIT } from '../provider';\n\n@Component({\n selector: 'daff-sf-carousel',\n templateUrl: './carousel.component.html',\n styleUrls: ['./carousel.component.scss'],\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n ngSkipHydration: 'true',\n class: 'daff-sf-carousel',\n tabindex: '0',\n },\n imports: [\n FaIconComponent,\n NgTemplateOutlet,\n ],\n schemas: [\n CUSTOM_ELEMENTS_SCHEMA,\n ],\n})\nexport class DaffSfCarouselComponent {\n readonly faChevronRight = faChevronRight;\n readonly faChevronLeft = faChevronLeft;\n\n private _options: DaffSfCarouselOptions;\n\n items = contentChildren(DaffSfCarouselItemDirective, { read: TemplateRef<any> });\n\n swiperElement = viewChild<unknown,ElementRef<SwiperNativeElement>>('swiperElement', { read: ElementRef<any> });\n\n swiperRef: Swiper = undefined;\n\n private initCarousel = inject(DAFF_SF_CAROUSEL_INIT);\n\n constructor(private cdr: ChangeDetectorRef) {\n this.options = {};\n\n afterNextRender({\n write: () => {\n Object.assign(this.swiperElement().nativeElement, this.options);\n this.swiperElement().nativeElement.initialize();\n this.swiperElement().nativeElement.classList.add('swiper-initialized');\n this.swiperRef = this.swiperElement().nativeElement.swiper;\n this.swiperRef.on('slideChange', () => {\n this.cdr.detectChanges();\n });\n // Force Angular to update the bindings\n\n this.cdr.detectChanges();\n },\n });\n\n effect(() => {\n const currentSlides = this.items();\n const swiper = this.swiperRef;\n if (!swiper) {\n return;\n };\n\n queueMicrotask(() => {\n swiper.update();\n this.cdr.detectChanges();\n });\n });\n }\n\n @Input()\n get options(): DaffSfCarouselOptions {\n return {\n ...{\n slidesPerView: 'auto',\n spaceBetween: 16,\n keyboard: true,\n },\n ...this._options,\n };\n }\n set options(val: DaffSfCarouselOptions) {\n this._options = val;\n }\n}\n","<div class=\"daff-sf-carousel__heading\">\n <ng-content select=\"[daffSfCarouselTitle]\"></ng-content>\n\t<div class=\"daff-sf-carousel__nav\">\n\t\t<button class=\"daff-sf-carousel__button\" aria-hidden=\"true\" tabindex=\"-1\" (click)=\"swiperRef.slidePrev()\" [disabled]=\"swiperRef?.isBeginning\">\n\t\t\t<fa-icon [icon]=\"faChevronLeft\"></fa-icon>\n\t\t</button>\n\t\t<button class=\"daff-sf-carousel__button\" aria-hidden=\"true\" tabindex=\"-1\" (click)=\"swiperRef.slideNext()\" [disabled]=\"swiperRef?.isEnd\">\n\t\t\t<fa-icon [icon]=\"faChevronRight\"></fa-icon>\n\t\t</button>\n\t</div>\n</div>\n\n<swiper-container init=\"false\" #swiperElement>\n\t@for (item of items(); track item) {\n\t\t <swiper-slide>\n\t\t\t\t<ng-container\n\t\t\t\t\t*ngTemplateOutlet=\"item\">\n\t\t\t\t</ng-container>\n\t\t\t</swiper-slide>\n\t}\n</swiper-container>","import { DaffSfCarouselComponent } from './carousel/carousel.component';\nimport { DaffSfCarouselItemDirective } from './carousel-item/carousel-item.directive';\n\nexport const DAFF_SF_CAROUSEL_COMPONENTS = <const> [\n DaffSfCarouselComponent,\n DaffSfCarouselItemDirective,\n];\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;;MAQa,2BAA2B,CAAA;iIAA3B,2BAA2B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;qHAA3B,2BAA2B,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,sBAAA,EAAA,IAAA,EAAA,EAAA,cAAA,EAAA,uBAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;2FAA3B,2BAA2B,EAAA,UAAA,EAAA,CAAA;kBANvC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,sBAAsB;AAChC,oBAAA,IAAI,EAAE;AACJ,wBAAA,KAAK,EAAE,uBAAuB;AAC/B,qBAAA;AACF,iBAAA;;;ACJD,IAAI,UAAU,GAAG,KAAK;AAEtB;;;AAGG;AACI,MAAM,qBAAqB,GAAG,IAAI,cAAc,CACrD,uBAAuB,EACvB;AACE,IAAA,UAAU,EAAE,MAAM;IAClB,OAAO,EAAE,MAAK;QACZ,IAAI,CAAC,UAAU,EAAE;AACf,YAAA,QAAQ,EAAE;YACV,UAAU,GAAG,IAAI;QACnB;AACA,QAAA,OAAO,IAAI;IACb,CAAC;AACF,CAAA,CACF;;MC4BY,uBAAuB,CAAA;AAclC,IAAA,WAAA,CAAoB,GAAsB,EAAA;QAAtB,IAAA,CAAA,GAAG,GAAH,GAAG;QAbd,IAAA,CAAA,cAAc,GAAG,cAAc;QAC/B,IAAA,CAAA,aAAa,G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A,CAAA,u0JAAA,CAAA,EAAA;AAQuB,SAAA,CAAA,EAAA,cAAA,EAAA,MAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,iBAAA,EAAA,CAAA,EAAA,cAAA,EAAA,EAAA,KAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,eAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,UAAA,CAAA,MAAA,2BAA2B,QAAE,EAAE,IAAI,GAAE,WAAgB,CAAA,EAAE,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,aAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,SAAA,EAAA,IAAA,EAAA,CAEZ,eAAe,OAAE,EAAE,IAAI,GAAE,UAAe,CAAA,EAAE,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,OAAA,EAAA,CAAA;sBAsC5G;;;AE5FI,MAAM,2BAA2B,GAAW;IACjD,uBAAuB;IACvB,2BAA2B;;;ACL7B;;AAEG;;;;"}
@@ -95,8 +95,8 @@ class DaffSfQuantityInputComponent {
95
95
  ? this._inputControl.disable()
96
96
  : this._inputControl.enable();
97
97
  }
98
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffSfQuantityInputComponent, deps: [{ token: i1.NgControl, optional: true }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
99
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.9", type: DaffSfQuantityInputComponent, isStandalone: true, selector: "daff-sf-quantity-input", inputs: { quantity: { classPropertyName: "quantity", publicName: "quantity", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { focusChange: "focusChange", blurChange: "blurChange", valueChange: "valueChange", quantity: "quantityChange" }, viewQueries: [{ propertyName: "input", first: true, predicate: DaffInputComponent, descendants: true }], ngImport: i0, template: "<input daff-input\n type=\"number\"\n [attr.max]=\"max()\"\n [attr.min]=\"min()\"\n [attr.step]=\"1\"\n (change)=\"onValueChange($event)\"\n (focus)=\"focusChange.emit()\" \n (blur)=\"blurChange.emit()\"\n [formControl]=\"_inputControl\"\n>\n", dependencies: [{ kind: "component", type: DaffInputComponent, selector: "input[daff-input]", inputs: ["disabled", "required"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
98
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffSfQuantityInputComponent, deps: [{ token: i1.NgControl, optional: true }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
99
+ /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.9", type: DaffSfQuantityInputComponent, isStandalone: true, selector: "daff-sf-quantity-input", inputs: { quantity: { classPropertyName: "quantity", publicName: "quantity", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { focusChange: "focusChange", blurChange: "blurChange", valueChange: "valueChange", quantity: "quantityChange" }, viewQueries: [{ propertyName: "input", first: true, predicate: DaffInputComponent, descendants: true }], ngImport: i0, template: "<input daff-input\n type=\"number\"\n [attr.max]=\"max()\"\n [attr.min]=\"min()\"\n [attr.step]=\"1\"\n (change)=\"onValueChange($event)\"\n (focus)=\"focusChange.emit()\" \n (blur)=\"blurChange.emit()\"\n [formControl]=\"_inputControl\"\n>\n", dependencies: [{ kind: "component", type: DaffInputComponent, selector: "input[daff-input]", inputs: ["disabled", "required"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
100
100
  }
101
101
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffSfQuantityInputComponent, decorators: [{
102
102
  type: Component,
@@ -186,8 +186,8 @@ class DaffSfQuantitySelectComponent {
186
186
  const val = coerceNumberProperty(event.target.value);
187
187
  this.valueChange.emit(val);
188
188
  }
189
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffSfQuantitySelectComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
190
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.9", type: DaffSfQuantitySelectComponent, isStandalone: true, selector: "daff-sf-quantity-select", inputs: { min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, extendable: { classPropertyName: "extendable", publicName: "extendable", isSignal: true, isRequired: false, transformFunction: null }, quantity: { classPropertyName: "quantity", publicName: "quantity", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { focusChange: "focusChange", blurChange: "blurChange", valueChange: "valueChange" }, viewQueries: [{ propertyName: "select", first: true, predicate: DaffNativeSelectComponent, descendants: true }], ngImport: i0, template: "<select daff-native-select\n [formControl]=\"_selectControl\"\n (focus)=\"focusChange.emit()\" \n (blur)=\"blurChange.emit()\"\n (change)=\"onValueChange($event)\"\n>\n @for (item of valueArray(); track item) {\n <option [value]=\"item\">{{ item }}</option>\n }\n @if (extendable()) {\n <option [value]=\"max()\">{{ max() }}+</option>\n } @else {\n <option [value]=\"max()\">{{ max() }}</option>\n }\n</select>\n", dependencies: [{ kind: "component", type: DaffNativeSelectComponent, selector: "select[daff-native-select]", inputs: ["disabled", "required"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
189
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffSfQuantitySelectComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
190
+ /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.9", type: DaffSfQuantitySelectComponent, isStandalone: true, selector: "daff-sf-quantity-select", inputs: { min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, extendable: { classPropertyName: "extendable", publicName: "extendable", isSignal: true, isRequired: false, transformFunction: null }, quantity: { classPropertyName: "quantity", publicName: "quantity", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { focusChange: "focusChange", blurChange: "blurChange", valueChange: "valueChange" }, viewQueries: [{ propertyName: "select", first: true, predicate: DaffNativeSelectComponent, descendants: true }], ngImport: i0, template: "<select daff-native-select\n [formControl]=\"_selectControl\"\n (focus)=\"focusChange.emit()\" \n (blur)=\"blurChange.emit()\"\n (change)=\"onValueChange($event)\"\n>\n @for (item of valueArray(); track item) {\n <option [value]=\"item\">{{ item }}</option>\n }\n @if (extendable()) {\n <option [value]=\"max()\">{{ max() }}+</option>\n } @else {\n <option [value]=\"max()\">{{ max() }}</option>\n }\n</select>\n", dependencies: [{ kind: "component", type: DaffNativeSelectComponent, selector: "select[daff-native-select]", inputs: ["disabled", "required"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
191
191
  }
192
192
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffSfQuantitySelectComponent, decorators: [{
193
193
  type: Component,
@@ -412,8 +412,8 @@ class DaffSfQuantityFieldComponent extends DaffFormFieldControl {
412
412
  get value() {
413
413
  return this.quantity();
414
414
  }
415
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffSfQuantityFieldComponent, deps: [{ token: i1.NgControl, optional: true, self: true }, { token: i0.ChangeDetectorRef }, { token: i2.DaffFormFieldComponent, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
416
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.9", type: DaffSfQuantityFieldComponent, isStandalone: true, selector: "daff-sf-quantity-field", inputs: { min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, selectMax: { classPropertyName: "selectMax", publicName: "selectMax", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: false, isRequired: false, transformFunction: booleanAttribute }, required: { classPropertyName: "required", publicName: "required", isSignal: false, isRequired: false, transformFunction: booleanAttribute } }, providers: [
415
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffSfQuantityFieldComponent, deps: [{ token: i1.NgControl, optional: true, self: true }, { token: i0.ChangeDetectorRef }, { token: i2.DaffFormFieldComponent, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
416
+ /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.9", type: DaffSfQuantityFieldComponent, isStandalone: true, selector: "daff-sf-quantity-field", inputs: { min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, selectMax: { classPropertyName: "selectMax", publicName: "selectMax", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: false, isRequired: false, transformFunction: booleanAttribute }, required: { classPropertyName: "required", publicName: "required", isSignal: false, isRequired: false, transformFunction: booleanAttribute } }, providers: [
417
417
  {
418
418
  provide: DaffFormFieldControl,
419
419
  useExisting: DaffSfQuantityFieldComponent,
@@ -1 +1 @@
1
- {"version":3,"file":"daffodil-storefront-quantity-field.mjs","sources":["../../../libs/storefront/quantity-field/src/quantity-input/quantity-input.component.ts","../../../libs/storefront/quantity-field/src/quantity-input/quantity-input.component.html","../../../libs/storefront/quantity-field/src/quantity-select/quantity-select.component.ts","../../../libs/storefront/quantity-field/src/quantity-select/quantity-select.component.html","../../../libs/storefront/quantity-field/src/quantity-field.component.ts","../../../libs/storefront/quantity-field/src/quantity-field.component.html","../../../libs/storefront/quantity-field/src/quantity-field.ts","../../../libs/storefront/quantity-field/src/daffodil-storefront-quantity-field.ts"],"sourcesContent":["import {\n Component,\n output,\n ViewChild,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n OnInit,\n OnDestroy,\n Optional,\n input,\n model,\n} from '@angular/core';\nimport {\n UntypedFormControl,\n NgControl,\n ReactiveFormsModule,\n} from '@angular/forms';\nimport { Subject } from 'rxjs';\nimport { takeUntil } from 'rxjs/operators';\n\nimport { DaffInputComponent } from '@daffodil/design/input';\n\n@Component({\n selector: 'daff-sf-quantity-input',\n templateUrl: './quantity-input.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [\n DaffInputComponent,\n ReactiveFormsModule,\n ],\n})\nexport class DaffSfQuantityInputComponent implements OnInit, OnDestroy {\n @ViewChild(DaffInputComponent) input: DaffInputComponent;\n\n /**\n * Event emitted when the quantity input gains focus\n */\n focusChange = output<void>();\n\n /**\n * Event emitted when the quantity input loses focus\n */\n blurChange = output<void>();\n\n /**\n * Event emitted when the quantity input's value changes\n */\n valueChange = output<number>();\n\n quantity = model<number>();\n\n /**\n * The minimum number for the quantity input field\n */\n min = input(1);\n\n /**\n * The maximum number for the quantity input field\n */\n max = input(10);\n\n /**\n * @docs-private\n */\n get focused() {\n return this.input.focused;\n }\n\n /**\n * A new control for the nested native input.\n * We don't bind the native input directly to the inherited form control\n * to avoid triggering updates on the input event.\n * Instead, we listen for the change event and manually patch form control values.\n */\n _inputControl = new UntypedFormControl();\n\n _destroyed = new Subject();\n\n get value(): number {\n return this.ngControl?.control.value || this.quantity();\n }\n set value(value: number) {\n if (value === 0 || Number.isNaN(value)) {\n value = this.value;\n }\n const val = Math.max(Math.min(Math.round(value), this.max()), this.min());\n this.ngControl?.control.patchValue(val);\n this._inputControl.patchValue(val);\n this.quantity.set(val);\n this.changeDetectorRef.markForCheck();\n }\n\n constructor(\n @Optional() public ngControl: NgControl,\n private changeDetectorRef: ChangeDetectorRef,\n ) {}\n\n /**\n * @docs-private\n */\n ngOnInit() {\n this._inputControl.patchValue(this.ngControl?.control.value ?? this.quantity());\n this.setInputDisabled();\n this.ngControl?.statusChanges.pipe(\n takeUntil(this._destroyed),\n ).subscribe((s) => {\n this.setInputDisabled();\n });\n }\n\n ngOnDestroy() {\n this._destroyed.next(true);\n }\n\n focus() {\n this.input.focus();\n }\n\n /**\n * Callback function fired when the value changes.\n * Used to pass the value back up to the ngControl.\n */\n onValueChange(event: Event) {\n if(event.target instanceof HTMLInputElement) {\n this.value = event.target.valueAsNumber;\n }\n\n this.valueChange.emit(this.value);\n }\n\n private setInputDisabled() {\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions\n this.ngControl?.disabled\n ? this._inputControl.disable()\n : this._inputControl.enable();\n }\n}\n","<input daff-input\n type=\"number\"\n [attr.max]=\"max()\"\n [attr.min]=\"min()\"\n [attr.step]=\"1\"\n (change)=\"onValueChange($event)\"\n (focus)=\"focusChange.emit()\" \n (blur)=\"blurChange.emit()\"\n [formControl]=\"_inputControl\"\n>\n","import { coerceNumberProperty } from '@angular/cdk/coercion';\nimport {\n Component,\n ChangeDetectionStrategy,\n ViewChild,\n input,\n output,\n effect,\n computed,\n} from '@angular/core';\nimport {\n ReactiveFormsModule,\n UntypedFormControl,\n} from '@angular/forms';\n\nimport { DaffNativeSelectComponent } from '@daffodil/design/native-select';\n\n/**\n * @docs-private\n *\n * Create an array of numbers from min to max, not including max.\n */\nexport const makeValueArray = (min: number, max: number, increment: number) =>\n Array(max - min).fill(0).map((x, i) => (i * increment) + min);\n\n@Component({\n selector: 'daff-sf-quantity-select',\n templateUrl: './quantity-select.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [\n DaffNativeSelectComponent,\n ReactiveFormsModule,\n ],\n})\nexport class DaffSfQuantitySelectComponent {\n @ViewChild(DaffNativeSelectComponent) select: DaffNativeSelectComponent;\n\n /**\n * A new control for the nested native select.\n * We don't bind the native select directly to the inherited form control\n * to avoid triggering updates on the input event.\n * Instead, we listen for the change event and manually patch form control values.\n */\n _selectControl = new UntypedFormControl();\n\n /**\n * The minimum number selectable. Defaults to 1.\n */\n min = input(1);\n\n /**\n * The maximum number selectable. Defaults to 10.\n */\n max = input(10);\n\n /**\n * Property used to determine whether or not the select is\n * used in a situation where the `max` isn't a true max.\n */\n extendable = input(true);\n\n /**\n * Event emitted when the quantity select gains focus\n */\n focusChange = output<void>();\n\n /**\n * Event emitted when the quantity select loses focus\n */\n blurChange = output<void>();\n\n /**\n * Event emitted when the quantiy select's value changes\n */\n valueChange = output<number>();\n\n quantity = input();\n\n disabled = input();\n\n constructor() {\n effect(() => {\n const value = this.quantity();\n this._selectControl.patchValue(value);\n });\n\n effect(() => {\n if(this.disabled()) {\n this._selectControl.disable();\n } else {\n this._selectControl.enable();\n }\n });\n }\n\n /**\n * An input for easily making options for the `select`.\n */\n valueArray = computed(() => makeValueArray(this.min(), this.max(), 1));\n\n get focused() {\n return this.select?.focused;\n }\n\n focus() {\n this.select?.focus();\n }\n\n /**\n * @docs-private\n *\n * Callback function fired when the value changes.\n * Used to pass the value back up to the ngControl.\n */\n onValueChange(event: Event) {\n const val = coerceNumberProperty((<HTMLSelectElement>event.target).value);\n\n this.valueChange.emit(val);\n }\n}\n","<select daff-native-select\n [formControl]=\"_selectControl\"\n (focus)=\"focusChange.emit()\" \n (blur)=\"blurChange.emit()\"\n (change)=\"onValueChange($event)\"\n>\n @for (item of valueArray(); track item) {\n <option [value]=\"item\">{{ item }}</option>\n }\n @if (extendable()) {\n <option [value]=\"max()\">{{ max() }}+</option>\n } @else {\n <option [value]=\"max()\">{{ max() }}</option>\n }\n</select>\n","import {\n Component,\n Input,\n ChangeDetectionStrategy,\n Optional,\n Self,\n ChangeDetectorRef,\n booleanAttribute,\n OnInit,\n input,\n signal,\n computed,\n effect,\n viewChild,\n} from '@angular/core';\nimport {\n ControlValueAccessor,\n NgControl,\n Validators,\n} from '@angular/forms';\nimport {\n Subject,\n merge,\n of,\n map,\n tap,\n} from 'rxjs';\nimport { takeUntil } from 'rxjs/operators';\n\nimport {\n DaffFormFieldComponent,\n DaffFormFieldControl,\n} from '@daffodil/design/form-field';\n\nimport { DaffSfQuantityInputComponent } from './quantity-input/quantity-input.component';\nimport { DaffSfQuantitySelectComponent } from './quantity-select/quantity-select.component';\n\n@Component({\n selector: 'daff-sf-quantity-field',\n templateUrl: './quantity-field.component.html',\n providers: [\n {\n provide: DaffFormFieldControl,\n useExisting: DaffSfQuantityFieldComponent,\n },\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [\n DaffSfQuantityInputComponent,\n DaffSfQuantitySelectComponent,\n ],\n})\nexport class DaffSfQuantityFieldComponent extends DaffFormFieldControl<number> implements ControlValueAccessor, DaffFormFieldControl<number>, OnInit {\n\n /**\n * @docs-private\n */\n quantity = signal<number>(1);\n\n /**\n * @docs-private\n */\n _inputHasBeenShown = signal(false);\n\n /**\n * @docs-private\n */\n _showInputField = computed(() => {\n this.quantity();\n\n return this._inputHasBeenShown() || this.quantity() >= this.selectMax();\n });\n\n /**\n * @docs-private\n */\n _showSelectField = computed(() => !this._showInputField());\n\n /** @docs-private */\n get controlType() {\n return this._showInputField() ? 'native-input' : 'native-select';\n }\n\n /**\n * @docs-private\n */\n input = viewChild(DaffSfQuantityInputComponent);\n\n /**\n * @docs-private\n */\n select = viewChild(DaffSfQuantitySelectComponent);\n\n /**\n * The minimum valid value of the quantity field.\n * Must be greater than or equal to 1.\n */\n min = input(1);\n\n /**\n * The maximum valid value of the quantity field.\n * Must be greater than `min`.\n */\n max = input(500);\n\n /**\n * The maximum number allowed before the field switches from a dropdown to an input.\n * When the value reaches this number, an input field is shown instead of a select.\n * Default is 10.\n */\n selectMax = input(10);\n\n /**\n * @docs-private\n *\n * Implemented as part of DaffFormFieldControl.\n */\n get focused() {\n return this.select()?.focused || this.input()?.focused;\n };\n\n private _disabled = false;\n\n /**\n * @docs-private\n *\n * Implemented as part of DaffFormFieldControl.\n */\n @Input({ transform: booleanAttribute })\n get disabled(): boolean {\n return this.ngControl?.disabled ?? this._disabled;\n }\n set disabled(value: boolean) {\n this._disabled = value;\n }\n\n private _required = false;\n\n /**\n * @docs-private\n *\n * Implemented as part of DaffFormFieldControl.\n */\n @Input({ transform: booleanAttribute })\n get required(): boolean {\n return this.ngControl?.control?.hasValidator(Validators.required) ?? this._required;\n }\n set required(value: boolean) {\n this._required = value;\n }\n\n _destroyed = new Subject<boolean>();\n\n /**\n * @docs-private\n *\n * Returns the lesser of max and selectMax.\n */\n get _maxFloor(): number {\n return Math.min(this.max(), this.selectMax());\n }\n\n private _focusSetWhenSwitching = false;\n\n constructor(\n @Optional() @Self() public ngControl: NgControl,\n private cd: ChangeDetectorRef,\n @Optional() private formField: DaffFormFieldComponent,\n ) {\n super(ngControl);\n\n if (this.ngControl != null) {\n this.ngControl.valueAccessor = this;\n }\n\n if(!this.formField) {\n throw new Error('DaffSfQuantityFieldComponent needs to be used with the DaffFormFieldComponent.');\n }\n\n effect(() => {\n if(this.quantity() >= this.selectMax()){\n this._inputHasBeenShown.set(true);\n }\n });\n\n effect(() => {\n if(this._inputHasBeenShown() && this.select()?.focused) {\n this._focusSetWhenSwitching = true;\n }\n\n if(this._focusSetWhenSwitching && this.input()) {\n this.input().focus();\n this._focusSetWhenSwitching = false;\n }\n });\n }\n\n /**\n * @docs-private\n */\n ngOnInit() {\n this.stateChanges = merge(\n this._stateChanges.asObservable(),\n this.ngControl ? this.ngControl.statusChanges : of(undefined),\n ).pipe(\n map(() => this.state),\n tap((state) => this.disabled = state.disabled),\n );\n\n if (this.ngControl?.statusChanges) {\n this.ngControl.statusChanges.pipe(\n takeUntil(this._destroyed),\n ).subscribe(() => {\n this.emitState();\n });\n }\n\n if (this.ngControl?.valueChanges) {\n this.ngControl.valueChanges.pipe(\n takeUntil(this._destroyed),\n ).subscribe((value) => {\n this.quantity.set(value);\n this.cd.markForCheck();\n });\n }\n }\n\n private onChange(quantity: number): void {};\n private onTouched(quantity: number): void {};\n\n /**\n * @docs-private\n */\n writeValue(quantity: number): void {\n this.quantity.set(quantity);\n this.cd.markForCheck();\n }\n\n /**\n * @docs-private\n */\n registerOnChange(fn: (quantity: number) => void): void {\n this.onChange = fn;\n }\n\n /**\n * @docs-private\n */\n registerOnTouched(fn: any): void {\n this.onTouched = fn;\n }\n\n /**\n * @docs-private\n */\n setDisabledState(isDisabled: boolean): void {\n this.disabled = isDisabled;\n this.cd.markForCheck();\n }\n\n /**\n * @docs-private\n *\n * Implemented as part of DaffFormFieldControl.\n */\n focus() {\n if (this.select()) {\n this.select().focus();\n }\n if (this.input()) {\n this.input().focus();\n }\n this.emitState();\n }\n\n /**\n * @docs-private\n *\n * Called when child components gain focus\n */\n _onChildFocus() {\n this.onTouched(this.value);\n this.emitState();\n }\n\n /**\n * @docs-private\n *\n * Called when child components lose focus\n */\n _onChildBlur() {\n this.onTouched(this.value);\n this.emitState(true);\n }\n\n /**\n * @docs-private\n *\n * Called when child components change value\n */\n _onChildValueChange(value: number) {\n this.quantity.set(value);\n this.onChange(value);\n\n this.cd.markForCheck();\n }\n\n /**\n * Implemented as part of DaffFormFieldControl.\n */\n get value(): number {\n return this.quantity();\n }\n}\n","@if (_showSelectField()) {\n <daff-sf-quantity-select\n [min]=\"min()\"\n [max]=\"_maxFloor\"\n [quantity]=\"quantity()\"\n [disabled]=\"disabled\"\n [extendable]=\"max() > selectMax()\"\n (focusChange)=\"_onChildFocus()\"\n (blurChange)=\"_onChildBlur()\"\n (valueChange)=\"_onChildValueChange($event)\">\n </daff-sf-quantity-select>\n}\n@if (_showInputField()) {\n <daff-sf-quantity-input\n [min]=\"min()\"\n [max]=\"max()\"\n [quantity]=\"quantity()\"\n (focusChange)=\"_onChildFocus()\"\n (blurChange)=\"_onChildBlur()\"\n (valueChange)=\"_onChildValueChange($event)\">\n </daff-sf-quantity-input>\n}\n","import { DaffSfQuantityFieldComponent } from './quantity-field.component';\n\n/**\n * @docs-private\n */\nexport const DAFF_SF_QUANTITY_FIELD_COMPONENTS = <const> [\n DaffSfQuantityFieldComponent,\n];\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;MA+Ba,4BAA4B,CAAA;AA8BvC;;AAEG;AACH,IAAA,IAAI,OAAO,GAAA;AACT,QAAA,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO;IAC3B;AAYA,IAAA,IAAI,KAAK,GAAA;AACP,QAAA,OAAO,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,KAAK,IAAI,IAAI,CAAC,QAAQ,EAAE;IACzD;IACA,IAAI,KAAK,CAAC,KAAa,EAAA;QACrB,IAAI,KAAK,KAAK,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;AACtC,YAAA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ity-field/src/quantity-input/quantity-input.component.ts","../../../libs/storefront/quantity-field/src/quantity-input/quantity-input.component.html","../../../libs/storefront/quantity-field/src/quantity-select/quantity-select.component.ts","../../../libs/storefront/quantity-field/src/quantity-select/quantity-select.component.html","../../../libs/storefront/quantity-field/src/quantity-field.component.ts","../../../libs/storefront/quantity-field/src/quantity-field.component.html","../../../libs/storefront/quantity-field/src/quantity-field.ts","../../../libs/storefront/quantity-field/src/daffodil-storefront-quantity-field.ts"],"sourcesContent":["import {\n Component,\n output,\n ViewChild,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n OnInit,\n OnDestroy,\n Optional,\n input,\n model,\n} from '@angular/core';\nimport {\n UntypedFormControl,\n NgControl,\n ReactiveFormsModule,\n} from '@angular/forms';\nimport { Subject } from 'rxjs';\nimport { takeUntil } from 'rxjs/operators';\n\nimport { DaffInputComponent } from '@daffodil/design/input';\n\n@Component({\n selector: 'daff-sf-quantity-input',\n templateUrl: './quantity-input.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [\n DaffInputComponent,\n ReactiveFormsModule,\n ],\n})\nexport class DaffSfQuantityInputComponent implements OnInit, OnDestroy {\n @ViewChild(DaffInputComponent) input: DaffInputComponent;\n\n /**\n * Event emitted when the quantity input gains focus\n */\n focusChange = output<void>();\n\n /**\n * Event emitted when the quantity input loses focus\n */\n blurChange = output<void>();\n\n /**\n * Event emitted when the quantity input's value changes\n */\n valueChange = output<number>();\n\n quantity = model<number>();\n\n /**\n * The minimum number for the quantity input field\n */\n min = input(1);\n\n /**\n * The maximum number for the quantity input field\n */\n max = input(10);\n\n /**\n * @docs-private\n */\n get focused() {\n return this.input.focused;\n }\n\n /**\n * A new control for the nested native input.\n * We don't bind the native input directly to the inherited form control\n * to avoid triggering updates on the input event.\n * Instead, we listen for the change event and manually patch form control values.\n */\n _inputControl = new UntypedFormControl();\n\n _destroyed = new Subject();\n\n get value(): number {\n return this.ngControl?.control.value || this.quantity();\n }\n set value(value: number) {\n if (value === 0 || Number.isNaN(value)) {\n value = this.value;\n }\n const val = Math.max(Math.min(Math.round(value), this.max()), this.min());\n this.ngControl?.control.patchValue(val);\n this._inputControl.patchValue(val);\n this.quantity.set(val);\n this.changeDetectorRef.markForCheck();\n }\n\n constructor(\n @Optional() public ngControl: NgControl,\n private changeDetectorRef: ChangeDetectorRef,\n ) {}\n\n /**\n * @docs-private\n */\n ngOnInit() {\n this._inputControl.patchValue(this.ngControl?.control.value ?? this.quantity());\n this.setInputDisabled();\n this.ngControl?.statusChanges.pipe(\n takeUntil(this._destroyed),\n ).subscribe((s) => {\n this.setInputDisabled();\n });\n }\n\n ngOnDestroy() {\n this._destroyed.next(true);\n }\n\n focus() {\n this.input.focus();\n }\n\n /**\n * Callback function fired when the value changes.\n * Used to pass the value back up to the ngControl.\n */\n onValueChange(event: Event) {\n if(event.target instanceof HTMLInputElement) {\n this.value = event.target.valueAsNumber;\n }\n\n this.valueChange.emit(this.value);\n }\n\n private setInputDisabled() {\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions\n this.ngControl?.disabled\n ? this._inputControl.disable()\n : this._inputControl.enable();\n }\n}\n","<input daff-input\n type=\"number\"\n [attr.max]=\"max()\"\n [attr.min]=\"min()\"\n [attr.step]=\"1\"\n (change)=\"onValueChange($event)\"\n (focus)=\"focusChange.emit()\" \n (blur)=\"blurChange.emit()\"\n [formControl]=\"_inputControl\"\n>\n","import { coerceNumberProperty } from '@angular/cdk/coercion';\nimport {\n Component,\n ChangeDetectionStrategy,\n ViewChild,\n input,\n output,\n effect,\n computed,\n} from '@angular/core';\nimport {\n ReactiveFormsModule,\n UntypedFormControl,\n} from '@angular/forms';\n\nimport { DaffNativeSelectComponent } from '@daffodil/design/native-select';\n\n/**\n * @docs-private\n *\n * Create an array of numbers from min to max, not including max.\n */\nexport const makeValueArray = (min: number, max: number, increment: number) =>\n Array(max - min).fill(0).map((x, i) => (i * increment) + min);\n\n@Component({\n selector: 'daff-sf-quantity-select',\n templateUrl: './quantity-select.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [\n DaffNativeSelectComponent,\n ReactiveFormsModule,\n ],\n})\nexport class DaffSfQuantitySelectComponent {\n @ViewChild(DaffNativeSelectComponent) select: DaffNativeSelectComponent;\n\n /**\n * A new control for the nested native select.\n * We don't bind the native select directly to the inherited form control\n * to avoid triggering updates on the input event.\n * Instead, we listen for the change event and manually patch form control values.\n */\n _selectControl = new UntypedFormControl();\n\n /**\n * The minimum number selectable. Defaults to 1.\n */\n min = input(1);\n\n /**\n * The maximum number selectable. Defaults to 10.\n */\n max = input(10);\n\n /**\n * Property used to determine whether or not the select is\n * used in a situation where the `max` isn't a true max.\n */\n extendable = input(true);\n\n /**\n * Event emitted when the quantity select gains focus\n */\n focusChange = output<void>();\n\n /**\n * Event emitted when the quantity select loses focus\n */\n blurChange = output<void>();\n\n /**\n * Event emitted when the quantiy select's value changes\n */\n valueChange = output<number>();\n\n quantity = input();\n\n disabled = input();\n\n constructor() {\n effect(() => {\n const value = this.quantity();\n this._selectControl.patchValue(value);\n });\n\n effect(() => {\n if(this.disabled()) {\n this._selectControl.disable();\n } else {\n this._selectControl.enable();\n }\n });\n }\n\n /**\n * An input for easily making options for the `select`.\n */\n valueArray = computed(() => makeValueArray(this.min(), this.max(), 1));\n\n get focused() {\n return this.select?.focused;\n }\n\n focus() {\n this.select?.focus();\n }\n\n /**\n * @docs-private\n *\n * Callback function fired when the value changes.\n * Used to pass the value back up to the ngControl.\n */\n onValueChange(event: Event) {\n const val = coerceNumberProperty((<HTMLSelectElement>event.target).value);\n\n this.valueChange.emit(val);\n }\n}\n","<select daff-native-select\n [formControl]=\"_selectControl\"\n (focus)=\"focusChange.emit()\" \n (blur)=\"blurChange.emit()\"\n (change)=\"onValueChange($event)\"\n>\n @for (item of valueArray(); track item) {\n <option [value]=\"item\">{{ item }}</option>\n }\n @if (extendable()) {\n <option [value]=\"max()\">{{ max() }}+</option>\n } @else {\n <option [value]=\"max()\">{{ max() }}</option>\n }\n</select>\n","import {\n Component,\n Input,\n ChangeDetectionStrategy,\n Optional,\n Self,\n ChangeDetectorRef,\n booleanAttribute,\n OnInit,\n input,\n signal,\n computed,\n effect,\n viewChild,\n} from '@angular/core';\nimport {\n ControlValueAccessor,\n NgControl,\n Validators,\n} from '@angular/forms';\nimport {\n Subject,\n merge,\n of,\n map,\n tap,\n} from 'rxjs';\nimport { takeUntil } from 'rxjs/operators';\n\nimport {\n DaffFormFieldComponent,\n DaffFormFieldControl,\n} from '@daffodil/design/form-field';\n\nimport { DaffSfQuantityInputComponent } from './quantity-input/quantity-input.component';\nimport { DaffSfQuantitySelectComponent } from './quantity-select/quantity-select.component';\n\n@Component({\n selector: 'daff-sf-quantity-field',\n templateUrl: './quantity-field.component.html',\n providers: [\n {\n provide: DaffFormFieldControl,\n useExisting: DaffSfQuantityFieldComponent,\n },\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [\n DaffSfQuantityInputComponent,\n DaffSfQuantitySelectComponent,\n ],\n})\nexport class DaffSfQuantityFieldComponent extends DaffFormFieldControl<number> implements ControlValueAccessor, DaffFormFieldControl<number>, OnInit {\n\n /**\n * @docs-private\n */\n quantity = signal<number>(1);\n\n /**\n * @docs-private\n */\n _inputHasBeenShown = signal(false);\n\n /**\n * @docs-private\n */\n _showInputField = computed(() => {\n this.quantity();\n\n return this._inputHasBeenShown() || this.quantity() >= this.selectMax();\n });\n\n /**\n * @docs-private\n */\n _showSelectField = computed(() => !this._showInputField());\n\n /** @docs-private */\n get controlType() {\n return this._showInputField() ? 'native-input' : 'native-select';\n }\n\n /**\n * @docs-private\n */\n input = viewChild(DaffSfQuantityInputComponent);\n\n /**\n * @docs-private\n */\n select = viewChild(DaffSfQuantitySelectComponent);\n\n /**\n * The minimum valid value of the quantity field.\n * Must be greater than or equal to 1.\n */\n min = input(1);\n\n /**\n * The maximum valid value of the quantity field.\n * Must be greater than `min`.\n */\n max = input(500);\n\n /**\n * The maximum number allowed before the field switches from a dropdown to an input.\n * When the value reaches this number, an input field is shown instead of a select.\n * Default is 10.\n */\n selectMax = input(10);\n\n /**\n * @docs-private\n *\n * Implemented as part of DaffFormFieldControl.\n */\n get focused() {\n return this.select()?.focused || this.input()?.focused;\n };\n\n private _disabled = false;\n\n /**\n * @docs-private\n *\n * Implemented as part of DaffFormFieldControl.\n */\n @Input({ transform: booleanAttribute })\n get disabled(): boolean {\n return this.ngControl?.disabled ?? this._disabled;\n }\n set disabled(value: boolean) {\n this._disabled = value;\n }\n\n private _required = false;\n\n /**\n * @docs-private\n *\n * Implemented as part of DaffFormFieldControl.\n */\n @Input({ transform: booleanAttribute })\n get required(): boolean {\n return this.ngControl?.control?.hasValidator(Validators.required) ?? this._required;\n }\n set required(value: boolean) {\n this._required = value;\n }\n\n _destroyed = new Subject<boolean>();\n\n /**\n * @docs-private\n *\n * Returns the lesser of max and selectMax.\n */\n get _maxFloor(): number {\n return Math.min(this.max(), this.selectMax());\n }\n\n private _focusSetWhenSwitching = false;\n\n constructor(\n @Optional() @Self() public ngControl: NgControl,\n private cd: ChangeDetectorRef,\n @Optional() private formField: DaffFormFieldComponent,\n ) {\n super(ngControl);\n\n if (this.ngControl != null) {\n this.ngControl.valueAccessor = this;\n }\n\n if(!this.formField) {\n throw new Error('DaffSfQuantityFieldComponent needs to be used with the DaffFormFieldComponent.');\n }\n\n effect(() => {\n if(this.quantity() >= this.selectMax()){\n this._inputHasBeenShown.set(true);\n }\n });\n\n effect(() => {\n if(this._inputHasBeenShown() && this.select()?.focused) {\n this._focusSetWhenSwitching = true;\n }\n\n if(this._focusSetWhenSwitching && this.input()) {\n this.input().focus();\n this._focusSetWhenSwitching = false;\n }\n });\n }\n\n /**\n * @docs-private\n */\n ngOnInit() {\n this.stateChanges = merge(\n this._stateChanges.asObservable(),\n this.ngControl ? this.ngControl.statusChanges : of(undefined),\n ).pipe(\n map(() => this.state),\n tap((state) => this.disabled = state.disabled),\n );\n\n if (this.ngControl?.statusChanges) {\n this.ngControl.statusChanges.pipe(\n takeUntil(this._destroyed),\n ).subscribe(() => {\n this.emitState();\n });\n }\n\n if (this.ngControl?.valueChanges) {\n this.ngControl.valueChanges.pipe(\n takeUntil(this._destroyed),\n ).subscribe((value) => {\n this.quantity.set(value);\n this.cd.markForCheck();\n });\n }\n }\n\n private onChange(quantity: number): void {};\n private onTouched(quantity: number): void {};\n\n /**\n * @docs-private\n */\n writeValue(quantity: number): void {\n this.quantity.set(quantity);\n this.cd.markForCheck();\n }\n\n /**\n * @docs-private\n */\n registerOnChange(fn: (quantity: number) => void): void {\n this.onChange = fn;\n }\n\n /**\n * @docs-private\n */\n registerOnTouched(fn: any): void {\n this.onTouched = fn;\n }\n\n /**\n * @docs-private\n */\n setDisabledState(isDisabled: boolean): void {\n this.disabled = isDisabled;\n this.cd.markForCheck();\n }\n\n /**\n * @docs-private\n *\n * Implemented as part of DaffFormFieldControl.\n */\n focus() {\n if (this.select()) {\n this.select().focus();\n }\n if (this.input()) {\n this.input().focus();\n }\n this.emitState();\n }\n\n /**\n * @docs-private\n *\n * Called when child components gain focus\n */\n _onChildFocus() {\n this.onTouched(this.value);\n this.emitState();\n }\n\n /**\n * @docs-private\n *\n * Called when child components lose focus\n */\n _onChildBlur() {\n this.onTouched(this.value);\n this.emitState(true);\n }\n\n /**\n * @docs-private\n *\n * Called when child components change value\n */\n _onChildValueChange(value: number) {\n this.quantity.set(value);\n this.onChange(value);\n\n this.cd.markForCheck();\n }\n\n /**\n * Implemented as part of DaffFormFieldControl.\n */\n get value(): number {\n return this.quantity();\n }\n}\n","@if (_showSelectField()) {\n <daff-sf-quantity-select\n [min]=\"min()\"\n [max]=\"_maxFloor\"\n [quantity]=\"quantity()\"\n [disabled]=\"disabled\"\n [extendable]=\"max() > selectMax()\"\n (focusChange)=\"_onChildFocus()\"\n (blurChange)=\"_onChildBlur()\"\n (valueChange)=\"_onChildValueChange($event)\">\n </daff-sf-quantity-select>\n}\n@if (_showInputField()) {\n <daff-sf-quantity-input\n [min]=\"min()\"\n [max]=\"max()\"\n [quantity]=\"quantity()\"\n (focusChange)=\"_onChildFocus()\"\n (blurChange)=\"_onChildBlur()\"\n (valueChange)=\"_onChildValueChange($event)\">\n </daff-sf-quantity-input>\n}\n","import { DaffSfQuantityFieldComponent } from './quantity-field.component';\n\n/**\n * @docs-private\n */\nexport const DAFF_SF_QUANTITY_FIELD_COMPONENTS = <const> [\n DaffSfQuantityFieldComponent,\n];\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;MA+Ba,4BAA4B,CAAA;AA8BvC;;AAEG;AACH,IAAA,IAAI,OAAO,GAAA;AACT,QAAA,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO;IAC3B;AAYA,IAAA,IAAI,KAAK,GAAA;AACP,QAAA,OAAO,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,KAAK,IAAI,IAAI,CAAC,QAAQ,EAAE;IACzD;IACA,IAAI,KAAK,CAAC,KAAa,EAAA;QACrB,IAAI,KAAK,KAAK,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;AACtC,YAAA,KAAK,GAAG,IAAI,CAAC,KAAK;QACpB;AACA,QAAA,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC;QACzE,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC;AACvC,QAAA,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,GAAG,CAAC;AAClC,QAAA,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC;AACtB,QAAA,IAAI,CAAC,iBAAiB,CAAC,YAAY,EAAE;IACvC;IAEA,WAAA,CACqB,SAAoB,EAC/B,iBAAoC,EAAA;QADzB,I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,IAAA,EAAA,KAAA,EAAA,KAAA,EAAA,QAAA,EAAA,KAAA,EAAA,CAAA,EAAA,CAAA,EAAA,GAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,KAAA,EAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,KAAA,EAAA,KAAA,EAAA,QAAA,EAAA,KAAA,EAAA,CAAA,EAAA,CAAA,EAAA,SAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,KAAA,EAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,KAAA,EAAA,WAAA,EAAA,QAAA,EAAA,KAAA,EAAA,CAAA,EAAA,CAAA,EAAA,QAAA,EAAA,CAAA;sBAqC/C,KAAK;uBAAC,EAAE,SAAS,EAAE,gBAAgB,EAAE;;sBAerC,KAAK;uBAAC,EAAE,SAAS,EAAE,gBAAgB,EAAE;;;AE7IxC;;AAEG;AACI,MAAM,iCAAiC,GAAW;IACvD,4BAA4B;;;ACN9B;;AAEG;;;;"}
@@ -2,35 +2,72 @@ import * as i0 from '@angular/core';
2
2
  import { computed, ChangeDetectionStrategy, Component } from '@angular/core';
3
3
  import { toSignal } from '@angular/core/rxjs-interop';
4
4
  import { FaIconComponent } from '@fortawesome/angular-fontawesome';
5
- import { faMoon, faSun } from '@fortawesome/free-solid-svg-icons';
5
+ import { faSun, faMoon, faCircleHalfStroke } from '@fortawesome/free-solid-svg-icons';
6
6
  import * as i1 from '@daffodil/design';
7
7
  import { DaffTheme } from '@daffodil/design';
8
- import { DaffIconButtonComponent } from '@daffodil/design/button';
8
+ import * as i2 from '@daffodil/design/button';
9
+ import { DAFF_ICON_BUTTON_COMPONENTS } from '@daffodil/design/button';
10
+ import * as i3 from '@daffodil/design/menu';
11
+ import { DaffMenuService, DAFF_MENU_COMPONENTS } from '@daffodil/design/menu';
9
12
 
10
- /** @docs-private */
11
- const TOGGLE_TO_LIGHT_LABEL = 'Switch to light mode';
12
- /** @docs-private */
13
- const TOGGLE_TO_DARK_LABEL = 'Switch to dark mode';
14
13
  /**
15
- * DaffSfThemeToggleComponent renders a button that toggles the active
16
- * theme between light and dark.
14
+ * DaffSfThemeToggleComponent renders a button that opens a menu for choosing
15
+ * between the light, dark, and system themes.
17
16
  */
18
17
  class DaffSfThemeToggleComponent {
19
18
  constructor(themeService) {
20
19
  this.themeService = themeService;
21
20
  /** @docs-private */
22
- this.theme = toSignal(this.themeService.getTheme());
21
+ this.DaffTheme = DaffTheme;
23
22
  /** @docs-private */
24
- this.ariaLabel = computed(() => this.theme() === DaffTheme.Light ? TOGGLE_TO_DARK_LABEL : TOGGLE_TO_LIGHT_LABEL, ...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
23
+ this.faSun = faSun;
25
24
  /** @docs-private */
26
- this.icon = computed(() => this.theme() === DaffTheme.Light ? faMoon : faSun, ...(ngDevMode ? [{ debugName: "icon" }] : /* istanbul ignore next */ []));
25
+ this.faMoon = faMoon;
26
+ /** @docs-private */
27
+ this.faCircleHalfStroke = faCircleHalfStroke;
28
+ /**
29
+ * @docs-private
30
+ *
31
+ * The user's stored theme preference.
32
+ */
33
+ this.preference = toSignal(this.themeService.getThemePreference());
34
+ /** @docs-private */
35
+ this.icon = computed(() => {
36
+ switch (this.preference()) {
37
+ case DaffTheme.Light:
38
+ return faSun;
39
+ case DaffTheme.Dark:
40
+ return faMoon;
41
+ default:
42
+ return faCircleHalfStroke;
43
+ }
44
+ }, ...(ngDevMode ? [{ debugName: "icon" }] : /* istanbul ignore next */ []));
45
+ /**
46
+ * @docs-private
47
+ *
48
+ * The accessible label for the toggle.
49
+ */
50
+ this.label = computed(() => {
51
+ const theme = this.preference() ?? DaffTheme.System;
52
+ return `Change theme. Current theme: ${theme}`;
53
+ }, ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
54
+ }
55
+ /** @docs-private */
56
+ lightMode() {
57
+ this.themeService.lightMode();
58
+ }
59
+ /** @docs-private */
60
+ darkMode() {
61
+ this.themeService.darkMode();
27
62
  }
28
63
  /** @docs-private */
29
- toggleTheme() {
30
- this.themeService.switchTheme();
64
+ systemMode() {
65
+ this.themeService.systemMode();
31
66
  }
32
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffSfThemeToggleComponent, deps: [{ token: i1.DaffThemingService }], target: i0.ɵɵFactoryTarget.Component }); }
33
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.9", type: DaffSfThemeToggleComponent, isStandalone: true, selector: "daff-sf-theme-toggle", host: { attributes: { "aria-live": "polite" } }, ngImport: i0, template: "<button type=\"button\" daff-icon-button color=\"theme-contrast\" (click)=\"toggleTheme()\" [attr.aria-label]=\"ariaLabel()\">\n <fa-icon [icon]=\"icon()\"></fa-icon>\n</button>\n", dependencies: [{ kind: "component", type: FaIconComponent, selector: "fa-icon", inputs: ["icon", "title", "animation", "mask", "flip", "size", "pull", "border", "inverse", "symbol", "rotate", "fixedWidth", "transform", "a11yRole"], outputs: ["iconChange", "titleChange", "animationChange", "maskChange", "flipChange", "sizeChange", "pullChange", "borderChange", "inverseChange", "symbolChange", "rotateChange", "fixedWidthChange", "transformChange", "a11yRoleChange"] }, { kind: "component", type: DaffIconButtonComponent, selector: "button[daff-icon-button],a[daff-icon-button]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
67
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffSfThemeToggleComponent, deps: [{ token: i1.DaffThemingService }], target: i0.ɵɵFactoryTarget.Component }); }
68
+ /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.9", type: DaffSfThemeToggleComponent, isStandalone: true, selector: "daff-sf-theme-toggle", host: { attributes: { "aria-live": "polite" } }, providers: [
69
+ DaffMenuService,
70
+ ], ngImport: i0, template: "<button\n type=\"button\"\n daff-icon-button\n color=\"theme-contrast\"\n [daffMenuActivator]=\"menu\"\n [attr.aria-label]=\"label()\">\n <fa-icon [icon]=\"icon()\"></fa-icon>\n</button>\n\n<ng-template #menu>\n <daff-menu>\n <button\n type=\"button\"\n daff-menu-item\n aria-label=\"Set default system theme\"\n [attr.aria-current]=\"preference() === DaffTheme.System\"\n (click)=\"systemMode()\">\n <fa-icon [icon]=\"faCircleHalfStroke\" [fixedWidth]=\"true\" daffPrefix></fa-icon>\n System\n </button>\n <button\n type=\"button\"\n daff-menu-item\n aria-label=\"Set light theme\"\n [attr.aria-current]=\"preference() === DaffTheme.Light\"\n (click)=\"lightMode()\">\n <fa-icon [icon]=\"faSun\" [fixedWidth]=\"true\" daffPrefix></fa-icon>\n Light\n </button>\n <button\n type=\"button\"\n daff-menu-item\n aria-label=\"Set dark theme\"\n [attr.aria-current]=\"preference() === DaffTheme.Dark\"\n (click)=\"darkMode()\">\n <fa-icon [icon]=\"faMoon\" [fixedWidth]=\"true\" daffPrefix></fa-icon>\n Dark\n </button>\n </daff-menu>\n</ng-template>\n", dependencies: [{ kind: "component", type: FaIconComponent, selector: "fa-icon", inputs: ["icon", "title", "animation", "mask", "flip", "size", "pull", "border", "inverse", "symbol", "rotate", "fixedWidth", "transform", "a11yRole"], outputs: ["iconChange", "titleChange", "animationChange", "maskChange", "flipChange", "sizeChange", "pullChange", "borderChange", "inverseChange", "symbolChange", "rotateChange", "fixedWidthChange", "transformChange", "a11yRoleChange"] }, { kind: "component", type: i2.DaffIconButtonComponent, selector: "button[daff-icon-button],a[daff-icon-button]" }, { kind: "directive", type: i1.DaffPrefixDirective, selector: "[daffPrefix]" }, { kind: "component", type: i3.DaffMenuComponent, selector: "daff-menu" }, { kind: "directive", type: i3.DaffMenuActivatorDirective, selector: "[daffMenuActivator]", inputs: ["daffMenuActivator", "id"], exportAs: ["daffMenuActivator"] }, { kind: "component", type: i3.DaffMenuItemComponent, selector: "a[daff-menu-item],button[daff-menu-item]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
34
71
  }
35
72
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffSfThemeToggleComponent, decorators: [{
36
73
  type: Component,
@@ -38,8 +75,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
38
75
  'aria-live': 'polite',
39
76
  }, imports: [
40
77
  FaIconComponent,
41
- DaffIconButtonComponent,
42
- ], template: "<button type=\"button\" daff-icon-button color=\"theme-contrast\" (click)=\"toggleTheme()\" [attr.aria-label]=\"ariaLabel()\">\n <fa-icon [icon]=\"icon()\"></fa-icon>\n</button>\n" }]
78
+ DAFF_ICON_BUTTON_COMPONENTS,
79
+ DAFF_MENU_COMPONENTS,
80
+ ], providers: [
81
+ DaffMenuService,
82
+ ], template: "<button\n type=\"button\"\n daff-icon-button\n color=\"theme-contrast\"\n [daffMenuActivator]=\"menu\"\n [attr.aria-label]=\"label()\">\n <fa-icon [icon]=\"icon()\"></fa-icon>\n</button>\n\n<ng-template #menu>\n <daff-menu>\n <button\n type=\"button\"\n daff-menu-item\n aria-label=\"Set default system theme\"\n [attr.aria-current]=\"preference() === DaffTheme.System\"\n (click)=\"systemMode()\">\n <fa-icon [icon]=\"faCircleHalfStroke\" [fixedWidth]=\"true\" daffPrefix></fa-icon>\n System\n </button>\n <button\n type=\"button\"\n daff-menu-item\n aria-label=\"Set light theme\"\n [attr.aria-current]=\"preference() === DaffTheme.Light\"\n (click)=\"lightMode()\">\n <fa-icon [icon]=\"faSun\" [fixedWidth]=\"true\" daffPrefix></fa-icon>\n Light\n </button>\n <button\n type=\"button\"\n daff-menu-item\n aria-label=\"Set dark theme\"\n [attr.aria-current]=\"preference() === DaffTheme.Dark\"\n (click)=\"darkMode()\">\n <fa-icon [icon]=\"faMoon\" [fixedWidth]=\"true\" daffPrefix></fa-icon>\n Dark\n </button>\n </daff-menu>\n</ng-template>\n" }]
43
83
  }], ctorParameters: () => [{ type: i1.DaffThemingService }] });
44
84
 
45
85
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"daffodil-storefront-theme-toggle.mjs","sources":["../../../libs/storefront/theme-toggle/src/theme-toggle.component.ts","../../../libs/storefront/theme-toggle/src/theme-toggle.component.html","../../../libs/storefront/theme-toggle/src/daffodil-storefront-theme-toggle.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n computed,\n} from '@angular/core';\nimport { toSignal } from '@angular/core/rxjs-interop';\nimport { FaIconComponent } from '@fortawesome/angular-fontawesome';\nimport {\n faMoon,\n faSun,\n} from '@fortawesome/free-solid-svg-icons';\n\nimport {\n DaffTheme,\n DaffThemingService,\n} from '@daffodil/design';\nimport { DaffIconButtonComponent } from '@daffodil/design/button';\n\n/** @docs-private */\nexport const TOGGLE_TO_LIGHT_LABEL = 'Switch to light mode';\n/** @docs-private */\nexport const TOGGLE_TO_DARK_LABEL = 'Switch to dark mode';\n\n/**\n * DaffSfThemeToggleComponent renders a button that toggles the active\n * theme between light and dark.\n */\n@Component({\n selector: 'daff-sf-theme-toggle',\n templateUrl: './theme-toggle.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n 'aria-live': 'polite',\n },\n imports: [\n FaIconComponent,\n DaffIconButtonComponent,\n ],\n})\nexport class DaffSfThemeToggleComponent {\n /** @docs-private */\n theme = toSignal(this.themeService.getTheme());\n\n /** @docs-private */\n ariaLabel = computed(() => this.theme() === DaffTheme.Light ? TOGGLE_TO_DARK_LABEL : TOGGLE_TO_LIGHT_LABEL);\n\n /** @docs-private */\n icon = computed(() => this.theme() === DaffTheme.Light ? faMoon : faSun);\n\n constructor(private themeService: DaffThemingService) { }\n\n /** @docs-private */\n toggleTheme() {\n this.themeService.switchTheme();\n }\n}\n","<button type=\"button\" daff-icon-button color=\"theme-contrast\" (click)=\"toggleTheme()\" [attr.aria-label]=\"ariaLabel()\">\n <fa-ic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QAAA,EAAA,sBAAA,EAAA,IAAA,EAAA,EAAA,UAAA,EAAA,EAAA,WAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,ECvCvC,sLAGA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EDgCI,eAAe,ybACf,uBAAuB,EAAA,QAAA,EAAA,8CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA,CAAA;;2FAGd,0BAA0B,EAAA,UAAA,EAAA,CAAA;kBAZtC,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,sBAAsB,EAAA,eAAA,EAEf,uBAAuB,CAAC,MAAM,EAAA,IAAA,EACzC;AACJ,wBAAA,WAAW,EAAE,QAAQ;qBACtB,EAAA,OAAA,EACQ;wBACP,eAAe;wBACf,uBAAuB;AACxB,qBAAA,EAAA,QAAA,EAAA,sLAAA,EAAA;;;AErCH;;AAEG;;;;"}
1
+ {"version":3,"file":"daffodil-storefront-theme-toggle.mjs","sources":["../../../libs/storefront/theme-toggle/src/theme-toggle.component.ts","../../../libs/storefront/theme-toggle/src/theme-toggle.component.html","../../../libs/storefront/theme-toggle/src/daffodil-storefront-theme-toggle.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n computed,\n} from '@angular/core';\nimport { toSignal } from '@angular/core/rxjs-interop';\nimport { FaIconComponent } from '@fortawesome/angular-fontawesome';\nimport {\n faCircleHalfStroke,\n faMoon,\n faSun,\n} from '@fortawesome/free-solid-svg-icons';\n\nimport {\n DaffTheme,\n DaffThemingService,\n} from '@daffodil/design';\nimport { DAFF_ICON_BUTTON_COMPONENTS } from '@daffodil/design/button';\nimport {\n DAFF_MENU_COMPONENTS,\n DaffMenuService,\n} from '@daffodil/design/menu';\n\n/**\n * DaffSfThemeToggleComponent renders a button that opens a menu for choosing\n * between the light, dark, and system themes.\n */\n@Component({\n selector: 'daff-sf-theme-toggle',\n templateUrl: './theme-toggle.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n 'aria-live': 'polite',\n },\n imports: [\n FaIconComponent,\n DAFF_ICON_BUTTON_COMPONENTS,\n DAFF_MENU_COMPONENTS,\n ],\n providers: [\n DaffMenuService,\n ],\n})\nexport class DaffSfThemeToggleComponent {\n /** @docs-private */\n DaffTheme = DaffTheme;\n\n /** @docs-private */\n faSun = faSun;\n /** @docs-private */\n faMoon = faMoon;\n /** @docs-private */\n faCircleHalfStroke = faCircleHalfStroke;\n\n /**\n * @docs-private\n *\n * The user's stored theme preference.\n */\n preference = toSignal(this.themeService.getThemePreference());\n\n /** @docs-private */\n icon = computed(() => {\n switch (this.preference()) {\n case DaffTheme.Light:\n return faSun;\n case DaffTheme.Dark:\n return faMoon;\n default:\n return faCircleHalfStroke;\n }\n });\n\n /**\n * @docs-private\n *\n * The accessible label for the toggle.\n */\n label = computed(() => {\n const theme = this.preference() ?? DaffTheme.System;\n return `Change theme. Current theme: ${theme}`;\n });\n\n constructor(private themeService: DaffThemingService) { }\n\n /** @docs-private */\n lightMode() {\n this.themeService.lightMode();\n }\n\n /** @docs-private */\n darkMode() {\n this.themeService.darkMode();\n }\n\n /** @docs-private */\n systemMode() {\n this.themeService.systemMode();\n }\n}\n","<button\n type=\"button\"\n daff-icon-button\n color=\"theme-contrast\"\n [daffMenuActivator]=\"menu\"\n [attr.aria-label]=\"label()\">\n <fa-icon [icon]=\"icon()\"></fa-icon>\n</button>\n\n<ng-template #menu>\n <daff-menu>\n <button\n type=\"button\"\n daff-menu-item\n aria-label=\"Set default system theme\"\n [attr.aria-current]=\"preference() === DaffTheme.System\"\n (click)=\"systemMode()\">\n <fa-icon [icon]=\"faCircleHalfStroke\" [fixedWidth]=\"true\" daffPrefix></fa-icon>\n System\n </button>\n <button\n type=\"button\"\n daff-menu-item\n aria-label=\"Set light theme\"\n [attr.aria-current]=\"preference() === DaffTheme.Light\"\n (click)=\"lightMode()\">\n <fa-icon [icon]=\"faSun\" [fixedWidth]=\"true\" daffPrefix></fa-icon>\n Light\n </button>\n <button\n type=\"button\"\n daff-menu-item\n aria-label=\"Set dark theme\"\n [attr.aria-current]=\"preference() === DaffTheme.Dark\"\n (click)=\"darkMode()\">\n <fa-icon [icon]=\"faMoon\" [fixedWidth]=\"true\" daffPrefix></fa-icon>\n Dark\n </button>\n </daff-menu>\n</ng-template>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;;;;;;;AAuBA;;;AAGG;MAiBU,0BAA0B,CAAA;AAwCrC,IAAA,WAAA,CAAoB,YAAgC,EAAA;QAAhC,IAAA,CAAA,YAAY,GAAZ,YAAY;;QAtChC,IAAA,CAAA,SAAS,GAAG,SAAS;;QAGrB,IAAA,CAAA,KAAK,GAAG,KAAK;;QAEb,IAAA,CAAA,MAAM,GAAG,MAAM;;QAEf,IAAA,CAAA,kBAAkB,GAAG,kBAAkB;AAEvC;;;;AAIG;QACH,IAAA,CAAA,UAAU,GAAG,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,kBAAkB,EAAE,CAAC;;AAG7D,QAAA,IAAA,CAAA,IAAI,GAAG,QAAQ,CAAC,MAAK;AACnB,YAAA,QAAQ,IAAI,CAAC,UAAU,EAAE;gBACvB,KAAK,SAAS,CAAC,KAAK;AAClB,oBAAA,OAAO,KAAK;gBACd,KAAK,SAAS,CAAC,IAAI;AACjB,oBAAA,OAAO,MAAM;AACf,gBAAA;AACE,oBAAA,OAAO,kBAAkB;;AAE/B,QAAA,CAAC,2EAAC;AAEF;;;;AAIG;AACH,QAAA,IAAA,CAAA,KAAK,GAAG,QAAQ,CAAC,MAAK;YACpB,MAAM,KAAK,GAAG,IAAI,CAAC,UAAU,EAAE,IAAI,SAAS,CAAC,MAAM;YACnD,OAAO,CAAA,6BAAA,EAAgC,KAAK,CAAA,CAAE;AAChD,QAAA,CAAC,4EAAC;IA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,uBAAA,EAAA,QAAA,EAAA,8CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAA,EAAA,CAAA,mBAAA,EAAA,QAAA,EAAA,cAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAA,EAAA,CAAA,iBAAA,EAAA,QAAA,EAAA,WAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAA,EAAA,CAAA,0BAAA,EAAA,QAAA,EAAA,qBAAA,EAAA,MAAA,EAAA,CAAA,mBAAA,EAAA,IAAA,CAAA,EAAA,QAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAA,EAAA,CAAA,qBAAA,EAAA,QAAA,EAAA,0CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA,CAAA;;2FAQN,0BAA0B,EAAA,UAAA,EAAA,CAAA;kBAhBtC,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,sBAAsB,EAAA,eAAA,EAEf,uBAAuB,CAAC,MAAM,EAAA,IAAA,EACzC;AACJ,wBAAA,WAAW,EAAE,QAAQ;qBACtB,EAAA,OAAA,EACQ;wBACP,eAAe;wBACf,2BAA2B;wBAC3B,oBAAoB;qBACrB,EAAA,SAAA,EACU;wBACT,eAAe;AAChB,qBAAA,EAAA,QAAA,EAAA,2pCAAA,EAAA;;;AEzCH;;AAEG;;;;"}
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@daffodil/storefront","version":"0.93.0","repository":{"type":"git","url":"https://github.com/graycoreio/daffodil"},"nx":{"targets":{"build":{"outputs":["{workspaceRoot}/dist/storefront"]}}},"peerDependencies":{"@angular/common":"^21","@angular/core":"^21","@daffodil/design":"0.93.0"},"dependencies":{"tslib":"^2.6.2"},"sideEffects":false,"exports":{"./scss/theme":{"sass":"./scss/theme.scss"},"./package.json":{"default":"./package.json"},".":{"types":"./types/daffodil-storefront.d.ts","default":"./fesm2022/daffodil-storefront.mjs"},"./carousel":{"types":"./types/daffodil-storefront-carousel.d.ts","default":"./fesm2022/daffodil-storefront-carousel.mjs"},"./quantity-field":{"types":"./types/daffodil-storefront-quantity-field.d.ts","default":"./fesm2022/daffodil-storefront-quantity-field.mjs"},"./theme-toggle":{"types":"./types/daffodil-storefront-theme-toggle.d.ts","default":"./fesm2022/daffodil-storefront-theme-toggle.mjs"}},"description":"High-level ecommerce UI components built on @daffodil/design for storefront applications. Part of the Daffodil ecommerce framework.","module":"fesm2022/daffodil-storefront.mjs","typings":"types/daffodil-storefront.d.ts","type":"module"}
1
+ {"name":"@daffodil/storefront","version":"0.93.1","author":"Graycore LLC","license":"MIT","homepage":"https://github.com/graycoreio/daffodil","description":"High-level ecommerce UI components built on @daffodil/design for storefront applications. Part of the Daffodil ecommerce framework.","bugs":{"url":"https://github.com/graycoreio/daffodil/issues"},"repository":{"type":"git","url":"https://github.com/graycoreio/daffodil"},"nx":{"targets":{"build":{"outputs":["{workspaceRoot}/dist/storefront"]}}},"peerDependencies":{"@angular/common":"^21","@angular/core":"^21","@daffodil/design":"0.93.1"},"dependencies":{"tslib":"^2.6.2"},"sideEffects":false,"exports":{"./scss/theme":{"sass":"./scss/theme.scss"},"./package.json":{"default":"./package.json"},".":{"types":"./types/daffodil-storefront.d.ts","default":"./fesm2022/daffodil-storefront.mjs"},"./carousel":{"types":"./types/daffodil-storefront-carousel.d.ts","default":"./fesm2022/daffodil-storefront-carousel.mjs"},"./quantity-field":{"types":"./types/daffodil-storefront-quantity-field.d.ts","default":"./fesm2022/daffodil-storefront-quantity-field.mjs"},"./theme-toggle":{"types":"./types/daffodil-storefront-theme-toggle.d.ts","default":"./fesm2022/daffodil-storefront-theme-toggle.mjs"}},"module":"fesm2022/daffodil-storefront.mjs","typings":"types/daffodil-storefront.d.ts","type":"module"}
@@ -1,22 +1,42 @@
1
- import * as _fortawesome_fontawesome_common_types from '@fortawesome/fontawesome-common-types';
2
1
  import * as _angular_core from '@angular/core';
2
+ import * as _fortawesome_fontawesome_common_types from '@fortawesome/fontawesome-common-types';
3
3
  import { DaffTheme, DaffThemingService } from '@daffodil/design';
4
4
 
5
5
  /**
6
- * DaffSfThemeToggleComponent renders a button that toggles the active
7
- * theme between light and dark.
6
+ * DaffSfThemeToggleComponent renders a button that opens a menu for choosing
7
+ * between the light, dark, and system themes.
8
8
  */
9
9
  declare class DaffSfThemeToggleComponent {
10
10
  private themeService;
11
11
  /** @docs-private */
12
- theme: _angular_core.Signal<DaffTheme>;
12
+ DaffTheme: typeof DaffTheme;
13
+ /** @docs-private */
14
+ faSun: _fortawesome_fontawesome_common_types.IconDefinition;
13
15
  /** @docs-private */
14
- ariaLabel: _angular_core.Signal<"Switch to light mode" | "Switch to dark mode">;
16
+ faMoon: _fortawesome_fontawesome_common_types.IconDefinition;
17
+ /** @docs-private */
18
+ faCircleHalfStroke: _fortawesome_fontawesome_common_types.IconDefinition;
19
+ /**
20
+ * @docs-private
21
+ *
22
+ * The user's stored theme preference.
23
+ */
24
+ preference: _angular_core.Signal<DaffTheme>;
15
25
  /** @docs-private */
16
26
  icon: _angular_core.Signal<_fortawesome_fontawesome_common_types.IconDefinition>;
27
+ /**
28
+ * @docs-private
29
+ *
30
+ * The accessible label for the toggle.
31
+ */
32
+ label: _angular_core.Signal<string>;
17
33
  constructor(themeService: DaffThemingService);
18
34
  /** @docs-private */
19
- toggleTheme(): void;
35
+ lightMode(): void;
36
+ /** @docs-private */
37
+ darkMode(): void;
38
+ /** @docs-private */
39
+ systemMode(): void;
20
40
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<DaffSfThemeToggleComponent, never>;
21
41
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<DaffSfThemeToggleComponent, "daff-sf-theme-toggle", never, {}, {}, never, never, true, never>;
22
42
  }