@wikicasa-dev/components 2.1.4-alpha.1 → 2.1.4-alpha.10

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 (28) hide show
  1. package/dist/UIKit/BaseBadge.d.ts +2 -2
  2. package/dist/UIKit/BasePin.d.ts +22 -0
  3. package/dist/UIKit/BaseSelect.d.ts +26 -0
  4. package/dist/UIKit/BaseSelect.js +5 -0
  5. package/dist/UIKit/BaseTextarea.js +2 -2
  6. package/dist/assets/packages/components/lib/UIKit/BaseAlert.css +1 -1
  7. package/dist/assets/packages/components/lib/UIKit/BaseBadge.css +1 -1
  8. package/dist/assets/packages/components/lib/UIKit/BaseComplexToggle.css +1 -1
  9. package/dist/assets/packages/components/lib/UIKit/{NativeSelect.css → BaseSelect.css} +1 -1
  10. package/dist/assets/packages/components/lib/UIKit/BaseTextarea.css +1 -1
  11. package/dist/assets/packages/components/src/tailwind.css +1 -1
  12. package/dist/index.d.ts +3 -1
  13. package/dist/index.js +93 -87
  14. package/dist/packages/components/lib/UIKit/AccessibleSelect.vue.js +20 -20
  15. package/dist/packages/components/lib/UIKit/BaseBadge.vue.js +5 -5
  16. package/dist/packages/components/lib/UIKit/BaseBanner.vue.js +9 -9
  17. package/dist/packages/components/lib/UIKit/BaseButton.vue.js +15 -15
  18. package/dist/packages/components/lib/UIKit/BaseFloatingLabel.vue.js +4 -4
  19. package/dist/packages/components/lib/UIKit/BaseInput.vue.js +8 -8
  20. package/dist/packages/components/lib/UIKit/{NativeSelect.vue.js → BaseSelect.vue.js} +12 -12
  21. package/dist/packages/components/lib/UIKit/BaseTextarea.vue.js +8 -8
  22. package/dist/packages/components/lib/UIKit/BaseUploadFile.vue.js +1 -1
  23. package/dist/packages/components/lib/UIKit/Checkbox/CheckboxBtn.vue.js +1 -1
  24. package/dist/packages/components/lib/UIKit/Checkbox/CheckboxGroup.vue.js +7 -9
  25. package/dist/packages/components/lib/UIKit/DatePicker.vue.js +2 -2
  26. package/package.json +6 -2
  27. package/plugins/buttonPlugin.ts +290 -0
  28. package/dist/UIKit/NativeSelect.js +0 -5
@@ -0,0 +1,290 @@
1
+ import plugin from "tailwindcss/plugin";
2
+
3
+ const colors = {
4
+ //New colors
5
+ primary: { value: "#F20282", hover: "#E30C79", outlineHover: "#FFF8FB" },
6
+ secondary: { value: "#2b5dff", hover: "#244FD9" },
7
+ lightgray: { value: "#C1C8D5", hover: "" },
8
+ ghost: { value: "#FAFBFF", hover: "" },
9
+
10
+ //Old colors
11
+ darkPrimary: { value: "#2A3761", hover: "" },
12
+ lavender: { value: "#E9EFFE", hover: "" },
13
+ cultured: { value: "#F4F7FF", hover: "" },
14
+ carbon: { value: "#3C474D", hover: "" },
15
+ gray: { value: "#6D7687", hover: "" },
16
+ black: { value: "#222222", hover: "" },
17
+ warning: { value: "#FFD167", hover: "" },
18
+ white: { value: "#FFF", hover: "" },
19
+ danger: { value: "#FA4F64", hover: "" },
20
+ } as const;
21
+
22
+ export const buttonPlugin = plugin(({ addComponents, theme }) => {
23
+ addComponents({
24
+ ".btn": {
25
+ "--btn-px": "25px",
26
+ "--btn-py": "11px",
27
+ "--btn-bg-color": "transparent",
28
+ "--btn-text-color": colors.black.value,
29
+ "--btn-border-color": "unset",
30
+ "--btn-border-width": "0",
31
+ "--btn-border-radius": "24px",
32
+ "--btn-border-style": "solid",
33
+ "--btn-height": "40px",
34
+ "--btn-width": "auto",
35
+ "--btn-font-size": theme("fontSize.16"),
36
+ "--btn-transition":
37
+ "color, background-color cubic-bezier(0.4, 0, 0.2, 1) 150ms",
38
+ "--btn-font-weight": `${theme("fontWeight.semibold")}`,
39
+ display: "inline-flex",
40
+ "align-items": "center",
41
+ "justify-content": "center",
42
+ "font-size": "var(--btn-font-size)",
43
+ "font-weight": "var(--btn-font-weight)",
44
+ "white-space": "nowrap",
45
+ border:
46
+ "var(--btn-border-width) var(--btn-border-color) var(--btn-border-style)",
47
+ "border-radius": "var(--btn-border-radius)",
48
+ cursor: "pointer",
49
+ height: "var(--btn-height)",
50
+ width: "var(--btn-width)",
51
+ "background-color": "var(--btn-bg-color)",
52
+ color: "var(--btn-text-color)",
53
+ padding: "var(--btn-py) var(--btn-px)",
54
+ transition: "var(--btn-transition)",
55
+ "line-height": "1",
56
+ "-webkit-tap-highlight-color": "transparent",
57
+ "&.btn-lg": {
58
+ "--btn-height": "48px",
59
+ "--btn-px": "24px",
60
+ "--btn-py": "12px",
61
+ },
62
+ "&.btn-sm": {
63
+ "--btn-px": "24px",
64
+ "--btn-py": "8px",
65
+ "--btn-height": "40px",
66
+ },
67
+ "&.btn-rounded": {
68
+ "--btn-px": "0",
69
+ "--btn-py": "0",
70
+ },
71
+ "&.btn-outline": {
72
+ "--btn-border-width": "1px",
73
+ "--btn-bg-color": colors.white.value,
74
+ },
75
+ "&.btn-primary": {
76
+ ...createBtn(
77
+ {
78
+ bgColor: colors.primary.value,
79
+ textColor: colors.white.value,
80
+ hoverBgColor: colors.primary.hover,
81
+ hoverDisabledBgColor: colors.primary.value,
82
+ },
83
+ {
84
+ mainColor: colors.white.hover,
85
+ textColor: colors.primary.value,
86
+ hoverBgColor: colors.primary.outlineHover,
87
+ },
88
+ ),
89
+ "text-transform": "uppercase",
90
+ },
91
+ "&.btn-secondary": createBtn(
92
+ {
93
+ bgColor: colors.secondary.value,
94
+ textColor: colors.white.value,
95
+ hoverBgColor: colors.secondary.hover,
96
+ hoverDisabledBgColor: colors.secondary.value,
97
+ },
98
+ {
99
+ mainColor: colors.secondary.value,
100
+ textColor: colors.secondary.value,
101
+ },
102
+ ),
103
+ "&.btn-ternary": {
104
+ ...createBtn({
105
+ bgColor: colors.white.value,
106
+ textColor: colors.secondary.value,
107
+ hoverBgColor: colors.white.value,
108
+ hoverDisabledBgColor: colors.secondary.value,
109
+ hoverTextColor: colors.secondary.hover,
110
+ }),
111
+ "--btn-border-color": colors.lightgray.value,
112
+ "--btn-border-width": "1px",
113
+ "--btn-border-radius": "24px",
114
+ },
115
+ "&.btn-quaternary": {
116
+ "--btn-px": "0",
117
+ "--btn-py": "0",
118
+ "--btn-text-color": colors.secondary.value,
119
+ "--btn-height": "auto",
120
+ "&:hover": {
121
+ "text-decoration": "underline",
122
+ "--btn-text-color": colors.secondary.hover,
123
+ },
124
+ "&:disabled": {
125
+ "--btn-bg-color": "transparent",
126
+ "--btn-text-color": colors.lightgray.value,
127
+ },
128
+ },
129
+ "&.btn-single-selection": {
130
+ "--btn-px": "16px",
131
+ "--btn-py": "8px",
132
+ "--btn-border-radius": theme("borderRadius.2xs"),
133
+ "--btn-border-color": colors.lightgray.value,
134
+ "--btn-border-width": "1px",
135
+ "--btn-font-weight": theme("fontWeight.regular"),
136
+ "&:hover": {
137
+ "--btn-border-color": colors.secondary.value,
138
+ },
139
+ "&:active,&.active,&[data-active='true']": {
140
+ "--btn-bg-color": colors.ghost.value,
141
+ "--btn-text-color": colors.secondary.value,
142
+ "--btn-border-color": colors.secondary.value,
143
+ },
144
+ },
145
+ },
146
+ //OLD style. Kept for retro-compatibility
147
+ ".btn-light": createBtn({
148
+ textColor: colors.primary.value,
149
+ bgColor: colors.white.value,
150
+ hoverTextColor: colors.primary.value,
151
+ hoverBgColor: "#FAFAFA",
152
+ hoverDisabledBgColor: colors.white.value,
153
+ }),
154
+ ".btn-warning": createBtn({
155
+ bgColor: colors.warning.value,
156
+ textColor: "#2A3761",
157
+ hoverBgColor: "#F2C761",
158
+ hoverDisabledBgColor: colors.warning.value,
159
+ }),
160
+ ".btn-danger": createBtn(
161
+ {
162
+ bgColor: colors.danger.value,
163
+ textColor: colors.white.value,
164
+ hoverBgColor: "#E0485A",
165
+ hoverDisabledBgColor: colors.danger.value,
166
+ },
167
+ {
168
+ mainColor: colors.danger.value,
169
+ textColor: colors.danger.value,
170
+ },
171
+ ),
172
+ ".btn-multi-selection": {
173
+ "--btn-py": "10px",
174
+ "--btn-height": "40px",
175
+ "font-weight": theme("fontWeight.regular"),
176
+ "--btn-border-radius": theme("borderRadius.xs"),
177
+ "--btn-border-color": "#EAEFFD",
178
+ "--btn-border-width": "1px",
179
+ "white-space": "normal",
180
+ ...createBtn({
181
+ textColor: colors.black.value,
182
+ bgColor: "#F5F7FA",
183
+ hoverBgColor: colors.lavender.value,
184
+ hoverDisabledBgColor: colors.white.value,
185
+ hoverBorderColor: "#385CF6",
186
+ }),
187
+ },
188
+
189
+ ".btn-facile": {
190
+ "--btn-facile-color": "#FF6600",
191
+ "--btn-facile-hover-color": "#b34700",
192
+ ...createBtn({
193
+ bgColor: "var(--btn-facile-color)",
194
+ textColor: colors.white.value,
195
+ hoverBgColor: "var(--btn-facile-hover-color)",
196
+ hoverTextColor: colors.white.value,
197
+ hoverDisabledBgColor: "var(--btn-facile-color)",
198
+ }),
199
+ },
200
+ ".btn-show-more": {
201
+ "--btn-border-radius": "0",
202
+ "--btn-border-color": colors.white.value,
203
+ ...createBtn({
204
+ textColor: "#2B5DFF",
205
+ bgColor: colors.white.value,
206
+ hoverTextColor: "#3646B3",
207
+ hoverBgColor: colors.white.value,
208
+ hoverDisabledBgColor: colors.white.value,
209
+ }),
210
+ },
211
+ ".btn-transparent": {
212
+ "--border-color": "transparent",
213
+ "--btn-px": "0",
214
+ "--btn-py": "0",
215
+ "&:hover": {
216
+ "--btn-bg-color": "transparent",
217
+ "--border-color": "transparent",
218
+ },
219
+ },
220
+ });
221
+ });
222
+
223
+ type BtnAttributes = {
224
+ bgColor: string;
225
+ textColor: string;
226
+ hoverBgColor: string;
227
+ hoverTextColor?: string;
228
+ /* The border color will be applied to desktop mode */
229
+ hoverBorderColor?: string;
230
+ activeBorderColor?: string;
231
+ activeBgColor?: string;
232
+ activeTextColor?: string;
233
+ hoverDisabledBgColor: string;
234
+ };
235
+ type BtnOutlineVariantAttributes = {
236
+ /* If present, it will be used to set the color to borders, text and background */
237
+ mainColor?: string;
238
+ borderColor?: string;
239
+ textColor?: string;
240
+ /* The hover bg color will be activated only from tablet mode on */
241
+ hoverBgColor?: string;
242
+ hoverDisabledBgColor?: string;
243
+ /* The hover text color will be activated only from tablet mode on */
244
+ hoverTextColor?: string;
245
+ activeBgColor?: string;
246
+ activeTextColor?: string;
247
+ };
248
+
249
+ const createBtn = (
250
+ btnProps: BtnAttributes,
251
+ btnOutlineProps?: BtnOutlineVariantAttributes,
252
+ ): any => ({
253
+ "--btn-bg-color": btnProps.bgColor,
254
+ "--btn-text-color": btnProps.textColor,
255
+ "&:disabled": {
256
+ cursor: "not-allowed",
257
+ },
258
+ "&:hover:not(:disabled)": {
259
+ "--btn-text-color": btnProps.hoverTextColor,
260
+ "--btn-bg-color": btnProps.hoverBgColor,
261
+ },
262
+ ...(btnOutlineProps
263
+ ? {
264
+ "&.btn-outline": createOutlineVariant(btnOutlineProps),
265
+ }
266
+ : {}),
267
+ });
268
+
269
+ const createOutlineVariant = (props: BtnOutlineVariantAttributes): any => ({
270
+ "--btn-border-color": props.mainColor ?? props.borderColor,
271
+ "--btn-text-color": props.textColor,
272
+ "--btn-bg-color": "#fff",
273
+ //By default, the active section is the same of the hover section in desktop mode
274
+ "&:active": {
275
+ "--btn-bg-color":
276
+ (props.mainColor ?? props.activeBgColor ?? props.hoverBgColor) +
277
+ " !important",
278
+ //By default, on active the text is white
279
+ ...(props.activeTextColor || props.hoverTextColor
280
+ ? {
281
+ "--btn-text-color": props.activeTextColor ?? props.hoverTextColor,
282
+ }
283
+ : {}),
284
+ },
285
+ "&:hover": {
286
+ //By default, the text color is white
287
+ ...(props.hoverBgColor ? { "--btn-bg-color": props.hoverBgColor } : {}),
288
+ "--btn-text-color": props.hoverTextColor ?? props.textColor,
289
+ },
290
+ });
@@ -1,5 +0,0 @@
1
- import o from "../packages/components/lib/UIKit/NativeSelect.vue.js";
2
- import '../assets/packages/components/lib/UIKit/NativeSelect.css';/* empty css */
3
- export {
4
- o as default
5
- };