@rogieking/figui3 1.0.18 → 1.0.20
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 +34 -15
- package/fig.js +14 -7
- package/package.json +1 -1
package/fig.css
CHANGED
|
@@ -600,23 +600,33 @@ fig-dropdown>option {
|
|
|
600
600
|
}
|
|
601
601
|
|
|
602
602
|
/* Button */
|
|
603
|
-
button,
|
|
604
|
-
|
|
605
|
-
fig-button,
|
|
606
|
-
input[type=submit],
|
|
607
|
-
input[type=button] {
|
|
608
|
-
display: flex;
|
|
609
|
-
align-items: center;
|
|
610
|
-
justify-content: center;
|
|
611
|
-
height: var(--spacer-4);
|
|
612
|
-
padding: 0 var(--spacer-2);
|
|
613
|
-
appearance: none;
|
|
614
|
-
background-color: var(--figma-color-bg-brand);
|
|
615
|
-
border: 0;
|
|
616
|
-
color: var(--figma-color-text-onbrand);
|
|
603
|
+
.fig-button,
|
|
604
|
+
fig-button {
|
|
617
605
|
border-radius: var(--radius-medium);
|
|
618
|
-
font-weight: 500;
|
|
619
606
|
box-shadow: inset 0 0 0 1px var(--figma-color-bordertranslucent);
|
|
607
|
+
color: var(--figma-color-text-onbrand);
|
|
608
|
+
|
|
609
|
+
&,
|
|
610
|
+
&>button {
|
|
611
|
+
display: flex;
|
|
612
|
+
align-items: center;
|
|
613
|
+
justify-content: center;
|
|
614
|
+
height: var(--spacer-4);
|
|
615
|
+
padding: 0 var(--spacer-2);
|
|
616
|
+
appearance: none;
|
|
617
|
+
border: 0;
|
|
618
|
+
color: inherit;
|
|
619
|
+
background-color: var(--figma-color-bg-brand);
|
|
620
|
+
font-weight: 500;
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
&>button {
|
|
624
|
+
background: transparent;
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
&:has(>button) {
|
|
628
|
+
padding: 0;
|
|
629
|
+
}
|
|
620
630
|
|
|
621
631
|
&:active {
|
|
622
632
|
background-color: var(--figma-color-bg-brand-pressed);
|
|
@@ -730,6 +740,7 @@ input[type=button] {
|
|
|
730
740
|
outline: 0;
|
|
731
741
|
box-shadow: inset 0 0 0 1px var(--figma-color-border-selected);
|
|
732
742
|
}
|
|
743
|
+
|
|
733
744
|
}
|
|
734
745
|
|
|
735
746
|
fig-button>button {
|
|
@@ -1599,6 +1610,11 @@ fig-tooltip {
|
|
|
1599
1610
|
display: inline-flex;
|
|
1600
1611
|
gap: var(--spacer-2);
|
|
1601
1612
|
user-select: none;
|
|
1613
|
+
|
|
1614
|
+
&[full] {
|
|
1615
|
+
display: flex;
|
|
1616
|
+
width: 100%;
|
|
1617
|
+
}
|
|
1602
1618
|
}
|
|
1603
1619
|
|
|
1604
1620
|
fig-input-text {
|
|
@@ -1791,6 +1807,9 @@ fig-spinner {
|
|
|
1791
1807
|
animation: fig-spinner-spin 1.0s linear infinite;
|
|
1792
1808
|
}
|
|
1793
1809
|
|
|
1810
|
+
/* Utilities */
|
|
1811
|
+
|
|
1812
|
+
|
|
1794
1813
|
@keyframes fig-spinner-spin {
|
|
1795
1814
|
from {
|
|
1796
1815
|
transform: rotate(0deg);
|
package/fig.js
CHANGED
|
@@ -12,13 +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
|
|
21
|
+
this.#type = this.getAttribute("type")
|
|
22
|
+
/*this.shadowRoot.innerHTML = `
|
|
22
23
|
<style>
|
|
23
24
|
button, button:hover, button:active {
|
|
24
25
|
padding: 0;
|
|
@@ -32,20 +33,23 @@ class FigButton extends HTMLElement {
|
|
|
32
33
|
background: transparent;
|
|
33
34
|
}
|
|
34
35
|
</style>
|
|
35
|
-
<button>
|
|
36
|
+
<button type="${this.#type}">
|
|
36
37
|
<slot></slot>
|
|
37
38
|
</button>
|
|
38
|
-
|
|
39
|
+
`;*/
|
|
40
|
+
this.innerHTML = `<button type="${this.#type}">${this.innerHTML}</button>`
|
|
39
41
|
this.#selected = this.hasAttribute("selected") && this.getAttribute("selected") !== "false"
|
|
40
|
-
this
|
|
41
|
-
this.button = this.shadowRoot.querySelector('button')
|
|
42
|
+
this.button = this.querySelector('button')
|
|
42
43
|
this.addEventListener("click", this.handleClick.bind(this))
|
|
44
|
+
|
|
45
|
+
|
|
43
46
|
}
|
|
44
47
|
get type() {
|
|
45
48
|
return this.#type
|
|
46
49
|
}
|
|
47
50
|
set type(value) {
|
|
48
51
|
this.#type = value
|
|
52
|
+
this.button.type = value
|
|
49
53
|
this.setAttribute("type", value)
|
|
50
54
|
}
|
|
51
55
|
get selected() {
|
|
@@ -56,10 +60,13 @@ class FigButton extends HTMLElement {
|
|
|
56
60
|
this.setAttribute("selected", value)
|
|
57
61
|
}
|
|
58
62
|
|
|
59
|
-
handleClick() {
|
|
63
|
+
handleClick(event) {
|
|
60
64
|
if (this.#type === "toggle") {
|
|
61
65
|
this.selected = !this.#selected
|
|
62
66
|
}
|
|
67
|
+
if (this.#type === "submit") {
|
|
68
|
+
this.button.click()
|
|
69
|
+
}
|
|
63
70
|
}
|
|
64
71
|
static get observedAttributes() {
|
|
65
72
|
return ['disabled'];
|
package/package.json
CHANGED