Skip to content

Commit 16af36c

Browse files
committed
Fix missing data-step-id across SDK. Fix missing part props in Checklist.Collapsible
1 parent 38ed440 commit 16af36c

File tree

8 files changed

+56
-47
lines changed

8 files changed

+56
-47
lines changed

packages/react/src/components/Announcement/index.tsx

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,24 +19,15 @@ export interface AnnouncementProps extends FlowPropsWithoutChildren, DialogProps
1919
defaultOpen?: boolean
2020
}
2121

22-
export function Announcement({ flowId, part, ...props }: AnnouncementProps) {
22+
export function Announcement({ flowId, ...props }: AnnouncementProps) {
2323
return (
24-
<Flow
25-
as={Dialog}
26-
display="flex"
27-
flexDirection="column"
28-
flowId={flowId}
29-
gap={5}
30-
part={['announcement', part]}
31-
textAlign="center"
32-
{...props}
33-
>
24+
<Flow as={null} flowId={flowId} {...props}>
3425
{({
3526
flow,
3627
handleDismiss,
3728
handlePrimary,
3829
handleSecondary,
39-
parentProps: { dismissible },
30+
parentProps: { containerProps, dismissible },
4031
step,
4132
}) => {
4233
const primaryButtonTitle = step.primaryButton?.title ?? step.primaryButtonTitle
@@ -47,7 +38,15 @@ export function Announcement({ flowId, part, ...props }: AnnouncementProps) {
4738
const { videoProps } = getVideoProps(step.props ?? {})
4839

4940
return (
50-
<>
41+
<Dialog
42+
data-step-id={step.id}
43+
display="flex"
44+
flexDirection="column"
45+
gap={5}
46+
part="announcement"
47+
textAlign="center"
48+
{...containerProps}
49+
>
5150
{dismissible && <Dialog.Dismiss onClick={handleDismiss} />}
5251
<Flex.Column gap={1} part="announcement-header">
5352
<Dialog.Title>{step.title}</Dialog.Title>
@@ -95,7 +94,7 @@ export function Announcement({ flowId, part, ...props }: AnnouncementProps) {
9594
/>
9695
)}
9796
</Flex.Row>
98-
</>
97+
</Dialog>
9998
)
10099
}}
101100
</Flow>

packages/react/src/components/Banner/index.tsx

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,35 @@ import { Box } from '@/components/Box'
55

66
export interface BannerProps extends FlowPropsWithoutChildren {}
77

8-
export function Banner({ flowId, part, ...props }: BannerProps) {
8+
export function Banner({ flowId, ...props }: BannerProps) {
99
return (
10-
<Flow
11-
alignItems="center"
12-
aria-label="Banner"
13-
as={Card}
14-
borderWidth="md"
15-
display="flex"
16-
flexDirection="row"
17-
flowId={flowId}
18-
gap={3}
19-
justifyContent="flex-start"
20-
part={['banner', part]}
21-
role="complementary"
22-
{...props}
23-
>
24-
{({ handleDismiss, handlePrimary, handleSecondary, parentProps: { dismissible }, step }) => {
10+
<Flow as={null} flowId={flowId} {...props}>
11+
{({
12+
handleDismiss,
13+
handlePrimary,
14+
handleSecondary,
15+
parentProps: { containerProps, dismissible },
16+
step,
17+
}) => {
2518
const primaryButtonTitle = step.primaryButton?.title ?? step.primaryButtonTitle
2619
const secondaryButtonTitle = step.secondaryButton?.title ?? step.secondaryButtonTitle
2720

2821
const disabled = step.$state.blocked
2922

3023
return (
31-
<>
24+
<Card
25+
alignItems="center"
26+
aria-label="Banner"
27+
borderWidth="md"
28+
data-step-id={step.id}
29+
display="flex"
30+
flexDirection="row"
31+
gap={3}
32+
justifyContent="flex-start"
33+
part="banner"
34+
role="complementary"
35+
{...containerProps}
36+
>
3237
{step.imageUri && (
3338
<Box
3439
as="img"
@@ -50,7 +55,7 @@ export function Banner({ flowId, part, ...props }: BannerProps) {
5055
/>
5156
<Card.Primary disabled={disabled} title={primaryButtonTitle} onClick={handlePrimary} />
5257
{dismissible && <Card.Dismiss onClick={handleDismiss} />}
53-
</>
58+
</Card>
5459
)
5560
}}
5661
</Flow>

packages/react/src/components/Checklist/CarouselStep.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ export function CarouselStep({ onPrimary, onSecondary, step }: CarouselStepProps
4242
flexBasis: '25%',
4343
},
4444
}}
45+
data-step-id={step.id}
4546
flex="0 0 30%"
4647
gap="2"
4748
p="4"

packages/react/src/components/Checklist/Collapsible.tsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,12 @@ function DefaultCollapsibleStep({
7676
const { videoProps } = getVideoProps(stepProps)
7777

7878
return (
79-
<CollapsibleStep.Root open={open} onOpenChange={onOpenChange} {...stepProps}>
79+
<CollapsibleStep.Root
80+
data-step-id={step.id}
81+
open={open}
82+
onOpenChange={onOpenChange}
83+
{...stepProps}
84+
>
8085
<CollapsibleStep.Trigger
8186
isBlocked={step.$state.blocked}
8287
isCompleted={completed || skipped}
@@ -183,17 +188,16 @@ export function Collapsible({
183188

184189
return (
185190
<>
186-
<Flex.Column gap={2}>
191+
<Flex.Column gap={2} part="checklist-header">
187192
<Card.Header
188193
dismissible={dismissible}
189194
handleDismiss={handleDismiss}
190-
part="checklist-header"
191195
subtitle={flow.subtitle}
192196
title={flow.title}
193197
/>
194198

195-
<Flex.Row alignItems="center" gap={2}>
196-
<Text.Body2 fontWeight="demibold">
199+
<Flex.Row alignItems="center" gap={2} part="checklist-progress">
200+
<Text.Body2 fontWeight="demibold" part="progress-text">
197201
{currentSteps}/{availableSteps}
198202
</Text.Body2>
199203
<Progress.Bar current={currentSteps} total={availableSteps} flexGrow={1} />

packages/react/src/components/Checklist/CollapsibleStep.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ function CheckIndicator({ checked = false }) {
4949
borderStyle="solid"
5050
borderColor="neutral.border"
5151
borderRadius="100%"
52+
marginRight="2"
5253
padding="0"
5354
part="field-radio-value"
5455
position="relative"
@@ -100,7 +101,7 @@ export function Content({ children }) {
100101
It creates a flex gap at the top of this column, which animates smoothly.
101102
Other forms of whitespace like margin or padding? Not so smooth!
102103
*/}
103-
<Box />
104+
<Box part="checklist-spacer" />
104105

105106
{children}
106107
</Flex.Column>
@@ -139,7 +140,7 @@ export function Trigger({ isCompleted, isBlocked, title }) {
139140
<Collapsible.Trigger asChild>
140141
<Flex.Row
141142
alignItems="center"
142-
justifyContent="space-between"
143+
justifyContent="flex-start"
143144
margin={-5}
144145
padding={5}
145146
zIndex={1}
@@ -149,12 +150,10 @@ export function Trigger({ isCompleted, isBlocked, title }) {
149150
cursor={isBlocked ? 'not-allowed' : 'pointer'}
150151
part="collapsible-header"
151152
>
152-
<Flex.Row alignItems="center" gap={2}>
153-
<CheckIndicator checked={isCompleted} />
154-
<Text.Body2 fontWeight="demibold" userSelect="none" part="collapsible-title">
155-
{title}
156-
</Text.Body2>
157-
</Flex.Row>
153+
<CheckIndicator checked={isCompleted} />
154+
<Text.Body2 fontWeight="demibold" userSelect="none" part="collapsible-title">
155+
{title}
156+
</Text.Body2>
158157

159158
<Box
160159
as={ChevronDownIcon}
@@ -166,6 +165,7 @@ export function Trigger({ isCompleted, isBlocked, title }) {
166165
}}
167166
display="block"
168167
height="16px"
168+
marginLeft="auto"
169169
order={2}
170170
part="collapsible-step-icon"
171171
width="16px"

packages/react/src/components/Checklist/FloatingStep.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import { useStepHandlers } from '@/hooks/useStepHandlers'
1111

1212
import { floatingTransitionCSS } from '@/components/Checklist/Floating.styles'
1313

14-
// TODO: Type props
1514
export function FloatingStep({ onPrimary, onSecondary, openStepId, setOpenStepId, step }) {
1615
const anchorPointerEnterTimeout = useRef<ReturnType<typeof setTimeout>>()
1716
const { handlePrimary, handleSecondary } = useStepHandlers(step, { onPrimary, onSecondary })
@@ -34,7 +33,6 @@ export function FloatingStep({ onPrimary, onSecondary, openStepId, setOpenStepId
3433
}
3534
}
3635

37-
// TODO: Handle tap while open on mobile to close step
3836
function handlePointerEnter() {
3937
clearTimeout(anchorPointerEnterTimeout.current)
4038

packages/react/src/components/Flow/FlowProps.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ export interface FlowProps extends FlowPropsWithoutChildren {
8181
}
8282

8383
type ParentProps = {
84+
as: FlowPropsWithoutChildren['as']
8485
containerProps: Record<string, unknown>
8586
dismissible: boolean
8687
flowId: string

packages/react/src/components/Flow/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ export function Flow({
146146
handlePrimary,
147147
handleSecondary,
148148
parentProps: {
149+
as,
149150
dismissible,
150151
flowId,
151152
variables,

0 commit comments

Comments
 (0)