@rescui/chip-list 0.14.1 → 0.14.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
@@ -1,4 +1,5 @@
1
1
  # Tab-list and Chip-list
2
2
 
3
- * [Usage examples of TabList](./docs/demo.md)
4
- * [Usage examples of ChipList](./docs/chip-list/demo.md)
3
+ ## LLM
4
+
5
+ To get the docs for the LLM, check out [this index](./llm/index.md).
package/lib/index.css CHANGED
@@ -1,19 +1,19 @@
1
- ._light_clap9i_8{
1
+ ._light_t5wzop_8{
2
2
  --rs-theme-dark:0;
3
3
  }
4
- ._dark_clap9i_11{
4
+ ._dark_t5wzop_11{
5
5
  --rs-theme-dark:1;
6
6
  }
7
- ._alignLeft_clap9i_15{
7
+ ._alignLeft_t5wzop_15{
8
8
  --_rs-cl-align:left;
9
9
  }
10
- ._alignCenter_clap9i_18{
10
+ ._alignCenter_t5wzop_18{
11
11
  --_rs-cl-align:center;
12
12
  }
13
- ._alignRight_clap9i_21{
13
+ ._alignRight_t5wzop_21{
14
14
  --_rs-cl-align:right;
15
15
  }
16
- ._sizeXs_clap9i_25{
16
+ ._sizeXs_t5wzop_25{
17
17
  --_rs-cl-chip-base-border-radius:4px;
18
18
  --_rs-cl-chip-compact-border-radius:var(--_rs-cl-chip-base-border-radius);
19
19
  --_rs-cl-chip-vertical-padding:2px;
@@ -27,7 +27,7 @@
27
27
  --_rs-cl-compact-horizontal-gap:4px;
28
28
  --_rs-cl-sparse-horizontal-gap:12px;
29
29
  }
30
- ._sizeXs_clap9i_25 [data-rs-internal='chip-list__chip']{
30
+ ._sizeXs_t5wzop_25 [data-rs-internal='chip-list__chip']{
31
31
  --_rs-typography-letter-spacing:var(--rs-text-3-letter-spacing, 0.0045em);
32
32
  --_rs-typography-text-transform:initial;
33
33
  --_rs-typography-font-variant-numeric:initial;
@@ -62,7 +62,7 @@
62
62
  --_rs-typography-link-external-standalone-border-offset-from-text-base:1.02em;
63
63
  --_rs-typography-link-border-bottom-width-from-text:1px;
64
64
  }
65
- ._sizeS_clap9i_28{
65
+ ._sizeS_t5wzop_28{
66
66
  --_rs-cl-chip-base-border-radius:16px;
67
67
  --_rs-cl-chip-compact-border-radius:4px;
68
68
  --_rs-cl-chip-vertical-padding:6px;
@@ -76,7 +76,7 @@
76
76
  --_rs-cl-compact-horizontal-gap:6px;
77
77
  --_rs-cl-sparse-horizontal-gap:12px;
78
78
  }
79
- ._sizeS_clap9i_28 [data-rs-internal='chip-list__chip']{
79
+ ._sizeS_t5wzop_28 [data-rs-internal='chip-list__chip']{
80
80
  --_rs-typography-letter-spacing:var(--rs-text-3-letter-spacing, 0.0045em);
81
81
  --_rs-typography-text-transform:initial;
82
82
  --_rs-typography-font-variant-numeric:initial;
@@ -111,7 +111,7 @@
111
111
  --_rs-typography-link-external-standalone-border-offset-from-text-base:1.02em;
112
112
  --_rs-typography-link-border-bottom-width-from-text:1px;
113
113
  }
114
- ._sizeM_clap9i_31{
114
+ ._sizeM_t5wzop_31{
115
115
  --_rs-cl-chip-base-border-radius:20px;
116
116
  --_rs-cl-chip-compact-border-radius:8px;
117
117
  --_rs-cl-chip-vertical-padding:8px;
@@ -125,7 +125,7 @@
125
125
  --_rs-cl-compact-horizontal-gap:6px;
126
126
  --_rs-cl-sparse-horizontal-gap:16px;
127
127
  }
128
- ._sizeM_clap9i_31 [data-rs-internal='chip-list__chip']{
128
+ ._sizeM_t5wzop_31 [data-rs-internal='chip-list__chip']{
129
129
  --_rs-typography-letter-spacing:var(--rs-text-2-letter-spacing, 0.0015em);
130
130
  --_rs-typography-text-transform:initial;
131
131
  --_rs-typography-font-variant-numeric:initial;
@@ -164,11 +164,11 @@
164
164
  --_rs-typography-link-border-bottom-width-from-text:1px;
165
165
  }
166
166
  @media screen and (max-width: 640px){
167
- ._sizeM_clap9i_31 [data-rs-internal='chip-list__chip']{
167
+ ._sizeM_t5wzop_31 [data-rs-internal='chip-list__chip']{
168
168
  --_rs-typography-text-2-sm-list-li-margin-top-from-text:12px;
169
169
  }
170
170
  }
171
- ._sizeL_clap9i_34{
171
+ ._sizeL_t5wzop_34{
172
172
  --_rs-cl-chip-base-border-radius:26px;
173
173
  --_rs-cl-chip-compact-border-radius:12px;
174
174
  --_rs-cl-chip-vertical-padding:12px;
@@ -183,11 +183,11 @@
183
183
  --_rs-cl-sparse-horizontal-gap:16px;
184
184
  }
185
185
  @media screen and (max-width: 640px){
186
- ._sizeL_clap9i_34{
186
+ ._sizeL_t5wzop_34{
187
187
  --_rs-cl-vertical-gap:12px;
188
188
  }
189
189
  }
190
- ._sizeL_clap9i_34 [data-rs-internal='chip-list__chip']{
190
+ ._sizeL_t5wzop_34 [data-rs-internal='chip-list__chip']{
191
191
  --_rs-typography-letter-spacing:var(--rs-text-1-letter-spacing, normal);
192
192
  --_rs-typography-text-transform:initial;
193
193
  --_rs-typography-font-variant-numeric:initial;
@@ -226,34 +226,34 @@
226
226
  --_rs-typography-link-border-bottom-width-from-text:1px;
227
227
  }
228
228
  @media screen and (max-width: 640px){
229
- ._sizeL_clap9i_34 [data-rs-internal='chip-list__chip']{
229
+ ._sizeL_t5wzop_34 [data-rs-internal='chip-list__chip']{
230
230
  --_rs-typography-text-1-sm-list-li-margin-top-from-text:16px;
231
231
  }
232
232
  }
233
- ._innerOffsetL_clap9i_38{
233
+ ._innerOffsetL_t5wzop_38{
234
234
  --_rs-cl-horizontal-gap-from-sparse:var(--_rs-cl-sparse-horizontal-gap);
235
235
  }
236
236
  @media screen and (max-width: 640px){
237
- ._innerOffsetL_clap9i_38{
237
+ ._innerOffsetL_t5wzop_38{
238
238
  --_rs-cl-horizontal-gap-from-sparse:var(--_rs-cl-base-horizontal-gap);
239
239
  }
240
240
  }
241
- ._innerOffsetM_clap9i_41{
241
+ ._innerOffsetM_t5wzop_41{
242
242
  --_rs-cl-horizontal-gap-from-sparse:initial;
243
243
  }
244
- ._classic_clap9i_45{
244
+ ._classic_t5wzop_45{
245
245
  --_rs-cl-chip-active-border-color:var(--_rs-color-primary);
246
246
  --_rs-cl-chip-selected-border-color:var(--_rs-color-primary);
247
247
  --_rs-cl-chip-hover-background:var(--_rs-color-primary-t-fog);
248
248
  --_rs-cl-chip-active-background:var(--_rs-color-primary-t-fog);
249
249
  }
250
- ._rock_clap9i_48{
250
+ ._rock_t5wzop_48{
251
251
  --_rs-cl-chip-active-border-color:rgba(calc(25 + var(--_rs-theme-dark-coefficient, 0)*230), calc(25 + var(--_rs-theme-dark-coefficient, 0)*230), calc(28 + var(--_rs-theme-dark-coefficient, 0)*227));
252
252
  --_rs-cl-chip-selected-border-color:rgba(calc(25 + var(--_rs-theme-dark-coefficient, 0)*230), calc(25 + var(--_rs-theme-dark-coefficient, 0)*230), calc(28 + var(--_rs-theme-dark-coefficient, 0)*227));
253
253
  --_rs-cl-chip-hover-background:rgba(calc(25 + var(--_rs-theme-dark-coefficient, 0)*230), calc(25 + var(--_rs-theme-dark-coefficient, 0)*230), calc(28 + var(--_rs-theme-dark-coefficient, 0)*227), 0.1);
254
254
  --_rs-cl-chip-active-background:rgba(calc(25 + var(--_rs-theme-dark-coefficient, 0)*230), calc(25 + var(--_rs-theme-dark-coefficient, 0)*230), calc(28 + var(--_rs-theme-dark-coefficient, 0)*227), 0.1);
255
255
  }
256
- ._compact_clap9i_52{
256
+ ._compact_t5wzop_52{
257
257
  --_rs-cl-chip-border-radius-from-compact:var(
258
258
  --_rs-cl-chip-compact-border-radius
259
259
  );
@@ -262,7 +262,7 @@
262
262
  );
263
263
  --_rs-cl-horizontal-gap-from-compact:var(--_rs-cl-compact-horizontal-gap);
264
264
  }
265
- ._main_clap9i_56{
265
+ ._main_t5wzop_56{
266
266
  --_rs-theme-dark:var(
267
267
  --_rs-internal-force-theme-dark-consult-rescui-before-using,
268
268
  var(--rs-theme-dark, 0)
@@ -272,7 +272,7 @@
272
272
  --_rs-theme-light-coefficient:calc(1 - var(--_rs-theme-dark-coefficient));
273
273
  }
274
274
  @supports (color: color-mix(in srgb, #fff 50%, #000 50%)){
275
- ._main_clap9i_56{
275
+ ._main_t5wzop_56{
276
276
  --_rs-color-primary:color-mix(in srgb, var(--rs-color-primary-light-theme, #6B57FF) calc(100%*var(--_rs-theme-light-coefficient, 1)), var(--rs-color-primary-dark-theme, #8473FF) calc(100%*var(--_rs-theme-dark-coefficient, 0)));
277
277
  --_rs-color-primary-dim:color-mix(in srgb, var(--rs-color-primary-dim-light-theme, #8979ff) calc(100%*var(--_rs-theme-light-coefficient, 1)), var(--rs-color-primary-dim-dark-theme, #6f61d2) calc(100%*var(--_rs-theme-dark-coefficient, 0)));
278
278
  --_rs-color-primary-fog:color-mix(in srgb, var(--rs-color-primary-fog-light-theme, #e1ddff) calc(100%*var(--_rs-theme-light-coefficient, 1)), var(--rs-color-primary-fog-dark-theme, #2e2b49) calc(100%*var(--_rs-theme-dark-coefficient, 0)));
@@ -281,7 +281,7 @@
281
281
  }
282
282
  }
283
283
  @supports not (color: color-mix(in srgb, #fff 50%, #000 50%)){
284
- ._main_clap9i_56{
284
+ ._main_t5wzop_56{
285
285
  --_rs-color-primary:rgb(calc(var(--_rs-theme-light-coefficient, 1)*107 + var(--_rs-theme-dark-coefficient, 0)*132), calc(var(--_rs-theme-light-coefficient, 1)*87 + var(--_rs-theme-dark-coefficient, 0)*115), 255);
286
286
  --_rs-color-primary-dim:rgb(calc(var(--_rs-theme-light-coefficient, 1)*137 + var(--_rs-theme-dark-coefficient, 0)*111), calc(var(--_rs-theme-light-coefficient, 1)*121 + var(--_rs-theme-dark-coefficient, 0)*97), calc(var(--_rs-theme-light-coefficient, 1)*255 + var(--_rs-theme-dark-coefficient, 0)*210));
287
287
  --_rs-color-primary-fog:rgb(calc(var(--_rs-theme-light-coefficient, 1)*225 + var(--_rs-theme-dark-coefficient, 0)*46), calc(var(--_rs-theme-light-coefficient, 1)*221 + var(--_rs-theme-dark-coefficient, 0)*43), calc(var(--_rs-theme-light-coefficient, 1)*255 + var(--_rs-theme-dark-coefficient, 0)*73));
@@ -289,7 +289,7 @@
289
289
  --_rs-color-primary-t-fog:rgba(calc(var(--_rs-theme-light-coefficient, 1)*107 + var(--_rs-theme-dark-coefficient, 0)*132), calc(var(--_rs-theme-light-coefficient, 1)*87 + var(--_rs-theme-dark-coefficient, 0)*115), 255, calc(var(--_rs-theme-light-coefficient, 1)*0.2 + var(--_rs-theme-dark-coefficient, 0)*0.3));
290
290
  }
291
291
  }
292
- ._main_clap9i_56 {
292
+ ._main_t5wzop_56 {
293
293
  --_rs-cl-chip-border-radius:var(
294
294
  --_rs-cl-chip-border-radius-from-compact,
295
295
  var(--_rs-cl-chip-base-border-radius)
@@ -303,7 +303,7 @@
303
303
  var(--_rs-cl-horizontal-gap-from-sparse, var(--_rs-cl-base-horizontal-gap))
304
304
  );
305
305
  }
306
- ._chipsContainer_clap9i_62{
306
+ ._chipsContainer_t5wzop_62{
307
307
  position:relative;
308
308
 
309
309
  display:flex;
@@ -312,17 +312,17 @@
312
312
 
313
313
  gap:var(--_rs-cl-vertical-gap) var(--_rs-cl-horizontal-gap);
314
314
  }
315
- ._alignIconLeft_clap9i_72{
315
+ ._alignIconLeft_t5wzop_72{
316
316
  --_rs-cl-chip-icon-flex-direction:row;
317
317
  --_rs-cl-chip-icon-position-multiplier-left:1;
318
318
  --_rs-cl-chip-icon-position-multiplier-right:0;
319
319
  }
320
- ._alignIconRight_clap9i_75{
320
+ ._alignIconRight_t5wzop_75{
321
321
  --_rs-cl-chip-icon-flex-direction:row-reverse;
322
322
  --_rs-cl-chip-icon-position-multiplier-left:0;
323
323
  --_rs-cl-chip-icon-position-multiplier-right:1;
324
324
  }
325
- ._chip_clap9i_62{
325
+ ._chip_t5wzop_62{
326
326
  letter-spacing:var(
327
327
  --rs-text-base-letter-spacing,
328
328
  var(--_rs-typography-letter-spacing)
@@ -374,25 +374,25 @@
374
374
  -moz-osx-font-smoothing:inherit;
375
375
  -webkit-appearance:none;
376
376
  }
377
- ._chip_clap9i_62::-moz-focus-inner{
377
+ ._chip_t5wzop_62::-moz-focus-inner{
378
378
  padding:0;
379
379
 
380
380
  border:none;
381
381
  }
382
- ._chip_clap9i_62:hover,
383
- ._chip_clap9i_62:focus,
384
- ._chip_clap9i_62:active{
382
+ ._chip_t5wzop_62:hover,
383
+ ._chip_t5wzop_62:focus,
384
+ ._chip_t5wzop_62:active{
385
385
  outline:none;
386
386
 
387
387
  text-decoration:none;
388
388
  }
389
- ._chip_clap9i_62:focus[data-focus-method='key']{
389
+ ._chip_t5wzop_62:focus[data-focus-method='key']{
390
390
  box-shadow:var(--_rs-color-primary-t-dim) 0 0 0 4px;
391
391
  }
392
- ._chip_clap9i_62:has(:focus[data-focus-method='key']){
392
+ ._chip_t5wzop_62:has(:focus[data-focus-method='key']){
393
393
  box-shadow:var(--_rs-color-primary-t-dim) 0 0 0 4px;
394
394
  }
395
- ._chip_clap9i_62:focus{
395
+ ._chip_t5wzop_62:focus{
396
396
  --_rs-cl-chip-border-color:rgba(
397
397
  calc(25 + var(--_rs-theme-dark-coefficient, 0)*230), calc(25 + var(--_rs-theme-dark-coefficient, 0)*230), calc(28 + var(--_rs-theme-dark-coefficient, 0)*227),
398
398
  calc(0.3 + var(--_rs-theme-dark-coefficient)*0.1)
@@ -401,7 +401,7 @@
401
401
  color:rgba(calc(25 + var(--_rs-theme-dark-coefficient, 0)*230), calc(25 + var(--_rs-theme-dark-coefficient, 0)*230), calc(28 + var(--_rs-theme-dark-coefficient, 0)*227));
402
402
  }
403
403
  @media (hover: hover){
404
- ._chip_clap9i_62:hover{
404
+ ._chip_t5wzop_62:hover{
405
405
  --_rs-cl-chip-border-color:rgba(
406
406
  calc(25 + var(--_rs-theme-dark-coefficient, 0)*230), calc(25 + var(--_rs-theme-dark-coefficient, 0)*230), calc(28 + var(--_rs-theme-dark-coefficient, 0)*227),
407
407
  calc(0.3 + var(--_rs-theme-dark-coefficient)*0.1)
@@ -412,20 +412,20 @@
412
412
  background:var(--_rs-cl-chip-hover-background);
413
413
  }
414
414
  }
415
- ._chip_clap9i_62:active{
415
+ ._chip_t5wzop_62:active{
416
416
  --_rs-cl-chip-border-color:var(--_rs-cl-chip-active-border-color);
417
417
 
418
418
  color:rgba(calc(25 + var(--_rs-theme-dark-coefficient, 0)*230), calc(25 + var(--_rs-theme-dark-coefficient, 0)*230), calc(28 + var(--_rs-theme-dark-coefficient, 0)*227));
419
419
 
420
420
  background:var(--_rs-cl-chip-active-background);
421
421
  }
422
- ._chip_clap9i_62._selected_clap9i_176{
422
+ ._chip_t5wzop_62._selected_t5wzop_176{
423
423
  --_rs-cl-chip-border-color:var(--_rs-cl-chip-selected-border-color);
424
424
  --_rs-cl-chip-border-width:2px;
425
425
 
426
426
  color:rgba(calc(25 + var(--_rs-theme-dark-coefficient, 0)*230), calc(25 + var(--_rs-theme-dark-coefficient, 0)*230), calc(28 + var(--_rs-theme-dark-coefficient, 0)*227));
427
427
  }
428
- ._disabled_clap9i_183 ._chip_clap9i_62{
428
+ ._disabled_t5wzop_183 ._chip_t5wzop_62{
429
429
  --_rs-cl-chip-border-color:rgba(calc(25 + var(--_rs-theme-dark-coefficient, 0)*230), calc(25 + var(--_rs-theme-dark-coefficient, 0)*230), calc(28 + var(--_rs-theme-dark-coefficient, 0)*227), 0.2);
430
430
 
431
431
  pointer-events:none;
@@ -434,10 +434,10 @@
434
434
 
435
435
  background:transparent;
436
436
  }
437
- ._disabled_clap9i_183 ._chip_clap9i_62._selected_clap9i_176{
437
+ ._disabled_t5wzop_183 ._chip_t5wzop_62._selected_t5wzop_176{
438
438
  --_rs-cl-chip-border-color:rgba(calc(25 + var(--_rs-theme-dark-coefficient, 0)*230), calc(25 + var(--_rs-theme-dark-coefficient, 0)*230), calc(28 + var(--_rs-theme-dark-coefficient, 0)*227), 0.4);
439
439
  }
440
- ._chip_clap9i_62::before{
440
+ ._chip_t5wzop_62::before{
441
441
  position:absolute;
442
442
  top:0;
443
443
  right:0;
@@ -454,7 +454,7 @@
454
454
 
455
455
  transition:border-color 100ms var(--rs-transition-function, ease);
456
456
  }
457
- ._chip_clap9i_62 ._icon_clap9i_216{
457
+ ._chip_t5wzop_62 ._icon_t5wzop_216{
458
458
  flex:0 0 auto;
459
459
 
460
460
  width:auto;
@@ -463,7 +463,7 @@
463
463
  margin:0;
464
464
  fill:currentColor;
465
465
  }
466
- ._hiddenInput_clap9i_227{
466
+ ._hiddenInput_t5wzop_227{
467
467
  position:absolute;
468
468
 
469
469
  overflow:hidden;
@@ -479,7 +479,7 @@
479
479
  white-space:nowrap;
480
480
  clip-path:inset(50%);
481
481
  }
482
- ._withoutText_clap9i_244{
482
+ ._withoutText_t5wzop_244{
483
483
  --_rs-cl-chip-horizontal-real-padding:var(--_rs-cl-chip-icon-only-padding);
484
484
  --_rs-cl-chip-vertical-real-padding:var(--_rs-cl-chip-icon-only-padding);
485
485
  }
@@ -1,27 +1,27 @@
1
1
  var styles = {
2
- "light": "_light_clap9i_8",
3
- "dark": "_dark_clap9i_11",
4
- "alignLeft": "_alignLeft_clap9i_15",
5
- "alignCenter": "_alignCenter_clap9i_18",
6
- "alignRight": "_alignRight_clap9i_21",
7
- "sizeXs": "_sizeXs_clap9i_25",
8
- "sizeS": "_sizeS_clap9i_28",
9
- "sizeM": "_sizeM_clap9i_31",
10
- "sizeL": "_sizeL_clap9i_34",
11
- "innerOffsetL": "_innerOffsetL_clap9i_38",
12
- "innerOffsetM": "_innerOffsetM_clap9i_41",
13
- "classic": "_classic_clap9i_45",
14
- "rock": "_rock_clap9i_48",
15
- "compact": "_compact_clap9i_52",
16
- "main": "_main_clap9i_56",
17
- "chipsContainer": "_chipsContainer_clap9i_62",
18
- "alignIconLeft": "_alignIconLeft_clap9i_72",
19
- "alignIconRight": "_alignIconRight_clap9i_75",
20
- "chip": "_chip_clap9i_62",
21
- "selected": "_selected_clap9i_176",
22
- "disabled": "_disabled_clap9i_183",
23
- "icon": "_icon_clap9i_216",
24
- "hiddenInput": "_hiddenInput_clap9i_227",
25
- "withoutText": "_withoutText_clap9i_244"
2
+ "light": "_light_t5wzop_8",
3
+ "dark": "_dark_t5wzop_11",
4
+ "alignLeft": "_alignLeft_t5wzop_15",
5
+ "alignCenter": "_alignCenter_t5wzop_18",
6
+ "alignRight": "_alignRight_t5wzop_21",
7
+ "sizeXs": "_sizeXs_t5wzop_25",
8
+ "sizeS": "_sizeS_t5wzop_28",
9
+ "sizeM": "_sizeM_t5wzop_31",
10
+ "sizeL": "_sizeL_t5wzop_34",
11
+ "innerOffsetL": "_innerOffsetL_t5wzop_38",
12
+ "innerOffsetM": "_innerOffsetM_t5wzop_41",
13
+ "classic": "_classic_t5wzop_45",
14
+ "rock": "_rock_t5wzop_48",
15
+ "compact": "_compact_t5wzop_52",
16
+ "main": "_main_t5wzop_56",
17
+ "chipsContainer": "_chipsContainer_t5wzop_62",
18
+ "alignIconLeft": "_alignIconLeft_t5wzop_72",
19
+ "alignIconRight": "_alignIconRight_t5wzop_75",
20
+ "chip": "_chip_t5wzop_62",
21
+ "selected": "_selected_t5wzop_176",
22
+ "disabled": "_disabled_t5wzop_183",
23
+ "icon": "_icon_t5wzop_216",
24
+ "hiddenInput": "_hiddenInput_t5wzop_227",
25
+ "withoutText": "_withoutText_t5wzop_244"
26
26
  };
27
27
  export { styles as default };
@@ -0,0 +1,615 @@
1
+ # ChipList
2
+
3
+ Created with adaptivity in mind, ChipList is the component for radiogroup-like controls and navigational panels. It wraps items onto a new line if the screen is too narrow to fit all of the content.
4
+
5
+ ## Usage
6
+
7
+ ### Features showcase
8
+
9
+ `ChipList` component can only be a controlled component. It requires `value` and `onChange` props to function properly.
10
+
11
+ By default, `ChipList` uses `pattern="auto"`. It renders native `input[type="radio"]` elements with `role="radiogroup"` when chips do not have `href`, switches to `role="navigation"` when at least one chip has `href`, and switches to `role="tablist"` when chips use `aria-controls`.
12
+
13
+ `ChipList` interactive overview:
14
+
15
+ #### Content Switcher made of ChipList with default values
16
+
17
+ `ChipList` enumerates `Chip` children components, so by default it has different keys for `onChange` prop function. When chips switch panels, add `aria-controls` to every chip so `pattern="auto"` resolves to `role="tablist"`.
18
+
19
+ ```tsx
20
+ import { useState } from 'react';
21
+ import { ChipList, Chip } from '@rescui/chip-list';
22
+ import { Switcher } from '@rescui/switcher';
23
+
24
+ const ContentSwitcher = ({ index, children }) => {
25
+ return children[index];
26
+ };
27
+ const Demo = () => {
28
+ const [activeIndex, setActiveIndex] = useState(1);
29
+ return (
30
+ <div>
31
+ <Switcher
32
+ size="xs"
33
+ value={activeIndex}
34
+ options={[
35
+ { label: 'First', value: 0 },
36
+ { label: 'Second', value: 1 },
37
+ { label: 'Third', value: 2 }
38
+ ]}
39
+ onChange={v => setActiveIndex(v)}
40
+ className="rs-docs-offset-top-12"
41
+ />
42
+ <ChipList
43
+ value={activeIndex}
44
+ onChange={v => setActiveIndex(v)}
45
+ className="rs-docs-offset-top-12"
46
+ >
47
+ <Chip id="first-default-tab" aria-controls="first-default-panel">
48
+ First
49
+ </Chip>
50
+ <Chip id="second-default-tab" aria-controls="second-default-panel">
51
+ Second
52
+ </Chip>
53
+ <Chip id="third-default-tab" aria-controls="third-default-panel">
54
+ Third
55
+ </Chip>
56
+ </ChipList>
57
+ <div className="rs-docs-offset-top-12">
58
+ <ContentSwitcher index={activeIndex}>
59
+ <div
60
+ id="first-default-panel"
61
+ role="tabpanel"
62
+ aria-labelledby="first-default-tab"
63
+ >
64
+ First
65
+ </div>
66
+ <div
67
+ id="second-default-panel"
68
+ role="tabpanel"
69
+ aria-labelledby="second-default-tab"
70
+ >
71
+ Second
72
+ </div>
73
+ <div
74
+ id="third-default-panel"
75
+ role="tabpanel"
76
+ aria-labelledby="third-default-tab"
77
+ >
78
+ Third
79
+ </div>
80
+ </ContentSwitcher>
81
+ </div>
82
+ </div>
83
+ );
84
+ };
85
+
86
+ render(<Demo />);
87
+ ```
88
+
89
+ #### Switcher with custom values on Chips and component for tab content
90
+
91
+ `ChipList` component works as radiogroup-like control with custom `value` on `Chip` components.
92
+
93
+ ```tsx
94
+ import { useState } from 'react';
95
+ import { ChipList, Chip } from '@rescui/chip-list';
96
+ import { Switcher } from '@rescui/switcher';
97
+
98
+ const Content = ({ activeChip }) => {
99
+ switch (activeChip) {
100
+ case 'first':
101
+ return <div>First</div>;
102
+ case 'second':
103
+ return <div>Second</div>;
104
+ case 'third':
105
+ return <div>Third</div>;
106
+ }
107
+ };
108
+ const Demo = () => {
109
+ const [activeChip, setActiveChip] = useState('second');
110
+ return (
111
+ <div>
112
+ <div>
113
+ <Switcher
114
+ size="xs"
115
+ value={activeChip}
116
+ options={[
117
+ { label: 'First', value: 'first' },
118
+ { label: 'Second', value: 'second' },
119
+ { label: 'Third', value: 'third' }
120
+ ]}
121
+ onChange={tab => setActiveChip(tab)}
122
+ className="rs-docs-offset-top-12"
123
+ />
124
+ </div>
125
+ <ChipList
126
+ value={activeChip}
127
+ onChange={v => setActiveChip(v)}
128
+ className="rs-docs-offset-top-12"
129
+ >
130
+ <Chip value="first">First</Chip>
131
+ <Chip value="second">Second</Chip>
132
+ <Chip value="third">Third</Chip>
133
+ </ChipList>
134
+ <div className="rs-docs-offset-top-12">
135
+ <Content activeChip={activeChip} />
136
+ </div>
137
+ </div>
138
+ );
139
+ };
140
+
141
+ render(<Demo />);
142
+ ```
143
+
144
+ #### SEO tip: render the content from every tab and hide it with display: none
145
+
146
+ Content could be rendered to DOM and hidden with CSS. This is a usefull trick for SEO optimization. This is also the most complete tablist pattern because every controlled panel stays in the DOM.
147
+
148
+ ```tsx
149
+ import { useState, cloneElement } from 'react';
150
+ import { ChipList, Chip } from '@rescui/chip-list';
151
+
152
+ const CSSContentSwitcher = ({ index, children }) => {
153
+ return children.map((ch, i) => {
154
+ const chStyles = ch.props.style || {};
155
+ const addStyles = i === index ? {} : { display: 'none' };
156
+ return cloneElement(ch, { key: i, style: { ...chStyles, ...addStyles } });
157
+ });
158
+ };
159
+
160
+ const Demo = () => {
161
+ const [activeIndex, setActiveIndex] = useState(0);
162
+ return (
163
+ <div className="rs-docs-offset-top-24">
164
+ <ChipList value={activeIndex} onChange={v => setActiveIndex(v)}>
165
+ <Chip id="first-seo-tab" aria-controls="first-seo-panel">
166
+ First
167
+ </Chip>
168
+ <Chip id="second-seo-tab" aria-controls="second-seo-panel">
169
+ Second
170
+ </Chip>
171
+ <Chip id="third-seo-tab" aria-controls="third-seo-panel">
172
+ Third
173
+ </Chip>
174
+ </ChipList>
175
+ <CSSContentSwitcher index={activeIndex}>
176
+ <div
177
+ id="first-seo-panel"
178
+ role="tabpanel"
179
+ aria-labelledby="first-seo-tab"
180
+ >
181
+ First
182
+ </div>
183
+ <div
184
+ id="second-seo-panel"
185
+ role="tabpanel"
186
+ aria-labelledby="second-seo-tab"
187
+ >
188
+ Second
189
+ </div>
190
+ <div
191
+ id="third-seo-panel"
192
+ role="tabpanel"
193
+ aria-labelledby="third-seo-tab"
194
+ >
195
+ Third
196
+ </div>
197
+ </CSSContentSwitcher>
198
+ </div>
199
+ );
200
+ };
201
+
202
+ render(<Demo />);
203
+ ```
204
+
205
+ #### Controls for the e2e tests
206
+
207
+ When testing the page, you can get access to the arrows with `data-e2e` attributes. You should set the scope with the `data-e2e` attribute from the outside.
208
+
209
+ ```tsx
210
+ import { useState, cloneElement } from 'react';
211
+ import { ChipList, Chip } from '@rescui/chip-list';
212
+
213
+ const CSSContentSwitcher = ({ index, children }) => {
214
+ return children.map((ch, i) => {
215
+ const chStyles = ch.props.style || {};
216
+ const addStyles = i === index ? {} : { display: 'none' };
217
+ return cloneElement(ch, { key: i, style: { ...chStyles, ...addStyles } });
218
+ });
219
+ };
220
+
221
+ const Demo = () => {
222
+ const [activeIndex, setActiveIndex] = useState(0);
223
+ return (
224
+ <div className="rs-docs-offset-top-24">
225
+ <ChipList
226
+ value={activeIndex}
227
+ onChange={v => setActiveIndex(v)}
228
+ data-e2e={'example-chips'}
229
+ >
230
+ <Chip id="first-e2e-tab" aria-controls="first-e2e-panel">
231
+ First
232
+ </Chip>
233
+ <Chip id="second-e2e-tab" aria-controls="second-e2e-panel">
234
+ Second
235
+ </Chip>
236
+ <Chip id="third-e2e-tab" aria-controls="third-e2e-panel">
237
+ Third
238
+ </Chip>
239
+ </ChipList>
240
+ <CSSContentSwitcher index={activeIndex}>
241
+ <div
242
+ id="first-e2e-panel"
243
+ role="tabpanel"
244
+ aria-labelledby="first-e2e-tab"
245
+ >
246
+ First
247
+ </div>
248
+ <div
249
+ id="second-e2e-panel"
250
+ role="tabpanel"
251
+ aria-labelledby="second-e2e-tab"
252
+ >
253
+ Second
254
+ </div>
255
+ <div
256
+ id="third-e2e-panel"
257
+ role="tabpanel"
258
+ aria-labelledby="third-e2e-tab"
259
+ >
260
+ Third
261
+ </div>
262
+ </CSSContentSwitcher>
263
+ </div>
264
+ );
265
+ };
266
+
267
+ render(<Demo />);
268
+ ```
269
+
270
+ #### Usage with Icons
271
+
272
+ ```tsx
273
+ import { useState } from 'react';
274
+ import { ChipList, Chip } from '@rescui/chip-list';
275
+ import {
276
+ TeamOutlineIcon,
277
+ WinOutlineIcon,
278
+ ThumbsUpOutlineIcon
279
+ } from '@rescui/icons';
280
+
281
+ const Demo = () => {
282
+ const [activeChip, setActiveChip] = useState('second');
283
+ return (
284
+ <div>
285
+ <ChipList
286
+ value={activeChip}
287
+ onChange={v => setActiveChip(v)}
288
+ className="rs-docs-offset-top-12"
289
+ >
290
+ <Chip icon={<TeamOutlineIcon />} value="first">
291
+ First
292
+ </Chip>
293
+ <Chip icon={<WinOutlineIcon />} value="second">
294
+ Second
295
+ </Chip>
296
+ <Chip icon={<ThumbsUpOutlineIcon />} value="third">
297
+ Third
298
+ </Chip>
299
+ </ChipList>
300
+ </div>
301
+ );
302
+ };
303
+
304
+ render(<Demo />);
305
+ ```
306
+
307
+ #### Chips as links
308
+
309
+ With the default `pattern="auto"`, chips with `href` switch the whole list to navigation behavior. You can also set `pattern="navigation"` explicitly. In `pattern="radiogroup"`, `href` is ignored and a development warning is printed.
310
+
311
+ ```tsx
312
+ import { useState } from 'react';
313
+ import { ChipList, Chip } from '@rescui/chip-list';
314
+
315
+ const Demo = () => {
316
+ const [activeChip, setActiveChip] = useState('second');
317
+ return (
318
+ <div>
319
+ <div>
320
+ <h4 id="first">First</h4>
321
+ <h4 id="second">Second</h4>
322
+ <h4 id="third">Third</h4>
323
+ </div>
324
+ <ChipList
325
+ value={activeChip}
326
+ onChange={v => setActiveChip(v)}
327
+ className="rs-docs-offset-top-24"
328
+ >
329
+ <Chip href="#first" value="first">
330
+ First
331
+ </Chip>
332
+ <Chip href="#second" value="second">
333
+ Second
334
+ </Chip>
335
+ <Chip href="#third" value="third">
336
+ Third
337
+ </Chip>
338
+ </ChipList>
339
+ </div>
340
+ );
341
+ };
342
+
343
+ render(<Demo />);
344
+ ```
345
+
346
+ #### Chips as navigation buttons
347
+
348
+ Use `pattern="navigation"` when chips without `href` should control page navigation through JavaScript.
349
+
350
+ ```tsx
351
+ import { useState } from 'react';
352
+ import { ChipList, Chip } from '@rescui/chip-list';
353
+
354
+ const Demo = () => {
355
+ const [activeChip, setActiveChip] = useState('second');
356
+ const navigateToSection = value => {
357
+ setActiveChip(value);
358
+ window.location.hash = `${value}-buttons`;
359
+ };
360
+
361
+ return (
362
+ <div>
363
+ <div>
364
+ <h4 id="first-buttons">First</h4>
365
+ <h4 id="second-buttons">Second</h4>
366
+ <h4 id="third-buttons">Third</h4>
367
+ </div>
368
+ <ChipList
369
+ value={activeChip}
370
+ onChange={navigateToSection}
371
+ pattern="navigation"
372
+ className="rs-docs-offset-top-24"
373
+ >
374
+ <Chip value="first">First</Chip>
375
+ <Chip value="second">Second</Chip>
376
+ <Chip value="third">Third</Chip>
377
+ </ChipList>
378
+ </div>
379
+ );
380
+ };
381
+
382
+ render(<Demo />);
383
+ ```
384
+
385
+ #### Compact mode
386
+
387
+ ```tsx
388
+ import { useState } from 'react';
389
+ import { ChipList, Chip } from '@rescui/chip-list';
390
+
391
+ const Demo = () => {
392
+ const [activeChip, setActiveChip] = useState('second');
393
+ return (
394
+ <div>
395
+ <ChipList
396
+ value={activeChip}
397
+ onChange={v => setActiveChip(v)}
398
+ compact
399
+ className="rs-docs-offset-top-12"
400
+ >
401
+ <Chip value="first">First</Chip>
402
+ <Chip value="second">Second</Chip>
403
+ <Chip value="third">Third</Chip>
404
+ </ChipList>
405
+ </div>
406
+ );
407
+ };
408
+
409
+ render(<Demo />);
410
+ ```
411
+
412
+ ## ChipListMulti
413
+
414
+ ### Features showcase
415
+
416
+ `ChipListMulti` component can only be a controlled component. It requires `value` and `onChange` props to function properly.
417
+
418
+ `ChipListMulti` interactive overview:
419
+
420
+ #### Usage with Icons
421
+
422
+ ```tsx
423
+ import { useState } from 'react';
424
+ import { ChipListMulti, Chip } from '@rescui/chip-list';
425
+ import {
426
+ TeamOutlineIcon,
427
+ WinOutlineIcon,
428
+ ThumbsUpOutlineIcon
429
+ } from '@rescui/icons';
430
+
431
+ const Demo = () => {
432
+ const [activeChips, setActiveChips] = useState(['second', 'third']);
433
+ return (
434
+ <div>
435
+ <ChipListMulti
436
+ value={activeChips}
437
+ onChange={setActiveChips}
438
+ className="rs-docs-offset-top-12"
439
+ >
440
+ <Chip icon={<TeamOutlineIcon />} value="first">
441
+ First
442
+ </Chip>
443
+ <Chip icon={<WinOutlineIcon />} value="second">
444
+ Second
445
+ </Chip>
446
+ <Chip icon={<ThumbsUpOutlineIcon />} value="third">
447
+ Third
448
+ </Chip>
449
+ </ChipListMulti>
450
+ </div>
451
+ );
452
+ };
453
+
454
+ render(<Demo />);
455
+ ```
456
+
457
+ ## CSS Mixins API
458
+
459
+ #### `Chip` mixins
460
+
461
+ | Mixin name | Details |
462
+ | --- | --- |
463
+ | `rs-chip-icon-left` | prop: `iconPosition`<br><br>value: `"left"` |
464
+ | `rs-chip-icon-right` | prop: `iconPosition`<br><br>value: `"right"` |
465
+
466
+ #### `ChipList` mixins
467
+
468
+ | Mixin name | Details |
469
+ | --- | --- |
470
+ | `rs-chip-list-align-left` | prop: `alignItems`<br><br>value: `"left"` |
471
+ | `rs-chip-list-align-center` | prop: `alignItems`<br><br>value: `"center"` |
472
+ | `rs-chip-list-align-right` | prop: `alignItems`<br><br>value: `"right"` |
473
+ | `rs-chip-list-sparse-true` | prop: `sparse`<br><br>value: `true` |
474
+ | `rs-chip-list-sparse-false` | prop: `sparse`<br><br>value: `false` |
475
+ | `rs-chip-list-size-xs` | prop: `size`<br><br>value: `"xs"` |
476
+ | `rs-chip-list-size-s` | prop: `size`<br><br>value: `"s"` |
477
+ | `rs-chip-list-size-m` | prop: `size`<br><br>value: `"m"` |
478
+ | `rs-chip-list-size-l` | prop: `size`<br><br>value: `"l"` |
479
+ | `rs-chip-list-mode-classic` | prop: `mode`<br><br>value: `"classic"` |
480
+ | `rs-chip-list-mode-rock` | prop: `mode`<br><br>value: `"rock"` |
481
+
482
+ #### `ChipListMulti` mixins
483
+
484
+ | Mixin name | Details |
485
+ | --- | --- |
486
+ | `rs-chip-list-multi-align-left` | prop: `alignItems`<br><br>value: `"left"` |
487
+ | `rs-chip-list-multi-align-center` | prop: `alignItems`<br><br>value: `"center"` |
488
+ | `rs-chip-list-multi-align-right` | prop: `alignItems`<br><br>value: `"right"` |
489
+ | `rs-chip-list-multi-sparse-true` | prop: `sparse`<br><br>value: `true` |
490
+ | `rs-chip-list-multi-sparse-false` | prop: `sparse`<br><br>value: `false` |
491
+ | `rs-chip-list-multi-size-xs` | prop: `size`<br><br>value: `"xs"` |
492
+ | `rs-chip-list-multi-size-s` | prop: `size`<br><br>value: `"s"` |
493
+ | `rs-chip-list-multi-size-m` | prop: `size`<br><br>value: `"m"` |
494
+ | `rs-chip-list-multi-size-l` | prop: `size`<br><br>value: `"l"` |
495
+ | `rs-chip-list-multi-mode-classic` | prop: `mode`<br><br>value: `"classic"` |
496
+ | `rs-chip-list-multi-mode-rock` | prop: `mode`<br><br>value: `"rock"` |
497
+
498
+ #### Demo
499
+
500
+ Instead of separate classes, it may be a single class with `@media` queries inside:
501
+
502
+ ```tsx
503
+ import { ChipList, ChipListMulti, Chip } from '@rescui/chip-list';
504
+ import { useState } from 'react';
505
+ import cn from 'classnames';
506
+ import { TeamOutlineIcon, WinOutlineIcon, ThumbsUpOutlineIcon } from '@rescui/icons';
507
+
508
+ const MyChipLists = ({ singleClassName, multiClassName }) => {
509
+ const [activeIndex, setActiveIndex] = useState(1);
510
+ const [activeChips, setActiveChips] = useState(['second', 'third']);
511
+ return (
512
+ <div style={{ padding: 12, backgroundColor: 'var(--rs-color-black-t5)' }}>
513
+ <ChipList
514
+ value={activeIndex}
515
+ onChange={v => setActiveIndex(v)}
516
+ className={singleClassName}
517
+ >
518
+ <Chip className="my-chip" icon={<TeamOutlineIcon />}>
519
+ First
520
+ </Chip>
521
+ <Chip className="my-chip" icon={<WinOutlineIcon />}>
522
+ Second
523
+ </Chip>
524
+ <Chip className="my-chip" icon={<ThumbsUpOutlineIcon />}>
525
+ Third
526
+ </Chip>
527
+ </ChipList>
528
+ <ChipListMulti
529
+ value={activeChips}
530
+ onChange={v => setActiveChips(v)}
531
+ className={cn(multiClassName, 'rs-docs-offset-top-12')}
532
+ >
533
+ <Chip className="my-chip" icon={<TeamOutlineIcon />} value="first">
534
+ First multi
535
+ </Chip>
536
+ <Chip className="my-chip" icon={<WinOutlineIcon />} value="second">
537
+ Second multi
538
+ </Chip>
539
+ <Chip className="my-chip" icon={<ThumbsUpOutlineIcon />} value="third">
540
+ Third multi
541
+ </Chip>
542
+ </ChipListMulti>
543
+ </div>
544
+ );
545
+ };
546
+
547
+ render(
548
+ <div style={{ display: 'flex', flexDirection: 'column', gap: 24 }}>
549
+ <div>
550
+ <p>Default:</p>
551
+ <MyChipLists />
552
+ </div>
553
+ <div>
554
+ <p>Var1:</p>
555
+ <MyChipLists
556
+ singleClassName={`my-chip-list-var-1`}
557
+ multiClassName={`my-chip-list-multi-var-1`}
558
+ />
559
+ </div>
560
+ <div>
561
+ <p>Var1 & Var2 combined:</p>
562
+ <MyChipLists
563
+ singleClassName={`my-chip-list-var-1 my-chip-list-var-2`}
564
+ multiClassName={`my-chip-list-multi-var-1 my-chip-list-multi-var-2`}
565
+ />
566
+ </div>
567
+ </div>
568
+ );
569
+ ```
570
+
571
+ ```postcss
572
+ @import '@rescui/chip-list/lib/public-api.p.css';
573
+
574
+ .my-chip-list-var-1 {
575
+ @mixin rs-chip-list-size-l;
576
+ @mixin rs-chip-list-mode-rock;
577
+ @mixin rs-chip-list-align-center;
578
+ @mixin rs-chip-list-sparse-true;
579
+
580
+ .my-chip {
581
+ @mixin rs-chip-icon-right;
582
+ }
583
+ }
584
+ .my-chip-list-var-2 {
585
+ @mixin rs-chip-list-size-s;
586
+ @mixin rs-chip-list-mode-classic;
587
+ @mixin rs-chip-list-align-right;
588
+ @mixin rs-chip-list-sparse-false;
589
+
590
+ .my-chip {
591
+ @mixin rs-chip-icon-left;
592
+ }
593
+ }
594
+
595
+ .my-chip-list-multi-var-1 {
596
+ @mixin rs-chip-list-multi-size-l;
597
+ @mixin rs-chip-list-multi-mode-rock;
598
+ @mixin rs-chip-list-multi-align-center;
599
+ @mixin rs-chip-list-multi-sparse-true;
600
+
601
+ .my-chip {
602
+ @mixin rs-chip-icon-right;
603
+ }
604
+ }
605
+ .my-chip-list-multi-var-2 {
606
+ @mixin rs-chip-list-multi-size-s;
607
+ @mixin rs-chip-list-multi-mode-classic;
608
+ @mixin rs-chip-list-multi-align-right;
609
+ @mixin rs-chip-list-multi-sparse-false;
610
+
611
+ .my-chip {
612
+ @mixin rs-chip-icon-left;
613
+ }
614
+ }
615
+ ```
package/llm/index.md ADDED
@@ -0,0 +1,2 @@
1
+ - Components and Hooks
2
+ - [ChipList](./components/chip-list.md)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rescui/chip-list",
3
- "version": "0.14.1",
3
+ "version": "0.14.2",
4
4
  "description": "",
5
5
  "license": "Apache-2.0",
6
6
  "author": "JetBrains",
@@ -9,6 +9,7 @@
9
9
  "src:main": "src/index.ts",
10
10
  "files": [
11
11
  "lib",
12
+ "llm",
12
13
  "LICENSE.txt"
13
14
  ],
14
15
  "publishConfig": {
@@ -24,9 +25,9 @@
24
25
  "react": ">=16.8.0 <20"
25
26
  },
26
27
  "devDependencies": {
27
- "@rescui/colors": "^0.3.1",
28
+ "@rescui/colors": "^0.3.2",
28
29
  "@rescui/scripts": "^0.5.2",
29
- "@rescui/typography": "^0.27.1",
30
+ "@rescui/typography": "^0.27.2",
30
31
  "@rescui/visual-regression": "^0.1.4"
31
32
  },
32
33
  "scripts": {
@@ -34,5 +35,5 @@
34
35
  "build-pcss-api": "rescui-scripts build-pcss-api --file public-api.p.css"
35
36
  },
36
37
  "nx": {},
37
- "gitHead": "a04f6790abce8e72834eedce3512ee83513c5e78"
38
+ "gitHead": "d60e4f3491c7cdb9ef684d08940869914492a61b"
38
39
  }