open-consul/ui/packages/consul-ui/app/components/modal-dialog
Ella Cai aa03846880
UI: Update Consul UI colors to use HDS colors (#16111)
* update red color variables to hds

* change background red to be one step lighter

* map oranges

* map greens

* map blues

* map greys

* delete themes, colours: lemon, magenta, strawberry, and vault color aliases

* add unmapped rainbow colours

* replace white and transparent vars, remove unused semantic vars and frame placeholders

* small tweaks to improve contrast, change node health status x/check colours for non-voters to match design doc, replace semantic colour action w hds colour

* add unmapped grays, remove dark theme, manually set nav bar to use dark colours

* map consul pink colour

* map yellows

* add unmapped oranges, delete light theme

* remove readme, base variables, clean up dangling colours

* Start working on the nav disclosure menus

* Update main-nav-horizontal dropdowns

* Format template

* Update box-shadow tokens

* Replace --tone- usage with tokens

* Update nav disabled state and panel border colour

* Replace rgb usage on tile

* Fix permissions modal overlay

* More fixes

* Replace orange-500 with amber-200

* Update badge colors

* Update vertical sidebar colors

* Remove top border on consul peer list ul

---------

Co-authored-by: wenincode <tyler.wendlandt@hashicorp.com>
2023-02-27 09:30:12 -07:00
..
README.mdx ui: Add a modal.opened property for inspecting whether the modal is open (#13723) 2022-07-18 15:30:37 +01:00
index.hbs [UI] CC-4031: change from Action, a and button to hds::Button (#16251) 2023-02-22 13:05:15 -08:00
index.js ui: chore - upgrade ember and friends (#14518) 2022-09-15 09:43:17 +01:00
index.scss
layout.scss [UI] CC-4031: change from Action, a and button to hds::Button (#16251) 2023-02-22 13:05:15 -08:00
skin.scss UI: Update Consul UI colors to use HDS colors (#16111) 2023-02-27 09:30:12 -07:00

README.mdx

---
class: ember
---
# ModalDialog

Consul UIs modal component is a thin wrapper around the excellent `a11y-dialog`. The
most common usage will be something like the below:

```hbs preview-template
<ModalDialog
  @onclose={{noop}}
  @onopen={{noop}}
  @aria={{hash
    label="Screenread name of the modal"
  }}
as |modal|>

  <!-- Save a reference to the modal component so we can call its methods -->
  {{did-insert (set this 'modal' modal)}}

  <BlockSlot @name="header">
    <h2>
      Modal Header
    </h2>
  </BlockSlot>
  <BlockSlot @name="body">
    <p>
      Modal body
    </p>
  </BlockSlot>
  <BlockSlot @name="actions">
    <button type="button"
      {{on "click" modal.close}}
    >
      Close modal
    </button>
  </BlockSlot>
</ModalDialog>

<button
  type="button"
  {{on 'click' (optional this.modal.open)}}
>
  Open Modal
</button>

```
All modals work in tandem with `<ModalLayer />` to render modals. First of all ensure
you have a modal layer on the page (it doesn't have to be in the same
template)

```hbs
<ModalLayer />
```

Then all modals will be rendered into the `<ModalLayer />`.

## Arguments

| Argument | Type | Default | Description |
| --- | --- | --- | --- |
| `onopen` | `Function` | `undefined` | A function to call when the modal has opened |
| `onclose` | `Function` | `undefined` | A function to call when the modal has closed |
| `aria` | `Object` | `undefined` | A `hash` of aria properties used in the component, currently only label is supported |
| `open` | `Boolean` | `false` | Whether the modal should be initialized in its 'open' state. Useful if the modal should be controlled via handlebars conditionals. Please note this argument it not yet reactive, i.e. it is only checked on component insert not attribute update. An improvement here would be to respect this value during the update of the attribute. |

## Exports

| Name | Type | Description |
| --- | --- | --- |
| `open` | `Function` | Opens the modal dialog |
| `close` | `Function` | Closes the modal dialog |
| `opened` | `boolean` | Whether the modal is currently open or not |