Skip to content

Commit

Permalink
Refactor #5266
Browse files Browse the repository at this point in the history
  • Loading branch information
tugcekucukoglu committed Feb 20, 2024
1 parent 89610aa commit 5cc61a3
Show file tree
Hide file tree
Showing 82 changed files with 233 additions and 146 deletions.
16 changes: 11 additions & 5 deletions components/lib/stepper/Stepper.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* @module stepper
*
*/
import { VNode } from 'vue';
import { ComponentHooks } from '../basecomponent';
import { PassThroughOptions } from '../passthrough';
import { StepperPanelPassThroughOptionType } from '../stepperpanel';
Expand Down Expand Up @@ -53,10 +54,6 @@ export interface StepperPassThroughOptions {
* Used to pass attributes to the root's DOM element.
*/
root?: StepperPassThroughOptionType;
/**
* Used to pass attributes to the nav container's DOM element.
*/
navContainer?: StepperPassThroughOptionType;
/**
* Used to pass attributes to the nav's DOM element.
*/
Expand Down Expand Up @@ -151,7 +148,16 @@ export interface StepperProps {
/**
* Defines valid slots in Stepper component.
*/
export interface StepperSlots {}
export interface StepperSlots {
/**
* Custom start template.
*/
start(): VNode[];
/**
* Custom end template.
*/
end(): VNode[];
}

/**
* Defines valid emits in Stepper component.
Expand Down
123 changes: 61 additions & 62 deletions components/lib/stepper/Stepper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,52 +3,50 @@
<slot v-if="$slots.start" name="start" />

<template v-if="orientation === 'horizontal'">
<div :class="cx('navContainer')" v-bind="ptm('navContainer')">
<ul ref="nav" :class="cx('nav')" v-bind="ptm('nav')">
<li
v-for="(step, index) of stepperpanels"
:key="getStepKey(step, index)"
:class="cx('stepper.header', { step, index })"
:aria-current="isStepActive(index) ? 'step' : undefined"
role="presentation"
v-bind="{ ...getStepPT(step, 'root', index), ...getStepPT(step, 'header', index) }"
data-pc-name="stepperpanel"
:data-p-highlight="isStepActive(index)"
:data-p-disabled="isItemDisabled(index)"
:data-pc-index="index"
:data-p-active="isStepActive(index)"
>
<slot name="header">
<StepperHeader
:id="getStepHeaderActionId(index)"
:template="step.children?.header"
:stepperpanel="step"
:index="index"
:disabled="isItemDisabled(index)"
:active="isStepActive(index)"
:highlighted="index < d_activeStep"
:class="cx('stepper.action')"
:aria-controls="getStepContentId(index)"
:clickCallback="(event) => onItemClick(event, index)"
:getStepPT="getStepPT"
:getStepProp="getStepProp"
/>
</slot>
<slot v-if="index !== stepperpanels.length - 1" name="separator">
<StepperSeparator
v-if="index !== stepperpanels.length - 1"
:template="step.children?.separator"
:separatorClass="cx('stepper.separator')"
:stepperpanel="step"
:index="index"
:active="isStepActive(index)"
:highlighted="index < d_activeStep"
:getStepPT="getStepPT(step, 'separator', index)"
/>
</slot>
</li>
</ul>
</div>
<ul ref="nav" :class="cx('nav')" v-bind="ptm('nav')">
<li
v-for="(step, index) of stepperpanels"
:key="getStepKey(step, index)"
:class="cx('stepper.header', { step, index })"
:aria-current="isStepActive(index) ? 'step' : undefined"
role="presentation"
v-bind="{ ...getStepPT(step, 'root', index), ...getStepPT(step, 'header', index) }"
data-pc-name="stepperpanel"
:data-p-highlight="isStepActive(index)"
:data-p-disabled="isItemDisabled(index)"
:data-pc-index="index"
:data-p-active="isStepActive(index)"
>
<slot name="header">
<StepperHeader
:id="getStepHeaderActionId(index)"
:template="step.children?.header"
:stepperpanel="step"
:index="index"
:disabled="isItemDisabled(index)"
:active="isStepActive(index)"
:highlighted="index < d_activeStep"
:class="cx('stepper.action')"
:aria-controls="getStepContentId(index)"
:clickCallback="(event) => onItemClick(event, index)"
:getStepPT="getStepPT"
:getStepProp="getStepProp"
/>
</slot>
<slot v-if="index !== stepperpanels.length - 1" name="separator">
<StepperSeparator
v-if="index !== stepperpanels.length - 1"
:template="step.children?.separator"
:separatorClass="cx('stepper.separator')"
:stepperpanel="step"
:index="index"
:active="isStepActive(index)"
:highlighted="index < d_activeStep"
:getStepPT="getStepPT(step, 'separator', index)"
/>
</slot>
</li>
</ul>
<div :class="cx('panelContainer')" v-bind="ptm('panelContainer')">
<template v-for="(step, index) of stepperpanels" :key="getStepKey(step, index)">
<StepperContent
Expand Down Expand Up @@ -100,20 +98,21 @@
/>
</slot>
</div>
<div :class="cx('stepper.toggleableContent')" v-bind="getStepPT(step, 'toggleableContent', index)">
<slot v-if="index !== stepperpanels.length - 1" name="separator">
<StepperSeparator
v-if="index !== stepperpanels.length - 1"
:template="step.children?.separator"
:separatorClass="cx('stepper.separator')"
:stepperpanel="step"
:index="index"
:active="isStepActive(index)"
:highlighted="index < d_activeStep"
:getStepPT="getStepPT(step, 'separator', index)"
/>
</slot>
<transition name="p-toggleable-content" v-bind="getStepPT(step, 'transition', index)">

<transition name="p-toggleable-content" v-bind="getStepPT(step, 'transition', index)">
<div v-if="isStepActive(index)" :class="cx('stepper.toggleableContent')" v-bind="getStepPT(step, 'toggleableContent', index)">
<slot v-if="index !== stepperpanels.length - 1" name="separator">
<StepperSeparator
v-if="index !== stepperpanels.length - 1"
:template="step.children?.separator"
:separatorClass="cx('stepper.separator')"
:stepperpanel="step"
:index="index"
:active="isStepActive(index)"
:highlighted="index < d_activeStep"
:getStepPT="getStepPT(step, 'separator', index)"
/>
</slot>
<slot name="content">
<StepperContent
v-show="isStepActive(index)"
Expand All @@ -130,8 +129,8 @@
:aria-labelledby="getStepHeaderActionId(index)"
/>
</slot>
</transition>
</div>
</div>
</transition>
</div>
</template>
<slot v-if="$slots.end" name="end" />
Expand Down
13 changes: 12 additions & 1 deletion components/lib/stepper/StepperHeader.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
<template>
<component v-if="template" :is="template" :index="index" :active="active" :highlighted="highlighted" :class="cx('stepper.action')" :clickCallback="(event) => clickCallback(event, index)" />
<component
v-if="template"
:is="template"
:index="index"
:active="active"
:highlighted="highlighted"
:class="cx('stepper.action')"
:headerClass="cx('stepper.action')"
:numberClass="cx('stepper.number')"
:titleClass="cx('stepper.title')"
:clickCallback="(event) => clickCallback(event, index)"
/>
<button v-else :id="id" :class="cx('stepper.action')" role="tab" :tabindex="disabled ? -1 : undefined" :aria-controls="ariaControls" @click="clickCallback($event, index)" v-bind="getStepPT(stepperpanel, 'action', index)">
<span :class="cx('stepper.number')" v-bind="getStepPT(stepperpanel, 'number', index)">{{ index + 1 }}</span>
<span :class="cx('stepper.title')" v-bind="getStepPT(stepperpanel, 'title', index)">{{ getStepProp(stepperpanel, 'header') }}</span>
Expand Down
1 change: 0 additions & 1 deletion components/lib/stepper/style/StepperStyle.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ const classes = {
'p-readonly': props.linear
}
],
navContainer: 'p-stepper-nav-container',
nav: 'p-stepper-nav',
stepper: {
header: ({ instance, step, index }) => [
Expand Down
12 changes: 12 additions & 0 deletions components/lib/stepperpanel/StepperPanel.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,18 @@ export interface StepperPanelSlots {
* Style class of the stepperpanel
*/
class: string;
/**
* Style class of the stepperpanel
*/
headerClass: string;
/**
* Style class of the number content container
*/
numberClass: string;
/**
* Style class of the title content container
*/
titleClass: string;
/**
* Header click function.
* @param {Event} event - Browser event
Expand Down
2 changes: 1 addition & 1 deletion public/themes/arya-blue/theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -6335,12 +6335,12 @@
flex: initial;
}
.p-stepper.p-stepper-vertical .p-stepper-panel .p-stepper-content {
width: 100%;
padding-left: 1rem;
}
.p-stepper.p-stepper-vertical .p-stepper-panel .p-stepper-separator {
flex: 0 0 auto;
width: 2px;
min-height: 28px;
height: auto;
margin-inline-start: calc(1.75rem + 2px);
}
Expand Down
2 changes: 1 addition & 1 deletion public/themes/arya-green/theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -6335,12 +6335,12 @@
flex: initial;
}
.p-stepper.p-stepper-vertical .p-stepper-panel .p-stepper-content {
width: 100%;
padding-left: 1rem;
}
.p-stepper.p-stepper-vertical .p-stepper-panel .p-stepper-separator {
flex: 0 0 auto;
width: 2px;
min-height: 28px;
height: auto;
margin-inline-start: calc(1.75rem + 2px);
}
Expand Down
2 changes: 1 addition & 1 deletion public/themes/arya-orange/theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -6335,12 +6335,12 @@
flex: initial;
}
.p-stepper.p-stepper-vertical .p-stepper-panel .p-stepper-content {
width: 100%;
padding-left: 1rem;
}
.p-stepper.p-stepper-vertical .p-stepper-panel .p-stepper-separator {
flex: 0 0 auto;
width: 2px;
min-height: 28px;
height: auto;
margin-inline-start: calc(1.75rem + 2px);
}
Expand Down
2 changes: 1 addition & 1 deletion public/themes/arya-purple/theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -6335,12 +6335,12 @@
flex: initial;
}
.p-stepper.p-stepper-vertical .p-stepper-panel .p-stepper-content {
width: 100%;
padding-left: 1rem;
}
.p-stepper.p-stepper-vertical .p-stepper-panel .p-stepper-separator {
flex: 0 0 auto;
width: 2px;
min-height: 28px;
height: auto;
margin-inline-start: calc(1.75rem + 2px);
}
Expand Down
5 changes: 4 additions & 1 deletion public/themes/aura-dark-amber/theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -6403,12 +6403,12 @@
flex: initial;
}
.p-stepper.p-stepper-vertical .p-stepper-panel .p-stepper-content {
width: 100%;
padding-left: 1rem;
}
.p-stepper.p-stepper-vertical .p-stepper-panel .p-stepper-separator {
flex: 0 0 auto;
width: 2px;
min-height: 28px;
height: auto;
margin-inline-start: calc(1.75rem + 2px);
}
Expand Down Expand Up @@ -11797,6 +11797,9 @@
border-radius: 6px;
}

.p-stepper .p-stepper-header .p-stepper-number {
box-shadow: 0px 0.5px 0px 0px rgba(0, 0, 0, 0.06), 0px 1px 1px 0px rgba(0, 0, 0, 0.12);
}
.p-stepper .p-stepper-header.p-highlight .p-stepper-number {
background: #18181b;
color: #fbbf24;
Expand Down
5 changes: 4 additions & 1 deletion public/themes/aura-dark-blue/theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -6403,12 +6403,12 @@
flex: initial;
}
.p-stepper.p-stepper-vertical .p-stepper-panel .p-stepper-content {
width: 100%;
padding-left: 1rem;
}
.p-stepper.p-stepper-vertical .p-stepper-panel .p-stepper-separator {
flex: 0 0 auto;
width: 2px;
min-height: 28px;
height: auto;
margin-inline-start: calc(1.75rem + 2px);
}
Expand Down Expand Up @@ -11797,6 +11797,9 @@
border-radius: 6px;
}

.p-stepper .p-stepper-header .p-stepper-number {
box-shadow: 0px 0.5px 0px 0px rgba(0, 0, 0, 0.06), 0px 1px 1px 0px rgba(0, 0, 0, 0.12);
}
.p-stepper .p-stepper-header.p-highlight .p-stepper-number {
background: #18181b;
color: #60a5fa;
Expand Down
5 changes: 4 additions & 1 deletion public/themes/aura-dark-cyan/theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -6403,12 +6403,12 @@
flex: initial;
}
.p-stepper.p-stepper-vertical .p-stepper-panel .p-stepper-content {
width: 100%;
padding-left: 1rem;
}
.p-stepper.p-stepper-vertical .p-stepper-panel .p-stepper-separator {
flex: 0 0 auto;
width: 2px;
min-height: 28px;
height: auto;
margin-inline-start: calc(1.75rem + 2px);
}
Expand Down Expand Up @@ -11797,6 +11797,9 @@
border-radius: 6px;
}

.p-stepper .p-stepper-header .p-stepper-number {
box-shadow: 0px 0.5px 0px 0px rgba(0, 0, 0, 0.06), 0px 1px 1px 0px rgba(0, 0, 0, 0.12);
}
.p-stepper .p-stepper-header.p-highlight .p-stepper-number {
background: #18181b;
color: #22d3ee;
Expand Down
5 changes: 4 additions & 1 deletion public/themes/aura-dark-green/theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -6403,12 +6403,12 @@
flex: initial;
}
.p-stepper.p-stepper-vertical .p-stepper-panel .p-stepper-content {
width: 100%;
padding-left: 1rem;
}
.p-stepper.p-stepper-vertical .p-stepper-panel .p-stepper-separator {
flex: 0 0 auto;
width: 2px;
min-height: 28px;
height: auto;
margin-inline-start: calc(1.75rem + 2px);
}
Expand Down Expand Up @@ -11797,6 +11797,9 @@
border-radius: 6px;
}

.p-stepper .p-stepper-header .p-stepper-number {
box-shadow: 0px 0.5px 0px 0px rgba(0, 0, 0, 0.06), 0px 1px 1px 0px rgba(0, 0, 0, 0.12);
}
.p-stepper .p-stepper-header.p-highlight .p-stepper-number {
background: #18181b;
color: #34d399;
Expand Down
Loading

0 comments on commit 5cc61a3

Please sign in to comment.