@besaitech/ng-design-system 0.0.36 → 0.0.37

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
@@ -495,6 +495,10 @@ declare class SdsCard {
495
495
 
496
496
  /** Small, dependency-free date helpers (day-granularity, local time). */
497
497
  declare function startOfDay(d: Date): Date;
498
+ /** Zero-pad a number to two digits (e.g. 9 → "09"). */
499
+ declare function pad2(n: number): string;
500
+ /** Format a date's time-of-day as HH:mm (24h, local time). */
501
+ declare function formatHhMm(d: Date): string;
498
502
  declare function startOfMonth(d: Date): Date;
499
503
  declare function addDays(d: Date, n: number): Date;
500
504
  declare function addMonths(d: Date, n: number): Date;
@@ -531,6 +535,18 @@ declare class SdsCalendar {
531
535
  readonly firstDayOfWeek: _angular_core.InputSignal<0 | 1>;
532
536
  readonly locale: _angular_core.InputSignal<string>;
533
537
  readonly showActions: _angular_core.InputSignal<boolean>;
538
+ /** When true, a time editor (HH:mm, 24h) is shown and the value keeps its time-of-day. */
539
+ readonly showTime: _angular_core.InputSignalWithTransform<boolean, unknown>;
540
+ /** When true, a "done" action is shown (used by the overlay picker to close the panel). */
541
+ readonly showDone: _angular_core.InputSignalWithTransform<boolean, unknown>;
542
+ /** Visible label of the time editor. Translate it in the consuming app. */
543
+ readonly timeLabel: _angular_core.InputSignal<string>;
544
+ /** Accessible name of the hours field (it is a bare numeric input). */
545
+ readonly hoursLabel: _angular_core.InputSignal<string>;
546
+ /** Accessible name of the minutes field. */
547
+ readonly minutesLabel: _angular_core.InputSignal<string>;
548
+ /** Visible text of the "done" action (shown when {@link showDone} is true). */
549
+ readonly doneLabel: _angular_core.InputSignal<string>;
534
550
  /**
535
551
  * Accessible name for the calendar container. French default so existing consumers are unchanged,
536
552
  * but an app serving more than one language MUST translate it.
@@ -553,6 +569,8 @@ declare class SdsCalendar {
553
569
  readonly clearActionLabel: _angular_core.InputSignal<string>;
554
570
  /** Emitted when a concrete date is picked (day click or "Aujourd'hui"). */
555
571
  readonly dateSelect: _angular_core.OutputEmitterRef<Date>;
572
+ /** Emitted when the "done" action is used (see {@link showDone}). */
573
+ readonly done: _angular_core.OutputEmitterRef<void>;
556
574
  protected readonly view: _angular_core.WritableSignal<CalView>;
557
575
  protected readonly viewDate: _angular_core.WritableSignal<Date>;
558
576
  protected readonly focusedDate: _angular_core.WritableSignal<Date>;
@@ -562,6 +580,9 @@ declare class SdsCalendar {
562
580
  protected readonly navBtn = "inline-flex h-8 w-8 items-center justify-center rounded-control text-ink-soft hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand-500";
563
581
  protected readonly titleBtn = "rounded-control px-2 py-1 capitalize hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand-500";
564
582
  protected readonly actionBtn = "rounded-control px-2 py-1 text-xs font-medium text-brand-700 hover:bg-brand-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand-500 disabled:cursor-not-allowed disabled:opacity-40";
583
+ protected readonly doneBtn = "rounded-control bg-brand-600 px-3 py-1 text-xs font-semibold text-white hover:bg-brand-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand-500";
584
+ protected readonly timeInput = "w-8 bg-transparent py-1 text-center text-sm text-ink outline-none disabled:cursor-not-allowed disabled:opacity-40";
585
+ protected readonly stepBtn = "flex h-3.5 w-5 items-center justify-center text-ink-faint transition-colors hover:text-ink focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-30";
565
586
  protected readonly monthLong: _angular_core.Signal<string>;
566
587
  protected readonly yearLabel: _angular_core.Signal<number>;
567
588
  protected readonly decadeStart: _angular_core.Signal<number>;
@@ -583,10 +604,20 @@ declare class SdsCalendar {
583
604
  protected prev(): void;
584
605
  protected next(): void;
585
606
  protected selectDay(d: Date): void;
607
+ /** Carry the previously-selected time-of-day onto a freshly-picked day (only when showTime). */
608
+ private applyTime;
586
609
  protected selectMonth(m: number): void;
587
610
  protected selectYear(y: number): void;
588
611
  protected goToday(): void;
589
612
  protected clear(): void;
613
+ protected readonly hoursText: _angular_core.Signal<string>;
614
+ protected readonly minutesText: _angular_core.Signal<string>;
615
+ protected setHours(raw: string): void;
616
+ protected setMinutes(raw: string): void;
617
+ /** Wrap hours within 0–23; never carries into the day. */
618
+ protected stepHours(delta: number): void;
619
+ /** Wrap minutes within 0–59; never carries into the hour. */
620
+ protected stepMinutes(delta: number): void;
590
621
  protected onGridKeydown(e: KeyboardEvent): void;
591
622
  /** Move focus to the active day cell (called when the panel opens). */
592
623
  focusActiveCell(): void;
@@ -597,7 +628,7 @@ declare class SdsCalendar {
597
628
  protected dayClass(cell: DayCell): string;
598
629
  protected cellClass(selected: boolean, current: boolean, disabled: boolean): string;
599
630
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<SdsCalendar, never>;
600
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<SdsCalendar, "sds-calendar", never, { "value": { "alias": "value"; "required": false; "isSignal": true; }; "min": { "alias": "min"; "required": false; "isSignal": true; }; "max": { "alias": "max"; "required": false; "isSignal": true; }; "firstDayOfWeek": { "alias": "firstDayOfWeek"; "required": false; "isSignal": true; }; "locale": { "alias": "locale"; "required": false; "isSignal": true; }; "showActions": { "alias": "showActions"; "required": false; "isSignal": true; }; "calendarLabel": { "alias": "calendarLabel"; "required": false; "isSignal": true; }; "previousLabel": { "alias": "previousLabel"; "required": false; "isSignal": true; }; "nextLabel": { "alias": "nextLabel"; "required": false; "isSignal": true; }; "todayActionLabel": { "alias": "todayActionLabel"; "required": false; "isSignal": true; }; "clearActionLabel": { "alias": "clearActionLabel"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; "dateSelect": "dateSelect"; }, never, never, true, never>;
631
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<SdsCalendar, "sds-calendar", never, { "value": { "alias": "value"; "required": false; "isSignal": true; }; "min": { "alias": "min"; "required": false; "isSignal": true; }; "max": { "alias": "max"; "required": false; "isSignal": true; }; "firstDayOfWeek": { "alias": "firstDayOfWeek"; "required": false; "isSignal": true; }; "locale": { "alias": "locale"; "required": false; "isSignal": true; }; "showActions": { "alias": "showActions"; "required": false; "isSignal": true; }; "showTime": { "alias": "showTime"; "required": false; "isSignal": true; }; "showDone": { "alias": "showDone"; "required": false; "isSignal": true; }; "timeLabel": { "alias": "timeLabel"; "required": false; "isSignal": true; }; "hoursLabel": { "alias": "hoursLabel"; "required": false; "isSignal": true; }; "minutesLabel": { "alias": "minutesLabel"; "required": false; "isSignal": true; }; "doneLabel": { "alias": "doneLabel"; "required": false; "isSignal": true; }; "calendarLabel": { "alias": "calendarLabel"; "required": false; "isSignal": true; }; "previousLabel": { "alias": "previousLabel"; "required": false; "isSignal": true; }; "nextLabel": { "alias": "nextLabel"; "required": false; "isSignal": true; }; "todayActionLabel": { "alias": "todayActionLabel"; "required": false; "isSignal": true; }; "clearActionLabel": { "alias": "clearActionLabel"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; "dateSelect": "dateSelect"; "done": "done"; }, never, never, true, never>;
601
632
  }
602
633
 
603
634
  type SdsDatePickerSize = 'sm' | 'md' | 'lg';
@@ -627,8 +658,22 @@ declare class SdsDatePicker implements ControlValueAccessor, OnDestroy {
627
658
  readonly clearable: _angular_core.InputSignalWithTransform<boolean, unknown>;
628
659
  readonly showActions: _angular_core.InputSignalWithTransform<boolean, unknown>;
629
660
  readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
630
- /** Custom display formatter (default dd/MM/yyyy). */
661
+ /**
662
+ * When true, the calendar shows a time editor (HH:mm, 24h), the value keeps its time-of-day, and
663
+ * the field displays date + time. The overlay stays open on day-select so the time can be set;
664
+ * a "done" action (and click-away / Escape) closes it.
665
+ */
666
+ readonly showTime: _angular_core.InputSignalWithTransform<boolean, unknown>;
667
+ /** Custom display formatter for the DATE part (default dd/MM/yyyy). The time is appended as HH:mm. */
631
668
  readonly format: _angular_core.InputSignal<(d: Date) => string>;
669
+ /** Visible label of the time editor (forwarded to the calendar). See {@link showTime}. */
670
+ readonly timeLabel: _angular_core.InputSignal<string>;
671
+ /** Accessible name of the hours field (forwarded to the calendar). */
672
+ readonly hoursLabel: _angular_core.InputSignal<string>;
673
+ /** Accessible name of the minutes field (forwarded to the calendar). */
674
+ readonly minutesLabel: _angular_core.InputSignal<string>;
675
+ /** Visible text of the calendar's "done" action, shown in the overlay when {@link showTime}. */
676
+ readonly doneLabel: _angular_core.InputSignal<string>;
632
677
  /**
633
678
  * Accessible name for the clear button. French default so existing consumers are unchanged, but an
634
679
  * app serving more than one language MUST translate it — it is an icon-only control, so this string
@@ -671,6 +716,26 @@ declare class SdsDatePicker implements ControlValueAccessor, OnDestroy {
671
716
  protected close(returnFocus?: boolean): void;
672
717
  protected clear(event: Event): void;
673
718
  protected onCalendarValue(v: Date | null): void;
719
+ /**
720
+ * A day was clicked in the overlay. Without a time editor, a day click is the whole selection, so
721
+ * close. With showTime, the user still needs to set the time, so keep the panel open (they close it
722
+ * with the "done" action, a click away, or Escape).
723
+ */
724
+ protected onDateSelect(): void;
725
+ /**
726
+ * Escape closes the panel and consumes the event while the panel is open, so an ancestor modal does
727
+ * not also dismiss on the same keystroke (mirrors sds-select). When the panel is already closed, the
728
+ * event passes through so Escape can dismiss whatever contains the field.
729
+ */
730
+ protected onEscape(event: Event): void;
731
+ /** The readonly trigger is not a button, so open the overlay on Enter / Space / ArrowDown too. */
732
+ protected onTriggerKeydown(event: Event): void;
733
+ /**
734
+ * Self-contained Tab trap for the overlay. The panel is relocated to document.body, so it sits
735
+ * outside any ancestor modal's focus trap; without this, tabbing off the last control would land on
736
+ * the page behind the dialog. Keeps Tab / Shift+Tab cycling within the panel's own focusables.
737
+ */
738
+ protected onPanelKeydown(event: KeyboardEvent): void;
674
739
  protected onDocumentClick(event: MouseEvent): void;
675
740
  private readonly reflow;
676
741
  private listening;
@@ -686,7 +751,7 @@ declare class SdsDatePicker implements ControlValueAccessor, OnDestroy {
686
751
  registerOnTouched(fn: () => void): void;
687
752
  setDisabledState(isDisabled: boolean): void;
688
753
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<SdsDatePicker, never>;
689
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<SdsDatePicker, "sds-date-picker", never, { "label": { "alias": "label"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "hint": { "alias": "hint"; "required": false; "isSignal": true; }; "error": { "alias": "error"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "min": { "alias": "min"; "required": false; "isSignal": true; }; "max": { "alias": "max"; "required": false; "isSignal": true; }; "firstDayOfWeek": { "alias": "firstDayOfWeek"; "required": false; "isSignal": true; }; "locale": { "alias": "locale"; "required": false; "isSignal": true; }; "inline": { "alias": "inline"; "required": false; "isSignal": true; }; "clearable": { "alias": "clearable"; "required": false; "isSignal": true; }; "showActions": { "alias": "showActions"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "format": { "alias": "format"; "required": false; "isSignal": true; }; "clearLabel": { "alias": "clearLabel"; "required": false; "isSignal": true; }; "openCalendarLabel": { "alias": "openCalendarLabel"; "required": false; "isSignal": true; }; "closeCalendarLabel": { "alias": "closeCalendarLabel"; "required": false; "isSignal": true; }; "panelLabel": { "alias": "panelLabel"; "required": false; "isSignal": true; }; "calendarLabel": { "alias": "calendarLabel"; "required": false; "isSignal": true; }; "previousLabel": { "alias": "previousLabel"; "required": false; "isSignal": true; }; "nextLabel": { "alias": "nextLabel"; "required": false; "isSignal": true; }; "todayActionLabel": { "alias": "todayActionLabel"; "required": false; "isSignal": true; }; "clearActionLabel": { "alias": "clearActionLabel"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
754
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<SdsDatePicker, "sds-date-picker", never, { "label": { "alias": "label"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "hint": { "alias": "hint"; "required": false; "isSignal": true; }; "error": { "alias": "error"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "min": { "alias": "min"; "required": false; "isSignal": true; }; "max": { "alias": "max"; "required": false; "isSignal": true; }; "firstDayOfWeek": { "alias": "firstDayOfWeek"; "required": false; "isSignal": true; }; "locale": { "alias": "locale"; "required": false; "isSignal": true; }; "inline": { "alias": "inline"; "required": false; "isSignal": true; }; "clearable": { "alias": "clearable"; "required": false; "isSignal": true; }; "showActions": { "alias": "showActions"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "showTime": { "alias": "showTime"; "required": false; "isSignal": true; }; "format": { "alias": "format"; "required": false; "isSignal": true; }; "timeLabel": { "alias": "timeLabel"; "required": false; "isSignal": true; }; "hoursLabel": { "alias": "hoursLabel"; "required": false; "isSignal": true; }; "minutesLabel": { "alias": "minutesLabel"; "required": false; "isSignal": true; }; "doneLabel": { "alias": "doneLabel"; "required": false; "isSignal": true; }; "clearLabel": { "alias": "clearLabel"; "required": false; "isSignal": true; }; "openCalendarLabel": { "alias": "openCalendarLabel"; "required": false; "isSignal": true; }; "closeCalendarLabel": { "alias": "closeCalendarLabel"; "required": false; "isSignal": true; }; "panelLabel": { "alias": "panelLabel"; "required": false; "isSignal": true; }; "calendarLabel": { "alias": "calendarLabel"; "required": false; "isSignal": true; }; "previousLabel": { "alias": "previousLabel"; "required": false; "isSignal": true; }; "nextLabel": { "alias": "nextLabel"; "required": false; "isSignal": true; }; "todayActionLabel": { "alias": "todayActionLabel"; "required": false; "isSignal": true; }; "clearActionLabel": { "alias": "clearActionLabel"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
690
755
  }
691
756
 
692
757
  type SdsSelectSize = 'sm' | 'md' | 'lg';
@@ -1871,5 +1936,5 @@ declare class SdsNavItem {
1871
1936
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<SdsNavItem, "sds-nav-item", never, { "icon": { "alias": "icon"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": true; "isSignal": true; }; "link": { "alias": "link"; "required": false; "isSignal": true; }; "exact": { "alias": "exact"; "required": false; "isSignal": true; }; "active": { "alias": "active"; "required": false; "isSignal": true; }; }, { "select": "select"; }, never, never, true, never>;
1872
1937
  }
1873
1938
 
1874
- export { SDS_ICONS, SDS_PHONE_COUNTRIES, SdsAccordion, SdsAccordionContent, SdsAccordionHeader, SdsAccordionPanel, SdsAccordionStore, SdsAvatar, SdsBadge, SdsButton, SdsCalendar, SdsCard, SdsCheckbox, SdsDatePicker, SdsIcon, SdsInput, SdsMultiSelect, SdsNavGroup, SdsNavItem, SdsOtpInput, SdsPaginator, SdsPhoneInput, SdsSelect, SdsShell, SdsSidebar, SdsTab, SdsTabList, SdsTabPanel, SdsTabPanels, SdsTable, SdsTableCell, SdsTableRowExpansion, SdsTabs, SdsTabsStore, SdsTextarea, SdsToggleSwitch, SdsTopbar, SidebarStore, addDays, addMonths, addMonthsKeepDay, formatDdMmYyyy, isOutOfRange, isSameDay, isoDay, sdsFormatNational, sdsMatchDialCode, sdsNormalizeSignificant, startOfDay, startOfMonth };
1939
+ export { SDS_ICONS, SDS_PHONE_COUNTRIES, SdsAccordion, SdsAccordionContent, SdsAccordionHeader, SdsAccordionPanel, SdsAccordionStore, SdsAvatar, SdsBadge, SdsButton, SdsCalendar, SdsCard, SdsCheckbox, SdsDatePicker, SdsIcon, SdsInput, SdsMultiSelect, SdsNavGroup, SdsNavItem, SdsOtpInput, SdsPaginator, SdsPhoneInput, SdsSelect, SdsShell, SdsSidebar, SdsTab, SdsTabList, SdsTabPanel, SdsTabPanels, SdsTable, SdsTableCell, SdsTableRowExpansion, SdsTabs, SdsTabsStore, SdsTextarea, SdsToggleSwitch, SdsTopbar, SidebarStore, addDays, addMonths, addMonthsKeepDay, formatDdMmYyyy, formatHhMm, isOutOfRange, isSameDay, isoDay, pad2, sdsFormatNational, sdsMatchDialCode, sdsNormalizeSignificant, startOfDay, startOfMonth };
1875
1940
  export type { SdsAccordionActive, SdsAccordionValue, SdsAvatarStatus, SdsBadgeSize, SdsBadgeVariant, SdsButtonShape, SdsButtonSize, SdsButtonVariant, SdsCardVariant, SdsCheckboxSize, SdsDatePickerSize, SdsIconName, SdsIconSize, SdsInputAppearance, SdsInputShape, SdsInputSize, SdsInputType, SdsMultiSelectDisplay, SdsMultiSelectSize, SdsOtpInputSize, SdsPaginatorSize, SdsPaginatorState, SdsPhoneCountry, SdsPhoneInputSize, SdsPhoneValue, SdsSelectSize, SdsSortOrder, SdsTabValue, SdsTableCellContext, SdsTableColumn, SdsTableLazyEvent, SdsTableRowExpansionContext, SdsTableSize, SdsTableSortEvent, SdsTextareaResize, SdsTextareaSize, SdsToggleSwitchSize, SdsTopbarAppearance };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@besaitech/ng-design-system",
3
- "version": "0.0.36",
3
+ "version": "0.0.37",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org/",
6
6
  "access": "public"