@proj-airi/ui 0.8.1-beta.8 → 0.8.1
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/package.json
CHANGED
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
ComboboxItem,
|
|
11
11
|
ComboboxItemIndicator,
|
|
12
12
|
ComboboxLabel,
|
|
13
|
+
ComboboxPortal,
|
|
13
14
|
ComboboxRoot,
|
|
14
15
|
ComboboxSeparator,
|
|
15
16
|
ComboboxTrigger,
|
|
@@ -62,69 +63,76 @@ function toDisplayValue(value: T): string {
|
|
|
62
63
|
</ComboboxTrigger>
|
|
63
64
|
</ComboboxAnchor>
|
|
64
65
|
|
|
65
|
-
<
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
:
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
66
|
+
<ComboboxPortal>
|
|
67
|
+
<ComboboxContent
|
|
68
|
+
position="popper"
|
|
69
|
+
side="bottom"
|
|
70
|
+
align="start"
|
|
71
|
+
:side-offset="4"
|
|
72
|
+
:avoid-collisions="true"
|
|
73
|
+
:class="[
|
|
74
|
+
'z-150 w-full min-w-[160px] overflow-hidden rounded-xl shadow-sm border will-change-[opacity,transform]',
|
|
75
|
+
'data-[side=top]:animate-slideDownAndFade data-[side=right]:animate-slideLeftAndFade data-[side=bottom]:animate-slideUpAndFade data-[side=left]:animate-slideRightAndFade',
|
|
76
|
+
'bg-white dark:bg-neutral-900',
|
|
77
|
+
'border-neutral-200 dark:border-neutral-800 border-solid border-2 focus:border-neutral-300 dark:focus:border-neutral-600',
|
|
78
|
+
]"
|
|
79
|
+
:style="{ width: 'var(--reka-combobox-trigger-width)' }"
|
|
80
|
+
>
|
|
81
|
+
<ComboboxViewport :class="['p-[2px]', 'max-h-50dvh', 'overflow-y-auto']">
|
|
82
|
+
<ComboboxEmpty
|
|
83
|
+
:class="[
|
|
84
|
+
'font-medium py-2 px-2',
|
|
85
|
+
'text-xs text-neutral-700 dark:text-neutral-200',
|
|
86
|
+
'transition-colors duration-200 ease-in-out',
|
|
87
|
+
]"
|
|
88
|
+
/>
|
|
82
89
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
90
|
+
<template
|
|
91
|
+
v-for="(group, index) in options"
|
|
92
|
+
:key="group.groupLabel"
|
|
93
|
+
>
|
|
94
|
+
<ComboboxGroup :class="['overflow-x-hidden']">
|
|
95
|
+
<ComboboxSeparator
|
|
96
|
+
v-if="index !== 0"
|
|
97
|
+
:class="['m-[5px]', 'h-[1px]', 'bg-neutral-400']"
|
|
98
|
+
/>
|
|
92
99
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
100
|
+
<ComboboxLabel
|
|
101
|
+
:class="[
|
|
102
|
+
'px-[25px] text-xs leading-[25px]',
|
|
103
|
+
'text-neutral-500 dark:text-neutral-400',
|
|
104
|
+
'transition-colors duration-200 ease-in-out',
|
|
105
|
+
]"
|
|
106
|
+
>
|
|
107
|
+
{{ group.groupLabel }}
|
|
108
|
+
</ComboboxLabel>
|
|
102
109
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
>
|
|
116
|
-
<ComboboxItemIndicator
|
|
117
|
-
:class="['absolute', 'left-0', 'w-[25px]', 'inline-flex', 'items-center', 'justify-center', 'opacity-30']"
|
|
110
|
+
<ComboboxItem
|
|
111
|
+
v-for="option in group.children"
|
|
112
|
+
:key="option.label"
|
|
113
|
+
:text-value="option.label"
|
|
114
|
+
:value="option.value"
|
|
115
|
+
:class="[
|
|
116
|
+
'leading-normal rounded-lg flex items-center h-8 pr-[0.5rem] pl-[1.5rem] relative select-none data-[disabled]:pointer-events-none data-[highlighted]:outline-none',
|
|
117
|
+
'data-[highlighted]:bg-neutral-100 dark:data-[highlighted]:bg-neutral-800',
|
|
118
|
+
'text-sm text-neutral-700 dark:text-neutral-200 data-[disabled]:text-neutral-400 dark:data-[disabled]:text-neutral-600 data-[highlighted]:text-grass1',
|
|
119
|
+
'transition-colors duration-200 ease-in-out',
|
|
120
|
+
'cursor-pointer',
|
|
121
|
+
]"
|
|
118
122
|
>
|
|
119
|
-
<
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
123
|
+
<ComboboxItemIndicator
|
|
124
|
+
:class="['absolute', 'left-0', 'w-[25px]', 'inline-flex', 'items-center', 'justify-center', 'opacity-30']"
|
|
125
|
+
>
|
|
126
|
+
<div i-solar:alt-arrow-right-outline />
|
|
127
|
+
</ComboboxItemIndicator>
|
|
128
|
+
<span :class="['line-clamp-1', 'overflow-hidden', 'text-ellipsis', 'whitespace-nowrap']">
|
|
129
|
+
{{ option.label }}
|
|
130
|
+
</span>
|
|
131
|
+
</ComboboxItem>
|
|
132
|
+
</ComboboxGroup>
|
|
133
|
+
</template>
|
|
134
|
+
</ComboboxViewport>
|
|
135
|
+
</ComboboxContent>
|
|
136
|
+
</ComboboxPortal>
|
|
129
137
|
</ComboboxRoot>
|
|
130
138
|
</template>
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
<script
|
|
1
|
+
<script
|
|
2
|
+
setup
|
|
3
|
+
lang="ts"
|
|
4
|
+
generic="InputType extends 'number' | string, T = InputType extends 'number' ? (number | undefined) : ((string | undefined))"
|
|
5
|
+
>
|
|
2
6
|
import { Input } from '../input'
|
|
3
7
|
|
|
4
8
|
const props = withDefaults(defineProps<{
|
|
@@ -6,14 +10,14 @@ const props = withDefaults(defineProps<{
|
|
|
6
10
|
description?: string
|
|
7
11
|
placeholder?: string
|
|
8
12
|
required?: boolean
|
|
9
|
-
type?:
|
|
13
|
+
type?: InputType
|
|
10
14
|
inputClass?: string
|
|
11
15
|
singleLine?: boolean
|
|
12
16
|
}>(), {
|
|
13
17
|
singleLine: true,
|
|
14
18
|
})
|
|
15
19
|
|
|
16
|
-
const modelValue = defineModel<
|
|
20
|
+
const modelValue = defineModel<T>({ required: false })
|
|
17
21
|
</script>
|
|
18
22
|
|
|
19
23
|
<template>
|
|
@@ -33,15 +37,22 @@ const modelValue = defineModel<string>({ required: false })
|
|
|
33
37
|
</div>
|
|
34
38
|
</div>
|
|
35
39
|
<Input
|
|
36
|
-
v-if="singleLine"
|
|
40
|
+
v-if="singleLine && props.type === 'number'"
|
|
41
|
+
v-model.number="modelValue"
|
|
42
|
+
:type="props.type"
|
|
43
|
+
:placeholder="props.placeholder"
|
|
44
|
+
:class="props.inputClass"
|
|
45
|
+
/>
|
|
46
|
+
<Input
|
|
47
|
+
v-else-if="singleLine"
|
|
37
48
|
v-model="modelValue"
|
|
38
49
|
:type="props.type"
|
|
39
50
|
:placeholder="props.placeholder"
|
|
40
51
|
:class="props.inputClass"
|
|
41
52
|
/>
|
|
42
53
|
<textarea
|
|
43
|
-
v-else
|
|
44
|
-
v-model="modelValue"
|
|
54
|
+
v-else-if="props.type !== 'number'"
|
|
55
|
+
v-model="modelValue as string | undefined"
|
|
45
56
|
:type="props.type"
|
|
46
57
|
:placeholder="props.placeholder"
|
|
47
58
|
:class="[
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
<script
|
|
1
|
+
<script
|
|
2
|
+
setup
|
|
3
|
+
lang="ts"
|
|
4
|
+
generic="InputType extends 'number' | string, T = InputType extends 'number' ? (number | undefined) : ((string | undefined))"
|
|
5
|
+
>
|
|
2
6
|
// Define button variants for better type safety and maintainability
|
|
3
7
|
type InputVariant = 'primary' | 'secondary' | 'primary-dimmed'
|
|
4
8
|
|
|
@@ -8,7 +12,7 @@ type InputTheme = 'default'
|
|
|
8
12
|
type InputSize = 'sm' | 'md' | 'lg'
|
|
9
13
|
|
|
10
14
|
const props = withDefaults(defineProps<{
|
|
11
|
-
type?:
|
|
15
|
+
type?: InputType
|
|
12
16
|
variant?: InputVariant // Button style variant
|
|
13
17
|
size?: InputSize // Button size variant
|
|
14
18
|
theme?: InputTheme // Button theme
|
|
@@ -18,7 +22,7 @@ const props = withDefaults(defineProps<{
|
|
|
18
22
|
theme: 'default',
|
|
19
23
|
})
|
|
20
24
|
|
|
21
|
-
const modelValue = defineModel<
|
|
25
|
+
const modelValue = defineModel<T>({ required: false })
|
|
22
26
|
|
|
23
27
|
const variantClasses: Record<InputVariant, Record<InputTheme, {
|
|
24
28
|
default: string[]
|
|
@@ -59,13 +63,26 @@ const variantClasses: Record<InputVariant, Record<InputTheme, {
|
|
|
59
63
|
</script>
|
|
60
64
|
|
|
61
65
|
<template>
|
|
62
|
-
<
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
66
|
+
<template v-if="props.type === 'number'">
|
|
67
|
+
<input
|
|
68
|
+
v-model.number="modelValue"
|
|
69
|
+
:type="props.type || 'text'"
|
|
70
|
+
:class="[
|
|
71
|
+
'transition-all duration-200 ease-in-out',
|
|
72
|
+
'cursor-disabled:not-allowed',
|
|
73
|
+
...variantClasses[props.variant][props.theme].default,
|
|
74
|
+
]"
|
|
75
|
+
>
|
|
76
|
+
</template>
|
|
77
|
+
<template v-else>
|
|
78
|
+
<input
|
|
79
|
+
v-model="modelValue"
|
|
80
|
+
:type="props.type || 'text'"
|
|
81
|
+
:class="[
|
|
82
|
+
'transition-all duration-200 ease-in-out',
|
|
83
|
+
'cursor-disabled:not-allowed',
|
|
84
|
+
...variantClasses[props.variant][props.theme].default,
|
|
85
|
+
]"
|
|
86
|
+
>
|
|
87
|
+
</template>
|
|
71
88
|
</template>
|