@infonomic/uikit 5.9.0 → 5.10.0
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/dist/components/button/@types/button.d.ts +1 -1
- package/dist/components/button/@types/button.d.ts.map +1 -1
- package/dist/components/button/@types/button.js +1 -0
- package/dist/components/button/button.module.css +107 -28
- package/dist/components/button/button.module.js +2 -0
- package/dist/components/button/button_module.css +53 -0
- package/dist/components/chips/@types/chip.d.ts +6 -0
- package/dist/components/chips/@types/chip.d.ts.map +1 -0
- package/dist/components/chips/@types/chip.js +7 -0
- package/dist/components/chips/chip.d.ts +32 -0
- package/dist/components/chips/chip.d.ts.map +1 -0
- package/dist/components/chips/chip.js +97 -0
- package/dist/components/chips/chip.module.css +425 -0
- package/dist/components/chips/chip.module.js +28 -0
- package/dist/components/chips/chip_module.css +319 -0
- package/dist/components/chips/index.js +2 -0
- package/dist/icons/check-icon.js +1 -0
- package/dist/icons/close-icon.d.ts.map +1 -1
- package/dist/icons/close-icon.js +21 -9
- package/dist/icons/icon-element.d.ts.map +1 -1
- package/dist/icons/icon-element.js +1 -4
- package/dist/icons/icons.module.css +8 -0
- package/dist/icons/icons_module.css +8 -0
- package/dist/react.d.ts +1 -0
- package/dist/react.d.ts.map +1 -1
- package/dist/react.js +1 -0
- package/dist/styles/components-vanilla.css +1 -1
- package/dist/styles/styles.css +1 -1
- package/package.json +18 -18
- package/src/components/button/@types/button.ts +1 -1
- package/src/components/button/button-intents.stories.tsx +2 -2
- package/src/components/button/button.module.css +107 -28
- package/src/components/chips/@types/chip.ts +7 -0
- package/src/components/chips/chip.module.css +425 -0
- package/src/components/chips/chip.stories.tsx +108 -0
- package/src/components/chips/chip.tsx +185 -0
- package/src/components/chips/index.ts +2 -0
- package/src/icons/check-icon.tsx +1 -1
- package/src/icons/close-icon.tsx +12 -11
- package/src/icons/icon-element.tsx +1 -4
- package/src/icons/icons.module.css +8 -0
- package/src/react.ts +1 -0
- package/src/styles/functional/colors.css +116 -107
|
@@ -3,7 +3,7 @@ import type { Size as s } from '../../@types/shared.js';
|
|
|
3
3
|
/**
|
|
4
4
|
* This file contains the types and prop-types for Button and IconButton component.
|
|
5
5
|
*/
|
|
6
|
-
export declare const variant: readonly ["filled", "outlined", "gradient", "text"];
|
|
6
|
+
export declare const variant: readonly ["filled", "filled-weak", "outlined", "gradient", "text"];
|
|
7
7
|
export type Variant = (typeof variant)[number];
|
|
8
8
|
export type Size = 'md' | s;
|
|
9
9
|
export type Intent = 'primary' | t;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../../src/components/button/@types/button.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC,EAAE,MAAM,wBAAwB,CAAA;AAEzD,OAAO,KAAK,EAAE,IAAI,IAAI,CAAC,EAAE,MAAM,wBAAwB,CAAA;AAEvD;;GAEG;AAGH,eAAO,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../../src/components/button/@types/button.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC,EAAE,MAAM,wBAAwB,CAAA;AAEzD,OAAO,KAAK,EAAE,IAAI,IAAI,CAAC,EAAE,MAAM,wBAAwB,CAAA;AAEvD;;GAEG;AAGH,eAAO,MAAM,OAAO,oEAAqE,CAAA;AACzF,MAAM,MAAM,OAAO,GAAG,CAAC,OAAO,OAAO,CAAC,CAAC,MAAM,CAAC,CAAA;AAE9C,MAAM,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,CAAA;AAC3B,MAAM,MAAM,MAAM,GAAG,SAAS,GAAG,CAAC,CAAA;AAClC,MAAM,MAAM,SAAS,GAAG,OAAO,CAAA;AAC/B,MAAM,MAAM,YAAY,GAAG,OAAO,CAAA"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
@layer infonomic-base, infonomic-functional, infonomic-utilities, infonomic-theme, infonomic-typography, infonomic-components;
|
|
2
2
|
|
|
3
3
|
@layer infonomic-components {
|
|
4
|
+
|
|
4
5
|
.button,
|
|
5
6
|
:global(.button) {
|
|
6
7
|
border: none;
|
|
@@ -113,6 +114,35 @@
|
|
|
113
114
|
color: var(--button-variant-filled-foreground-disabled, oklch(from var(--button-variant-filled-foreground) calc(l * 0.9) calc(c * 0.85) h));
|
|
114
115
|
}
|
|
115
116
|
|
|
117
|
+
/* -------------------------------------------------------- */
|
|
118
|
+
/* Weak variant for close button on selected button */
|
|
119
|
+
|
|
120
|
+
.filled-weak,
|
|
121
|
+
:global(.button-filled) {
|
|
122
|
+
color: var(--button-variant-filled-weak-foreground);
|
|
123
|
+
background-color: var(--button-variant-filled-weak);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.filled-weak:hover,
|
|
127
|
+
:global(.button-filled):hover {
|
|
128
|
+
background-color: var(--button-variant-filled-weak-hover);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.filled-weak:focus,
|
|
132
|
+
.filled-weak:active,
|
|
133
|
+
:global(.button-filled):focus,
|
|
134
|
+
:global(.button-filled):active {
|
|
135
|
+
--ring-color: var(--button-ring-color);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.filled-weak:disabled,
|
|
139
|
+
.filled[disabled],
|
|
140
|
+
:global(.button-filled):disabled,
|
|
141
|
+
:global(.button-filled)[disabled] {
|
|
142
|
+
background-color: var(--button-variant-filled-weak-disabled, oklch(from var(--button-variant-filled-weak) calc(l * 1.1) calc(c * 0.85) h));
|
|
143
|
+
color: var(--button-variant-filled-weak-foreground-disabled, oklch(from var(--button-variant-filled-weak-foreground) calc(l * 0.9) calc(c * 0.85) h));
|
|
144
|
+
}
|
|
145
|
+
|
|
116
146
|
.outlined,
|
|
117
147
|
:global(.button-outlined) {
|
|
118
148
|
border: 1px solid var(--button-variant-outlined-border);
|
|
@@ -201,14 +231,21 @@
|
|
|
201
231
|
.primary,
|
|
202
232
|
:global(.button-primary) {
|
|
203
233
|
--button-ring-color: var(--ring-primary);
|
|
204
|
-
|
|
234
|
+
|
|
205
235
|
/* Filled */
|
|
206
236
|
--button-variant-filled: var(--fill-primary-strong);
|
|
207
237
|
--button-variant-filled-foreground: var(--text-on-primary);
|
|
208
238
|
--button-variant-filled-hover: var(--fill-primary-strong-hover);
|
|
209
239
|
--button-variant-filled-disabled: var(--fill-primary-strong-disabled);
|
|
210
240
|
--button-variant-filled-foreground-disabled: var(--text-on-primary-disabled);
|
|
211
|
-
|
|
241
|
+
|
|
242
|
+
/* Filled Weak */
|
|
243
|
+
--button-variant-filled-weak: var(--fill-primary-weak);
|
|
244
|
+
--button-variant-filled-weak-foreground: var(--text-primary-weak);
|
|
245
|
+
--button-variant-filled-weak-hover: var(--fill-primary-weak-hover);
|
|
246
|
+
--button-variant-filled-weak-disabled: var(--fill-primary-weak-disabled);
|
|
247
|
+
--button-variant-filled-weak-foreground-disabled: var(--text-on-primary-disabled);
|
|
248
|
+
|
|
212
249
|
/* Outlined */
|
|
213
250
|
--button-variant-outlined: transparent;
|
|
214
251
|
--button-variant-outlined-foreground: var(--text-primary-strong);
|
|
@@ -216,12 +253,12 @@
|
|
|
216
253
|
--button-variant-outlined-border: var(--stroke-primary);
|
|
217
254
|
--button-variant-outlined-border-disabled: var(--stroke-primary-disabled);
|
|
218
255
|
--button-variant-outlined-foreground-disabled: var(--text-primary-disabled);
|
|
219
|
-
|
|
256
|
+
|
|
220
257
|
/* Text */
|
|
221
258
|
--button-variant-text: transparent;
|
|
222
259
|
--button-variant-text-foreground: var(--text-primary-weak);
|
|
223
260
|
--button-variant-text-hover: var(--fill-primary-weak-hover);
|
|
224
|
-
|
|
261
|
+
|
|
225
262
|
/* Gradient */
|
|
226
263
|
--button-variant-gradient-start: var(--gradient-primary-start);
|
|
227
264
|
--button-variant-gradient-end: var(--gradient-primary-end);
|
|
@@ -233,14 +270,21 @@
|
|
|
233
270
|
.secondary,
|
|
234
271
|
:global(.button-secondary) {
|
|
235
272
|
--button-ring-color: var(--ring-secondary);
|
|
236
|
-
|
|
273
|
+
|
|
237
274
|
/* Filled */
|
|
238
275
|
--button-variant-filled: var(--fill-secondary-strong);
|
|
239
276
|
--button-variant-filled-foreground: var(--text-on-secondary);
|
|
240
277
|
--button-variant-filled-hover: var(--fill-secondary-strong-hover);
|
|
241
278
|
--button-variant-filled-disabled: var(--fill-secondary-strong-disabled);
|
|
242
279
|
--button-variant-filled-foreground-disabled: var(--text-on-secondary-disabled);
|
|
243
|
-
|
|
280
|
+
|
|
281
|
+
/* Filled Weak */
|
|
282
|
+
--button-variant-filled-weak: var(--fill-secondary-weak);
|
|
283
|
+
--button-variant-filled-weak-foreground: var(--text-secondary-weak);
|
|
284
|
+
--button-variant-filled-weak-hover: var(--fill-secondary-weak-hover);
|
|
285
|
+
--button-variant-filled-weak-disabled: var(--fill-secondary-weak-disabled);
|
|
286
|
+
--button-variant-filled-weak-foreground-disabled: var(--text-secondary-weak-disabled);
|
|
287
|
+
|
|
244
288
|
/* Outlined */
|
|
245
289
|
--button-variant-outlined: transparent;
|
|
246
290
|
--button-variant-outlined-foreground: var(--text-secondary-strong);
|
|
@@ -248,12 +292,12 @@
|
|
|
248
292
|
--button-variant-outlined-border: var(--stroke-secondary);
|
|
249
293
|
--button-variant-outlined-border-disabled: var(--stroke-secondary-disabled);
|
|
250
294
|
--button-variant-outlined-foreground-disabled: var(--text-secondary-disabled);
|
|
251
|
-
|
|
295
|
+
|
|
252
296
|
/* Text */
|
|
253
297
|
--button-variant-text: transparent;
|
|
254
298
|
--button-variant-text-foreground: var(--text-secondary-weak);
|
|
255
299
|
--button-variant-text-hover: var(--fill-secondary-weak-hover);
|
|
256
|
-
|
|
300
|
+
|
|
257
301
|
/* Gradient */
|
|
258
302
|
--button-variant-gradient-start: var(--gradient-secondary-start);
|
|
259
303
|
--button-variant-gradient-end: var(--gradient-secondary-end);
|
|
@@ -265,14 +309,21 @@
|
|
|
265
309
|
.noeffect,
|
|
266
310
|
:global(.button-noeffect) {
|
|
267
311
|
--button-ring-color: var(--ring-noeffect);
|
|
268
|
-
|
|
312
|
+
|
|
269
313
|
/* Filled */
|
|
270
314
|
--button-variant-filled: var(--fill-noeffect-strong);
|
|
271
315
|
--button-variant-filled-foreground: var(--text-on-noeffect);
|
|
272
316
|
--button-variant-filled-hover: var(--fill-noeffect-strong-hover);
|
|
273
317
|
--button-variant-filled-disabled: var(--fill-noeffect-strong-disabled);
|
|
274
318
|
--button-variant-filled-foreground-disabled: var(--text-on-noeffect-disabled);
|
|
275
|
-
|
|
319
|
+
|
|
320
|
+
/* Filled Weak */
|
|
321
|
+
--button-variant-filled-weak: var(--fill-noeffect-weak);
|
|
322
|
+
--button-variant-filled-weak-foreground: var(--text-on-noeffect);
|
|
323
|
+
--button-variant-filled-weak-hover: var(--fill-noeffect-weak-hover);
|
|
324
|
+
--button-variant-filled-weak-disabled: var(--fill-noeffect-weak-disabled);
|
|
325
|
+
--button-variant-filled-weak-foreground-disabled: var(--text-on-noeffect-disabled);
|
|
326
|
+
|
|
276
327
|
/* Outlined */
|
|
277
328
|
--button-variant-outlined: transparent;
|
|
278
329
|
--button-variant-outlined-foreground: var(--text-noeffect-strong);
|
|
@@ -280,12 +331,12 @@
|
|
|
280
331
|
--button-variant-outlined-border: var(--stroke-noeffect);
|
|
281
332
|
--button-variant-outlined-border-disabled: var(--stroke-noeffect-disabled);
|
|
282
333
|
--button-variant-outlined-foreground-disabled: var(--text-noeffect-disabled);
|
|
283
|
-
|
|
334
|
+
|
|
284
335
|
/* Text */
|
|
285
336
|
--button-variant-text: transparent;
|
|
286
337
|
--button-variant-text-foreground: var(--text-noeffect-weak);
|
|
287
338
|
--button-variant-text-hover: var(--fill-noeffect-weak-hover);
|
|
288
|
-
|
|
339
|
+
|
|
289
340
|
/* Gradient */
|
|
290
341
|
--button-variant-gradient-start: var(--gradient-noeffect-start);
|
|
291
342
|
--button-variant-gradient-end: var(--gradient-noeffect-end);
|
|
@@ -297,14 +348,21 @@
|
|
|
297
348
|
.success,
|
|
298
349
|
:global(.button-success) {
|
|
299
350
|
--button-ring-color: var(--ring-success);
|
|
300
|
-
|
|
351
|
+
|
|
301
352
|
/* Filled */
|
|
302
353
|
--button-variant-filled: var(--fill-success-strong);
|
|
303
354
|
--button-variant-filled-foreground: var(--text-on-success);
|
|
304
355
|
--button-variant-filled-hover: var(--fill-success-strong-hover);
|
|
305
356
|
--button-variant-filled-disabled: var(--fill-success-strong-disabled);
|
|
306
357
|
--button-variant-filled-foreground-disabled: var(--text-on-success-disabled);
|
|
307
|
-
|
|
358
|
+
|
|
359
|
+
/* Filled Weak */
|
|
360
|
+
--button-variant-filled-weak: var(--fill-success-weak);
|
|
361
|
+
--button-variant-filled-weak-foreground: var(--text-success-weak);
|
|
362
|
+
--button-variant-filled-weak-hover: var(--fill-success-weak-hover);
|
|
363
|
+
--button-variant-filled-weak-disabled: var(--fill-success-weak-disabled);
|
|
364
|
+
--button-variant-filled-weak-foreground-disabled: var(--text-success-weak-disabled);
|
|
365
|
+
|
|
308
366
|
/* Outlined */
|
|
309
367
|
--button-variant-outlined: transparent;
|
|
310
368
|
--button-variant-outlined-foreground: var(--text-success-strong);
|
|
@@ -312,12 +370,12 @@
|
|
|
312
370
|
--button-variant-outlined-border: var(--stroke-success);
|
|
313
371
|
--button-variant-outlined-border-disabled: var(--stroke-success-disabled);
|
|
314
372
|
--button-variant-outlined-foreground-disabled: var(--text-success-disabled);
|
|
315
|
-
|
|
373
|
+
|
|
316
374
|
/* Text */
|
|
317
375
|
--button-variant-text: transparent;
|
|
318
376
|
--button-variant-text-foreground: var(--text-success-weak);
|
|
319
377
|
--button-variant-text-hover: var(--fill-success-weak-hover);
|
|
320
|
-
|
|
378
|
+
|
|
321
379
|
/* Gradient */
|
|
322
380
|
--button-variant-gradient-start: var(--gradient-success-start);
|
|
323
381
|
--button-variant-gradient-end: var(--gradient-success-end);
|
|
@@ -329,14 +387,21 @@
|
|
|
329
387
|
.info,
|
|
330
388
|
:global(.button-info) {
|
|
331
389
|
--button-ring-color: var(--ring-info);
|
|
332
|
-
|
|
390
|
+
|
|
333
391
|
/* Filled */
|
|
334
392
|
--button-variant-filled: var(--fill-info-strong);
|
|
335
393
|
--button-variant-filled-foreground: var(--text-on-info);
|
|
336
394
|
--button-variant-filled-hover: var(--fill-info-strong-hover);
|
|
337
395
|
--button-variant-filled-disabled: var(--fill-info-strong-disabled);
|
|
338
396
|
--button-variant-filled-foreground-disabled: var(--text-on-info-disabled);
|
|
339
|
-
|
|
397
|
+
|
|
398
|
+
/* Filled Weak */
|
|
399
|
+
--button-variant-filled-weak: var(--fill-info-weak);
|
|
400
|
+
--button-variant-filled-weak-foreground: var(--text-info-weak);
|
|
401
|
+
--button-variant-filled-weak-hover: var(--fill-info-weak-hover);
|
|
402
|
+
--button-variant-filled-weak-disabled: var(--fill-info-weak-disabled);
|
|
403
|
+
--button-variant-filled-weak-foreground-disabled: var(--text-info-weak-disabled);
|
|
404
|
+
|
|
340
405
|
/* Outlined */
|
|
341
406
|
--button-variant-outlined: transparent;
|
|
342
407
|
--button-variant-outlined-foreground: var(--text-info-strong);
|
|
@@ -344,12 +409,12 @@
|
|
|
344
409
|
--button-variant-outlined-border: var(--stroke-info);
|
|
345
410
|
--button-variant-outlined-border-disabled: var(--stroke-info-disabled);
|
|
346
411
|
--button-variant-outlined-foreground-disabled: var(--text-info-disabled);
|
|
347
|
-
|
|
412
|
+
|
|
348
413
|
/* Text */
|
|
349
414
|
--button-variant-text: transparent;
|
|
350
415
|
--button-variant-text-foreground: var(--text-info-weak);
|
|
351
416
|
--button-variant-text-hover: var(--fill-info-weak-hover);
|
|
352
|
-
|
|
417
|
+
|
|
353
418
|
/* Gradient */
|
|
354
419
|
--button-variant-gradient-start: var(--gradient-info-start);
|
|
355
420
|
--button-variant-gradient-end: var(--gradient-info-end);
|
|
@@ -361,14 +426,21 @@
|
|
|
361
426
|
.warning,
|
|
362
427
|
:global(.button-warning) {
|
|
363
428
|
--button-ring-color: var(--ring-warning);
|
|
364
|
-
|
|
429
|
+
|
|
365
430
|
/* Filled */
|
|
366
431
|
--button-variant-filled: var(--fill-warning-strong);
|
|
367
432
|
--button-variant-filled-foreground: var(--text-on-warning);
|
|
368
433
|
--button-variant-filled-hover: var(--fill-warning-strong-hover);
|
|
369
434
|
--button-variant-filled-disabled: var(--fill-warning-strong-disabled);
|
|
370
435
|
--button-variant-filled-foreground-disabled: var(--text-on-warning-disabled);
|
|
371
|
-
|
|
436
|
+
|
|
437
|
+
/* Filled Weak */
|
|
438
|
+
--button-variant-filled-weak: var(--fill-warning-weak);
|
|
439
|
+
--button-variant-filled-weak-foreground: var(--text-warning-weak);
|
|
440
|
+
--button-variant-filled-weak-hover: var(--fill-warning-weak-hover);
|
|
441
|
+
--button-variant-filled-weak-disabled: var(--fill-warning-weak-disabled);
|
|
442
|
+
--button-variant-filled-weak-foreground-disabled: var(--text-warning-weak-disabled);
|
|
443
|
+
|
|
372
444
|
/* Outlined */
|
|
373
445
|
--button-variant-outlined: transparent;
|
|
374
446
|
--button-variant-outlined-foreground: var(--text-warning-strong);
|
|
@@ -376,12 +448,12 @@
|
|
|
376
448
|
--button-variant-outlined-border: var(--stroke-warning);
|
|
377
449
|
--button-variant-outlined-border-disabled: var(--stroke-warning-disabled);
|
|
378
450
|
--button-variant-outlined-foreground-disabled: var(--text-warning-disabled);
|
|
379
|
-
|
|
451
|
+
|
|
380
452
|
/* Text */
|
|
381
453
|
--button-variant-text: transparent;
|
|
382
454
|
--button-variant-text-foreground: var(--text-warning-weak);
|
|
383
455
|
--button-variant-text-hover: var(--fill-warning-weak-hover);
|
|
384
|
-
|
|
456
|
+
|
|
385
457
|
/* Gradient */
|
|
386
458
|
--button-variant-gradient-start: var(--gradient-warning-start);
|
|
387
459
|
--button-variant-gradient-end: var(--gradient-warning-end);
|
|
@@ -393,14 +465,21 @@
|
|
|
393
465
|
.danger,
|
|
394
466
|
:global(.button-danger) {
|
|
395
467
|
--button-ring-color: var(--ring-danger);
|
|
396
|
-
|
|
468
|
+
|
|
397
469
|
/* Filled */
|
|
398
470
|
--button-variant-filled: var(--fill-danger-strong);
|
|
399
471
|
--button-variant-filled-foreground: var(--text-on-danger);
|
|
400
472
|
--button-variant-filled-hover: var(--fill-danger-strong-hover);
|
|
401
473
|
--button-variant-filled-disabled: var(--fill-danger-strong-disabled);
|
|
402
474
|
--button-variant-filled-foreground-disabled: var(--text-on-danger-disabled);
|
|
403
|
-
|
|
475
|
+
|
|
476
|
+
/* Filled Weak */
|
|
477
|
+
--button-variant-filled-weak: var(--fill-danger-weak);
|
|
478
|
+
--button-variant-filled-weak-foreground: var(--text-danger-weak);
|
|
479
|
+
--button-variant-filled-weak-hover: var(--fill-danger-weak-hover);
|
|
480
|
+
--button-variant-filled-weak-disabled: var(--fill-danger-weak-disabled);
|
|
481
|
+
--button-variant-filled-weak-foreground-disabled: var(--text-danger-weak-disabled);
|
|
482
|
+
|
|
404
483
|
/* Outlined */
|
|
405
484
|
--button-variant-outlined: transparent;
|
|
406
485
|
--button-variant-outlined-foreground: var(--text-danger-strong);
|
|
@@ -408,12 +487,12 @@
|
|
|
408
487
|
--button-variant-outlined-border: var(--stroke-danger);
|
|
409
488
|
--button-variant-outlined-border-disabled: var(--stroke-danger-disabled);
|
|
410
489
|
--button-variant-outlined-foreground-disabled: var(--text-danger-disabled);
|
|
411
|
-
|
|
490
|
+
|
|
412
491
|
/* Text */
|
|
413
492
|
--button-variant-text: transparent;
|
|
414
493
|
--button-variant-text-foreground: var(--text-danger-weak);
|
|
415
494
|
--button-variant-text-hover: var(--fill-danger-weak-hover);
|
|
416
|
-
|
|
495
|
+
|
|
417
496
|
/* Gradient */
|
|
418
497
|
--button-variant-gradient-start: var(--gradient-danger-start);
|
|
419
498
|
--button-variant-gradient-end: var(--gradient-danger-end);
|
|
@@ -101,6 +101,24 @@
|
|
|
101
101
|
color: var(--button-variant-filled-foreground-disabled, oklch(from var(--button-variant-filled-foreground) calc(l * .9) calc(c * .85) h));
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
+
:is(.filled-weak-QLU8bA, .button-filled) {
|
|
105
|
+
color: var(--button-variant-filled-weak-foreground);
|
|
106
|
+
background-color: var(--button-variant-filled-weak);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
:is(.filled-weak-QLU8bA:hover, .button-filled:hover) {
|
|
110
|
+
background-color: var(--button-variant-filled-weak-hover);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
:is(.filled-weak-QLU8bA:focus, .filled-weak-QLU8bA:active, .button-filled:focus, .button-filled:active) {
|
|
114
|
+
--ring-color: var(--button-ring-color);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
:is(.filled-weak-QLU8bA:disabled, .filled-CwGsrO[disabled], .button-filled:disabled, .button-filled[disabled]) {
|
|
118
|
+
background-color: var(--button-variant-filled-weak-disabled, oklch(from var(--button-variant-filled-weak) calc(l * 1.1) calc(c * .85) h));
|
|
119
|
+
color: var(--button-variant-filled-weak-foreground-disabled, oklch(from var(--button-variant-filled-weak-foreground) calc(l * .9) calc(c * .85) h));
|
|
120
|
+
}
|
|
121
|
+
|
|
104
122
|
:is(.outlined-nZGbxu, .button-outlined) {
|
|
105
123
|
border: 1px solid var(--button-variant-outlined-border);
|
|
106
124
|
color: var(--button-variant-outlined-foreground);
|
|
@@ -164,6 +182,11 @@
|
|
|
164
182
|
--button-variant-filled-hover: var(--fill-primary-strong-hover);
|
|
165
183
|
--button-variant-filled-disabled: var(--fill-primary-strong-disabled);
|
|
166
184
|
--button-variant-filled-foreground-disabled: var(--text-on-primary-disabled);
|
|
185
|
+
--button-variant-filled-weak: var(--fill-primary-weak);
|
|
186
|
+
--button-variant-filled-weak-foreground: var(--text-primary-weak);
|
|
187
|
+
--button-variant-filled-weak-hover: var(--fill-primary-weak-hover);
|
|
188
|
+
--button-variant-filled-weak-disabled: var(--fill-primary-weak-disabled);
|
|
189
|
+
--button-variant-filled-weak-foreground-disabled: var(--text-on-primary-disabled);
|
|
167
190
|
--button-variant-outlined: transparent;
|
|
168
191
|
--button-variant-outlined-foreground: var(--text-primary-strong);
|
|
169
192
|
--button-variant-outlined-hover: var(--fill-primary-weak);
|
|
@@ -187,6 +210,11 @@
|
|
|
187
210
|
--button-variant-filled-hover: var(--fill-secondary-strong-hover);
|
|
188
211
|
--button-variant-filled-disabled: var(--fill-secondary-strong-disabled);
|
|
189
212
|
--button-variant-filled-foreground-disabled: var(--text-on-secondary-disabled);
|
|
213
|
+
--button-variant-filled-weak: var(--fill-secondary-weak);
|
|
214
|
+
--button-variant-filled-weak-foreground: var(--text-secondary-weak);
|
|
215
|
+
--button-variant-filled-weak-hover: var(--fill-secondary-weak-hover);
|
|
216
|
+
--button-variant-filled-weak-disabled: var(--fill-secondary-weak-disabled);
|
|
217
|
+
--button-variant-filled-weak-foreground-disabled: var(--text-secondary-weak-disabled);
|
|
190
218
|
--button-variant-outlined: transparent;
|
|
191
219
|
--button-variant-outlined-foreground: var(--text-secondary-strong);
|
|
192
220
|
--button-variant-outlined-hover: var(--fill-secondary-weak);
|
|
@@ -210,6 +238,11 @@
|
|
|
210
238
|
--button-variant-filled-hover: var(--fill-noeffect-strong-hover);
|
|
211
239
|
--button-variant-filled-disabled: var(--fill-noeffect-strong-disabled);
|
|
212
240
|
--button-variant-filled-foreground-disabled: var(--text-on-noeffect-disabled);
|
|
241
|
+
--button-variant-filled-weak: var(--fill-noeffect-weak);
|
|
242
|
+
--button-variant-filled-weak-foreground: var(--text-on-noeffect);
|
|
243
|
+
--button-variant-filled-weak-hover: var(--fill-noeffect-weak-hover);
|
|
244
|
+
--button-variant-filled-weak-disabled: var(--fill-noeffect-weak-disabled);
|
|
245
|
+
--button-variant-filled-weak-foreground-disabled: var(--text-on-noeffect-disabled);
|
|
213
246
|
--button-variant-outlined: transparent;
|
|
214
247
|
--button-variant-outlined-foreground: var(--text-noeffect-strong);
|
|
215
248
|
--button-variant-outlined-hover: var(--fill-noeffect-weak);
|
|
@@ -233,6 +266,11 @@
|
|
|
233
266
|
--button-variant-filled-hover: var(--fill-success-strong-hover);
|
|
234
267
|
--button-variant-filled-disabled: var(--fill-success-strong-disabled);
|
|
235
268
|
--button-variant-filled-foreground-disabled: var(--text-on-success-disabled);
|
|
269
|
+
--button-variant-filled-weak: var(--fill-success-weak);
|
|
270
|
+
--button-variant-filled-weak-foreground: var(--text-success-weak);
|
|
271
|
+
--button-variant-filled-weak-hover: var(--fill-success-weak-hover);
|
|
272
|
+
--button-variant-filled-weak-disabled: var(--fill-success-weak-disabled);
|
|
273
|
+
--button-variant-filled-weak-foreground-disabled: var(--text-success-weak-disabled);
|
|
236
274
|
--button-variant-outlined: transparent;
|
|
237
275
|
--button-variant-outlined-foreground: var(--text-success-strong);
|
|
238
276
|
--button-variant-outlined-hover: var(--fill-success-weak);
|
|
@@ -256,6 +294,11 @@
|
|
|
256
294
|
--button-variant-filled-hover: var(--fill-info-strong-hover);
|
|
257
295
|
--button-variant-filled-disabled: var(--fill-info-strong-disabled);
|
|
258
296
|
--button-variant-filled-foreground-disabled: var(--text-on-info-disabled);
|
|
297
|
+
--button-variant-filled-weak: var(--fill-info-weak);
|
|
298
|
+
--button-variant-filled-weak-foreground: var(--text-info-weak);
|
|
299
|
+
--button-variant-filled-weak-hover: var(--fill-info-weak-hover);
|
|
300
|
+
--button-variant-filled-weak-disabled: var(--fill-info-weak-disabled);
|
|
301
|
+
--button-variant-filled-weak-foreground-disabled: var(--text-info-weak-disabled);
|
|
259
302
|
--button-variant-outlined: transparent;
|
|
260
303
|
--button-variant-outlined-foreground: var(--text-info-strong);
|
|
261
304
|
--button-variant-outlined-hover: var(--fill-info-weak);
|
|
@@ -279,6 +322,11 @@
|
|
|
279
322
|
--button-variant-filled-hover: var(--fill-warning-strong-hover);
|
|
280
323
|
--button-variant-filled-disabled: var(--fill-warning-strong-disabled);
|
|
281
324
|
--button-variant-filled-foreground-disabled: var(--text-on-warning-disabled);
|
|
325
|
+
--button-variant-filled-weak: var(--fill-warning-weak);
|
|
326
|
+
--button-variant-filled-weak-foreground: var(--text-warning-weak);
|
|
327
|
+
--button-variant-filled-weak-hover: var(--fill-warning-weak-hover);
|
|
328
|
+
--button-variant-filled-weak-disabled: var(--fill-warning-weak-disabled);
|
|
329
|
+
--button-variant-filled-weak-foreground-disabled: var(--text-warning-weak-disabled);
|
|
282
330
|
--button-variant-outlined: transparent;
|
|
283
331
|
--button-variant-outlined-foreground: var(--text-warning-strong);
|
|
284
332
|
--button-variant-outlined-hover: var(--fill-warning-weak);
|
|
@@ -302,6 +350,11 @@
|
|
|
302
350
|
--button-variant-filled-hover: var(--fill-danger-strong-hover);
|
|
303
351
|
--button-variant-filled-disabled: var(--fill-danger-strong-disabled);
|
|
304
352
|
--button-variant-filled-foreground-disabled: var(--text-on-danger-disabled);
|
|
353
|
+
--button-variant-filled-weak: var(--fill-danger-weak);
|
|
354
|
+
--button-variant-filled-weak-foreground: var(--text-danger-weak);
|
|
355
|
+
--button-variant-filled-weak-hover: var(--fill-danger-weak-hover);
|
|
356
|
+
--button-variant-filled-weak-disabled: var(--fill-danger-weak-disabled);
|
|
357
|
+
--button-variant-filled-weak-foreground-disabled: var(--text-danger-weak-disabled);
|
|
305
358
|
--button-variant-outlined: transparent;
|
|
306
359
|
--button-variant-outlined-foreground: var(--text-danger-strong);
|
|
307
360
|
--button-variant-outlined-hover: var(--fill-danger-weak);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Intent, Size } from '../../@types/shared.js';
|
|
2
|
+
export declare const chipVariant: readonly ["assist", "selectable", "removable", "selectable-removable"];
|
|
3
|
+
export type ChipVariant = (typeof chipVariant)[number];
|
|
4
|
+
export type ChipIntent = Intent;
|
|
5
|
+
export type ChipSize = Size;
|
|
6
|
+
//# sourceMappingURL=chip.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chip.d.ts","sourceRoot":"","sources":["../../../../src/components/chips/@types/chip.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAA;AAE1D,eAAO,MAAM,WAAW,wEAAyE,CAAA;AACjG,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAA;AAEtD,MAAM,MAAM,UAAU,GAAG,MAAM,CAAA;AAC/B,MAAM,MAAM,QAAQ,GAAG,IAAI,CAAA"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { ChipIntent, ChipSize, ChipVariant } from './@types/chip.js';
|
|
3
|
+
type AsButton = {
|
|
4
|
+
asChild?: false;
|
|
5
|
+
} & React.ComponentPropsWithoutRef<'button'>;
|
|
6
|
+
interface AsSlot {
|
|
7
|
+
asChild?: true;
|
|
8
|
+
}
|
|
9
|
+
export type ChipRefType<C extends React.ElementType> = React.ComponentPropsWithRef<C>['ref'];
|
|
10
|
+
type ToggleEvent = React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>;
|
|
11
|
+
type RemoveEvent = React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>;
|
|
12
|
+
export type ChipProps<C extends React.ElementType = 'button'> = {
|
|
13
|
+
variant?: ChipVariant;
|
|
14
|
+
intent?: ChipIntent;
|
|
15
|
+
size?: ChipSize;
|
|
16
|
+
selected?: boolean;
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
startIcon?: React.ReactNode;
|
|
19
|
+
endIcon?: React.ReactNode;
|
|
20
|
+
selectedIcon?: React.ReactNode;
|
|
21
|
+
removeLabel?: string;
|
|
22
|
+
onToggle?: (selected: boolean, event: ToggleEvent) => void;
|
|
23
|
+
onRemove?: (event: RemoveEvent) => void;
|
|
24
|
+
className?: string;
|
|
25
|
+
ref?: ChipRefType<C>;
|
|
26
|
+
} & (AsButton | AsSlot) & Omit<React.HTMLAttributes<HTMLElement>, 'onToggle'>;
|
|
27
|
+
export declare const Chip: {
|
|
28
|
+
<C extends React.ElementType = "button">({ variant, intent, size, selected, disabled, startIcon, endIcon, selectedIcon, removeLabel, onToggle, onRemove, className, children, asChild, ref, ...rest }: ChipProps<C>): React.JSX.Element;
|
|
29
|
+
displayName: string;
|
|
30
|
+
};
|
|
31
|
+
export {};
|
|
32
|
+
//# sourceMappingURL=chip.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chip.d.ts","sourceRoot":"","sources":["../../../src/components/chips/chip.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAK9B,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAGzE,KAAK,QAAQ,GAAG;IAAE,OAAO,CAAC,EAAE,KAAK,CAAA;CAAE,GAAG,KAAK,CAAC,wBAAwB,CAAC,QAAQ,CAAC,CAAA;AAE9E,UAAU,MAAM;IACf,OAAO,CAAC,EAAE,IAAI,CAAA;CACd;AAED,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAA;AAE5F,KAAK,WAAW,GAAG,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,GAAG,KAAK,CAAC,aAAa,CAAC,WAAW,CAAC,CAAA;AACnF,KAAK,WAAW,GAAG,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,GAAG,KAAK,CAAC,aAAa,CAAC,WAAW,CAAC,CAAA;AAEnF,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,GAAG,QAAQ,IAAI;IAC/D,OAAO,CAAC,EAAE,WAAW,CAAA;IACrB,MAAM,CAAC,EAAE,UAAU,CAAA;IACnB,IAAI,CAAC,EAAE,QAAQ,CAAA;IACf,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC3B,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,KAAK,IAAI,CAAA;IAC1D,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAA;IACvC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,GAAG,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,CAAA;CACpB,GAAG,CAAC,QAAQ,GAAG,MAAM,CAAC,GACtB,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,EAAE,UAAU,CAAC,CAAA;AAEpD,eAAO,MAAM,IAAI;KAAI,CAAC,SAAS,KAAK,CAAC,WAAW,2KAiB7C,SAAS,CAAC,CAAC,CAAC;;CA6Hd,CAAA"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
4
|
+
import classnames from "classnames";
|
|
5
|
+
import { CheckIcon } from "../../icons/check-icon.js";
|
|
6
|
+
import { IconButton } from "../button/icon-button.js";
|
|
7
|
+
import { CloseIcon } from "../../icons/close-icon.js";
|
|
8
|
+
import chip_module from "./chip.module.js";
|
|
9
|
+
const Chip = ({ variant = 'assist', intent = 'primary', size = 'md', selected = false, disabled = false, startIcon, endIcon, selectedIcon, removeLabel = 'Remove chip', onToggle, onRemove, className, children, asChild, ref, ...rest })=>{
|
|
10
|
+
const { onClick, onKeyDown, role, tabIndex, ...restProps } = rest;
|
|
11
|
+
const Comp = true === asChild ? Slot : 'button';
|
|
12
|
+
const isSelectable = 'selectable' === variant || 'selectable-removable' === variant;
|
|
13
|
+
const isRemovable = 'removable' === variant || 'selectable-removable' === variant;
|
|
14
|
+
const isSelected = Boolean(selected);
|
|
15
|
+
const handleClick = (event)=>{
|
|
16
|
+
if (disabled) return void event.preventDefault();
|
|
17
|
+
if (onClick) onClick(event);
|
|
18
|
+
if (isSelectable && onToggle) onToggle(!isSelected, event);
|
|
19
|
+
};
|
|
20
|
+
const handleKeyDown = (event)=>{
|
|
21
|
+
if (disabled) return;
|
|
22
|
+
if (('Enter' === event.key || ' ' === event.key) && true === asChild) {
|
|
23
|
+
event.preventDefault();
|
|
24
|
+
if (onClick) onClick(event);
|
|
25
|
+
if (isSelectable && onToggle) onToggle(!isSelected, event);
|
|
26
|
+
}
|
|
27
|
+
if (('Backspace' === event.key || 'Delete' === event.key) && isRemovable && onRemove) {
|
|
28
|
+
event.preventDefault();
|
|
29
|
+
onRemove(event);
|
|
30
|
+
}
|
|
31
|
+
if (onKeyDown) onKeyDown(event);
|
|
32
|
+
};
|
|
33
|
+
const handleRemoveClick = (event)=>{
|
|
34
|
+
if (disabled) return;
|
|
35
|
+
event.stopPropagation();
|
|
36
|
+
if (onRemove) onRemove(event);
|
|
37
|
+
};
|
|
38
|
+
const handleRemoveKeyDown = (event)=>{
|
|
39
|
+
if (disabled) return;
|
|
40
|
+
if ('Enter' === event.key || ' ' === event.key || 'Backspace' === event.key || 'Delete' === event.key) {
|
|
41
|
+
event.preventDefault();
|
|
42
|
+
event.stopPropagation();
|
|
43
|
+
if (onRemove) onRemove(event);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
const leadingIcon = startIcon ?? (isSelectable && isSelected ? selectedIcon ?? /*#__PURE__*/ jsx(CheckIcon, {
|
|
47
|
+
className: chip_module.icon
|
|
48
|
+
}) : null);
|
|
49
|
+
const trailingIcon = isRemovable ? /*#__PURE__*/ jsx(IconButton, {
|
|
50
|
+
role: "button",
|
|
51
|
+
variant: isSelected ? 'filled-weak' : 'outlined',
|
|
52
|
+
className: classnames('remove', chip_module.remove, chip_module["end-icon"]),
|
|
53
|
+
tabIndex: disabled ? -1 : 0,
|
|
54
|
+
disabled: disabled,
|
|
55
|
+
"aria-label": removeLabel,
|
|
56
|
+
onClick: handleRemoveClick,
|
|
57
|
+
onKeyDown: handleRemoveKeyDown,
|
|
58
|
+
children: /*#__PURE__*/ jsx(CloseIcon, {
|
|
59
|
+
className: chip_module.icon
|
|
60
|
+
})
|
|
61
|
+
}) : endIcon;
|
|
62
|
+
const appliedVariant = isSelected ? 'filled' : 'outlined';
|
|
63
|
+
return /*#__PURE__*/ jsxs(Comp, {
|
|
64
|
+
ref: ref,
|
|
65
|
+
type: true === asChild ? void 0 : 'button',
|
|
66
|
+
role: role ?? (true === asChild ? 'button' : void 0),
|
|
67
|
+
tabIndex: disabled ? -1 : tabIndex ?? 0,
|
|
68
|
+
"aria-disabled": disabled || void 0,
|
|
69
|
+
"aria-pressed": isSelectable ? isSelected : void 0,
|
|
70
|
+
"aria-selected": isSelectable ? isSelected : void 0,
|
|
71
|
+
className: classnames('chip', variant, intent, size, {
|
|
72
|
+
selected: isSelected,
|
|
73
|
+
disabled,
|
|
74
|
+
removable: isRemovable
|
|
75
|
+
}, chip_module.chip, chip_module[appliedVariant], chip_module[intent], chip_module[size], className),
|
|
76
|
+
disabled: true === asChild ? void 0 : disabled,
|
|
77
|
+
onClick: handleClick,
|
|
78
|
+
onKeyDown: handleKeyDown,
|
|
79
|
+
...restProps,
|
|
80
|
+
children: [
|
|
81
|
+
null != leadingIcon && /*#__PURE__*/ jsx("span", {
|
|
82
|
+
className: classnames(chip_module.iconWrapper),
|
|
83
|
+
children: leadingIcon
|
|
84
|
+
}),
|
|
85
|
+
/*#__PURE__*/ jsx("span", {
|
|
86
|
+
className: chip_module.label,
|
|
87
|
+
children: children
|
|
88
|
+
}),
|
|
89
|
+
null != trailingIcon && /*#__PURE__*/ jsx("span", {
|
|
90
|
+
className: classnames(chip_module.iconWrapper),
|
|
91
|
+
children: trailingIcon
|
|
92
|
+
})
|
|
93
|
+
]
|
|
94
|
+
});
|
|
95
|
+
};
|
|
96
|
+
Chip.displayName = 'Chip';
|
|
97
|
+
export { Chip };
|