@rogieking/figui3 1.6.9 → 1.7.1
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/components.css +31 -0
- package/example.html +13 -21
- package/fig.js +38 -5
- package/package.json +1 -1
- package/bun.lockb +0 -0
package/components.css
CHANGED
|
@@ -437,6 +437,8 @@
|
|
|
437
437
|
/* Icons */
|
|
438
438
|
--icon-chevron: 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='M5.87868 7.12132L8 9.24264L10.1213 7.12132' stroke='rgb(0 0 0 / 90%)' stroke-linecap='round'/%3E%3C/svg%3E%0A");
|
|
439
439
|
--icon-checkmark: 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 fill-rule='evenodd' clip-rule='evenodd' d='M11.7773 4.08403C12.0071 4.2372 12.0692 4.54764 11.916 4.7774L7.91603 10.7774C7.83293 10.902 7.69834 10.9829 7.54927 10.9976C7.4002 11.0124 7.25237 10.9595 7.14645 10.8536L4.14645 7.85361C3.95118 7.65834 3.95118 7.34176 4.14645 7.1465C4.34171 6.95124 4.65829 6.95124 4.85355 7.1465L7.42229 9.71523L11.084 4.2227C11.2372 3.99294 11.5476 3.93085 11.7773 4.08403Z' fill='white'/%3E%3C/svg%3E%0A");
|
|
440
|
+
--icon-steppers: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11.7245 6.08191C11.9186 5.95386 12.1826 5.97562 12.3534 6.14637L14.3534 8.14637L14.4179 8.22449C14.546 8.41852 14.5242 8.68253 14.3534 8.8534C14.1826 9.02426 13.9186 9.04601 13.7245 8.91785L13.6464 8.8534L11.9999 7.20691L10.3534 8.8534C10.1582 9.04866 9.84166 9.04866 9.6464 8.8534C9.45123 8.65813 9.45117 8.3416 9.6464 8.14637L11.6464 6.14637L11.7245 6.08191Z' fill='black'/%3E%3Cpath d='M13.7248 15.0822C13.9189 14.9541 14.1829 14.9758 14.3537 15.1467C14.5246 15.3176 14.5463 15.5815 14.4182 15.7756L14.3537 15.8537L12.3537 17.8537C12.1829 18.0246 11.9189 18.0463 11.7248 17.9182L11.6467 17.8537L9.64669 15.8537L9.58224 15.7756C9.45407 15.5815 9.47583 15.3176 9.64669 15.1467C9.81756 14.9758 10.0815 14.9541 10.2756 15.0822L10.3537 15.1467L12.0002 16.7932L13.6467 15.1467L13.7248 15.0822Z' fill='black' /%3E%3C/svg%3E%0A");
|
|
441
|
+
|
|
440
442
|
/* Elevations */
|
|
441
443
|
--figma-elevation-100: 0px 0px 0.5px 0px rgba(0, 0, 0, 0.3),
|
|
442
444
|
0px 1px 3px 0px rgba(0, 0, 0, 0.15);
|
|
@@ -451,6 +453,7 @@
|
|
|
451
453
|
|
|
452
454
|
:root.figma-dark {
|
|
453
455
|
--icon-chevron: 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='M5.87868 7.12132L8 9.24264L10.1213 7.12132' stroke='rgb(255 255 255 / 100%)' stroke-linecap='round'/%3E%3C/svg%3E%0A");
|
|
456
|
+
|
|
454
457
|
--handle-shadow: 0px 0 0 0.75px 0px 0 0 0.75px rgba(0, 0, 0, 0.1),
|
|
455
458
|
0px 0px 0.5px 0px rgba(255, 255, 255, 0.1);
|
|
456
459
|
--figma-color-bg-ghost-hover: rgba(255, 255, 255, 0.05);
|
|
@@ -506,10 +509,33 @@ input[type="password"],
|
|
|
506
509
|
&::-webkit-outer-spin-button,
|
|
507
510
|
&::-webkit-inner-spin-button {
|
|
508
511
|
display: none;
|
|
512
|
+
-webkit-appearance: none;
|
|
509
513
|
margin: 0;
|
|
510
514
|
}
|
|
511
515
|
}
|
|
512
516
|
|
|
517
|
+
fig-input-text {
|
|
518
|
+
&:has([slot="append"]) input[type="number"] {
|
|
519
|
+
&::-webkit-outer-spin-button,
|
|
520
|
+
&::-webkit-inner-spin-button {
|
|
521
|
+
display: none;
|
|
522
|
+
margin: 0;
|
|
523
|
+
opacity: 0;
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
&[steppers="true"] {
|
|
527
|
+
input[type="number"]::-webkit-inner-spin-button {
|
|
528
|
+
display: block;
|
|
529
|
+
opacity: 1;
|
|
530
|
+
height: 1.5rem;
|
|
531
|
+
width: 1.5rem;
|
|
532
|
+
margin-right: calc(var(--spacer-2) * -1);
|
|
533
|
+
background-color: var(--figma-color-text-secondary);
|
|
534
|
+
mask-image: var(--icon-steppers);
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
|
|
513
539
|
/* Textarea */
|
|
514
540
|
textarea {
|
|
515
541
|
min-height: 2rem;
|
|
@@ -956,6 +982,11 @@ fig-tabs,
|
|
|
956
982
|
gap: var(--spacer-2);
|
|
957
983
|
}
|
|
958
984
|
|
|
985
|
+
fig-tab-content,
|
|
986
|
+
.fig-tab-content {
|
|
987
|
+
display: none;
|
|
988
|
+
}
|
|
989
|
+
|
|
959
990
|
/* Avatar */
|
|
960
991
|
fig-avatar,
|
|
961
992
|
.fig-avatar {
|
package/example.html
CHANGED
|
@@ -240,9 +240,16 @@
|
|
|
240
240
|
</fig-header>
|
|
241
241
|
<fig-field>
|
|
242
242
|
<fig-tabs>
|
|
243
|
-
<fig-tab selected
|
|
244
|
-
|
|
243
|
+
<fig-tab selected
|
|
244
|
+
content="#tab-1-content">Tab #1</fig-tab>
|
|
245
|
+
<fig-tab content="#tab-2-content">Tab #2</fig-tab>
|
|
245
246
|
</fig-tabs>
|
|
247
|
+
<fig-tab-content id="tab-1-content">
|
|
248
|
+
Content for Tab #1
|
|
249
|
+
</fig-tab-content>
|
|
250
|
+
<fig-tab-content id="tab-2-content">
|
|
251
|
+
Content for Tab #2
|
|
252
|
+
</fig-tab-content>
|
|
246
253
|
</fig-field>
|
|
247
254
|
<fig-header>
|
|
248
255
|
<h2>Segmented control</h2>
|
|
@@ -272,15 +279,7 @@
|
|
|
272
279
|
label="Upload image"
|
|
273
280
|
size="large"></fig-image>
|
|
274
281
|
</fig-field>
|
|
275
|
-
|
|
276
|
-
<fig-field>
|
|
277
|
-
<label>Large (with upload)</label>
|
|
278
|
-
<fig-image upload="true"
|
|
279
|
-
label="Change image"
|
|
280
|
-
aspect-ratio="auto"
|
|
281
|
-
src="charli.jpeg"
|
|
282
|
-
size="large"></fig-image>
|
|
283
|
-
</fig-field>
|
|
282
|
+
|
|
284
283
|
<br /><br />
|
|
285
284
|
<fig-header>
|
|
286
285
|
<h2>Button</h2>
|
|
@@ -575,7 +574,8 @@
|
|
|
575
574
|
<fig-field>
|
|
576
575
|
<label>Numeric input</label>
|
|
577
576
|
<fig-input-text placeholder="###"
|
|
578
|
-
type="number"
|
|
577
|
+
type="number"
|
|
578
|
+
steppers="true"></fig-input-text>
|
|
579
579
|
</fig-field>
|
|
580
580
|
<fig-field>
|
|
581
581
|
<label>Password input</label>
|
|
@@ -920,15 +920,7 @@
|
|
|
920
920
|
</fig-button>
|
|
921
921
|
</fig-field>
|
|
922
922
|
</fig-content>
|
|
923
|
-
|
|
924
|
-
let elements = Array.from(document.querySelectorAll('*'));
|
|
925
|
-
elements.filter(n => n.tagName.toLowerCase().indexOf("fig-slider") > -1).forEach(n => n.addEventListener('input', (e) => {
|
|
926
|
-
console.log('input:', n.tagName, e.target)
|
|
927
|
-
}))
|
|
928
|
-
document.querySelectorAll('fig-input-color').forEach(n => n.addEventListener('change', (e) => {
|
|
929
|
-
console.log('change:', n.tagName, e.target.value)
|
|
930
|
-
}))
|
|
931
|
-
</script>
|
|
923
|
+
|
|
932
924
|
</body>
|
|
933
925
|
|
|
934
926
|
</html>
|
package/fig.js
CHANGED
|
@@ -450,7 +450,6 @@ class FigDialog extends HTMLDialogElement {
|
|
|
450
450
|
connectedCallback() {
|
|
451
451
|
this.modal =
|
|
452
452
|
this.hasAttribute("modal") && this.getAttribute("modal") !== "false";
|
|
453
|
-
|
|
454
453
|
requestAnimationFrame(() => {
|
|
455
454
|
this.#addCloseListeners();
|
|
456
455
|
});
|
|
@@ -530,18 +529,53 @@ window.customElements.define("fig-popover-2", FigPopover2);
|
|
|
530
529
|
* @attr {boolean} selected - Whether the tab is currently selected
|
|
531
530
|
*/
|
|
532
531
|
class FigTab extends HTMLElement {
|
|
532
|
+
#selected;
|
|
533
533
|
constructor() {
|
|
534
534
|
super();
|
|
535
|
+
this.content = null;
|
|
536
|
+
this.#selected = false;
|
|
535
537
|
}
|
|
536
538
|
connectedCallback() {
|
|
537
539
|
this.setAttribute("label", this.innerText);
|
|
538
540
|
this.addEventListener("click", this.handleClick.bind(this));
|
|
541
|
+
|
|
542
|
+
requestAnimationFrame(() => {
|
|
543
|
+
if (typeof this.getAttribute("content") === "string") {
|
|
544
|
+
this.content = document.querySelector(this.getAttribute("content"));
|
|
545
|
+
if (this.#selected) {
|
|
546
|
+
this.content.style.display = "block";
|
|
547
|
+
} else {
|
|
548
|
+
this.content.style.display = "none";
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
});
|
|
552
|
+
}
|
|
553
|
+
get selected() {
|
|
554
|
+
return this.#selected;
|
|
555
|
+
}
|
|
556
|
+
set selected(value) {
|
|
557
|
+
this.setAttribute("selected", value ? "true" : "false");
|
|
539
558
|
}
|
|
540
559
|
disconnectedCallback() {
|
|
541
560
|
this.removeEventListener("click", this.handleClick);
|
|
542
561
|
}
|
|
543
562
|
handleClick() {
|
|
544
|
-
this.
|
|
563
|
+
this.selected = true;
|
|
564
|
+
if (this.content) {
|
|
565
|
+
this.content.style.display = "block";
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
static get observedAttributes() {
|
|
570
|
+
return ["selected"];
|
|
571
|
+
}
|
|
572
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
573
|
+
if (name === "selected") {
|
|
574
|
+
this.#selected = newValue !== null && newValue !== "false";
|
|
575
|
+
if (this?.content) {
|
|
576
|
+
this.content.style.display = this.#selected ? "block" : "none";
|
|
577
|
+
}
|
|
578
|
+
}
|
|
545
579
|
}
|
|
546
580
|
}
|
|
547
581
|
window.customElements.define("fig-tab", FigTab);
|
|
@@ -983,8 +1017,8 @@ class FigInputText extends HTMLElement {
|
|
|
983
1017
|
|
|
984
1018
|
//child nodes hack
|
|
985
1019
|
requestAnimationFrame(() => {
|
|
986
|
-
|
|
987
|
-
|
|
1020
|
+
let append = this.querySelector("[slot=append]");
|
|
1021
|
+
let prepend = this.querySelector("[slot=prepend]");
|
|
988
1022
|
|
|
989
1023
|
this.innerHTML = html;
|
|
990
1024
|
|
|
@@ -1845,7 +1879,6 @@ class FigImage extends HTMLElement {
|
|
|
1845
1879
|
await new Promise((resolve) => {
|
|
1846
1880
|
this.image = new Image();
|
|
1847
1881
|
this.image.crossOrigin = "Anonymous";
|
|
1848
|
-
console.log("loading image", this.src);
|
|
1849
1882
|
this.image.onload = async () => {
|
|
1850
1883
|
this.aspectRatio = this.image.width / this.image.height;
|
|
1851
1884
|
this.style.setProperty(
|
package/package.json
CHANGED
package/bun.lockb
DELETED
|
Binary file
|