Skip to content

Commit

Permalink
Merge branch 'main' into noPreselectedOption
Browse files Browse the repository at this point in the history
  • Loading branch information
renka authored Sep 21, 2023
2 parents ef3e559 + 58ba1d6 commit 8801d26
Show file tree
Hide file tree
Showing 21 changed files with 3,103 additions and 913 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ebay/ui-core-react",
"version": "5.0.0",
"version": "5.2.0",
"description": "Skin components build off React",
"publishConfig": {
"registry": "https://registry.npmjs.org"
Expand Down
5 changes: 4 additions & 1 deletion src/common/floating-label-utils/hooks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ type FloatingLabelHookProps = {
className?: string;
placeholder?: string;
invalid?: boolean;
opaqueLabel?: boolean;
onMount?: () => void;
}

Expand Down Expand Up @@ -76,6 +77,7 @@ export function useFloatingLabel({
inputValue,
placeholder,
invalid,
opaqueLabel,
onMount = () => {}
} : FloatingLabelHookProps): FloatingLabelHookReturn {
const _internalInputRef = useRef(null)
Expand Down Expand Up @@ -123,7 +125,8 @@ export function useFloatingLabel({
})

const floatingLabelClassName = classNames(`floating-label`, {
'floating-label--large': inputSize === `large`
'floating-label--large': inputSize === `large`,
'floating-label--opaque': opaqueLabel
})

const FragmentContainer = useCallback(({ children }) => <>{children}</>, [])
Expand Down
16 changes: 8 additions & 8 deletions src/ebay-carousel/__tests__/__snapshots__/index.spec.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ exports[`Storyshots ebay-carousel Continuous 1`] = `
>
<svg
aria-hidden="true"
class="icon icon--carousel-prev icon icon--chevron-left-24"
class="icon icon--carousel-prev icon icon--chevron-left-12"
focusable="false"
xmlns="http://www.w3.org/2000/svg"
>
<use
xlink:href="#icon-chevron-left-24"
xlink:href="#icon-chevron-left-12"
/>
</svg>
</button>
Expand Down Expand Up @@ -110,12 +110,12 @@ exports[`Storyshots ebay-carousel Continuous 1`] = `
>
<svg
aria-hidden="true"
class="icon icon--carousel-next icon icon--chevron-right-24"
class="icon icon--carousel-next icon icon--chevron-right-12"
focusable="false"
xmlns="http://www.w3.org/2000/svg"
>
<use
xlink:href="#icon-chevron-right-24"
xlink:href="#icon-chevron-right-12"
/>
</svg>
</button>
Expand All @@ -139,12 +139,12 @@ exports[`Storyshots ebay-carousel Items Per Slide 1`] = `
>
<svg
aria-hidden="true"
class="icon icon--carousel-prev icon icon--chevron-left-24"
class="icon icon--carousel-prev icon icon--chevron-left-12"
focusable="false"
xmlns="http://www.w3.org/2000/svg"
>
<use
xlink:href="#icon-chevron-left-24"
xlink:href="#icon-chevron-left-12"
/>
</svg>
</button>
Expand Down Expand Up @@ -234,12 +234,12 @@ exports[`Storyshots ebay-carousel Items Per Slide 1`] = `
>
<svg
aria-hidden="true"
class="icon icon--carousel-next icon icon--chevron-right-24"
class="icon icon--carousel-next icon icon--chevron-right-12"
focusable="false"
xmlns="http://www.w3.org/2000/svg"
>
<use
xlink:href="#icon-chevron-right-24"
xlink:href="#icon-chevron-right-12"
/>
</svg>
</button>
Expand Down
4 changes: 2 additions & 2 deletions src/ebay-carousel/carousel-control-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ type CarouselControlProps = {
}

const icon: Record<CarouselControlType, Icon> = {
prev: 'chevronLeft24',
next: 'chevronRight24'
prev: 'chevronLeft12',
next: 'chevronRight12'
}

const typeToDirection: Record<CarouselControlType, MovementDirection> = {
Expand Down
4 changes: 2 additions & 2 deletions src/ebay-dialog-base/components/dialog-close-button.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React, { FC, ReactNode } from 'react'

type EbayDialogFooterProps = {
type EbayDialogCloseButtonProps = {
children?: ReactNode;
}

const EbayDialogCloseButton: FC = ({ children }: EbayDialogFooterProps) => <>{children}</>
const EbayDialogCloseButton: FC = ({ children }: EbayDialogCloseButtonProps) => <>{children}</>

export default EbayDialogCloseButton
23 changes: 23 additions & 0 deletions src/ebay-dialog-base/components/dialog-previous-button.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import React, { FC, KeyboardEventHandler, MouseEventHandler } from 'react'
import classNames from 'classnames'
import { EbayIconButton } from '../../ebay-icon-button'
import { Icon } from '../../ebay-icon'

type EbayDialogPreviousButtonProps = {
icon?: Icon;
className?: string
onClick?: MouseEventHandler & KeyboardEventHandler
}

const EbayDialogPreviousButton: FC<EbayDialogPreviousButtonProps> = ({
className,
icon,
...rest
}: EbayDialogPreviousButtonProps) => (
<EbayIconButton
{...rest}
icon={icon || 'chevronLeft16'}
className={classNames(className, 'lightbox-dialog__prev')} />
)

export default EbayDialogPreviousButton
3 changes: 3 additions & 0 deletions src/ebay-dialog-base/components/dialogBase.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export interface DialogBaseProps<T> extends HTMLProps<T> {
mainId?: string;
ignoreEscape?: boolean;
closeButton?: ReactElement;
previousButton?: ReactElement;
focus?: RefObject<HTMLAnchorElement & HTMLButtonElement>;
animated?: boolean;
transitionElement?: TransitionElement;
Expand Down Expand Up @@ -74,6 +75,7 @@ export const DialogBase: FC<DialogBaseProps<HTMLElement>> = ({
onBackgroundClick = () => {},
ignoreEscape,
closeButton,
previousButton,
isModal,
role = 'dialog',
focus,
Expand Down Expand Up @@ -198,6 +200,7 @@ export const DialogBase: FC<DialogBaseProps<HTMLElement>> = ({
{top}
{dialogHeader && (
<div className={`${classPrefix}__header`}>
{previousButton}
{buttonPosition === 'right' && dialogHeader}
{buttonPosition !== 'bottom' && closeButtonContent}
{(buttonPosition === 'left' || buttonPosition === 'hidden') && dialogHeader}
Expand Down
18 changes: 16 additions & 2 deletions src/ebay-dialog-base/dialog-base-with-state.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import React, { Children, ReactElement } from 'react'
import { RemoveScroll } from 'react-remove-scroll'
import { DialogBase, DialogBaseProps } from './components/dialogBase'
import { EbayDialogCloseButton, EbayDialogFooter, EbayDialogHeader, EbayDialogActions } from './index'
import {
EbayDialogCloseButton,
EbayDialogFooter,
EbayDialogHeader,
EbayDialogActions,
EbayDialogPreviousButton
} from './index'

export const DialogBaseWithState = ({
isModal,
Expand All @@ -17,8 +23,15 @@ export const DialogBaseWithState = ({
const footer = childrenArray.find((child: ReactElement) => child.type === EbayDialogFooter)
const actions = childrenArray.find((child: ReactElement) => child.type === EbayDialogActions)
const closeButton = childrenArray.find((child: ReactElement) => child.type === EbayDialogCloseButton)
const previousButton = childrenArray.find((child: ReactElement) => child.type === EbayDialogPreviousButton)
const content = childrenArray.filter((child: ReactElement) =>
![EbayDialogHeader, EbayDialogFooter, EbayDialogCloseButton, EbayDialogActions].some(c => c === child.type))
![
EbayDialogHeader,
EbayDialogFooter,
EbayDialogCloseButton,
EbayDialogActions,
EbayDialogPreviousButton
].some(c => c === child.type))

const dialogBase = (
<DialogBase
Expand All @@ -29,6 +42,7 @@ export const DialogBaseWithState = ({
footer={footer}
actions={actions}
closeButton={closeButton}
previousButton={previousButton}
animated={animated}
>
{content}
Expand Down
1 change: 1 addition & 0 deletions src/ebay-dialog-base/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ export { default as EbayDialogCloseButton } from './components/dialog-close-butt
export { WindowType, DialogBaseProps } from './components/dialogBase'
export { default as DialogBaseWithState } from './dialog-base-with-state'
export { default as EbayDialogActions } from './components/dialog-actions'
export { default as EbayDialogPreviousButton } from './components/dialog-previous-button'
Loading

0 comments on commit 8801d26

Please sign in to comment.