@ckui/core 0.1.0-next.1 → 0.1.0-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +122 -4
- package/fesm2022/ckui-core-badge.mjs +169 -0
- package/fesm2022/ckui-core-badge.mjs.map +1 -0
- package/fesm2022/ckui-core-dialog.mjs +2 -1
- package/fesm2022/ckui-core-dialog.mjs.map +1 -1
- package/fesm2022/ckui-core-internal-overlay.mjs +468 -0
- package/fesm2022/ckui-core-internal-overlay.mjs.map +1 -0
- package/fesm2022/ckui-core-internal.mjs +2 -463
- package/fesm2022/ckui-core-internal.mjs.map +1 -1
- package/fesm2022/ckui-core-progress.mjs +165 -0
- package/fesm2022/ckui-core-progress.mjs.map +1 -0
- package/fesm2022/ckui-core-segmented.mjs +184 -8
- package/fesm2022/ckui-core-segmented.mjs.map +1 -1
- package/fesm2022/ckui-core-stepper.mjs +842 -0
- package/fesm2022/ckui-core-stepper.mjs.map +1 -0
- package/fesm2022/ckui-core.mjs +2 -0
- package/fesm2022/ckui-core.mjs.map +1 -1
- package/package.json +17 -1
- package/types/ckui-core-badge.d.ts +44 -0
- package/types/ckui-core-internal-overlay.d.ts +76 -0
- package/types/ckui-core-internal.d.ts +2 -75
- package/types/ckui-core-progress.d.ts +43 -0
- package/types/ckui-core-segmented.d.ts +26 -0
- package/types/ckui-core-stepper.d.ts +186 -0
- package/types/ckui-core.d.ts +2 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ckui-core-stepper.mjs","names":[],"sources":["../../../../projects/core/stepper/stepper-math.ts","../../../../projects/core/stepper/stepper.ts"],"sourcesContent":["/** What the stepper needs to snap, clamp and format: all numbers already validated. */\nexport interface StepperGrid {\n readonly step: number;\n readonly min: number | null;\n readonly max: number | null;\n readonly digits: number;\n}\n\nexport interface StepperSeparators {\n readonly decimal: string;\n readonly group: string;\n}\n\nconst MAX_DIGITS = 10;\nconst EPSILON = 1e-9;\n/** Larger typed values are treated as a typo and reverted. */\nconst LIMIT = 1e15;\n\n/** Fraction digits of a number as written, `0.25` → 2, `1e-7` → 7. */\nexport function decimalsOf(value: number): number {\n if (!Number.isFinite(value)) {\n return 0;\n }\n const [mantissa, exponent] = String(Math.abs(value)).split('e');\n const fraction = mantissa.split('.')[1]?.length ?? 0;\n const shift = exponent === undefined ? 0 : -Number(exponent);\n return Math.min(Math.max(fraction + shift, 0), MAX_DIGITS);\n}\n\n/** Rounds to `digits` fraction digits, so 0.1 + 0.2 becomes 0.3, and never returns -0. */\nexport function roundTo(value: number, digits: number): number {\n const rounded = Number(value.toFixed(Math.min(digits, MAX_DIGITS)));\n return rounded === 0 ? 0 : rounded;\n}\n\n/** The nearest grid point inside the bounds. When `min` is above `max`, `min` wins. */\nexport function snap(value: number, grid: StepperGrid): number {\n const { step, min, max, digits } = grid;\n const base = min ?? 0;\n if (min !== null && max !== null && min > max) {\n return roundTo(min, digits);\n }\n let count = Math.round((value - base) / step);\n if (max !== null && base + count * step > max + EPSILON) {\n count = Math.floor((max - base) / step + EPSILON);\n }\n let snapped = base + count * step;\n if (min !== null && snapped < min) {\n snapped = min;\n }\n return roundTo(snapped, digits);\n}\n\n/** The first grid point beyond `value` in the direction; a value on the grid moves by one step. */\nexport function adjacent(value: number, direction: 1 | -1, grid: StepperGrid): number {\n const base = grid.min ?? 0;\n const position = (value - base) / grid.step;\n const nearest = Math.round(position);\n const onGrid = Math.abs(position - nearest) < EPSILON;\n let count: number;\n if (direction > 0) {\n count = onGrid ? nearest + 1 : Math.ceil(position);\n } else {\n count = onGrid ? nearest - 1 : Math.floor(position);\n }\n return snap(base + count * grid.step, grid);\n}\n\n/** `count` steps from the value; an off-grid value first moves to the adjacent grid point. */\nexport function moveBy(value: number, direction: 1 | -1, count: number, grid: StepperGrid): number {\n const first = adjacent(value, direction, grid);\n return count <= 1 ? first : snap(first + direction * (count - 1) * grid.step, grid);\n}\n\n/** Arabic-Indic and Persian digits and marks to ASCII, as `Intl` writes numbers in ar and fa. */\nfunction toAscii(text: string): string {\n return text\n .replace(/[\\u0660-\\u0669]/g, (digit) => String(digit.charCodeAt(0) - 0x0660))\n .replace(/[\\u06f0-\\u06f9]/g, (digit) => String(digit.charCodeAt(0) - 0x06f0))\n .replace(/\\u066b/g, '.')\n .replace(/\\u066c/g, ',')\n .replace(/[\\u061c\\u200e\\u200f]/g, '');\n}\n\nexport function separatorsOf(locale: string): StepperSeparators {\n try {\n const parts = new Intl.NumberFormat(locale).formatToParts(1000000.5);\n return {\n decimal: parts.find((part) => part.type === 'decimal')?.value ?? '.',\n group: parts.find((part) => part.type === 'group')?.value ?? ',',\n };\n } catch {\n return { decimal: '.', group: ',' };\n }\n}\n\nexport function createFormatter(\n locale: string,\n minDigits: number,\n maxDigits: number,\n): Intl.NumberFormat {\n const options = {\n useGrouping: false,\n minimumFractionDigits: minDigits,\n maximumFractionDigits: Math.max(minDigits, maxDigits),\n };\n try {\n return new Intl.NumberFormat(locale, options);\n } catch {\n return new Intl.NumberFormat('en', options);\n }\n}\n\n/**\n * Reads what a person typed. `null` is an empty field, `undefined` something that is no number.\n * Both `.` and `,` count as a decimal mark; a mark that is the locale's group separator and sits\n * in groups of three (`1.250` in German) is a group separator.\n */\nexport function parseNumber(\n text: string,\n separators: StepperSeparators,\n): number | null | undefined {\n const groupMark = toAscii(separators.group);\n let cleaned = toAscii(text)\n .replace(/[\\s'’]/g, '')\n .replace(/[−‒–]/g, '-');\n if (cleaned === '') {\n return null;\n }\n const dots = cleaned.split('.').length - 1;\n const commas = cleaned.split(',').length - 1;\n if (dots > 0 && commas > 0) {\n const decimalMark = cleaned.lastIndexOf('.') > cleaned.lastIndexOf(',') ? '.' : ',';\n const groupMark = decimalMark === '.' ? ',' : '.';\n cleaned = cleaned.split(groupMark).join('').replace(decimalMark, '.');\n } else if (dots + commas > 0) {\n const mark = dots > 0 ? '.' : ',';\n const count = Math.max(dots, commas);\n const grouped = /^[+-]?[1-9]\\d{0,2}([.,]\\d{3})+$/.test(cleaned);\n if (count > 1 || (grouped && groupMark === mark)) {\n if (!grouped) {\n return undefined;\n }\n cleaned = cleaned.split(mark).join('');\n } else {\n cleaned = cleaned.replace(mark, '.');\n }\n }\n if (!/^[+-]?(\\d+\\.?\\d*|\\.\\d+)$/.test(cleaned)) {\n return undefined;\n }\n const parsed = Number(cleaned);\n return Number.isFinite(parsed) && Math.abs(parsed) <= LIMIT ? parsed : undefined;\n}\n","import { DOCUMENT, isPlatformBrowser } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n DestroyRef,\n ElementRef,\n LOCALE_ID,\n PLATFORM_ID,\n Renderer2,\n ViewEncapsulation,\n afterNextRender,\n afterRenderEffect,\n booleanAttribute,\n computed,\n effect,\n inject,\n input,\n viewChild,\n} from '@angular/core';\nimport { CK_CONFIG, CK_LABELS, CkSize } from '@ckui/core';\nimport {\n CkIcon,\n CkMedia,\n CkValueControl,\n hasAccessibleName,\n provideCkValueAccessor,\n} from '@ckui/core/internal';\nimport {\n StepperGrid,\n createFormatter,\n decimalsOf,\n moveBy,\n parseNumber,\n separatorsOf,\n snap,\n} from './stepper-math';\n\ndeclare const ngDevMode: unknown;\n\n/** A held button repeats after this delay, then at the interval, and speeds up after the ramp. */\nconst REPEAT_DELAY = 400;\nconst REPEAT_INTERVAL = 80;\nconst REPEAT_RAMP = 2000;\nconst REPEAT_RAMP_FACTOR = 5;\nconst DEFAULT_LARGE_FACTOR = 10;\nconst SHOWN_DIGITS = 6;\n\ntype Direction = 1 | -1;\n\n/** Accepts `50`, `'50'`, `null`, `undefined` and `''`; anything else that is no number is `NaN`. */\nfunction toNumber(value: unknown): number | null {\n if (value === null || value === undefined || value === '') {\n return null;\n }\n return typeof value === 'number' || typeof value === 'string' ? Number(value) : NaN;\n}\n\nconst finiteOrNull = (value: number | null): number | null =>\n value !== null && Number.isFinite(value) ? value : null;\n\n/**\n * A number field with a minus and a plus button. The value is a real text input with the\n * `spinbutton` role: type a number (committed on Enter or blur, snapped to `step` and clamped to\n * `min` / `max`), use the arrow keys, or press the buttons, which repeat while held. An empty\n * field is `null`. The buttons are outside the tab order; the input is the one tab stop.\n *\n * Name it with `aria-label` or `aria-labelledby` on `ck-stepper`, or wrap it in a `<label>`. The\n * attributes are inputs here and move to the input element.\n *\n * The input comes first in the DOM, so a wrapping `<label>` names it rather than a button; the\n * minus button is moved in front of it with CSS `order`.\n */\n@Component({\n selector: 'ck-stepper',\n imports: [CkIcon],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n providers: [provideCkValueAccessor(CkStepper)],\n host: {\n class: 'ck-stepper',\n '[class]': 'modifierClasses()',\n '[class.ck-stepper--disabled]': 'isDisabled()',\n '[class.ck-stepper--readonly]': 'readonly()',\n '[style.--_ck-stepper-chars]': 'chars()',\n '(focusout)': 'onFocusOut($event)',\n '(click)': 'focusInput($event)',\n },\n template: `\n <span class=\"ck-stepper__field\">\n <input\n #input\n class=\"ck-stepper__input\"\n type=\"text\"\n role=\"spinbutton\"\n [attr.inputmode]=\"inputMode()\"\n autocomplete=\"off\"\n autocapitalize=\"off\"\n spellcheck=\"false\"\n enterkeyhint=\"done\"\n [attr.value]=\"displayValue()\"\n [readOnly]=\"readonly()\"\n [disabled]=\"isDisabled()\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-labelledby]=\"ariaLabelledby()\"\n [attr.aria-describedby]=\"ariaDescribedby()\"\n [attr.aria-readonly]=\"readonly() ? 'true' : null\"\n [attr.aria-valuenow]=\"current()\"\n [attr.aria-valuemin]=\"bounds().min\"\n [attr.aria-valuemax]=\"bounds().max\"\n [attr.aria-valuetext]=\"valueText()\"\n (input)=\"editing = true\"\n (keydown)=\"onKeydown($event)\"\n />\n @if (unit()) {\n <span class=\"ck-stepper__unit\" aria-hidden=\"true\">{{ unit() }}</span>\n }\n </span>\n <button\n type=\"button\"\n class=\"ck-stepper__button ck-stepper__button--decrement\"\n tabindex=\"-1\"\n [attr.aria-label]=\"decrementText()\"\n [disabled]=\"decrementBlocked()\"\n (pointerdown)=\"onPress($event, -1)\"\n (pointermove)=\"onPressMove($event)\"\n (pointerup)=\"endPress()\"\n (pointercancel)=\"onPressCancel()\"\n (lostpointercapture)=\"endPress()\"\n (pointerleave)=\"endPress()\"\n (click)=\"onButtonClick(-1)\"\n (auxclick)=\"$event.preventDefault()\"\n (contextmenu)=\"$event.preventDefault()\"\n >\n <ck-icon name=\"minus\" />\n </button>\n <button\n type=\"button\"\n class=\"ck-stepper__button ck-stepper__button--increment\"\n tabindex=\"-1\"\n [attr.aria-label]=\"incrementText()\"\n [disabled]=\"incrementBlocked()\"\n (pointerdown)=\"onPress($event, 1)\"\n (pointermove)=\"onPressMove($event)\"\n (pointerup)=\"endPress()\"\n (pointercancel)=\"onPressCancel()\"\n (lostpointercapture)=\"endPress()\"\n (pointerleave)=\"endPress()\"\n (click)=\"onButtonClick(1)\"\n (auxclick)=\"$event.preventDefault()\"\n (contextmenu)=\"$event.preventDefault()\"\n >\n <ck-icon name=\"plus\" />\n </button>\n `,\n styleUrl: './stepper.css',\n})\nexport class CkStepper extends CkValueControl<number | null> {\n /** Smallest value. Without it the value has no lower limit. When above `max`, `min` wins. */\n readonly min = input<number | null, unknown>(null, { transform: toNumber });\n /** Largest value. Without it the value has no upper limit. */\n readonly max = input<number | null, unknown>(null, { transform: toNumber });\n /** Distance between values, counted from `min` (else 0). Not a number above 0 counts as 1. */\n readonly step = input<number | null, unknown>(null, { transform: toNumber });\n /** What Page Up and Page Down move by. Default: 10 steps. */\n readonly largeStep = input<number | null, unknown>(null, { transform: toNumber });\n /** Text after the value, part of the value text for assistive technology: `W` reads \"250 W\". */\n readonly unit = input('');\n /** `undefined` uses the size from `provideCkui`. */\n readonly size = input<CkSize | undefined>(undefined);\n /** The value can be read and focused, but not typed or stepped. */\n readonly readonly = input(false, { transform: booleanAttribute });\n /** Replaces the label of the minus button (\"FTP minus 5\"). */\n readonly decrementLabel = input('');\n /** Replaces the label of the plus button (\"FTP plus 5\"). */\n readonly incrementLabel = input('');\n /** The accessible name of the input. Moves from the host to the input element. */\n readonly ariaLabel = input<string | null>(null, { alias: 'aria-label' });\n /** The ids of the elements that name the input. Moves from the host to the input element. */\n readonly ariaLabelledby = input<string | null>(null, { alias: 'aria-labelledby' });\n /** The ids of a hint or error for the input. Moves from the host to the input element. */\n readonly ariaDescribedby = input<string | null>(null, { alias: 'aria-describedby' });\n\n private readonly config = inject(CK_CONFIG);\n private readonly labels = inject(CK_LABELS);\n private readonly locale = inject(LOCALE_ID);\n private readonly media = inject(CkMedia);\n private readonly document = inject(DOCUMENT);\n private readonly browser = isPlatformBrowser(inject(PLATFORM_ID));\n private readonly element = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n private readonly inputRef = viewChild.required<ElementRef<HTMLInputElement>>('input');\n\n /** Typed text that is not committed yet. */\n protected editing = false;\n /** The text last written into the input, so the render after a commit does not redo it. */\n private shown: string | null = null;\n private holding = false;\n /** Set by an accepted pointerdown on a button; the click that follows it must not step again. */\n private pressed = false;\n private stopWatchingRelease: (() => void) | null = null;\n private repeatTimer: ReturnType<typeof setTimeout> | null = null;\n private repeatElapsed = 0;\n private repeatDirection: Direction = 1;\n\n protected readonly modifierClasses = computed(\n () => `ck-stepper ck-stepper--${this.size() ?? this.config.size}`,\n );\n\n /** The decimal keypad has no minus sign, so a range that allows negatives gets the text one. */\n protected readonly inputMode = computed(() => {\n const { min } = this.bounds();\n return min !== null && min < 0 ? 'text' : 'decimal';\n });\n\n protected readonly stepSize = computed(() => {\n const step = this.step();\n return step !== null && Number.isFinite(step) && step > 0 ? step : 1;\n });\n\n /** The limits, with `max` raised to `min` when they cross. */\n protected readonly bounds = computed(() => {\n const min = finiteOrNull(this.min());\n const max = finiteOrNull(this.max());\n return { min, max: min !== null && max !== null && max < min ? min : max };\n });\n\n private readonly digits = computed(() =>\n Math.max(decimalsOf(this.stepSize()), decimalsOf(this.bounds().min ?? 0)),\n );\n\n private readonly grid = computed<StepperGrid>(() => ({\n step: this.stepSize(),\n ...this.bounds(),\n digits: this.digits(),\n }));\n\n private readonly largeDelta = computed(() => {\n const large = this.largeStep();\n return large !== null && Number.isFinite(large) && large > 0\n ? large\n : this.stepSize() * DEFAULT_LARGE_FACTOR;\n });\n\n private readonly separators = computed(() => separatorsOf(this.locale));\n\n /** The committed value, `null` for none (or anything that is not a finite number). */\n protected readonly current = computed<number | null>(() => {\n const value = this.value();\n return typeof value === 'number' && Number.isFinite(value) ? value : null;\n });\n\n private format(value: number | null): string {\n if (value === null) {\n return '';\n }\n const shown = Math.min(decimalsOf(value), SHOWN_DIGITS);\n return createFormatter(this.locale, this.digits(), shown).format(value);\n }\n\n protected readonly displayValue = computed(() => this.format(this.current()));\n\n protected readonly valueText = computed(() => {\n const value = this.displayValue();\n return value === '' ? null : this.unit() ? `${value} ${this.unit()}` : value;\n });\n\n /** Width of the value in characters, from the formatted limits (else the value), at least 3. */\n protected readonly chars = computed(() => {\n const { min, max } = this.bounds();\n const sources = min !== null || max !== null ? [min, max] : [this.current()];\n const lengths = sources\n .filter((value): value is number => value !== null)\n .map((value) => this.format(value).length);\n return Math.max(3, ...lengths);\n });\n\n protected readonly decrementText = computed(\n () => this.decrementLabel() || this.labels().decrement,\n );\n protected readonly incrementText = computed(\n () => this.incrementLabel() || this.labels().increment,\n );\n\n private readonly locked = computed(() => this.isDisabled() || this.readonly());\n\n protected readonly decrementBlocked = computed(() => {\n const { min } = this.bounds();\n const value = this.current();\n return this.locked() || (value !== null && min !== null && value <= min);\n });\n\n protected readonly incrementBlocked = computed(() => {\n const { max } = this.bounds();\n const value = this.current();\n return this.locked() || (value !== null && max !== null && value >= max);\n });\n\n constructor() {\n super();\n // The names are inputs here, so the host must not also keep them as a (role-less) attribute.\n const renderer = inject(Renderer2);\n renderer.removeAttribute(this.element, 'aria-label');\n renderer.removeAttribute(this.element, 'aria-labelledby');\n renderer.removeAttribute(this.element, 'aria-describedby');\n\n inject(DestroyRef).onDestroy(() => {\n this.holding = false;\n this.clearRepeat();\n this.unwatchRelease();\n });\n\n effect(() => {\n if (this.locked()) {\n this.endPress();\n }\n });\n\n let firstRender = true;\n afterRenderEffect(() => {\n const text = this.displayValue();\n if (!this.browser) {\n return;\n }\n const wasFirst = firstRender;\n firstRender = false;\n // Server markup keeps what a visitor typed before the page took over, as a draft.\n if (wasFirst && this.inputRef().nativeElement.value !== text) {\n this.editing = true;\n this.shown = text;\n return;\n }\n // A commit already showed this text; typing since then is a new draft the render must keep.\n if (text !== this.shown) {\n this.show(text);\n }\n });\n\n if (typeof ngDevMode !== 'undefined' && ngDevMode && this.browser) {\n this.watchConfiguration();\n }\n }\n\n private watchConfiguration(): void {\n let destroyed = false;\n inject(DestroyRef).onDestroy(() => (destroyed = true));\n afterNextRender(() => {\n if (\n !destroyed &&\n !hasAccessibleName(this.inputRef().nativeElement, {\n title: false,\n text: false,\n labels: true,\n })\n ) {\n console.warn(\n '[ckui] ck-stepper has no accessible name. Add an aria-label or aria-labelledby, or wrap it in a <label>.',\n this.element,\n );\n }\n });\n let warnedStep = false;\n let warnedBounds = false;\n effect(() => {\n const step = this.step();\n if (!warnedStep && step !== null && !(Number.isFinite(step) && step > 0)) {\n warnedStep = true;\n console.warn(\n `[ckui] ck-stepper step must be a number above 0, got ${step}. Using 1.`,\n this.element,\n );\n }\n const min = finiteOrNull(this.min());\n const max = finiteOrNull(this.max());\n if (!warnedBounds && min !== null && max !== null && min > max) {\n warnedBounds = true;\n console.warn(\n `[ckui] ck-stepper min (${min}) is above max (${max}). The value is pinned to min.`,\n this.element,\n );\n }\n });\n }\n\n /** Writes text into the input and drops any uncommitted typing. */\n private show(text: string): void {\n const input = this.inputRef().nativeElement;\n this.editing = false;\n this.shown = text;\n if (input.value !== text) {\n input.value = text;\n }\n }\n\n /** The value arrows and buttons start from: the typed text when valid, else the value. */\n private base(): number | null {\n if (!this.editing) {\n return this.current();\n }\n const parsed = parseNumber(this.inputRef().nativeElement.value, this.separators());\n if (parsed === undefined) {\n return this.current();\n }\n return parsed === null ? null : snap(parsed, this.grid());\n }\n\n /** Moves by `count` steps from the base. Returns whether the committed value changed. */\n private stepBy(direction: Direction, count: number): boolean {\n const grid = this.grid();\n const base = this.base();\n const next =\n base === null\n ? snap(Math.min(grid.min ?? 0, grid.max ?? Infinity), grid)\n : moveBy(base, direction, count, grid);\n return this.settle(next);\n }\n\n /** Commits a value from the user and shows what the control then holds. */\n private settle(next: number | null): boolean {\n const before = this.current();\n if (next === before) {\n // Also an emptied field whose value was never set: `undefined` to `null` is no change.\n this.show(this.displayValue());\n return false;\n }\n this.commit(next);\n this.show(this.displayValue());\n return !Object.is(before, this.current());\n }\n\n private commitText(): void {\n if (!this.editing) {\n return;\n }\n const parsed = parseNumber(this.inputRef().nativeElement.value, this.separators());\n if (parsed === undefined) {\n this.show(this.displayValue());\n return;\n }\n this.settle(parsed === null ? null : snap(parsed, this.grid()));\n }\n\n protected onKeydown(event: KeyboardEvent): void {\n if (this.isDisabled() || event.ctrlKey || event.metaKey || event.altKey) {\n return;\n }\n if (event.key === 'Enter') {\n this.commitText();\n return;\n }\n if (this.readonly()) {\n return;\n }\n const { min, max } = this.bounds();\n switch (event.key) {\n case 'ArrowUp':\n this.stepBy(1, 1);\n break;\n case 'ArrowDown':\n this.stepBy(-1, 1);\n break;\n case 'PageUp':\n this.stepBy(1, this.largeDelta() / this.stepSize());\n break;\n case 'PageDown':\n this.stepBy(-1, this.largeDelta() / this.stepSize());\n break;\n case 'Home':\n if (min === null) {\n return;\n }\n this.settle(snap(min, this.grid()));\n break;\n case 'End':\n if (max === null) {\n return;\n }\n this.settle(snap(max, this.grid()));\n break;\n default:\n return;\n }\n event.preventDefault();\n }\n\n protected onFocusOut(event: FocusEvent): void {\n if (this.isDisabled()) {\n return;\n }\n // Ending a hold counts as touched already, so a blur during one reports once.\n const onInput = event.target === this.inputRef().nativeElement;\n const endsHold = onInput && this.holding;\n if (onInput) {\n this.commitText();\n this.endPress();\n }\n const entering = event.relatedTarget;\n if (!endsHold && (!(entering instanceof Node) || !this.element.contains(entering))) {\n this.markTouched();\n }\n }\n\n /** A click on the field around the value (the unit, the padding) focuses the input. */\n protected focusInput(event: Event): void {\n const input = this.inputRef().nativeElement;\n const target = event.target;\n if (\n target instanceof Element &&\n target !== input &&\n target.closest('.ck-stepper__field') !== null &&\n !input.disabled\n ) {\n input.focus({ preventScroll: true });\n }\n }\n\n /** The press starts on pointerdown, so the first step happens at once and a hold can repeat. */\n protected onPress(event: PointerEvent, direction: Direction): void {\n const blocked = direction > 0 ? this.incrementBlocked() : this.decrementBlocked();\n // A button inside `<fieldset disabled>` is :disabled but still gets pointer events.\n const disabledByAncestor = (event.currentTarget as HTMLElement).matches(':disabled');\n if (event.button !== 0 || !event.isPrimary || blocked || disabledByAncestor) {\n return;\n }\n this.pressed = true;\n // Keeps focus where it is (the input, so arrows still work); the click still happens.\n event.preventDefault();\n if (!this.media.coarsePointer()) {\n this.inputRef().nativeElement.focus({ preventScroll: true });\n }\n this.endPress();\n this.holding = true;\n this.watchRelease();\n this.repeatDirection = direction;\n this.repeatElapsed = 0;\n if (this.stepBy(direction, 1)) {\n this.scheduleRepeat(REPEAT_DELAY);\n } else {\n this.endPress();\n }\n }\n\n /** A pointer that has moved off the button no longer holds it. */\n protected onPressMove(event: PointerEvent): void {\n if (!this.holding) {\n return;\n }\n const rect = (event.currentTarget as HTMLElement).getBoundingClientRect();\n const inside =\n event.clientX >= rect.left &&\n event.clientX <= rect.right &&\n event.clientY >= rect.top &&\n event.clientY <= rect.bottom;\n if (!inside) {\n // Released elsewhere, so no click follows on this button.\n this.pressed = false;\n this.endPress();\n }\n }\n\n /** The browser took the pointer away: no click follows. */\n protected onPressCancel(): void {\n this.pressed = false;\n this.endPress();\n }\n\n /**\n * The click after a pointer press was handled on pointerdown and is skipped. A click without a\n * pointerdown (keyboard, a screen reader's activation, `button.click()`) steps once here.\n */\n protected onButtonClick(direction: Direction): void {\n if (this.pressed) {\n this.pressed = false;\n return;\n }\n if (this.locked()) {\n return;\n }\n this.stepBy(direction, 1);\n this.markTouched();\n }\n\n private scheduleRepeat(delay: number): void {\n this.repeatTimer = setTimeout(() => {\n this.repeatTimer = null;\n this.repeatElapsed += delay;\n if (!this.holding || this.locked() || this.inputRef().nativeElement.matches(':disabled')) {\n this.endPress();\n return;\n }\n const count = this.repeatElapsed >= REPEAT_RAMP ? REPEAT_RAMP_FACTOR : 1;\n if (this.stepBy(this.repeatDirection, count)) {\n this.scheduleRepeat(REPEAT_INTERVAL);\n } else {\n this.endPress();\n }\n }, delay);\n }\n\n /**\n * On a coarse pointer the input is not focused during a press, so the window losing focus and\n * the document turning hidden are the only signals that the finger will not be released here.\n */\n private watchRelease(): void {\n this.unwatchRelease();\n const view = this.document.defaultView;\n const onVisibility = (): void => {\n if (this.document.visibilityState === 'hidden') {\n this.endPress();\n }\n };\n const onBlur = (): void => this.endPress();\n this.document.addEventListener('visibilitychange', onVisibility);\n view?.addEventListener('blur', onBlur);\n this.stopWatchingRelease = () => {\n this.document.removeEventListener('visibilitychange', onVisibility);\n view?.removeEventListener('blur', onBlur);\n };\n }\n\n private unwatchRelease(): void {\n this.stopWatchingRelease?.();\n this.stopWatchingRelease = null;\n }\n\n private clearRepeat(): void {\n if (this.repeatTimer !== null) {\n clearTimeout(this.repeatTimer);\n this.repeatTimer = null;\n }\n }\n\n /** Release, cancel, lost capture, leave, blur, hidden, a bound or a lock: stops, counts as touched. */\n protected endPress(): void {\n this.clearRepeat();\n this.unwatchRelease();\n if (this.holding) {\n this.holding = false;\n this.markTouched();\n }\n }\n}\n"],"mappings":";;;;;AAaA,MAAM,aAAa;AACnB,MAAM,UAAU;AAEhB,MAAM,QAAQ;AAGd,SAAgB,WAAW,OAAa;CACtC,IAAI,CAAC,OAAO,SAAS,KAAK,GACxB,OAAO;CAET,MAAM,CAAC,UAAU,YAAY,OAAO,KAAK,IAAI,KAAK,CAAC,CAAC,CAAC,MAAM,GAAG;CAC9D,MAAM,WAAW,SAAS,M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,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,MAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,UAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,gBAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,gBAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,WAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,gBAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,iBAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,UAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,SAAO,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
|
package/fesm2022/ckui-core.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ckui-core.mjs","names":[],"sources":["../../../../projects/core/src/size.ts","../../../../projects/core/src/labels.ts","../../../../projects/core/src/config.ts"],"sourcesContent":["export type CkSize = 'sm' | 'md' | 'lg' | 'xl';\n\nexport const CK_SIZES: readonly CkSize[] = ['sm', 'md', 'lg', 'xl'];\n","import { InjectionToken, Signal, signal } from '@angular/core';\n\n/** Built-in strings. Each package adds its keys; consumers pass a `Partial`. */\nexport interface CkLabels {\n close: string;\n dismiss: string;\n loading: string;\n noResults: string;\n notifications: string;\n}\n\nexport const CK_DEFAULT_LABELS: Readonly<CkLabels> = Object.freeze({\n close: 'Close',\n dismiss: 'Dismiss',\n loading: 'Loading',\n noResults: 'No results',\n notifications: 'Notifications',\n});\n\n/** Merges overrides onto the defaults. Blank and non-string values fall back; unknown keys are ignored. */\nexport function resolveCkLabels(overrides: unknown): CkLabels {\n const source = typeof overrides === 'object' && overrides !== null ? overrides : {};\n const resolved: CkLabels = { ...CK_DEFAULT_LABELS };\n for (const key of Object.keys(CK_DEFAULT_LABELS) as (keyof CkLabels)[]) {\n const value = Object.hasOwn(source, key) ? (source as Record<string, unknown>)[key] : undefined;\n if (typeof value === 'string' && value.trim() !== '') {\n resolved[key] = value;\n }\n }\n return resolved;\n}\n\nexport const CK_LABELS = new InjectionToken<Signal<CkLabels>>('CK_LABELS', {\n providedIn: 'root',\n factory: () => signal<CkLabels>({ ...CK_DEFAULT_LABELS }).asReadonly(),\n});\n","import {\n EnvironmentProviders,\n InjectionToken,\n Provider,\n Signal,\n computed,\n isSignal,\n makeEnvironmentProviders,\n signal,\n} from '@angular/core';\nimport { CK_LABELS, CkLabels, resolveCkLabels } from './labels';\nimport { CK_SIZES, CkSize } from './size';\n\nexport interface CkConfig {\n readonly size: CkSize;\n /** Viewport width in px below which a coarse pointer switches overlays to sheets. */\n readonly sheetBreakpoint: number;\n}\n\nexport const CK_DEFAULT_CONFIG: Readonly<CkConfig> = Object.freeze({\n size: 'md',\n sheetBreakpoint: 640,\n});\n\nexport const CK_CONFIG = new InjectionToken<CkConfig>('CK_CONFIG', {\n providedIn: 'root',\n factory: () => ({ ...CK_DEFAULT_CONFIG }),\n});\n\nexport interface CkOptions {\n size?: CkSize;\n /** In px; finite and greater than 0. */\n sheetBreakpoint?: number;\n /** A partial object, a signal of one, or a factory (runs in injection context) returning a signal of one. */\n labels?: Partial<CkLabels> | Signal<Partial<CkLabels>> | (() => Signal<Partial<CkLabels>>);\n}\n\nfunction labelsProvider(labels: NonNullable<CkOptions['labels']>): Provider {\n if (isSignal(labels)) {\n return { provide: CK_LABELS, useValue: computed(() => resolveCkLabels(labels())) };\n }\n if (typeof labels === 'function') {\n return {\n provide: CK_LABELS,\n useFactory: (): Signal<CkLabels> => {\n const source = labels();\n if (!isSignal(source)) {\n throw new TypeError('provideCkui: the labels factory must return a signal.');\n }\n return computed(() => resolveCkLabels(source()));\n },\n };\n }\n if (typeof labels !== 'object' || labels === null) {\n throw new TypeError('provideCkui: labels must be an object or a factory returning a signal.');\n }\n return { provide: CK_LABELS, useValue: signal(resolveCkLabels(labels)).asReadonly() };\n}\n\n/** Configures size, sheet breakpoint and built-in strings for the whole app. */\nexport function provideCkui(options: CkOptions = {}): EnvironmentProviders {\n const size = options.size === undefined ? CK_DEFAULT_CONFIG.size : options.size;\n const sheetBreakpoint =\n options.sheetBreakpoint === undefined\n ? CK_DEFAULT_CONFIG.sheetBreakpoint\n : options.sheetBreakpoint;\n if (!CK_SIZES.includes(size)) {\n throw new TypeError(`provideCkui: size must be one of ${CK_SIZES.join(', ')}, got \"${size}\".`);\n }\n if (\n typeof sheetBreakpoint !== 'number' ||\n !Number.isFinite(sheetBreakpoint) ||\n sheetBreakpoint <= 0\n ) {\n throw new TypeError(\n `provideCkui: sheetBreakpoint must be a finite number greater than 0, got ${String(sheetBreakpoint)}.`,\n );\n }\n const providers: Provider[] = [{ provide: CK_CONFIG, useValue: { size, sheetBreakpoint } }];\n if (options.labels !== undefined) {\n providers.push(labelsProvider(options.labels));\n }\n return makeEnvironmentProviders(providers);\n}\n"],"mappings":";AAEA,MAAa,WAA8B;CAAC;CAAM;CAAM;CAAM;AAAI;
|
|
1
|
+
{"version":3,"file":"ckui-core.mjs","names":[],"sources":["../../../../projects/core/src/size.ts","../../../../projects/core/src/labels.ts","../../../../projects/core/src/config.ts"],"sourcesContent":["export type CkSize = 'sm' | 'md' | 'lg' | 'xl';\n\nexport const CK_SIZES: readonly CkSize[] = ['sm', 'md', 'lg', 'xl'];\n","import { InjectionToken, Signal, signal } from '@angular/core';\n\n/** Built-in strings. Each package adds its keys; consumers pass a `Partial`. */\nexport interface CkLabels {\n close: string;\n decrement: string;\n dismiss: string;\n increment: string;\n loading: string;\n noResults: string;\n notifications: string;\n}\n\nexport const CK_DEFAULT_LABELS: Readonly<CkLabels> = Object.freeze({\n close: 'Close',\n decrement: 'Decrease',\n dismiss: 'Dismiss',\n increment: 'Increase',\n loading: 'Loading',\n noResults: 'No results',\n notifications: 'Notifications',\n});\n\n/** Merges overrides onto the defaults. Blank and non-string values fall back; unknown keys are ignored. */\nexport function resolveCkLabels(overrides: unknown): CkLabels {\n const source = typeof overrides === 'object' && overrides !== null ? overrides : {};\n const resolved: CkLabels = { ...CK_DEFAULT_LABELS };\n for (const key of Object.keys(CK_DEFAULT_LABELS) as (keyof CkLabels)[]) {\n const value = Object.hasOwn(source, key) ? (source as Record<string, unknown>)[key] : undefined;\n if (typeof value === 'string' && value.trim() !== '') {\n resolved[key] = value;\n }\n }\n return resolved;\n}\n\nexport const CK_LABELS = new InjectionToken<Signal<CkLabels>>('CK_LABELS', {\n providedIn: 'root',\n factory: () => signal<CkLabels>({ ...CK_DEFAULT_LABELS }).asReadonly(),\n});\n","import {\n EnvironmentProviders,\n InjectionToken,\n Provider,\n Signal,\n computed,\n isSignal,\n makeEnvironmentProviders,\n signal,\n} from '@angular/core';\nimport { CK_LABELS, CkLabels, resolveCkLabels } from './labels';\nimport { CK_SIZES, CkSize } from './size';\n\nexport interface CkConfig {\n readonly size: CkSize;\n /** Viewport width in px below which a coarse pointer switches overlays to sheets. */\n readonly sheetBreakpoint: number;\n}\n\nexport const CK_DEFAULT_CONFIG: Readonly<CkConfig> = Object.freeze({\n size: 'md',\n sheetBreakpoint: 640,\n});\n\nexport const CK_CONFIG = new InjectionToken<CkConfig>('CK_CONFIG', {\n providedIn: 'root',\n factory: () => ({ ...CK_DEFAULT_CONFIG }),\n});\n\nexport interface CkOptions {\n size?: CkSize;\n /** In px; finite and greater than 0. */\n sheetBreakpoint?: number;\n /** A partial object, a signal of one, or a factory (runs in injection context) returning a signal of one. */\n labels?: Partial<CkLabels> | Signal<Partial<CkLabels>> | (() => Signal<Partial<CkLabels>>);\n}\n\nfunction labelsProvider(labels: NonNullable<CkOptions['labels']>): Provider {\n if (isSignal(labels)) {\n return { provide: CK_LABELS, useValue: computed(() => resolveCkLabels(labels())) };\n }\n if (typeof labels === 'function') {\n return {\n provide: CK_LABELS,\n useFactory: (): Signal<CkLabels> => {\n const source = labels();\n if (!isSignal(source)) {\n throw new TypeError('provideCkui: the labels factory must return a signal.');\n }\n return computed(() => resolveCkLabels(source()));\n },\n };\n }\n if (typeof labels !== 'object' || labels === null) {\n throw new TypeError('provideCkui: labels must be an object or a factory returning a signal.');\n }\n return { provide: CK_LABELS, useValue: signal(resolveCkLabels(labels)).asReadonly() };\n}\n\n/** Configures size, sheet breakpoint and built-in strings for the whole app. */\nexport function provideCkui(options: CkOptions = {}): EnvironmentProviders {\n const size = options.size === undefined ? CK_DEFAULT_CONFIG.size : options.size;\n const sheetBreakpoint =\n options.sheetBreakpoint === undefined\n ? CK_DEFAULT_CONFIG.sheetBreakpoint\n : options.sheetBreakpoint;\n if (!CK_SIZES.includes(size)) {\n throw new TypeError(`provideCkui: size must be one of ${CK_SIZES.join(', ')}, got \"${size}\".`);\n }\n if (\n typeof sheetBreakpoint !== 'number' ||\n !Number.isFinite(sheetBreakpoint) ||\n sheetBreakpoint <= 0\n ) {\n throw new TypeError(\n `provideCkui: sheetBreakpoint must be a finite number greater than 0, got ${String(sheetBreakpoint)}.`,\n );\n }\n const providers: Provider[] = [{ provide: CK_CONFIG, useValue: { size, sheetBreakpoint } }];\n if (options.labels !== undefined) {\n providers.push(labelsProvider(options.labels));\n }\n return makeEnvironmentProviders(providers);\n}\n"],"mappings":";AAEA,MAAa,WAA8B;C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CAAC,CAAC,CAAC,WAAU;CAAE;AACrF;AAGA,SAAgB,YAAY,UAAqB,CAAA,GAAE;CACjD,MAAM,OAAO,QAAQ,SAAS,SAAY,kBAAkB,OAAO,QAAQ;CAC3E,MAAM,kBACJ,QAAQ,oBAAoB,SACxB,kBAAkB,kBAClB,QAAQ;CACd,IAAI,CAAC,SAAS,SAAS,IAAI,GACzB,MAAM,IAAI,UAAU,oCAAoC,SAAS,KAAK,IAAI,EAAC,SAAU,KAAI,GAAI;CAE/F,IACE,OAAO,oBAAoB,YAC3B,CAAC,OAAO,SAAS,eAAe,KAChC,mBAAmB,GAEnB,MAAM,IAAI,UACR,4EAA4E,OAAO,eAAe,EAAC,EAAG;CAG1G,MAAM,YAAwB,CAAC;EAAE,SAAS;EAAW,UAAU;GAAE;GAAM;EAAe;CAAE,CAAE;CAC1F,IAAI,QAAQ,WAAW,QACrB,UAAU,KAAK,eAAe,QAAQ,MAAM,CAAC;CAE/C,OAAO,yBAAyB,SAAS;AAC3C"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckui/core",
|
|
3
|
-
"version": "0.1.0-next.
|
|
3
|
+
"version": "0.1.0-next.2",
|
|
4
4
|
"description": "Accessible, themeable Angular UI components for phone and desktop.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"angular",
|
|
@@ -42,6 +42,10 @@
|
|
|
42
42
|
"types": "./types/ckui-core.d.ts",
|
|
43
43
|
"default": "./fesm2022/ckui-core.mjs"
|
|
44
44
|
},
|
|
45
|
+
"./badge": {
|
|
46
|
+
"types": "./types/ckui-core-badge.d.ts",
|
|
47
|
+
"default": "./fesm2022/ckui-core-badge.mjs"
|
|
48
|
+
},
|
|
45
49
|
"./button": {
|
|
46
50
|
"types": "./types/ckui-core-button.d.ts",
|
|
47
51
|
"default": "./fesm2022/ckui-core-button.mjs"
|
|
@@ -58,10 +62,22 @@
|
|
|
58
62
|
"types": "./types/ckui-core-internal.d.ts",
|
|
59
63
|
"default": "./fesm2022/ckui-core-internal.mjs"
|
|
60
64
|
},
|
|
65
|
+
"./internal/overlay": {
|
|
66
|
+
"types": "./types/ckui-core-internal-overlay.d.ts",
|
|
67
|
+
"default": "./fesm2022/ckui-core-internal-overlay.mjs"
|
|
68
|
+
},
|
|
69
|
+
"./progress": {
|
|
70
|
+
"types": "./types/ckui-core-progress.d.ts",
|
|
71
|
+
"default": "./fesm2022/ckui-core-progress.mjs"
|
|
72
|
+
},
|
|
61
73
|
"./segmented": {
|
|
62
74
|
"types": "./types/ckui-core-segmented.d.ts",
|
|
63
75
|
"default": "./fesm2022/ckui-core-segmented.mjs"
|
|
64
76
|
},
|
|
77
|
+
"./stepper": {
|
|
78
|
+
"types": "./types/ckui-core-stepper.d.ts",
|
|
79
|
+
"default": "./fesm2022/ckui-core-stepper.mjs"
|
|
80
|
+
},
|
|
65
81
|
"./toast": {
|
|
66
82
|
"types": "./types/ckui-core-toast.d.ts",
|
|
67
83
|
"default": "./fesm2022/ckui-core-toast.mjs"
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
type CkBadgeTone = 'neutral' | 'success' | 'warning' | 'danger';
|
|
3
|
+
type CkBadgeSize = 'sm' | 'md';
|
|
4
|
+
/** Marks a projected element (usually an `svg`) as the badge's leading icon. It is decorative. */
|
|
5
|
+
export declare class CkBadgeIcon {
|
|
6
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CkBadgeIcon, never>;
|
|
7
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<CkBadgeIcon, "[ckBadgeIcon]", never, {}, {}, never, never, true, never>;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* A small, non-interactive status label: a pill with text, an optional leading dot or icon. It is
|
|
11
|
+
* not a live region and has no role; the text must say what the status is, colour never does.
|
|
12
|
+
*/
|
|
13
|
+
export declare class CkBadge {
|
|
14
|
+
/** Colours of the badge. An unknown value falls back to `neutral`. */
|
|
15
|
+
readonly tone: import("@angular/core").InputSignal<CkBadgeTone>;
|
|
16
|
+
/** Adds a leading dot in the text colour. */
|
|
17
|
+
readonly dot: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
18
|
+
/** `md` is a 1.5rem pill, `sm` a smaller one for dense lists. An unknown value falls back to `md`. */
|
|
19
|
+
readonly size: import("@angular/core").InputSignal<CkBadgeSize>;
|
|
20
|
+
private readonly element;
|
|
21
|
+
protected readonly modifierClasses: import("@angular/core").Signal<string>;
|
|
22
|
+
constructor();
|
|
23
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CkBadge, never>;
|
|
24
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<CkBadge, "ck-badge", never, {
|
|
25
|
+
"tone": {
|
|
26
|
+
"alias": "tone";
|
|
27
|
+
"required": false;
|
|
28
|
+
"isSignal": true;
|
|
29
|
+
};
|
|
30
|
+
"dot": {
|
|
31
|
+
"alias": "dot";
|
|
32
|
+
"required": false;
|
|
33
|
+
"isSignal": true;
|
|
34
|
+
};
|
|
35
|
+
"size": {
|
|
36
|
+
"alias": "size";
|
|
37
|
+
"required": false;
|
|
38
|
+
"isSignal": true;
|
|
39
|
+
};
|
|
40
|
+
}, {}, never, ["[ckBadgeIcon]", "*"], true, never>;
|
|
41
|
+
}
|
|
42
|
+
/** Everything a template needs for a badge: `imports: [CK_BADGE_IMPORTS]`. */
|
|
43
|
+
export declare const CK_BADGE_IMPORTS: readonly [typeof CkBadge, typeof CkBadgeIcon];
|
|
44
|
+
export type { CkBadgeSize, CkBadgeTone };
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { ComponentType } from "@angular/cdk/portal";
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
import { Injector, TemplateRef } from "@angular/core";
|
|
4
|
+
type CkOverlayMode = 'auto' | 'modal' | 'sheet';
|
|
5
|
+
type CkOverlayDismissReason = 'escape' | 'backdrop' | 'swipe';
|
|
6
|
+
interface CkOverlayConfig {
|
|
7
|
+
/** `auto` becomes a sheet when `CkMedia.sheet()` is true at the moment of opening. Default `auto`. */
|
|
8
|
+
mode?: CkOverlayMode;
|
|
9
|
+
/** Escape, a click on the backdrop and a swipe down may close the overlay. Default `true`. */
|
|
10
|
+
dismissible?: boolean;
|
|
11
|
+
/** A sheet as tall as the viewport allows instead of as tall as its content. */
|
|
12
|
+
fullHeight?: boolean;
|
|
13
|
+
panelClass?: string | string[];
|
|
14
|
+
/** Default `dialog`. */
|
|
15
|
+
role?: 'dialog' | 'alertdialog';
|
|
16
|
+
ariaLabel?: string;
|
|
17
|
+
ariaLabelledBy?: string;
|
|
18
|
+
ariaDescribedBy?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Called when the user asks to dismiss (Escape, backdrop, swipe) a dismissible overlay. It is
|
|
21
|
+
* expected to call `handle.close()` straight away; without it the host closes the overlay itself.
|
|
22
|
+
* A sheet that is still open after a swipe snaps back.
|
|
23
|
+
*/
|
|
24
|
+
onDismissRequest?: (reason: CkOverlayDismissReason) => void;
|
|
25
|
+
/**
|
|
26
|
+
* Picks the element that takes focus once the overlay has rendered. Without it, or when it
|
|
27
|
+
* returns `null` or something that cannot take focus, the first tabbable element does.
|
|
28
|
+
*/
|
|
29
|
+
initialFocus?: () => HTMLElement | null;
|
|
30
|
+
}
|
|
31
|
+
interface CkOverlayHandle {
|
|
32
|
+
/** The mode resolved when the overlay opened. */
|
|
33
|
+
readonly mode: 'modal' | 'sheet';
|
|
34
|
+
/** The element that carries `role`, `aria-modal` and the labels; set `aria-labelledby` here when the title appears later. */
|
|
35
|
+
readonly panel: HTMLElement;
|
|
36
|
+
/** Resolves once the opening animation and the initial focus are done. */
|
|
37
|
+
readonly opened: Promise<void>;
|
|
38
|
+
/** Resolves once the overlay is detached. */
|
|
39
|
+
readonly closed: Promise<void>;
|
|
40
|
+
/** Animates out, then detaches. Repeated calls return the same promise. */
|
|
41
|
+
close(): Promise<void>;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Opens modal dialogs and bottom sheets on the CDK overlay: backdrop, scroll lock, focus trap and
|
|
45
|
+
* restore, `inert` background, Escape / backdrop / swipe dismissal and the open and close animation.
|
|
46
|
+
*/
|
|
47
|
+
export declare class CkOverlayHost {
|
|
48
|
+
private readonly overlay;
|
|
49
|
+
private readonly overlayContainer;
|
|
50
|
+
private readonly media;
|
|
51
|
+
private readonly inert;
|
|
52
|
+
private readonly focusTraps;
|
|
53
|
+
private readonly injector;
|
|
54
|
+
private readonly document;
|
|
55
|
+
private readonly isBrowser;
|
|
56
|
+
/** Open overlays, topmost last. A closing overlay has already left it. */
|
|
57
|
+
private readonly stack;
|
|
58
|
+
private readonly entries;
|
|
59
|
+
private scrollStrategy;
|
|
60
|
+
private scrollLocks;
|
|
61
|
+
private listening;
|
|
62
|
+
constructor();
|
|
63
|
+
open<C>(content: ComponentType<C> | TemplateRef<unknown>, config?: CkOverlayConfig, injector?: Injector): CkOverlayHandle;
|
|
64
|
+
/** Focus did not return to where it came from (opener disabled, inert or gone): find it a home. */
|
|
65
|
+
private restoreFocus;
|
|
66
|
+
private contentPortal;
|
|
67
|
+
/** What the server gets: nothing is rendered, and the overlay counts as closed. */
|
|
68
|
+
private inertHandle;
|
|
69
|
+
private lockScroll;
|
|
70
|
+
private unlockScroll;
|
|
71
|
+
private listen;
|
|
72
|
+
private readonly onKeydown;
|
|
73
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CkOverlayHost, never>;
|
|
74
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
75
|
+
}
|
|
76
|
+
export type { CkOverlayConfig, CkOverlayDismissReason, CkOverlayHandle, CkOverlayMode };
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
|
-
import {
|
|
2
|
+
import { ModelSignal, Provider, Signal, Type } from "@angular/core";
|
|
3
3
|
import { ControlValueAccessor } from "@angular/forms";
|
|
4
4
|
import { FormValueControl } from "@angular/forms/signals";
|
|
5
|
-
import { ComponentType } from "@angular/cdk/portal";
|
|
6
5
|
/** Returns an id that is unique within the running page, e.g. `ck-field-3`. */
|
|
7
6
|
export declare function createCkId(prefix: string): string;
|
|
8
7
|
/** Viewport and user-preference signals. All `false` on the server, where nothing can match. */
|
|
@@ -153,78 +152,6 @@ export declare abstract class CkValueControl<T> implements ControlValueAccessor,
|
|
|
153
152
|
}
|
|
154
153
|
/** Registers the component as a value accessor: `providers: [provideCkValueAccessor(CkSegmented)]`. */
|
|
155
154
|
export declare function provideCkValueAccessor(type: Type<unknown>): Provider;
|
|
156
|
-
type CkOverlayMode = 'auto' | 'modal' | 'sheet';
|
|
157
|
-
type CkOverlayDismissReason = 'escape' | 'backdrop' | 'swipe';
|
|
158
|
-
interface CkOverlayConfig {
|
|
159
|
-
/** `auto` becomes a sheet when `CkMedia.sheet()` is true at the moment of opening. Default `auto`. */
|
|
160
|
-
mode?: CkOverlayMode;
|
|
161
|
-
/** Escape, a click on the backdrop and a swipe down may close the overlay. Default `true`. */
|
|
162
|
-
dismissible?: boolean;
|
|
163
|
-
/** A sheet as tall as the viewport allows instead of as tall as its content. */
|
|
164
|
-
fullHeight?: boolean;
|
|
165
|
-
panelClass?: string | string[];
|
|
166
|
-
/** Default `dialog`. */
|
|
167
|
-
role?: 'dialog' | 'alertdialog';
|
|
168
|
-
ariaLabel?: string;
|
|
169
|
-
ariaLabelledBy?: string;
|
|
170
|
-
ariaDescribedBy?: string;
|
|
171
|
-
/**
|
|
172
|
-
* Called when the user asks to dismiss (Escape, backdrop, swipe) a dismissible overlay. It is
|
|
173
|
-
* expected to call `handle.close()` straight away; without it the host closes the overlay itself.
|
|
174
|
-
* A sheet that is still open after a swipe snaps back.
|
|
175
|
-
*/
|
|
176
|
-
onDismissRequest?: (reason: CkOverlayDismissReason) => void;
|
|
177
|
-
/**
|
|
178
|
-
* Picks the element that takes focus once the overlay has rendered. Without it, or when it
|
|
179
|
-
* returns `null` or something that cannot take focus, the first tabbable element does.
|
|
180
|
-
*/
|
|
181
|
-
initialFocus?: () => HTMLElement | null;
|
|
182
|
-
}
|
|
183
|
-
interface CkOverlayHandle {
|
|
184
|
-
/** The mode resolved when the overlay opened. */
|
|
185
|
-
readonly mode: 'modal' | 'sheet';
|
|
186
|
-
/** The element that carries `role`, `aria-modal` and the labels; set `aria-labelledby` here when the title appears later. */
|
|
187
|
-
readonly panel: HTMLElement;
|
|
188
|
-
/** Resolves once the opening animation and the initial focus are done. */
|
|
189
|
-
readonly opened: Promise<void>;
|
|
190
|
-
/** Resolves once the overlay is detached. */
|
|
191
|
-
readonly closed: Promise<void>;
|
|
192
|
-
/** Animates out, then detaches. Repeated calls return the same promise. */
|
|
193
|
-
close(): Promise<void>;
|
|
194
|
-
}
|
|
195
|
-
/**
|
|
196
|
-
* Opens modal dialogs and bottom sheets on the CDK overlay: backdrop, scroll lock, focus trap and
|
|
197
|
-
* restore, `inert` background, Escape / backdrop / swipe dismissal and the open and close animation.
|
|
198
|
-
*/
|
|
199
|
-
export declare class CkOverlayHost {
|
|
200
|
-
private readonly overlay;
|
|
201
|
-
private readonly overlayContainer;
|
|
202
|
-
private readonly media;
|
|
203
|
-
private readonly inert;
|
|
204
|
-
private readonly focusTraps;
|
|
205
|
-
private readonly injector;
|
|
206
|
-
private readonly document;
|
|
207
|
-
private readonly isBrowser;
|
|
208
|
-
/** Open overlays, topmost last. A closing overlay has already left it. */
|
|
209
|
-
private readonly stack;
|
|
210
|
-
private readonly entries;
|
|
211
|
-
private scrollStrategy;
|
|
212
|
-
private scrollLocks;
|
|
213
|
-
private listening;
|
|
214
|
-
constructor();
|
|
215
|
-
open<C>(content: ComponentType<C> | TemplateRef<unknown>, config?: CkOverlayConfig, injector?: Injector): CkOverlayHandle;
|
|
216
|
-
/** Focus did not return to where it came from (opener disabled, inert or gone): find it a home. */
|
|
217
|
-
private restoreFocus;
|
|
218
|
-
private contentPortal;
|
|
219
|
-
/** What the server gets: nothing is rendered, and the overlay counts as closed. */
|
|
220
|
-
private inertHandle;
|
|
221
|
-
private lockScroll;
|
|
222
|
-
private unlockScroll;
|
|
223
|
-
private listen;
|
|
224
|
-
private readonly onKeydown;
|
|
225
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<CkOverlayHost, never>;
|
|
226
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
227
|
-
}
|
|
228
155
|
interface CkNameSources {
|
|
229
156
|
/** Count `title` as a name. */
|
|
230
157
|
readonly title: boolean;
|
|
@@ -235,4 +162,4 @@ interface CkNameSources {
|
|
|
235
162
|
}
|
|
236
163
|
/** Whether the element has an accessible name: a label attribute, a label reference or readable text. */
|
|
237
164
|
export declare function hasAccessibleName(element: Element, sources: CkNameSources): boolean;
|
|
238
|
-
export type { CkFocusTrap, CkIconName, CkNameSources
|
|
165
|
+
export type { CkFocusTrap, CkIconName, CkNameSources };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
/**
|
|
3
|
+
* A horizontal progress bar. A number `value` fills the track up to `value / max`; `null` (or a
|
|
4
|
+
* value that is not a number) shows an indeterminate bar. It is not a live region: announce
|
|
5
|
+
* milestones yourself.
|
|
6
|
+
*/
|
|
7
|
+
export declare class CkProgress {
|
|
8
|
+
/**
|
|
9
|
+
* The progress, from 0 to `max`. Below 0 counts as 0 and above `max` as `max`. `null`,
|
|
10
|
+
* `undefined` and `NaN` show an indeterminate bar without `aria-valuenow`.
|
|
11
|
+
*/
|
|
12
|
+
readonly value: import("@angular/core").InputSignal<number | null | undefined>;
|
|
13
|
+
/** The value that means done. Anything that is not a number above 0 counts as 100. */
|
|
14
|
+
readonly max: import("@angular/core").InputSignal<number>;
|
|
15
|
+
/** Text for `aria-valuetext`, such as "Step 2 of 7". Without it assistive technology reads the percentage. */
|
|
16
|
+
readonly valueText: import("@angular/core").InputSignal<string | undefined>;
|
|
17
|
+
private readonly element;
|
|
18
|
+
/** @internal */
|
|
19
|
+
protected readonly limit: import("@angular/core").Signal<number>;
|
|
20
|
+
/** The clamped value, or `null` while the bar is indeterminate. */
|
|
21
|
+
protected readonly current: import("@angular/core").Signal<number | null>;
|
|
22
|
+
protected readonly indeterminate: import("@angular/core").Signal<boolean>;
|
|
23
|
+
protected readonly fraction: import("@angular/core").Signal<number>;
|
|
24
|
+
constructor();
|
|
25
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CkProgress, never>;
|
|
26
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<CkProgress, "ck-progress", never, {
|
|
27
|
+
"value": {
|
|
28
|
+
"alias": "value";
|
|
29
|
+
"required": false;
|
|
30
|
+
"isSignal": true;
|
|
31
|
+
};
|
|
32
|
+
"max": {
|
|
33
|
+
"alias": "max";
|
|
34
|
+
"required": false;
|
|
35
|
+
"isSignal": true;
|
|
36
|
+
};
|
|
37
|
+
"valueText": {
|
|
38
|
+
"alias": "valueText";
|
|
39
|
+
"required": false;
|
|
40
|
+
"isSignal": true;
|
|
41
|
+
};
|
|
42
|
+
}, {}, never, never, true, never>;
|
|
43
|
+
}
|
|
@@ -54,6 +54,9 @@ export declare class CkSegment<T = unknown> {
|
|
|
54
54
|
* A group of mutually exclusive options that behaves as one radio group: one tab stop, the arrow
|
|
55
55
|
* keys move and select. Direction comes from the `dir` attribute (`:dir(rtl)`), not from the CSS
|
|
56
56
|
* `direction` property. The value is the `value` of the selected `ck-segment`, or `null`.
|
|
57
|
+
*
|
|
58
|
+
* Segments are as wide as an equal share or their label, whichever is larger. Only when the labels
|
|
59
|
+
* cannot fit at all do they share the width equally and truncate with an ellipsis.
|
|
57
60
|
*/
|
|
58
61
|
export declare class CkSegmented<T = unknown> extends CkValueControl<T | null> implements CkSegmentedContext {
|
|
59
62
|
/** `undefined` uses the size from `provideCkui`. */
|
|
@@ -66,11 +69,34 @@ export declare class CkSegmented<T = unknown> extends CkValueControl<T | null> i
|
|
|
66
69
|
protected readonly modifierClasses: import("@angular/core").Signal<string>;
|
|
67
70
|
private readonly current;
|
|
68
71
|
protected readonly checkedIndex: import("@angular/core").Signal<number>;
|
|
72
|
+
/** The grid column of the checked segment, which the indicator is placed in. */
|
|
73
|
+
protected readonly column: import("@angular/core").Signal<number | null>;
|
|
74
|
+
/** Equal columns with truncated labels: the labels do not fit at their natural width. */
|
|
75
|
+
protected readonly compact: import("@angular/core").WritableSignal<boolean>;
|
|
76
|
+
private readonly media;
|
|
77
|
+
private readonly browser;
|
|
78
|
+
private destroyed;
|
|
79
|
+
private shownSegment;
|
|
80
|
+
private slide;
|
|
81
|
+
private observer;
|
|
82
|
+
private mutations;
|
|
83
|
+
private fonts;
|
|
69
84
|
/** @internal Used by `ck-segment`. */
|
|
70
85
|
readonly groupDisabled: import("@angular/core").Signal<boolean>;
|
|
71
86
|
/** @internal Used by `ck-segment`. The checked segment, else the first one that can be used. */
|
|
72
87
|
readonly tabStop: import("@angular/core").Signal<CkSegmentRef | null>;
|
|
73
88
|
constructor();
|
|
89
|
+
/** Slides the indicator after the layout moved it, unless it appears or motion is reduced. */
|
|
90
|
+
private slideTo;
|
|
91
|
+
/** Watches the group, its segments and their content, and switches the compact layout. */
|
|
92
|
+
private fit;
|
|
93
|
+
/**
|
|
94
|
+
* A label that changes (text, language, font) moves no box once the group is compact, so the
|
|
95
|
+
* resize observer is blind to it: watch the text itself and the fonts that finish loading.
|
|
96
|
+
*/
|
|
97
|
+
private watchContent;
|
|
98
|
+
private readonly onFontsLoaded;
|
|
99
|
+
private measure;
|
|
74
100
|
/** @internal Used by `ck-segment`. */
|
|
75
101
|
isChecked(value: unknown): boolean;
|
|
76
102
|
/** @internal Used by `ck-segment`. */
|