lurq 0.65.1

A Rust UI toolkit with typed components, retained state, reactive signals, GPU rendering, and DevTools.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
//! A popover: a panel beside the element that opens it, over the window, holding anything.

use std::sync::Arc;

use super::{
  names,
  part_style::{Length, PartAnimation, PartStyle},
  recipe::{Case, Name, Recipe, ResolvedPart, ResolvedRecipe},
  shared::{FADE_IN, FADE_OUT},
  theme::{Themed, current_theme},
};
use crate::{
  app::{
    ctx::{CollisionStrategy, OutsidePress, Placement},
    theme::{
      BorderSize, MotionDuration, MotionEasing, PaletteColor, RadiusSize, ShadowStyle, SpacingSize, Theme,
      TypographyStyle,
    },
  },
  components::{Column, Popup, Row},
  core::{ElementRef, Signal},
  layout::{Alignment, text_style::FontWeight},
  node::{Element, NodeUpdate, SpacingValue, border::Border, padding::Padding},
};

/// The parts of a popover a recipe styles.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
pub enum PopoverPart {
  /// The panel: its fill, its edge, its shadow, and its text over its body.
  Panel,
  /// The column of the title over the description.
  Text,
  /// What the popover is about, in a line.
  Title,
  /// What it is for, under the title.
  Description,
  /// What the popover holds, one thing under another.
  Body,
}

names!(PopoverPart {
  Panel => "panel",
  Text => "text",
  Title => "title",
  Description => "description",
  Body => "body",
});

/// What builds a popover's panel: a theme's in place of the default one.
/// Where the panel is shown, and when, stays the popover's.
pub type PopoverRenderer = Arc<dyn Fn(PopoverView) -> Element + Send + Sync>;

/// A popover: a panel shown beside the element that opens it, over the
/// window, holding anything: the size of a layer, a few settings, a form.
///
/// ```
/// use lurq::{
///   components::{Placement, Row},
///   core::{ElementRef, Signal},
///   ui::{Button, Field, Input, Popover},
/// };
///
/// // What the app keeps from one render to the next: the anchor, and whether it is open.
/// let (anchor, open) = (ElementRef::new(), Signal::new(false));
///
/// // The button opens and closes it, and it is shown under the button.
/// let popover = Popover::new(open.clone(), anchor.clone())
///   .trigger(Button::new("Dimensions"))
///   .title("Dimensions")
///   .description("Set the size of the layer.")
///   .placement(Placement::BottomStart)
///   .child(Field::new("Width", Input::new(Signal::new("320px".to_owned())).full_width(true)).full_width(true));
///
/// // Beside an element of the app's, which opens it in its own way.
/// let (anchor, open) = (ElementRef::new(), Signal::new(false));
/// let row = Row::new()
///   .child(Row::new().ref_element(anchor.clone()))
///   .child(Popover::new(open, anchor).title("Details"));
/// ```
///
/// A popover does not keep whether it is open: the app's signal does. A
/// press outside it or Escape closes it, which sets the signal to `false`
/// (either can be turned off: [`Popover::dismiss_on_outside_press`],
/// [`Popover::dismiss_on_escape`]).
/// Its trigger ([`Popover::trigger`]) turns the signal; without one the app
/// opens it, and the anchor is any element of its own. A press of the
/// anchor is not a press outside it. The anchor is kept from one render to
/// the next (a field of the component, `ctx.element_ref()`): one made anew in
/// each render is not the one the focus goes back to as it closes.
///
/// As it opens the focus goes to the first thing in it that takes the focus,
/// and as it closes with the focus inside, back to the anchor. Where there is
/// no room for it on its side it goes to the other, and it is kept in the
/// window.
pub struct Popover {
  anchor: ElementRef,
  open: Signal<bool>,
  trigger: Option<Element>,
  title: Option<Arc<str>>,
  description: Option<Arc<str>>,
  children: Vec<Element>,
  placement: Placement,
  offset: SpacingValue,
  cross_offset: SpacingValue,
  collision: CollisionStrategy,
  within: Option<ElementRef>,
  within_inset: Padding,
  placed_by: Option<ElementRef>,
  at: Option<(f32, f32)>,
  width: Option<Length>,
  alert: bool,
  inline: bool,
  dismiss_on_escape: bool,
  dismiss_on_outside_press: bool,
  switch_on_anchor_press: bool,
  keeps_focus: bool,
  label: Option<Arc<str>>,
  described: Option<Arc<str>>,
  on_dismiss: Vec<Arc<dyn Fn() + Send + Sync>>,
  states: Vec<Name>,
  rules: Recipe,
  id: Option<Arc<str>>,
  key: Option<Arc<str>>,
}

impl Popover {
  /// A popover shown beside `anchor` while `open` is `true`.
  pub fn new(open: Signal<bool>, anchor: impl Into<ElementRef>) -> Self {
    Self {
      anchor: anchor.into(),
      open,
      trigger: None,
      title: None,
      description: None,
      children: Vec::new(),
      placement: Placement::BottomStart,
      offset: SpacingSize::Xs.into(),
      cross_offset: SpacingValue::default(),
      collision: CollisionStrategy::FlipThenClamp,
      within: None,
      within_inset: Padding::default(),
      placed_by: None,
      at: None,
      width: None,
      alert: false,
      inline: false,
      dismiss_on_escape: true,
      dismiss_on_outside_press: true,
      switch_on_anchor_press: true,
      keeps_focus: false,
      label: None,
      described: None,
      on_dismiss: Vec::new(),
      states: Vec::new(),
      rules: Recipe::new(),
      id: None,
      key: None,
    }
  }

  /// What opens and closes the popover: a button. It is put before the
  /// popover, is its anchor, and a press of it turns the signal. While
  /// another popup is open a press of it closes that one and opens this one.
  /// It says to what reads the tree whether the popover is open.
  pub fn trigger(mut self, trigger: impl Into<Element>) -> Self {
    self.trigger = Some(trigger.into());
    self
  }

  /// What the popover is about, at the top of it.
  pub fn title(mut self, title: &str) -> Self {
    self.title = Some(Arc::from(title));
    self
  }

  /// What it is for, under the title.
  pub fn description(mut self, description: &str) -> Self {
    self.description = Some(Arc::from(description));
    self
  }

  /// Adds something the popover holds, under what it holds already.
  pub fn child(mut self, child: impl Into<Element>) -> Self {
    self.children.push(child.into());
    self
  }

  /// Adds several things the popover holds.
  pub fn children(mut self, children: impl IntoIterator<Item = impl Into<Element>>) -> Self {
    self.children.extend(children.into_iter().map(Into::into));
    self
  }

  /// Which side of the anchor the popover is on, and which edge of it it
  /// lines up with. Under the anchor at its start by default.
  pub fn placement(mut self, placement: Placement) -> Self {
    self.placement = placement;
    self
  }

  /// How far the popover is from its anchor, away from it on the side it is on: the theme's smallest spacing by
  /// default. Over its anchor too it is away from it, up: a negative offset moves it toward the anchor, over it.
  pub fn offset(mut self, offset: impl Into<SpacingValue>) -> Self {
    self.offset = offset.into();
    self
  }

  /// How far the popover is moved along the edge of its anchor it stands on, besides [`offset`](Self::offset) away
  /// from it: toward the end over or under its anchor, and down beside it. A negative one moves it toward the start
  /// (up): a popover at the end of a bar, 12 in from the bar's end, is `placement(Placement::TopEnd)` and
  /// `cross_offset(-12.0)`. None by default. With [`at`](Self::at) it is not used.
  pub fn cross_offset(mut self, offset: impl Into<SpacingValue>) -> Self {
    self.cross_offset = offset.into();
    self
  }

  /// What the popover does where there is no room for it on its side: goes
  /// to the other side, then is moved into the window, by default.
  pub fn collision(mut self, collision: CollisionStrategy) -> Self {
    self.collision = collision;
    self
  }

  /// Keeps the popover inside the box of `element` besides the window, a column it belongs in: where its collision
  /// flips and clamps it, it does so in that box too ([`Overlay::within`](crate::app::ctx::Overlay::within)).
  pub fn within(mut self, element: impl Into<ElementRef>) -> Self {
    self.within = Some(element.into());
    self
  }

  /// Keeps the popover inside the box of `element` less `inset` on each side, as [`within`](Self::within) keeps it in
  /// the box: a popover that ends 12 or more before the end of the column it belongs in is
  /// `within_inset(column, Padding::new().right(12.0))`, and with [`CollisionStrategy::Clamp`] it moves back toward
  /// the start just as far as that takes.
  pub fn within_inset(mut self, element: impl Into<ElementRef>, inset: Padding) -> Self {
    self.within = Some(element.into());
    self.within_inset = inset;
    self
  }

  /// Places the popover by the box of `element` in place of its anchor's, as it was last laid out: at its placement
  /// of that box, and flipped and clamped there. The anchor stays its trigger and where the focus goes back. A
  /// popover over a status bar and at its end, opened by an item of the bar
  /// ([`Overlay::placed_by`](crate::app::ctx::Overlay::placed_by)).
  pub fn placed_by(mut self, element: impl Into<ElementRef>) -> Self {
    self.placed_by = Some(element.into());
    self
  }

  /// A point of the window, in logical pixels, that the popover stands at in place of its anchor: down and toward
  /// the end from it, `offset` away on both axes, and on the other side where the window has no room
  /// ([`Overlay::at`](crate::app::ctx::Overlay::at)). The placement is not used. `None`, the default, places it by its
  /// anchor.
  pub fn at(mut self, point: Option<(f32, f32)>) -> Self {
    self.at = point;
    self
  }

  /// How wide the panel is, in place of what the theme gives it.
  pub fn width(mut self, width: impl Into<Length>) -> Self {
    self.width = Some(width.into());
    self
  }

  /// Whether the popover asks something that has to be answered: an
  /// `alertdialog`, and not a `dialog`, to tooling that reads the tree.
  pub fn alert(mut self, alert: bool) -> Self {
    self.alert = alert;
    self
  }

  /// What the popover is called to tooling that reads the tree, in place of
  /// its title: for one whose title is drawn by what it holds and not given
  /// to [`Popover::title`].
  pub fn label(mut self, label: &str) -> Self {
    self.label = Some(Arc::from(label));
    self
  }

  /// What the popover is described by to tooling that reads the tree.
  pub fn described(mut self, description: &str) -> Self {
    self.described = Some(Arc::from(description));
    self
  }

  /// What runs after a person closed the popover by a press outside it or
  /// Escape; not when the app sets the signal. A second handler is called
  /// after the first.
  pub fn on_dismiss(mut self, handler: impl Fn() + Send + Sync + 'static) -> Self {
    self.on_dismiss.push(Arc::new(handler));
    self
  }

  /// Whether Escape closes the popover. `true` by default.
  pub fn dismiss_on_escape(mut self, dismiss: bool) -> Self {
    self.dismiss_on_escape = dismiss;
    self
  }

  /// Whether a press outside the popover and its anchor closes it. `true` by default.
  pub fn dismiss_on_outside_press(mut self, dismiss: bool) -> Self {
    self.dismiss_on_outside_press = dismiss;
    self
  }

  /// Whether its anchor is the trigger of a dropdown, which a press opens: while another popup is open, a press of the
  /// anchor closes that one and goes on to the anchor, so one press switches from one to the other. `true` by
  /// default. `false` for a popover the app opens by itself (a question at a card, a popover at a row's pointer),
  /// whose anchor a press does something else to: a press of the anchor while another popup is open then only closes
  /// that one, as a press elsewhere does.
  pub fn switch_on_anchor_press(mut self, switch: bool) -> Self {
    self.switch_on_anchor_press = switch;
    self
  }

  /// Whether the popover leaves the focus where it is as it opens, in the app's field or panel, in place of taking it:
  /// a list of choices under a field being typed in, a calendar whose keys the app reads where it keeps the focus
  /// ([`Calendar::keys`](super::Calendar::keys)). A press outside it then closes it, where it closes it, and goes on
  /// to what it was on. `false` by default: the focus goes into the popover and back as it closes.
  pub fn keeps_focus(mut self, keeps: bool) -> Self {
    self.keeps_focus = keeps;
    self
  }

  /// Draws the panel where the popover is declared, whether or not it is
  /// open, and not over the window beside its anchor: for a gallery, a
  /// screenshot, a test. Its trigger is not drawn, and Escape and a press
  /// outside do not close it.
  pub fn inline(mut self, inline: bool) -> Self {
    self.inline = inline;
    self
  }

  /// Puts the popover in a state the theme's recipe names, or takes it out.
  pub fn state(mut self, state: impl Into<Name>, on: bool) -> Self {
    let state = state.into();
    self.states.retain(|held| *held != state);
    if on {
      self.states.push(state);
    }
    self
  }

  /// Styles one part of this popover over what the theme gives it.
  pub fn style(mut self, part: impl Into<Name>, style: impl FnOnce(PartStyle) -> PartStyle) -> Self {
    self.rules = self.rules.base(part, style);
    self
  }

  /// Lays rules over the theme's recipe for this popover.
  pub fn rules(mut self, rules: &Recipe) -> Self {
    self.rules = self.rules.extend(rules);
    self
  }

  /// The id of the panel.
  pub fn id(mut self, id: impl Into<Arc<str>>) -> Self {
    self.id = Some(id.into());
    self
  }

  pub fn key(mut self, key: impl Into<Arc<str>>) -> Self {
    self.key = Some(key.into());
    self
  }

  /// Builds the popover in `theme`. Converting a popover into an element does
  /// this in the theme of what is being rendered.
  pub fn build(self, theme: &Theme) -> Element {
    let case = Case {
      variant: None,
      size: None,
      density: None,
      breakpoint: super::current_breakpoint(),
      states: self.states.clone(),
    };
    // A width given here is under what `style` and `rules` say of the panel.
    let mut rules = Recipe::new();
    if let Some(width) = self.width {
      rules = rules.base(PopoverPart::Panel, |s| s.width(width));
    }
    let rules = rules.extend(&self.rules);
    let view = PopoverView {
      title: self.title,
      description: self.description,
      children: self.children,
      recipe: theme.resolve::<Popover>(&case, Some(&rules)).owned_by(self.id.as_ref()),
      alert: self.alert,
      label: self.label,
      described: self.described,
      id: self.id,
      key: self.key,
    };
    let panel = match theme.renderer::<Popover>() {
      Some(renderer) => renderer(view),
      None => view.render(),
    };
    if self.inline {
      return panel;
    }
    // The offset is away from the anchor, on the side the popover is on; the cross offset along that side.
    let spacing = theme.spacing();
    let (offset, cross) = (
      self.offset.resolve(&spacing, 0.0),
      self.cross_offset.resolve(&spacing, 0.0),
    );
    let (x, y) = match self.placement {
      _ if self.at.is_some() => (offset, offset),
      Placement::LeftStart
      | Placement::Left
      | Placement::LeftEnd
      | Placement::RightStart
      | Placement::Right
      | Placement::RightEnd => (offset, cross),
      _ => (cross, offset),
    };
    let mut popup = Popup::new(self.anchor.clone(), panel)
      .open(self.open.clone())
      .placement(self.placement)
      .offset(x, y)
      .collision(self.collision)
      .dismiss_on_escape(self.dismiss_on_escape)
      .dismiss_on_outside_click(self.dismiss_on_outside_press)
      .takes_focus(!self.keeps_focus)
      .switch_on_anchor_press(self.switch_on_anchor_press);
    if self.keeps_focus {
      popup = popup.outside_press(OutsidePress::PassThrough);
    }
    if let Some(within) = self.within {
      let side = |side: SpacingValue| side.resolve(&spacing, 0.0);
      let inset = self.within_inset;
      popup = popup.within_inset(
        within,
        side(inset.top),
        side(inset.right),
        side(inset.bottom),
        side(inset.left),
      );
    }
    if let Some(frame) = self.placed_by {
      popup = popup.placed_by(frame);
    }
    if self.at.is_some() {
      popup = popup.at(self.at);
    }
    if !self.on_dismiss.is_empty() {
      let handlers = self.on_dismiss;
      popup = popup.on_dismiss(move || {
        for handler in &handlers {
          handler();
        }
      });
    }
    let Some(trigger) = self.trigger else {
      return popup.into();
    };
    // The trigger's own node is the anchor, so the engine knows it for the popup's trigger: the first thing
    // a press reaches that takes the focus. It is put on the trigger's root as a decoration, so that a trigger
    // that is a component has it on the root it renders, whenever it renders.
    let (open, expanded, anchor) = (self.open.clone(), self.open.get(), self.anchor);
    let trigger = trigger.decorate_root(move |mut node| {
      let open = open.clone();
      NodeUpdate::ref_element(&mut node, anchor.clone());
      NodeUpdate::on_click(&mut node, move |_: crate::app::events::MouseEvent| {
        open.update(|open| *open = !*open)
      });
      NodeUpdate::describe(&mut node, Arc::from("a11y_haspopup"), Arc::from("dialog"));
      NodeUpdate::describe(
        &mut node,
        Arc::from("a11y_expanded"),
        Arc::from(if expanded { "true" } else { "false" }),
      );
      node
    });
    Row::new().child(trigger).child(popup).into()
  }
}

impl From<Popover> for Element {
  fn from(popover: Popover) -> Self {
    popover.build(&current_theme())
  }
}

/// A popover's panel as a renderer sees it: what it was given and the style of its parts.
pub struct PopoverView {
  pub title: Option<Arc<str>>,
  pub description: Option<Arc<str>>,
  /// What the popover holds.
  pub children: Vec<Element>,
  /// The style of each part of this popover.
  pub recipe: ResolvedRecipe,
  alert: bool,
  label: Option<Arc<str>>,
  described: Option<Arc<str>>,
  id: Option<Arc<str>>,
  key: Option<Arc<str>>,
}

impl PopoverView {
  /// The style of a part, as this popover is to be drawn.
  pub fn part(&self, part: impl Into<Name>) -> ResolvedPart {
    self.recipe.part(part)
  }

  pub fn theme(&self) -> &Theme {
    self.recipe.theme()
  }

  /// A line in the style of a part, in a node that has the part's color.
  fn line(&self, part: PopoverPart, content: &str) -> Column {
    let part = self.part(part);
    Column::new().part(&part).child(part.text(content))
  }

  /// The title over the description, where the popover has either.
  pub fn text(&self) -> Option<Column> {
    if self.title.is_none() && self.description.is_none() {
      return None;
    }
    let mut text = Column::new()
      .align_items(Alignment::Stretch)
      .part(&self.part(PopoverPart::Text));
    if let Some(title) = &self.title {
      text = text.child(self.line(PopoverPart::Title, title));
    }
    if let Some(description) = &self.description {
      text = text.child(self.line(PopoverPart::Description, description));
    }
    Some(text)
  }

  /// The panel with nothing in it yet: what a renderer puts the text and the
  /// body in. It is a dialog to what reads the tree, called by its label or
  /// its title.
  pub fn panel(&self) -> Column {
    let mut panel = Column::new()
      .align_items(Alignment::Stretch)
      .part(&self.part(PopoverPart::Panel))
      .describe("a11y_role", if self.alert { "alertdialog" } else { "dialog" });
    if let Some(name) = self.label.as_ref().or(self.title.as_ref()) {
      panel = panel.describe("a11y_name", name.clone());
    }
    if let Some(description) = &self.described {
      panel = panel.describe("a11y_description", description.clone());
    }
    if let Some(id) = &self.id {
      panel = panel.id(id.clone());
    }
    if let Some(key) = &self.key {
      panel = panel.key(key.clone());
    }
    panel
  }

  /// How the default renderer builds a popover: the text over the body, in the panel.
  pub fn render(mut self) -> Element {
    let mut panel = self.panel();
    if let Some(text) = self.text() {
      panel = panel.child(text);
    }
    let children = std::mem::take(&mut self.children);
    if !children.is_empty() {
      let mut body = Column::new()
        .align_items(Alignment::Stretch)
        .part(&self.part(PopoverPart::Body));
      for child in children {
        body = body.child(child);
      }
      panel = panel.child(body);
    }
    panel.into()
  }
}

impl crate::ui::Styled for Popover {
  type Component = Self;

  fn rules(self, rules: &crate::ui::Recipe) -> Self {
    Self::rules(self, rules)
  }

  fn state(self, state: impl Into<crate::ui::Name>, on: bool) -> Self {
    Self::state(self, state, on)
  }
}

impl Themed for Popover {
  const NAME: &'static str = "popover";
  const ROOT: &'static str = "panel";
  type Renderer = PopoverRenderer;

  fn parts() -> crate::ui::Declared {
    PopoverPart::declared()
  }

  /// The design's popover (`pencil/lurq-design-system.pen`, Popover): a panel
  /// 292 wide in the popover's colors, with an edge of 1 in the border's
  /// color, the large radius and the medium shadow, 16 of padding and 14
  /// between its text and its body. The text has the title in the body's
  /// type at medium weight over the description in 13 and the muted
  /// foreground, 4 apart; what the body holds is 14 apart. It fades in over
  /// the theme's base duration in the entering curve, and out over the fast
  /// one in the leaving curve (Foundations, Motion: popovers take the base
  /// duration, and exits are quicker than entrances).
  fn recipe() -> Recipe {
    use PaletteColor::{Border as Edge, MutedForeground, Popover as Fill, PopoverForeground};
    use PopoverPart::{Body, Description, Panel, Text, Title};
    Recipe::new()
      .base(Panel, |s| {
        s.width(292.0)
          .padding_x(16.0)
          .padding_y(16.0)
          .gap(14.0)
          .radius(RadiusSize::Lg)
          .background(Fill)
          .foreground(PopoverForeground)
          .border(Border::inside(BorderSize::Sm, Edge))
          .shadow(ShadowStyle::Md)
          .enter(PartAnimation::new(FADE_IN, MotionDuration::Base, MotionEasing::Enter))
          .exit(PartAnimation::new(FADE_OUT, MotionDuration::Fast, MotionEasing::Exit))
      })
      .base(Text, |s| s.gap(4.0))
      .base(Title, |s| {
        s.typography(TypographyStyle::Body).weight(FontWeight::Medium)
      })
      .base(Description, |s| {
        s.typography(TypographyStyle::Description)
          .font_size(13.0)
          .foreground(MutedForeground)
      })
      .base(Body, |s| s.gap(14.0))
  }
}