Skip to content

Commit

Permalink
chore: remove spectrum naming (#126)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeldking committed May 16, 2023
1 parent 7549c01 commit af65a0a
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 11 deletions.
36 changes: 34 additions & 2 deletions src/breadcrumbs/Breadcrumbs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,49 @@ import { FolderOutline } from '../icon/Icons';
import { Menu } from '../menu/Menu';
import { MenuTrigger } from '../menu/MenuTrigger';
import React, { Key, ReactElement, useCallback, useRef } from 'react';
import { SpectrumBreadcrumbsProps } from '@react-types/breadcrumbs';
import { useBreadcrumbs } from '@react-aria/breadcrumbs';
import { useLayoutEffect, useValueEffect } from '@react-aria/utils';
import { useProviderProps } from '../provider';
import { useResizeObserver } from '@react-aria/utils';
import { css } from '@emotion/react';
import theme from '../theme';
import { AriaLabelingProps, DOMProps, ItemProps, StyleProps } from '../types';

const MIN_VISIBLE_ITEMS = 1;
const MAX_VISIBLE_ITEMS = 4;

export interface BreadcrumbsProps {}
export interface AriaBreadcrumbsProps
extends BreadcrumbsProps,
DOMProps,
AriaLabelingProps {}

export interface ArizeBreadcrumbsProps<T>
extends AriaBreadcrumbsProps,
StyleProps {
/** The breadcrumb items. */
children: ReactElement<ItemProps<T>> | ReactElement<ItemProps<T>>[];
/** Whether the Breadcrumbs are disabled. */
isDisabled?: boolean;
/** Called when an item is acted upon (usually selection via press). */
onAction?: (key: Key) => void;
/**
* Size of the Breadcrumbs including spacing and layout.
* @default 'L'
*/
size?: 'S' | 'M' | 'L';
/** Whether to always show the root item if the items are collapsed. */
showRoot?: boolean;
/**
* Whether to place the last Breadcrumb item onto a new line.
*/
isMultiline?: boolean;
/**
* Whether to autoFocus the last Breadcrumb item when the Breadcrumbs render.
*/
autoFocusCurrent?: boolean;
}

const ulCSS = css`
flex-wrap: nowrap;
flex: 1 0;
Expand Down Expand Up @@ -55,7 +87,7 @@ const liCSS = css`
}
`;

function Breadcrumbs<T>(props: SpectrumBreadcrumbsProps<T>, ref: DOMRef) {
function Breadcrumbs<T>(props: ArizeBreadcrumbsProps<T>, ref: DOMRef) {
props = useProviderProps(props);
let {
size = 'L',
Expand Down
1 change: 0 additions & 1 deletion src/field/HelpText.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// import AlertMedium from '@spectrum-icons/ui/AlertMedium';
import { classNames, useDOMRef } from '../utils';
import { DOMRef, HelpTextProps, Validation } from '../types';
import React, { HTMLAttributes } from 'react';
Expand Down
2 changes: 1 addition & 1 deletion src/layout/Flex.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ function flexWrapValue(value: boolean | 'wrap' | 'nowrap') {
}

/**
* A layout container using flexbox. Provides Spectrum dimension values, and supports the gap
* A layout container using flexbox. Provides AC dimension values, and supports the gap
* property to define consistent spacing between items.
*/
const _Flex = forwardRef(Flex);
Expand Down
3 changes: 0 additions & 3 deletions src/switch/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ import { css } from '@emotion/react';
import theme from '../theme';

export const switchCSS = css`
--ac-switch-label-color-default: var(
--spectrum-neutral-content-color-default
);
--ac-switch-label-color-disabled: ${theme.textColors.white50};
--ac-switch-background-color: ${theme.colors.gray300};
Expand Down
5 changes: 3 additions & 2 deletions src/types/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ export interface AriaMenuProps<T>
extends MenuProps<T>,
DOMProps,
AriaLabelingProps {}
export interface SpectrumMenuProps<T> extends AriaMenuProps<T>, StyleProps {}

export interface ArizeMenuProps<T> extends AriaMenuProps<T>, StyleProps {}

export interface ActionMenuProps<T>
extends CollectionBase<T>,
Expand All @@ -88,7 +89,7 @@ export interface ActionMenuProps<T>
shouldFlip?: boolean;
/** Whether the button is disabled. */
isDisabled?: boolean;
/** Whether the button should be displayed with a [quiet style](https://spectrum.adobe.com/page/action-button/#Quiet). */
/** Whether the button should be displayed with a quiet style. */
isQuiet?: boolean;
/** Whether the element should receive focus on render. */
autoFocus?: boolean;
Expand Down
4 changes: 2 additions & 2 deletions src/utils/styleProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ export function useStyleProps<T extends StyleProps>(
if (otherProps.className) {
console.warn(
'The className prop is unsafe and is unsupported in Arize Components. ' +
'Please use style props with Spectrum variables, or UNSAFE_className if you absolutely must do something custom. ' +
'Please use style props with AC variables, or UNSAFE_className if you absolutely must do something custom. ' +
'Note that this may break in future versions due to DOM structure changes.'
);
}
Expand All @@ -310,7 +310,7 @@ export function useStyleProps<T extends StyleProps>(
if (otherProps.style) {
console.warn(
'The style prop is unsafe and is unsupported in React Arize Components. ' +
'Please use style props with Spectrum variables, or UNSAFE_style if you absolutely must do something custom. ' +
'Please use style props with AC variables, or UNSAFE_style if you absolutely must do something custom. ' +
'Note that this may break in future versions due to DOM structure changes.'
);
}
Expand Down

0 comments on commit af65a0a

Please sign in to comment.