consul/ui/packages/consul-ui/app/styles/base/icons
Michael Klein 03a1a86dfe
ui: chore - upgrade ember and friends (#14518)
* v3.20.2...v3.24.0

* Fix handle undefined outlet in route component

* Don't use template helper for optional modal.open

Using the optional-helper here will trigger a computation
in the same runloop error. This is because we are setting
the `modal`-property when the `<Ref>` component gets
rendered which will update the `this.modal`-property which
will then recompute the `optional`-helper leading to this
error.

Instead we will create an action that will call the `open`-method
on the modal when it is defined. This gets rid of the double
computation error as we will not access the modal property
twice in the same runloop when `modal` is getting set.

* Fix - fn needs to be passed function tab-nav

We create functions in the component file instead
so that fn-helper stops complaining about the
need to pass a function.

* Update ember-exam to 6.1 version

"Makes it compatible" with ember-qunit v5

* scheduleOnce setMaxHeight paged-collection

We need to schedule to get around double-computation error.

* Fix - model.data is removed from ember-data

This has been private API all along - we need to
work around the removal.

Reference: https://github.com/emberjs/data/pull/7338/files#diff-9a8746fc5c86fd57e6122f00fef3155f76f0f3003a24b53fb7c4621d95dcd9bfL1310

* Fix `propContains` instead of `deepEqual` policy

Recent model.data works differently than iterating attributes.
We use `propContains` instead of `deepEqual`. We are only
interested in the properties we assert against and match
the previous behavior with this change.

* Fix `propContains` instead of `deepEqual` token

* Better handling single-records repo test-helper

`model.data` has been removed we need to handle proxies and
model instances differently.

* Fix remaining repository tests with propContains

We don't want to match entire objects - we don't care
about properties we haven't defined in the assertion.

* Don't use template helper for optional modal.open

Using a template helper will give us a recomputation error -
we work around it by creating an explicit action on
the component instead.

* Await `I $verb the $pageObject object` step

* Fix no more customization ember-can

No need to customize, the helper handles destruction
fine on its own.

* Fix - don't pass `optional` functions to fn

We will declare the functions on the component instead.
This gives us the same behavior but no error from
`fn`, which expects a function to be passed.

* Fix - handle `undefined` state on validate modifier

StateChart can yield out an undefined `state` we need
to handle that in the validate modifier

* Fix linting errors tests directory

* Warn / turn off new ember linting issues

We will tackle them one by one and don't want to
autofix issues that could be dangerous to auto-fix.

* Auto-fix linting issues

* More linting configuration

* Fix remaining linting issues

* Fix linting issues new files after rebase

* ui: Remove ember-cli-uglify config now we are using terser (#14574)

Co-authored-by: John Cowen <johncowen@users.noreply.github.com>
2022-09-15 09:43:17 +01:00
..
icons ui: Adds a HCP home link when in HCP (#14417) 2022-09-01 18:26:12 +01:00
README.mdx ui: upgrade ember composable helper (#13394) 2022-06-08 16:07:51 +01:00
base-keyframes.css.js ui: chore - upgrade ember and friends (#14518) 2022-09-15 09:43:17 +01:00
base-keyframes.scss ui: Icon related fixups (#13183) 2022-05-25 14:28:42 +01:00
base-placeholders.scss
debug.scss
index.scss
overrides.scss

README.mdx

# Iconography

All our iconography uses native CSS properties for adding iconography from The
Outside. You can also add icons using the same properties within `style=""`
attributes, but you should think twice before adding decorative content into
HTML and only do so if you have a good reason/have tried everything else.

Available icons properties are:

- `--icon-name`: See below for available names
- `--icon-color`: By default our icons are set to be monochrome, using
  `--icon-color` will color the icon, you can also use `currentColor`
- `--icon-size`: Set the size of the icon, see below for available values. Our
  values use a `icon-000` naming scheme similar to all our ther naming scales (and
  `font-weight`). We default this to `icon-300` i.e. `1rem`/`16px` and `icon-000`
  means 'use the font-size'
- `--icon-resolution`: Set the resolution of the icon. Currently you can set
  either `1` or `.5` here `resolution` happens to mean the thickness of the lines
  used in the icon. 1 equals thicker lines and should be used at sizes lower than
  `icon-500`. `.5` equals thinner lines and should be used at sizes larger than
  `icon-500`.

All of the above properties can be suffixed with `-start` or `-end`, these are
mainly used for specifying icons using `style=""` attributes. Here `start` and
`end` refer to either the `::before` or `::after` pseudo element to use to
display the icon. If you are not using the `style=""` attribute (which you
probably aren't) consider just using normal `::before` and `::after` CSS
selectors.

```css
.selector::before {
  --icon-name: icon-aws-color;
  content: '';
}
```

```css
.selector::after {
  --icon-name: icon-aws;
  --icon-color: rgb(var(---white));
  content: '';
}
```

If you cannot use CSS or have a good reason to do so, you can very easily add
icons in HTML using these CSS properties.

```hbs preview-template
<h2
  style={{style-map
    (array '--icon-name-start' 'icon-consul')
    (array '--icon-color-start' 'rgb(var(--tone-strawberry-500))')
    (array '--icon-name-end' 'icon-vault')
    (array '--icon-color-end' 'var(--color-vault-500)')
  }}
>
  Header Name
</h2>
```

It's probably worth noting that we could make an icon component using the
following. Under different circumstances this would give us an option that works
"For Everyone, Everywhere" (in Every Framework as it's just native CSS).

```hbs
<span
  class={{class-map
    'visually-hidden'
  }}
  style={{style-map
    (array '--icon-name-start' @name)
    (array '--icon-color' @color)
    (array '--icon-size' @size)
  }}
  ...attributes
>{{yield}}</span>


<Icon @name="icon-name" @color="#FF0000" @size="icon-300" />
```


## Deprecated

Please prefer our Constructable `%placeholder` styles over singular CSS
properties. If you need to drop back, to something not covered there then you
can also use CSS properties directly.

All icons use a `%with-` prefix for example `%with-alert-circle-fill-icon` or
`%with-alert-circle-fill-mask`. We mostly use the `-mask` suffix and also use
the `%as-pseudo` placeholder to tell CSS that we are using the background on a
pseudo element:

If you are not using a pseudo element for whatever reason, then you do not need
to use `%as-pseudo`.

When using `-mask` icons, color will use the `currentColor` of the element. If
you need the color of the icon to be different to the text you can define the
color of the icon itself via the `color` CSS property (preferred) but you can
also use `background-color`.

```css
.selector::before {
  @extend %with-alert-circle-fill-mask, %as-pseudo;
  color: rgb(var(--tone-strawberry-500));
}
```

If you need to use a colored icon (usually an existing brand icon) then don't
use `-mask`, use `-icon` instead:

```css
.selector::before {
  @extend %with-logo-consul-color-icon, %as-pseudo;
}
```

```hbs preview-template
<figure>
    <select
      onchange={{action (mut this.type) value="target.value"}}
    >
      <option>colored</option>
      <option>monochrome</option>
    </select>
    <select
      onchange={{action (mut this.theme) value="target.value"}}
    >
      <option>light</option>
      <option>dark</option>
    </select>
    <input
      oninput={{action (mut this.size) value="target.value"}}
      type="range" min="100" max="900" step="100"
    />
    {{this.size}}
</figure>
<ul
  {{css-props (set this 'icons')
    prefix='icon-'
  }}
  class={{class-map
    (concat 'theme-' (or this.theme 'light'))
  }}
  style={{style-map
    (array '--icon-color' (if (eq this.type 'monochrome') 'rgb(var(--black))'))
    (array '--icon-size' (concat 'icon-' (or this.size '500')))
    (array '--icon-resolution' (if (gt this.size 500) '.5' '1'))
  }}
>
{{#each-in this.icons as |prop value|}}
{{#if (and
    (not (includes prop (array '--icon-name' '--icon-color' '--icon-size' '--icon-resolution')))
    (not (string-includes prop '-24'))
  )
}}
{{#let
  (string-replace (string-replace prop '-16' '') '--' '')
as |name|}}
  <li>
    <figure
      {{with-copyable (concat '--icon-name: ' name ';content: "";')}}
      style={{style-map
        (array '--icon-name-start' name)
      }}
    >
      <figcaption>{{name}}</figcaption>
    </figure>
  </li>
{{/let}}
{{/if}}
{{/each-in}}
</ul>
```