@juligc99/loro-ui 0.0.8 → 0.0.12
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 +129 -31
- package/fesm2022/juligc99-loro-ui.mjs +102 -145
- package/fesm2022/juligc99-loro-ui.mjs.map +1 -1
- package/package.json +3 -45
- package/styles/_breakpoints.scss +6 -10
- package/types/juligc99-loro-ui.d.ts +26 -31
package/README.md
CHANGED
|
@@ -1,66 +1,164 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Loro UI
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Loro UI is the Angular design system for Al Loro. It contains standalone Angular components, design tokens, icons, images, Storybook documentation and npm publishing configuration.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Requirements
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
- Node `20.19+`, `22.12+` or `24+`
|
|
8
|
+
- npm `10.9+`
|
|
9
|
+
- Angular `21+`
|
|
10
|
+
|
|
11
|
+
Node 22 LTS is recommended for local Storybook work.
|
|
12
|
+
|
|
13
|
+
## Install dependencies
|
|
8
14
|
|
|
9
15
|
```bash
|
|
10
|
-
|
|
16
|
+
npm install
|
|
11
17
|
```
|
|
12
18
|
|
|
13
|
-
|
|
19
|
+
## Development
|
|
14
20
|
|
|
15
21
|
```bash
|
|
16
|
-
|
|
22
|
+
npm run build:loro-ui
|
|
23
|
+
npm run storybook
|
|
17
24
|
```
|
|
18
25
|
|
|
19
|
-
|
|
26
|
+
Stable Storybook run with cache cleanup:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npm run storybook:stable
|
|
30
|
+
```
|
|
20
31
|
|
|
21
|
-
|
|
32
|
+
Build static Storybook:
|
|
22
33
|
|
|
23
34
|
```bash
|
|
24
|
-
|
|
35
|
+
npm run build-storybook:stable
|
|
25
36
|
```
|
|
26
37
|
|
|
27
|
-
|
|
38
|
+
## Package structure
|
|
39
|
+
|
|
40
|
+
```txt
|
|
41
|
+
projects/loro-ui/
|
|
42
|
+
├── .storybook/
|
|
43
|
+
├── scripts/
|
|
44
|
+
├── src/
|
|
45
|
+
│ ├── lib/assets/
|
|
46
|
+
│ ├── lib/components/
|
|
47
|
+
│ ├── lib/design-tokens/
|
|
48
|
+
│ ├── lib/docs/
|
|
49
|
+
│ ├── lib/services/
|
|
50
|
+
│ ├── lib/styles/
|
|
51
|
+
│ ├── public-api.ts
|
|
52
|
+
│ └── styles.scss
|
|
53
|
+
├── ng-package.json
|
|
54
|
+
├── package.json
|
|
55
|
+
└── tsconfig.storybook.json
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Angular best practices used
|
|
28
59
|
|
|
29
|
-
|
|
60
|
+
- Standalone components.
|
|
61
|
+
- Signal inputs/models.
|
|
62
|
+
- `ChangeDetectionStrategy.OnPush`.
|
|
63
|
+
- `@angular/forms/signals` support for reusable form controls.
|
|
64
|
+
- Public API through `projects/loro-ui/src/public-api.ts`.
|
|
65
|
+
- Relative internal imports to avoid broken npm bundles.
|
|
66
|
+
- Sass tokens exported as package assets.
|
|
30
67
|
|
|
31
|
-
|
|
68
|
+
## Sass API
|
|
32
69
|
|
|
33
|
-
|
|
70
|
+
Use breakpoints from the package:
|
|
34
71
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
72
|
+
```scss
|
|
73
|
+
@use '@juligc99/loro-ui/styles/breakpoints' as bp;
|
|
74
|
+
```
|
|
38
75
|
|
|
39
|
-
|
|
40
|
-
```bash
|
|
41
|
-
npm publish
|
|
42
|
-
```
|
|
76
|
+
Use theme tokens globally in an app:
|
|
43
77
|
|
|
44
|
-
|
|
78
|
+
```scss
|
|
79
|
+
@use 'sass:meta';
|
|
45
80
|
|
|
46
|
-
|
|
81
|
+
@include meta.load-css('@juligc99/loro-ui/design-tokens/loro-theme.scss');
|
|
82
|
+
```
|
|
47
83
|
|
|
48
|
-
|
|
84
|
+
Copy package assets in the consuming Angular app if you use images/fonts/icons by path:
|
|
85
|
+
|
|
86
|
+
```json
|
|
87
|
+
{
|
|
88
|
+
"glob": "**/*",
|
|
89
|
+
"input": "node_modules/@juligc99/loro-ui/assets/loro-ui",
|
|
90
|
+
"output": "/assets/loro-ui"
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Publish to npm
|
|
95
|
+
|
|
96
|
+
The workspace root is private and must not be published. The publishable package is generated in `dist/loro-ui`.
|
|
49
97
|
|
|
50
98
|
```bash
|
|
51
|
-
|
|
99
|
+
npm login
|
|
100
|
+
npm run publish:loro-ui:dry
|
|
101
|
+
npm run publish:loro-ui
|
|
52
102
|
```
|
|
53
103
|
|
|
54
|
-
|
|
104
|
+
Manual flow:
|
|
55
105
|
|
|
56
|
-
|
|
106
|
+
```bash
|
|
107
|
+
npm run build:loro-ui
|
|
108
|
+
cd dist/loro-ui
|
|
109
|
+
npm publish --dry-run
|
|
110
|
+
npm publish --access public
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## Versioning
|
|
57
114
|
|
|
58
115
|
```bash
|
|
59
|
-
|
|
116
|
+
npm run version:loro-ui:patch
|
|
117
|
+
npm run publish:loro-ui
|
|
60
118
|
```
|
|
61
119
|
|
|
62
|
-
|
|
120
|
+
The current package version is `0.0.11`.
|
|
63
121
|
|
|
64
|
-
##
|
|
122
|
+
## Consume from an Angular app
|
|
65
123
|
|
|
66
|
-
|
|
124
|
+
```bash
|
|
125
|
+
npm i @juligc99/loro-ui
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
```ts
|
|
129
|
+
import { LoroButton, LoroInput } from '@juligc99/loro-ui';
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
```ts
|
|
133
|
+
@Component({
|
|
134
|
+
standalone: true,
|
|
135
|
+
imports: [LoroButton, LoroInput],
|
|
136
|
+
template: `
|
|
137
|
+
<loro-button label="Guardar" />
|
|
138
|
+
<loro-input label="Email" type="email" />
|
|
139
|
+
`,
|
|
140
|
+
})
|
|
141
|
+
export class ExampleComponent {}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## Quality checks
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
npm run lint:all
|
|
148
|
+
npm run verify
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
## Form controls
|
|
153
|
+
|
|
154
|
+
Form components that represent values implement Angular Signal Forms control contracts:
|
|
155
|
+
|
|
156
|
+
- `LoroInput`, `LoroAuthField`, `LoroTextArea`, `LoroDropdown`, `LoroSegmentedControl`: `FormValueControl<string>`.
|
|
157
|
+
- `LoroCheckbox`, `LoroToggle`: `FormCheckboxControl`.
|
|
158
|
+
|
|
159
|
+
Use them from an app with `FormField` from `@angular/forms/signals`:
|
|
160
|
+
|
|
161
|
+
```html
|
|
162
|
+
<loro-input [formField]="form.email" label="Email" type="email" />
|
|
163
|
+
<loro-checkbox [formField]="form.acceptTerms">Acepto los términos</loro-checkbox>
|
|
164
|
+
```
|