diff --git a/packages/manager-wiki/.storybook/main.tsx b/packages/manager-wiki/.storybook/main.tsx index 982473ac7dd0..ebd6c5aecdf9 100644 --- a/packages/manager-wiki/.storybook/main.tsx +++ b/packages/manager-wiki/.storybook/main.tsx @@ -33,7 +33,18 @@ const config: StorybookConfig = { reactDocgenTypescriptOptions: { shouldExtractLiteralValuesFromEnum: true, shouldRemoveUndefinedFromOptional: true, - propFilter: () => true, // ← include all props, even from node_modules + compilerOptions: { + allowSyntheticDefaultImports: true, + esModuleInterop: true, + }, + propFilter: (prop) => { + // Include all props from our components + if (prop.parent) { + // Exclude props from node_modules except from our components + return !prop.parent.fileName.includes('node_modules'); + } + return true; + }, }, check: false, }, diff --git a/packages/manager-wiki/.storybook/preview.tsx b/packages/manager-wiki/.storybook/preview.tsx index 0f5eac3c0ae4..143eb7e1ce1c 100644 --- a/packages/manager-wiki/.storybook/preview.tsx +++ b/packages/manager-wiki/.storybook/preview.tsx @@ -40,7 +40,11 @@ const preview: Preview = { }, source: { excludeDecorators: true, - state: 'open', + state: 'shown', + type: 'dynamic', + }, + canvas: { + sourceState: 'shown', }, page: TechnicalInformation, }, @@ -88,7 +92,7 @@ const preview: Preview = { }, }; -const withI18next = (Story, context) => { +const withI18next = (story, context) => { const { locale } = context.globals; const [isLoading, setIsLoading] = useState(true); @@ -107,6 +111,7 @@ const withI18next = (Story, context) => { setIsLoading(false); } } catch (error) { + // eslint-disable-next-line no-console console.error('Language change failed:', error); if (isMounted) { setIsLoading(false); @@ -124,15 +129,15 @@ const withI18next = (Story, context) => { useEffect(() => { const handleBrowserLanguageChange = () => { const normalizedLang = normalizeLanguageCode(navigator.language); + // eslint-disable-next-line no-console console.info('Browser language changed:', normalizedLang); - i18n - .changeLanguage(normalizedLang) - .catch((err) => - console.error( - 'Failed to change language on system languagechange:', - err, - ), + i18n.changeLanguage(normalizedLang).catch((err) => { + // eslint-disable-next-line no-console + console.error( + 'Failed to change language on system languagechange:', + err, ); + }); }; window.addEventListener('languagechange', handleBrowserLanguageChange); @@ -146,11 +151,13 @@ const withI18next = (Story, context) => { return
Loading translations...
; } + const StoryComponent = story; + return ( loading translations...}> - + diff --git a/packages/manager-wiki/.storybook/technical-information.mdx b/packages/manager-wiki/.storybook/technical-information.mdx index 8af650beba3e..a1f014a3c616 100644 --- a/packages/manager-wiki/.storybook/technical-information.mdx +++ b/packages/manager-wiki/.storybook/technical-information.mdx @@ -5,6 +5,8 @@ import { Primary, Stories, ArgTypes, + Source, + Controls, } from '@storybook/addon-docs'; import { Meta, Story, Canvas } from '@storybook/blocks'; @@ -14,12 +16,18 @@ import { Meta, Story, Canvas } from '@storybook/blocks'; - - - +## Basic Usage -## Properties + - +## API Reference + +### Props + + + +## Code Examples + +All examples below include their source code for easy copy-paste: diff --git a/packages/manager-wiki/package.json b/packages/manager-wiki/package.json index 479764512c41..4de0d9d022c2 100644 --- a/packages/manager-wiki/package.json +++ b/packages/manager-wiki/package.json @@ -16,11 +16,14 @@ "@ovh-ux/muk": "^0.0.1", "@ovhcloud/ods-react": "^19.0.1", "@ovhcloud/ods-themes": "^19.0.1", + "@tanstack/react-query": "^5.0.0", "@tanstack/react-table": "^8.10.0", "clsx": "^2.1.1", + "i18next": "^23.0.0", "lz-string": "^1.5.0", "react": "^18.2.0", "react-docgen": "^8.0.2", + "react-i18next": "^14.0.0", "react-router-dom": "^6.3.0", "sass": "1.56.1", "tailwindcss": "^3.4.4", diff --git a/packages/manager-wiki/stories/manager-ui-kit/components/Breadcrumb/breadcrumb.stories.tsx b/packages/manager-wiki/stories/manager-ui-kit/components/Breadcrumb/breadcrumb.stories.tsx index dda8d96009d8..34b35b6f6633 100644 --- a/packages/manager-wiki/stories/manager-ui-kit/components/Breadcrumb/breadcrumb.stories.tsx +++ b/packages/manager-wiki/stories/manager-ui-kit/components/Breadcrumb/breadcrumb.stories.tsx @@ -23,6 +23,18 @@ Basic.args = { hideRootLabel: false, }; +Basic.parameters = { + docs: { + source: { + code: ``, + }, + }, +}; + export const HideRootLabel = BreadcrumbStory.bind({}); HideRootLabel.args = { @@ -31,9 +43,22 @@ HideRootLabel.args = { hideRootLabel: true, }; +HideRootLabel.parameters = { + docs: { + source: { + code: ``, + }, + }, +}; + export default { title: 'Manager UI Kit/Components/Breadcrumb', component: Breadcrumb, + tags: ['autodocs'], decorators: [withRouter], parameters: { docs: { diff --git a/packages/manager-wiki/stories/manager-ui-kit/components/Clipboard/clipboard.stories.tsx b/packages/manager-wiki/stories/manager-ui-kit/components/Clipboard/clipboard.stories.tsx index 13eb7348c2a4..21c51af2af31 100644 --- a/packages/manager-wiki/stories/manager-ui-kit/components/Clipboard/clipboard.stories.tsx +++ b/packages/manager-wiki/stories/manager-ui-kit/components/Clipboard/clipboard.stories.tsx @@ -4,6 +4,7 @@ import { Clipboard } from '@ovh-ux/muk'; const meta: Meta = { title: 'Manager UI Kit/Components/Clipboard', component: Clipboard, + tags: ['autodocs'], }; type Story = StoryObj; @@ -15,6 +16,13 @@ export const regular: Story = { loading: false, masked: false, }, + parameters: { + docs: { + source: { + code: ``, + }, + }, + }, }; export const disabled: Story = { @@ -22,6 +30,16 @@ export const disabled: Story = { value: 'Disabled clipboard', disabled: true, }, + parameters: { + docs: { + source: { + code: ``, + }, + }, + }, }; export const loading: Story = { @@ -29,6 +47,16 @@ export const loading: Story = { value: '', loading: true, }, + parameters: { + docs: { + source: { + code: ``, + }, + }, + }, }; export const masked: Story = { @@ -36,6 +64,16 @@ export const masked: Story = { value: 'Secret Data', masked: true, }, + parameters: { + docs: { + source: { + code: ``, + }, + }, + }, }; export default meta; diff --git a/packages/manager-wiki/stories/manager-ui-kit/components/Datagrid/datagrid.stories.tsx b/packages/manager-wiki/stories/manager-ui-kit/components/Datagrid/datagrid.stories.tsx index d1b659cf609f..d9aedb4bede2 100644 --- a/packages/manager-wiki/stories/manager-ui-kit/components/Datagrid/datagrid.stories.tsx +++ b/packages/manager-wiki/stories/manager-ui-kit/components/Datagrid/datagrid.stories.tsx @@ -438,6 +438,7 @@ FullFooter.args = { const meta = { title: 'Manager UI Kit/Components/Datagrid New', component: Datagrid, + tags: ['autodocs'], decorators: [withRouter], parameters: { docs: { diff --git a/packages/manager-wiki/stories/manager-ui-kit/components/Drawer/Drawer.stories.tsx b/packages/manager-wiki/stories/manager-ui-kit/components/Drawer/Drawer.stories.tsx index d40ad76e9d32..be5a46afaf78 100644 --- a/packages/manager-wiki/stories/manager-ui-kit/components/Drawer/Drawer.stories.tsx +++ b/packages/manager-wiki/stories/manager-ui-kit/components/Drawer/Drawer.stories.tsx @@ -1,6 +1,7 @@ import React, { useState } from 'react'; import { Meta } from '@storybook/react'; import { Button } from '@ovh-ux/muk'; +import { DrawerBase } from '@ovh-ux/muk/src/components/drawer/drawer-base/DrawerBase.component'; import { DrawerContent } from './DrawerContent.component'; import { Content } from './mocks/Content.component'; import { @@ -11,6 +12,8 @@ import { const meta = { title: 'Manager UI Kit/Components/Drawer', + component: DrawerBase, + tags: ['autodocs'], args: { isOpen: false, isLoading: false, @@ -38,7 +41,6 @@ const meta = { const [isOpen, setIsOpen] = useState(args.isOpen); const triggerDrawer = () => setIsOpen(!isOpen); - console.info('isOpen', isOpen); const title = args.title as string; return ( <> @@ -49,7 +51,9 @@ const meta = { alert('dismiss')} + onDismiss={() => { + // Dismiss action + }} primaryButton={{ ...args.primaryButton, onClick: triggerDrawer, @@ -88,6 +92,31 @@ export const Default: Meta = { children:
Children drawer story
, content: , }, + parameters: { + docs: { + source: { + code: ` + + +
Your drawer content here
+
+ +
`, + }, + }, + }, }; export const ScrollableContent: Meta = { @@ -97,6 +126,31 @@ export const ScrollableContent: Meta = { children:
Children scrollable drawer story
, content: , }, + parameters: { + docs: { + source: { + code: ` + + +
Long scrollable content here...
+
+ +
`, + }, + }, + }, }; export const Collapsible: Meta = { @@ -106,4 +160,29 @@ export const Collapsible: Meta = { children:
Children Collapsible drawer story
, content: , }, + parameters: { + docs: { + source: { + code: ` + + +
Your drawer content here
+
+ +
`, + }, + }, + }, }; diff --git a/packages/manager-wiki/stories/manager-ui-kit/components/Error/error.stories.tsx b/packages/manager-wiki/stories/manager-ui-kit/components/Error/error.stories.tsx index 5f2059dd41df..be2c18e5c42a 100644 --- a/packages/manager-wiki/stories/manager-ui-kit/components/Error/error.stories.tsx +++ b/packages/manager-wiki/stories/manager-ui-kit/components/Error/error.stories.tsx @@ -26,6 +26,7 @@ const meta: Meta = { title: 'Manager UI Kit/Components/Errors', decorators: [(story) =>
{story()}
], component: Error, + tags: ['autodocs'], argTypes: {}, args: defaultError, parameters: { @@ -36,5 +37,40 @@ const meta: Meta = { export default meta; export const ErrorBoundary = () => ; +ErrorBoundary.parameters = { + docs: { + source: { + code: ``, + }, + }, +}; + export const Error404 = () => ; +Error404.parameters = { + docs: { + source: { + code: ``, + }, + }, +}; + export const ErrorApiWithCode = () => ; +ErrorApiWithCode.parameters = { + docs: { + source: { + code: ``, + }, + }, +}; diff --git a/packages/manager-wiki/stories/manager-ui-kit/components/Filters/filters.stories.tsx b/packages/manager-wiki/stories/manager-ui-kit/components/Filters/filters.stories.tsx index fb553d1e8836..042eb5405a17 100644 --- a/packages/manager-wiki/stories/manager-ui-kit/components/Filters/filters.stories.tsx +++ b/packages/manager-wiki/stories/manager-ui-kit/components/Filters/filters.stories.tsx @@ -113,6 +113,7 @@ export const DefaultProps = { const meta = { title: 'Manager UI Kit/Components/Filters', component: FiltersStory, + tags: ['autodocs'], decorators: [withRouter], }; diff --git a/packages/manager-wiki/stories/manager-ui-kit/components/Link/link.stories.tsx b/packages/manager-wiki/stories/manager-ui-kit/components/Link/link.stories.tsx index c5b9f4026f3d..497410a431ad 100644 --- a/packages/manager-wiki/stories/manager-ui-kit/components/Link/link.stories.tsx +++ b/packages/manager-wiki/stories/manager-ui-kit/components/Link/link.stories.tsx @@ -54,6 +54,8 @@ const iamLinkWithoutAuthAndTooltip: LinkProps = { const meta: Meta = { title: 'Manager UI Kit/Components/Link', decorators: [(story) =>
{story()}
], + component: Link, + tags: ['autodocs'], argTypes: {}, args: backLink, }; @@ -61,19 +63,103 @@ const meta: Meta = { export default meta; export const BackLink = () => ; +BackLink.parameters = { + docs: { + source: { + code: ` + Back to the list +`, + }, + }, +}; export const NextLink = () => ; +NextLink.parameters = { + docs: { + source: { + code: ` + Next Page +`, + }, + }, +}; export const ExternalLink = () => ; +ExternalLink.parameters = { + docs: { + source: { + code: ` + External Page +`, + }, + }, +}; export const IamLinkWithAuthorization = () => ( ); +IamLinkWithAuthorization.parameters = { + docs: { + source: { + code: ` + Resiliate Link +`, + }, + }, +}; export const IamLinkWithoutAuthorization = () => ( ); +IamLinkWithoutAuthorization.parameters = { + docs: { + source: { + code: ` + Resiliate Link +`, + }, + }, +}; export const IamLinkWithoutAuthAndTooltip = () => ( ); +IamLinkWithoutAuthAndTooltip.parameters = { + docs: { + source: { + code: ` + Resiliate Link +`, + }, + }, +}; diff --git a/packages/manager-wiki/stories/manager-ui-kit/components/Notifications/notifications.stories.tsx b/packages/manager-wiki/stories/manager-ui-kit/components/Notifications/notifications.stories.tsx index 0e72bc913813..3df0ef0d20a7 100644 --- a/packages/manager-wiki/stories/manager-ui-kit/components/Notifications/notifications.stories.tsx +++ b/packages/manager-wiki/stories/manager-ui-kit/components/Notifications/notifications.stories.tsx @@ -61,5 +61,6 @@ export const Primary = { export default { title: 'Manager UI Kit/Components/Notifications', component: NotificationsStory, + tags: ['autodocs'], decorators: [withRouter], }; diff --git a/packages/manager-wiki/stories/manager-ui-kit/components/Order/Order.stories.tsx b/packages/manager-wiki/stories/manager-ui-kit/components/Order/Order.stories.tsx index 2e6030dd485e..4222b9644090 100644 --- a/packages/manager-wiki/stories/manager-ui-kit/components/Order/Order.stories.tsx +++ b/packages/manager-wiki/stories/manager-ui-kit/components/Order/Order.stories.tsx @@ -42,11 +42,33 @@ export const DemoOrder: Story = { onClickLink: () => {}, }, render: renderComponent, + parameters: { + docs: { + source: { + code: ` + +

Your order configuration steps here

+
+ +
`, + }, + }, + }, }; const meta: Meta = { title: 'Manager UI Kit/Components/Order', component: Order, + tags: ['autodocs'], subcomponents: { 'Order.Summary': Order.Summary as ComponentType, 'Order.Configuration': Order.Configuration as ComponentType, diff --git a/packages/manager-wiki/stories/manager-ui-kit/components/Price/price.stories.tsx b/packages/manager-wiki/stories/manager-ui-kit/components/Price/price.stories.tsx index ca23b3af9d7c..1af03eb7f1f2 100644 --- a/packages/manager-wiki/stories/manager-ui-kit/components/Price/price.stories.tsx +++ b/packages/manager-wiki/stories/manager-ui-kit/components/Price/price.stories.tsx @@ -1,10 +1,10 @@ -import React from 'react'; import { Meta, StoryObj } from '@storybook/react'; import { Price, OvhSubsidiary, IntervalUnitType } from '@ovh-ux/muk'; const meta = { title: 'Manager UI Kit/Components/Price', component: Price, + tags: ['autodocs'], parameters: { docs: { description: { @@ -53,6 +53,17 @@ export const Basic: Story = { ovhSubsidiary: OvhSubsidiary.FR, locale: 'fr-FR', }, + parameters: { + docs: { + source: { + code: ``, + }, + }, + }, }; // Price with tax @@ -63,6 +74,18 @@ export const WithTax: Story = { ovhSubsidiary: OvhSubsidiary.FR, locale: 'fr-FR', }, + parameters: { + docs: { + source: { + code: ``, + }, + }, + }, }; // Price with interval @@ -73,6 +96,18 @@ export const WithInterval: Story = { ovhSubsidiary: OvhSubsidiary.FR, locale: 'fr-FR', }, + parameters: { + docs: { + source: { + code: ``, + }, + }, + }, }; // Price with tax and interval @@ -84,6 +119,19 @@ export const WithTaxAndInterval: Story = { ovhSubsidiary: OvhSubsidiary.FR, locale: 'fr-FR', }, + parameters: { + docs: { + source: { + code: ``, + }, + }, + }, }; // Different subsidiary (US) diff --git a/packages/manager-wiki/stories/manager-ui-kit/components/Step/step.stories.tsx b/packages/manager-wiki/stories/manager-ui-kit/components/Step/step.stories.tsx index 90b60892d97f..461876cb9cb4 100644 --- a/packages/manager-wiki/stories/manager-ui-kit/components/Step/step.stories.tsx +++ b/packages/manager-wiki/stories/manager-ui-kit/components/Step/step.stories.tsx @@ -2,29 +2,9 @@ import React from 'react'; import { Meta } from '@storybook/react'; import { Step, StepProps, Text } from '@ovh-ux/muk'; -const renderComponent = ({ - order, - title, - subtitle, - open, - checked, - locked, - next, - edit, - skip, -}) => { +const renderComponent = (args: StepProps) => { return ( - + Hello world!!!! ); @@ -39,20 +19,47 @@ export const Default = { checked: false, locked: false, next: { - action: (_id: string) => {}, + action: () => {}, label: 'Next', disabled: false, }, edit: { - action: (_id: string) => {}, + action: () => {}, label: 'Edit', disabled: false, }, }, + parameters: { + docs: { + source: { + code: ` handleNext(id), + label: 'Next', + disabled: false, + }} + edit={{ + action: (id) => handleEdit(id), + label: 'Edit', + disabled: false, + }} +> + Step content here +`, + }, + }, + }, }; const StepStory: Meta = { title: 'Manager UI Kit/Components/Step', + component: Step, + tags: ['autodocs'], render: renderComponent, }; @@ -60,8 +67,22 @@ export const Checked: Meta = { title: 'Manager UI Kit/Components/Step', render: renderComponent, args: { - ...Default.args, + order: 1, + title: 'Title', + subtitle: '', + open: true, checked: true, + locked: false, + next: { + action: () => {}, + label: 'Next', + disabled: false, + }, + edit: { + action: () => {}, + label: 'Edit', + disabled: false, + }, }, }; @@ -69,9 +90,22 @@ export const CheckedAndLocked: Meta = { title: 'Manager UI Kit/Components/Step', render: renderComponent, args: { - ...Default.args, + order: 1, + title: 'Title', + subtitle: '', + open: true, checked: true, locked: true, + next: { + action: () => {}, + label: 'Next', + disabled: false, + }, + edit: { + action: () => {}, + label: 'Edit', + disabled: false, + }, }, }; @@ -79,11 +113,19 @@ export const CheckedAndLockedWithoutEdit: Meta = { title: 'Manager UI Kit/Components/Step', render: renderComponent, args: { - ...Default.args, + order: 1, + title: 'Title', + subtitle: '', + open: true, checked: true, locked: true, + next: { + action: () => {}, + label: 'Next', + disabled: false, + }, edit: { - action: (_id: string) => {}, + action: () => {}, label: 'Edit', disabled: true, }, @@ -94,10 +136,22 @@ export const Closed: Meta = { title: 'Manager UI Kit/Components/Step', render: renderComponent, args: { - ...Default.args, - checked: true, + order: 1, + title: 'Title', + subtitle: '', open: false, + checked: true, locked: true, + next: { + action: () => {}, + label: 'Next', + disabled: false, + }, + edit: { + action: () => {}, + label: 'Edit', + disabled: false, + }, }, }; @@ -105,10 +159,22 @@ export const UncheckedAndClosed: Meta = { title: 'Manager UI Kit/Components/Step', render: renderComponent, args: { - ...Default.args, - checked: false, + order: 1, + title: 'Title', + subtitle: '', open: false, + checked: false, locked: true, + next: { + action: () => {}, + label: 'Next', + disabled: false, + }, + edit: { + action: () => {}, + label: 'Edit', + disabled: false, + }, }, }; @@ -116,12 +182,22 @@ export const NextButtonDisabled: Meta = { title: 'Manager UI Kit/Components/Step', render: renderComponent, args: { - ...Default.args, + order: 1, + title: 'Title', + subtitle: '', + open: true, + checked: false, + locked: false, next: { - action: (_id: string) => {}, + action: () => {}, label: 'Next', disabled: true, }, + edit: { + action: () => {}, + label: 'Edit', + disabled: false, + }, }, }; @@ -129,9 +205,24 @@ export const Skip: Meta = { title: 'Manager UI Kit/Components/Step', render: renderComponent, args: { - ...Default.args, + order: 1, + title: 'Title', + subtitle: '', + open: true, + checked: false, + locked: false, + next: { + action: () => {}, + label: 'Next', + disabled: false, + }, + edit: { + action: () => {}, + label: 'Edit', + disabled: false, + }, skip: { - action: (_id: string) => {}, + action: () => {}, label: 'Skip', disabled: false, hint: '(Optional)', diff --git a/packages/manager-wiki/stories/manager-ui-kit/components/TagsTile/tags-tile.stories.tsx b/packages/manager-wiki/stories/manager-ui-kit/components/TagsTile/tags-tile.stories.tsx index 05440e015960..72639bd14d81 100644 --- a/packages/manager-wiki/stories/manager-ui-kit/components/TagsTile/tags-tile.stories.tsx +++ b/packages/manager-wiki/stories/manager-ui-kit/components/TagsTile/tags-tile.stories.tsx @@ -4,6 +4,7 @@ import { TagsTile } from '@ovh-ux/muk'; const managerTagsTile = { title: 'Manager UI Kit/Components/TagsTile', component: TagsTile, + tags: ['autodocs'], }; type Story = StoryObj; @@ -31,6 +32,22 @@ export const DemoTagsTile: Story = { lineNumber: 5, onEditTags: () => {}, }, + parameters: { + docs: { + source: { + code: ` console.log('Edit tags')} +/>`, + }, + }, + }, }; export default managerTagsTile; diff --git a/packages/manager-wiki/stories/manager-ui-kit/components/TilesInputGroup/tiles-input-group.stories.tsx b/packages/manager-wiki/stories/manager-ui-kit/components/TilesInputGroup/tiles-input-group.stories.tsx index e80ecdde50e9..74f1fe7e911a 100644 --- a/packages/manager-wiki/stories/manager-ui-kit/components/TilesInputGroup/tiles-input-group.stories.tsx +++ b/packages/manager-wiki/stories/manager-ui-kit/components/TilesInputGroup/tiles-input-group.stories.tsx @@ -11,6 +11,7 @@ import { export default { title: 'Manager UI Kit/Components/TilesInputGroup', component: TilesInputGroupComponent, + tags: ['autodocs'], parameters: { docs: { description: { diff --git a/packages/manager-wiki/stories/manager-ui-kit/components/action-banner/ActionBanner.stories.tsx b/packages/manager-wiki/stories/manager-ui-kit/components/action-banner/ActionBanner.stories.tsx index 0951585766db..be3348262952 100644 --- a/packages/manager-wiki/stories/manager-ui-kit/components/action-banner/ActionBanner.stories.tsx +++ b/packages/manager-wiki/stories/manager-ui-kit/components/action-banner/ActionBanner.stories.tsx @@ -10,11 +10,23 @@ export const Default = { color: MESSAGE_COLOR.information, dismissible: true, }, + parameters: { + docs: { + source: { + code: ``, + }, + }, + }, }; const SampleActionBanner: Meta = { title: 'Manager UI Kit/Components/Action Banner', component: ActionBanner, + tags: ['autodocs'], }; export const ActionBannerWithMessageVariants: Meta = { diff --git a/packages/manager-wiki/stories/manager-ui-kit/components/action-menu/ActionMenu.stories.tsx b/packages/manager-wiki/stories/manager-ui-kit/components/action-menu/ActionMenu.stories.tsx index 60be0f1be57d..276e2e4aba9e 100644 --- a/packages/manager-wiki/stories/manager-ui-kit/components/action-menu/ActionMenu.stories.tsx +++ b/packages/manager-wiki/stories/manager-ui-kit/components/action-menu/ActionMenu.stories.tsx @@ -1,4 +1,3 @@ -import React from 'react'; import { Meta, StoryObj } from '@storybook/react'; import { POPOVER_POSITION, @@ -57,6 +56,33 @@ export const Default: Story = { isDisabled: false, isLoading: false, }, + parameters: { + docs: { + source: { + code: `const actionItems = [ + { + id: 1, + href: 'https://www.ovhcloud.com', + target: '_blank', + label: 'external link', + }, + { + id: 2, + onClick: () => handleAction(), + label: 'action', + }, +]; + +`, + }, + }, + }, }; export const Compact: Story = { @@ -66,6 +92,18 @@ export const Compact: Story = { isCompact: true, popoverPosition: POPOVER_POSITION.bottom, }, + parameters: { + docs: { + source: { + code: ``, + }, + }, + }, }; export const Loading: Story = { diff --git a/packages/manager-wiki/stories/manager-ui-kit/components/badges/badge/Badge.stories.tsx b/packages/manager-wiki/stories/manager-ui-kit/components/badges/badge/Badge.stories.tsx index b9658d42fa96..4b1837c1d301 100644 --- a/packages/manager-wiki/stories/manager-ui-kit/components/badges/badge/Badge.stories.tsx +++ b/packages/manager-wiki/stories/manager-ui-kit/components/badges/badge/Badge.stories.tsx @@ -8,6 +8,18 @@ export const Default = { color: BADGE_COLOR.information, size: BADGE_SIZE.md, }, + parameters: { + docs: { + source: { + code: ` + Active +`, + }, + }, + }, }; function renderComponent({ children, ...args }) { @@ -16,6 +28,8 @@ function renderComponent({ children, ...args }) { const simpleBadge: Meta = { title: 'Manager UI Kit/Components/Badges/Badge', + component: Badge, + tags: ['autodocs'], render: renderComponent, parameters: { docs: { diff --git a/packages/manager-wiki/stories/manager-ui-kit/components/badges/service-state-badge/ServiceStateBadge.stories.tsx b/packages/manager-wiki/stories/manager-ui-kit/components/badges/service-state-badge/ServiceStateBadge.stories.tsx index 73f1e28f5a29..36ed6d77d092 100644 --- a/packages/manager-wiki/stories/manager-ui-kit/components/badges/service-state-badge/ServiceStateBadge.stories.tsx +++ b/packages/manager-wiki/stories/manager-ui-kit/components/badges/service-state-badge/ServiceStateBadge.stories.tsx @@ -5,14 +5,35 @@ import { ServiceStateBadge, ResourceStatus } from '@ovh-ux/muk'; export const ServiceStateBadgeActive = () => ( ); +ServiceStateBadgeActive.parameters = { + docs: { + source: { + code: ``, + }, + }, +}; export const ServiceStateBadgeDeleted = () => ( ); +ServiceStateBadgeDeleted.parameters = { + docs: { + source: { + code: ``, + }, + }, +}; export const ServiceStateBadgeSuspended = () => ( ); +ServiceStateBadgeSuspended.parameters = { + docs: { + source: { + code: ``, + }, + }, +}; export const ServiceStateBadgeToActivate = () => ( @@ -36,10 +57,21 @@ export const LoadingBadge = () => ( state={('unknown' as unknown) as ResourceStatus} /> ); +LoadingBadge.parameters = { + docs: { + source: { + code: ``, + }, + }, +}; const meta: Meta = { title: 'Manager UI Kit/Components/Badges/ServiceStateBadge', component: ServiceStateBadge, + tags: ['autodocs'], argTypes: { state: { control: { type: 'select' }, diff --git a/packages/manager-wiki/stories/manager-ui-kit/components/button/Button.stories.tsx b/packages/manager-wiki/stories/manager-ui-kit/components/button/Button.stories.tsx index 02c81ffc1b44..0f2ceafa46df 100644 --- a/packages/manager-wiki/stories/manager-ui-kit/components/button/Button.stories.tsx +++ b/packages/manager-wiki/stories/manager-ui-kit/components/button/Button.stories.tsx @@ -6,6 +6,13 @@ export const Default: Meta = { args: { children: 'Remove Button', }, + parameters: { + docs: { + source: { + code: ``, + }, + }, + }, }; export const IsLoading: Meta = { @@ -13,6 +20,15 @@ export const IsLoading: Meta = { children: 'Remove Button', loading: true, }, + parameters: { + docs: { + source: { + code: ``, + }, + }, + }, }; export const ButtonWithIamAuthorization: Meta = { @@ -21,6 +37,18 @@ export const ButtonWithIamAuthorization: Meta = { urn: IAM_URNS.WITH_AUTH, iamActions: IAM_ACTIONS, }, + parameters: { + docs: { + source: { + code: ``, + }, + }, + }, }; export const ButtonWithoutIamAuthorization: Meta = { @@ -29,11 +57,24 @@ export const ButtonWithoutIamAuthorization: Meta = { urn: IAM_URNS.WITHOUT_AUTH, iamActions: IAM_ACTIONS, }, + parameters: { + docs: { + source: { + code: ``, + }, + }, + }, }; const meta = { title: 'Manager UI Kit/Components/Button', component: Button, + tags: ['autodocs'], args: { children: 'Remove button', }, diff --git a/packages/manager-wiki/stories/manager-ui-kit/components/changelog-menu/ChangelogMenu.stories.tsx b/packages/manager-wiki/stories/manager-ui-kit/components/changelog-menu/ChangelogMenu.stories.tsx index 238415308778..afd09ffce076 100644 --- a/packages/manager-wiki/stories/manager-ui-kit/components/changelog-menu/ChangelogMenu.stories.tsx +++ b/packages/manager-wiki/stories/manager-ui-kit/components/changelog-menu/ChangelogMenu.stories.tsx @@ -21,10 +21,30 @@ export const changelogMenu: ChangelogMenuProps = { chapters: changelogChapters, }; +changelogMenu.parameters = { + docs: { + source: { + code: `const changelogLinks = { + roadmap: 'https://github.com/orgs/ovh/projects/16/...', + changelog: 'https://github.com/orgs/ovh/projects/16/...', + 'feature-request': 'https://github.com/orgs/ovh/projects/16/...', +}; + +const changelogChapters = ['baremetal', 'server', 'dedicated']; + +`, + }, + }, +}; + const meta: Meta = { title: 'Manager UI Kit/Components/ChangelogMenu', decorators: [withRouter], component: ChangelogMenu, + tags: ['autodocs'], argTypes: {}, args: changelogMenu, }; diff --git a/packages/manager-wiki/stories/manager-ui-kit/components/delete-modal/DeleteModal.stories.tsx b/packages/manager-wiki/stories/manager-ui-kit/components/delete-modal/DeleteModal.stories.tsx index 8a501574870e..f47c02ef39a6 100644 --- a/packages/manager-wiki/stories/manager-ui-kit/components/delete-modal/DeleteModal.stories.tsx +++ b/packages/manager-wiki/stories/manager-ui-kit/components/delete-modal/DeleteModal.stories.tsx @@ -12,6 +12,19 @@ export const DeleteModalDefault = (props: DeleteModalProps) => { return ; }; +DeleteModalDefault.parameters = { + docs: { + source: { + code: ` console.log('onDelete')} + serviceTypeName="SQL Server" +/>`, + }, + }, +}; + export const DeleteModalWithError = (props: DeleteModalProps) => { const [isOpen, setIsOpen] = useState(true); @@ -49,13 +62,16 @@ export const DeleteModalIsLoading = (props: DeleteModalProps) => { const meta: Meta = { title: 'Manager UI Kit/Components/Delete Modal', component: DeleteModal, + tags: ['autodocs'], argTypes: { isOpen: { control: 'boolean' }, isLoading: { control: 'boolean' }, error: { control: 'text' }, }, args: { - onConfirmDelete: () => console.log('onDelete'), + onConfirmDelete: () => { + // Handle delete action + }, serviceTypeName: 'SQL Server', isLoading: false, }, diff --git a/packages/manager-wiki/stories/manager-ui-kit/components/grid-layout/GridLayout.stories.tsx b/packages/manager-wiki/stories/manager-ui-kit/components/grid-layout/GridLayout.stories.tsx index 8d384a1f228a..2bb3fd5784d1 100644 --- a/packages/manager-wiki/stories/manager-ui-kit/components/grid-layout/GridLayout.stories.tsx +++ b/packages/manager-wiki/stories/manager-ui-kit/components/grid-layout/GridLayout.stories.tsx @@ -5,6 +5,7 @@ import { GridLayout, Tile, Text } from '@ovh-ux/muk'; const meta: Meta = { title: 'Manager UI Kit/Components/GridLayout', component: GridLayout, + tags: ['autodocs'], decorators: [(story) =>
{story()}
], }; diff --git a/packages/manager-wiki/stories/manager-ui-kit/components/guide-menu/GuideMenu.stories.tsx b/packages/manager-wiki/stories/manager-ui-kit/components/guide-menu/GuideMenu.stories.tsx index f8771273a334..1c47597f2fb1 100644 --- a/packages/manager-wiki/stories/manager-ui-kit/components/guide-menu/GuideMenu.stories.tsx +++ b/packages/manager-wiki/stories/manager-ui-kit/components/guide-menu/GuideMenu.stories.tsx @@ -21,6 +21,29 @@ export const GuideMenuExemple: GuideMenuProps = { items: guideItems, }; +GuideMenuExemple.parameters = { + docs: { + source: { + code: `const guideItems = [ + { + id: 1, + href: 'https://www.ovh.com', + target: '_blank', + children: 'ovh.com', + }, + { + id: 2, + href: 'https://help.ovhcloud.com/csm/fr-documentation?id=kb_home', + target: '_blank', + children: 'Guides OVH', + }, +]; + +`, + }, + }, +}; + export const GuideMenuLoading = () => ( ); @@ -31,6 +54,7 @@ const meta: Meta = { title: 'Manager UI Kit/Components/GuideMenu', decorators: [(story) =>
{story()}
], component: GuideMenu, + tags: ['autodocs'], argTypes: {}, args: GuideMenuExemple, }; diff --git a/packages/manager-wiki/stories/manager-ui-kit/components/link-card/LinkCard.stories.tsx b/packages/manager-wiki/stories/manager-ui-kit/components/link-card/LinkCard.stories.tsx index 1826a727e90b..56051c8a3be4 100644 --- a/packages/manager-wiki/stories/manager-ui-kit/components/link-card/LinkCard.stories.tsx +++ b/packages/manager-wiki/stories/manager-ui-kit/components/link-card/LinkCard.stories.tsx @@ -42,6 +42,7 @@ const meta: Meta = { ), ], component: LinkCard, + tags: ['autodocs'], argTypes: { texts: { title: { control: 'text', description: 'Title of the Card' }, @@ -92,12 +93,43 @@ WithDescription.args = { ...defaultProps, texts: textsWithDescription, }; +WithDescription.parameters = { + docs: { + source: { + code: ``, + }, + }, +}; export const WithImage = Template.bind({}); WithImage.args = { ...defaultProps, img, }; +WithImage.parameters = { + docs: { + source: { + code: ``, + }, + }, +}; export const WithBadges = Template.bind({}); WithBadges.args = { diff --git a/packages/manager-wiki/stories/manager-ui-kit/components/modal/Modal.stories.tsx b/packages/manager-wiki/stories/manager-ui-kit/components/modal/Modal.stories.tsx index 8f562871cec6..ad814f50754e 100644 --- a/packages/manager-wiki/stories/manager-ui-kit/components/modal/Modal.stories.tsx +++ b/packages/manager-wiki/stories/manager-ui-kit/components/modal/Modal.stories.tsx @@ -43,6 +43,16 @@ Basic.parameters = { controls: { include: ['heading', 'children'], }, + docs: { + source: { + code: ` +
Example of content
+
`, + }, + }, }; Basic.args = basicMock; @@ -53,6 +63,25 @@ Actions.parameters = { controls: { include: ['onOpenChange', 'primaryButton', 'secondaryButton'], }, + docs: { + source: { + code: ` {}, + }} + secondaryButton={{ + label: 'Cancel', + onClick: () => {}, + }} + onOpenChange={() => {}} +> +
Example of content
+
`, + }, + }, }; Actions.args = { @@ -66,6 +95,25 @@ Type.parameters = { controls: { include: ['type'], }, + docs: { + source: { + code: ` {}, + }} + secondaryButton={{ + label: 'Cancel', + onClick: () => {}, + }} +> +
Example of content
+
`, + }, + }, }; Type.args = { @@ -80,6 +128,25 @@ Loading.parameters = { controls: { include: ['loading'], }, + docs: { + source: { + code: ` {}, + }} + secondaryButton={{ + label: 'Cancel', + onClick: () => {}, + }} +> +
Example of content
+
`, + }, + }, }; Loading.args = { @@ -94,6 +161,28 @@ Step.parameters = { controls: { include: ['step'], }, + docs: { + source: { + code: ` {}, + }} + secondaryButton={{ + label: 'Cancel', + onClick: () => {}, + }} +> +
Example of content
+
`, + }, + }, }; Step.args = { @@ -115,4 +204,5 @@ Full.args = { export default { title: 'Manager UI Kit/Components/Modal', component: Modal, + tags: ['autodocs'], }; diff --git a/packages/manager-wiki/stories/manager-ui-kit/components/tags-list/TagsList.stories.tsx b/packages/manager-wiki/stories/manager-ui-kit/components/tags-list/TagsList.stories.tsx index 04b02fe5a420..e83b90b5579d 100644 --- a/packages/manager-wiki/stories/manager-ui-kit/components/tags-list/TagsList.stories.tsx +++ b/packages/manager-wiki/stories/manager-ui-kit/components/tags-list/TagsList.stories.tsx @@ -12,6 +12,7 @@ import { TagsList } from '../../../../../manager-ui-kit/src/components'; const managerTagsList = { title: 'Manager UI Kit/Components/TagsList', component: TagsList, + tags: ['autodocs'], }; type Story = StoryObj; diff --git a/packages/manager-wiki/stories/manager-ui-kit/components/text/Text.stories.tsx b/packages/manager-wiki/stories/manager-ui-kit/components/text/Text.stories.tsx index 71736f98bc19..4a10bf0ff8c4 100644 --- a/packages/manager-wiki/stories/manager-ui-kit/components/text/Text.stories.tsx +++ b/packages/manager-wiki/stories/manager-ui-kit/components/text/Text.stories.tsx @@ -8,6 +8,18 @@ export const Default: Meta = { iamActions: IAM_ACTIONS, children: 'lorem ipsum dolor sit amet', }, + parameters: { + docs: { + source: { + code: ` + lorem ipsum dolor sit amet +`, + }, + }, + }, }; export const TextWithAuthorization: Meta = { @@ -15,6 +27,18 @@ export const TextWithAuthorization: Meta = { urn: IAM_URNS.WITH_AUTH, iamActions: IAM_ACTIONS, }, + parameters: { + docs: { + source: { + code: ` + Confidential information +`, + }, + }, + }, }; export const TextWithoutAuthorization: Meta = { @@ -22,11 +46,24 @@ export const TextWithoutAuthorization: Meta = { ...Default.args, urn: IAM_URNS.WITHOUT_AUTH, }, + parameters: { + docs: { + source: { + code: ` + HIDDEN (user without authorization) +`, + }, + }, + }, }; const meta = { title: 'Manager UI Kit/Components/Text', component: Text, + tags: ['autodocs'], args: { ...Default.args, children: diff --git a/packages/manager-wiki/stories/manager-ui-kit/components/update-name-modal/UpdateNameModal.stories.tsx b/packages/manager-wiki/stories/manager-ui-kit/components/update-name-modal/UpdateNameModal.stories.tsx index 231451632b6d..4e4ad8d78de2 100644 --- a/packages/manager-wiki/stories/manager-ui-kit/components/update-name-modal/UpdateNameModal.stories.tsx +++ b/packages/manager-wiki/stories/manager-ui-kit/components/update-name-modal/UpdateNameModal.stories.tsx @@ -19,6 +19,24 @@ export const UpdateNameModalDefault = (props: UpdateNameModalProps) => { ); }; +UpdateNameModalDefault.parameters = { + docs: { + source: { + code: ` console.log('updateDisplayName', name)} + headline="Update Resource Name" + description="Do you really want to update the display name of this resource?" + inputLabel="New display name" + defaultValue="oldDisplayName" + cancelButtonLabel="Cancel" + confirmButtonLabel="Confirm" +/>`, + }, + }, +}; + export const UpdateNameModalWithError = (props: UpdateNameModalProps) => { const [isOpen, setIsOpen] = useState(true); const handleClose = () => { @@ -37,6 +55,7 @@ export const UpdateNameModalWithError = (props: UpdateNameModalProps) => { const meta: Meta = { title: 'Manager UI Kit/Components/Update Name Modal', component: UpdateNameModalComponent, + tags: ['autodocs'], argTypes: { isLoading: { control: 'boolean' }, error: { control: 'text' }, @@ -52,8 +71,12 @@ const meta: Meta = { }, args: { isOpen: true, - onClose: () => console.log('close'), - updateDisplayName: (name: string) => console.log('updateDisplayName', name), + onClose: () => { + // Handle close + }, + updateDisplayName: () => { + // Handle update display name + }, headline: 'headline', description: 'Do you really want to update the display name of this resource ?', diff --git a/packages/manager-wiki/stories/manager-ui-kit/content/tile/tile.stories.tsx b/packages/manager-wiki/stories/manager-ui-kit/content/tile/tile.stories.tsx index 9cdb60ff4a4d..16d6f3c38067 100644 --- a/packages/manager-wiki/stories/manager-ui-kit/content/tile/tile.stories.tsx +++ b/packages/manager-wiki/stories/manager-ui-kit/content/tile/tile.stories.tsx @@ -39,6 +39,25 @@ export const SimpleTile = () => ( ); +SimpleTile.parameters = { + docs: { + source: { + code: ` + + + + + + + + Description without Divider + + +`, + }, + }, +}; + export const TileWithLink = () => ( @@ -57,6 +76,28 @@ export const TileWithLink = () => ( ); +TileWithLink.parameters = { + docs: { + source: { + code: ` + + + + + + + + + + Link + + + +`, + }, + }, +}; + export const TileWithActionMenuAndTooltip = () => ( @@ -74,8 +115,29 @@ export const TileWithActionMenuAndTooltip = () => ( ); +TileWithActionMenuAndTooltip.parameters = { + docs: { + source: { + code: `const actionItems = [ + { id: 1, href: 'https://ovhcloud.com', label: 'Action 1' }, + { id: 2, onClick: () => handleAction(), label: 'Action 2' }, +]; + + + + } + /> + + +`, + }, + }, +}; + export const CompleteExample = () => { - const id = useId(); return (
@@ -158,6 +220,7 @@ export const CompleteExample = () => { const meta: Meta = { title: 'Manager UI Kit/Content/Tile', component: Tile, + tags: ['autodocs'], argTypes: {}, args: {}, }; diff --git a/packages/manager-wiki/stories/manager-ui-kit/hooks/useFormatDate/useFormatDate.stories.tsx b/packages/manager-wiki/stories/manager-ui-kit/hooks/useFormatDate/useFormatDate.stories.tsx index 2e956004f99d..05b0426e4fa3 100644 --- a/packages/manager-wiki/stories/manager-ui-kit/hooks/useFormatDate/useFormatDate.stories.tsx +++ b/packages/manager-wiki/stories/manager-ui-kit/hooks/useFormatDate/useFormatDate.stories.tsx @@ -56,6 +56,7 @@ export const UnknownDate = { const useFormatDateStories = { title: 'Manager UI Kit/Hooks/useFormatDate', component: FormatDateComponent, + tags: ['autodocs'], argTypes: { invalidDateDisplayLabel: { control: 'text', diff --git a/packages/manager-wiki/stories/manager-ui-kit/hooks/useTranslatedMicroRegion/useTranslatedMicroRegions.stories.tsx b/packages/manager-wiki/stories/manager-ui-kit/hooks/useTranslatedMicroRegion/useTranslatedMicroRegions.stories.tsx index a88b3894ae90..3c0c0734b44c 100644 --- a/packages/manager-wiki/stories/manager-ui-kit/hooks/useTranslatedMicroRegion/useTranslatedMicroRegions.stories.tsx +++ b/packages/manager-wiki/stories/manager-ui-kit/hooks/useTranslatedMicroRegion/useTranslatedMicroRegions.stories.tsx @@ -24,6 +24,7 @@ const TranslatedMicroRegionsComponent = ({ region }: { region: string }) => { export default { title: 'Manager UI Kit/Hooks/useTranslatedMicroRegions', component: TranslatedMicroRegionsComponent, + tags: ['autodocs'], argTypes: { region: { control: 'text', diff --git a/packages/manager-wiki/stories/manager-ui-kit/templates/ErrorBoundary/ErrorBoundary.stories.tsx b/packages/manager-wiki/stories/manager-ui-kit/templates/ErrorBoundary/ErrorBoundary.stories.tsx index 42365aa08327..6e5b7f650a3e 100644 --- a/packages/manager-wiki/stories/manager-ui-kit/templates/ErrorBoundary/ErrorBoundary.stories.tsx +++ b/packages/manager-wiki/stories/manager-ui-kit/templates/ErrorBoundary/ErrorBoundary.stories.tsx @@ -12,6 +12,7 @@ const defaultsProps = { const meta: Meta = { title: 'Manager UI Kit/Components/ErrorBoundary', component: ErrorBoundary, + tags: ['autodocs'], decorators: [withRouter], args: defaultsProps, }; diff --git a/packages/manager-wiki/stories/manager-ui-kit/templates/Onboarding/onboarding.stories.tsx b/packages/manager-wiki/stories/manager-ui-kit/templates/Onboarding/onboarding.stories.tsx index b71ca2cc888f..c3c0861e7fa6 100644 --- a/packages/manager-wiki/stories/manager-ui-kit/templates/Onboarding/onboarding.stories.tsx +++ b/packages/manager-wiki/stories/manager-ui-kit/templates/Onboarding/onboarding.stories.tsx @@ -177,6 +177,7 @@ export const OnboardingWithoutHeadingSection = () => ( const meta: Meta = { title: 'Manager UI Kit/Components/OnboardingLayout', component: OnboardingLayout, + tags: ['autodocs'], argTypes: { title: { description: 'The main title of the onboarding layout', diff --git a/packages/manager-wiki/stories/manager-ui-kit/templates/baseLayout/BaseLayout.stories.tsx b/packages/manager-wiki/stories/manager-ui-kit/templates/baseLayout/BaseLayout.stories.tsx index 7ed29358c4c0..0ef03f1c30af 100644 --- a/packages/manager-wiki/stories/manager-ui-kit/templates/baseLayout/BaseLayout.stories.tsx +++ b/packages/manager-wiki/stories/manager-ui-kit/templates/baseLayout/BaseLayout.stories.tsx @@ -243,6 +243,7 @@ const meta: Meta = { decorators: [withRouter], title: 'Manager React Components/Templates/Base Layout', component: BaseLayout, + tags: ['autodocs'], argTypes: {}, args: completeBaseLayoutExample, };