diff --git a/packages/web-react/src/components/Button/README.md b/packages/web-react/src/components/Button/README.md index fa9dd270c1..41667348ae 100644 --- a/packages/web-react/src/components/Button/README.md +++ b/packages/web-react/src/components/Button/README.md @@ -12,7 +12,6 @@ import { Button } from '@lmc-eu/spirit-web-react'; - @@ -33,20 +32,20 @@ import { RouterLink } from 'react-router-dom'; ### API -| Name | Type | Default | Required | Description | -| ------------- | ----------------------------------------------------------------------------------------- | --------- | -------- | -------------------------------------------------------------------------- | -| `children` | `ReactNode` | `null` | ✕ | Content of the Button | -| `color` | [Action Color dictionary][dictionary-color], [Emotion Color dictionary][dictionary-color] | `primary` | ✕ | Color variant | -| `elementType` | `ElementType` | `button` | ✕ | Type of element | -| `isBlock` | `bool` | `false` | ✕ | Span the element to the full width of its parent | -| `isDisabled` | `bool` | `false` | ✕ | If true, Button is disabled | -| `isLoading` | `bool` | `false` | ✕ | If true, Button is in a loading state, disabled and the Spinner is visible | -| `isSquare` | `bool` | `false` | ✕ | If true, Button is square, usually only with an Icon | -| `name` | `string` | — | ✕ | For use a button as a form data reference | -| `onClick` | `string` | `null` | ✕ | JS function to call on click | -| `ref` | `ForwardedRef` | — | ✕ | Button element reference | -| `size` | [Size dictionary][dictionary-size] | `medium` | ✕ | Size variant | -| `type` | `string` | `button` | ✕ | Type of the Button | +| Name | Type | Default | Required | Description | +| ------------- | ------------------------------------------------------------------------------------------------ | --------- | -------- | -------------------------------------------------------------------------- | +| `children` | `ReactNode` | `null` | ✕ | Content of the Button | +| `color` | [Action Button Color dictionary][dictionary-color], [Emotion Color dictionary][dictionary-color] | `primary` | ✕ | Color variant | +| `elementType` | `ElementType` | `button` | ✕ | Type of element | +| `isBlock` | `bool` | `false` | ✕ | Span the element to the full width of its parent | +| `isDisabled` | `bool` | `false` | ✕ | If true, Button is disabled | +| `isLoading` | `bool` | `false` | ✕ | If true, Button is in a loading state, disabled and the Spinner is visible | +| `isSquare` | `bool` | `false` | ✕ | If true, Button is square, usually only with an Icon | +| `name` | `string` | — | ✕ | For use a button as a form data reference | +| `onClick` | `string` | `null` | ✕ | JS function to call on click | +| `ref` | `ForwardedRef` | — | ✕ | Button element reference | +| `size` | [Size dictionary][dictionary-size] | `medium` | ✕ | Size variant | +| `type` | `string` | `button` | ✕ | Type of the Button | For more information see [Button][button] component. Button also contain all the appropriate attributes according to the type of element. The default element type for Button is `{' '} - {' '} - - +
+ {' '} + {' '} +
))} diff --git a/packages/web-react/src/components/ButtonLink/README.md b/packages/web-react/src/components/ButtonLink/README.md index 226f79781f..cbeffdbea8 100644 --- a/packages/web-react/src/components/ButtonLink/README.md +++ b/packages/web-react/src/components/ButtonLink/README.md @@ -10,7 +10,6 @@ import { ButtonLink } from '@lmc-eu/spirit-web-react'; Click me Click me Click me - Click me Click me Click me Click me diff --git a/packages/web-react/src/components/ButtonLink/__tests__/useButtonLinkStyleProps.test.ts b/packages/web-react/src/components/ButtonLink/__tests__/useButtonLinkStyleProps.test.ts index 831c551e91..3673ff1055 100644 --- a/packages/web-react/src/components/ButtonLink/__tests__/useButtonLinkStyleProps.test.ts +++ b/packages/web-react/src/components/ButtonLink/__tests__/useButtonLinkStyleProps.test.ts @@ -9,7 +9,6 @@ describe('useButtonStyleProps', () => { ['secondary', 'medium', false, false, false, false, 'Button Button--secondary Button--medium'], ['tertiary', 'medium', false, false, false, false, 'Button Button--tertiary Button--medium'], ['danger', 'medium', false, false, false, false, 'Button Button--danger Button--medium'], - ['inverted', 'medium', false, false, false, false, 'Button Button--inverted Button--medium'], ['primary', 'medium', true, false, false, false, 'Button Button--primary Button--medium Button--block'], ['primary', 'medium', false, true, false, false, 'Button Button--primary Button--medium Button--disabled'], [ diff --git a/packages/web-react/src/components/ButtonLink/demo/ButtonLinkDemoFactory.tsx b/packages/web-react/src/components/ButtonLink/demo/ButtonLinkDemoFactory.tsx index be4b091937..c0e1c1a8ce 100644 --- a/packages/web-react/src/components/ButtonLink/demo/ButtonLinkDemoFactory.tsx +++ b/packages/web-react/src/components/ButtonLink/demo/ButtonLinkDemoFactory.tsx @@ -1,34 +1,32 @@ import React from 'react'; import DocsSection from '../../../../docs/DocsSections'; -import { ActionColors, EmotionColors, Sizes } from '../../../constants'; +import { ActionButtonColors, EmotionColors, Sizes } from '../../../constants'; import { ButtonBaseProps } from '../../../types'; import { Icon } from '../../Icon'; import { ButtonLink } from '../ButtonLink'; const ButtonLinkDemoFactory = ({ ...props }: ButtonBaseProps) => { const sizes = Object.values(Sizes); - const actionColors = Object.values(ActionColors); + const actionButtonColors = Object.values(ActionButtonColors); const emotionColors = Object.values(EmotionColors); - const colors = [...actionColors, ...emotionColors]; + const colors = [...actionButtonColors, ...emotionColors]; return ( <> {sizes.map((size) => ( {colors.map((color) => ( -
-
- - {`Button ${color}`} - {' '} - - - Menu - {' '} - - - -
+
+ + {`Button ${color}`} + {' '} + + + Menu + {' '} + + +
))} diff --git a/packages/web-react/src/components/ButtonLink/stories/ButtonLink.stories.tsx b/packages/web-react/src/components/ButtonLink/stories/ButtonLink.stories.tsx index fa601f230b..aa800f1495 100644 --- a/packages/web-react/src/components/ButtonLink/stories/ButtonLink.stories.tsx +++ b/packages/web-react/src/components/ButtonLink/stories/ButtonLink.stories.tsx @@ -1,7 +1,7 @@ import { Markdown } from '@storybook/blocks'; import type { Meta, StoryObj } from '@storybook/react'; import React from 'react'; -import { ActionColors, EmotionColors, Sizes } from '../../../constants'; +import { ActionButtonColors, EmotionColors, Sizes } from '../../../constants'; import { Icon } from '../../Icon'; import ReadMe from '../README.md'; import { ButtonLink } from '..'; @@ -34,9 +34,9 @@ const meta: Meta = { }, color: { control: 'select', - options: [...Object.values(ActionColors), ...Object.values(EmotionColors)], + options: [...Object.values(ActionButtonColors), ...Object.values(EmotionColors)], table: { - defaultValue: { summary: ActionColors.PRIMARY }, + defaultValue: { summary: ActionButtonColors.PRIMARY }, }, }, isBlock: { @@ -58,7 +58,7 @@ const meta: Meta = { }, args: { children: 'Click me', - color: ActionColors.PRIMARY, + color: ActionButtonColors.PRIMARY, isBlock: false, isDisabled: false, isLoading: false, diff --git a/packages/web-react/src/constants/dictionaries.ts b/packages/web-react/src/constants/dictionaries.ts index 2cd13d3291..fbaa014fb5 100644 --- a/packages/web-react/src/constants/dictionaries.ts +++ b/packages/web-react/src/constants/dictionaries.ts @@ -29,6 +29,12 @@ export const ActionColors = { INVERTED: 'inverted', } as const; +export const ActionButtonColors = { + PRIMARY: 'primary', + SECONDARY: 'secondary', + TERTIARY: 'tertiary', +} as const; + export const ActionLinkColors = { PRIMARY: 'primary', SECONDARY: 'secondary', diff --git a/packages/web-react/src/types/button.ts b/packages/web-react/src/types/button.ts index bc92918950..adcdb58661 100644 --- a/packages/web-react/src/types/button.ts +++ b/packages/web-react/src/types/button.ts @@ -1,6 +1,6 @@ import { ElementType } from 'react'; import { - ActionColorsDictionaryType, + ActionButtonColorsDictionaryType, AriaLabelingProps, ChildrenProps, ClickEvents, @@ -10,7 +10,7 @@ import { StyleProps, } from './shared'; -export type ButtonColor = ActionColorsDictionaryType | EmotionColorsDictionaryType | C; +export type ButtonColor = ActionButtonColorsDictionaryType | EmotionColorsDictionaryType | C; export type ButtonSize = SizesDictionaryType | S; export type ButtonType = 'button' | 'submit' | 'reset'; diff --git a/packages/web-react/src/types/shared/dictionaries.ts b/packages/web-react/src/types/shared/dictionaries.ts index 9e96c97d11..fefded746a 100644 --- a/packages/web-react/src/types/shared/dictionaries.ts +++ b/packages/web-react/src/types/shared/dictionaries.ts @@ -1,5 +1,6 @@ import { ActionColors, + ActionButtonColors, ActionLinkColors, AlignmentX, AlignmentXExtended, @@ -34,6 +35,11 @@ export type AlignmentYExtendedDictionaryType = export type ActionColorsDictionaryKeys = keyof typeof ActionColors; export type ActionColorsDictionaryType = (typeof ActionColors)[ActionColorsDictionaryKeys] | C; +export type ActionButtonColorsDictionaryKeys = keyof typeof ActionButtonColors; +export type ActionButtonColorsDictionaryType = + | (typeof ActionButtonColors)[ActionButtonColorsDictionaryKeys] + | C; + export type ActionLinkColorsDictionaryKeys = keyof typeof ActionLinkColors; export type ActionLinkColorsDictionaryType = | (typeof ActionLinkColors)[ActionLinkColorsDictionaryKeys]