@jsenv/navi 0.28.2 → 0.28.3

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.
@@ -42278,9 +42278,10 @@ const css$p = /* css */`
42278
42278
  user-select: none;
42279
42279
  }
42280
42280
  }
42281
- /* Loading placeholders (see List's loading / loadingIndicator / skeletonTemplate).
42281
+ /* Loading placeholders (see List's loading / loadingFallback / loadingSkeletonTemplate).
42282
42282
  A skeleton row reuses <Text loading> for the shimmer bar; the loader row
42283
- centers a spinner. */
42283
+ centers a spinner; a custom loadingFallback is only given a row to live in,
42284
+ its own markup does the layout. */
42284
42285
  .navi_list_item_skeleton {
42285
42286
  pointer-events: none;
42286
42287
  }
@@ -42291,6 +42292,9 @@ const css$p = /* css */`
42291
42292
  justify-content: center;
42292
42293
  color: light-dark(#888, #aaa);
42293
42294
  }
42295
+ .navi_list_loading_fallback {
42296
+ display: flex;
42297
+ }
42294
42298
  /* Error state (List error prop): an inline callout describing why the list
42295
42299
  failed to load, shown in place of the items. */
42296
42300
  .navi_list_error {
@@ -42402,9 +42406,9 @@ const ListUI = props => {
42402
42406
  searchText,
42403
42407
  searchNoMatchMode = "remove",
42404
42408
  loading,
42405
- loadingIndicator = "skeleton",
42409
+ loadingFallback = "skeleton",
42406
42410
  loadingSkeletonCount = 3,
42407
- skeletonTemplate,
42411
+ loadingSkeletonTemplate,
42408
42412
  error,
42409
42413
  horizontal,
42410
42414
  spacing,
@@ -42495,9 +42499,8 @@ const ListUI = props => {
42495
42499
  const nothingToDisplay = !loading && !error && noVisibleItems && !searchFallbackShown && !emptyFallbackShown;
42496
42500
 
42497
42501
  // Placeholder content replaces the real children: an error message when the
42498
- // load failed (takes precedence), otherwise — while loading — skeleton rows
42499
- // (default, count loadingSkeletonCount, look skeletonTemplate) or a single
42500
- // centered loader when loadingIndicator="loader".
42502
+ // load failed (takes precedence), otherwise — while loading — whatever
42503
+ // loadingFallback asks for.
42501
42504
  let content = children;
42502
42505
  if (error) {
42503
42506
  content = jsxs(ListItem, {
@@ -42511,16 +42514,9 @@ const ListUI = props => {
42511
42514
  children: error === true ? "Something went wrong." : error
42512
42515
  })]
42513
42516
  });
42514
- } else if (loading) {
42515
- if (loadingIndicator === "loader") {
42516
- content = jsx(ListItem, {
42517
- role: "presentation",
42518
- "aria-hidden": "true",
42519
- baseClassName: "navi_list_item navi_list_loader",
42520
- children: jsx(LoadingIndicator, {})
42521
- });
42522
- } else {
42523
- const template = skeletonTemplate ?? jsx(ListItem, {
42517
+ } else if (loading && loadingFallback) {
42518
+ if (loadingFallback === "skeleton") {
42519
+ const template = loadingSkeletonTemplate ?? jsx(ListItem, {
42524
42520
  skeleton: true
42525
42521
  });
42526
42522
  const skeletons = [];
@@ -42532,6 +42528,21 @@ const ListUI = props => {
42532
42528
  skeletonIndex++;
42533
42529
  }
42534
42530
  content = skeletons;
42531
+ } else if (loadingFallback === "loader") {
42532
+ content = jsx(ListItem, {
42533
+ role: "presentation",
42534
+ "aria-hidden": "true",
42535
+ baseClassName: "navi_list_item navi_list_loader",
42536
+ children: jsx(LoadingIndicator, {})
42537
+ });
42538
+ } else {
42539
+ // Custom content is not aria-hidden (unlike the bare spinner): it usually
42540
+ // carries a message worth announcing.
42541
+ content = jsx(ListItem, {
42542
+ role: "presentation",
42543
+ baseClassName: "navi_list_item navi_list_loading_fallback",
42544
+ children: loadingFallback
42545
+ });
42535
42546
  }
42536
42547
  }
42537
42548
  return jsx(Box, {
@@ -42614,9 +42625,9 @@ const ListFirstResolver = props => {
42614
42625
  * searchText?: string,
42615
42626
  * searchNoMatchMode?: "remove" | "invisible_and_inert" | "muted" | "below",
42616
42627
  * loading?: boolean,
42617
- * loadingIndicator?: "skeleton" | "loader",
42628
+ * loadingFallback?: "skeleton" | "loader" | import("ignore:preact").ComponentChildren,
42618
42629
  * loadingSkeletonCount?: number,
42619
- * skeletonTemplate?: import("ignore:preact").ComponentChildren,
42630
+ * loadingSkeletonTemplate?: import("ignore:preact").ComponentChildren,
42620
42631
  * error?: boolean | import("ignore:preact").ComponentChildren,
42621
42632
  * separator?: boolean | import("ignore:preact").ComponentChildren,
42622
42633
  * lockSize?: boolean,
@@ -42629,6 +42640,11 @@ const ListFirstResolver = props => {
42629
42640
  * children?: import("ignore:preact").ComponentChildren,
42630
42641
  * [key: string]: any,
42631
42642
  * }>}
42643
+ * @param {"skeleton"|"loader"|import("ignore:preact").ComponentChildren} [props.loadingFallback="skeleton"]
42644
+ * What to display in place of the items while `loading`: `"skeleton"` renders
42645
+ * `loadingSkeletonCount` placeholder rows (look: `loadingSkeletonTemplate`),
42646
+ * `"loader"` a single centered spinner, and anything else is rendered as-is
42647
+ * in a row of its own. A falsy value displays nothing.
42632
42648
  */
42633
42649
  const List = createComponentResolver([ListFirstResolver, ListSelectableResolver, ListUI]);
42634
42650
  const ListContent = ({
@@ -43376,7 +43392,7 @@ const ListItemPresentation = props => {
43376
43392
  // A <List.Item skeleton> — a non-interactive placeholder row shown while a list
43377
43393
  // is loading. It is presentation-only (not tracked, not selectable, aria-hidden)
43378
43394
  // and reuses <Text loading> for the shimmer. Box layout props (padding, spacing…)
43379
- // pass through so a skeletonTemplate can match the real items' metrics; and when
43395
+ // pass through so a loadingSkeletonTemplate can match the real items' metrics; and when
43380
43396
  // children are provided they render as-is, so a template can reproduce a
43381
43397
  // multi-part item (e.g. title + subtitle) out of several <Text loading> bars.
43382
43398
  const ListItemSkeletonResolver = props => {
@@ -43617,7 +43633,7 @@ const LIST_ITEM_PSEUDO_ELEMENTS = ["::highlight"];
43617
43633
  * depending on whether the parent List has `multiple`). Requires
43618
43634
  * `value` and typically a <SelectableInput /> child.
43619
43635
  * skeleton — render a non-interactive placeholder row (a shimmering bar)
43620
- * instead of a real item. Used as the List `skeletonTemplate`
43636
+ * instead of a real item. Used as the List `loadingSkeletonTemplate`
43621
43637
  * while `loading`; Box layout props (padding…) pass through so the
43622
43638
  * placeholder can match the real items' metrics.
43623
43639
  * value — the JS value emitted by the list's action/uiAction when this item