@semantic-components/ui 0.11.0 → 0.12.0

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/index.d.ts CHANGED
@@ -46,3 +46,4 @@ export * from './lib/components/command';
46
46
  export * from './lib/components/collapsible';
47
47
  export * from './lib/components/sidebar';
48
48
  export * from './lib/components/autocomplete';
49
+ export * from './lib/components/time-picker';
@@ -1,24 +1,33 @@
1
1
  import { OnInit } from '@angular/core';
2
+ import { ControlValueAccessor } from '@angular/forms';
2
3
  import { WeekDayName } from './util';
3
4
  import * as i0 from "@angular/core";
4
- export declare class ScCalendar implements OnInit {
5
+ export declare class ScCalendar implements OnInit, ControlValueAccessor {
6
+ private readonly _cdr;
5
7
  class: import("@angular/core").InputSignal<string>;
6
8
  classes: import("@angular/core").Signal<string>;
7
9
  private readonly localeId;
10
+ date: import("@angular/core").Signal<Date>;
8
11
  year: import("@angular/core").WritableSignal<number>;
9
12
  month: import("@angular/core").WritableSignal<number>;
10
13
  weekDaysNames: import("@angular/core").WritableSignal<WeekDayName[]>;
11
14
  monthYear: import("@angular/core").Signal<string>;
12
15
  monthDays: import("@angular/core").Signal<string[]>;
13
16
  firstDayMonth: import("@angular/core").Signal<number>;
14
- selectedDay: import("@angular/core").WritableSignal<string>;
15
- ngOnInit(): void;
16
- init(): void;
17
+ value: import("@angular/core").ModelSignal<string>;
17
18
  setSelectedDay(day: string): void;
19
+ _onChange: (value: string) => void;
20
+ _onTouched: () => void;
21
+ writeValue(value: string): void;
22
+ registerOnChange(fn: (value: string) => void): void;
23
+ registerOnTouched(fn: () => void): void;
24
+ private readonly _disabledByCva;
25
+ setDisabledState?(isDisabled: boolean): void;
26
+ ngOnInit(): void;
18
27
  private setLocaleDayNames;
19
28
  private getFirstDayOfWeek;
20
29
  setMonthYear(n: number): void;
21
30
  twoDigits(n: number): string;
22
31
  static ɵfac: i0.ɵɵFactoryDeclaration<ScCalendar, never>;
23
- static ɵcmp: i0.ɵɵComponentDeclaration<ScCalendar, "sc-calendar", never, { "class": { "alias": "class"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
32
+ static ɵcmp: i0.ɵɵComponentDeclaration<ScCalendar, "sc-calendar", never, { "class": { "alias": "class"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; }, never, never, true, never>;
24
33
  }
@@ -0,0 +1,9 @@
1
+ import * as i0 from "@angular/core";
2
+ export declare class ScDateInput {
3
+ private readonly el;
4
+ private readonly dateFormatRegExp;
5
+ previousKey: string;
6
+ onKeyDown(event: KeyboardEvent): void;
7
+ static ɵfac: i0.ɵɵFactoryDeclaration<ScDateInput, never>;
8
+ static ɵdir: i0.ɵɵDirectiveDeclaration<ScDateInput, "[scDateInput]", never, {}, {}, never, never, true, never>;
9
+ }
@@ -1,13 +1,9 @@
1
- import { OnInit, OutputEmitterRef } from '@angular/core';
1
+ import { OutputEmitterRef } from '@angular/core';
2
2
  import * as i0 from "@angular/core";
3
- export declare class ScDatePicker implements OnInit {
3
+ export declare class ScDatePicker {
4
4
  class: import("@angular/core").InputSignal<string>;
5
5
  classes: import("@angular/core").Signal<string>;
6
- private host;
7
- private readonly localeId;
8
- dateFormatPattern: import("@angular/core").WritableSignal<string>;
9
- ngOnInit(): void;
10
- getDateFormatPattern(localeId: string): string;
6
+ private readonly host;
11
7
  private readonly _injector;
12
8
  private readonly _dir;
13
9
  private readonly _overlay;
@@ -1,13 +1,13 @@
1
1
  import { OnDestroy, TemplateRef } from '@angular/core';
2
2
  import * as i0 from "@angular/core";
3
3
  export declare class ScHoverCardTriggerFor implements OnDestroy {
4
- private element;
5
- private overlay;
6
- private viewContainer;
4
+ private readonly element;
5
+ private readonly overlay;
6
+ private readonly viewContainer;
7
7
  readonly scHoverCardTriggerFor: import("@angular/core").InputSignal<TemplateRef<unknown>>;
8
8
  private overlayRef;
9
- showTooltip(): void;
10
- hideTooltip(): void;
9
+ showCard(): void;
10
+ hideCard(): void;
11
11
  ngOnDestroy(): void;
12
12
  private attachTooltip;
13
13
  private getPositionStrategy;
@@ -1,4 +1,5 @@
1
1
  import * as i0 from "@angular/core";
2
+ export declare const scInputStyles: import("@angular/core").WritableSignal<string>;
2
3
  export declare class ScInput {
3
4
  class: import("@angular/core").InputSignal<string>;
4
5
  classes: import("@angular/core").Signal<string>;
@@ -1,8 +1,7 @@
1
- import { BreakpointObserver } from '@angular/cdk/layout';
2
1
  import { ScSidebarState } from './sidebar-state';
3
2
  import * as i0 from "@angular/core";
4
3
  export declare class ScSidebar {
5
- private observer;
4
+ private readonly observer;
6
5
  sidebarState: ScSidebarState;
7
6
  class: import("@angular/core").InputSignal<string>;
8
7
  classes: import("@angular/core").Signal<string>;
@@ -14,7 +13,7 @@ export declare class ScSidebar {
14
13
  state: import("@angular/core").Signal<"expanded" | "collapsed">;
15
14
  classes1: import("@angular/core").WritableSignal<string>;
16
15
  classes2: import("@angular/core").WritableSignal<string>;
17
- constructor(observer: BreakpointObserver);
16
+ constructor();
18
17
  static ɵfac: i0.ɵɵFactoryDeclaration<ScSidebar, never>;
19
18
  static ɵcmp: i0.ɵɵComponentDeclaration<ScSidebar, "sc-sidebar", never, { "class": { "alias": "class"; "required": false; "isSignal": true; }; "side": { "alias": "side"; "required": false; "isSignal": true; }; "variant": { "alias": "variant"; "required": false; "isSignal": true; }; "collapsible": { "alias": "collapsible"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
20
19
  }
@@ -0,0 +1 @@
1
+ export * from './time-picker';
@@ -0,0 +1,28 @@
1
+ import { Highlightable } from '@angular/cdk/a11y';
2
+ import * as i0 from "@angular/core";
3
+ export declare class ScTimeOption implements Highlightable {
4
+ /** The unique ID of the option. */
5
+ id: import("@angular/core").WritableSignal<string>;
6
+ class: import("@angular/core").InputSignal<string>;
7
+ _class: import("@angular/core").Signal<string>;
8
+ _active: import("@angular/core").WritableSignal<boolean>;
9
+ _selected: import("@angular/core").WritableSignal<boolean>;
10
+ readonly _disabledByInput: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
11
+ readonly _disabled: import("@angular/core").Signal<boolean>;
12
+ value: import("@angular/core").InputSignal<string | undefined>;
13
+ setActiveStyles(): void;
14
+ setInactiveStyles(): void;
15
+ disabled: boolean | undefined;
16
+ getLabel?(): string;
17
+ private readonly _element;
18
+ /** Gets the host DOM element. */
19
+ _getHostElement(): HTMLElement;
20
+ /** Selects the option. */
21
+ select(): void;
22
+ /** Deselects the option. */
23
+ deselect(): void;
24
+ onClick(): void;
25
+ selected: import("@angular/core").OutputEmitterRef<string | undefined>;
26
+ static ɵfac: i0.ɵɵFactoryDeclaration<ScTimeOption, never>;
27
+ static ɵcmp: i0.ɵɵComponentDeclaration<ScTimeOption, "sc-time-option", never, { "class": { "alias": "class"; "required": false; "isSignal": true; }; "_disabledByInput": { "alias": "disabled"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; }, { "selected": "selected"; }, never, ["*"], true, never>;
28
+ }
@@ -0,0 +1,7 @@
1
+ import * as i0 from "@angular/core";
2
+ export declare class ScTimePickerInput {
3
+ class: import("@angular/core").InputSignal<string>;
4
+ classes: import("@angular/core").Signal<string>;
5
+ static ɵfac: i0.ɵɵFactoryDeclaration<ScTimePickerInput, never>;
6
+ static ɵdir: i0.ɵɵDirectiveDeclaration<ScTimePickerInput, "[scTimePickerInput]", never, { "class": { "alias": "class"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
7
+ }
@@ -0,0 +1,97 @@
1
+ import { InputSignal, OnDestroy, OutputEmitterRef, Signal, TemplateRef } from '@angular/core';
2
+ import { ScTimeOption } from './time-option';
3
+ import * as i0 from "@angular/core";
4
+ /**
5
+ * Time selection option that can be displayed within a `mat-timepicker`.
6
+ */
7
+ export interface MatTimepickerOption<D = unknown> {
8
+ /** Date value of the option. */
9
+ value: D;
10
+ /** Label to show to the user. */
11
+ label: string;
12
+ }
13
+ /** Event emitted when a value is selected in the timepicker. */
14
+ export interface MatTimepickerSelected<D> {
15
+ value: D;
16
+ }
17
+ export declare class ScTimePicker implements OnDestroy {
18
+ class: InputSignal<string>;
19
+ classes: Signal<string>;
20
+ private readonly _overlay;
21
+ private readonly _dir;
22
+ private readonly _viewContainerRef;
23
+ private readonly _injector;
24
+ private readonly _isOpen;
25
+ private readonly _activeDescendant;
26
+ private readonly _input;
27
+ private _overlayRef;
28
+ private _portal;
29
+ private readonly _optionsCacheKey;
30
+ private readonly _localeChanges;
31
+ private _onOpenRender;
32
+ protected _panelTemplate: Signal<TemplateRef<unknown>>;
33
+ protected _timeOptions: readonly MatTimepickerOption<string>[];
34
+ protected _options: Signal<readonly ScTimeOption[]>;
35
+ private readonly _keyManager;
36
+ /**
37
+ * Interval between each option in the timepicker. The value can either be an amount of
38
+ * seconds (e.g. 90) or a number with a unit (e.g. 45m). Supported units are `s` for seconds,
39
+ * `m` for minutes or `h` for hours.
40
+ */
41
+ /**
42
+ * Array of pre-defined options that the user can select from, as an alternative to using the
43
+ * `interval` input. An error will be thrown if both `options` and `interval` are specified.
44
+ */
45
+ readonly options: InputSignal<readonly MatTimepickerOption<string>[] | null>;
46
+ /** Whether the timepicker is open. */
47
+ readonly isOpen: Signal<boolean>;
48
+ /** Emits when the user selects a time. */
49
+ readonly selected: OutputEmitterRef<MatTimepickerSelected<string>>;
50
+ /** Emits when the timepicker is opened. */
51
+ readonly opened: OutputEmitterRef<void>;
52
+ /** Emits when the timepicker is closed. */
53
+ readonly closed: OutputEmitterRef<void>;
54
+ /** ID of the active descendant option. */
55
+ readonly activeDescendant: Signal<string | null>;
56
+ /** Unique ID of the timepicker's panel */
57
+ readonly panelId: string;
58
+ /** Whether ripples within the timepicker should be disabled. */
59
+ /** ARIA label for the timepicker panel. */
60
+ readonly ariaLabel: InputSignal<string | null>;
61
+ /** ID of the label element for the timepicker panel. */
62
+ readonly ariaLabelledby: InputSignal<string | null>;
63
+ /** Whether the timepicker is currently disabled. */
64
+ readonly disabled: Signal<boolean>;
65
+ constructor();
66
+ /** Opens the timepicker. */
67
+ open(): void;
68
+ /** Closes the timepicker. */
69
+ close(): void;
70
+ /** Registers an input with the timepicker. */
71
+ ngOnDestroy(): void;
72
+ /** Selects a specific time value. */
73
+ protected _selectValue(value: string): void;
74
+ /** Gets the value of the `aria-labelledby` attribute. */
75
+ protected _getAriaLabelledby(): string | null;
76
+ /** Creates an overlay reference for the timepicker panel. */
77
+ private _getOverlayRef;
78
+ /** Generates the list of options from which the user can select.. */
79
+ private _generateOptions;
80
+ /**
81
+ * Synchronizes the internal state of the component based on a specific selected date.
82
+ * @param value Currently selected date.
83
+ * @param options Options rendered out in the timepicker.
84
+ * @param fallback Option to set as active if no option is selected.
85
+ */
86
+ private _syncSelectedState;
87
+ /** Handles keyboard events while the overlay is open. */
88
+ private _handleKeydown;
89
+ /** Sets up the logic that updates the timepicker when the locale changes. */
90
+ private _handleLocaleChanges;
91
+ /**
92
+ * Sets up the logic that updates the timepicker when the state of the connected input changes.
93
+ */
94
+ private _handleInputStateChanges;
95
+ static ɵfac: i0.ɵɵFactoryDeclaration<ScTimePicker, never>;
96
+ static ɵcmp: i0.ɵɵComponentDeclaration<ScTimePicker, "sc-time-picker", never, { "class": { "alias": "class"; "required": false; "isSignal": true; }; "options": { "alias": "options"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "aria-label"; "required": false; "isSignal": true; }; "ariaLabelledby": { "alias": "aria-labelledby"; "required": false; "isSignal": true; }; }, { "selected": "selected"; "opened": "opened"; "closed": "closed"; }, never, never, true, never>;
97
+ }
@@ -0,0 +1,2 @@
1
+ import { type ClassValue } from 'clsx';
2
+ export declare function cn(...inputs: ClassValue[]): string;
@@ -1,2 +1,2 @@
1
- import { type ClassValue } from 'clsx';
2
- export declare function cn(...inputs: ClassValue[]): string;
1
+ export * from './css';
2
+ export * from './settings';
@@ -0,0 +1,9 @@
1
+ import * as i0 from "@angular/core";
2
+ export declare class ScSettings {
3
+ dateFormatPattern: import("@angular/core").WritableSignal<string>;
4
+ private readonly localeId;
5
+ constructor();
6
+ getDateFormatPattern(localeId: string): string;
7
+ static ɵfac: i0.ɵɵFactoryDeclaration<ScSettings, never>;
8
+ static ɵprov: i0.ɵɵInjectableDeclaration<ScSettings>;
9
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@semantic-components/ui",
3
- "version": "0.11.0",
3
+ "version": "0.12.0",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"