palace-ui 0.11.0 → 0.12.0
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/SPEC.md +21 -0
- package/catalog.html +18 -0
- package/package.json +1 -1
- package/palace.css +118 -1
package/SPEC.md
CHANGED
|
@@ -138,6 +138,27 @@ Every page follows this structure:
|
|
|
138
138
|
</nav>
|
|
139
139
|
```
|
|
140
140
|
|
|
141
|
+
A navbar menu for the signed-in user is a `<details class="navbar-menu">`: the summary looks like `.navbar-user`, and the panel's links and buttons are its items. A form in the panel (sign out) sits under a thin rule. It works without JavaScript; a script can add Escape and closing from outside.
|
|
142
|
+
|
|
143
|
+
```html
|
|
144
|
+
<nav class="navbar">
|
|
145
|
+
<a href="/" class="navbar-brand">App Name</a>
|
|
146
|
+
<div class="navbar-right">
|
|
147
|
+
<details class="navbar-menu">
|
|
148
|
+
<summary><span class="visually-hidden">Account: </span>Username</summary>
|
|
149
|
+
<div class="navbar-menu-panel">
|
|
150
|
+
<p class="navbar-menu-label" aria-hidden="true">Your teams</p>
|
|
151
|
+
<ul aria-label="Your teams"><li><a href="/a" aria-current="true">Team A</a></li></ul>
|
|
152
|
+
<a href="/account">Account</a>
|
|
153
|
+
<form method="post" action="/logout"><button type="submit">Sign out</button></form>
|
|
154
|
+
</div>
|
|
155
|
+
</details>
|
|
156
|
+
</div>
|
|
157
|
+
</nav>
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
`.visually-hidden` hides text visually and keeps it for screen readers.
|
|
161
|
+
|
|
141
162
|
With an icon beside the brand name (`.navbar-brand` uses `inline-flex` layout with `gap: 10px`; images/SVGs are auto-sized to 24×24):
|
|
142
163
|
|
|
143
164
|
```html
|
package/catalog.html
CHANGED
|
@@ -793,6 +793,24 @@
|
|
|
793
793
|
</nav>
|
|
794
794
|
</div>
|
|
795
795
|
|
|
796
|
+
<h3 style="margin-bottom: 12px;">With a navbar menu (open it)</h3>
|
|
797
|
+
<div data-source style="margin-bottom: 24px; padding-bottom: 180px;">
|
|
798
|
+
<nav class="navbar">
|
|
799
|
+
<a href="#" class="navbar-brand">App Name</a>
|
|
800
|
+
<div class="navbar-right">
|
|
801
|
+
<details class="navbar-menu">
|
|
802
|
+
<summary><span class="visually-hidden">Account: </span>Username</summary>
|
|
803
|
+
<div class="navbar-menu-panel">
|
|
804
|
+
<p class="navbar-menu-label" aria-hidden="true">Your teams</p>
|
|
805
|
+
<ul aria-label="Your teams"><li><a href="#" aria-current="true">Team A</a></li><li><a href="#">Team B</a></li></ul>
|
|
806
|
+
<a href="#">Account</a>
|
|
807
|
+
<form><button type="button">Sign out</button></form>
|
|
808
|
+
</div>
|
|
809
|
+
</details>
|
|
810
|
+
</div>
|
|
811
|
+
</nav>
|
|
812
|
+
</div>
|
|
813
|
+
|
|
796
814
|
<h3 style="margin-bottom: 12px;">Light (.navbar-light)</h3>
|
|
797
815
|
<div data-source>
|
|
798
816
|
<nav class="navbar navbar-light" style="border: 2px solid var(--p-border);">
|
package/package.json
CHANGED
package/palace.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! palace-ui v0.
|
|
1
|
+
/*! palace-ui v0.12.0 | MIT License | fonts: SIL OFL 1.1, see fonts/ */
|
|
2
2
|
|
|
3
3
|
/* ══════════════════════════════════════════
|
|
4
4
|
FONTS (self-hosted; no third-party requests)
|
|
@@ -114,6 +114,16 @@
|
|
|
114
114
|
/* The hidden attribute always hides, even on elements palace gives a display (buttons, .btn). */
|
|
115
115
|
[hidden] { display: none !important; }
|
|
116
116
|
|
|
117
|
+
/* Text for screen readers only: off screen, still read. */
|
|
118
|
+
.visually-hidden {
|
|
119
|
+
position: absolute;
|
|
120
|
+
width: 1px;
|
|
121
|
+
height: 1px;
|
|
122
|
+
overflow: hidden;
|
|
123
|
+
clip-path: inset(50%);
|
|
124
|
+
white-space: nowrap;
|
|
125
|
+
}
|
|
126
|
+
|
|
117
127
|
body {
|
|
118
128
|
font-family: var(--p-font);
|
|
119
129
|
color: var(--p-text);
|
|
@@ -720,6 +730,11 @@ textarea:focus {
|
|
|
720
730
|
color: var(--p-accent-2);
|
|
721
731
|
}
|
|
722
732
|
|
|
733
|
+
.navbar-light .navbar-menu > summary {
|
|
734
|
+
color: var(--p-accent-2);
|
|
735
|
+
border-color: var(--p-border);
|
|
736
|
+
}
|
|
737
|
+
|
|
723
738
|
.navbar-light .btn {
|
|
724
739
|
color: var(--p-text-secondary);
|
|
725
740
|
border-color: var(--p-border);
|
|
@@ -731,6 +746,108 @@ textarea:focus {
|
|
|
731
746
|
}
|
|
732
747
|
|
|
733
748
|
|
|
749
|
+
/* Navbar menu: a <details> whose summary looks like .navbar-user and opens a
|
|
750
|
+
panel in the dialog card language. Works without JavaScript; a script may
|
|
751
|
+
add Escape and closing from outside. Links and buttons in the panel are its
|
|
752
|
+
items; a form in it (e.g. Sign out) sits under a thin rule. */
|
|
753
|
+
.navbar-menu { position: relative; }
|
|
754
|
+
.navbar-menu > summary {
|
|
755
|
+
position: relative;
|
|
756
|
+
display: block;
|
|
757
|
+
box-sizing: border-box;
|
|
758
|
+
max-width: min(14rem, 40vw);
|
|
759
|
+
/* The label truncates; the caret after it, in the right padding, never does. */
|
|
760
|
+
padding: 6px 28px 6px 14px;
|
|
761
|
+
overflow: hidden;
|
|
762
|
+
text-overflow: ellipsis;
|
|
763
|
+
white-space: nowrap;
|
|
764
|
+
border: var(--p-border-thin) solid var(--p-border-dark);
|
|
765
|
+
font: 600 11px/1.4 var(--p-font);
|
|
766
|
+
letter-spacing: 1px;
|
|
767
|
+
text-transform: uppercase;
|
|
768
|
+
color: var(--p-accent-3);
|
|
769
|
+
list-style: none;
|
|
770
|
+
cursor: pointer;
|
|
771
|
+
}
|
|
772
|
+
.navbar-menu > summary::-webkit-details-marker { display: none; }
|
|
773
|
+
.navbar-menu > summary::after {
|
|
774
|
+
content: '';
|
|
775
|
+
position: absolute;
|
|
776
|
+
right: 12px;
|
|
777
|
+
top: 50%;
|
|
778
|
+
margin-top: -2px;
|
|
779
|
+
border: 4px solid transparent;
|
|
780
|
+
border-top-color: currentColor;
|
|
781
|
+
border-bottom: 0;
|
|
782
|
+
}
|
|
783
|
+
.navbar-menu > summary:hover,
|
|
784
|
+
.navbar-menu[open] > summary { color: var(--p-accent-1); border-color: var(--p-accent-1); }
|
|
785
|
+
.navbar-menu > summary:focus-visible { outline: 2px solid var(--p-accent-3); outline-offset: 2px; }
|
|
786
|
+
|
|
787
|
+
/* Right-aligned under the summary: a navbar menu sits at the navbar's right. */
|
|
788
|
+
.navbar-menu-panel {
|
|
789
|
+
position: absolute;
|
|
790
|
+
right: 0;
|
|
791
|
+
top: calc(100% + 6px);
|
|
792
|
+
z-index: 100;
|
|
793
|
+
min-width: 14rem;
|
|
794
|
+
max-width: calc(100vw - 2 * var(--p-space-md));
|
|
795
|
+
display: grid;
|
|
796
|
+
padding: var(--p-space-xs) 0;
|
|
797
|
+
background: var(--p-surface);
|
|
798
|
+
color: var(--p-text);
|
|
799
|
+
border: var(--p-border-width) solid var(--p-text);
|
|
800
|
+
box-shadow: var(--p-shadow-md) var(--p-accent-2);
|
|
801
|
+
}
|
|
802
|
+
.navbar-menu-panel ul { list-style: none; margin: 0; padding: 0; display: grid; }
|
|
803
|
+
.navbar-menu-label {
|
|
804
|
+
margin: 0;
|
|
805
|
+
padding: var(--p-space-sm) var(--p-space-md) var(--p-space-xs);
|
|
806
|
+
font-size: 11px;
|
|
807
|
+
font-weight: 600;
|
|
808
|
+
letter-spacing: 1px;
|
|
809
|
+
text-transform: uppercase;
|
|
810
|
+
color: var(--p-text-faint);
|
|
811
|
+
}
|
|
812
|
+
.navbar-menu-panel a,
|
|
813
|
+
.navbar-menu-panel button {
|
|
814
|
+
display: block;
|
|
815
|
+
width: 100%;
|
|
816
|
+
box-sizing: border-box;
|
|
817
|
+
padding: var(--p-space-sm) var(--p-space-md);
|
|
818
|
+
border: 0;
|
|
819
|
+
background: none;
|
|
820
|
+
font: 600 13px/1.4 var(--p-font);
|
|
821
|
+
text-transform: none;
|
|
822
|
+
letter-spacing: normal;
|
|
823
|
+
color: var(--p-text);
|
|
824
|
+
text-align: left;
|
|
825
|
+
text-decoration: none;
|
|
826
|
+
cursor: pointer;
|
|
827
|
+
/* No transition: a closed <details> does not render its content, so a
|
|
828
|
+
transition started there would never finish. */
|
|
829
|
+
transition: none;
|
|
830
|
+
}
|
|
831
|
+
.navbar-menu-panel a:hover,
|
|
832
|
+
.navbar-menu-panel button:hover { background: var(--p-hover-bg); transform: none; box-shadow: none; }
|
|
833
|
+
/* One focus style for links and buttons: the button lift would spill past the panel. */
|
|
834
|
+
.navbar-menu-panel a:focus-visible,
|
|
835
|
+
.navbar-menu-panel button:focus-visible {
|
|
836
|
+
outline: 2px solid var(--p-accent-2);
|
|
837
|
+
outline-offset: -2px;
|
|
838
|
+
color: var(--p-accent-2);
|
|
839
|
+
transform: none;
|
|
840
|
+
box-shadow: none;
|
|
841
|
+
}
|
|
842
|
+
/* The current item: a pink bar, beside any focus outline, never instead of it. */
|
|
843
|
+
.navbar-menu-panel a[aria-current],
|
|
844
|
+
.navbar-menu-panel a[aria-current]:focus-visible { box-shadow: inset 3px 0 0 var(--p-accent-1); }
|
|
845
|
+
.navbar-menu-panel form {
|
|
846
|
+
margin: var(--p-space-xs) 0 0;
|
|
847
|
+
padding-top: var(--p-space-xs);
|
|
848
|
+
border-top: var(--p-border-thin) solid var(--p-border);
|
|
849
|
+
}
|
|
850
|
+
|
|
734
851
|
/* ══════════════════════════════════════════
|
|
735
852
|
TABLES
|
|
736
853
|
══════════════════════════════════════════ */
|