@multiplatform.one/components 7.90.6 → 8.1.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/dist/cjs/ChatTurn/index.cjs +105 -0
- package/dist/cjs/ChatTurn/index.native.js +109 -0
- package/dist/cjs/ChatTurn/index.native.js.map +1 -0
- package/dist/cjs/Chip/index.cjs +50 -0
- package/dist/cjs/Chip/index.native.js +52 -1
- package/dist/cjs/Chip/index.native.js.map +1 -1
- package/dist/cjs/DropDownPanel/index.cjs +101 -0
- package/dist/cjs/DropDownPanel/index.native.js +109 -0
- package/dist/cjs/DropDownPanel/index.native.js.map +1 -0
- package/dist/cjs/DropdownMenu/index.cjs +1 -2
- package/dist/cjs/DropdownMenu/index.native.js +1 -2
- package/dist/cjs/DropdownMenu/index.native.js.map +1 -1
- package/dist/cjs/SwipeDismissRow/index.cjs +137 -0
- package/dist/cjs/SwipeDismissRow/index.native.js +149 -0
- package/dist/cjs/SwipeDismissRow/index.native.js.map +1 -0
- package/dist/cjs/appShell/AppShell.cjs +0 -1
- package/dist/cjs/appShell/AppShell.native.js +0 -1
- package/dist/cjs/appShell/AppShell.native.js.map +1 -1
- package/dist/cjs/index.cjs +6 -0
- package/dist/cjs/index.gnome.cjs +293 -0
- package/dist/cjs/index.gnome.native.js +296 -0
- package/dist/cjs/index.gnome.native.js.map +1 -0
- package/dist/cjs/index.native.js +6 -0
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/layouts/page.cjs +0 -3
- package/dist/cjs/layouts/page.native.js +0 -3
- package/dist/cjs/layouts/page.native.js.map +1 -1
- package/dist/cjs/surfaces.cjs +1 -11
- package/dist/cjs/surfaces.native.js +0 -10
- package/dist/cjs/surfaces.native.js.map +1 -1
- package/dist/esm/ChatTurn/index.mjs +80 -0
- package/dist/esm/ChatTurn/index.mjs.map +1 -0
- package/dist/esm/ChatTurn/index.native.js +81 -0
- package/dist/esm/ChatTurn/index.native.js.map +1 -0
- package/dist/esm/Chip/index.mjs +50 -0
- package/dist/esm/Chip/index.mjs.map +1 -1
- package/dist/esm/Chip/index.native.js +52 -1
- package/dist/esm/Chip/index.native.js.map +1 -1
- package/dist/esm/DropDownPanel/index.mjs +76 -0
- package/dist/esm/DropDownPanel/index.mjs.map +1 -0
- package/dist/esm/DropDownPanel/index.native.js +81 -0
- package/dist/esm/DropDownPanel/index.native.js.map +1 -0
- package/dist/esm/DropdownMenu/index.mjs +1 -2
- package/dist/esm/DropdownMenu/index.mjs.map +1 -1
- package/dist/esm/DropdownMenu/index.native.js +1 -2
- package/dist/esm/DropdownMenu/index.native.js.map +1 -1
- package/dist/esm/SwipeDismissRow/index.mjs +110 -0
- package/dist/esm/SwipeDismissRow/index.mjs.map +1 -0
- package/dist/esm/SwipeDismissRow/index.native.js +119 -0
- package/dist/esm/SwipeDismissRow/index.native.js.map +1 -0
- package/dist/esm/appShell/AppShell.mjs +0 -1
- package/dist/esm/appShell/AppShell.mjs.map +1 -1
- package/dist/esm/appShell/AppShell.native.js +0 -1
- package/dist/esm/appShell/AppShell.native.js.map +1 -1
- package/dist/esm/index.gnome.mjs +69 -0
- package/dist/esm/index.gnome.mjs.map +1 -0
- package/dist/esm/index.gnome.native.js +69 -0
- package/dist/esm/index.gnome.native.js.map +1 -0
- package/dist/esm/index.mjs +5 -1
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/index.native.js +5 -1
- package/dist/esm/index.native.js.map +1 -1
- package/dist/esm/layouts/page.mjs +0 -3
- package/dist/esm/layouts/page.mjs.map +1 -1
- package/dist/esm/layouts/page.native.js +0 -3
- package/dist/esm/layouts/page.native.js.map +1 -1
- package/dist/esm/surfaces.mjs +3 -8
- package/dist/esm/surfaces.mjs.map +1 -1
- package/dist/esm/surfaces.native.js +3 -8
- package/dist/esm/surfaces.native.js.map +1 -1
- package/dist/jsx/ChatTurn/index.mjs +80 -0
- package/dist/jsx/ChatTurn/index.mjs.map +1 -0
- package/dist/jsx/ChatTurn/index.native.js +109 -0
- package/dist/jsx/ChatTurn/index.native.js.map +1 -0
- package/dist/jsx/Chip/index.mjs +50 -0
- package/dist/jsx/Chip/index.mjs.map +1 -1
- package/dist/jsx/Chip/index.native.js +52 -1
- package/dist/jsx/Chip/index.native.js.map +1 -1
- package/dist/jsx/DropDownPanel/index.mjs +76 -0
- package/dist/jsx/DropDownPanel/index.mjs.map +1 -0
- package/dist/jsx/DropDownPanel/index.native.js +109 -0
- package/dist/jsx/DropDownPanel/index.native.js.map +1 -0
- package/dist/jsx/DropdownMenu/index.mjs +1 -2
- package/dist/jsx/DropdownMenu/index.mjs.map +1 -1
- package/dist/jsx/DropdownMenu/index.native.js +1 -2
- package/dist/jsx/DropdownMenu/index.native.js.map +1 -1
- package/dist/jsx/SwipeDismissRow/index.mjs +110 -0
- package/dist/jsx/SwipeDismissRow/index.mjs.map +1 -0
- package/dist/jsx/SwipeDismissRow/index.native.js +149 -0
- package/dist/jsx/SwipeDismissRow/index.native.js.map +1 -0
- package/dist/jsx/appShell/AppShell.mjs +0 -1
- package/dist/jsx/appShell/AppShell.mjs.map +1 -1
- package/dist/jsx/appShell/AppShell.native.js +0 -1
- package/dist/jsx/appShell/AppShell.native.js.map +1 -1
- package/dist/jsx/index.gnome.mjs +69 -0
- package/dist/jsx/index.gnome.mjs.map +1 -0
- package/dist/jsx/index.gnome.native.js +296 -0
- package/dist/jsx/index.gnome.native.js.map +1 -0
- package/dist/jsx/index.js +5 -1
- package/dist/jsx/index.js.map +1 -1
- package/dist/jsx/index.mjs +5 -1
- package/dist/jsx/index.mjs.map +1 -1
- package/dist/jsx/index.native.js +6 -0
- package/dist/jsx/index.native.js.map +1 -1
- package/dist/jsx/layouts/page.mjs +0 -3
- package/dist/jsx/layouts/page.mjs.map +1 -1
- package/dist/jsx/layouts/page.native.js +0 -3
- package/dist/jsx/layouts/page.native.js.map +1 -1
- package/dist/jsx/surfaces.mjs +3 -8
- package/dist/jsx/surfaces.mjs.map +1 -1
- package/dist/jsx/surfaces.native.js +0 -10
- package/dist/jsx/surfaces.native.js.map +1 -1
- package/package.json +20 -8
- package/src/ChatTurn/ChatTurn.spec.tsx +75 -0
- package/src/ChatTurn/ChatTurn.stories.tsx +61 -0
- package/src/ChatTurn/index.tsx +91 -0
- package/src/Chip/Chip.stories.tsx +38 -1
- package/src/Chip/Chip.trailingToggle.spec.tsx +99 -0
- package/src/Chip/index.tsx +72 -0
- package/src/DropDownPanel/DropDownPanel.spec.tsx +55 -0
- package/src/DropDownPanel/DropDownPanel.stories.tsx +69 -0
- package/src/DropDownPanel/index.tsx +87 -0
- package/src/DropdownMenu/index.tsx +0 -1
- package/src/SheetModal/SheetModal.menus.spec.tsx +9 -9
- package/src/SwipeDismissRow/SwipeDismissRow.spec.tsx +48 -0
- package/src/SwipeDismissRow/SwipeDismissRow.stories.tsx +59 -0
- package/src/SwipeDismissRow/index.tsx +150 -0
- package/src/appShell/AppShell.tsx +1 -1
- package/src/checkedRow.native-press.spec.tsx +1 -2
- package/src/export-surface.spec.tsx +1 -1
- package/src/focusedFieldTheme.native-press.spec.tsx +1 -2
- package/src/index.gnome.ts +330 -0
- package/src/index.ts +6 -0
- package/src/layouts/page.tsx +3 -3
- package/src/layouts/topBarConfirm.spec.tsx +22 -25
- package/src/overlayStack.native-press.spec.tsx +1 -2
- package/src/surfaces.spec.tsx +0 -15
- package/src/surfaces.tsx +0 -18
- package/src/utils/utils.spec.tsx +1 -42
- package/types/ChatTurn/index.d.ts +29 -0
- package/types/ChatTurn/index.d.ts.map +1 -0
- package/types/Chip/index.d.ts +9 -1
- package/types/Chip/index.d.ts.map +1 -1
- package/types/DropDownPanel/index.d.ts +11 -0
- package/types/DropDownPanel/index.d.ts.map +1 -0
- package/types/DropdownMenu/index.d.ts.map +1 -1
- package/types/SwipeDismissRow/index.d.ts +18 -0
- package/types/SwipeDismissRow/index.d.ts.map +1 -0
- package/types/index.d.ts +6 -0
- package/types/index.d.ts.map +1 -1
- package/types/index.gnome.d.ts +107 -0
- package/types/index.gnome.d.ts.map +1 -0
- package/types/surfaces.d.ts +0 -24
- package/types/surfaces.d.ts.map +1 -1
- package/dist/cjs/utils/setTinted.cjs +0 -39
- package/dist/cjs/utils/setTinted.native.js +0 -44
- package/dist/cjs/utils/setTinted.native.js.map +0 -1
- package/dist/esm/utils/setTinted.mjs +0 -11
- package/dist/esm/utils/setTinted.mjs.map +0 -1
- package/dist/esm/utils/setTinted.native.js +0 -13
- package/dist/esm/utils/setTinted.native.js.map +0 -1
- package/dist/jsx/utils/setTinted.mjs +0 -11
- package/dist/jsx/utils/setTinted.mjs.map +0 -1
- package/dist/jsx/utils/setTinted.native.js +0 -44
- package/dist/jsx/utils/setTinted.native.js.map +0 -1
- package/src/utils/setTinted.ts +0 -12
- package/types/utils/setTinted.d.ts +0 -5
- package/types/utils/setTinted.d.ts.map +0 -1
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { CardsIcon } from "@phosphor-icons/react";
|
|
2
|
+
import type { Meta, StoryObj } from "@storybook/react-native-web-vite";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { YStack } from "tamagui";
|
|
5
|
+
import { ListGroup, ListGroupItem, ListRow, ListRowMeta } from "../views";
|
|
6
|
+
import { SwipeDismissRow } from "./index";
|
|
7
|
+
|
|
8
|
+
const meta: Meta<typeof SwipeDismissRow> = {
|
|
9
|
+
title: "Components/SwipeDismissRow",
|
|
10
|
+
component: SwipeDismissRow,
|
|
11
|
+
parameters: {
|
|
12
|
+
status: { type: "beta" },
|
|
13
|
+
docs: {
|
|
14
|
+
description: {
|
|
15
|
+
component:
|
|
16
|
+
"A list row a full swipe toward the leading edge dismisses; a short swipe springs back. The revealed ✕ is pressable too.",
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
export default meta;
|
|
22
|
+
|
|
23
|
+
type Story = StoryObj<typeof SwipeDismissRow>;
|
|
24
|
+
|
|
25
|
+
const seed = [
|
|
26
|
+
{ id: "a", title: "Approve the Reports add-on", session: "Add-on admin", time: "2m" },
|
|
27
|
+
{ id: "b", title: "Sign in to the Studio account", session: "Accounts", time: "14m" },
|
|
28
|
+
{ id: "c", title: "Review MR !926", session: "Drover boards", time: "1h" },
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
function Demo({ caught }: { caught?: boolean }) {
|
|
32
|
+
const [items, setItems] = useState(seed);
|
|
33
|
+
return (
|
|
34
|
+
<YStack width="100%">
|
|
35
|
+
<ListGroup variant="plain" aria-label="Needs you">
|
|
36
|
+
{items.map((item, index) => (
|
|
37
|
+
<SwipeDismissRow
|
|
38
|
+
key={item.id}
|
|
39
|
+
swipeProgress={caught && index === 0 ? 0.35 : undefined}
|
|
40
|
+
onDismiss={() => setItems((all) => all.filter((x) => x.id !== item.id))}
|
|
41
|
+
>
|
|
42
|
+
<ListGroupItem onPress={() => {}}>
|
|
43
|
+
<ListRow
|
|
44
|
+
icon={<CardsIcon />}
|
|
45
|
+
title={item.title}
|
|
46
|
+
subtitle={item.session}
|
|
47
|
+
meta={<ListRowMeta>{item.time}</ListRowMeta>}
|
|
48
|
+
/>
|
|
49
|
+
</ListGroupItem>
|
|
50
|
+
</SwipeDismissRow>
|
|
51
|
+
))}
|
|
52
|
+
</ListGroup>
|
|
53
|
+
</YStack>
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export const Default: Story = { render: () => <Demo /> };
|
|
58
|
+
|
|
59
|
+
export const MidSwipe: Story = { render: () => <Demo caught /> };
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SwipeDismissRow (FZ-10608): a list row a full swipe toward the leading edge
|
|
3
|
+
* dismisses, the iOS Mail full-swipe. A short swipe springs back. The swipe
|
|
4
|
+
* reveals one trailing ✕ action on the destructive fill, also pressable, so
|
|
5
|
+
* the gesture is never the only path (LC-177). Wrap a ListGroupItem in it.
|
|
6
|
+
*/
|
|
7
|
+
import {
|
|
8
|
+
sizeRecipeForToken,
|
|
9
|
+
transitionProps,
|
|
10
|
+
useGlyphColor,
|
|
11
|
+
useLegibleInkOn,
|
|
12
|
+
useResolvedKnobs,
|
|
13
|
+
type SizeRecipeToken,
|
|
14
|
+
} from "@multiplatform.one/theme";
|
|
15
|
+
import { ICON_BUTTON_GLYPH_PX } from "@multiplatform.one/forms";
|
|
16
|
+
import { XIcon } from "@phosphor-icons/react";
|
|
17
|
+
import { useMemo, useRef, useState, type ReactNode } from "react";
|
|
18
|
+
import { PanResponder } from "react-native";
|
|
19
|
+
import { useTranslation } from "react-i18next";
|
|
20
|
+
import { XStack, YStack } from "tamagui";
|
|
21
|
+
|
|
22
|
+
/** Past this share of the row's width a release dismisses; short of it, the row springs back. */
|
|
23
|
+
export const SWIPE_DISMISS_COMMIT = 0.5;
|
|
24
|
+
|
|
25
|
+
/** A horizontal move under this share of the row's width stays a tap or a scroll. */
|
|
26
|
+
const SWIPE_CLAIM = 0.04;
|
|
27
|
+
|
|
28
|
+
const DISMISS_FILL = "$red9";
|
|
29
|
+
|
|
30
|
+
export type SwipeDismissOutcome = "dismiss" | "rest";
|
|
31
|
+
|
|
32
|
+
/** What a release at `dx` (negative toward the leading edge) does on a row `width` wide. */
|
|
33
|
+
export function swipeDismissOutcome(dx: number, width: number): SwipeDismissOutcome {
|
|
34
|
+
if (width <= 0) return "rest";
|
|
35
|
+
return -dx >= width * SWIPE_DISMISS_COMMIT ? "dismiss" : "rest";
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface SwipeDismissRowProps {
|
|
39
|
+
children: ReactNode;
|
|
40
|
+
onDismiss: () => void;
|
|
41
|
+
/** The ✕ action's accessible name. Defaults to "Dismiss". */
|
|
42
|
+
dismissLabel?: string;
|
|
43
|
+
disabled?: boolean;
|
|
44
|
+
/** Draw the row caught mid-swipe, as a share of its width (boards and stories). */
|
|
45
|
+
swipeProgress?: number;
|
|
46
|
+
testID?: string;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function SwipeDismissRow({
|
|
50
|
+
children,
|
|
51
|
+
onDismiss,
|
|
52
|
+
dismissLabel,
|
|
53
|
+
disabled,
|
|
54
|
+
swipeProgress,
|
|
55
|
+
testID,
|
|
56
|
+
}: SwipeDismissRowProps) {
|
|
57
|
+
const { t } = useTranslation();
|
|
58
|
+
const { knobProps } = useResolvedKnobs({ component: "SwipeDismissRow", intent: "error" });
|
|
59
|
+
const glyphColor = useGlyphColor(useLegibleInkOn(DISMISS_FILL, "$color1"));
|
|
60
|
+
const iconSize = Math.max(
|
|
61
|
+
sizeRecipeForToken(knobProps.sizeToken as SizeRecipeToken).iconSize,
|
|
62
|
+
ICON_BUTTON_GLYPH_PX,
|
|
63
|
+
);
|
|
64
|
+
const [width, setWidth] = useState(0);
|
|
65
|
+
const [dragX, setDragX] = useState<number | null>(null);
|
|
66
|
+
const [dismissed, setDismissed] = useState(false);
|
|
67
|
+
const widthRef = useRef(0);
|
|
68
|
+
|
|
69
|
+
const dismiss = () => {
|
|
70
|
+
if (disabled) return;
|
|
71
|
+
setDismissed(true);
|
|
72
|
+
onDismiss();
|
|
73
|
+
};
|
|
74
|
+
const dismissRef = useRef(dismiss);
|
|
75
|
+
dismissRef.current = dismiss;
|
|
76
|
+
|
|
77
|
+
const responder = useMemo(
|
|
78
|
+
() =>
|
|
79
|
+
PanResponder.create({
|
|
80
|
+
onMoveShouldSetPanResponder: (_e, g) =>
|
|
81
|
+
!disabled && Math.abs(g.dx) > Math.abs(g.dy) && -g.dx > widthRef.current * SWIPE_CLAIM,
|
|
82
|
+
onPanResponderMove: (_e, g) => setDragX(Math.min(0, g.dx)),
|
|
83
|
+
onPanResponderRelease: (_e, g) => {
|
|
84
|
+
setDragX(null);
|
|
85
|
+
if (swipeDismissOutcome(g.dx, widthRef.current) === "dismiss") dismissRef.current();
|
|
86
|
+
},
|
|
87
|
+
onPanResponderTerminate: () => setDragX(null),
|
|
88
|
+
}),
|
|
89
|
+
[disabled],
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
const previewX = swipeProgress != null && width > 0 ? -width * swipeProgress : 0;
|
|
93
|
+
const offset = dismissed ? -width : (dragX ?? previewX);
|
|
94
|
+
const revealed = -offset;
|
|
95
|
+
const unmeasuredPreview =
|
|
96
|
+
!dismissed && dragX == null && width === 0 && swipeProgress != null && swipeProgress > 0
|
|
97
|
+
? `${Math.round(swipeProgress * 100)}%`
|
|
98
|
+
: null;
|
|
99
|
+
|
|
100
|
+
return (
|
|
101
|
+
<XStack
|
|
102
|
+
position="relative"
|
|
103
|
+
overflow="hidden"
|
|
104
|
+
testID={testID}
|
|
105
|
+
data-swipe-dismiss-row=""
|
|
106
|
+
accessibilityActions={
|
|
107
|
+
disabled ? undefined : [{ name: "dismiss", label: dismissLabel ?? t("Dismiss") }]
|
|
108
|
+
}
|
|
109
|
+
onAccessibilityAction={(e: { nativeEvent: { actionName: string } }) => {
|
|
110
|
+
if (e.nativeEvent.actionName === "dismiss") dismiss();
|
|
111
|
+
}}
|
|
112
|
+
onLayout={(e) => {
|
|
113
|
+
const next = e.nativeEvent.layout.width;
|
|
114
|
+
widthRef.current = next;
|
|
115
|
+
if (next !== width) setWidth(next);
|
|
116
|
+
}}
|
|
117
|
+
{...responder.panHandlers}
|
|
118
|
+
>
|
|
119
|
+
{revealed > 0 || unmeasuredPreview ? (
|
|
120
|
+
<XStack
|
|
121
|
+
position="absolute"
|
|
122
|
+
top={0}
|
|
123
|
+
bottom={0}
|
|
124
|
+
right={0}
|
|
125
|
+
width={unmeasuredPreview ?? revealed}
|
|
126
|
+
backgroundColor={DISMISS_FILL}
|
|
127
|
+
alignItems="center"
|
|
128
|
+
justifyContent="center"
|
|
129
|
+
role="button"
|
|
130
|
+
aria-label={dismissLabel ?? t("Dismiss")}
|
|
131
|
+
data-swipe-dismiss-action=""
|
|
132
|
+
cursor="pointer"
|
|
133
|
+
onPress={dismiss}
|
|
134
|
+
>
|
|
135
|
+
<XIcon weight="bold" size={iconSize} color={glyphColor} />
|
|
136
|
+
</XStack>
|
|
137
|
+
) : null}
|
|
138
|
+
<YStack
|
|
139
|
+
flex={1}
|
|
140
|
+
x={offset}
|
|
141
|
+
{...(unmeasuredPreview ? { left: `-${unmeasuredPreview}` } : undefined)}
|
|
142
|
+
backgroundColor="$background"
|
|
143
|
+
data-swipe-dismiss-offset={String(Math.round(offset))}
|
|
144
|
+
{...(dragX == null ? transitionProps(knobProps.motion.control) : undefined)}
|
|
145
|
+
>
|
|
146
|
+
{children}
|
|
147
|
+
</YStack>
|
|
148
|
+
</XStack>
|
|
149
|
+
);
|
|
150
|
+
}
|
|
@@ -207,7 +207,7 @@ function AppShellNavBar({ maxWidth, leading, trailing, title, showTitle, scrolle
|
|
|
207
207
|
const motion = transitionProps(knobProps.motion.control);
|
|
208
208
|
const clearance = Math.max(sides.leading, sides.trailing);
|
|
209
209
|
return (
|
|
210
|
-
<Surface bar
|
|
210
|
+
<Surface bar>
|
|
211
211
|
<YStack
|
|
212
212
|
role="banner"
|
|
213
213
|
data-testid="app-shell-bar"
|
|
@@ -19,8 +19,7 @@ import { ContextMenu } from "./ContextMenu";
|
|
|
19
19
|
|
|
20
20
|
vi.mock("@multiplatform.one/theme", async (original) => ({
|
|
21
21
|
...(await original<typeof import("@multiplatform.one/theme")>()),
|
|
22
|
-
transitionProps: (await import("@multiplatform.one/theme/
|
|
23
|
-
.transitionProps,
|
|
22
|
+
transitionProps: (await import("@multiplatform.one/theme/native-twins")).transitionProps,
|
|
24
23
|
}));
|
|
25
24
|
|
|
26
25
|
// The harness resolves forms web-first, and the web panel portals out of the
|
|
@@ -106,7 +106,7 @@ describe("export surface partition (LC-70)", () => {
|
|
|
106
106
|
describe("semantic colour layer is importable by a stable name", () => {
|
|
107
107
|
// A token map whose own header says "use these instead of hardcoding
|
|
108
108
|
// $color3, $color10" is only useful if a consumer can reach it without
|
|
109
|
-
// deep-pathing into another package's file layout. `./src/*`
|
|
109
|
+
// deep-pathing into another package's file layout. `./src/*` was an escape
|
|
110
110
|
// hatch, not an API.
|
|
111
111
|
it("exports componentColors and sectionHeading from the barrel", () => {
|
|
112
112
|
expect(pkg.componentColors).toBe(componentColors);
|
|
@@ -20,8 +20,7 @@ import { afterEach, describe, expect, it, vi } from "vitest";
|
|
|
20
20
|
|
|
21
21
|
vi.mock("@multiplatform.one/theme", async (original) => ({
|
|
22
22
|
...(await original<typeof import("@multiplatform.one/theme")>()),
|
|
23
|
-
transitionProps: (await import("@multiplatform.one/theme/
|
|
24
|
-
.transitionProps,
|
|
23
|
+
transitionProps: (await import("@multiplatform.one/theme/native-twins")).transitionProps,
|
|
25
24
|
}));
|
|
26
25
|
|
|
27
26
|
const config = createDefaultThemeConfig({
|
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
export {
|
|
2
|
+
CONTENT_MAX_WIDTH,
|
|
3
|
+
EmptyState,
|
|
4
|
+
GutterFrame,
|
|
5
|
+
PageActionButton,
|
|
6
|
+
PageBackButton,
|
|
7
|
+
PageBarButton,
|
|
8
|
+
PageHeader,
|
|
9
|
+
PageMenuButton,
|
|
10
|
+
PageSection,
|
|
11
|
+
PushedPage,
|
|
12
|
+
READABLE_MAX_WIDTH,
|
|
13
|
+
Screen,
|
|
14
|
+
ScreenToolbar,
|
|
15
|
+
useInlinePageTitle,
|
|
16
|
+
} from "./layouts/page";
|
|
17
|
+
export type {
|
|
18
|
+
EmptyStateProps,
|
|
19
|
+
PageActionButtonProps,
|
|
20
|
+
PageBackButtonProps,
|
|
21
|
+
PageBarButtonProps,
|
|
22
|
+
PageHeaderProps,
|
|
23
|
+
PageSectionProps,
|
|
24
|
+
ScreenProps,
|
|
25
|
+
ScreenToolbarProps,
|
|
26
|
+
} from "./layouts/page";
|
|
27
|
+
export {
|
|
28
|
+
ShellSidebarSlotProvider,
|
|
29
|
+
useHasShellSidebarSlot,
|
|
30
|
+
useShellSidebarPanel,
|
|
31
|
+
useShellSidebarSlotState,
|
|
32
|
+
} from "./layouts/shellSidebarSlot";
|
|
33
|
+
export type { ShellSidebarPanel } from "./layouts/shellSidebarSlot";
|
|
34
|
+
export { ViewSwitcher } from "./layouts/ViewSwitcher";
|
|
35
|
+
export type { ViewOption, ViewSwitcherProps } from "./layouts/ViewSwitcher";
|
|
36
|
+
export {
|
|
37
|
+
BottomAccessory,
|
|
38
|
+
BottomAccessoryHost,
|
|
39
|
+
BottomAccessoryScope,
|
|
40
|
+
createBottomAccessoryStore,
|
|
41
|
+
useBottomAccessoryOccupied,
|
|
42
|
+
useBottomAccessorySlot,
|
|
43
|
+
} from "./layouts/bottomAccessory";
|
|
44
|
+
export type { BottomAccessoryProps, BottomAccessoryStore } from "./layouts/bottomAccessory";
|
|
45
|
+
export { StatusDot, StatusMark, statusToneInk } from "./layouts/StatusDot";
|
|
46
|
+
export type { StatusDotProps, StatusTone } from "./layouts/StatusDot";
|
|
47
|
+
export { ImageGrid, PHOTOS_GRID_GUTTER, tileTrack, useImageGridGeometry } from "./views/ImageGrid";
|
|
48
|
+
export type { ImageGridHotkeys, ImageGridProps, ImageGridVariant } from "./views/ImageGrid";
|
|
49
|
+
export {
|
|
50
|
+
__resetAsyncDevWarnSeen,
|
|
51
|
+
AsyncBoundary,
|
|
52
|
+
asyncLoadDelayMs,
|
|
53
|
+
AsyncSkeleton,
|
|
54
|
+
resolveAsyncStatus,
|
|
55
|
+
useAsyncBoundary,
|
|
56
|
+
useAsyncCount,
|
|
57
|
+
} from "./layouts/AsyncBoundary";
|
|
58
|
+
export type {
|
|
59
|
+
AsyncBoundaryContextValue,
|
|
60
|
+
AsyncBoundaryLayout,
|
|
61
|
+
AsyncBoundaryProps,
|
|
62
|
+
AsyncSkeletonHero,
|
|
63
|
+
AsyncStatus,
|
|
64
|
+
} from "./layouts/AsyncBoundary";
|
|
65
|
+
export { themed } from "./icons/themed";
|
|
66
|
+
export { ShortcutCard } from "./views/ShortcutCard";
|
|
67
|
+
export type { ShortcutCardProps, ShortcutConfig } from "./views/ShortcutCard";
|
|
68
|
+
export {
|
|
69
|
+
ListItemStateContext,
|
|
70
|
+
listLeadingIconSize,
|
|
71
|
+
ListRow,
|
|
72
|
+
ListRowFact,
|
|
73
|
+
ListRowMeta,
|
|
74
|
+
listRowPressDelayMs,
|
|
75
|
+
listRowTouchProps,
|
|
76
|
+
useListItemState,
|
|
77
|
+
} from "./views/ListRow";
|
|
78
|
+
export type { ListItemState, ListRowProps } from "./views/ListRow";
|
|
79
|
+
export { ListGroup, ListGroupItem } from "./views/ListGroup";
|
|
80
|
+
export type { ListGroupItemProps, ListGroupProps, ListGroupVariant } from "./views/ListGroup";
|
|
81
|
+
export {
|
|
82
|
+
__resetToastViewportRegistry,
|
|
83
|
+
claimToastViewport,
|
|
84
|
+
dismissAllToasts,
|
|
85
|
+
dismissToast,
|
|
86
|
+
getToasts,
|
|
87
|
+
getToastViewportOwner,
|
|
88
|
+
releaseToastViewport,
|
|
89
|
+
resetToasts,
|
|
90
|
+
resolveToastPolicy,
|
|
91
|
+
showToast,
|
|
92
|
+
subscribeToasts,
|
|
93
|
+
subscribeToastViewport,
|
|
94
|
+
TOAST_ACTION_MIN_MS,
|
|
95
|
+
TOAST_DEFAULT_MS,
|
|
96
|
+
TOAST_ERROR_MS,
|
|
97
|
+
TOAST_EXIT_MS,
|
|
98
|
+
TOAST_WARNING_MS,
|
|
99
|
+
} from "./Toast/store";
|
|
100
|
+
export type { ToastActionOptions, ToastEntry, ToastIntent, ToastShowOptions } from "./Toast/store";
|
|
101
|
+
export { Badge } from "./Badge";
|
|
102
|
+
export type {
|
|
103
|
+
BadgeColor,
|
|
104
|
+
BadgeIndicatorProps,
|
|
105
|
+
BadgePosition,
|
|
106
|
+
BadgeProps,
|
|
107
|
+
BadgeVariant,
|
|
108
|
+
BadgeWrapperProps,
|
|
109
|
+
} from "./Badge";
|
|
110
|
+
export { chordName, detectKbdPlatform, Kbd, resolveChord, splitChord } from "./Kbd";
|
|
111
|
+
export type { KbdCapProps, KbdKey, KbdModifier, KbdPlatform, KbdProps } from "./Kbd";
|
|
112
|
+
export { SkipLink } from "./SkipLink";
|
|
113
|
+
export type { SkipLinkProps, SkipLinkSurfaceProps } from "./SkipLink";
|
|
114
|
+
export { Wheel } from "./Wheel";
|
|
115
|
+
export type {
|
|
116
|
+
WheelContainerProps,
|
|
117
|
+
WheelHighlightEdges,
|
|
118
|
+
WheelItem,
|
|
119
|
+
WheelItemProps,
|
|
120
|
+
WheelProps,
|
|
121
|
+
} from "./Wheel";
|
|
122
|
+
export { DropdownMenu, isIconTrigger } from "./DropdownMenu";
|
|
123
|
+
export type {
|
|
124
|
+
DropdownMenuCheckboxItemProps,
|
|
125
|
+
DropdownMenuCloseAutoFocusEvent,
|
|
126
|
+
DropdownMenuContentProps,
|
|
127
|
+
DropdownMenuEntry,
|
|
128
|
+
DropdownMenuItemProps,
|
|
129
|
+
DropdownMenuItemSpec,
|
|
130
|
+
DropdownMenuLabelProps,
|
|
131
|
+
DropdownMenuPlacement,
|
|
132
|
+
DropdownMenuProps,
|
|
133
|
+
DropdownMenuRowProps,
|
|
134
|
+
DropdownMenuSeparatorProps,
|
|
135
|
+
DropdownMenuTriggerProps,
|
|
136
|
+
} from "./DropdownMenu";
|
|
137
|
+
export {
|
|
138
|
+
Chip,
|
|
139
|
+
CHIP_DISMISS_OPACITY,
|
|
140
|
+
ChipFrame,
|
|
141
|
+
chipFrameGeometry,
|
|
142
|
+
chipIconSize,
|
|
143
|
+
chipSwatch,
|
|
144
|
+
ChipText,
|
|
145
|
+
chipTextSize,
|
|
146
|
+
chipTone,
|
|
147
|
+
} from "./Chip";
|
|
148
|
+
export type {
|
|
149
|
+
ChipColor,
|
|
150
|
+
ChipFrameProps,
|
|
151
|
+
ChipHue,
|
|
152
|
+
ChipProps,
|
|
153
|
+
ChipSize,
|
|
154
|
+
ChipTone,
|
|
155
|
+
ChipVariant,
|
|
156
|
+
} from "./Chip";
|
|
157
|
+
export {
|
|
158
|
+
__resetTooltipSkipForTests,
|
|
159
|
+
createNativeTooltipPressHandlers,
|
|
160
|
+
noteTooltipClosed,
|
|
161
|
+
resolveTooltipDelay,
|
|
162
|
+
resolveTooltipPadRecipe,
|
|
163
|
+
resolveTooltipSizeRecipe,
|
|
164
|
+
Tooltip,
|
|
165
|
+
TOOLTIP_COLLISION_PADDING_PX,
|
|
166
|
+
TOOLTIP_DEFAULT_DELAY_MS,
|
|
167
|
+
TOOLTIP_NATIVE_LONG_PRESS_MS,
|
|
168
|
+
TOOLTIP_SKIP_DELAY_MS,
|
|
169
|
+
TooltipArrow,
|
|
170
|
+
TooltipContent,
|
|
171
|
+
tooltipPadRecipes,
|
|
172
|
+
tooltipSizeRecipes,
|
|
173
|
+
tooltipStop,
|
|
174
|
+
TooltipText,
|
|
175
|
+
wrapTooltipContent,
|
|
176
|
+
} from "./Tooltip";
|
|
177
|
+
export type {
|
|
178
|
+
NativeTooltipPressHandlers,
|
|
179
|
+
TooltipArrowProps,
|
|
180
|
+
TooltipContentProps,
|
|
181
|
+
TooltipProps,
|
|
182
|
+
TooltipSizeRecipe,
|
|
183
|
+
TooltipTextProps,
|
|
184
|
+
} from "./Tooltip";
|
|
185
|
+
export { Alert } from "./Alert";
|
|
186
|
+
export type { AlertFrameProps, AlertIntent, AlertPlacement, AlertProps } from "./Alert";
|
|
187
|
+
export { Breadcrumbs } from "./layouts/breadcrumbs";
|
|
188
|
+
export type { BreadcrumbItem, BreadcrumbsProps } from "./layouts/breadcrumbs";
|
|
189
|
+
export {
|
|
190
|
+
Sidebar,
|
|
191
|
+
sidebarMaterial,
|
|
192
|
+
sidebarMaterialOpacity,
|
|
193
|
+
sidebarRailInset,
|
|
194
|
+
} from "./layouts/sidebar";
|
|
195
|
+
export type { SidebarItem, SidebarProps, SidebarSection } from "./layouts/sidebar";
|
|
196
|
+
export {
|
|
197
|
+
formatRelativeTimestamp,
|
|
198
|
+
getEntryDisplayName,
|
|
199
|
+
prettifyAuthorName,
|
|
200
|
+
threadEntries,
|
|
201
|
+
Timeline,
|
|
202
|
+
} from "./layouts/timeline";
|
|
203
|
+
export type {
|
|
204
|
+
TimelineEntry,
|
|
205
|
+
TimelineEntryType,
|
|
206
|
+
TimelineProps,
|
|
207
|
+
TimelineThread,
|
|
208
|
+
VersionChange,
|
|
209
|
+
} from "./layouts/timeline";
|
|
210
|
+
export {
|
|
211
|
+
aggregateData,
|
|
212
|
+
calculatePercentageChange,
|
|
213
|
+
calculateTrend,
|
|
214
|
+
ChartCard,
|
|
215
|
+
Dashboard,
|
|
216
|
+
KPICard,
|
|
217
|
+
ListCard,
|
|
218
|
+
ProgressCard,
|
|
219
|
+
resolveTrendColor,
|
|
220
|
+
} from "./views/Dashboard";
|
|
221
|
+
export type {
|
|
222
|
+
CardHeadingLevel,
|
|
223
|
+
ChartCardProps,
|
|
224
|
+
ChartConfig,
|
|
225
|
+
ChartDataPoint,
|
|
226
|
+
ChartType,
|
|
227
|
+
DashboardListItem,
|
|
228
|
+
DashboardProps,
|
|
229
|
+
DashboardWidget,
|
|
230
|
+
KPICardConfig,
|
|
231
|
+
KPICardProps,
|
|
232
|
+
ListCardProps,
|
|
233
|
+
ListConfig,
|
|
234
|
+
ProgressCardProps,
|
|
235
|
+
ProgressConfig,
|
|
236
|
+
TrendDirection,
|
|
237
|
+
} from "./views/Dashboard";
|
|
238
|
+
export { List } from "./views/List";
|
|
239
|
+
export type { ListHotkeys, ListProps } from "./views/List";
|
|
240
|
+
export { TreeView } from "./views/TreeView";
|
|
241
|
+
export type { TreeNode, TreeViewDisplay, TreeViewHotkeys, TreeViewProps } from "./views/TreeView";
|
|
242
|
+
export { ReportBuilder } from "./views/ReportBuilder";
|
|
243
|
+
export type { GroupByConfig, ReportBuilderProps, ReportColumn } from "./views/ReportBuilder";
|
|
244
|
+
export { Kanban } from "./views/Kanban";
|
|
245
|
+
export type { KanbanColumn, KanbanHotkeys, KanbanProps } from "./views/Kanban";
|
|
246
|
+
export {
|
|
247
|
+
Calendar,
|
|
248
|
+
computeEventMoveRange,
|
|
249
|
+
eventChipTextColor,
|
|
250
|
+
findDayKeyAtPoint,
|
|
251
|
+
} from "./views/Calendar";
|
|
252
|
+
export type {
|
|
253
|
+
CalendarDayLayout,
|
|
254
|
+
CalendarEvent,
|
|
255
|
+
CalendarEventDraft,
|
|
256
|
+
CalendarEventMoveRange,
|
|
257
|
+
CalendarProps,
|
|
258
|
+
CalendarViewType,
|
|
259
|
+
} from "./views/Calendar";
|
|
260
|
+
export { Tags } from "./layouts/tags";
|
|
261
|
+
export type { TagItem, TagsProps, TagVariant } from "./layouts/tags";
|
|
262
|
+
export { Attachments } from "./layouts/attachments";
|
|
263
|
+
export type { AttachmentItem, AttachmentsProps } from "./layouts/attachments";
|
|
264
|
+
export {
|
|
265
|
+
PageHeadingScope,
|
|
266
|
+
usePageChromeInset,
|
|
267
|
+
useRegisterPageHeading,
|
|
268
|
+
} from "./layouts/pageHeadingScope";
|
|
269
|
+
export type { PageHeadingLevel, PageHeadingScopeProps } from "./layouts/pageHeadingScope";
|
|
270
|
+
export { ConfirmDialog, confirmDialogPresentation } from "./feedback/ConfirmDialog";
|
|
271
|
+
export type { ConfirmDialogProps } from "./feedback/ConfirmDialog";
|
|
272
|
+
export { useLargeTitle, useRevealTop } from "./layouts/screenScroll";
|
|
273
|
+
export { Accordion, useAccordionTriggerInk } from "./Accordion";
|
|
274
|
+
export type { AccordionItemProps, AccordionProps } from "./Accordion";
|
|
275
|
+
export { Avatar, getInitials } from "./Avatar";
|
|
276
|
+
export type { AvatarProps, AvatarSize } from "./Avatar";
|
|
277
|
+
export { Carousel } from "./Carousel";
|
|
278
|
+
export { Quote } from "./Quote";
|
|
279
|
+
export { Tabs } from "./Tabs";
|
|
280
|
+
export type { TabsItem, TabsProps, TabsSize, TabsVariant } from "./Tabs";
|
|
281
|
+
export type { ChartDatum, ChartSize } from "./charts/types";
|
|
282
|
+
export {
|
|
283
|
+
approximateTextWidth,
|
|
284
|
+
createBandScale,
|
|
285
|
+
createLinearScale,
|
|
286
|
+
formatChartValue,
|
|
287
|
+
getLinearTicks,
|
|
288
|
+
} from "./charts/math";
|
|
289
|
+
export { describeChart } from "./charts/accessibility";
|
|
290
|
+
export { useChartTheme } from "./charts/useChartTheme";
|
|
291
|
+
export type { ChartTheme } from "./charts/useChartTheme";
|
|
292
|
+
export { getPaginationItems, Pagination } from "./Pagination";
|
|
293
|
+
export { useDirection } from "./hooks/useDirection";
|
|
294
|
+
export { DialogContent, DialogOverlay, PopoverContent } from "./surfaces";
|
|
295
|
+
export {
|
|
296
|
+
AreaSeries,
|
|
297
|
+
BarChart,
|
|
298
|
+
BarSeries,
|
|
299
|
+
ChartSurface,
|
|
300
|
+
LineChart,
|
|
301
|
+
LineSeries,
|
|
302
|
+
PieChart,
|
|
303
|
+
PieSeries,
|
|
304
|
+
Sparkline,
|
|
305
|
+
XAxis,
|
|
306
|
+
YAxis,
|
|
307
|
+
} from "./charts";
|
|
308
|
+
export { ActionButton, OverlayHeader } from "./actions/StandardAction";
|
|
309
|
+
export { componentColors, sectionHeading } from "./componentColors";
|
|
310
|
+
export { SizableText } from "./Text";
|
|
311
|
+
export { notify } from "./feedback/notify";
|
|
312
|
+
export { ListPageLayout } from "./layouts/PageTemplates";
|
|
313
|
+
export { SheetModal } from "./SheetModal";
|
|
314
|
+
export type { SheetModalProps } from "./SheetModal";
|
|
315
|
+
export { Code, CodeInline } from "./code/Code";
|
|
316
|
+
export { HighlightedCode } from "./code/HighlightedCode";
|
|
317
|
+
export { highlightCode, useShikiTokens } from "./code/Highlighter";
|
|
318
|
+
export { Pre } from "./code/Pre";
|
|
319
|
+
export { ErrorBoundary } from "./ErrorBoundary";
|
|
320
|
+
export { useClipboard } from "./hooks/useClipboard";
|
|
321
|
+
export { unwrapText } from "./utils/unwrapText";
|
|
322
|
+
export { BottomChromeClearance } from "./appShell/BottomChromeClearance";
|
|
323
|
+
export { Dialog } from "./Dialog";
|
|
324
|
+
export { renumberIdx } from "./views/kanbanDnd";
|
|
325
|
+
export { Toolbar } from "./layouts/toolbar";
|
|
326
|
+
export { TreeSelect } from "./TreeSelect";
|
|
327
|
+
export { SortableHandle, SortableSessionProvider, useSortableRows } from "./SortableList";
|
|
328
|
+
export { CardGrid } from "./views/CardGrid";
|
|
329
|
+
export { splitHeaderActions } from "./actions/HeaderActions";
|
|
330
|
+
export type { HeaderAction } from "./actions/HeaderActions";
|
package/src/index.ts
CHANGED
|
@@ -20,6 +20,10 @@ export type {
|
|
|
20
20
|
export * from "./Badge";
|
|
21
21
|
export * from "./Carousel";
|
|
22
22
|
export * from "./Chip";
|
|
23
|
+
export * from "./SwipeDismissRow";
|
|
24
|
+
export * from "./DropDownPanel";
|
|
25
|
+
export { ChatTurn } from "./ChatTurn";
|
|
26
|
+
export type { ChatTurnFrom, ChatTurnProps } from "./ChatTurn";
|
|
23
27
|
export * from "./ChoiceChips";
|
|
24
28
|
export * from "./Kbd";
|
|
25
29
|
export * from "./CopyField";
|
|
@@ -160,6 +164,8 @@ export type { SpinnerProps } from "@multiplatform.one/forms";
|
|
|
160
164
|
export { Button } from "./Button";
|
|
161
165
|
export type { ButtonProps } from "./Button";
|
|
162
166
|
export { IconButton } from "@multiplatform.one/forms";
|
|
167
|
+
export { Composer } from "@multiplatform.one/forms";
|
|
168
|
+
export type { ComposerProps } from "@multiplatform.one/forms";
|
|
163
169
|
export type { IconButtonProps } from "@multiplatform.one/forms";
|
|
164
170
|
|
|
165
171
|
// Shadow tamagui Text and Heading with the house versions. ./tamagui.ts says
|
package/src/layouts/page.tsx
CHANGED
|
@@ -572,7 +572,7 @@ export function PageHeader({
|
|
|
572
572
|
data-page-header-actions=""
|
|
573
573
|
>
|
|
574
574
|
{/* LC-153: page-head actions are a bar; neutral buttons go plain. */}
|
|
575
|
-
<Surface bar
|
|
575
|
+
<Surface bar>
|
|
576
576
|
<IconButtonGroup {...knobProps.gap} justifyContent="flex-end">
|
|
577
577
|
{actions}
|
|
578
578
|
</IconButtonGroup>
|
|
@@ -842,7 +842,7 @@ function InlineToolbar({ leading, trailing, title, children, ...rest }: ScreenTo
|
|
|
842
842
|
const titleRole = pushedTitle ? pageTitleRole : null;
|
|
843
843
|
// LC-153: the toolbar is a bar, so its neutral buttons paint plain.
|
|
844
844
|
return (
|
|
845
|
-
<Surface bar
|
|
845
|
+
<Surface bar>
|
|
846
846
|
<XStack
|
|
847
847
|
data-testid="screen-toolbar"
|
|
848
848
|
justifyContent="space-between"
|
|
@@ -918,7 +918,7 @@ function PinnedTopBar({
|
|
|
918
918
|
const titleRole = pushedTitle ? pageTitleRole : null;
|
|
919
919
|
// LC-153: the pinned bar is a bar, so its neutral buttons paint plain.
|
|
920
920
|
return (
|
|
921
|
-
<Surface bar
|
|
921
|
+
<Surface bar>
|
|
922
922
|
<YStack
|
|
923
923
|
data-testid="screen-toolbar"
|
|
924
924
|
data-top-bar=""
|