@rogieking/figui3 7.0.0 → 8.0.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/fig-editor.css CHANGED
@@ -535,3 +535,268 @@ fig-fill-picker {
535
535
  }
536
536
  }
537
537
  }
538
+
539
+
540
+ /* Select — host chrome; trigger/listbox live in shadow (options slotted) */
541
+ fig-select {
542
+ display: inline-flex;
543
+ position: relative;
544
+ align-items: center;
545
+ min-width: 0;
546
+ height: var(--spacer-4);
547
+ border-radius: var(--radius-medium);
548
+ background-color: var(--figma-color-bg);
549
+ color: var(--figma-color-text);
550
+ box-shadow: inset 0 0 0 1px var(--figma-color-border);
551
+
552
+ &[full]:not([full="false"]) {
553
+ display: flex;
554
+ width: 100%;
555
+ }
556
+
557
+ &[disabled]:not([disabled="false"]) {
558
+ pointer-events: none;
559
+ color: var(--figma-color-text-tertiary);
560
+
561
+ &::after {
562
+ background-color: var(--figma-color-icon-disabled);
563
+ }
564
+ }
565
+
566
+ &::after {
567
+ content: "";
568
+ position: absolute;
569
+ right: 0.25rem;
570
+ top: 50%;
571
+ transform: translateY(-50%);
572
+ width: 1rem;
573
+ height: 1rem;
574
+ mask-image: var(--icon-16-chevron);
575
+ mask-size: contain;
576
+ mask-repeat: no-repeat;
577
+ mask-position: center;
578
+ background-color: var(--figma-color-icon);
579
+ pointer-events: none;
580
+ z-index: 1;
581
+ }
582
+ }
583
+
584
+ /*
585
+ * Internal listbox is a fig-popup inside fig-select's shadow, so document
586
+ * dialog[is="fig-popup"] rules don't apply. Expose part=listbox and mirror
587
+ * the menu-theme popup chrome (same tokens as components.css).
588
+ */
589
+ fig-select::part(listbox) {
590
+ --z-index: 999999;
591
+ --fig-popup-radius: var(--radius-large);
592
+ --fig-popup-bg-color: var(--figma-color-bg-menu);
593
+
594
+ z-index: var(--z-index);
595
+ position: fixed;
596
+ /* Do not set inset here — ::part inset beats inline left/top and
597
+ prevents edge clamping from moving the menu back into view. */
598
+ margin: 0;
599
+ border: 0;
600
+ outline: 0;
601
+ padding: 0;
602
+ overflow: hidden;
603
+ border-radius: var(--fig-popup-radius);
604
+ background-color: var(--fig-popup-bg-color);
605
+ color: var(--figma-color-text-menu);
606
+ color-scheme: dark;
607
+ box-shadow: var(--figma-elevation-400-menu-panel);
608
+ /* width/min/max set in JS — ::part width rules override element.style. */
609
+ max-height: calc(100vh - 1rem);
610
+ height: max-content;
611
+ }
612
+
613
+ /* Vertical option panels own their scroller and shared top/bottom paging buttons. */
614
+ fig-select-options,
615
+ .fig-menu-options {
616
+ --fig-vertical-overflow-size: var(--spacer-4);
617
+
618
+ box-sizing: border-box;
619
+ display: flex;
620
+ flex-direction: column;
621
+ gap: 0;
622
+ width: 100%;
623
+ max-width: 100%;
624
+ max-height: calc(100vh - 1rem);
625
+ /* No block padding — sticky overflow buttons must sit flush to the popup edges. */
626
+ padding: 0;
627
+ overflow: hidden auto;
628
+ scrollbar-width: none;
629
+
630
+ &::-webkit-scrollbar {
631
+ display: none;
632
+ }
633
+
634
+ & > :not(.fig-overflow) {
635
+ flex-shrink: 0;
636
+ }
637
+
638
+ /* List breathing room (not on the scroller itself). */
639
+ & > :not(.fig-overflow):first-child,
640
+ & > .fig-overflow-start + :not(.fig-overflow) {
641
+ margin-top: var(--spacer-2);
642
+ }
643
+
644
+ & > :not(.fig-overflow):last-child,
645
+ & > :not(.fig-overflow):has(+ .fig-overflow-end) {
646
+ margin-bottom: var(--spacer-2);
647
+ }
648
+
649
+ & > .fig-overflow {
650
+ position: sticky;
651
+ left: 0;
652
+ flex: 0 0 var(--fig-vertical-overflow-size);
653
+ width: 100%;
654
+ height: var(--fig-vertical-overflow-size);
655
+ margin: 0;
656
+ z-index: 3;
657
+ /* Menu chrome — not option hover (bg-menu-hover is brand blue). */
658
+ color: var(--figma-color-text-menu);
659
+ background: var(--figma-color-bg-menu) !important;
660
+
661
+ &::before {
662
+ inset: 0;
663
+ border-radius: 0;
664
+ background: var(--figma-color-bg-menu) !important;
665
+ }
666
+
667
+ &:hover::before {
668
+ background: light-dark(
669
+ rgba(0, 0, 0, 0.06),
670
+ rgba(255, 255, 255, 0.08)
671
+ )
672
+ !important;
673
+ }
674
+
675
+ &:hover {
676
+ color: var(--figma-color-text-menu);
677
+ }
678
+ }
679
+
680
+ & > .fig-overflow-start {
681
+ order: -1;
682
+ top: 0;
683
+ margin-block-end: calc(-1 * var(--fig-vertical-overflow-size));
684
+
685
+ &::before {
686
+ border-radius: var(--radius-large) var(--radius-large) 0 0;
687
+ }
688
+
689
+ .fig-overflow-chevron {
690
+ rotate: 180deg;
691
+ }
692
+ }
693
+
694
+ & > .fig-overflow-end {
695
+ order: 1;
696
+ bottom: 0;
697
+ margin-block-start: calc(-1 * var(--fig-vertical-overflow-size));
698
+
699
+ &::before {
700
+ border-radius: 0 0 var(--radius-large) var(--radius-large);
701
+ }
702
+ }
703
+
704
+ }
705
+
706
+ fig-select-options > fig-separator {
707
+ /* Align labels with select option text after the checkmark column. */
708
+ &[label]:not([label=""]) {
709
+ --fig-menu-inline-padding: 0 var(--spacer-2) 0 var(--spacer-5);
710
+
711
+ &::before {
712
+ margin-inline: unset;
713
+ margin-left: calc(-1 * var(--spacer-5));
714
+ margin-right: calc(-1 * var(--spacer-2));
715
+ }
716
+ }
717
+ }
718
+
719
+ fig-select-option {
720
+ display: flex;
721
+ align-items: center;
722
+ gap: 0;
723
+ position: relative;
724
+ min-height: var(--spacer-4);
725
+ height: auto;
726
+ padding: var(--spacer-1) var(--spacer-2);
727
+ padding-right: var(--spacer-3);
728
+ border-radius: var(--radius-medium);
729
+ color: var(--figma-color-text-menu);
730
+ cursor: default;
731
+ user-select: none;
732
+ white-space: nowrap;
733
+
734
+ &::before {
735
+ content: "";
736
+ display: block;
737
+ position: absolute;
738
+ inset: 0 var(--spacer-2);
739
+ border-radius: var(--radius-medium);
740
+ z-index: -1;
741
+ background-color: transparent;
742
+ }
743
+
744
+ &::after {
745
+ content: "";
746
+ display: block;
747
+ flex: 0 0 1rem;
748
+ order: -1;
749
+ width: 1rem;
750
+ height: 1rem;
751
+ margin-left: var(--spacer-1);
752
+ margin-right: var(--spacer-1);
753
+ background-color: currentColor;
754
+ -webkit-mask-image: var(--icon-16-checkmark);
755
+ mask-image: var(--icon-16-checkmark);
756
+ -webkit-mask-repeat: no-repeat;
757
+ mask-repeat: no-repeat;
758
+ -webkit-mask-position: center;
759
+ mask-position: center;
760
+ -webkit-mask-size: contain;
761
+ mask-size: contain;
762
+ visibility: hidden;
763
+ }
764
+
765
+ & > [slot="prepend"] {
766
+ margin-top: calc(var(--spacer-1) * -1);
767
+ margin-bottom: calc(var(--spacer-1) * -1);
768
+ margin-right: var(--spacer-1);
769
+ }
770
+
771
+
772
+ & > :not([slot="prepend"]):not([slot="append"]) {
773
+ flex: 1 1 auto;
774
+ min-width: 0;
775
+ }
776
+
777
+ & > [slot="append"] {
778
+ flex: 0 0 auto;
779
+ margin-inline-start: auto;
780
+ color: var(--figma-color-text-tertiary);
781
+ }
782
+
783
+ &:hover,
784
+ &:focus-visible {
785
+ outline: none;
786
+
787
+ &::before {
788
+ background-color: var(--figma-color-bg-menu-hover);
789
+ }
790
+ }
791
+
792
+ &[selected]:not([selected="false"])::after,
793
+ &[aria-selected="true"]::after {
794
+ visibility: visible;
795
+ }
796
+
797
+ &[disabled]:not([disabled="false"]),
798
+ &[aria-disabled="true"] {
799
+ opacity: 0.4;
800
+ pointer-events: none;
801
+ }
802
+ }