@duyluonganduin/acl-web-components 0.0.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 ADDED
@@ -0,0 +1,187 @@
1
+ # acl-web-components
2
+
3
+ A native Web Components library built with [Lit](https://lit.dev) and TypeScript for the Anduin design system.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install acl-web-components
9
+ ```
10
+
11
+ ---
12
+
13
+ ## Setup
14
+
15
+ ### 1. Import the components
16
+
17
+ ```js
18
+ import 'acl-web-components'
19
+ ```
20
+
21
+ ### 2. Import design tokens (required)
22
+
23
+ The tokens file sets all CSS custom properties (`--color-*`, `--text-*`, etc.) on `:root`. It must be imported once at your app root.
24
+
25
+ ```css
26
+ @import 'acl-web-components/tokens.css';
27
+ ```
28
+
29
+ Or in JS:
30
+
31
+ ```js
32
+ import 'acl-web-components/tokens.css'
33
+ ```
34
+
35
+ ---
36
+
37
+ ## Tailwind Integration
38
+
39
+ ### Tailwind v3
40
+
41
+ Add the preset to extend your Tailwind theme with all design tokens:
42
+
43
+ ```js
44
+ // tailwind.config.js
45
+ import aclPreset from 'acl-web-components/tailwind-preset'
46
+
47
+ export default {
48
+ presets: [aclPreset],
49
+ content: ['./src/**/*.{html,js,ts,jsx,tsx}'],
50
+ }
51
+ ```
52
+
53
+ ```css
54
+ /* main.css */
55
+ @import 'acl-web-components/tokens.css';
56
+ @tailwind base;
57
+ @tailwind components;
58
+ @tailwind utilities;
59
+ ```
60
+
61
+ ### Tailwind v4
62
+
63
+ Import the CSS theme bridge instead of a config preset:
64
+
65
+ ```css
66
+ /* main.css */
67
+ @import "tailwindcss";
68
+ @import "acl-web-components/tokens.css";
69
+ @import "acl-web-components/tailwind-theme.css";
70
+ ```
71
+
72
+ No `tailwind.config.js` changes needed.
73
+
74
+ ### Using token-based utility classes
75
+
76
+ Once set up, you can use token values directly as Tailwind classes:
77
+
78
+ ```html
79
+ <p class="text-13 font-medium text-primary-4 leading-20">Heading</p>
80
+ <div class="bg-gray-1 rounded-lg shadow-2 p-16 gap-8 flex">...</div>
81
+ <span class="text-danger-4 font-semibold">Error message</span>
82
+ ```
83
+
84
+ ---
85
+
86
+ ## Components
87
+
88
+ Use components directly in HTML — they work in any framework since they are standard custom elements.
89
+
90
+ ```html
91
+ <acl-button appearance="filled" variant="primary">Save</acl-button>
92
+ <acl-input placeholder="Search..." />
93
+ <acl-spinner size="small"></acl-spinner>
94
+ ```
95
+
96
+ ### Framework integration
97
+
98
+ **React:**
99
+
100
+ ```jsx
101
+ import 'acl-web-components'
102
+ import 'acl-web-components/tokens.css'
103
+
104
+ export default function App() {
105
+ return (
106
+ <div>
107
+ <acl-button appearance="filled" variant="primary">Click me</acl-button>
108
+ <acl-input placeholder="Enter text..." />
109
+ </div>
110
+ )
111
+ }
112
+ ```
113
+
114
+ **Vue:**
115
+
116
+ ```vue
117
+ <script setup>
118
+ import 'acl-web-components'
119
+ import 'acl-web-components/tokens.css'
120
+ </script>
121
+
122
+ <template>
123
+ <acl-button appearance="filled" variant="primary">Click me</acl-button>
124
+ <acl-input placeholder="Enter text..." />
125
+ </template>
126
+ ```
127
+
128
+ ---
129
+
130
+ ## Component Reference
131
+
132
+ | Component | Tag | Key Attributes |
133
+ |---|---|---|
134
+ | Badge | `<acl-badge>` | `variant` |
135
+ | Badge Count | `<acl-badge-count>` | `variant`, `count` |
136
+ | Button | `<acl-button>` | `appearance`, `variant` (default: `gray0`), `size`, `disabled`, `loading`, `href`, `pill`, `full-width`, `start-icon`, `end-icon` |
137
+ | Callout | `<acl-callout>` | `variant` |
138
+ | Checkbox | `<acl-checkbox>` | `checked`, `disabled`, `indeterminate`, `readonly`, `inputid` |
139
+ | Divider | `<acl-divider>` | `direction` |
140
+ | Dot | `<acl-dot>` | `variant` |
141
+ | Field | `<acl-field>` | `orientation` |
142
+ | Field Label | `<acl-field-label>` | `htmlfor`, `required` |
143
+ | Icon | `<acl-icon>` | `name`, `size` (12 small · **16 default** · 20 · 24 large) |
144
+ | Input | `<acl-input>` | `value`, `size`, `disabled`, `readonly`, `placeholder`, `inputid`, `status` |
145
+ | Loading State | `<acl-loading-state>` | `height` |
146
+ | Progress | `<acl-progress>` | `percent`, `height` |
147
+ | Skeleton | `<acl-skeleton>` | `effect`, `shape`, `height`, `width`, `duration`, `font-size` |
148
+ | Spinner | `<acl-spinner>` | `size`, `percent` |
149
+ | Tabs | `<acl-tabs>` | `default-value`, `value` |
150
+ | Tab List | `<acl-tabs-list>` | `alignment` |
151
+ | Tab Trigger | `<acl-tab-trigger>` | `value`, `start-icon`, `disabled` |
152
+ | Tab Content | `<acl-tab-content>` | `value` |
153
+ | Tag | `<acl-tag>` | `variant`, `icon`, `disabled` |
154
+ | Textarea | `<acl-textarea>` | `value`, `disabled`, `readonly`, `placeholder`, `inputid`, `rows`, `status` |
155
+ | Tooltip | `<acl-tooltip>` | `placement`, `disabled` |
156
+ | Tooltip Trigger | `<acl-tooltip-trigger>` | — |
157
+ | Tooltip Content | `<acl-tooltip-content>` | — |
158
+ | Well | `<acl-well>` | `variant` |
159
+
160
+ ---
161
+
162
+ ## Package Exports
163
+
164
+ | Import path | Contents |
165
+ |---|---|
166
+ | `acl-web-components` | All component classes (auto-registers custom elements) |
167
+ | `acl-web-components/tokens.css` | CSS custom properties for all design tokens |
168
+ | `acl-web-components/tailwind-preset` | Tailwind **v3** preset |
169
+ | `acl-web-components/tailwind-theme.css` | Tailwind **v4** `@theme inline` bridge |
170
+
171
+ ---
172
+
173
+ ## Development
174
+
175
+ ```bash
176
+ npm install
177
+ npm run storybook # Component dev server → http://localhost:6006
178
+ npm run build # Type-check + Vite build → dist/
179
+ npm run build-storybook # Static Storybook export
180
+ ```
181
+
182
+ ## Stack
183
+
184
+ - [Lit](https://lit.dev) — Web Components base library
185
+ - [Vite](https://vitejs.dev) — Build tool (library mode)
186
+ - [Storybook](https://storybook.js.org) — Component development & documentation
187
+ - TypeScript