terra-disclosure-manager
Advanced tools
Comparing version 4.11.0 to 4.12.0
@@ -7,2 +7,10 @@ ChangeLog | ||
4.12.0 - (June 12, 2019) | ||
------------------s | ||
### Removed | ||
* Removed node_modules from .npmignore | ||
### Changed | ||
* Update tests for terra-toolkit v5 and terra-dev-site v5 changes | ||
4.11.0 - (May 13, 2019) | ||
@@ -9,0 +17,0 @@ ------------------ |
@@ -1,42 +0,42 @@ | ||
'use strict'; | ||
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.disclosureManagerShape = exports.withDisclosureManager = exports.availableDisclosureWidths = exports.availableDisclosureHeights = exports.availableDisclosureSizes = undefined; | ||
Object.defineProperty(exports, "withDisclosureManager", { | ||
enumerable: true, | ||
get: function get() { | ||
return _withDisclosureManager.default; | ||
} | ||
}); | ||
exports.disclosureManagerShape = exports.default = exports.availableDisclosureWidths = exports.availableDisclosureHeights = exports.availableDisclosureSizes = void 0; | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")); | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")); | ||
var _react = require('react'); | ||
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")); | ||
var _react2 = _interopRequireDefault(_react); | ||
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized")); | ||
var _propTypes = require('prop-types'); | ||
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass")); | ||
var _propTypes2 = _interopRequireDefault(_propTypes); | ||
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits")); | ||
var _DisclosureManagerDelegate = require('./DisclosureManagerDelegate'); | ||
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); | ||
var _DisclosureManagerDelegate2 = _interopRequireDefault(_DisclosureManagerDelegate); | ||
var _extends3 = _interopRequireDefault(require("@babel/runtime/helpers/extends")); | ||
var _DisclosureManagerContext = require('./DisclosureManagerContext'); | ||
var _react = _interopRequireDefault(require("react")); | ||
var _DisclosureManagerContext2 = _interopRequireDefault(_DisclosureManagerContext); | ||
var _propTypes = _interopRequireDefault(require("prop-types")); | ||
var _withDisclosureManager = require('./withDisclosureManager'); | ||
var _DisclosureManagerDelegate = _interopRequireDefault(require("./DisclosureManagerDelegate")); | ||
var _withDisclosureManager2 = _interopRequireDefault(_withDisclosureManager); | ||
var _DisclosureManagerContext = _interopRequireDefault(require("./DisclosureManagerContext")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var _withDisclosureManager = _interopRequireDefault(require("./withDisclosureManager")); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
var availableDisclosureSizes = { | ||
@@ -50,10 +50,16 @@ TINY: 'tiny', | ||
}; | ||
exports.availableDisclosureSizes = availableDisclosureSizes; | ||
var arrayReducer = function arrayReducer(mappingObject, value) { | ||
return _extends(_defineProperty({}, '' + value, value), mappingObject); | ||
return (0, _extends3.default)((0, _defineProperty2.default)({}, "".concat(value), value), mappingObject); | ||
}; | ||
var availableDisclosureHeights = [240, 420, 600, 690, 780, 870, 960, 1140].reduce(arrayReducer, {}); | ||
exports.availableDisclosureHeights = availableDisclosureHeights; | ||
var availableDisclosureWidths = [320, 480, 560, 640, 800, 960, 1120, 1280, 1440, 1600, 1760, 1920].reduce(arrayReducer, {}); | ||
var defaultDimensions = { height: availableDisclosureHeights['690'], width: availableDisclosureWidths['1120'] }; | ||
exports.availableDisclosureWidths = availableDisclosureWidths; | ||
var defaultDimensions = { | ||
height: availableDisclosureHeights['690'], | ||
width: availableDisclosureWidths['1120'] | ||
}; | ||
var defaultSize = availableDisclosureSizes.SMALL; | ||
@@ -69,7 +75,2 @@ | ||
exports.availableDisclosureSizes = availableDisclosureSizes; | ||
exports.availableDisclosureHeights = availableDisclosureHeights; | ||
exports.availableDisclosureWidths = availableDisclosureWidths; | ||
var propTypes = { | ||
@@ -79,7 +80,9 @@ /** | ||
*/ | ||
children: _propTypes2.default.node, | ||
children: _propTypes.default.node, | ||
/** | ||
* A function used to provide rendering capabilities to the DisclosureManager. | ||
*/ | ||
render: _propTypes2.default.func.isRequired, | ||
render: _propTypes.default.func.isRequired, | ||
/** | ||
@@ -89,3 +92,4 @@ * An array of disclosure types that the DisclosureManager should support. If an unsupported disclosure request occurs, the DisclosureManager will | ||
*/ | ||
supportedDisclosureTypes: _propTypes2.default.array, | ||
supportedDisclosureTypes: _propTypes.default.array, | ||
/** | ||
@@ -95,3 +99,4 @@ * A boolean indicating whether or not the DisclosureManager should handle all nested disclosure requests. When enabled, the DisclosureManager will handle all | ||
*/ | ||
trapNestedDisclosureRequests: _propTypes2.default.bool, | ||
trapNestedDisclosureRequests: _propTypes.default.bool, | ||
/** | ||
@@ -101,5 +106,4 @@ * A DisclosureManagerDelegate instance provided by a parent DisclosureManager. This prop is automatically provided by `withDisclosureManager` and should not | ||
*/ | ||
disclosureManager: _DisclosureManagerDelegate2.default.propType | ||
disclosureManager: _DisclosureManagerDelegate.default.propType | ||
}; | ||
var defaultProps = { | ||
@@ -109,8 +113,9 @@ supportedDisclosureTypes: [] | ||
var DisclosureManager = function (_React$Component) { | ||
_inherits(DisclosureManager, _React$Component); | ||
var DisclosureManager = | ||
/*#__PURE__*/ | ||
function (_React$Component) { | ||
(0, _inherits2.default)(DisclosureManager, _React$Component); | ||
(0, _createClass2.default)(DisclosureManager, null, [{ | ||
key: "cloneDisclosureState", | ||
_createClass(DisclosureManager, null, [{ | ||
key: 'cloneDisclosureState', | ||
/** | ||
@@ -120,7 +125,6 @@ * Clones the current disclosure component state objects and returns the structure for further mutation. | ||
value: function cloneDisclosureState(state) { | ||
var newState = _extends({}, state); | ||
newState.disclosureComponentKeys = _extends([], newState.disclosureComponentKeys); | ||
newState.disclosureComponentData = _extends({}, newState.disclosureComponentData); | ||
newState.disclosureComponentDelegates = _extends([], newState.disclosureComponentDelegates); | ||
var newState = (0, _extends3.default)({}, state); | ||
newState.disclosureComponentKeys = (0, _extends3.default)([], newState.disclosureComponentKeys); | ||
newState.disclosureComponentData = (0, _extends3.default)({}, newState.disclosureComponentData); | ||
newState.disclosureComponentDelegates = (0, _extends3.default)([], newState.disclosureComponentDelegates); | ||
return newState; | ||
@@ -131,29 +135,24 @@ } | ||
function DisclosureManager(props) { | ||
_classCallCheck(this, DisclosureManager); | ||
var _this; | ||
var _this = _possibleConstructorReturn(this, (DisclosureManager.__proto__ || Object.getPrototypeOf(DisclosureManager)).call(this, props)); | ||
(0, _classCallCheck2.default)(this, DisclosureManager); | ||
_this = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(DisclosureManager).call(this, props)); | ||
_this.generateChildComponentDelegate = _this.generateChildComponentDelegate.bind((0, _assertThisInitialized2.default)(_this)); | ||
_this.generateDisclosureComponentDelegate = _this.generateDisclosureComponentDelegate.bind((0, _assertThisInitialized2.default)(_this)); | ||
_this.resolveDismissPromise = _this.resolveDismissPromise.bind((0, _assertThisInitialized2.default)(_this)); | ||
_this.resolveDismissChecksInSequence = _this.resolveDismissChecksInSequence.bind((0, _assertThisInitialized2.default)(_this)); | ||
_this.disclosureTypeIsSupported = _this.disclosureTypeIsSupported.bind((0, _assertThisInitialized2.default)(_this)); | ||
_this.safelyCloseDisclosure = _this.safelyCloseDisclosure.bind((0, _assertThisInitialized2.default)(_this)); | ||
_this.generatePopFunction = _this.generatePopFunction.bind((0, _assertThisInitialized2.default)(_this)); | ||
_this.openDisclosure = _this.openDisclosure.bind((0, _assertThisInitialized2.default)(_this)); | ||
_this.pushDisclosure = _this.pushDisclosure.bind((0, _assertThisInitialized2.default)(_this)); | ||
_this.popDisclosure = _this.popDisclosure.bind((0, _assertThisInitialized2.default)(_this)); | ||
_this.closeDisclosure = _this.closeDisclosure.bind((0, _assertThisInitialized2.default)(_this)); | ||
_this.requestDisclosureFocus = _this.requestDisclosureFocus.bind((0, _assertThisInitialized2.default)(_this)); | ||
_this.releaseDisclosureFocus = _this.releaseDisclosureFocus.bind((0, _assertThisInitialized2.default)(_this)); | ||
_this.maximizeDisclosure = _this.maximizeDisclosure.bind((0, _assertThisInitialized2.default)(_this)); | ||
_this.minimizeDisclosure = _this.minimizeDisclosure.bind((0, _assertThisInitialized2.default)(_this)); // These cached functions are stored outside of state to prevent unnecessary rerenders. | ||
_this.generateChildComponentDelegate = _this.generateChildComponentDelegate.bind(_this); | ||
_this.generateDisclosureComponentDelegate = _this.generateDisclosureComponentDelegate.bind(_this); | ||
_this.resolveDismissPromise = _this.resolveDismissPromise.bind(_this); | ||
_this.resolveDismissChecksInSequence = _this.resolveDismissChecksInSequence.bind(_this); | ||
_this.disclosureTypeIsSupported = _this.disclosureTypeIsSupported.bind(_this); | ||
_this.safelyCloseDisclosure = _this.safelyCloseDisclosure.bind(_this); | ||
_this.generatePopFunction = _this.generatePopFunction.bind(_this); | ||
_this.openDisclosure = _this.openDisclosure.bind(_this); | ||
_this.pushDisclosure = _this.pushDisclosure.bind(_this); | ||
_this.popDisclosure = _this.popDisclosure.bind(_this); | ||
_this.closeDisclosure = _this.closeDisclosure.bind(_this); | ||
_this.requestDisclosureFocus = _this.requestDisclosureFocus.bind(_this); | ||
_this.releaseDisclosureFocus = _this.releaseDisclosureFocus.bind(_this); | ||
_this.maximizeDisclosure = _this.maximizeDisclosure.bind(_this); | ||
_this.minimizeDisclosure = _this.minimizeDisclosure.bind(_this); | ||
// These cached functions are stored outside of state to prevent unnecessary rerenders. | ||
_this.dismissChecks = {}; | ||
_this.onDismissResolvers = {}; | ||
_this.state = { | ||
@@ -173,8 +172,8 @@ childComponentDelegate: _this.generateChildComponentDelegate(), | ||
_createClass(DisclosureManager, [{ | ||
key: 'generateChildComponentDelegate', | ||
(0, _createClass2.default)(DisclosureManager, [{ | ||
key: "generateChildComponentDelegate", | ||
value: function generateChildComponentDelegate() { | ||
var _this2 = this; | ||
return _DisclosureManagerDelegate2.default.create({ | ||
return _DisclosureManagerDelegate.default.create({ | ||
disclose: function disclose(data) { | ||
@@ -188,2 +187,4 @@ if (_this2.disclosureTypeIsSupported(data.preferredType)) { | ||
*/ | ||
return { | ||
@@ -196,2 +197,3 @@ /** | ||
}), | ||
/** | ||
@@ -211,3 +213,3 @@ * The dismissDisclosure value is a function that the disclosing component can use to manually close the disclosure. | ||
}, { | ||
key: 'generateDisclosureComponentDelegate', | ||
key: "generateDisclosureComponentDelegate", | ||
value: function generateDisclosureComponentDelegate(componentKey, disclosureState) { | ||
@@ -221,4 +223,2 @@ var _this3 = this; | ||
disclosureSize = disclosureState.disclosureSize; | ||
var componentData = disclosureComponentData[componentKey]; | ||
@@ -228,8 +228,7 @@ var isFullscreen = disclosureSize === availableDisclosureSizes.FULLSCREEN; | ||
var componentIndex = disclosureComponentKeys.indexOf(componentKey); | ||
var delegate = {}; | ||
/** | ||
* The disclose function provided will push content onto the disclosure stack. | ||
*/ | ||
delegate.disclose = function (data) { | ||
@@ -251,3 +250,2 @@ if (_this3.props.trapNestedDisclosureRequests || _this3.disclosureTypeIsSupported(data.preferredType)) { | ||
}; | ||
/** | ||
@@ -257,9 +255,10 @@ * Allows a component to remove itself from the disclosure stack. If the component is the only element in the disclosure stack, | ||
*/ | ||
delegate.dismiss = popContent; | ||
/** | ||
* Allows a component to close the entire disclosure stack. | ||
*/ | ||
delegate.closeDisclosure = this.safelyCloseDisclosure; | ||
/** | ||
@@ -269,39 +268,38 @@ * Allows a component to remove itself from the disclosure stack. Functionally similar to `dismiss`, however `onBack` is | ||
*/ | ||
delegate.goBack = componentIndex > 0 ? popContent : undefined; | ||
/** | ||
* Allows a component to request focus from the disclosure in the event that the disclosure mechanism in use utilizes a focus trap. | ||
*/ | ||
delegate.requestFocus = disclosureIsFocused ? function () { | ||
return Promise.resolve().then(_this3.releaseDisclosureFocus); | ||
} : undefined; | ||
/** | ||
* Allows a component to release focus from itself and return it to the disclosure. | ||
*/ | ||
delegate.releaseFocus = !disclosureIsFocused ? function () { | ||
return Promise.resolve().then(_this3.requestDisclosureFocus); | ||
} : undefined; | ||
/** | ||
* Allows a component to maximize its presentation size. This is only provided if the component is not already maximized. | ||
*/ | ||
delegate.maximize = !isFullscreen && !disclosureIsMaximized ? function () { | ||
return Promise.resolve().then(_this3.maximizeDisclosure); | ||
} : undefined; | ||
/** | ||
* Allows a component to minimize its presentation size. This is only provided if the component is currently maximized. | ||
*/ | ||
delegate.minimize = !isFullscreen && disclosureIsMaximized ? function () { | ||
return Promise.resolve().then(_this3.minimizeDisclosure); | ||
} : undefined; | ||
/** | ||
* Allows a component to register a function with the DisclosureManager that will be called before the component is dismissed for any reason. | ||
*/ | ||
delegate.registerDismissCheck = function (checkFunc) { | ||
var disclosureManager = _this3.props.disclosureManager; | ||
_this3.dismissChecks[componentData.key] = checkFunc; | ||
@@ -321,5 +319,4 @@ | ||
return _DisclosureManagerDelegate2.default.create(delegate); | ||
return _DisclosureManagerDelegate.default.create(delegate); | ||
} | ||
/** | ||
@@ -331,13 +328,11 @@ * Determines if the provided disclosure type is supported by the DisclosureManager. | ||
}, { | ||
key: 'disclosureTypeIsSupported', | ||
key: "disclosureTypeIsSupported", | ||
value: function disclosureTypeIsSupported(type) { | ||
var _props = this.props, | ||
disclosureManager = _props.disclosureManager, | ||
supportedDisclosureTypes = _props.supportedDisclosureTypes; | ||
var _this$props = this.props, | ||
disclosureManager = _this$props.disclosureManager, | ||
supportedDisclosureTypes = _this$props.supportedDisclosureTypes; | ||
return supportedDisclosureTypes.indexOf(type) >= 0 || !disclosureManager; | ||
} | ||
}, { | ||
key: 'openDisclosure', | ||
key: "openDisclosure", | ||
value: function openDisclosure(data) { | ||
@@ -349,6 +344,7 @@ var dimensions = data.dimensions; | ||
dimensions = defaultDimensions; | ||
} | ||
} // eslint-disable-next-line prefer-destructuring | ||
// eslint-disable-next-line prefer-destructuring | ||
var size = data.size; | ||
if (!size || size && !isValidSize(size)) { | ||
@@ -359,4 +355,5 @@ // no valid size passed | ||
dimensions = defaultDimensions; | ||
} | ||
// ensure size set for pacivity | ||
} // ensure size set for pacivity | ||
size = defaultSize; | ||
@@ -371,3 +368,3 @@ } | ||
disclosureComponentKeys: [data.content.key], | ||
disclosureComponentData: _defineProperty({}, data.content.key, { | ||
disclosureComponentData: (0, _defineProperty2.default)({}, data.content.key, { | ||
key: data.content.key, | ||
@@ -380,10 +377,8 @@ name: data.content.name, | ||
newState.disclosureComponentDelegates = [this.generateDisclosureComponentDelegate(data.content.key, newState)]; | ||
this.setState(newState); | ||
} | ||
}, { | ||
key: 'pushDisclosure', | ||
key: "pushDisclosure", | ||
value: function pushDisclosure(data) { | ||
var newState = DisclosureManager.cloneDisclosureState(this.state); | ||
newState.disclosureComponentKeys.push(data.content.key); | ||
@@ -397,17 +392,14 @@ newState.disclosureComponentData[data.content.key] = { | ||
newState.disclosureComponentDelegates = newState.disclosureComponentDelegates.concat(this.generateDisclosureComponentDelegate(data.content.key, newState)); | ||
this.setState(newState); | ||
} | ||
}, { | ||
key: 'popDisclosure', | ||
key: "popDisclosure", | ||
value: function popDisclosure() { | ||
var newState = DisclosureManager.cloneDisclosureState(this.state); | ||
newState.disclosureComponentData[newState.disclosureComponentKeys.pop()] = undefined; | ||
newState.disclosureComponentDelegates.pop(); | ||
this.setState(newState); | ||
} | ||
}, { | ||
key: 'closeDisclosure', | ||
key: "closeDisclosure", | ||
value: function closeDisclosure() { | ||
@@ -426,3 +418,3 @@ this.setState({ | ||
}, { | ||
key: 'requestDisclosureFocus', | ||
key: "requestDisclosureFocus", | ||
value: function requestDisclosureFocus() { | ||
@@ -436,7 +428,6 @@ var _this4 = this; | ||
}); | ||
this.setState(newState); | ||
} | ||
}, { | ||
key: 'releaseDisclosureFocus', | ||
key: "releaseDisclosureFocus", | ||
value: function releaseDisclosureFocus() { | ||
@@ -450,7 +441,6 @@ var _this5 = this; | ||
}); | ||
this.setState(newState); | ||
} | ||
}, { | ||
key: 'maximizeDisclosure', | ||
key: "maximizeDisclosure", | ||
value: function maximizeDisclosure() { | ||
@@ -464,7 +454,6 @@ var _this6 = this; | ||
}); | ||
this.setState(newState); | ||
} | ||
}, { | ||
key: 'minimizeDisclosure', | ||
key: "minimizeDisclosure", | ||
value: function minimizeDisclosure() { | ||
@@ -478,6 +467,4 @@ var _this7 = this; | ||
}); | ||
this.setState(newState); | ||
} | ||
/** | ||
@@ -489,11 +476,12 @@ * Looks up the deferred afterDismiss promise for the provided disclosure key and | ||
}, { | ||
key: 'resolveDismissPromise', | ||
key: "resolveDismissPromise", | ||
value: function resolveDismissPromise(key) { | ||
var resolve = this.onDismissResolvers[key]; | ||
if (resolve) { | ||
resolve(); | ||
} | ||
this.onDismissResolvers[key] = undefined; | ||
} | ||
/** | ||
@@ -505,3 +493,3 @@ * Resolves the dismiss checks for the current disclosure components in sequence. The Promise will either resolve if all checks resolve or | ||
}, { | ||
key: 'resolveDismissChecksInSequence', | ||
key: "resolveDismissChecksInSequence", | ||
value: function resolveDismissChecksInSequence(keys) { | ||
@@ -525,3 +513,2 @@ var _this8 = this; | ||
} | ||
/** | ||
@@ -533,8 +520,7 @@ * Closes the disclosure after calling all checks and resolving all deferred promises. | ||
}, { | ||
key: 'safelyCloseDisclosure', | ||
key: "safelyCloseDisclosure", | ||
value: function safelyCloseDisclosure() { | ||
var _this9 = this; | ||
var disclosureKeys = _extends([], this.state.disclosureComponentKeys); | ||
var disclosureKeys = (0, _extends3.default)([], this.state.disclosureComponentKeys); | ||
/** | ||
@@ -545,8 +531,9 @@ * Before closing the disclosure, the dismiss checks for components in the stack are | ||
*/ | ||
return this.resolveDismissChecksInSequence(disclosureKeys).then(function () { | ||
_this9.dismissChecks = {}; | ||
_this9.closeDisclosure(); | ||
}); | ||
} | ||
/** | ||
@@ -557,3 +544,3 @@ * Creates an instance of a pop function for the component represented by the given key. | ||
}, { | ||
key: 'generatePopFunction', | ||
key: "generatePopFunction", | ||
value: function generatePopFunction(key) { | ||
@@ -565,3 +552,2 @@ var _this10 = this; | ||
if (disclosureComponentKeys[disclosureComponentKeys.length - 1] !== key) { | ||
@@ -584,2 +570,3 @@ /** | ||
_this10.dismissChecks[key] = undefined; | ||
_this10.resolveDismissPromise(key); | ||
@@ -599,19 +586,18 @@ }).then(function () { | ||
}, { | ||
key: 'render', | ||
key: "render", | ||
value: function render() { | ||
var _props2 = this.props, | ||
render = _props2.render, | ||
children = _props2.children; | ||
var _state = this.state, | ||
childComponentDelegate = _state.childComponentDelegate, | ||
disclosureIsOpen = _state.disclosureIsOpen, | ||
disclosureIsFocused = _state.disclosureIsFocused, | ||
disclosureIsMaximized = _state.disclosureIsMaximized, | ||
disclosureSize = _state.disclosureSize, | ||
disclosureDimensions = _state.disclosureDimensions, | ||
disclosureComponentKeys = _state.disclosureComponentKeys, | ||
disclosureComponentData = _state.disclosureComponentData, | ||
disclosureComponentDelegates = _state.disclosureComponentDelegates; | ||
var _this$props2 = this.props, | ||
render = _this$props2.render, | ||
children = _this$props2.children; | ||
var _this$state = this.state, | ||
childComponentDelegate = _this$state.childComponentDelegate, | ||
disclosureIsOpen = _this$state.disclosureIsOpen, | ||
disclosureIsFocused = _this$state.disclosureIsFocused, | ||
disclosureIsMaximized = _this$state.disclosureIsMaximized, | ||
disclosureSize = _this$state.disclosureSize, | ||
disclosureDimensions = _this$state.disclosureDimensions, | ||
disclosureComponentKeys = _this$state.disclosureComponentKeys, | ||
disclosureComponentData = _this$state.disclosureComponentData, | ||
disclosureComponentDelegates = _this$state.disclosureComponentDelegates; | ||
if (!render) { | ||
@@ -625,7 +611,5 @@ return null; | ||
children: { | ||
components: _react2.default.createElement( | ||
_DisclosureManagerContext2.default.Provider, | ||
{ value: childComponentDelegate }, | ||
children | ||
) | ||
components: _react.default.createElement(_DisclosureManagerContext.default.Provider, { | ||
value: childComponentDelegate | ||
}, children) | ||
}, | ||
@@ -639,7 +623,6 @@ disclosure: { | ||
components: disclosureComponentKeys.map(function (key, index) { | ||
return _react2.default.createElement( | ||
_DisclosureManagerContext2.default.Provider, | ||
{ value: disclosureComponentDelegates[index], key: key }, | ||
disclosureComponentData[key].component | ||
); | ||
return _react.default.createElement(_DisclosureManagerContext.default.Provider, { | ||
value: disclosureComponentDelegates[index], | ||
key: key | ||
}, disclosureComponentData[key].component); | ||
}) | ||
@@ -650,13 +633,12 @@ } | ||
}]); | ||
return DisclosureManager; | ||
}(_react2.default.Component); | ||
}(_react.default.Component); | ||
DisclosureManager.propTypes = propTypes; | ||
DisclosureManager.defaultProps = defaultProps; | ||
var disclosureManagerShape = _DisclosureManagerDelegate.default.propType; | ||
exports.disclosureManagerShape = disclosureManagerShape; | ||
var disclosureManagerShape = _DisclosureManagerDelegate2.default.propType; | ||
var _default = (0, _withDisclosureManager.default)(DisclosureManager); | ||
exports.default = (0, _withDisclosureManager2.default)(DisclosureManager); | ||
exports.withDisclosureManager = _withDisclosureManager2.default; | ||
exports.disclosureManagerShape = disclosureManagerShape; | ||
exports.default = _default; |
@@ -1,15 +0,15 @@ | ||
'use strict'; | ||
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = void 0; | ||
var _react = require('react'); | ||
var _react = _interopRequireDefault(require("react")); | ||
var _react2 = _interopRequireDefault(_react); | ||
var DisclosureManagerContext = _react.default.createContext(); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var DisclosureManagerContext = _react2.default.createContext(); | ||
exports.default = DisclosureManagerContext; | ||
var _default = DisclosureManagerContext; | ||
exports.default = _default; |
@@ -1,15 +0,14 @@ | ||
'use strict'; | ||
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = void 0; | ||
var _propTypes = require('prop-types'); | ||
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")); | ||
var _propTypes2 = _interopRequireDefault(_propTypes); | ||
var _propTypes = _interopRequireDefault(require("prop-types")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
var supportedAttributes = ['disclose', 'dismiss', 'closeDisclosure', 'goBack', 'maximize', 'minimize', 'requestFocus', 'releaseFocus', 'registerDismissCheck']; | ||
@@ -20,4 +19,3 @@ | ||
_classCallCheck(this, DisclosureManagerDelegateInstance); | ||
(0, _classCallCheck2.default)(this, DisclosureManagerDelegateInstance); | ||
supportedAttributes.forEach(function (attribute) { | ||
@@ -36,3 +34,2 @@ if (data[attribute]) { | ||
var ancestorDelegate = delegate || {}; | ||
var mergedData = {}; | ||
@@ -42,3 +39,2 @@ supportedAttributes.forEach(function (attribute) { | ||
}); | ||
return create(mergedData); | ||
@@ -62,5 +58,5 @@ }; | ||
var DisclosureManagerDelegate = { | ||
propType: _propTypes2.default.objectOf(function (propValue, key, componentName, location, propFullName) { | ||
propType: _propTypes.default.objectOf(function (propValue, key, componentName, location, propFullName) { | ||
if (supportedAttributes.indexOf(key) < 0) { | ||
return new Error('Invalid key \'' + key + '\' supplied to ' + componentName + '\'s \'' + propFullName + '\' prop. Validation failed.'); | ||
return new Error("Invalid key '".concat(key, "' supplied to ").concat(componentName, "'s '").concat(propFullName, "' prop. Validation failed.")); | ||
} | ||
@@ -74,3 +70,3 @@ | ||
}; | ||
exports.default = DisclosureManagerDelegate; | ||
var _default = DisclosureManagerDelegate; | ||
exports.default = _default; |
@@ -1,36 +0,31 @@ | ||
'use strict'; | ||
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = void 0; | ||
var _react = require('react'); | ||
var _react = _interopRequireDefault(require("react")); | ||
var _react2 = _interopRequireDefault(_react); | ||
var _terraDocTemplate = _interopRequireDefault(require("terra-doc-template")); | ||
var _terraDocTemplate = require('terra-doc-template'); | ||
var _package = require("../../../../package.json"); | ||
var _terraDocTemplate2 = _interopRequireDefault(_terraDocTemplate); | ||
var _README = _interopRequireDefault(require("../../../../docs/README.md")); | ||
var _package = require('../../../../package.json'); | ||
var _DisclosureManager = _interopRequireDefault(require("!raw-loader!../../../../src/DisclosureManager.jsx")); | ||
var _README = require('../../../../docs/README.md'); | ||
/* eslint-disable import/no-webpack-loader-syntax, import/first, import/extensions, import/no-unresolved, import/no-duplicates */ | ||
// Component Source | ||
var _README2 = _interopRequireDefault(_README); | ||
var _DisclosureManager = require('!raw-loader!../../../../src/DisclosureManager.jsx'); | ||
var _DisclosureManager2 = _interopRequireDefault(_DisclosureManager); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/* eslint-enabled import/no-webpack-loader-syntax, import/first, import/extensions, import/no-unresolved, import/no-duplicates */ | ||
var DocPage = function DocPage() { | ||
return _react2.default.createElement(_terraDocTemplate2.default, { | ||
return _react.default.createElement(_terraDocTemplate.default, { | ||
packageName: _package.name, | ||
readme: _README2.default, | ||
srcPath: 'https://github.com/cerner/terra-framework/tree/master/packages/' + _package.name, | ||
readme: _README.default, | ||
srcPath: "https://github.com/cerner/terra-framework/tree/master/packages/".concat(_package.name), | ||
propsTables: [{ | ||
componentSrc: _DisclosureManager2.default | ||
componentSrc: _DisclosureManager.default | ||
}] | ||
@@ -40,4 +35,3 @@ }); | ||
/* eslint-disable import/no-webpack-loader-syntax, import/first, import/extensions, import/no-unresolved, import/no-duplicates */ | ||
// Component Source | ||
exports.default = DocPage; | ||
var _default = DocPage; | ||
exports.default = _default; |
@@ -1,29 +0,25 @@ | ||
'use strict'; | ||
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = void 0; | ||
var _react = require('react'); | ||
var _react = _interopRequireDefault(require("react")); | ||
var _react2 = _interopRequireDefault(_react); | ||
var _terraDocTemplate = _interopRequireDefault(require("terra-doc-template")); | ||
var _terraDocTemplate = require('terra-doc-template'); | ||
var _CHANGELOG = _interopRequireDefault(require("../../../../CHANGELOG.md")); | ||
var _terraDocTemplate2 = _interopRequireDefault(_terraDocTemplate); | ||
var _CHANGELOG = require('../../../../CHANGELOG.md'); | ||
var _CHANGELOG2 = _interopRequireDefault(_CHANGELOG); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var DocPage = function DocPage() { | ||
return _react2.default.createElement(_terraDocTemplate2.default, { | ||
packageName: 'terra-disclosure-manager', | ||
srcPath: 'https://github.com/cerner/terra-framework/tree/master/packages/terra-disclosure-manager', | ||
readme: _CHANGELOG2.default | ||
return _react.default.createElement(_terraDocTemplate.default, { | ||
packageName: "terra-disclosure-manager", | ||
srcPath: "https://github.com/cerner/terra-framework/tree/master/packages/terra-disclosure-manager", | ||
readme: _CHANGELOG.default | ||
}); | ||
}; | ||
exports.default = DocPage; | ||
var _default = DocPage; | ||
exports.default = _default; |
@@ -1,19 +0,16 @@ | ||
'use strict'; | ||
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = void 0; | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")); | ||
var _react = require('react'); | ||
var _react = _interopRequireDefault(require("react")); | ||
var _react2 = _interopRequireDefault(_react); | ||
var _DisclosureManagerContext = _interopRequireDefault(require("./DisclosureManagerContext")); | ||
var _DisclosureManagerContext = require('./DisclosureManagerContext'); | ||
var _DisclosureManagerContext2 = _interopRequireDefault(_DisclosureManagerContext); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var getDisplayName = function getDisplayName(Component) { | ||
@@ -25,17 +22,15 @@ return Component.displayName || Component.name || 'Component'; | ||
var WithDisclosureManagerComp = function WithDisclosureManagerComp(props) { | ||
return _react2.default.createElement( | ||
_DisclosureManagerContext2.default.Consumer, | ||
null, | ||
function (disclosureManager) { | ||
return _react2.default.createElement(WrappedComponent, _extends({}, props, { disclosureManager: disclosureManager })); | ||
} | ||
); | ||
return _react.default.createElement(_DisclosureManagerContext.default.Consumer, null, function (disclosureManager) { | ||
return _react.default.createElement(WrappedComponent, (0, _extends2.default)({}, props, { | ||
disclosureManager: disclosureManager | ||
})); | ||
}); | ||
}; | ||
WithDisclosureManagerComp.displayName = 'withDisclosureManager(' + getDisplayName(WrappedComponent) + ')'; | ||
WithDisclosureManagerComp.displayName = "withDisclosureManager(".concat(getDisplayName(WrappedComponent), ")"); | ||
WithDisclosureManagerComp.WrappedComponent = WrappedComponent; | ||
return WithDisclosureManagerComp; | ||
}; | ||
exports.default = withDisclosureManager; | ||
var _default = withDisclosureManager; | ||
exports.default = _default; |
{ | ||
"name": "terra-disclosure-manager", | ||
"main": "lib/DisclosureManager.js", | ||
"version": "4.11.0", | ||
"version": "4.12.0", | ||
"description": "A stateful component used to manage disclosure presentation.", | ||
@@ -35,11 +35,11 @@ "repository": { | ||
"scripts": { | ||
"compile": "npm run compile:clean && npm run compile:build", | ||
"compile:clean": "rm -rf lib", | ||
"compile:build": "babel src --out-dir lib --copy-files", | ||
"compile": "babel --root-mode upward src --out-dir lib --copy-files", | ||
"lint": "npm run lint:js && npm run lint:scss", | ||
"lint:js": "eslint --ext .js,.jsx . --ignore-path ../../.eslintignore", | ||
"lint:scss": "stylelint src/**/*.scss", | ||
"precompile": "rm -rf lib", | ||
"test": "npm run test:jest", | ||
"test:jest": "jest --config ../../jestconfig.js" | ||
} | ||
}, | ||
"gitHead": "55d4739caab6f5a19edb8daaabd83dd2579851de" | ||
} |
# Terra Disclosure Manager | ||
[![NPM version](https://badgen.net/npm/v/terra-disclosure-manager)](https://www.npmjs.org/package/terra-disclosure-manager) | ||
[![Build Status](https://badgen.net/travis/cerner/terra-framework)](https://travis-ci.org/cerner/terra-framework) | ||
[![Build Status](https://badgen.net/travis/cerner/terra-framework)](https://travis-ci.com/cerner/terra-framework) | ||
@@ -6,0 +6,0 @@ The DisclosureManager is a stateful component used to manage disclosure presentation. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
128552
1918