@uniflowed/stylex 0.5.0 → 0.7.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/package.json +2 -2
- package/preset.js +76 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniflowed/stylex",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Flow declarations for @uniflowed/stylex, part of the Unified Toolchain for Flow.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"!*.test.js"
|
|
24
24
|
],
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@uniflowed/core": "0.
|
|
26
|
+
"@uniflowed/core": "0.7.0"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"react-native": ">=0.86.0"
|
package/preset.js
CHANGED
|
@@ -212,6 +212,14 @@ const fields = stylex.create({
|
|
|
212
212
|
outlineStyle: "solid",
|
|
213
213
|
outlineColor: ufTokens.focus,
|
|
214
214
|
outlineOffset: "1px",
|
|
215
|
+
// The border turns and the focus ring draws outward in `durationFast`;
|
|
216
|
+
// only the colours stay under reduced motion.
|
|
217
|
+
transitionProperty: {
|
|
218
|
+
default: "background-color, border-color, outline-width",
|
|
219
|
+
"@media (prefers-reduced-motion: reduce)": "background-color, border-color",
|
|
220
|
+
},
|
|
221
|
+
transitionDuration: ufTokens.durationFast,
|
|
222
|
+
transitionTimingFunction: ufTokens.easing,
|
|
215
223
|
},
|
|
216
224
|
invalid: {
|
|
217
225
|
borderColor: ufTokens.danger,
|
|
@@ -225,16 +233,37 @@ const fields = stylex.create({
|
|
|
225
233
|
});
|
|
226
234
|
|
|
227
235
|
const overlays = stylex.create({
|
|
236
|
+
// Enter: the wash fades in over `durationSlow`, the same time as the panel
|
|
237
|
+
// in front of it. A fade is what reduced motion keeps, so it keeps this.
|
|
228
238
|
backdrop: {
|
|
229
239
|
position: "fixed",
|
|
230
240
|
inset: 0,
|
|
231
241
|
backgroundColor: ufTokens.scrim,
|
|
232
|
-
|
|
233
|
-
|
|
242
|
+
opacity: { default: 1, "@starting-style": 0 },
|
|
243
|
+
transitionProperty: "opacity",
|
|
244
|
+
transitionDuration: ufTokens.durationSlow,
|
|
245
|
+
transitionTimingFunction: ufTokens.easingEnter,
|
|
246
|
+
},
|
|
247
|
+
// Enter: the panel fades in and grows from 96% of its size where it rests,
|
|
248
|
+
// on the decelerating curve, so it is legible almost at once and is seen
|
|
249
|
+
// settling rather than popping. The centring translate is part of both
|
|
250
|
+
// values, or the panel would start in the corner. Under reduced motion it
|
|
251
|
+
// only fades.
|
|
252
|
+
dialog: {
|
|
234
253
|
position: "fixed",
|
|
235
254
|
top: "50%",
|
|
236
255
|
left: "50%",
|
|
237
|
-
|
|
256
|
+
opacity: { default: 1, "@starting-style": 0 },
|
|
257
|
+
transform: {
|
|
258
|
+
default: "translate(-50%, -50%)",
|
|
259
|
+
"@starting-style": "translate(-50%, -50%) scale(0.96)",
|
|
260
|
+
},
|
|
261
|
+
transitionProperty: {
|
|
262
|
+
default: "opacity, transform",
|
|
263
|
+
"@media (prefers-reduced-motion: reduce)": "opacity",
|
|
264
|
+
},
|
|
265
|
+
transitionDuration: ufTokens.durationSlow,
|
|
266
|
+
transitionTimingFunction: ufTokens.easingEnter,
|
|
238
267
|
width: "calc(100% - 32px)",
|
|
239
268
|
maxWidth: "32rem",
|
|
240
269
|
backgroundColor: ufTokens.surface,
|
|
@@ -249,7 +278,31 @@ const overlays = stylex.create({
|
|
|
249
278
|
});
|
|
250
279
|
|
|
251
280
|
const menus = stylex.create({
|
|
252
|
-
|
|
281
|
+
// Enter: it fades in while travelling 4px out of its trigger, from the side
|
|
282
|
+
// `@uniflowed/ui` put it on (`data-side`), the way `registry/ui/menu.js`
|
|
283
|
+
// does. Under reduced motion it only fades.
|
|
284
|
+
menu: {
|
|
285
|
+
"--uf-enter-x": {
|
|
286
|
+
default: "0px",
|
|
287
|
+
":is([data-side=left])": "4px",
|
|
288
|
+
":is([data-side=right])": "-4px",
|
|
289
|
+
},
|
|
290
|
+
"--uf-enter-y": {
|
|
291
|
+
default: "0px",
|
|
292
|
+
":is([data-side=top])": "4px",
|
|
293
|
+
":is([data-side=bottom])": "-4px",
|
|
294
|
+
},
|
|
295
|
+
opacity: { default: 1, "@starting-style": 0 },
|
|
296
|
+
transform: {
|
|
297
|
+
default: "none",
|
|
298
|
+
"@starting-style": "translate(var(--uf-enter-x), var(--uf-enter-y))",
|
|
299
|
+
},
|
|
300
|
+
transitionProperty: {
|
|
301
|
+
default: "opacity, transform",
|
|
302
|
+
"@media (prefers-reduced-motion: reduce)": "opacity",
|
|
303
|
+
},
|
|
304
|
+
transitionDuration: ufTokens.durationBase,
|
|
305
|
+
transitionTimingFunction: ufTokens.easingEnter,
|
|
253
306
|
minWidth: "12rem",
|
|
254
307
|
margin: 0,
|
|
255
308
|
padding: ufTokens.space1,
|
|
@@ -274,6 +327,11 @@ const menus = stylex.create({
|
|
|
274
327
|
color: ufTokens.ink,
|
|
275
328
|
backgroundColor: { default: "transparent", ":hover": ufTokens.surfaceHover },
|
|
276
329
|
cursor: "pointer",
|
|
330
|
+
// The highlight follows the pointer in `durationFast`: long enough to be
|
|
331
|
+
// seen, short enough never to trail it. Colour, so reduced motion keeps it.
|
|
332
|
+
transitionProperty: "background-color, color",
|
|
333
|
+
transitionDuration: ufTokens.durationFast,
|
|
334
|
+
transitionTimingFunction: ufTokens.easing,
|
|
277
335
|
},
|
|
278
336
|
active: {
|
|
279
337
|
backgroundColor: ufTokens.accentSoft,
|
|
@@ -309,6 +367,18 @@ const tabs = stylex.create({
|
|
|
309
367
|
fontWeight: ufTokens.weightMedium,
|
|
310
368
|
color: { default: ufTokens.muted, ":hover": ufTokens.ink },
|
|
311
369
|
cursor: "pointer",
|
|
370
|
+
// The underline and the label change together, and the focus ring draws
|
|
371
|
+
// outward; only the colours stay under reduced motion.
|
|
372
|
+
transitionProperty: {
|
|
373
|
+
default: "border-color, color, outline-width",
|
|
374
|
+
"@media (prefers-reduced-motion: reduce)": "border-color, color",
|
|
375
|
+
},
|
|
376
|
+
transitionDuration: ufTokens.durationBase,
|
|
377
|
+
transitionTimingFunction: ufTokens.easing,
|
|
378
|
+
outlineWidth: { default: "0", ":focus-visible": "2px" },
|
|
379
|
+
outlineStyle: "solid",
|
|
380
|
+
outlineColor: ufTokens.focus,
|
|
381
|
+
outlineOffset: "-2px",
|
|
312
382
|
},
|
|
313
383
|
selected: {
|
|
314
384
|
color: ufTokens.ink,
|
|
@@ -457,12 +527,12 @@ export function backdropStyles(): StyleProps {
|
|
|
457
527
|
|
|
458
528
|
/** A centred modal panel. */
|
|
459
529
|
export function dialogStyles(): StyleProps {
|
|
460
|
-
return props(overlays.
|
|
530
|
+
return props(overlays.dialog);
|
|
461
531
|
}
|
|
462
532
|
|
|
463
533
|
/** The box a menu's options sit in. */
|
|
464
534
|
export function menuStyles(): StyleProps {
|
|
465
|
-
return props(menus.
|
|
535
|
+
return props(menus.menu);
|
|
466
536
|
}
|
|
467
537
|
|
|
468
538
|
/** One option in a menu. */
|