@rogieking/figui3 2.12.2 → 2.13.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 +9 -0
- package/fig.js +14 -7
- package/index.html +56 -1
- package/package.json +1 -1
package/components.css
CHANGED
|
@@ -2487,6 +2487,15 @@ fig-segmented-control {
|
|
|
2487
2487
|
border-radius: calc(var(--radius-medium) - 1px);
|
|
2488
2488
|
box-shadow: 0 0 0 1px var(--figma-color-border);
|
|
2489
2489
|
}
|
|
2490
|
+
|
|
2491
|
+
svg {
|
|
2492
|
+
*[fill] {
|
|
2493
|
+
fill: currentColor;
|
|
2494
|
+
}
|
|
2495
|
+
*[stroke]:not([stroke="none"]) {
|
|
2496
|
+
stroke: currentColor;
|
|
2497
|
+
}
|
|
2498
|
+
}
|
|
2490
2499
|
}
|
|
2491
2500
|
}
|
|
2492
2501
|
|
package/fig.js
CHANGED
|
@@ -847,6 +847,8 @@ class FigDialog extends HTMLDialogElement {
|
|
|
847
847
|
"textarea",
|
|
848
848
|
"a",
|
|
849
849
|
"label",
|
|
850
|
+
"details",
|
|
851
|
+
"summary",
|
|
850
852
|
'[contenteditable="true"]',
|
|
851
853
|
"[tabindex]",
|
|
852
854
|
];
|
|
@@ -893,6 +895,11 @@ class FigDialog extends HTMLDialogElement {
|
|
|
893
895
|
return;
|
|
894
896
|
}
|
|
895
897
|
|
|
898
|
+
// Don't interfere with interactive elements (inputs, sliders, buttons, etc.)
|
|
899
|
+
if (this.#isInteractiveElement(e.target)) {
|
|
900
|
+
return;
|
|
901
|
+
}
|
|
902
|
+
|
|
896
903
|
// If handle attribute is specified, only allow drag from within that element
|
|
897
904
|
// Otherwise, allow dragging from anywhere on the dialog (except interactive elements)
|
|
898
905
|
const handleSelector = this.getAttribute("handle");
|
|
@@ -905,7 +912,7 @@ class FigDialog extends HTMLDialogElement {
|
|
|
905
912
|
// No handle specified = drag from anywhere (original behavior)
|
|
906
913
|
|
|
907
914
|
// Don't prevent default yet - just set up pending drag
|
|
908
|
-
// This allows clicks on interactive elements like <details> to work
|
|
915
|
+
// This allows clicks on non-interactive elements like <details> to work
|
|
909
916
|
this.#dragPending = true;
|
|
910
917
|
this.#dragStartPos.x = e.clientX;
|
|
911
918
|
this.#dragStartPos.y = e.clientY;
|
|
@@ -1361,14 +1368,14 @@ class FigSegmentedControl extends HTMLElement {
|
|
|
1361
1368
|
}
|
|
1362
1369
|
|
|
1363
1370
|
handleClick(event) {
|
|
1364
|
-
const
|
|
1365
|
-
if (
|
|
1371
|
+
const segment = event.target.closest("fig-segment");
|
|
1372
|
+
if (segment) {
|
|
1366
1373
|
const segments = this.querySelectorAll("fig-segment");
|
|
1367
|
-
for (const
|
|
1368
|
-
if (
|
|
1369
|
-
this.selectedSegment =
|
|
1374
|
+
for (const seg of segments) {
|
|
1375
|
+
if (seg === segment) {
|
|
1376
|
+
this.selectedSegment = seg;
|
|
1370
1377
|
} else {
|
|
1371
|
-
|
|
1378
|
+
seg.removeAttribute("selected");
|
|
1372
1379
|
}
|
|
1373
1380
|
}
|
|
1374
1381
|
}
|
package/index.html
CHANGED
|
@@ -683,9 +683,26 @@
|
|
|
683
683
|
<fig-content>
|
|
684
684
|
<p>This is a draggable dialog. You can drag it by the header.</p>
|
|
685
685
|
<fig-field direction="horizontal">
|
|
686
|
-
<label>
|
|
686
|
+
<label>Text</label>
|
|
687
687
|
<fig-input-text placeholder="Enter text"></fig-input-text>
|
|
688
688
|
</fig-field>
|
|
689
|
+
<fig-field direction="horizontal">
|
|
690
|
+
<label>Number</label>
|
|
691
|
+
<fig-input-number value="50"
|
|
692
|
+
min="0"
|
|
693
|
+
max="100"
|
|
694
|
+
units="px"></fig-input-number>
|
|
695
|
+
</fig-field>
|
|
696
|
+
<fig-field direction="horizontal">
|
|
697
|
+
<label>Slider</label>
|
|
698
|
+
<fig-slider value="50"
|
|
699
|
+
min="0"
|
|
700
|
+
max="100"></fig-slider>
|
|
701
|
+
</fig-field>
|
|
702
|
+
<fig-field direction="horizontal">
|
|
703
|
+
<label>Checkbox</label>
|
|
704
|
+
<fig-checkbox checked="true">Enable feature</fig-checkbox>
|
|
705
|
+
</fig-field>
|
|
689
706
|
<details>
|
|
690
707
|
<summary>More options</summary>
|
|
691
708
|
<fig-field direction="horizontal">
|
|
@@ -735,6 +752,17 @@
|
|
|
735
752
|
</fig-header>
|
|
736
753
|
<fig-content>
|
|
737
754
|
<p>This dialog is positioned at a specific corner.</p>
|
|
755
|
+
<fig-field direction="horizontal">
|
|
756
|
+
<label>Number</label>
|
|
757
|
+
<fig-input-number value="100"
|
|
758
|
+
units="%"></fig-input-number>
|
|
759
|
+
</fig-field>
|
|
760
|
+
<fig-field direction="horizontal">
|
|
761
|
+
<label>Slider</label>
|
|
762
|
+
<fig-slider value="50"
|
|
763
|
+
min="0"
|
|
764
|
+
max="100"></fig-slider>
|
|
765
|
+
</fig-field>
|
|
738
766
|
</fig-content>
|
|
739
767
|
<footer>
|
|
740
768
|
<fig-button close-dialog>Close</fig-button>
|
|
@@ -778,6 +806,19 @@
|
|
|
778
806
|
<li>✗ This content area (won't drag)</li>
|
|
779
807
|
<li>✗ The footer below (won't drag)</li>
|
|
780
808
|
</ul>
|
|
809
|
+
<fig-field direction="horizontal">
|
|
810
|
+
<label>Number</label>
|
|
811
|
+
<fig-input-number value="45"
|
|
812
|
+
units="°"
|
|
813
|
+
min="0"
|
|
814
|
+
max="360"></fig-input-number>
|
|
815
|
+
</fig-field>
|
|
816
|
+
<fig-field direction="horizontal">
|
|
817
|
+
<label>Slider</label>
|
|
818
|
+
<fig-slider value="50"
|
|
819
|
+
min="0"
|
|
820
|
+
max="100"></fig-slider>
|
|
821
|
+
</fig-field>
|
|
781
822
|
<details>
|
|
782
823
|
<summary>More options</summary>
|
|
783
824
|
<fig-field direction="horizontal">
|
|
@@ -2497,6 +2538,20 @@
|
|
|
2497
2538
|
<fig-segment>Right</fig-segment>
|
|
2498
2539
|
</fig-segmented-control>
|
|
2499
2540
|
|
|
2541
|
+
<h3>With Icons</h3>
|
|
2542
|
+
<fig-segmented-control>
|
|
2543
|
+
<fig-segment selected>
|
|
2544
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2545
|
+
<path d="M8.5 5.59686C8.80936 5.41829 9.19064 5.41829 9.5 5.59686L15 8.77264C15.6185 9.12984 15.9998 9.78984 16 10.5041V16.8557C15.9999 17.2128 15.8093 17.5433 15.5 17.7219C15.1907 17.9003 14.8093 17.9003 14.5 17.7219L14.2988 17.6057L14.1025 17.4924L13.9111 17.381L13.7236 17.2736L13.541 17.1672L13.3613 17.0637L13.1846 16.9621L13.0117 16.8625L12.8418 16.7639L12.6738 16.6672L12.5078 16.5715L12.3438 16.4767L12.1816 16.383L12.0205 16.2902L11.8613 16.1974L11.7012 16.1057L11.543 16.0139L11.0654 15.7385L10.9053 15.6457L10.7432 15.5519L10.5801 15.4582L10.416 15.3635L10.249 15.2668L10.0801 15.1691L9.9082 15.0705L9.73438 14.9699L9.55664 14.8674L9.375 14.7619L9.18945 14.6555L9.00098 14.5461C8.38287 14.1892 8.00002 13.5289 8 12.8137V6.46307C8 6.10581 8.1906 5.7755 8.5 5.59686ZM9 12.8137C9.00001 13.1709 9.1916 13.5012 9.50098 13.6799C11.542 14.8584 12.8291 15.6022 15 16.8557V10.5051C15 10.1925 14.8541 9.89983 14.6104 9.7121L14.5 9.63885L9 6.46307V12.8137Z" fill="black" fill-opacity="0.9"/>
|
|
2546
|
+
</svg>
|
|
2547
|
+
</fig-segment>
|
|
2548
|
+
<fig-segment>
|
|
2549
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2550
|
+
<path d="M14.4998 5.5968C14.8091 5.41823 15.1904 5.41823 15.4998 5.5968C15.8092 5.77543 15.9998 6.10575 15.9998 6.46301V12.8136C15.9997 13.5281 15.6185 14.1888 14.9998 14.546L9.49976 17.7218C9.19046 17.9003 8.80905 17.9003 8.49976 17.7218C8.19043 17.5432 7.99986 17.2127 7.99976 16.8556V10.504C7.99995 9.78978 8.38122 9.12978 8.99976 8.77258L14.4998 5.5968ZM9.49976 9.63879L9.3894 9.71204C9.14564 9.89977 8.99977 10.1924 8.99976 10.505V16.8556L14.4998 13.6798C14.7704 13.5235 14.9502 13.2513 14.991 12.9464L14.9998 12.8136V6.46301L9.49976 9.63879Z" fill="black" fill-opacity="0.9"/>
|
|
2551
|
+
</svg>
|
|
2552
|
+
</fig-segment>
|
|
2553
|
+
</fig-segmented-control>
|
|
2554
|
+
|
|
2500
2555
|
<h3>Many Options</h3>
|
|
2501
2556
|
<fig-segmented-control>
|
|
2502
2557
|
<fig-segment>XS</fig-segment>
|
package/package.json
CHANGED