@xui/time-picker 2.0.0-alpha.19 → 2.0.0-alpha.21
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.
|
@@ -15,14 +15,18 @@ const pad = (value, length = 2) => String(value).padStart(length, '0');
|
|
|
15
15
|
class XuiTimePicker {
|
|
16
16
|
adapter = injectXDateAdapter();
|
|
17
17
|
host = inject(ElementRef);
|
|
18
|
+
/** Extra classes, merged into the component's own rather than replacing them. */
|
|
18
19
|
class = input('', /* @ts-ignore */
|
|
19
20
|
...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
20
21
|
/** The current time. Two-way bindable with `[(value)]`. */
|
|
21
22
|
value = model(null, /* @ts-ignore */
|
|
22
23
|
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
24
|
+
/** How far down the time goes: to the minute, the second, or the millisecond. Each step adds a field. */
|
|
23
25
|
precision = input('minute', /* @ts-ignore */
|
|
24
26
|
...(ngDevMode ? [{ debugName: "precision" }] : /* istanbul ignore next */ []));
|
|
27
|
+
/** Show a 12-hour clock with an AM/PM field instead of a 24-hour one. The bound value is unaffected. */
|
|
25
28
|
useAmPm = input(false, { ...(ngDevMode ? { debugName: "useAmPm" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
29
|
+
/** Block interaction and dim every field. */
|
|
26
30
|
disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
27
31
|
cva = createXValueAccessor({
|
|
28
32
|
onWrite: value => this.value.set(value ?? null),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xui-time-picker.mjs","sources":["../../../../../../libs/ui/time-picker/xui/src/lib/time-picker.ts","../../../../../../libs/ui/time-picker/xui/src/index.ts","../../../../../../libs/ui/time-picker/xui/src/xui-time-picker.ts"],"sourcesContent":["import { BooleanInput } from '@angular/cdk/coercion';\nimport {\n booleanAttribute,\n ChangeDetectionStrategy,\n Component,\n computed,\n ElementRef,\n inject,\n input,\n model,\n ViewEncapsulation\n} from '@angular/core';\nimport { ControlValueAccessor } from '@angular/forms';\nimport { xui } from '@xui/core';\nimport { injectXDateAdapter } from '@xui/core/date-time';\nimport { createXValueAccessor, provideXValueAccessor } from '@xui/core/forms';\nimport type { ClassValue } from 'clsx';\n\n/** How fine the picker edits. */\nexport type XuiTimePrecision = 'minute' | 'second' | 'millisecond';\n\nconst pad = (value: number, length = 2): string => String(value).padStart(length, '0');\n\n/**\n * A time field with hour/minute (and optional second/millisecond) spin buttons.\n * Arrow keys or the input step each field with wrap-around; `useAmPm` switches to\n * a 12-hour clock with an AM/PM toggle. `[(value)]` two-way binding; `T` is the\n * active `DateAdapter`'s type (a `Date` by default). It is a full\n * `ControlValueAccessor`, so `ngModel`/`formControl` bind to it directly.\n */\n@Component({\n selector: 'xui-time-picker',\n imports: [],\n providers: [provideXValueAccessor(() => XuiTimePicker)],\n template: `\n <div [class]=\"groupClass()\">\n <input\n type=\"text\"\n inputmode=\"numeric\"\n role=\"spinbutton\"\n aria-label=\"Hours\"\n [class]=\"fieldClass()\"\n [disabled]=\"isDisabled()\"\n [value]=\"pad(displayHour())\"\n [attr.aria-valuenow]=\"displayHour()\"\n (focus)=\"$any($event.target).select()\"\n (input)=\"onField('hour', $event)\"\n (keydown)=\"onKeydown('hour', $event)\"\n />\n <span class=\"text-foreground-muted text-sm\">:</span>\n <input\n type=\"text\"\n inputmode=\"numeric\"\n role=\"spinbutton\"\n aria-label=\"Minutes\"\n [class]=\"fieldClass()\"\n [disabled]=\"isDisabled()\"\n [value]=\"pad(minute())\"\n [attr.aria-valuenow]=\"minute()\"\n (focus)=\"$any($event.target).select()\"\n (input)=\"onField('minute', $event)\"\n (keydown)=\"onKeydown('minute', $event)\"\n />\n\n @if (showSeconds()) {\n <span class=\"text-foreground-muted text-sm\">:</span>\n <input\n type=\"text\"\n inputmode=\"numeric\"\n role=\"spinbutton\"\n aria-label=\"Seconds\"\n [class]=\"fieldClass()\"\n [disabled]=\"isDisabled()\"\n [value]=\"pad(second())\"\n [attr.aria-valuenow]=\"second()\"\n (focus)=\"$any($event.target).select()\"\n (input)=\"onField('second', $event)\"\n (keydown)=\"onKeydown('second', $event)\"\n />\n }\n\n @if (showMillis()) {\n <span class=\"text-foreground-muted text-sm\">.</span>\n <input\n type=\"text\"\n inputmode=\"numeric\"\n role=\"spinbutton\"\n aria-label=\"Milliseconds\"\n [class]=\"fieldClass() + ' w-10'\"\n [disabled]=\"isDisabled()\"\n [value]=\"pad(millisecond(), 3)\"\n [attr.aria-valuenow]=\"millisecond()\"\n (focus)=\"$any($event.target).select()\"\n (input)=\"onField('millisecond', $event)\"\n (keydown)=\"onKeydown('millisecond', $event)\"\n />\n }\n\n @if (useAmPm()) {\n <button type=\"button\" [class]=\"ampmClass()\" [disabled]=\"isDisabled()\" (click)=\"toggleMeridiem()\">\n {{ isPm() ? 'PM' : 'AM' }}\n </button>\n }\n </div>\n `,\n host: {\n '[class]': 'computedClass()',\n '(focusout)': 'onFocusOut($event)'\n },\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None\n})\nexport class XuiTimePicker<T = Date> implements ControlValueAccessor {\n private readonly adapter = injectXDateAdapter<T>();\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n\n readonly class = input<ClassValue>('');\n\n /** The current time. Two-way bindable with `[(value)]`. */\n readonly value = model<T | null>(null);\n\n readonly precision = input<XuiTimePrecision>('minute');\n readonly useAmPm = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n protected readonly cva = createXValueAccessor<T | null>({\n onWrite: value => this.value.set(value ?? null),\n disabled: this.disabled\n });\n protected readonly isDisabled = this.cva.disabled;\n\n protected readonly pad = pad;\n\n /** A concrete working value — the bound value, or today at 00:00 when empty. */\n private readonly working = computed(() => this.value() ?? this.adapter.startOfDay(this.adapter.now()));\n\n protected readonly showSeconds = computed(() => this.precision() !== 'minute');\n protected readonly showMillis = computed(() => this.precision() === 'millisecond');\n\n protected readonly hour24 = computed(() => this.adapter.getHours(this.working()));\n protected readonly minute = computed(() => this.adapter.getMinutes(this.working()));\n protected readonly second = computed(() => this.adapter.getSeconds(this.working()));\n protected readonly millisecond = computed(() => this.adapter.getMilliseconds(this.working()));\n protected readonly isPm = computed(() => this.hour24() >= 12);\n\n protected readonly displayHour = computed(() => {\n const hour = this.hour24();\n if (!this.useAmPm()) {\n return hour;\n }\n const twelve = hour % 12;\n return twelve === 0 ? 12 : twelve;\n });\n\n protected readonly computedClass = computed(() => xui('inline-block', this.class()));\n protected readonly groupClass = computed(() =>\n xui(\n 'border-border bg-surface-inset inline-flex h-(--control-height-md) items-center gap-1 rounded-lg border px-(--control-padding-sm)',\n 'focus-within:border-focus transition-colors',\n this.isDisabled() && 'cursor-not-allowed opacity-50'\n )\n );\n protected readonly fieldClass = computed(() =>\n xui('text-foreground w-7 bg-transparent text-center text-sm tabular-nums outline-none')\n );\n protected readonly ampmClass = computed(() =>\n xui('text-foreground-muted hover:bg-surface-raised ms-1 rounded px-1.5 py-0.5 text-xs font-medium')\n );\n\n private readonly ranges: Record<string, number> = { hour: 24, minute: 60, second: 60, millisecond: 1000 };\n\n protected onField(unit: 'hour' | 'minute' | 'second' | 'millisecond', event: Event): void {\n const raw = (event.target as HTMLInputElement).value.replace(/\\D/g, '');\n if (raw === '') {\n return;\n }\n\n let parsed = parseInt(raw, 10);\n if (unit === 'hour') {\n parsed = this.to24Hour(parsed);\n }\n this.commit(unit, this.wrap(parsed, this.ranges[unit]));\n }\n\n protected onKeydown(unit: 'hour' | 'minute' | 'second' | 'millisecond', event: KeyboardEvent): void {\n const step = event.key === 'ArrowUp' ? 1 : event.key === 'ArrowDown' ? -1 : 0;\n if (!step) {\n return;\n }\n\n event.preventDefault();\n const currentByUnit = {\n hour: this.hour24(),\n minute: this.minute(),\n second: this.second(),\n millisecond: this.millisecond()\n };\n this.commit(unit, this.wrap(currentByUnit[unit] + step, this.ranges[unit]));\n }\n\n protected toggleMeridiem(): void {\n this.commit('hour', this.wrap(this.hour24() + 12, 24));\n }\n\n /** Convert a typed 12-hour value into 24-hour, preserving the current meridiem. */\n private to24Hour(hour: number): number {\n if (!this.useAmPm()) {\n return hour;\n }\n\n const twelve = hour % 12;\n return this.isPm() ? twelve + 12 : twelve;\n }\n\n private wrap(value: number, size: number): number {\n return ((value % size) + size) % size;\n }\n\n /** The single write path for user edits — typing, arrow keys or the AM/PM toggle. */\n private commit(unit: 'hour' | 'minute' | 'second' | 'millisecond', value: number): void {\n if (this.isDisabled()) {\n return;\n }\n\n const next = this.adapter.set(this.working(), { [unit]: value });\n this.value.set(next);\n this.cva.notifyChange(next);\n }\n\n /** Touched fires when focus leaves the picker, not while moving between fields. */\n protected onFocusOut(event: FocusEvent): void {\n const next = event.relatedTarget as Node | null;\n if (!next || !this.host.nativeElement.contains(next)) {\n this.cva.markTouched();\n }\n }\n\n readonly writeValue = this.cva.writeValue;\n readonly registerOnChange = this.cva.registerOnChange;\n readonly registerOnTouched = this.cva.registerOnTouched;\n readonly setDisabledState = this.cva.setDisabledState;\n}\n","import { XuiTimePicker } from './lib/time-picker';\n\nexport * from './lib/time-picker';\n\nexport const XuiTimePickerImports = [XuiTimePicker] as const;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAqBA,MAAM,GAAG,GAAG,CAAC,KAAa,EAAE,MAAM,GAAG,CAAC,KAAa,MAAM,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,MAAM,EAAE,GAAG,CAAC;AAEtF;;;;;;AAMG;MAmFU,aAAa,CAAA;IACP,OAAO,GAAG,kBAAkB,EAAK;AACjC,IAAA,IAAI,GAAG,MAAM,CAA0B,UAAU,CAAC;IAE1D,KAAK,GAAG,KAAK,CAAa,EAAE;8EAAC;;IAG7B,KAAK,GAAG,KAAK,C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UAAA,EAAA,CAAA;kBAlFzB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,iBAAiB;AAC3B,oBAAA,OAAO,EAAE,EAAE;oBACX,SAAS,EAAE,CAAC,qBAAqB,EAAC,MAAK,aAAc,EAAC,CAAC;AACvD,oBAAA,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsET,EAAA,CAAA;AACD,oBAAA,IAAI,EAAE;AACJ,wBAAA,SAAS,EAAE,iBAAiB;AAC5B,wBAAA,YAAY,EAAE;AACf,qBAAA;oBACD,eAAe,EAAE,uBAAuB,CAAC,MAAM;oBAC/C,aAAa,EAAE,iBAAiB,CAAC;AAClC,iBAAA;;;AC3GM,MAAM,oBAAoB,GAAG,CAAC,aAAa;;ACJlD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"xui-time-picker.mjs","sources":["../../../../../../libs/ui/time-picker/xui/src/lib/time-picker.ts","../../../../../../libs/ui/time-picker/xui/src/index.ts","../../../../../../libs/ui/time-picker/xui/src/xui-time-picker.ts"],"sourcesContent":["import { BooleanInput } from '@angular/cdk/coercion';\nimport {\n booleanAttribute,\n ChangeDetectionStrategy,\n Component,\n computed,\n ElementRef,\n inject,\n input,\n model,\n ViewEncapsulation\n} from '@angular/core';\nimport { ControlValueAccessor } from '@angular/forms';\nimport { xui } from '@xui/core';\nimport { injectXDateAdapter } from '@xui/core/date-time';\nimport { createXValueAccessor, provideXValueAccessor } from '@xui/core/forms';\nimport type { ClassValue } from 'clsx';\n\n/** How fine the picker edits. */\nexport type XuiTimePrecision = 'minute' | 'second' | 'millisecond';\n\nconst pad = (value: number, length = 2): string => String(value).padStart(length, '0');\n\n/**\n * A time field with hour/minute (and optional second/millisecond) spin buttons.\n * Arrow keys or the input step each field with wrap-around; `useAmPm` switches to\n * a 12-hour clock with an AM/PM toggle. `[(value)]` two-way binding; `T` is the\n * active `DateAdapter`'s type (a `Date` by default). It is a full\n * `ControlValueAccessor`, so `ngModel`/`formControl` bind to it directly.\n */\n@Component({\n selector: 'xui-time-picker',\n imports: [],\n providers: [provideXValueAccessor(() => XuiTimePicker)],\n template: `\n <div [class]=\"groupClass()\">\n <input\n type=\"text\"\n inputmode=\"numeric\"\n role=\"spinbutton\"\n aria-label=\"Hours\"\n [class]=\"fieldClass()\"\n [disabled]=\"isDisabled()\"\n [value]=\"pad(displayHour())\"\n [attr.aria-valuenow]=\"displayHour()\"\n (focus)=\"$any($event.target).select()\"\n (input)=\"onField('hour', $event)\"\n (keydown)=\"onKeydown('hour', $event)\"\n />\n <span class=\"text-foreground-muted text-sm\">:</span>\n <input\n type=\"text\"\n inputmode=\"numeric\"\n role=\"spinbutton\"\n aria-label=\"Minutes\"\n [class]=\"fieldClass()\"\n [disabled]=\"isDisabled()\"\n [value]=\"pad(minute())\"\n [attr.aria-valuenow]=\"minute()\"\n (focus)=\"$any($event.target).select()\"\n (input)=\"onField('minute', $event)\"\n (keydown)=\"onKeydown('minute', $event)\"\n />\n\n @if (showSeconds()) {\n <span class=\"text-foreground-muted text-sm\">:</span>\n <input\n type=\"text\"\n inputmode=\"numeric\"\n role=\"spinbutton\"\n aria-label=\"Seconds\"\n [class]=\"fieldClass()\"\n [disabled]=\"isDisabled()\"\n [value]=\"pad(second())\"\n [attr.aria-valuenow]=\"second()\"\n (focus)=\"$any($event.target).select()\"\n (input)=\"onField('second', $event)\"\n (keydown)=\"onKeydown('second', $event)\"\n />\n }\n\n @if (showMillis()) {\n <span class=\"text-foreground-muted text-sm\">.</span>\n <input\n type=\"text\"\n inputmode=\"numeric\"\n role=\"spinbutton\"\n aria-label=\"Milliseconds\"\n [class]=\"fieldClass() + ' w-10'\"\n [disabled]=\"isDisabled()\"\n [value]=\"pad(millisecond(), 3)\"\n [attr.aria-valuenow]=\"millisecond()\"\n (focus)=\"$any($event.target).select()\"\n (input)=\"onField('millisecond', $event)\"\n (keydown)=\"onKeydown('millisecond', $event)\"\n />\n }\n\n @if (useAmPm()) {\n <button type=\"button\" [class]=\"ampmClass()\" [disabled]=\"isDisabled()\" (click)=\"toggleMeridiem()\">\n {{ isPm() ? 'PM' : 'AM' }}\n </button>\n }\n </div>\n `,\n host: {\n '[class]': 'computedClass()',\n '(focusout)': 'onFocusOut($event)'\n },\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None\n})\nexport class XuiTimePicker<T = Date> implements ControlValueAccessor {\n private readonly adapter = injectXDateAdapter<T>();\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /** Extra classes, merged into the component's own rather than replacing them. */\n readonly class = input<ClassValue>('');\n\n /** The current time. Two-way bindable with `[(value)]`. */\n readonly value = model<T | null>(null);\n\n /** How far down the time goes: to the minute, the second, or the millisecond. Each step adds a field. */\n readonly precision = input<XuiTimePrecision>('minute');\n /** Show a 12-hour clock with an AM/PM field instead of a 24-hour one. The bound value is unaffected. */\n readonly useAmPm = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n /** Block interaction and dim every field. */\n readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n protected readonly cva = createXValueAccessor<T | null>({\n onWrite: value => this.value.set(value ?? null),\n disabled: this.disabled\n });\n protected readonly isDisabled = this.cva.disabled;\n\n protected readonly pad = pad;\n\n /** A concrete working value — the bound value, or today at 00:00 when empty. */\n private readonly working = computed(() => this.value() ?? this.adapter.startOfDay(this.adapter.now()));\n\n protected readonly showSeconds = computed(() => this.precision() !== 'minute');\n protected readonly showMillis = computed(() => this.precision() === 'millisecond');\n\n protected readonly hour24 = computed(() => this.adapter.getHours(this.working()));\n protected readonly minute = computed(() => this.adapter.getMinutes(this.working()));\n protected readonly second = computed(() => this.adapter.getSeconds(this.working()));\n protected readonly millisecond = computed(() => this.adapter.getMilliseconds(this.working()));\n protected readonly isPm = computed(() => this.hour24() >= 12);\n\n protected readonly displayHour = computed(() => {\n const hour = this.hour24();\n if (!this.useAmPm()) {\n return hour;\n }\n const twelve = hour % 12;\n return twelve === 0 ? 12 : twelve;\n });\n\n protected readonly computedClass = computed(() => xui('inline-block', this.class()));\n protected readonly groupClass = computed(() =>\n xui(\n 'border-border bg-surface-inset inline-flex h-(--control-height-md) items-center gap-1 rounded-lg border px-(--control-padding-sm)',\n 'focus-within:border-focus transition-colors',\n this.isDisabled() && 'cursor-not-allowed opacity-50'\n )\n );\n protected readonly fieldClass = computed(() =>\n xui('text-foreground w-7 bg-transparent text-center text-sm tabular-nums outline-none')\n );\n protected readonly ampmClass = computed(() =>\n xui('text-foreground-muted hover:bg-surface-raised ms-1 rounded px-1.5 py-0.5 text-xs font-medium')\n );\n\n private readonly ranges: Record<string, number> = { hour: 24, minute: 60, second: 60, millisecond: 1000 };\n\n protected onField(unit: 'hour' | 'minute' | 'second' | 'millisecond', event: Event): void {\n const raw = (event.target as HTMLInputElement).value.replace(/\\D/g, '');\n if (raw === '') {\n return;\n }\n\n let parsed = parseInt(raw, 10);\n if (unit === 'hour') {\n parsed = this.to24Hour(parsed);\n }\n this.commit(unit, this.wrap(parsed, this.ranges[unit]));\n }\n\n protected onKeydown(unit: 'hour' | 'minute' | 'second' | 'millisecond', event: KeyboardEvent): void {\n const step = event.key === 'ArrowUp' ? 1 : event.key === 'ArrowDown' ? -1 : 0;\n if (!step) {\n return;\n }\n\n event.preventDefault();\n const currentByUnit = {\n hour: this.hour24(),\n minute: this.minute(),\n second: this.second(),\n millisecond: this.millisecond()\n };\n this.commit(unit, this.wrap(currentByUnit[unit] + step, this.ranges[unit]));\n }\n\n protected toggleMeridiem(): void {\n this.commit('hour', this.wrap(this.hour24() + 12, 24));\n }\n\n /** Convert a typed 12-hour value into 24-hour, preserving the current meridiem. */\n private to24Hour(hour: number): number {\n if (!this.useAmPm()) {\n return hour;\n }\n\n const twelve = hour % 12;\n return this.isPm() ? twelve + 12 : twelve;\n }\n\n private wrap(value: number, size: number): number {\n return ((value % size) + size) % size;\n }\n\n /** The single write path for user edits — typing, arrow keys or the AM/PM toggle. */\n private commit(unit: 'hour' | 'minute' | 'second' | 'millisecond', value: number): void {\n if (this.isDisabled()) {\n return;\n }\n\n const next = this.adapter.set(this.working(), { [unit]: value });\n this.value.set(next);\n this.cva.notifyChange(next);\n }\n\n /** Touched fires when focus leaves the picker, not while moving between fields. */\n protected onFocusOut(event: FocusEvent): void {\n const next = event.relatedTarget as Node | null;\n if (!next || !this.host.nativeElement.contains(next)) {\n this.cva.markTouched();\n }\n }\n\n readonly writeValue = this.cva.writeValue;\n readonly registerOnChange = this.cva.registerOnChange;\n readonly registerOnTouched = this.cva.registerOnTouched;\n readonly setDisabledState = this.cva.setDisabledState;\n}\n","import { XuiTimePicker } from './lib/time-picker';\n\nexport * from './lib/time-picker';\n\nexport const XuiTimePickerImports = [XuiTimePicker] as const;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAqBA,MAAM,GAAG,GAAG,CAAC,KAAa,EAAE,MAAM,GAAG,CAAC,KAAa,MAAM,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,MAAM,EAAE,GAAG,CAAC;AAEtF;;;;;;AAMG;MAmFU,aAAa,CAAA;IACP,OAAO,GAAG,kBAAkB,EAAK;AACjC,IAAA,IAAI,GAAG,MAAM,CAA0B,UAAU,CAAC;;IAG1D,KAAK,GAAG,KAAK,CAAa,EAAE;8EAAC;;IAG7B,KAAK,GAAG,KAAK,CAAW,IAAI;8EAAC;;IAG7B,SAAS,GAAG,KAAK,CAAmB,QAAQ;kFAAC;;IAE7C,OAAO,GAAG,KAAK,CAAwB,KAAK,+EAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;;IAE9E,QAAQ,GAAG,KAAK,CAAwB,KAAK,gFAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;IAErE,GAAG,GAAG,oBAAoB,CAAW;AACtD,QAAA,OAAO,EAAE,KAAK,IAAI,IAAI,CAAC,K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ET,EAAA,CAAA;AACD,oBAAA,IAAI,EAAE;AACJ,wBAAA,SAAS,EAAE,iBAAiB;AAC5B,wBAAA,YAAY,EAAE;AACf,qBAAA;oBACD,eAAe,EAAE,uBAAuB,CAAC,MAAM;oBAC/C,aAAa,EAAE,iBAAiB,CAAC;AAClC,iBAAA;;;AC3GM,MAAM,oBAAoB,GAAG,CAAC,aAAa;;ACJlD;;AAEG;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xui/time-picker",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.21",
|
|
4
4
|
"description": "Modern Angular 22 UI Library based on TailwindCSS",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"angular",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"@angular/cdk": "22",
|
|
40
40
|
"@angular/core": "22",
|
|
41
41
|
"@angular/forms": "22",
|
|
42
|
-
"@xui/core": "2.0.0-alpha.
|
|
42
|
+
"@xui/core": "2.0.0-alpha.21",
|
|
43
43
|
"clsx": "^2.1.1"
|
|
44
44
|
},
|
|
45
45
|
"publishConfig": {
|
|
@@ -16,11 +16,15 @@ type XuiTimePrecision = 'minute' | 'second' | 'millisecond';
|
|
|
16
16
|
declare class XuiTimePicker<T = Date> implements ControlValueAccessor {
|
|
17
17
|
private readonly adapter;
|
|
18
18
|
private readonly host;
|
|
19
|
+
/** Extra classes, merged into the component's own rather than replacing them. */
|
|
19
20
|
readonly class: _angular_core.InputSignal<ClassValue>;
|
|
20
21
|
/** The current time. Two-way bindable with `[(value)]`. */
|
|
21
22
|
readonly value: _angular_core.ModelSignal<T | null>;
|
|
23
|
+
/** How far down the time goes: to the minute, the second, or the millisecond. Each step adds a field. */
|
|
22
24
|
readonly precision: _angular_core.InputSignal<XuiTimePrecision>;
|
|
25
|
+
/** Show a 12-hour clock with an AM/PM field instead of a 24-hour one. The bound value is unaffected. */
|
|
23
26
|
readonly useAmPm: _angular_core.InputSignalWithTransform<boolean, BooleanInput>;
|
|
27
|
+
/** Block interaction and dim every field. */
|
|
24
28
|
readonly disabled: _angular_core.InputSignalWithTransform<boolean, BooleanInput>;
|
|
25
29
|
protected readonly cva: _xui_core_forms.XValueAccessor<T | null>;
|
|
26
30
|
protected readonly isDisabled: _angular_core.Signal<boolean>;
|