@smwb/ui-styles 1.3.0 → 1.4.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.
@@ -0,0 +1,2 @@
1
+ @import (reference) "../../_prelude.less";
2
+ @import "./floatingWindow.less";
@@ -0,0 +1,200 @@
1
+ .smwb-floating-window {
2
+ background-color: var(--smui-surfaceBackground);
3
+ color: var(--smui-onSurfaceColor);
4
+ position: fixed;
5
+ z-index: @floatingWindowZ;
6
+ display: flex;
7
+ flex-direction: column;
8
+ // The geometry (left/top/width/height) is written inline in px by the component, and
9
+ // padding must be included in it or every resize frame would grow the window by the
10
+ // padding and drift away from the cursor. Same reasoning as .smwb-sheet.
11
+ box-sizing: border-box;
12
+ overflow: hidden;
13
+ border-radius: @floatingWindowBorderRadius;
14
+ box-shadow: rgb(0 0 0 / 14%) 0px 8px 10px -5px, rgb(0 0 0 / 14%) 0px 1px 14px 1px, rgb(0 0 0 / 14%) 0px 6px 22px 4px;
15
+ opacity: 0;
16
+ // Deliberately NOT `transition: all` — the window is dragged and resized by writing
17
+ // left/top/width/height every pointer frame, and animating those would lag the cursor
18
+ // (which is why Sheet has to inject `transition: none` mid-drag). Only the mount fade
19
+ // is animated, so drag frames never fight a transition.
20
+ transition: opacity 0.12s ease-in-out;
21
+
22
+ &.smwb-floating-window_entered {
23
+ opacity: 1;
24
+ }
25
+
26
+ &__header {
27
+ display: flex;
28
+ align-items: center;
29
+ gap: @floatingWindowHeaderGap;
30
+ flex-shrink: 0;
31
+ height: @floatingWindowHeaderHeight;
32
+ padding: 0 @floatingWindowPadding;
33
+ border-bottom: 1px solid var(--smui-dividerColor);
34
+ // A pointer-drag move must own the touch gesture, or dragging the title bar scrolls
35
+ // the page on touch devices instead.
36
+ touch-action: none;
37
+ user-select: none;
38
+ cursor: move;
39
+
40
+ &:focus-visible {
41
+ outline: 2px solid var(--smui-primaryColor);
42
+ outline-offset: -2px;
43
+ }
44
+ }
45
+
46
+ // The keyboard move affordance. Pointer drag is handled by the whole header; this is
47
+ // the focusable element so the header itself need not be a role="button" wrapping the
48
+ // header's own buttons.
49
+ &__grip {
50
+ display: inline-flex;
51
+ align-items: center;
52
+ color: var(--smui-onSurfaceVariant);
53
+ flex-shrink: 0;
54
+ cursor: move;
55
+
56
+ &:focus-visible {
57
+ outline: 2px solid var(--smui-primaryColor);
58
+ outline-offset: 2px;
59
+ border-radius: @smui-radius-xs;
60
+ }
61
+ }
62
+
63
+ &__title {
64
+ font-family: var(--smui-fontFamily);
65
+ font-size: @smui-font-subtitle2-size;
66
+ font-weight: @smui-font-subtitle2-weight;
67
+ line-height: @smui-font-subtitle2-lh;
68
+ color: var(--smui-onSurfaceColor);
69
+ flex: 1 1 auto;
70
+ min-width: 0;
71
+ overflow: hidden;
72
+ text-overflow: ellipsis;
73
+ white-space: nowrap;
74
+ }
75
+
76
+ &__actions {
77
+ display: flex;
78
+ align-items: center;
79
+ gap: @smui-space-xxs;
80
+ flex-shrink: 0;
81
+ margin-left: auto;
82
+ cursor: default;
83
+ }
84
+
85
+ &__action {
86
+ display: inline-flex;
87
+ align-items: center;
88
+ justify-content: center;
89
+ padding: 2px;
90
+ border: none;
91
+ border-radius: @smui-radius-sm;
92
+ background: transparent;
93
+ color: var(--smui-onSurfaceVariant);
94
+ cursor: pointer;
95
+
96
+ &:hover {
97
+ background-color: var(--smui-onSurfaceHover);
98
+ color: var(--smui-onSurfaceColor);
99
+ }
100
+
101
+ &:focus-visible {
102
+ outline: 2px solid var(--smui-primaryColor);
103
+ outline-offset: -2px;
104
+ }
105
+ }
106
+
107
+ &__body {
108
+ flex: 1 1 auto;
109
+ // Without an explicit zero minimum a flex item refuses to shrink below its content,
110
+ // so a scrolling child would push the window past its dragged height instead of
111
+ // scrolling inside it.
112
+ min-height: 0;
113
+ display: flex;
114
+ flex-direction: column;
115
+ overflow: auto;
116
+ padding: @floatingWindowPadding;
117
+ }
118
+
119
+ // Shaded to the title bar: the component drops the inline height, so the flex column
120
+ // collapses to the header's own height.
121
+ &.smwb-collapsed {
122
+ height: auto;
123
+ }
124
+
125
+ &__resize {
126
+ position: absolute;
127
+ touch-action: none;
128
+ user-select: none;
129
+ z-index: 1;
130
+
131
+ &:focus-visible {
132
+ outline: 2px solid var(--smui-primaryColor);
133
+ outline-offset: -2px;
134
+ }
135
+
136
+ &_n,
137
+ &_s {
138
+ left: @floatingWindowResizeEdge;
139
+ right: @floatingWindowResizeEdge;
140
+ height: @floatingWindowResizeEdge;
141
+ cursor: ns-resize;
142
+ }
143
+
144
+ &_e,
145
+ &_w {
146
+ top: @floatingWindowResizeEdge;
147
+ bottom: @floatingWindowResizeEdge;
148
+ width: @floatingWindowResizeEdge;
149
+ cursor: ew-resize;
150
+ }
151
+
152
+ &_n {
153
+ top: 0;
154
+ }
155
+
156
+ &_s {
157
+ bottom: 0;
158
+ }
159
+
160
+ &_e {
161
+ right: 0;
162
+ }
163
+
164
+ &_w {
165
+ left: 0;
166
+ }
167
+
168
+ &_ne,
169
+ &_nw,
170
+ &_se,
171
+ &_sw {
172
+ width: (@floatingWindowResizeEdge * 2);
173
+ height: (@floatingWindowResizeEdge * 2);
174
+ }
175
+
176
+ &_ne {
177
+ top: 0;
178
+ right: 0;
179
+ cursor: nesw-resize;
180
+ }
181
+
182
+ &_nw {
183
+ top: 0;
184
+ left: 0;
185
+ cursor: nwse-resize;
186
+ }
187
+
188
+ &_se {
189
+ bottom: 0;
190
+ right: 0;
191
+ cursor: nwse-resize;
192
+ }
193
+
194
+ &_sw {
195
+ bottom: 0;
196
+ left: 0;
197
+ cursor: nesw-resize;
198
+ }
199
+ }
200
+ }
@@ -35,13 +35,24 @@
35
35
  display: inline-flex;
36
36
  align-items: center;
37
37
  gap: @treeViewItemGap;
38
+ // While min-width is auto a flex item never shrinks below its content, so
39
+ // a long label claims max-content and spills out of the node instead of
40
+ // wrapping. The icon keeps its size regardless.
41
+ min-width: 0;
42
+ overflow-wrap: break-word;
43
+
44
+ > .smwb-icon__wrapper {
45
+ flex: none;
46
+ }
38
47
  }
39
48
 
40
49
  &__content {
41
50
  display: flex;
42
51
  align-items: center;
43
52
  gap: @treeViewItemGap;
44
- height: 40px;
53
+ // min-height, not height: a fixed row height let a wrapped two-line label
54
+ // overflow the node and overlap the next one.
55
+ min-height: 40px;
45
56
  cursor: pointer;
46
57
  user-select: none;
47
58
  }
@@ -26,6 +26,7 @@
26
26
  @import "./components/grid/grid.less";
27
27
  @import "./components/tooltip/tooltip.less";
28
28
  @import "./components/sheet/sheet.less";
29
+ @import "./components/floatingWindow/floatingWindow.less";
29
30
  @import "./components/badge/badge.less";
30
31
  @import "./components/card/card.less";
31
32
  @import "./components/carousel/carousel.less";
@@ -188,6 +188,11 @@
188
188
  @sheetContentPaddingLeft: 10px; // off-grid
189
189
  @sheetHandleSpace: @smui-space-xl; // drag-to-resize grab-handle hit area
190
190
 
191
+ @floatingWindowPadding: @smui-space-md;
192
+ @floatingWindowHeaderHeight: 36px; // off-grid; the collapsed (title-bar only) height
193
+ @floatingWindowHeaderGap: @smui-space-xs;
194
+ @floatingWindowResizeEdge: 6px; // off-grid; pointer hit area of the edge/corner grips
195
+
191
196
  @sidebarPadding: @smui-space-lg;
192
197
  @sidebarOpenGap: @smui-space-xl;
193
198
  @sidebarNavGap: 5px; // off-grid
@@ -397,6 +402,18 @@
397
402
  --------------------*/
398
403
  @sheetBorderRadius: @smui-radius-xxl;
399
404
 
405
+ /*-------------------
406
+ Floating window
407
+ --------------------*/
408
+ @floatingWindowBorderRadius: @smui-radius-lg;
409
+ // off-grid. Above the sheet panel/overlay (100) so a window can float over a docked
410
+ // sheet, but below every portaled surface a window's own content may open — consumer
411
+ // popups (thumbCard's hover preview at 200 and card menu at 300), snackbar (777), modal
412
+ // (1001) and menu/dataPicker (1300). A ConfirmDialog, dropdown or hover preview raised
413
+ // from inside a window must paint above it, so the window sits at the bottom of that
414
+ // stack. Hosts add their stacking index on top, leaving headroom before 200.
415
+ @floatingWindowZ: 150;
416
+
400
417
  /*-------------------
401
418
  Tooltip
402
419
  --------------------*/
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smwb/ui-styles",
3
- "version": "1.3.0",
3
+ "version": "1.4.1",
4
4
  "description": "Framework-agnostic LESS design tokens and component styles (smwb-*) shared by the @smwb UI libraries. Prebuilt aggregate CSS lives in @smwb/ui-css.",
5
5
  "license": "MIT",
6
6
  "sideEffects": [