Skip to content
This repository has been archived by the owner on Mar 31, 2021. It is now read-only.

Commit

Permalink
Add isFilled prop to Set; Make SelectMenu more form friendly
Browse files Browse the repository at this point in the history
  • Loading branch information
jxom committed Feb 14, 2019
1 parent 914754d commit 027708e
Show file tree
Hide file tree
Showing 15 changed files with 211 additions and 77 deletions.
6 changes: 4 additions & 2 deletions src/Checkbox/Checkbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export type LocalCheckboxProps = {
/** State of the checkbox. Can be any color in the palette. */
state?: string;
/** Initial value of the checkbox */
value?: string;
value?: boolean | string;
/** Function to invoke when focus is lost */
onBlur?: React.FocusEventHandler<HTMLInputElement>;
/** Function to invoke when checkbox has changed */
Expand Down Expand Up @@ -73,6 +73,7 @@ export const Checkbox: React.FunctionComponent<LocalCheckboxProps> = ({
name={name}
state={state}
type="checkbox"
// @ts-ignore
value={value}
/>
<CheckboxIcon state={state} />
Expand All @@ -96,7 +97,7 @@ export const checkboxPropTypes = {
label: PropTypes.string,
name: PropTypes.string,
state: PropTypes.string,
value: PropTypes.string,
value: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
onBlur: PropTypes.func,
onChange: PropTypes.func,
onFocus: PropTypes.func
Expand All @@ -122,5 +123,6 @@ export const checkboxDefaultProps = {
};
Checkbox.defaultProps = checkboxDefaultProps;

// @ts-ignore
const C: React.FunctionComponent<CheckboxProps> = Checkbox;
export default C;
9 changes: 3 additions & 6 deletions src/FieldSet/__tests__/__snapshots__/FieldSet.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,13 @@ exports[`renders correctly for a basic field 1`] = `
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-flex-wrap: wrap;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
-webkit-flex-direction: column;
-ms-flex-direction: column;
flex-direction: column;
-webkit-align-items: flex-start;
-webkit-box-align: flex-start;
-ms-flex-align: flex-start;
align-items: flex-start;
-webkit-flex-direction: column;
-ms-flex-direction: column;
flex-direction: column;
}
.c1 > *:not(:last-child) {
Expand Down
18 changes: 6 additions & 12 deletions src/LayoutSet/__tests__/__snapshots__/LayoutSet.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,13 @@ exports[`renders correctly for a basic field 1`] = `
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-flex-wrap: wrap;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
-webkit-flex-direction: column;
-ms-flex-direction: column;
flex-direction: column;
-webkit-align-items: flex-start;
-webkit-box-align: flex-start;
-ms-flex-align: flex-start;
align-items: flex-start;
-webkit-flex-direction: column;
-ms-flex-direction: column;
flex-direction: column;
}
.c1 > *:not(:last-child) {
Expand All @@ -44,16 +41,13 @@ exports[`renders correctly for a basic field 1`] = `
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-flex-wrap: wrap;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
-webkit-flex-direction: column;
-ms-flex-direction: column;
flex-direction: column;
-webkit-align-items: flex-start;
-webkit-box-align: flex-start;
-ms-flex-align: flex-start;
align-items: flex-start;
-webkit-flex-direction: column;
-ms-flex-direction: column;
flex-direction: column;
}
.c8 > *:not(:last-child) {
Expand Down
1 change: 1 addition & 0 deletions src/Menu/MenuButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export class MenuButton extends React.Component<LocalMenuButtonProps> {
onKeyDown={this.handleKeyDown}
{...context}
{...props}
type="button"
/>
);
};
Expand Down
2 changes: 1 addition & 1 deletion src/Menu/MenuItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export class MenuItem extends React.Component<LocalMenuItemProps> {
render = () => {
const { children, icon, isDisabled, ...props } = this.props;
return (
<_MenuItem role="menuitem" disabled={isDisabled} {...props} onClick={this.handleClick}>
<_MenuItem role="menuitem" disabled={isDisabled} {...props} onClick={this.handleClick} type="button">
{icon && (
// @ts-ignore
<MenuIcon a11yHidden icon={icon} />
Expand Down
22 changes: 22 additions & 0 deletions src/Menu/__tests__/__snapshots__/Menu.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,14 @@ a.c3:hover {
<button
class="c3 c4"
role="menuitem"
type="button"
>
Edit...
</button>
<button
class="c3 c4"
role="menuitem"
type="button"
>
Share...
</button>
Expand Down Expand Up @@ -287,6 +289,7 @@ a.c5:hover {
<button
class="c4 c5 c6"
role="menuitem"
type="button"
>
<svg
aria-hidden="true"
Expand All @@ -307,6 +310,7 @@ a.c5:hover {
<button
class="c4 c5 c6"
role="menuitem"
type="button"
>
<svg
aria-hidden="true"
Expand Down Expand Up @@ -335,6 +339,7 @@ a.c5:hover {
<button
class="c4 c5 c6"
role="menuitem"
type="button"
>
Go to google
</button>
Expand Down Expand Up @@ -707,25 +712,29 @@ a.c15:hover {
<button
class="c14 c15 c16"
role="menuitem"
type="button"
>
Edit...
</button>
<button
class="c14 c15 c16"
role="menuitem"
type="button"
>
Share...
</button>
<button
class="c14 c15 c16"
role="menuitem"
type="button"
>
Rename...
</button>
<button
class="c14 c15 c17"
color="danger"
role="menuitem"
type="button"
>
Delete...
</button>
Expand All @@ -746,6 +755,7 @@ a.c15:hover {
class="c14 c15 c16 c21 "
href="https://google.com"
role="menuitem"
type="button"
>
Go to Google
</a>
Expand Down Expand Up @@ -883,6 +893,7 @@ a.c3:hover {
class="c3 c4"
disabled=""
role="menuitem"
type="button"
>
<svg
aria-hidden="true"
Expand All @@ -903,6 +914,7 @@ a.c3:hover {
<button
class="c3 c4"
role="menuitem"
type="button"
>
<svg
aria-hidden="true"
Expand Down Expand Up @@ -1070,6 +1082,7 @@ a.c3:hover {
<button
class="c3 c4"
role="menuitem"
type="button"
>
<svg
aria-hidden="true"
Expand All @@ -1090,6 +1103,7 @@ a.c3:hover {
<button
class="c3 c4"
role="menuitem"
type="button"
>
<svg
aria-hidden="true"
Expand Down Expand Up @@ -1118,6 +1132,7 @@ a.c3:hover {
<button
class="c3 c4"
role="menuitem"
type="button"
>
Go to google
</button>
Expand Down Expand Up @@ -1299,6 +1314,7 @@ a.c3:hover {
<button
class="c3 c4"
role="menuitem"
type="button"
>
<svg
aria-hidden="true"
Expand All @@ -1319,6 +1335,7 @@ a.c3:hover {
<button
class="c8 c4"
role="menuitem"
type="button"
>
<svg
aria-hidden="true"
Expand Down Expand Up @@ -1463,6 +1480,7 @@ a.c3:hover {
<button
class="c3 c4"
role="menuitem"
type="button"
>
<svg
aria-hidden="true"
Expand All @@ -1483,6 +1501,7 @@ a.c3:hover {
<button
class="c3 c4"
role="menuitem"
type="button"
>
<svg
aria-hidden="true"
Expand Down Expand Up @@ -1631,6 +1650,7 @@ a.c3:hover {
<button
class="c3 c4"
role="menuitem"
type="button"
>
<svg
aria-hidden="true"
Expand All @@ -1651,6 +1671,7 @@ a.c3:hover {
<button
class="c3 c4"
role="menuitem"
type="button"
>
<svg
aria-hidden="true"
Expand All @@ -1675,6 +1696,7 @@ a.c3:hover {
<button
class="c3 c4"
role="menuitem"
type="button"
>
Go to google
</button>
Expand Down
Loading

0 comments on commit 027708e

Please sign in to comment.