pgo-uiux2 1.0.0
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/.env +1 -0
- package/.env.production +1 -0
- package/.prettierrc +13 -0
- package/.vscode/extensions.json +3 -0
- package/BUTTON_GUIDE.md +257 -0
- package/README.md +49 -0
- package/THEME_REFERENCE.md +310 -0
- package/eslint.config.ts +27 -0
- package/index.html +13 -0
- package/package.json +85 -0
- package/public/favicon.ico +0 -0
- package/src/App.vue +368 -0
- package/src/assets/fonts/Faruma.ttf +0 -0
- package/src/components/examples/AppBarExample.vue +101 -0
- package/src/components/examples/AvatarExample.vue +47 -0
- package/src/components/examples/BannerExample.vue +287 -0
- package/src/components/examples/BaseInputExample.vue +25 -0
- package/src/components/examples/BreadcrumbExample.vue +53 -0
- package/src/components/examples/CardExample.vue +77 -0
- package/src/components/examples/ChipExample.vue +225 -0
- package/src/components/examples/DatePickerExample.vue +31 -0
- package/src/components/examples/DropdownExample.vue +84 -0
- package/src/components/examples/EditorExample.vue +200 -0
- package/src/components/examples/ExpansionPanelExample.vue +42 -0
- package/src/components/examples/FileUploadExample.vue +40 -0
- package/src/components/examples/FormExample.vue +121 -0
- package/src/components/examples/HugeTest.vue +8 -0
- package/src/components/examples/LayoutContainerExample.vue +80 -0
- package/src/components/examples/ModalExample.vue +82 -0
- package/src/components/examples/NavDrawerExample.vue +170 -0
- package/src/components/examples/NumberFieldExample.vue +145 -0
- package/src/components/examples/RadioButtonExample.vue +161 -0
- package/src/components/examples/SearchExample.vue +322 -0
- package/src/components/examples/SelectExample.vue +121 -0
- package/src/components/examples/StackedTableViewExample.vue +53 -0
- package/src/components/examples/TabExample.vue +336 -0
- package/src/components/examples/TableExample.vue +228 -0
- package/src/components/examples/TextFieldExample.vue +181 -0
- package/src/components/examples/TextareaExample.vue +173 -0
- package/src/components/examples/ThemeToggle.vue +50 -0
- package/src/components/examples/TimelineExample.vue +66 -0
- package/src/components/examples/TipTapEditorExample.vue +20 -0
- package/src/components/examples/TooltipExample.vue +53 -0
- package/src/components/examples/VueDatePickerShowcase.vue +214 -0
- package/src/components/examples/_DatePickerExample.vue +33 -0
- package/src/components/examples/__FormExample.vue +77 -0
- package/src/components/index.ts +25 -0
- package/src/components/pgo/AppBar.vue +347 -0
- package/src/components/pgo/Avatar.vue +139 -0
- package/src/components/pgo/Banner.vue +300 -0
- package/src/components/pgo/Breadcrumb.vue +101 -0
- package/src/components/pgo/Button.vue +171 -0
- package/src/components/pgo/Card.vue +178 -0
- package/src/components/pgo/ConfirmationModel.vue +32 -0
- package/src/components/pgo/DataTable.vue +845 -0
- package/src/components/pgo/DatePicker/CalendarPanel.vue +43 -0
- package/src/components/pgo/DatePicker/__DatePicker.vue +122 -0
- package/src/components/pgo/DatePicker/types.ts +11 -0
- package/src/components/pgo/DatePicker/useCalendar.ts +39 -0
- package/src/components/pgo/DatePicker/useDatePicker.ts +31 -0
- package/src/components/pgo/Deprecated/ToastContainer.vue +51 -0
- package/src/components/pgo/Deprecated/ToastItem.vue +55 -0
- package/src/components/pgo/Dropdown.vue +296 -0
- package/src/components/pgo/DropdownItem.vue +40 -0
- package/src/components/pgo/Editor.vue +511 -0
- package/src/components/pgo/ExpansionPanel.vue +185 -0
- package/src/components/pgo/Footer.vue +39 -0
- package/src/components/pgo/HeroIcon.vue +124 -0
- package/src/components/pgo/InputSearch.vue +194 -0
- package/src/components/pgo/LayoutContainer.vue +104 -0
- package/src/components/pgo/Main.vue +37 -0
- package/src/components/pgo/Modal.vue +273 -0
- package/src/components/pgo/NavDrawer.vue +127 -0
- package/src/components/pgo/NavDrawerItem.vue +161 -0
- package/src/components/pgo/NavigationDrawer.vue +849 -0
- package/src/components/pgo/OLDNavDrawer.vue +661 -0
- package/src/components/pgo/OldAppBar.vue +223 -0
- package/src/components/pgo/PApp.vue +102 -0
- package/src/components/pgo/Pagination.vue +242 -0
- package/src/components/pgo/Search copy.vue +310 -0
- package/src/components/pgo/Search.vue +411 -0
- package/src/components/pgo/StackedTableView.vue +167 -0
- package/src/components/pgo/Tab.vue +617 -0
- package/src/components/pgo/TestInput.vue +395 -0
- package/src/components/pgo/Timeline.vue +367 -0
- package/src/components/pgo/TimelineItem.vue +80 -0
- package/src/components/pgo/TipTapEditor.vue +315 -0
- package/src/components/pgo/Tooltip.NOTES.md +12 -0
- package/src/components/pgo/Tooltip.PROPS.md +21 -0
- package/src/components/pgo/Tooltip.vue +281 -0
- package/src/components/pgo/base/Base.vue +444 -0
- package/src/components/pgo/buttons/Chip.vue +324 -0
- package/src/components/pgo/buttons/ChipGroup.vue +224 -0
- package/src/components/pgo/buttons/Radio.vue +424 -0
- package/src/components/pgo/filters/FilterSection.vue +188 -0
- package/src/components/pgo/filters/Searchbar.vue +216 -0
- package/src/components/pgo/forms/DynamicForm.vue +45 -0
- package/src/components/pgo/forms/Form.vue +132 -0
- package/src/components/pgo/index.ts +15 -0
- package/src/components/pgo/inputs/Checkbox.vue +320 -0
- package/src/components/pgo/inputs/DatePicker.vue +395 -0
- package/src/components/pgo/inputs/FileUpload.vue +326 -0
- package/src/components/pgo/inputs/NumberField.vue +243 -0
- package/src/components/pgo/inputs/Radio.vue +162 -0
- package/src/components/pgo/inputs/RadioGroup.vue +188 -0
- package/src/components/pgo/inputs/Select.vue +535 -0
- package/src/components/pgo/inputs/TextField.vue +194 -0
- package/src/components/pgo/inputs/Textarea.vue +181 -0
- package/src/main.js +12 -0
- package/src/pgo-components/_index.js +31 -0
- package/src/pgo-components/assets/fonts/Faruma.ttf +0 -0
- package/src/pgo-components/assets/fonts/logo.png +0 -0
- package/src/pgo-components/composables/useTheme.js +10 -0
- package/src/pgo-components/directives/tooltip-directive.ts +393 -0
- package/src/pgo-components/index.js +96 -0
- package/src/pgo-components/lib/componentConfig.js +147 -0
- package/src/pgo-components/lib/core/composables/_useCalendar.ts +127 -0
- package/src/pgo-components/lib/core/composables/useDefaults.ts +15 -0
- package/src/pgo-components/lib/core/composables/useLanguageSelect.js +0 -0
- package/src/pgo-components/lib/core/composables/useRtl.ts +12 -0
- package/src/pgo-components/lib/core/defaults/createDefaults.ts +5 -0
- package/src/pgo-components/lib/core/defaults/defaults.ts +7 -0
- package/src/pgo-components/lib/core/rtl/rtl.ts +3 -0
- package/src/pgo-components/lib/core/rtl/setRtl.ts +19 -0
- package/src/pgo-components/lib/drawerState.ts +3 -0
- package/src/pgo-components/lib/i18n/defaultLables.js +71 -0
- package/src/pgo-components/lib/i18n/i18nPlugin.js +52 -0
- package/src/pgo-components/lib/i18n/useI18n.js +35 -0
- package/src/pgo-components/lib/index.ts +38 -0
- package/src/pgo-components/pages/Component.vue +7 -0
- package/src/pgo-components/pages/ComponentRenderer.vue +85 -0
- package/src/pgo-components/pages/Home.vue +130 -0
- package/src/pgo-components/pages/ListView.vue +370 -0
- package/src/pgo-components/pages/Page1.vue +296 -0
- package/src/pgo-components/pages/_Page1.vue +180 -0
- package/src/pgo-components/plugins/SnackBar.vue +251 -0
- package/src/pgo-components/plugins/SnackBarContainer.vue +53 -0
- package/src/pgo-components/plugins/SnackBarPlugin.ts +136 -0
- package/src/pgo-components/plugins/theme-plugin.js +114 -0
- package/src/pgo-components/plugins/types.ts +46 -0
- package/src/pgo-components/plugins/useSnackBar.js +11 -0
- package/src/pgo-components/plugins/useSnackBar.ts +21 -0
- package/src/pgo-components/plugins/validation-plugin.js +11 -0
- package/src/pgo-components/services/Entry.json +813 -0
- package/src/pgo-components/services/axios.js +54 -0
- package/src/pgo-components/services/data.json +90 -0
- package/src/pgo-components/services/person.json +260 -0
- package/src/pgo-components/services/toast.ts +44 -0
- package/src/pgo-components/styles/global.css +234 -0
- package/src/pgo-components/styles/reset.css +96 -0
- package/src/pgo-components/styles/tokens.css +18 -0
- package/src/pgo-components/styles/utilities/border-radius.css +57 -0
- package/src/pgo-components/styles/utilities/borders.css +85 -0
- package/src/pgo-components/styles/utilities/colors.css +38 -0
- package/src/pgo-components/styles/utilities/cursor.css +19 -0
- package/src/pgo-components/styles/utilities/display.css +78 -0
- package/src/pgo-components/styles/utilities/elevation.css +33 -0
- package/src/pgo-components/styles/utilities/flex.css +403 -0
- package/src/pgo-components/styles/utilities/float.css +41 -0
- package/src/pgo-components/styles/utilities/hover.css +9 -0
- package/src/pgo-components/styles/utilities/index.css +18 -0
- package/src/pgo-components/styles/utilities/opacity.css +27 -0
- package/src/pgo-components/styles/utilities/overflow.css +26 -0
- package/src/pgo-components/styles/utilities/palette.css +515 -0
- package/src/pgo-components/styles/utilities/position.css +14 -0
- package/src/pgo-components/styles/utilities/sizing.css +70 -0
- package/src/pgo-components/styles/utilities/spacing.css +578 -0
- package/src/pgo-components/styles/utilities/transitions.css +58 -0
- package/src/pgo-components/styles/utilities/typography.css +91 -0
- package/src/pgo-components/styles/utilities/z-index.css +11 -0
- package/src/pgo-components/tokens/index.js +337 -0
- package/src/router/index.js +88 -0
- package/src/shims-vue.d.ts +14 -0
- package/src/validations/validationRules.js +50 -0
- package/tailwind.config.js +73 -0
- package/test.php +5 -0
- package/tsconfig.json +25 -0
- package/ui +31 -0
- package/ui.pgo.mv.conf +18 -0
- package/vite.config.js +42 -0
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
ref="containerRef"
|
|
4
|
+
:class="['relative', containerClass, width]"
|
|
5
|
+
>
|
|
6
|
+
<Base
|
|
7
|
+
:model-value="modelValue"
|
|
8
|
+
:label="label"
|
|
9
|
+
:hint="hint"
|
|
10
|
+
:persistent-hint="!!hint"
|
|
11
|
+
:disabled="disabled"
|
|
12
|
+
:readonly="readonly"
|
|
13
|
+
:required="required"
|
|
14
|
+
:error="!!error || errorMessages.length > 0"
|
|
15
|
+
:error-messages="errorMessages"
|
|
16
|
+
:clearable="clearable && !loading"
|
|
17
|
+
:size="size"
|
|
18
|
+
:id="inputId"
|
|
19
|
+
:prepend="prepend"
|
|
20
|
+
:append="append"
|
|
21
|
+
:is-open="isFocused"
|
|
22
|
+
@click:clear="clear"
|
|
23
|
+
:bg="bg"
|
|
24
|
+
:border="border"
|
|
25
|
+
:text-color="textColor"
|
|
26
|
+
:rounded="rounded"
|
|
27
|
+
:dir="computedDir"
|
|
28
|
+
:lang="computedLang"
|
|
29
|
+
:width="width"
|
|
30
|
+
:rules="rules"
|
|
31
|
+
>
|
|
32
|
+
<template #control="{ attrs, events }">
|
|
33
|
+
<input
|
|
34
|
+
ref="inputRef"
|
|
35
|
+
v-bind="attrs"
|
|
36
|
+
v-on="events"
|
|
37
|
+
type="text"
|
|
38
|
+
:value="modelValue"
|
|
39
|
+
:placeholder="isFocused && !modelValue ? placeholder : ''"
|
|
40
|
+
:class="inputClasses"
|
|
41
|
+
@input="handleInput"
|
|
42
|
+
@keydown.enter="handleEnter"
|
|
43
|
+
@focus="handleFocus"
|
|
44
|
+
@blur="handleBlur"
|
|
45
|
+
/>
|
|
46
|
+
</template>
|
|
47
|
+
|
|
48
|
+
<!-- Loading spinner in append slot -->
|
|
49
|
+
<template v-if="loading" #append>
|
|
50
|
+
<svg class="animate-spin h-4 w-4" fill="none" viewBox="0 0 24 24">
|
|
51
|
+
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
|
|
52
|
+
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 714 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
|
|
53
|
+
</svg>
|
|
54
|
+
</template>
|
|
55
|
+
</Base>
|
|
56
|
+
</div>
|
|
57
|
+
</template>
|
|
58
|
+
|
|
59
|
+
<script setup>
|
|
60
|
+
import { ref, computed, inject, onBeforeUnmount } from 'vue'
|
|
61
|
+
import Base from '../base/Base.vue'
|
|
62
|
+
import { roundedMap, sizes, iconSizes } from '../../../pgo-components/lib/componentConfig'
|
|
63
|
+
|
|
64
|
+
const props = defineProps({
|
|
65
|
+
modelValue: { type: [String, Number], default: '' },
|
|
66
|
+
label: { type: [String, Object], default: '' },
|
|
67
|
+
placeholder: { type: String, default: 'text ...' },
|
|
68
|
+
hint: { type: String, default: '' },
|
|
69
|
+
error: { type: String, default: '' },
|
|
70
|
+
errorMessages: { type: Array, default: () => [] },
|
|
71
|
+
disabled: { type: Boolean, default: false },
|
|
72
|
+
readonly: { type: Boolean, default: false },
|
|
73
|
+
required: { type: Boolean, default: false },
|
|
74
|
+
clearable: { type: Boolean, default: true },
|
|
75
|
+
loading: { type: Boolean, default: false },
|
|
76
|
+
prepend: { type: String, default: '' },
|
|
77
|
+
append: { type: String, default: '' },
|
|
78
|
+
rules: { type: Array, default: () => [] }, // ADD THIS
|
|
79
|
+
|
|
80
|
+
// Search behavior
|
|
81
|
+
// debounce: { type: Number, default: 300 },
|
|
82
|
+
|
|
83
|
+
// Appearance
|
|
84
|
+
size: { type: String },
|
|
85
|
+
rounded: { type: String },
|
|
86
|
+
border: { type: String},
|
|
87
|
+
textColor: { type: String },
|
|
88
|
+
bg: { type: String },
|
|
89
|
+
containerClass: { type: String, default: '' },
|
|
90
|
+
id: { type: String, default: '' },
|
|
91
|
+
width: { type: String, default: 'w-full' },
|
|
92
|
+
|
|
93
|
+
// RTL/Lang support
|
|
94
|
+
dir: { type: String, default: '' },
|
|
95
|
+
lang: { type: String, default: '' },
|
|
96
|
+
|
|
97
|
+
// Props that might be passed but not used (to avoid warnings)
|
|
98
|
+
items: { type: Array, default: () => [] },
|
|
99
|
+
itemText: { type: String, default: 'text' },
|
|
100
|
+
itemValue: { type: String, default: 'value' },
|
|
101
|
+
})
|
|
102
|
+
|
|
103
|
+
// Inject dir from parent Card (if exists)
|
|
104
|
+
const cardDir = inject('parentDir', '')
|
|
105
|
+
const cardLang = inject('parentLang', '')
|
|
106
|
+
|
|
107
|
+
// Use component's dir if provided, otherwise use card's dir
|
|
108
|
+
const computedDir = computed(() => props.dir || cardDir)
|
|
109
|
+
const computedLang = computed(() => props.lang || cardLang)
|
|
110
|
+
|
|
111
|
+
const emit = defineEmits([
|
|
112
|
+
'update:modelValue',
|
|
113
|
+
'input',
|
|
114
|
+
'change',
|
|
115
|
+
'focus',
|
|
116
|
+
'blur',
|
|
117
|
+
'clear',
|
|
118
|
+
// 'search',
|
|
119
|
+
'enter'
|
|
120
|
+
])
|
|
121
|
+
|
|
122
|
+
const inputRef = ref(null)
|
|
123
|
+
const containerRef = ref(null)
|
|
124
|
+
const isFocused = ref(false)
|
|
125
|
+
// let debounceTimeout = null
|
|
126
|
+
|
|
127
|
+
// Generate unique ID
|
|
128
|
+
const inputId = computed(() => props.id || `input-${Math.random().toString(36).substr(2, 9)}`)
|
|
129
|
+
|
|
130
|
+
// Input classes
|
|
131
|
+
const inputClasses = computed(() => [
|
|
132
|
+
'w-full bg-transparent outline-none border-none',
|
|
133
|
+
'placeholder:text-gray-400',
|
|
134
|
+
'focus:outline-none'
|
|
135
|
+
])
|
|
136
|
+
|
|
137
|
+
// Handlers
|
|
138
|
+
const handleInput = (e) => {
|
|
139
|
+
const value = e.target.value
|
|
140
|
+
|
|
141
|
+
// Update immediately for label animation
|
|
142
|
+
emit('update:modelValue', value)
|
|
143
|
+
|
|
144
|
+
// clearTimeout(debounceTimeout)
|
|
145
|
+
// debounceTimeout = setTimeout(() => {
|
|
146
|
+
// emit('input', value)
|
|
147
|
+
// emit('search', value)
|
|
148
|
+
// }, props.debounce)
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
const handleFocus = (event) => {
|
|
152
|
+
isFocused.value = true
|
|
153
|
+
emit('focus', event)
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
const handleBlur = (event) => {
|
|
157
|
+
isFocused.value = false
|
|
158
|
+
emit('blur', event)
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
const handleEnter = (event) => {
|
|
162
|
+
emit('enter', props.modelValue)
|
|
163
|
+
// emit('search', props.modelValue)
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
const clear = () => {
|
|
167
|
+
emit('update:modelValue', '')
|
|
168
|
+
emit('clear')
|
|
169
|
+
inputRef.value?.focus()
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// Focus method
|
|
173
|
+
const focus = () => {
|
|
174
|
+
inputRef.value?.focus()
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// Lifecycle
|
|
178
|
+
// onBeforeUnmount(() => {
|
|
179
|
+
// clearTimeout(debounceTimeout)
|
|
180
|
+
// })
|
|
181
|
+
|
|
182
|
+
// Expose methods
|
|
183
|
+
defineExpose({ focus, clear })
|
|
184
|
+
</script>
|
|
185
|
+
|
|
186
|
+
<style scoped>
|
|
187
|
+
/* Remove default search input styling */
|
|
188
|
+
/* input[type="search"]::-webkit-search-decoration,
|
|
189
|
+
input[type="search"]::-webkit-search-cancel-button,
|
|
190
|
+
input[type="search"]::-webkit-search-results-button,
|
|
191
|
+
input[type="search"]::-webkit-search-results-decoration {
|
|
192
|
+
display: none;
|
|
193
|
+
} */
|
|
194
|
+
</style>
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
ref="containerRef"
|
|
4
|
+
:class="['relative', containerClass, width]"
|
|
5
|
+
>
|
|
6
|
+
<Base
|
|
7
|
+
v-bind="$props"
|
|
8
|
+
:model-value="modelValue"
|
|
9
|
+
:error="!!error || errorMessages.length > 0"
|
|
10
|
+
:clearable="clearable && !loading"
|
|
11
|
+
:id="inputId"
|
|
12
|
+
:is-open="isFocused"
|
|
13
|
+
@click:clear="clear"
|
|
14
|
+
:dir="computedDir"
|
|
15
|
+
:lang="computedLang"
|
|
16
|
+
:rules="rules"
|
|
17
|
+
>
|
|
18
|
+
<template #control="{ attrs, events }">
|
|
19
|
+
<textarea
|
|
20
|
+
ref="inputRef"
|
|
21
|
+
v-bind="attrs"
|
|
22
|
+
v-on="events"
|
|
23
|
+
type="text"
|
|
24
|
+
:value="modelValue"
|
|
25
|
+
:placeholder="isFocused && !modelValue ? placeholder : ''"
|
|
26
|
+
:class="inputClasses"
|
|
27
|
+
:rows="rows"
|
|
28
|
+
:maxlength="maxlength"
|
|
29
|
+
@input="handleInput"
|
|
30
|
+
@keydown.enter="handleEnter"
|
|
31
|
+
@focus="handleFocus"
|
|
32
|
+
@blur="handleBlur"
|
|
33
|
+
/>
|
|
34
|
+
</template>
|
|
35
|
+
|
|
36
|
+
<!-- Loading spinner in append slot -->
|
|
37
|
+
<template v-if="loading" #append>
|
|
38
|
+
<svg class="animate-spin h-4 w-4" fill="none" viewBox="0 0 24 24">
|
|
39
|
+
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
|
|
40
|
+
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 714 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
|
|
41
|
+
</svg>
|
|
42
|
+
</template>
|
|
43
|
+
</Base>
|
|
44
|
+
</div>
|
|
45
|
+
</template>
|
|
46
|
+
|
|
47
|
+
<script setup>
|
|
48
|
+
import { ref, computed, inject, onBeforeUnmount } from 'vue'
|
|
49
|
+
import Base from '../base/Base.vue'
|
|
50
|
+
import { roundedMap, sizes, iconSizes, heights } from '../../../pgo-components/lib/componentConfig'
|
|
51
|
+
|
|
52
|
+
const props = defineProps({
|
|
53
|
+
modelValue: { type: [String, Number], default: '' },
|
|
54
|
+
label: { type: [String, Object], default: '' },
|
|
55
|
+
placeholder: { type: String, default: 'text ...' },
|
|
56
|
+
hint: { type: String, default: '' },
|
|
57
|
+
error: { type: String, default: '' },
|
|
58
|
+
errorMessages: { type: Array, default: () => [] },
|
|
59
|
+
disabled: { type: Boolean, default: false },
|
|
60
|
+
readonly: { type: Boolean, default: false },
|
|
61
|
+
required: { type: Boolean, default: false },
|
|
62
|
+
clearable: { type: Boolean, default: true },
|
|
63
|
+
loading: { type: Boolean, default: false },
|
|
64
|
+
prepend: { type: String, default: '' },
|
|
65
|
+
append: { type: String, default: '' },
|
|
66
|
+
rules: { type: Array, default: () => [] }, // ADD THIS
|
|
67
|
+
rows: { type: [Number, String], default: 3 },
|
|
68
|
+
maxlength: { type: [Number, String], default: null },
|
|
69
|
+
|
|
70
|
+
size: { type: String },
|
|
71
|
+
rounded: { type: String },
|
|
72
|
+
border: { type: String},
|
|
73
|
+
textColor: { type: String },
|
|
74
|
+
bg: { type: String },
|
|
75
|
+
containerClass: { type: String, default: '' },
|
|
76
|
+
id: { type: String, default: '' },
|
|
77
|
+
width: { type: String, default: 'w-full' },
|
|
78
|
+
|
|
79
|
+
// RTL/Lang support
|
|
80
|
+
dir: { type: String, default: '' },
|
|
81
|
+
lang: { type: String, default: '' },
|
|
82
|
+
|
|
83
|
+
// Props that might be passed but not used (to avoid warnings)
|
|
84
|
+
items: { type: Array, default: () => [] },
|
|
85
|
+
itemText: { type: String, default: 'text' },
|
|
86
|
+
itemValue: { type: String, default: 'value' },
|
|
87
|
+
height: { type: String, default: 'h-auto' },
|
|
88
|
+
})
|
|
89
|
+
|
|
90
|
+
// Inject dir from parent Card (if exists)
|
|
91
|
+
const cardDir = inject('parentDir', '')
|
|
92
|
+
const cardLang = inject('parentLang', '')
|
|
93
|
+
|
|
94
|
+
// Use component's dir if provided, otherwise use card's dir
|
|
95
|
+
const computedDir = computed(() => props.dir || cardDir)
|
|
96
|
+
const computedLang = computed(() => props.lang || cardLang)
|
|
97
|
+
|
|
98
|
+
const emit = defineEmits([
|
|
99
|
+
'update:modelValue',
|
|
100
|
+
'input',
|
|
101
|
+
'change',
|
|
102
|
+
'focus',
|
|
103
|
+
'blur',
|
|
104
|
+
'clear',
|
|
105
|
+
// 'search',
|
|
106
|
+
'enter'
|
|
107
|
+
])
|
|
108
|
+
|
|
109
|
+
const inputRef = ref(null)
|
|
110
|
+
const containerRef = ref(null)
|
|
111
|
+
const isFocused = ref(false)
|
|
112
|
+
// let debounceTimeout = null
|
|
113
|
+
|
|
114
|
+
// Generate unique ID
|
|
115
|
+
const inputId = computed(() => props.id || `input-${Math.random().toString(36).substr(2, 9)}`)
|
|
116
|
+
|
|
117
|
+
// Input classes
|
|
118
|
+
const inputClasses = computed(() => [
|
|
119
|
+
'w-full bg-transparent outline-none border-none',
|
|
120
|
+
'placeholder:text-gray-400',
|
|
121
|
+
'focus:outline-none'
|
|
122
|
+
])
|
|
123
|
+
|
|
124
|
+
// Handlers
|
|
125
|
+
const handleInput = (e) => {
|
|
126
|
+
const value = e.target.value
|
|
127
|
+
|
|
128
|
+
// Update immediately for label animation
|
|
129
|
+
emit('update:modelValue', value)
|
|
130
|
+
|
|
131
|
+
// clearTimeout(debounceTimeout)
|
|
132
|
+
// debounceTimeout = setTimeout(() => {
|
|
133
|
+
// emit('input', value)
|
|
134
|
+
// emit('search', value)
|
|
135
|
+
// }, props.debounce)
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
const handleFocus = (event) => {
|
|
139
|
+
isFocused.value = true
|
|
140
|
+
emit('focus', event)
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
const handleBlur = (event) => {
|
|
144
|
+
isFocused.value = false
|
|
145
|
+
emit('blur', event)
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
const handleEnter = (event) => {
|
|
149
|
+
emit('enter', props.modelValue)
|
|
150
|
+
// emit('search', props.modelValue)
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
const clear = () => {
|
|
154
|
+
emit('update:modelValue', '')
|
|
155
|
+
emit('clear')
|
|
156
|
+
inputRef.value?.focus()
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// Focus method
|
|
160
|
+
const focus = () => {
|
|
161
|
+
inputRef.value?.focus()
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// Lifecycle
|
|
165
|
+
// onBeforeUnmount(() => {
|
|
166
|
+
// clearTimeout(debounceTimeout)
|
|
167
|
+
// })
|
|
168
|
+
|
|
169
|
+
// Expose methods
|
|
170
|
+
defineExpose({ focus, clear })
|
|
171
|
+
</script>
|
|
172
|
+
|
|
173
|
+
<style scoped>
|
|
174
|
+
/* Remove default search input styling */
|
|
175
|
+
/* input[type="search"]::-webkit-search-decoration,
|
|
176
|
+
input[type="search"]::-webkit-search-cancel-button,
|
|
177
|
+
input[type="search"]::-webkit-search-results-button,
|
|
178
|
+
input[type="search"]::-webkit-search-results-decoration {
|
|
179
|
+
display: none;
|
|
180
|
+
} */
|
|
181
|
+
</style>
|
package/src/main.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// src/index.js
|
|
2
|
+
import './styles/global.css'
|
|
3
|
+
import { createThemePlugin } from './plugins/theme-plugin.js'
|
|
4
|
+
import { themes } from './tokens/index.js'
|
|
5
|
+
import { useTheme as _useTheme } from './composables/useTheme.js'
|
|
6
|
+
import { i18nPlugin } from './lib/i18n/i18nPlugin'
|
|
7
|
+
import { SnackBarPlugin } from './plugins/SnackBarPlugin.ts'
|
|
8
|
+
import validationPlugin from './plugins/validation-plugin'
|
|
9
|
+
import { tooltipDirective } from './directives/tooltip-directive.ts'
|
|
10
|
+
import api from './services/axios'
|
|
11
|
+
|
|
12
|
+
// create default plugin instance
|
|
13
|
+
const plugin = createThemePlugin({ themes, defaultTheme: 'default', defaultVariant: 'light' })
|
|
14
|
+
|
|
15
|
+
// attach to window for the demo/example app convenience
|
|
16
|
+
if (typeof window !== 'undefined') {
|
|
17
|
+
window.__VTS_PLUGIN__ = plugin
|
|
18
|
+
window.__VTS_THEMES__ = Object.keys(themes)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export {
|
|
22
|
+
createThemePlugin,
|
|
23
|
+
plugin as defaultPlugin,
|
|
24
|
+
themes,
|
|
25
|
+
_useTheme as useTheme,
|
|
26
|
+
i18nPlugin,
|
|
27
|
+
SnackBarPlugin,
|
|
28
|
+
validationPlugin,
|
|
29
|
+
tooltipDirective,
|
|
30
|
+
api
|
|
31
|
+
}
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// src/composables/useTheme.js
|
|
2
|
+
import { inject } from 'vue';
|
|
3
|
+
|
|
4
|
+
export function useTheme() {
|
|
5
|
+
const themeState = inject('vts-theme');
|
|
6
|
+
if (!themeState) {
|
|
7
|
+
throw new Error('[vts] theme plugin not installed. Did you call app.use(plugin)?');
|
|
8
|
+
}
|
|
9
|
+
return themeState;
|
|
10
|
+
}
|