@instructure/ui-alerts 8.15.1-snapshot.0 → 8.16.0
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/CHANGELOG.md +4 -0
- package/es/Alert/index.js +14 -6
- package/es/Alert/props.js +0 -54
- package/lib/Alert/index.js +16 -6
- package/lib/Alert/props.js +0 -54
- package/package.json +17 -18
- package/src/Alert/index.tsx +27 -40
- package/src/Alert/props.ts +46 -42
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/Alert/index.d.ts +22 -19
- package/types/Alert/index.d.ts.map +1 -1
- package/types/Alert/props.d.ts +49 -4
- package/types/Alert/props.d.ts.map +1 -1
- package/LICENSE.md +0 -27
package/types/Alert/index.d.ts
CHANGED
|
@@ -1,41 +1,43 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
-
import { Component } from 'react';
|
|
2
|
+
import React, { Component } from 'react';
|
|
3
|
+
import type { ViewOwnProps } from '@instructure/ui-view';
|
|
3
4
|
import { IconCheckMarkSolid, IconInfoBorderlessSolid, IconWarningBorderlessSolid, IconNoSolid } from '@instructure/ui-icons';
|
|
4
5
|
import { jsx } from '@instructure/emotion';
|
|
5
|
-
import type { AlertProps } from './props';
|
|
6
|
+
import type { AlertProps, AlertState } from './props';
|
|
6
7
|
/**
|
|
7
8
|
---
|
|
8
9
|
category: components
|
|
9
10
|
---
|
|
11
|
+
@tsProps
|
|
10
12
|
**/
|
|
11
|
-
declare class Alert extends Component<AlertProps> {
|
|
13
|
+
declare class Alert extends Component<AlertProps, AlertState> {
|
|
12
14
|
static readonly componentId = "Alert";
|
|
13
15
|
static propTypes: import("@instructure/shared-types/types/UtilityTypes").PropValidators<keyof {
|
|
14
|
-
children?:
|
|
16
|
+
children?: React.ReactNode;
|
|
15
17
|
variant?: "info" | "success" | "warning" | "error" | undefined;
|
|
16
|
-
liveRegion?: ((
|
|
18
|
+
liveRegion?: (() => Element) | undefined;
|
|
17
19
|
liveRegionPoliteness?: "polite" | "assertive" | undefined;
|
|
18
20
|
isLiveRegionAtomic?: boolean | undefined;
|
|
19
21
|
screenReaderOnly?: boolean | undefined;
|
|
20
22
|
timeout?: number | undefined;
|
|
21
23
|
margin?: import("@instructure/emotion/types/styleUtils/ThemeablePropValues").Spacing | undefined;
|
|
22
|
-
renderCloseButtonLabel?:
|
|
23
|
-
onDismiss?: ((
|
|
24
|
+
renderCloseButtonLabel?: React.ReactNode | (() => React.ReactNode);
|
|
25
|
+
onDismiss?: (() => void) | undefined;
|
|
24
26
|
transition?: "none" | "fade" | undefined;
|
|
25
27
|
open?: boolean | undefined;
|
|
26
28
|
hasShadow: boolean;
|
|
27
29
|
}>;
|
|
28
30
|
static allowedProps: readonly (keyof {
|
|
29
|
-
children?:
|
|
31
|
+
children?: React.ReactNode;
|
|
30
32
|
variant?: "info" | "success" | "warning" | "error" | undefined;
|
|
31
|
-
liveRegion?: ((
|
|
33
|
+
liveRegion?: (() => Element) | undefined;
|
|
32
34
|
liveRegionPoliteness?: "polite" | "assertive" | undefined;
|
|
33
35
|
isLiveRegionAtomic?: boolean | undefined;
|
|
34
36
|
screenReaderOnly?: boolean | undefined;
|
|
35
37
|
timeout?: number | undefined;
|
|
36
38
|
margin?: import("@instructure/emotion/types/styleUtils/ThemeablePropValues").Spacing | undefined;
|
|
37
|
-
renderCloseButtonLabel?:
|
|
38
|
-
onDismiss?: ((
|
|
39
|
+
renderCloseButtonLabel?: React.ReactNode | (() => React.ReactNode);
|
|
40
|
+
onDismiss?: (() => void) | undefined;
|
|
39
41
|
transition?: "none" | "fade" | undefined;
|
|
40
42
|
open?: boolean | undefined;
|
|
41
43
|
hasShadow: boolean;
|
|
@@ -52,8 +54,9 @@ declare class Alert extends Component<AlertProps> {
|
|
|
52
54
|
children: null;
|
|
53
55
|
hasShadow: boolean;
|
|
54
56
|
};
|
|
55
|
-
constructor(props:
|
|
56
|
-
_timeouts:
|
|
57
|
+
constructor(props: AlertProps);
|
|
58
|
+
_timeouts: ReturnType<typeof setTimeout>[];
|
|
59
|
+
srid?: string;
|
|
57
60
|
variantUI: {
|
|
58
61
|
error: typeof IconNoSolid;
|
|
59
62
|
info: typeof IconInfoBorderlessSolid;
|
|
@@ -66,17 +69,17 @@ declare class Alert extends Component<AlertProps> {
|
|
|
66
69
|
clearTimeouts(): void;
|
|
67
70
|
onExitTransition: () => void;
|
|
68
71
|
close: () => void;
|
|
69
|
-
isDOMNode(n:
|
|
70
|
-
getLiveRegion():
|
|
71
|
-
initLiveRegion(liveRegion:
|
|
72
|
+
isDOMNode(n: Element | null): boolean | null;
|
|
73
|
+
getLiveRegion(): Element | null;
|
|
74
|
+
initLiveRegion(liveRegion: Element): void;
|
|
72
75
|
createScreenreaderContentNode(): jsx.JSX.Element;
|
|
73
76
|
createScreenreaderAlert(): void;
|
|
74
77
|
updateScreenreaderAlert(): void;
|
|
75
|
-
renderScreenreeaderAlert(div:
|
|
78
|
+
renderScreenreeaderAlert(div: HTMLDivElement): void;
|
|
76
79
|
removeScreenreaderAlert(): void;
|
|
77
|
-
handleKeyUp: (event:
|
|
80
|
+
handleKeyUp: (event: React.KeyboardEvent<ViewOwnProps>) => void;
|
|
78
81
|
componentDidMount(): void;
|
|
79
|
-
componentDidUpdate(prevProps:
|
|
82
|
+
componentDidUpdate(prevProps: AlertProps): void;
|
|
80
83
|
componentWillUnmount(): void;
|
|
81
84
|
renderIcon(): jsx.JSX.Element;
|
|
82
85
|
renderCloseButton(): jsx.JSX.Element | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Alert/index.tsx"],"names":[],"mappings":"AAuBA,eAAe;AACf,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Alert/index.tsx"],"names":[],"mappings":"AAuBA,eAAe;AACf,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,C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,CAAA;AACpB,OAAO,EAAE,KAAK,EAAE,CAAA"}
|
package/types/Alert/props.d.ts
CHANGED
|
@@ -2,18 +2,60 @@ import { ReactNode } from 'react';
|
|
|
2
2
|
import type { Spacing, WithStyleProps, ComponentStyle } from '@instructure/emotion';
|
|
3
3
|
import type { AlertTheme, PropValidators } from '@instructure/shared-types';
|
|
4
4
|
declare type AlertOwnProps = {
|
|
5
|
+
/**
|
|
6
|
+
* content to be rendered within Alert
|
|
7
|
+
*/
|
|
5
8
|
children?: ReactNode;
|
|
9
|
+
/**
|
|
10
|
+
* Determines color and icon
|
|
11
|
+
*/
|
|
6
12
|
variant?: 'info' | 'success' | 'warning' | 'error';
|
|
7
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Function that returns the DIV where screenreader alerts will be placed.
|
|
15
|
+
*/
|
|
16
|
+
liveRegion?: () => Element;
|
|
17
|
+
/**
|
|
18
|
+
* Choose the politeness level of screenreader alerts.
|
|
19
|
+
*/
|
|
8
20
|
liveRegionPoliteness?: 'polite' | 'assertive';
|
|
21
|
+
/**
|
|
22
|
+
* If the screenreader alert should be atomic
|
|
23
|
+
*/
|
|
9
24
|
isLiveRegionAtomic?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* If the alert should only be visible to screen readers
|
|
27
|
+
*/
|
|
10
28
|
screenReaderOnly?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Milliseconds until the Alert is dismissed automatically
|
|
31
|
+
*/
|
|
11
32
|
timeout?: number;
|
|
33
|
+
/**
|
|
34
|
+
* Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
|
|
35
|
+
* `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
|
|
36
|
+
* familiar CSS-like shorthand. For example: `margin="small auto large"`.
|
|
37
|
+
*/
|
|
12
38
|
margin?: Spacing;
|
|
13
|
-
|
|
14
|
-
|
|
39
|
+
/**
|
|
40
|
+
* Close button label. Can be a React component
|
|
41
|
+
*/
|
|
42
|
+
renderCloseButtonLabel?: (() => ReactNode) | ReactNode;
|
|
43
|
+
/**
|
|
44
|
+
* Callback after the alert is closed
|
|
45
|
+
*/
|
|
46
|
+
onDismiss?: () => void;
|
|
47
|
+
/**
|
|
48
|
+
* Transition used to make the alert appear and disappear
|
|
49
|
+
*/
|
|
15
50
|
transition?: 'none' | 'fade';
|
|
51
|
+
/**
|
|
52
|
+
* if open transitions from truthy to falsey, it's a signal to close and unmount the alert.
|
|
53
|
+
* This is necessary to close the alert from the outside and still run the transition.
|
|
54
|
+
*/
|
|
16
55
|
open?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* If the alert should have a shadow.
|
|
58
|
+
*/
|
|
17
59
|
hasShadow: boolean;
|
|
18
60
|
};
|
|
19
61
|
declare type PropKeys = keyof AlertOwnProps;
|
|
@@ -22,6 +64,9 @@ declare type AlertProps = AlertOwnProps & WithStyleProps<AlertTheme, AlertStyle>
|
|
|
22
64
|
declare type AlertStyle = ComponentStyle<'alert' | 'icon' | 'closeButton' | 'content'>;
|
|
23
65
|
declare const propTypes: PropValidators<PropKeys>;
|
|
24
66
|
declare const allowedProps: AllowedPropKeys;
|
|
25
|
-
|
|
67
|
+
declare type AlertState = {
|
|
68
|
+
open: boolean;
|
|
69
|
+
};
|
|
70
|
+
export type { AlertProps, AlertStyle, AlertState };
|
|
26
71
|
export { propTypes, allowedProps };
|
|
27
72
|
//# sourceMappingURL=props.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../src/Alert/props.ts"],"names":[],"mappings":"AAwBA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAKjC,OAAO,KAAK,EACV,OAAO,EACP,cAAc,EACd,cAAc,EACf,MAAM,sBAAsB,CAAA;AAC7B,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAE3E,aAAK,aAAa,GAAG;IACnB,QAAQ,CAAC,EAAE,S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AQ,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAA;AAEhD,aAAK,UAAU,GAAG,aAAa,GAAG,cAAc,CAAC,UAAU,EAAE,UAAU,CAAC,CAAA;AAExE,aAAK,UAAU,GAAG,cAAc,CAAC,OAAO,GAAG,MAAM,GAAG,aAAa,GAAG,SAAS,CAAC,CAAA;AAE9E,QAAA,MAAM,SAAS,EAAE,cAAc,CAAC,QAAQ,CAcvC,CAAA;AAED,QAAA,MAAM,YAAY,EAAE,eAcnB,CAAA;AAED,aAAK,UAAU,GAAG;IAChB,IAAI,EAAE,OAAO,CAAA;CACd,CAAA;AAED,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,CAAA;AAClD,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,CAAA"}
|
package/LICENSE.md
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: The MIT License (MIT)
|
|
3
|
-
category: Getting Started
|
|
4
|
-
order: 9
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# The MIT License (MIT)
|
|
8
|
-
|
|
9
|
-
Copyright (c) 2015 Instructure, Inc.
|
|
10
|
-
|
|
11
|
-
**Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
12
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
13
|
-
in the Software without restriction, including without limitation the rights
|
|
14
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
15
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
16
|
-
furnished to do so, subject to the following conditions.**
|
|
17
|
-
|
|
18
|
-
The above copyright notice and this permission notice shall be included in all
|
|
19
|
-
copies or substantial portions of the Software.
|
|
20
|
-
|
|
21
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
22
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
23
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
24
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
25
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
26
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
27
|
-
SOFTWARE.
|