Files
WRNexusJS/packages/ui/components/SearchBox.wrn
T
ClintchizandClaude Opus 5.5 1bed8e4b74 feat(ui): component redesign pass and fixes, release ui 0.8.87
Redesign
- Shared field foundation rules (duplicated across 15 form components and
  emitted globally) are now identical everywhere, so later copies no longer
  silently override earlier redesigns.
- Drawn checkbox and radio controls, white switch thumbs (the thumb was the
  text colour, a black blob in light mode), recessed field wells, keycap
  actions in Modal, Drawer, Popover, Toaster, Pagination, Stepper, DataTable.
- Menus (Dropdown, ContextMenu, Popover, Select dropdown, Navbar panels) share
  one flat raised panel with neutral hover rows and mono section labels.
- Alerts with an accent rail and icon chip; card headers without the grey
  band; accordion, collapse, list, list group, timeline, stats, metrics,
  chat, skeleton, avatar group, clipboard, splitter, section, sidebar,
  navbar and upload progress restyled.
- Chart rebuilt: nice y-axis ticks, gridlines, rounded bars, line and area
  modes, hover tooltips, hidden series leave the scale.

Fixes
- Checkbox and radio labels toggle their input again (empty for="" broke it).
- TimePicker kept every clicked time pressed; only the chosen hour and
  minute are pressed now, and nothing is pressed before a value exists.
- ColorPicker hex readout now follows the picked colour.
- Disabled FileInput no longer shows the native file-input text.
- Date and time panels float instead of pushing content.
- ContextMenu opened at the pointer closes on scroll.
- Drawer left/top/bottom placements slide from their own edge again.
- Image-only Card no longer renders an empty body strip.
- Timeline supports item.time, current/upcoming states, sizes and
  compact/alternate variants; showcase demos use distinct variants.
- ChatBubble: delivery receipts (sending/sent/delivered/read/failed/error)
  and meta aligned to its bubble.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-30 16:18:13 +05:30

169 lines
5.5 KiB
Plaintext

component SearchBox {
outputs {
search(payload: { sourceEvent?: Event; [key: string]: string | number | boolean | null | object })
clear(payload: { sourceEvent?: Event; [key: string]: string | number | boolean | null | object })
}
props {
size: string = "default"
color: string = "primary"
label: string = "Search Box"
name: string = ""
value: string = ""
placeholder: string = ""
type: string = "search"
min: string = ""
max: string = ""
step: string = ""
disabled: boolean = false
required: boolean = false
class: string = ""
}
state query = value
view {
<form
data-ui-component="SearchBox"
role="search"
class='wrn-search-box {class}'
@submit='event.preventDefault(); output.search({ value: query, name: name })'
>
<label
class="wrn-search-box__label"
data-hidden='{label === "" ? "true" : "false"}'
>
{label}
</label>
<div class="wrn-search-box__control">
<span
class="icon-[lucide--search] wrn-search-box__search-icon"
aria-hidden="true"
></span>
<input
name='{name}'
type='{type}'
value='{query}'
placeholder='{placeholder}'
min='{min}'
max='{max}'
step='{step}'
disabled='{disabled}'
required='{required}'
autocomplete="off"
class="wrn-search-box__input"
data-size='{size}'
@input='query = event.target.value'
@change='query = event.target.value'
/>
<button
type="button"
aria-label="Clear search"
data-show='query.length > 0 && !disabled'
class="wrn-search-box__button wrn-search-box__clear"
@click='query = ""; event.currentTarget.parentElement.querySelector("input")?.focus(); output.clear({ value: "", name: name })'
>
<span class="icon-[lucide--x] wrn-search-box__button-icon" aria-hidden="true"></span>
</button>
<button
type="submit"
aria-label='{label || "Search"}'
disabled='{disabled}'
class="wrn-search-box__button wrn-search-box__submit"
>
<span class="icon-[lucide--arrow-right] wrn-search-box__button-icon" aria-hidden="true"></span>
</button>
</div>
</form>
}
style {
input[type="search"]::-webkit-search-cancel-button { -webkit-appearance:none; appearance:none; }
.wrn-search-box { width: 100%; }
.wrn-search-box__label {
display: block;
margin-bottom: 0.4rem;
color: var(--wrn-color-text);
font-size: 0.8125rem;
font-weight: 600;
}
.wrn-search-box__label[data-hidden="true"] {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border: 0;
}
.wrn-search-box__control { position: relative; display: flex; align-items: center; }
.wrn-search-box__search-icon {
position: absolute;
left: 0.875rem;
width: 1.125rem;
height: 1.125rem;
color: var(--wrn-color-input-placeholder);
pointer-events: none;
}
.wrn-search-box__input {
width: 100%;
height: 2.75rem;
padding: 0 5.5rem 0 2.5rem;
border: 1px solid var(--wrn-color-input-border);
border-radius: var(--wrn-radius-sm);
outline: none;
color: var(--wrn-color-input-text);
background: var(--wrn-color-input-background);
box-shadow: inset 0 1px 2px rgb(0 0 0 / 0.04);
font: inherit;
font-size: 0.875rem;
transition: border-color var(--wrn-motion-base), box-shadow var(--wrn-motion-base);
}
.wrn-search-box__input[data-size="sm"] { height: 2.5rem; }
.wrn-search-box__input[data-size="lg"] { height: 3.5rem; }
.wrn-search-box__input::placeholder { color: var(--wrn-color-input-placeholder); }
.wrn-search-box__input:hover { border-color: var(--wrn-color-input-border-hover); }
.wrn-search-box__input:focus {
border-color: var(--wrn-color-input-border-focus);
box-shadow: 0 0 0 3px color-mix(in srgb, var(--wrn-color-focus) 18%, transparent);
}
.wrn-search-box__input:disabled, .wrn-search-box__button:disabled { cursor: not-allowed; opacity: 0.6; }
.wrn-search-box__button {
position: absolute;
display: inline-flex;
align-items: center;
justify-content: center;
padding: 0;
border: 0;
border-radius: var(--wrn-radius-sm);
transition: color var(--wrn-motion-base), background var(--wrn-motion-base);
}
.wrn-search-box__clear {
right: 2.75rem;
width: 1.75rem;
height: 1.75rem;
color: var(--wrn-color-text-muted);
background: transparent;
}
.wrn-search-box__clear:hover { color: var(--wrn-color-text); background: var(--wrn-color-surface-soft); }
.wrn-search-box__submit {
right: 0.375rem;
width: 2rem;
height: 2rem;
color: var(--wrn-color-on-primary);
background: linear-gradient(180deg, color-mix(in srgb, var(--wrn-color-primary) 92%, white), var(--wrn-color-primary));
border: 1px solid color-mix(in srgb, var(--wrn-color-primary) 82%, black) !important;
box-shadow: var(--wrn-highlight-edge, none);
}
.wrn-search-box__submit:hover { background: var(--wrn-color-primary-hover); }
.wrn-search-box__button:focus-visible { outline: 2px solid var(--wrn-color-focus); outline-offset: 2px; }
.wrn-search-box__button-icon { width: 1rem; height: 1rem; }
}
}