@rogieking/figui3 1.0.20 → 1.0.22

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.
Files changed (3) hide show
  1. package/fig.css +39 -21
  2. package/fig.js +8 -3
  3. package/package.json +1 -1
package/fig.css CHANGED
@@ -602,26 +602,34 @@ fig-dropdown>option {
602
602
  /* Button */
603
603
  .fig-button,
604
604
  fig-button {
605
- border-radius: var(--radius-medium);
606
605
  box-shadow: inset 0 0 0 1px var(--figma-color-bordertranslucent);
607
606
  color: var(--figma-color-text-onbrand);
607
+ display: flex;
608
+ align-items: center;
609
+ justify-content: center;
610
+ height: var(--spacer-4);
611
+ padding: 0 var(--spacer-2);
612
+ appearance: none;
613
+ border: 0;
614
+ color: inherit;
615
+ outline: 0;
616
+ border-radius: var(--radius-medium);
617
+ background-color: var(--figma-color-bg-brand);
618
+ font-weight: 500;
608
619
 
609
- &,
610
620
  &>button {
621
+ background: transparent;
622
+ box-shadow: none;
623
+ border: 0;
624
+ appearance: none;
625
+ outline: 0;
611
626
  display: flex;
612
627
  align-items: center;
613
628
  justify-content: center;
629
+ border-radius: var(--radius-medium);
614
630
  height: var(--spacer-4);
615
631
  padding: 0 var(--spacer-2);
616
- appearance: none;
617
- border: 0;
618
632
  color: inherit;
619
- background-color: var(--figma-color-bg-brand);
620
- font-weight: 500;
621
- }
622
-
623
- &>button {
624
- background: transparent;
625
633
  }
626
634
 
627
635
  &:has(>button) {
@@ -633,8 +641,7 @@ fig-button {
633
641
  }
634
642
 
635
643
  /* Variant: Ghost */
636
- &[variant="ghost"],
637
- &[variant="ghost"]>button {
644
+ &[variant="ghost"] {
638
645
  box-shadow: none;
639
646
  background: none;
640
647
  color: var(--figma-color-text);
@@ -649,15 +656,13 @@ fig-button {
649
656
  }
650
657
  }
651
658
 
652
- &[variant="ghost"][disabled=true],
653
- &[variant="ghost"][disabled=true]>button {
659
+ &[variant="ghost"][disabled=true] {
654
660
  background-color: transparent;
655
661
  }
656
662
 
657
663
 
658
664
  /* Variant: Secondary */
659
- &[variant="secondary"],
660
- &[variant="secondary"]>button {
665
+ &[variant="secondary"] {
661
666
  box-shadow: inset 0 0 0 1px var(--figma-color-border);
662
667
  background: none;
663
668
  color: var(--figma-color-text);
@@ -732,11 +737,16 @@ fig-button {
732
737
  }
733
738
 
734
739
  &[selected]:not([selected=false]) {
735
- color: var(--figma-color-icon-brand);
736
- background-color: var(--figma-color-bg-selected);
740
+
741
+ &,
742
+ &:hover {
743
+ color: var(--figma-color-icon-brand);
744
+ background-color: var(--figma-color-bg-selected);
745
+ }
737
746
  }
738
747
 
739
- &:focus {
748
+ &:focus,
749
+ &:focus-within {
740
750
  outline: 0;
741
751
  box-shadow: inset 0 0 0 1px var(--figma-color-border-selected);
742
752
  }
@@ -995,12 +1005,16 @@ input[type=checkbox]:not(.switch) {
995
1005
 
996
1006
  &:checked {
997
1007
  background-color: var(--figma-color-bg-brand);
1008
+ box-shadow: inset 0 0 0 1px var(--figma-color-border-selected-strong);
998
1009
  background-image: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4.50012 7.5L7.50012 10.5L11.5001 4.5' stroke='white' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.125' /%3E%3C/svg%3E%0A");
999
1010
  }
1000
1011
 
1001
1012
  &:focus {
1002
1013
  outline: 0;
1003
- box-shadow: inset 0 0 0 1px var(--figma-color-border-selected);
1014
+
1015
+ &:not(:checked) {
1016
+ box-shadow: inset 0 0 0 1px var(--figma-color-border-selected);
1017
+ }
1004
1018
  }
1005
1019
  }
1006
1020
 
@@ -1031,6 +1045,7 @@ input[type=radio] {
1031
1045
 
1032
1046
  &:checked {
1033
1047
  background-color: var(--figma-color-bg-brand);
1048
+ box-shadow: inset 0 0 0 1px var(--figma-color-border-selected-strong);
1034
1049
 
1035
1050
  &::after {
1036
1051
  transform: scale(1);
@@ -1039,7 +1054,10 @@ input[type=radio] {
1039
1054
 
1040
1055
  &:focus {
1041
1056
  outline: 0;
1042
- box-shadow: inset 0 0 0 1px var(--figma-color-border-selected);
1057
+
1058
+ &:not(:checked) {
1059
+ box-shadow: inset 0 0 0 1px var(--figma-color-border-selected);
1060
+ }
1043
1061
  }
1044
1062
 
1045
1063
  &:hover:not(:checked) {
package/fig.js CHANGED
@@ -18,7 +18,7 @@ class FigButton extends HTMLElement {
18
18
  this.render()
19
19
  }
20
20
  render() {
21
- this.#type = this.getAttribute("type")
21
+ this.#type = this.getAttribute("type") || "button"
22
22
  /*this.shadowRoot.innerHTML = `
23
23
  <style>
24
24
  button, button:hover, button:active {
@@ -37,12 +37,17 @@ class FigButton extends HTMLElement {
37
37
  <slot></slot>
38
38
  </button>
39
39
  `;*/
40
- this.innerHTML = `<button type="${this.#type}">${this.innerHTML}</button>`
40
+
41
41
  this.#selected = this.hasAttribute("selected") && this.getAttribute("selected") !== "false"
42
- this.button = this.querySelector('button')
43
42
  this.addEventListener("click", this.handleClick.bind(this))
44
43
 
45
44
 
45
+ //child nodes hack
46
+ requestAnimationFrame(() => {
47
+ this.innerHTML = `<button type="${this.#type}">${this.innerHTML}</button>`
48
+ this.button = this.querySelector('button')
49
+ })
50
+
46
51
  }
47
52
  get type() {
48
53
  return this.#type
package/package.json CHANGED
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "@rogieking/figui3",
3
- "version": "1.0.20"
3
+ "version": "1.0.22"
4
4
  }