Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(manager-react-components): Bump ods version 18.3.0 #14080

Merged
merged 5 commits into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added docs/.vitepress/.nojekyll
Empty file.
4 changes: 2 additions & 2 deletions docs/cli/prebuild.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const path = require('path');
const pick = require('lodash/pick');

// Get all workspaces defined in the `package.json` file.
const { workspaces } = require('./../../package.json');
const { workspaces } = require('../../package.json');

// Keep the bare minimum entries from all package.json files.
const entries = ['name', 'version', 'description', 'repository'];
Expand All @@ -19,7 +19,7 @@ const packages = getMonorepoPackages(directoryPath).map(
);

// Group packages by their corresponding workspaces.
const groupedWorkspaces = workspaces.map((workspace) => {
const groupedWorkspaces = workspaces.packages.map((workspace) => {
const packagesList = packages.filter((pkg) => {
// Remove the pattern `/*` from the workspace name.
if (
Expand Down
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"scripts": {
"docs:build": "yarn docs:build:manager-react-components && node cli/prebuild.js && vitepress build --base /manager/",
"docs:build:manager-react-components": "cd ../packages/manager-react-components && yarn build:storybook && rm -rf ../../docs/docs/public/storybook-static && mkdir -p ../../docs/docs/public/storybook-static && cp -r ./storybook-static/* ../../docs/docs/public/storybook-static",
"docs:deploy": "yarn run docs:build && gh-pages -d .vitepress/dist -m \"docs: update documentation [skip ci]\"",
"docs:deploy": "yarn run docs:build && touch .vitepress/dist/storybook-static/.nojekyll && touch .vitepress/dist/.nojekyll && gh-pages -d .vitepress/dist --dotfiles -m \"docs: update documentation [skip ci]\"",
aboungnaseng-ovhcloud marked this conversation as resolved.
Show resolved Hide resolved
"docs:dev": "node cli/prebuild.js && vitepress dev",
"docs:preview": "vitepress preview"
},
Expand Down
3 changes: 2 additions & 1 deletion packages/manager-react-components/.storybook/main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { StorybookConfig } from '@storybook/react-vite';

const config: StorybookConfig = {
stories: [
'../src/**/*.stories.@(js|jsx|ts|tsx|mdx)',
Expand All @@ -10,7 +11,7 @@ const config: StorybookConfig = {
'@storybook/addon-essentials',
'@storybook/addon-interactions',
'@storybook/addon-styling',
'@storybook/addon-doc',
'@storybook/addon-docs',
],
framework: {
name: '@storybook/react-vite',
Expand Down
12 changes: 6 additions & 6 deletions packages/manager-react-components/.storybook/ovh.theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ export default create({
base: 'light',

// Brand
colorPrimary: '#004FD6',
colorSecondary: '#004FD6',
// colorPrimary: '#004FD6',
// colorSecondary: '#004FD6',

// UI
appBg: '#FF3358',
// appBg: '#FF3358',
appBorderColor: '#004FD6',
appBorderRadius: 0,
appContentBg: '#ffffff',
Expand All @@ -23,9 +23,9 @@ export default create({
textInverseColor: 'rgba(255,255,255,0.9)',

// Toolbar default and active colors
barBg: '#f3fcff',
barSelectedColor: '#004FD6',
barTextColor: '#202124',
// barBg: '#f3fcff',
// barSelectedColor: '#004FD6',
// barTextColor: '#202124',

// Form colors
inputBg: '#ffffff',
Expand Down
9 changes: 5 additions & 4 deletions packages/manager-react-components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ovh-ux/manager-react-components",
"version": "2.1.0",
"version": "2.2.0",
"license": "BSD-3-Clause",
"author": "OVH SAS",
"types": "dist/types/src/lib.d.ts",
Expand Down Expand Up @@ -36,8 +36,6 @@
},
"dependencies": {
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
"@ovhcloud/ods-components": "18.0.0",
"@ovhcloud/ods-themes": "18.0.0",
"@tanstack/react-query": "^5.51.21",
"@tanstack/react-table": "^8.20.1",
"clsx": "^2.1.1",
Expand All @@ -52,11 +50,12 @@
"devDependencies": {
"@babel/core": "7.22.10",
"@mdx-js/react": "^3.0.1",
"@ovhcloud/ods-components": "^18.3.0",
"@ovhcloud/ods-themes": "^18.3.0",
"@ovh-ux/manager-core-api": "^0.9.0",
"@ovh-ux/manager-react-shell-client": "^0.8.1",
"@ovh-ux/manager-tailwind-config": "^0.2.0",
"@ovh-ux/manager-vite-config": "^0.8.1",
"@storybook/addon-a11y": "8.0.4",
"@storybook/addon-docs": "^7.5.3",
"@storybook/addon-essentials": "7.5.3",
"@storybook/addon-interactions": "7.5.3",
Expand Down Expand Up @@ -115,6 +114,8 @@
"zustand": "^4.5.5"
},
"peerDependencies": {
"@ovhcloud/ods-components": "^18.3.0",
"@ovhcloud/ods-themes": "^18.3.0",
"@ovh-ux/manager-core-api": "^0.9.0-alpha.0",
"@ovh-ux/manager-react-shell-client": "^0.8.0-alpha.3",
"i18next": "^23.8.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ export const ManagerButton = ({
<>
<div id={id} className="w-fit">
<OdsButton
{...restProps}
data-testid="manager-button-tooltip"
{...restProps}
isDisabled={true}
label={label}
onClick={null}
Expand All @@ -57,8 +57,8 @@ export const ManagerButton = ({
</>
) : (
<OdsButton
{...restProps}
data-testid="manager-button-without-tooltip"
{...restProps}
isDisabled={true}
onClick={null}
label={label}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react';
import { OdsDivider, OdsCard } from '@ovhcloud/ods-components/react';
import { ODS_CARD_COLOR } from '@ovhcloud/ods-components';
import { TileBlock } from './tile-block.component';

export type DashboardTileBlockItem = {
Expand All @@ -11,13 +12,19 @@ export type DashboardTileBlockItem = {
export type DashboardTileProps = {
title?: string;
items: DashboardTileBlockItem[];
'data-testid'?: string;
};

export const DashboardTile: React.FC<DashboardTileProps> = ({
title,
items,
...props
}) => (
<OdsCard className="w-full flex-col p-[1rem]" color="neutral">
<OdsCard
data-testid={props['data-testid']}
className="w-full flex-col p-[1rem]"
color={ODS_CARD_COLOR.neutral}
>
<div className="flex flex-col w-full">
{title && (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const guideItems = [
const HeadingWithActionButton: HeadersProps = {
title: 'Example for header with actions ',
description: 'description for header',
headerButton: <ActionMenu items={actionItems} />,
headerButton: <ActionMenu id="1" items={actionItems} />,
};
const HeadingWithGuideButton: HeadersProps = {
title: 'Example for header with guides',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,22 @@ export interface ActionMenuItem {
id: number;
rel?: string;
download?: string;
href?: string;
target?: string;
onClick?: () => void;
label: string;
variant?: ODS_BUTTON_VARIANT;
disabled?: boolean;
iamActions?: string[];
urn?: string;
className?: string;
}

export interface ActionMenuProps {
items: ActionMenuItem[];
isCompact?: boolean;
icon?: ODS_ICON_NAME;
variant?: ODS_BUTTON_VARIANT;
disabled?: boolean;
id: string;
isDisabled?: boolean;
}

const MenuItem = ({
Expand All @@ -45,16 +45,13 @@ const MenuItem = ({
size: ODS_BUTTON_SIZE.sm,
variant: ODS_BUTTON_VARIANT.ghost,
displayTooltip: false,
className: 'w-full action-menu-item',
...item,
};
return (
<div className="-mx-[2px]">
{!item?.iamActions || item?.iamActions?.length === 0 ? (
<OdsButton
{...buttonProps}
isDisabled={buttonProps.disabled}
label={item.label}
>
<OdsButton {...buttonProps} label={item.label}>
<span slot="start">
<span>{item.label}</span>
</span>
Expand All @@ -66,7 +63,6 @@ const MenuItem = ({
iamActions={item.iamActions}
urn={item.urn}
{...buttonProps}
isDisabled={buttonProps.disabled || undefined}
>
<span slot="start">
<span>{item.label}</span>
Expand All @@ -82,19 +78,22 @@ export const ActionMenu: React.FC<ActionMenuProps> = ({
isCompact,
icon,
variant = ODS_BUTTON_VARIANT.outline,
disabled,
isDisabled = false,
id,
}) => {
const { t } = useTranslation('buttons');
const [isTrigger, setIsTrigger] = React.useState(false);

return (
<>
<div id="navigation-action-trigger">
<div key={id} id={`navigation-action-trigger-${id}`}>
<OdsButton
data-testid="navigation-action-trigger-action"
className="action-menu-btn"
slot="menu-title"
id={id}
variant={variant}
isDisabled={disabled}
isDisabled={isDisabled}
size={ODS_BUTTON_SIZE.sm}
onClick={() => setIsTrigger(true)}
{...(!isCompact && { label: t('common_actions') })}
Expand All @@ -107,12 +106,17 @@ export const ActionMenu: React.FC<ActionMenuProps> = ({
</div>
<OdsPopover
className="py-[8px] px-0 overflow-hidden"
triggerId="navigation-action-trigger"
triggerId={`navigation-action-trigger-${id}`}
with-arrow
>
{items.map(({ id, ...item }) => {
{items.map(({ id: itemId, ...item }) => {
return (
<MenuItem id={id} key={id} item={item} isTrigger={isTrigger} />
<MenuItem
id={itemId}
key={itemId}
item={item}
isTrigger={isTrigger}
/>
);
})}
</OdsPopover>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { IamAuthorizationResponse } from '../../../../hooks/iam/iam.interface';
vitest.mock('../../../../hooks/iam');

const actionItems: ActionMenuProps = {
id: 'action-menu-test-id',
items: [
{
id: 1,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,30 @@
import React from 'react';
import { ODS_ICON_NAME } from '@ovhcloud/ods-components';
import {
ODS_ICON_NAME,
ODS_LINK_COLOR,
ODS_LINK_ICON_ALIGNMENT,
} from '@ovhcloud/ods-components';
import { OdsLink } from '@ovhcloud/ods-components/react';

export enum LinkType {
back = 'back',
next = 'next',
external = 'external',
}
export enum IconLinkAlignmentType {
left = 'left',
right = 'right',
}

export interface LinksProps {
className?: string;
color?: ODS_LINK_COLOR;
download?: string;
label?: string;
href?: string;
rel?: string;
target?: string;
iconAlignment?: IconLinkAlignmentType;
type?: LinkType;
onClickReturn?: () => void;
}
Expand All @@ -24,12 +34,19 @@ export const Links: React.FC<LinksProps> = ({
onClickReturn,
type,
href,
color = ODS_LINK_COLOR.primary,
iconAlignment,
...props
}: LinksProps) => (
<OdsLink
href={href}
onClick={onClickReturn}
color={color}
{...(iconAlignment && {
iconAlignment: ODS_LINK_ICON_ALIGNMENT[iconAlignment],
})}
{...props}
{...(type === LinkType.back && { icon: ODS_ICON_NAME.arrowLeft })}
{...(type === LinkType.next && { icon: ODS_ICON_NAME.arrowRight })}
{...(type === LinkType.external && { icon: ODS_ICON_NAME.externalLink })}
label={label}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export const Title: React.FC<
React.PropsWithChildren<{
className?: string;
}>
> = ({ children, className }) => {
> = ({ children, className = '' }) => {
return (
<div
className={`${className} m-0 p-0 text-[--ods-color-heading] text-[36px] leading-[45px] font-bold mb-[24px]`}
Expand All @@ -18,7 +18,7 @@ export const Subtitle: React.FC<
React.PropsWithChildren<{
className?: string;
}>
> = ({ children, className }) => {
> = ({ children, className = '' }) => {
return (
<div
className={`${className} m-0 p-0 text-[--ods-color-heading] text-[24px] leading-[32px] font-bold`}
Expand Down
37 changes: 27 additions & 10 deletions packages/manager-react-components/src/docs/introduction.mdx
Original file line number Diff line number Diff line change
@@ -1,18 +1,35 @@
import { Meta } from '@storybook/addon-docs/blocks';
import { Links, LinkType } from './../index.ts';
import { version, dependencies } from './../../package.json';

<Meta title="Manager React Components/Introduction" />

# Welcome to the Manager Component Storybook!

<Links
type={LinkType.external}
label="Follow on Github"
href="https://github.com/ovh/manager/tree/master/packages/manager-react-components"
target="_blank"
/>
<div>
<Links
type={LinkType.external}
label={`Library package version ${version}`}
href="https://github.com/ovh/manager/tree/master/packages/manager-react-components"
target="_blank"
/>
<br />
</div>

<img
src="https://th.bing.com/th/id/R.173e08cbab5c318ff60d0e2445c8aafd?rik=WDLPHDEItBd4Bw&pid=ImgRaw&r=0"
alt="welcome"
/>
<div>
<Links
type={LinkType.external}
label={`@ovhcloud/ods-components and @ovhcloud/ods-themes version ${dependencies['@ovhcloud/ods-components']}`}
href="https://ovh.github.io/design-system/v18.3.0/?path=/docs/ovhcloud-design-system-welcome--docs"
target="_blank"
/>
<br />
</div>

<div>
<br />
<img
src="https://th.bing.com/th/id/R.173e08cbab5c318ff60d0e2445c8aafd?rik=WDLPHDEItBd4Bw&pid=ImgRaw&r=0"
alt="welcome"
/>
</div>
Loading
Loading