@rogieking/figui3 1.0.90 → 1.0.92
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/example.html +17 -2
- package/fig.css +83 -73
- package/fig.js +13 -10
- package/package.json +1 -1
package/example.html
CHANGED
|
@@ -19,13 +19,28 @@
|
|
|
19
19
|
<h2>Heading 2</h2>
|
|
20
20
|
<h3>Heading 3</h3>
|
|
21
21
|
<br />
|
|
22
|
+
<fig-button-combo>
|
|
23
|
+
<fig-button disabled>Button 1</fig-button>
|
|
24
|
+
<fig-button disabled>Button 2</fig-button>
|
|
25
|
+
<fig-button disabled>Button 3</fig-button>
|
|
26
|
+
</fig-button-combo>
|
|
27
|
+
<br /><br />
|
|
28
|
+
<fig-button-combo>
|
|
29
|
+
<fig-button variant="secondary"
|
|
30
|
+
disabled>Button 1</fig-button>
|
|
31
|
+
<fig-button variant="secondary"
|
|
32
|
+
disabled>Button 2</fig-button>
|
|
33
|
+
<fig-button variant="secondary"
|
|
34
|
+
disabled>Button 3</fig-button>
|
|
35
|
+
</fig-button-combo>
|
|
36
|
+
<br /><br />
|
|
22
37
|
<fig-dropdown>
|
|
23
38
|
<option>One</option>
|
|
24
39
|
<option>Two</option>
|
|
25
40
|
<option>Three</option>
|
|
26
41
|
<option selected>Four</option>
|
|
27
42
|
</fig-dropdown>
|
|
28
|
-
<br />
|
|
43
|
+
<br /><br />
|
|
29
44
|
<fig-slider min="0"
|
|
30
45
|
max="1"
|
|
31
46
|
transform="100"
|
|
@@ -40,7 +55,7 @@
|
|
|
40
55
|
step="0.1"
|
|
41
56
|
transform="100"
|
|
42
57
|
type="number"
|
|
43
|
-
|
|
58
|
+
autoresize="true"
|
|
44
59
|
value="0.5"
|
|
45
60
|
text="true">
|
|
46
61
|
<span slot="append">%</span>
|
package/fig.css
CHANGED
|
@@ -696,7 +696,7 @@ fig-button {
|
|
|
696
696
|
}
|
|
697
697
|
}
|
|
698
698
|
|
|
699
|
-
&[variant="ghost"][disabled="
|
|
699
|
+
&[variant="ghost"][disabled]:not([disabled="false"]) {
|
|
700
700
|
background-color: transparent;
|
|
701
701
|
}
|
|
702
702
|
|
|
@@ -732,11 +732,18 @@ fig-button {
|
|
|
732
732
|
}
|
|
733
733
|
|
|
734
734
|
/* Disabled */
|
|
735
|
-
&[disabled="
|
|
736
|
-
&[disabled="true"] > button {
|
|
735
|
+
&[disabled]:not([disabled="false"]){
|
|
737
736
|
background-color: var(--figma-color-bg-disabled);
|
|
738
|
-
|
|
737
|
+
|
|
739
738
|
pointer-events: none;
|
|
739
|
+
&:not([variant="secondary"]){
|
|
740
|
+
color: var(--figma-color-text-ondisabled);
|
|
741
|
+
box-shadow: none;
|
|
742
|
+
}
|
|
743
|
+
&[variant="secondary"]{
|
|
744
|
+
color: var(--figma-color-text-disabled);
|
|
745
|
+
background-color: transparent;
|
|
746
|
+
}
|
|
740
747
|
}
|
|
741
748
|
|
|
742
749
|
/* Size */
|
|
@@ -795,18 +802,62 @@ fig-button {
|
|
|
795
802
|
|
|
796
803
|
&:focus,
|
|
797
804
|
&:focus-within {
|
|
798
|
-
|
|
799
|
-
|
|
805
|
+
&:not(:active) {
|
|
806
|
+
outline: 0;
|
|
807
|
+
box-shadow: inset 0 0 0 1px var(--figma-color-border-selected);
|
|
808
|
+
}
|
|
800
809
|
}
|
|
801
810
|
}
|
|
802
811
|
|
|
803
|
-
|
|
804
|
-
|
|
812
|
+
/* Combo button */
|
|
813
|
+
.fig-button-combo,
|
|
814
|
+
fig-button-combo,
|
|
815
|
+
.fig-input-combo,
|
|
816
|
+
fig-input-combo {
|
|
817
|
+
display: inline-flex;
|
|
818
|
+
flex-wrap: nowrap;
|
|
819
|
+
align-items: center;
|
|
820
|
+
gap: 0px;
|
|
821
|
+
& > * {
|
|
822
|
+
&:first-child,
|
|
823
|
+
&:first-child > * {
|
|
824
|
+
border-top-right-radius: 0;
|
|
825
|
+
border-bottom-right-radius: 0;
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
&:last-child,
|
|
829
|
+
&:last-child > * {
|
|
830
|
+
border-top-left-radius: 0;
|
|
831
|
+
border-bottom-left-radius: 0;
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
&:not(:last-child):not(:first-child),
|
|
835
|
+
&:not(:last-child):not(:first-child) > * {
|
|
836
|
+
border-radius: 0;
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
.fig-button-combo,
|
|
841
|
+
fig-button-combo {
|
|
842
|
+
> *:not(:first-child) {
|
|
843
|
+
border-left: 1px solid var(--figma-color-bg-brand-hover);
|
|
844
|
+
margin-left: -1px;
|
|
845
|
+
&[disabled]:not([disabled="false"]) {
|
|
846
|
+
border-left: 1px solid var(--figma-color-border-disabled);
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
> *[variant="secondary"]:not(:first-child) {
|
|
850
|
+
border-left: transparent;
|
|
851
|
+
margin-left: -1px;
|
|
852
|
+
&[disabled]:not([disabled="false"]) {
|
|
853
|
+
border-left: transparent;
|
|
854
|
+
}
|
|
855
|
+
}
|
|
805
856
|
}
|
|
806
857
|
|
|
807
858
|
/* Tabs */
|
|
808
859
|
fig-tab,
|
|
809
|
-
.tab {
|
|
860
|
+
.fig-tab {
|
|
810
861
|
display: inline-flex;
|
|
811
862
|
flex-direction: column;
|
|
812
863
|
align-items: center;
|
|
@@ -838,7 +889,7 @@ fig-tab,
|
|
|
838
889
|
}
|
|
839
890
|
|
|
840
891
|
&:has(:checked),
|
|
841
|
-
&[selected] {
|
|
892
|
+
&[selected]:not([selected="false"]) {
|
|
842
893
|
background-color: var(--figma-color-bg-secondary);
|
|
843
894
|
font-weight: var(--body-medium-strong-fontWeight);
|
|
844
895
|
color: var(--figma-color-text);
|
|
@@ -1116,45 +1167,7 @@ fig-image {
|
|
|
1116
1167
|
}
|
|
1117
1168
|
}
|
|
1118
1169
|
|
|
1119
|
-
/* Combo button */
|
|
1120
|
-
.fig-button-combo,
|
|
1121
|
-
fig-button-combo,
|
|
1122
|
-
.fig-input-combo,
|
|
1123
|
-
fig-input-combo {
|
|
1124
|
-
display: inline-flex;
|
|
1125
|
-
flex-wrap: nowrap;
|
|
1126
|
-
align-items: center;
|
|
1127
|
-
gap: 0px;
|
|
1128
|
-
& > * {
|
|
1129
|
-
&:first-child,
|
|
1130
|
-
&:first-child > * {
|
|
1131
|
-
border-top-right-radius: 0;
|
|
1132
|
-
border-bottom-right-radius: 0;
|
|
1133
|
-
}
|
|
1134
|
-
|
|
1135
|
-
&:last-child,
|
|
1136
|
-
&:last-child > * {
|
|
1137
|
-
border-top-left-radius: 0;
|
|
1138
|
-
border-bottom-left-radius: 0;
|
|
1139
|
-
}
|
|
1140
1170
|
|
|
1141
|
-
&:not(:last-child):not(:first-child),
|
|
1142
|
-
&:not(:last-child):not(:first-child) > * {
|
|
1143
|
-
border-radius: 0;
|
|
1144
|
-
}
|
|
1145
|
-
}
|
|
1146
|
-
}
|
|
1147
|
-
.fig-button-combo,
|
|
1148
|
-
fig-button-combo {
|
|
1149
|
-
> *:not(:first-child) {
|
|
1150
|
-
border-left: 1px solid var(--figma-color-bg-brand-hover);
|
|
1151
|
-
margin-left: -1px;
|
|
1152
|
-
}
|
|
1153
|
-
> *[variant="secondary"]:not(:first-child) {
|
|
1154
|
-
border-left: transparent;
|
|
1155
|
-
margin-left: -1px;
|
|
1156
|
-
}
|
|
1157
|
-
}
|
|
1158
1171
|
|
|
1159
1172
|
/* Combo input */
|
|
1160
1173
|
.input-combo {
|
|
@@ -1983,30 +1996,6 @@ fig-tabs {
|
|
|
1983
1996
|
}
|
|
1984
1997
|
}
|
|
1985
1998
|
|
|
1986
|
-
/* Text input */
|
|
1987
|
-
fig-input-text {
|
|
1988
|
-
display: inline-flex;
|
|
1989
|
-
user-select: all;
|
|
1990
|
-
gap: 0;
|
|
1991
|
-
|
|
1992
|
-
&[multiline] {
|
|
1993
|
-
display: block;
|
|
1994
|
-
}
|
|
1995
|
-
&[autoresize] input,
|
|
1996
|
-
&[autoresize] textarea {
|
|
1997
|
-
field-sizing: content;
|
|
1998
|
-
}
|
|
1999
|
-
&[resizable] input,
|
|
2000
|
-
&[resizable] textarea {
|
|
2001
|
-
resize: both;
|
|
2002
|
-
}
|
|
2003
|
-
&[resizable]:has(textarea[style*="width"]),
|
|
2004
|
-
&[resizable]:has(textarea[style*="height"]),
|
|
2005
|
-
&[resizable]:has(input[style*="width"]),
|
|
2006
|
-
&[resizable]:has(input[style*="height"]) {
|
|
2007
|
-
flex: unset;
|
|
2008
|
-
}
|
|
2009
|
-
}
|
|
2010
1999
|
|
|
2011
2000
|
fig-checkbox,
|
|
2012
2001
|
fig-radio {
|
|
@@ -2069,9 +2058,30 @@ fig-input-text {
|
|
|
2069
2058
|
background-color: var(--figma-color-bg-secondary);
|
|
2070
2059
|
border: 0;
|
|
2071
2060
|
border-radius: var(--radius-medium);
|
|
2072
|
-
display: flex;
|
|
2061
|
+
display: inline-flex;
|
|
2073
2062
|
flex-wrap: nowrap;
|
|
2074
2063
|
justify-content: center;
|
|
2064
|
+
user-select: all;
|
|
2065
|
+
gap: 0;
|
|
2066
|
+
|
|
2067
|
+
&[multiline] {
|
|
2068
|
+
display: block;
|
|
2069
|
+
display: flex;
|
|
2070
|
+
}
|
|
2071
|
+
&[autoresize] input,
|
|
2072
|
+
&[autoresize] textarea {
|
|
2073
|
+
field-sizing: content;
|
|
2074
|
+
}
|
|
2075
|
+
&[resizable] input,
|
|
2076
|
+
&[resizable] textarea {
|
|
2077
|
+
resize: both;
|
|
2078
|
+
}
|
|
2079
|
+
&[resizable]:has(textarea[style*="width"]),
|
|
2080
|
+
&[resizable]:has(textarea[style*="height"]),
|
|
2081
|
+
&[resizable]:has(input[style*="width"]),
|
|
2082
|
+
&[resizable]:has(input[style*="height"]) {
|
|
2083
|
+
flex: unset;
|
|
2084
|
+
}
|
|
2075
2085
|
|
|
2076
2086
|
& label,
|
|
2077
2087
|
& [slot] {
|
package/fig.js
CHANGED
|
@@ -805,25 +805,28 @@ class FigSlider extends HTMLElement {
|
|
|
805
805
|
}
|
|
806
806
|
handleTextInput() {
|
|
807
807
|
if (this.figInputText) {
|
|
808
|
-
this.input.value =
|
|
809
|
-
this
|
|
808
|
+
this.value = this.input.value = this.figInputText.value;
|
|
809
|
+
this.#syncProperties();
|
|
810
810
|
}
|
|
811
811
|
}
|
|
812
812
|
#calculateNormal(value) {
|
|
813
813
|
let min = Number(this.input.min);
|
|
814
814
|
let max = Number(this.input.max);
|
|
815
|
-
let val =
|
|
815
|
+
let val = value;
|
|
816
816
|
return (val - min) / (max - min);
|
|
817
817
|
}
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
let val = Number(this.input.value);
|
|
821
|
-
this.value = val;
|
|
822
|
-
let complete = this.#calculateNormal(val);
|
|
818
|
+
#syncProperties() {
|
|
819
|
+
let complete = this.#calculateNormal(this.value);
|
|
823
820
|
let defaultValue = this.#calculateNormal(this.default);
|
|
824
821
|
this.style.setProperty("--slider-complete", complete);
|
|
825
822
|
this.style.setProperty("--default", defaultValue);
|
|
826
823
|
this.style.setProperty("--unchanged", complete === defaultValue ? 1 : 0);
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
handleInput() {
|
|
827
|
+
let val = this.input.value;
|
|
828
|
+
this.value = val;
|
|
829
|
+
this.#syncProperties();
|
|
827
830
|
if (this.figInputText) {
|
|
828
831
|
this.figInputText.setAttribute("value", val);
|
|
829
832
|
}
|
|
@@ -902,10 +905,10 @@ class FigInputText extends HTMLElement {
|
|
|
902
905
|
this.input.focus();
|
|
903
906
|
}
|
|
904
907
|
#transformNumber(value) {
|
|
905
|
-
return
|
|
908
|
+
return value * (this.transform || 1);
|
|
906
909
|
}
|
|
907
910
|
#handleInput(e) {
|
|
908
|
-
let value =
|
|
911
|
+
let value = e.target.value;
|
|
909
912
|
if (this.type === "number") {
|
|
910
913
|
this.value = value / (this.transform || 1);
|
|
911
914
|
} else {
|
package/package.json
CHANGED