Compare commits
2 commits
23d0ab147b
...
f196f98317
Author | SHA1 | Date | |
---|---|---|---|
f196f98317 | |||
9edbc97d61 |
4 changed files with 75 additions and 59 deletions
|
@ -153,6 +153,14 @@ export function DemoApp()
|
||||||
"d": "DDDDDD",
|
"d": "DDDDDD",
|
||||||
"e": "EEEEEE",
|
"e": "EEEEEE",
|
||||||
"f": "FFFFFF",
|
"f": "FFFFFF",
|
||||||
|
"g": "GGGGGG",
|
||||||
|
"h": "HHHHHH",
|
||||||
|
"i": "IIIIII",
|
||||||
|
"j": "JJJJJJ",
|
||||||
|
"k": "KKKKKK",
|
||||||
|
"l": "LLLLLL",
|
||||||
|
"m": "MMMMMM",
|
||||||
|
"n": "NNNNNN",
|
||||||
}} value={selected} onChange={setSelected} selectibleMaxCount={3} placeholder={"Simple test"}>
|
}} value={selected} onChange={setSelected} selectibleMaxCount={3} placeholder={"Simple test"}>
|
||||||
Simple select test
|
Simple select test
|
||||||
</Select>
|
</Select>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"version": "1.3.2",
|
"version": "1.3.3",
|
||||||
"name": "@kernelui/core",
|
"name": "@kernelui/core",
|
||||||
"description": "Kernel UI Core.",
|
"description": "Kernel UI Core.",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
|
@ -5,22 +5,9 @@ import {classes, Modify, normalizeString} from "../../Utils";
|
||||||
import {CaretDown, Check, X} from "@phosphor-icons/react";
|
import {CaretDown, Check, X} from "@phosphor-icons/react";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generic select component.
|
* Generic select component properties.
|
||||||
*/
|
*/
|
||||||
export function Select<OptionKey extends keyof any, Option>(
|
export type SelectProperties<OptionKey extends keyof any, Option> = React.PropsWithChildren<Modify<React.InputHTMLAttributes<HTMLInputElement>, {
|
||||||
{
|
|
||||||
className,
|
|
||||||
value, onChange,
|
|
||||||
options, renderOption, match,
|
|
||||||
selectibleMaxCount, multiple,
|
|
||||||
blurOnSelect, blurWhenMaxCountSelected,
|
|
||||||
// Properties to pass down.
|
|
||||||
onKeyDown,
|
|
||||||
// Already set properties.
|
|
||||||
type, role,
|
|
||||||
children,
|
|
||||||
...props
|
|
||||||
}: React.PropsWithChildren<Modify<React.InputHTMLAttributes<HTMLInputElement>, {
|
|
||||||
/**
|
/**
|
||||||
* The currently selected option(s).
|
* The currently selected option(s).
|
||||||
*/
|
*/
|
||||||
|
@ -77,7 +64,25 @@ export function Select<OptionKey extends keyof any, Option>(
|
||||||
// Already set properties.
|
// Already set properties.
|
||||||
type?: never;
|
type?: never;
|
||||||
role?: never;
|
role?: never;
|
||||||
}>>): React.ReactElement
|
}>>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generic select component.
|
||||||
|
*/
|
||||||
|
export function Select<OptionKey extends keyof any, Option>(
|
||||||
|
{
|
||||||
|
className,
|
||||||
|
value, onChange,
|
||||||
|
options, renderOption, match,
|
||||||
|
selectibleMaxCount, multiple,
|
||||||
|
blurOnSelect, blurWhenMaxCountSelected,
|
||||||
|
// Properties to pass down.
|
||||||
|
onKeyDown,
|
||||||
|
// Already set properties.
|
||||||
|
type, role,
|
||||||
|
children,
|
||||||
|
...props
|
||||||
|
}: SelectProperties<OptionKey, Option>): React.ReactElement
|
||||||
{
|
{
|
||||||
const [search, setSearch] = React.useState("");
|
const [search, setSearch] = React.useState("");
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
.floating.suggestions
|
.floating.suggestions
|
||||||
{
|
{
|
||||||
|
height: ~"min(90vh, 18em)";
|
||||||
padding: 0.5em 0;
|
padding: 0.5em 0;
|
||||||
|
|
||||||
|
overflow-y: auto;
|
||||||
|
|
||||||
.suggestion
|
.suggestion
|
||||||
{
|
{
|
||||||
transition: background 0.2s ease;
|
transition: background 0.2s ease;
|
||||||
|
|
Loading…
Reference in a new issue