Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

terra-disclosure-manager

Package Overview
Dependencies
Maintainers
9
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

terra-disclosure-manager - npm Package Compare versions

Comparing version 4.31.0 to 4.32.0

5

CHANGELOG.md

@@ -7,2 +7,7 @@ ChangeLog

4.32.0 - (February 25, 2020)
------------------
### Added
* Add `title` options to the `disclose` API provided to disclosed content (see #1013)
4.31.0 - (February 18, 2020)

@@ -9,0 +14,0 @@ ------------------

34

lib/DisclosureManager.js

@@ -119,3 +119,3 @@ "use strict";

* An array of disclosure types that the DisclosureManager should support. If an unsupported disclosure request occurs, the DisclosureManager will
* utilize its 'app' prop and forward the request instead of handling the request itself.
* utilize its 'disclosureManager' prop and forward the request instead of handling the request itself.
*/

@@ -208,3 +208,3 @@ supportedDisclosureTypes: _propTypes.default.array,

key: "generateHeaderContextValue",
value: function generateHeaderContextValue(key) {
value: function generateHeaderContextValue(key, initialTitle) {
var _this2 = this;

@@ -221,3 +221,3 @@

headerAdapterData: {
title: title,
title: initialTitle || title,
collapsibleMenuView: collapsibleMenuView

@@ -391,3 +391,3 @@ }

dimensions = defaultDimensions;
} // ensure size set for pacivity
} // ensure size set for passivity

@@ -404,9 +404,14 @@

disclosureComponentKeys: [data.content.key],
disclosureComponentData: (0, _defineProperty2.default)({}, data.content.key, {
disclosureComponentData: (0, _defineProperty2.default)({}, data.content.key, _objectSpread({
key: data.content.key,
name: data.content.name,
props: data.content.props,
component: data.content.component,
headerAdapterContextValue: this.generateHeaderContextValue(data.content.key)
})
component: data.content.component
}, data.content.title !== undefined && {
headerAdapterData: {
title: data.content.title
}
}, {
headerAdapterContextValue: this.generateHeaderContextValue(data.content.key, data.content.title)
}))
};

@@ -421,9 +426,14 @@ newState.disclosureComponentDelegates = [this.generateDisclosureComponentDelegate(data.content.key, newState)];

newState.disclosureComponentKeys.push(data.content.key);
newState.disclosureComponentData[data.content.key] = {
newState.disclosureComponentData[data.content.key] = _objectSpread({
key: data.content.key,
name: data.content.name,
props: data.content.props,
component: data.content.component,
headerAdapterContextValue: this.generateHeaderContextValue(data.content.key)
};
component: data.content.component
}, data.content.title !== undefined && {
headerAdapterData: {
title: data.content.title
}
}, {
headerAdapterContextValue: this.generateHeaderContextValue(data.content.key, data.content.title)
});
newState.disclosureComponentDelegates = newState.disclosureComponentDelegates.concat(this.generateDisclosureComponentDelegate(data.content.key, newState));

@@ -430,0 +440,0 @@ this.setState(newState);

{
"name": "terra-disclosure-manager",
"main": "lib/DisclosureManager.js",
"version": "4.31.0",
"version": "4.32.0",
"description": "A stateful component used to manage disclosure presentation.",

@@ -43,3 +43,3 @@ "repository": {

},
"gitHead": "05651a5eb143e22525ba00861e815b1360c0549e"
"gitHead": "07d07c97907328ec086a4d5d1be8159df45becef"
}

@@ -43,3 +43,3 @@ import React from 'react';

* An array of disclosure types that the DisclosureManager should support. If an unsupported disclosure request occurs, the DisclosureManager will
* utilize its 'app' prop and forward the request instead of handling the request itself.
* utilize its 'disclosureManager' prop and forward the request instead of handling the request itself.
*/

@@ -123,3 +123,3 @@ supportedDisclosureTypes: PropTypes.array,

generateHeaderContextValue(key) {
generateHeaderContextValue(key, initialTitle) {
return {

@@ -131,3 +131,6 @@ register: ({ title, collapsibleMenuView }) => {

...{
[key]: { ...state.disclosureComponentData[key], headerAdapterData: { title, collapsibleMenuView } },
[key]: {
...state.disclosureComponentData[key],
headerAdapterData: { title: initialTitle || title, collapsibleMenuView },
},
},

@@ -279,3 +282,3 @@ },

}
// ensure size set for pacivity
// ensure size set for passivity
size = defaultSize;

@@ -296,6 +299,8 @@ }

component: data.content.component,
headerAdapterContextValue: this.generateHeaderContextValue(data.content.key),
...(data.content.title !== undefined) && { headerAdapterData: { title: data.content.title } },
headerAdapterContextValue: this.generateHeaderContextValue(data.content.key, data.content.title),
},
},
};
newState.disclosureComponentDelegates = [this.generateDisclosureComponentDelegate(data.content.key, newState)];

@@ -315,3 +320,4 @@

component: data.content.component,
headerAdapterContextValue: this.generateHeaderContextValue(data.content.key),
...(data.content.title !== undefined) && { headerAdapterData: { title: data.content.title } },
headerAdapterContextValue: this.generateHeaderContextValue(data.content.key, data.content.title),
};

@@ -318,0 +324,0 @@ newState.disclosureComponentDelegates = newState.disclosureComponentDelegates.concat(this.generateDisclosureComponentDelegate(data.content.key, newState));

import React from 'react';
import DisclosureManager, { withDisclosureManager } from '../../src/DisclosureManager';
import DisclosureManager, { withDisclosureManager, DisclosureManagerHeaderAdapter } from '../../src/DisclosureManager';

@@ -76,3 +76,3 @@ const TestChild = withDisclosureManager(({ id }) => <div id={id} />);

const triggerChildDisclose = wrapper => (
const triggerChildDisclose = (wrapper, disclosureOptions = { content: {} }) => (
new Promise((resolve, reject) => {

@@ -83,5 +83,7 @@ const childDisclosureManager1 = wrapper.find('#child1').getElements()[1].props.disclosureManager;

size: 'large',
...disclosureOptions,
content: {
key: 'DISCLOSE_KEY',
component: <TestChild id="disclosure-component" />,
...disclosureOptions.content,
},

@@ -161,2 +163,39 @@ }).then(resolve).catch(reject);

describe('discloses content with header title', () => {
it('renders with title', () => {
const wrapper = mountDisclosureManager(['test'], manager => (
<div id="wrapper">
{manager.children.components}
{manager.disclosure.components}
</div>
));
return triggerChildDisclose(wrapper, { content: { title: 'test title' } }).then(() => {
expect(wrapper.state().disclosureComponentData.DISCLOSE_KEY.headerAdapterData).toHaveProperty('title', 'test title');
});
});
it('maintains disclosed title when title is registered with DisclosureManagerHeaderAdapter', () => {
const wrapper = mountDisclosureManager(['test'], manager => (
<div id="wrapper">
{manager.children.components}
{manager.disclosure.components}
</div>
));
const ContentWithHeaderAdapter = withDisclosureManager(({ id }) => (
<div id={id}>
<DisclosureManagerHeaderAdapter title="DisclosureManagerTitle" collapsibleMenuView={<div id="dummy component" />} />
</div>
));
const discloseParameters = { content: { title: 'test title', component: <ContentWithHeaderAdapter id="disclosure-component" /> } };
return triggerChildDisclose(wrapper, discloseParameters).then(() => {
expect(wrapper.state().disclosureComponentData.DISCLOSE_KEY.headerAdapterData).toHaveProperty('title', 'test title');
expect(wrapper.state().disclosureComponentData.DISCLOSE_KEY.headerAdapterData).toHaveProperty('collapsibleMenuView');
expect(wrapper.state().disclosureComponentData.DISCLOSE_KEY.headerAdapterData.collapsibleMenuView).toBeDefined();
});
});
});
it('should resolve disclose request with dismissDisclosure/afterDismiss APIs', () => {

@@ -163,0 +202,0 @@ let dismissDisclosureInstance;

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc