@thalassic/ui 0.0.1 → 0.1.1
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 +1 -7
- package/features/button/button-appearance.scss +144 -0
- package/features/button/button-color.scss +41 -0
- package/features/button/button-size.scss +47 -0
- package/features/button/button.scss +55 -0
- package/features/form/checkbox/checkbox.scss +95 -0
- package/features/form/input/input.scss +3 -0
- package/features/form/password/password.scss +25 -0
- package/features/form/radio-button/radio-button.scss +103 -0
- package/features/form/switch/switch-color.scss +36 -0
- package/features/form/switch/switch.scss +82 -0
- package/features/form-item/form-item.scss +79 -0
- package/features/icon/icon.scss +15 -0
- package/fesm2022/thalassic-ui.mjs +230 -25
- package/fesm2022/thalassic-ui.mjs.map +1 -1
- package/index.scss +1 -0
- package/package.json +5 -1
- package/styles/_index.scss +1 -0
- package/styles/components/_index.scss +1 -0
- package/styles/components/form/_index.scss +1 -0
- package/styles/components/form/form-control/_form-control-addon.scss +2 -0
- package/styles/components/form/form-control/_form-control-group-size.scss +39 -0
- package/styles/components/form/form-control/_form-control-group.scss +57 -0
- package/styles/components/form/form-control/_form-control-size.scss +39 -0
- package/styles/components/form/form-control/_form-control.scss +45 -0
- package/styles/components/form/form-control/_index.scss +5 -0
- package/styles/mixins/_index.scss +1 -0
- package/styles/mixins/focus-ring.scss +4 -0
- package/types/thalassic-ui.d.ts +94 -21
package/types/thalassic-ui.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { InputSignal, InputSignalWithTransform, InjectionToken,
|
|
2
|
+
import { InputSignal, InputSignalWithTransform, InjectionToken, ModelSignal, Signal, EnvironmentProviders } from '@angular/core';
|
|
3
|
+
import { FieldTree, FormUiControl, WithOptionalFieldTree, ValidationError, FormCheckboxControl, FormValueControl } from '@angular/forms/signals';
|
|
3
4
|
import { SafeHtml } from '@angular/platform-browser';
|
|
4
|
-
import { FormUiControl, WithOptionalFieldTree, ValidationError, FormCheckboxControl, FormValueControl } from '@angular/forms/signals';
|
|
5
5
|
|
|
6
6
|
type color = 'primary' | 'secondary' | 'tertiary' | 'success' | 'info' | 'warning' | 'danger';
|
|
7
7
|
|
|
@@ -13,6 +13,7 @@ interface tlsUiConfigProvider {
|
|
|
13
13
|
input?: Partial<InputConfig>;
|
|
14
14
|
password?: Partial<PasswordConfig>;
|
|
15
15
|
switch?: Partial<SwitchConfig>;
|
|
16
|
+
formItem?: Partial<FormItemConfig>;
|
|
16
17
|
icon?: Partial<IconConfig>;
|
|
17
18
|
};
|
|
18
19
|
}
|
|
@@ -52,25 +53,15 @@ declare const DEFAULT_BUTTON_CONFIG: ButtonConfig;
|
|
|
52
53
|
|
|
53
54
|
declare const BUTTON_CONFIG: InjectionToken<ButtonConfig>;
|
|
54
55
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
private _config;
|
|
58
|
-
iconSrc: InputSignal<string>;
|
|
59
|
-
alt: InputSignal<string>;
|
|
60
|
-
allowedSources: InputSignal<string[]>;
|
|
61
|
-
protected isSvg: Signal<boolean>;
|
|
62
|
-
private _svgContentResource;
|
|
63
|
-
get svgContent(): Signal<SafeHtml>;
|
|
64
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<Icon, never>;
|
|
65
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<Icon, "tls-icon", never, { "iconSrc": { "alias": "iconSrc"; "required": true; "isSignal": true; }; "alt": { "alias": "alt"; "required": false; "isSignal": true; }; "allowedSources": { "alias": "allowedSources"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
66
|
-
}
|
|
56
|
+
type ErrorMessageFn = (fieldTree?: FieldTree<unknown>) => string;
|
|
57
|
+
type ErrorMessageMap = Record<string, ErrorMessageFn>;
|
|
67
58
|
|
|
68
|
-
interface
|
|
69
|
-
|
|
59
|
+
interface FormItemConfig {
|
|
60
|
+
reserveErrorSpace: boolean;
|
|
61
|
+
displayErrors: boolean;
|
|
62
|
+
errorMessages: ErrorMessageMap;
|
|
70
63
|
}
|
|
71
|
-
declare const
|
|
72
|
-
|
|
73
|
-
declare const ICON_CONFIG: InjectionToken<IconConfig>;
|
|
64
|
+
declare const DEFAULT_FORM_ITEM_CONFIG: FormItemConfig;
|
|
74
65
|
|
|
75
66
|
declare abstract class FormControl implements FormUiControl {
|
|
76
67
|
readonly touched: ModelSignal<boolean>;
|
|
@@ -83,14 +74,17 @@ declare abstract class FormControl implements FormUiControl {
|
|
|
83
74
|
readonly dirty: InputSignalWithTransform<boolean, unknown>;
|
|
84
75
|
readonly errors: InputSignal<readonly WithOptionalFieldTree<ValidationError>[]>;
|
|
85
76
|
readonly required: InputSignalWithTransform<boolean, unknown>;
|
|
77
|
+
protected CLASS_NAME: string;
|
|
86
78
|
protected notInteractive: Signal<boolean>;
|
|
87
79
|
protected controlClasses: Signal<string[]>;
|
|
80
|
+
protected baseControlClasses(): string[];
|
|
88
81
|
static ɵfac: i0.ɵɵFactoryDeclaration<FormControl, never>;
|
|
89
82
|
static ɵdir: i0.ɵɵDirectiveDeclaration<FormControl, never, never, { "touched": { "alias": "touched"; "required": false; "isSignal": true; }; "name": { "alias": "name"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "hidden": { "alias": "hidden"; "required": false; "isSignal": true; }; "invalid": { "alias": "invalid"; "required": false; "isSignal": true; }; "pending": { "alias": "pending"; "required": false; "isSignal": true; }; "dirty": { "alias": "dirty"; "required": false; "isSignal": true; }; "errors": { "alias": "errors"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; }, { "touched": "touchedChange"; }, never, never, true, never>;
|
|
90
83
|
}
|
|
91
84
|
|
|
92
85
|
declare abstract class CheckboxFormControl extends FormControl implements FormCheckboxControl {
|
|
93
86
|
abstract readonly checked: ModelSignal<boolean>;
|
|
87
|
+
protected controlClasses: i0.Signal<string[]>;
|
|
94
88
|
static ɵfac: i0.ɵɵFactoryDeclaration<CheckboxFormControl, never>;
|
|
95
89
|
static ɵdir: i0.ɵɵDirectiveDeclaration<CheckboxFormControl, never, never, {}, {}, never, never, true, never>;
|
|
96
90
|
}
|
|
@@ -101,6 +95,44 @@ declare abstract class ValueFormControl<T> extends FormControl implements FormVa
|
|
|
101
95
|
static ɵdir: i0.ɵɵDirectiveDeclaration<ValueFormControl<any>, never, never, {}, {}, never, never, true, never>;
|
|
102
96
|
}
|
|
103
97
|
|
|
98
|
+
declare class FormItem {
|
|
99
|
+
private _config;
|
|
100
|
+
protected control: Signal<FormControl | undefined>;
|
|
101
|
+
label: i0.InputSignal<string | undefined>;
|
|
102
|
+
reserveErrorSpace: i0.InputSignal<boolean>;
|
|
103
|
+
displayErrors: i0.InputSignal<boolean>;
|
|
104
|
+
protected isInvalid: Signal<boolean | undefined>;
|
|
105
|
+
protected isRequired: Signal<boolean>;
|
|
106
|
+
protected classes: Signal<string[]>;
|
|
107
|
+
protected errorMessages: Signal<string[]>;
|
|
108
|
+
protected firstErrorMessage: Signal<string | null>;
|
|
109
|
+
private _getErrorMessages;
|
|
110
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<FormItem, never>;
|
|
111
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<FormItem, "tls-form-item", never, { "label": { "alias": "label"; "required": false; "isSignal": true; }; "reserveErrorSpace": { "alias": "reserveErrorSpace"; "required": false; "isSignal": true; }; "displayErrors": { "alias": "displayErrors"; "required": false; "isSignal": true; }; }, {}, ["control"], ["*"], true, never>;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
declare const FORM_ITEM_CONFIG: InjectionToken<FormItemConfig>;
|
|
115
|
+
|
|
116
|
+
interface CheckboxConfig {
|
|
117
|
+
}
|
|
118
|
+
declare const DEFAULT_CHECKBOX_CONFIG: CheckboxConfig;
|
|
119
|
+
|
|
120
|
+
declare const CHECKBOX_CONFIG: InjectionToken<CheckboxConfig>;
|
|
121
|
+
|
|
122
|
+
declare class Checkbox extends CheckboxFormControl {
|
|
123
|
+
private _config;
|
|
124
|
+
protected CLASS_NAME: string;
|
|
125
|
+
indeterminate: ModelSignal<boolean>;
|
|
126
|
+
readonly checked: ModelSignal<boolean>;
|
|
127
|
+
readonly inputId: InputSignal<string | undefined>;
|
|
128
|
+
readonly tabindex: InputSignal<string | number>;
|
|
129
|
+
protected readonly classes: Signal<string[]>;
|
|
130
|
+
protected toggle(): void;
|
|
131
|
+
protected onKeyboardToggle(event: Event): void;
|
|
132
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<Checkbox, never>;
|
|
133
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<Checkbox, "tls-checkbox", never, { "indeterminate": { "alias": "indeterminate"; "required": false; "isSignal": true; }; "checked": { "alias": "checked"; "required": false; "isSignal": true; }; "inputId": { "alias": "inputId"; "required": false; "isSignal": true; }; "tabindex": { "alias": "tabindex"; "required": false; "isSignal": true; }; }, { "indeterminate": "indeterminateChange"; "checked": "checkedChange"; }, never, never, true, never>;
|
|
134
|
+
}
|
|
135
|
+
|
|
104
136
|
type inputSize = controlSize;
|
|
105
137
|
|
|
106
138
|
declare class Input extends ValueFormControl<string> {
|
|
@@ -155,10 +187,31 @@ declare const DEFAULT_PASSWORD_CONFIG: PasswordConfig;
|
|
|
155
187
|
|
|
156
188
|
declare const PASSWORD_CONFIG: InjectionToken<PasswordConfig>;
|
|
157
189
|
|
|
190
|
+
interface RadioButtonConfig {
|
|
191
|
+
}
|
|
192
|
+
declare const DEFAULT_RADIO_BUTTON_CONFIG: RadioButtonConfig;
|
|
193
|
+
|
|
194
|
+
declare const RADIO_BUTTON_CONFIG: InjectionToken<RadioButtonConfig>;
|
|
195
|
+
|
|
196
|
+
declare class RadioButton extends ValueFormControl<unknown> {
|
|
197
|
+
private _config;
|
|
198
|
+
protected CLASS_NAME: string;
|
|
199
|
+
readonly radioValue: InputSignal<unknown>;
|
|
200
|
+
readonly value: ModelSignal<unknown>;
|
|
201
|
+
readonly inputId: InputSignal<string | undefined>;
|
|
202
|
+
readonly tabindex: InputSignal<string | number>;
|
|
203
|
+
protected readonly checked: Signal<boolean>;
|
|
204
|
+
protected readonly classes: Signal<string[]>;
|
|
205
|
+
protected check(): void;
|
|
206
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<RadioButton, never>;
|
|
207
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<RadioButton, "tls-radio-button", never, { "radioValue": { "alias": "radioValue"; "required": true; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; "inputId": { "alias": "inputId"; "required": false; "isSignal": true; }; "tabindex": { "alias": "tabindex"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; }, never, never, true, never>;
|
|
208
|
+
}
|
|
209
|
+
|
|
158
210
|
type switchColor = color;
|
|
159
211
|
|
|
160
212
|
declare class Switch extends CheckboxFormControl {
|
|
161
213
|
private _config;
|
|
214
|
+
protected CLASS_NAME: string;
|
|
162
215
|
readonly checked: ModelSignal<boolean>;
|
|
163
216
|
readonly inputId: InputSignal<string | undefined>;
|
|
164
217
|
readonly color: InputSignal<switchColor>;
|
|
@@ -177,6 +230,26 @@ declare const DEFAULT_SWITCH_CONFIG: SwitchConfig;
|
|
|
177
230
|
|
|
178
231
|
declare const SWITCH_CONFIG: InjectionToken<SwitchConfig>;
|
|
179
232
|
|
|
233
|
+
declare class Icon {
|
|
234
|
+
private _iconService;
|
|
235
|
+
private _config;
|
|
236
|
+
iconSrc: InputSignal<string>;
|
|
237
|
+
alt: InputSignal<string>;
|
|
238
|
+
allowedSources: InputSignal<string[]>;
|
|
239
|
+
protected isSvg: Signal<boolean>;
|
|
240
|
+
private _svgContentResource;
|
|
241
|
+
get svgContent(): Signal<SafeHtml>;
|
|
242
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<Icon, never>;
|
|
243
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<Icon, "tls-icon", never, { "iconSrc": { "alias": "iconSrc"; "required": true; "isSignal": true; }; "alt": { "alias": "alt"; "required": false; "isSignal": true; }; "allowedSources": { "alias": "allowedSources"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
interface IconConfig {
|
|
247
|
+
allowedSources: string[];
|
|
248
|
+
}
|
|
249
|
+
declare const DEFAULT_ICON_CONFIG: IconConfig;
|
|
250
|
+
|
|
251
|
+
declare const ICON_CONFIG: InjectionToken<IconConfig>;
|
|
252
|
+
|
|
180
253
|
type themeType = 'light' | 'dark';
|
|
181
254
|
|
|
182
255
|
declare class ThemeService {
|
|
@@ -208,5 +281,5 @@ interface ThemeConfig {
|
|
|
208
281
|
|
|
209
282
|
declare const provideTheme: (config?: Partial<ThemeConfig>) => EnvironmentProviders;
|
|
210
283
|
|
|
211
|
-
export { BUTTON_CONFIG, Button, DEFAULT_BUTTON_CONFIG, DEFAULT_ICON_CONFIG, DEFAULT_INPUT_CONFIG, DEFAULT_PASSWORD_CONFIG, DEFAULT_SWITCH_CONFIG, ICON_CONFIG, INPUT_CONFIG, Icon, Input, InputDirective, PASSWORD_CONFIG, Password, SWITCH_CONFIG, Switch, ThemeService, provideThalassicUIConfig, provideTheme };
|
|
212
|
-
export type { ButtonConfig, IconConfig, InputConfig, PasswordConfig, SwitchConfig, color, controlSize, themeType, tlsUiConfigProvider };
|
|
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 };
|