@proj-airi/ui 0.6.1 → 0.7.0-alpha.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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@proj-airi/ui",
3
3
  "type": "module",
4
- "version": "0.6.1",
4
+ "version": "0.7.0-alpha.1",
5
5
  "description": "A collection of UI components that used by Project AIRI",
6
6
  "author": {
7
7
  "name": "Moeru AI Project AIRI Team",
@@ -20,22 +20,17 @@
20
20
  "./components/form": "./src/components/Form/index.ts",
21
21
  "./*": "./*"
22
22
  },
23
- "main": "./dist/index.mjs",
24
- "module": "./dist/index.mjs",
25
23
  "dependencies": {
26
- "@vueuse/core": "^13.3.0",
24
+ "@vueuse/core": "^13.5.0",
27
25
  "floating-vue": "^5.2.2",
28
- "reka-ui": "^2.3.1",
29
- "vue": "^3.5.16"
26
+ "reka-ui": "^2.3.2",
27
+ "vue": "^3.5.17"
30
28
  },
31
29
  "devDependencies": {
32
30
  "@vue-macros/volar": "3.0.0-beta.8",
33
- "vue-tsc": "^3.0.0-alpha.10"
31
+ "vue-tsc": "^3.0.1"
34
32
  },
35
33
  "scripts": {
36
- "dev": "pnpm run build",
37
- "stub": "pnpm run build",
38
- "build": "tsdown",
39
34
  "typecheck": "vue-tsc --noEmit"
40
35
  }
41
36
  }
@@ -0,0 +1,36 @@
1
+ <script setup lang="ts">
2
+ function enter(el: any, done: any) {
3
+ el.style.transition = 'all 0.5s'
4
+ const width = el.scrollWidth
5
+ el.style.width = '0'
6
+ requestAnimationFrame(() => {
7
+ el.style.width = `${width}px`
8
+ })
9
+ el.addEventListener('transitionend', done)
10
+ }
11
+
12
+ function beforeLeave(el: any) {
13
+ el.style.transition = 'all 0.5s'
14
+ el.style.width = '0'
15
+ el.style.opacity = '0'
16
+ }
17
+
18
+ function leave(el: any, done: any) {
19
+ el.style.transition = 'all 0.5s'
20
+ el.style.width = '0'
21
+ el.style.opacity = '0'
22
+ el.addEventListener('transitionend', done)
23
+ }
24
+ </script>
25
+
26
+ <template>
27
+ <Transition
28
+ name="slide-fade"
29
+ :css="false"
30
+ @enter="enter"
31
+ @leave="leave"
32
+ @before-leave="beforeLeave"
33
+ >
34
+ <slot />
35
+ </Transition>
36
+ </template>
@@ -1 +1,2 @@
1
+ export { default as TransitionHorizontal } from './TransitionHorizontal.vue'
1
2
  export { default as TransitionVertical } from './TransitionVertical.vue'
@@ -14,10 +14,14 @@ const modelValue = defineModel<boolean>({ required: true })
14
14
  <div flex="~ row" items-center gap-2>
15
15
  <div flex="1">
16
16
  <div class="flex items-center gap-1 text-sm font-medium">
17
- {{ props.label }}
17
+ <slot name="label">
18
+ {{ props.label }}
19
+ </slot>
18
20
  </div>
19
21
  <div class="text-xs text-neutral-500 dark:text-neutral-400">
20
- {{ props.description }}
22
+ <slot name="description">
23
+ {{ props.description }}
24
+ </slot>
21
25
  </div>
22
26
  </div>
23
27
  <Checkbox v-model="modelValue" />
@@ -13,7 +13,7 @@ const props = withDefaults(defineProps<{
13
13
  singleLine: true,
14
14
  })
15
15
 
16
- const modelValue = defineModel<string>({ required: true })
16
+ const modelValue = defineModel<string>({ required: false })
17
17
  </script>
18
18
 
19
19
  <template>
@@ -21,11 +21,15 @@ const modelValue = defineModel<string>({ required: true })
21
21
  <label flex="~ col gap-4">
22
22
  <div>
23
23
  <div class="flex items-center gap-1 text-sm font-medium">
24
- {{ props.label }}
24
+ <slot name="label">
25
+ {{ props.label }}
26
+ </slot>
25
27
  <span v-if="props.required !== false" class="text-red-500">*</span>
26
28
  </div>
27
29
  <div class="text-xs text-neutral-500 dark:text-neutral-400" text-nowrap>
28
- {{ props.description }}
30
+ <slot name="description">
31
+ {{ props.description }}
32
+ </slot>
29
33
  </div>
30
34
  </div>
31
35
  <Input
@@ -32,11 +32,15 @@ watch([inputKey, inputValue], () => {
32
32
  <label flex="~ col gap-2">
33
33
  <div>
34
34
  <div class="flex items-center gap-1 text-sm font-medium">
35
- {{ props.label }}
35
+ <slot name="label">
36
+ {{ props.label }}
37
+ </slot>
36
38
  <span v-if="props.required !== false" class="text-red-500">*</span>
37
39
  </div>
38
40
  <div class="text-xs text-neutral-500 dark:text-neutral-400" text-nowrap>
39
- {{ props.description }}
41
+ <slot name="description">
42
+ {{ props.description }}
43
+ </slot>
40
44
  </div>
41
45
  </div>
42
46
  <div v-auto-animate flex="~ col gap-2">
@@ -1,27 +1,34 @@
1
1
  <script setup lang="ts">
2
2
  import Range from '../Range/Range.vue'
3
3
 
4
- const props = defineProps<{
4
+ const props = withDefaults(defineProps<{
5
5
  min?: number
6
6
  max?: number
7
7
  step?: number
8
8
  label?: string
9
9
  description?: string
10
10
  formatValue?: (value: number) => string
11
- }>()
11
+ as?: 'label' | 'div'
12
+ }>(), {
13
+ as: 'label',
14
+ })
12
15
 
13
16
  const modelValue = defineModel<number>({ required: true })
14
17
  </script>
15
18
 
16
19
  <template>
17
- <label flex="~ col gap-4">
20
+ <props.as flex="~ col gap-4">
18
21
  <div flex="~ row" items-center gap-2>
19
22
  <div flex="1">
20
23
  <div class="flex items-center gap-1 text-sm font-medium">
21
- {{ label }}
24
+ <slot name="label">
25
+ {{ label }}
26
+ </slot>
22
27
  </div>
23
28
  <div class="text-xs text-neutral-500 dark:text-neutral-400">
24
- {{ description }}
29
+ <slot name="description">
30
+ {{ description }}
31
+ </slot>
25
32
  </div>
26
33
  </div>
27
34
  <span font-mono>{{ props.formatValue?.(modelValue) || modelValue }}</span>
@@ -35,5 +42,5 @@ const modelValue = defineModel<number>({ required: true })
35
42
  w-full
36
43
  />
37
44
  </div>
38
- </label>
45
+ </props.as>
39
46
  </template>
@@ -0,0 +1,50 @@
1
+ <script setup lang="ts">
2
+ import { Select } from '@proj-airi/ui'
3
+
4
+ const props = defineProps<{
5
+ label: string
6
+ description?: string
7
+ options?: { label: string, value: string | number }[]
8
+ placeholder?: string
9
+ disabled?: boolean
10
+ layout?: 'horizontal' | 'vertical'
11
+ }>()
12
+
13
+ const modelValue = defineModel<string>({ required: false })
14
+ </script>
15
+
16
+ <template>
17
+ <label flex="~ col gap-4">
18
+ <div
19
+ :class="[
20
+ props.layout === 'horizontal' ? 'flex flex-row items-center justify-between gap-2' : 'flex flex-col items-start justify-center gap-2',
21
+ ]"
22
+ >
23
+ <div class="min-w-[max-content] flex-1">
24
+ <div class="flex items-center gap-1 text-sm font-medium">
25
+ <slot name="label">
26
+ {{ props.label }}
27
+ </slot>
28
+ </div>
29
+ <div class="text-xs text-neutral-500 dark:text-neutral-400">
30
+ <slot name="description">
31
+ {{ props.description }}
32
+ </slot>
33
+ </div>
34
+ </div>
35
+ <slot>
36
+ <Select
37
+ v-model="modelValue"
38
+ :options="props.options"
39
+ :placeholder="props.placeholder"
40
+ :disabled="props.disabled"
41
+ :title="label"
42
+ >
43
+ <template #default="{ value }">
44
+ {{ props.options?.find(option => option.value === value)?.label || props.placeholder }}
45
+ </template>
46
+ </Select>
47
+ </slot>
48
+ </div>
49
+ </label>
50
+ </template>
@@ -33,11 +33,15 @@ function removeItem(index: number) {
33
33
  <label class="flex flex-col gap-2">
34
34
  <div>
35
35
  <div class="flex items-center gap-1 text-sm font-medium">
36
- {{ props.label }}
36
+ <slot name="label">
37
+ {{ props.label }}
38
+ </slot>
37
39
  <span v-if="props.required !== false" class="text-red-500">*</span>
38
40
  </div>
39
41
  <div class="text-nowrap text-xs text-neutral-500 dark:text-neutral-400">
40
- {{ props.description }}
42
+ <slot name="description">
43
+ {{ props.description }}
44
+ </slot>
41
45
  </div>
42
46
  </div>
43
47
 
@@ -2,4 +2,5 @@ export { default as FieldCheckbox } from './FieldCheckbox.vue'
2
2
  export { default as FieldInput } from './FieldInput.vue'
3
3
  export { default as FieldKeyValues } from './FieldKeyValues.vue'
4
4
  export { default as FieldRange } from './FieldRange.vue'
5
+ export { default as FieldSelect } from './FieldSelect.vue'
5
6
  export { default as FieldValues } from './FieldValues.vue'
@@ -3,7 +3,7 @@ const props = defineProps<{
3
3
  type?: string
4
4
  }>()
5
5
 
6
- const modelValue = defineModel<string>({ required: true })
6
+ const modelValue = defineModel<string>({ required: false })
7
7
  </script>
8
8
 
9
9
  <template>
@@ -39,23 +39,23 @@ const colorValue = defineModel<string>('colorValue', {
39
39
  );
40
40
 
41
41
  &::-webkit-slider-thumb {
42
- --at-apply: w-1 h-12 appearance-none rounded-md bg-neutral-600 cursor-pointer shadow-lg border-2 border-neutral-500
43
- hover: bg-neutral-800 transition-colors duration-200;
42
+ --at-apply: w-1 h-12 hover:w-2 hover:h-13 appearance-none rounded-md bg-neutral-600 cursor-pointer shadow-lg border-2 border-neutral-500
43
+ hover: bg-neutral-800 transition-colors,transform,width,height duration-200 cursor-col-resize;
44
44
  }
45
45
 
46
46
  .dark &::-webkit-slider-thumb {
47
- --at-apply: w-1 h-12 appearance-none rounded-md bg-neutral-100 cursor-pointer shadow-md border-2 border-white
48
- hover: bg-neutral-300 transition-colors duration-200;
47
+ --at-apply: w-1 h-12 hover:w-2 hover:h-13 appearance-none rounded-md bg-neutral-100 cursor-pointer shadow-md border-2 border-white
48
+ hover: bg-neutral-300 transition-colors,transform,width,height duration-200 cursor-col-resize;
49
49
  }
50
50
 
51
51
  &::-moz-range-thumb {
52
- --at-apply: w-1 h-12 appearance-none rounded-md bg-neutral-600 cursor-pointer shadow-lg border-2 border-neutral-500
53
- hover: bg-neutral-800 transition-colors duration-200;
52
+ --at-apply: w-1 h-12 hover:w-2 hover:h-13 appearance-none rounded-md bg-neutral-600 cursor-pointer shadow-lg border-2 border-neutral-500
53
+ hover: bg-neutral-800 transition-colors,transform,width,height duration-200 cursor-col-resize;
54
54
  }
55
55
 
56
56
  .dark &::-moz-range-thumb {
57
- --at-apply: w-1 h-12 appearance-none rounded-md bg-neutral-100 cursor-pointer shadow-md border-2 border-white
58
- hover: bg-neutral-300 transition-colors duration-200;
57
+ --at-apply: w-1 h-12 hover:w-2 hover:h-13 appearance-none rounded-md bg-neutral-100 cursor-pointer shadow-md border-2 border-white
58
+ hover: bg-neutral-300 transition-colors,transform,width,height duration-200 cursor-col-resize;
59
59
  }
60
60
  }
61
61
  </style>
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import { computed, onMounted, ref } from 'vue'
2
+ import { computed, onMounted, ref, watch } from 'vue'
3
3
 
4
4
  const props = withDefaults(defineProps<{
5
5
  min?: number
@@ -19,7 +19,7 @@ const props = withDefaults(defineProps<{
19
19
  trackValueColor: 'red',
20
20
  })
21
21
 
22
- const modelValue = defineModel<number>('modelValue', { required: true })
22
+ const modelValue = defineModel<number>({ required: true })
23
23
 
24
24
  const scaledMin = computed(() => props.min * 10000)
25
25
  const scaledMax = computed(() => props.max * 10000)
@@ -34,15 +34,16 @@ const sliderValue = computed({
34
34
  },
35
35
  })
36
36
 
37
- onMounted(() => {
38
- updateTrackColor()
39
- })
37
+ onMounted(() => updateTrackColor())
38
+ watch(sliderValue, () => updateTrackColor(), { immediate: true })
39
+ watch([scaledMin, scaledMax, scaledStep], () => updateTrackColor(), { immediate: true })
40
40
 
41
41
  function updateTrackColor() {
42
- if (!sliderRef.value)
42
+ if (!sliderRef.value) {
43
43
  return
44
+ }
44
45
 
45
- sliderRef.value.style.setProperty('--value', sliderRef.value.value)
46
+ sliderRef.value.style.setProperty('--value', sliderValue.value.toString())
46
47
  sliderRef.value.style.setProperty('--min', !sliderRef.value.min ? props.min.toString() : sliderRef.value.min)
47
48
  sliderRef.value.style.setProperty('--max', !sliderRef.value.max ? props.max.toString() : sliderRef.value.max)
48
49
  }
@@ -83,17 +84,17 @@ https://toughengineer.github.io/demo/slider-styler*/
83
84
  --thumb-box-shadow: 0 0 0px #e6e6e6;
84
85
  --thumb-border: none;
85
86
  --thumb-border-radius: 999px;
86
- --thumb-background: oklch(80% var(--theme-colors-chroma-200) calc(var(--theme-colors-hue) + 0));
87
- --thumb-background-hover: oklch(90% var(--theme-colors-chroma-200) calc(var(--theme-colors-hue) + 0));
88
- --thumb-background-active: oklch(70% var(--theme-colors-chroma-200) calc(var(--theme-colors-hue) + 0));
87
+ --thumb-background: oklch(80% var(--chromatic-chroma-200) calc(var(--chromatic-hue) + 0));
88
+ --thumb-background-hover: oklch(90% var(--chromatic-chroma-200) calc(var(--chromatic-hue) + 0));
89
+ --thumb-background-active: oklch(70% var(--chromatic-chroma-200) calc(var(--chromatic-hue) + 0));
89
90
 
90
91
  --track-height: calc(var(--height) - var(--track-value-padding) * 2);
91
92
  --track-box-shadow: none;
92
93
  --track-border: solid 2px rgb(238, 238, 238);
93
94
  --track-border-radius: 6px;
94
- --track-background: rgb(238, 238, 238);
95
- --track-background-hover: rgb(238, 238, 238);
96
- --track-background-active: rgb(238, 238, 238);
95
+ --track-background: rgba(238, 238, 238, 0.6);
96
+ --track-background-hover: rgba(238, 238, 238, 0.6);
97
+ --track-background-active: rgba(238, 238, 238, 0.6);
97
98
 
98
99
  --track-value-background: rgb(255, 255, 255);
99
100
  --track-value-background-hover: rgb(255, 255, 255);
@@ -102,14 +103,14 @@ https://toughengineer.github.io/demo/slider-styler*/
102
103
  }
103
104
 
104
105
  .dark .form_input-range {
105
- --thumb-background: oklch(70% var(--theme-colors-chroma-200) calc(var(--theme-colors-hue) + 0));
106
- --thumb-background-hover: oklch(90% var(--theme-colors-chroma-200) calc(var(--theme-colors-hue) + 0));
107
- --thumb-background-active: oklch(80% var(--theme-colors-chroma-200) calc(var(--theme-colors-hue) + 0));
106
+ --thumb-background: oklch(70% var(--chromatic-chroma-200) calc(var(--chromatic-hue) + 0));
107
+ --thumb-background-hover: oklch(90% var(--chromatic-chroma-200) calc(var(--chromatic-hue) + 0));
108
+ --thumb-background-active: oklch(80% var(--chromatic-chroma-200) calc(var(--chromatic-hue) + 0));
108
109
 
109
110
  --track-border: solid 2px rgb(44, 44, 44);
110
- --track-background: rgb(44, 44, 44);
111
- --track-background-hover: rgb(44, 44, 44);
112
- --track-background-active: rgb(44, 44, 44);
111
+ --track-background: rgba(44, 44, 44, 0.7);
112
+ --track-background-hover: rgba(44, 44, 44, 0.7);
113
+ --track-background-active: rgba(44, 44, 44, 0.7);
113
114
 
114
115
  --track-value-background: rgb(164, 164, 164);
115
116
  --track-value-background-hover: rgb(164, 164, 164);
@@ -143,7 +144,8 @@ https://toughengineer.github.io/demo/slider-styler*/
143
144
  background 0.2s ease-in-out,
144
145
  box-shadow 0.2s ease-in-out,
145
146
  border-color 0.2s ease-in-out,
146
- transform 0.2s ease-in-out;
147
+ transform 0.2s cubic-bezier(0.165, 0.84, 0.44, 1),
148
+ width 0.2s cubic-bezier(0.165, 0.84, 0.44, 1);
147
149
  }
148
150
 
149
151
  .form_input-range::-webkit-slider-runnable-track {
@@ -151,6 +153,7 @@ https://toughengineer.github.io/demo/slider-styler*/
151
153
  border: var(--track-border);
152
154
  border-radius: var(--track-border-radius);
153
155
  background: var(--track-background);
156
+ backdrop-filter: blur(8px);
154
157
  box-shadow: var(--track-box-shadow);
155
158
  position: relative;
156
159
  cursor: col-resize;
@@ -161,6 +164,9 @@ https://toughengineer.github.io/demo/slider-styler*/
161
164
 
162
165
  .form_input-range::-webkit-slider-thumb:hover {
163
166
  background: var(--thumb-background-hover);
167
+
168
+ width: calc(var(--thumb-width) * 1.6);
169
+ transform: scaleY(1.2);
164
170
  }
165
171
 
166
172
  .form_input-range:hover::-webkit-slider-runnable-track {
@@ -207,6 +213,12 @@ https://toughengineer.github.io/demo/slider-styler*/
207
213
  box-shadow: var(--thumb-box-shadow);
208
214
  cursor: col-resize;
209
215
  margin-left: calc(0 - var(--track-value-padding));
216
+ transition:
217
+ background 0.2s ease-in-out,
218
+ box-shadow 0.2s ease-in-out,
219
+ border-color 0.2s ease-in-out,
220
+ transform 0.2s cubic-bezier(0.165, 0.84, 0.44, 1),
221
+ width 0.2s cubic-bezier(0.165, 0.84, 0.44, 1);
210
222
  }
211
223
 
212
224
  .form_input-range::-moz-range-track {
@@ -214,6 +226,7 @@ https://toughengineer.github.io/demo/slider-styler*/
214
226
  border: var(--track-border);
215
227
  border-radius: var(--track-border-radius);
216
228
  background: var(--track-background);
229
+ backdrop-filter: blur(8px);
217
230
  box-shadow: var(--track-box-shadow);
218
231
  cursor: col-resize;
219
232
  /* Trim left and right paddings of track */
@@ -222,6 +235,9 @@ https://toughengineer.github.io/demo/slider-styler*/
222
235
 
223
236
  .form_input-range::-moz-range-thumb:hover {
224
237
  background: var(--thumb-background-hover);
238
+
239
+ width: calc(var(--thumb-width) * 1.6);
240
+ transform: scaleY(1.2);
225
241
  }
226
242
 
227
243
  .form_input-range:hover::-moz-range-track {
@@ -280,12 +296,20 @@ https://toughengineer.github.io/demo/slider-styler*/
280
296
  margin-left: calc(0 - var(--track-value-padding));
281
297
  box-sizing: border-box;
282
298
  cursor: col-resize;
299
+
300
+ transition:
301
+ background 0.2s ease-in-out,
302
+ box-shadow 0.2s ease-in-out,
303
+ border-color 0.2s ease-in-out,
304
+ transform 0.2s cubic-bezier(0.165, 0.84, 0.44, 1),
305
+ width 0.2s cubic-bezier(0.165, 0.84, 0.44, 1);
283
306
  }
284
307
 
285
308
  .form_input-range::-ms-track {
286
309
  height: var(--track-height);
287
310
  border-radius: var(--track-border-radius);
288
311
  background: var(--track-background);
312
+ backdrop-filter: blur(8px);
289
313
  border: var(--track-border);
290
314
  box-shadow: var(--track-box-shadow);
291
315
  box-sizing: border-box;
@@ -294,6 +318,9 @@ https://toughengineer.github.io/demo/slider-styler*/
294
318
 
295
319
  .form_input-range::-ms-thumb:hover {
296
320
  background: var(--thumb-background-hover);
321
+
322
+ width: calc(var(--thumb-width) * 1.6);
323
+ transform: scaleY(1.2);
297
324
  }
298
325
 
299
326
  .form_input-range:hover::-ms-track {