diff --git a/docs/styleguide.config.js b/docs/styleguide.config.js index 2875aedd2f..26cea62b13 100644 --- a/docs/styleguide.config.js +++ b/docs/styleguide.config.js @@ -136,6 +136,8 @@ module.exports = { { name: 'Special', components: () => [ + '../react/Alert/index.jsx', + '../react/AlertTitle/index.jsx', '../react/Alerter/index.jsx', '../react/AppIcon/index.jsx', '../react/AppTile/index.jsx', diff --git a/package.json b/package.json index 5f2a07149b..7342e451fa 100644 --- a/package.json +++ b/package.json @@ -72,6 +72,7 @@ "@babel/helper-regex": "7.10.5", "@cozy/codemods": "^1.9.0", "@material-ui/core": "4.12.3", + "@material-ui/lab": "4.0.0-alpha.61", "@semantic-release/changelog": "5.0.1", "@semantic-release/git": "7.0.18", "@semantic-release/npm": "9.0.1", @@ -173,6 +174,7 @@ }, "peerDependencies": { "@material-ui/core": ">=4.12", + "@material-ui/lab": ">=4.0.0-alpha.61", "cozy-client": ">=28.1.0", "cozy-device-helper": "^2.0.0", "cozy-doctypes": "^1.69.0", diff --git a/react/Alert/Readme.md b/react/Alert/Readme.md new file mode 100644 index 0000000000..b124853525 --- /dev/null +++ b/react/Alert/Readme.md @@ -0,0 +1,122 @@ +```jsx +import Alert from 'cozy-ui/transpiled/react/Alert' +import AlertTitle from 'cozy-ui/transpiled/react/AlertTitle' +import Button from 'cozy-ui/transpiled/react/Buttons' +import Icon from 'cozy-ui/transpiled/react/Icon' +import Variants from 'cozy-ui/docs/components/Variants' +import DeviceLaptopIcon from 'cozy-ui/transpiled/react/Icons/DeviceLaptop' +import DownloadIcon from 'cozy-ui/transpiled/react/Icons/Download' + +const initialVariants = [{ + longText: false, + title: false, + block: false, + color: false, + largeIcon: false, + noIcon: false, + square: false, + actionOne: false, + actionTwo: false, + close: false +}] + +; + + + {variant => ( + : undefined} + action={(variant.actionOne || variant.actionTwo) ? + <> + {variant.actionOne && + + + +
+
+
+ + + + +
+
+
SECONDARY
This is a secondary alert +
+
+
+
+
+
+
+ +
+
+
SUCCESS
This is a success alert +
+
+
+
+
+
+
+ +
+
+
ERROR
This is a error alert +
+
+
+
+
+
+
+ +
+
+
WARNING
This is a warning alert +
+
+
+
+
+
+
+ + + + +
+
+
INFO
This is a info alert +
+
+
+
+" +`; + exports[`AppTitle should render examples: AppTitle 1`] = ` "

Drive

@@ -107,7 +207,7 @@ exports[`Badge should render examples: Badge 1`] = `
" `; -exports[`Badge should render examples: Badge 2`] = `"
CD
"`; +exports[`Badge should render examples: Badge 2`] = `"
CD
"`; exports[`Banner should render examples: Banner 1`] = ` "
@@ -2399,187 +2499,187 @@ exports[`DropdownText should render examples: DropdownText 1`] = ` "
Default
-
-

h1

-

+

+

h1

+

-
-

h2

-

+

+

h2

+

-
-

h3

-

+

+

h3

+

-
-

h4

-

+

+

h4

+

-
-
h5
-

+

+
h5
+

-
-
subtitle1
-

+

+
subtitle1
+

-
-
subtitle2
-

+

+
subtitle2
+

-
-

body1

-

+

+

body1

+

-
-

body2

-

+

+

body2

+

-
caption -

+

caption +

Disabled
-
-

h1

-

+

+

h1

+

-
-

h2

-

+

+

h2

+

-
-

h3

-

+

+

h3

+

-
-

h4

-

+

+

h4

+

-
-
h5
-

+

+
h5
+

-
-
subtitle1
-

+

+
subtitle1
+

-
-
subtitle2
-

+

+
subtitle2
+

-
-

body1

-

+

+

body1

+

-
-

body2

-

+

+

body2

+

-
caption -

+

caption +

-
-

This is a long text without ellipsis

-

+

+

This is a long text without ellipsis

+

-
-

This is a long text with ellipsis

-

+

+

This is a long text with ellipsis

+

-
-

Space between text and icon

-

+

+

Space between text and icon

+

-
-

Text with
breaking spaces
inside content

-

+

+

Text with
breaking spaces
inside content

+

@@ -2954,98 +3054,98 @@ exports[`Icon should render examples: Icon 1`] = ` "

Font size: 16px

-
+

Album

-
+

AlbumAdd

-
+

AlbumRemove

-
+

Answer

-
+

Apple

-
+

Archive

-
+

Attachment

-
+

Attention

-
+

Bank

-
+

Banking

-
+

BankingAdd

-
+

Bell

-
+

Bike

-
+

Bill

-
+

Bottom

-
+

BrowserBrave

-
+

BrowserChrome

-
+

BrowserDuckduckgo

-
+
@@ -3053,108 +3153,108 @@ exports[`Icon should render examples: Icon 1`] = `

BrowserEdge

-
+

BrowserEdgeChromium

-
+

BrowserFirefox

-
+

BrowserIe

-
+

BrowserOpera

-
+

BrowserSafari

-
+

Burger

-
+

Bus

-
+

Calendar

-
+

Camera

-
+

Car

-
+

CarbonCopy

-
+

Categories

-
+

Certified

-
+

Check

-
+

Checkbox

-
+

CheckCircle

-
+

CheckList

-
+

CheckSquare

-
+

CircleFilled

-
+

Clock

-
+
@@ -3164,58 +3264,58 @@ exports[`Icon should render examples: Icon 1`] = `

Cloud

-
+

CloudHappy

-
+

Collect

-
+

Comment

-
+

Company

-
+

Compass

-
+

Connector

-
+

Contract

-
+

Contrast

-
+

CozyLaugh

-
+

CozyText

-
+
@@ -3223,57 +3323,57 @@ exports[`Icon should render examples: Icon 1`] = `

Credit

-
+

CreditCard

-
+

CreditCardAdd

-
+

Crop

-
+

Cross

-
+

CrossCircle

-
+

CrossSmall

-
+

Cube

-
+

Dash

-
+

Dashboard

-
+

DataControl

-
+
@@ -3281,82 +3381,82 @@ exports[`Icon should render examples: Icon 1`] = `

Debit

-
+

Devices

-
+

Dots

-
+

Down

-
+

Download

-
+

DrawingArrowUp

-
+

Dropdown

-
+

DropdownClose

-
+

DropdownOpen

-
+

Dropup

-
+

Email

-
+

EmailNotification

-
+

Eu

-
+

Euro

-
+

Exchange

-
+

Eye

-
+
@@ -3365,7 +3465,7 @@ exports[`Icon should render examples: Icon 1`] = `

EyeClosed

-
+
@@ -3373,12 +3473,12 @@ exports[`Icon should render examples: Icon 1`] = `

File

-
+

FileAdd

-
+
@@ -3388,12 +3488,12 @@ exports[`Icon should render examples: Icon 1`] = `

FileDuotone

-
+

FileNew

-
+
@@ -3401,47 +3501,47 @@ exports[`Icon should render examples: Icon 1`] = `

FileNone

-
+

FileOutline

-
+

Filter

-
+

Fingerprint

-
+

Fitness

-
+

Flag

-
+

FlagOutlined

-
+

FlashAuto

-
+

Flashlight

-
+
@@ -3449,27 +3549,27 @@ exports[`Icon should render examples: Icon 1`] = `

Folder

-
+

FolderAdd

-
+

FolderMoveto

-
+

Forbidden

-
+

FromUser

-
+
@@ -3477,57 +3577,57 @@ exports[`Icon should render examples: Icon 1`] = `

Gear

-
+

Globe

-
+

GraphCircle

-
+

Grid

-
+

GroupList

-
+

Groups

-
+

Hand

-
+

Heart

-
+

Help

-
+

History

-
+

Home

-
+
@@ -3535,12 +3635,12 @@ exports[`Icon should render examples: Icon 1`] = `

Hourglass

-
+

Image

-
+
@@ -3548,87 +3648,87 @@ exports[`Icon should render examples: Icon 1`] = `

Info

-
+

InfoOutlined

-
+

Key

-
+

Laptop

-
+

Left

-
+

Lightbulb

-
+

Link

-
+

LinkOut

-
+

List

-
+

Location

-
+

Lock

-
+

Logout

-
+

MagicTrick

-
+

Magnet

-
+

Magnifier

-
+

Merge

-
+

Mountain

-
+
@@ -3636,7 +3736,7 @@ exports[`Icon should render examples: Icon 1`] = `

MovementIn

-
+
@@ -3644,82 +3744,82 @@ exports[`Icon should render examples: Icon 1`] = `

MovementOut

-
+

Movement

-
+

Moveto

-
+

MultiFiles

-
+

Music

-
+

New

-
+

Next

-
+

Note

-
+

NotificationEmail

-
+

Offline

-
+

Online

-
+

Openwith

-
+

Palette

-
+

Paper

-
+

Paperplane

-
+

Password

-
+
@@ -3727,57 +3827,57 @@ exports[`Icon should render examples: Icon 1`] = `

Pen

-
+

People

-
+

Percent

-
+

PercentCircle

-
+

PersonalData

-
+

Phone

-
+

PhoneDownload

-
+

PhoneUpload

-
+

PieChart

-
+

Pin

-
+

Plane

-
+
@@ -3785,7 +3885,7 @@ exports[`Icon should render examples: Icon 1`] = `

Plus

-
+
@@ -3793,57 +3893,57 @@ exports[`Icon should render examples: Icon 1`] = `

PlusSmall

-
+

Previous

-
+

Printer

-
+

Qualify

-
+

RadioChecked

-
+

RadioUnchecked

-
+

Rename

-
+

Repare

-
+

Reply

-
+

Restaurant

-
+

RestoreStraight

-
+
@@ -3851,52 +3951,52 @@ exports[`Icon should render examples: Icon 1`] = `

Restore

-
+

Right

-
+

Rise

-
+

RotateLeft

-
+

RotateRight

-
+

SadCozy

-
+

Safe

-
+

School

-
+

SelectAll

-
+

Setting

-
+
@@ -3904,99 +4004,99 @@ exports[`Icon should render examples: Icon 1`] = `

Share

-
+

ShareCircle

-
+

Shield

-
+

Shop

-
+

Sound

-
+

Spinner

-
+

Stack

-
+

Star

-
+

Stats

-
+

Subway

-
+

Sync

-
+

SyncCozy

-
+

Tag

-
+

Target

-
+

Team

-
+

Telephone

-
+

ToTheCloud

-
+

Top

-
+

Train

-
+
@@ -4004,77 +4104,77 @@ exports[`Icon should render examples: Icon 1`] = `

Trash

-
+

Trophy

-
+

Unknow

-
+

Unlink

-
+

Unlock

-
+

Up

-
+

Upload

-
+

Videos

-
+

Walk

-
+

Wallet

-
+

WalletAdd

-
+

WalletNew

-
+

Warn

-
+

Warning

-
+

WarningCircle

-
+

WrenchCircle

@@ -7854,13 +7954,13 @@ exports[`Media should render examples: Media 3`] = ` exports[`MuiCozyTheme/Switch should render examples: MuiCozyTheme/Switch 1`] = ` "
-
+

primary

-
+

secondary

-
+

default

@@ -7895,42 +7995,42 @@ exports[`Paper should render examples: Paper 1`] = `
Variant selector
-
+

This is a sheet of paper

elevation 0

Paper can be used to build surface or other elements for your application.

-
+

This is a sheet of paper

elevation 1

Paper can be used to build surface or other elements for your application.

-
+

This is a sheet of paper

elevation 4

Paper can be used to build surface or other elements for your application.

-
+

This is a sheet of paper

elevation 12

Paper can be used to build surface or other elements for your application.

-
+

This is a sheet of paper

elevation 16

Paper can be used to build surface or other elements for your application.

-
+

This is a sheet of paper

elevation 24
@@ -7964,20 +8064,20 @@ exports[`PieChart should render examples: PieChart 1`] = ` "
-
-
-
-

60 %

-

of the total

+
+
+
+

60 %

+

of the total

-
-
-
-

105 €

-

on the period

+
+
+
+

105 €

+

on the period

@@ -8005,7 +8105,7 @@ exports[`ProgressionBanner should render examples: ProgressionBanner 1`] = `
Variant selector
-
+
@@ -8024,7 +8124,7 @@ exports[`ProgressionBanner should render examples: ProgressionBanner 1`] = `

-
+
diff --git a/react/examples.spec.jsx b/react/examples.spec.jsx index 92b1ecc722..32187cf35b 100644 --- a/react/examples.spec.jsx +++ b/react/examples.spec.jsx @@ -24,6 +24,7 @@ const testComponent = (ComponentName, options) => { } // Please keep the list sorted +testComponent('Alert') testComponent('AppTitle') testComponent('Avatar') testComponent('Badge') diff --git a/react/index.js b/react/index.js index 09f123b630..aef76422b9 100644 --- a/react/index.js +++ b/react/index.js @@ -106,3 +106,5 @@ export { default as Chips } from './Chips' export { default as PieChart } from './PieChart' export { default as DropdownText } from './DropdownText' export { default as CircleButton } from './CircleButton' +export { default as Alert } from './Alert' +export { default as AlertTitle } from './AlertTitle' diff --git a/yarn.lock b/yarn.lock index 3daa5956cf..3ec61cd6eb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1855,6 +1855,17 @@ react-is "^16.8.0 || ^17.0.0" react-transition-group "^4.4.0" +"@material-ui/lab@4.0.0-alpha.61": + version "4.0.0-alpha.61" + resolved "https://registry.yarnpkg.com/@material-ui/lab/-/lab-4.0.0-alpha.61.tgz#9bf8eb389c0c26c15e40933cc114d4ad85e3d978" + integrity sha512-rSzm+XKiNUjKegj8bzt5+pygZeckNLOr+IjykH8sYdVk7dE9y2ZuUSofiMV2bJk3qU+JHwexmw+q0RyNZB9ugg== + dependencies: + "@babel/runtime" "^7.4.4" + "@material-ui/utils" "^4.11.3" + clsx "^1.0.4" + prop-types "^15.7.2" + react-is "^16.8.0 || ^17.0.0" + "@material-ui/styles@^4.11.4": version "4.11.4" resolved "https://registry.yarnpkg.com/@material-ui/styles/-/styles-4.11.4.tgz#eb9dfccfcc2d208243d986457dff025497afa00d" @@ -1901,6 +1912,15 @@ prop-types "^15.7.2" react-is "^16.8.0 || ^17.0.0" +"@material-ui/utils@^4.11.3": + version "4.11.3" + resolved "https://registry.yarnpkg.com/@material-ui/utils/-/utils-4.11.3.tgz#232bd86c4ea81dab714f21edad70b7fdf0253942" + integrity sha512-ZuQPV4rBK/V1j2dIkSSEcH5uT6AaHuKWFfotADHsC0wVL1NLd2WkFCm4ZZbX33iO4ydl6V0GPngKm8HZQ2oujg== + dependencies: + "@babel/runtime" "^7.4.4" + prop-types "^15.7.2" + react-is "^16.8.0 || ^17.0.0" + "@mrmlnc/readdir-enhanced@^2.2.1": version "2.2.1" resolved "https://registry.yarnpkg.com/@mrmlnc/readdir-enhanced/-/readdir-enhanced-2.2.1.tgz#524af240d1a360527b730475ecfa1344aa540dde"