From edb4de3d9d26b004e3b6b307c12ecfb168e37a09 Mon Sep 17 00:00:00 2001
From: Laliq <105340174+martalalik@users.noreply.github.com>
Date: Wed, 24 Aug 2022 15:02:23 +0200
Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9D=20=20=20Add=20ButtonGroup=20to=20S?=
=?UTF-8?q?torybook=20(#2420)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* 📝 Update Usage
* 📝 Add ButtonGroup
* ✏️ Fix typo
* 📝 Add Introduction
* ✨ Add vertical prop & story
* 🚧 Add SplitButton
* ✨ Add role to Group
* 💄 Fix menu btn position
* 💄 Update group style
* ♿️ Add aria-label & a11y description
* ♿️ Update a11y description
* 📝 Update component name from Group to ButtonGroup
* 💄 Change display
* 💄 Update display to flex-inline
* 🎨 Move ButtonGroup under Button
* ♿️ Add aria-label
* ✏️ Fix typo
---
.../src/components/Button/Button.docs.mdx | 78 +++++++---
.../src/components/Button/Button.stories.tsx | 135 +++++++++++++++---
.../ButtonGroup/ButtonGroup.tokens.ts} | 0
.../Button/ButtonGroup/ButtonGroup.tsx | 68 +++++++++
.../components/Button/ButtonGroup/index.ts | 1 +
.../src/components/Button/index.ts | 15 +-
.../src/components/Group/Group.tsx | 44 ------
.../src/components/Group/index.ts | 1 -
8 files changed, 257 insertions(+), 85 deletions(-)
rename packages/eds-core-react/src/components/{Group/Group.tokens.ts => Button/ButtonGroup/ButtonGroup.tokens.ts} (100%)
create mode 100644 packages/eds-core-react/src/components/Button/ButtonGroup/ButtonGroup.tsx
create mode 100644 packages/eds-core-react/src/components/Button/ButtonGroup/index.ts
delete mode 100644 packages/eds-core-react/src/components/Group/Group.tsx
delete mode 100644 packages/eds-core-react/src/components/Group/index.ts
diff --git a/packages/eds-core-react/src/components/Button/Button.docs.mdx b/packages/eds-core-react/src/components/Button/Button.docs.mdx
index 919e5375d6..352491e439 100644
--- a/packages/eds-core-react/src/components/Button/Button.docs.mdx
+++ b/packages/eds-core-react/src/components/Button/Button.docs.mdx
@@ -1,7 +1,6 @@
import { Story, PropsTable, Links } from './../../../.storybook/components'
-import { Button } from '.'
-
+import { Button } from '.'
# Button
Allows users to take action with a single click or tap.
@@ -26,45 +25,62 @@ import { Button } from '@equinor/eds-core-react'
```
+### Using the 'as' prop to render as another component
+
+The `as` prop allows you to render the `Button` as another html element or even react component.
+
+```tsx
+
+```
+This is especially useful if you want to use the `Button` as as a navigation component for a third party routing library such as react-router.
+
+```tsx
+import { Link } from "react-router-dom"
+import { Button } from '@equinor/eds-core-react'
+
+
+```
+
## Examples
### Basic
-
The `Button` come with four variants; `contained`, `outlined`, `ghost` and `ghost_icon`.
+
### Icon button
-
The `ghost_icon` & `contained_icon`variant is meant for standalone icon buttons using the `` component.
Make sure to defined `aria-label` with descriptive text of `Button` interaction.
+
### Color
+
### Hierarchy
-
Use variants to differentiate the hierarchy.
Contained - being high-emphasis.
Outlined - being medium-emphasis.
Ghost - being low-emphasis.
+
### File upload
-
Example of how to do file upload button. Please note this demo only works in Storybook Canvas (isolated example only).
+
### Progress button
-
Use the `Progress` component if you need progress indication on a button.
+
### All
-
Example All button combinations.
+
### Full width
@@ -72,22 +88,48 @@ Example All button combinations.
### Compact
-
Compact `Button` using `EdsProvider`.
+
-### Using the 'as' prop to render as another component
+## Button.Group
+Is used to group related buttons.
-The `as` prop allows you to render the `Button` as another html element or even react component.
+### Usage
+The buttons can be grouped by wrapping them with the `Button.Group` component.
```tsx
-
-```
-This is especially useful if you want to use the `Button` as as a navigation component for a third party routing library such as react-router.
-
-```tsx
-import { Link } from "react-router-dom"
import { Button } from '@equinor/eds-core-react'
-
+
+
+
+
+
```
+
+### Accessibility
+
+#### ARIA
+
+
Button.Group has role="group".
+
You should provide an accessible label with aria-label="label", aria-labelledby="id" or <label>.
+
+
+## Examples
+
+### Horizontal
+The `Button.Group` is displayed horizontally by default.
+
+
+
+### Vertical
+The `Button.Group` can be displayed vertically using the `vertical` prop.
+
+
+
+### Split
+`Button.Group` can also be used to create a split button.
+The dropdown can change the button action (as in this example) or be used to immediately trigger a related action.
+
+
\ No newline at end of file
diff --git a/packages/eds-core-react/src/components/Button/Button.stories.tsx b/packages/eds-core-react/src/components/Button/Button.stories.tsx
index 9149c69038..a2a7cca8c4 100644
--- a/packages/eds-core-react/src/components/Button/Button.stories.tsx
+++ b/packages/eds-core-react/src/components/Button/Button.stories.tsx
@@ -1,16 +1,18 @@
import { useState, useEffect } from 'react'
+import { action } from '@storybook/addon-actions'
import {
Button,
- Icon,
ButtonProps,
+ ButtonGroupProps,
+ Icon,
EdsProvider,
Density,
+ Menu,
Progress,
} from '../..'
import { Story, ComponentMeta } from '@storybook/react'
import { menu, add, save } from '@equinor/eds-icons'
import { Stack } from './../../../.storybook/components'
-// import { Group } from '../Group'
import page from './Button.docs.mdx'
export default {
@@ -254,30 +256,30 @@ export const FullWidth: Story = () => (
-