-
Notifications
You must be signed in to change notification settings - Fork 144
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #825 from thejackshelton/select-improvements
export select description
- Loading branch information
Showing
17 changed files
with
130 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
'@qwik-ui/headless': patch | ||
--- | ||
|
||
feat: new Select.ErrorMessage component | ||
|
||
feat: data-invalid attribute to style when the select is invalid | ||
|
||
feat: new Select.Description component |
33 changes: 33 additions & 0 deletions
33
apps/website/src/routes/docs/headless/select/examples/description.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { component$, useStyles$ } from '@builder.io/qwik'; | ||
import { Select } from '@qwik-ui/headless'; | ||
|
||
export default component$(() => { | ||
useStyles$(styles); | ||
const users = ['Tim', 'Ryan', 'Jim', 'Jessie', 'Abby']; | ||
|
||
return ( | ||
<Select.Root class="select"> | ||
<Select.Label>Logged in users</Select.Label> | ||
<Select.Trigger class="select-trigger"> | ||
<Select.DisplayValue placeholder="Select an option" /> | ||
</Select.Trigger> | ||
<Select.Description>Select a user to see their profile</Select.Description> | ||
<Select.Popover class="select-popover"> | ||
<Select.Listbox class="select-listbox"> | ||
{users.map((user) => ( | ||
<Select.Item class="select-item" key={user}> | ||
<Select.ItemLabel>{user}</Select.ItemLabel> | ||
<Select.ItemIndicator> | ||
<LuCheck /> | ||
</Select.ItemIndicator> | ||
</Select.Item> | ||
))} | ||
</Select.Listbox> | ||
</Select.Popover> | ||
</Select.Root> | ||
); | ||
}); | ||
|
||
// internal | ||
import styles from '../snippets/select.css?inline'; | ||
import { LuCheck } from '@qwikest/icons/lucide'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
export { HSelectRoot as Root } from './select-inline'; | ||
export { HSelectLabel as Label } from './select-label'; | ||
export { HSelectTrigger as Trigger } from './select-trigger'; | ||
export { HSelectDisplayText as DisplayValue } from './select-display-text'; | ||
export { HSelectDisplayValue as DisplayValue } from './select-display-value'; | ||
export { HSelectPopover as Popover } from './select-popover'; | ||
export { HSelectListbox as Listbox } from './select-listbox'; | ||
export { HSelectGroup as Group } from './select-group'; | ||
export { HSelectGroupLabel as GroupLabel } from './select-group-label'; | ||
export { HSelectItem as Item } from './select-item'; | ||
export { HSelectItemLabel as ItemLabel } from './select-item-label'; | ||
export { HSelectItemIndicator as ItemIndicator } from './select-item-indicator'; | ||
export { HSelectDescription as Description } from './select-description'; | ||
export { HHiddenNativeSelect as HiddenNativeSelect } from './hidden-select'; | ||
export { HSelectErrorMessage as ErrorMessage } from './select-error-message'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
packages/kit-headless/src/components/select/select-error-message.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { PropsOf, Slot, component$, useContext } from '@builder.io/qwik'; | ||
import SelectContextId from './select-context'; | ||
|
||
export const HSelectErrorMessage = component$((props: PropsOf<'div'>) => { | ||
const context = useContext(SelectContextId); | ||
const errorMessageId = `${context.localId}-error-message`; | ||
|
||
return ( | ||
<div role="alert" id={errorMessageId} {...props}> | ||
<Slot /> | ||
</div> | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters