refactor: migrate legacy wire namespace to wrn
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
import ComponentBaseStyles from "../styles/ComponentBaseStyles.wrn"
|
||||
|
||||
component Badge {
|
||||
outputs {
|
||||
dismiss(payload: { sourceEvent?: Event; [key: string]: string | number | boolean | null | object })
|
||||
@@ -50,62 +48,61 @@ component Badge {
|
||||
view {
|
||||
<span
|
||||
{...attrs}
|
||||
class="wire-component wire-next--badge-root {anchorLabel || anchorIcon ? 'wire-next--badge-anchored' : ''} {class}"
|
||||
class="wrn-component wrn-next--badge-root {anchorLabel || anchorIcon ? 'wrn-next--badge-anchored' : ''} {class}"
|
||||
data-wrn-badge
|
||||
data-placement="{placement}"
|
||||
data-show="visible"
|
||||
aria-hidden="{visible ? 'false' : 'true'}"
|
||||
>
|
||||
{#if anchorLabel || anchorIcon}
|
||||
<button type="button" class="wire-next__badge-anchor" aria-label="{anchorLabelText}">
|
||||
<button type="button" class="wrn-next__badge-anchor" aria-label="{anchorLabelText}">
|
||||
{#if anchorIcon}<span class="{anchorIcon}" aria-hidden="true"></span>{/if}
|
||||
{#if anchorLabel}<span>{anchorLabel}</span>{/if}
|
||||
</button>
|
||||
{/if}
|
||||
|
||||
<span
|
||||
class="wire-next__badge"
|
||||
class="wrn-next__badge"
|
||||
data-size="{size}"
|
||||
data-color="{color}"
|
||||
data-variant="{variant}"
|
||||
data-shape="{shape}"
|
||||
data-animated="{animated ? 'true' : 'false'}"
|
||||
style="--wire-badge-max-width:{maxWidth}"
|
||||
style="--wrn-badge-max-width:{maxWidth}"
|
||||
role="{dotOnly ? 'status' : ''}"
|
||||
aria-label="{dotOnly ? dotLabel : ''}"
|
||||
>
|
||||
{#if animated}
|
||||
<span class="wire-next__badge-ping" aria-hidden="true"></span>
|
||||
<span class="wrn-next__badge-ping" aria-hidden="true"></span>
|
||||
{/if}
|
||||
{#if avatarSrc}
|
||||
<img class="wire-next__badge-avatar" src="{avatarSrc}" alt="{avatarAlt}" loading="lazy" />
|
||||
<img class="wrn-next__badge-avatar" src="{avatarSrc}" alt="{avatarAlt}" loading="lazy" />
|
||||
{/if}
|
||||
{#if dot || dotOnly}
|
||||
<span class="wire-next__badge-dot" aria-hidden="true"></span>
|
||||
<span class="wrn-next__badge-dot" aria-hidden="true"></span>
|
||||
{/if}
|
||||
{#if icon && iconPosition === "start"}
|
||||
<span class="wire-next__badge-icon {icon}" aria-hidden="true"></span>
|
||||
<span class="wrn-next__badge-icon {icon}" aria-hidden="true"></span>
|
||||
{/if}
|
||||
{#if !dotOnly}
|
||||
<span class="wire-next__badge-label {truncate ? 'wire-next__badge-label--truncate' : ''}">
|
||||
<span class="wrn-next__badge-label {truncate ? 'wrn-next__badge-label--truncate' : ''}">
|
||||
{label}
|
||||
</span>
|
||||
{/if}
|
||||
{#if icon && iconPosition === "end"}
|
||||
<span class="wire-next__badge-icon {icon}" aria-hidden="true"></span>
|
||||
<span class="wrn-next__badge-icon {icon}" aria-hidden="true"></span>
|
||||
{/if}
|
||||
{#if dismissible}
|
||||
<button type="button" class="wire-next__badge-dismiss" aria-label="{dismissLabel}" @click="dismissBadge(event)">
|
||||
<button type="button" class="wrn-next__badge-dismiss" aria-label="{dismissLabel}" @click="dismissBadge(event)">
|
||||
<span class="icon-[lucide--x]" aria-hidden="true"></span>
|
||||
</button>
|
||||
{/if}
|
||||
</span>
|
||||
</span>
|
||||
<ComponentBaseStyles hidden />
|
||||
}
|
||||
|
||||
style {
|
||||
@keyframes wire-badge-ping {
|
||||
@keyframes wrn-badge-ping {
|
||||
75%,
|
||||
100% {
|
||||
opacity: 0;
|
||||
@@ -114,7 +111,7 @@ component Badge {
|
||||
}
|
||||
|
||||
/* --- Badge --------------------------------------------------------------- */
|
||||
.wire-next--badge-root {
|
||||
.wrn-next--badge-root {
|
||||
position: relative;
|
||||
display: inline-flex;
|
||||
width: fit-content;
|
||||
@@ -122,8 +119,8 @@ component Badge {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.wire-next__badge {
|
||||
--wire-badge-color: var(--wire-color-primary);
|
||||
.wrn-next__badge {
|
||||
--wrn-badge-color: var(--wrn-color-primary);
|
||||
position: relative;
|
||||
isolation: isolate;
|
||||
display: inline-flex;
|
||||
@@ -132,108 +129,108 @@ component Badge {
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 0.35rem;
|
||||
max-width: var(--wire-badge-max-width);
|
||||
max-width: var(--wrn-badge-max-width);
|
||||
padding: 0.25rem 0.6rem;
|
||||
color: white;
|
||||
border: 1px solid var(--wire-badge-color);
|
||||
border: 1px solid var(--wrn-badge-color);
|
||||
border-radius: 999px;
|
||||
background: var(--wire-badge-color);
|
||||
box-shadow: 0 4px 12px color-mix(in srgb, var(--wire-badge-color) 18%, transparent);
|
||||
background: var(--wrn-badge-color);
|
||||
box-shadow: 0 4px 12px color-mix(in srgb, var(--wrn-badge-color) 18%, transparent);
|
||||
font-size: 0.75rem;
|
||||
font-weight: 750;
|
||||
line-height: 1;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.wire-next__badge[data-size="xs"] {
|
||||
.wrn-next__badge[data-size="xs"] {
|
||||
min-height: 1.25rem;
|
||||
padding: 0.15rem 0.4rem;
|
||||
font-size: 0.625rem;
|
||||
}
|
||||
|
||||
.wire-next__badge[data-size="sm"] {
|
||||
.wrn-next__badge[data-size="sm"] {
|
||||
min-height: 1.45rem;
|
||||
padding: 0.2rem 0.5rem;
|
||||
font-size: 0.6875rem;
|
||||
}
|
||||
|
||||
.wire-next__badge[data-size="lg"] {
|
||||
.wrn-next__badge[data-size="lg"] {
|
||||
min-height: 2rem;
|
||||
padding: 0.35rem 0.75rem;
|
||||
font-size: 0.825rem;
|
||||
}
|
||||
|
||||
.wire-next__badge[data-color="secondary"] {
|
||||
--wire-badge-color: #737373;
|
||||
.wrn-next__badge[data-color="secondary"] {
|
||||
--wrn-badge-color: #737373;
|
||||
}
|
||||
|
||||
.wire-next__badge[data-color="success"] {
|
||||
--wire-badge-color: #0f9f8f;
|
||||
.wrn-next__badge[data-color="success"] {
|
||||
--wrn-badge-color: #0f9f8f;
|
||||
}
|
||||
|
||||
.wire-next__badge[data-color="info"] {
|
||||
--wire-badge-color: #2563eb;
|
||||
.wrn-next__badge[data-color="info"] {
|
||||
--wrn-badge-color: #2563eb;
|
||||
}
|
||||
|
||||
.wire-next__badge[data-color="danger"] {
|
||||
--wire-badge-color: #ef3340;
|
||||
.wrn-next__badge[data-color="danger"] {
|
||||
--wrn-badge-color: #ef3340;
|
||||
}
|
||||
|
||||
.wire-next__badge[data-color="warning"] {
|
||||
--wire-badge-color: #eab308;
|
||||
.wrn-next__badge[data-color="warning"] {
|
||||
--wrn-badge-color: #eab308;
|
||||
}
|
||||
|
||||
.wire-next__badge[data-color="dark"] {
|
||||
--wire-badge-color: #27272a;
|
||||
.wrn-next__badge[data-color="dark"] {
|
||||
--wrn-badge-color: #27272a;
|
||||
}
|
||||
|
||||
.wire-next__badge[data-color="light"] {
|
||||
--wire-badge-color: #f4f4f5;
|
||||
.wrn-next__badge[data-color="light"] {
|
||||
--wrn-badge-color: #f4f4f5;
|
||||
}
|
||||
|
||||
.wire-next__badge[data-color="warning"][data-variant="solid"],
|
||||
.wire-next__badge[data-color="light"][data-variant="solid"] {
|
||||
.wrn-next__badge[data-color="warning"][data-variant="solid"],
|
||||
.wrn-next__badge[data-color="light"][data-variant="solid"] {
|
||||
color: #18181b;
|
||||
}
|
||||
|
||||
.wire-next__badge[data-variant="soft"] {
|
||||
color: var(--wire-badge-color);
|
||||
.wrn-next__badge[data-variant="soft"] {
|
||||
color: var(--wrn-badge-color);
|
||||
border-color: transparent;
|
||||
background: color-mix(in srgb, var(--wire-badge-color) 15%, var(--wire-color-surface));
|
||||
background: color-mix(in srgb, var(--wrn-badge-color) 15%, var(--wrn-color-surface));
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.wire-next__badge[data-variant="outline"] {
|
||||
color: var(--wire-badge-color);
|
||||
.wrn-next__badge[data-variant="outline"] {
|
||||
color: var(--wrn-badge-color);
|
||||
background: transparent;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.wire-next__badge[data-variant="white"] {
|
||||
color: var(--wire-color-text);
|
||||
border-color: var(--wire-color-border);
|
||||
background: var(--wire-color-surface);
|
||||
.wrn-next__badge[data-variant="white"] {
|
||||
color: var(--wrn-color-text);
|
||||
border-color: var(--wrn-color-border);
|
||||
background: var(--wrn-color-surface);
|
||||
box-shadow: 0 4px 12px rgb(0 0 0 / 0.12);
|
||||
}
|
||||
|
||||
.wire-next__badge[data-shape="rounded"] {
|
||||
.wrn-next__badge[data-shape="rounded"] {
|
||||
border-radius: 0.4rem;
|
||||
}
|
||||
|
||||
.wire-next__badge[data-shape="square"] {
|
||||
.wrn-next__badge[data-shape="square"] {
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
.wire-next__badge-label {
|
||||
.wrn-next__badge-label {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.wire-next__badge-label--truncate {
|
||||
.wrn-next__badge-label--truncate {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.wire-next__badge-dot {
|
||||
.wrn-next__badge-dot {
|
||||
width: 0.42rem;
|
||||
height: 0.42rem;
|
||||
flex: none;
|
||||
@@ -241,28 +238,28 @@ component Badge {
|
||||
background: currentColor;
|
||||
}
|
||||
|
||||
.wire-next__badge:has(.wire-next__badge-dot):not(:has(.wire-next__badge-label)) {
|
||||
.wrn-next__badge:has(.wrn-next__badge-dot):not(:has(.wrn-next__badge-label)) {
|
||||
width: 0.7rem;
|
||||
min-width: 0.7rem;
|
||||
height: 0.7rem;
|
||||
min-height: 0.7rem;
|
||||
padding: 0;
|
||||
border: 2px solid var(--wire-color-bg);
|
||||
border: 2px solid var(--wrn-color-bg);
|
||||
}
|
||||
|
||||
.wire-next__badge:has(.wire-next__badge-dot):not(:has(.wire-next__badge-label))
|
||||
.wire-next__badge-dot {
|
||||
.wrn-next__badge:has(.wrn-next__badge-dot):not(:has(.wrn-next__badge-label))
|
||||
.wrn-next__badge-dot {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.wire-next__badge-icon {
|
||||
.wrn-next__badge-icon {
|
||||
width: 0.9rem;
|
||||
height: 0.9rem;
|
||||
flex: none;
|
||||
}
|
||||
|
||||
.wire-next__badge-avatar {
|
||||
.wrn-next__badge-avatar {
|
||||
width: 1.25rem;
|
||||
height: 1.25rem;
|
||||
margin-left: -0.35rem;
|
||||
@@ -271,7 +268,7 @@ component Badge {
|
||||
border-radius: 999px;
|
||||
}
|
||||
|
||||
.wire-next__badge-dismiss {
|
||||
.wrn-next__badge-dismiss {
|
||||
display: grid;
|
||||
width: 1.15rem;
|
||||
height: 1.15rem;
|
||||
@@ -285,70 +282,139 @@ component Badge {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.wire-next__badge-dismiss:hover {
|
||||
.wrn-next__badge-dismiss:hover {
|
||||
background: color-mix(in srgb, currentColor 22%, transparent);
|
||||
}
|
||||
|
||||
.wire-next__badge-dismiss:focus-visible {
|
||||
.wrn-next__badge-dismiss:focus-visible {
|
||||
outline: 2px solid currentColor;
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
.wire-next__badge-dismiss span {
|
||||
.wrn-next__badge-dismiss span {
|
||||
width: 0.75rem;
|
||||
height: 0.75rem;
|
||||
}
|
||||
|
||||
.wire-next__badge-anchor {
|
||||
.wrn-next__badge-anchor {
|
||||
display: inline-flex;
|
||||
min-height: 2.75rem;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 0.5rem;
|
||||
padding: 0.65rem 0.9rem;
|
||||
color: var(--wire-color-text);
|
||||
border: 1px solid var(--wire-color-border);
|
||||
color: var(--wrn-color-text);
|
||||
border: 1px solid var(--wrn-color-border);
|
||||
border-radius: 0.5rem;
|
||||
background: var(--wire-color-surface);
|
||||
background: var(--wrn-color-surface);
|
||||
font: inherit;
|
||||
font-size: 0.875rem;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.wire-next__badge-anchor > [class*="icon-"] {
|
||||
.wrn-next__badge-anchor > [class*="icon-"] {
|
||||
width: 1rem;
|
||||
height: 1rem;
|
||||
}
|
||||
|
||||
.wire-next--badge-anchored[data-placement="inline"] {
|
||||
.wrn-next--badge-anchored[data-placement="inline"] {
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.wire-next--badge-anchored[data-placement="inline"] .wire-next__badge {
|
||||
.wrn-next--badge-anchored[data-placement="inline"] .wrn-next__badge {
|
||||
margin-left: -0.55rem;
|
||||
}
|
||||
|
||||
.wire-next--badge-anchored[data-placement="top-right"] .wire-next__badge {
|
||||
.wrn-next--badge-anchored[data-placement="top-right"] .wrn-next__badge {
|
||||
position: absolute;
|
||||
top: -0.55rem;
|
||||
right: -0.75rem;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.wire-next__badge-ping {
|
||||
.wrn-next__badge-ping {
|
||||
position: absolute;
|
||||
z-index: -1;
|
||||
inset: -0.25rem;
|
||||
border-radius: inherit;
|
||||
background: var(--wire-badge-color);
|
||||
background: var(--wrn-badge-color);
|
||||
opacity: 0.5;
|
||||
animation: wire-badge-ping 1.4s cubic-bezier(0, 0, 0.2, 1) infinite;
|
||||
animation: wrn-badge-ping 1.4s cubic-bezier(0, 0, 0.2, 1) infinite;
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.wire-next__badge-ping {
|
||||
.wrn-next__badge-ping {
|
||||
animation: none;
|
||||
}
|
||||
}
|
||||
|
||||
/* 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