Skip to content

Commit f58bca1

Browse files
committed
clean up
1 parent 6845787 commit f58bca1

File tree

5 files changed

+6
-173
lines changed

5 files changed

+6
-173
lines changed

src/i18n/messages/all.en.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,4 +470,4 @@
470470
"i18nStrings.nextButtonLoadingAnnouncement": "Loading next step",
471471
"i18nStrings.submitButtonLoadingAnnouncement": "Submitting form"
472472
}
473-
}
473+
}

src/wizard/internal.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
// SPDX-License-Identifier: Apache-2.0
3-
import React, { useRef, useState } from 'react';
3+
import React, { useRef } from 'react';
44
import clsx from 'clsx';
55

66
import { useMergeRefs, warnOnce } from '@cloudscape-design/component-toolkit/internal';
@@ -70,9 +70,6 @@ export default function InternalWizard({
7070
const farthestStepIndex = useRef<number>(actualActiveStepIndex);
7171
farthestStepIndex.current = Math.max(farthestStepIndex.current, actualActiveStepIndex);
7272

73-
// State for expandable step navigation (expanded by default for accessibility)
74-
const [stepNavigationExpanded, setStepNavigationExpanded] = useState(true);
75-
7673
const isVisualRefresh = useVisualRefresh();
7774
const isLastStep = actualActiveStepIndex >= steps.length - 1;
7875

@@ -214,8 +211,6 @@ export default function InternalWizard({
214211
onStepClick={onStepClick}
215212
onSkipToClick={onSkipToClick}
216213
onPrimaryClick={onPrimaryClick}
217-
stepNavigationExpanded={stepNavigationExpanded}
218-
onStepNavigationExpandedChange={setStepNavigationExpanded}
219214
/>
220215
</div>
221216
</div>

src/wizard/styles.scss

Lines changed: 0 additions & 151 deletions
Original file line numberDiff line numberDiff line change
@@ -267,157 +267,6 @@
267267
}
268268
}
269269

270-
.collapsed-steps-navigation {
271-
display: inline-block;
272-
}
273-
274-
.collapsed-steps-trigger {
275-
@include styles.styles-reset;
276-
display: inline-flex;
277-
align-items: center;
278-
gap: awsui.$space-xxs;
279-
padding-block: 0;
280-
padding-inline: 0;
281-
border-block: none;
282-
border-inline: none;
283-
background: transparent;
284-
color: awsui.$color-text-link-default;
285-
font-weight: styles.$font-weight-bold;
286-
font-size: inherit;
287-
cursor: pointer;
288-
289-
&:hover {
290-
color: awsui.$color-text-link-hover;
291-
}
292-
293-
&:disabled {
294-
color: awsui.$color-text-interactive-disabled;
295-
cursor: default;
296-
}
297-
298-
@include focus-visible.when-visible {
299-
@include styles.link-focus;
300-
}
301-
}
302-
303-
.collapsed-steps-trigger-label {
304-
/* used for test utils */
305-
}
306-
307-
.step-navigation-list {
308-
list-style: none;
309-
margin-block: 0;
310-
margin-inline: 0;
311-
padding-block: 0;
312-
padding-inline: 0;
313-
}
314-
315-
.step-navigation-item {
316-
position: relative;
317-
padding-inline-start: awsui.$space-l;
318-
margin-block-end: awsui.$space-s;
319-
320-
&:not(:last-child)::before {
321-
content: '';
322-
position: absolute;
323-
inset-inline-start: calc(#{awsui.$space-l} / 2 - 1px);
324-
inset-block-start: calc(#{awsui.$space-m} + 6px);
325-
block-size: calc(100% + #{awsui.$space-s} - 6px);
326-
inline-size: 2px;
327-
background-color: awsui.$color-border-divider-default;
328-
}
329-
330-
&:last-child {
331-
margin-block-end: 0;
332-
}
333-
}
334-
335-
.step-navigation-button {
336-
@include styles.styles-reset;
337-
display: flex;
338-
align-items: flex-start;
339-
gap: awsui.$space-xs;
340-
padding-block: 0;
341-
padding-inline: 0;
342-
border-block: none;
343-
border-inline: none;
344-
background: transparent;
345-
cursor: pointer;
346-
text-align: start;
347-
inline-size: 100%;
348-
349-
&:disabled {
350-
cursor: default;
351-
}
352-
353-
@include focus-visible.when-visible {
354-
@include styles.link-focus;
355-
}
356-
}
357-
358-
.step-navigation-button-disabled {
359-
cursor: default;
360-
}
361-
362-
.step-navigation-circle {
363-
flex-shrink: 0;
364-
inline-size: 12px;
365-
block-size: 12px;
366-
margin-block-start: 4px;
367-
border-start-start-radius: 50%;
368-
border-start-end-radius: 50%;
369-
border-end-start-radius: 50%;
370-
border-end-end-radius: 50%;
371-
border-block: 2px solid awsui.$color-text-interactive-disabled;
372-
border-inline: 2px solid awsui.$color-text-interactive-disabled;
373-
background-color: awsui.$color-background-container-content;
374-
box-sizing: border-box;
375-
}
376-
377-
.step-navigation-circle-selected {
378-
border-color: awsui.$color-background-control-checked;
379-
background-color: awsui.$color-background-control-checked;
380-
box-shadow:
381-
0 0 0 2px awsui.$color-background-container-content,
382-
0 0 0 4px awsui.$color-background-control-checked;
383-
}
384-
385-
.step-navigation-circle-visited {
386-
border-color: awsui.$color-text-interactive-default;
387-
}
388-
389-
.step-navigation-circle-unvisited {
390-
border-color: awsui.$color-text-interactive-disabled;
391-
}
392-
393-
.step-navigation-content {
394-
display: flex;
395-
flex-direction: column;
396-
}
397-
398-
.step-navigation-label {
399-
font-size: awsui.$font-size-body-s;
400-
color: awsui.$color-text-small;
401-
}
402-
403-
.step-navigation-title {
404-
font-size: awsui.$font-size-body-m;
405-
color: awsui.$color-text-body-default;
406-
}
407-
408-
.step-navigation-title-selected {
409-
color: awsui.$color-background-control-checked;
410-
font-weight: styles.$font-weight-bold;
411-
}
412-
413-
.step-navigation-title-visited {
414-
color: awsui.$color-text-interactive-default;
415-
}
416-
417-
.step-navigation-title-unvisited {
418-
color: awsui.$color-text-status-inactive;
419-
}
420-
421270
.form-header-component {
422271
&-wrapper {
423272
outline: none;

src/wizard/wizard-form.tsx

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ interface WizardFormProps extends InternalBaseComponentProps {
4545
onPrimaryClick: () => void;
4646
onStepClick: (stepIndex: number) => void;
4747
onSkipToClick: (stepIndex: number) => void;
48-
stepNavigationExpanded?: boolean;
49-
onStepNavigationExpandedChange?: (expanded: boolean) => void;
5048
}
5149

5250
export const STEP_NAME_SELECTOR = `[${DATA_ATTR_FUNNEL_KEY}="${FUNNEL_KEY_STEP_NAME}"]`;
@@ -93,8 +91,6 @@ function WizardForm({
9391
onPrimaryClick,
9492
onStepClick,
9593
onSkipToClick,
96-
stepNavigationExpanded = false,
97-
onStepNavigationExpandedChange,
9894
}: WizardFormProps & { stepHeaderRef: MutableRefObject<HTMLDivElement | null> }) {
9995
const rootRef = useRef<HTMLElement>();
10096
const ref = useMergeRefs(rootRef, __internalRootRef);
@@ -152,11 +148,7 @@ function WizardForm({
152148
<>
153149
<WizardFormHeader>
154150
<div className={clsx(styles['collapsed-steps'], !showCollapsedSteps && styles['collapsed-steps-hidden'])}>
155-
<WizardStepNavigationExpandable
156-
{...stepNavigationProps}
157-
expanded={stepNavigationExpanded}
158-
onExpandedChange={onStepNavigationExpandedChange ?? (() => {})}
159-
/>
151+
<WizardStepNavigationExpandable {...stepNavigationProps} />
160152
</div>
161153
<InternalHeader
162154
className={styles['form-header-component']}

src/wizard/wizard-step-navigation-expandable.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
// SPDX-License-Identifier: Apache-2.0
3-
import React from 'react';
3+
import React, { useState } from 'react';
44

55
import InternalExpandableSection from '../expandable-section/internal';
66
import { WizardProps } from './interfaces';
@@ -10,8 +10,6 @@ interface WizardStepNavigationExpandableProps {
1010
activeStepIndex: number;
1111
farthestStepIndex: number;
1212
allowSkipTo: boolean;
13-
expanded: boolean;
14-
onExpandedChange: (expanded: boolean) => void;
1513
i18nStrings: WizardProps.I18nStrings;
1614
isLoadingNextStep: boolean;
1715
onStepClick: (stepIndex: number) => void;
@@ -23,22 +21,21 @@ export default function WizardStepNavigationExpandable({
2321
activeStepIndex,
2422
farthestStepIndex,
2523
allowSkipTo,
26-
expanded,
27-
onExpandedChange,
2824
i18nStrings,
2925
isLoadingNextStep,
3026
onStepClick,
3127
onSkipToClick,
3228
steps,
3329
}: WizardStepNavigationExpandableProps) {
30+
const [expanded, setExpanded] = useState(true);
3431
const collapsedStepsLabel = i18nStrings.collapsedStepsLabel?.(activeStepIndex + 1, steps.length);
3532

3633
return (
3734
<InternalExpandableSection
3835
variant="footer"
3936
headerText={collapsedStepsLabel}
4037
expanded={expanded}
41-
onChange={({ detail }) => onExpandedChange(detail.expanded)}
38+
onChange={({ detail }) => setExpanded(detail.expanded)}
4239
>
4340
<nav aria-label={i18nStrings.navigationAriaLabel}>
4441
<WizardStepList

0 commit comments

Comments
 (0)