@instructure/ui-buttons 8.13.1-snapshot.41 → 8.13.1-snapshot.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/BaseButton/index.js +64 -43
- package/es/BaseButton/props.js +2 -88
- package/es/BaseButton/theme.js +1 -1
- package/es/Button/index.js +2 -2
- package/es/Button/props.js +3 -65
- package/es/CloseButton/index.js +23 -18
- package/es/CloseButton/props.js +2 -60
- package/es/CondensedButton/index.js +2 -2
- package/es/CondensedButton/props.js +3 -48
- package/es/IconButton/index.js +2 -2
- package/es/IconButton/props.js +3 -68
- package/es/ToggleButton/index.js +4 -5
- package/es/ToggleButton/props.js +1 -58
- package/lib/BaseButton/index.js +67 -43
- package/lib/BaseButton/props.js +2 -88
- package/lib/BaseButton/theme.js +1 -1
- package/lib/Button/index.js +2 -2
- package/lib/Button/props.js +3 -65
- package/lib/CloseButton/index.js +23 -18
- package/lib/CloseButton/props.js +2 -60
- package/lib/CondensedButton/index.js +2 -2
- package/lib/CondensedButton/props.js +3 -48
- package/lib/IconButton/index.js +2 -2
- package/lib/IconButton/props.js +3 -68
- package/lib/ToggleButton/index.js +4 -5
- package/lib/ToggleButton/props.js +1 -58
- package/package.json +21 -21
- package/src/BaseButton/index.tsx +35 -27
- package/src/BaseButton/props.ts +103 -72
- package/src/BaseButton/theme.ts +1 -6
- package/src/Button/index.tsx +4 -8
- package/src/Button/props.ts +74 -48
- package/src/CloseButton/index.tsx +4 -6
- package/src/CloseButton/props.ts +67 -41
- package/src/CondensedButton/index.tsx +3 -7
- package/src/CondensedButton/props.ts +56 -34
- package/src/IconButton/index.tsx +3 -7
- package/src/IconButton/props.ts +77 -50
- package/src/ToggleButton/index.tsx +8 -15
- package/src/ToggleButton/props.ts +65 -39
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/BaseButton/index.d.ts +16 -15
- package/types/BaseButton/index.d.ts.map +1 -1
- package/types/BaseButton/props.d.ts +76 -5
- package/types/BaseButton/props.d.ts.map +1 -1
- package/types/BaseButton/theme.d.ts.map +1 -1
- package/types/Button/index.d.ts +10 -7
- package/types/Button/index.d.ts.map +1 -1
- package/types/Button/props.d.ts +57 -3
- package/types/Button/props.d.ts.map +1 -1
- package/types/CloseButton/index.d.ts +4 -3
- package/types/CloseButton/index.d.ts.map +1 -1
- package/types/CloseButton/props.d.ts +55 -5
- package/types/CloseButton/props.d.ts.map +1 -1
- package/types/CondensedButton/index.d.ts +9 -6
- package/types/CondensedButton/index.d.ts.map +1 -1
- package/types/CondensedButton/props.d.ts +44 -3
- package/types/CondensedButton/props.d.ts.map +1 -1
- package/types/IconButton/index.d.ts +11 -8
- package/types/IconButton/index.d.ts.map +1 -1
- package/types/IconButton/props.d.ts +60 -4
- package/types/IconButton/props.d.ts.map +1 -1
- package/types/ToggleButton/index.d.ts +12 -13
- package/types/ToggleButton/index.d.ts.map +1 -1
- package/types/ToggleButton/props.d.ts +52 -4
- package/types/ToggleButton/props.d.ts.map +1 -1
|
@@ -1,23 +1,64 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { Spacing, WithStyleProps } from '@instructure/emotion';
|
|
3
|
-
import type { AsElementType, BaseButtonTheme, OtherHTMLAttributes, PropValidators } from '@instructure/shared-types';
|
|
3
|
+
import type { ToProp, AsElementType, BaseButtonTheme, OtherHTMLAttributes, PropValidators } from '@instructure/shared-types';
|
|
4
4
|
import type { Cursor } from '@instructure/ui-prop-types';
|
|
5
|
+
import type { ViewProps } from '@instructure/ui-view';
|
|
5
6
|
declare type CondensedButtonOwnProps = {
|
|
7
|
+
/**
|
|
8
|
+
* Specifies the `CondensedButton` children.
|
|
9
|
+
*/
|
|
6
10
|
children?: React.ReactNode;
|
|
11
|
+
/**
|
|
12
|
+
* Specifies the type of the `CondensedButton`'s underlying html element.
|
|
13
|
+
*/
|
|
7
14
|
type?: 'button' | 'submit' | 'reset';
|
|
15
|
+
/**
|
|
16
|
+
* The size of the `CondensedButton`
|
|
17
|
+
*/
|
|
8
18
|
size?: 'small' | 'medium' | 'large';
|
|
19
|
+
/**
|
|
20
|
+
* Provides a reference to the `CondensedButton`'s underlying html element.
|
|
21
|
+
*/
|
|
9
22
|
elementRef?: (element: Element | null) => void;
|
|
23
|
+
/**
|
|
24
|
+
* The element to render as the component root, `button` by default.
|
|
25
|
+
*/
|
|
10
26
|
as?: AsElementType;
|
|
27
|
+
/**
|
|
28
|
+
* Specifies if interaction with the `CondensedButton` is enabled, disabled, or readonly.
|
|
29
|
+
*/
|
|
11
30
|
interaction?: 'enabled' | 'disabled' | 'readonly';
|
|
31
|
+
/**
|
|
32
|
+
* Specifies the color for the `CondensedButton`.
|
|
33
|
+
*/
|
|
12
34
|
color?: 'primary' | 'primary-inverse';
|
|
35
|
+
/**
|
|
36
|
+
* Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
|
|
37
|
+
* `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
|
|
38
|
+
* familiar CSS-like shorthand. For example: `margin="small auto large"`.
|
|
39
|
+
*/
|
|
13
40
|
margin?: Spacing;
|
|
41
|
+
/**
|
|
42
|
+
* Specify a mouse cursor to use when hovering over the button.
|
|
43
|
+
* The `pointer` cursor is used by default.
|
|
44
|
+
*/
|
|
14
45
|
cursor?: Cursor;
|
|
46
|
+
/**
|
|
47
|
+
* Specifies an href attribute for the `CondensedButton`'s underlying html element.
|
|
48
|
+
*/
|
|
15
49
|
href?: string;
|
|
16
|
-
|
|
50
|
+
/**
|
|
51
|
+
* An icon, or function that returns an icon.
|
|
52
|
+
*/
|
|
53
|
+
renderIcon?: React.ReactNode | (() => React.ReactNode);
|
|
54
|
+
/**
|
|
55
|
+
* Callback fired when the `CondensedButton` is clicked.
|
|
56
|
+
*/
|
|
57
|
+
onClick?: (event: React.KeyboardEvent<ViewProps> | React.MouseEvent<ViewProps>) => void;
|
|
17
58
|
};
|
|
18
59
|
declare type PropKeys = keyof CondensedButtonOwnProps;
|
|
19
60
|
declare type AllowedPropKeys = Readonly<Array<PropKeys>>;
|
|
20
|
-
declare type CondensedButtonProps = CondensedButtonOwnProps & WithStyleProps<BaseButtonTheme, null> & OtherHTMLAttributes<CondensedButtonOwnProps
|
|
61
|
+
declare type CondensedButtonProps = CondensedButtonOwnProps & WithStyleProps<BaseButtonTheme, null> & OtherHTMLAttributes<CondensedButtonOwnProps> & ToProp;
|
|
21
62
|
declare const propTypes: PropValidators<PropKeys>;
|
|
22
63
|
declare const allowedProps: AllowedPropKeys;
|
|
23
64
|
export type { CondensedButtonProps };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../src/CondensedButton/props.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACnE,OAAO,KAAK,EACV,aAAa,EACb,eAAe,EACf,mBAAmB,EACnB,cAAc,EACf,MAAM,2BAA2B,CAAA;AAClC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAA;
|
|
1
|
+
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../src/CondensedButton/props.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACnE,OAAO,KAAK,EACV,MAAM,EACN,aAAa,EACb,eAAe,EACf,mBAAmB,EACnB,cAAc,EACf,MAAM,2BAA2B,CAAA;AAClC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAA;AACxD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAErD,aAAK,uBAAuB,GAAG;IAC7B;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAE1B;;OAEG;IACH,IAAI,CAAC,EAA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EAAE,CAAA"}
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import React, { Component } from 'react';
|
|
2
|
+
import { BaseButton } from '../BaseButton';
|
|
2
3
|
import type { IconButtonProps } from './props';
|
|
3
4
|
/**
|
|
4
5
|
---
|
|
5
6
|
category: components
|
|
6
7
|
---
|
|
8
|
+
@tsProps
|
|
7
9
|
**/
|
|
8
10
|
declare class IconButton extends Component<IconButtonProps> {
|
|
9
11
|
static readonly componentId = "IconButton";
|
|
10
12
|
static propTypes: import("@instructure/shared-types/types/UtilityTypes").PropValidators<keyof {
|
|
11
|
-
children?: React.ReactNode | ((
|
|
12
|
-
renderIcon?: React.ReactNode | ((
|
|
13
|
+
children?: React.ReactNode | (() => React.ReactNode);
|
|
14
|
+
renderIcon?: React.ReactNode | (() => React.ReactNode);
|
|
13
15
|
screenReaderLabel: string;
|
|
14
16
|
type?: "button" | "submit" | "reset" | undefined;
|
|
15
17
|
size?: "small" | "medium" | "large" | undefined;
|
|
@@ -24,10 +26,11 @@ declare class IconButton extends Component<IconButtonProps> {
|
|
|
24
26
|
margin?: import("@instructure/emotion/types/styleUtils/ThemeablePropValues").Spacing | undefined;
|
|
25
27
|
cursor?: import("@instructure/ui-prop-types/types/cursor").Cursor | undefined;
|
|
26
28
|
href?: string | undefined;
|
|
29
|
+
onClick?: ((event: React.KeyboardEvent<import("@instructure/ui-view/types/View/props").ViewProps> | React.MouseEvent<import("@instructure/ui-view/types/View/props").ViewProps, MouseEvent>) => void) | undefined;
|
|
27
30
|
}>;
|
|
28
31
|
static allowedProps: readonly (keyof {
|
|
29
|
-
children?: React.ReactNode | ((
|
|
30
|
-
renderIcon?: React.ReactNode | ((
|
|
32
|
+
children?: React.ReactNode | (() => React.ReactNode);
|
|
33
|
+
renderIcon?: React.ReactNode | (() => React.ReactNode);
|
|
31
34
|
screenReaderLabel: string;
|
|
32
35
|
type?: "button" | "submit" | "reset" | undefined;
|
|
33
36
|
size?: "small" | "medium" | "large" | undefined;
|
|
@@ -42,13 +45,13 @@ declare class IconButton extends Component<IconButtonProps> {
|
|
|
42
45
|
margin?: import("@instructure/emotion/types/styleUtils/ThemeablePropValues").Spacing | undefined;
|
|
43
46
|
cursor?: import("@instructure/ui-prop-types/types/cursor").Cursor | undefined;
|
|
44
47
|
href?: string | undefined;
|
|
48
|
+
onClick?: ((event: React.KeyboardEvent<import("@instructure/ui-view/types/View/props").ViewProps> | React.MouseEvent<import("@instructure/ui-view/types/View/props").ViewProps, MouseEvent>) => void) | undefined;
|
|
45
49
|
})[];
|
|
46
50
|
static defaultProps: {
|
|
47
|
-
children: null;
|
|
48
51
|
type: string;
|
|
49
52
|
size: string;
|
|
50
|
-
elementRef: (el: any) => void;
|
|
51
53
|
as: string;
|
|
54
|
+
interaction: undefined;
|
|
52
55
|
color: string;
|
|
53
56
|
shape: string;
|
|
54
57
|
withBackground: boolean;
|
|
@@ -56,10 +59,10 @@ declare class IconButton extends Component<IconButtonProps> {
|
|
|
56
59
|
margin: string;
|
|
57
60
|
cursor: string;
|
|
58
61
|
};
|
|
59
|
-
_baseButton: null;
|
|
62
|
+
_baseButton: BaseButton | null;
|
|
60
63
|
ref: Element | null;
|
|
61
64
|
handleRef: (el: Element | null) => void;
|
|
62
|
-
get focused(): null;
|
|
65
|
+
get focused(): boolean | null;
|
|
63
66
|
focus(): void;
|
|
64
67
|
render(): JSX.Element;
|
|
65
68
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/IconButton/index.tsx"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/IconButton/index.tsx"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AASxC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAG1C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAE9C;;;;;GAKG;AAGH,cAEM,UAAW,SAAQ,SAAS,CAAC,eAAe,CAAC;IACjD,MAAM,CAAC,QAAQ,CAAC,WAAW,gBAAe;IAE1C,MAAM,CAAC,SAAS;;;;;;;;;;;;;;;;;;OAAY;IAC5B,MAAM,CAAC,YAAY;;;;;;;;;;;;;;;;;;SAAe;IAClC,MAAM,CAAC,YAAY;;;;;;;;;;;MAYlB;IAED,WAAW,EAAE,UAAU,GAAG,IAAI,CAAO;IAErC,GAAG,EAAE,OAAO,GAAG,IAAI,CAAO;IAE1B,SAAS,OAAQ,OAAO,GAAG,IAAI,UAQ9B;IAED,IAAI,OAAO,mBAEV;IAED,KAAK;IAIL,MAAM;CAiDP;AAED,eAAe,UAAU,CAAA;AACzB,OAAO,EAAE,UAAU,EAAE,CAAA"}
|
|
@@ -1,28 +1,84 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { Spacing, WithStyleProps } from '@instructure/emotion';
|
|
3
|
-
import type { AsElementType, PropValidators, BaseButtonTheme, OtherHTMLAttributes } from '@instructure/shared-types';
|
|
3
|
+
import type { ToProp, AsElementType, PropValidators, BaseButtonTheme, OtherHTMLAttributes } from '@instructure/shared-types';
|
|
4
4
|
import type { Cursor } from '@instructure/ui-prop-types';
|
|
5
|
+
import type { ViewProps } from '@instructure/ui-view';
|
|
5
6
|
declare type IconButtonOwnProps = {
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* An icon, or function returning an icon (identical to the `renderIcon` prop).
|
|
9
|
+
*/
|
|
10
|
+
children?: React.ReactNode | (() => React.ReactNode);
|
|
11
|
+
/**
|
|
12
|
+
* An icon, or function that returns an icon (identical to the `children` prop).
|
|
13
|
+
*/
|
|
14
|
+
renderIcon?: React.ReactNode | (() => React.ReactNode);
|
|
15
|
+
/**
|
|
16
|
+
* An accessible label for the `IconButton`.
|
|
17
|
+
*/
|
|
8
18
|
screenReaderLabel: string;
|
|
19
|
+
/**
|
|
20
|
+
* Specifies the type of the `IconButton`'s underlying html element.
|
|
21
|
+
*/
|
|
9
22
|
type?: 'button' | 'submit' | 'reset';
|
|
23
|
+
/**
|
|
24
|
+
* The size of the `IconButton`
|
|
25
|
+
*/
|
|
10
26
|
size?: 'small' | 'medium' | 'large';
|
|
27
|
+
/**
|
|
28
|
+
* Provides a reference to the `IconButton`'s underlying html element.
|
|
29
|
+
*/
|
|
11
30
|
elementRef?: (element: Element | null) => void;
|
|
31
|
+
/**
|
|
32
|
+
* The element to render as the component root, `button` by default.
|
|
33
|
+
*/
|
|
12
34
|
as?: AsElementType;
|
|
35
|
+
/**
|
|
36
|
+
* Specifies if interaction with the `IconButton` is enabled, disabled, or readonly.
|
|
37
|
+
*/
|
|
13
38
|
interaction?: 'enabled' | 'disabled' | 'readonly';
|
|
39
|
+
/**
|
|
40
|
+
* Specifies the color for the `IconButton`.
|
|
41
|
+
*/
|
|
14
42
|
color?: 'primary' | 'primary-inverse' | 'secondary' | 'success' | 'danger';
|
|
43
|
+
/**
|
|
44
|
+
* Override the `Button`'s default focus outline color.
|
|
45
|
+
*/
|
|
15
46
|
focusColor?: 'info' | 'inverse';
|
|
47
|
+
/**
|
|
48
|
+
* Specifies if the `IconButton` shape should be a circle or rectangle.
|
|
49
|
+
*/
|
|
16
50
|
shape?: 'rectangle' | 'circle';
|
|
51
|
+
/**
|
|
52
|
+
* Specifies if the `IconButton` should render with a solid background. When false, the background is transparent.
|
|
53
|
+
*/
|
|
17
54
|
withBackground?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Specifies if the `IconButton` should render with a border.
|
|
57
|
+
*/
|
|
18
58
|
withBorder?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
|
|
61
|
+
* `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
|
|
62
|
+
* familiar CSS-like shorthand. For example: `margin="small auto large"`.
|
|
63
|
+
*/
|
|
19
64
|
margin?: Spacing;
|
|
65
|
+
/**
|
|
66
|
+
* Specify a mouse cursor to use when hovering over the button.
|
|
67
|
+
* The `pointer` cursor is used by default.
|
|
68
|
+
*/
|
|
20
69
|
cursor?: Cursor;
|
|
70
|
+
/**
|
|
71
|
+
* Specifies an href attribute for the `IconButton`'s underlying html element.
|
|
72
|
+
*/
|
|
21
73
|
href?: string;
|
|
74
|
+
/**
|
|
75
|
+
* Callback fired when the `Button` is clicked.
|
|
76
|
+
*/
|
|
77
|
+
onClick?: (event: React.KeyboardEvent<ViewProps> | React.MouseEvent<ViewProps>) => void;
|
|
22
78
|
};
|
|
23
79
|
declare type PropKeys = keyof IconButtonOwnProps;
|
|
24
80
|
declare type AllowedPropKeys = Readonly<Array<PropKeys>>;
|
|
25
|
-
declare type IconButtonProps = IconButtonOwnProps & WithStyleProps<BaseButtonTheme, null> & OtherHTMLAttributes<IconButtonOwnProps
|
|
81
|
+
declare type IconButtonProps = IconButtonOwnProps & WithStyleProps<BaseButtonTheme, null> & OtherHTMLAttributes<IconButtonOwnProps> & ToProp;
|
|
26
82
|
declare const propTypes: PropValidators<PropKeys>;
|
|
27
83
|
declare const allowedProps: AllowedPropKeys;
|
|
28
84
|
export type { IconButtonProps };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../src/IconButton/props.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACnE,OAAO,KAAK,EACV,aAAa,EACb,cAAc,EACd,eAAe,EACf,mBAAmB,EACpB,MAAM,2BAA2B,CAAA;AAClC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAA;
|
|
1
|
+
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../src/IconButton/props.ts"],"names":[],"mapp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AO,CAAA;IAExB;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;IAEpB;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;IAEhB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IAEf;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IAEb;;OAEG;IACH,OAAO,CAAC,EAAE,CACR,KAAK,EAAE,KAAK,CAAC,aAAa,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC,KAChE,IAAI,CAAA;CACV,CAAA;AAED,aAAK,QAAQ,GAAG,MAAM,kBAAkB,CAAA;AAExC,aAAK,eAAe,GAAG,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAA;AAEhD,aAAK,eAAe,GAAG,kBAAkB,GACvC,cAAc,CAAC,eAAe,EAAE,IAAI,CAAC,GACrC,mBAAmB,CAAC,kBAAkB,CAAC,GACvC,MAAM,CAAA;AAER,QAAA,MAAM,SAAS,EAAE,cAAc,CAAC,QAAQ,CAwBvC,CAAA;AAED,QAAA,MAAM,YAAY,EAAE,eAkBnB,CAAA;AAED,YAAY,EAAE,eAAe,EAAE,CAAA;AAC/B,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,CAAA"}
|
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
import React, { Component } from 'react';
|
|
2
|
-
import type { ToggleButtonProps } from './props';
|
|
2
|
+
import type { ToggleButtonProps, ToggleButtonState } from './props';
|
|
3
3
|
/**
|
|
4
4
|
---
|
|
5
5
|
category: components
|
|
6
6
|
---
|
|
7
|
+
@tsProps
|
|
7
8
|
**/
|
|
8
|
-
declare class ToggleButton extends Component<ToggleButtonProps> {
|
|
9
|
+
declare class ToggleButton extends Component<ToggleButtonProps, ToggleButtonState> {
|
|
9
10
|
static readonly componentId = "ToggleButton";
|
|
10
11
|
static propTypes: import("@instructure/shared-types/types/UtilityTypes").PropValidators<keyof {
|
|
11
12
|
screenReaderLabel: string;
|
|
12
13
|
renderTooltipContent: React.ReactNode | ((...args: any[]) => any);
|
|
13
|
-
renderIcon: React.ReactNode | ((
|
|
14
|
+
renderIcon: React.ReactNode | (() => React.ReactNode);
|
|
14
15
|
status: "pressed" | "unpressed";
|
|
15
16
|
as?: import("@instructure/shared-types/types/CommonProps").AsElementType | undefined;
|
|
16
17
|
interaction?: "enabled" | "disabled" | "readonly" | undefined;
|
|
17
18
|
size?: "small" | "medium" | "large" | undefined;
|
|
18
19
|
elementRef?: ((element: Element | null) => void) | undefined;
|
|
19
|
-
onClick?: ((
|
|
20
|
-
color?:
|
|
20
|
+
onClick?: ((event: React.KeyboardEvent<import("@instructure/ui-view/types/View/props").ViewProps> | React.MouseEvent<import("@instructure/ui-view/types/View/props").ViewProps, MouseEvent>) => void) | undefined;
|
|
21
|
+
color?: "primary" | "primary-inverse" | "secondary" | "success" | "danger" | undefined;
|
|
21
22
|
isShowingTooltip?: boolean | undefined;
|
|
22
23
|
mountNode?: import("@instructure/ui-position").PositionMountNode | undefined;
|
|
23
24
|
placement?: import("@instructure/ui-position").PlacementPropValues | undefined;
|
|
@@ -26,14 +27,14 @@ declare class ToggleButton extends Component<ToggleButtonProps> {
|
|
|
26
27
|
static allowedProps: readonly (keyof {
|
|
27
28
|
screenReaderLabel: string;
|
|
28
29
|
renderTooltipContent: React.ReactNode | ((...args: any[]) => any);
|
|
29
|
-
renderIcon: React.ReactNode | ((
|
|
30
|
+
renderIcon: React.ReactNode | (() => React.ReactNode);
|
|
30
31
|
status: "pressed" | "unpressed";
|
|
31
32
|
as?: import("@instructure/shared-types/types/CommonProps").AsElementType | undefined;
|
|
32
33
|
interaction?: "enabled" | "disabled" | "readonly" | undefined;
|
|
33
34
|
size?: "small" | "medium" | "large" | undefined;
|
|
34
35
|
elementRef?: ((element: Element | null) => void) | undefined;
|
|
35
|
-
onClick?: ((
|
|
36
|
-
color?:
|
|
36
|
+
onClick?: ((event: React.KeyboardEvent<import("@instructure/ui-view/types/View/props").ViewProps> | React.MouseEvent<import("@instructure/ui-view/types/View/props").ViewProps, MouseEvent>) => void) | undefined;
|
|
37
|
+
color?: "primary" | "primary-inverse" | "secondary" | "success" | "danger" | undefined;
|
|
37
38
|
isShowingTooltip?: boolean | undefined;
|
|
38
39
|
mountNode?: import("@instructure/ui-position").PositionMountNode | undefined;
|
|
39
40
|
placement?: import("@instructure/ui-position").PlacementPropValues | undefined;
|
|
@@ -42,18 +43,16 @@ declare class ToggleButton extends Component<ToggleButtonProps> {
|
|
|
42
43
|
static defaultProps: {
|
|
43
44
|
size: string;
|
|
44
45
|
as: string;
|
|
45
|
-
|
|
46
|
-
renderIcon: () => void;
|
|
47
|
-
onClick: () => void;
|
|
46
|
+
interaction: undefined;
|
|
48
47
|
mountNode: null;
|
|
49
48
|
color: string;
|
|
50
49
|
placement: string;
|
|
51
50
|
constrain: string;
|
|
52
51
|
};
|
|
53
|
-
constructor(props:
|
|
52
|
+
constructor(props: ToggleButtonProps);
|
|
54
53
|
ref: Element | null;
|
|
55
54
|
handleRef: (el: Element | null) => void;
|
|
56
|
-
get isShowingTooltip():
|
|
55
|
+
get isShowingTooltip(): boolean;
|
|
57
56
|
render(): JSX.Element;
|
|
58
57
|
}
|
|
59
58
|
export { ToggleButton };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ToggleButton/index.tsx"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAUxC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ToggleButton/index.tsx"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAUxC,OAAO,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAEnE;;;;;GAKG;AAEH,cACM,YAAa,SAAQ,SAAS,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;IACxE,MAAM,CAAC,QAAQ,CAAC,WAAW,kBAAiB;IAE5C,MAAM,CAAC,SAAS;;;;;;;;;;;;;;;OAAY;IAC5B,MAAM,CAAC,YAAY;;;;;;;;;;;;;;;SAAe;IAClC,MAAM,CAAC,YAAY;;;;;;;;MASlB;gBAEW,KAAK,EAAE,iBAAiB;IAQpC,GAAG,EAAE,OAAO,GAAG,IAAI,CAAO;IAE1B,SAAS,OAAQ,OAAO,GAAG,IAAI,UAQ9B;IAED,IAAI,gBAAgB,YAInB;IAED,MAAM;CAkDP;AAED,OAAO,EAAE,YAAY,EAAE,CAAA;AACvB,eAAe,YAAY,CAAA"}
|
|
@@ -1,27 +1,75 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { AsElementType, OtherHTMLAttributes, PropValidators } from '@instructure/shared-types';
|
|
3
3
|
import type { PlacementPropValues, PositionConstraint, PositionMountNode } from '@instructure/ui-position';
|
|
4
|
+
import type { ViewProps } from '@instructure/ui-view';
|
|
4
5
|
declare type ToggleButtonOwnProps = {
|
|
6
|
+
/**
|
|
7
|
+
* Text to output only to screen readers
|
|
8
|
+
*/
|
|
5
9
|
screenReaderLabel: string;
|
|
10
|
+
/**
|
|
11
|
+
* Text to render in the tooltip shown on hover/focus
|
|
12
|
+
*/
|
|
6
13
|
renderTooltipContent: React.ReactNode | ((...args: any[]) => any);
|
|
7
|
-
|
|
14
|
+
/**
|
|
15
|
+
* An icon or function that returns an icon
|
|
16
|
+
*/
|
|
17
|
+
renderIcon: React.ReactNode | (() => React.ReactNode);
|
|
18
|
+
/**
|
|
19
|
+
* Toggles the `aria-pressed` attribute on the button (`true` if `pressed`; `false` if `unpressed`)
|
|
20
|
+
*/
|
|
8
21
|
status: 'pressed' | 'unpressed';
|
|
22
|
+
/**
|
|
23
|
+
* The element to render as the component root; `button` by default
|
|
24
|
+
*/
|
|
9
25
|
as?: AsElementType;
|
|
26
|
+
/**
|
|
27
|
+
* Specifies if interaction with `ToggleButton` is `enabled`, `disabled`, or `readonly`
|
|
28
|
+
*/
|
|
10
29
|
interaction?: 'enabled' | 'disabled' | 'readonly';
|
|
30
|
+
/**
|
|
31
|
+
* The size of the `ToggleButton`
|
|
32
|
+
*/
|
|
11
33
|
size?: 'small' | 'medium' | 'large';
|
|
34
|
+
/**
|
|
35
|
+
* Provides a reference to `ToggleButton`'s underlying HTML element
|
|
36
|
+
*/
|
|
12
37
|
elementRef?: (element: Element | null) => void;
|
|
13
|
-
|
|
14
|
-
|
|
38
|
+
/**
|
|
39
|
+
* Callback fired when the `ToggleButton` is clicked
|
|
40
|
+
*/
|
|
41
|
+
onClick?: (event: React.KeyboardEvent<ViewProps> | React.MouseEvent<ViewProps>) => void;
|
|
42
|
+
/**
|
|
43
|
+
* The color in which to display the icon
|
|
44
|
+
*/
|
|
45
|
+
color?: 'primary' | 'primary-inverse' | 'secondary' | 'success' | 'danger';
|
|
46
|
+
/**
|
|
47
|
+
* By default, the tooltip will show on hover/focus. Use this prop if you need to override that behavior.
|
|
48
|
+
*/
|
|
15
49
|
isShowingTooltip?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* An element or a function returning an element to use as the mount node
|
|
52
|
+
*/
|
|
16
53
|
mountNode?: PositionMountNode;
|
|
54
|
+
/**
|
|
55
|
+
* The placement of the tooltip in relation to the button
|
|
56
|
+
*/
|
|
17
57
|
placement?: PlacementPropValues;
|
|
58
|
+
/**
|
|
59
|
+
* The parent in which to constrain the tooltip.
|
|
60
|
+
* One of: 'window', 'scroll-parent', 'parent', 'none', an element,
|
|
61
|
+
* or a function returning an element.
|
|
62
|
+
*/
|
|
18
63
|
constrain?: PositionConstraint;
|
|
19
64
|
};
|
|
20
65
|
declare type PropKeys = keyof ToggleButtonOwnProps;
|
|
21
66
|
declare type AllowedPropKeys = Readonly<Array<PropKeys>>;
|
|
22
67
|
declare type ToggleButtonProps = ToggleButtonOwnProps & OtherHTMLAttributes<ToggleButtonOwnProps>;
|
|
68
|
+
declare type ToggleButtonState = {
|
|
69
|
+
isShowingTooltip: boolean;
|
|
70
|
+
};
|
|
23
71
|
declare const propTypes: PropValidators<PropKeys>;
|
|
24
72
|
declare const allowedProps: AllowedPropKeys;
|
|
25
|
-
export type { ToggleButtonProps };
|
|
73
|
+
export type { ToggleButtonProps, ToggleButtonState };
|
|
26
74
|
export { propTypes, allowedProps };
|
|
27
75
|
//# sourceMappingURL=props.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../src/ToggleButton/props.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,OAAO,KAAK,EACV,aAAa,EACb,mBAAmB,EACnB,cAAc,EACf,MAAM,2BAA2B,CAAA;AAClC,OAAO,KAAK,EACV,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,0BAA0B,CAAA;
|
|
1
|
+
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../src/ToggleButton/props.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,OAAO,KAAK,EACV,aAAa,EACb,mBAAmB,EACnB,cAAc,EACf,MAAM,2BAA2B,CAAA;AAClC,OAAO,KAAK,EACV,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,0BAA0B,CAAA;AACjC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAErD,aAAK,oBAAoB,GAAG;IAC1B;;OAEG;IACH,iBAAiB,EAAE,MAAM,CAAA;IAEzB;;OAEG;IACH,oBAAoB,EAAE,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC,CAAA;IAEjE;;OAEG;IACH,UAAU,EAAE,KAAK,CAAC,SAAS,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