steps: { ariaPreviousLabel: "Previous" } |
| hasNavigation | Next and previous buttons below the component. You can use this property if you want to use your own custom navigation items. | boolean | - | true |
@@ -91,7 +93,6 @@ Breaking things down into multiple steps can improve the user experience by keep
| Prop name | Description | Type | Values | Default |
| --------- | ---------------------------------------------------------------------------------------------------------------------------------- | ---------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------- |
-| ariaRole | Role attribute to be passed to the li wrapper for better accessibility | string | - |
From config:
steps: { ariaRole: "tab" } |
| clickable | Item can be used directly to navigate. If undefined, previous steps are clickable while the others are not | boolean | - | |
| component | Component to be injected. | Component | - | |
| content | Text content, unnecessary when default slot is used | string | - | |
@@ -103,7 +104,6 @@ Breaking things down into multiple steps can improve the user experience by keep
| override | Override existing theme classes completely | boolean | - | |
| props | Props to be binded to the injected component | any | - | |
| step | Step marker content (when there is no icon) | number \| string | - | |
-| tag | Step item tag name | DynamicComponent | - |
From config:
steps: { itemTag: "button" } |
| value | Item value (it will be used as v-model of wrapper component) - default is an uuid | string\|number\|object | - | |
| variant | Default style for the step. This will override parent type. Could be used to set a completed step to "success" for example | string | - | |
| visible | Show/hide item | boolean | - | true |
diff --git a/packages/oruga/src/components/steps/StepItem.vue b/packages/oruga/src/components/steps/StepItem.vue
index 1e1de36d4..730850f2c 100644
--- a/packages/oruga/src/components/steps/StepItem.vue
+++ b/packages/oruga/src/components/steps/StepItem.vue
@@ -29,8 +29,6 @@ const props = withDefaults(defineProps>(), {
visible: true,
icon: () => getDefault("steps.icon"),
iconPack: () => getDefault("steps.iconPack"),
- tag: () => getDefault("steps.itemTag", "button"),
- ariaRole: () => getDefault("steps.ariaRole", "tab"),
content: undefined,
component: undefined,
props: undefined,
@@ -48,15 +46,14 @@ const itemValue = props.value ?? useId();
const slots = useSlots();
-// provided data is a computed ref to enjure reactivity
+// provided data is a computed ref to ensure reactivity
const providedData = computed>(() => ({
...props,
value: itemValue,
$slots: slots,
- navClasses: navItemClasses.value,
stepClasses: stepClasses.value,
- labelClasses: stepLabelClasses.value,
iconClasses: stepIconClasses.value,
+ labelClasses: stepLabelClasses.value,
isTransitioning: isTransitioning.value,
activate,
deactivate,
@@ -118,45 +115,40 @@ function beforeLeave(): void {
// --- Computed Component Classes ---
-const navItemClasses = defineClasses(
- ["navItemClass", "o-steps__nav-item"],
+const stepClasses = defineClasses(
+ ["stepClass", "o-steps__step"],
[
- "navItemVariantClass",
- "o-steps__nav-item--",
+ "stepVariantClass",
+ "o-steps__step--",
computed(() => parent.value?.variant || props.variant),
computed(() => !!parent.value?.variant || !!props.variant),
],
- ["navItemActiveClass", "o-steps__nav-item--active", null, isActive],
+ ["stepActiveClass", "o-steps__step--active", null, isActive],
+ ["stepClickableClass", "o-steps__step--clickable", null, isClickable],
+ [
+ "stepDisabledClass",
+ "o-steps__step--disabled",
+ null,
+ computed(() => props.disabled),
+ ],
[
- "navItemPreviousClass",
- "o-steps__nav-item--previous",
+ "stepPreviousClass",
+ "o-steps__step--previous",
null,
computed(() => item.value.index < parent.value?.activeIndex),
],
[
- "navItemNextClass",
- "o-steps__nav-item--next",
+ "stepNextClass",
+ "o-steps__step--next",
null,
computed(() => item.value.index > parent.value?.activeIndex),
],
-);
-
-const stepClasses = defineClasses(
- ["stepClass", "o-steps__step"],
[
"stepLabelPositionClass",
- "o-steps__step-label-",
+ "o-steps__step--label-",
computed(() => parent.value?.labelPosition),
computed(() => !!parent.value?.labelPosition),
],
- ["stepActiveClass", "o-steps__step--active", null, isActive],
- ["stepClickableClass", "o-steps__step--clickable", null, isClickable],
- [
- "stepDisabledClass",
- "o-steps__step--disabled",
- null,
- computed(() => props.disabled),
- ],
);
const stepLabelClasses = defineClasses([
@@ -184,6 +176,8 @@ const panelClasses = defineClasses(["stepPanelClass", "o-steps__panel"]);
data-oruga="steps-item"
:data-id="`steps-${item.identifier}`"
:class="panelClasses"
+ role="tabpanel"
+ :hidden="!isActive"
:aria-labelledby="`tab-${item.identifier}`"
aria-roledescription="item">
+ :previous="{ disabled: !hasPrev, action: () => activateItem(-1) }"
+ :next="{ disabled: !hasNext, action: () => activateItem(1) }">
diff --git a/packages/oruga/src/components/steps/examples/base.vue b/packages/oruga/src/components/steps/examples/base.vue
index d6f68a710..c2a53452a 100644
--- a/packages/oruga/src/components/steps/examples/base.vue
+++ b/packages/oruga/src/components/steps/examples/base.vue
@@ -19,11 +19,9 @@ const nextIcon = ref("chevron-right");
const showSocial = ref(false);
const labelPosition = ref<"bottom" | "left" | "right">("bottom");
-const onProfileActivate = () => {
- if (enableProfileActivateEvent.value) {
- alert("Profile Activated");
- }
-};
+function onProfileActivate(): void {
+ if (enableProfileActivateEvent.value) alert("Profile Activated");
+}
diff --git a/packages/oruga/src/components/steps/examples/inspector.vue b/packages/oruga/src/components/steps/examples/inspector.vue
index 206a83929..58bd7530a 100644
--- a/packages/oruga/src/components/steps/examples/inspector.vue
+++ b/packages/oruga/src/components/steps/examples/inspector.vue
@@ -82,40 +82,34 @@ const inspectData = [
warning: "Click on a marker to see it in action",
},
{
- class: "navClass",
- description: "Class of the steps nav container",
+ class: "listClass",
+ description: "Class of the steps list container",
},
{
- class: "navItemClass",
- description: "Class of the nav item",
- specificity: "when positionClass is applied",
- subitem: true,
- },
- {
- class: "navItemActiveClass",
- description: "Class of the nav item when active",
+ class: "stepClass",
+ description: "Class of the content item",
subitem: true,
},
{
- class: "navItemPreviousClass",
- description: "Class of the nav item before the active one",
+ class: "stepPreviousClass",
+ description: "Class of the step item before the active one",
subitem: true,
action: (): void => {
activeStep.value = 2;
},
},
{
- class: "navItemNextClass",
- description: "CClass of the nav item after the active one",
+ class: "stepNextClass",
+ description: "CClass of the step item after the active one",
subitem: true,
action: (): void => {
activeStep.value = 2;
},
},
{
- class: "navItemVariantClass",
+ class: "stepVariantClass",
description:
- "Class of the nav item with variant (default value by parent steps component)",
+ "Class of the step item with variant (default value by parent steps component)",
subitem: true,
properties: ["variant"],
suffixes: ["primary", "info", "warning", "danger"],
@@ -123,11 +117,6 @@ const inspectData = [
data.variant = "warning";
},
},
- {
- class: "stepClass",
- description: "Class of the content item",
- subitem: true,
- },
{
class: "stepActiveClass",
description: "Class of the tab item when active",
diff --git a/packages/oruga/src/components/steps/props.ts b/packages/oruga/src/components/steps/props.ts
index 0bd25c8f8..5a1c1a74f 100644
--- a/packages/oruga/src/components/steps/props.ts
+++ b/packages/oruga/src/components/steps/props.ts
@@ -1,10 +1,5 @@
import type { Component } from "vue";
-import type {
- ComponentClass,
- ComponentEmits,
- DynamicComponent,
- OptionsProp,
-} from "@/types";
+import type { ComponentClass, ComponentEmits, OptionsProp } from "@/types";
import type { ComponentProps } from "vue-component-type-helpers";
export type StepsProps = {
@@ -47,6 +42,8 @@ export type StepsProps = {
* Next and previous buttons below the component. You can use this property if you want to use your own custom navigation items.
*/
hasNavigation?: boolean;
+ /** Set the step active on navigation focus */
+ activateOnFocus?: boolean;
/** Step navigation is animated */
animated?: boolean;
/**
@@ -65,6 +62,8 @@ export type StepsProps = {
rounded?: boolean;
/** Mobile breakpoint as `max-width` value */
mobileBreakpoint?: string;
+ /** Accessibility aria-label to be passed to the tablist wrapper element */
+ ariaLabel?: string;
/** Accessibility next button aria label */
ariaNextLabel?: string;
/** Accessibility previous button aria label */
@@ -85,8 +84,8 @@ type StepsClasses = Partial<{
positionClass: ComponentClass;
/** Class of steps component when on mobile */
mobileClass: ComponentClass;
- /** Class of the steps nav container */
- navClass: ComponentClass;
+ /** Class of the steps list container */
+ listClass: ComponentClass;
/** Class of Steps component when animation gets triggered */
animatedClass: ComponentClass;
/** Class of the Steps component dividers */
@@ -134,10 +133,6 @@ export type StepItemProps = {
icon?: string;
/** Icon pack */
iconPack?: string;
- /** Step item tag name */
- tag?: DynamicComponent;
- /** Role attribute to be passed to the li wrapper for better accessibility */
- ariaRole?: string;
/** Text content, unnecessary when default slot is used */
content?: string;
/** Component to be injected. */
@@ -150,19 +145,15 @@ export type StepItemProps = {
// class props (will not be displayed in the docs)
type StepItemClasses = Partial<{
- /** Class of the nav item */
- navItemClass: ComponentClass;
- /** Class of the nav item when active */
- navItemActiveClass: ComponentClass;
- /** Class of the nav item before the active one */
- navItemPreviousClass: ComponentClass;
- /** Class of the nav item after the active one */
- navItemNextClass: ComponentClass;
- /** Class of the nav item with variant (default value by parent steps component) */
- navItemVariantClass: ComponentClass;
/** Class of the step item */
stepClass: ComponentClass;
- /** Class of the tab item when active */
+ /** Class of the step item with variant (default value by parent steps component) */
+ stepVariantClass: ComponentClass;
+ /** Class of the step item before the active one */
+ stepPreviousClass: ComponentClass;
+ /** Class of the step item after the active one */
+ stepNextClass: ComponentClass;
+ /** Class of the step item when active */
stepActiveClass: ComponentClass;
/** Class of the step item when clickable */
stepClickableClass: ComponentClass;
diff --git a/packages/oruga/src/components/steps/tests/__snapshots__/steps.test.ts.snap b/packages/oruga/src/components/steps/tests/__snapshots__/steps.test.ts.snap
index 95086d355..7275de9a8 100644
--- a/packages/oruga/src/components/steps/tests/__snapshots__/steps.test.ts.snap
+++ b/packages/oruga/src/components/steps/tests/__snapshots__/steps.test.ts.snap
@@ -1,8 +1,41 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
+exports[`OSteps tests > integration tests > test render correctly 1`] = `
+"
-
+
"
`;
diff --git a/packages/oruga/src/components/tabs/types.ts b/packages/oruga/src/components/tabs/types.ts
index 9e9df4f87..92cfe3d9c 100644
--- a/packages/oruga/src/components/tabs/types.ts
+++ b/packages/oruga/src/components/tabs/types.ts
@@ -13,7 +13,6 @@ export type TabsComponent = {
animateInitially: boolean;
};
-
export type TabItemComponent = TabItemProps & {
$slots: Slots;
tabClasses: ClassBind[];
diff --git a/packages/oruga/src/components/types.ts b/packages/oruga/src/components/types.ts
index e4cc7eefd..f1c6776ce 100644
--- a/packages/oruga/src/components/types.ts
+++ b/packages/oruga/src/components/types.ts
@@ -1041,23 +1041,15 @@ In addition, any CSS selector string or an actual DOM node can be used. */
icon: string;
/** Icon pack */
iconPack: string;
- /** Step item tag name */
- itemTag: DynamicComponent;
- /** Role attribute to be passed to the li wrapper for better accessibility */
- ariaRole: string;
- /** Class of the nav item */
- navItemClass: ClassDefinition;
- /** Class of the nav item when active */
- navItemActiveClass: ClassDefinition;
- /** Class of the nav item before the active one */
- navItemPreviousClass: ClassDefinition;
- /** Class of the nav item after the active one */
- navItemNextClass: ClassDefinition;
- /** Class of the nav item with variant (default value by parent steps component) */
- navItemVariantClass: ClassDefinition;
/** Class of the step item */
stepClass: ClassDefinition;
- /** Class of the tab item when active */
+ /** Class of the step item with variant (default value by parent steps component) */
+ stepVariantClass: ClassDefinition;
+ /** Class of the step item before the active one */
+ stepPreviousClass: ClassDefinition;
+ /** Class of the step item after the active one */
+ stepNextClass: ClassDefinition;
+ /** Class of the step item when active */
stepActiveClass: ClassDefinition;
/** Class of the step item when clickable */
stepClickableClass: ClassDefinition;
@@ -1089,6 +1081,8 @@ In addition, any CSS selector string or an actual DOM node can be used. */
labelPosition: "bottom" | "left" | "right";
/** Mobile breakpoint as `max-width` value */
mobileBreakpoint: string;
+ /** Accessibility aria-label to be passed to the tablist wrapper element */
+ ariaLabel: string;
/** Accessibility next button aria label */
ariaNextLabel: string;
/** Accessibility previous button aria label */
@@ -1105,8 +1099,8 @@ In addition, any CSS selector string or an actual DOM node can be used. */
positionClass: ClassDefinition;
/** Class of steps component when on mobile */
mobileClass: ClassDefinition;
- /** Class of the steps nav container */
- navClass: ClassDefinition;
+ /** Class of the steps list container */
+ listClass: ClassDefinition;
/** Class of Steps component when animation gets triggered */
animatedClass: ClassDefinition;
/** Class of the Steps component dividers */