@a-vision-software/vue-input-components 1.4.9 → 1.4.11

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@a-vision-software/vue-input-components",
3
- "version": "1.4.9",
3
+ "version": "1.4.11",
4
4
  "description": "A collection of reusable Vue 3 input components with TypeScript support",
5
5
  "author": "A-Vision Software",
6
6
  "license": "MIT",
@@ -37,6 +37,9 @@
37
37
  "import": "./dist/vue-input-components.es.js",
38
38
  "require": "./dist/vue-input-components.cjs.js"
39
39
  },
40
+ "./global": {
41
+ "types": "./dist/src/global.d.ts"
42
+ },
40
43
  "./dist/*": "./dist/*",
41
44
  "./styles.css": "./dist/vue-input-components.css",
42
45
  "./styles": "./dist/vue-input-components.css"
@@ -121,7 +121,7 @@ const filterInput = ref<HTMLInputElement | null>(null)
121
121
 
122
122
  const selectedOptions = computed(() => {
123
123
  if (Array.isArray(props.modelValue)) {
124
- return props.options.filter((option) => props.modelValue.includes(option.id))
124
+ return props.options.filter((option) => props.modelValue?.includes(option.id))
125
125
  }
126
126
  return props.options.filter((option) => option.id === props.modelValue)
127
127
  })
@@ -128,7 +128,7 @@ const props = withDefaults(defineProps<TextInputProps>(), {
128
128
  height: '5.5rem',
129
129
  maxHeight: '14rem',
130
130
  bgColor: 'var(--input-color, #ffffffee)',
131
- width: (props) => (props.type === 'date' ? '10rem' : '100%'),
131
+ width: '100%',
132
132
  })
133
133
 
134
134
  const emit = defineEmits<{
@@ -272,7 +272,7 @@ watch(
272
272
  () => props.modelValue,
273
273
  (newValue) => {
274
274
  if (props.type === 'date' && newValue) {
275
- dateValue.value = parseDateFromModel(newValue)
275
+ dateValue.value = parseDateFromModel(newValue as string)
276
276
  }
277
277
  },
278
278
  )
@@ -485,10 +485,6 @@ textarea {
485
485
  line-height: var(--line-height);
486
486
  }
487
487
 
488
- .text-input.label-left.text-input--date .text-input__wrapper {
489
- width: 10rem;
490
- }
491
-
492
488
  :deep(.dp__input::placeholder) {
493
489
  color: var(--text-muted);
494
490
  }
package/src/global.ts ADDED
@@ -0,0 +1,23 @@
1
+ import type TextInput from './components/TextInput.vue'
2
+ import type FileUpload from './components/FileUpload.vue'
3
+ import type Navigation from './components/Navigation.vue'
4
+ import type Action from './components/Action.vue'
5
+ import type Dropdown from './components/Dropdown.vue'
6
+ import type Checkbox from './components/Checkbox.vue'
7
+ import type List from './components/List.vue'
8
+ import type Modal from './components/Modal.vue'
9
+
10
+ declare module '@vue/runtime-core' {
11
+ export interface GlobalComponents {
12
+ TextInput: typeof TextInput
13
+ FileUpload: typeof FileUpload
14
+ Navigation: typeof Navigation
15
+ Action: typeof Action
16
+ Dropdown: typeof Dropdown
17
+ Checkbox: typeof Checkbox
18
+ List: typeof List
19
+ Modal: typeof Modal
20
+ }
21
+ }
22
+
23
+ export {}
@@ -6,7 +6,7 @@ export interface DropdownOption {
6
6
 
7
7
  export interface DropdownProps {
8
8
  options: DropdownOption[]
9
- modelValue: string | string[]
9
+ modelValue: string | string[] | null
10
10
  multiple?: boolean
11
11
  placeholder?: string
12
12
  filterable?: boolean
@@ -1,6 +1,6 @@
1
1
  export interface NavigationItem {
2
2
  id: string
3
- label: string
3
+ label?: string
4
4
  url?: string
5
5
  icon?: string
6
6
  disabled?: boolean
@@ -1,7 +1,6 @@
1
- export interface TextInputProps {
2
- modelValue: string
1
+ export type TextInputProps =
2
+ {
3
3
  required?: boolean
4
- type?: 'text' | 'textarea' | 'password' | 'email' | 'tel' | 'url' | 'date' | 'number'
5
4
  placeholder?: string
6
5
  label?: string
7
6
  labelPosition?: 'top' | 'left'
@@ -19,7 +18,16 @@ export interface TextInputProps {
19
18
  bgColor?: string
20
19
  autosave?: (value: string) => Promise<void>
21
20
  error?: string
22
- }
21
+ } & (
22
+ | {
23
+ modelValue: string
24
+ type?: 'text' | 'textarea' | 'password' | 'email' | 'tel' | 'url' | 'date'
25
+ }
26
+ | {
27
+ modelValue: number
28
+ type: 'number'
29
+ }
30
+ )
23
31
 
24
32
  export interface TextInputEmits {
25
33
  (e: 'update:modelValue', value: string): void
@@ -48,6 +48,8 @@
48
48
  label-position="top" label-align="left" />
49
49
  <TextInput v-model="comment" label="Comment" type="text" placeholder="Your comment" label-position="top"
50
50
  label-align="left" />
51
+ <TextInput v-model="age" type="number" label="Age" placeholder="Enter your age" label-position="top"
52
+ label-align="left" />
51
53
  </div>
52
54
  </div>
53
55
  </div>
@@ -66,6 +68,7 @@ const postalCode = ref('')
66
68
  const country = ref('')
67
69
  const birthDate = ref('1967-08-22')
68
70
  const comment = ref('')
71
+ const age = ref(0)
69
72
  const bio = ref('')
70
73
  const feedback = ref('')
71
74