@rogieking/figui3 1.0.19 → 1.0.21
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.css +39 -15
- package/fig.js +17 -6
- package/package.json +1 -1
package/fig.css
CHANGED
|
@@ -600,31 +600,47 @@ fig-dropdown>option {
|
|
|
600
600
|
}
|
|
601
601
|
|
|
602
602
|
/* Button */
|
|
603
|
-
button,
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
input[type=button] {
|
|
603
|
+
.fig-button,
|
|
604
|
+
fig-button {
|
|
605
|
+
box-shadow: inset 0 0 0 1px var(--figma-color-bordertranslucent);
|
|
606
|
+
color: var(--figma-color-text-onbrand);
|
|
608
607
|
display: flex;
|
|
609
608
|
align-items: center;
|
|
610
609
|
justify-content: center;
|
|
611
610
|
height: var(--spacer-4);
|
|
612
611
|
padding: 0 var(--spacer-2);
|
|
613
612
|
appearance: none;
|
|
614
|
-
background-color: var(--figma-color-bg-brand);
|
|
615
613
|
border: 0;
|
|
616
|
-
color:
|
|
614
|
+
color: inherit;
|
|
615
|
+
outline: 0;
|
|
617
616
|
border-radius: var(--radius-medium);
|
|
617
|
+
background-color: var(--figma-color-bg-brand);
|
|
618
618
|
font-weight: 500;
|
|
619
|
-
|
|
619
|
+
|
|
620
|
+
&>button {
|
|
621
|
+
background: transparent;
|
|
622
|
+
box-shadow: none;
|
|
623
|
+
border: 0;
|
|
624
|
+
appearance: none;
|
|
625
|
+
outline: 0;
|
|
626
|
+
display: flex;
|
|
627
|
+
align-items: center;
|
|
628
|
+
justify-content: center;
|
|
629
|
+
border-radius: var(--radius-medium);
|
|
630
|
+
height: var(--spacer-4);
|
|
631
|
+
padding: 0 var(--spacer-2);
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
&:has(>button) {
|
|
635
|
+
padding: 0;
|
|
636
|
+
}
|
|
620
637
|
|
|
621
638
|
&:active {
|
|
622
639
|
background-color: var(--figma-color-bg-brand-pressed);
|
|
623
640
|
}
|
|
624
641
|
|
|
625
642
|
/* Variant: Ghost */
|
|
626
|
-
&[variant="ghost"]
|
|
627
|
-
&[variant="ghost"]>button {
|
|
643
|
+
&[variant="ghost"] {
|
|
628
644
|
box-shadow: none;
|
|
629
645
|
background: none;
|
|
630
646
|
color: var(--figma-color-text);
|
|
@@ -639,15 +655,13 @@ input[type=button] {
|
|
|
639
655
|
}
|
|
640
656
|
}
|
|
641
657
|
|
|
642
|
-
&[variant="ghost"][disabled=true]
|
|
643
|
-
&[variant="ghost"][disabled=true]>button {
|
|
658
|
+
&[variant="ghost"][disabled=true] {
|
|
644
659
|
background-color: transparent;
|
|
645
660
|
}
|
|
646
661
|
|
|
647
662
|
|
|
648
663
|
/* Variant: Secondary */
|
|
649
|
-
&[variant="secondary"]
|
|
650
|
-
&[variant="secondary"]>button {
|
|
664
|
+
&[variant="secondary"] {
|
|
651
665
|
box-shadow: inset 0 0 0 1px var(--figma-color-border);
|
|
652
666
|
background: none;
|
|
653
667
|
color: var(--figma-color-text);
|
|
@@ -726,10 +740,12 @@ input[type=button] {
|
|
|
726
740
|
background-color: var(--figma-color-bg-selected);
|
|
727
741
|
}
|
|
728
742
|
|
|
729
|
-
&:focus
|
|
743
|
+
&:focus,
|
|
744
|
+
&:focus-within {
|
|
730
745
|
outline: 0;
|
|
731
746
|
box-shadow: inset 0 0 0 1px var(--figma-color-border-selected);
|
|
732
747
|
}
|
|
748
|
+
|
|
733
749
|
}
|
|
734
750
|
|
|
735
751
|
fig-button>button {
|
|
@@ -1599,6 +1615,11 @@ fig-tooltip {
|
|
|
1599
1615
|
display: inline-flex;
|
|
1600
1616
|
gap: var(--spacer-2);
|
|
1601
1617
|
user-select: none;
|
|
1618
|
+
|
|
1619
|
+
&[full] {
|
|
1620
|
+
display: flex;
|
|
1621
|
+
width: 100%;
|
|
1622
|
+
}
|
|
1602
1623
|
}
|
|
1603
1624
|
|
|
1604
1625
|
fig-input-text {
|
|
@@ -1791,6 +1812,9 @@ fig-spinner {
|
|
|
1791
1812
|
animation: fig-spinner-spin 1.0s linear infinite;
|
|
1792
1813
|
}
|
|
1793
1814
|
|
|
1815
|
+
/* Utilities */
|
|
1816
|
+
|
|
1817
|
+
|
|
1794
1818
|
@keyframes fig-spinner-spin {
|
|
1795
1819
|
from {
|
|
1796
1820
|
transform: rotate(0deg);
|
package/fig.js
CHANGED
|
@@ -12,14 +12,14 @@ class FigButton extends HTMLElement {
|
|
|
12
12
|
#selected
|
|
13
13
|
constructor() {
|
|
14
14
|
super()
|
|
15
|
-
this.attachShadow({ mode: 'open' })
|
|
15
|
+
//this.attachShadow({ mode: 'open' })
|
|
16
16
|
}
|
|
17
17
|
connectedCallback() {
|
|
18
18
|
this.render()
|
|
19
19
|
}
|
|
20
20
|
render() {
|
|
21
|
-
this.#type = this.getAttribute("type")
|
|
22
|
-
this.shadowRoot.innerHTML = `
|
|
21
|
+
this.#type = this.getAttribute("type") || "button"
|
|
22
|
+
/*this.shadowRoot.innerHTML = `
|
|
23
23
|
<style>
|
|
24
24
|
button, button:hover, button:active {
|
|
25
25
|
padding: 0;
|
|
@@ -36,10 +36,18 @@ class FigButton extends HTMLElement {
|
|
|
36
36
|
<button type="${this.#type}">
|
|
37
37
|
<slot></slot>
|
|
38
38
|
</button>
|
|
39
|
-
|
|
39
|
+
`;*/
|
|
40
|
+
|
|
40
41
|
this.#selected = this.hasAttribute("selected") && this.getAttribute("selected") !== "false"
|
|
41
|
-
this.button = this.shadowRoot.querySelector('button')
|
|
42
42
|
this.addEventListener("click", this.handleClick.bind(this))
|
|
43
|
+
|
|
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
|
+
|
|
43
51
|
}
|
|
44
52
|
get type() {
|
|
45
53
|
return this.#type
|
|
@@ -57,10 +65,13 @@ class FigButton extends HTMLElement {
|
|
|
57
65
|
this.setAttribute("selected", value)
|
|
58
66
|
}
|
|
59
67
|
|
|
60
|
-
handleClick() {
|
|
68
|
+
handleClick(event) {
|
|
61
69
|
if (this.#type === "toggle") {
|
|
62
70
|
this.selected = !this.#selected
|
|
63
71
|
}
|
|
72
|
+
if (this.#type === "submit") {
|
|
73
|
+
this.button.click()
|
|
74
|
+
}
|
|
64
75
|
}
|
|
65
76
|
static get observedAttributes() {
|
|
66
77
|
return ['disabled'];
|
package/package.json
CHANGED