Skip to content

Commit

Permalink
feat: Deprecates some component
Browse files Browse the repository at this point in the history
BREAKING CHANGE: This is the list of deprecated component
`ActionMenu`, `Alerter`, `BottomDrawer`, `Button`, `ButtonAction`, `Chip`, `CompositeRow`, `GridItem`, `Infos`, `InfosCarrousel`, `InlineCard`, `IntentModal`, `IntentOpener`, `Media`, `Menus`, `Modal`, `NarrowContent`, `Overlay`, `PercentageBar`, `PercentageLine`, `PushClientButton`, `QuotaAlert`, `Radio`, `RaisedList`, `ViewStack`

These components are now in a `deprecated` subfolder. Use this codemods to migrate: 

```
$ yarn global add @cozy/codemods
$ jscodeshift -t $(yarn global dir)/node_modules/@cozy/codemods/src/transforms/transform-ui-deprecated-imports.js src --parser babel --ignore-pattern=src/targets/ --extensions js,jsx
```
  • Loading branch information
JF-Cozy committed Jun 28, 2023
1 parent cf655aa commit 85404bd
Show file tree
Hide file tree
Showing 178 changed files with 350 additions and 735 deletions.
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ yarn add cozy-ui
If you use the transpiled components (from `cozy-ui/transpiled/react`), you need to import the stylesheet (once):

```
import Button from 'cozy-ui/transpiled/react/Button'
import Button from 'cozy-ui/transpiled/react/deprecated/Button'
import 'cozy-ui/transpiled/react/stylesheet.css'
<Button />
Expand Down
2 changes: 1 addition & 1 deletion docs/components/Wrapper.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useState } from 'react'
import CozyTheme from '../../react/CozyTheme'
import Paper from '../../react/Paper'
import Button from '../../react/Button'
import Button from '../../react/deprecated/Button'
import isTesting from '../../react/helpers/isTesting'
import themes from '../../theme/themes'
import palette from '../../theme/palette.json'
Expand Down
50 changes: 25 additions & 25 deletions docs/styleguide.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,6 @@ module.exports = {
'../react/Page',
'../react/PasswordExample',
'../react/Labs/PasswordInput',
'../react/PercentageBar',
'../react/Popup',
'../react/PopupOpener',
'../react/SelectBox/SelectBox.jsx',
Expand All @@ -205,30 +204,31 @@ module.exports = {
{
name: 'Deprecated',
components: () => [
'../react/ActionMenu',
'../react/Alerter',
'../react/Button',
'../react/ButtonAction',
'../react/BottomDrawer',
'../react/Chip',
'../react/CompositeRow',
'../react/Labs/GridItem',
'../react/Infos',
'../react/InfosCarrousel',
'../react/InlineCard',
'../react/IntentModal/IntentModal.jsx',
'../react/IntentOpener/IntentOpener.jsx',
'../react/MuiCozyTheme/Menus',
'../react/Modal',
'../react/NarrowContent',
'../react/Media/Media.jsx',
'../react/Overlay',
'../react/PercentageLine',
'../react/PushClientButton',
'../react/QuotaAlert',
'../react/Radio',
'../react/MuiCozyTheme/RaisedList',
'../react/ViewStack'
'../react/deprecated/ActionMenu',
'../react/deprecated/Alerter',
'../react/deprecated/Button',
'../react/deprecated/ButtonAction',
'../react/deprecated/BottomDrawer',
'../react/deprecated/Chip',
'../react/deprecated/CompositeRow',
'../react/deprecated/GridItem',
'../react/deprecated/Infos',
'../react/deprecated/InfosCarrousel',
'../react/deprecated/InlineCard',
'../react/deprecated/IntentModal/IntentModal.jsx',
'../react/deprecated/IntentOpener/IntentOpener.jsx',
'../react/deprecated/Media/Media.jsx',
'../react/deprecated/Menus',
'../react/deprecated/Modal',
'../react/deprecated/NarrowContent',
'../react/deprecated/Overlay',
'../react/deprecated/PercentageBar',
'../react/deprecated/PercentageLine',
'../react/deprecated/QuotaAlert',
'../react/deprecated/PushClientButton',
'../react/deprecated/Radio',
'../react/deprecated/RaisedList',
'../react/deprecated/ViewStack'
]
}
],
Expand Down
4 changes: 2 additions & 2 deletions react/ActionsMenu/Actions/locales/withActionsLocales.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import withOnlyLocales from '../../../I18n/withOnlyLocales'

import en from '../../../ActionMenu/Actions/locales/en.json'
import fr from '../../../ActionMenu/Actions/locales/fr.json'
import en from '../../../deprecated/ActionMenu/Actions/locales/en.json'
import fr from '../../../deprecated/ActionMenu/Actions/locales/fr.json'

export const locales = {
en,
Expand Down
2 changes: 1 addition & 1 deletion react/ActionsMenu/ActionsMenuWrapper.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import useBreakpoints from '../hooks/useBreakpoints'
import BottomSheet from '../BottomSheet'
import isTesting from '../helpers/isTesting'
import Paper from '../Paper'
import { useActionMenuEffects } from '../ActionMenu/ActionMenuEffects'
import { useActionMenuEffects } from '../deprecated/ActionMenu/ActionMenuEffects'

const ActionsMenuWrapper = ({
children,
Expand Down
2 changes: 1 addition & 1 deletion react/Banner/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Variants from 'cozy-ui/docs/components/Variants'
import palette from 'cozy-ui/transpiled/react/palette'

import Banner from 'cozy-ui/transpiled/react/Banner'
import Button from 'cozy-ui/transpiled/react/Button'
import Button from 'cozy-ui/transpiled/react/deprecated/Button'
import Icon from 'cozy-ui/transpiled/react/Icon'
import DeviceLaptopIcon from 'cozy-ui/transpiled/react/Icons/DeviceLaptop'
import DownloadIcon from 'cozy-ui/transpiled/react/Icons/Download'
Expand Down
2 changes: 1 addition & 1 deletion react/Card/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ A card is a small block used to separate some content from the rest of the UI.

```jsx
import Card from 'cozy-ui/transpiled/react/Card';
import Button from 'cozy-ui/transpiled/react/Button';
import Button from 'cozy-ui/transpiled/react/deprecated/Button';
import Typography from "cozy-ui/transpiled/react/Typography";

<Card>
Expand Down
2 changes: 1 addition & 1 deletion react/ContactsListModal/AddContact/AddContactContent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import PropTypes from 'prop-types'

import Icon from '../../Icon'
import PeopleIcon from '../../Icons/People'
import { Media, Img, Bd } from '../../Media'
import { Media, Img, Bd } from '../../deprecated/Media'
import TextField from '../../MuiCozyTheme/TextField'
import Typography from '../../Typography'
import { withContactsListLocales } from '../withContactsListLocales'
Expand Down
8 changes: 4 additions & 4 deletions react/CozyDialogs/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ import {
import { BreakpointsProvider } from 'cozy-ui/transpiled/react/hooks/useBreakpoints'

import Button from 'cozy-ui/transpiled/react/Buttons'
import Alerter from 'cozy-ui/transpiled/react/Alerter'
import Alerter from 'cozy-ui/transpiled/react/deprecated/Alerter'
import Icon from 'cozy-ui/transpiled/react/Icon'
import Typography from 'cozy-ui/transpiled/react/Typography'
import Variants from 'cozy-ui/docs/components/Variants'
Expand Down Expand Up @@ -238,9 +238,9 @@ const setFlagshipVars = () => {
;

<BreakpointsProvider>
<Button
onClick={() => setFlagshipVars()}
variant="secondary"
<Button
onClick={() => setFlagshipVars()}
variant="secondary"
label={'Simulate Immersive Flagship Mode'} />
<Variants initialVariants={initialVariants}>
{variant => (
Expand Down
2 changes: 1 addition & 1 deletion react/CozyTheme/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ The inverted theme is not supported for several components but the work

```jsx
import CozyTheme from 'cozy-ui/transpiled/react/CozyTheme'
import Button from 'cozy-ui/transpiled/react/Button'
import Button from 'cozy-ui/transpiled/react/deprecated/Button'
import MuiButton from 'cozy-ui/transpiled/react/MuiCozyTheme/Buttons'
import TextField from 'cozy-ui/transpiled/react/MuiCozyTheme/TextField'
import BarButton from 'cozy-ui/transpiled/react/BarButton'
Expand Down
4 changes: 2 additions & 2 deletions react/DateMonthPicker/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import I18n from 'cozy-ui/transpiled/react/I18n';
import DateMonthPicker from 'cozy-ui/transpiled/react/DateMonthPicker';
import Stack from 'cozy-ui/transpiled/react/Stack';
import Button from 'cozy-ui/transpiled/react/Button';
import Button from 'cozy-ui/transpiled/react/deprecated/Button';
import Dialog, { DialogContent, DialogTitle } from 'cozy-ui/transpiled/react/Dialog';
import { useCozyDialog, DialogCloseButton } from 'cozy-ui/transpiled/react/CozyDialogs'
import { BreakpointsProvider } from 'cozy-ui/transpiled/react/hooks/useBreakpoints'
Expand Down Expand Up @@ -52,7 +52,7 @@ const Static = () => (
f={x => x}
onSelect={handleSelect}
initialValue={state.monthDate}
/>
/>
);

<BreakpointsProvider>
Expand Down
6 changes: 3 additions & 3 deletions react/Dialog/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@ import { DialogBackButton, DialogCloseButton, useCozyDialog } from 'cozy-ui/tran
import useBreakpoints, {
BreakpointsProvider
} from 'cozy-ui/transpiled/react/hooks/useBreakpoints'
import Alerter from 'cozy-ui/transpiled/react/Alerter'
import Alerter from 'cozy-ui/transpiled/react/deprecated/Alerter'

import Divider from 'cozy-ui/transpiled/react/MuiCozyTheme/Divider'
import Button from 'cozy-ui/transpiled/react/Button'
import Button from 'cozy-ui/transpiled/react/deprecated/Button'
import List from 'cozy-ui/transpiled/react/MuiCozyTheme/List'
import ListItem from 'cozy-ui/transpiled/react/MuiCozyTheme/ListItem'
import ListItemIcon from 'cozy-ui/transpiled/react/MuiCozyTheme/ListItemIcon'
import ListItemText from 'cozy-ui/transpiled/react/ListItemText'
import ListItemSecondaryAction from 'cozy-ui/transpiled/react/MuiCozyTheme/ListItemSecondaryAction'
import Icon from 'cozy-ui/transpiled/react/Icon'
import Menu from 'cozy-ui/transpiled/react/MuiCozyTheme/Menus'
import Menu from 'cozy-ui/transpiled/react/deprecated/Menus'
import MenuItem from '@material-ui/core/MenuItem'
import FileTypeFolderIcon from 'cozy-ui/transpiled/react/Icons/FileTypeFolder'
import FileTypeText from 'cozy-ui/transpiled/react/Icons/FileTypeText'
Expand Down
2 changes: 1 addition & 1 deletion react/Empty/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Empty (or error) view in a listing container

```jsx
import CozyIcon from 'cozy-ui/transpiled/react/Icons/Cozy'
import Button from 'cozy-ui/transpiled/react/Button'
import Button from 'cozy-ui/transpiled/react/deprecated/Button'
import Empty from 'cozy-ui/transpiled/react/Empty'
import Variants from 'cozy-ui/docs/components/Variants'

Expand Down
2 changes: 1 addition & 1 deletion react/Field/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ It gives access to the underlying `<input />` element, for example to give focus

```jsx
import Field from 'cozy-ui/transpiled/react/Field'
import Button from 'cozy-ui/transpiled/react/Button'
import Button from 'cozy-ui/transpiled/react/deprecated/Button'

class FieldWithFocus extends React.Component {
constructor() {
Expand Down
2 changes: 1 addition & 1 deletion react/FilePicker/FilePickerFooter.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { memo } from 'react'
import PropTypes from 'prop-types'

import Button from '../Button'
import Button from '../deprecated/Button'
import { createUseI18n } from '../I18n'

import en from './locales/en.json'
Expand Down
2 changes: 1 addition & 1 deletion react/FilePicker/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FilePicker allows you to select a file or folder in Drive

```jsx
import CozyIcon from 'cozy-ui/transpiled/react/Icons/Cozy'
import Button from 'cozy-ui/transpiled/react/Button'
import Button from 'cozy-ui/transpiled/react/deprecated/Button'
import FilePicker from 'cozy-ui/transpiled/react/FilePicker'
import Variants from 'cozy-ui/docs/components/Variants'
import DemoProvider from './docs/DemoProvider';
Expand Down
2 changes: 1 addition & 1 deletion react/Filename/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react'
import PropTypes from 'prop-types'
import cx from 'classnames'

import { Media, Bd, Img } from '../Media'
import { Media, Bd, Img } from '../deprecated/Media'
import Icon from '../Icon'
import Typography from '../Typography'
import styles from './styles.styl'
Expand Down
2 changes: 1 addition & 1 deletion react/Hero/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import Hero, {
CTA,
Icon
} from 'cozy-ui/transpiled/react/Hero';
import Button from 'cozy-ui/transpiled/react/Button';
import Button from 'cozy-ui/transpiled/react/deprecated/Button';
import { t } from '../../docs/utils';

import WarningIcon from "cozy-ui/transpiled/react/Icons/Warning";
Expand Down
2 changes: 1 addition & 1 deletion react/HistoryRow/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Circle from '../Circle'
import Icon from '../Icon'
import DownloadIcon from '../Icons/Download'
import FileIcon from '../Icons/File'
import { Media, Bd, Img } from '../Media'
import { Media, Bd, Img } from '../deprecated/Media'
import Typography from '../Typography'

import styles from './styles.styl'
Expand Down
2 changes: 1 addition & 1 deletion react/Input/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ If you need to programmatically access the underlying `<input />` for example to

```jsx
import Input from 'cozy-ui/transpiled/react/Input';
import Button from 'cozy-ui/transpiled/react/Button';
import Button from 'cozy-ui/transpiled/react/deprecated/Button';
class InputComponent extends React.Component {
constructor() {
super()
Expand Down
2 changes: 1 addition & 1 deletion react/IntentWrapper/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import PropTypes from 'prop-types'
import styles from './styles.styl'

import cx from 'classnames'
import { ModalHeader, ModalContent } from '../Modal'
import { ModalHeader, ModalContent } from '../deprecated/Modal'

export const IntentWrapper = ({
children,
Expand Down
2 changes: 1 addition & 1 deletion react/Labs/CollectionField/index.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useRef } from 'react'
import PropTypes from 'prop-types'

import Button from '../../Button'
import Button from '../../deprecated/Button'
import { FieldContainer } from '../../Field'
import Icon from '../../Icon'
import Label from '../../Label'
Expand Down
2 changes: 1 addition & 1 deletion react/LoadMore/index.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useState, useEffect, useRef, useCallback } from 'react'
import PropTypes from 'prop-types'
import Button from '../Button'
import Button from '../deprecated/Button'
import Spinner from '../Spinner'

import 'intersection-observer' // polyfill for safari (mobile and desktop)
Expand Down
2 changes: 1 addition & 1 deletion react/MuiCozyTheme/List/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import ActionsMenu from 'cozy-ui/transpiled/react/ActionsMenu'
import ActionsMenuItem from 'cozy-ui/transpiled/react/ActionsMenu/ActionsMenuItem'
import ActionsMenuWrapper from 'cozy-ui/transpiled/react/ActionsMenu/ActionsMenuWrapper'
import Icon from 'cozy-ui/transpiled/react/Icon'
import Menu from 'cozy-ui/transpiled/react/MuiCozyTheme/Menus'
import Menu from 'cozy-ui/transpiled/react/deprecated/Menus'
import MenuItem from '@material-ui/core/MenuItem'
import Divider from 'cozy-ui/transpiled/react/MuiCozyTheme/Divider'
import FileTypeFolderIcon from 'cozy-ui/transpiled/react/Icons/FileTypeFolder'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Alerter from 'cozy-ui/transpiled/react/Alerter'
import Alerter from 'cozy-ui/transpiled/react/deprecated/Alerter'

export const renameFile = async (client, file, name) => {
try {
Expand Down
2 changes: 1 addition & 1 deletion react/MuiCozyTheme/Switch/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Uses [Material UI's Switch](https://material-ui.com/components/switches/).

```jsx
import { useState, useCallback } from 'react'
import { Media, Img } from 'cozy-ui/transpiled/react/Media'
import { Media, Img } from 'cozy-ui/transpiled/react/deprecated/Media'
import Switch from 'cozy-ui/transpiled/react/MuiCozyTheme/Switch'
import Typography from "cozy-ui/transpiled/react/Typography"
import Stack from "cozy-ui/transpiled/react/Stack"
Expand Down
2 changes: 1 addition & 1 deletion react/NestedSelect/Modal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Dialog, { DialogTitle, DialogContent } from '../Dialog'
import Icon from '../Icon'
import IconButton from '../IconButton'
import LeftIcon from '../Icons/Left'
import { Media, Bd, Img } from '../Media'
import { Media, Bd, Img } from '../deprecated/Media'

import NestedSelect from './NestedSelect'
import styles from './styles.styl'
Expand Down
2 changes: 1 addition & 1 deletion react/NestedSelect/NestedSelect.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
```jsx
import { useState } from 'react'
import Button from '../Button'
import Button from '../deprecated/Button'
import Circle from '../Circle'
import NestedSelectModal from './Modal'
import ListItem from '../MuiCozyTheme/ListItem'
Expand Down
4 changes: 0 additions & 4 deletions react/Overlay/styles.styl

This file was deleted.

2 changes: 1 addition & 1 deletion react/PasswordExample/index.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import cx from 'classnames'
import InlineCard from '../InlineCard'
import InlineCard from '../deprecated/InlineCard'
import styles from './styles.styl'

const alphaRegexp = /^[a-z]$/i
Expand Down
4 changes: 0 additions & 4 deletions react/PushClientButton/styles.styl

This file was deleted.

4 changes: 0 additions & 4 deletions react/Radio/styles.styl

This file was deleted.

2 changes: 1 addition & 1 deletion react/SelectBox/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ import {
BreakpointsProvider
} from 'cozy-ui/transpiled/react/hooks/useBreakpoints'

import Button from 'cozy-ui/transpiled/react/Button'
import Button from 'cozy-ui/transpiled/react/deprecated/Button'
import Typography from 'cozy-ui/transpiled/react/Typography'

import SelectBox from 'cozy-ui/transpiled/react/SelectBox'
Expand Down
2 changes: 1 addition & 1 deletion react/SelectionBar/SelectionBarMore.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import PropTypes from 'prop-types'
import Icon from '../Icon'
import IconButton from '../IconButton'
import DotsIcon from '../Icons/Dots'
import { ActionMenuWithClose, ActionMenuItem } from '../ActionMenu'
import { ActionMenuWithClose, ActionMenuItem } from '../deprecated/ActionMenu'
import { useI18n } from '../I18n'

import styles from './styles.styl'
Expand Down
4 changes: 2 additions & 2 deletions react/UploadQueue/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import List from '../MuiCozyTheme/List'
import ListItem from '../MuiCozyTheme/ListItem'
import ListItemText from '../ListItemText'
import ListItemIcon from '../MuiCozyTheme/ListItemIcon'
import { Img } from '../Media'
import Button from '../Button'
import { Img } from '../deprecated/Media'
import Button from '../deprecated/Button'

import styles from './styles.styl'
import localeEn from './locales/en.json'
Expand Down
2 changes: 1 addition & 1 deletion react/Viewer/Footer/DownloadButton.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { useClient } from 'cozy-client'
import Icon from '../../Icon'
import DownloadIcon from '../../Icons/Download'
import Button from '../../Buttons'
import Alerter from '../../Alerter'
import Alerter from '../../deprecated/Alerter'
import { withViewerLocales } from '../hoc/withViewerLocales'

const DownloadButton = ({ file, t }) => {
Expand Down
Loading

0 comments on commit 85404bd

Please sign in to comment.