@proj-airi/ui 0.9.0-beta.6 → 0.9.0-beta.7
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 +1 -1
- package/src/components/form/field/field-input.vue +3 -1
- package/src/components/form/field/field-select.vue +105 -0
- package/src/components/form/field/index.ts +2 -1
- package/src/components/form/input/input.vue +3 -1
- package/src/components/form/range/round-range.vue +2 -3
- package/src/components/form/select/select.vue +1 -2
- /package/src/components/form/field/{field-combobox.vue → field-combobox-select.vue} +0 -0
package/package.json
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
<script
|
|
2
2
|
setup
|
|
3
3
|
lang="ts"
|
|
4
|
-
generic="InputType extends 'number' | string, T = InputType extends 'number' ? (number | undefined) : ((string | undefined))"
|
|
4
|
+
generic="InputType extends 'number' | InputTypeHTMLAttribute | string, T = InputType extends 'number' ? (number | undefined) : ((string | undefined))"
|
|
5
5
|
>
|
|
6
|
+
import type { InputTypeHTMLAttribute } from 'vue'
|
|
7
|
+
|
|
6
8
|
import { Input } from '../input'
|
|
7
9
|
|
|
8
10
|
const props = withDefaults(defineProps<{
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
<script setup lang="ts" generic="T extends AcceptableValue">
|
|
2
|
+
import type { AcceptableValue } from 'reka-ui'
|
|
3
|
+
|
|
4
|
+
import { Select } from '../select'
|
|
5
|
+
|
|
6
|
+
interface SelectOptionItem<T extends AcceptableValue> {
|
|
7
|
+
label: string
|
|
8
|
+
value: T
|
|
9
|
+
description?: string
|
|
10
|
+
disabled?: boolean
|
|
11
|
+
icon?: string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface SelectOptionGroupItem<T extends AcceptableValue> {
|
|
15
|
+
groupLabel?: string
|
|
16
|
+
children?: SelectOptionItem<T>[]
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const props = withDefaults(defineProps<{
|
|
20
|
+
label: string
|
|
21
|
+
description?: string
|
|
22
|
+
options?: SelectOptionItem<T>[] | SelectOptionGroupItem<T>[]
|
|
23
|
+
placeholder?: string
|
|
24
|
+
disabled?: boolean
|
|
25
|
+
layout?: 'horizontal' | 'vertical'
|
|
26
|
+
selectClass?: string | string[]
|
|
27
|
+
by?: string | ((a: T, b: T) => boolean)
|
|
28
|
+
contentMinWidth?: string | number
|
|
29
|
+
contentWidth?: string | number
|
|
30
|
+
shape?: 'rounded' | 'default'
|
|
31
|
+
variant?: 'blurry' | 'default'
|
|
32
|
+
}>(), {
|
|
33
|
+
layout: 'horizontal',
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
const modelValue = defineModel<T>({ required: false })
|
|
37
|
+
</script>
|
|
38
|
+
|
|
39
|
+
<template>
|
|
40
|
+
<label :class="['flex', 'flex-col', 'gap-4']">
|
|
41
|
+
<div
|
|
42
|
+
:class="[
|
|
43
|
+
'items-center',
|
|
44
|
+
props.layout === 'horizontal' ? 'grid grid-cols-4 gap-2' : 'grid grid-rows-2 gap-2',
|
|
45
|
+
]"
|
|
46
|
+
>
|
|
47
|
+
<div
|
|
48
|
+
:class="[
|
|
49
|
+
'w-full',
|
|
50
|
+
props.layout === 'horizontal' ? 'col-span-2' : 'row-span-2',
|
|
51
|
+
]"
|
|
52
|
+
>
|
|
53
|
+
<div :class="['flex', 'items-center', 'gap-1', 'break-words', 'text-sm', 'font-medium', 'text-left']">
|
|
54
|
+
<slot name="label">
|
|
55
|
+
{{ props.label }}
|
|
56
|
+
</slot>
|
|
57
|
+
</div>
|
|
58
|
+
<div :class="['break-words', 'text-xs', 'text-neutral-500', 'dark:text-neutral-400', 'text-left']">
|
|
59
|
+
<slot name="description">
|
|
60
|
+
{{ props.description }}
|
|
61
|
+
</slot>
|
|
62
|
+
</div>
|
|
63
|
+
</div>
|
|
64
|
+
<slot>
|
|
65
|
+
<Select
|
|
66
|
+
v-model="modelValue"
|
|
67
|
+
:options="props.options ?? []"
|
|
68
|
+
:placeholder="props.placeholder"
|
|
69
|
+
:disabled="props.disabled"
|
|
70
|
+
:by="props.by"
|
|
71
|
+
:content-min-width="props.contentMinWidth"
|
|
72
|
+
:content-width="props.contentWidth"
|
|
73
|
+
:shape="props.shape"
|
|
74
|
+
:variant="props.variant"
|
|
75
|
+
:class="[
|
|
76
|
+
...(props.selectClass
|
|
77
|
+
? (typeof props.selectClass === 'string' ? [props.selectClass] : props.selectClass)
|
|
78
|
+
: []),
|
|
79
|
+
props.layout === 'horizontal' ? 'col-span-2' : 'row-span-2',
|
|
80
|
+
]"
|
|
81
|
+
>
|
|
82
|
+
<template
|
|
83
|
+
v-if="$slots.value"
|
|
84
|
+
#value="{ option, value, placeholder: slotPlaceholder }"
|
|
85
|
+
>
|
|
86
|
+
<slot
|
|
87
|
+
name="value"
|
|
88
|
+
v-bind="{ option, value, placeholder: slotPlaceholder }"
|
|
89
|
+
/>
|
|
90
|
+
</template>
|
|
91
|
+
|
|
92
|
+
<template
|
|
93
|
+
v-if="$slots.option"
|
|
94
|
+
#option="{ option }"
|
|
95
|
+
>
|
|
96
|
+
<slot
|
|
97
|
+
name="option"
|
|
98
|
+
v-bind="{ option }"
|
|
99
|
+
/>
|
|
100
|
+
</template>
|
|
101
|
+
</Select>
|
|
102
|
+
</slot>
|
|
103
|
+
</div>
|
|
104
|
+
</label>
|
|
105
|
+
</template>
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export { default as FieldCheckbox } from './field-checkbox.vue'
|
|
2
|
-
export { default as FieldCombobox } from './field-combobox.vue'
|
|
2
|
+
export { default as FieldCombobox } from './field-combobox-select.vue'
|
|
3
3
|
export { default as FieldInput } from './field-input.vue'
|
|
4
4
|
export { default as FieldKeyValues } from './field-key-values.vue'
|
|
5
5
|
export { default as FieldRange } from './field-range.vue'
|
|
6
|
+
export { default as FieldSelect } from './field-select.vue'
|
|
6
7
|
export { default as FieldTextArea } from './field-text-area.vue'
|
|
7
8
|
export { default as FieldValues } from './field-values.vue'
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
<script
|
|
2
2
|
setup
|
|
3
3
|
lang="ts"
|
|
4
|
-
generic="InputType extends 'number' | string, T = InputType extends 'number' ? (number | undefined) : ((string | undefined))"
|
|
4
|
+
generic="InputType extends 'number' | InputTypeHTMLAttribute | string, T = InputType extends 'number' ? (number | undefined) : ((string | undefined))"
|
|
5
5
|
>
|
|
6
|
+
import type { InputTypeHTMLAttribute } from 'vue'
|
|
7
|
+
|
|
6
8
|
// Define button variants for better type safety and maintainability
|
|
7
9
|
type InputVariant = 'primary' | 'secondary' | 'primary-dimmed'
|
|
8
10
|
|
|
@@ -71,7 +71,6 @@ https://toughengineer.github.io/demo/slider-styler*/
|
|
|
71
71
|
min-height: var(--height);
|
|
72
72
|
appearance: none;
|
|
73
73
|
background: transparent;
|
|
74
|
-
border-radius: 4px;
|
|
75
74
|
transition: background-color 0.2s ease;
|
|
76
75
|
|
|
77
76
|
--thumb-width: var(--height);
|
|
@@ -84,7 +83,7 @@ https://toughengineer.github.io/demo/slider-styler*/
|
|
|
84
83
|
--track-height: calc(var(--height) - var(--track-value-padding) * 2);
|
|
85
84
|
--track-box-shadow: 0 0 12px -2px rgb(0 0 0 / 22%);
|
|
86
85
|
--track-border: none;
|
|
87
|
-
--track-border-radius:
|
|
86
|
+
--track-border-radius: 16px;
|
|
88
87
|
--track-background: rgba(0, 0, 0, 0.4);
|
|
89
88
|
|
|
90
89
|
--track-value-background: rgb(255, 255, 255);
|
|
@@ -99,7 +98,7 @@ https://toughengineer.github.io/demo/slider-styler*/
|
|
|
99
98
|
--thumb-background: rgb(238, 238, 238);
|
|
100
99
|
|
|
101
100
|
--track-border: none;
|
|
102
|
-
--track-background: rgba(
|
|
101
|
+
--track-background: rgba(64, 64, 64, 0.7);
|
|
103
102
|
--track-box-shadow: 0 0 12px -2px rgb(0 0 0 / 22%);
|
|
104
103
|
|
|
105
104
|
--track-value-background: rgb(238, 238, 238);
|
|
@@ -112,7 +112,7 @@ function toCssSize(value?: string | number): string | undefined {
|
|
|
112
112
|
<SelectTrigger
|
|
113
113
|
:class="[
|
|
114
114
|
'group',
|
|
115
|
-
'w-full inline-flex items-center justify-between border px-
|
|
115
|
+
'w-full inline-flex items-center justify-between border px-3 leading-none h-9 gap-[5px] outline-none',
|
|
116
116
|
props.shape === 'rounded' ? 'rounded-full' : 'rounded-lg',
|
|
117
117
|
'text-sm text-neutral-700 dark:text-neutral-200 data-[placeholder]:text-neutral-400 dark:data-[placeholder]:text-neutral-500',
|
|
118
118
|
props.variant === 'default' ? 'bg-white dark:bg-neutral-900 disabled:bg-neutral-100 hover:bg-neutral-50 dark:disabled:bg-neutral-900 dark:hover:bg-neutral-700' : '',
|
|
@@ -144,7 +144,6 @@ function toCssSize(value?: string | number): string | undefined {
|
|
|
144
144
|
<SelectValue
|
|
145
145
|
v-else
|
|
146
146
|
v-model="modelValue"
|
|
147
|
-
:placeholder="props.placeholder"
|
|
148
147
|
/>
|
|
149
148
|
</div>
|
|
150
149
|
<SelectIcon as-child>
|
|
File without changes
|