@ckui/core 0.1.0-next.0 → 0.1.0-next.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.
@@ -1 +1 @@
1
- {"version":3,"file":"ckui-core-internal.mjs","names":[],"sources":["../../../../projects/core/internal/id.ts","../../../../projects/core/internal/media.ts","../../../../projects/core/internal/announcer.ts","../../../../projects/core/internal/focus-trap.ts","../../../../projects/core/internal/icon.ts"],"sourcesContent":["let counter = 0;\n\n/** Returns an id that is unique within the running page, e.g. `ck-field-3`. */\nexport function createCkId(prefix: string): string {\n if (typeof prefix !== 'string' || prefix.trim() === '') {\n throw new TypeError('createCkId needs a non-empty prefix string.');\n }\n counter += 1;\n return `${prefix}-${counter}`;\n}\n","import { BreakpointObserver } from '@angular/cdk/layout';\nimport { Injectable, Signal, computed, inject } from '@angular/core';\nimport { toSignal } from '@angular/core/rxjs-interop';\nimport { CK_CONFIG } from '@ckui/core';\n\n/** Viewport and user-preference signals. All `false` on the server, where nothing can match. */\n@Injectable({ providedIn: 'root' })\nexport class CkMedia {\n private readonly breakpointObserver = inject(BreakpointObserver);\n private readonly config = inject(CK_CONFIG);\n\n /** `(pointer: coarse)` */\n readonly coarsePointer: Signal<boolean> = this.watch('(pointer: coarse)');\n /** Viewport narrower than `CK_CONFIG.sheetBreakpoint`. */\n readonly narrow: Signal<boolean> = this.watch(\n `(max-width: ${this.config.sheetBreakpoint - 0.02}px)`,\n );\n /** `(prefers-reduced-motion: reduce)` */\n readonly reducedMotion: Signal<boolean> = this.watch('(prefers-reduced-motion: reduce)');\n /** Coarse pointer and a narrow viewport: overlays render as sheets. */\n readonly sheet: Signal<boolean> = computed(() => this.coarsePointer() && this.narrow());\n\n private watch(query: string): Signal<boolean> {\n const state = toSignal(this.breakpointObserver.observe(query), {\n initialValue: { matches: this.breakpointObserver.isMatched(query), breakpoints: {} },\n });\n return computed(() => state().matches);\n }\n}\n","import { LiveAnnouncer } from '@angular/cdk/a11y';\nimport { Injectable, inject } from '@angular/core';\n\n/** Screen-reader announcements through one shared live region. */\n@Injectable({ providedIn: 'root' })\nexport class CkAnnouncer {\n private readonly liveAnnouncer = inject(LiveAnnouncer);\n\n /** Resolves once the message is in the live region. A blank message does nothing. */\n announce(message: string, politeness: 'polite' | 'assertive' = 'polite'): Promise<void> {\n if (typeof message !== 'string' || message.trim() === '') {\n return Promise.resolve();\n }\n return this.liveAnnouncer.announce(message, politeness);\n }\n\n clear(): void {\n this.liveAnnouncer.clear();\n }\n}\n","import { FocusTrap, FocusTrapFactory } from '@angular/cdk/a11y';\nimport { DOCUMENT } from '@angular/common';\nimport { Injectable, Injector, afterNextRender, inject } from '@angular/core';\n\nexport interface CkFocusTrap {\n /** Remembers the focused element, then focuses the first tabbable one inside. Resolves `false` if nothing could be focused. */\n activate(): Promise<boolean>;\n /** Destroys the trap and gives focus back if the remembered element is still connected. Safe to call repeatedly. */\n release(): void;\n}\n\n@Injectable({ providedIn: 'root' })\nexport class CkFocusTrapFactory {\n private readonly focusTrapFactory = inject(FocusTrapFactory);\n private readonly document = inject(DOCUMENT);\n private readonly injector = inject(Injector);\n\n create(element: HTMLElement): CkFocusTrap {\n const trap: FocusTrap = this.focusTrapFactory.create(element);\n const { document, injector } = this;\n let previous: HTMLElement | null = null;\n let released = false;\n\n return {\n activate: () => {\n if (released) {\n return Promise.resolve(false);\n }\n previous ??= document.activeElement instanceof HTMLElement ? document.activeElement : null;\n // The CDK's own deferred variant would still focus after a release in between.\n return new Promise<boolean>((resolve) => {\n afterNextRender(() => resolve(released ? false : trap.focusInitialElement()), {\n injector,\n });\n });\n },\n release: () => {\n if (released) {\n return;\n }\n released = true;\n trap.destroy();\n const target = previous;\n previous = null;\n if (target?.isConnected) {\n target.focus();\n }\n },\n };\n }\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n ViewEncapsulation,\n computed,\n input,\n} from '@angular/core';\n\nexport type CkIconName = 'check' | 'chevron-down' | 'chevron-end' | 'close' | 'minus';\n\nconst ICON_PATHS: Readonly<Record<CkIconName, string>> = {\n check: 'M3 8.5l3.5 3.5L13 4.5',\n 'chevron-down': 'M4 6l4 4 4-4',\n 'chevron-end': 'M6 4l4 4-4 4',\n close: 'M4 4l8 8M12 4l-8 8',\n minus: 'M3.5 8h9',\n};\n\n/** Decorative icon at the surrounding font size and colour. The control carries its own accessible name. */\n@Component({\n selector: 'ck-icon',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'ck-icon',\n 'aria-hidden': 'true',\n '[class.ck-icon--mirror]': 'name() === \"chevron-end\"',\n },\n template: `\n <svg\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n focusable=\"false\"\n >\n <path [attr.d]=\"path()\" />\n </svg>\n `,\n styles: `\n @layer ckui {\n .ck-icon {\n display: inline-block;\n flex: none;\n inline-size: var(--ck-icon-size, 1em);\n block-size: var(--ck-icon-size, 1em);\n color: currentColor;\n vertical-align: -0.125em;\n }\n\n .ck-icon > svg {\n display: block;\n inline-size: 100%;\n block-size: 100%;\n }\n\n .ck-icon--mirror:dir(rtl) {\n transform: scaleX(-1);\n }\n }\n `,\n})\nexport class CkIcon {\n readonly name = input.required<CkIconName>();\n protected readonly path = computed(() => ICON_PATHS[this.name()] ?? '');\n}\n"],"mappings":";;;;;;;AAAA,IAAI,UAAU;AAGd,SAAgB,WAAW,QAAc;CACvC,IAAI,OAAO,WAAW,YAAY,OAAO,KAAI,MAAO,IAClD,MAAM,IAAI,UAAU,6CAA6C;CAEnE,WAAW;CACX,OAAO,GAAG,OAAM,GAAI;AACtB;ACFA,IAAa,UAAb,MAAa,QAAO;CACD,qBAAqB,OAAO,kBAAkB;CAC9C,SAAS,OAAO,SAAS;CAGjC,gBAAiC,KAAK,MAAM,mBAAmB;CAE/D,SAA0B,KAAK,MACtC,eAAe,KAAK,OAAO,kBAAk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ChB,eAAe;CACf,OAAO;CACP,OAAO;AACR;AAgDD,IAAa,SAAb,MAAa,OAAM;CACR,OAAO,MAAM,SAAsB,GAAA,YAAA,CAAA,EAAA,WAAA,OAAA,CAAA,+BAAA,CAAA,CAAA;CACzB,OAAO,eAAe,WAAW,KAAK,KAAI,MAAO,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,OAAA,CAAA,+BAAA,CAAA,CAAA;CAF5D,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAM,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAN,OAAA,OAAA,GAAA,qBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,MAAA;EAAM,cAAA;EAAA,UAAA;EAAA,QAAA,EAAA,MAAA;GAAA,mBAAA;GAAA,YAAA;GAAA,UAAA;GAAA,YAAA;GAAA,mBAAA;EAAA,EAAA;EAAA,MAAA;GAAA,YAAA,EAAA,eAAA,OAAA;GAAA,YAAA,EAAA,yBAAA,6BAAA;GAAA,gBAAA;EAAA;EAAA,UAAA;EAAA,UApCP;;;;;;;;;;;;;EAYT,UAAA;EAAA,QAAA,CAAA,uRAAA;EAAA,iBAAA,GAAA,wBAAA;EAAA,eAAA,GAAA,kBAAA;CAAA,CAAA;;AAwBU,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAM,YAAA,CAAA;EA7ClB,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAS,iBACF,wBAAwB;GAAM,eAChC,kBAAkB;GAAI,MAC/B;IACJ,OAAO;IACP,eAAe;IACf,2BAA2B;GAC5B;GAAA,UACS;;;;;;;;;;;;;GAYT,QAAA,CAAA,uRAAA;EAAA,CAAA"}
1
+ {"version":3,"file":"ckui-core-internal.mjs","names":[],"sources":["../../../../projects/core/internal/id.ts","../../../../projects/core/internal/media.ts","../../../../projects/core/internal/announcer.ts","../../../../projects/core/internal/focus-trap.ts","../../../../projects/core/internal/icon.ts","../../../../projects/core/internal/inert.ts","../../../../projects/core/internal/value-control.ts","../../../../projects/core/internal/overlay-pane.ts","../../../../projects/core/internal/sheet-swipe.ts","../../../../projects/core/internal/overlay-host.ts","../../../../projects/core/internal/accessible-name.ts"],"sourcesContent":["let counter = 0;\n\n/** Returns an id that is unique within the running page, e.g. `ck-field-3`. */\nexport function createCkId(prefix: string): string {\n if (typeof prefix !== 'string' || prefix.trim() === '') {\n throw new TypeError('createCkId needs a non-empty prefix string.');\n }\n counter += 1;\n return `${prefix}-${counter}`;\n}\n","import { BreakpointObserver } from '@angular/cdk/layout';\nimport { Injectable, Signal, computed, inject } from '@angular/core';\nimport { toSignal } from '@angular/core/rxjs-interop';\nimport { CK_CONFIG } from '@ckui/core';\n\n/** Viewport and user-preference signals. All `false` on the server, where nothing can match. */\n@Injectable({ providedIn: 'root' })\nexport class CkMedia {\n private readonly breakpointObserver = inject(BreakpointObserver);\n private readonly config = inject(CK_CONFIG);\n\n /** `(pointer: coarse)` */\n readonly coarsePointer: Signal<boolean> = this.watch('(pointer: coarse)');\n /** Viewport narrower than `CK_CONFIG.sheetBreakpoint`. */\n readonly narrow: Signal<boolean> = this.watch(\n `(max-width: ${this.config.sheetBreakpoint - 0.02}px)`,\n );\n /** `(prefers-reduced-motion: reduce)` */\n readonly reducedMotion: Signal<boolean> = this.watch('(prefers-reduced-motion: reduce)');\n /** Coarse pointer and a narrow viewport: overlays render as sheets. */\n readonly sheet: Signal<boolean> = computed(() => this.coarsePointer() && this.narrow());\n\n private watch(query: string): Signal<boolean> {\n const state = toSignal(this.breakpointObserver.observe(query), {\n initialValue: { matches: this.breakpointObserver.isMatched(query), breakpoints: {} },\n });\n return computed(() => state().matches);\n }\n}\n","import { LiveAnnouncer } from '@angular/cdk/a11y';\nimport { _CdkPrivateStyleLoader, _VisuallyHiddenLoader } from '@angular/cdk/private';\nimport { DOCUMENT, isPlatformBrowser } from '@angular/common';\nimport { Injectable, PLATFORM_ID, inject } from '@angular/core';\n\ntype Politeness = 'polite' | 'assertive';\n\ninterface Pending {\n readonly message: string;\n readonly politeness: Politeness;\n}\n\n/** Joins messages in order, with \". \" unless the earlier one already ends in punctuation. */\nfunction join(messages: readonly string[]): string {\n return messages.reduce((text, message) => {\n const trimmed = message.trim();\n if (text === '') {\n return trimmed;\n }\n return /[.!?:;,]$/.test(text) ? `${text} ${trimmed}` : `${text}. ${trimmed}`;\n }, '');\n}\n\n/** A message handed to the live region this recently (ms) may not have been read out yet. */\nconst READ_OUT_WINDOW = 150;\n\n/**\n * Screen-reader announcements through one shared live region. The CDK live region keeps only the\n * last message, so announcements made in the same tick are collected and spoken as one message, in\n * order (joined with \". \"); it is assertive if any of them is. A batch that follows within 150 ms\n * of the previous hand-over (the previous one may not be read out yet, and the CDK would replace\n * it) is spoken together with the previous text, again in order and assertive if either is; after\n * a longer pause only the new text is written. The region is hidden visually by the CDK styles,\n * which this service loads itself.\n */\n@Injectable({ providedIn: 'root' })\nexport class CkAnnouncer {\n private readonly liveAnnouncer = inject(LiveAnnouncer);\n private pending: Pending[] = [];\n private waiters: (() => void)[] = [];\n private scheduled = false;\n private readonly view = inject(DOCUMENT).defaultView;\n private last: (Pending & { at: number }) | null = null;\n\n constructor() {\n if (isPlatformBrowser(inject(PLATFORM_ID))) {\n inject(_CdkPrivateStyleLoader).load(_VisuallyHiddenLoader);\n }\n }\n\n /**\n * Resolves once the message is in the live region. A blank message does nothing. Messages from\n * the same tick share one live-region update and one promise result.\n */\n announce(message: string, politeness: Politeness = 'polite'): Promise<void> {\n if (typeof message !== 'string' || message.trim() === '') {\n return Promise.resolve();\n }\n this.pending.push({ message, politeness });\n const done = new Promise<void>((resolve) => this.waiters.push(resolve));\n if (!this.scheduled) {\n this.scheduled = true;\n queueMicrotask(() => this.flush());\n }\n return done;\n }\n\n /** Empties the live region and drops announcements that have not been written yet. */\n clear(): void {\n this.pending = [];\n this.last = null;\n this.release();\n this.liveAnnouncer.clear();\n }\n\n private flush(): void {\n this.scheduled = false;\n const items = this.pending;\n if (items.length === 0) {\n return;\n }\n this.pending = [];\n const waiters = this.waiters;\n this.waiters = [];\n const now = this.view?.performance.now() ?? Date.now();\n const previous = this.last && now - this.last.at < READ_OUT_WINDOW ? this.last : null;\n const fresh = join(items.map((item) => item.message));\n // The same words again are repeated on their own, not stacked onto themselves.\n const all = previous && previous.message !== fresh ? [previous, ...items] : items;\n const politeness = all.some((item) => item.politeness === 'assertive') ? 'assertive' : 'polite';\n const message = all === items ? fresh : join(all.map((item) => item.message));\n this.last = { message, politeness, at: now };\n void this.liveAnnouncer\n .announce(message, politeness)\n .then(() => waiters.forEach((resolve) => resolve()));\n }\n\n private release(): void {\n const waiters = this.waiters;\n this.waiters = [];\n waiters.forEach((resolve) => resolve());\n }\n}\n","import { FocusTrap, FocusTrapFactory } from '@angular/cdk/a11y';\nimport { DOCUMENT } from '@angular/common';\nimport { Injectable, Injector, afterNextRender, inject } from '@angular/core';\n\nexport interface CkFocusTrap {\n /**\n * Remembers the focused element, then focuses `initialFocus()` if it returns an element that takes\n * focus, else the first tabbable one inside. Resolves `false` if nothing could be focused.\n */\n activate(initialFocus?: () => HTMLElement | null): Promise<boolean>;\n /** Destroys the trap and gives focus back if the remembered element is still connected. Safe to call repeatedly. */\n release(): void;\n}\n\n@Injectable({ providedIn: 'root' })\nexport class CkFocusTrapFactory {\n private readonly focusTrapFactory = inject(FocusTrapFactory);\n private readonly document = inject(DOCUMENT);\n private readonly injector = inject(Injector);\n\n create(element: HTMLElement): CkFocusTrap {\n const trap: FocusTrap = this.focusTrapFactory.create(element);\n const { document, injector } = this;\n let previous: HTMLElement | null = null;\n let released = false;\n\n return {\n activate: (initialFocus) => {\n if (released) {\n return Promise.resolve(false);\n }\n previous ??= document.activeElement instanceof HTMLElement ? document.activeElement : null;\n // The CDK's own deferred variant would still focus after a release in between.\n return new Promise<boolean>((resolve) => {\n afterNextRender(\n () => {\n if (released) {\n return resolve(false);\n }\n const target = initialFocus?.() ?? null;\n if (target) {\n target.focus();\n if (document.activeElement === target) {\n return resolve(true);\n }\n }\n resolve(trap.focusInitialElement());\n },\n { injector },\n );\n });\n },\n release: () => {\n if (released) {\n return;\n }\n released = true;\n trap.destroy();\n const target = previous;\n previous = null;\n if (target?.isConnected) {\n target.focus();\n }\n },\n };\n }\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n ViewEncapsulation,\n computed,\n input,\n} from '@angular/core';\n\nexport type CkIconName =\n | 'alert-octagon'\n | 'alert-triangle'\n | 'check'\n | 'chevron-down'\n | 'chevron-end'\n | 'close'\n | 'info'\n | 'minus'\n | 'plus';\n\nconst ICON_PATHS: Readonly<Record<CkIconName, string>> = {\n 'alert-octagon': 'M5.2 2h5.6L14 5.2v5.6L10.8 14H5.2L2 10.8V5.2L5.2 2zM8 5.5v3M8 11v.01',\n 'alert-triangle': 'M8 2.5l6 10.5H2L8 2.5zM8 6.5v3M8 11.5v.01',\n check: 'M3 8.5l3.5 3.5L13 4.5',\n 'chevron-down': 'M4 6l4 4 4-4',\n 'chevron-end': 'M6 4l4 4-4 4',\n close: 'M4 4l8 8M12 4l-8 8',\n info: 'M8 14A6 6 0 108 2a6 6 0 000 12zM8 7.5v3.5M8 5v.01',\n minus: 'M3.5 8h9',\n plus: 'M8 3.5v9M3.5 8h9',\n};\n\n/** Decorative icon at the surrounding font size and colour. The control carries its own accessible name. */\n@Component({\n selector: 'ck-icon',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'ck-icon',\n 'aria-hidden': 'true',\n '[class.ck-icon--mirror]': 'name() === \"chevron-end\"',\n },\n template: `\n <svg\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n focusable=\"false\"\n >\n <path [attr.d]=\"path()\" />\n </svg>\n `,\n styles: `\n @layer ckui {\n .ck-icon {\n display: inline-block;\n flex: none;\n inline-size: var(--ck-icon-size, 1em);\n block-size: var(--ck-icon-size, 1em);\n color: currentColor;\n vertical-align: -0.125em;\n }\n\n .ck-icon > svg {\n display: block;\n inline-size: 100%;\n block-size: 100%;\n }\n\n .ck-icon--mirror:dir(rtl) {\n transform: scaleX(-1);\n }\n }\n `,\n})\nexport class CkIcon {\n readonly name = input.required<CkIconName>();\n protected readonly path = computed(() => ICON_PATHS[this.name()] ?? '');\n}\n","import { DOCUMENT } from '@angular/common';\nimport { Injectable, inject } from '@angular/core';\n\n/** Never made inert: they render nothing, or must keep announcing while an overlay is open. */\nconst SKIPPED =\n 'script, style, link, template, noscript, [data-ck-inert-exempt], .cdk-live-announcer-element';\n\ninterface Hold {\n count: number;\n /** The `inert` attribute value the element had before the first hold; `null` if it had none. */\n original: string | null;\n}\n\n/** Reference-counted `inert`: an element stays inert until every hold on it is released. */\n@Injectable({ providedIn: 'root' })\nexport class CkInert {\n private readonly document = inject(DOCUMENT);\n private readonly holds = new Map<Element, Hold>();\n\n /**\n * Makes the elements inert and returns the release function (safe to call more than once).\n * An element that was already inert keeps its own attribute value when the last hold ends.\n */\n hold(elements: Iterable<Element>): () => void {\n const held = new Set(elements);\n for (const element of held) {\n const entry = this.holds.get(element);\n if (entry) {\n entry.count++;\n continue;\n }\n const original = element.getAttribute('inert');\n this.holds.set(element, { count: 1, original });\n if (original === null) {\n element.setAttribute('inert', '');\n }\n }\n let released = false;\n return () => {\n if (released) {\n return;\n }\n released = true;\n for (const element of held) {\n const entry = this.holds.get(element);\n if (!entry || --entry.count > 0) {\n continue;\n }\n this.holds.delete(element);\n if (entry.original === null) {\n element.removeAttribute('inert');\n }\n }\n };\n }\n\n /** Body children that an overlay hides from the user: all but `keep`, exempt elements and non-rendered tags. */\n backgroundElements(keep: Element): Element[] {\n return Array.from(this.document.body.children).filter(\n (element) => element !== keep && !element.matches(SKIPPED),\n );\n }\n}\n","import {\n Directive,\n ModelSignal,\n Provider,\n Type,\n booleanAttribute,\n computed,\n forwardRef,\n input,\n model,\n signal,\n} from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport type { FormValueControl } from '@angular/forms/signals';\n\nconst noop = (): void => undefined;\n\n/**\n * Base for components that edit one value.\n *\n * Reactive Forms, `ngModel` and Signal Forms all talk to the component through the\n * `ControlValueAccessor` registered by `provideCkValueAccessor`: Angular's `[formField]` prefers a\n * value accessor on the same node over the `value` model contract, so only that one path is ever\n * active. The `value` model and `disabled` input are for standalone use (`[(value)]`) and for the\n * template.\n *\n * `value` is `undefined` until something sets it; a subclass with a `null` default reads\n * `value() ?? null`.\n */\n@Directive()\nexport abstract class CkValueControl<T> implements ControlValueAccessor, FormValueControl<T> {\n readonly value: ModelSignal<T> = model(undefined as T);\n readonly disabled = input(false, { transform: booleanAttribute });\n /**\n * Only ever becomes `true` here: `markAsUntouched()` and `reset()` do not travel through a value\n * accessor. Do not style from it; read the form's own state (`ng-touched`, the field's `touched()`).\n */\n readonly touched = model(false);\n\n private readonly controlDisabled = signal(false);\n private onChange: (value: T) => void = noop;\n private onTouched: () => void = noop;\n\n /** The `disabled` input or the forms API (`control.disable()`, a disabled field) says so. */\n protected readonly isDisabled = computed(() => this.disabled() || this.controlDisabled());\n\n writeValue(value: T): void {\n this.value.set(value);\n }\n\n registerOnChange(onChange: (value: T) => void): void {\n this.onChange = onChange;\n }\n\n registerOnTouched(onTouched: () => void): void {\n this.onTouched = onTouched;\n }\n\n setDisabledState(isDisabled: boolean): void {\n this.controlDisabled.set(isDisabled);\n }\n\n /** A change made by the user. Ignored while disabled or when the value is the current one. */\n protected commit(value: T): void {\n if (this.isDisabled() || Object.is(value, this.value())) {\n return;\n }\n this.value.set(value);\n this.onChange(value);\n }\n\n /** Call when focus leaves the whole control, not a part of it. */\n protected markTouched(): void {\n this.touched.set(true);\n this.onTouched();\n }\n}\n\n/** Registers the component as a value accessor: `providers: [provideCkValueAccessor(CkSegmented)]`. */\nexport function provideCkValueAccessor(type: Type<unknown>): Provider {\n return { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => type), multi: true };\n}\n","import { CdkPortalOutlet, Portal } from '@angular/cdk/portal';\nimport {\n ChangeDetectionStrategy,\n Component,\n ViewContainerRef,\n ViewEncapsulation,\n inject,\n input,\n viewChild,\n} from '@angular/core';\n\n/** What the overlay host puts inside every CDK pane: the grab area of a sheet and the caller's content. */\n@Component({\n selector: 'ck-overlay-pane',\n imports: [CdkPortalOutlet],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n host: { class: 'ck-overlay-pane' },\n template: `\n @if (grab()) {\n <div class=\"ck-overlay-grab\" data-ck-sheet-grab aria-hidden=\"true\">\n <span class=\"ck-overlay-grab-bar\"></span>\n </div>\n }\n <ng-template cdkPortalOutlet />\n `,\n styles: `\n @layer ckui {\n .ck-overlay-backdrop {\n position: absolute;\n inset: 0;\n z-index: -1;\n background: var(--ck-color-backdrop);\n pointer-events: auto;\n touch-action: manipulation;\n }\n\n @media (forced-colors: active) {\n .ck-overlay-backdrop {\n forced-color-adjust: none;\n }\n }\n\n .ck-overlay-pane {\n position: relative;\n display: flex;\n flex: 1 1 auto;\n flex-direction: column;\n min-inline-size: 0;\n min-block-size: 0;\n max-block-size: 100%;\n }\n\n .ck-overlay-pane > :not(.ck-overlay-grab) {\n flex: 1 1 auto;\n min-block-size: 0;\n }\n\n .ck-overlay-grab {\n display: flex;\n flex: none;\n justify-content: center;\n block-size: var(--ck-target-min);\n border-start-start-radius: var(--ck-radius-xl);\n border-start-end-radius: var(--ck-radius-xl);\n background: var(--ck-sheet-grab-bg, var(--ck-color-surface-raised));\n touch-action: none;\n }\n\n .ck-overlay-grab-bar {\n margin-block-start: var(--ck-space-2);\n inline-size: var(--ck-space-10);\n block-size: var(--ck-space-1);\n border-radius: var(--ck-radius-full);\n background: var(--ck-color-border);\n }\n\n @media (forced-colors: active) {\n .ck-overlay {\n border: 1px solid CanvasText;\n }\n\n .ck-overlay-grab-bar {\n background: CanvasText;\n }\n }\n }\n `,\n})\nexport class CkOverlayPane {\n readonly grab = input(false);\n\n private readonly outlet = viewChild.required(CdkPortalOutlet);\n readonly viewContainerRef = inject(ViewContainerRef);\n\n attach(portal: Portal<unknown>): void {\n this.outlet().attach(portal);\n }\n}\n","/** A sheet is dismissed by a drag past this share of its height... */\nexport const SWIPE_DISTANCE_RATIO = 1 / 3;\n/** ...or by a flick at least this fast (px per ms) that has moved a little. */\nexport const SWIPE_FLICK_VELOCITY = 0.5;\nexport const SWIPE_FLICK_MIN_DISTANCE = 16;\n/** The speed is measured over this many ms before release. */\nconst VELOCITY_WINDOW = 100;\n\nexport function shouldDismissSwipe(distance: number, height: number, velocity: number): boolean {\n if (distance <= 0 || height <= 0) {\n return false;\n }\n return (\n distance > height * SWIPE_DISTANCE_RATIO ||\n (velocity >= SWIPE_FLICK_VELOCITY && distance >= SWIPE_FLICK_MIN_DISTANCE)\n );\n}\n\nexport interface SheetSwipeOptions {\n /** Contains the grab area (`[data-ck-sheet-grab]`); the swipe starts there. */\n readonly pane: HTMLElement;\n /** The element that follows the finger. */\n readonly panel: HTMLElement;\n readonly backdrop: HTMLElement;\n readonly duration: () => number;\n readonly easing: () => string;\n /** Called on release. `dismiss` says the swipe passed the threshold; return whether the overlay closed. */\n readonly onRelease: (dismiss: boolean) => boolean;\n}\n\ninterface Sample {\n readonly offset: number;\n readonly time: number;\n}\n\n/** Makes the grab area of a bottom sheet draggable. Returns the function that removes it. */\nexport function attachSheetSwipe(options: SheetSwipeOptions): () => void {\n const { pane, panel, backdrop } = options;\n const doc = pane.ownerDocument;\n const now = (): number => (doc.defaultView as Window).performance.now();\n let pointerId: number | null = null;\n let startY = 0;\n let height = 0;\n let offset = 0;\n let samples: Sample[] = [];\n\n function setOffset(next: number): void {\n offset = Math.max(0, next);\n panel.style.transform = `translateY(${offset}px)`;\n backdrop.style.opacity = String(Math.max(0, 1 - offset / Math.max(height, 1)));\n samples.push({ offset, time: now() });\n }\n\n function velocity(): number {\n const current = now();\n const recent = samples.filter((sample) => current - sample.time <= VELOCITY_WINDOW);\n const first = recent[0];\n const last = recent[recent.length - 1];\n if (!first || !last) {\n return 0;\n }\n return (last.offset - first.offset) / Math.max(1, current - first.time);\n }\n\n function stopTracking(): void {\n pointerId = null;\n doc.removeEventListener('pointermove', onMove);\n doc.removeEventListener('pointerup', onUp);\n doc.removeEventListener('pointercancel', onCancel);\n }\n\n function snapBack(): void {\n const from = offset;\n panel.style.transform = '';\n backdrop.style.opacity = '';\n offset = 0;\n const duration = options.duration();\n if (from > 0 && duration > 0 && typeof panel.animate === 'function') {\n const timing = { duration, easing: options.easing() };\n panel.animate([{ transform: `translateY(${from}px)` }, { transform: 'none' }], timing);\n backdrop.animate(\n [{ opacity: String(Math.max(0, 1 - from / Math.max(height, 1))) }, { opacity: '1' }],\n timing,\n );\n }\n }\n\n function onDown(event: PointerEvent): void {\n const target = event.target;\n if (\n pointerId !== null ||\n !event.isPrimary ||\n event.button !== 0 ||\n !(target instanceof Element) ||\n !target.closest('[data-ck-sheet-grab]')\n ) {\n return;\n }\n pointerId = event.pointerId;\n startY = event.clientY;\n height = panel.getBoundingClientRect().height;\n offset = 0;\n samples = [{ offset: 0, time: now() }];\n try {\n (target as HTMLElement).setPointerCapture?.(event.pointerId);\n } catch {\n // A pointer that is already gone cannot be captured; the document listeners still work.\n }\n doc.addEventListener('pointermove', onMove);\n doc.addEventListener('pointerup', onUp);\n doc.addEventListener('pointercancel', onCancel);\n }\n\n function onMove(event: PointerEvent): void {\n if (event.pointerId === pointerId) {\n setOffset(event.clientY - startY);\n }\n }\n\n function onUp(event: PointerEvent): void {\n if (event.pointerId !== pointerId) {\n return;\n }\n setOffset(event.clientY - startY);\n const dismiss = shouldDismissSwipe(offset, height, velocity());\n stopTracking();\n if (!options.onRelease(dismiss)) {\n snapBack();\n }\n }\n\n function onCancel(event: PointerEvent): void {\n if (event.pointerId === pointerId) {\n stopTracking();\n snapBack();\n }\n }\n\n pane.addEventListener('pointerdown', onDown);\n return () => {\n pane.removeEventListener('pointerdown', onDown);\n stopTracking();\n };\n}\n","import { Overlay, OverlayContainer, OverlayRef, ScrollStrategy } from '@angular/cdk/overlay';\nimport { ComponentPortal, ComponentType, Portal, TemplatePortal } from '@angular/cdk/portal';\nimport { DOCUMENT, isPlatformBrowser } from '@angular/common';\nimport { DestroyRef, Injectable, Injector, PLATFORM_ID, TemplateRef, inject } from '@angular/core';\nimport { CkFocusTrap, CkFocusTrapFactory } from './focus-trap';\nimport { CkInert } from './inert';\nimport { CkMedia } from './media';\nimport { CkOverlayPane } from './overlay-pane';\nimport { attachSheetSwipe } from './sheet-swipe';\n\nexport type CkOverlayMode = 'auto' | 'modal' | 'sheet';\nexport type CkOverlayDismissReason = 'escape' | 'backdrop' | 'swipe';\n\nexport interface CkOverlayConfig {\n /** `auto` becomes a sheet when `CkMedia.sheet()` is true at the moment of opening. Default `auto`. */\n mode?: CkOverlayMode;\n /** Escape, a click on the backdrop and a swipe down may close the overlay. Default `true`. */\n dismissible?: boolean;\n /** A sheet as tall as the viewport allows instead of as tall as its content. */\n fullHeight?: boolean;\n panelClass?: string | string[];\n /** Default `dialog`. */\n role?: 'dialog' | 'alertdialog';\n ariaLabel?: string;\n ariaLabelledBy?: string;\n ariaDescribedBy?: string;\n /**\n * Called when the user asks to dismiss (Escape, backdrop, swipe) a dismissible overlay. It is\n * expected to call `handle.close()` straight away; without it the host closes the overlay itself.\n * A sheet that is still open after a swipe snaps back.\n */\n onDismissRequest?: (reason: CkOverlayDismissReason) => void;\n /**\n * Picks the element that takes focus once the overlay has rendered. Without it, or when it\n * returns `null` or something that cannot take focus, the first tabbable element does.\n */\n initialFocus?: () => HTMLElement | null;\n}\n\nexport interface CkOverlayHandle {\n /** The mode resolved when the overlay opened. */\n readonly mode: 'modal' | 'sheet';\n /** The element that carries `role`, `aria-modal` and the labels; set `aria-labelledby` here when the title appears later. */\n readonly panel: HTMLElement;\n /** Resolves once the opening animation and the initial focus are done. */\n readonly opened: Promise<void>;\n /** Resolves once the overlay is detached. */\n readonly closed: Promise<void>;\n /** Animates out, then detaches. Repeated calls return the same promise. */\n close(): Promise<void>;\n}\n\nconst DEFAULT_DURATION = 200;\nconst SHEET_MAX_HEIGHT = 'calc(100dvh - env(safe-area-inset-top, 0px))';\nconst MODAL_MARGIN = 'var(--ck-space-4, 1rem)';\n\ntype State = 'open' | 'closing' | 'closed';\n\ninterface Entry {\n readonly overlayRef: OverlayRef;\n readonly dismissible: boolean;\n readonly dismiss: (reason: CkOverlayDismissReason) => void;\n /** Elements that had focus before this overlay (and ones it inherited) that focus can return to. */\n readonly openers: HTMLElement[];\n /** Runs the whole teardown at once, without animation. Safe to call repeatedly. */\n readonly destroy: () => void;\n state: State;\n}\n\nfunction parseDuration(value: string): number {\n const match = /^\\s*(-?[\\d.]+)(ms|s)\\s*$/.exec(value);\n if (!match) {\n return DEFAULT_DURATION;\n }\n const amount = Number(match[1]) * (match[2] === 's' ? 1000 : 1);\n return Number.isFinite(amount) && amount >= 0 ? amount : DEFAULT_DURATION;\n}\n\n/**\n * Opens modal dialogs and bottom sheets on the CDK overlay: backdrop, scroll lock, focus trap and\n * restore, `inert` background, Escape / backdrop / swipe dismissal and the open and close animation.\n */\n@Injectable({ providedIn: 'root' })\nexport class CkOverlayHost {\n private readonly overlay = inject(Overlay);\n private readonly overlayContainer = inject(OverlayContainer);\n private readonly media = inject(CkMedia);\n private readonly inert = inject(CkInert);\n private readonly focusTraps = inject(CkFocusTrapFactory);\n private readonly injector = inject(Injector);\n private readonly document = inject(DOCUMENT);\n private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n\n /** Open overlays, topmost last. A closing overlay has already left it. */\n private readonly stack: Entry[] = [];\n private readonly entries = new Set<Entry>();\n private scrollStrategy: ScrollStrategy | null = null;\n private scrollLocks = 0;\n private listening = false;\n\n constructor() {\n inject(DestroyRef).onDestroy(() => {\n for (const entry of [...this.entries]) {\n entry.destroy();\n }\n this.entries.clear();\n this.stack.length = 0;\n this.listen(false);\n if (this.scrollLocks > 0) {\n this.scrollLocks = 0;\n this.scrollStrategy?.disable();\n }\n });\n }\n\n open<C>(\n content: ComponentType<C> | TemplateRef<unknown>,\n config: CkOverlayConfig = {},\n injector?: Injector,\n ): CkOverlayHandle {\n const requested = config.mode ?? 'auto';\n const mode = requested === 'auto' ? (this.media.sheet() ? 'sheet' : 'modal') : requested;\n if (!this.isBrowser) {\n return this.inertHandle(mode);\n }\n\n const sheet = mode === 'sheet';\n const dismissible = config.dismissible ?? true;\n const container = this.overlayContainer.getContainerElement();\n container.style.zIndex = 'var(--ck-z-overlay, 1000)';\n\n const overlayRef = this.overlay.create({\n positionStrategy: sheet\n ? this.overlay.position().global().bottom('0').centerHorizontally()\n : this.overlay.position().global().centerHorizontally().centerVertically(),\n scrollStrategy: this.overlay.scrollStrategies.noop(),\n width: sheet ? '100%' : undefined,\n height: sheet && config.fullHeight ? SHEET_MAX_HEIGHT : undefined,\n maxWidth: sheet ? undefined : `calc(100% - 2 * ${MODAL_MARGIN})`,\n maxHeight: sheet ? SHEET_MAX_HEIGHT : `calc(100dvh - 2 * ${MODAL_MARGIN})`,\n panelClass: [\n 'ck-overlay',\n sheet ? 'ck-overlay--sheet' : 'ck-overlay--modal',\n ...(config.panelClass === undefined ? [] : [config.panelClass].flat()),\n ],\n disposeOnNavigation: false,\n // The top layer would put every overlay above the toast host; the z-index tokens order them instead.\n usePopover: false,\n });\n const panel = overlayRef.overlayElement;\n const host = overlayRef.hostElement;\n\n let paneRef;\n try {\n paneRef = overlayRef.attach(new ComponentPortal(CkOverlayPane, null, this.injector));\n paneRef.setInput('grab', sheet && dismissible);\n paneRef.changeDetectorRef.detectChanges();\n paneRef.instance.attach(this.contentPortal(content, paneRef.instance, injector));\n } catch (error) {\n overlayRef.dispose();\n throw error;\n }\n\n panel.setAttribute('role', config.role ?? 'dialog');\n panel.setAttribute('aria-modal', 'true');\n panel.tabIndex = -1;\n for (const [attribute, value] of [\n ['aria-label', config.ariaLabel],\n ['aria-labelledby', config.ariaLabelledBy],\n ['aria-describedby', config.ariaDescribedBy],\n ] as const) {\n if (value) {\n panel.setAttribute(attribute, value);\n }\n }\n\n const backdrop = this.document.createElement('div');\n backdrop.className = 'ck-overlay-backdrop';\n host.prepend(backdrop);\n\n // The opener is recorded before the background turns inert; inert would blur it.\n const opener =\n this.document.activeElement instanceof HTMLElement ? this.document.activeElement : null;\n const trap: CkFocusTrap = this.focusTraps.create(panel);\n const activation = trap.activate(config.initialFocus);\n\n const releaseInert = this.inert.hold([\n ...this.inert.backgroundElements(container),\n ...this.stack.map((other) => other.overlayRef.hostElement),\n ]);\n this.lockScroll();\n\n let resolveClosed: () => void = () => undefined;\n const closed = new Promise<void>((resolve) => (resolveClosed = resolve));\n let closing: Promise<void> | null = null;\n let released = false;\n let finishedOnce = false;\n let openAnimations: Animation[] = [];\n const view = this.document.defaultView;\n\n const motion = () => {\n const style = view!.getComputedStyle(panel);\n return {\n duration: this.media.reducedMotion()\n ? 0\n : parseDuration(style.getPropertyValue('--ck-duration-normal')),\n easing: style.getPropertyValue('--ck-ease-standard').trim() || 'ease',\n };\n };\n\n const play = (\n element: HTMLElement,\n keyframes: Keyframe[],\n fill: FillMode,\n ): Animation | null => {\n const { duration, easing } = motion();\n if (duration <= 0 || typeof element.animate !== 'function') {\n return null;\n }\n return element.animate(keyframes, { duration, easing, fill });\n };\n\n const finished = (animation: Animation | null): Promise<unknown> =>\n animation ? animation.finished.catch(() => undefined) : Promise.resolve();\n\n const entry: Entry = {\n overlayRef,\n dismissible,\n state: 'open',\n openers: opener ? [opener] : [],\n dismiss: (reason) => {\n if (config.onDismissRequest) {\n config.onDismissRequest(reason);\n } else {\n void close();\n }\n },\n destroy: () => {\n release();\n finish();\n },\n };\n this.entries.add(entry);\n this.stack.push(entry);\n this.listen(true);\n\n const detachSwipe =\n sheet && dismissible\n ? attachSheetSwipe({\n pane: paneRef.location.nativeElement as HTMLElement,\n panel,\n backdrop,\n duration: () => motion().duration,\n easing: () => motion().easing,\n onRelease: (dismissed) => {\n if (dismissed) {\n entry.dismiss('swipe');\n }\n return entry.state !== 'open';\n },\n })\n : () => undefined;\n\n const onBackdropClick = (): void => {\n if (entry.state === 'open' && dismissible && this.stack.at(-1) === entry) {\n entry.dismiss('backdrop');\n }\n };\n backdrop.addEventListener('click', onBackdropClick);\n\n /** Everything that must stop the moment the overlay starts closing. */\n const release = (): void => {\n if (released) {\n return;\n }\n released = true;\n entry.state = 'closing';\n const index = this.stack.indexOf(entry);\n this.stack.splice(index, 1);\n // An overlay above this one gets its openers, so focus can still reach the page later.\n this.stack[index]?.openers.unshift(...entry.openers);\n detachSwipe();\n backdrop.removeEventListener('click', onBackdropClick);\n for (const animation of openAnimations) {\n animation.cancel();\n }\n // The background has to be live again before the opener can take focus back.\n releaseInert();\n host.inert = true;\n trap.release();\n this.restoreFocus(entry);\n };\n\n /** Everything that happens once the overlay is gone. */\n const finish = (): void => {\n if (finishedOnce) {\n return;\n }\n finishedOnce = true;\n entry.state = 'closed';\n this.entries.delete(entry);\n overlayRef.dispose();\n backdrop.remove();\n this.unlockScroll();\n if (this.entries.size === 0) {\n this.listen(false);\n }\n resolveClosed();\n };\n\n const enter: Keyframe[] = sheet\n ? [{ transform: 'translateY(100%)' }, { transform: 'none' }]\n : [\n { opacity: 0, transform: 'scale(0.96)' },\n { opacity: 1, transform: 'none' },\n ];\n openAnimations = [\n play(panel, enter, 'none'),\n play(backdrop, [{ opacity: 0 }, { opacity: 1 }], 'none'),\n ].filter((animation): animation is Animation => animation !== null);\n\n // Nothing focusable inside: the panel takes focus right away, not after the animation.\n void activation.then((focused) => {\n if (entry.state === 'open' && !focused) {\n panel.focus({ preventScroll: true });\n }\n });\n const opened = Promise.all([\n activation,\n ...openAnimations.map((animation) => finished(animation)),\n ]).then(() => undefined);\n\n const close = (): Promise<void> => {\n if (closing) {\n return closing;\n }\n release();\n const leave: Keyframe[] = sheet\n ? [{ transform: 'translateY(100%)' }]\n : [{ opacity: 0, transform: 'scale(0.96)' }];\n const animations = [\n play(panel, leave, 'forwards'),\n play(backdrop, [{ opacity: 0 }], 'forwards'),\n ];\n closing = Promise.all(animations.map(finished)).then(finish);\n return closing;\n };\n\n return { mode, panel, opened, closed, close };\n }\n\n /** Focus did not return to where it came from (opener disabled, inert or gone): find it a home. */\n private restoreFocus(closed: Entry): void {\n const top = this.stack.at(-1);\n const active = this.document.activeElement;\n if (top?.overlayRef.overlayElement.contains(active)) {\n return;\n }\n const openers = [...closed.openers].reverse().filter((candidate) => candidate.isConnected);\n if (active && openers.includes(active as HTMLElement)) {\n return;\n }\n for (const candidate of openers) {\n candidate.focus();\n if (this.document.activeElement === candidate) {\n return;\n }\n }\n top?.overlayRef.overlayElement.focus({ preventScroll: true });\n }\n\n private contentPortal<C>(\n content: ComponentType<C> | TemplateRef<unknown>,\n pane: CkOverlayPane,\n injector: Injector | undefined,\n ): Portal<unknown> {\n return content instanceof TemplateRef\n ? new TemplatePortal(content, pane.viewContainerRef, undefined, injector)\n : new ComponentPortal(content, null, injector ?? this.injector);\n }\n\n /** What the server gets: nothing is rendered, and the overlay counts as closed. */\n private inertHandle(mode: 'modal' | 'sheet'): CkOverlayHandle {\n return {\n mode,\n panel: this.document.createElement('div'),\n opened: Promise.resolve(),\n closed: Promise.resolve(),\n close: () => Promise.resolve(),\n };\n }\n\n private lockScroll(): void {\n this.scrollStrategy ??= this.overlay.scrollStrategies.block();\n if (this.scrollLocks++ === 0) {\n this.scrollStrategy.enable();\n }\n }\n\n private unlockScroll(): void {\n if (this.scrollLocks > 0 && --this.scrollLocks === 0) {\n this.scrollStrategy?.disable();\n }\n }\n\n private listen(active: boolean): void {\n if (active === this.listening) {\n return;\n }\n this.listening = active;\n if (active) {\n this.document.addEventListener('keydown', this.onKeydown);\n } else {\n this.document.removeEventListener('keydown', this.onKeydown);\n }\n }\n\n private readonly onKeydown = (event: KeyboardEvent): void => {\n if (event.key !== 'Escape' || event.defaultPrevented || event.isComposing) {\n return;\n }\n const top = this.stack.at(-1);\n if (top?.dismissible) {\n event.preventDefault();\n top.dismiss('escape');\n }\n };\n}\n","export interface CkNameSources {\n /** Count `title` as a name. */\n readonly title: boolean;\n /** Count the element's own visible text (not `aria-hidden` or `hidden` parts). */\n readonly text: boolean;\n /** Count the text of the `<label>` elements of a form control. */\n readonly labels?: boolean;\n}\n\n/** Whether the element has an accessible name: a label attribute, a label reference or readable text. */\nexport function hasAccessibleName(element: Element, sources: CkNameSources): boolean {\n const attribute = (name: string): boolean => (element.getAttribute(name) ?? '').trim() !== '';\n if (attribute('aria-label') || (sources.title && attribute('title'))) {\n return true;\n }\n if (sources.text && visibleText(element) !== '') {\n return true;\n }\n const named = (node: Element | null): boolean => (node?.textContent ?? '').trim() !== '';\n const labels = (element as Partial<HTMLInputElement>).labels;\n return (\n (element.getAttribute('aria-labelledby') ?? '')\n .split(/\\s+/)\n .some((id) => id !== '' && named(element.ownerDocument.getElementById(id))) ||\n (sources.labels === true && Array.from(labels ?? []).some(named))\n );\n}\n\n/** Text that is neither in an `aria-hidden` nor in a `hidden` subtree. */\nfunction visibleText(node: Node): string {\n if (node.nodeType === Node.TEXT_NODE) {\n return (node.textContent ?? '').trim();\n }\n if (\n node instanceof Element &&\n (node.getAttribute('aria-hidden') === 'true' || node.hasAttribute('hidden'))\n ) {\n return '';\n }\n return Array.from(node.childNodes, visibleText).join('');\n}\n"],"mappings":";;;;;;;;;;;AAAA,IAAI,UAAU;AAGd,SAAgB,WAAW,QAAc;CACvC,IAAI,OAAO,WAAW,YAAY,OAAO,KAAI,MAAO,IAClD,MAAM,IAAI,UAAU,6CAA6C;CAEnE,WAAW;CACX,OAAO,GAAG,OAAM,GAAI;AACtB;ACFA,IAAa,UAAb,MAAa,QAAO;CACD,qBAAqB,OAAO,kBAAkB;CAC9C,SAAS,OAAO,SAAS;CAGjC,gBAAiC,KAAK,MAAM,mBAAmB;CAE/D,SAA0B,KAAK,MACtC,eAAe,KAA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A,GAAA,gBAAA;CAAA,CAAA;CAAb,OAAA,QAAA,GAAA,sBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAa,YADA;CAAM,CAAA;;AACnB,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAa,YAAA,CAAA;EADzB,MAAA;EAAW,MAAA,CAAA,EAAE,YAAY,OAAM,CAAE;;;;ACxElC,SAAgB,kBAAkB,SAAkB,SAAsB;CACxE,MAAM,aAAa,UAA2B,QAAQ,aAAa,IAAI,KAAK,GAAA,CAAI,KAAI,MAAO;CAC3F,IAAI,UAAU,YAAY,KAAM,QAAQ,SAAS,UAAU,OAAO,GAChE,OAAO;CAET,IAAI,QAAQ,QAAQ,YAAY,OAAO,MAAM,IAC3C,OAAO;CAET,MAAM,SAAS,UAAmC,MAAM,eAAe,GAAA,CAAI,KAAI,MAAO;CACtF,MAAM,SAAU,QAAsC;CACtD,QACG,QAAQ,aAAa,iBAAiB,KAAK,GAAA,CACzC,MAAM,KAAK,CAAC,CACZ,MAAM,OAAO,OAAO,MAAM,MAAM,QAAQ,cAAc,eAAe,EAAE,CAAC,CAAC,KAC3E,QAAQ,WAAW,QAAQ,MAAM,KAAK,UAAU,CAAA,CAAE,CAAC,CAAC,KAAK,KAAK;AAEnE;AAGA,SAAS,YAAY,MAAU;CAC7B,IAAI,KAAK,aAAa,KAAK,WACzB,QAAQ,KAAK,eAAe,GAAA,CAAI,KAAI;CAEtC,IACE,gBAAgB,YACf,KAAK,aAAa,aAAa,MAAM,UAAU,KAAK,aAAa,QAAQ,IAE1E,OAAO;CAET,OAAO,MAAM,KAAK,KAAK,YAAY,WAAW,CAAC,CAAC,KAAK,EAAE;AACzD"}
@@ -0,0 +1,352 @@
1
+ import * as i0 from "@angular/core";
2
+ import { ChangeDetectionStrategy, Component, DestroyRef, ElementRef, InjectionToken, ViewEncapsulation, afterNextRender, booleanAttribute, computed, contentChildren, forwardRef, inject, input } from "@angular/core";
3
+ import { CkValueControl, hasAccessibleName, provideCkValueAccessor } from "@ckui/core/internal";
4
+ import { CK_CONFIG } from "@ckui/core";
5
+ const CK_SEGMENTED_CONTEXT = new InjectionToken("CK_SEGMENTED_CONTEXT");
6
+ const UNBOUND = Symbol("unbound");
7
+ var CkSegment = class CkSegment {
8
+ value = input.required(...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
9
+ disabled = input(false, {
10
+ ...ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {},
11
+ transform: booleanAttribute
12
+ });
13
+ element = inject(ElementRef).nativeElement;
14
+ group = inject(CK_SEGMENTED_CONTEXT);
15
+ checked = computed(() => {
16
+ const value = this.bound();
17
+ return value !== UNBOUND && this.group.isChecked(value);
18
+ }, ...ngDevMode ? [{ debugName: "checked" }] : /* istanbul ignore next */ []);
19
+ unavailable = computed(() => this.disabled() || this.group.groupDisabled(), ...ngDevMode ? [{ debugName: "unavailable" }] : /* istanbul ignore next */ []);
20
+ bound = computed(() => {
21
+ try {
22
+ return this.value();
23
+ } catch {
24
+ return UNBOUND;
25
+ }
26
+ }, ...ngDevMode ? [{ debugName: "bound" }] : /* istanbul ignore next */ []);
27
+ tabIndex = computed(() => {
28
+ if (this.unavailable()) return null;
29
+ return this.group.tabStop() === this ? 0 : -1;
30
+ }, ...ngDevMode ? [{ debugName: "tabIndex" }] : /* istanbul ignore next */ []);
31
+ constructor() {
32
+ if (typeof ngDevMode !== "undefined" && ngDevMode) {
33
+ let destroyed = false;
34
+ inject(DestroyRef).onDestroy(() => destroyed = true);
35
+ afterNextRender(() => {
36
+ if (!destroyed && !hasAccessibleName(this.element, {
37
+ title: true,
38
+ text: true
39
+ })) console.warn("[ckui] ck-segment has no accessible name. An icon-only segment needs an aria-label.", this.element);
40
+ });
41
+ }
42
+ }
43
+ static ɵfac = i0.ɵɵngDeclareFactory({
44
+ minVersion: "12.0.0",
45
+ version: "22.2.4",
46
+ ngImport: i0,
47
+ type: CkSegment,
48
+ deps: [],
49
+ target: i0.ɵɵFactoryTarget.Component
50
+ });
51
+ static ɵcmp = i0.ɵɵngDeclareComponent({
52
+ minVersion: "17.1.0",
53
+ version: "22.2.4",
54
+ type: CkSegment,
55
+ isStandalone: true,
56
+ selector: "ck-segment",
57
+ inputs: {
58
+ value: {
59
+ classPropertyName: "value",
60
+ publicName: "value",
61
+ isSignal: true,
62
+ isRequired: true,
63
+ transformFunction: null
64
+ },
65
+ disabled: {
66
+ classPropertyName: "disabled",
67
+ publicName: "disabled",
68
+ isSignal: true,
69
+ isRequired: false,
70
+ transformFunction: null
71
+ }
72
+ },
73
+ host: {
74
+ attributes: { "role": "radio" },
75
+ listeners: { "click": "group.select(this)" },
76
+ properties: {
77
+ "class.ck-segment--checked": "checked()",
78
+ "class.ck-segment--disabled": "unavailable()",
79
+ "attr.aria-checked": "checked()",
80
+ "attr.aria-disabled": "unavailable() ? \"true\" : null",
81
+ "attr.tabindex": "tabIndex()"
82
+ },
83
+ classAttribute: "ck-segment"
84
+ },
85
+ ngImport: i0,
86
+ template: `<span class="ck-segment__content"
87
+ ><ng-content select="svg, ck-icon" /><span class="ck-segment__label"><ng-content /></span
88
+ ></span>`,
89
+ isInline: true,
90
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
91
+ encapsulation: i0.ViewEncapsulation.None
92
+ });
93
+ };
94
+ i0.ɵɵngDeclareClassMetadata({
95
+ minVersion: "12.0.0",
96
+ version: "22.2.4",
97
+ ngImport: i0,
98
+ type: CkSegment,
99
+ decorators: [{
100
+ type: Component,
101
+ args: [{
102
+ selector: "ck-segment",
103
+ changeDetection: ChangeDetectionStrategy.OnPush,
104
+ encapsulation: ViewEncapsulation.None,
105
+ host: {
106
+ class: "ck-segment",
107
+ role: "radio",
108
+ "[class.ck-segment--checked]": "checked()",
109
+ "[class.ck-segment--disabled]": "unavailable()",
110
+ "[attr.aria-checked]": "checked()",
111
+ "[attr.aria-disabled]": "unavailable() ? \"true\" : null",
112
+ "[attr.tabindex]": "tabIndex()",
113
+ "(click)": "group.select(this)"
114
+ },
115
+ template: `<span class="ck-segment__content"
116
+ ><ng-content select="svg, ck-icon" /><span class="ck-segment__label"><ng-content /></span
117
+ ></span>`
118
+ }]
119
+ }],
120
+ ctorParameters: () => [],
121
+ propDecorators: {
122
+ value: [{
123
+ type: i0.Input,
124
+ args: [{
125
+ isSignal: true,
126
+ alias: "value",
127
+ required: true
128
+ }]
129
+ }],
130
+ disabled: [{
131
+ type: i0.Input,
132
+ args: [{
133
+ isSignal: true,
134
+ alias: "disabled",
135
+ required: false
136
+ }]
137
+ }]
138
+ }
139
+ });
140
+ function stepOf(key, rtl) {
141
+ switch (key) {
142
+ case "ArrowUp": return -1;
143
+ case "ArrowDown": return 1;
144
+ case "ArrowLeft": return rtl ? 1 : -1;
145
+ case "ArrowRight": return rtl ? -1 : 1;
146
+ default: return 0;
147
+ }
148
+ }
149
+ var CkSegmented = class CkSegmented extends CkValueControl {
150
+ size = input(void 0, ...ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []);
151
+ fullWidth = input(false, {
152
+ ...ngDevMode ? { debugName: "fullWidth" } : /* istanbul ignore next */ {},
153
+ transform: booleanAttribute
154
+ });
155
+ config = inject(CK_CONFIG);
156
+ element = inject(ElementRef).nativeElement;
157
+ segments = contentChildren(CkSegment, {
158
+ ...ngDevMode ? { debugName: "segments" } : /* istanbul ignore next */ {},
159
+ descendants: true
160
+ });
161
+ modifierClasses = computed(() => `ck-segmented--${this.size() ?? this.config.size}`, ...ngDevMode ? [{ debugName: "modifierClasses" }] : /* istanbul ignore next */ []);
162
+ current = computed(() => this.value() ?? null, ...ngDevMode ? [{ debugName: "current" }] : /* istanbul ignore next */ []);
163
+ checkedIndex = computed(() => this.segments().findIndex((segment) => segment.checked()), ...ngDevMode ? [{ debugName: "checkedIndex" }] : /* istanbul ignore next */ []);
164
+ groupDisabled = computed(() => this.isDisabled(), ...ngDevMode ? [{ debugName: "groupDisabled" }] : /* istanbul ignore next */ []);
165
+ tabStop = computed(() => {
166
+ if (this.isDisabled()) return null;
167
+ const usable = this.segments().filter((segment) => !segment.unavailable());
168
+ return usable.find((segment) => segment.checked()) ?? usable[0] ?? null;
169
+ }, ...ngDevMode ? [{ debugName: "tabStop" }] : /* istanbul ignore next */ []);
170
+ constructor() {
171
+ super();
172
+ if (typeof ngDevMode !== "undefined" && ngDevMode) {
173
+ let destroyed = false;
174
+ inject(DestroyRef).onDestroy(() => destroyed = true);
175
+ afterNextRender(() => {
176
+ if (!destroyed && !hasAccessibleName(this.element, {
177
+ title: false,
178
+ text: false
179
+ })) console.warn("[ckui] ck-segmented has no accessible name. Add an aria-label or aria-labelledby.", this.element);
180
+ });
181
+ }
182
+ }
183
+ isChecked(value) {
184
+ const current = this.current();
185
+ return current !== null && Object.is(current, value);
186
+ }
187
+ select(segment) {
188
+ if (!segment.unavailable()) this.commit(segment.value());
189
+ }
190
+ onKeydown(event) {
191
+ if (this.isDisabled() || event.ctrlKey || event.metaKey || event.altKey) return;
192
+ const target = event.target;
193
+ const segments = this.segments();
194
+ const focused = segments.find((segment) => segment.element.contains(target));
195
+ if (focused === void 0) return;
196
+ const usable = segments.filter((segment) => !segment.unavailable());
197
+ if (usable.length === 0) return;
198
+ if (event.key === " " || event.key === "Spacebar") {
199
+ event.preventDefault();
200
+ this.select(focused);
201
+ return;
202
+ }
203
+ const next = this.targetOf(event.key, focused, usable);
204
+ if (next === null) return;
205
+ event.preventDefault();
206
+ this.select(next);
207
+ next.element.focus();
208
+ }
209
+ targetOf(key, focused, usable) {
210
+ const last = usable.length - 1;
211
+ if (key === "Home") return usable[0];
212
+ if (key === "End") return usable[last];
213
+ const step = stepOf(key, this.element.matches(":dir(rtl)"));
214
+ if (step === 0) return null;
215
+ const from = usable.indexOf(focused);
216
+ if (from < 0) return step > 0 ? usable[0] : usable[last];
217
+ return usable[(from + step + usable.length) % usable.length];
218
+ }
219
+ onFocusOut(event) {
220
+ const entering = event.relatedTarget;
221
+ if (this.isDisabled()) return;
222
+ if (!(entering instanceof Node) || !this.element.contains(entering)) this.markTouched();
223
+ }
224
+ static ɵfac = i0.ɵɵngDeclareFactory({
225
+ minVersion: "12.0.0",
226
+ version: "22.2.4",
227
+ ngImport: i0,
228
+ type: CkSegmented,
229
+ deps: [],
230
+ target: i0.ɵɵFactoryTarget.Component
231
+ });
232
+ static ɵcmp = i0.ɵɵngDeclareComponent({
233
+ minVersion: "17.2.0",
234
+ version: "22.2.4",
235
+ type: CkSegmented,
236
+ isStandalone: true,
237
+ selector: "ck-segmented",
238
+ inputs: {
239
+ size: {
240
+ classPropertyName: "size",
241
+ publicName: "size",
242
+ isSignal: true,
243
+ isRequired: false,
244
+ transformFunction: null
245
+ },
246
+ fullWidth: {
247
+ classPropertyName: "fullWidth",
248
+ publicName: "fullWidth",
249
+ isSignal: true,
250
+ isRequired: false,
251
+ transformFunction: null
252
+ }
253
+ },
254
+ host: {
255
+ attributes: { "role": "radiogroup" },
256
+ listeners: {
257
+ "keydown": "onKeydown($event)",
258
+ "focusout": "onFocusOut($event)"
259
+ },
260
+ properties: {
261
+ "class": "modifierClasses()",
262
+ "class.ck-segmented--has-value": "checkedIndex() >= 0",
263
+ "class.ck-segmented--disabled": "isDisabled()",
264
+ "class.ck-segmented--full-width": "fullWidth()",
265
+ "attr.aria-disabled": "isDisabled() ? \"true\" : null",
266
+ "style.--_ck-segmented-count": "segments().length",
267
+ "style.--_ck-segmented-index": "checkedIndex()"
268
+ },
269
+ classAttribute: "ck-segmented"
270
+ },
271
+ providers: [provideCkValueAccessor(CkSegmented), {
272
+ provide: CK_SEGMENTED_CONTEXT,
273
+ useExisting: forwardRef(() => CkSegmented)
274
+ }],
275
+ queries: [{
276
+ propertyName: "segments",
277
+ predicate: CkSegment,
278
+ descendants: true,
279
+ isSignal: true
280
+ }],
281
+ usesInheritance: true,
282
+ ngImport: i0,
283
+ template: `<span class="ck-segmented__indicator" aria-hidden="true"></span><ng-content />`,
284
+ isInline: true,
285
+ styles: ["@layer ckui{.ck-segmented{--_ck-segmented-gap: var(--ck-segmented-padding, var(--ck-space-1));--_ck-segmented-radius: var(--ck-segmented-radius, var(--ck-control-radius));--_ck-segmented-direction: 1;position:relative;display:inline-grid;grid-auto-flow:column;grid-auto-columns:minmax(0,1fr);box-sizing:border-box;max-inline-size:100%;block-size:var(--_ck-segmented-height);border-radius:var(--_ck-segmented-radius);background:var(--ck-segmented-bg, var(--ck-color-control));box-shadow:inset 0 0 0 1px var(--ck-segmented-border-color, var(--ck-color-control-border));color-scheme:var(--ck-color-scheme);font-family:inherit;font-variant-numeric:var(--ck-font-variant-numeric);line-height:var(--ck-line-height-tight);vertical-align:middle;isolation:isolate}.ck-segmented:dir(rtl){--_ck-segmented-direction: -1}.ck-segmented:dir(ltr){direction:ltr}.ck-segmented--full-width{display:grid;inline-size:100%}.ck-segmented--sm{--_ck-segmented-height: var(--ck-control-height-sm);--_ck-segmented-font-size: var(--ck-control-font-size-sm);--_ck-segmented-padding-inline: var(--ck-control-padding-inline-sm)}.ck-segmented--md{--_ck-segmented-height: var(--ck-control-height-md);--_ck-segmented-font-size: var(--ck-control-font-size-md);--_ck-segmented-padding-inline: var(--ck-control-padding-inline-md)}.ck-segmented--lg{--_ck-segmented-height: var(--ck-control-height-lg);--_ck-segmented-font-size: var(--ck-control-font-size-lg);--_ck-segmented-padding-inline: var(--ck-control-padding-inline-lg)}.ck-segmented--xl{--_ck-segmented-height: var(--ck-control-height-xl);--_ck-segmented-font-size: var(--ck-control-font-size-xl);--_ck-segmented-padding-inline: var(--ck-control-padding-inline-xl)}.ck-segmented__indicator{position:absolute;display:none;box-sizing:border-box;inset-block:var(--_ck-segmented-gap);inset-inline-start:var(--_ck-segmented-gap);inline-size:calc(100% / var(--_ck-segmented-count, 1) - 2 * var(--_ck-segmented-gap));border:1px solid var(--ck-segmented-border-color, var(--ck-color-control-border));border-radius:max(0px,calc(var(--_ck-segmented-radius) - var(--_ck-segmented-gap)));background:var(--ck-segmented-indicator-bg, var(--ck-color-surface-raised));box-shadow:var(--ck-shadow-sm);transform:translate(calc(var(--_ck-segmented-direction) * var(--_ck-segmented-index, 0) * (100% + 2 * var(--_ck-segmented-gap))));transition:transform var(--ck-duration-normal) var(--ck-ease-standard);pointer-events:none}.ck-segmented--has-value .ck-segmented__indicator{display:block}.ck-segment{position:relative;display:flex;align-items:center;justify-content:center;box-sizing:border-box;min-inline-size:0;padding-inline:var(--_ck-segmented-padding-inline);color:var(--ck-segmented-fg, var(--ck-color-fg-muted));font-size:var(--_ck-segmented-font-size);font-weight:var(--ck-font-weight-medium);text-align:center;cursor:pointer;touch-action:manipulation;-webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent}.ck-segment:before{content:\"\";position:absolute;inset:var(--_ck-segmented-gap);border-radius:max(0px,calc(var(--_ck-segmented-radius) - var(--_ck-segmented-gap)));pointer-events:none}.ck-segment__content{position:relative;display:flex;align-items:center;justify-content:center;gap:var(--ck-space-2);min-inline-size:0;max-inline-size:100%}.ck-segment__content>svg{flex:none;inline-size:1em;block-size:1em}.ck-segment__content>ck-icon{flex:none}.ck-segment__label{min-inline-size:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ck-segment__label:empty{display:none}.ck-segment--checked{color:var(--ck-segmented-indicator-fg, var(--ck-color-fg))}@media(hover:hover){.ck-segment:not(.ck-segment--checked,.ck-segment--disabled):hover:before{background:var(--ck-color-surface-hover)}}.ck-segment:after{content:\"\";position:absolute;inset:0;border-radius:var(--_ck-segmented-radius);pointer-events:none}.ck-segment:focus-visible{outline:none}.ck-segment:focus-visible:after{outline:var(--ck-focus-ring);outline-offset:calc(var(--ck-focus-ring-width) * -1)}.ck-segmented--disabled,.ck-segment--disabled{cursor:not-allowed}.ck-segment--disabled,.ck-segment--disabled.ck-segment--checked{color:var(--ck-color-fg-disabled)}@media(prefers-reduced-motion:reduce){.ck-segmented__indicator{transition:none}}@media(forced-colors:active){.ck-segmented{box-shadow:none;outline:1px solid ButtonText;outline-offset:-1px}.ck-segmented__indicator{border-color:Highlight;background:Highlight;box-shadow:none}.ck-segment--checked{forced-color-adjust:none;color:HighlightText}.ck-segment:focus-visible:after{outline-color:Highlight}.ck-segment--disabled,.ck-segment--disabled.ck-segment--checked{color:GrayText}.ck-segmented--disabled .ck-segmented__indicator,.ck-segmented:has(.ck-segment--checked.ck-segment--disabled) .ck-segmented__indicator{border-color:GrayText;background:Canvas}}}\n"],
286
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
287
+ encapsulation: i0.ViewEncapsulation.None
288
+ });
289
+ };
290
+ i0.ɵɵngDeclareClassMetadata({
291
+ minVersion: "12.0.0",
292
+ version: "22.2.4",
293
+ ngImport: i0,
294
+ type: CkSegmented,
295
+ decorators: [{
296
+ type: Component,
297
+ args: [{
298
+ selector: "ck-segmented",
299
+ changeDetection: ChangeDetectionStrategy.OnPush,
300
+ encapsulation: ViewEncapsulation.None,
301
+ providers: [provideCkValueAccessor(CkSegmented), {
302
+ provide: CK_SEGMENTED_CONTEXT,
303
+ useExisting: forwardRef(() => CkSegmented)
304
+ }],
305
+ host: {
306
+ class: "ck-segmented",
307
+ role: "radiogroup",
308
+ "[class]": "modifierClasses()",
309
+ "[class.ck-segmented--has-value]": "checkedIndex() >= 0",
310
+ "[class.ck-segmented--disabled]": "isDisabled()",
311
+ "[class.ck-segmented--full-width]": "fullWidth()",
312
+ "[attr.aria-disabled]": "isDisabled() ? \"true\" : null",
313
+ "[style.--_ck-segmented-count]": "segments().length",
314
+ "[style.--_ck-segmented-index]": "checkedIndex()",
315
+ "(keydown)": "onKeydown($event)",
316
+ "(focusout)": "onFocusOut($event)"
317
+ },
318
+ template: `<span class="ck-segmented__indicator" aria-hidden="true"></span><ng-content />`,
319
+ styles: ["@layer ckui{.ck-segmented{--_ck-segmented-gap: var(--ck-segmented-padding, var(--ck-space-1));--_ck-segmented-radius: var(--ck-segmented-radius, var(--ck-control-radius));--_ck-segmented-direction: 1;position:relative;display:inline-grid;grid-auto-flow:column;grid-auto-columns:minmax(0,1fr);box-sizing:border-box;max-inline-size:100%;block-size:var(--_ck-segmented-height);border-radius:var(--_ck-segmented-radius);background:var(--ck-segmented-bg, var(--ck-color-control));box-shadow:inset 0 0 0 1px var(--ck-segmented-border-color, var(--ck-color-control-border));color-scheme:var(--ck-color-scheme);font-family:inherit;font-variant-numeric:var(--ck-font-variant-numeric);line-height:var(--ck-line-height-tight);vertical-align:middle;isolation:isolate}.ck-segmented:dir(rtl){--_ck-segmented-direction: -1}.ck-segmented:dir(ltr){direction:ltr}.ck-segmented--full-width{display:grid;inline-size:100%}.ck-segmented--sm{--_ck-segmented-height: var(--ck-control-height-sm);--_ck-segmented-font-size: var(--ck-control-font-size-sm);--_ck-segmented-padding-inline: var(--ck-control-padding-inline-sm)}.ck-segmented--md{--_ck-segmented-height: var(--ck-control-height-md);--_ck-segmented-font-size: var(--ck-control-font-size-md);--_ck-segmented-padding-inline: var(--ck-control-padding-inline-md)}.ck-segmented--lg{--_ck-segmented-height: var(--ck-control-height-lg);--_ck-segmented-font-size: var(--ck-control-font-size-lg);--_ck-segmented-padding-inline: var(--ck-control-padding-inline-lg)}.ck-segmented--xl{--_ck-segmented-height: var(--ck-control-height-xl);--_ck-segmented-font-size: var(--ck-control-font-size-xl);--_ck-segmented-padding-inline: var(--ck-control-padding-inline-xl)}.ck-segmented__indicator{position:absolute;display:none;box-sizing:border-box;inset-block:var(--_ck-segmented-gap);inset-inline-start:var(--_ck-segmented-gap);inline-size:calc(100% / var(--_ck-segmented-count, 1) - 2 * var(--_ck-segmented-gap));border:1px solid var(--ck-segmented-border-color, var(--ck-color-control-border));border-radius:max(0px,calc(var(--_ck-segmented-radius) - var(--_ck-segmented-gap)));background:var(--ck-segmented-indicator-bg, var(--ck-color-surface-raised));box-shadow:var(--ck-shadow-sm);transform:translate(calc(var(--_ck-segmented-direction) * var(--_ck-segmented-index, 0) * (100% + 2 * var(--_ck-segmented-gap))));transition:transform var(--ck-duration-normal) var(--ck-ease-standard);pointer-events:none}.ck-segmented--has-value .ck-segmented__indicator{display:block}.ck-segment{position:relative;display:flex;align-items:center;justify-content:center;box-sizing:border-box;min-inline-size:0;padding-inline:var(--_ck-segmented-padding-inline);color:var(--ck-segmented-fg, var(--ck-color-fg-muted));font-size:var(--_ck-segmented-font-size);font-weight:var(--ck-font-weight-medium);text-align:center;cursor:pointer;touch-action:manipulation;-webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent}.ck-segment:before{content:\"\";position:absolute;inset:var(--_ck-segmented-gap);border-radius:max(0px,calc(var(--_ck-segmented-radius) - var(--_ck-segmented-gap)));pointer-events:none}.ck-segment__content{position:relative;display:flex;align-items:center;justify-content:center;gap:var(--ck-space-2);min-inline-size:0;max-inline-size:100%}.ck-segment__content>svg{flex:none;inline-size:1em;block-size:1em}.ck-segment__content>ck-icon{flex:none}.ck-segment__label{min-inline-size:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ck-segment__label:empty{display:none}.ck-segment--checked{color:var(--ck-segmented-indicator-fg, var(--ck-color-fg))}@media(hover:hover){.ck-segment:not(.ck-segment--checked,.ck-segment--disabled):hover:before{background:var(--ck-color-surface-hover)}}.ck-segment:after{content:\"\";position:absolute;inset:0;border-radius:var(--_ck-segmented-radius);pointer-events:none}.ck-segment:focus-visible{outline:none}.ck-segment:focus-visible:after{outline:var(--ck-focus-ring);outline-offset:calc(var(--ck-focus-ring-width) * -1)}.ck-segmented--disabled,.ck-segment--disabled{cursor:not-allowed}.ck-segment--disabled,.ck-segment--disabled.ck-segment--checked{color:var(--ck-color-fg-disabled)}@media(prefers-reduced-motion:reduce){.ck-segmented__indicator{transition:none}}@media(forced-colors:active){.ck-segmented{box-shadow:none;outline:1px solid ButtonText;outline-offset:-1px}.ck-segmented__indicator{border-color:Highlight;background:Highlight;box-shadow:none}.ck-segment--checked{forced-color-adjust:none;color:HighlightText}.ck-segment:focus-visible:after{outline-color:Highlight}.ck-segment--disabled,.ck-segment--disabled.ck-segment--checked{color:GrayText}.ck-segmented--disabled .ck-segmented__indicator,.ck-segmented:has(.ck-segment--checked.ck-segment--disabled) .ck-segmented__indicator{border-color:GrayText;background:Canvas}}}\n"]
320
+ }]
321
+ }],
322
+ ctorParameters: () => [],
323
+ propDecorators: {
324
+ size: [{
325
+ type: i0.Input,
326
+ args: [{
327
+ isSignal: true,
328
+ alias: "size",
329
+ required: false
330
+ }]
331
+ }],
332
+ fullWidth: [{
333
+ type: i0.Input,
334
+ args: [{
335
+ isSignal: true,
336
+ alias: "fullWidth",
337
+ required: false
338
+ }]
339
+ }],
340
+ segments: [{
341
+ type: i0.ContentChildren,
342
+ args: [i0.forwardRef(() => CkSegment), {
343
+ descendants: true,
344
+ isSignal: true
345
+ }]
346
+ }]
347
+ }
348
+ });
349
+ const CK_SEGMENTED_IMPORTS = [CkSegmented, CkSegment];
350
+ export { CK_SEGMENTED_IMPORTS, CkSegment, CkSegmented };
351
+
352
+ //# sourceMappingURL=ckui-core-segmented.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ckui-core-segmented.mjs","names":[],"sources":["../../../../projects/core/segmented/context.ts","../../../../projects/core/segmented/segment.ts","../../../../projects/core/segmented/segmented.ts","../../../../projects/core/segmented/index.ts"],"sourcesContent":["import { InjectionToken, Signal } from '@angular/core';\n\n/** The part of a `ck-segment` its group reads, so the two files need not import each other's classes. */\nexport interface CkSegmentRef {\n readonly element: HTMLElement;\n readonly value: () => unknown;\n readonly unavailable: Signal<boolean>;\n}\n\n/** What a `ck-segment` needs from its group. */\nexport interface CkSegmentedContext {\n /** The group is disabled by its input or by the forms API. */\n readonly groupDisabled: Signal<boolean>;\n /** The group's one tab stop, or `null` when nothing can take focus. */\n readonly tabStop: Signal<CkSegmentRef | null>;\n isChecked(value: unknown): boolean;\n select(segment: CkSegmentRef): void;\n}\n\nexport const CK_SEGMENTED_CONTEXT = new InjectionToken<CkSegmentedContext>('CK_SEGMENTED_CONTEXT');\n","import {\n ChangeDetectionStrategy,\n Component,\n DestroyRef,\n ElementRef,\n ViewEncapsulation,\n afterNextRender,\n booleanAttribute,\n computed,\n inject,\n input,\n} from '@angular/core';\nimport { hasAccessibleName } from '@ckui/core/internal';\nimport { CK_SEGMENTED_CONTEXT } from './context';\n\ndeclare const ngDevMode: unknown;\n\nconst UNBOUND = Symbol('unbound');\n\n/**\n * One option of a `ck-segmented`. Its content is projected: text, an icon (a direct `svg` child, always shown before the text), or both. An icon-only\n * segment needs an `aria-label`.\n */\n@Component({\n selector: 'ck-segment',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'ck-segment',\n role: 'radio',\n '[class.ck-segment--checked]': 'checked()',\n '[class.ck-segment--disabled]': 'unavailable()',\n '[attr.aria-checked]': 'checked()',\n '[attr.aria-disabled]': 'unavailable() ? \"true\" : null',\n '[attr.tabindex]': 'tabIndex()',\n '(click)': 'group.select(this)',\n },\n template: `<span class=\"ck-segment__content\"\n ><ng-content select=\"svg, ck-icon\" /><span class=\"ck-segment__label\"><ng-content /></span\n ></span>`,\n})\nexport class CkSegment<T = unknown> {\n readonly value = input.required<T>();\n readonly disabled = input(false, { transform: booleanAttribute });\n\n /** @internal Used by `ck-segmented`. */\n readonly element = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n protected readonly group = inject(CK_SEGMENTED_CONTEXT);\n\n /** @internal Used by `ck-segmented`. */\n readonly checked = computed(() => {\n const value = this.bound();\n return value !== UNBOUND && this.group.isChecked(value);\n });\n /** @internal Used by `ck-segmented`: disabled by itself or by its group. */\n readonly unavailable = computed(() => this.disabled() || this.group.groupDisabled());\n /** A segment the template has just created has no value yet, though its group already reads it. */\n private readonly bound = computed<unknown>(() => {\n try {\n return this.value();\n } catch {\n return UNBOUND;\n }\n });\n /** An unavailable segment has no tabindex at all, so a click cannot focus it either. */\n protected readonly tabIndex = computed(() => {\n if (this.unavailable()) {\n return null;\n }\n return this.group.tabStop() === this ? 0 : -1;\n });\n\n constructor() {\n if (typeof ngDevMode !== 'undefined' && ngDevMode) {\n let destroyed = false;\n inject(DestroyRef).onDestroy(() => (destroyed = true));\n afterNextRender(() => {\n if (!destroyed && !hasAccessibleName(this.element, { title: true, text: true })) {\n console.warn(\n '[ckui] ck-segment has no accessible name. An icon-only segment needs an aria-label.',\n this.element,\n );\n }\n });\n }\n }\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n DestroyRef,\n ElementRef,\n ViewEncapsulation,\n afterNextRender,\n booleanAttribute,\n computed,\n contentChildren,\n forwardRef,\n inject,\n input,\n} from '@angular/core';\nimport { CK_CONFIG, CkSize } from '@ckui/core';\nimport { CkValueControl, hasAccessibleName, provideCkValueAccessor } from '@ckui/core/internal';\nimport { CK_SEGMENTED_CONTEXT, CkSegmentRef, CkSegmentedContext } from './context';\nimport { CkSegment } from './segment';\n\ndeclare const ngDevMode: unknown;\n\n/** -1 for the previous segment, 1 for the next one, 0 for a key that does not move. */\nfunction stepOf(key: string, rtl: boolean): -1 | 0 | 1 {\n switch (key) {\n case 'ArrowUp':\n return -1;\n case 'ArrowDown':\n return 1;\n case 'ArrowLeft':\n return rtl ? 1 : -1;\n case 'ArrowRight':\n return rtl ? -1 : 1;\n default:\n return 0;\n }\n}\n\n/**\n * A group of mutually exclusive options that behaves as one radio group: one tab stop, the arrow\n * keys move and select. Direction comes from the `dir` attribute (`:dir(rtl)`), not from the CSS\n * `direction` property. The value is the `value` of the selected `ck-segment`, or `null`.\n */\n@Component({\n selector: 'ck-segmented',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n providers: [\n provideCkValueAccessor(CkSegmented),\n { provide: CK_SEGMENTED_CONTEXT, useExisting: forwardRef(() => CkSegmented) },\n ],\n host: {\n class: 'ck-segmented',\n role: 'radiogroup',\n '[class]': 'modifierClasses()',\n '[class.ck-segmented--has-value]': 'checkedIndex() >= 0',\n '[class.ck-segmented--disabled]': 'isDisabled()',\n '[class.ck-segmented--full-width]': 'fullWidth()',\n '[attr.aria-disabled]': 'isDisabled() ? \"true\" : null',\n '[style.--_ck-segmented-count]': 'segments().length',\n '[style.--_ck-segmented-index]': 'checkedIndex()',\n '(keydown)': 'onKeydown($event)',\n '(focusout)': 'onFocusOut($event)',\n },\n template: `<span class=\"ck-segmented__indicator\" aria-hidden=\"true\"></span><ng-content />`,\n styleUrl: './segmented.css',\n})\nexport class CkSegmented<T = unknown>\n extends CkValueControl<T | null>\n implements CkSegmentedContext\n{\n /** `undefined` uses the size from `provideCkui`. */\n readonly size = input<CkSize | undefined>(undefined);\n /** Stretches the group to the width of its container; by default it is as wide as its segments. */\n readonly fullWidth = input(false, { transform: booleanAttribute });\n\n private readonly config = inject(CK_CONFIG);\n private readonly element = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n private readonly segments = contentChildren(CkSegment, { descendants: true });\n\n protected readonly modifierClasses = computed(\n () => `ck-segmented--${this.size() ?? this.config.size}`,\n );\n\n private readonly current = computed(() => this.value() ?? null);\n protected readonly checkedIndex = computed(() =>\n this.segments().findIndex((segment) => segment.checked()),\n );\n\n /** @internal Used by `ck-segment`. */\n readonly groupDisabled = computed(() => this.isDisabled());\n\n /** @internal Used by `ck-segment`. The checked segment, else the first one that can be used. */\n readonly tabStop = computed<CkSegmentRef | null>(() => {\n if (this.isDisabled()) {\n return null;\n }\n const usable = this.segments().filter((segment) => !segment.unavailable());\n return usable.find((segment) => segment.checked()) ?? usable[0] ?? null;\n });\n\n constructor() {\n super();\n if (typeof ngDevMode !== 'undefined' && ngDevMode) {\n let destroyed = false;\n inject(DestroyRef).onDestroy(() => (destroyed = true));\n afterNextRender(() => {\n if (!destroyed && !hasAccessibleName(this.element, { title: false, text: false })) {\n console.warn(\n '[ckui] ck-segmented has no accessible name. Add an aria-label or aria-labelledby.',\n this.element,\n );\n }\n });\n }\n }\n\n /** @internal Used by `ck-segment`. */\n isChecked(value: unknown): boolean {\n const current = this.current();\n return current !== null && Object.is(current, value);\n }\n\n /** @internal Used by `ck-segment`. */\n select(segment: CkSegmentRef): void {\n if (!segment.unavailable()) {\n this.commit(segment.value() as T);\n }\n }\n\n protected onKeydown(event: KeyboardEvent): void {\n if (this.isDisabled() || event.ctrlKey || event.metaKey || event.altKey) {\n return;\n }\n const target = event.target as Node;\n const segments = this.segments();\n const focused = segments.find((segment) => segment.element.contains(target));\n if (focused === undefined) {\n return;\n }\n const usable = segments.filter((segment) => !segment.unavailable());\n if (usable.length === 0) {\n return;\n }\n\n if (event.key === ' ' || event.key === 'Spacebar') {\n event.preventDefault();\n this.select(focused);\n return;\n }\n\n const next = this.targetOf(event.key, focused, usable);\n if (next === null) {\n return;\n }\n event.preventDefault();\n this.select(next);\n next.element.focus();\n }\n\n /** The segment a navigation key leads to, or `null` for a key that does not navigate. */\n private targetOf(key: string, focused: CkSegment, usable: CkSegment[]): CkSegment | null {\n const last = usable.length - 1;\n if (key === 'Home') {\n return usable[0];\n }\n if (key === 'End') {\n return usable[last];\n }\n const step = stepOf(key, this.element.matches(':dir(rtl)'));\n if (step === 0) {\n return null;\n }\n const from = usable.indexOf(focused);\n if (from < 0) {\n return step > 0 ? usable[0] : usable[last];\n }\n return usable[(from + step + usable.length) % usable.length];\n }\n\n protected onFocusOut(event: FocusEvent): void {\n const entering = event.relatedTarget;\n if (this.isDisabled()) {\n return;\n }\n if (!(entering instanceof Node) || !this.element.contains(entering)) {\n this.markTouched();\n }\n }\n}\n","import { CkSegment } from './segment';\nimport { CkSegmented } from './segmented';\n\nexport { CkSegment } from './segment';\nexport { CkSegmented } from './segmented';\n\n/** Everything a template needs for a segmented control: `imports: [CK_SEGMENTED_IMPORTS]`. */\nexport const CK_SEGMENTED_IMPORTS = [CkSegmented, CkSegment] as const;\n"],"mappings":";;;;AAmBA,MAAa,uBAAuB,IAAI,eAAmC,sBAAsB;ACFjG,MAAM,UAAU,OAAO,SAAS;AAwBhC,IAAa,YAAb,MAAa,UAAS;CACX,QAAQ,MAAM,SAAa,GAAA,YAAA,CAAA,EAAA,WAA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