Commit 9a24198
authored
Allow users customize ID generation (#2959)
* Move `useId` calls inside setup()
* Allow injecting custom id generator
Vue does not currently have a native `useId` helper. However, Nuxt has created their own that they ensure works across the client/server boundary.
Now a user can use `provide()` in their app to inject a custom useId generation function which, for Nuxt users, can defer to the one provided by Nuxt.
* Add tests
* Export a `provideUseId` helper1 parent 7c6fa3d commit 9a24198
File tree
14 files changed
+168
-80
lines changed- packages/@headlessui-vue/src
- components
- combobox
- description
- dialog
- label
- listbox
- popover
- radio-group
- switch
- tabs
- hooks
14 files changed
+168
-80
lines changedLines changed: 9 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
779 | 779 | | |
780 | 780 | | |
781 | 781 | | |
782 | | - | |
| 782 | + | |
783 | 783 | | |
784 | 784 | | |
| 785 | + | |
785 | 786 | | |
786 | 787 | | |
787 | 788 | | |
| |||
794 | 795 | | |
795 | 796 | | |
796 | 797 | | |
797 | | - | |
| 798 | + | |
798 | 799 | | |
799 | 800 | | |
800 | 801 | | |
| |||
815 | 816 | | |
816 | 817 | | |
817 | 818 | | |
818 | | - | |
| 819 | + | |
819 | 820 | | |
820 | 821 | | |
| 822 | + | |
821 | 823 | | |
822 | 824 | | |
823 | 825 | | |
| |||
884 | 886 | | |
885 | 887 | | |
886 | 888 | | |
887 | | - | |
| 889 | + | |
888 | 890 | | |
889 | 891 | | |
890 | 892 | | |
| |||
921 | 923 | | |
922 | 924 | | |
923 | 925 | | |
924 | | - | |
| 926 | + | |
925 | 927 | | |
926 | 928 | | |
927 | 929 | | |
928 | 930 | | |
929 | 931 | | |
| 932 | + | |
930 | 933 | | |
931 | 934 | | |
932 | 935 | | |
| |||
1284 | 1287 | | |
1285 | 1288 | | |
1286 | 1289 | | |
1287 | | - | |
| 1290 | + | |
1288 | 1291 | | |
1289 | 1292 | | |
1290 | 1293 | | |
| |||
Lines changed: 5 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
| 69 | + | |
70 | 70 | | |
71 | 71 | | |
| 72 | + | |
72 | 73 | | |
73 | 74 | | |
74 | | - | |
| 75 | + | |
75 | 76 | | |
76 | 77 | | |
77 | 78 | | |
78 | | - | |
| 79 | + | |
| 80 | + | |
79 | 81 | | |
80 | 82 | | |
81 | 83 | | |
| |||
Lines changed: 16 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
76 | | - | |
| 76 | + | |
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
| 81 | + | |
81 | 82 | | |
82 | 83 | | |
83 | 84 | | |
| |||
292 | 293 | | |
293 | 294 | | |
294 | 295 | | |
295 | | - | |
| 296 | + | |
296 | 297 | | |
297 | 298 | | |
298 | 299 | | |
| |||
352 | 353 | | |
353 | 354 | | |
354 | 355 | | |
355 | | - | |
| 356 | + | |
356 | 357 | | |
357 | 358 | | |
| 359 | + | |
358 | 360 | | |
359 | 361 | | |
360 | 362 | | |
| |||
365 | 367 | | |
366 | 368 | | |
367 | 369 | | |
368 | | - | |
| 370 | + | |
369 | 371 | | |
370 | 372 | | |
371 | 373 | | |
| |||
390 | 392 | | |
391 | 393 | | |
392 | 394 | | |
393 | | - | |
| 395 | + | |
394 | 396 | | |
395 | 397 | | |
396 | 398 | | |
| 399 | + | |
397 | 400 | | |
398 | 401 | | |
399 | 402 | | |
| |||
408 | 411 | | |
409 | 412 | | |
410 | 413 | | |
411 | | - | |
| 414 | + | |
412 | 415 | | |
413 | 416 | | |
414 | 417 | | |
| |||
437 | 440 | | |
438 | 441 | | |
439 | 442 | | |
440 | | - | |
| 443 | + | |
441 | 444 | | |
442 | 445 | | |
| 446 | + | |
443 | 447 | | |
444 | 448 | | |
445 | 449 | | |
| |||
449 | 453 | | |
450 | 454 | | |
451 | 455 | | |
452 | | - | |
| 456 | + | |
453 | 457 | | |
454 | 458 | | |
455 | 459 | | |
| |||
474 | 478 | | |
475 | 479 | | |
476 | 480 | | |
477 | | - | |
| 481 | + | |
478 | 482 | | |
479 | 483 | | |
| 484 | + | |
480 | 485 | | |
481 | 486 | | |
482 | 487 | | |
483 | | - | |
| 488 | + | |
484 | 489 | | |
485 | 490 | | |
486 | 491 | | |
487 | 492 | | |
488 | | - | |
| 493 | + | |
489 | 494 | | |
490 | 495 | | |
491 | 496 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | | - | |
| 68 | + | |
69 | 69 | | |
70 | 70 | | |
| 71 | + | |
71 | 72 | | |
72 | 73 | | |
73 | | - | |
| 74 | + | |
74 | 75 | | |
75 | 76 | | |
76 | 77 | | |
77 | | - | |
| 78 | + | |
78 | 79 | | |
79 | 80 | | |
80 | 81 | | |
| |||
Lines changed: 20 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
426 | 426 | | |
427 | 427 | | |
428 | 428 | | |
429 | | - | |
| 429 | + | |
430 | 430 | | |
431 | 431 | | |
| 432 | + | |
432 | 433 | | |
433 | 434 | | |
434 | 435 | | |
| |||
440 | 441 | | |
441 | 442 | | |
442 | 443 | | |
443 | | - | |
| 444 | + | |
444 | 445 | | |
445 | 446 | | |
446 | 447 | | |
| |||
461 | 462 | | |
462 | 463 | | |
463 | 464 | | |
464 | | - | |
| 465 | + | |
465 | 466 | | |
466 | 467 | | |
| 468 | + | |
467 | 469 | | |
468 | 470 | | |
469 | 471 | | |
| |||
529 | 531 | | |
530 | 532 | | |
531 | 533 | | |
532 | | - | |
| 534 | + | |
533 | 535 | | |
534 | 536 | | |
535 | 537 | | |
| |||
564 | 566 | | |
565 | 567 | | |
566 | 568 | | |
567 | | - | |
| 569 | + | |
568 | 570 | | |
569 | 571 | | |
| 572 | + | |
570 | 573 | | |
571 | 574 | | |
572 | 575 | | |
| |||
656 | 659 | | |
657 | 660 | | |
658 | 661 | | |
659 | | - | |
| 662 | + | |
660 | 663 | | |
661 | 664 | | |
662 | 665 | | |
| |||
696 | 699 | | |
697 | 700 | | |
698 | 701 | | |
699 | | - | |
| 702 | + | |
700 | 703 | | |
701 | 704 | | |
| 705 | + | |
702 | 706 | | |
703 | 707 | | |
704 | 708 | | |
705 | 709 | | |
706 | 710 | | |
707 | 711 | | |
708 | 712 | | |
709 | | - | |
| 713 | + | |
710 | 714 | | |
711 | 715 | | |
712 | 716 | | |
| |||
727 | 731 | | |
728 | 732 | | |
729 | 733 | | |
730 | | - | |
| 734 | + | |
731 | 735 | | |
732 | 736 | | |
733 | 737 | | |
| |||
744 | 748 | | |
745 | 749 | | |
746 | 750 | | |
747 | | - | |
748 | | - | |
| 751 | + | |
| 752 | + | |
749 | 753 | | |
750 | 754 | | |
751 | 755 | | |
| |||
756 | 760 | | |
757 | 761 | | |
758 | 762 | | |
759 | | - | |
| 763 | + | |
760 | 764 | | |
761 | 765 | | |
762 | | - | |
| 766 | + | |
763 | 767 | | |
764 | 768 | | |
765 | 769 | | |
| |||
785 | 789 | | |
786 | 790 | | |
787 | 791 | | |
788 | | - | |
| 792 | + | |
789 | 793 | | |
790 | 794 | | |
791 | 795 | | |
| |||
798 | 802 | | |
799 | 803 | | |
800 | 804 | | |
801 | | - | |
| 805 | + | |
802 | 806 | | |
803 | 807 | | |
804 | 808 | | |
| |||
811 | 815 | | |
812 | 816 | | |
813 | 817 | | |
814 | | - | |
| 818 | + | |
815 | 819 | | |
816 | 820 | | |
817 | 821 | | |
| |||
0 commit comments