@manafishrov/ui 1.3.7 → 1.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Select.js +1 -1
- package/dist/components/Select.js.map +1 -1
- package/dist/components/form/SelectField.d.ts +1 -0
- package/dist/components/form/SelectField.js +35 -25
- package/dist/components/form/SelectField.js.map +1 -1
- package/dist/components/toaster/Toaster.js +13 -10
- package/dist/components/toaster/Toaster.js.map +1 -1
- package/dist/theme.css +1 -1
- package/package.json +1 -1
- package/src/components/Select.tsx +1 -1
- package/src/components/form/SelectField.tsx +29 -12
- package/src/components/toaster/Toaster.tsx +2 -2
- package/src/components/toaster/toaster.css +1 -0
package/package.json
CHANGED
|
@@ -162,7 +162,7 @@ export const SelectTrigger: Component<
|
|
|
162
162
|
data-size={size}
|
|
163
163
|
class={cn(
|
|
164
164
|
'px-2.5 text-sm *:data-[slot=select-value]:gap-1.5 [&_svg:not([class*="size-"])]:size-4 gap-1.5 min-w-0 shadow-xs flex w-full items-center justify-between rounded-lg border border-input bg-transparent whitespace-nowrap transition-[color,box-shadow] outline-none select-none disabled:cursor-not-allowed disabled:opacity-50 data-placeholder-shown:text-muted-foreground *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center dark:bg-input/30 dark:hover:bg-input/50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*="size-"])]:text-muted-foreground',
|
|
165
|
-
'data-[size=default]:h-
|
|
165
|
+
'data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)]',
|
|
166
166
|
'focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 data-[focus-visible]:border-ring data-[focus-visible]:ring-[3px] data-[focus-visible]:ring-ring/50',
|
|
167
167
|
'data-[invalid=true]:border-destructive data-[invalid=true]:ring-[3px] data-[invalid=true]:ring-destructive/20 dark:data-[invalid=true]:ring-destructive/40',
|
|
168
168
|
'data-[disabled=true]:bg-input/50 data-[disabled=true]:opacity-50 dark:data-[disabled=true]:bg-input/80',
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
Select,
|
|
6
6
|
SelectContent,
|
|
7
7
|
SelectControl,
|
|
8
|
+
SelectIndicator,
|
|
8
9
|
SelectPositioner,
|
|
9
10
|
SelectTrigger,
|
|
10
11
|
SelectValue,
|
|
@@ -13,11 +14,18 @@ import {
|
|
|
13
14
|
import { useFieldContext } from './context';
|
|
14
15
|
import { WithTrailingAddon } from './WithTrailingAddon';
|
|
15
16
|
|
|
16
|
-
const SelectInput: Component<{
|
|
17
|
+
const SelectInput: Component<{
|
|
18
|
+
placeholder: string;
|
|
19
|
+
showSelectIndicator: boolean | undefined;
|
|
20
|
+
children: JSX.Element;
|
|
21
|
+
}> = (props) => (
|
|
17
22
|
<>
|
|
18
23
|
<SelectControl>
|
|
19
24
|
<SelectTrigger>
|
|
20
25
|
<SelectValue placeholder={props.placeholder} />
|
|
26
|
+
<Show when={props.showSelectIndicator !== false}>
|
|
27
|
+
<SelectIndicator />
|
|
28
|
+
</Show>
|
|
21
29
|
</SelectTrigger>
|
|
22
30
|
</SelectControl>
|
|
23
31
|
<SelectPositioner>
|
|
@@ -30,21 +38,25 @@ export type SelectFieldProps = ComponentProps<typeof Select> & {
|
|
|
30
38
|
label?: string;
|
|
31
39
|
description?: string;
|
|
32
40
|
placeholder?: string;
|
|
41
|
+
showSelectIndicator?: boolean;
|
|
33
42
|
trailingAddon?: JSXElement;
|
|
34
43
|
};
|
|
35
44
|
|
|
45
|
+
const SELECT_FIELD_PROPS = [
|
|
46
|
+
'label',
|
|
47
|
+
'description',
|
|
48
|
+
'required',
|
|
49
|
+
'disabled',
|
|
50
|
+
'readOnly',
|
|
51
|
+
'placeholder',
|
|
52
|
+
'showSelectIndicator',
|
|
53
|
+
'children',
|
|
54
|
+
'trailingAddon',
|
|
55
|
+
] as const;
|
|
56
|
+
|
|
36
57
|
export const SelectField: Component<SelectFieldProps> = (props) => {
|
|
37
58
|
const field = useFieldContext<string[]>();
|
|
38
|
-
const [local, others] = splitProps(props,
|
|
39
|
-
'label',
|
|
40
|
-
'description',
|
|
41
|
-
'required',
|
|
42
|
-
'disabled',
|
|
43
|
-
'readOnly',
|
|
44
|
-
'placeholder',
|
|
45
|
-
'children',
|
|
46
|
-
'trailingAddon',
|
|
47
|
-
]);
|
|
59
|
+
const [local, others] = splitProps(props, SELECT_FIELD_PROPS);
|
|
48
60
|
|
|
49
61
|
return (
|
|
50
62
|
<Field
|
|
@@ -69,7 +81,12 @@ export const SelectField: Component<SelectFieldProps> = (props) => {
|
|
|
69
81
|
readOnly={local.readOnly ?? false}
|
|
70
82
|
{...others}
|
|
71
83
|
>
|
|
72
|
-
<SelectInput
|
|
84
|
+
<SelectInput
|
|
85
|
+
placeholder={local.placeholder ?? ''}
|
|
86
|
+
showSelectIndicator={local.showSelectIndicator}
|
|
87
|
+
>
|
|
88
|
+
{local.children}
|
|
89
|
+
</SelectInput>
|
|
73
90
|
</Select>
|
|
74
91
|
</WithTrailingAddon>
|
|
75
92
|
<FieldError errors={field().state.meta.errors} />
|
|
@@ -24,7 +24,7 @@ export const toast = createToaster({
|
|
|
24
24
|
const ToastItem: Component<{ toast: Accessor<ToastOptions> }> = (props) => (
|
|
25
25
|
<Toast.Root
|
|
26
26
|
class={cn(
|
|
27
|
-
'group gap-3 p-4 pr-10 shadow-lg min-w-72 pointer-events-auto relative flex w-full items-center rounded-lg border bg-popover
|
|
27
|
+
'group gap-3 p-4 pr-10 shadow-lg min-w-72 pointer-events-auto relative flex w-full items-center rounded-lg border bg-popover',
|
|
28
28
|
'data-[state=open]:sm:slide-in-from-bottom-full data-[state=open]:animate-in data-[state=open]:slide-in-from-top-full',
|
|
29
29
|
'border-border text-popover-foreground',
|
|
30
30
|
)}
|
|
@@ -50,7 +50,7 @@ const ToastItem: Component<{ toast: Accessor<ToastOptions> }> = (props) => (
|
|
|
50
50
|
{props.toast().title}
|
|
51
51
|
</Toast.Title>
|
|
52
52
|
</Show>
|
|
53
|
-
<Show when={props.toast().description}>
|
|
53
|
+
<Show when={props.toast().description} fallback={<div aria-hidden='true' class='h-5' />}>
|
|
54
54
|
<Toast.Description class='text-sm opacity-90'>
|
|
55
55
|
{props.toast().description}
|
|
56
56
|
</Toast.Description>
|