Skip to content

Commit

Permalink
Button: Adding various tests and updating component to include compon…
Browse files Browse the repository at this point in the history
…entRef (#13718)

* Updates.

* useMergedRefs update to be immutable.

* adding comment.

* Change files

* more updates.

* updates

* better.

* Fixing unneeded style prop in button.

* undo

* Change files

* update.

* cleanup.

* Removing oufr dependency from button, updating api

* Update change/@fluentui-react-button-2020-06-19-15-32-16-fix-button-fixes.json

Co-authored-by: Makoto Morimoto <Humberto.Morimoto@microsoft.com>

* Update packages/react-button/src/components/Button/Button.types.tsx

Co-authored-by: Makoto Morimoto <Humberto.Morimoto@microsoft.com>

* updates.

* This is wrong - styles should not be injected without being necessary.

* undo!

* no message

Co-authored-by: Makoto Morimoto <Humberto.Morimoto@microsoft.com>
  • Loading branch information
dzearing and khmakoto authored Jun 30, 2020
1 parent 0992ce1 commit 4746eb1
Show file tree
Hide file tree
Showing 11 changed files with 339 additions and 188 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"type": "minor",
"comment": "Button: Adding componentRef, focus method, styling, and tests.",
"packageName": "@fluentui/react-button",
"email": "dzearing@microsoft.com",
"dependentChangeType": "patch",
"date": "2020-06-19T22:32:16.380Z"
}
286 changes: 147 additions & 139 deletions packages/react-button/etc/react-button.api.md
Original file line number Diff line number Diff line change
@@ -1,139 +1,147 @@
## API Report File for "@fluentui/react-button"

> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
```ts

import { BaseSlots } from '@fluentui/react-compose';
import { ColorPlateSet } from '@fluentui/react-theme-provider';
import { ComposeOptions } from '@fluentui/react-compose';
import { ComposePreparedOptions } from '@fluentui/react-compose';
import * as React from 'react';
import { SlotProps } from '@fluentui/react-compose';

// @public (undocumented)
export const Button: import("@fluentui/react-compose").ComponentWithAs<"button", ButtonProps>;

// @public (undocumented)
export const ButtonBase: import("@fluentui/react-compose").ComponentWithAs<"button", ButtonProps>;

// Warning: (ae-forgotten-export) The symbol "ComposeStandardStatics" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export interface ButtonOptions extends ComposeOptions<ButtonProps, ButtonSlots, ButtonSlotProps, ComposeStandardStatics> {
}

// Warning: (ae-forgotten-export) The symbol "ComponentProps" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export interface ButtonProps extends ComponentProps, React.HTMLAttributes<HTMLButtonElement> {
circular?: boolean;
content?: ShorthandValue<{}>;
disabled?: boolean;
fluid?: boolean;
// Warning: (ae-forgotten-export) The symbol "ShorthandValue" needs to be exported by the entry point index.d.ts
icon?: ShorthandValue<{}>;
iconOnly?: boolean;
iconPosition?: 'before' | 'after';
inverted?: boolean;
loader?: ShorthandValue<{}>;
loading?: boolean;
primary?: boolean;
secondary?: boolean;
size?: SizeValue;
// Warning: (ae-forgotten-export) The symbol "RecursivePartial" needs to be exported by the entry point index.d.ts
tokens?: RecursivePartial<ButtonTokens>;
}

// @public (undocumented)
export type ButtonSlotProps = SlotProps<ButtonSlots, ButtonProps, React.ButtonHTMLAttributes<HTMLButtonElement>>;

// @public (undocumented)
export interface ButtonSlots extends BaseSlots {
// (undocumented)
content: React.ElementType;
// (undocumented)
icon: React.ElementType;
// (undocumented)
loader: React.ElementType;
}

// @public (undocumented)
export interface ButtonState extends ButtonProps {
}

// @public (undocumented)
export type ButtonTokens = ColorPlateSet & {
padding: string;
margin: string;
height: string;
minWidth: string;
maxWidth: string;
contentGap: string;
iconSize: string;
borderRadius: string;
borderWidth: string;
boxShadow: string;
width: string;
size: {
smallest: string;
smaller: string;
small: string;
regular: string;
large: string;
larger: string;
largest: string;
};
transform: string;
transition: string;
fontFamily: string;
fontSize: string;
fontWeight: string;
pressed: {
transform: string;
};
};

// @public (undocumented)
export type SizeValue = 'smallest' | 'smaller' | 'small' | 'medium' | 'large' | 'larger' | 'largest';

// @public (undocumented)
export const ToggleButton: import("@fluentui/react-compose").ComponentWithAs<"button", ToggleButtonProps>;

// @public (undocumented)
export const ToggleButtonBase: import("@fluentui/react-compose").ComponentWithAs<"button", ToggleButtonProps & ButtonProps>;

// @public (undocumented)
export interface ToggleButtonOptions extends ComposeOptions<ToggleButtonProps, ToggleButtonSlots, ToggleButtonSlotProps, ComposeStandardStatics> {
}

// @public (undocumented)
export interface ToggleButtonProps extends ButtonProps {
checked?: boolean;
defaultChecked?: boolean;
}

// @public (undocumented)
export type ToggleButtonSlotProps = SlotProps<ToggleButtonSlots, ToggleButtonProps, React.ButtonHTMLAttributes<HTMLButtonElement>>;

// @public (undocumented)
export interface ToggleButtonSlots extends ButtonSlots {
}

// @public (undocumented)
export interface ToggleButtonState extends ToggleButtonProps {
}

// @public
export const useButton: (props: ButtonProps, ref: import("react").Ref<HTMLElement>, options: ComposePreparedOptions<{}, any, {}>) => ButtonState;

// Warning: (ae-forgotten-export) The symbol "ToggleProps" needs to be exported by the entry point index.d.ts
// Warning: (ae-forgotten-export) The symbol "ToggleState" needs to be exported by the entry point index.d.ts
//
// @public
export const useToggle: <TProps, TState extends TProps = TProps>(props: TProps & ToggleProps) => TState & ToggleState;


// (No @packageDocumentation comment for this package)

```
## API Report File for "@fluentui/react-button"

> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
```ts

import { BaseSlots } from '@fluentui/react-compose';
import { ColorPlateSet } from '@fluentui/react-theme-provider';
import { ComposeOptions } from '@fluentui/react-compose';
import { ComposePreparedOptions } from '@fluentui/react-compose';
import * as React from 'react';
import { SlotProps } from '@fluentui/react-compose';

// @public (undocumented)
export const Button: import("@fluentui/react-compose").ComponentWithAs<"button", ButtonProps>;

// @public (undocumented)
export const ButtonBase: import("@fluentui/react-compose").ComponentWithAs<"button", ButtonProps>;

// Warning: (ae-forgotten-export) The symbol "ComposeStandardStatics" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export interface ButtonOptions extends ComposeOptions<ButtonProps, ButtonSlots, ButtonSlotProps, ComposeStandardStatics> {
}

// Warning: (ae-forgotten-export) The symbol "ComponentProps" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export interface ButtonProps extends ComponentProps, React.HTMLAttributes<HTMLButtonElement> {
circular?: boolean;
componentRef?: React.RefObject<ButtonRef>;
content?: ShorthandValue<{}>;
disabled?: boolean;
fluid?: boolean;
// Warning: (ae-forgotten-export) The symbol "ShorthandValue" needs to be exported by the entry point index.d.ts
icon?: ShorthandValue<{}>;
iconOnly?: boolean;
iconPosition?: 'before' | 'after';
inverted?: boolean;
loader?: ShorthandValue<{}>;
loading?: boolean;
primary?: boolean;
secondary?: boolean;
size?: SizeValue;
// Warning: (ae-forgotten-export) The symbol "RecursivePartial" needs to be exported by the entry point index.d.ts
tokens?: RecursivePartial<ButtonTokens>;
}

// @public (undocumented)
export interface ButtonRef {
focus: () => void;
}

// @public (undocumented)
export type ButtonSlotProps = SlotProps<ButtonSlots, ButtonProps, React.ButtonHTMLAttributes<HTMLButtonElement>>;

// @public (undocumented)
export interface ButtonSlots extends BaseSlots {
// (undocumented)
content: React.ElementType;
// (undocumented)
icon: React.ElementType;
// (undocumented)
loader: React.ElementType;
}

// @public (undocumented)
export interface ButtonState extends ButtonProps {
// (undocumented)
buttonRef?: React.RefObject<HTMLButtonElement>;
}

// @public (undocumented)
export type ButtonTokens = ColorPlateSet & {
padding: string;
margin: string;
height: string;
minWidth: string;
maxWidth: string;
contentGap: string;
iconSize: string;
borderRadius: string;
borderWidth: string;
boxShadow: string;
width: string;
size: {
smallest: string;
smaller: string;
small: string;
regular: string;
large: string;
larger: string;
largest: string;
};
transform: string;
transition: string;
fontFamily: string;
fontSize: string;
fontWeight: string;
pressed: {
transform: string;
};
};

// @public (undocumented)
export type SizeValue = 'smallest' | 'smaller' | 'small' | 'medium' | 'large' | 'larger' | 'largest';

// @public (undocumented)
export const ToggleButton: import("@fluentui/react-compose").ComponentWithAs<"button", ToggleButtonProps>;

// @public (undocumented)
export const ToggleButtonBase: import("@fluentui/react-compose").ComponentWithAs<"button", ToggleButtonProps & ButtonProps>;

// @public (undocumented)
export interface ToggleButtonOptions extends ComposeOptions<ToggleButtonProps, ToggleButtonSlots, ToggleButtonSlotProps, ComposeStandardStatics> {
}

// @public (undocumented)
export interface ToggleButtonProps extends ButtonProps {
checked?: boolean;
defaultChecked?: boolean;
}

// @public (undocumented)
export type ToggleButtonSlotProps = SlotProps<ToggleButtonSlots, ToggleButtonProps, React.ButtonHTMLAttributes<HTMLButtonElement>>;

// @public (undocumented)
export interface ToggleButtonSlots extends ButtonSlots {
}

// @public (undocumented)
export interface ToggleButtonState extends ToggleButtonProps {
}

// @public
export const useButton: (props: ButtonProps, ref: import("react").Ref<HTMLElement>, options: ComposePreparedOptions<{}, any, {}>) => ButtonState;

// Warning: (ae-forgotten-export) The symbol "ToggleProps" needs to be exported by the entry point index.d.ts
// Warning: (ae-forgotten-export) The symbol "ToggleState" needs to be exported by the entry point index.d.ts
//
// @public
export const useToggle: <TProps, TState extends TProps = TProps>(props: TProps & ToggleProps) => TState & ToggleState;


// (No @packageDocumentation comment for this package)

```
2 changes: 1 addition & 1 deletion packages/react-button/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"@uifabric/tslint-rules": "^7.2.2",
"enzyme": "~3.10.0",
"enzyme-adapter-react-16": "^1.15.0",
"office-ui-fabric-react": "^7.121.5",
"react": "16.8.6",
"react-app-polyfill": "~1.0.1",
"react-dom": "16.8.6",
Expand All @@ -51,7 +52,6 @@
"@uifabric/react-hooks": "^7.4.10",
"@uifabric/set-version": "^7.0.15",
"@uifabric/utilities": "^7.21.4",
"office-ui-fabric-react": "^7.121.5",
"tslib": "^1.10.0"
},
"peerDependencies": {
Expand Down
11 changes: 10 additions & 1 deletion packages/react-button/src/components/Button/Button.stories.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@
flex-direction: column;
align-items: flex-start;
> *:not(:first-child) {
margin-top: var(--gap, 8px);
margin-top: var(--gap, 20px);
}
}

.text {
font-family: 'Segoe UI', 'Segoe UI Web (West European)', 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto,
'Helvetica Neue', sans-serif;
font-size: 20px;
font-weight: 600;
margin: 0;
padding: 0;
}
Loading

0 comments on commit 4746eb1

Please sign in to comment.