Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Rename ButtonGroup to SplitButtonGroup #1997

Merged
merged 5 commits into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions packages/components/src/BasicModal.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useRef, useCallback } from 'react';
import PropTypes from 'prop-types';
import ButtonGroup from './ButtonGroup';
import { SplitButtonGroup } from './SplitButtonGroup';
import Button from './Button';
import { Modal, ModalBody, ModalFooter, ModalHeader } from './modal';

Expand Down Expand Up @@ -126,7 +126,7 @@ function BasicModal(props: BasicModalProps): JSX.Element {
{cancelButtonText}
</Button>
)}
<ButtonGroup>
<SplitButtonGroup>
<Button
kind={isConfirmDanger ? 'danger' : 'primary'}
onClick={onConfirmClicked}
Expand All @@ -138,7 +138,7 @@ function BasicModal(props: BasicModalProps): JSX.Element {
{confirmButtonText}
</Button>
{children}
</ButtonGroup>
</SplitButtonGroup>
</ModalFooter>
</Modal>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ import React from 'react';
import classNames from 'classnames';
import PropTypes from 'prop-types';

interface ButtonGroupProps {
interface SplitButtonGroupProps {
children?: React.ReactNode;
className?: string;
style?: React.CSSProperties;
'data-testid'?: string;
}

function ButtonGroup(props: ButtonGroupProps): JSX.Element {
export function SplitButtonGroup(props: SplitButtonGroupProps): JSX.Element {
const { children, className, style, 'data-testid': dataTestId } = props;

return (
Expand All @@ -24,19 +24,19 @@ function ButtonGroup(props: ButtonGroupProps): JSX.Element {
);
}

ButtonGroup.displayName = 'ButtonGroup';
SplitButtonGroup.displayName = 'SplitButtonGroup';

ButtonGroup.propTypes = {
SplitButtonGroup.propTypes = {
children: PropTypes.node.isRequired,
className: PropTypes.string,
style: PropTypes.object,
'data-testid': PropTypes.string,
};

ButtonGroup.defaultProps = {
SplitButtonGroup.defaultProps = {
className: null,
style: {},
'data-testid': undefined,
};

export default ButtonGroup;
export default SplitButtonGroup;
2 changes: 1 addition & 1 deletion packages/components/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ export { default as AutoCompleteInput } from './AutoCompleteInput';
export { default as AutoResizeTextarea } from './AutoResizeTextarea';
export { default as BasicModal } from './BasicModal';
export { default as Button } from './Button';
export { default as ButtonGroup } from './ButtonGroup';
export { default as ButtonOld } from './ButtonOld';
export * from './BulkActionBar';
export { default as CardFlip } from './CardFlip';
Expand Down Expand Up @@ -50,6 +49,7 @@ export * from './SelectValueList';
export * from './shortcuts';
export { default as SocketedButton } from './SocketedButton';
export * from './spectrum';
export * from './SplitButtonGroup';
export * from './TableViewEmptyState';
export * from './TextWithTooltip';
export * from './theme';
Expand Down
3 changes: 3 additions & 0 deletions packages/components/src/spectrum/buttons.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
export {
ActionButton,
type SpectrumActionButtonProps as ActionButtonProps,
// Button - we want to use our own `Button` component instead of Spectrum's
// ButtonGroup - will re-export once our `Button` is compatible
// FileTrigger - we aren't planning to support this component
LogicButton,
type SpectrumLogicButtonProps as LogicButtonProps,
ToggleButton,
Expand Down
2 changes: 2 additions & 0 deletions packages/components/src/spectrum/collections.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
export {
ActionBar,
type SpectrumActionBarProps as ActionBarProps,
// ListBox - we aren't planning to support this component
MenuTrigger,
type SpectrumMenuTriggerProps as MenuTriggerProps,
// TableView - we aren't planning to support this component
TagGroup,
type SpectrumTagGroupProps as TagGroupProps,
} from '@adobe/react-spectrum';
3 changes: 3 additions & 0 deletions packages/components/src/spectrum/forms.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
export {
// Checkbox - we want to use our own `Checkbox` component instead of Spectrum's
CheckboxGroup,
type SpectrumCheckboxGroupProps as CheckboxGroupProps,
Form,
type SpectrumFormProps as FormProps,
NumberField,
type SpectrumNumberFieldProps as NumberFieldProps,
// Radio - re-export once we re-export RadioGroup
// RadioGroup - we need to replace references to our DH `RadioGroup` before we can re-export
RangeSlider,
type SpectrumRangeSliderProps as RangeSliderProps,
Slider,
Expand Down
Loading