Skip to content

Commit 516337f

Browse files
authored
button type (#63)
* support button type * simplify * v0.4.15
1 parent f7777e4 commit 516337f

File tree

4 files changed

+20
-7
lines changed

4 files changed

+20
-7
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "0.4.14",
2+
"version": "0.4.15",
33
"license": "MIT",
44
"main": "dist/index.js",
55
"typings": "dist/index.d.ts",

src/button/types.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
import { ReactNode } from 'react';
2+
import { AriaLabelingProps, FocusableDOMProps } from '../types';
23

3-
export interface BaseButtonProps {
4+
interface AriaBaseButtonProps extends FocusableDOMProps, AriaLabelingProps {
45
/**
5-
* A custom id for ally, analytics
6+
* The behavior of the button when used in an HTML form.
67
*/
7-
id?: string;
8+
type?: 'button' | 'submit' | 'reset';
9+
}
10+
export interface BaseButtonProps extends AriaBaseButtonProps {
811
/** Whether the button is disabled. */
912
isDisabled?: boolean;
1013
/** The content to display in the button. */

stories/Button.stories.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ export const Gallery = () => {
4242
>
4343
<li>
4444
<ButtonToolbar>
45-
<Button variant="primary">Create Dashboard</Button>
45+
<Button id="primary-test-button" variant="primary">
46+
Create Dashboard
47+
</Button>
4648
<Button variant="primary" icon={plusIcon}>
4749
Create Dashboard
4850
</Button>

stories/Form.stories.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
import React from 'react';
22
import { Meta, Story } from '@storybook/react';
3-
import { Form, FormProps, TextField, Picker, Item, Field } from '../src';
3+
import {
4+
Form,
5+
FormProps,
6+
TextField,
7+
Picker,
8+
Item,
9+
Field,
10+
Button,
11+
} from '../src';
412
import { useForm, Controller } from 'react-hook-form';
513

614
const meta: Meta = {
@@ -89,7 +97,7 @@ const Template: Story<FormProps> = args => {
8997
)}
9098
/>
9199
</Field>
92-
<input type="submit" />
100+
<Button variant="primary" type="submit" />
93101
</Form>
94102
);
95103
};

0 commit comments

Comments
 (0)