@catarina-ds/angular 0.1.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/README.md ADDED
@@ -0,0 +1,183 @@
1
+ ## Catarina – Design System for Angular
2
+
3
+ **Catarina** is a UI component library for Angular 20.3.x.
4
+ It includes buttons, icons, form controls, panels, and utilities related to _theming_ and icons.
5
+
6
+ The library is published under the name:
7
+
8
+ - **npm package**: `catarina`
9
+ - **Version**: `1.0.1`
10
+
11
+ ---
12
+
13
+ ## Requirements
14
+
15
+ `catarina` declares the following _peerDependencies_:
16
+
17
+ - `@angular/core`: `^20.3.0`
18
+ - `@angular/common`: `^20.3.0`
19
+ - `@angular/cdk`: `^20.2.0` (required for Dialog and Drawer components)
20
+
21
+ And depends on:
22
+
23
+ - `tslib`: `^2.3.0`
24
+
25
+ ---
26
+
27
+ ## Installation
28
+
29
+ In an Angular 20 project:
30
+
31
+ ```bash
32
+ npm install catarina @angular/cdk
33
+ ```
34
+
35
+ It can also be installed with `pnpm` or `yarn` using the same package name.
36
+
37
+ **Note**: `@angular/cdk` is required if you plan to use the `Dialog` or `Drawer` components. These components use CDK Overlay internally to automatically manage overlays, z-index, and scroll.
38
+
39
+ ---
40
+
41
+ ## Public API
42
+
43
+ The `public-api.ts` file exposes the main elements of the design system:
44
+
45
+ - **Design components**:
46
+ - `Icon` (`cat-icon`)
47
+ - `Button` (`cat-button`)
48
+ - Panels (`card`, `accordion`, `accordion-group`)
49
+ - **Form components**:
50
+ - `cat-input`, `color-input`, `select-input`, `date-input`, `file-input`,
51
+ `password-input`, `range-input`, `text-area-input`, `time-input`
52
+ - **Overlays**:
53
+ - `dialog`
54
+ - **Services and directives**:
55
+ - Drag directive (`drag`)
56
+ - Theming utilities
57
+ - **Tokens**:
58
+ - `ICON_PROVIDER`
59
+ - **Icon utilities**:
60
+ - `getIconPath`, `iconList`, `IconName`, `ICON_BASE_PATH`
61
+
62
+ All these symbols are imported directly from the `catarina` package.
63
+
64
+ ---
65
+
66
+ ## Icon configuration
67
+
68
+ `catarina` uses the `ICON_PROVIDER` token to resolve icon paths.
69
+ This token can be configured using the integrated utilities in `catarina`:
70
+
71
+ ```ts
72
+ // app.config.ts
73
+ import { ApplicationConfig } from '@angular/core';
74
+ import { provideHttpClient } from '@angular/common/http';
75
+ import { ICON_PROVIDER as CATARINA_ICON_PROVIDER, getIconPath } from 'catarina';
76
+
77
+ const iconProviderConfig = {
78
+ getPath: getIconPath
79
+ };
80
+
81
+ export const appConfig: ApplicationConfig = {
82
+ providers: [
83
+ provideHttpClient(),
84
+ { provide: CATARINA_ICON_PROVIDER, useValue: iconProviderConfig }
85
+ ]
86
+ };
87
+ ```
88
+
89
+ With this configuration, `catarina` components that use icons resolve paths using the integrated utilities.
90
+
91
+ ### Assets configuration in `angular.json`
92
+
93
+ To use external SVG icons, you need to add the following entry in the `assets` section of `angular.json` so that SVG files are copied to the output directory:
94
+
95
+ ```json
96
+ {
97
+ "projects": {
98
+ "your-project": {
99
+ "architect": {
100
+ "build": {
101
+ "options": {
102
+ "assets": [
103
+ "src/favicon.ico",
104
+ "src/assets",
105
+ {
106
+ "glob": "**/*.svg",
107
+ "input": "node_modules/safirial-icons/assets",
108
+ "output": "safirial-icons"
109
+ }
110
+ ]
111
+ }
112
+ }
113
+ }
114
+ }
115
+ }
116
+ }
117
+ ```
118
+
119
+ **Note**: If you use the `safirial-icons` package from npm, this configuration copies SVG files from `node_modules/safirial-icons/assets` to the `safirial-icons` folder in the output directory. The utilities `getIconPath` and `iconList` are available directly from `catarina` without needing to install `safirial-icons`.
120
+
121
+ ---
122
+
123
+ ## Basic component usage
124
+
125
+ Example usage of `cat-button` and `Icon` within an application component:
126
+
127
+ ```ts
128
+ // app.component.ts
129
+ import { Component } from '@angular/core';
130
+ import { Button as CatarinaButton, Icon as CatarinaIcon } from 'catarina';
131
+
132
+ @Component({
133
+ selector: 'app-root',
134
+ imports: [CatarinaButton, CatarinaIcon],
135
+ template: `
136
+ <cat-button variant="primary" size="md" iconLeft="home">
137
+ Catarina Button
138
+ </cat-button>
139
+
140
+ <cat-icon name="sun" [size]="'32px'"></cat-icon>
141
+ `
142
+ })
143
+ export class AppComponent {}
144
+ ```
145
+
146
+ Icon `name` values must match the names defined in the `iconList` exported from `catarina`. You can import `iconList` for autocomplete and validation:
147
+
148
+ ```ts
149
+ import { iconList, IconName } from 'catarina';
150
+ ```
151
+
152
+ ---
153
+
154
+ ## Building and publishing
155
+
156
+ To compile the library from the workspace:
157
+
158
+ ```bash
159
+ ng build catarina
160
+ ```
161
+
162
+ The output is generated in:
163
+
164
+ ```bash
165
+ dist/catarina
166
+ ```
167
+
168
+ To publish to npm (from the workspace):
169
+
170
+ ```bash
171
+ ng build catarina
172
+ cd dist/catarina
173
+ npm publish
174
+ ```
175
+
176
+ ---
177
+
178
+ ## Language / Idioma
179
+
180
+ This documentation is available in English. For the Spanish version, see [README.en.md](./README.en.md).
181
+
182
+ Esta documentación está disponible en inglés. Para la versión en español, consulta [README.en.md](./README.en.md).
183
+