@instructure/ui-alerts 8.15.0 → 8.15.1-snapshot.5

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.
@@ -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?: import("react").ReactNode;
16
+ children?: React.ReactNode;
15
17
  variant?: "info" | "success" | "warning" | "error" | undefined;
16
- liveRegion?: ((...args: any[]) => any) | undefined;
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?: import("react").ReactNode | ((...args: any[]) => any);
23
- onDismiss?: ((...args: any[]) => any) | undefined;
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?: import("react").ReactNode;
31
+ children?: React.ReactNode;
30
32
  variant?: "info" | "success" | "warning" | "error" | undefined;
31
- liveRegion?: ((...args: any[]) => any) | undefined;
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?: import("react").ReactNode | ((...args: any[]) => any);
38
- onDismiss?: ((...args: any[]) => any) | undefined;
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: any);
56
- _timeouts: never[];
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: any): any;
70
- getLiveRegion(): any;
71
- initLiveRegion(liveRegion: any): void;
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: any): void;
78
+ renderScreenreeaderAlert(div: HTMLDivElement): void;
76
79
  removeScreenreaderAlert(): void;
77
- handleKeyUp: (event: any) => void;
80
+ handleKeyUp: (event: React.KeyboardEvent<ViewOwnProps>) => void;
78
81
  componentDidMount(): void;
79
- componentDidUpdate(prevProps: any): void;
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;AAQjC,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACvB,0BAA0B,EAC1B,WAAW,EACZ,MAAM,uBAAuB,CAAA;AAK9B,OAAO,EAAa,GAAG,EAA0B,MAAM,sBAAsB,CAAA;AAM7E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAEzC;;;;GAIG;AACH,cACM,KAAM,SAAQ,SAAS,CAAC,UAAU,CAAC;IACvC,MAAM,CAAC,QAAQ,CAAC,WAAW,WAAU;IAErC,MAAM,CAAC,SAAS;;;;;;;;;;;;;;OAAY;IAC5B,MAAM,CAAC,YAAY;;;;;;;;;;;;;;SAAe;IAClC,MAAM,CAAC,YAAY;;;;;;;;;;;MAWlB;gBAGW,KAAK,KAAA;IAQjB,SAAS,UAAK;IAEd,SAAS;;;;;MAKR;IAED,GAAG,EAAE,OAAO,GAAG,IAAI,CAAO;IAE1B,SAAS,OAAQ,OAAO,GAAG,IAAI,UAE9B;IAED,aAAa,aAUZ;IAED,aAAa;IAKb,gBAAgB,aAIf;IAED,KAAK,aAQJ;IAID,SAAS,CAAC,CAAC,KAAA;IAIX,aAAa;IAUb,cAAc,CAAC,UAAU,KAAA;IAazB,6BAA6B;IAI7B,uBAAuB;IAevB,uBAAuB;IAcvB,wBAAwB,CAAC,GAAG,KAAA;IAW5B,uBAAuB;IAwBvB,WAAW,uBAOV;IAED,iBAAiB;IAajB,kBAAkB,CAAC,SAAS,KAAA;IAc5B,oBAAoB;IAKpB,UAAU;IAUV,iBAAiB;IAgBjB,WAAW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,cAAc;IAW5C,uBAAuB;IAqBvB,WAAW,UAAW,mBAAmB,CAAC,YAAY,CAAC,UAOtD;IAED,iBAAiB;IAWjB,kBAAkB,CAAC,SAAS,EAAE,UAAU;IAaxC,oBAAoB;IAKpB,UAAU;IASV,iBAAiB;IAgBjB,WAAW;IAgBX,MAAM;CA0BP;AAED,eAAe,KAAK,CAAA;AACpB,OAAO,EAAE,KAAK,EAAE,CAAA"}
@@ -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
- liveRegion?: (...args: any[]) => any;
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
- renderCloseButtonLabel?: ((...args: any[]) => any) | ReactNode;
14
- onDismiss?: (...args: any[]) => any;
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
- export type { AlertProps, AlertStyle };
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,SAAS,CAAA;IACpB,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAA;IAClD,UAAU,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAA;IACpC,oBAAoB,CAAC,EAAE,QAAQ,GAAG,WAAW,CAAA;IAC7C,kBAAkB,CAAC,EAAE,OAAO,CAA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