refactor: migrate legacy wire namespace to wrn
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
import ComponentBaseStyles from "../styles/ComponentBaseStyles.wrn"
|
||||
|
||||
component Alert {
|
||||
outputs {
|
||||
dismiss(payload: { sourceEvent?: Event; [key: string]: string | number | boolean | null | object })
|
||||
@@ -78,10 +76,10 @@ component Alert {
|
||||
aria-hidden="{visible ? 'false' : 'true'}"
|
||||
role="{role}"
|
||||
aria-live="{live}"
|
||||
class="wire-component wire-component--color-{color} wire-component--size-{size} wire-next--alert wire-next--alert-{variant} {compact ? 'wire-next--alert-compact' : ''} {class}"
|
||||
class="wrn-component wrn-component--color-{color} wrn-component--size-{size} wrn-next--alert wrn-next--alert-{variant} {compact ? 'wrn-next--alert-compact' : ''} {class}"
|
||||
>
|
||||
{#if showIcon}
|
||||
<span class="wire-next__alert-icon" aria-hidden="true">
|
||||
<span class="wrn-next__alert-icon" aria-hidden="true">
|
||||
{#if icon}
|
||||
<span class="{icon}"></span>
|
||||
{:else if color === "success"}
|
||||
@@ -96,8 +94,8 @@ component Alert {
|
||||
</span>
|
||||
{/if}
|
||||
|
||||
<div class="wire-next__alert-body">
|
||||
{#if title}<strong class="wire-next__alert-title">{title}</strong>{/if}
|
||||
<div class="wrn-next__alert-body">
|
||||
{#if title}<strong class="wrn-next__alert-title">{title}</strong>{/if}
|
||||
{#if description}<p>{description}</p>{/if}
|
||||
|
||||
{#if items.length > 0}
|
||||
@@ -107,7 +105,7 @@ component Alert {
|
||||
{/if}
|
||||
|
||||
{#if actions.length > 0 || actionLabel || linkLabel}
|
||||
<div class="wire-next__alert-actions">
|
||||
<div class="wrn-next__alert-actions">
|
||||
{#each actions as item}
|
||||
<a
|
||||
href="{item.href || '#'}"
|
||||
@@ -136,7 +134,7 @@ component Alert {
|
||||
{#if dismissible}
|
||||
<button
|
||||
type="button"
|
||||
class="wire-next__alert-dismiss"
|
||||
class="wrn-next__alert-dismiss"
|
||||
aria-label="{dismissLabel}"
|
||||
@click="dismissAlert(event)"
|
||||
>
|
||||
@@ -144,253 +142,321 @@ component Alert {
|
||||
</button>
|
||||
{/if}
|
||||
</section>
|
||||
<ComponentBaseStyles hidden />
|
||||
}
|
||||
|
||||
style {
|
||||
.wire-next--alert-soft {
|
||||
border-color: color-mix(in srgb, var(--wire-alert-color) 45%, var(--wire-color-border));
|
||||
background: var(--wire-alert-soft);
|
||||
.wrn-next--alert-soft {
|
||||
border-color: color-mix(in srgb, var(--wrn-alert-color) 45%, var(--wrn-color-border));
|
||||
background: var(--wrn-alert-soft);
|
||||
}
|
||||
.wire-next--alert-soft .wire-next__alert-title,
|
||||
.wire-next--alert-soft .wire-next__alert-icon,
|
||||
.wire-next--alert-soft .wire-next__alert-actions a {
|
||||
color: var(--wire-alert-color);
|
||||
.wrn-next--alert-soft .wrn-next__alert-title,
|
||||
.wrn-next--alert-soft .wrn-next__alert-icon,
|
||||
.wrn-next--alert-soft .wrn-next__alert-actions a {
|
||||
color: var(--wrn-alert-color);
|
||||
}
|
||||
.wire-next--alert-solid {
|
||||
border-color: var(--wire-alert-color);
|
||||
background: var(--wire-alert-color);
|
||||
.wrn-next--alert-solid {
|
||||
border-color: var(--wrn-alert-color);
|
||||
background: var(--wrn-alert-color);
|
||||
color: white;
|
||||
}
|
||||
.wire-next--alert.wire-next--alert-solid
|
||||
.wrn-next--alert.wrn-next--alert-solid
|
||||
:is(
|
||||
.wire-next__alert-title,
|
||||
.wire-next__alert-body > p,
|
||||
.wire-next__alert-body li,
|
||||
.wire-next__alert-actions a,
|
||||
.wire-next__alert-icon
|
||||
.wrn-next__alert-title,
|
||||
.wrn-next__alert-body > p,
|
||||
.wrn-next__alert-body li,
|
||||
.wrn-next__alert-actions a,
|
||||
.wrn-next__alert-icon
|
||||
) {
|
||||
color: currentColor;
|
||||
}
|
||||
.wire-next--alert-solid[data-color="light"] {
|
||||
.wrn-next--alert-solid[data-color="light"] {
|
||||
color: #18181b;
|
||||
}
|
||||
.wire-next--alert-solid[data-color="warning"] {
|
||||
.wrn-next--alert-solid[data-color="warning"] {
|
||||
color: #18181b;
|
||||
}
|
||||
.wire-next--alert-bordered {
|
||||
border-color: var(--wire-alert-color);
|
||||
background: var(--wire-color-surface);
|
||||
.wrn-next--alert-bordered {
|
||||
border-color: var(--wrn-alert-color);
|
||||
background: var(--wrn-color-surface);
|
||||
}
|
||||
.wire-next--alert-bordered .wire-next__alert-title,
|
||||
.wire-next--alert-bordered .wire-next__alert-icon,
|
||||
.wire-next--alert-bordered .wire-next__alert-actions a {
|
||||
color: var(--wire-alert-color);
|
||||
.wrn-next--alert-bordered .wrn-next__alert-title,
|
||||
.wrn-next--alert-bordered .wrn-next__alert-icon,
|
||||
.wrn-next--alert-bordered .wrn-next__alert-actions a {
|
||||
color: var(--wrn-alert-color);
|
||||
}
|
||||
.wire-next--alert-accent {
|
||||
border-color: color-mix(in srgb, var(--wire-alert-color) 35%, var(--wire-color-border));
|
||||
border-left: 4px solid var(--wire-alert-color);
|
||||
background: var(--wire-alert-soft);
|
||||
.wrn-next--alert-accent {
|
||||
border-color: color-mix(in srgb, var(--wrn-alert-color) 35%, var(--wrn-color-border));
|
||||
border-left: 4px solid var(--wrn-alert-color);
|
||||
background: var(--wrn-alert-soft);
|
||||
}
|
||||
.wire-next--alert-accent .wire-next__alert-title,
|
||||
.wire-next--alert-accent .wire-next__alert-icon,
|
||||
.wire-next--alert-accent .wire-next__alert-actions a {
|
||||
color: var(--wire-alert-color);
|
||||
.wrn-next--alert-accent .wrn-next__alert-title,
|
||||
.wrn-next--alert-accent .wrn-next__alert-icon,
|
||||
.wrn-next--alert-accent .wrn-next__alert-actions a {
|
||||
color: var(--wrn-alert-color);
|
||||
}
|
||||
|
||||
.wire-next--alert {
|
||||
--wire-alert-color: var(--wire-component-color);
|
||||
--wire-alert-soft: color-mix(in srgb, var(--wire-alert-color) 16%, var(--wire-color-surface));
|
||||
.wrn-next--alert {
|
||||
--wrn-alert-color: var(--wrn-component-color);
|
||||
--wrn-alert-soft: color-mix(in srgb, var(--wrn-alert-color) 16%, var(--wrn-color-surface));
|
||||
display: grid;
|
||||
grid-template-columns: auto minmax(0, 1fr) auto;
|
||||
gap: 0.8rem;
|
||||
width: 100%;
|
||||
padding: 1rem;
|
||||
border: 1px solid transparent;
|
||||
border-radius: var(--wire-radius, 0.75rem);
|
||||
color: var(--wire-color-text);
|
||||
border-radius: var(--wrn-radius, 0.75rem);
|
||||
color: var(--wrn-color-text);
|
||||
}
|
||||
|
||||
.wire-next--alert[data-radius="none"] {
|
||||
.wrn-next--alert[data-radius="none"] {
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
.wire-next--alert[data-radius="sm"] {
|
||||
border-radius: var(--wire-radius-sm, 0.375rem);
|
||||
.wrn-next--alert[data-radius="sm"] {
|
||||
border-radius: var(--wrn-radius-sm, 0.375rem);
|
||||
}
|
||||
|
||||
.wire-next--alert[data-radius="lg"] {
|
||||
border-radius: calc(var(--wire-radius, 0.75rem) * 1.35);
|
||||
.wrn-next--alert[data-radius="lg"] {
|
||||
border-radius: calc(var(--wrn-radius, 0.75rem) * 1.35);
|
||||
}
|
||||
|
||||
.wire-next--alert[data-radius="xl"] {
|
||||
border-radius: calc(var(--wire-radius, 0.75rem) * 1.75);
|
||||
.wrn-next--alert[data-radius="xl"] {
|
||||
border-radius: calc(var(--wrn-radius, 0.75rem) * 1.75);
|
||||
}
|
||||
|
||||
.wire-next--alert[data-shadow="none"] {
|
||||
.wrn-next--alert[data-shadow="none"] {
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.wire-next--alert[data-shadow="sm"] {
|
||||
.wrn-next--alert[data-shadow="sm"] {
|
||||
box-shadow: 0 6px 16px color-mix(in srgb, #000 14%, transparent);
|
||||
}
|
||||
|
||||
.wire-next--alert[data-shadow="md"] {
|
||||
.wrn-next--alert[data-shadow="md"] {
|
||||
box-shadow:
|
||||
0 2px 6px color-mix(in srgb, #000 10%, transparent),
|
||||
0 12px 28px color-mix(in srgb, #000 18%, transparent);
|
||||
}
|
||||
|
||||
.wire-next--alert[data-shadow="lg"] {
|
||||
.wrn-next--alert[data-shadow="lg"] {
|
||||
box-shadow:
|
||||
0 4px 10px color-mix(in srgb, #000 12%, transparent),
|
||||
0 20px 48px color-mix(in srgb, #000 24%, transparent);
|
||||
}
|
||||
|
||||
.wire-next--alert[data-color="secondary"] {
|
||||
--wire-alert-color: #737373;
|
||||
.wrn-next--alert[data-color="secondary"] {
|
||||
--wrn-alert-color: #737373;
|
||||
}
|
||||
|
||||
.wire-next--alert[data-color="success"] {
|
||||
--wire-alert-color: #0f9f8f;
|
||||
.wrn-next--alert[data-color="success"] {
|
||||
--wrn-alert-color: #0f9f8f;
|
||||
}
|
||||
|
||||
.wire-next--alert[data-color="danger"] {
|
||||
--wire-alert-color: #dc3545;
|
||||
.wrn-next--alert[data-color="danger"] {
|
||||
--wrn-alert-color: #dc3545;
|
||||
}
|
||||
|
||||
.wire-next--alert[data-color="warning"] {
|
||||
--wire-alert-color: #eab308;
|
||||
.wrn-next--alert[data-color="warning"] {
|
||||
--wrn-alert-color: #eab308;
|
||||
}
|
||||
|
||||
.wire-next--alert[data-color="info"] {
|
||||
--wire-alert-color: #2563eb;
|
||||
.wrn-next--alert[data-color="info"] {
|
||||
--wrn-alert-color: #2563eb;
|
||||
}
|
||||
|
||||
.wire-next--alert[data-color="dark"] {
|
||||
--wire-alert-color: #27272a;
|
||||
.wrn-next--alert[data-color="dark"] {
|
||||
--wrn-alert-color: #27272a;
|
||||
}
|
||||
|
||||
.wire-next--alert[data-color="light"] {
|
||||
--wire-alert-color: #f4f4f5;
|
||||
.wrn-next--alert[data-color="light"] {
|
||||
--wrn-alert-color: #f4f4f5;
|
||||
}
|
||||
|
||||
.wire-next--alert-compact {
|
||||
.wrn-next--alert-compact {
|
||||
padding: 0.75rem 0.9rem;
|
||||
}
|
||||
|
||||
.wire-next--alert-compact:not(:has(.wire-next__alert-icon)):not(:has(.wire-next__alert-dismiss)) {
|
||||
.wrn-next--alert-compact:not(:has(.wrn-next__alert-icon)):not(:has(.wrn-next__alert-dismiss)) {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
}
|
||||
|
||||
.wire-next--alert-compact .wire-next__alert-body {
|
||||
.wrn-next--alert-compact .wrn-next__alert-body {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.wire-next--alert-compact .wire-next__alert-title {
|
||||
.wrn-next--alert-compact .wrn-next__alert-title {
|
||||
margin-right: 0.25rem;
|
||||
}
|
||||
|
||||
.wire-next--alert-compact .wire-next__alert-body > p {
|
||||
.wrn-next--alert-compact .wrn-next__alert-body > p {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
.wire-next__alert-icon {
|
||||
.wrn-next__alert-icon {
|
||||
display: inline-grid;
|
||||
width: 1.25rem;
|
||||
height: 1.25rem;
|
||||
place-items: center;
|
||||
margin-top: 0.05rem;
|
||||
color: var(--wire-alert-color);
|
||||
color: var(--wrn-alert-color);
|
||||
}
|
||||
|
||||
.wire-next__alert-icon > span {
|
||||
.wrn-next__alert-icon > span {
|
||||
width: 1rem;
|
||||
height: 1rem;
|
||||
}
|
||||
|
||||
.wire-next__alert-body {
|
||||
.wrn-next__alert-body {
|
||||
display: grid;
|
||||
min-width: 0;
|
||||
gap: 0.35rem;
|
||||
}
|
||||
|
||||
.wire-next__alert-title {
|
||||
.wrn-next__alert-title {
|
||||
font-size: 0.88rem;
|
||||
line-height: 1.45;
|
||||
}
|
||||
|
||||
.wire-next__alert-body > p,
|
||||
.wire-next__alert-body li {
|
||||
.wrn-next__alert-body > p,
|
||||
.wrn-next__alert-body li {
|
||||
color: inherit;
|
||||
font-size: 0.8rem;
|
||||
line-height: 1.55;
|
||||
}
|
||||
|
||||
.wire-next__alert-body > ul {
|
||||
.wrn-next__alert-body > ul {
|
||||
display: grid;
|
||||
gap: 0.25rem;
|
||||
margin: 0.15rem 0 0;
|
||||
padding-left: 1.25rem;
|
||||
}
|
||||
|
||||
.wire-next__alert-actions {
|
||||
.wrn-next__alert-actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.5rem 1rem;
|
||||
margin-top: 0.35rem;
|
||||
}
|
||||
|
||||
.wire-next__alert-actions a {
|
||||
color: var(--wire-alert-color);
|
||||
.wrn-next__alert-actions a {
|
||||
color: var(--wrn-alert-color);
|
||||
font-size: 0.78rem;
|
||||
font-weight: 700;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.wire-next__alert-actions a:hover {
|
||||
.wrn-next__alert-actions a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.wire-next__alert-actions a[data-variant="action"] {
|
||||
.wrn-next__alert-actions a[data-variant="action"] {
|
||||
padding: 0.35rem 0.6rem;
|
||||
border-radius: var(--wire-radius-sm);
|
||||
background: var(--wire-alert-color);
|
||||
border-radius: var(--wrn-radius-sm);
|
||||
background: var(--wrn-alert-color);
|
||||
color: white;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.wire-next__alert-dismiss {
|
||||
.wrn-next__alert-dismiss {
|
||||
display: inline-grid;
|
||||
width: 1.75rem;
|
||||
height: 1.75rem;
|
||||
place-items: center;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
border-radius: var(--wire-radius-sm);
|
||||
border-radius: var(--wrn-radius-sm);
|
||||
background: transparent;
|
||||
color: currentColor;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.wire-next__alert-dismiss:hover {
|
||||
.wrn-next__alert-dismiss:hover {
|
||||
background: color-mix(in srgb, currentColor 10%, transparent);
|
||||
}
|
||||
|
||||
.wire-next__alert-dismiss:focus-visible {
|
||||
.wrn-next__alert-dismiss:focus-visible {
|
||||
outline: 2px solid currentColor;
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
@media (max-width: 36rem) {
|
||||
.wire-next--alert {
|
||||
.wrn-next--alert {
|
||||
grid-template-columns: auto minmax(0, 1fr);
|
||||
}
|
||||
.wire-next__alert-dismiss {
|
||||
.wrn-next__alert-dismiss {
|
||||
grid-column: 2;
|
||||
grid-row: 1;
|
||||
justify-self: end;
|
||||
}
|
||||
}
|
||||
|
||||
/* Shared component foundation. */
|
||||
|
||||
.wrn-component {
|
||||
--wrn-component-color: var(--wrn-color-primary);
|
||||
--wrn-component-scale: 1;
|
||||
margin: 0;
|
||||
color: var(--wrn-color-text);
|
||||
font-family: var(--wrn-font-sans, inherit);
|
||||
}
|
||||
|
||||
.wrn-component--color-primary {
|
||||
--wrn-component-color: var(--wrn-color-primary);
|
||||
}
|
||||
|
||||
.wrn-component--color-secondary {
|
||||
--wrn-component-color: var(--wrn-color-secondary);
|
||||
}
|
||||
|
||||
.wrn-component--color-success {
|
||||
--wrn-component-color: var(--wrn-color-success);
|
||||
}
|
||||
|
||||
.wrn-component--color-warning {
|
||||
--wrn-component-color: var(--wrn-color-warning);
|
||||
}
|
||||
|
||||
.wrn-component--color-danger {
|
||||
--wrn-component-color: var(--wrn-color-danger);
|
||||
}
|
||||
|
||||
.wrn-component--color-info {
|
||||
--wrn-component-color: var(--wrn-color-info);
|
||||
}
|
||||
|
||||
.wrn-component--size-xs {
|
||||
--wrn-component-scale: 0.78;
|
||||
}
|
||||
|
||||
.wrn-component--size-sm {
|
||||
--wrn-component-scale: 0.88;
|
||||
}
|
||||
|
||||
.wrn-component--size-default,
|
||||
.wrn-component--size-md {
|
||||
--wrn-component-scale: 1;
|
||||
}
|
||||
|
||||
.wrn-component--size-lg {
|
||||
--wrn-component-scale: 1.14;
|
||||
}
|
||||
|
||||
.wrn-component--size-xl {
|
||||
--wrn-component-scale: 1.28;
|
||||
}
|
||||
|
||||
.wrn-component:not(.wrn-btn) {
|
||||
font-size: calc(1em * var(--wrn-component-scale));
|
||||
}
|
||||
|
||||
.wrn-component :is(a, button, input, select, textarea):focus-visible {
|
||||
outline-color: var(--wrn-component-color);
|
||||
}
|
||||
|
||||
.wrn-component p {
|
||||
margin: 0;
|
||||
color: var(--wrn-color-muted);
|
||||
line-height: 1.6;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user