Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(theme): sync with input theme on labelPlacement #4597

Open
wants to merge 3 commits into
base: canary
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/serious-sheep-camp.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@heroui/theme": patch
---

sync with input theme on labelPlacement (#4593)
6 changes: 3 additions & 3 deletions packages/components/select/stories/select.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ const MirrorTemplate = ({color, variant, ...args}: SelectProps) => (

const LabelPlacementTemplate = ({color, variant, ...args}: SelectProps) => (
<div className="w-full flex flex-col items-center gap-12">
<div className="w-full max-w-2xl flex flex-col gap-3">
<div className="w-full max-w-5xl flex flex-col gap-3">
<h3>Without placeholder</h3>
<div className="w-full flex flex-row items-end gap-4">
<Select color={color} label="Select an animal" variant={variant} {...args}>
Expand All @@ -411,7 +411,7 @@ const LabelPlacementTemplate = ({color, variant, ...args}: SelectProps) => (
</Select>
</div>
</div>
<div className="w-full max-w-2xl flex flex-col gap-3">
<div className="w-full max-w-5xl flex flex-col gap-3">
<h3>With placeholder</h3>
<div className="w-full flex flex-row items-end gap-4">
<Select
Expand Down Expand Up @@ -445,7 +445,7 @@ const LabelPlacementTemplate = ({color, variant, ...args}: SelectProps) => (
</Select>
</div>
</div>
<div className="w-full max-w-2xl flex flex-col gap-3">
<div className="w-full max-w-5xl flex flex-col gap-3">
<h3>With placeholder and description</h3>
<div className="w-full flex flex-row items-end gap-4">
<Select
Expand Down
27 changes: 25 additions & 2 deletions packages/core/theme/src/components/select.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const select = tv({
"absolute",
"z-10",
"origin-top-left",
"flex-shrink-0",
// Using RTL here as Tailwind CSS doesn't support `start` and `end` logical properties for transforms yet.
"rtl:origin-top-right",
"subpixel-antialiased",
Expand All @@ -29,7 +30,7 @@ const select = tv({
listboxWrapper: "scroll-py-6 w-full",
listbox: "",
popoverContent: "w-full p-1 overflow-hidden",
helperWrapper: "p-1 flex relative flex-col gap-1.5",
helperWrapper: "p-1 flex relative flex-col gap-1.5 group-data-[has-helper=true]:flex",
description: "text-tiny text-foreground-400",
errorMessage: "text-tiny text-danger",
},
Expand Down Expand Up @@ -143,7 +144,7 @@ const select = tv({
base: "flex flex-col",
},
"outside-left": {
base: "flex-row items-center flex-nowrap items-start",
base: "flex-row items-center flex-nowrap data-[has-helper=true]:items-start",
label: "relative pe-2 text-foreground",
},
inside: {
Expand Down Expand Up @@ -719,6 +720,28 @@ const select = tv({
base: "data-[has-label=true]:mt-[calc(theme(fontSize.small)_+_12px)]",
},
},
// outside-left & size & hasHelper
{
labelPlacement: "outside-left",
size: "sm",
class: {
label: "group-data-[has-helper=true]:pt-2",
},
},
{
labelPlacement: "outside-left",
size: "md",
class: {
label: "group-data-[has-helper=true]:pt-3",
},
},
{
labelPlacement: "outside-left",
size: "lg",
class: {
label: "group-data-[has-helper=true]:pt-4",
},
},
// isMultiline & labelPlacement="outside"
{
labelPlacement: "outside",
Expand Down
Loading