feat: establish shared field and form foundation
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
/* Adapted from HeroUI v3, ce90ea3. Copyright 2025 NextUI Inc.
|
||||
* See third-party/HEROUI-LICENSE. Modified: hv- namespace. */
|
||||
/* Field error styles */
|
||||
.hv-field-error {
|
||||
@apply h-0 px-1 text-xs wrap-break-word text-danger opacity-0 data-visible:h-auto data-visible:opacity-100;
|
||||
|
||||
/**
|
||||
* Transitions
|
||||
* CRITICAL: motion-reduce must be AFTER transition for correct override specificity
|
||||
*/
|
||||
transition:
|
||||
opacity 150ms var(--ease-out),
|
||||
height 350ms var(--ease-smooth);
|
||||
@apply motion-reduce:transition-none;
|
||||
}
|
||||
|
||||
/*
|
||||
* Toggle fields (checkbox/switch): stack below the label like description.
|
||||
* Disable collapsible height/opacity — those styles break flex-col content layout.
|
||||
*/
|
||||
.hv-checkbox > .hv-field-error,
|
||||
.hv-checkbox > [data-slot="field-error"],
|
||||
.hv-switch > .hv-field-error,
|
||||
.hv-switch > [data-slot="field-error"],
|
||||
.hv-radio > .hv-field-error,
|
||||
.hv-radio > [data-slot="field-error"] {
|
||||
@apply m-0 h-auto min-h-0 p-0 text-muted opacity-100;
|
||||
transition: none;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/* Adapted from HeroUI v3, ce90ea3. Copyright 2025 NextUI Inc.
|
||||
* See third-party/HEROUI-LICENSE. Modified: hv- namespace. */
|
||||
/* Text field styles */
|
||||
/* use textfield instead of text-field to avoid conflict with Tailwind `text-` prefix */
|
||||
.hv-textfield {
|
||||
@apply flex flex-col gap-1;
|
||||
|
||||
&[data-invalid="true"],
|
||||
&[aria-invalid="true"] {
|
||||
[data-slot="description"] {
|
||||
@apply hidden;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Full width modifier */
|
||||
.hv-textfield--full-width {
|
||||
@apply w-full;
|
||||
|
||||
/* Automatically make Input full width when TextField is full width */
|
||||
[data-slot="input"],
|
||||
[data-slot="textarea"] {
|
||||
@apply w-full;
|
||||
}
|
||||
}
|
||||
@@ -56,3 +56,6 @@
|
||||
font-size: var(--text-xs);
|
||||
}
|
||||
}
|
||||
|
||||
@import "./components/textfield.css";
|
||||
@import "./components/field-error.css";
|
||||
|
||||
Reference in New Issue
Block a user