labx-components 0.1.0 → 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.
Files changed (3) hide show
  1. package/README.md +207 -0
  2. package/package.json +1 -1
  3. package/readme.md +0 -111
package/README.md ADDED
@@ -0,0 +1,207 @@
1
+ # labx-components
2
+
3
+ Web Components library built with [Stencil](https://stenciljs.com/). Includes Angular wrappers and a warm design token system.
4
+
5
+ ## Components
6
+
7
+ | Component | Tag | Description |
8
+ |-----------|-----|-------------|
9
+ | Button | `<labx-button>` | Button with primary, secondary and danger variants |
10
+ | Input | `<labx-input>` | Input with floating label and icon slots |
11
+ | Icon | `<labx-icon>` | Material Symbols icon |
12
+
13
+ ---
14
+
15
+ ## Installation
16
+
17
+ ```bash
18
+ npm install labx-components
19
+ ```
20
+
21
+ ---
22
+
23
+ ## Usage
24
+
25
+ ### Vanilla / HTML
26
+
27
+ Add the font and scripts to your HTML:
28
+
29
+ ```html
30
+ <link rel="stylesheet" href="node_modules/labx-components/dist/labx-components/labx-components.css" />
31
+ <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200" />
32
+ <script type="module" src="node_modules/labx-components/dist/labx-components/labx-components.esm.js"></script>
33
+ ```
34
+
35
+ ```html
36
+ <labx-button label="Guardar"></labx-button>
37
+
38
+ <labx-button label="Eliminar" variant="danger"></labx-button>
39
+
40
+ <labx-input label="Correo">
41
+ <labx-icon slot="icon-left" name="email"></labx-icon>
42
+ </labx-input>
43
+
44
+ <labx-icon name="favorite" filled></labx-icon>
45
+ ```
46
+
47
+ ---
48
+
49
+ ### Angular
50
+
51
+ **1. Register custom elements in `main.ts`:**
52
+
53
+ ```ts
54
+ import { defineCustomElements } from 'labx-components/loader';
55
+ defineCustomElements();
56
+ ```
57
+
58
+ **2. Add styles in `angular.json`:**
59
+
60
+ ```json
61
+ "styles": [
62
+ "node_modules/labx-components/dist/labx-components/labx-components.css"
63
+ ]
64
+ ```
65
+
66
+ **3. Add the Material Symbols font in `index.html`:**
67
+
68
+ ```html
69
+ <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200" />
70
+ ```
71
+
72
+ **4. Import and use the Angular wrappers:**
73
+
74
+ ```ts
75
+ import { LabxButton, LabxInput, LabxIcon } from 'labx-components/angular';
76
+
77
+ @Component({
78
+ standalone: true,
79
+ imports: [LabxButton, LabxInput, LabxIcon],
80
+ template: `
81
+ <labx-button label="Guardar" (labxClick)="save()"></labx-button>
82
+
83
+ <labx-input label="Correo" [value]="email" (labxChange)="email = $event.detail">
84
+ <labx-icon slot="icon-left" name="email"></labx-icon>
85
+ </labx-input>
86
+ `
87
+ })
88
+ export class AppComponent {
89
+ email = '';
90
+ save() {}
91
+ }
92
+ ```
93
+
94
+ **5. Reactive Forms:**
95
+
96
+ ```ts
97
+ import { ReactiveFormsModule, FormControl } from '@angular/forms';
98
+ import { LabxInput } from 'labx-components/angular';
99
+
100
+ @Component({
101
+ imports: [ReactiveFormsModule, LabxInput],
102
+ template: `
103
+ <labx-input label="Correo" [formControl]="emailControl"></labx-input>
104
+ `
105
+ })
106
+ export class AppComponent {
107
+ emailControl = new FormControl('');
108
+ }
109
+ ```
110
+
111
+ ---
112
+
113
+ ## Components API
114
+
115
+ ### `<labx-button>`
116
+
117
+ | Prop | Type | Default | Description |
118
+ |------|------|---------|-------------|
119
+ | `label` | `string` | `'Button'` | Button text |
120
+ | `variant` | `'primary' \| 'secondary' \| 'danger'` | `'primary'` | Visual style |
121
+ | `disabled` | `boolean` | `false` | Disables the button |
122
+ | `type` | `'button' \| 'submit' \| 'reset'` | `'button'` | HTML button type |
123
+
124
+ | Event | Detail | Description |
125
+ |-------|--------|-------------|
126
+ | `labxClick` | `void` | Emitted on click |
127
+
128
+ ---
129
+
130
+ ### `<labx-input>`
131
+
132
+ | Prop | Type | Default | Description |
133
+ |------|------|---------|-------------|
134
+ | `label` | `string` | — | Floating label text |
135
+ | `value` | `string` | `''` | Input value |
136
+ | `type` | `string` | `'text'` | HTML input type |
137
+ | `disabled` | `boolean` | `false` | Disables the input |
138
+ | `error` | `string` | — | Error message shown below |
139
+
140
+ | Slot | Description |
141
+ |------|-------------|
142
+ | `icon-left` | Icon on the left side |
143
+ | `icon-right` | Icon on the right side |
144
+
145
+ | Event | Detail | Description |
146
+ |-------|--------|-------------|
147
+ | `labxChange` | `string` | Emitted on value change |
148
+
149
+ ---
150
+
151
+ ### `<labx-icon>`
152
+
153
+ | Prop | Type | Default | Description |
154
+ |------|------|---------|-------------|
155
+ | `name` | `string` | — | Material Symbols icon name |
156
+ | `size` | `number` | `20` | Size in px |
157
+ | `filled` | `boolean` | `false` | Filled vs outlined style |
158
+
159
+ ---
160
+
161
+ ## Design Tokens
162
+
163
+ CSS custom properties available globally after importing the stylesheet:
164
+
165
+ ```css
166
+ --color-bg-surface
167
+ --color-bg-light
168
+ --color-bg-subtle
169
+ --color-primary
170
+ --color-primary-hover
171
+ --color-primary-light
172
+ --color-text-default
173
+ --color-text-muted
174
+ --color-border
175
+ --color-success
176
+ --color-success-light
177
+ --color-danger
178
+ --color-danger-light
179
+ --color-disabled
180
+ ```
181
+
182
+ ### Utility Classes
183
+
184
+ | Class | Property |
185
+ |-------|----------|
186
+ | `labx-bg-surface` | `background-color: var(--color-bg-surface)` |
187
+ | `labx-bg-light` | `background-color: var(--color-bg-light)` |
188
+ | `labx-bg-subtle` | `background-color: var(--color-bg-subtle)` |
189
+ | `labx-bg-primary` | `background-color: var(--color-primary)` |
190
+ | `labx-bg-success` | `background-color: var(--color-success-light)` |
191
+ | `labx-bg-danger` | `background-color: var(--color-danger-light)` |
192
+ | `labx-text-default` | `color: var(--color-text-default)` |
193
+ | `labx-text-muted` | `color: var(--color-text-muted)` |
194
+ | `labx-text-primary` | `color: var(--color-primary)` |
195
+ | `labx-text-success` | `color: var(--color-success)` |
196
+ | `labx-text-danger` | `color: var(--color-danger)` |
197
+ | `labx-text-disabled` | `color: var(--color-disabled)` |
198
+ | `labx-border` | `border: 1px solid var(--color-border)` |
199
+ | `labx-border-primary` | `border: 1px solid var(--color-primary)` |
200
+ | `labx-border-success` | `border: 1px solid var(--color-success)` |
201
+ | `labx-border-danger` | `border: 1px solid var(--color-danger)` |
202
+
203
+ ---
204
+
205
+ ## License
206
+
207
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "labx-components",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Web Components library built with Stencil. Includes Angular wrappers and design tokens.",
5
5
  "author": "egarcia9543",
6
6
  "license": "MIT",
package/readme.md DELETED
@@ -1,111 +0,0 @@
1
- [![Built With Stencil](https://img.shields.io/badge/-Built%20With%20Stencil-16161d.svg?logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDE5LjIuMSwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCA1MTIgNTEyIiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCA1MTIgNTEyOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI%2BCjxzdHlsZSB0eXBlPSJ0ZXh0L2NzcyI%2BCgkuc3Qwe2ZpbGw6I0ZGRkZGRjt9Cjwvc3R5bGU%2BCjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik00MjQuNywzNzMuOWMwLDM3LjYtNTUuMSw2OC42LTkyLjcsNjguNkgxODAuNGMtMzcuOSwwLTkyLjctMzAuNy05Mi43LTY4LjZ2LTMuNmgzMzYuOVYzNzMuOXoiLz4KPHBhdGggY2xhc3M9InN0MCIgZD0iTTQyNC43LDI5Mi4xSDE4MC40Yy0zNy42LDAtOTIuNy0zMS05Mi43LTY4LjZ2LTMuNkgzMzJjMzcuNiwwLDkyLjcsMzEsOTIuNyw2OC42VjI5Mi4xeiIvPgo8cGF0aCBjbGFzcz0ic3QwIiBkPSJNNDI0LjcsMTQxLjdIODcuN3YtMy42YzAtMzcuNiw1NC44LTY4LjYsOTIuNy02OC42SDMzMmMzNy45LDAsOTIuNywzMC43LDkyLjcsNjguNlYxNDEuN3oiLz4KPC9zdmc%2BCg%3D%3D&colorA=16161d&style=flat-square)](https://stenciljs.com)
2
-
3
- # Stencil Component Starter
4
-
5
- > This is a starter project for building a standalone Web Components using Stencil.
6
-
7
- Stencil is a compiler for building fast web apps using Web Components.
8
-
9
- Stencil combines the best concepts of the most popular frontend frameworks into a compile-time rather than runtime tool. Stencil takes TypeScript, JSX, a tiny virtual DOM layer, efficient one-way data binding, an asynchronous rendering pipeline (similar to React Fiber), and lazy-loading out of the box, and generates 100% standards-based Web Components that run in any browser supporting the Custom Elements specification.
10
-
11
- Stencil components are just Web Components, so they work in any major framework or with no framework at all.
12
-
13
- ## Getting Started
14
-
15
- To start building a new web component using Stencil, clone this repo to a new directory:
16
-
17
- ```bash
18
- git clone https://github.com/stenciljs/component-starter.git my-component
19
- cd my-component
20
- git remote rm origin
21
- ```
22
-
23
- and run:
24
-
25
- ```bash
26
- npm install
27
- npm start
28
- ```
29
-
30
- To build the component for production, run:
31
-
32
- ```bash
33
- npm run build
34
- ```
35
-
36
- To run the unit tests for the components, run:
37
-
38
- ```bash
39
- npm test
40
- ```
41
-
42
- Need help? Check out our docs [here](https://stenciljs.com/docs/my-first-component).
43
-
44
- ## Naming Components
45
-
46
- When creating new component tags, we recommend _not_ using `stencil` in the component name (ex: `<stencil-datepicker>`). This is because the generated component has little to nothing to do with Stencil; it's just a web component!
47
-
48
- Instead, use a prefix that fits your company or any name for a group of related components. For example, all of the [Ionic-generated](https://ionicframework.com/) web components use the prefix `ion`.
49
-
50
- ## Using this component
51
-
52
- There are two strategies we recommend for using web components built with Stencil.
53
-
54
- The first step for all two of these strategies is to [publish to NPM](https://docs.npmjs.com/getting-started/publishing-npm-packages).
55
-
56
- You can read more about these different approaches in the [Stencil docs](https://stenciljs.com/docs/publishing).
57
-
58
- ### Lazy Loading
59
-
60
- If your Stencil project is built with the [`dist`](https://stenciljs.com/docs/distribution) output target, you can import a small bootstrap script that registers all components and allows you to load individual component scripts lazily.
61
-
62
- For example, given your Stencil project namespace is called `my-design-system`, to use `my-component` on any website, inject this into your HTML:
63
-
64
- ```html
65
- <script type="module" src="https://unpkg.com/my-design-system"></script>
66
- <!--
67
- To avoid unpkg.com redirects to the actual file, you can also directly import:
68
- https://unpkg.com/foobar-design-system@0.0.1/dist/foobar-design-system/foobar-design-system.esm.js
69
- -->
70
- <my-component first="Stencil" middle="'Don't call me a framework'" last="JS"></my-component>
71
- ```
72
-
73
- This will only load the necessary scripts needed to render `<my-component />`. Once more components of this package are used, they will automatically be loaded lazily.
74
-
75
- You can also import the script as part of your `node_modules` in your applications entry file:
76
-
77
- ```tsx
78
- import 'foobar-design-system/dist/foobar-design-system/foobar-design-system.esm.js';
79
- ```
80
-
81
- Check out this [Live Demo](https://stackblitz.com/edit/vitejs-vite-y6v26a?file=src%2Fmain.tsx).
82
-
83
- ### Standalone
84
-
85
- If you are using a Stencil component library with `dist-custom-elements`, we recommend importing Stencil components individually in those files where they are needed.
86
-
87
- To export Stencil components as standalone components make sure you have the [`dist-custom-elements`](https://stenciljs.com/docs/custom-elements) output target defined in your `stencil.config.ts`.
88
-
89
- For example, given you'd like to use `<my-component />` as part of a React component, you can import the component directly via:
90
-
91
- ```tsx
92
- import 'foobar-design-system/my-component';
93
-
94
- function App() {
95
- return (
96
- <>
97
- <div>
98
- <my-component
99
- first="Stencil"
100
- middle="'Don't call me a framework'"
101
- last="JS"
102
- ></my-component>
103
- </div>
104
- </>
105
- );
106
- }
107
-
108
- export default App;
109
- ```
110
-
111
- Check out this [Live Demo](https://stackblitz.com/edit/vitejs-vite-b6zuds?file=src%2FApp.tsx).