2023-04-20 05:19:38 +02:00
|
|
|
import React from "react";
|
2024-06-03 00:11:19 +02:00
|
|
|
import type { Meta, StoryObj } from "@storybook/react";
|
2024-06-09 11:53:25 +02:00
|
|
|
import { createKcPageStory } from "../KcPageStory";
|
2023-04-20 05:19:38 +02:00
|
|
|
|
2024-06-09 11:53:25 +02:00
|
|
|
const { KcPageStory } = createKcPageStory({ pageId: "idp-review-user-profile.ftl" });
|
2023-04-20 05:19:38 +02:00
|
|
|
|
2024-06-03 00:11:19 +02:00
|
|
|
const meta = {
|
2024-06-06 07:28:34 +02:00
|
|
|
title: "login/idp-review-user-profile.ftl",
|
2024-06-09 11:53:25 +02:00
|
|
|
component: KcPageStory
|
|
|
|
} satisfies Meta<typeof KcPageStory>;
|
2023-04-20 05:19:38 +02:00
|
|
|
|
|
|
|
export default meta;
|
|
|
|
|
2024-06-03 00:11:19 +02:00
|
|
|
type Story = StoryObj<typeof meta>;
|
|
|
|
|
|
|
|
export const Default: Story = {
|
2024-06-09 11:53:25 +02:00
|
|
|
render: () => <KcPageStory />
|
2024-06-03 00:11:19 +02:00
|
|
|
};
|
2024-09-29 04:35:02 -04:00
|
|
|
export const WithFormValidationErrors: Story = {
|
|
|
|
render: () => (
|
|
|
|
<KcPageStory
|
|
|
|
kcContext={{
|
|
|
|
messagesPerField: {
|
|
|
|
existsError: (fieldName: string) => ["email", "firstName"].includes(fieldName),
|
|
|
|
get: (fieldName: string) => {
|
|
|
|
if (fieldName === "email") return "Invalid email format.";
|
|
|
|
if (fieldName === "firstName") return "First name is required.";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
)
|
|
|
|
};
|
|
|
|
export const WithReadOnlyFields: Story = {
|
|
|
|
render: () => (
|
|
|
|
<KcPageStory
|
|
|
|
kcContext={{
|
|
|
|
profile: {
|
|
|
|
attributesByName: {
|
|
|
|
email: { value: "jane.doe@example.com", readOnly: true },
|
|
|
|
firstName: { value: "Jane", readOnly: false }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
)
|
|
|
|
};
|
|
|
|
export const WithPrefilledFormFields: Story = {
|
|
|
|
render: () => (
|
|
|
|
<KcPageStory
|
|
|
|
kcContext={{
|
|
|
|
profile: {
|
|
|
|
attributesByName: {
|
|
|
|
firstName: { value: "Jane" },
|
|
|
|
lastName: { value: "Doe" },
|
|
|
|
email: { value: "jane.doe@example.com" }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
)
|
|
|
|
};
|