Add feedback, layout, button, and interaction utilities
This commit is contained in:
@@ -102,6 +102,19 @@ body.theme-blue {
|
||||
|
||||
`--frost-color-selection` and `--frost-color-overlay` are available for theme-specific selection and overlay colors. Frost's modal primitives provide visual structure only; opening, closing, focus management, and ARIA behavior remain application responsibilities.
|
||||
|
||||
Frost's tokens are semantic and intentionally overridable. Add an application theme by setting the roles on a wrapper or document root; component selectors do not need to be redefined:
|
||||
|
||||
```css
|
||||
[data-theme="ocean"] {
|
||||
--frost-color-bg: #071a2b;
|
||||
--frost-color-surface: #0d2a40;
|
||||
--frost-color-text: #e8f5ff;
|
||||
--frost-color-accent: #55b9ff;
|
||||
--frost-color-accent-hover: #8bd1ff;
|
||||
--frost-color-border: #24516b;
|
||||
}
|
||||
```
|
||||
|
||||
```html
|
||||
<div class="frost-backdrop" hidden></div>
|
||||
<section class="frost-modal" role="dialog" aria-modal="true" aria-labelledby="dialog-title" hidden>
|
||||
@@ -113,6 +126,44 @@ body.theme-blue {
|
||||
</section>
|
||||
```
|
||||
|
||||
## Menus, popovers, and feedback
|
||||
|
||||
Frost supplies visual primitives while application code owns state, positioning updates, and keyboard behavior. Use native buttons, `aria-expanded`, `aria-controls`, and `hidden` so the same markup works with vanilla JavaScript or a framework:
|
||||
|
||||
```html
|
||||
<div class="frost-dropdown">
|
||||
<button class="frost-button frost-button--secondary" aria-expanded="false" aria-controls="account-menu">Account</button>
|
||||
<div id="account-menu" class="frost-dropdown__menu" hidden>
|
||||
<a class="frost-dropdown__item" href="/profile">Profile</a>
|
||||
<button class="frost-dropdown__item" type="button">Sign out</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="frost-alert frost-alert--warning" role="alert">
|
||||
<strong class="frost-alert__title">Check your details</strong>
|
||||
<span class="frost-alert__body">Some fields need attention.</span>
|
||||
</div>
|
||||
|
||||
<div class="frost-toast-region" aria-live="polite" aria-atomic="true">
|
||||
<div class="frost-toast frost-toast--success" role="status">
|
||||
<span>Saved successfully.</span>
|
||||
<button class="frost-button frost-button--icon" aria-label="Dismiss">×</button>
|
||||
</div>
|
||||
</div>
|
||||
```
|
||||
|
||||
Tooltips use `data-frost-tooltip` and should supplement, never replace, an accessible label:
|
||||
|
||||
```html
|
||||
<button class="frost-button frost-button--icon frost-tooltip" data-frost-tooltip="Copy link" aria-label="Copy link">⧉</button>
|
||||
```
|
||||
|
||||
Modal, drawer, dropdown, and popover behavior is deliberately separate from CSS. A behavior layer should toggle `hidden`, synchronize `aria-expanded`, move focus into dialogs, return focus to the trigger, and close on Escape where appropriate. For modal dialogs, use `role="dialog" aria-modal="true"` and a labelled heading.
|
||||
|
||||
## Responsive utilities
|
||||
|
||||
`frost-cluster` is a wrapping flex row for actions, while `frost-hide-mobile`, `frost-show-mobile`, `frost-hide-desktop`, and `frost-responsive` cover common responsive composition needs. Layout components expose local properties such as `--frost-grid-min` and `--frost-cluster-gap` so applications can tune them without new framework classes.
|
||||
|
||||
## Customization
|
||||
|
||||
Override semantic tokens in the project layer:
|
||||
|
||||
Reference in New Issue
Block a user