Skip to content

Commit d932710

Browse files
anveshmekalabenelan
authored andcommitted
feat(stepper): enable responsive layout (#7744)
**Related Issue:** #6694 Enables responsive layout for stepper component. - stepper element `host` display is changed to `flex` from `grid` - grid column width will use `minmax( )` instead of fixed fractional units. - When none of the stepper item's are selected and the first one is disabled, the first available enabled stepper will be selected.
1 parent ebafefd commit d932710

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+765
-110
lines changed

packages/calcite-components/calcite-preset.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ export default {
221221
4.5: "1.125rem",
222222
9: "2.25rem",
223223
11: "2.75rem",
224+
13: "3.25rem",
224225
},
225226
transitionProperty: {
226227
margin: "margin",

packages/calcite-components/src/components/icon/icon.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,14 @@ export class Icon {
142142
return;
143143
}
144144

145-
this.pathData = await fetchIcon({ icon, scale });
145+
const pathData = await fetchIcon({ icon, scale });
146+
147+
// While the fetchIcon method is awaiting response, the icon requested can change. This check is to verify the response received belongs to the current icon.
148+
if (icon !== this.icon) {
149+
return;
150+
}
151+
152+
this.pathData = pathData;
146153
}
147154

148155
private waitUntilVisible(callback: () => void): void {

packages/calcite-components/src/components/stepper-item/stepper-item.scss

Lines changed: 38 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
--calcite-stepper-item-spacing-unit-s: theme("spacing.1");
33
--calcite-stepper-item-spacing-unit-m: theme("spacing.3");
44
--calcite-stepper-item-spacing-unit-l: theme("spacing.4");
5+
--calcite-internal-stepper-action-inline-size: theme("spacing.8");
56
@apply text-n1h;
67
margin-inline-end: theme("margin.1");
78
.stepper-item-description {
@@ -13,6 +14,7 @@
1314
--calcite-stepper-item-spacing-unit-s: theme("spacing.2");
1415
--calcite-stepper-item-spacing-unit-m: theme("spacing.4");
1516
--calcite-stepper-item-spacing-unit-l: theme("spacing.5");
17+
--calcite-internal-stepper-action-inline-size: theme("spacing.10");
1618
@apply text-0h;
1719
margin-inline-end: theme("margin.2");
1820
.stepper-item-description {
@@ -24,6 +26,7 @@
2426
--calcite-stepper-item-spacing-unit-s: theme("spacing.3");
2527
--calcite-stepper-item-spacing-unit-m: theme("spacing.5");
2628
--calcite-stepper-item-spacing-unit-l: theme("spacing.6");
29+
--calcite-internal-stepper-action-inline-size: theme("spacing.12");
2730
@apply text-1h;
2831
margin-inline-end: theme("margin.3");
2932
.stepper-item-description {
@@ -257,10 +260,7 @@
257260
border-solid
258261
border-t-2
259262
focus-base;
260-
261263
grid-row: items;
262-
margin-inline-end: theme("margin.2");
263-
margin-block-end: var(--calcite-stepper-item-spacing-unit-s);
264264

265265
&:focus {
266266
@apply focus-outset;
@@ -287,19 +287,6 @@
287287
}
288288
}
289289

290-
:host([layout="horizontal"][scale="s"]) {
291-
.stepper-item-header {
292-
margin-inline-end: theme("margin.1");
293-
margin-block-end: var(--calcite-stepper-item-spacing-unit-s);
294-
}
295-
}
296-
:host([layout="horizontal"][scale="l"]) {
297-
.stepper-item-header {
298-
margin-inline-end: theme("margin.3");
299-
margin-block-end: var(--calcite-stepper-item-spacing-unit-s);
300-
}
301-
}
302-
303290
:host([layout="horizontal"][complete]) .stepper-item-header {
304291
border-color: rgba($h-bb-060, 0.5);
305292
}
@@ -310,7 +297,7 @@
310297
:host([layout="horizontal"][error]) .stepper-item-header {
311298
@apply border-color-danger;
312299
}
313-
:host([layout="horizontal"][selected]) .stepper-item-header {
300+
:host([layout="horizontal"][selected][multiple-view-mode]) .stepper-item-header {
314301
@apply border-color-brand;
315302
}
316303
:host([layout="horizontal"]:hover:not([disabled]):not([selected])) .stepper-item-header,
@@ -348,6 +335,40 @@
348335
}
349336
}
350337

338+
:host([layout="horizontal"]:not([multiple-view-mode])) .stepper-item-header {
339+
@apply border-none
340+
me-0;
341+
inline-size: 100%;
342+
padding-inline: calc(var(--calcite-internal-stepper-action-inline-size) + 0.5rem);
343+
}
344+
345+
:host([layout="horizontal"][error]:not([multiple-view-mode])) .container {
346+
& .stepper-item-number {
347+
color: theme("backgroundColor.danger");
348+
}
349+
& .stepper-item-icon {
350+
@apply opacity-100;
351+
color: theme("backgroundColor.danger");
352+
}
353+
}
354+
355+
:host([layout="horizontal"][error][selected]:not([multiple-view-mode])),
356+
:host([layout="horizontal"][complete][selected]:not([multiple-view-mode])) .container {
357+
@apply text-color-3;
358+
& .stepper-item-heading {
359+
@apply text-color-2;
360+
}
361+
}
362+
363+
:host([layout="horizontal"][complete][selected]:not([multiple-view-mode])) .container {
364+
& .stepper-item-icon {
365+
@apply opacity-disabled;
366+
}
367+
& .stepper-item-number {
368+
@apply text-color-3;
369+
}
370+
}
371+
351372
.visually-hidden {
352373
@apply sr-only;
353374
}

packages/calcite-components/src/components/stepper-item/stepper-item.tsx

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,13 @@ export class StepperItem
142142
*/
143143
@Prop({ reflect: true }) scale: Scale = "m";
144144

145+
/**
146+
* Specifies if the user is viewing one `stepper-item` at a time.
147+
* Helps in determining if header region is tabbable.
148+
* @internal
149+
*/
150+
@Prop({ reflect: true }) multipleViewMode = false;
151+
145152
/**
146153
* Use this property to override individual strings used by the component.
147154
*/
@@ -260,7 +267,7 @@ export class StepperItem
260267
class={CSS.stepperItemHeader}
261268
tabIndex={
262269
/* additional tab index logic needed because of display: contents */
263-
this.layout === "horizontal" && !this.disabled ? 0 : null
270+
this.layout === "horizontal" && !this.disabled && this.multipleViewMode ? 0 : null
264271
}
265272
// eslint-disable-next-line react/jsx-sort-props -- ref should be last so node attrs/props are in sync (see https://github.com/Esri/calcite-design-system/pull/6530)
266273
ref={(el) => (this.headerEl = el)}
@@ -358,13 +365,15 @@ export class StepperItem
358365
};
359366

360367
private renderIcon(): VNode {
361-
const path = this.selected
362-
? "circleF"
363-
: this.error
364-
? "exclamationMarkCircleF"
365-
: this.complete
366-
? "checkCircleF"
367-
: "circle";
368+
let path = "circle";
369+
370+
if (this.selected && (this.multipleViewMode || (!this.error && !this.complete))) {
371+
path = "circleF";
372+
} else if (this.error) {
373+
path = "exclamationMarkCircleF";
374+
} else if (this.complete) {
375+
path = "checkCircleF";
376+
}
368377

369378
return (
370379
<calcite-icon class="stepper-item-icon" flipRtl={this.iconFlipRtl} icon={path} scale="s" />
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
{
2-
"label": "Progress steps"
2+
"label": "Progress steps",
3+
"previousStep": "Previous step",
4+
"nextStep": "Next step"
35
}
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
{
2-
"label": "خطوات التقدم"
2+
"label": "خطوات التقدم",
3+
"previousStep": "الخطوة السابقة",
4+
"nextStep": "الخطوة التالية"
35
}
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
{
2-
"label": "Стъпки на напредъка"
2+
"label": "Стъпки на напредъка",
3+
"previousStep": "Предишна стъпка",
4+
"nextStep": "Следваща стъпка"
35
}
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
{
2-
"label": "Koraci napretka"
2+
"label": "Koraci napretka",
3+
"previousStep": "Prethodni korak",
4+
"nextStep": "Sljedeći korak"
35
}
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
{
2-
"label": "Passos de progrés"
2+
"label": "Passos de progrés",
3+
"previousStep": "Pas anterior",
4+
"nextStep": "Pas següent"
35
}
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
{
2-
"label": "Kroky průběhu"
2+
"label": "Kroky průběhu",
3+
"previousStep": "Předchozí krok",
4+
"nextStep": "Další krok"
35
}
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
{
2-
"label": "Statustrin"
2+
"label": "Statustrin",
3+
"previousStep": "Forrige trin",
4+
"nextStep": "Næste trin"
35
}
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
{
2-
"label": "Statusschritte"
2+
"label": "Statusschritte",
3+
"previousStep": "Vorheriger Schritt",
4+
"nextStep": "Nächster Schritt"
35
}
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
{
2-
"label": "Βήματα προόδου"
2+
"label": "Βήματα προόδου",
3+
"previousStep": "Προηγούμενο βήμα",
4+
"nextStep": "Επόμενο βήμα"
35
}
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
{
2-
"label": "Progress steps"
2+
"label": "Progress steps",
3+
"previousStep": "Previous step",
4+
"nextStep": "Next step"
35
}
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
{
2-
"label": "Pasos de progreso"
2+
"label": "Pasos de progreso",
3+
"previousStep": "Paso anterior",
4+
"nextStep": "Paso siguiente"
35
}
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
{
2-
"label": "Edenemise etapid"
2+
"label": "Edenemise etapid",
3+
"previousStep": "Eelmine toiming",
4+
"nextStep": "Järgmine toiming"
35
}
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
{
2-
"label": "Edistymisen vaiheet"
2+
"label": "Edistymisen vaiheet",
3+
"previousStep": "Edellinen vaihe",
4+
"nextStep": "Seuraava vaihe"
35
}
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
{
2-
"label": "Étapes de progression"
2+
"label": "Étapes de progression",
3+
"previousStep": "Étape précédente",
4+
"nextStep": "Étape suivante"
35
}
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
{
2-
"label": "שלבי התקדמות"
2+
"label": "שלבי התקדמות",
3+
"previousStep": "השלב הקודם",
4+
"nextStep": "השלב הבא"
35
}
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
{
2-
"label": "Koraci napretka"
2+
"label": "Koraci napretka",
3+
"previousStep": "Prethodni korak",
4+
"nextStep": "Sljedeći korak"
35
}
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
{
2-
"label": "Előrehaladás lépései"
2+
"label": "Előrehaladás lépései",
3+
"previousStep": "Előző lépés",
4+
"nextStep": "Következő lépés"
35
}
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
{
2-
"label": "Langkah dalam proses"
2+
"label": "Langkah dalam proses",
3+
"previousStep": "Langkah sebelumnya",
4+
"nextStep": "Langkah berikutnya"
35
}
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
{
2-
"label": "Passi di avanzamento"
2+
"label": "Passi di avanzamento",
3+
"previousStep": "Passaggio precedente",
4+
"nextStep": "Passaggio successivo"
35
}
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
{
2-
"label": "ステップの進行状況"
2+
"label": "ステップの進行状況",
3+
"previousStep": "前のステップ",
4+
"nextStep": "次のステップ"
35
}
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
{
2-
"label": "진행 단계"
2+
"label": "진행 단계",
3+
"previousStep": "이전 단계",
4+
"nextStep": "다음 단계"
35
}
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
{
2-
"label": "Eigos žingsniai"
2+
"label": "Eigos žingsniai",
3+
"previousStep": "Ankstesnis žingsnis",
4+
"nextStep": "Kitas žingsnis"
35
}
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
{
2-
"label": "Progresa soļi"
2+
"label": "Progresa soļi",
3+
"previousStep": "Iepriekšējā darbība",
4+
"nextStep": "Nākamā darbība"
35
}
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
{
2-
"label": "Voortgangsstappen"
2+
"label": "Voortgangsstappen",
3+
"previousStep": "Vorige stap",
4+
"nextStep": "Volgende stap"
35
}
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
{
2-
"label": "Fremdriftstrinn"
2+
"label": "Fremdriftstrinn",
3+
"previousStep": "Forrige trinn",
4+
"nextStep": "Neste trinn"
35
}
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
{
2-
"label": "Etapy postępu"
2+
"label": "Etapy postępu",
3+
"previousStep": "Poprzedni etap",
4+
"nextStep": "Następny etap"
35
}
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
{
2-
"label": "Etapas de progresso"
2+
"label": "Etapas de progresso",
3+
"previousStep": "Etapa anterior",
4+
"nextStep": "Próxima etapa"
35
}
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
{
2-
"label": "Passos de progresso"
2+
"label": "Passos de progresso",
3+
"previousStep": "Passo anterior",
4+
"nextStep": "Próximo passo"
35
}
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
{
2-
"label": "Pași de progres"
2+
"label": "Pași de progres",
3+
"previousStep": "Pasul anterior",
4+
"nextStep": "Pasul următor"
35
}
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
{
2-
"label": "Шаги выполнения"
2+
"label": "Шаги выполнения",
3+
"previousStep": "Предыдущий шаг",
4+
"nextStep": "Следующий шаг"
35
}
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
{
2-
"label": "Kroky postupu"
2+
"label": "Kroky postupu",
3+
"previousStep": "Predchádzajúci krok",
4+
"nextStep": "Ďaľší krok"
35
}
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
{
2-
"label": "Koraki napredka"
2+
"label": "Koraki napredka",
3+
"previousStep": "Prejšnji korak",
4+
"nextStep": "Naslednji korak"
35
}

0 commit comments

Comments
 (0)