@besaitech/ng-design-system 0.0.45 → 0.0.47

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
@@ -2703,5 +2703,111 @@ declare class SdsSearchCommand {
2703
2703
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<SdsSearchCommand, "sds-search-command", never, { "items": { "alias": "items"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "showTrigger": { "alias": "showTrigger"; "required": false; "isSignal": true; }; "hotkey": { "alias": "hotkey"; "required": false; "isSignal": true; }; "triggerMinWidth": { "alias": "triggerMinWidth"; "required": false; "isSignal": true; }; "appearance": { "alias": "appearance"; "required": false; "isSignal": true; }; "searchLabel": { "alias": "searchLabel"; "required": false; "isSignal": true; }; "clearLabel": { "alias": "clearLabel"; "required": false; "isSignal": true; }; "emptyLabel": { "alias": "emptyLabel"; "required": false; "isSignal": true; }; "selectHint": { "alias": "selectHint"; "required": false; "isSignal": true; }; "navigateHint": { "alias": "navigateHint"; "required": false; "isSignal": true; }; "closeHint": { "alias": "closeHint"; "required": false; "isSignal": true; }; }, { "select": "select"; "openChange": "openChange"; }, never, never, true, never>;
2704
2704
  }
2705
2705
 
2706
- export { SDS_ICONS, SDS_PHONE_COUNTRIES, SdsAccordion, SdsAccordionContent, SdsAccordionHeader, SdsAccordionPanel, SdsAccordionStore, SdsAvatar, SdsBadge, SdsButton, SdsCalendar, SdsCard, SdsCheckbox, SdsDatePicker, SdsIcon, SdsInput, SdsInputNumber, SdsLocalizedInput, SdsMenuItem, SdsMultiSelect, SdsNavGroup, SdsNavItem, SdsOtpInput, SdsPaginator, SdsPhoneInput, SdsSearchCommand, SdsSelect, SdsSelectEmpty, SdsSelectFooter, SdsSelectOption, SdsShell, SdsSidebar, SdsTab, SdsTabList, SdsTabPanel, SdsTabPanels, SdsTable, SdsTableCell, SdsTableRowExpansion, SdsTabs, SdsTabsStore, SdsTextarea, SdsThemeService, SdsThemeToggle, SdsToastHost, SdsToastService, SdsToggleSwitch, SdsTopbar, SdsUserMenu, SidebarStore, addDays, addMonths, addMonthsKeepDay, formatDdMmYyyy, formatHhMm, isOutOfRange, isSameDay, isoDay, pad2, sdsFormatNational, sdsMatchDialCode, sdsNormalizeSignificant, startOfDay, startOfMonth };
2707
- export type { SdsAccordionActive, SdsAccordionValue, SdsAvatarStatus, SdsBadgeSize, SdsBadgeVariant, SdsButtonShape, SdsButtonSize, SdsButtonVariant, SdsCardVariant, SdsCheckboxSize, SdsDatePickerSize, SdsIconName, SdsIconSize, SdsInputAppearance, SdsInputNumberAppearance, SdsInputNumberButtonLayout, SdsInputNumberCurrencyDisplay, SdsInputNumberMode, SdsInputNumberSize, SdsInputShape, SdsInputSize, SdsInputType, SdsLocalizedInputSize, SdsLocalizedValue, SdsMenuItemTone, SdsMultiSelectDisplay, SdsMultiSelectSize, SdsOtpInputSize, SdsPaginatorSize, SdsPaginatorState, SdsPhoneCountry, SdsPhoneInputSize, SdsPhoneValue, SdsSearchAppearance, SdsSearchItem, SdsSelectAppearance, SdsSelectEmptyContext, SdsSelectFooterContext, SdsSelectOptionContext, SdsSelectSize, SdsShellBackground, SdsSidebarAppearance, SdsSortOrder, SdsTabValue, SdsTableCellContext, SdsTableColumn, SdsTableLazyEvent, SdsTableRowExpansionContext, SdsTableSize, SdsTableSortEvent, SdsTextareaResize, SdsTextareaSize, SdsTheme, SdsThemeToggleAppearance, SdsToast, SdsToastKind, SdsToggleSwitchSize, SdsTopbarAppearance, SdsUserMenuAlign, SdsUserMenuAppearance };
2706
+ type SdsLanguageSwitcherAppearance = 'surface' | 'on-brand';
2707
+ type SdsLanguageSwitcherAlign = 'start' | 'end';
2708
+ type SdsLanguageSwitcherDirection = 'down' | 'up';
2709
+ /**
2710
+ * One selectable language. Pass either this shape or a bare code string in [languages].
2711
+ */
2712
+ interface SdsLanguageOption {
2713
+ /** Language code, e.g. 'fr', 'de', 'en'. Shown uppercased in the trigger. */
2714
+ code: string;
2715
+ /** Human-readable name shown in the list, e.g. 'Français'. Defaults to `code.toUpperCase()`. */
2716
+ label?: string;
2717
+ }
2718
+ /**
2719
+ * The language picker for the top bar: a compact pill (globe icon + the active code) that opens a panel
2720
+ * listing exactly the languages the app supports, each row marked selected for the current one.
2721
+ *
2722
+ * The library owns no i18n engine — every app uses a different one (ngx-translate, Transloco, per-locale
2723
+ * URLs). So this is a pure, controlled control: the app passes the supported [languages] and the [current]
2724
+ * code, and reacts to the choice. `current` is a two-way `model`, so bind `[(current)]="lang"` for optimistic
2725
+ * echo, or just listen to `(currentChange)` and call your own `translate.use($event)`. Rows show each
2726
+ * language's human label (pass it in the option, or let it default to the uppercased code).
2727
+ *
2728
+ * It is a sibling of sds-user-menu / sds-theme-toggle / sds-search-command and shares their chrome: the same
2729
+ * two appearances (`surface` default for a light/glass bar, `on-brand` for the dark brand bar), the same
2730
+ * disclosure mechanics (closes on outside click, on Escape, and on selection, restoring focus to the trigger),
2731
+ * and the same panel styling and open animation — so the three top-bar controls read as one set.
2732
+ *
2733
+ * The panel is appended to `document.body` while open and positioned against the trigger (like sds-select),
2734
+ * so a clipping ancestor — a bar with `overflow:hidden`, or a `glass` bar whose `backdrop-filter` is a
2735
+ * containing block — can never cut it off or paint over it. It repositions on scroll/resize and is removed
2736
+ * on close. Accessibility follows the APG select-only combobox: focus stays on the trigger, and Arrow/Home/
2737
+ * End/Enter/Escape drive a highlighted option surfaced via `aria-activedescendant` (works even though the
2738
+ * listbox lives in `<body>`).
2739
+ *
2740
+ * @example
2741
+ * <sds-language-switcher
2742
+ * [languages]="[{ code: 'fr', label: 'Français' }, { code: 'de', label: 'Deutsch' }, { code: 'en', label: 'English' }]"
2743
+ * [current]="lang()"
2744
+ * menuLabel="Changer de langue"
2745
+ * (currentChange)="translate.use($event)"
2746
+ * />
2747
+ *
2748
+ * @example
2749
+ * <!-- Bare codes are fine; rows fall back to the uppercased code. -->
2750
+ * <sds-language-switcher [languages]="['fr', 'de', 'en']" [(current)]="lang" />
2751
+ */
2752
+ declare class SdsLanguageSwitcher implements OnDestroy {
2753
+ private readonly el;
2754
+ private readonly injector;
2755
+ private readonly trigger;
2756
+ protected readonly panelId: string;
2757
+ /** The supported languages — either `{ code, label }` options or bare code strings. */
2758
+ readonly languages: _angular_core.InputSignal<readonly (string | SdsLanguageOption)[]>;
2759
+ /** The active language code. Two-way: `[(current)]` echoes the choice, or listen to `(currentChange)`. */
2760
+ readonly current: _angular_core.ModelSignal<string>;
2761
+ /** `surface` (default) for a light / glass bar; `on-brand` for the dark brand bar. */
2762
+ readonly appearance: _angular_core.InputSignal<SdsLanguageSwitcherAppearance>;
2763
+ /** Which edge the panel aligns to. `end` (default) hangs it from the right of the trigger. */
2764
+ readonly align: _angular_core.InputSignal<SdsLanguageSwitcherAlign>;
2765
+ /** `up` prefers opening the panel above the trigger — for a switcher near the bottom of the page. */
2766
+ readonly direction: _angular_core.InputSignal<SdsLanguageSwitcherDirection>;
2767
+ /** Accessible name for the trigger and panel. */
2768
+ readonly menuLabel: _angular_core.InputSignal<string>;
2769
+ /** Optional visible header above the list (e.g. "Langue"). Omitted when empty. */
2770
+ readonly heading: _angular_core.InputSignal<string>;
2771
+ readonly openChange: _angular_core.OutputEmitterRef<boolean>;
2772
+ protected readonly open: _angular_core.WritableSignal<boolean>;
2773
+ protected readonly highlightedIndex: _angular_core.WritableSignal<number>;
2774
+ private panelEl;
2775
+ /** Normalise the mixed `languages` input to `{ code, label }`, defaulting the label to the code. */
2776
+ protected readonly options: _angular_core.Signal<SdsLanguageOption[]>;
2777
+ /**
2778
+ * The code treated as active everywhere — trigger label AND the selected row. Falls back to the first
2779
+ * option when `current` is unset, so the pill and the checked row can never disagree.
2780
+ */
2781
+ protected readonly effectiveCode: _angular_core.Signal<string>;
2782
+ /** Uppercased code shown in the trigger. */
2783
+ protected readonly currentCode: _angular_core.Signal<string>;
2784
+ protected readonly activeOptionId: _angular_core.Signal<string | null>;
2785
+ protected optionId(i: number): string;
2786
+ protected toggle(): void;
2787
+ protected openPanel(): void;
2788
+ protected close(returnFocus?: boolean): void;
2789
+ protected choose(code: string): void;
2790
+ protected onDocumentClick(event: MouseEvent): void;
2791
+ protected onEscape(): void;
2792
+ protected onTriggerKeydown(event: KeyboardEvent): void;
2793
+ private initHighlight;
2794
+ private move;
2795
+ private highlight;
2796
+ private chooseHighlighted;
2797
+ private scrollHighlightedIntoView;
2798
+ private readonly reflow;
2799
+ private listening;
2800
+ private addReflowListeners;
2801
+ private removeReflowListeners;
2802
+ private positionPanel;
2803
+ ngOnDestroy(): void;
2804
+ private readonly onBrand;
2805
+ protected readonly triggerClass: _angular_core.Signal<"text-white/85 hover:bg-white/10 hover:text-white focus-visible:ring-white/40" | "bg-muted text-ink-soft hover:bg-brand-50 hover:text-brand-600 focus-visible:ring-brand-500/40">;
2806
+ protected readonly chevronClass: _angular_core.Signal<"text-ink-faint" | "text-white/70">;
2807
+ protected rowClass(index: number, selected: boolean): string;
2808
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<SdsLanguageSwitcher, never>;
2809
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<SdsLanguageSwitcher, "sds-language-switcher", never, { "languages": { "alias": "languages"; "required": false; "isSignal": true; }; "current": { "alias": "current"; "required": false; "isSignal": true; }; "appearance": { "alias": "appearance"; "required": false; "isSignal": true; }; "align": { "alias": "align"; "required": false; "isSignal": true; }; "direction": { "alias": "direction"; "required": false; "isSignal": true; }; "menuLabel": { "alias": "menuLabel"; "required": false; "isSignal": true; }; "heading": { "alias": "heading"; "required": false; "isSignal": true; }; }, { "current": "currentChange"; "openChange": "openChange"; }, never, never, true, never>;
2810
+ }
2811
+
2812
+ export { SDS_ICONS, SDS_PHONE_COUNTRIES, SdsAccordion, SdsAccordionContent, SdsAccordionHeader, SdsAccordionPanel, SdsAccordionStore, SdsAvatar, SdsBadge, SdsButton, SdsCalendar, SdsCard, SdsCheckbox, SdsDatePicker, SdsIcon, SdsInput, SdsInputNumber, SdsLanguageSwitcher, SdsLocalizedInput, SdsMenuItem, SdsMultiSelect, SdsNavGroup, SdsNavItem, SdsOtpInput, SdsPaginator, SdsPhoneInput, SdsSearchCommand, SdsSelect, SdsSelectEmpty, SdsSelectFooter, SdsSelectOption, SdsShell, SdsSidebar, SdsTab, SdsTabList, SdsTabPanel, SdsTabPanels, SdsTable, SdsTableCell, SdsTableRowExpansion, SdsTabs, SdsTabsStore, SdsTextarea, SdsThemeService, SdsThemeToggle, SdsToastHost, SdsToastService, SdsToggleSwitch, SdsTopbar, SdsUserMenu, SidebarStore, addDays, addMonths, addMonthsKeepDay, formatDdMmYyyy, formatHhMm, isOutOfRange, isSameDay, isoDay, pad2, sdsFormatNational, sdsMatchDialCode, sdsNormalizeSignificant, startOfDay, startOfMonth };
2813
+ export type { SdsAccordionActive, SdsAccordionValue, SdsAvatarStatus, SdsBadgeSize, SdsBadgeVariant, SdsButtonShape, SdsButtonSize, SdsButtonVariant, SdsCardVariant, SdsCheckboxSize, SdsDatePickerSize, SdsIconName, SdsIconSize, SdsInputAppearance, SdsInputNumberAppearance, SdsInputNumberButtonLayout, SdsInputNumberCurrencyDisplay, SdsInputNumberMode, SdsInputNumberSize, SdsInputShape, SdsInputSize, SdsInputType, SdsLanguageOption, SdsLanguageSwitcherAlign, SdsLanguageSwitcherAppearance, SdsLanguageSwitcherDirection, SdsLocalizedInputSize, SdsLocalizedValue, SdsMenuItemTone, SdsMultiSelectDisplay, SdsMultiSelectSize, SdsOtpInputSize, SdsPaginatorSize, SdsPaginatorState, SdsPhoneCountry, SdsPhoneInputSize, SdsPhoneValue, SdsSearchAppearance, SdsSearchItem, SdsSelectAppearance, SdsSelectEmptyContext, SdsSelectFooterContext, SdsSelectOptionContext, SdsSelectSize, SdsShellBackground, SdsSidebarAppearance, SdsSortOrder, SdsTabValue, SdsTableCellContext, SdsTableColumn, SdsTableLazyEvent, SdsTableRowExpansionContext, SdsTableSize, SdsTableSortEvent, SdsTextareaResize, SdsTextareaSize, SdsTheme, SdsThemeToggleAppearance, SdsToast, SdsToastKind, SdsToggleSwitchSize, SdsTopbarAppearance, SdsUserMenuAlign, SdsUserMenuAppearance };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@besaitech/ng-design-system",
3
- "version": "0.0.45",
3
+ "version": "0.0.47",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org/",
6
6
  "access": "public"
package/themes/base.css CHANGED
@@ -141,3 +141,35 @@ html.dark {
141
141
  --sds-sidebar-w-collapsed: 76px;
142
142
  }
143
143
  }
144
+
145
+ /* Thin, rounded scrollbars, painted from the theme tokens so they flip with light/dark like everything
146
+ else (instead of the raw UA bar that `color-scheme` alone leaves). Standard properties first for
147
+ Firefox, then the WebKit/Chromium pseudo-elements. Kept in @layer base so an app can still override a
148
+ specific scroll container with an ordinary utility class if it ever needs to. */
149
+ @layer base {
150
+ * {
151
+ scrollbar-width: thin;
152
+ scrollbar-color: var(--color-ink-faint) transparent;
153
+ }
154
+ *::-webkit-scrollbar {
155
+ width: 10px;
156
+ height: 10px;
157
+ }
158
+ *::-webkit-scrollbar-track {
159
+ background: transparent;
160
+ }
161
+ *::-webkit-scrollbar-thumb {
162
+ background-color: var(--color-ink-faint);
163
+ border-radius: 9999px;
164
+ /* A transparent border + padding-box clip insets the thumb into a thin rounded pill with breathing
165
+ room, rather than a bar that fills the whole gutter. */
166
+ border: 3px solid transparent;
167
+ background-clip: padding-box;
168
+ }
169
+ *::-webkit-scrollbar-thumb:hover {
170
+ background-color: var(--color-ink-soft);
171
+ }
172
+ *::-webkit-scrollbar-corner {
173
+ background: transparent;
174
+ }
175
+ }