@ulu/frontend 0.6.22 → 0.6.23

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.
@@ -200,9 +200,6 @@ $config: (
200
200
  display: grid;
201
201
  grid-template-columns: 1fr;
202
202
  grid-template-rows: auto 1fr auto;
203
-
204
-
205
-
206
203
  max-width: get("max-width");
207
204
  line-height: get("line-height");
208
205
  margin-top: get("margin-y");
@@ -39,3 +39,49 @@
39
39
  <p>Customize which alerts you receive via email, push notification, or SMS.</p>
40
40
  </div>
41
41
  </div>
42
+
43
+ <!-- @ulu-demo
44
+ title: Sticky Horizontal Tabs
45
+ description: Using the `tabs--sticky` modifier to keep the horizontal tab labels visible at the top of the viewport when scrolling through long panel content.
46
+ -->
47
+ <div class="tabs tabs--sticky">
48
+ <div role="tablist" data-ulu-tablist='{ "equalHeights": false }'>
49
+ <button role="tab" id="sh-tab-1" aria-selected="true" aria-controls="sh-panel-1">Section 1</button>
50
+ <button role="tab" id="sh-tab-2" aria-selected="false" aria-controls="sh-panel-2">Section 2</button>
51
+ <button role="tab" id="sh-tab-3" aria-selected="false" aria-controls="sh-panel-3">Section 3</button>
52
+ </div>
53
+ <div role="tabpanel" id="sh-panel-1" aria-labelledby="sh-tab-1">
54
+ <p>Scroll down to see the sticky behavior.</p>
55
+ <div style="height: 400px; background-image: repeating-linear-gradient(45deg, #ccc 25%, transparent 25%, transparent 75%, #ccc 75%, #ccc), repeating-linear-gradient(45deg, #ccc 25%, transparent 25%, transparent 75%, #ccc 75%, #ccc); background-position: 0 0, 10px 10px; background-size: 20px 20px; opacity: 0.1; margin-top: 1rem;"></div>
56
+ </div>
57
+ <div role="tabpanel" id="sh-panel-2" aria-labelledby="sh-tab-2" hidden>
58
+ <p>This is section 2 content.</p>
59
+ <div style="height: 400px; background-image: repeating-linear-gradient(45deg, #ccc 25%, transparent 25%, transparent 75%, #ccc 75%, #ccc), repeating-linear-gradient(45deg, #ccc 25%, transparent 25%, transparent 75%, #ccc 75%, #ccc); background-position: 0 0, 10px 10px; background-size: 20px 20px; opacity: 0.1; margin-top: 1rem;"></div>
60
+ </div>
61
+ <div role="tabpanel" id="sh-panel-3" aria-labelledby="sh-tab-3" hidden>
62
+ <p>This is section 3 content.</p>
63
+ </div>
64
+ </div>
65
+
66
+ <!-- @ulu-demo
67
+ title: Sticky Vertical Tabs
68
+ description: Using both `tabs--vertical` and `tabs--sticky` modifiers. On large screens, the tab labels stick within their grid column as you scroll the adjacent panel. On smaller screens, they behave like sticky horizontal tabs.
69
+ -->
70
+ <div class="tabs tabs--vertical tabs--sticky">
71
+ <div role="tablist" data-ulu-tablist='{ "vertical": true, "equalHeights": false }'>
72
+ <button role="tab" id="sv-tab-1" aria-selected="true" aria-controls="sv-panel-1">Chapter 1</button>
73
+ <button role="tab" id="sv-tab-2" aria-selected="false" aria-controls="sv-panel-2">Chapter 2</button>
74
+ <button role="tab" id="sv-tab-3" aria-selected="false" aria-controls="sv-panel-3">Chapter 3</button>
75
+ </div>
76
+ <div role="tabpanel" id="sv-panel-1" aria-labelledby="sv-tab-1">
77
+ <p>Scroll down to see the vertical tablist stick to the top.</p>
78
+ <div style="height: 400px; background-image: repeating-linear-gradient(45deg, #ccc 25%, transparent 25%, transparent 75%, #ccc 75%, #ccc), repeating-linear-gradient(45deg, #ccc 25%, transparent 25%, transparent 75%, #ccc 75%, #ccc); background-position: 0 0, 10px 10px; background-size: 20px 20px; opacity: 0.1; margin-top: 1rem;"></div>
79
+ </div>
80
+ <div role="tabpanel" id="sv-panel-2" aria-labelledby="sv-tab-2" hidden>
81
+ <p>This is chapter 2 content.</p>
82
+ <div style="height: 400px; background-image: repeating-linear-gradient(45deg, #ccc 25%, transparent 25%, transparent 75%, #ccc 75%, #ccc), repeating-linear-gradient(45deg, #ccc 25%, transparent 25%, transparent 75%, #ccc 75%, #ccc); background-position: 0 0, 10px 10px; background-size: 20px 20px; opacity: 0.1; margin-top: 1rem;"></div>
83
+ </div>
84
+ <div role="tabpanel" id="sv-panel-3" aria-labelledby="sv-tab-3" hidden>
85
+ <p>This is chapter 3 content.</p>
86
+ </div>
87
+ </div>
@@ -7,6 +7,7 @@
7
7
  @use "sass:meta";
8
8
 
9
9
  @use "../utils";
10
+ @use "../cssvar";
10
11
  @use "../color";
11
12
  @use "../selector";
12
13
  @use "../breakpoint";
@@ -61,6 +62,10 @@ $-fallbacks: (
61
62
  /// @prop {Boolean} horizontal-tab-wrap [false] Set to true to allow line wrapping when the tabs are in horizontal orientation, vertical is always allowed to wrap
62
63
  /// @prop {Color} full-width-tablist-background-color [null] Optional background color for full-width tabs tablist
63
64
  /// @prop {Color} full-width-tabpanel-background-color [transparent] Optional background color for full-width tabs tabpanel
65
+ /// @prop {Dimension} sticky-top [cssvar.use-ulu("sticky-offset-top")] The top offset when the sticky modifier is applied
66
+ /// @prop {Dimension} sticky-vertical-top [cssvar.add(cssvar.use-ulu("sticky-offset-top"), 1em)] The top offset when the sticky modifier is applied in vertical layout
67
+ /// @prop {Color} sticky-background-color [background] The background color for the tablist when sticky
68
+ /// @prop {Number} sticky-z-index [2] The z-index for the tablist when sticky
64
69
 
65
70
  $config: (
66
71
  "margin" : (2rem 0),
@@ -93,6 +98,10 @@ $config: (
93
98
  "horizontal-tab-wrap" : false,
94
99
  "full-width-tablist-background-color" : null,
95
100
  "full-width-tabpanel-background-color" : transparent,
101
+ "sticky-top" : cssvar.use-ulu("sticky-offset-top"),
102
+ "sticky-vertical-top" : cssvar.add(cssvar.use-ulu("sticky-offset-top"), 1em),
103
+ "sticky-background-color" : "background",
104
+ "sticky-z-index" : 2,
96
105
  ) !default;
97
106
 
98
107
  /// Change modules $config
@@ -241,6 +250,22 @@ $config: (
241
250
  }
242
251
  }
243
252
  }
253
+
254
+
255
+ #{ $prefix }--sticky {
256
+ [role="tablist"] {
257
+ position: sticky;
258
+ top: get("sticky-top");
259
+ z-index: get("sticky-z-index");
260
+ background-color: color.get(get("sticky-background-color"));
261
+ }
262
+ }
263
+ #{ $prefix }--sticky#{ $prefix }--vertical {
264
+ [role="tablist"] {
265
+ top: get("sticky-vertical-top");
266
+ align-self: start;
267
+ }
268
+ }
244
269
 
245
270
  #{ $prefix }--transparent {
246
271
  [role="tablist"] {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ulu/frontend",
3
- "version": "0.6.22",
3
+ "version": "0.6.23",
4
4
  "description": "A framework-agnostic frontend toolkit providing a modular, tree-shakable library of accessible components and utilities. Designed for seamless integration, it features a highly configurable SCSS system for any environment and vanilla JavaScript modules optimized for traditional websites and content management systems.",
5
5
  "type": "module",
6
6
  "files": [