@salmonui/overlays 0.0.0-stage → 0.3.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/LICENSE +21 -0
- package/README.md +44 -2
- package/dist/dialog/AlertDialog.d.ts +70 -0
- package/dist/dialog/AlertDialog.d.ts.map +1 -0
- package/dist/dialog/AlertDialog.js +100 -0
- package/dist/dialog/AlertDialog.js.map +1 -0
- package/dist/dialog/Dialog.d.ts +15 -0
- package/dist/dialog/Dialog.d.ts.map +1 -0
- package/dist/dialog/Dialog.js +17 -0
- package/dist/dialog/Dialog.js.map +1 -0
- package/dist/dialog.css +656 -0
- package/dist/dialog.d.ts +6 -0
- package/dist/dialog.d.ts.map +1 -0
- package/dist/dialog.js +13 -0
- package/dist/dialog.js.map +1 -0
- package/dist/drawer/Drawer.d.ts +23 -0
- package/dist/drawer/Drawer.d.ts.map +1 -0
- package/dist/drawer/Drawer.js +11 -0
- package/dist/drawer/Drawer.js.map +1 -0
- package/dist/drawer.css +247 -0
- package/dist/drawer.d.ts +5 -0
- package/dist/drawer.d.ts.map +1 -0
- package/dist/drawer.js +11 -0
- package/dist/drawer.js.map +1 -0
- package/dist/internal/placement.d.ts +18 -0
- package/dist/internal/placement.d.ts.map +1 -0
- package/dist/internal/placement.js +19 -0
- package/dist/internal/placement.js.map +1 -0
- package/dist/popover/Popover.d.ts +99 -0
- package/dist/popover/Popover.d.ts.map +1 -0
- package/dist/popover/Popover.js +140 -0
- package/dist/popover/Popover.js.map +1 -0
- package/dist/popover.css +116 -0
- package/dist/popover.d.ts +3 -0
- package/dist/popover.d.ts.map +1 -0
- package/dist/popover.js +9 -0
- package/dist/popover.js.map +1 -0
- package/dist/styles.css +870 -0
- package/dist/tooltip/Tooltip.d.ts +87 -0
- package/dist/tooltip/Tooltip.d.ts.map +1 -0
- package/dist/tooltip/Tooltip.js +183 -0
- package/dist/tooltip/Tooltip.js.map +1 -0
- package/dist/tooltip.css +57 -0
- package/dist/tooltip.d.ts +3 -0
- package/dist/tooltip.d.ts.map +1 -0
- package/dist/tooltip.js +8 -0
- package/dist/tooltip.js.map +1 -0
- package/package.json +57 -4
package/dist/dialog.css
ADDED
|
@@ -0,0 +1,656 @@
|
|
|
1
|
+
@layer salmon.a,salmon.b,salmon.c;
|
|
2
|
+
@layer salmon.a {
|
|
3
|
+
/* @salmonui/buttons/button/styles.css, first part (button-core): Button,
|
|
4
|
+
ToggleButton, ButtonGroup, ToggleButtonGroup without the chip, progress
|
|
5
|
+
and floating extras of styles/button.css. Colors come from --salmon-*
|
|
6
|
+
theme variables only; tone and variant are orthogonal (data-tone x
|
|
7
|
+
data-variant); sizes are three fixed metric sets. Logical properties only. */
|
|
8
|
+
|
|
9
|
+
.salmon-button {
|
|
10
|
+
--salmon-button-c: var(--salmon-surface-sunken);
|
|
11
|
+
--salmon-button-c-hover: var(--salmon-surface-hover);
|
|
12
|
+
--salmon-button-c-active: var(--salmon-border-subtle);
|
|
13
|
+
--salmon-button-c-on: var(--salmon-text-primary);
|
|
14
|
+
--salmon-button-c-edge: var(--salmon-border-default);
|
|
15
|
+
--salmon-button-c-subtle: var(--salmon-surface-hover);
|
|
16
|
+
--salmon-button-c-subtle-hover: var(--salmon-surface-sunken);
|
|
17
|
+
--salmon-button-c-text: var(--salmon-text-primary);
|
|
18
|
+
--salmon-button-c-border: var(--salmon-border-default);
|
|
19
|
+
--salmon-button-c-selected: var(--salmon-surface-selected);
|
|
20
|
+
--salmon-button-c-selected-edge: var(--salmon-border-selected);
|
|
21
|
+
--salmon-button-h: var(--salmon-control-height-md, 32px);
|
|
22
|
+
--salmon-button-pad: var(--salmon-control-padding-md, 12px);
|
|
23
|
+
--salmon-button-bg: var(--salmon-button-c);
|
|
24
|
+
--salmon-button-fg: var(--salmon-button-c-on);
|
|
25
|
+
--salmon-button-bd: var(--salmon-button-c-edge);
|
|
26
|
+
position: relative;
|
|
27
|
+
isolation: isolate;
|
|
28
|
+
display: inline-flex;
|
|
29
|
+
align-items: center;
|
|
30
|
+
justify-content: center;
|
|
31
|
+
gap: 6px;
|
|
32
|
+
box-sizing: border-box;
|
|
33
|
+
min-block-size: var(--salmon-button-h);
|
|
34
|
+
margin: 0;
|
|
35
|
+
padding-block: 0;
|
|
36
|
+
padding-inline: var(--salmon-button-pad);
|
|
37
|
+
overflow: hidden;
|
|
38
|
+
border: 1px solid var(--salmon-button-bd);
|
|
39
|
+
border-radius: var(--salmon-radius-md);
|
|
40
|
+
background: var(--salmon-button-bg);
|
|
41
|
+
color: var(--salmon-button-fg);
|
|
42
|
+
font-family: var(--salmon-font-sans);
|
|
43
|
+
font-size: var(--salmon-font-size-md);
|
|
44
|
+
font-weight: var(--salmon-font-weight-medium);
|
|
45
|
+
line-height: var(--salmon-line-height-tight);
|
|
46
|
+
text-decoration: none;
|
|
47
|
+
white-space: nowrap;
|
|
48
|
+
vertical-align: middle;
|
|
49
|
+
cursor: pointer;
|
|
50
|
+
user-select: none;
|
|
51
|
+
-webkit-tap-highlight-color: transparent;
|
|
52
|
+
transition: background-color var(--salmon-motion-duration-fast) var(--salmon-motion-easing), border-color var(--salmon-motion-duration-fast) var(--salmon-motion-easing), color var(--salmon-motion-duration-fast) var(--salmon-motion-easing);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/* The class's display would override the native hidden attribute. */
|
|
56
|
+
.salmon-button[hidden] {
|
|
57
|
+
display: none;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.salmon-button[data-tone='primary'],
|
|
61
|
+
.salmon-button[data-tone='success'],
|
|
62
|
+
.salmon-button[data-tone='warning'],
|
|
63
|
+
.salmon-button[data-tone='danger'],
|
|
64
|
+
.salmon-button[data-tone='info'] {
|
|
65
|
+
--salmon-button-c-edge: var(--salmon-button-c);
|
|
66
|
+
--salmon-button-c-selected: var(--salmon-button-c-subtle);
|
|
67
|
+
--salmon-button-c-selected-edge: var(--salmon-button-c);
|
|
68
|
+
}
|
|
69
|
+
.salmon-button[data-tone='primary'] {
|
|
70
|
+
--salmon-button-c: var(--salmon-color-primary);
|
|
71
|
+
--salmon-button-c-hover: var(--salmon-color-primary-hover);
|
|
72
|
+
--salmon-button-c-active: var(--salmon-color-primary-active);
|
|
73
|
+
--salmon-button-c-on: var(--salmon-color-primary-on);
|
|
74
|
+
--salmon-button-c-subtle: var(--salmon-color-primary-subtle);
|
|
75
|
+
--salmon-button-c-subtle-hover: var(--salmon-color-primary-subtle-hover);
|
|
76
|
+
--salmon-button-c-text: var(--salmon-color-primary-text);
|
|
77
|
+
--salmon-button-c-border: var(--salmon-color-primary-border);
|
|
78
|
+
}
|
|
79
|
+
.salmon-button[data-tone='success'] {
|
|
80
|
+
--salmon-button-c: var(--salmon-color-success);
|
|
81
|
+
--salmon-button-c-hover: var(--salmon-color-success-hover);
|
|
82
|
+
--salmon-button-c-active: var(--salmon-color-success-active);
|
|
83
|
+
--salmon-button-c-on: var(--salmon-color-success-on);
|
|
84
|
+
--salmon-button-c-subtle: var(--salmon-color-success-subtle);
|
|
85
|
+
--salmon-button-c-subtle-hover: var(--salmon-color-success-subtle-hover);
|
|
86
|
+
--salmon-button-c-text: var(--salmon-color-success-text);
|
|
87
|
+
--salmon-button-c-border: var(--salmon-color-success-border);
|
|
88
|
+
}
|
|
89
|
+
.salmon-button[data-tone='warning'] {
|
|
90
|
+
--salmon-button-c: var(--salmon-color-warning);
|
|
91
|
+
--salmon-button-c-hover: var(--salmon-color-warning-hover);
|
|
92
|
+
--salmon-button-c-active: var(--salmon-color-warning-active);
|
|
93
|
+
--salmon-button-c-on: var(--salmon-color-warning-on);
|
|
94
|
+
--salmon-button-c-subtle: var(--salmon-color-warning-subtle);
|
|
95
|
+
--salmon-button-c-subtle-hover: var(--salmon-color-warning-subtle-hover);
|
|
96
|
+
--salmon-button-c-text: var(--salmon-color-warning-text);
|
|
97
|
+
--salmon-button-c-border: var(--salmon-color-warning-border);
|
|
98
|
+
}
|
|
99
|
+
.salmon-button[data-tone='danger'] {
|
|
100
|
+
--salmon-button-c: var(--salmon-color-danger);
|
|
101
|
+
--salmon-button-c-hover: var(--salmon-color-danger-hover);
|
|
102
|
+
--salmon-button-c-active: var(--salmon-color-danger-active);
|
|
103
|
+
--salmon-button-c-on: var(--salmon-color-danger-on);
|
|
104
|
+
--salmon-button-c-subtle: var(--salmon-color-danger-subtle);
|
|
105
|
+
--salmon-button-c-subtle-hover: var(--salmon-color-danger-subtle-hover);
|
|
106
|
+
--salmon-button-c-text: var(--salmon-color-danger-text);
|
|
107
|
+
--salmon-button-c-border: var(--salmon-color-danger-border);
|
|
108
|
+
}
|
|
109
|
+
.salmon-button[data-tone='info'] {
|
|
110
|
+
--salmon-button-c: var(--salmon-color-info);
|
|
111
|
+
--salmon-button-c-hover: var(--salmon-color-info-hover);
|
|
112
|
+
--salmon-button-c-active: var(--salmon-color-info-active);
|
|
113
|
+
--salmon-button-c-on: var(--salmon-color-info-on);
|
|
114
|
+
--salmon-button-c-subtle: var(--salmon-color-info-subtle);
|
|
115
|
+
--salmon-button-c-subtle-hover: var(--salmon-color-info-subtle-hover);
|
|
116
|
+
--salmon-button-c-text: var(--salmon-color-info-text);
|
|
117
|
+
--salmon-button-c-border: var(--salmon-color-info-border);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/* Sizes: the density control metrics. */
|
|
121
|
+
.salmon-button[data-size='sm'] {
|
|
122
|
+
--salmon-button-h: var(--salmon-control-height-sm, 24px);
|
|
123
|
+
--salmon-button-pad: var(--salmon-control-padding-sm, 8px);
|
|
124
|
+
gap: 4px;
|
|
125
|
+
font-size: var(--salmon-font-size-sm);
|
|
126
|
+
}
|
|
127
|
+
.salmon-button[data-size='lg'] {
|
|
128
|
+
--salmon-button-h: var(--salmon-control-height-lg, 40px);
|
|
129
|
+
--salmon-button-pad: var(--salmon-control-padding-lg, 16px);
|
|
130
|
+
gap: 8px;
|
|
131
|
+
font-size: var(--salmon-font-size-lg);
|
|
132
|
+
}
|
|
133
|
+
.salmon-button[data-icon-only] {
|
|
134
|
+
min-inline-size: var(--salmon-button-h);
|
|
135
|
+
padding-inline: 0;
|
|
136
|
+
}
|
|
137
|
+
/* A glyph in the label is a flex item, not an inline box on the text baseline,
|
|
138
|
+
so it sits on the centre axis. */
|
|
139
|
+
.salmon-button[data-icon-only] > .salmon-button__label {
|
|
140
|
+
display: flex;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/* Variants. */
|
|
144
|
+
.salmon-button[data-variant='solid']:hover {
|
|
145
|
+
--salmon-button-bg: var(--salmon-button-c-hover);
|
|
146
|
+
}
|
|
147
|
+
.salmon-button[data-variant='solid']:active {
|
|
148
|
+
--salmon-button-bg: var(--salmon-button-c-active);
|
|
149
|
+
}
|
|
150
|
+
/* A pressed state persists, so it keeps the guaranteed pairs:
|
|
151
|
+
the fill with its on-color, marked by an inset ring
|
|
152
|
+
of that on-color; outline and ghost use the subtle surface with tone text. */
|
|
153
|
+
.salmon-button[data-variant='solid'][data-pressed] {
|
|
154
|
+
--salmon-button-bg: var(--salmon-button-c);
|
|
155
|
+
box-shadow: inset 0 0 0 2px var(--salmon-button-c-on);
|
|
156
|
+
}
|
|
157
|
+
.salmon-button[data-variant='outline'],
|
|
158
|
+
.salmon-button[data-variant='ghost'],
|
|
159
|
+
.salmon-button[data-variant='link'] {
|
|
160
|
+
--salmon-button-bg: transparent;
|
|
161
|
+
--salmon-button-fg: var(--salmon-button-c-text);
|
|
162
|
+
--salmon-button-bd: transparent;
|
|
163
|
+
}
|
|
164
|
+
.salmon-button[data-variant='outline'] {
|
|
165
|
+
--salmon-button-bd: var(--salmon-button-c-border);
|
|
166
|
+
}
|
|
167
|
+
.salmon-button[data-variant='outline']:hover,
|
|
168
|
+
.salmon-button[data-variant='ghost']:hover {
|
|
169
|
+
--salmon-button-bg: var(--salmon-button-c-subtle);
|
|
170
|
+
}
|
|
171
|
+
.salmon-button[data-variant='outline']:active,
|
|
172
|
+
.salmon-button[data-variant='ghost']:active {
|
|
173
|
+
--salmon-button-bg: var(--salmon-button-c-subtle-hover);
|
|
174
|
+
}
|
|
175
|
+
.salmon-button[data-variant='outline'][data-pressed],
|
|
176
|
+
.salmon-button[data-variant='ghost'][data-pressed] {
|
|
177
|
+
--salmon-button-bg: var(--salmon-button-c-subtle);
|
|
178
|
+
--salmon-button-bd: var(--salmon-button-c-selected-edge);
|
|
179
|
+
}
|
|
180
|
+
.salmon-button[data-variant='link'] {
|
|
181
|
+
padding-inline: 2px;
|
|
182
|
+
min-block-size: auto;
|
|
183
|
+
font-weight: var(--salmon-font-weight-regular);
|
|
184
|
+
}
|
|
185
|
+
.salmon-button[data-variant='link'][data-tone='neutral'] {
|
|
186
|
+
--salmon-button-fg: var(--salmon-text-link);
|
|
187
|
+
}
|
|
188
|
+
.salmon-button[data-variant='link']:hover,
|
|
189
|
+
.salmon-button[data-variant='link'][data-pressed] {
|
|
190
|
+
text-decoration: underline;
|
|
191
|
+
}
|
|
192
|
+
/* States. */
|
|
193
|
+
.salmon-button:focus-visible {
|
|
194
|
+
z-index: 1;
|
|
195
|
+
outline: var(--salmon-state-focus-ring-width) solid var(--salmon-state-focus-ring);
|
|
196
|
+
outline-offset: var(--salmon-state-focus-ring-offset);
|
|
197
|
+
}
|
|
198
|
+
.salmon-button[data-variant]:disabled,
|
|
199
|
+
.salmon-button[data-variant][aria-disabled='true']:not([data-loading]) {
|
|
200
|
+
--salmon-button-bg: var(--salmon-surface-disabled);
|
|
201
|
+
--salmon-button-fg: var(--salmon-text-disabled);
|
|
202
|
+
--salmon-button-bd: var(--salmon-border-subtle);
|
|
203
|
+
cursor: not-allowed;
|
|
204
|
+
}
|
|
205
|
+
.salmon-button[data-variant='link']:disabled,
|
|
206
|
+
.salmon-button[data-variant='link'][aria-disabled='true']:not([data-loading]),
|
|
207
|
+
.salmon-button[data-variant='ghost']:disabled {
|
|
208
|
+
--salmon-button-bg: transparent;
|
|
209
|
+
--salmon-button-bd: transparent;
|
|
210
|
+
}
|
|
211
|
+
.salmon-button[data-loading] {
|
|
212
|
+
cursor: progress;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.salmon-button__label {
|
|
216
|
+
min-inline-size: 0;
|
|
217
|
+
overflow: hidden;
|
|
218
|
+
text-overflow: ellipsis;
|
|
219
|
+
}
|
|
220
|
+
.salmon-button__icon,
|
|
221
|
+
.salmon-button__spinner {
|
|
222
|
+
display: inline-flex;
|
|
223
|
+
flex: none;
|
|
224
|
+
align-items: center;
|
|
225
|
+
justify-content: center;
|
|
226
|
+
}
|
|
227
|
+
.salmon-button__spinner:empty {
|
|
228
|
+
inline-size: 1em;
|
|
229
|
+
block-size: 1em;
|
|
230
|
+
box-sizing: border-box;
|
|
231
|
+
border: 2px solid currentColor;
|
|
232
|
+
border-inline-end-color: transparent;
|
|
233
|
+
border-radius: 50%;
|
|
234
|
+
animation: salmon-button-spin 0.8s linear infinite;
|
|
235
|
+
}
|
|
236
|
+
@keyframes salmon-button-spin {
|
|
237
|
+
to {
|
|
238
|
+
rotate: 360deg;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
.salmon-button__sr {
|
|
242
|
+
position: absolute;
|
|
243
|
+
inline-size: 1px;
|
|
244
|
+
block-size: 1px;
|
|
245
|
+
margin: -1px;
|
|
246
|
+
padding: 0;
|
|
247
|
+
overflow: hidden;
|
|
248
|
+
clip-path: inset(50%);
|
|
249
|
+
white-space: nowrap;
|
|
250
|
+
border: 0;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/* Groups. */
|
|
254
|
+
.salmon-button-group,
|
|
255
|
+
.salmon-toggle-button-group {
|
|
256
|
+
display: inline-flex;
|
|
257
|
+
gap: 8px;
|
|
258
|
+
vertical-align: middle;
|
|
259
|
+
}
|
|
260
|
+
.salmon-button-group:not([data-attached]),
|
|
261
|
+
.salmon-toggle-button-group:not([data-attached]) {
|
|
262
|
+
flex-wrap: wrap;
|
|
263
|
+
}
|
|
264
|
+
.salmon-button-group[data-orientation='vertical'],
|
|
265
|
+
.salmon-toggle-button-group[data-orientation='vertical'] {
|
|
266
|
+
flex-direction: column;
|
|
267
|
+
align-items: stretch;
|
|
268
|
+
}
|
|
269
|
+
.salmon-button-group[data-attached],
|
|
270
|
+
.salmon-toggle-button-group[data-attached] {
|
|
271
|
+
gap: 0;
|
|
272
|
+
}
|
|
273
|
+
[data-attached][data-orientation='horizontal'] > .salmon-button:not(:first-of-type) {
|
|
274
|
+
margin-inline-start: -1px;
|
|
275
|
+
border-start-start-radius: 0;
|
|
276
|
+
border-end-start-radius: 0;
|
|
277
|
+
}
|
|
278
|
+
[data-attached][data-orientation='horizontal'] > .salmon-button:not(:last-of-type) {
|
|
279
|
+
border-start-end-radius: 0;
|
|
280
|
+
border-end-end-radius: 0;
|
|
281
|
+
}
|
|
282
|
+
[data-attached][data-orientation='vertical'] > .salmon-button:not(:first-of-type) {
|
|
283
|
+
margin-block-start: -1px;
|
|
284
|
+
border-start-start-radius: 0;
|
|
285
|
+
border-start-end-radius: 0;
|
|
286
|
+
}
|
|
287
|
+
[data-attached][data-orientation='vertical'] > .salmon-button:not(:last-of-type) {
|
|
288
|
+
border-end-start-radius: 0;
|
|
289
|
+
border-end-end-radius: 0;
|
|
290
|
+
}
|
|
291
|
+
[data-attached] > .salmon-button:hover,
|
|
292
|
+
[data-attached] > .salmon-button[data-pressed] {
|
|
293
|
+
z-index: 1;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
@media (prefers-reduced-motion: reduce) {
|
|
297
|
+
.salmon-button {
|
|
298
|
+
transition: none;
|
|
299
|
+
}
|
|
300
|
+
.salmon-button__spinner:empty {
|
|
301
|
+
animation-duration: 2.4s;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
@media (forced-colors: active) {
|
|
306
|
+
.salmon-button {
|
|
307
|
+
border-color: ButtonText;
|
|
308
|
+
}
|
|
309
|
+
.salmon-button[data-pressed] {
|
|
310
|
+
forced-color-adjust: none;
|
|
311
|
+
border-color: Highlight;
|
|
312
|
+
background: Highlight;
|
|
313
|
+
color: HighlightText;
|
|
314
|
+
}
|
|
315
|
+
.salmon-button:disabled {
|
|
316
|
+
border-color: GrayText;
|
|
317
|
+
color: GrayText;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
}
|
|
322
|
+
@layer salmon.a {
|
|
323
|
+
/* Dialog core (no subpath): the native <dialog> surface, parts, close button,
|
|
324
|
+
drag and resize handles, full-screen sheets. Carried by /dialog/styles.css
|
|
325
|
+
and /drawer/styles.css. Logical properties only. */
|
|
326
|
+
|
|
327
|
+
/* Direction sign: -1 under the nearest dir="rtl", 1 under dir="ltr". */
|
|
328
|
+
:where([dir='rtl']) { --salmon-dir: -1; }
|
|
329
|
+
:where([dir='ltr']) { --salmon-dir: 1; }
|
|
330
|
+
|
|
331
|
+
.salmon-dialog {
|
|
332
|
+
--salmon-dialog-x: 0px;
|
|
333
|
+
--salmon-dialog-y: 0px;
|
|
334
|
+
box-sizing: border-box;
|
|
335
|
+
display: none;
|
|
336
|
+
flex-direction: column;
|
|
337
|
+
inline-size: min(560px, calc(100vw - 32px));
|
|
338
|
+
max-inline-size: calc(100vw - 32px);
|
|
339
|
+
max-block-size: calc(100dvh - 32px);
|
|
340
|
+
margin: auto;
|
|
341
|
+
padding: 0;
|
|
342
|
+
overflow: hidden;
|
|
343
|
+
font-family: var(--salmon-font-sans);
|
|
344
|
+
font-size: var(--salmon-font-size-md);
|
|
345
|
+
line-height: var(--salmon-line-height-normal);
|
|
346
|
+
color: var(--salmon-text-primary);
|
|
347
|
+
background: var(--salmon-surface-overlay);
|
|
348
|
+
border: 1px solid var(--salmon-border-default);
|
|
349
|
+
border-radius: var(--salmon-radius-lg);
|
|
350
|
+
box-shadow: var(--salmon-shadow-lg);
|
|
351
|
+
translate: calc(var(--salmon-dialog-x) * var(--salmon-dir, 1)) var(--salmon-dialog-y);
|
|
352
|
+
opacity: 1;
|
|
353
|
+
transition: opacity 150ms ease-out, display 150ms allow-discrete, overlay 150ms allow-discrete;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
.salmon-dialog[open] {
|
|
357
|
+
display: flex;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
@starting-style {
|
|
361
|
+
.salmon-dialog[open] {
|
|
362
|
+
opacity: 0;
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
.salmon-dialog *,
|
|
367
|
+
.salmon-dialog ::before,
|
|
368
|
+
.salmon-dialog ::after {
|
|
369
|
+
box-sizing: border-box;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
.salmon-dialog::backdrop {
|
|
373
|
+
background: var(--salmon-surface-backdrop);
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
.salmon-dialog:not([data-modal]) {
|
|
377
|
+
position: fixed;
|
|
378
|
+
inset: 0;
|
|
379
|
+
z-index: 1000;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
.salmon-dialog[data-contained] {
|
|
383
|
+
position: absolute;
|
|
384
|
+
max-inline-size: 100%;
|
|
385
|
+
max-block-size: 100%;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
.salmon-dialog[data-placement='top'] {
|
|
389
|
+
margin-block-start: 48px;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
.salmon-dialog:focus-visible {
|
|
393
|
+
outline: var(--salmon-state-focus-ring-width) solid var(--salmon-state-focus-ring);
|
|
394
|
+
outline-offset: var(--salmon-state-focus-ring-offset);
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
.salmon-dialog-title {
|
|
398
|
+
margin: 0;
|
|
399
|
+
padding: var(--salmon-space-4) var(--salmon-space-4) var(--salmon-space-2);
|
|
400
|
+
padding-inline-end: 48px;
|
|
401
|
+
font-size: var(--salmon-font-size-lg);
|
|
402
|
+
font-weight: 600;
|
|
403
|
+
line-height: var(--salmon-line-height-tight);
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
.salmon-dialog[data-draggable] .salmon-dialog-title {
|
|
407
|
+
cursor: move;
|
|
408
|
+
touch-action: none;
|
|
409
|
+
user-select: none;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
.salmon-dialog-description {
|
|
413
|
+
margin: 0;
|
|
414
|
+
padding: 0 var(--salmon-space-4) var(--salmon-space-2);
|
|
415
|
+
color: var(--salmon-text-secondary);
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
.salmon-dialog-body {
|
|
419
|
+
flex: 1 1 auto;
|
|
420
|
+
min-block-size: 0;
|
|
421
|
+
padding: var(--salmon-space-2) var(--salmon-space-4);
|
|
422
|
+
overflow: auto;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
.salmon-dialog-footer {
|
|
426
|
+
display: flex;
|
|
427
|
+
flex-wrap: wrap;
|
|
428
|
+
justify-content: flex-end;
|
|
429
|
+
gap: var(--salmon-space-2);
|
|
430
|
+
padding: var(--salmon-space-3) var(--salmon-space-4) var(--salmon-space-4);
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
.salmon-dialog-close-button {
|
|
434
|
+
position: absolute;
|
|
435
|
+
inset-block-start: 6px;
|
|
436
|
+
inset-inline-end: 6px;
|
|
437
|
+
display: inline-flex;
|
|
438
|
+
align-items: center;
|
|
439
|
+
justify-content: center;
|
|
440
|
+
inline-size: var(--salmon-control-height-md, 32px);
|
|
441
|
+
block-size: var(--salmon-control-height-md, 32px);
|
|
442
|
+
padding: 0;
|
|
443
|
+
color: var(--salmon-text-secondary);
|
|
444
|
+
background: transparent;
|
|
445
|
+
border: 0;
|
|
446
|
+
border-radius: var(--salmon-radius-md);
|
|
447
|
+
cursor: pointer;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
.salmon-dialog-close-button > svg {
|
|
451
|
+
flex: none;
|
|
452
|
+
inline-size: 16px;
|
|
453
|
+
block-size: 16px;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
.salmon-dialog-close-button:hover {
|
|
457
|
+
color: var(--salmon-text-primary);
|
|
458
|
+
background: var(--salmon-surface-hover);
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
.salmon-dialog-close-button:focus-visible,
|
|
462
|
+
.salmon-dialog-resize-handle:focus-visible,
|
|
463
|
+
.salmon-dialog-title:focus-visible {
|
|
464
|
+
outline: var(--salmon-state-focus-ring-width) solid var(--salmon-state-focus-ring);
|
|
465
|
+
outline-offset: calc(-1 * var(--salmon-state-focus-ring-width));
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
.salmon-dialog-live {
|
|
469
|
+
position: absolute;
|
|
470
|
+
inline-size: 1px;
|
|
471
|
+
block-size: 1px;
|
|
472
|
+
overflow: hidden;
|
|
473
|
+
clip-path: inset(50%);
|
|
474
|
+
white-space: nowrap;
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
.salmon-dialog-resize-handle {
|
|
478
|
+
position: absolute;
|
|
479
|
+
inline-size: 12px;
|
|
480
|
+
block-size: 12px;
|
|
481
|
+
touch-action: none;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
.salmon-dialog-resize-handle[data-edge='bottomEnd'] { inset-block-end: 0; inset-inline-end: 0; cursor: nwse-resize; }
|
|
485
|
+
.salmon-dialog-resize-handle[data-edge='bottomStart'] { inset-block-end: 0; inset-inline-start: 0; cursor: nesw-resize; }
|
|
486
|
+
.salmon-dialog-resize-handle[data-edge='topEnd'] { inset-block-start: 0; inset-inline-end: 0; cursor: nesw-resize; }
|
|
487
|
+
.salmon-dialog-resize-handle[data-edge='topStart'] { inset-block-start: 0; inset-inline-start: 0; cursor: nwse-resize; }
|
|
488
|
+
.salmon-dialog-resize-handle:is([data-edge='top'], [data-edge='bottom']) { inset-inline: 12px; inline-size: auto; cursor: ns-resize; }
|
|
489
|
+
.salmon-dialog-resize-handle[data-edge='top'] { inset-block-start: 0; }
|
|
490
|
+
.salmon-dialog-resize-handle[data-edge='bottom'] { inset-block-end: 0; }
|
|
491
|
+
.salmon-dialog-resize-handle:is([data-edge='start'], [data-edge='end']) { inset-block: 12px; block-size: auto; cursor: ew-resize; }
|
|
492
|
+
.salmon-dialog-resize-handle[data-edge='start'] { inset-inline-start: 0; }
|
|
493
|
+
.salmon-dialog-resize-handle[data-edge='end'] { inset-inline-end: 0; }
|
|
494
|
+
|
|
495
|
+
/* Full screen: always, or below the mobile width (the Data Grid adaptive sheet rule). */
|
|
496
|
+
.salmon-dialog[data-full-screen='always'] {
|
|
497
|
+
inline-size: 100vw;
|
|
498
|
+
max-inline-size: none;
|
|
499
|
+
block-size: 100dvh;
|
|
500
|
+
max-block-size: none;
|
|
501
|
+
border: 0;
|
|
502
|
+
border-radius: 0;
|
|
503
|
+
translate: none;
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
@media (max-width: 640px) {
|
|
507
|
+
.salmon-dialog[data-full-screen='mobile'] {
|
|
508
|
+
inline-size: 100vw;
|
|
509
|
+
max-inline-size: none;
|
|
510
|
+
block-size: 100dvh;
|
|
511
|
+
max-block-size: none;
|
|
512
|
+
border: 0;
|
|
513
|
+
border-radius: 0;
|
|
514
|
+
translate: none;
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
@media (prefers-reduced-motion: reduce) {
|
|
519
|
+
.salmon-dialog {
|
|
520
|
+
transition: none;
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
}
|
|
525
|
+
@layer salmon.b {
|
|
526
|
+
/* @salmonui/buttons/button/styles.css, second part: the filter chip variant,
|
|
527
|
+
the progress fill and the floating action button. tooling/checks/copy-css.mjs
|
|
528
|
+
writes dist/button.css as styles/button-core.css followed by this file;
|
|
529
|
+
families of other packages that render plain buttons only carry
|
|
530
|
+
button-core.css (`@salmonui/buttons:button-core` in the manifest).
|
|
531
|
+
Chip hover and pressed apply
|
|
532
|
+
to enabled chips only, so the disabled state of button-core.css, which
|
|
533
|
+
comes first, keeps winning. */
|
|
534
|
+
|
|
535
|
+
.salmon-button[data-variant='chip'] {
|
|
536
|
+
--salmon-button-h: calc(var(--salmon-control-height-md, 32px) - 4px);
|
|
537
|
+
--salmon-button-bg: transparent;
|
|
538
|
+
--salmon-button-fg: var(--salmon-button-c-text);
|
|
539
|
+
--salmon-button-bd: var(--salmon-button-c-border);
|
|
540
|
+
border-radius: var(--salmon-radius-sm);
|
|
541
|
+
font-weight: var(--salmon-font-weight-regular);
|
|
542
|
+
}
|
|
543
|
+
.salmon-button[data-variant='chip'][data-size='sm'] {
|
|
544
|
+
--salmon-button-h: calc(var(--salmon-control-height-sm, 24px) - 2px);
|
|
545
|
+
}
|
|
546
|
+
.salmon-button[data-variant='chip'][data-size='lg'] {
|
|
547
|
+
--salmon-button-h: calc(var(--salmon-control-height-lg, 40px) - 6px);
|
|
548
|
+
}
|
|
549
|
+
.salmon-button[data-variant='chip']:hover:where(:enabled) {
|
|
550
|
+
--salmon-button-bg: var(--salmon-button-c-subtle);
|
|
551
|
+
}
|
|
552
|
+
.salmon-button[data-variant='chip'][data-pressed]:where(:enabled) {
|
|
553
|
+
--salmon-button-bg: var(--salmon-button-c-selected);
|
|
554
|
+
--salmon-button-bd: var(--salmon-button-c-selected-edge);
|
|
555
|
+
}
|
|
556
|
+
/* Filter chips show a check when pressed. */
|
|
557
|
+
.salmon-button[data-variant='chip'][data-pressed]::after {
|
|
558
|
+
content: '';
|
|
559
|
+
order: -1;
|
|
560
|
+
inline-size: 0.3em;
|
|
561
|
+
block-size: 0.6em;
|
|
562
|
+
margin-block-start: -0.2em;
|
|
563
|
+
border: solid currentColor;
|
|
564
|
+
border-width: 0 2px 2px 0;
|
|
565
|
+
rotate: 45deg;
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
/* Progress fill from inline-start. */
|
|
569
|
+
.salmon-button[data-progress]::before {
|
|
570
|
+
content: '';
|
|
571
|
+
position: absolute;
|
|
572
|
+
z-index: -1;
|
|
573
|
+
inset-block: 0;
|
|
574
|
+
inset-inline-start: 0;
|
|
575
|
+
inline-size: var(--salmon-button-progress, 0%);
|
|
576
|
+
background: currentColor;
|
|
577
|
+
opacity: 0.22;
|
|
578
|
+
transition: inline-size var(--salmon-motion-duration-fast) var(--salmon-motion-easing);
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
/* Floating action button: circular, elevated, CSS positioned. */
|
|
582
|
+
.salmon-button[data-floating] {
|
|
583
|
+
--salmon-button-h: 56px;
|
|
584
|
+
--salmon-button-pad: 20px;
|
|
585
|
+
--salmon-button-inset: 16px;
|
|
586
|
+
position: fixed;
|
|
587
|
+
z-index: 10;
|
|
588
|
+
border-radius: var(--salmon-radius-full);
|
|
589
|
+
box-shadow: var(--salmon-shadow-lg);
|
|
590
|
+
}
|
|
591
|
+
.salmon-button[data-floating][data-size='sm'] {
|
|
592
|
+
--salmon-button-h: 40px;
|
|
593
|
+
--salmon-button-pad: 14px;
|
|
594
|
+
}
|
|
595
|
+
.salmon-button[data-floating][data-size='lg'] {
|
|
596
|
+
--salmon-button-h: 64px;
|
|
597
|
+
--salmon-button-pad: 24px;
|
|
598
|
+
}
|
|
599
|
+
.salmon-button[data-floating-scope='parent'] {
|
|
600
|
+
position: absolute;
|
|
601
|
+
}
|
|
602
|
+
.salmon-button[data-floating^='top'] {
|
|
603
|
+
inset-block-start: var(--salmon-button-inset);
|
|
604
|
+
}
|
|
605
|
+
.salmon-button[data-floating^='bottom'] {
|
|
606
|
+
inset-block-end: var(--salmon-button-inset);
|
|
607
|
+
}
|
|
608
|
+
.salmon-button[data-floating$='Start'] {
|
|
609
|
+
inset-inline-start: var(--salmon-button-inset);
|
|
610
|
+
}
|
|
611
|
+
.salmon-button[data-floating$='End'] {
|
|
612
|
+
inset-inline-end: var(--salmon-button-inset);
|
|
613
|
+
}
|
|
614
|
+
.salmon-button[data-floating^='middle'] {
|
|
615
|
+
inset-block-start: 50%;
|
|
616
|
+
translate: 0 -50%;
|
|
617
|
+
}
|
|
618
|
+
/* Direction sign: -1 under the nearest dir="rtl", 1 under dir="ltr". */
|
|
619
|
+
:where([dir='rtl']) { --salmon-dir: -1; }
|
|
620
|
+
:where([dir='ltr']) { --salmon-dir: 1; }
|
|
621
|
+
.salmon-button[data-floating$='Center'] {
|
|
622
|
+
inset-inline-start: 50%;
|
|
623
|
+
translate: calc(-50% * var(--salmon-dir, 1)) 0;
|
|
624
|
+
}
|
|
625
|
+
.salmon-button[data-floating='middleCenter'] {
|
|
626
|
+
translate: calc(-50% * var(--salmon-dir, 1)) -50%;
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
@media (prefers-reduced-motion: reduce) {
|
|
630
|
+
.salmon-button[data-progress]::before {
|
|
631
|
+
transition: none;
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
}
|
|
636
|
+
@layer salmon.c {
|
|
637
|
+
/* @salmonui/overlays/dialog: AlertDialog additions. dist/dialog.css is the
|
|
638
|
+
Button stylesheet (AlertDialog renders Button), the core dialog-core.css and
|
|
639
|
+
this file. Logical properties only. */
|
|
640
|
+
|
|
641
|
+
.salmon-dialog-form {
|
|
642
|
+
display: contents;
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
.salmon-dialog[data-kind='alert'] {
|
|
646
|
+
inline-size: min(420px, calc(100vw - 32px));
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
/* The reason of a rejected async confirm, above the actions. */
|
|
650
|
+
.salmon-alert-dialog-error {
|
|
651
|
+
padding: var(--salmon-space-2) var(--salmon-space-4) 0;
|
|
652
|
+
color: var(--salmon-color-danger-text);
|
|
653
|
+
font-size: var(--salmon-font-size-sm);
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
}
|
package/dist/dialog.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { Dialog } from './dialog/Dialog.js';
|
|
2
|
+
export { DialogTrigger, DialogClose, DialogTitle, DialogDescription, DialogBody, DialogFooter } from '@salmonui/core/internal/dialog-core/Dialog';
|
|
3
|
+
export type { DialogProps, DialogTriggerProps, DialogTriggerRenderProps, DialogOpenChangeEvent, DialogOpenChangeReason, DialogPosition, DialogSize, DialogResizeEdge, DialogLocaleText, DialogPart, } from '@salmonui/core/internal/dialog-core/Dialog';
|
|
4
|
+
export { AlertDialog, DialogProvider, useConfirm, useAlert } from './dialog/AlertDialog.js';
|
|
5
|
+
export type { AlertDialogProps, AlertDialogLocaleText, ConfirmOptions } from './dialog/AlertDialog.js';
|
|
6
|
+
//# sourceMappingURL=dialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../src/dialog.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,WAAW,EAAE,iBAAiB,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,4CAA4C,CAAC;AAClJ,YAAY,EACV,WAAW,EACX,kBAAkB,EAClB,wBAAwB,EACxB,qBAAqB,EACrB,sBAAsB,EACtB,cAAc,EACd,UAAU,EACV,gBAAgB,EAChB,gBAAgB,EAChB,UAAU,GACX,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAC5F,YAAY,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC"}
|
package/dist/dialog.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { expectStylesheet } from '@salmonui/core/internal/dev';
|
|
3
|
+
// `@salmonui/overlays/dialog`: Dialog and its parts, AlertDialog,
|
|
4
|
+
// DialogProvider, useConfirm and useAlert. Dialog
|
|
5
|
+
// lives in the dialog core (`dialog-core/`), shared with `/drawer`. Render-safe: a closed
|
|
6
|
+
// dialog renders nothing; drag and resize are a lazy chunk. AlertDialog
|
|
7
|
+
// composes `Button` from `@salmonui/buttons/button`.
|
|
8
|
+
export { Dialog } from './dialog/Dialog.js';
|
|
9
|
+
export { DialogTrigger, DialogClose, DialogTitle, DialogDescription, DialogBody, DialogFooter } from '@salmonui/core/internal/dialog-core/Dialog';
|
|
10
|
+
export { AlertDialog, DialogProvider, useConfirm, useAlert } from './dialog/AlertDialog.js';
|
|
11
|
+
if (process.env.NODE_ENV !== 'production')
|
|
12
|
+
expectStylesheet('@salmonui/overlays/dialog', 'salmon-dialog');
|
|
13
|
+
//# sourceMappingURL=dialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialog.js","sourceRoot":"","sources":["../src/dialog.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AACb,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,kEAAkE;AAClE,kDAAkD;AAClD,0FAA0F;AAC1F,wEAAwE;AACxE,qDAAqD;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,WAAW,EAAE,iBAAiB,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,4CAA4C,CAAC;AAalJ,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAM5F,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY;IAAE,gBAAgB,CAAC,2BAA2B,EAAE,eAAe,CAAC,CAAC"}
|