mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-03 20:17:59 +00:00
* Adding explicit MPL license for sub-package. This directory and its subdirectories (packages) contain files licensed with the MPLv2 `LICENSE` file in this directory and are intentionally licensed separately from the BSL `LICENSE` file at the root of this repository. * Adding explicit MPL license for sub-package. This directory and its subdirectories (packages) contain files licensed with the MPLv2 `LICENSE` file in this directory and are intentionally licensed separately from the BSL `LICENSE` file at the root of this repository. * Updating the license from MPL to Business Source License. Going forward, this project will be licensed under the Business Source License v1.1. Please see our blog post for more details at https://hashi.co/bsl-blog, FAQ at www.hashicorp.com/licensing-faq, and details of the license at www.hashicorp.com/bsl. * add missing license headers * Update copyright file headers to BUS-1.1 * Fix test that expected exact offset on hcl file --------- Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com> Co-authored-by: Sarah Thompson <sthompson@hashicorp.com> Co-authored-by: Brian Kassouf <bkassouf@hashicorp.com>
56 lines
1.6 KiB
JavaScript
56 lines
1.6 KiB
JavaScript
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* SPDX-License-Identifier: BUSL-1.1
|
|
*/
|
|
|
|
import Component from '@glimmer/component';
|
|
import { messageTypes } from 'core/helpers/message-types';
|
|
/**
|
|
* @module Modal
|
|
* Modal components are used to overlay content on top of the page. Has a darkened background,
|
|
* a title, and in order to close it you must pass an onClose function.
|
|
*
|
|
* @example
|
|
* ```js
|
|
* <Modal
|
|
* @title="Export attribution data"
|
|
* @type="info"
|
|
* @isActive={{this.showModal}}
|
|
* @showCloseButton={{true}}
|
|
* @onClose={{action (mut this.showModal) false}}
|
|
* >
|
|
* Whatever content pops up when the modal isActive!
|
|
* </Modal>
|
|
* ```
|
|
* @callback onClose
|
|
* @param {onClose} onClose - onClose is the action taken when someone clicks the modal background or close button (if shown).
|
|
* @param {boolean} isActive=false - whether or not modal displays
|
|
* @param {string} [title] - This text shows up in the header section of the modal. Only the first word should be capitalized.
|
|
* @param {boolean} [showCloseButton=false] - controls whether the close button in the top right corner shows.
|
|
* @param {string} [type=null] - The header styling based on type passed into the message-types helper.
|
|
*/
|
|
|
|
export default class ModalComponent extends Component {
|
|
get isActive() {
|
|
return this.args.isActive || false;
|
|
}
|
|
|
|
get showCloseButton() {
|
|
return this.args.showCloseButton || false;
|
|
}
|
|
|
|
get glyph() {
|
|
if (!this.args.type) {
|
|
return null;
|
|
}
|
|
return messageTypes([this.args.type]);
|
|
}
|
|
|
|
get modalClass() {
|
|
if (!this.args.type) {
|
|
return 'modal';
|
|
}
|
|
return 'modal ' + messageTypes([this.args.type]).class;
|
|
}
|
|
}
|