@thalassic/ui 0.1.1 → 0.2.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/LICENSE.txt +21 -0
- package/features/button/button-size.scss +7 -0
- package/features/button/button.scss +4 -0
- package/features/divider/divider.scss +91 -0
- package/features/form/input/input.scss +6 -0
- package/fesm2022/thalassic-ui.mjs +139 -39
- package/fesm2022/thalassic-ui.mjs.map +1 -1
- package/package.json +1 -1
- package/styles/components/form/{form-control/_form-control-group-size.scss → _form-control-group-size.scss} +7 -0
- package/styles/components/form/{form-control/_form-control-group.scss → _form-control-group.scss} +1 -0
- package/styles/components/form/{form-control/_form-control-size.scss → _form-control-size.scss} +7 -0
- package/styles/components/form/_index.scss +4 -0
- package/types/thalassic-ui.d.ts +98 -17
- package/index.scss +0 -1
- package/styles/components/form/form-control/_index.scss +0 -5
- /package/styles/components/form/{form-control/_form-control-addon.scss → _form-control-addon.scss} +0 -0
- /package/styles/components/form/{form-control/_form-control.scss → _form-control.scss} +0 -0
- /package/styles/{_index.scss → index.scss} +0 -0
package/types/thalassic-ui.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ type controlSize = 'sm' | 'md' | 'lg';
|
|
|
10
10
|
interface tlsUiConfigProvider {
|
|
11
11
|
components: {
|
|
12
12
|
button?: Partial<ButtonConfig>;
|
|
13
|
+
divider?: Partial<DividerConfig>;
|
|
13
14
|
input?: Partial<InputConfig>;
|
|
14
15
|
password?: Partial<PasswordConfig>;
|
|
15
16
|
switch?: Partial<SwitchConfig>;
|
|
@@ -26,21 +27,31 @@ type buttonColor = color;
|
|
|
26
27
|
declare class Button {
|
|
27
28
|
private _routerLink;
|
|
28
29
|
private _config;
|
|
29
|
-
label
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
30
|
+
/** The text label displayed inside the button. Takes priority over projected content. */
|
|
31
|
+
readonly label: InputSignal<string | undefined>;
|
|
32
|
+
readonly type: InputSignal<buttonType>;
|
|
33
|
+
readonly disabled: InputSignalWithTransform<boolean, unknown>;
|
|
34
|
+
/**
|
|
35
|
+
* Icon to display on the button. Accepts:
|
|
36
|
+
* - A string icon name to render a specific icon.
|
|
37
|
+
* - An empty string or boolean `true` to render an icon-only button (using a projected icon).
|
|
38
|
+
* - `false` to render no icon.
|
|
39
|
+
*/
|
|
40
|
+
readonly icon: InputSignalWithTransform<string | boolean, unknown>;
|
|
41
|
+
readonly color: InputSignal<buttonColor>;
|
|
42
|
+
readonly appearance: InputSignal<buttonAppearance>;
|
|
43
|
+
readonly size: InputSignal<buttonSize>;
|
|
44
|
+
/** Whether the button stretches to fill its container's width. */
|
|
45
|
+
readonly fluid: InputSignalWithTransform<boolean, unknown>;
|
|
46
|
+
/** An optional URL that causes the button to render as an anchor link. */
|
|
47
|
+
readonly href: InputSignal<string | null>;
|
|
48
|
+
readonly tabindex: InputSignal<string>;
|
|
38
49
|
protected isLink: i0.Signal<boolean>;
|
|
39
50
|
protected isIconString: i0.Signal<boolean>;
|
|
40
51
|
protected classes: i0.Signal<string[]>;
|
|
41
52
|
protected readonly String: StringConstructor;
|
|
42
53
|
static ɵfac: i0.ɵɵFactoryDeclaration<Button, never>;
|
|
43
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<Button, "tls-button", never, { "label": { "alias": "label"; "required": false; "isSignal": true; }; "type": { "alias": "type"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "icon": { "alias": "icon"; "required": false; "isSignal": true; }; "color": { "alias": "color"; "required": false; "isSignal": true; }; "appearance": { "alias": "appearance"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "href": { "alias": "href"; "required": false; "isSignal": true; }; "tabindex": { "alias": "tabindex"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
|
|
54
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<Button, "tls-button", never, { "label": { "alias": "label"; "required": false; "isSignal": true; }; "type": { "alias": "type"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "icon": { "alias": "icon"; "required": false; "isSignal": true; }; "color": { "alias": "color"; "required": false; "isSignal": true; }; "appearance": { "alias": "appearance"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "fluid": { "alias": "fluid"; "required": false; "isSignal": true; }; "href": { "alias": "href"; "required": false; "isSignal": true; }; "tabindex": { "alias": "tabindex"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
|
|
44
55
|
}
|
|
45
56
|
|
|
46
57
|
interface ButtonConfig {
|
|
@@ -48,11 +59,37 @@ interface ButtonConfig {
|
|
|
48
59
|
appearance: buttonAppearance;
|
|
49
60
|
size: buttonSize;
|
|
50
61
|
type: buttonType;
|
|
62
|
+
fluid: boolean;
|
|
51
63
|
}
|
|
52
64
|
declare const DEFAULT_BUTTON_CONFIG: ButtonConfig;
|
|
53
65
|
|
|
54
66
|
declare const BUTTON_CONFIG: InjectionToken<ButtonConfig>;
|
|
55
67
|
|
|
68
|
+
type dividerOrientation = 'horizontal' | 'vertical';
|
|
69
|
+
type dividerContentPosition = 'start' | 'center' | 'end';
|
|
70
|
+
type dividerVariant = 'dashed' | 'dotted' | 'solid';
|
|
71
|
+
|
|
72
|
+
declare class Divider {
|
|
73
|
+
private _config;
|
|
74
|
+
orientation: InputSignal<dividerOrientation>;
|
|
75
|
+
position: InputSignal<dividerContentPosition>;
|
|
76
|
+
variant: InputSignal<dividerVariant>;
|
|
77
|
+
flush: InputSignalWithTransform<boolean, unknown>;
|
|
78
|
+
protected hostClasses: i0.Signal<string[]>;
|
|
79
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<Divider, never>;
|
|
80
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<Divider, "tls-divider", never, { "orientation": { "alias": "orientation"; "required": false; "isSignal": true; }; "position": { "alias": "position"; "required": false; "isSignal": true; }; "variant": { "alias": "variant"; "required": false; "isSignal": true; }; "flush": { "alias": "flush"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
interface DividerConfig {
|
|
84
|
+
orientation: dividerOrientation;
|
|
85
|
+
position: dividerContentPosition;
|
|
86
|
+
variant: dividerVariant;
|
|
87
|
+
flush: boolean;
|
|
88
|
+
}
|
|
89
|
+
declare const DEFAULT_DIVIDER_CONFIG: DividerConfig;
|
|
90
|
+
|
|
91
|
+
declare const DIVIDER_CONFIG: InjectionToken<DividerConfig>;
|
|
92
|
+
|
|
56
93
|
type ErrorMessageFn = (fieldTree?: FieldTree<unknown>) => string;
|
|
57
94
|
type ErrorMessageMap = Record<string, ErrorMessageFn>;
|
|
58
95
|
|
|
@@ -142,16 +179,18 @@ declare class Input extends ValueFormControl<string> {
|
|
|
142
179
|
readonly inputId: InputSignal<string | null>;
|
|
143
180
|
readonly placeholder: InputSignal<string>;
|
|
144
181
|
readonly size: InputSignal<inputSize>;
|
|
182
|
+
readonly fluid: InputSignalWithTransform<boolean, unknown>;
|
|
145
183
|
protected readonly classes: Signal<string[]>;
|
|
146
184
|
protected onInput(event: Event): void;
|
|
147
185
|
static ɵfac: i0.ɵɵFactoryDeclaration<Input, never>;
|
|
148
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<Input, "tls-input", never, { "type": { "alias": "type"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; "inputId": { "alias": "inputId"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; }, never, never, true, never>;
|
|
186
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<Input, "tls-input", never, { "type": { "alias": "type"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; "inputId": { "alias": "inputId"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "fluid": { "alias": "fluid"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; }, never, never, true, never>;
|
|
149
187
|
}
|
|
150
188
|
|
|
151
189
|
interface InputConfig {
|
|
152
190
|
size: inputSize;
|
|
153
191
|
type: string;
|
|
154
192
|
placeholder: string;
|
|
193
|
+
fluid: boolean;
|
|
155
194
|
}
|
|
156
195
|
declare const DEFAULT_INPUT_CONFIG: InputConfig;
|
|
157
196
|
|
|
@@ -171,17 +210,19 @@ declare class Password extends ValueFormControl<string> {
|
|
|
171
210
|
readonly inputId: InputSignal<string | null>;
|
|
172
211
|
readonly placeholder: InputSignal<string>;
|
|
173
212
|
readonly size: InputSignal<inputSize>;
|
|
213
|
+
readonly fluid: InputSignalWithTransform<boolean, unknown>;
|
|
174
214
|
protected readonly classes: Signal<string[]>;
|
|
175
215
|
protected type: Signal<"text" | "password">;
|
|
176
216
|
protected onInput(event: Event): void;
|
|
177
217
|
protected toggle(): void;
|
|
178
218
|
static ɵfac: i0.ɵɵFactoryDeclaration<Password, never>;
|
|
179
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<Password, "tls-password", never, { "value": { "alias": "value"; "required": false; "isSignal": true; }; "visible": { "alias": "visible"; "required": false; "isSignal": true; }; "inputId": { "alias": "inputId"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; "visible": "visibleChange"; }, never, never, true, never>;
|
|
219
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<Password, "tls-password", never, { "value": { "alias": "value"; "required": false; "isSignal": true; }; "visible": { "alias": "visible"; "required": false; "isSignal": true; }; "inputId": { "alias": "inputId"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "fluid": { "alias": "fluid"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; "visible": "visibleChange"; }, never, never, true, never>;
|
|
180
220
|
}
|
|
181
221
|
|
|
182
222
|
interface PasswordConfig {
|
|
183
223
|
size: inputSize;
|
|
184
224
|
placeholder: string;
|
|
225
|
+
fluid: boolean;
|
|
185
226
|
}
|
|
186
227
|
declare const DEFAULT_PASSWORD_CONFIG: PasswordConfig;
|
|
187
228
|
|
|
@@ -252,6 +293,11 @@ declare const ICON_CONFIG: InjectionToken<IconConfig>;
|
|
|
252
293
|
|
|
253
294
|
type themeType = 'light' | 'dark';
|
|
254
295
|
|
|
296
|
+
type themePreference = 'light' | 'dark' | 'system';
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* Service responsible for managing the application's theme (light/dark/system).
|
|
300
|
+
*/
|
|
255
301
|
declare class ThemeService {
|
|
256
302
|
private readonly _config;
|
|
257
303
|
private readonly _document;
|
|
@@ -261,13 +307,48 @@ declare class ThemeService {
|
|
|
261
307
|
private readonly _isBrowser;
|
|
262
308
|
private readonly LS_THEME;
|
|
263
309
|
private _currentTheme;
|
|
310
|
+
private _currentThemePreference;
|
|
264
311
|
constructor();
|
|
312
|
+
/**
|
|
313
|
+
* A readonly signal of the currently applied theme (`'light'` or `'dark'`).
|
|
314
|
+
* Reflects the resolved theme even when the preference is `'system'`.
|
|
315
|
+
*/
|
|
265
316
|
get currentTheme(): Signal<themeType>;
|
|
317
|
+
/**
|
|
318
|
+
* A readonly signal of the user's selected theme preference (`'light'`, `'dark'`, or `'system'`).
|
|
319
|
+
*/
|
|
320
|
+
get currentThemePreference(): Signal<themePreference>;
|
|
321
|
+
/**
|
|
322
|
+
* Toggles between `'light'` and `'dark'` themes based on the currently applied theme.
|
|
323
|
+
* Does not toggle to `'system'`.
|
|
324
|
+
*/
|
|
266
325
|
toggle(): void;
|
|
267
|
-
|
|
326
|
+
/**
|
|
327
|
+
* Sets the theme preference and applies the corresponding theme to the document.
|
|
328
|
+
* When `'system'` is passed, the theme is resolved from the OS color scheme preference.
|
|
329
|
+
*
|
|
330
|
+
* @param preference - The desired theme preference: `'light'`, `'dark'`, or `'system'`.
|
|
331
|
+
*/
|
|
332
|
+
setTheme(preference: themePreference): void;
|
|
333
|
+
/**
|
|
334
|
+
* Applies the given theme to the document root element by toggling theme CSS classes.
|
|
335
|
+
*
|
|
336
|
+
* @param theme - The theme to apply: `'light'` or `'dark'`.
|
|
337
|
+
*/
|
|
338
|
+
private _applyTheme;
|
|
339
|
+
/**
|
|
340
|
+
* Detects the OS-level color scheme preference using the `prefers-color-scheme` media query.
|
|
341
|
+
*
|
|
342
|
+
* @returns `'dark'` if the OS prefers dark mode, otherwise `'light'`.
|
|
343
|
+
*/
|
|
268
344
|
private _detectSystemTheme;
|
|
345
|
+
/**
|
|
346
|
+
* Initializes the theme on app startup (browser only).
|
|
347
|
+
* Reads the stored preference from localStorage, falling back to the configured default.
|
|
348
|
+
* Also registers a listener for OS color scheme changes to reactively update the theme
|
|
349
|
+
* when the preference is `'system'`.
|
|
350
|
+
*/
|
|
269
351
|
private _initTheme;
|
|
270
|
-
private _initDefaultTheme;
|
|
271
352
|
static ɵfac: i0.ɵɵFactoryDeclaration<ThemeService, never>;
|
|
272
353
|
static ɵprov: i0.ɵɵInjectableDeclaration<ThemeService>;
|
|
273
354
|
}
|
|
@@ -276,10 +357,10 @@ declare const provideThalassicUIConfig: (config: tlsUiConfigProvider) => Environ
|
|
|
276
357
|
|
|
277
358
|
interface ThemeConfig {
|
|
278
359
|
localStorageKey: string;
|
|
279
|
-
defaultTheme:
|
|
360
|
+
defaultTheme: themePreference;
|
|
280
361
|
}
|
|
281
362
|
|
|
282
363
|
declare const provideTheme: (config?: Partial<ThemeConfig>) => EnvironmentProviders;
|
|
283
364
|
|
|
284
|
-
export { BUTTON_CONFIG, Button, CHECKBOX_CONFIG, Checkbox, DEFAULT_BUTTON_CONFIG, DEFAULT_CHECKBOX_CONFIG, DEFAULT_FORM_ITEM_CONFIG, DEFAULT_ICON_CONFIG, DEFAULT_INPUT_CONFIG, DEFAULT_PASSWORD_CONFIG, DEFAULT_RADIO_BUTTON_CONFIG, DEFAULT_SWITCH_CONFIG, FORM_ITEM_CONFIG, FormItem, ICON_CONFIG, INPUT_CONFIG, Icon, Input, InputDirective, PASSWORD_CONFIG, Password, RADIO_BUTTON_CONFIG, RadioButton, SWITCH_CONFIG, Switch, ThemeService, provideThalassicUIConfig, provideTheme };
|
|
285
|
-
export type { ButtonConfig, CheckboxConfig, FormItemConfig, IconConfig, InputConfig, PasswordConfig, RadioButtonConfig, SwitchConfig, color, controlSize, themeType, tlsUiConfigProvider };
|
|
365
|
+
export { BUTTON_CONFIG, Button, CHECKBOX_CONFIG, Checkbox, DEFAULT_BUTTON_CONFIG, DEFAULT_CHECKBOX_CONFIG, DEFAULT_DIVIDER_CONFIG, DEFAULT_FORM_ITEM_CONFIG, DEFAULT_ICON_CONFIG, DEFAULT_INPUT_CONFIG, DEFAULT_PASSWORD_CONFIG, DEFAULT_RADIO_BUTTON_CONFIG, DEFAULT_SWITCH_CONFIG, DIVIDER_CONFIG, Divider, FORM_ITEM_CONFIG, FormItem, ICON_CONFIG, INPUT_CONFIG, Icon, Input, InputDirective, PASSWORD_CONFIG, Password, RADIO_BUTTON_CONFIG, RadioButton, SWITCH_CONFIG, Switch, ThemeService, provideThalassicUIConfig, provideTheme };
|
|
366
|
+
export type { ButtonConfig, CheckboxConfig, DividerConfig, FormItemConfig, IconConfig, InputConfig, PasswordConfig, RadioButtonConfig, SwitchConfig, color, controlSize, themePreference, themeType, tlsUiConfigProvider };
|
package/index.scss
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
@forward 'styles';
|
/package/styles/components/form/{form-control/_form-control-addon.scss → _form-control-addon.scss}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|