@versini/ui-button 11.3.3 → 11.3.5

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.
@@ -1,389 +0,0 @@
1
- /*!
2
- @versini/ui-button v11.3.3
3
- © 2026 gizmette.com
4
- */
5
-
6
- import clsx from "clsx";
7
- import { BUTTON_CLASSNAME } from "../../common/constants.js";
8
-
9
- ;// CONCATENATED MODULE: external "clsx"
10
-
11
- ;// CONCATENATED MODULE: external "../../common/constants.js"
12
-
13
- ;// CONCATENATED MODULE: ./src/components/Button/utilities.ts
14
-
15
-
16
- const TYPE_ICON = "icon";
17
- const TYPE_BUTTON = "button";
18
- const TYPE_LINK = "link";
19
- const getButtonSizesClasses = ({ type, size, labelRight, labelLeft, align, animated })=>{
20
- const smallClasses = "max-h-8 py-0 px-2";
21
- const mediumClasses = "max-h-9 h-8 px-3";
22
- const largeClasses = "max-h-12 py-2 px-4";
23
- switch(type){
24
- case TYPE_BUTTON:
25
- case TYPE_LINK:
26
- return clsx({
27
- [smallClasses]: size === "small",
28
- [mediumClasses]: size === "medium",
29
- [largeClasses]: size === "large"
30
- });
31
- case TYPE_ICON:
32
- return clsx("flex items-center", {
33
- "justify-center": align === "center",
34
- "justify-start": align === "left",
35
- "justify-end": align === "right",
36
- "h-6 w-6 p-0": size === "small" && !animated && !(labelRight || labelLeft),
37
- "h-6 px-1 sm:px-2": size === "small" && !animated && (labelRight || labelLeft),
38
- "h-8 w-8 p-1": size === "medium" && !animated && !(labelRight || labelLeft),
39
- "h-8 px-3": size === "medium" && !animated && (labelRight || labelLeft),
40
- "h-12 w-12 p-2": size === "large" && !animated && !(labelRight || labelLeft),
41
- "h-12 px-4": size === "large" && !animated && (labelRight || labelLeft),
42
- "h-6 py-0": size === "small" && animated && !(labelRight || labelLeft),
43
- "h-6": size === "small" && animated && (labelRight || labelLeft),
44
- "h-8 py-1": size === "medium" && animated && !(labelRight || labelLeft),
45
- "h-8": size === "medium" && animated && (labelRight || labelLeft),
46
- "h-12 py-2": size === "large" && animated && !(labelRight || labelLeft),
47
- "h-12": size === "large" && animated && (labelRight || labelLeft)
48
- });
49
- }
50
- };
51
- const getButtonFontClasses = ({ type, size, labelRight, labelLeft })=>{
52
- const smallClasses = "text-sm font-medium";
53
- const mediumClasses = "text-base font-medium";
54
- const largeClasses = "text-lg font-medium";
55
- switch(type){
56
- case TYPE_BUTTON:
57
- case TYPE_LINK:
58
- return clsx({
59
- "text-center": type === TYPE_LINK,
60
- [smallClasses]: size === "small",
61
- [mediumClasses]: size === "medium",
62
- [largeClasses]: size === "large"
63
- });
64
- case TYPE_ICON:
65
- return clsx({
66
- [smallClasses]: size === "small" && (labelRight || labelLeft),
67
- [mediumClasses]: size === "medium" && (labelRight || labelLeft),
68
- [largeClasses]: size === "large" && (labelRight || labelLeft)
69
- });
70
- }
71
- };
72
- const getButtonTextCopyClasses = ({ mode, noBackground, truncate, variant })=>{
73
- if (noBackground) {
74
- return "not-prose";
75
- }
76
- if (variant === "primary") {
77
- return clsx("not-prose", {
78
- truncate: truncate,
79
- "text-copy-dark": mode === "light" || mode === "system",
80
- "text-copy-light": mode === "dark" || mode === "alt-system",
81
- "dark:text-copy-light": mode === "system",
82
- "dark:text-copy-dark": mode === "alt-system"
83
- });
84
- }
85
- if (variant === "secondary") {
86
- return clsx("not-prose", {
87
- truncate: truncate,
88
- "text-copy-light": mode === "light" || mode === "system",
89
- "text-copy-dark": mode === "dark" || mode === "alt-system",
90
- "dark:text-copy-dark": mode === "system",
91
- "dark:text-copy-light": mode === "alt-system"
92
- });
93
- }
94
- if (variant === "danger") {
95
- return clsx("not-prose", {
96
- truncate: truncate,
97
- "text-copy-light": mode === "dark" || mode === "system",
98
- "text-copy-lighter": mode === "light" || mode === "alt-system",
99
- "dark:text-copy-lighter": mode === "system",
100
- "dark:text-copy-light": mode === "alt-system"
101
- });
102
- }
103
- /* v8 ignore start - selected variant edge case */ if (variant === "selected") {
104
- return clsx("not-prose text-copy-lighter", {
105
- truncate: truncate
106
- });
107
- }
108
- /* v8 ignore stop */ };
109
- const getButtonBackgroundClasses = ({ mode, noBackground, variant })=>{
110
- if (noBackground) {
111
- return;
112
- }
113
- if (variant === "primary") {
114
- return clsx({
115
- "bg-action-light": mode === "light",
116
- "bg-action-dark": mode === "dark",
117
- "bg-action-light dark:bg-action-dark": mode === "system",
118
- "bg-action-dark dark:bg-action-light": mode === "alt-system"
119
- });
120
- }
121
- if (variant === "secondary") {
122
- return clsx({
123
- "bg-action-dark": mode === "light",
124
- "bg-action-light": mode === "dark",
125
- "bg-action-dark dark:bg-action-light": mode === "system",
126
- "bg-action-light dark:bg-action-dark": mode === "alt-system"
127
- });
128
- }
129
- if (variant === "danger") {
130
- return clsx({
131
- "bg-action-danger-dark": mode === "dark",
132
- "bg-action-danger-light": mode === "light",
133
- "bg-action-danger-dark dark:bg-action-danger-light": mode === "system",
134
- "bg-action-danger-light dark:bg-action-danger-dark": mode === "alt-system"
135
- });
136
- }
137
- /* v8 ignore start - selected variant edge case */ if (variant === "selected") {
138
- return "bg-action-selected-dark";
139
- }
140
- /* v8 ignore stop */ };
141
- const getButtonRadiusClasses = ({ radius })=>{
142
- return clsx({
143
- "rounded-full": radius === "large",
144
- "rounded-md": radius === "medium",
145
- "rounded-xs": radius === "small"
146
- });
147
- };
148
- const getButtonHoverClasses = ({ mode, disabled, variant })=>{
149
- if (disabled) {
150
- return "";
151
- }
152
- if (variant === "primary") {
153
- return clsx({
154
- "hover:text-copy-dark-hover": mode === "light" || mode === "system",
155
- "hover:text-copy-light-hover": mode === "dark" || mode === "alt-system",
156
- "dark:hover:text-copy-light-hover": mode === "system",
157
- "dark:hover:text-copy-dark-hover": mode === "alt-system",
158
- "hover:bg-action-light-hover": mode === "light",
159
- "hover:bg-action-dark-hover": mode === "dark",
160
- "hover:bg-action-light-hover dark:hover:bg-action-dark-hover": mode === "system",
161
- "hover:bg-action-dark-hover dark:hover:bg-action-light-hover": mode === "alt-system"
162
- });
163
- }
164
- if (variant === "secondary") {
165
- return clsx({
166
- "hover:text-copy-light-hover": mode === "light" || mode === "system",
167
- "hover:text-copy-dark-hover": mode === "dark" || mode === "alt-system",
168
- "dark:hover:text-copy-dark-hover": mode === "system",
169
- "dark:hover:text-copy-light-hover": mode === "alt-system",
170
- "hover:bg-action-dark-hover": mode === "light",
171
- "hover:bg-action-light-hover": mode === "dark",
172
- "hover:bg-action-dark-hover dark:hover:bg-action-light-hover": mode === "system",
173
- "hover:bg-action-light-hover dark:hover:bg-action-dark-hover": mode === "alt-system"
174
- });
175
- }
176
- if (variant === "danger") {
177
- return clsx("hover:text-copy-light-hover", {
178
- "hover:bg-action-danger-dark-hover": mode === "dark",
179
- "hover:bg-action-danger-light-hover": mode === "light",
180
- "hover:bg-action-danger-dark-hover dark:hover:bg-action-danger-light-hover": mode === "system",
181
- "hover:bg-action-danger-light-hover dark:hover:bg-action-danger-dark-hover": mode === "alt-system"
182
- });
183
- }
184
- /* v8 ignore start - selected variant edge case */ if (variant === "selected") {
185
- return "hover:text-copy-light-hover hover:bg-action-selected-dark-hover";
186
- }
187
- /* v8 ignore stop */ };
188
- const getButtonActiveClasses = ({ mode, disabled, variant })=>{
189
- if (disabled) {
190
- return "";
191
- }
192
- if (variant === "primary") {
193
- return clsx({
194
- "active:text-copy-light-active": mode === "light" || mode === "system",
195
- "active:text-copy-medium-active": mode === "dark" || mode === "alt-system",
196
- "dark:active:text-copy-medium-active": mode === "system",
197
- "dark:active:text-copy-light-active": mode === "alt-system",
198
- "active:bg-action-light-active": mode === "light",
199
- "active:bg-action-dark-active": mode === "dark",
200
- "active:bg-action-light-active dark:active:bg-action-dark-active": mode === "system",
201
- "active:bg-action-dark-active dark:active:bg-action-light-active": mode === "alt-system"
202
- });
203
- }
204
- if (variant === "secondary") {
205
- return clsx({
206
- "active:text-copy-medium-active": mode === "light" || mode === "system",
207
- "active:text-copy-light-active": mode === "dark" || mode === "alt-system",
208
- "dark:active:text-copy-light-active": mode === "system",
209
- "dark:active:text-copy-medium-active": mode === "alt-system",
210
- "active:bg-action-dark-active": mode === "light",
211
- "active:bg-action-light-active": mode === "dark",
212
- "active:bg-action-dark-active dark:active:bg-action-light-active": mode === "system",
213
- "active:bg-action-light-active dark:active:bg-action-dark-active": mode === "alt-system"
214
- });
215
- }
216
- if (variant === "danger") {
217
- return clsx("active:text-copy-lighter-active", {
218
- "active:bg-action-danger-dark-active": mode === "dark",
219
- "active:bg-action-danger-light-active": mode === "light",
220
- "active:bg-action-danger-dark-active dark:active:bg-action-danger-light-active": mode === "system",
221
- "active:bg-action-danger-light-active dark:active:bg-action-danger-dark-active": mode === "alt-system"
222
- });
223
- }
224
- /* v8 ignore start - selected variant edge case */ if (variant === "selected") {
225
- return "active:text-copy-lighter-active active:bg-action-selected-dark-active";
226
- }
227
- /* v8 ignore stop */ };
228
- const getButtonBorderClasses = ({ mode, noBorder, variant })=>{
229
- if (noBorder) {
230
- return "border border-transparent";
231
- }
232
- if (variant === "primary") {
233
- return clsx("border", {
234
- "border-border-medium": mode === "light",
235
- "border-border-accent": mode === "dark",
236
- "border-border-medium dark:border-border-accent": mode === "system",
237
- "border-border-accent dark:border-border-medium": mode === "alt-system"
238
- });
239
- }
240
- if (variant === "secondary") {
241
- return clsx("border", {
242
- "border-border-accent": mode === "light",
243
- "border-border-medium": mode === "dark",
244
- "border-border-accent dark:border-border-medium": mode === "system",
245
- "border-border-medium dark:border-border-accent": mode === "alt-system"
246
- });
247
- }
248
- if (variant === "danger") {
249
- return clsx("border", {
250
- "border-border-danger-dark": mode === "dark",
251
- "border-border-danger-medium": mode === "light",
252
- "border-border-danger-dark dark:border-border-danger-medium": mode === "system",
253
- "border-border-danger-medium dark:border-border-danger-dark": mode === "alt-system"
254
- });
255
- }
256
- /* v8 ignore start - selected variant edge case */ if (variant === "selected") {
257
- return "border border-border-selected-dark";
258
- }
259
- /* v8 ignore stop */ };
260
- const getButtonFocusClasses = ({ focusMode })=>{
261
- return clsx("focus:outline", "focus:outline-2", "focus:outline-offset-2", {
262
- "focus:outline-focus-dark": focusMode === "dark",
263
- "focus:outline-focus-light": focusMode === "light",
264
- "focus:outline-focus-light dark:focus:outline-focus-dark": focusMode === "alt-system",
265
- "focus:outline-focus-dark dark:focus:outline-focus-light": focusMode === "system"
266
- });
267
- };
268
- const getIconClasses = ({ mode, raw, iconClassName, variant = "primary" })=>{
269
- if (raw) {
270
- return "";
271
- }
272
- // Use the same text color logic as getButtonTextCopyClasses
273
- let textColorClasses = {};
274
- if (variant === "primary") {
275
- textColorClasses = {
276
- "text-copy-dark": mode === "light" || mode === "system",
277
- "text-copy-light": mode === "dark" || mode === "alt-system",
278
- "dark:text-copy-light": mode === "system",
279
- "dark:text-copy-dark": mode === "alt-system"
280
- };
281
- } else if (variant === "secondary") {
282
- textColorClasses = {
283
- "text-copy-light": mode === "light" || mode === "system",
284
- "text-copy-dark": mode === "dark" || mode === "alt-system",
285
- "dark:text-copy-dark": mode === "system",
286
- "dark:text-copy-light": mode === "alt-system"
287
- };
288
- } else if (variant === "danger") {
289
- textColorClasses = {
290
- "text-copy-light": mode === "dark" || mode === "system",
291
- "text-copy-lighter": mode === "light" || mode === "alt-system",
292
- "dark:text-copy-lighter": mode === "system",
293
- "dark:text-copy-light": mode === "alt-system"
294
- };
295
- }
296
- /* v8 ignore start - selected variant edge case */ if (variant === "selected") {
297
- textColorClasses = {
298
- "text-copy-lighter": true
299
- };
300
- }
301
- /* v8 ignore stop */ return clsx(textColorClasses, iconClassName);
302
- };
303
- const getButtonIconLabelClasses = ({ animated })=>{
304
- return clsx({
305
- "transition-opacity duration-300 ease-in-out": animated
306
- });
307
- };
308
- const getBadgeClasses = ({ size, badge })=>{
309
- if (badge === undefined || badge === false || badge === 0) {
310
- return null;
311
- }
312
- const isNumber = typeof badge === "number";
313
- const displayValue = isNumber ? badge > 99 ? "99+" : String(badge) : null;
314
- // Base classes for badge positioning and styling
315
- const baseClasses = clsx("absolute inline-flex items-center justify-center", "border border-border-white", "rounded-full", "text-copy-lighter", "bg-copy-error-dark", "pointer-events-none");
316
- // Size-specific classes for positioning and dimensions
317
- const sizeClasses = clsx({
318
- // Dot badge (boolean true) - small circle
319
- "size-2 -top-0.5 right-0": !isNumber && size === "small",
320
- "size-2.5 -top-0.5 right-0": !isNumber && size === "medium",
321
- "size-3 -top-0.5 right-1": !isNumber && size === "large",
322
- // Number badge - larger to fit text
323
- "min-w-3 h-3 text-[8px] px-1 -top-1.5 -right-1.5": isNumber && size === "small" && badge < 10,
324
- "min-w-3 h-3 text-[8px] px-1 -top-1.5 -right-2": isNumber && size === "small" && badge >= 10 && badge <= 99,
325
- "min-w-3 h-3 text-[8px] px-1 -top-1.5 -right-3": isNumber && size === "small" && badge > 99,
326
- "min-w-4 h-4 text-[10px] px-1 -top-1.5 -right-0.5": isNumber && size === "medium" && badge < 10,
327
- "min-w-4 h-4 text-[10px] px-1 -top-1.5 -right-2": isNumber && size === "medium" && badge >= 10 && badge <= 99,
328
- "min-w-4 h-4 text-[10px] px-1 -top-1.5 -right-3": isNumber && size === "medium" && badge > 99,
329
- "min-w-5 h-5 text-xs px-1 -top-1 -right-1": isNumber && size === "large" && badge < 10,
330
- "min-w-5 h-5 text-xs px-1 -top-1 -right-2": isNumber && size === "large" && badge >= 10 && badge <= 99,
331
- "min-w-5 h-5 text-xs px-1 -top-1 -right-3": isNumber && size === "large" && badge > 99
332
- });
333
- return {
334
- className: clsx(baseClasses, sizeClasses),
335
- displayValue
336
- };
337
- };
338
- const getButtonClasses = ({ type, className, raw, mode, focusMode, disabled, fullWidth, size, noBorder, labelRight, labelLeft, noBackground, variant, truncate, align, radius, animated, badge })=>{
339
- if (!variant) {
340
- variant = "primary";
341
- }
342
- const hasBadge = badge !== undefined && badge !== false && badge !== 0;
343
- return raw ? clsx(BUTTON_CLASSNAME, className) : clsx(BUTTON_CLASSNAME, getButtonTextCopyClasses({
344
- mode,
345
- variant,
346
- noBackground,
347
- truncate
348
- }), getButtonBackgroundClasses({
349
- mode,
350
- noBackground,
351
- variant
352
- }), getButtonRadiusClasses({
353
- radius
354
- }), getButtonSizesClasses({
355
- type,
356
- size,
357
- labelRight,
358
- labelLeft,
359
- align,
360
- animated
361
- }), getButtonFontClasses({
362
- type,
363
- size,
364
- labelRight,
365
- labelLeft
366
- }), getButtonBorderClasses({
367
- mode,
368
- variant,
369
- noBorder
370
- }), getButtonFocusClasses({
371
- focusMode
372
- }), getButtonHoverClasses({
373
- mode,
374
- variant,
375
- disabled
376
- }), getButtonActiveClasses({
377
- mode,
378
- variant,
379
- disabled
380
- }), {
381
- "w-full": fullWidth,
382
- "disabled:cursor-not-allowed disabled:opacity-50": disabled,
383
- relative: hasBadge
384
- }, clsx({
385
- "transition-[width] duration-300 ease-in": type === TYPE_ICON && animated
386
- }), className);
387
- };
388
-
389
- export { TYPE_BUTTON, TYPE_ICON, TYPE_LINK, getBadgeClasses, getButtonClasses, getButtonIconLabelClasses, getIconClasses };
@@ -1,20 +0,0 @@
1
- /*!
2
- @versini/ui-button v11.3.3
3
- © 2026 gizmette.com
4
- */
5
-
6
- export * from "../common/constants.js";
7
- export * from "./Button/Button.js";
8
- export * from "./Button/ButtonCopy.js";
9
- export * from "./Button/ButtonIcon.js";
10
- export * from "./Button/ButtonLink.js";
11
- export * from "./private/ButtonSort.js";
12
-
13
- ;// CONCATENATED MODULE: ./src/components/index.ts
14
-
15
-
16
-
17
-
18
-
19
-
20
-