@tangible/ui 0.2.17 → 0.2.18

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.
@@ -2,6 +2,7 @@
2
2
 
3
3
  /* @tui-tokens
4
4
  --tui-sidebar-width
5
+ --tui-sidebar-collapsed-width
5
6
  --tui-sidebar-bg
6
7
  --tui-sidebar-border
7
8
  --tui-sidebar-divider
@@ -16,6 +17,7 @@
16
17
  //
17
18
  // Component API tokens (never defined here, only read via fallback):
18
19
  // --tui-sidebar-width Fixed sidebar width
20
+ // --tui-sidebar-collapsed-width Width of the collapsed rail
19
21
  // --tui-sidebar-bg Background color
20
22
  // --tui-sidebar-border Edge border color (docked left/right edge)
21
23
  // --tui-sidebar-divider Header/footer divider color
@@ -111,6 +113,87 @@
111
113
  padding: var(--_padding);
112
114
  }
113
115
 
116
+ // ---------------------------------------------------------------------------
117
+ // Collapsed rail
118
+ // ---------------------------------------------------------------------------
119
+ //
120
+ // `collapsible` narrows the sidebar to a rail wide enough for one control.
121
+ // Header, Nav and Footer go; anything else the consumer put directly in
122
+ // the sidebar — the toggle, an icon rail — stays. `display: none` rather
123
+ // than a zero width so the hidden regions leave the tab order and the
124
+ // accessibility tree with it: a rail you can still Tab into is a trap.
125
+ //
126
+ // Written as a top-level rule spelling out the hierarchy. Nesting this as
127
+ // `[data-collapsed="true"] &` would splice `.tui-interface` after the
128
+ // attribute and match nothing — the same trap that killed the drawer
129
+ // animations before 0.2.8.
130
+
131
+ :where(.#{sys.$prefix}interface) .#{sys.$prefix}sidebar[data-collapsed] {
132
+ transition: width var(--#{sys.$prefix}motion-duration) var(--#{sys.$prefix}motion-timing);
133
+ }
134
+
135
+ :where(.#{sys.$prefix}interface) .#{sys.$prefix}sidebar[data-collapsed="true"] {
136
+ --_width: var(--#{sys.$prefix}sidebar-collapsed-width, 4.5rem);
137
+
138
+ align-items: center;
139
+ padding-block: var(--_padding);
140
+ }
141
+
142
+ :where(.#{sys.$prefix}interface)
143
+ .#{sys.$prefix}sidebar[data-collapsed="true"]
144
+ > :is(
145
+ .#{sys.$prefix}sidebar__header,
146
+ .#{sys.$prefix}sidebar__nav,
147
+ .#{sys.$prefix}sidebar__footer
148
+ ) {
149
+ display: none;
150
+ }
151
+
152
+ @media (prefers-reduced-motion: reduce) {
153
+ :where(.#{sys.$prefix}interface) .#{sys.$prefix}sidebar[data-collapsed] {
154
+ transition: none;
155
+ }
156
+ }
157
+
158
+ // ---------------------------------------------------------------------------
159
+ // Toggle
160
+ // ---------------------------------------------------------------------------
161
+ //
162
+ // Sits at the sidebar's content-facing edge while expanded — the edge the
163
+ // collapse travels towards — and centres itself once there is only a rail
164
+ // left to sit in.
165
+ //
166
+ // Full specificity, not `:where()`. The toggle IS an IconButton, whose own
167
+ // base rule is `.tui-interface .tui-icon-button` (0,2,0) and resets
168
+ // `margin: 0`. A (0,1,0) host rule loses to it outright, so the margin
169
+ // below would be dead CSS and the toggle would sit flush in the corner.
170
+ // At (0,2,0) the two tie and Sidebar wins on bundle order, which is why
171
+ // the house convention puts host rules at full specificity.
172
+
173
+ .#{sys.$prefix}interface .#{sys.$prefix}sidebar__toggle {
174
+ flex-shrink: 0;
175
+ margin: var(--_padding);
176
+ margin-block-end: 0;
177
+ align-self: flex-end;
178
+ }
179
+
180
+ .#{sys.$prefix}interface
181
+ .#{sys.$prefix}sidebar[data-position="right"]
182
+ > .#{sys.$prefix}sidebar__toggle {
183
+ align-self: flex-start;
184
+ }
185
+
186
+ // The collapsed root supplies its own `padding-block`, so the toggle drops
187
+ // its block-start margin rather than stacking on top of it — otherwise the
188
+ // control visibly steps down the rail as the sidebar collapses.
189
+ .#{sys.$prefix}interface
190
+ .#{sys.$prefix}sidebar[data-collapsed="true"]
191
+ > .#{sys.$prefix}sidebar__toggle {
192
+ align-self: center;
193
+ margin-inline: 0;
194
+ margin-block-start: 0;
195
+ }
196
+
114
197
  // ---------------------------------------------------------------------------
115
198
  // Drawer Mode
116
199
  // ---------------------------------------------------------------------------
package/tui-manifest.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
- "version": "0.2.17",
3
- "generated": "2026-08-28T00:48:22.210Z",
2
+ "version": "0.2.18",
3
+ "generated": "2026-08-30T20:29:02.985Z",
4
4
  "components": {
5
5
  "Accordion": {
6
6
  "props": {
@@ -3138,6 +3138,23 @@
3138
3138
  "defaultValue": "false",
3139
3139
  "description": "Enable drawer mode (mobile overlay).\nEnable drawer mode (mobile overlay).\nWhen true, sidebar renders with backdrop, focus trap, and dialog semantics."
3140
3140
  },
3141
+ "collapsible": {
3142
+ "type": "boolean",
3143
+ "required": false,
3144
+ "defaultValue": "false",
3145
+ "description": "Opt into the collapsed rail: the sidebar can shrink to\n`--tui-sidebar-collapsed-width`, hiding Header, Nav and Footer while\nleaving any other child — a `Sidebar.Toggle`, an icon rail — visible.\n\nDeliberately absent from drawer mode: a drawer is already a\nshow/hide overlay, and a rail inside one has nothing to sit beside."
3146
+ },
3147
+ "collapsed": {
3148
+ "type": "boolean",
3149
+ "required": false,
3150
+ "description": "Collapsed state (controlled). Pair with `onCollapsedChange`.\nLeave undefined to let the sidebar own the state."
3151
+ },
3152
+ "defaultCollapsed": {
3153
+ "type": "boolean",
3154
+ "required": false,
3155
+ "defaultValue": "false",
3156
+ "description": "Initial collapsed state when uncontrolled."
3157
+ },
3141
3158
  "open": {
3142
3159
  "type": "boolean",
3143
3160
  "required": false,
@@ -3151,6 +3168,7 @@
3151
3168
  },
3152
3169
  "cssTokens": [
3153
3170
  "--tui-sidebar-width",
3171
+ "--tui-sidebar-collapsed-width",
3154
3172
  "--tui-sidebar-bg",
3155
3173
  "--tui-sidebar-border",
3156
3174
  "--tui-sidebar-divider",