-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1e3163b
commit 9775353
Showing
47 changed files
with
316 additions
and
311 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
.uwp-Box { | ||
.uw-Box { | ||
box-sizing: border-box; | ||
display: block; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,38 @@ | ||
import * as React from 'react'; | ||
|
||
import clsx from 'clsx'; | ||
import { ButtonBaseProps } from './ButtonBase.props'; | ||
import { buttonBasePropDefs, ButtonBaseProps } from './ButtonBase.props'; | ||
import { DATA_ATTRIBUTES } from '../../helpers/data-attributes'; | ||
import type { ElementRef } from 'react'; | ||
import { withGlobalPrefix } from '../../helpers/with-global-prefix'; | ||
import { extractProps } from '../../helpers/extract-props'; | ||
|
||
const componentName = 'ButtonBase'; | ||
const componentClassName = 'uwp-' + componentName; | ||
|
||
const classNames = { | ||
variant: { | ||
solid: 'uwp-variant-solid', | ||
outline: 'uwp-variant-outline', | ||
ghost: 'uwp-variant-ghost', | ||
}, | ||
}; | ||
const componentClassName = withGlobalPrefix(componentName); | ||
|
||
export type ButtonBaseElement = ElementRef<'button'>; | ||
|
||
export const ButtonBase = React.forwardRef<ButtonBaseElement, ButtonBaseProps>( | ||
( | ||
{ variant = 'solid', colorScheme = 'cyan', className, disabled, onClick, ...props }, | ||
forwardedRef | ||
) => { | ||
const dataAttributeProps = { | ||
[DATA_ATTRIBUTES.colorscheme]: colorScheme, | ||
}; | ||
return ( | ||
<button | ||
ref={forwardedRef} | ||
aria-disabled={disabled || undefined} | ||
className={clsx(componentClassName, classNames.variant[variant], className)} | ||
// as we're using aria-disabled instead of disabled then we need to | ||
// disable the onClick event | ||
onClick={disabled ? undefined : onClick} | ||
{...dataAttributeProps} | ||
{...props} | ||
/> | ||
); | ||
} | ||
); | ||
export const ButtonBase = React.forwardRef<ButtonBaseElement, ButtonBaseProps>((props, ref) => { | ||
const { | ||
colorScheme = 'cyan', | ||
className, | ||
disabled, | ||
onClick, | ||
...buttonBaseProps | ||
} = extractProps(props, buttonBasePropDefs); | ||
const dataAttributeProps = { [DATA_ATTRIBUTES.colorscheme]: colorScheme }; | ||
return ( | ||
<button | ||
ref={ref} | ||
aria-disabled={disabled || undefined} | ||
className={clsx(componentClassName, className)} | ||
// as we're using aria-disabled instead of disabled then we need to | ||
// disable the onClick event | ||
onClick={disabled ? undefined : onClick} | ||
{...dataAttributeProps} | ||
{...buttonBaseProps} | ||
/> | ||
); | ||
}); | ||
|
||
ButtonBase.displayName = componentName; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
.uwp-Em { | ||
.uw-Em { | ||
font-style: italic; | ||
font-family: inherit; | ||
font-size: inherit; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
.uwp-Fieldset { | ||
.uw-Fieldset { | ||
border: 0; | ||
margin: 0; | ||
padding: 0; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/react/src/components/FieldsetLegend/FieldsetLegend.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.