hans-ui-design-lib 1.0.0 → 1.0.2

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 CHANGED
@@ -49,6 +49,56 @@ import { HansButton } from 'hans-ui-design-lib';
49
49
  <HansButton label="Button"></HansButton>;
50
50
  ```
51
51
 
52
+ The current 5 theme combinations are fully supported and represent the default preset system. But if your project needs a custom semantic palette, you can override the active combination at runtime:
53
+
54
+ ```tsx
55
+ import { HansButton, setHansTheme } from 'hans-ui-design-lib';
56
+
57
+ setHansTheme({
58
+ primary: {
59
+ strong: '#1e3a8a',
60
+ default: '#2563eb',
61
+ neutral: '#bfdbfe',
62
+ },
63
+ secondary: {
64
+ strong: '#9f1239',
65
+ default: '#e11d48',
66
+ neutral: '#fecdd3',
67
+ },
68
+ success: {
69
+ strong: '#166534',
70
+ default: '#22c55e',
71
+ neutral: '#bbf7d0',
72
+ },
73
+ danger: {
74
+ strong: '#991b1b',
75
+ default: '#ef4444',
76
+ neutral: '#fecaca',
77
+ },
78
+ warning: {
79
+ strong: '#92400e',
80
+ default: '#f59e0b',
81
+ neutral: '#fde68a',
82
+ },
83
+ info: {
84
+ strong: '#155e75',
85
+ default: '#06b6d4',
86
+ neutral: '#cffafe',
87
+ },
88
+ base: {
89
+ strong: '#334155',
90
+ default: '#64748b',
91
+ neutral: '#cbd5e1',
92
+ },
93
+ backgroundColor: '#f8fafc',
94
+ textColor: '#0f172a',
95
+ });
96
+
97
+ <HansButton label="Button"></HansButton>;
98
+ ```
99
+
100
+ The dynamic object must include the same 23 color slots used by the built-in combinations. You can see more details about the palette customization in our Color System documentation session.
101
+
52
102
  ### Others:
53
103
 
54
104
  If you're using other Technologies like Angular for example, you don't have to install it with npm, you just have to import the CDN links. In the root index.html of your application, define:
@@ -72,7 +122,7 @@ If you're using other Technologies like Angular for example, you don't have to i
72
122
  </html>
73
123
  ```
74
124
 
75
- If you're using a technology like Angular, probably you're gonna have to declare CUSTOM_ELEMENTS_SCHEMA like this in your component:
125
+ If you're using a technology like Angular, probably you're gonna have to declare `CUSTOM_ELEMENTS_SCHEMA` like this in your component:
76
126
 
77
127
  ```ts
78
128
  import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
@@ -90,6 +140,52 @@ And in your component html you can just call it like this, passing the props you
90
140
  <hans-button label="Button"></hans-button>
91
141
  ```
92
142
 
143
+ You can also override the active combination dynamically in CDN/web component usage:
144
+
145
+ ```html
146
+ <script>
147
+ window.HansUI.setTheme({
148
+ primary: {
149
+ strong: '#1e3a8a',
150
+ default: '#2563eb',
151
+ neutral: '#bfdbfe',
152
+ },
153
+ secondary: {
154
+ strong: '#9f1239',
155
+ default: '#e11d48',
156
+ neutral: '#fecdd3',
157
+ },
158
+ success: {
159
+ strong: '#166534',
160
+ default: '#22c55e',
161
+ neutral: '#bbf7d0',
162
+ },
163
+ danger: {
164
+ strong: '#991b1b',
165
+ default: '#ef4444',
166
+ neutral: '#fecaca',
167
+ },
168
+ warning: {
169
+ strong: '#92400e',
170
+ default: '#f59e0b',
171
+ neutral: '#fde68a',
172
+ },
173
+ info: {
174
+ strong: '#155e75',
175
+ default: '#06b6d4',
176
+ neutral: '#cffafe',
177
+ },
178
+ base: {
179
+ strong: '#334155',
180
+ default: '#64748b',
181
+ neutral: '#cbd5e1',
182
+ },
183
+ backgroundColor: '#f8fafc',
184
+ textColor: '#0f172a',
185
+ });
186
+ </script>
187
+ ```
188
+
93
189
  ## 🧑‍💻 Development
94
190
 
95
191
  Clone the repo and install dependencies: