@multiplatform.one/components 7.58.0 → 7.59.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/DropdownMenu/index.cjs +15 -3
- package/dist/cjs/DropdownMenu/index.native.js +16 -3
- package/dist/cjs/DropdownMenu/index.native.js.map +1 -1
- package/dist/cjs/SheetModal/SheetHeader.cjs +53 -0
- package/dist/cjs/SheetModal/SheetHeader.native.js +57 -0
- package/dist/cjs/SheetModal/SheetHeader.native.js.map +1 -0
- package/dist/cjs/SheetModal/index.cjs +11 -4
- package/dist/cjs/SheetModal/index.native.js +7 -1
- package/dist/cjs/SheetModal/index.native.js.map +1 -1
- package/dist/cjs/actions/DangerSection.cjs +73 -0
- package/dist/cjs/actions/DangerSection.native.js +77 -0
- package/dist/cjs/actions/DangerSection.native.js.map +1 -0
- package/dist/cjs/actions/HeaderActions.cjs +98 -0
- package/dist/cjs/actions/HeaderActions.native.js +114 -0
- package/dist/cjs/actions/HeaderActions.native.js.map +1 -0
- package/dist/cjs/actions/index.cjs +7 -1
- package/dist/cjs/actions/index.native.js +7 -1
- package/dist/cjs/actions/index.native.js.map +1 -1
- package/dist/cjs/layouts/page.cjs +3 -1
- package/dist/cjs/layouts/page.native.js +2 -0
- package/dist/cjs/layouts/page.native.js.map +1 -1
- package/dist/esm/DropdownMenu/index.mjs +14 -3
- package/dist/esm/DropdownMenu/index.mjs.map +1 -1
- package/dist/esm/DropdownMenu/index.native.js +15 -3
- package/dist/esm/DropdownMenu/index.native.js.map +1 -1
- package/dist/esm/SheetModal/SheetHeader.mjs +28 -0
- package/dist/esm/SheetModal/SheetHeader.mjs.map +1 -0
- package/dist/esm/SheetModal/SheetHeader.native.js +29 -0
- package/dist/esm/SheetModal/SheetHeader.native.js.map +1 -0
- package/dist/esm/SheetModal/index.mjs +11 -4
- package/dist/esm/SheetModal/index.mjs.map +1 -1
- package/dist/esm/SheetModal/index.native.js +7 -1
- package/dist/esm/SheetModal/index.native.js.map +1 -1
- package/dist/esm/actions/DangerSection.mjs +48 -0
- package/dist/esm/actions/DangerSection.mjs.map +1 -0
- package/dist/esm/actions/DangerSection.native.js +49 -0
- package/dist/esm/actions/DangerSection.native.js.map +1 -0
- package/dist/esm/actions/HeaderActions.mjs +71 -0
- package/dist/esm/actions/HeaderActions.mjs.map +1 -0
- package/dist/esm/actions/HeaderActions.native.js +84 -0
- package/dist/esm/actions/HeaderActions.native.js.map +1 -0
- package/dist/esm/actions/index.mjs +3 -1
- package/dist/esm/actions/index.mjs.map +1 -1
- package/dist/esm/actions/index.native.js +3 -1
- package/dist/esm/actions/index.native.js.map +1 -1
- package/dist/esm/layouts/page.mjs +2 -0
- package/dist/esm/layouts/page.mjs.map +1 -1
- package/dist/esm/layouts/page.native.js +2 -0
- package/dist/esm/layouts/page.native.js.map +1 -1
- package/dist/jsx/DropdownMenu/index.mjs +14 -3
- package/dist/jsx/DropdownMenu/index.mjs.map +1 -1
- package/dist/jsx/DropdownMenu/index.native.js +16 -3
- package/dist/jsx/DropdownMenu/index.native.js.map +1 -1
- package/dist/jsx/SheetModal/SheetHeader.mjs +28 -0
- package/dist/jsx/SheetModal/SheetHeader.mjs.map +1 -0
- package/dist/jsx/SheetModal/SheetHeader.native.js +57 -0
- package/dist/jsx/SheetModal/SheetHeader.native.js.map +1 -0
- package/dist/jsx/SheetModal/index.mjs +11 -4
- package/dist/jsx/SheetModal/index.mjs.map +1 -1
- package/dist/jsx/SheetModal/index.native.js +7 -1
- package/dist/jsx/SheetModal/index.native.js.map +1 -1
- package/dist/jsx/actions/DangerSection.mjs +48 -0
- package/dist/jsx/actions/DangerSection.mjs.map +1 -0
- package/dist/jsx/actions/DangerSection.native.js +77 -0
- package/dist/jsx/actions/DangerSection.native.js.map +1 -0
- package/dist/jsx/actions/HeaderActions.mjs +71 -0
- package/dist/jsx/actions/HeaderActions.mjs.map +1 -0
- package/dist/jsx/actions/HeaderActions.native.js +114 -0
- package/dist/jsx/actions/HeaderActions.native.js.map +1 -0
- package/dist/jsx/actions/index.mjs +3 -1
- package/dist/jsx/actions/index.mjs.map +1 -1
- package/dist/jsx/actions/index.native.js +7 -1
- package/dist/jsx/actions/index.native.js.map +1 -1
- package/dist/jsx/layouts/page.mjs +2 -0
- package/dist/jsx/layouts/page.mjs.map +1 -1
- package/dist/jsx/layouts/page.native.js +2 -0
- package/dist/jsx/layouts/page.native.js.map +1 -1
- package/package.json +9 -9
- package/src/DropdownMenu/index.tsx +23 -3
- package/src/SheetModal/SheetHeader.tsx +30 -0
- package/src/SheetModal/SheetModal.menus.spec.tsx +121 -2
- package/src/SheetModal/SheetModal.stories.tsx +66 -30
- package/src/SheetModal/index.native.tsx +7 -1
- package/src/SheetModal/index.tsx +20 -4
- package/src/actions/DangerSection.spec.tsx +45 -0
- package/src/actions/DangerSection.tsx +52 -0
- package/src/actions/HeaderActions.spec.tsx +84 -0
- package/src/actions/HeaderActions.tsx +90 -0
- package/src/actions/index.ts +10 -0
- package/src/layouts/IdentityPlate.stories.tsx +20 -1
- package/src/layouts/page.tsx +3 -0
- package/types/DropdownMenu/index.d.ts +5 -0
- package/types/DropdownMenu/index.d.ts.map +1 -1
- package/types/SheetModal/SheetHeader.d.ts +13 -0
- package/types/SheetModal/SheetHeader.d.ts.map +1 -0
- package/types/SheetModal/index.d.ts +7 -1
- package/types/SheetModal/index.d.ts.map +1 -1
- package/types/SheetModal/index.native.d.ts +1 -1
- package/types/SheetModal/index.native.d.ts.map +1 -1
- package/types/actions/DangerSection.d.ts +15 -0
- package/types/actions/DangerSection.d.ts.map +1 -0
- package/types/actions/HeaderActions.d.ts +42 -0
- package/types/actions/HeaderActions.d.ts.map +1 -0
- package/types/actions/index.d.ts +2 -0
- package/types/actions/index.d.ts.map +1 -1
- package/types/layouts/page.d.ts +6 -0
- package/types/layouts/page.d.ts.map +1 -1
|
@@ -7,13 +7,26 @@ import {
|
|
|
7
7
|
type TamaguiElement,
|
|
8
8
|
} from "@multiplatform.one/components";
|
|
9
9
|
import { Button, Input, Select } from "@multiplatform.one/forms";
|
|
10
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
ArrowClockwiseIcon,
|
|
12
|
+
CloudArrowUpIcon,
|
|
13
|
+
GlobeIcon,
|
|
14
|
+
HouseIcon,
|
|
15
|
+
LockIcon,
|
|
16
|
+
ScrollIcon,
|
|
17
|
+
ShieldCheckIcon,
|
|
18
|
+
StopIcon,
|
|
19
|
+
TerminalIcon,
|
|
20
|
+
UserCircleCheckIcon,
|
|
21
|
+
} from "@phosphor-icons/react";
|
|
11
22
|
import type { Meta, StoryObj } from "@storybook/react-native-web-vite";
|
|
12
23
|
import { useRef, useState } from "react";
|
|
13
24
|
import { Platform, useWindowDimensions, type LayoutChangeEvent } from "react-native";
|
|
14
25
|
import { YStack } from "tamagui";
|
|
15
26
|
import { ActionBar } from "../actions/ActionBar";
|
|
16
|
-
import {
|
|
27
|
+
import { DangerSection } from "../actions/DangerSection";
|
|
28
|
+
import { DestructiveAction } from "../actions/DestructiveAction";
|
|
29
|
+
import { HeaderActions } from "../actions/HeaderActions";
|
|
17
30
|
import { SheetModal } from "./index";
|
|
18
31
|
import { Paragraph, SizableText } from "../Text";
|
|
19
32
|
|
|
@@ -120,44 +133,58 @@ export const OpenOnMount: Story = {
|
|
|
120
133
|
render: () => <Harness startOpen />,
|
|
121
134
|
};
|
|
122
135
|
|
|
123
|
-
const
|
|
124
|
-
{ label: "
|
|
125
|
-
{ label: "
|
|
126
|
-
{
|
|
127
|
-
{ label: "
|
|
136
|
+
const exposureOptions = [
|
|
137
|
+
{ label: "Private", value: "private", icon: <LockIcon /> },
|
|
138
|
+
{ label: "Tailnet", value: "tailnet", icon: <ShieldCheckIcon /> },
|
|
139
|
+
{ label: "LAN", value: "lan", icon: <HouseIcon /> },
|
|
140
|
+
{ label: "Public", value: "public", icon: <GlobeIcon /> },
|
|
141
|
+
{ label: "Public, signed in", value: "public-auth", icon: <UserCircleCheckIcon /> },
|
|
128
142
|
];
|
|
129
143
|
|
|
130
|
-
const
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
144
|
+
const regionOptions = [
|
|
145
|
+
"Ashburn",
|
|
146
|
+
"Hillsboro",
|
|
147
|
+
"Helsinki",
|
|
148
|
+
"Falkenstein",
|
|
149
|
+
"Nuremberg",
|
|
150
|
+
"Singapore",
|
|
151
|
+
"Sydney",
|
|
152
|
+
"Tokyo",
|
|
153
|
+
].map((label) => ({ label, value: label.toLowerCase() }));
|
|
154
|
+
|
|
155
|
+
const noop = () => {};
|
|
156
|
+
|
|
157
|
+
/** Stop and Restart: the stack's frequent actions, shown, never hidden (LC-262). */
|
|
158
|
+
const lifecycleActions = [
|
|
159
|
+
{ icon: StopIcon, label: "Stop", onPress: noop },
|
|
160
|
+
{ icon: ArrowClockwiseIcon, label: "Restart", onPress: noop },
|
|
136
161
|
];
|
|
137
162
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
</XStack>
|
|
146
|
-
);
|
|
147
|
-
}
|
|
163
|
+
/** Past three, the last slot is "…" with the rest, each row with its glyph. */
|
|
164
|
+
const pageActions = [
|
|
165
|
+
...lifecycleActions,
|
|
166
|
+
{ icon: ScrollIcon, label: "Logs", onPress: noop },
|
|
167
|
+
{ icon: TerminalIcon, label: "Shell", onPress: noop },
|
|
168
|
+
{ icon: CloudArrowUpIcon, label: "Back up", onPress: noop },
|
|
169
|
+
];
|
|
148
170
|
|
|
149
171
|
/**
|
|
150
|
-
* FZ-7830
|
|
151
|
-
*
|
|
152
|
-
*
|
|
153
|
-
*
|
|
172
|
+
* FZ-7830, LC-262 DIRECT-ACTIONS. The sheet's frequent actions are icon
|
|
173
|
+
* buttons in its header, Uninstall sits in a Danger section at the end with
|
|
174
|
+
* its confirm, and the five-option Exposure lays out inline with its glyphs.
|
|
175
|
+
* The eight-option Region stays a menu over its field. On the page, past three
|
|
176
|
+
* actions "…" holds the rest, and the short Select opens over its trigger.
|
|
154
177
|
*/
|
|
155
178
|
function MenusHarness({ startOpen = false }: { startOpen?: boolean }) {
|
|
156
179
|
const [open, setOpen] = useState(startOpen);
|
|
157
180
|
const [exposure, setExposure] = useState("tailnet");
|
|
181
|
+
const [region, setRegion] = useState("helsinki");
|
|
158
182
|
return (
|
|
159
183
|
<FixtureStack minHeight={480} gap="$3" padding="$4">
|
|
160
|
-
<
|
|
184
|
+
<XStack alignItems="center" justifyContent="space-between" gap="$3">
|
|
185
|
+
<Paragraph>Page stack</Paragraph>
|
|
186
|
+
<HeaderActions actions={pageActions} />
|
|
187
|
+
</XStack>
|
|
161
188
|
<Select
|
|
162
189
|
label="Page exposure"
|
|
163
190
|
options={exposureOptions}
|
|
@@ -168,16 +195,25 @@ function MenusHarness({ startOpen = false }: { startOpen?: boolean }) {
|
|
|
168
195
|
<SheetModal
|
|
169
196
|
open={open}
|
|
170
197
|
onOpenChange={setOpen}
|
|
171
|
-
header={<SizableText fontWeight="600">
|
|
198
|
+
header={<SizableText fontWeight="600">keycloak</SizableText>}
|
|
199
|
+
headerActions={<HeaderActions actions={lifecycleActions} />}
|
|
172
200
|
>
|
|
173
201
|
<FixtureStack gap="$3">
|
|
174
|
-
<MenuRow label="Sheet stack" />
|
|
175
202
|
<Select
|
|
176
203
|
label="Exposure"
|
|
177
204
|
options={exposureOptions}
|
|
178
205
|
value={exposure}
|
|
179
206
|
onValueChange={(value) => setExposure(value as string)}
|
|
180
207
|
/>
|
|
208
|
+
<Select
|
|
209
|
+
label="Region"
|
|
210
|
+
options={regionOptions}
|
|
211
|
+
value={region}
|
|
212
|
+
onValueChange={(value) => setRegion(value as string)}
|
|
213
|
+
/>
|
|
214
|
+
<DangerSection>
|
|
215
|
+
<DestructiveAction verb="Uninstall" noun="keycloak" severity="medium" onAction={noop} />
|
|
216
|
+
</DangerSection>
|
|
181
217
|
</FixtureStack>
|
|
182
218
|
</SheetModal>
|
|
183
219
|
</FixtureStack>
|
|
@@ -48,6 +48,7 @@ import { View, YStack } from "tamagui";
|
|
|
48
48
|
import { DialogRegionContext } from "../surfaces";
|
|
49
49
|
|
|
50
50
|
import type { SheetModalProps } from "./index";
|
|
51
|
+
import { SheetHeader } from "./SheetHeader";
|
|
51
52
|
export type { SheetModalProps } from "./index";
|
|
52
53
|
|
|
53
54
|
const bottomInset = Platform.OS === "ios" ? 24 : 16;
|
|
@@ -76,11 +77,16 @@ export function SheetModal({
|
|
|
76
77
|
open,
|
|
77
78
|
onOpenChange,
|
|
78
79
|
children,
|
|
79
|
-
header,
|
|
80
|
+
header: headerContent,
|
|
81
|
+
headerActions,
|
|
80
82
|
snapPoint,
|
|
81
83
|
scrollable,
|
|
82
84
|
fill = false,
|
|
83
85
|
}: SheetModalProps) {
|
|
86
|
+
const header =
|
|
87
|
+
headerContent || headerActions ? (
|
|
88
|
+
<SheetHeader header={headerContent} actions={headerActions} />
|
|
89
|
+
) : null;
|
|
84
90
|
const { t } = useTranslation();
|
|
85
91
|
const { knobProps } = useResolvedKnobs();
|
|
86
92
|
const windowZIndex = useOverlayZIndex("sheet");
|
package/src/SheetModal/index.tsx
CHANGED
|
@@ -15,6 +15,7 @@ import { useEffect, useId, useRef, type ReactNode } from "react";
|
|
|
15
15
|
import { isWeb, Sheet, View, useWindowDimensions } from "tamagui";
|
|
16
16
|
import { DialogRegionContext, SheetFrame } from "../surfaces";
|
|
17
17
|
import { largeDetentRatio, resolveWebSnap } from "./detents";
|
|
18
|
+
import { SheetHeader } from "./SheetHeader";
|
|
18
19
|
import { useSheetFrameFocus } from "./useSheetFrameFocus";
|
|
19
20
|
|
|
20
21
|
export interface SheetModalProps {
|
|
@@ -23,6 +24,12 @@ export interface SheetModalProps {
|
|
|
23
24
|
children?: ReactNode;
|
|
24
25
|
/** Fixed content above the (scrollable) body, e.g. the sheet title. */
|
|
25
26
|
header?: ReactNode;
|
|
27
|
+
/**
|
|
28
|
+
* The sheet's frequent actions, as icon buttons in the header's trailing
|
|
29
|
+
* area (LC-262 DIRECT-ACTIONS): `HeaderActions`. Destructive actions go in a
|
|
30
|
+
* `DangerSection` at the end of the body instead.
|
|
31
|
+
*/
|
|
32
|
+
headerActions?: ReactNode;
|
|
26
33
|
/**
|
|
27
34
|
* Percent snap point. Web: the Sheet's snap point. Native: a drag detent.
|
|
28
35
|
* Omitted: the sheet opens at its content's height, capped at the large
|
|
@@ -77,17 +84,26 @@ export function SheetModal({
|
|
|
77
84
|
open,
|
|
78
85
|
onOpenChange,
|
|
79
86
|
children,
|
|
80
|
-
header,
|
|
87
|
+
header: headerContent,
|
|
88
|
+
headerActions,
|
|
81
89
|
snapPoint,
|
|
82
90
|
scrollable,
|
|
83
91
|
fill = false,
|
|
84
92
|
}: SheetModalProps) {
|
|
93
|
+
const titleId = useId();
|
|
94
|
+
const header =
|
|
95
|
+
headerContent || headerActions ? (
|
|
96
|
+
<SheetHeader
|
|
97
|
+
header={headerContent}
|
|
98
|
+
actions={headerActions}
|
|
99
|
+
titleId={headerActions ? titleId : undefined}
|
|
100
|
+
/>
|
|
101
|
+
) : null;
|
|
85
102
|
const snap = resolveWebSnap({ snapPoint, fill });
|
|
86
103
|
const { height: windowHeight } = useWindowDimensions();
|
|
87
104
|
const { knobProps } = useResolvedKnobs();
|
|
88
105
|
const sheetZIndex = useOverlayZIndex("sheet");
|
|
89
106
|
const transition = knobProps.motion.slide.transition;
|
|
90
|
-
const titleId = useId();
|
|
91
107
|
const frameRef = useRef<HTMLElement | null>(null);
|
|
92
108
|
|
|
93
109
|
useSheetFrameFocus(open, frameRef);
|
|
@@ -125,7 +141,7 @@ export function SheetModal({
|
|
|
125
141
|
tabIndex: -1,
|
|
126
142
|
role: "dialog",
|
|
127
143
|
"aria-modal": true,
|
|
128
|
-
"aria-labelledby":
|
|
144
|
+
"aria-labelledby": headerContent ? titleId : undefined,
|
|
129
145
|
} as Record<string, unknown>)}
|
|
130
146
|
{...knobProps.gap}
|
|
131
147
|
{...(snap.snapPointsMode === "fit"
|
|
@@ -139,7 +155,7 @@ export function SheetModal({
|
|
|
139
155
|
<DialogRegionContext.Provider value={IN_DIALOG_REGION}>
|
|
140
156
|
<OverlayStackProvider zIndex={sheetZIndex}>
|
|
141
157
|
{header ? (
|
|
142
|
-
<View id={titleId} {...(fill ? nonShrinking : null)}>
|
|
158
|
+
<View id={headerActions ? undefined : titleId} {...(fill ? nonShrinking : null)}>
|
|
143
159
|
{header}
|
|
144
160
|
</View>
|
|
145
161
|
) : null}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LC-262 DIRECT-ACTIONS (FZ-7830): destructive actions sit in a Danger section
|
|
3
|
+
* at the end of the content, set apart, and confirm by name before they run.
|
|
4
|
+
*/
|
|
5
|
+
import { renderWithProviders } from "@multiplatform.one/test-utils";
|
|
6
|
+
import { fireEvent, waitFor, within } from "@testing-library/react";
|
|
7
|
+
import { describe, expect, it, vi } from "vitest";
|
|
8
|
+
import { componentColors } from "../componentColors";
|
|
9
|
+
import { DangerSection } from "./DangerSection";
|
|
10
|
+
import { DestructiveAction } from "./DestructiveAction";
|
|
11
|
+
|
|
12
|
+
describe("DangerSection (LC-262)", () => {
|
|
13
|
+
it("is a group named by its red-ink heading, set apart by a rule", () => {
|
|
14
|
+
const result = renderWithProviders(
|
|
15
|
+
<DangerSection>
|
|
16
|
+
<DestructiveAction verb="Uninstall" noun="keycloak" severity="medium" onAction={() => {}} />
|
|
17
|
+
</DangerSection>,
|
|
18
|
+
);
|
|
19
|
+
const group = result.getByRole("group", { name: "Danger zone" });
|
|
20
|
+
expect(group.getAttribute("data-testid")).toBe("danger-section");
|
|
21
|
+
expect(group.className).toContain("mp-hairline-t");
|
|
22
|
+
const heading = result.getByRole("heading", { name: "Danger zone" });
|
|
23
|
+
expect(componentColors.semantic.error).toBe("$red11");
|
|
24
|
+
expect(heading.className).toMatch(/_col-red11/);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it("Uninstall asks first, naming the action, and runs only on confirm", async () => {
|
|
28
|
+
const onAction = vi.fn();
|
|
29
|
+
const result = renderWithProviders(
|
|
30
|
+
<DangerSection>
|
|
31
|
+
<DestructiveAction verb="Uninstall" noun="keycloak" severity="medium" onAction={onAction} />
|
|
32
|
+
</DangerSection>,
|
|
33
|
+
);
|
|
34
|
+
fireEvent.click(result.getByRole("button", { name: /Uninstall keycloak/ }));
|
|
35
|
+
await waitFor(() => expect(document.querySelector('[role="alertdialog"]')).toBeTruthy());
|
|
36
|
+
expect(onAction).not.toHaveBeenCalled();
|
|
37
|
+
const dialog = document.querySelector('[role="alertdialog"]') as HTMLElement;
|
|
38
|
+
const confirm = within(dialog)
|
|
39
|
+
.queryAllByRole("button")
|
|
40
|
+
.find((b) => (b.textContent ?? "").trim() === "Uninstall");
|
|
41
|
+
expect(confirm).toBeTruthy();
|
|
42
|
+
fireEvent.click(confirm!);
|
|
43
|
+
await waitFor(() => expect(onAction).toHaveBeenCalledTimes(1));
|
|
44
|
+
});
|
|
45
|
+
});
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { hairline, useResolvedKnobs } from "@multiplatform.one/theme";
|
|
2
|
+
import type { ReactNode } from "react";
|
|
3
|
+
import { useId } from "react";
|
|
4
|
+
import { YStack, type YStackProps } from "tamagui";
|
|
5
|
+
import { componentColors } from "../componentColors";
|
|
6
|
+
import { useTranslation } from "../shared/i18n";
|
|
7
|
+
import { Paragraph } from "../Text";
|
|
8
|
+
|
|
9
|
+
export interface DangerSectionProps extends Omit<YStackProps, "children"> {
|
|
10
|
+
/** Defaults to "Danger zone". */
|
|
11
|
+
title?: ReactNode;
|
|
12
|
+
/** The destructive actions: `DestructiveAction`s, each with its confirm. */
|
|
13
|
+
children: ReactNode;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Where a sheet's or page's destructive actions live (LC-262 DIRECT-ACTIONS):
|
|
18
|
+
* the last group of its content, set apart by a rule and a red-ink heading,
|
|
19
|
+
* never mixed into a menu. Each action confirms by name before it runs.
|
|
20
|
+
*/
|
|
21
|
+
export function DangerSection({ title, children, ...rest }: DangerSectionProps) {
|
|
22
|
+
const { t } = useTranslation();
|
|
23
|
+
const { knobProps } = useResolvedKnobs({ component: "PageSection" });
|
|
24
|
+
const headingId = useId();
|
|
25
|
+
return (
|
|
26
|
+
<YStack
|
|
27
|
+
role="group"
|
|
28
|
+
aria-labelledby={headingId}
|
|
29
|
+
data-testid="danger-section"
|
|
30
|
+
{...hairline.top}
|
|
31
|
+
borderColor={componentColors.divider}
|
|
32
|
+
paddingTop={knobProps.gap.gap}
|
|
33
|
+
{...knobProps.gapSm}
|
|
34
|
+
{...rest}
|
|
35
|
+
>
|
|
36
|
+
<Paragraph
|
|
37
|
+
id={headingId}
|
|
38
|
+
role="heading"
|
|
39
|
+
aria-level={3}
|
|
40
|
+
margin={0}
|
|
41
|
+
{...knobProps.body}
|
|
42
|
+
fontWeight="600"
|
|
43
|
+
color={componentColors.semantic.error}
|
|
44
|
+
>
|
|
45
|
+
{title ?? t("Danger zone")}
|
|
46
|
+
</Paragraph>
|
|
47
|
+
<YStack alignItems="flex-start" {...knobProps.gapSm}>
|
|
48
|
+
{children}
|
|
49
|
+
</YStack>
|
|
50
|
+
</YStack>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LC-262 DIRECT-ACTIONS (FZ-7830): a sheet's frequent actions are visible icon
|
|
3
|
+
* buttons, each named for assistive tech, and "…" appears only past three.
|
|
4
|
+
*/
|
|
5
|
+
import { renderWithProviders } from "@multiplatform.one/test-utils";
|
|
6
|
+
import {
|
|
7
|
+
ArrowClockwiseIcon,
|
|
8
|
+
CloudArrowUpIcon,
|
|
9
|
+
ScrollIcon,
|
|
10
|
+
StopIcon,
|
|
11
|
+
TerminalIcon,
|
|
12
|
+
} from "@phosphor-icons/react";
|
|
13
|
+
import { fireEvent, waitFor, within } from "@testing-library/react";
|
|
14
|
+
import { describe, expect, it, vi } from "vitest";
|
|
15
|
+
import { Paragraph } from "../Text";
|
|
16
|
+
import { SheetModal } from "../SheetModal";
|
|
17
|
+
import { HeaderActions, HEADER_ACTIONS_MAX, splitHeaderActions } from "./HeaderActions";
|
|
18
|
+
|
|
19
|
+
const stop = vi.fn();
|
|
20
|
+
const restart = vi.fn();
|
|
21
|
+
const two = [
|
|
22
|
+
{ icon: StopIcon, label: "Stop", onPress: stop },
|
|
23
|
+
{ icon: ArrowClockwiseIcon, label: "Restart", onPress: restart },
|
|
24
|
+
];
|
|
25
|
+
const five = [
|
|
26
|
+
...two,
|
|
27
|
+
{ icon: ScrollIcon, label: "Logs", onPress: vi.fn() },
|
|
28
|
+
{ icon: TerminalIcon, label: "Shell", onPress: vi.fn() },
|
|
29
|
+
{ icon: CloudArrowUpIcon, label: "Back up", onPress: vi.fn() },
|
|
30
|
+
];
|
|
31
|
+
|
|
32
|
+
describe("splitHeaderActions (LC-262)", () => {
|
|
33
|
+
it("shows up to three actions, and past three gives the last slot to the overflow", () => {
|
|
34
|
+
expect(HEADER_ACTIONS_MAX).toBe(3);
|
|
35
|
+
expect(splitHeaderActions([1, 2])).toEqual({ visible: [1, 2], overflow: [] });
|
|
36
|
+
expect(splitHeaderActions([1, 2, 3])).toEqual({ visible: [1, 2, 3], overflow: [] });
|
|
37
|
+
expect(splitHeaderActions([1, 2, 3, 4, 5])).toEqual({ visible: [1, 2], overflow: [3, 4, 5] });
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
describe("HeaderActions (LC-262)", () => {
|
|
42
|
+
it("renders each frequent action as a named icon button, with no overflow menu", () => {
|
|
43
|
+
const result = renderWithProviders(<HeaderActions actions={two} />);
|
|
44
|
+
const buttons = result.getAllByRole("button");
|
|
45
|
+
expect(buttons.map((b) => b.getAttribute("aria-label"))).toEqual(["Stop", "Restart"]);
|
|
46
|
+
expect(buttons.every((b) => (b.textContent ?? "").trim() === "")).toBe(true);
|
|
47
|
+
fireEvent.click(result.getByRole("button", { name: "Restart" }));
|
|
48
|
+
expect(restart).toHaveBeenCalledTimes(1);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it("past three, shows two and puts the rest behind More actions, each row with its glyph", async () => {
|
|
52
|
+
const result = renderWithProviders(<HeaderActions actions={five} />);
|
|
53
|
+
const labels = result.getAllByRole("button").map((b) => b.getAttribute("aria-label"));
|
|
54
|
+
expect(labels).toEqual(["Stop", "Restart", "More actions"]);
|
|
55
|
+
fireEvent.click(result.getByRole("button", { name: "More actions" }));
|
|
56
|
+
await waitFor(() => expect(document.querySelectorAll('[role="menuitem"]').length).toBe(3));
|
|
57
|
+
for (const row of Array.from(document.querySelectorAll('[role="menuitem"]'))) {
|
|
58
|
+
expect(row.querySelector("svg")).toBeTruthy();
|
|
59
|
+
}
|
|
60
|
+
// An icon trigger is not echoed as the menu's first row (LC-262).
|
|
61
|
+
expect(document.querySelector("[data-fp-trigger-row]")).toBeNull();
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it("sits in the sheet header's trailing area, and the sheet stays named by its title", async () => {
|
|
65
|
+
renderWithProviders(
|
|
66
|
+
<SheetModal
|
|
67
|
+
open
|
|
68
|
+
onOpenChange={() => {}}
|
|
69
|
+
header={<Paragraph>keycloak</Paragraph>}
|
|
70
|
+
headerActions={<HeaderActions actions={two} />}
|
|
71
|
+
>
|
|
72
|
+
<Paragraph>Body</Paragraph>
|
|
73
|
+
</SheetModal>,
|
|
74
|
+
);
|
|
75
|
+
await waitFor(() =>
|
|
76
|
+
expect(document.querySelector('[data-testid="sheet-modal-header-actions"]')).toBeTruthy(),
|
|
77
|
+
);
|
|
78
|
+
const slot = document.querySelector('[data-testid="sheet-modal-header-actions"]')!;
|
|
79
|
+
expect(within(slot as HTMLElement).getAllByRole("button").length).toBe(2);
|
|
80
|
+
const dialog = document.querySelector('[role="dialog"]')!;
|
|
81
|
+
const title = document.getElementById(dialog.getAttribute("aria-labelledby") ?? "");
|
|
82
|
+
expect(title?.textContent).toBe("keycloak");
|
|
83
|
+
});
|
|
84
|
+
});
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { DotsThreeIcon } from "@phosphor-icons/react";
|
|
2
|
+
import { createElement, isValidElement, type ComponentType, type ReactNode } from "react";
|
|
3
|
+
import { XStack } from "tamagui";
|
|
4
|
+
import { DropdownMenu } from "../DropdownMenu";
|
|
5
|
+
import { PageBarButton } from "../layouts/page";
|
|
6
|
+
import { useTranslation } from "../shared/i18n";
|
|
7
|
+
import { Tooltip } from "../Tooltip";
|
|
8
|
+
|
|
9
|
+
type Glyph = ReactNode | ComponentType<{ size?: number; color?: string }>;
|
|
10
|
+
|
|
11
|
+
export interface HeaderAction {
|
|
12
|
+
/** Stable key (defaults to the label). */
|
|
13
|
+
key?: string;
|
|
14
|
+
/** The action's glyph: a bare tinted icon (LC-176). */
|
|
15
|
+
icon: Glyph;
|
|
16
|
+
/** The action's name: its accessibility label and tooltip (LC-260). */
|
|
17
|
+
label: string;
|
|
18
|
+
onPress: () => void;
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface HeaderActionsProps {
|
|
23
|
+
actions: HeaderAction[];
|
|
24
|
+
/**
|
|
25
|
+
* Most controls the row shows. Past it, the last slot becomes "…" holding
|
|
26
|
+
* the rest. Defaults to `HEADER_ACTIONS_MAX` (3).
|
|
27
|
+
*/
|
|
28
|
+
max?: number;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** The most icon buttons a header shows before "…" takes the last slot (LC-262). */
|
|
32
|
+
export const HEADER_ACTIONS_MAX = 3;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Which actions show as icon buttons and which go behind "…": all of them when
|
|
36
|
+
* they fit, else the first `max - 1` and "…" for the rest.
|
|
37
|
+
*/
|
|
38
|
+
export function splitHeaderActions<T>(actions: T[], max = HEADER_ACTIONS_MAX) {
|
|
39
|
+
if (actions.length <= max) return { visible: actions, overflow: [] as T[] };
|
|
40
|
+
const shown = Math.max(0, max - 1);
|
|
41
|
+
return { visible: actions.slice(0, shown), overflow: actions.slice(shown) };
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function glyphNode(icon: Glyph): ReactNode {
|
|
45
|
+
if (icon == null || isValidElement(icon)) return icon as ReactNode;
|
|
46
|
+
if (typeof icon === "function" || (typeof icon === "object" && "$$typeof" in icon)) {
|
|
47
|
+
return createElement(icon as ComponentType);
|
|
48
|
+
}
|
|
49
|
+
return icon as ReactNode;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* A sheet's or page's frequent actions as visible icon buttons (LC-262
|
|
54
|
+
* DIRECT-ACTIONS): each a bare glyph with its name as accessibility label and
|
|
55
|
+
* tooltip. "…" appears only for overflow past `max`. Destructive actions never
|
|
56
|
+
* go here; they sit in a `DangerSection`.
|
|
57
|
+
*/
|
|
58
|
+
export function HeaderActions({ actions, max = HEADER_ACTIONS_MAX }: HeaderActionsProps) {
|
|
59
|
+
const { t } = useTranslation();
|
|
60
|
+
const { visible, overflow } = splitHeaderActions(actions, max);
|
|
61
|
+
const last = visible.length - 1;
|
|
62
|
+
return (
|
|
63
|
+
<XStack testID="header-actions" alignItems="center">
|
|
64
|
+
{visible.map((action, index) => (
|
|
65
|
+
<Tooltip key={action.key ?? action.label} content={action.label}>
|
|
66
|
+
<PageBarButton
|
|
67
|
+
icon={action.icon as never}
|
|
68
|
+
aria-label={action.label}
|
|
69
|
+
onPress={action.onPress}
|
|
70
|
+
disabled={action.disabled}
|
|
71
|
+
{...(overflow.length === 0 && index === last ? { edge: "end" as const } : null)}
|
|
72
|
+
/>
|
|
73
|
+
</Tooltip>
|
|
74
|
+
))}
|
|
75
|
+
{overflow.length ? (
|
|
76
|
+
<DropdownMenu
|
|
77
|
+
items={overflow.map((action) => ({
|
|
78
|
+
key: action.key ?? action.label,
|
|
79
|
+
label: action.label,
|
|
80
|
+
icon: glyphNode(action.icon),
|
|
81
|
+
disabled: action.disabled,
|
|
82
|
+
onSelect: action.onPress,
|
|
83
|
+
}))}
|
|
84
|
+
>
|
|
85
|
+
<PageBarButton icon={DotsThreeIcon} aria-label={t("More actions")} edge="end" />
|
|
86
|
+
</DropdownMenu>
|
|
87
|
+
) : null}
|
|
88
|
+
</XStack>
|
|
89
|
+
);
|
|
90
|
+
}
|
package/src/actions/index.ts
CHANGED
|
@@ -16,6 +16,16 @@ export {
|
|
|
16
16
|
|
|
17
17
|
export { ActionBar, type ActionBarAlign, type ActionBarProps } from "./ActionBar";
|
|
18
18
|
|
|
19
|
+
export {
|
|
20
|
+
HeaderActions,
|
|
21
|
+
HEADER_ACTIONS_MAX,
|
|
22
|
+
splitHeaderActions,
|
|
23
|
+
type HeaderAction,
|
|
24
|
+
type HeaderActionsProps,
|
|
25
|
+
} from "./HeaderActions";
|
|
26
|
+
|
|
27
|
+
export { DangerSection, type DangerSectionProps } from "./DangerSection";
|
|
28
|
+
|
|
19
29
|
export {
|
|
20
30
|
actionDevWarn,
|
|
21
31
|
__resetActionDevWarnSeen,
|
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from "@storybook/react-native-web-vite";
|
|
2
2
|
import { DescriptionList } from "@multiplatform.one/forms";
|
|
3
3
|
import {
|
|
4
|
+
ArrowClockwiseIcon,
|
|
4
5
|
ArrowsClockwiseIcon,
|
|
5
6
|
BuildingsIcon,
|
|
6
7
|
CubeIcon,
|
|
7
8
|
HardDrivesIcon,
|
|
8
9
|
PackageIcon,
|
|
9
10
|
StackIcon,
|
|
11
|
+
StopIcon,
|
|
10
12
|
TagIcon,
|
|
11
13
|
TreeStructureIcon,
|
|
12
14
|
} from "@phosphor-icons/react";
|
|
13
15
|
import { useState } from "react";
|
|
14
16
|
import { YStack } from "tamagui";
|
|
17
|
+
import { DangerSection } from "../actions/DangerSection";
|
|
18
|
+
import { DestructiveAction } from "../actions/DestructiveAction";
|
|
19
|
+
import { HeaderActions } from "../actions/HeaderActions";
|
|
15
20
|
import { Avatar } from "../Avatar";
|
|
16
21
|
import { Card } from "../Card";
|
|
17
22
|
import { SheetModal } from "../SheetModal";
|
|
@@ -68,10 +73,13 @@ export const Main: Story = {
|
|
|
68
73
|
|
|
69
74
|
const image = "registry.selfhostedcloud.org/shc/keycloak:26.6.1@sha256:9f2c41a7e0b3";
|
|
70
75
|
|
|
76
|
+
const noop = () => {};
|
|
77
|
+
|
|
71
78
|
/**
|
|
72
79
|
* The SHC stack sheet without its Overview tab. Clay on round 2: "I told you
|
|
73
80
|
* no overview section". The facts the Overview held ride the plate, and the
|
|
74
|
-
* first tab is the stack's services.
|
|
81
|
+
* first tab is the stack's services. Stop and Restart are icon buttons in the
|
|
82
|
+
* header and Uninstall sits in the Danger section at the end (LC-262).
|
|
75
83
|
*/
|
|
76
84
|
function StackSheet() {
|
|
77
85
|
const [open, setOpen] = useState(true);
|
|
@@ -89,6 +97,14 @@ function StackSheet() {
|
|
|
89
97
|
facts={facts}
|
|
90
98
|
/>
|
|
91
99
|
}
|
|
100
|
+
headerActions={
|
|
101
|
+
<HeaderActions
|
|
102
|
+
actions={[
|
|
103
|
+
{ icon: StopIcon, label: "Stop", onPress: noop },
|
|
104
|
+
{ icon: ArrowClockwiseIcon, label: "Restart", onPress: noop },
|
|
105
|
+
]}
|
|
106
|
+
/>
|
|
107
|
+
}
|
|
92
108
|
>
|
|
93
109
|
<Tabs
|
|
94
110
|
defaultValue="services"
|
|
@@ -138,6 +154,9 @@ function StackSheet() {
|
|
|
138
154
|
},
|
|
139
155
|
]}
|
|
140
156
|
/>
|
|
157
|
+
<DangerSection>
|
|
158
|
+
<DestructiveAction verb="Uninstall" noun="keycloak" severity="medium" onAction={noop} />
|
|
159
|
+
</DangerSection>
|
|
141
160
|
</SheetModal>
|
|
142
161
|
</YStack>
|
|
143
162
|
);
|
package/src/layouts/page.tsx
CHANGED
|
@@ -722,6 +722,8 @@ export function PageBarButton(props: PageBarButtonProps) {
|
|
|
722
722
|
const control = useTopBarControl();
|
|
723
723
|
return <Button {...control} data-top-bar-control="action" {...props} />;
|
|
724
724
|
}
|
|
725
|
+
// A menu opened from it is attached with no echo row (LC-262).
|
|
726
|
+
PageBarButton.iconOnly = true;
|
|
725
727
|
|
|
726
728
|
/**
|
|
727
729
|
* The page's "…" overflow trigger: the bar's icon-action recipe. Pass
|
|
@@ -738,3 +740,4 @@ export function PageMenuButton(props: Omit<ButtonProps, "children" | "icon">) {
|
|
|
738
740
|
/>
|
|
739
741
|
);
|
|
740
742
|
}
|
|
743
|
+
PageMenuButton.iconOnly = true;
|
|
@@ -81,6 +81,11 @@ declare const ItemRow: import("tamagui").TamaguiComponent<import("@tamagui/web")
|
|
|
81
81
|
selected?: boolean | undefined;
|
|
82
82
|
}, import("@tamagui/web").StaticConfigPublic>;
|
|
83
83
|
declare const SeparatorLine: import("tamagui").TamaguiComponent<import("@tamagui/web").TamaDefer, TamaguiElement, import("@tamagui/core").RNTamaguiViewNonStyleProps, import("@tamagui/web").StackStyleBase, {}, import("@tamagui/web").StaticConfigPublic>;
|
|
84
|
+
/**
|
|
85
|
+
* A trigger that shows only a glyph: an `icon` and no label children, or a
|
|
86
|
+
* component marked `iconOnly` (PageMenuButton, PageBarButton).
|
|
87
|
+
*/
|
|
88
|
+
export declare function isIconTrigger(trigger: ReactNode): boolean;
|
|
84
89
|
declare function DropdownMenuRoot({ children, items, open: openProp, defaultOpen, onOpenChange, placement, maxHeight, closeOnSelect, size, triggerSizing, anchorMode, triggerRow, }: DropdownMenuProps): import("react/jsx-runtime").JSX.Element;
|
|
85
90
|
export interface DropdownMenuTriggerProps {
|
|
86
91
|
children?: ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/DropdownMenu/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/DropdownMenu/index.t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S,CAAC;CACrB;AAED,iBAAS,iBAAiB,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,sBAAsB,2CAgBxE;AAID,eAAO,MAAM,YAAY;;;;;;;CAOvB,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG,QAAQ,CAAC,OAAO,OAAO,CAAC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* The sheet's header row: what the sheet is about, and its frequent actions as
|
|
4
|
+
* icon buttons in the trailing area (LC-262 DIRECT-ACTIONS), never hidden in a
|
|
5
|
+
* menu.
|
|
6
|
+
*/
|
|
7
|
+
export declare function SheetHeader({ header, actions, titleId, }: {
|
|
8
|
+
header?: ReactNode;
|
|
9
|
+
actions?: ReactNode;
|
|
10
|
+
/** Names the sheet: on the header content alone, so the actions stay out of it. */
|
|
11
|
+
titleId?: string;
|
|
12
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
//# sourceMappingURL=SheetHeader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SheetHeader.d.ts","sourceRoot":"","sources":["../../src/SheetModal/SheetHeader.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,EAC1B,MAAM,EACN,OAAO,EACP,OAAO,GACR,EAAE;IACD,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,mFAAmF;IACnF,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,2CAYA"}
|