hans-ui-design-lib 1.0.0 → 1.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 +48 -0
- package/dist/index.cjs.js +50 -50
- package/dist/index.d.ts +37 -0
- package/dist/index.es.js +6356 -6274
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -49,6 +49,33 @@ import { HansButton } from 'hans-ui-design-lib';
|
|
|
49
49
|
<HansButton label="Button"></HansButton>;
|
|
50
50
|
```
|
|
51
51
|
|
|
52
|
+
The current 5 theme combinations are still fully supported and remain the default preset system.
|
|
53
|
+
|
|
54
|
+
If your project needs a custom semantic palette, you can override the active combination at runtime:
|
|
55
|
+
|
|
56
|
+
```tsx
|
|
57
|
+
import { HansButton, setHansTheme } from 'hans-ui-design-lib';
|
|
58
|
+
|
|
59
|
+
setHansTheme({
|
|
60
|
+
primary: {
|
|
61
|
+
strong: '#1e3a8a',
|
|
62
|
+
default: '#2563eb',
|
|
63
|
+
neutral: '#bfdbfe',
|
|
64
|
+
},
|
|
65
|
+
secondary: {
|
|
66
|
+
strong: '#9f1239',
|
|
67
|
+
default: '#e11d48',
|
|
68
|
+
neutral: '#fecdd3',
|
|
69
|
+
},
|
|
70
|
+
backgroundColor: '#f8fafc',
|
|
71
|
+
textColor: '#0f172a',
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
<HansButton label="Button"></HansButton>;
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Only the tokens you provide are overridden. The others keep following the current `data-theme` fallback.
|
|
78
|
+
|
|
52
79
|
### Others:
|
|
53
80
|
|
|
54
81
|
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:
|
|
@@ -90,6 +117,27 @@ And in your component html you can just call it like this, passing the props you
|
|
|
90
117
|
<hans-button label="Button"></hans-button>
|
|
91
118
|
```
|
|
92
119
|
|
|
120
|
+
You can also override the active combination dynamically in CDN/web component usage:
|
|
121
|
+
|
|
122
|
+
```html
|
|
123
|
+
<script>
|
|
124
|
+
window.HansUI.setTheme({
|
|
125
|
+
primary: {
|
|
126
|
+
strong: '#1e3a8a',
|
|
127
|
+
default: '#2563eb',
|
|
128
|
+
neutral: '#bfdbfe',
|
|
129
|
+
},
|
|
130
|
+
secondary: {
|
|
131
|
+
strong: '#9f1239',
|
|
132
|
+
default: '#e11d48',
|
|
133
|
+
neutral: '#fecdd3',
|
|
134
|
+
},
|
|
135
|
+
backgroundColor: '#f8fafc',
|
|
136
|
+
textColor: '#0f172a',
|
|
137
|
+
});
|
|
138
|
+
</script>
|
|
139
|
+
```
|
|
140
|
+
|
|
93
141
|
## 🧑💻 Development
|
|
94
142
|
|
|
95
143
|
Clone the repo and install dependencies:
|