@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/src/Alert/props.ts
CHANGED
|
@@ -35,84 +35,84 @@ import type {
|
|
|
35
35
|
import type { AlertTheme, PropValidators } from '@instructure/shared-types'
|
|
36
36
|
|
|
37
37
|
type AlertOwnProps = {
|
|
38
|
-
children?: ReactNode
|
|
39
|
-
variant?: 'info' | 'success' | 'warning' | 'error'
|
|
40
|
-
liveRegion?: (...args: any[]) => any
|
|
41
|
-
liveRegionPoliteness?: 'polite' | 'assertive'
|
|
42
|
-
isLiveRegionAtomic?: boolean
|
|
43
|
-
screenReaderOnly?: boolean
|
|
44
|
-
timeout?: number
|
|
45
|
-
margin?: Spacing
|
|
46
|
-
renderCloseButtonLabel?: ((...args: any[]) => any) | ReactNode
|
|
47
|
-
onDismiss?: (...args: any[]) => any
|
|
48
|
-
transition?: 'none' | 'fade'
|
|
49
|
-
open?: boolean
|
|
50
|
-
hasShadow: boolean
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
type PropKeys = keyof AlertOwnProps
|
|
54
|
-
|
|
55
|
-
type AllowedPropKeys = Readonly<Array<PropKeys>>
|
|
56
|
-
|
|
57
|
-
type AlertProps = AlertOwnProps & WithStyleProps<AlertTheme, AlertStyle>
|
|
58
|
-
|
|
59
|
-
type AlertStyle = ComponentStyle<'alert' | 'icon' | 'closeButton' | 'content'>
|
|
60
|
-
|
|
61
|
-
const propTypes: PropValidators<PropKeys> = {
|
|
62
38
|
/**
|
|
63
39
|
* content to be rendered within Alert
|
|
64
40
|
*/
|
|
65
|
-
children
|
|
41
|
+
children?: ReactNode
|
|
66
42
|
/**
|
|
67
43
|
* Determines color and icon
|
|
68
44
|
*/
|
|
69
|
-
variant
|
|
70
|
-
/**
|
|
71
|
-
* Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
|
|
72
|
-
* `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
|
|
73
|
-
* familiar CSS-like shorthand. For example: `margin="small auto large"`.
|
|
74
|
-
*/
|
|
75
|
-
margin: ThemeablePropTypes.spacing,
|
|
45
|
+
variant?: 'info' | 'success' | 'warning' | 'error'
|
|
76
46
|
/**
|
|
77
47
|
* Function that returns the DIV where screenreader alerts will be placed.
|
|
78
48
|
*/
|
|
79
|
-
liveRegion
|
|
49
|
+
liveRegion?: () => Element
|
|
80
50
|
/**
|
|
81
51
|
* Choose the politeness level of screenreader alerts.
|
|
82
52
|
*/
|
|
83
|
-
liveRegionPoliteness
|
|
53
|
+
liveRegionPoliteness?: 'polite' | 'assertive'
|
|
84
54
|
/**
|
|
85
55
|
* If the screenreader alert should be atomic
|
|
86
56
|
*/
|
|
87
|
-
isLiveRegionAtomic
|
|
57
|
+
isLiveRegionAtomic?: boolean
|
|
88
58
|
/**
|
|
89
59
|
* If the alert should only be visible to screen readers
|
|
90
60
|
*/
|
|
91
|
-
screenReaderOnly
|
|
61
|
+
screenReaderOnly?: boolean
|
|
92
62
|
/**
|
|
93
63
|
* Milliseconds until the Alert is dismissed automatically
|
|
94
64
|
*/
|
|
95
|
-
timeout
|
|
65
|
+
timeout?: number
|
|
66
|
+
/**
|
|
67
|
+
* Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
|
|
68
|
+
* `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
|
|
69
|
+
* familiar CSS-like shorthand. For example: `margin="small auto large"`.
|
|
70
|
+
*/
|
|
71
|
+
margin?: Spacing
|
|
96
72
|
/**
|
|
97
73
|
* Close button label. Can be a React component
|
|
98
74
|
*/
|
|
99
|
-
renderCloseButtonLabel
|
|
75
|
+
renderCloseButtonLabel?: (() => ReactNode) | ReactNode
|
|
100
76
|
/**
|
|
101
77
|
* Callback after the alert is closed
|
|
102
78
|
*/
|
|
103
|
-
onDismiss
|
|
79
|
+
onDismiss?: () => void
|
|
104
80
|
/**
|
|
105
81
|
* Transition used to make the alert appear and disappear
|
|
106
82
|
*/
|
|
107
|
-
transition
|
|
83
|
+
transition?: 'none' | 'fade'
|
|
108
84
|
/**
|
|
109
85
|
* if open transitions from truthy to falsey, it's a signal to close and unmount the alert.
|
|
110
86
|
* This is necessary to close the alert from the outside and still run the transition.
|
|
111
87
|
*/
|
|
112
|
-
open
|
|
88
|
+
open?: boolean
|
|
113
89
|
/**
|
|
114
90
|
* If the alert should have a shadow.
|
|
115
91
|
*/
|
|
92
|
+
hasShadow: boolean
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
type PropKeys = keyof AlertOwnProps
|
|
96
|
+
|
|
97
|
+
type AllowedPropKeys = Readonly<Array<PropKeys>>
|
|
98
|
+
|
|
99
|
+
type AlertProps = AlertOwnProps & WithStyleProps<AlertTheme, AlertStyle>
|
|
100
|
+
|
|
101
|
+
type AlertStyle = ComponentStyle<'alert' | 'icon' | 'closeButton' | 'content'>
|
|
102
|
+
|
|
103
|
+
const propTypes: PropValidators<PropKeys> = {
|
|
104
|
+
children: PropTypes.node,
|
|
105
|
+
variant: PropTypes.oneOf(['info', 'success', 'warning', 'error']),
|
|
106
|
+
margin: ThemeablePropTypes.spacing,
|
|
107
|
+
liveRegion: PropTypes.func,
|
|
108
|
+
liveRegionPoliteness: PropTypes.oneOf(['polite', 'assertive']),
|
|
109
|
+
isLiveRegionAtomic: PropTypes.bool,
|
|
110
|
+
screenReaderOnly: PropTypes.bool,
|
|
111
|
+
timeout: PropTypes.number,
|
|
112
|
+
renderCloseButtonLabel: PropTypes.oneOfType([PropTypes.func, PropTypes.node]),
|
|
113
|
+
onDismiss: PropTypes.func,
|
|
114
|
+
transition: PropTypes.oneOf(['none', 'fade']),
|
|
115
|
+
open: PropTypes.bool,
|
|
116
116
|
hasShadow: PropTypes.bool
|
|
117
117
|
}
|
|
118
118
|
|
|
@@ -132,5 +132,9 @@ const allowedProps: AllowedPropKeys = [
|
|
|
132
132
|
'hasShadow'
|
|
133
133
|
]
|
|
134
134
|
|
|
135
|
-
|
|
135
|
+
type AlertState = {
|
|
136
|
+
open: boolean
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export type { AlertProps, AlertStyle, AlertState }
|
|
136
140
|
export { propTypes, allowedProps }
|