@rogieking/figui3 2.17.2 → 2.17.3
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 +14 -0
- package/fig.js +2 -1
- package/index.html +31 -3
- package/package.json +1 -1
package/components.css
CHANGED
|
@@ -2060,6 +2060,20 @@ dialog[is="fig-popup"] {
|
|
|
2060
2060
|
display: block;
|
|
2061
2061
|
}
|
|
2062
2062
|
|
|
2063
|
+
&[theme="dark"] {
|
|
2064
|
+
color-scheme: dark;
|
|
2065
|
+
}
|
|
2066
|
+
|
|
2067
|
+
&[theme="light"] {
|
|
2068
|
+
color-scheme: light;
|
|
2069
|
+
}
|
|
2070
|
+
|
|
2071
|
+
&[theme="menu"] {
|
|
2072
|
+
background-color: var(--figma-color-bg-menu);
|
|
2073
|
+
color: var(--figma-color-text-menu);
|
|
2074
|
+
color-scheme: dark;
|
|
2075
|
+
}
|
|
2076
|
+
|
|
2063
2077
|
&[variant="popover"] {
|
|
2064
2078
|
overflow: visible;
|
|
2065
2079
|
box-shadow: inset 0 0.5px 0 0 rgba(255, 255, 255, 0.1);
|
package/fig.js
CHANGED
|
@@ -1057,6 +1057,7 @@ customElements.define("fig-dialog", FigDialog, { extends: "dialog" });
|
|
|
1057
1057
|
* @attr {string} position - Preferred placement as "vertical horizontal" (default: "top center").
|
|
1058
1058
|
* @attr {string} offset - Horizontal and vertical offset as "x y" (default: "0 0").
|
|
1059
1059
|
* @attr {string} variant - Visual variant. Use variant="popover" to show an anchor beak.
|
|
1060
|
+
* @attr {string} theme - Visual theme: "light", "dark", or "menu".
|
|
1060
1061
|
* @attr {boolean|string} open - Open when present and not "false".
|
|
1061
1062
|
*/
|
|
1062
1063
|
class FigPopup extends HTMLDialogElement {
|
|
@@ -1078,7 +1079,7 @@ class FigPopup extends HTMLDialogElement {
|
|
|
1078
1079
|
}
|
|
1079
1080
|
|
|
1080
1081
|
static get observedAttributes() {
|
|
1081
|
-
return ["open", "anchor", "position", "offset", "variant"];
|
|
1082
|
+
return ["open", "anchor", "position", "offset", "variant", "theme"];
|
|
1082
1083
|
}
|
|
1083
1084
|
|
|
1084
1085
|
get open() {
|
package/index.html
CHANGED
|
@@ -2682,7 +2682,14 @@
|
|
|
2682
2682
|
|
|
2683
2683
|
<h3>Popover Variant (with Arrow)</h3>
|
|
2684
2684
|
<p class="description">Use <code>variant="popover"</code> to show the beak and automatically point it at the
|
|
2685
|
-
anchor.</p>
|
|
2685
|
+
anchor. Use <code>theme="menu"</code> for menu-style dark surfaces.</p>
|
|
2686
|
+
<fig-segmented-control id="popup-theme-control">
|
|
2687
|
+
<fig-segment id="popup-theme-default">Default</fig-segment>
|
|
2688
|
+
<fig-segment id="popup-theme-dark">Dark</fig-segment>
|
|
2689
|
+
<fig-segment id="popup-theme-light">Light</fig-segment>
|
|
2690
|
+
<fig-segment id="popup-theme-menu"
|
|
2691
|
+
selected>Menu</fig-segment>
|
|
2692
|
+
</fig-segmented-control>
|
|
2686
2693
|
<hstack>
|
|
2687
2694
|
<fig-button id="popup-open-popover">Open Popover Variant</fig-button>
|
|
2688
2695
|
<fig-button id="popup-close-popover"
|
|
@@ -2692,7 +2699,8 @@
|
|
|
2692
2699
|
is="fig-popup"
|
|
2693
2700
|
anchor="#popup-open-popover"
|
|
2694
2701
|
position="top center"
|
|
2695
|
-
variant="popover"
|
|
2702
|
+
variant="popover"
|
|
2703
|
+
theme="menu">
|
|
2696
2704
|
<vstack style="min-width: 12rem;">
|
|
2697
2705
|
<strong style="padding: 0 var(--spacer-1);">Popover Beak</strong>
|
|
2698
2706
|
<fig-field direction="horizontal">
|
|
@@ -2705,7 +2713,8 @@
|
|
|
2705
2713
|
<dialog is="fig-popup"
|
|
2706
2714
|
anchor="#popup-open-popover"
|
|
2707
2715
|
position="top center"
|
|
2708
|
-
variant="popover"
|
|
2716
|
+
variant="popover"
|
|
2717
|
+
theme="menu">
|
|
2709
2718
|
...
|
|
2710
2719
|
</dialog></code></pre>
|
|
2711
2720
|
|
|
@@ -4166,6 +4175,8 @@ button.addEventListener('click', () => {
|
|
|
4166
4175
|
const popupDefault = document.getElementById('popup-default');
|
|
4167
4176
|
const popupPreferred = document.getElementById('popup-preferred');
|
|
4168
4177
|
const popupProp = document.getElementById('popup-prop');
|
|
4178
|
+
const popupPopover = document.getElementById('popup-popover');
|
|
4179
|
+
const popupThemeControl = document.getElementById('popup-theme-control');
|
|
4169
4180
|
|
|
4170
4181
|
document.getElementById('popup-open-default')?.addEventListener('click', () => {
|
|
4171
4182
|
popupDefault?.setAttribute('open', 'true');
|
|
@@ -4188,6 +4199,23 @@ button.addEventListener('click', () => {
|
|
|
4188
4199
|
if (popupProp) popupProp.open = false;
|
|
4189
4200
|
});
|
|
4190
4201
|
|
|
4202
|
+
popupThemeControl?.addEventListener('click', () => {
|
|
4203
|
+
if (!popupPopover) return;
|
|
4204
|
+
if (document.getElementById('popup-theme-default')?.hasAttribute('selected')) {
|
|
4205
|
+
popupPopover.removeAttribute('theme');
|
|
4206
|
+
return;
|
|
4207
|
+
}
|
|
4208
|
+
if (document.getElementById('popup-theme-dark')?.hasAttribute('selected')) {
|
|
4209
|
+
popupPopover.setAttribute('theme', 'dark');
|
|
4210
|
+
return;
|
|
4211
|
+
}
|
|
4212
|
+
if (document.getElementById('popup-theme-light')?.hasAttribute('selected')) {
|
|
4213
|
+
popupPopover.setAttribute('theme', 'light');
|
|
4214
|
+
return;
|
|
4215
|
+
}
|
|
4216
|
+
popupPopover.setAttribute('theme', 'menu');
|
|
4217
|
+
});
|
|
4218
|
+
|
|
4191
4219
|
const popupExamples = [
|
|
4192
4220
|
['popup-open-popover', 'popup-close-popover', 'popup-popover'],
|
|
4193
4221
|
['popup-open-top-left', 'popup-close-top-left', 'popup-top-left'],
|
package/package.json
CHANGED