fix(Button): unwind button proptype abstraction
MODIFY
packages/react/src/components/Button/Button.js
packages/react/src/components/Button/Button.js
@@ -9,7 +9,7 @@ import PropTypes from 'prop-types';
import React from 'react';
import classNames from 'classnames';
import { settings } from 'carbon-components';
-import { ButtonTypes } from '../../prop-types/types';
+import { ButtonKinds } from '../../prop-types/types';
import deprecate from '../../prop-types/deprecate';
const { prefix } = settings;
@@ -142,7 +142,7 @@ Button.propTypes = {
/**
* Specify the kind of Button you want to create
*/
- kind: ButtonTypes.buttonKind.isRequired,
+ kind: PropTypes.oneOf(ButtonKinds).isRequired,
/**
* Optionally specify an href for your Button to become an <a> element

MODIFY
packages/react/src/components/FileUploader/FileUploader.js
packages/react/src/components/FileUploader/FileUploader.js
@@ -17,7 +17,7 @@ import {
} from '@carbon/icons-react';
import Loading from '../Loading';
import uid from '../../tools/uniqueId';
-import { ButtonTypes } from '../../prop-types/types';
+import { ButtonKinds } from '../../prop-types/types';
const { prefix } = settings;
@@ -88,7 +88,7 @@ export class FileUploaderButton extends Component {
/**
* Specify the type of underlying button
*/
- buttonKind: ButtonTypes.buttonKind,
+ buttonKind: PropTypes.oneOf(ButtonKinds),
/**
* Specify the types of files that this input should be able to receive
@@ -269,7 +269,7 @@ export default class FileUploader extends Component {
/**
* Specify the type of the <FileUploaderButton>
*/
- buttonKind: ButtonTypes.buttonKind,
+ buttonKind: PropTypes.oneOf(ButtonKinds),
/**
* Specify the status of the File Upload

MODIFY
packages/react/src/components/ModalWrapper/ModalWrapper.js
packages/react/src/components/ModalWrapper/ModalWrapper.js
@@ -9,7 +9,7 @@ import PropTypes from 'prop-types';
import React from 'react';
import Modal from '../Modal';
import Button from '../Button';
-import { ButtonTypes } from '../../prop-types/types';
+import { ButtonKinds } from '../../prop-types/types';
export default class ModalWrapper extends React.Component {
static propTypes = {
@@ -34,7 +34,7 @@ export default class ModalWrapper extends React.Component {
PropTypes.object,
]),
triggerButtonIconDescription: PropTypes.string,
- triggerButtonKind: ButtonTypes.buttonKind,
+ triggerButtonKind: PropTypes.oneOf(ButtonKinds),
shouldCloseAfterSubmit: PropTypes.bool,
};

MODIFY
packages/react/src/prop-types/types.js
packages/react/src/prop-types/types.js
* LICENSE file in the root directory of this source tree.
*/
-import { oneOf } from 'prop-types';
-
-export const ButtonTypes = {
- buttonKind: oneOf([
+export const ButtonKinds = [
'primary',
'secondary',
'danger',
'ghost',
'danger--primary',
'tertiary',
- ]),
-};
+];

fix(Button): unwind button proptype abstraction (#4581)