@@ -12945,14 +12945,16 @@ return /******/ (function(modules) { // webpackBootstrap
12945
12945
dismissible: _react2["default"].PropTypes.bool,
12946
12946
duration: _react2["default"].PropTypes.number,
12947
12947
icon: _react2["default"].PropTypes.string,
12948
+ isOpen: _react2["default"].PropTypes.bool,
12948
12949
onDismiss: _react2["default"].PropTypes.func,
12949
12950
texture: _react2["default"].PropTypes.bool,
12950
12951
theme: _react2["default"].PropTypes.oneOf(["success", "warning", "error", "offline"]),
12951
12952
variant: _react2["default"].PropTypes.oneOf(["alert", "toast"])
12952
12953
};
12953
12954
12954
12955
var defaultProps = {
12955
- dismissible: true
12956
+ dismissible: true,
12957
+ isOpen: false
12956
12958
};
12957
12959
12958
12960
var SLDSNotification = (function (_React$Component) {
@@ -12962,21 +12964,41 @@ return /******/ (function(modules) { // webpackBootstrap
12962
12964
_classCallCheck(this, SLDSNotification);
12963
12965
12964
12966
_get(Object.getPrototypeOf(SLDSNotification.prototype), "constructor", this).call(this, props);
12965
- this.state = { isOpen: true };
12967
+ this.state = {
12968
+ interval: null,
12969
+ revealForScreenreader: false
12970
+ };
12966
12971
}
12967
12972
12968
12973
_createClass(SLDSNotification, [{
12969
12974
key: "componentDidMount",
12970
12975
value: function componentDidMount() {
12976
+ if (this.props.duration) {
12977
+ var that = this;
12978
+ setTimeout(function () {
12979
+ this.onDismiss();
12980
+ }, that.props.duration);
12981
+ }
12982
+ }
12983
+ }, {
12984
+ key: "componentWillUnmount",
12985
+ value: function componentWillUnmount() {
12986
+ this.setState({
12987
+ interval: null
12988
+ });
12989
+ }
12990
+ }, {
12991
+ key: "componentWillReceiveProps",
12992
+ value: function componentWillReceiveProps(nextProps) {
12971
12993
var _this = this;
12972
12994
12973
- if (this.props.duration ) {
12974
- (function ( ) {
12975
- var that = _this;
12976
- setTimeout(function () {
12977
- that.setState({ isOpen: false });
12978
- }, that.props.duration);
12979
- })( );
12995
+ if (this.props.isOpen !== nextProps.isOpen ) {
12996
+ if (nextProps.isOpen && !this.state.interval ) {
12997
+ this.setState({ interval: setTimeout(function () {
12998
+ _this.setState({ revealForScreenreader: true });
12999
+ }, 500) });
13000
+ }
13001
+ console.log('revealForScreen', this.state.revealForScreenreader );
12980
13002
}
12981
13003
}
12982
13004
}, {
@@ -13017,7 +13039,10 @@ return /******/ (function(modules) { // webpackBootstrap
13017
13039
key: "onDismiss",
13018
13040
value: function onDismiss() {
13019
13041
if (this.props.onDismiss) this.props.onDismiss();
13020
- this.setState({ isOpen: false });
13042
+ this.setState({
13043
+ revealForScreenreader: false,
13044
+ interval: null
13045
+ });
13021
13046
}
13022
13047
}, {
13023
13048
key: "renderAlertContent",
@@ -13038,13 +13063,22 @@ return /******/ (function(modules) { // webpackBootstrap
13038
13063
value: function getClassName() {
13039
13064
var _classNames;
13040
13065
13041
- return classNames(this.props.className, "slds-notify", (_classNames = {}, _defineProperty(_classNames, "slds-notify--" + this.props.variant, this.props.variant), _defineProperty(_classNames, "slds-theme--" + this.props.theme, this.props.theme), _defineProperty(_classNames, "slds-theme--alert-texture-animated", this.props.texture), _classNames));
13066
+ return classNames(this.props.className, "slds-notify", (_classNames = {}, _defineProperty(_classNames, "slds-transition-hide", !this.state.revealForScreenreader), _defineProperty(_classNames, "slds-notify--" + this.props.variant, this.props.variant), _defineProperty(_classNames, "slds-theme--" + this.props.theme, this.props.theme), _defineProperty(_classNames, "slds-theme--alert-texture-animated", this.props.texture), _classNames));
13067
+ }
13068
+ }, {
13069
+ key: "renderContent",
13070
+ value: function renderContent() {
13071
+ if (this.state.revealForScreenreader) {
13072
+ return _react2["default"].createElement("div", null, _react2["default"].createElement("p", { ref: "test", className: "slds-assistive-text" }, this.props.theme), this.renderClose(), this.renderAlertContent(), this.renderToastContent());
13073
+ } else {
13074
+ return _react2["default"].createElement("div", { className: "slds-hidden" }, "Notification loading");
13075
+ }
13042
13076
}
13043
13077
}, {
13044
13078
key: "render",
13045
13079
value: function render() {
13046
- if (this.state .isOpen) {
13047
- return _react2["default"].createElement("div", { className: "slds-notify-container" }, _react2["default"].createElement("div", { className: this.getClassName(), role: "alert" }, _react2["default"].createElement("span", { className: "slds-assistive-text" }, this.props.theme), this.renderClose(), this.renderAlertContent(), this.renderToastContent ()));
13080
+ if (this.props .isOpen) {
13081
+ return _react2["default"].createElement("div", { className: "slds-notify-container" }, _react2["default"].createElement("div", { ref: "alertContent", className: this.getClassName(), role: "alert" }, this.renderContent ()));
13048
13082
} else {
13049
13083
return null;
13050
13084
}
0 commit comments