@multiplatform.one/components 7.65.0 → 7.65.2

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.
Files changed (154) hide show
  1. package/dist/cjs/Alert/index.cjs +26 -5
  2. package/dist/cjs/Alert/index.native.js +26 -5
  3. package/dist/cjs/Alert/index.native.js.map +1 -1
  4. package/dist/cjs/images/Image/framing.cjs +29 -0
  5. package/dist/cjs/images/Image/framing.native.js +32 -0
  6. package/dist/cjs/images/Image/framing.native.js.map +1 -0
  7. package/dist/cjs/images/Image/shared.cjs +2 -2
  8. package/dist/cjs/images/Image/shared.native.js +2 -2
  9. package/dist/cjs/images/Image/shared.native.js.map +1 -1
  10. package/dist/cjs/views/Dashboard.cjs +16 -131
  11. package/dist/cjs/views/Dashboard.native.js +16 -131
  12. package/dist/cjs/views/Dashboard.native.js.map +1 -1
  13. package/dist/cjs/views/List.cjs +14 -189
  14. package/dist/cjs/views/List.native.js +14 -193
  15. package/dist/cjs/views/List.native.js.map +1 -1
  16. package/dist/cjs/views/ListGroup.cjs +181 -0
  17. package/dist/cjs/views/ListGroup.native.js +194 -0
  18. package/dist/cjs/views/ListGroup.native.js.map +1 -0
  19. package/dist/cjs/views/ListRow.cjs +266 -0
  20. package/dist/cjs/views/ListRow.native.js +274 -0
  21. package/dist/cjs/views/ListRow.native.js.map +1 -0
  22. package/dist/cjs/views/ShortcutCard.cjs +100 -0
  23. package/dist/cjs/views/ShortcutCard.native.js +104 -0
  24. package/dist/cjs/views/ShortcutCard.native.js.map +1 -0
  25. package/dist/cjs/views/index.cjs +3 -0
  26. package/dist/cjs/views/index.native.js +3 -0
  27. package/dist/cjs/views/index.native.js.map +1 -1
  28. package/dist/cjs/views/widgetChrome.cjs +93 -0
  29. package/dist/cjs/views/widgetChrome.native.js +95 -0
  30. package/dist/cjs/views/widgetChrome.native.js.map +1 -0
  31. package/dist/esm/Alert/index.mjs +27 -6
  32. package/dist/esm/Alert/index.mjs.map +1 -1
  33. package/dist/esm/Alert/index.native.js +27 -6
  34. package/dist/esm/Alert/index.native.js.map +1 -1
  35. package/dist/esm/images/Image/framing.mjs +4 -0
  36. package/dist/esm/images/Image/framing.mjs.map +1 -0
  37. package/dist/esm/images/Image/framing.native.js +4 -0
  38. package/dist/esm/images/Image/framing.native.js.map +1 -0
  39. package/dist/esm/images/Image/shared.mjs +2 -2
  40. package/dist/esm/images/Image/shared.mjs.map +1 -1
  41. package/dist/esm/images/Image/shared.native.js +2 -2
  42. package/dist/esm/images/Image/shared.native.js.map +1 -1
  43. package/dist/esm/views/Dashboard.mjs +6 -121
  44. package/dist/esm/views/Dashboard.mjs.map +1 -1
  45. package/dist/esm/views/Dashboard.native.js +6 -121
  46. package/dist/esm/views/Dashboard.native.js.map +1 -1
  47. package/dist/esm/views/List.mjs +8 -186
  48. package/dist/esm/views/List.mjs.map +1 -1
  49. package/dist/esm/views/List.native.js +8 -190
  50. package/dist/esm/views/List.native.js.map +1 -1
  51. package/dist/esm/views/ListGroup.mjs +144 -0
  52. package/dist/esm/views/ListGroup.mjs.map +1 -0
  53. package/dist/esm/views/ListGroup.native.js +154 -0
  54. package/dist/esm/views/ListGroup.native.js.map +1 -0
  55. package/dist/esm/views/ListRow.mjs +234 -0
  56. package/dist/esm/views/ListRow.mjs.map +1 -0
  57. package/dist/esm/views/ListRow.native.js +239 -0
  58. package/dist/esm/views/ListRow.native.js.map +1 -0
  59. package/dist/esm/views/ShortcutCard.mjs +75 -0
  60. package/dist/esm/views/ShortcutCard.mjs.map +1 -0
  61. package/dist/esm/views/ShortcutCard.native.js +76 -0
  62. package/dist/esm/views/ShortcutCard.native.js.map +1 -0
  63. package/dist/esm/views/index.mjs +2 -2
  64. package/dist/esm/views/index.mjs.map +1 -1
  65. package/dist/esm/views/index.native.js +2 -2
  66. package/dist/esm/views/index.native.js.map +1 -1
  67. package/dist/esm/views/widgetChrome.mjs +66 -0
  68. package/dist/esm/views/widgetChrome.mjs.map +1 -0
  69. package/dist/esm/views/widgetChrome.native.js +65 -0
  70. package/dist/esm/views/widgetChrome.native.js.map +1 -0
  71. package/dist/jsx/Alert/index.mjs +27 -6
  72. package/dist/jsx/Alert/index.mjs.map +1 -1
  73. package/dist/jsx/Alert/index.native.js +26 -5
  74. package/dist/jsx/Alert/index.native.js.map +1 -1
  75. package/dist/jsx/feedback/NotifyHost.native.js +1 -1
  76. package/dist/jsx/formLayouts/PreferencePanel.native.js +1 -1
  77. package/dist/jsx/images/Image/framing.mjs +4 -0
  78. package/dist/jsx/images/Image/framing.mjs.map +1 -0
  79. package/dist/jsx/images/Image/framing.native.js +32 -0
  80. package/dist/jsx/images/Image/framing.native.js.map +1 -0
  81. package/dist/jsx/images/Image/shared.mjs +2 -2
  82. package/dist/jsx/images/Image/shared.mjs.map +1 -1
  83. package/dist/jsx/images/Image/shared.native.js +2 -2
  84. package/dist/jsx/images/Image/shared.native.js.map +1 -1
  85. package/dist/jsx/index.native.js +1 -1
  86. package/dist/jsx/layouts/AsyncBoundary.native.js +1 -1
  87. package/dist/jsx/layouts/AsyncBoundary.native.js.map +1 -1
  88. package/dist/jsx/views/Dashboard.mjs +6 -121
  89. package/dist/jsx/views/Dashboard.mjs.map +1 -1
  90. package/dist/jsx/views/Dashboard.native.js +16 -131
  91. package/dist/jsx/views/Dashboard.native.js.map +1 -1
  92. package/dist/jsx/views/List.mjs +8 -186
  93. package/dist/jsx/views/List.mjs.map +1 -1
  94. package/dist/jsx/views/List.native.js +14 -193
  95. package/dist/jsx/views/List.native.js.map +1 -1
  96. package/dist/jsx/views/ListGroup.mjs +144 -0
  97. package/dist/jsx/views/ListGroup.mjs.map +1 -0
  98. package/dist/jsx/views/ListGroup.native.js +194 -0
  99. package/dist/jsx/views/ListGroup.native.js.map +1 -0
  100. package/dist/jsx/views/ListRow.mjs +234 -0
  101. package/dist/jsx/views/ListRow.mjs.map +1 -0
  102. package/dist/jsx/views/ListRow.native.js +274 -0
  103. package/dist/jsx/views/ListRow.native.js.map +1 -0
  104. package/dist/jsx/views/ShortcutCard.mjs +75 -0
  105. package/dist/jsx/views/ShortcutCard.mjs.map +1 -0
  106. package/dist/jsx/views/ShortcutCard.native.js +104 -0
  107. package/dist/jsx/views/ShortcutCard.native.js.map +1 -0
  108. package/dist/jsx/views/index.mjs +2 -2
  109. package/dist/jsx/views/index.mjs.map +1 -1
  110. package/dist/jsx/views/index.native.js +3 -0
  111. package/dist/jsx/views/index.native.js.map +1 -1
  112. package/dist/jsx/views/widgetChrome.mjs +66 -0
  113. package/dist/jsx/views/widgetChrome.mjs.map +1 -0
  114. package/dist/jsx/views/widgetChrome.native.js +95 -0
  115. package/dist/jsx/views/widgetChrome.native.js.map +1 -0
  116. package/package.json +9 -9
  117. package/src/Alert/Alert.spec.tsx +79 -0
  118. package/src/Alert/Alert.stories.tsx +32 -1
  119. package/src/Alert/index.tsx +54 -5
  120. package/src/images/Image/framing.ts +8 -0
  121. package/src/images/Image/shared.ts +2 -7
  122. package/src/overlayElevation.spec.tsx +3 -1
  123. package/src/views/Dashboard.tsx +5 -146
  124. package/src/views/Kanban.native.spec.tsx +2 -2
  125. package/src/views/List.tsx +22 -237
  126. package/src/views/ListGroup.spec.tsx +220 -0
  127. package/src/views/ListGroup.stories.tsx +83 -0
  128. package/src/views/ListGroup.tsx +189 -0
  129. package/src/views/ListRow.tsx +282 -0
  130. package/src/views/ShortcutCard.spec.tsx +40 -0
  131. package/src/views/ShortcutCard.stories.tsx +50 -1
  132. package/src/views/ShortcutCard.tsx +88 -0
  133. package/src/views/index.ts +6 -0
  134. package/src/views/widgetChrome.tsx +73 -0
  135. package/types/Alert/index.d.ts +9 -0
  136. package/types/Alert/index.d.ts.map +1 -1
  137. package/types/images/Image/framing.d.ts +7 -0
  138. package/types/images/Image/framing.d.ts.map +1 -0
  139. package/types/images/Image/shared.d.ts +1 -6
  140. package/types/images/Image/shared.d.ts.map +1 -1
  141. package/types/views/Dashboard.d.ts +2 -15
  142. package/types/views/Dashboard.d.ts.map +1 -1
  143. package/types/views/List.d.ts +3 -66
  144. package/types/views/List.d.ts.map +1 -1
  145. package/types/views/ListGroup.d.ts +43 -0
  146. package/types/views/ListGroup.d.ts.map +1 -0
  147. package/types/views/ListRow.d.ts +88 -0
  148. package/types/views/ListRow.d.ts.map +1 -0
  149. package/types/views/ShortcutCard.d.ts +26 -0
  150. package/types/views/ShortcutCard.d.ts.map +1 -0
  151. package/types/views/index.d.ts +1 -1
  152. package/types/views/index.d.ts.map +1 -1
  153. package/types/views/widgetChrome.d.ts +72 -0
  154. package/types/views/widgetChrome.d.ts.map +1 -0
@@ -12,12 +12,14 @@ import {
12
12
  warnBannedErrorWords,
13
13
  compareSizeTokens,
14
14
  edgeColorAt,
15
+ hairlineWidth,
15
16
  useAccentTintedSurface,
16
17
  useLegibleInkOn,
17
18
  useReadableTextOn,
18
19
  } from "@multiplatform.one/theme";
19
20
  import { useId, useState, type ReactNode } from "react";
20
21
  import { useTranslation } from "../shared/i18n";
22
+ import { Button } from "../Button";
21
23
 
22
24
  import { CheckCircleIcon, InfoIcon, WarningIcon, XCircleIcon, XIcon } from "@phosphor-icons/react";
23
25
  import type { GetProps, SizeTokens } from "tamagui";
@@ -27,6 +29,8 @@ import { SizableText, View, XStack, YStack, isWeb, styled, useTheme } from "tama
27
29
 
28
30
  export type AlertIntent = "info" | "success" | "warning" | "error";
29
31
 
32
+ export type AlertPlacement = "inline" | "bar";
33
+
30
34
  export interface AlertProps extends Omit<GetProps<typeof AlertFrame>, "role" | "children"> {
31
35
  /** Semantic intent. info rides the accent hue; the rest use the semantic ramp. */
32
36
  intent?: AlertIntent;
@@ -42,6 +46,8 @@ export interface AlertProps extends Omit<GetProps<typeof AlertFrame>, "role" | "
42
46
  actionLabel?: string;
43
47
  /** Press handler for the convenience action button. */
44
48
  onAction?: () => void;
49
+ /** Accessible name for the convenience action when the label alone is too terse. */
50
+ actionAccessibilityLabel?: string;
45
51
  /** Custom secondary action slot (Primer/Polaris: at most two actions). */
46
52
  secondaryAction?: ReactNode;
47
53
  /** Convenience secondary action label. */
@@ -56,6 +62,12 @@ export interface AlertProps extends Omit<GetProps<typeof AlertFrame>, "role" | "
56
62
  visible?: boolean;
57
63
  /** Uncontrolled initial visibility (default true). */
58
64
  defaultVisible?: boolean;
65
+ /**
66
+ * `inline` (default): a rounded box in the content flow. `bar`: pinned edge
67
+ * to edge across the top of a screen (an update waiting, offline): square
68
+ * corners, no stripe, one hairline along its bottom edge.
69
+ */
70
+ placement?: AlertPlacement;
59
71
  /**
60
72
  * Control size token (Tamagui's own `size`, e.g. `"$3"` in a table). Below
61
73
  * `$true` the icon and dismiss glyph draw one step smaller.
@@ -220,6 +232,7 @@ function hostData(attrs: Record<string, string>): Record<string, unknown> {
220
232
 
221
233
  function AlertAction({
222
234
  label,
235
+ accessibilityLabel,
223
236
  onPress,
224
237
  nestedPx,
225
238
  hitSlop,
@@ -230,6 +243,7 @@ function AlertAction({
230
243
  radiusOuter,
231
244
  }: {
232
245
  label: string;
246
+ accessibilityLabel?: string;
233
247
  onPress?: () => void;
234
248
  nestedPx: number;
235
249
  hitSlop: { top: number; bottom: number; left: number; right: number };
@@ -245,7 +259,7 @@ function AlertAction({
245
259
  <AlertActionTarget
246
260
  group={"alertAction" as unknown as undefined}
247
261
  className="mp-chip-dismiss"
248
- aria-label={label}
262
+ aria-label={accessibilityLabel ?? label}
249
263
  {...pressTargetStyle()}
250
264
  marginVertical={-outset}
251
265
  marginHorizontal={-hOutset}
@@ -277,6 +291,7 @@ function AlertInner({
277
291
  action,
278
292
  actionLabel,
279
293
  onAction,
294
+ actionAccessibilityLabel,
280
295
  secondaryAction,
281
296
  secondaryActionLabel,
282
297
  onSecondaryAction,
@@ -285,6 +300,7 @@ function AlertInner({
285
300
  visible,
286
301
  defaultVisible = true,
287
302
  size,
303
+ placement = "inline",
288
304
  ...props
289
305
  }: AlertProps) {
290
306
  const { t } = useTranslation();
@@ -347,13 +363,16 @@ function AlertInner({
347
363
  />
348
364
  );
349
365
 
366
+ const bar = placement === "bar";
350
367
  const hasPrimary = action != null || Boolean(actionLabel);
351
368
  const hasSecondary = secondaryAction != null || Boolean(secondaryActionLabel);
352
369
  const hasActions = hasPrimary || hasSecondary;
353
370
  // Primer: single-line keeps actions inline; title+body or two actions wrap
354
371
  // below the copy so the dismiss X keeps a full 44px floor (LC-54).
372
+ // A bar keeps its action trailing and centred: stacked under the copy it
373
+ // left the right side of a full-width strip empty.
355
374
  const stackedActions = Boolean(
356
- hasActions && ((title != null && children != null) || (hasPrimary && hasSecondary)),
375
+ !bar && hasActions && ((title != null && children != null) || (hasPrimary && hasSecondary)),
357
376
  );
358
377
  const dismissBesideAction = hasActions && !stackedActions;
359
378
  const actionBesideAdjacent = hasSecondary || dismissBesideAction;
@@ -371,7 +390,27 @@ function AlertInner({
371
390
  isInfo && node != null ? <Intent name="accent">{node}</Intent> : node;
372
391
  const primaryAction =
373
392
  accentSlot(action) ??
374
- (actionLabel ? <AlertAction label={actionLabel} onPress={onAction} {...actionShared} /> : null);
393
+ (actionLabel ? (
394
+ bar ? (
395
+ <Button
396
+ accent={isInfo}
397
+ success={intent === "success"}
398
+ warning={intent === "warning"}
399
+ error={intent === "error"}
400
+ aria-label={actionAccessibilityLabel ?? actionLabel}
401
+ onPress={onAction}
402
+ >
403
+ {actionLabel}
404
+ </Button>
405
+ ) : (
406
+ <AlertAction
407
+ label={actionLabel}
408
+ accessibilityLabel={actionAccessibilityLabel}
409
+ onPress={onAction}
410
+ {...actionShared}
411
+ />
412
+ )
413
+ ) : null);
375
414
  const secondaryNode =
376
415
  accentSlot(secondaryAction) ??
377
416
  (secondaryActionLabel ? (
@@ -405,6 +444,15 @@ function AlertInner({
405
444
  borderStartColor: isInfo ? componentColors.indicator.mark : ("$color9" as const),
406
445
  };
407
446
 
447
+ const barEdge = bar
448
+ ? {
449
+ alignItems: "center" as const,
450
+ borderRadius: 0,
451
+ borderWidth: 0,
452
+ borderBottomWidth: Math.max(knobProps.surface.borderWidth, hairlineWidth),
453
+ }
454
+ : null;
455
+
408
456
  return (
409
457
  <AlertFrame
410
458
  // Interruptive intents announce assertively; the rest politely.
@@ -419,14 +467,15 @@ function AlertInner({
419
467
  {...knobProps.panelPadding}
420
468
  backgroundColor={isInfo ? (wash ?? "$color3") : "$color3"}
421
469
  borderColor={edgeColorAt("$color6", knobProps.borderWidthStop)}
422
- {...stripe}
470
+ {...(bar ? barEdge : stripe)}
423
471
  {...transitionProps(knobProps.motion.control)}
424
472
  {...props}
425
473
  {...hostData({
474
+ "data-placement": placement,
426
475
  "data-size-token": knobProps.sizeToken,
427
476
  "data-layout": stackedActions ? "stacked" : "inline",
428
477
  "data-nested-px": String(nestedPx),
429
- "data-accent-stripe": "3",
478
+ "data-accent-stripe": bar ? "0" : "3",
430
479
  })}
431
480
  >
432
481
  {iconNode ? (
@@ -0,0 +1,8 @@
1
+ import { createContext } from "react";
2
+
3
+ /**
4
+ * LC-155: a slot that owns a thumbnail's frame (a list row's media slot)
5
+ * provides `false`, so thumbnails inside it draw no tile of their own. An
6
+ * explicit `framed` prop still wins.
7
+ */
8
+ export const ImageFramingContext = createContext<boolean | undefined>(undefined);
@@ -1,14 +1,9 @@
1
- import { createContext, useMemo } from "react";
1
+ import { useMemo } from "react";
2
2
  import type { ImageURISource } from "react-native";
3
3
  import { useAssets } from "../../hooks/useAssets";
4
4
  import type { ImageThumbnailSize } from "./types";
5
5
 
6
- /**
7
- * LC-155: a slot that owns a thumbnail's frame (a list row's media slot)
8
- * provides `false`, so thumbnails inside it draw no tile of their own. An
9
- * explicit `framed` prop still wins.
10
- */
11
- export const ImageFramingContext = createContext<boolean | undefined>(undefined);
6
+ export { ImageFramingContext } from "./framing";
12
7
 
13
8
  export function isThumbnailSize(size: unknown): size is ImageThumbnailSize {
14
9
  return size === "extraSmall" || size === "small" || size === "medium" || size === "large";
@@ -173,7 +173,9 @@ describe("nested surfaces stop re-elevating (WP-c2)", () => {
173
173
  expect(bgAtoms("inner")).toEqual(["_bg-color2"]);
174
174
  // LC-151: the top-level card lifts by a hair and draws a hairline edge;
175
175
  // the card on it does neither, so shadows never stack.
176
- expect(paintedShadow("outer")).toContain("0px 2px 3px");
176
+ expect(paintedShadow("outer")).toMatch(
177
+ /^0px 1px 2px var\(--shadow1\), 0px \d+px \d+px var\(--shadow2\)$/,
178
+ );
177
179
  expect(paintedShadow("outer")).not.toBe(overlaySmallPaint);
178
180
  expect(getComputedStyle(frame("outer")).borderTopWidth).not.toBe("0px");
179
181
  expect(paintedShadow("inner")).toBe("");
@@ -1,4 +1,3 @@
1
- import { IconSlot } from "@multiplatform.one/theme";
2
1
  import { Meter } from "../Meter";
3
2
  import { ChartDataView } from "../charts/ChartDataView";
4
3
  import { BarChart } from "../charts/BarChart";
@@ -13,26 +12,15 @@ import {
13
12
  formatNumber,
14
13
  formatPercent,
15
14
  useResolvedKnobs,
16
- useChartPalette,
17
- useReadableTextOn,
18
15
  } from "@multiplatform.one/theme";
19
16
  import React, { useCallback, useMemo, useState, type ReactNode } from "react";
20
17
  import { useTranslation } from "../shared/i18n";
21
- import {
22
- SizableText,
23
- Text,
24
- XStack,
25
- YStack,
26
- isWeb,
27
- type YStackProps,
28
- type FontSizeTokens,
29
- H2,
30
- H3,
31
- H4,
32
- H5,
33
- H6,
34
- } from "tamagui";
18
+ import { Text, XStack, YStack, isWeb, type YStackProps, H2, H3, H4, H5, H6 } from "tamagui";
35
19
  import { ScrollView } from "../ScrollView";
20
+ import { NestedIconWell, useWidgetChrome } from "./widgetChrome";
21
+ import { ShortcutCard, type ShortcutConfig } from "./ShortcutCard";
22
+
23
+ export { ShortcutCard, type ShortcutCardProps, type ShortcutConfig } from "./ShortcutCard";
36
24
 
37
25
  /**
38
26
  * LC-17 SECTION-HEADING-SCALE + DG-A11Y-02: card sub-titles read at the ONE
@@ -42,20 +30,6 @@ import { ScrollView } from "../ScrollView";
42
30
  const SECTION_HEADING_TAGS = { 2: H2, 3: H3, 4: H4, 5: H5, 6: H6 } as const;
43
31
  export type CardHeadingLevel = 2 | 3 | 4 | 5 | 6;
44
32
 
45
- function splitNestedControl(nested: {
46
- px: number;
47
- hitSlop: { top: number; bottom: number; left: number; right: number };
48
- width: number;
49
- height: number;
50
- minWidth: number;
51
- maxWidth: number;
52
- minHeight: number;
53
- maxHeight: number;
54
- }) {
55
- const { px, hitSlop, ...box } = nested;
56
- return { px, hitSlop, box };
57
- }
58
-
59
33
  function trendFill(color: string): string {
60
34
  if (color === componentColors.semantic.success) return "$green4";
61
35
  if (color === componentColors.semantic.error) return "$red4";
@@ -152,18 +126,6 @@ export interface ProgressConfig {
152
126
  color?: string;
153
127
  }
154
128
 
155
- /**
156
- * Frappe workspace shortcut: label + nested count pill.
157
- */
158
- export interface ShortcutConfig {
159
- id: string;
160
- title: string;
161
- count?: number | string;
162
- icon?: React.ReactNode;
163
- color?: string;
164
- onClick?: () => void;
165
- }
166
-
167
129
  /**
168
130
  * Frappe link card / Polaris resource list / Grafana table-lite.
169
131
  */
@@ -235,55 +197,6 @@ export interface DashboardProps extends Omit<YStackProps, "children"> {
235
197
  // Shared card chrome
236
198
  // ============================================================================
237
199
 
238
- function useWidgetChrome(onPress?: YStackProps["onPress"]) {
239
- const resolved = useResolvedKnobs();
240
- const { knobProps, control } = resolved;
241
- const nested = splitNestedControl(knobProps.nestedControl);
242
- const interactive = onPress
243
- ? {
244
- cursor: "pointer" as const,
245
- hoverStyle: control.hoverKnobProps,
246
- pressStyle: control.pressKnobProps,
247
- focusVisibleStyle: control.focusVisibleKnobProps,
248
- onPress,
249
- role: "button" as const,
250
- }
251
- : undefined;
252
- return { knobProps, control, nested, interactive };
253
- }
254
-
255
- function NestedIconWell({
256
- color,
257
- box,
258
- px,
259
- radius,
260
- children,
261
- }: {
262
- color?: string;
263
- box: ReturnType<typeof splitNestedControl>["box"];
264
- px: number;
265
- radius: object;
266
- children: ReactNode;
267
- }) {
268
- const identity = useChartPalette().single;
269
- const fill = color || identity;
270
- const ink = useReadableTextOn(fill);
271
- return (
272
- <YStack
273
- {...box}
274
- {...radius}
275
- alignItems="center"
276
- justifyContent="center"
277
- backgroundColor={fill as any}
278
- {...{ color: ink }}
279
- overflow="hidden"
280
- data-nested-px={px}
281
- >
282
- <IconSlot icon={children} color={ink} />
283
- </YStack>
284
- );
285
- }
286
-
287
200
  function TrendPill({
288
201
  symbol,
289
202
  value,
@@ -635,60 +548,6 @@ export function ProgressCard({ config, ...stackProps }: ProgressCardProps) {
635
548
  );
636
549
  }
637
550
 
638
- export interface ShortcutCardProps extends Omit<YStackProps, "children"> {
639
- config: ShortcutConfig;
640
- }
641
-
642
- export function ShortcutCard({ config, ...stackProps }: ShortcutCardProps) {
643
- const { knobProps, nested, interactive } = useWidgetChrome(config.onClick);
644
- const { px, box, hitSlop } = nested;
645
-
646
- return (
647
- <Card
648
- width="100%"
649
- elevation={knobProps.elevation}
650
- {...knobProps.surface}
651
- {...interactive}
652
- hitSlop={config.onClick ? hitSlop : undefined}
653
- {...stackProps}
654
- >
655
- <XStack alignItems="center" {...knobProps.gap}>
656
- {config.icon ? (
657
- <NestedIconWell color={config.color} box={box} px={px} radius={knobProps.borderRadius}>
658
- {config.icon}
659
- </NestedIconWell>
660
- ) : null}
661
- <SizableText
662
- size={knobProps.sizeToken as FontSizeTokens}
663
- {...knobProps.heading}
664
- flex={1}
665
- numberOfLines={1}
666
- >
667
- {config.title}
668
- </SizableText>
669
- {config.count != null && config.count !== "" ? (
670
- <XStack
671
- height={px}
672
- minHeight={px}
673
- maxHeight={px}
674
- minWidth={px}
675
- paddingHorizontal="$2"
676
- alignItems="center"
677
- justifyContent="center"
678
- backgroundColor="$color4"
679
- {...knobProps.borderRadius}
680
- data-nested-px={px}
681
- >
682
- <Text {...knobProps.label} color={knobProps.textAccentColor}>
683
- {config.count}
684
- </Text>
685
- </XStack>
686
- ) : null}
687
- </XStack>
688
- </Card>
689
- );
690
- }
691
-
692
551
  export interface ListCardProps extends Omit<YStackProps, "children"> {
693
552
  config: ListConfig;
694
553
  headingLevel?: CardHeadingLevel;
@@ -71,8 +71,8 @@ describe("native Kanban card elevation (FZ-7740)", () => {
71
71
  for (const stop of ["medium", "large"] as const) {
72
72
  it(`paints the theme elevation recipe at ${stop} and keeps the shadow unclipped`, () => {
73
73
  const card = renderBoard(stop);
74
- expect(card.shadowColor).toBe("$shadowColor");
75
- expect(card.shadowOpacity).toBe(1);
74
+ expect(card.shadowColor).toBe("rgb(0,0,0)");
75
+ expect(card.shadowOpacity).toBe(0.12);
76
76
  expect(card.shadowRadius).toBeGreaterThan(0);
77
77
  expect(card.elevation).toBeGreaterThan(0);
78
78
  expect(card.overflow).toBe("visible");
@@ -1,10 +1,8 @@
1
1
  import { componentColors } from "../componentColors";
2
- import { ImageFramingContext } from "../images/Image/shared";
3
2
  import { AsyncBoundary } from "../layouts/AsyncBoundary";
4
3
  import { Spinner } from "@multiplatform.one/forms";
5
4
  import { FlashList, type FlashListRef } from "@shopify/flash-list";
6
5
  import {
7
- IconSlot,
8
6
  MIN_PRESS_TARGET,
9
7
  containerCapProps,
10
8
  ensureKeyboardModalityTracking,
@@ -12,10 +10,7 @@ import {
12
10
  hairline,
13
11
  hairlineWidth,
14
12
  keyboardFocusRingProps,
15
- recipeKeyAbove,
16
- sizeRecipeForToken,
17
13
  stackRadiusProps,
18
- type SizeRecipeToken,
19
14
  Surface,
20
15
  useResolvedKnobs,
21
16
  useTouchSurface,
@@ -24,17 +19,29 @@ import {
24
19
  } from "@multiplatform.one/theme";
25
20
  import { useHotkey } from "@tanstack/react-hotkeys";
26
21
  import type { RegisterableHotkey } from "@tanstack/react-hotkeys";
27
- import React, {
28
- createContext,
29
- useCallback,
30
- useContext,
31
- useId,
32
- useRef,
33
- useState,
34
- type ReactNode,
35
- } from "react";
22
+ import React, { useCallback, useId, useRef, useState, type ReactNode } from "react";
36
23
  import { useTranslation } from "../shared/i18n";
37
- import { Text, View, XStack, YStack, isWeb, type SizeTokens, type YStackProps } from "tamagui";
24
+ import { View, XStack, YStack, type SizeTokens, type YStackProps } from "tamagui";
25
+ import { ListItemStateContext, listRowTouchProps, type ListItemState } from "./ListRow";
26
+
27
+ export {
28
+ ListRow,
29
+ ListRowFact,
30
+ ListRowMeta,
31
+ listLeadingIconSize,
32
+ listRowPressDelayMs,
33
+ listRowTouchProps,
34
+ useListItemState,
35
+ type ListItemState,
36
+ type ListRowProps,
37
+ } from "./ListRow";
38
+ export {
39
+ ListGroup,
40
+ ListGroupItem,
41
+ type ListGroupItemProps,
42
+ type ListGroupProps,
43
+ type ListGroupVariant,
44
+ } from "./ListGroup";
38
45
 
39
46
  /**
40
47
  * Configurable hotkey bindings for the List component.
@@ -56,228 +63,6 @@ export interface ListHotkeys {
56
63
  pageUp?: RegisterableHotkey;
57
64
  }
58
65
 
59
- /** Per-row interaction state passed to `renderItem` and `ListRow`. */
60
- export interface ListItemState {
61
- selected: boolean;
62
- focused: boolean;
63
- /** Ink for the selected row (LC-05 selection tier) */
64
- selectedInk?: string;
65
- }
66
-
67
- /** True inside a ListRow with a subtitle: its trailing meta is a caption. */
68
- const ListRowTwoLineContext = createContext(false);
69
-
70
- const ListItemStateContext = createContext<ListItemState>({
71
- selected: false,
72
- focused: false,
73
- });
74
-
75
- /** Read the current row's selection/focus. Defaults to idle outside a List. */
76
- export function useListItemState(): ListItemState {
77
- return useContext(ListItemStateContext);
78
- }
79
-
80
- /**
81
- * Subject-led document row (Desk list / Linear / Finder): leading glyph or
82
- * media, title (+ optional subtitle), trailing muted meta. Sits inside List's
83
- * stacked-group chrome — does not paint its own radius, fill, or ring.
84
- *
85
- * LC-155 ROW-ANATOMY: the title is the headline role, the subtitle the meta
86
- * role on one line, and with a subtitle the row is a two-line Mail row whose
87
- * trailing meta is a caption at the top right.
88
- */
89
- export interface ListRowProps {
90
- /** Leading glyph slot — fixed box so titles share one x (LC-08). */
91
- icon?: ReactNode;
92
- /**
93
- * Leading media slot (an avatar, a thumbnail): a `$true` square, and a
94
- * thumbnail inside it draws no tile of its own.
95
- */
96
- media?: ReactNode;
97
- title: ReactNode;
98
- subtitle?: ReactNode;
99
- /** Trailing Finder/Desk columns (dates, size, kind, status). */
100
- meta?: ReactNode;
101
- }
102
-
103
- function RowText({
104
- children,
105
- ...props
106
- }: { children: ReactNode } & React.ComponentProps<typeof Text>) {
107
- if (children == null || children === false) return null;
108
- if (typeof children === "string" || typeof children === "number") {
109
- return <Text {...props}>{children}</Text>;
110
- }
111
- return <>{children}</>;
112
- }
113
-
114
- /**
115
- * Trailing Finder/Desk column. Inherits selected fill ink (LC-71). `width`
116
- * fixes the column (a size token or a measured px) so the same column lines
117
- * up from row to row; rich cell content (pills, formatted cells) renders in a
118
- * box of that width instead of a Text run.
119
- */
120
- export function ListRowMeta({
121
- children,
122
- width,
123
- color,
124
- }: {
125
- children: ReactNode;
126
- width?: number | SizeTokens;
127
- color?: string;
128
- }) {
129
- const { knobProps } = useResolvedKnobs();
130
- const { selected, selectedInk } = useListItemState();
131
- const twoLine = useContext(ListRowTwoLineContext);
132
- const type = twoLine ? knobProps.textRole.caption : knobProps.label;
133
- const ink = color ?? (twoLine ? knobProps.textRole.caption.color : knobProps.textAccentColor);
134
- const resolved = selected && selectedInk ? selectedInk : ink;
135
- if (typeof children !== "string" && typeof children !== "number") {
136
- return (
137
- <XStack
138
- width={width}
139
- flexShrink={0}
140
- minWidth={0}
141
- alignItems="center"
142
- justifyContent="flex-end"
143
- overflow="hidden"
144
- {...({ "data-list-slot": "trailing", color: resolved } as Record<string, unknown>)}
145
- >
146
- {children}
147
- </XStack>
148
- );
149
- }
150
- return (
151
- <Text
152
- {...type}
153
- color={resolved}
154
- numberOfLines={1}
155
- width={width}
156
- flexShrink={0}
157
- textAlign="right"
158
- userSelect="none"
159
- >
160
- {children}
161
- </Text>
162
- );
163
- }
164
-
165
- /**
166
- * The leading glyph of a (two-line) list row: the control icon two recipe
167
- * keys above the row's size token (20 at the default `$true`), read off the
168
- * scale so a preset restyles it with every other control icon.
169
- */
170
- export function listLeadingIconSize(sizeToken: string): number {
171
- return sizeRecipeForToken(recipeKeyAbove(recipeKeyAbove(sizeToken as SizeRecipeToken))).iconSize;
172
- }
173
-
174
- export function ListRow({ icon, media, title, subtitle, meta }: ListRowProps) {
175
- const { knobProps } = useResolvedKnobs();
176
- const { selected, selectedInk } = useListItemState();
177
- const { headline, meta: metaRole } = knobProps.textRole;
178
- const selectedOverride = selected && selectedInk ? selectedInk : undefined;
179
- const ink = selectedOverride ?? knobProps.textAccentColor;
180
- const iconSize = listLeadingIconSize(knobProps.sizeToken);
181
- const leading = icon ? <IconSlot icon={icon} size={iconSize} color={ink} /> : null;
182
- const twoLine = subtitle != null && subtitle !== false;
183
-
184
- return (
185
- <ListRowTwoLineContext.Provider value={twoLine}>
186
- <XStack
187
- alignItems="center"
188
- {...knobProps.gap}
189
- flex={1}
190
- minWidth={0}
191
- width="100%"
192
- {...(twoLine ? { paddingVertical: "$1" } : null)}
193
- >
194
- {media ? (
195
- <View
196
- width="$true"
197
- height="$true"
198
- flexShrink={0}
199
- alignItems="center"
200
- justifyContent="center"
201
- overflow="hidden"
202
- {...({ "data-list-slot": "media" } as Record<string, unknown>)}
203
- >
204
- <ImageFramingContext.Provider value={false}>{media}</ImageFramingContext.Provider>
205
- </View>
206
- ) : null}
207
- {leading ? (
208
- <View
209
- width={iconSize}
210
- height={iconSize}
211
- flexShrink={0}
212
- alignItems="center"
213
- justifyContent="center"
214
- {...({ "data-list-slot": "icon", color: ink } as Record<string, unknown>)}
215
- >
216
- {leading}
217
- </View>
218
- ) : null}
219
- <YStack
220
- flex={1}
221
- minWidth={0}
222
- {...({ "data-list-slot": "title" } as Record<string, unknown>)}
223
- >
224
- <RowText
225
- {...knobProps.body}
226
- {...headline}
227
- color={selectedOverride ?? headline.color}
228
- numberOfLines={1}
229
- userSelect="none"
230
- >
231
- {title}
232
- </RowText>
233
- {twoLine ? (
234
- <RowText
235
- {...knobProps.body}
236
- {...metaRole}
237
- color={selectedOverride ?? metaRole.color}
238
- opacity={selected ? 0.85 : 1}
239
- numberOfLines={1}
240
- userSelect="none"
241
- >
242
- {subtitle}
243
- </RowText>
244
- ) : null}
245
- </YStack>
246
- {meta != null && meta !== false ? (
247
- <XStack
248
- alignItems="center"
249
- {...knobProps.gap}
250
- flexShrink={0}
251
- {...(twoLine ? { alignSelf: "flex-start" } : null)}
252
- {...({ "data-list-slot": "meta" } as Record<string, unknown>)}
253
- >
254
- {typeof meta === "string" || typeof meta === "number" ? (
255
- <ListRowMeta>{meta}</ListRowMeta>
256
- ) : (
257
- meta
258
- )}
259
- </XStack>
260
- ) : null}
261
- </XStack>
262
- </ListRowTwoLineContext.Provider>
263
- );
264
- }
265
-
266
- /**
267
- * A row in a scroller waits this long before it paints its press, the delay
268
- * UIScrollView gives its content: a touch that becomes a scroll never fills
269
- * the row it started on (LC-147).
270
- */
271
- export const listRowPressDelayMs = 150;
272
-
273
- /** What a touch surface adds to a row: the 44 floor and, on native, the press delay. */
274
- export function listRowTouchProps(touch: boolean, native = !isWeb) {
275
- if (!touch) return {};
276
- return native
277
- ? { minHeight: MIN_PRESS_TARGET, delayPressIn: listRowPressDelayMs }
278
- : { minHeight: MIN_PRESS_TARGET };
279
- }
280
-
281
66
  /**
282
67
  * Props for the generic List component.
283
68
  *