@besaitech/ng-design-system 0.0.59 → 0.0.60
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 +44 -0
- package/fesm2022/besaitech-ng-design-system.mjs +119 -24
- package/fesm2022/besaitech-ng-design-system.mjs.map +1 -1
- package/index.d.ts +69 -11
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -181,7 +181,7 @@ declare class SdsButton {
|
|
|
181
181
|
* most important control.
|
|
182
182
|
*/
|
|
183
183
|
readonly shape: _angular_core.InputSignal<SdsButtonShape>;
|
|
184
|
-
readonly type: _angular_core.InputSignal<"button" | "
|
|
184
|
+
readonly type: _angular_core.InputSignal<"button" | "submit" | "reset">;
|
|
185
185
|
readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
186
186
|
readonly loading: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
187
187
|
/** Full-width button. */
|
|
@@ -4069,7 +4069,14 @@ declare class SdsToastHost {
|
|
|
4069
4069
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<SdsToastHost, "sds-toast-host", never, { "closeLabel": { "alias": "closeLabel"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
4070
4070
|
}
|
|
4071
4071
|
|
|
4072
|
+
/** The theme actually painted. */
|
|
4072
4073
|
type SdsTheme = 'light' | 'dark';
|
|
4074
|
+
/** The person's choice: an explicit theme, or `system` = follow the OS `prefers-color-scheme`, live. */
|
|
4075
|
+
type SdsThemeMode = 'system' | SdsTheme;
|
|
4076
|
+
/** The localStorage key the mode is persisted under. Also read by the pre-paint boot script (see README). */
|
|
4077
|
+
declare const SDS_THEME_STORAGE_KEY = "sds-theme";
|
|
4078
|
+
/** `true` for the three values {@link SdsThemeMode} accepts — for validating stored or URL-supplied input. */
|
|
4079
|
+
declare function isSdsThemeMode(value: unknown): value is SdsThemeMode;
|
|
4073
4080
|
/**
|
|
4074
4081
|
* Light/dark theme state for the whole app. It owns exactly one thing: the presence of the `.dark`
|
|
4075
4082
|
* class on the document root, which flips every design token defined under `.dark` in the theme CSS
|
|
@@ -4080,25 +4087,35 @@ type SdsTheme = 'light' | 'dark';
|
|
|
4080
4087
|
*
|
|
4081
4088
|
* ```ts
|
|
4082
4089
|
* private readonly theme = inject(SdsThemeService);
|
|
4083
|
-
* this.theme.toggle(); // flip
|
|
4090
|
+
* this.theme.toggle(); // flip (to an explicit light/dark)
|
|
4091
|
+
* this.theme.setMode('system'); // follow the OS again
|
|
4084
4092
|
* this.theme.isDark(); // read (a signal)
|
|
4093
|
+
* this.theme.mode(); // 'system' | 'light' | 'dark'
|
|
4085
4094
|
* ```
|
|
4086
4095
|
*
|
|
4087
|
-
*
|
|
4088
|
-
*
|
|
4089
|
-
*
|
|
4090
|
-
* safe under SSR / prerender (it simply no-ops without a DOM).
|
|
4096
|
+
* Two layers: {@link mode} is the choice (persisted to `localStorage` under `sds-theme`), {@link theme} is
|
|
4097
|
+
* what that resolves to. With no stored choice the mode is `system`, which tracks the OS setting live —
|
|
4098
|
+
* a first-time visitor in dark at the OS level lands in dark, and follows the OS if it flips. Every
|
|
4099
|
+
* browser access is guarded, so the service is safe under SSR / prerender (it simply no-ops without a DOM).
|
|
4091
4100
|
*/
|
|
4092
4101
|
declare class SdsThemeService {
|
|
4093
4102
|
private readonly document;
|
|
4094
|
-
|
|
4103
|
+
/** The person's choice. */
|
|
4104
|
+
readonly mode: _angular_core.WritableSignal<SdsThemeMode>;
|
|
4105
|
+
/** The OS preference, kept live by a `matchMedia` listener. */
|
|
4106
|
+
private readonly systemDark;
|
|
4107
|
+
/** The theme painted: the explicit choice, or the OS one under `system`. */
|
|
4108
|
+
readonly theme: _angular_core.Signal<SdsTheme>;
|
|
4095
4109
|
readonly isDark: _angular_core.Signal<boolean>;
|
|
4096
4110
|
constructor();
|
|
4097
|
-
/** Flip between light and dark. */
|
|
4111
|
+
/** Flip between light and dark (an explicit choice, leaving `system`). */
|
|
4098
4112
|
toggle(): void;
|
|
4099
4113
|
/** Set an explicit theme. */
|
|
4100
4114
|
setTheme(theme: SdsTheme): void;
|
|
4101
|
-
|
|
4115
|
+
/** Set the choice, `system` included. */
|
|
4116
|
+
setMode(mode: SdsThemeMode): void;
|
|
4117
|
+
private initialMode;
|
|
4118
|
+
private queryDark;
|
|
4102
4119
|
private apply;
|
|
4103
4120
|
private readStorage;
|
|
4104
4121
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<SdsThemeService, never>;
|
|
@@ -4139,6 +4156,47 @@ declare class SdsThemeToggle {
|
|
|
4139
4156
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<SdsThemeToggle, "sds-theme-toggle", never, { "size": { "alias": "size"; "required": false; "isSignal": true; }; "appearance": { "alias": "appearance"; "required": false; "isSignal": true; }; "darkLabel": { "alias": "darkLabel"; "required": false; "isSignal": true; }; "lightLabel": { "alias": "lightLabel"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
4140
4157
|
}
|
|
4141
4158
|
|
|
4159
|
+
/**
|
|
4160
|
+
* UI preferences that travel in the URL between apps of one product (sign-in hinge ↔ storefront ↔ back-office,
|
|
4161
|
+
* mobile app → web account page), so the page that opens is in the language and theme the person is in.
|
|
4162
|
+
*
|
|
4163
|
+
* The contract is two optional query params — `lang` (a language code) and `theme` (`system` | `light` |
|
|
4164
|
+
* `dark`). The SENDING side appends them with {@link appendUiPrefs}; the RECEIVING side applies + persists +
|
|
4165
|
+
* strips them before first paint with the inline boot script documented in the README (and mirrored by
|
|
4166
|
+
* {@link readUiPrefs} / {@link stripUiPrefs} for code and tests).
|
|
4167
|
+
*
|
|
4168
|
+
* Never put them inside a nested redirect URL that a server matches exactly (an OAuth `return_to` /
|
|
4169
|
+
* `redirect_uri`): append them to the OUTER URL, and let the receiving app append them to the final redirect.
|
|
4170
|
+
*/
|
|
4171
|
+
interface SdsUiPrefs {
|
|
4172
|
+
/** A language code, e.g. `en`. Omitted / null / empty = not sent. */
|
|
4173
|
+
lang?: string | null;
|
|
4174
|
+
/** The theme CHOICE (`system` stays `system`). Omitted / null = not sent. */
|
|
4175
|
+
theme?: SdsThemeMode | null;
|
|
4176
|
+
}
|
|
4177
|
+
declare const SDS_UI_PREF_LANG_PARAM = "lang";
|
|
4178
|
+
declare const SDS_UI_PREF_THEME_PARAM = "theme";
|
|
4179
|
+
/**
|
|
4180
|
+
* `url` with `lang` / `theme` set on its query (overwriting any present), the fragment kept. Accepts an
|
|
4181
|
+
* absolute URL or a root-relative path (returned root-relative). Invalid themes are dropped, not sent.
|
|
4182
|
+
*
|
|
4183
|
+
* ```ts
|
|
4184
|
+
* appendUiPrefs('https://auth.example/continue#token=abc', { lang: 'fr', theme: 'dark' })
|
|
4185
|
+
* // → 'https://auth.example/continue?lang=fr&theme=dark#token=abc'
|
|
4186
|
+
* ```
|
|
4187
|
+
*/
|
|
4188
|
+
declare function appendUiPrefs(url: string, prefs: SdsUiPrefs): string;
|
|
4189
|
+
/**
|
|
4190
|
+
* The prefs carried by a query string (`location.search`), validated: `lang` only if it is one of
|
|
4191
|
+
* `supportedLangs`, `theme` only if it is a {@link SdsThemeMode}. Anything else reads as absent.
|
|
4192
|
+
*/
|
|
4193
|
+
declare function readUiPrefs(search: string, supportedLangs: readonly string[]): {
|
|
4194
|
+
lang: string | null;
|
|
4195
|
+
theme: SdsThemeMode | null;
|
|
4196
|
+
};
|
|
4197
|
+
/** `url` without the `lang` / `theme` params (everything else, fragment included, untouched). */
|
|
4198
|
+
declare function stripUiPrefs(url: string): string;
|
|
4199
|
+
|
|
4142
4200
|
/** How the rail is painted. `brand` is the dark brand rail; `surface` is a light rail with brand accents. */
|
|
4143
4201
|
type SdsSidebarAppearance = 'brand' | 'surface';
|
|
4144
4202
|
/**
|
|
@@ -4759,5 +4817,5 @@ declare class SdsLanguageSwitcher implements OnDestroy {
|
|
|
4759
4817
|
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>;
|
|
4760
4818
|
}
|
|
4761
4819
|
|
|
4762
|
-
export { SDS_ALLERGENS, SDS_ALLERGEN_ICONS, SDS_ALLERGEN_LABELS_EN, SDS_ICONS, SDS_PHONE_COUNTRIES, SdsAccordion, SdsAccordionContent, SdsAccordionHeader, SdsAccordionPanel, SdsAccordionStore, SdsAddressAutocomplete, SdsAddressExtra, SdsAllergenIcon, SdsAvatar, SdsBadge, SdsBulkBar, SdsButton, SdsCalendar, SdsCard, SdsCheckbox, SdsChecklistRow, SdsChip, SdsChipGroup, SdsDatePicker, SdsFileDrop, SdsIcon, SdsImageCropper, SdsInput, SdsInputNumber, SdsLanguageSwitcher, SdsLocalizedInput, SdsMenu, SdsMenuItem, SdsMenuTrigger, SdsMultiSelect, SdsNavGroup, SdsNavItem, SdsOtpInput, SdsPaginator, SdsPhoneInput, SdsRadio, SdsScore, SdsSearchCommand, SdsSegmented, SdsSelect, SdsSelectEmpty, SdsSelectFooter, SdsSelectOption, SdsShell, SdsSidebar, SdsSortableHandle, SdsSortableItem, SdsSortableList, SdsStatusTile, SdsTab, SdsTabList, SdsTabPanel, SdsTabPanels, SdsTable, SdsTableCell, SdsTableEmpty, SdsTableHeader, SdsTableRowExpansion, SdsTabs, SdsTabsStore, SdsTextarea, SdsThemeService, SdsThemeToggle, SdsTimeInput, SdsToastHost, SdsToastService, SdsToggleSwitch, SdsTopbar, SdsTriStateChip, SdsUserMenu, SidebarStore, addDays, addMonths, addMonthsKeepDay, formatDdMmYyyy, formatHhMm, isOutOfRange, isSameDay, isoDay, pad2, sdsFileMatchesAccept, sdsFormatBytes, sdsFormatNational, sdsMatchDialCode, sdsNormalizeSignificant, startOfDay, startOfMonth };
|
|
4763
|
-
export type { SdsAccordionActive, SdsAccordionValue, SdsAddressAutocompleteAppearance, SdsAddressAutocompleteShape, SdsAddressAutocompleteSize, SdsAddressExtraContext, SdsAddressExtraPosition, SdsAddressLocateFn, SdsAddressSearchFn, SdsAddressSuggestion, SdsAllergen, SdsAvatarShape, SdsAvatarStatus, SdsBadgeSize, SdsBadgeVariant, SdsBulkBarPosition, SdsButtonShape, SdsButtonSize, SdsButtonVariant, SdsCardVariant, SdsCheckboxSize, SdsChecklistStatus, SdsChipOption, SdsChipSize, SdsCropRect, SdsDatePickerSize, SdsFileDropAppearance, SdsFileRejection, SdsFileRejectionReason, SdsIconName, SdsIconSize, SdsImageCropperBlobOptions, SdsImageCropperShape, SdsInputAppearance, SdsInputNumberAppearance, SdsInputNumberButtonLayout, SdsInputNumberCurrencyDisplay, SdsInputNumberMode, SdsInputNumberSize, SdsInputShape, SdsInputSize, SdsInputType, SdsLanguageOption, SdsLanguageSwitcherAlign, SdsLanguageSwitcherAppearance, SdsLanguageSwitcherDirection, SdsLocalizedInputSize, SdsLocalizedValue, SdsMenuAction, SdsMenuAlign, SdsMenuEntry, SdsMenuItemTone, SdsMenuSeparator, SdsMultiSelectDisplay, SdsMultiSelectSize, SdsNavItemBadgeTone, SdsOtpInputSize, SdsPaginatorSize, SdsPaginatorState, SdsPhoneCountry, SdsPhoneInputSize, SdsPhoneValue, SdsRadioSize, SdsScoreSize, SdsScoreTier, SdsScoreVariant, SdsSearchAppearance, SdsSearchItem, SdsSegmentedOption, SdsSegmentedSize, SdsSelectAppearance, SdsSelectEmptyContext, SdsSelectFooterContext, SdsSelectOptionContext, SdsSelectSize, SdsShellBackground, SdsSidebarAppearance, SdsSortOrder, SdsSortableAppearance, SdsSortableItemContext, SdsSortableReorderEvent, SdsStatusTileState, SdsTabValue, SdsTableCellCommitEvent, SdsTableCellContext, SdsTableCellErrors, SdsTableColumn, SdsTableEditTrigger, SdsTableEditor, SdsTableEmptyContext, SdsTableHeaderContext, SdsTableLazyEvent, SdsTableRowExpansionContext, SdsTableSelectOption, SdsTableSize, SdsTableSortEvent, SdsTextareaAppearance, SdsTextareaResize, SdsTextareaSize, SdsTheme, SdsThemeToggleAppearance, SdsTimeInputAppearance, SdsTimeInputSize, SdsToast, SdsToastKind, SdsToggleSwitchSize, SdsTopbarAppearance, SdsTriState, SdsTriStateChipSize, SdsUserMenuAlign, SdsUserMenuAppearance };
|
|
4820
|
+
export { SDS_ALLERGENS, SDS_ALLERGEN_ICONS, SDS_ALLERGEN_LABELS_EN, SDS_ICONS, SDS_PHONE_COUNTRIES, SDS_THEME_STORAGE_KEY, SDS_UI_PREF_LANG_PARAM, SDS_UI_PREF_THEME_PARAM, SdsAccordion, SdsAccordionContent, SdsAccordionHeader, SdsAccordionPanel, SdsAccordionStore, SdsAddressAutocomplete, SdsAddressExtra, SdsAllergenIcon, SdsAvatar, SdsBadge, SdsBulkBar, SdsButton, SdsCalendar, SdsCard, SdsCheckbox, SdsChecklistRow, SdsChip, SdsChipGroup, SdsDatePicker, SdsFileDrop, SdsIcon, SdsImageCropper, SdsInput, SdsInputNumber, SdsLanguageSwitcher, SdsLocalizedInput, SdsMenu, SdsMenuItem, SdsMenuTrigger, SdsMultiSelect, SdsNavGroup, SdsNavItem, SdsOtpInput, SdsPaginator, SdsPhoneInput, SdsRadio, SdsScore, SdsSearchCommand, SdsSegmented, SdsSelect, SdsSelectEmpty, SdsSelectFooter, SdsSelectOption, SdsShell, SdsSidebar, SdsSortableHandle, SdsSortableItem, SdsSortableList, SdsStatusTile, SdsTab, SdsTabList, SdsTabPanel, SdsTabPanels, SdsTable, SdsTableCell, SdsTableEmpty, SdsTableHeader, SdsTableRowExpansion, SdsTabs, SdsTabsStore, SdsTextarea, SdsThemeService, SdsThemeToggle, SdsTimeInput, SdsToastHost, SdsToastService, SdsToggleSwitch, SdsTopbar, SdsTriStateChip, SdsUserMenu, SidebarStore, addDays, addMonths, addMonthsKeepDay, appendUiPrefs, formatDdMmYyyy, formatHhMm, isOutOfRange, isSameDay, isSdsThemeMode, isoDay, pad2, readUiPrefs, sdsFileMatchesAccept, sdsFormatBytes, sdsFormatNational, sdsMatchDialCode, sdsNormalizeSignificant, startOfDay, startOfMonth, stripUiPrefs };
|
|
4821
|
+
export type { SdsAccordionActive, SdsAccordionValue, SdsAddressAutocompleteAppearance, SdsAddressAutocompleteShape, SdsAddressAutocompleteSize, SdsAddressExtraContext, SdsAddressExtraPosition, SdsAddressLocateFn, SdsAddressSearchFn, SdsAddressSuggestion, SdsAllergen, SdsAvatarShape, SdsAvatarStatus, SdsBadgeSize, SdsBadgeVariant, SdsBulkBarPosition, SdsButtonShape, SdsButtonSize, SdsButtonVariant, SdsCardVariant, SdsCheckboxSize, SdsChecklistStatus, SdsChipOption, SdsChipSize, SdsCropRect, SdsDatePickerSize, SdsFileDropAppearance, SdsFileRejection, SdsFileRejectionReason, SdsIconName, SdsIconSize, SdsImageCropperBlobOptions, SdsImageCropperShape, SdsInputAppearance, SdsInputNumberAppearance, SdsInputNumberButtonLayout, SdsInputNumberCurrencyDisplay, SdsInputNumberMode, SdsInputNumberSize, SdsInputShape, SdsInputSize, SdsInputType, SdsLanguageOption, SdsLanguageSwitcherAlign, SdsLanguageSwitcherAppearance, SdsLanguageSwitcherDirection, SdsLocalizedInputSize, SdsLocalizedValue, SdsMenuAction, SdsMenuAlign, SdsMenuEntry, SdsMenuItemTone, SdsMenuSeparator, SdsMultiSelectDisplay, SdsMultiSelectSize, SdsNavItemBadgeTone, SdsOtpInputSize, SdsPaginatorSize, SdsPaginatorState, SdsPhoneCountry, SdsPhoneInputSize, SdsPhoneValue, SdsRadioSize, SdsScoreSize, SdsScoreTier, SdsScoreVariant, SdsSearchAppearance, SdsSearchItem, SdsSegmentedOption, SdsSegmentedSize, SdsSelectAppearance, SdsSelectEmptyContext, SdsSelectFooterContext, SdsSelectOptionContext, SdsSelectSize, SdsShellBackground, SdsSidebarAppearance, SdsSortOrder, SdsSortableAppearance, SdsSortableItemContext, SdsSortableReorderEvent, SdsStatusTileState, SdsTabValue, SdsTableCellCommitEvent, SdsTableCellContext, SdsTableCellErrors, SdsTableColumn, SdsTableEditTrigger, SdsTableEditor, SdsTableEmptyContext, SdsTableHeaderContext, SdsTableLazyEvent, SdsTableRowExpansionContext, SdsTableSelectOption, SdsTableSize, SdsTableSortEvent, SdsTextareaAppearance, SdsTextareaResize, SdsTextareaSize, SdsTheme, SdsThemeMode, SdsThemeToggleAppearance, SdsTimeInputAppearance, SdsTimeInputSize, SdsToast, SdsToastKind, SdsToggleSwitchSize, SdsTopbarAppearance, SdsTriState, SdsTriStateChipSize, SdsUiPrefs, SdsUserMenuAlign, SdsUserMenuAppearance };
|