@rt-tools/ui-kit 0.0.27 → 0.0.28
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 +171 -92
- package/package.json +7 -7
- package/rt-tools-ui-kit-0.0.28.tgz +0 -0
- package/rt-tools-ui-kit-0.0.27.tgz +0 -0
package/README.md
CHANGED
|
@@ -1,99 +1,178 @@
|
|
|
1
|
-
#
|
|
2
|
-
Package uses Angular Signals (Angular 16+).
|
|
3
|
-
|
|
4
|
-
## Interfaces & Types
|
|
5
|
-
|
|
6
|
-
* ```typescript
|
|
7
|
-
IDictionary
|
|
8
|
-
```
|
|
9
|
-
* ```typescript
|
|
10
|
-
IntersectionType
|
|
11
|
-
```
|
|
12
|
-
* ```typescript
|
|
13
|
-
Modify
|
|
14
|
-
```
|
|
15
|
-
* ```typescript
|
|
16
|
-
IMapper
|
|
17
|
-
```
|
|
18
|
-
* ```typescript
|
|
19
|
-
Nullable
|
|
20
|
-
```
|
|
21
|
-
* ```typescript
|
|
22
|
-
PartialOmit
|
|
23
|
-
```
|
|
24
|
-
* ```typescript
|
|
25
|
-
Primitive
|
|
26
|
-
```
|
|
27
|
-
* Makes selected props from a record optional
|
|
28
|
-
```typescript
|
|
29
|
-
Optional
|
|
30
|
-
```
|
|
31
|
-
* Get the union type of all the values in an object, array or array-like type
|
|
32
|
-
```typescript
|
|
33
|
-
ValuesType
|
|
34
|
-
```
|
|
1
|
+
# @rt-tools/ui-kit
|
|
35
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/@rt-tools/ui-kit)
|
|
4
|
+
[](https://angular.dev)
|
|
5
|
+
[](https://github.com/Eyhenij/rt-tools/blob/main/LICENSE)
|
|
36
6
|
|
|
37
|
-
|
|
7
|
+
Themeable, signal-based UI components for Angular. Every component is standalone, tree-shakeable,
|
|
8
|
+
and driven by CSS design tokens with built-in light / dark / auto theming and swappable brand
|
|
9
|
+
color schemes.
|
|
38
10
|
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pnpm add @rt-tools/ui-kit
|
|
15
|
+
# or
|
|
16
|
+
npm install @rt-tools/ui-kit
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
`@rt-tools/core`, `@rt-tools/store`, and `@rt-tools/utils` are installed automatically as dependencies.
|
|
20
|
+
|
|
21
|
+
**Peer requirements:** Angular `^22.0.0` (`@angular/core`, `common`, `forms`, `animations`,
|
|
22
|
+
`cdk`, `material`, `router`, `platform-browser`), `rxjs ^7.8.2`, `typescript ^6.0.0`.
|
|
23
|
+
|
|
24
|
+
## Setup
|
|
25
|
+
|
|
26
|
+
Provide the UI configuration once at bootstrap:
|
|
39
27
|
|
|
40
|
-
* ```typescript
|
|
41
|
-
isDateValid(date?: Date): boolean;
|
|
42
|
-
```
|
|
43
|
-
* ```typescript
|
|
44
|
-
dateStringToDate(date: string | Date): Date;
|
|
45
|
-
```
|
|
46
|
-
* Indicates if the arguments are equal
|
|
47
|
-
```typescript
|
|
48
|
-
isEqual<T>(f: T, s: T): boolean;
|
|
49
|
-
```
|
|
50
|
-
* Indicates if the content of two arrays is identical
|
|
51
|
-
```typescript
|
|
52
|
-
areArraysEqual<T>(f: T[], s: T[]): boolean;
|
|
53
|
-
```
|
|
54
|
-
* Indicates if the content of two arrays is identical
|
|
55
|
-
```typescript
|
|
56
|
-
areObjectsEqual<T>(f: T, s: T): boolean;
|
|
57
|
-
```
|
|
58
|
-
* ```typescript
|
|
59
|
-
isNumber<T>(value: T | number | unknown | undefined): value is number;
|
|
60
|
-
```
|
|
61
|
-
* ```typescript
|
|
62
|
-
initToday(): Date;
|
|
63
|
-
```
|
|
64
|
-
* ```typescript
|
|
65
|
-
isToday(date: Date): boolean;
|
|
66
|
-
```
|
|
67
|
-
* Make shallow copy of passed object
|
|
68
|
-
```typescript
|
|
69
|
-
removeFieldFromObject<T extends object, K extends string>(obj: T, key: K): Omit<T, K>;
|
|
70
|
-
```
|
|
71
|
-
* Allow to compare two values by provided comparator
|
|
72
|
-
```typescript
|
|
73
|
-
safeCompare<T>(a: T, b: T, comparator: ComparatorType<T>): number;
|
|
74
|
-
```
|
|
75
|
-
* Allow to safely compare two string values
|
|
76
28
|
```typescript
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
29
|
+
import { bootstrapApplication } from '@angular/platform-browser';
|
|
30
|
+
import { provideRtUi } from '@rt-tools/ui-kit';
|
|
31
|
+
|
|
32
|
+
bootstrapApplication(AppComponent, {
|
|
33
|
+
providers: [
|
|
34
|
+
provideRtUi({
|
|
35
|
+
global: { theme: 'auto', design: 'custom' },
|
|
36
|
+
components: { button: { size: 'md', appearance: 'solid' } },
|
|
37
|
+
}),
|
|
38
|
+
],
|
|
39
|
+
});
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Import the design-token stylesheet so components and your own styles share the same `--rt-*` variables:
|
|
43
|
+
|
|
44
|
+
```scss
|
|
45
|
+
@use '@rt-tools/ui-kit/styles/tokens.css';
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Usage
|
|
49
|
+
|
|
50
|
+
Components are standalone — import only what you use:
|
|
51
|
+
|
|
80
52
|
```typescript
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
53
|
+
import { Component } from '@angular/core';
|
|
54
|
+
import { RtuiButtonComponent } from '@rt-tools/ui-kit';
|
|
55
|
+
|
|
56
|
+
@Component({
|
|
57
|
+
selector: 'app-demo',
|
|
58
|
+
imports: [RtuiButtonComponent],
|
|
59
|
+
template: `
|
|
60
|
+
<rtui-button type="pill" variant="primary" text="Save" icon="check" (click)="save()" />
|
|
61
|
+
`,
|
|
62
|
+
})
|
|
63
|
+
export class DemoComponent {
|
|
64
|
+
save(): void {
|
|
65
|
+
/* ... */
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Components
|
|
71
|
+
|
|
72
|
+
All components use the `rtui-` prefix.
|
|
73
|
+
|
|
74
|
+
| Group | Components |
|
|
75
|
+
| --- | --- |
|
|
76
|
+
| **Actions & forms** | `rtui-button`, `rtui-multi-button`, `rtui-icon`, `rtui-checkbox`, `rtui-toggle`, `rtui-file-upload`, `rtui-image-upload` |
|
|
77
|
+
| **Overlays & feedback** | `rtui-modal`, `rtui-aside`, `rtui-popover`, `rtui-snack-bar`, `rtui-spinner`, `rtui-info-badge` |
|
|
78
|
+
| **Data display** | `rtui-table`, `rtui-dynamic-list`, `rtui-dynamic-selector`, `rtui-dynamic-input`, `rtui-pagination` |
|
|
79
|
+
| **Layout & navigation** | `rtui-header`, `rtui-toolbar`, `rtui-side-menu`, `rtui-scrollable`, `rtui-action-bar` |
|
|
80
|
+
|
|
81
|
+
### `rtui-button`
|
|
82
|
+
|
|
83
|
+
The button is fully configurable through inputs (all with sensible defaults):
|
|
84
|
+
|
|
85
|
+
| Input | Type | Default |
|
|
86
|
+
| --- | --- | --- |
|
|
87
|
+
| `type` | `'icon' \| 'fab' \| 'pill'` | `'icon'` |
|
|
88
|
+
| `variant` | `'default' \| 'primary' \| 'danger' \| 'success' \| 'warning' \| 'accent'` | `'default'` |
|
|
89
|
+
| `appearance` | `'solid' \| 'outline' \| 'light' \| 'text'` | config / `'solid'` |
|
|
90
|
+
| `size` | `'xs' \| 'sm' \| 'md' \| 'lg'` | config / `'md'` |
|
|
91
|
+
| `radius` | `'none' \| 'sm' \| 'md' \| 'lg' \| 'full'` | config / `'full'` |
|
|
92
|
+
| `design` | `'custom' \| 'material'` | config / `'custom'` |
|
|
93
|
+
| `icon` / `iconPosition` | `string` / `'start' \| 'end'` | `''` / `'start'` |
|
|
94
|
+
| `text` | `string` | `''` |
|
|
95
|
+
| `loading` / `disabled` | `boolean` | `false` |
|
|
96
|
+
|
|
97
|
+
```html
|
|
98
|
+
<rtui-button type="pill" variant="primary" appearance="outline" text="Confirm" icon="check" />
|
|
99
|
+
<rtui-button type="icon" icon="delete" variant="danger" />
|
|
100
|
+
<rtui-button type="pill" text="Loading" [loading]="true" />
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Theming
|
|
104
|
+
|
|
105
|
+
`RtThemeService` controls the active mode and brand palette from anywhere:
|
|
106
|
+
|
|
85
107
|
```typescript
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
108
|
+
import { inject } from '@angular/core';
|
|
109
|
+
import { RtThemeService } from '@rt-tools/ui-kit';
|
|
110
|
+
|
|
111
|
+
const theme = inject(RtThemeService);
|
|
112
|
+
|
|
113
|
+
theme.setTheme('dark'); // 'light' | 'dark' | 'auto'
|
|
114
|
+
theme.toggle();
|
|
115
|
+
|
|
116
|
+
// Register and activate a brand color scheme (tonal ramp, 0–100)
|
|
117
|
+
theme.registerColorScheme('teal', {
|
|
118
|
+
primary: { 40: '#5cb8b5', 60: '#1a9d99', 100: '#008582' },
|
|
119
|
+
brand: { 100: '#008582' },
|
|
120
|
+
});
|
|
121
|
+
theme.setColorScheme('teal'); // pass null to reset to the default palette
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Accent roles a scheme may override: `primary`, `info`, `success`, `warning`, `danger`, `brand`.
|
|
125
|
+
One ramp serves both light and dark — the active mode selects the tone. The chosen theme and
|
|
126
|
+
scheme are persisted per user.
|
|
127
|
+
|
|
128
|
+
## Configuration resolution
|
|
129
|
+
|
|
130
|
+
Defaults are resolved most-specific-first:
|
|
131
|
+
|
|
132
|
+
1. the component input on a concrete instance,
|
|
133
|
+
2. `components.<name>` in `provideRtUi()`,
|
|
134
|
+
3. `global` in `provideRtUi()`,
|
|
135
|
+
4. the library default.
|
|
136
|
+
|
|
137
|
+
## Design modes
|
|
138
|
+
|
|
139
|
+
Design-aware controls render in one of two modes:
|
|
140
|
+
|
|
141
|
+
- **`custom`** — the native rt-tools look driven by design tokens (default).
|
|
142
|
+
- **`material`** — the control renders as a real Angular Material component, so it matches
|
|
143
|
+
surrounding Material UI while you migrate.
|
|
144
|
+
|
|
145
|
+
```html
|
|
146
|
+
<rtui-button design="material" type="pill" text="Native Material" />
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## Using Material Symbols icons
|
|
150
|
+
|
|
151
|
+
`rtui-icon` (and icon-bearing components) render [Material Symbols](https://fonts.google.com/icons):
|
|
152
|
+
|
|
153
|
+
1. Add the font to `index.html`:
|
|
154
|
+
|
|
155
|
+
```html
|
|
156
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" />
|
|
157
|
+
<link
|
|
158
|
+
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200&display=block"
|
|
159
|
+
rel="stylesheet" />
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
2. Set the default font set in your root component:
|
|
163
|
+
|
|
164
|
+
```typescript
|
|
165
|
+
import { inject } from '@angular/core';
|
|
166
|
+
import { MatIconRegistry } from '@angular/material/icon';
|
|
167
|
+
|
|
168
|
+
inject(MatIconRegistry).setDefaultFontSetClass('material-symbols-outlined');
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
## Documentation
|
|
172
|
+
|
|
173
|
+
Full API references and live examples are available in **Storybook** (`pnpm run storybook` in the
|
|
174
|
+
[repository](https://github.com/Eyhenij/rt-tools)).
|
|
175
|
+
|
|
176
|
+
## License
|
|
177
|
+
|
|
178
|
+
[Apache-2.0](https://github.com/Eyhenij/rt-tools/blob/main/LICENSE) © Yauheni Krumin
|
package/package.json
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rt-tools/ui-kit",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.28",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"author": "Yauheni Krumin",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"tslib": "^2.8.0",
|
|
9
|
-
"@rt-tools/core": "^0.0.
|
|
10
|
-
"@rt-tools/store": "^0.0.
|
|
11
|
-
"@rt-tools/utils": "^0.0.
|
|
9
|
+
"@rt-tools/core": "^0.0.6",
|
|
10
|
+
"@rt-tools/store": "^0.0.7",
|
|
11
|
+
"@rt-tools/utils": "^0.0.8"
|
|
12
12
|
},
|
|
13
13
|
"peerDependencies": {
|
|
14
|
-
"@rt-tools/core": "^0.0.
|
|
15
|
-
"@rt-tools/store": "^0.0.
|
|
16
|
-
"@rt-tools/utils": "^0.0.
|
|
14
|
+
"@rt-tools/core": "^0.0.6",
|
|
15
|
+
"@rt-tools/store": "^0.0.7",
|
|
16
|
+
"@rt-tools/utils": "^0.0.8",
|
|
17
17
|
"@angular/animations": "^22.0.0",
|
|
18
18
|
"@angular/cdk": "^22.0.0",
|
|
19
19
|
"@angular/common": "^22.0.0",
|
|
Binary file
|
|
Binary file
|