@dolanske/vui 1.4.1 → 1.4.3
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 -2
- package/src/App.vue +0 -103
- package/src/components/Accordion/Accordion.vue +0 -98
- package/src/components/Accordion/AccordionGroup.vue +0 -49
- package/src/components/Accordion/accordion.scss +0 -97
- package/src/components/Alert/Alert.vue +0 -59
- package/src/components/Alert/alert.scss +0 -162
- package/src/components/Avatar/Avatar.vue +0 -53
- package/src/components/Avatar/avatar.scss +0 -52
- package/src/components/Badge/Badge.vue +0 -21
- package/src/components/Badge/badge.scss +0 -210
- package/src/components/Breadcrumbs/BreadcrumbItem.vue +0 -26
- package/src/components/Breadcrumbs/Breadcrumbs.vue +0 -29
- package/src/components/Breadcrumbs/breadcrumbs.scss +0 -31
- package/src/components/Button/Button.vue +0 -86
- package/src/components/Button/button.scss +0 -292
- package/src/components/ButtonGroup/ButtonGroup.vue +0 -28
- package/src/components/ButtonGroup/button-group.scss +0 -51
- package/src/components/Calendar/Calendar.vue +0 -66
- package/src/components/Calendar/calendar.scss +0 -88
- package/src/components/Card/Card.vue +0 -48
- package/src/components/Card/card.scss +0 -55
- package/src/components/Checkbox/Checkbox.vue +0 -54
- package/src/components/Checkbox/checkbox.scss +0 -80
- package/src/components/CopyClipboard/CopyClipboard.vue +0 -98
- package/src/components/CopyClipboard/copy-clipboard.scss +0 -25
- package/src/components/Divider/Divider.vue +0 -38
- package/src/components/Divider/divider.scss +0 -37
- package/src/components/Drawer/Drawer.vue +0 -102
- package/src/components/Drawer/drawer.scss +0 -37
- package/src/components/Dropdown/Dropdown.vue +0 -120
- package/src/components/Dropdown/DropdownItem.vue +0 -33
- package/src/components/Dropdown/DropdownTitle.vue +0 -14
- package/src/components/Dropdown/dropdown-item.scss +0 -84
- package/src/components/Dropdown/dropdown.scss +0 -53
- package/src/components/Flex/Flex.vue +0 -113
- package/src/components/Grid/Grid.vue +0 -87
- package/src/components/Input/Color.vue +0 -26
- package/src/components/Input/Counter.vue +0 -66
- package/src/components/Input/Dropzone.vue +0 -65
- package/src/components/Input/File.vue +0 -15
- package/src/components/Input/Input.vue +0 -123
- package/src/components/Input/Password.vue +0 -35
- package/src/components/Input/Textarea.vue +0 -78
- package/src/components/Input/input.scss +0 -302
- package/src/components/Kbd/Kbd.vue +0 -48
- package/src/components/Kbd/KbdGroup.vue +0 -28
- package/src/components/Kbd/kbd.scss +0 -19
- package/src/components/Modal/Confirm.vue +0 -56
- package/src/components/Modal/Modal.vue +0 -103
- package/src/components/Modal/modal.scss +0 -54
- package/src/components/OTP/OTP.vue +0 -133
- package/src/components/OTP/OTPItem.vue +0 -37
- package/src/components/OTP/otp.scss +0 -84
- package/src/components/Pagination/Pagination.vue +0 -92
- package/src/components/Pagination/pagination.ts +0 -78
- package/src/components/Popout/Popout.vue +0 -73
- package/src/components/Popout/popout.scss +0 -16
- package/src/components/Progress/Progress.vue +0 -103
- package/src/components/Progress/progress.scss +0 -47
- package/src/components/Radio/Radio.vue +0 -38
- package/src/components/Radio/RadioGroup.vue +0 -34
- package/src/components/Radio/radio.scss +0 -78
- package/src/components/Select/Select.vue +0 -212
- package/src/components/Select/select.scss +0 -82
- package/src/components/Sheet/Sheet.vue +0 -106
- package/src/components/Sheet/sheet.scss +0 -71
- package/src/components/Sidebar/Sidebar.vue +0 -116
- package/src/components/Sidebar/sidebar.scss +0 -124
- package/src/components/Skeleton/Skeleton.vue +0 -43
- package/src/components/Skeleton/skeleton.scss +0 -14
- package/src/components/Spinner/Spinner.vue +0 -42
- package/src/components/Spinner/spinner.scss +0 -47
- package/src/components/Switch/Switch.vue +0 -31
- package/src/components/Switch/switch.scss +0 -93
- package/src/components/Table/Cell.vue +0 -23
- package/src/components/Table/Head.vue +0 -66
- package/src/components/Table/Root.vue +0 -66
- package/src/components/Table/SelectAll.vue +0 -23
- package/src/components/Table/SelectRow.vue +0 -30
- package/src/components/Table/index.ts +0 -7
- package/src/components/Table/table.scss +0 -155
- package/src/components/Table/table.ts +0 -248
- package/src/components/Tabs/Tab.vue +0 -25
- package/src/components/Tabs/Tabs.vue +0 -90
- package/src/components/Tabs/tabs.scss +0 -87
- package/src/components/Toast/Toasts.vue +0 -52
- package/src/components/Toast/toast.scss +0 -45
- package/src/components/Toast/toast.ts +0 -75
- package/src/components/Tooltip/Tooltip.vue +0 -78
- package/src/components/Tooltip/tooltip.scss +0 -5
- package/src/examples/ExampleAccordions.vue +0 -69
- package/src/examples/ExampleAlerts.vue +0 -78
- package/src/examples/ExampleAvatars.vue +0 -44
- package/src/examples/ExampleBadges.vue +0 -48
- package/src/examples/ExampleBreadcrumbs.vue +0 -46
- package/src/examples/ExampleButtons.vue +0 -148
- package/src/examples/ExampleCalendars.vue +0 -40
- package/src/examples/ExampleCards.vue +0 -94
- package/src/examples/ExampleCheckboxes.vue +0 -123
- package/src/examples/ExampleCopyClipboard.vue +0 -47
- package/src/examples/ExampleDividers.vue +0 -39
- package/src/examples/ExampleDrawers.vue +0 -67
- package/src/examples/ExampleDropdowns.vue +0 -114
- package/src/examples/ExampleFlexGrid.vue +0 -124
- package/src/examples/ExampleInputs.vue +0 -236
- package/src/examples/ExampleKBD.vue +0 -65
- package/src/examples/ExampleModals.vue +0 -143
- package/src/examples/ExamplePalette.vue +0 -165
- package/src/examples/ExamplePopouts.vue +0 -41
- package/src/examples/ExampleSheets.vue +0 -77
- package/src/examples/ExampleSidebars.vue +0 -276
- package/src/examples/ExampleSkeletons.vue +0 -26
- package/src/examples/ExampleSpinners.vue +0 -80
- package/src/examples/ExampleTables.vue +0 -359
- package/src/examples/ExampleTabs.vue +0 -142
- package/src/examples/ExampleToasts.vue +0 -96
- package/src/examples/ExampleTooltips.vue +0 -70
- package/src/examples/shared/ExampleColor.vue +0 -28
- package/src/index.ts +0 -116
- package/src/internal/Backdrop/Backdrop.vue +0 -22
- package/src/internal/Backdrop/backdrop.scss +0 -34
- package/src/main.ts +0 -5
- package/src/shared/helpers.ts +0 -124
- package/src/shared/slots.ts +0 -61
- package/src/shared/theme.ts +0 -22
- package/src/shared/types.ts +0 -29
- package/src/style/animation.scss +0 -50
- package/src/style/core.scss +0 -133
- package/src/style/fonts.scss +0 -73
- package/src/style/layout.scss +0 -179
- package/src/style/media-query.scss +0 -29
- package/src/style/reset.scss +0 -135
- package/src/style/text.scss +0 -137
- package/src/style/theme.scss +0 -195
- package/src/style/tooltip.scss +0 -146
- package/src/style/typography.scss +0 -435
- package/src/style/utils.scss +0 -36
- package/src/style.scss +0 -1
- package/src/vite-env.d.ts +0 -1
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
<script setup lang='ts'>
|
|
2
|
-
import type { InputProps } from './Input.vue'
|
|
3
|
-
import { Icon } from '@iconify/vue'
|
|
4
|
-
import Button from '../Button/Button.vue'
|
|
5
|
-
import ButtonGroup from '../ButtonGroup/ButtonGroup.vue'
|
|
6
|
-
import Input from './Input.vue'
|
|
7
|
-
|
|
8
|
-
type Props = Omit<InputProps, 'type'> & {
|
|
9
|
-
incrementBy?: number
|
|
10
|
-
incrementEnabled?: boolean
|
|
11
|
-
hideIncrement?: boolean
|
|
12
|
-
decrementBy?: number
|
|
13
|
-
decrementEnabled?: boolean
|
|
14
|
-
hideDecrement?: boolean
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const {
|
|
18
|
-
incrementBy = 1,
|
|
19
|
-
incrementEnabled = true,
|
|
20
|
-
hideIncrement = false,
|
|
21
|
-
decrementBy = 1,
|
|
22
|
-
decrementEnabled = true,
|
|
23
|
-
hideDecrement = false,
|
|
24
|
-
...inputProps
|
|
25
|
-
} = defineProps<Props>()
|
|
26
|
-
|
|
27
|
-
const count = defineModel<number>({
|
|
28
|
-
default: 0,
|
|
29
|
-
})
|
|
30
|
-
</script>
|
|
31
|
-
|
|
32
|
-
<template>
|
|
33
|
-
<Input v-bind="inputProps" v-model.number="count" type="number">
|
|
34
|
-
<!-- <template v-if="!hideDecrement" #start>
|
|
35
|
-
</template> -->
|
|
36
|
-
|
|
37
|
-
<template #end>
|
|
38
|
-
<ButtonGroup>
|
|
39
|
-
<Button v-if="!hideDecrement" key="decrease" :disabled="!decrementEnabled" :style="{ 'border-top-left-radius': 0, 'border-bottom-left-radius': 0, 'marginRight': '-1px' }" @click="count -= decrementBy">
|
|
40
|
-
<Icon icon="ph:minus" /> {{ decrementBy > 1 ? decrementBy : '' }}
|
|
41
|
-
</Button>
|
|
42
|
-
<Button v-if="!hideIncrement" key="increase" :disabled="!incrementEnabled" @click="count += incrementBy">
|
|
43
|
-
<Icon icon="ph:plus" /> {{ incrementBy > 1 ? incrementBy : '' }}
|
|
44
|
-
</Button>
|
|
45
|
-
</ButtonGroup>
|
|
46
|
-
</template>
|
|
47
|
-
</Input>
|
|
48
|
-
</template>
|
|
49
|
-
|
|
50
|
-
<style scoped lang="scss">
|
|
51
|
-
:deep(.vui-button) {
|
|
52
|
-
padding-inline: 2px !important;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
:deep(input) {
|
|
56
|
-
::-webkit-outer-spin-button,
|
|
57
|
-
::-webkit-inner-spin-button {
|
|
58
|
-
-webkit-appearance: none;
|
|
59
|
-
margin: 0;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/* Firefox */
|
|
63
|
-
-moz-appearance: textfield;
|
|
64
|
-
appearance: textfield;
|
|
65
|
-
}
|
|
66
|
-
</style>
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
<script setup lang='ts'>
|
|
2
|
-
import type { InputProps } from './Input.vue'
|
|
3
|
-
import { Icon } from '@iconify/vue'
|
|
4
|
-
import { useEventListener } from '@vueuse/core'
|
|
5
|
-
import { onMounted, ref, useTemplateRef } from 'vue'
|
|
6
|
-
import Flex from '../Flex/Flex.vue'
|
|
7
|
-
import Input from './Input.vue'
|
|
8
|
-
|
|
9
|
-
type Props = Omit<InputProps, 'type' | 'modelValue' | 'focus' | 'limit' | 'placeholder'>
|
|
10
|
-
|
|
11
|
-
const props = defineProps<Props>()
|
|
12
|
-
const emits = defineEmits<{ files: [FileList] }>()
|
|
13
|
-
|
|
14
|
-
const dragging = ref(false)
|
|
15
|
-
|
|
16
|
-
function onSubmitHandler(e: any, isFromField?: boolean) {
|
|
17
|
-
e.preventDefault()
|
|
18
|
-
e.stopPropagation()
|
|
19
|
-
|
|
20
|
-
const files = isFromField ? e.target.files : e.dataTransfer.files
|
|
21
|
-
|
|
22
|
-
if (files.length > 0)
|
|
23
|
-
emits('files', files)
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const dropzoneRef = useTemplateRef<HTMLDivElement>('dropzone')
|
|
27
|
-
|
|
28
|
-
onMounted(() => {
|
|
29
|
-
useEventListener(dropzoneRef, 'dragenter', onSubmitHandler, false)
|
|
30
|
-
useEventListener(dropzoneRef, 'dragleave', onSubmitHandler, false)
|
|
31
|
-
useEventListener(dropzoneRef, 'dragover', onSubmitHandler, false)
|
|
32
|
-
useEventListener(dropzoneRef, 'drop', onSubmitHandler, false)
|
|
33
|
-
useEventListener(dropzoneRef, 'input', e => onSubmitHandler(e, true), false)
|
|
34
|
-
})
|
|
35
|
-
</script>
|
|
36
|
-
|
|
37
|
-
<template>
|
|
38
|
-
<Input
|
|
39
|
-
v-bind="props"
|
|
40
|
-
ref="dropzone"
|
|
41
|
-
type="file"
|
|
42
|
-
class="vui-dropzone"
|
|
43
|
-
:class="{ dragging }"
|
|
44
|
-
@dragenter="dragging = true"
|
|
45
|
-
@mouseleave="dragging = false"
|
|
46
|
-
>
|
|
47
|
-
<template #__internal_replace_input="{ inputId }">
|
|
48
|
-
<input :id="inputId" type="file">
|
|
49
|
-
<label :for="inputId">
|
|
50
|
-
<slot :dragging>
|
|
51
|
-
<Flex x-center gap="xs" y-center>
|
|
52
|
-
<template v-if="dragging">
|
|
53
|
-
<Icon icon="ph:target" />
|
|
54
|
-
Drop it
|
|
55
|
-
</template>
|
|
56
|
-
<template v-else>
|
|
57
|
-
<Icon icon="ph:file" />
|
|
58
|
-
Click or drag files over here
|
|
59
|
-
</template>
|
|
60
|
-
</Flex>
|
|
61
|
-
</slot>
|
|
62
|
-
</label>
|
|
63
|
-
</template>
|
|
64
|
-
</Input>
|
|
65
|
-
</template>
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
<script setup lang='ts'>
|
|
2
|
-
import type { InputProps } from './Input.vue'
|
|
3
|
-
import Input from './Input.vue'
|
|
4
|
-
|
|
5
|
-
const props = defineProps<Omit<InputProps, 'type'>>()
|
|
6
|
-
const emits = defineEmits<{ files: [FileList] }>()
|
|
7
|
-
</script>
|
|
8
|
-
|
|
9
|
-
<template>
|
|
10
|
-
<Input
|
|
11
|
-
type="file"
|
|
12
|
-
v-bind="props"
|
|
13
|
-
@input="emits('files', $event.target.files)"
|
|
14
|
-
/>
|
|
15
|
-
</template>
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { computed, useId, useTemplateRef, watchEffect } from 'vue'
|
|
3
|
-
import { getMaybeRefLength } from '../../shared/helpers'
|
|
4
|
-
import Flex from '../Flex/Flex.vue'
|
|
5
|
-
import '../../style/core.scss'
|
|
6
|
-
import './input.scss'
|
|
7
|
-
|
|
8
|
-
// FIXME: sometimes spamming inputs when limit is set, it will _just_ let me write one more letter
|
|
9
|
-
|
|
10
|
-
export type InputType = 'text' | 'password' | 'color' | 'date' | 'email' | 'number' | 'range' | 'search' | 'tel' | 'time' | 'url' | 'file'
|
|
11
|
-
|
|
12
|
-
export interface InputProps {
|
|
13
|
-
type?: InputType
|
|
14
|
-
label?: string
|
|
15
|
-
hint?: string
|
|
16
|
-
limit?: number | string
|
|
17
|
-
expand?: boolean
|
|
18
|
-
placeholder?: string
|
|
19
|
-
required?: boolean
|
|
20
|
-
modelValue?: string | number
|
|
21
|
-
readonly?: boolean
|
|
22
|
-
focus?: boolean
|
|
23
|
-
errors?: string[]
|
|
24
|
-
accept?: string
|
|
25
|
-
multiple?: boolean
|
|
26
|
-
min?: number
|
|
27
|
-
max?: number
|
|
28
|
-
disabled?: boolean
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const {
|
|
32
|
-
type = 'text',
|
|
33
|
-
limit,
|
|
34
|
-
label,
|
|
35
|
-
expand = false,
|
|
36
|
-
hint,
|
|
37
|
-
placeholder,
|
|
38
|
-
required,
|
|
39
|
-
modelValue = '',
|
|
40
|
-
readonly,
|
|
41
|
-
focus,
|
|
42
|
-
accept,
|
|
43
|
-
min,
|
|
44
|
-
max,
|
|
45
|
-
errors = [] as string[],
|
|
46
|
-
disabled,
|
|
47
|
-
} = defineProps<InputProps>()
|
|
48
|
-
|
|
49
|
-
const model = defineModel<string | number>({
|
|
50
|
-
default: '',
|
|
51
|
-
set(newValue) {
|
|
52
|
-
// Completely ignore inputs
|
|
53
|
-
if (readonly)
|
|
54
|
-
return modelValue
|
|
55
|
-
|
|
56
|
-
if (getMaybeRefLength(newValue) > Number(limit)) {
|
|
57
|
-
return modelValue
|
|
58
|
-
}
|
|
59
|
-
return newValue
|
|
60
|
-
},
|
|
61
|
-
})
|
|
62
|
-
const id = useId()
|
|
63
|
-
|
|
64
|
-
const inputRef = useTemplateRef('input')
|
|
65
|
-
|
|
66
|
-
watchEffect(() => {
|
|
67
|
-
if (focus)
|
|
68
|
-
inputRef.value?.focus({ preventScroll: true })
|
|
69
|
-
})
|
|
70
|
-
|
|
71
|
-
defineExpose({
|
|
72
|
-
focus: () => {
|
|
73
|
-
inputRef.value?.focus({ preventScroll: true })
|
|
74
|
-
},
|
|
75
|
-
})
|
|
76
|
-
|
|
77
|
-
const renderLimit = computed(() => {
|
|
78
|
-
return `${getMaybeRefLength(model.value)}/${limit}`
|
|
79
|
-
})
|
|
80
|
-
</script>
|
|
81
|
-
|
|
82
|
-
<template>
|
|
83
|
-
<div class="vui-input-container" :class="{ expand, disabled, required, readonly, 'has-errors': errors.length > 0 }">
|
|
84
|
-
<slot name="before" />
|
|
85
|
-
<div class="vui-input">
|
|
86
|
-
<label v-if="label" :for="id">{{ label }}</label>
|
|
87
|
-
<p v-if="hint" class="vui-input-hint">
|
|
88
|
-
{{ hint }}
|
|
89
|
-
</p>
|
|
90
|
-
<Flex class="vui-input-style" :gap="5" y-center>
|
|
91
|
-
<slot name="start" />
|
|
92
|
-
<slot name="__internal_replace_input" :input-id="id" />
|
|
93
|
-
<input
|
|
94
|
-
v-if="!$slots.__internal_replace_input"
|
|
95
|
-
:id
|
|
96
|
-
ref="input"
|
|
97
|
-
v-model="model"
|
|
98
|
-
:readonly
|
|
99
|
-
:type
|
|
100
|
-
name="id"
|
|
101
|
-
:placeholder
|
|
102
|
-
:required
|
|
103
|
-
:max="max ?? limit"
|
|
104
|
-
:accept
|
|
105
|
-
:multiple
|
|
106
|
-
:min
|
|
107
|
-
:disabled
|
|
108
|
-
>
|
|
109
|
-
<slot name="end" />
|
|
110
|
-
</Flex>
|
|
111
|
-
</div>
|
|
112
|
-
<p v-if="limit" class="vui-input-limit">
|
|
113
|
-
{{ renderLimit }}
|
|
114
|
-
</p>
|
|
115
|
-
<ul v-if="errors.length > 0" class="vui-input-errors">
|
|
116
|
-
<li v-for="err in errors" :key="err">
|
|
117
|
-
{{ err }}
|
|
118
|
-
</li>
|
|
119
|
-
</ul>
|
|
120
|
-
|
|
121
|
-
<slot name="after" />
|
|
122
|
-
</div>
|
|
123
|
-
</template>
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
<script setup lang='ts'>
|
|
2
|
-
import type { InputProps } from './Input.vue'
|
|
3
|
-
import { Icon } from '@iconify/vue'
|
|
4
|
-
import { ref } from 'vue'
|
|
5
|
-
import Button from '../Button/Button.vue'
|
|
6
|
-
import Input from './Input.vue'
|
|
7
|
-
|
|
8
|
-
type Props = Omit<InputProps, 'type'> & {
|
|
9
|
-
showPassword?: boolean
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const {
|
|
13
|
-
showPassword = false,
|
|
14
|
-
// @ts-expect-error Don't want to actually provide type as we handle that in
|
|
15
|
-
// this component manually
|
|
16
|
-
type,
|
|
17
|
-
...inputProps
|
|
18
|
-
} = defineProps<Props>()
|
|
19
|
-
|
|
20
|
-
const show = ref(showPassword)
|
|
21
|
-
</script>
|
|
22
|
-
|
|
23
|
-
<template>
|
|
24
|
-
<Input v-bind="inputProps" :type="show ? 'text' : 'password'" autocomplete="off">
|
|
25
|
-
<template #end>
|
|
26
|
-
<Button
|
|
27
|
-
square
|
|
28
|
-
:aria-label="show ? 'Hide' : 'Reveal'"
|
|
29
|
-
@click="show = !show"
|
|
30
|
-
>
|
|
31
|
-
<Icon :width="18" :height="18" :icon="show ? 'ph:eye-slash' : 'ph:eye'" />
|
|
32
|
-
</Button>
|
|
33
|
-
</template>
|
|
34
|
-
</Input>
|
|
35
|
-
</template>
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import type { InputProps } from './Input.vue'
|
|
3
|
-
import { computed, useId } from 'vue'
|
|
4
|
-
import '../Input/input.scss'
|
|
5
|
-
|
|
6
|
-
type Props = Omit<InputProps, 'type'> & {
|
|
7
|
-
resize?: boolean | 'vertical' | 'horizontal'
|
|
8
|
-
autoResize?: boolean
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const {
|
|
12
|
-
limit,
|
|
13
|
-
label,
|
|
14
|
-
expand = false,
|
|
15
|
-
hint,
|
|
16
|
-
placeholder,
|
|
17
|
-
required,
|
|
18
|
-
modelValue = '',
|
|
19
|
-
readonly,
|
|
20
|
-
resize = 'vertical',
|
|
21
|
-
autoResize,
|
|
22
|
-
errors = [] as string[],
|
|
23
|
-
disabled,
|
|
24
|
-
} = defineProps<Props>()
|
|
25
|
-
|
|
26
|
-
const model = defineModel<string>({
|
|
27
|
-
default: '',
|
|
28
|
-
set(newValue) {
|
|
29
|
-
if (readonly)
|
|
30
|
-
return modelValue
|
|
31
|
-
|
|
32
|
-
if (newValue.length > Number(limit)) {
|
|
33
|
-
return modelValue
|
|
34
|
-
}
|
|
35
|
-
return newValue
|
|
36
|
-
},
|
|
37
|
-
})
|
|
38
|
-
const id = useId()
|
|
39
|
-
|
|
40
|
-
const r = computed(() => resize === true ? 'both' : (resize || 'initial'))
|
|
41
|
-
const fS = computed(() => autoResize ? 'content' : 'auto')
|
|
42
|
-
</script>
|
|
43
|
-
|
|
44
|
-
<template>
|
|
45
|
-
<div class="vui-input-container" :class="{ expand, required, readonly, 'has-errors': errors.length > 0, disabled }">
|
|
46
|
-
<slot name="before" />
|
|
47
|
-
<div class="vui-input">
|
|
48
|
-
<label v-if="label" :for="id">{{ label }}</label>
|
|
49
|
-
<p v-if="hint" class="vui-input-hint">
|
|
50
|
-
{{ hint }}
|
|
51
|
-
</p>
|
|
52
|
-
<textarea
|
|
53
|
-
:id
|
|
54
|
-
v-model="model"
|
|
55
|
-
:readonly
|
|
56
|
-
name="id"
|
|
57
|
-
:placeholder
|
|
58
|
-
:required
|
|
59
|
-
:disabled
|
|
60
|
-
:max="limit"
|
|
61
|
-
:style="{
|
|
62
|
-
resize: r,
|
|
63
|
-
// @ts-expect-error Early-adoption CSS attribute
|
|
64
|
-
fieldSizing: fS,
|
|
65
|
-
}"
|
|
66
|
-
/>
|
|
67
|
-
</div>
|
|
68
|
-
<p v-if="limit" class="vui-input-limit">
|
|
69
|
-
{{ `${model.length}/${limit}` }}
|
|
70
|
-
</p>
|
|
71
|
-
<ul v-if="errors.length > 0" class="vui-input-errors">
|
|
72
|
-
<li v-for="err in errors" :key="err">
|
|
73
|
-
{{ err }}
|
|
74
|
-
</li>
|
|
75
|
-
</ul>
|
|
76
|
-
<slot name="after" />
|
|
77
|
-
</div>
|
|
78
|
-
</template>
|
|
@@ -1,302 +0,0 @@
|
|
|
1
|
-
.vui-input-container {
|
|
2
|
-
// Each component should have its own specification as it allows more granual
|
|
3
|
-
// modification via CSS variables if needed
|
|
4
|
-
--input-color-text-red: var(--color-text-red);
|
|
5
|
-
--input-color-text: var(--color-text);
|
|
6
|
-
--input-color-text-light: var(--color-text-light);
|
|
7
|
-
--input-color-text-lighter: var(--color-text-lighter);
|
|
8
|
-
--input-color-border: var(--color-border);
|
|
9
|
-
--input-color-border-strong: var(--color-border-strong);
|
|
10
|
-
--input-color-border-weak: var(--color-border-weak);
|
|
11
|
-
|
|
12
|
-
--input-height: var(--interactive-el-height);
|
|
13
|
-
--input-padding: 8px;
|
|
14
|
-
--textarea-padding: 8px;
|
|
15
|
-
|
|
16
|
-
//
|
|
17
|
-
|
|
18
|
-
width: 224px;
|
|
19
|
-
|
|
20
|
-
&.disabled {
|
|
21
|
-
.vui-input label {
|
|
22
|
-
color: var(--input-color-text-lighter);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
input,
|
|
26
|
-
textarea {
|
|
27
|
-
cursor: not-allowed;
|
|
28
|
-
resize: none !important;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
&.expand {
|
|
33
|
-
width: 100%;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
&.required .vui-input > label:after {
|
|
37
|
-
content: '*';
|
|
38
|
-
padding-left: 2px;
|
|
39
|
-
color: var(--input-color-text-red);
|
|
40
|
-
font-size: var(--font-size-l);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
&.readonly .vui-input {
|
|
44
|
-
input,
|
|
45
|
-
textarea,
|
|
46
|
-
.vui-input-style {
|
|
47
|
-
// pointer-events: none;
|
|
48
|
-
color: var(--input-color-text-light);
|
|
49
|
-
border-color: var(--input-color-border-weak);
|
|
50
|
-
resize: none !important;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
&.has-errors {
|
|
55
|
-
.vui-input {
|
|
56
|
-
.vui-input-style,
|
|
57
|
-
textarea {
|
|
58
|
-
outline: 1px solid var(--color-text-red) !important;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
&.vui-input-color {
|
|
64
|
-
.vui-input-style {
|
|
65
|
-
padding-left: 0 !important;
|
|
66
|
-
outline: none !important;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
.vui-input {
|
|
71
|
-
label {
|
|
72
|
-
display: block;
|
|
73
|
-
text-align: left;
|
|
74
|
-
margin-bottom: 8px;
|
|
75
|
-
font-size: var(--font-size-m);
|
|
76
|
-
color: var(--input-color-text);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
svg {
|
|
80
|
-
min-width: 16px;
|
|
81
|
-
min-height: 16px;
|
|
82
|
-
// font-size: var(--font-size-l);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
.vui-input-hint {
|
|
86
|
-
margin-bottom: 8px;
|
|
87
|
-
margin-top: -4px;
|
|
88
|
-
color: var(--input-color-text-lighter);
|
|
89
|
-
font-size: var(--font-size-s);
|
|
90
|
-
display: block;
|
|
91
|
-
text-align: left;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
::placeholder {
|
|
95
|
-
font-weight: var(--font-weight);
|
|
96
|
-
color: var(--color-text-lighter);
|
|
97
|
-
font-family: var(--global-font);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
.vui-input-style,
|
|
101
|
-
textarea {
|
|
102
|
-
display: block;
|
|
103
|
-
border-radius: var(--border-radius-s);
|
|
104
|
-
border: 1px solid var(--input-color-border);
|
|
105
|
-
background: transparent;
|
|
106
|
-
height: var(--input-height);
|
|
107
|
-
line-height: var(--input-height);
|
|
108
|
-
color: var(--color-text-lighter);
|
|
109
|
-
outline: none;
|
|
110
|
-
font-size: var(--font-size-m);
|
|
111
|
-
width: 100%;
|
|
112
|
-
transition: var(--transition-fast);
|
|
113
|
-
padding-inline: var(--input-padding);
|
|
114
|
-
z-index: var(--z-default);
|
|
115
|
-
|
|
116
|
-
&:has(input:focus),
|
|
117
|
-
&:focus {
|
|
118
|
-
// Override error outline
|
|
119
|
-
outline: 2px solid var(--color-text) !important;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
.vui-button {
|
|
123
|
-
border: 1px solid var(--color-border);
|
|
124
|
-
|
|
125
|
-
&:first-child {
|
|
126
|
-
border-top-right-radius: 0;
|
|
127
|
-
border-bottom-right-radius: 0;
|
|
128
|
-
margin-left: calc(calc(var(--input-padding) + 1px) * -1);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
&:last-child {
|
|
132
|
-
border-top-left-radius: 0;
|
|
133
|
-
border-bottom-left-radius: 0;
|
|
134
|
-
margin-right: calc(calc(var(--input-padding) + 1px) * -1);
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
input,
|
|
140
|
-
textarea {
|
|
141
|
-
color: var(--color-text);
|
|
142
|
-
font-family: var(--global-font);
|
|
143
|
-
// padding-inline: 3px;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
input[type='file']::file-selector-button {
|
|
147
|
-
background-color: var(--color-bg);
|
|
148
|
-
color: var(--color-text);
|
|
149
|
-
border: none;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
input[type='range'] {
|
|
153
|
-
-webkit-appearance: none; /* Override default CSS styles */
|
|
154
|
-
appearance: none;
|
|
155
|
-
height: 4px;
|
|
156
|
-
border-radius: 2px;
|
|
157
|
-
background-color: var(--color-border);
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
input[type='color'] {
|
|
161
|
-
width: 1px;
|
|
162
|
-
height: 1px;
|
|
163
|
-
position: absolute;
|
|
164
|
-
overflow: hidden;
|
|
165
|
-
outline: none !important;
|
|
166
|
-
opacity: 0;
|
|
167
|
-
|
|
168
|
-
&:focus + label .vui-input-color-indicator {
|
|
169
|
-
outline: 2px solid var(--color-text);
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
& + label {
|
|
173
|
-
position: relative;
|
|
174
|
-
margin: 0;
|
|
175
|
-
padding-left: var(--input-height);
|
|
176
|
-
|
|
177
|
-
input {
|
|
178
|
-
padding-inline: var(--space-xs);
|
|
179
|
-
border-radius: var(--border-radius-s);
|
|
180
|
-
|
|
181
|
-
&:focus {
|
|
182
|
-
outline: 2px solid var(--color-text);
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
.vui-input-color-indicator {
|
|
187
|
-
position: absolute;
|
|
188
|
-
inset: 4px;
|
|
189
|
-
right: unset;
|
|
190
|
-
width: calc(var(--input-height) - 8px);
|
|
191
|
-
background-color: var(--color-border);
|
|
192
|
-
border-radius: var(--border-radius-s);
|
|
193
|
-
font-size: var(--font-size-l);
|
|
194
|
-
display: flex;
|
|
195
|
-
align-items: center;
|
|
196
|
-
justify-content: center;
|
|
197
|
-
|
|
198
|
-
&:hover {
|
|
199
|
-
opacity: 0.8;
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
::-moz-range-thumb,
|
|
206
|
-
::-webkit-slider-thumb {
|
|
207
|
-
width: 16px;
|
|
208
|
-
height: 16px;
|
|
209
|
-
background-color: var(--color-text-light);
|
|
210
|
-
border: none;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
input {
|
|
214
|
-
display: block;
|
|
215
|
-
width: 100%;
|
|
216
|
-
border: none;
|
|
217
|
-
height: calc(var(--input-height) - 1px);
|
|
218
|
-
line-height: calc(var(--input-height) - 1px);
|
|
219
|
-
background: transparent;
|
|
220
|
-
outline: none;
|
|
221
|
-
font-size: var(--font-size-m);
|
|
222
|
-
color: var(--color-text);
|
|
223
|
-
|
|
224
|
-
&:-webkit-autofill {
|
|
225
|
-
box-shadow: 0 0 0px 1000px var(--color-bg) inset;
|
|
226
|
-
-webkit-text-fill-color: var(--color-text);
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
textarea {
|
|
231
|
-
line-height: 1.3em;
|
|
232
|
-
height: auto;
|
|
233
|
-
min-height: 5lh;
|
|
234
|
-
field-sizing: content;
|
|
235
|
-
padding: var(--textarea-padding);
|
|
236
|
-
transition: none;
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
.vui-input-limit {
|
|
241
|
-
display: block;
|
|
242
|
-
margin-top: 6px;
|
|
243
|
-
text-align: left;
|
|
244
|
-
font-size: var(--font-size-xs);
|
|
245
|
-
color: var(--input-color-text-lighter);
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
.vui-input-errors {
|
|
249
|
-
display: flex;
|
|
250
|
-
flex-direction: column;
|
|
251
|
-
gap: 6px;
|
|
252
|
-
padding-top: 6px;
|
|
253
|
-
|
|
254
|
-
li {
|
|
255
|
-
display: block;
|
|
256
|
-
font-size: var(--font-size-s);
|
|
257
|
-
color: var(--color-text-red);
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
&.vui-dropzone {
|
|
262
|
-
&.dragging .vui-input .vui-input-style {
|
|
263
|
-
border-color: var(--color-accent);
|
|
264
|
-
|
|
265
|
-
&:hover {
|
|
266
|
-
border-color: var(--color-border);
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
.vui-input {
|
|
271
|
-
.vui-input-style {
|
|
272
|
-
height: unset;
|
|
273
|
-
border-width: 2px;
|
|
274
|
-
border-style: dashed;
|
|
275
|
-
border-radius: var(--border-radius-m);
|
|
276
|
-
line-height: 1.2em;
|
|
277
|
-
|
|
278
|
-
&:hover {
|
|
279
|
-
border-color: var(--color-accent);
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
input {
|
|
283
|
-
width: 1px;
|
|
284
|
-
height: 1px;
|
|
285
|
-
position: absolute;
|
|
286
|
-
outline: 0 !important;
|
|
287
|
-
opacity: 0 !important;
|
|
288
|
-
|
|
289
|
-
& + label {
|
|
290
|
-
display: flex;
|
|
291
|
-
align-items: center;
|
|
292
|
-
justify-content: center;
|
|
293
|
-
width: 100%;
|
|
294
|
-
min-height: 96px;
|
|
295
|
-
margin: 0;
|
|
296
|
-
color: var(--color-text-light);
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
}
|