Major overhaul to the theme and now functioning.

This commit is contained in:
david committed 2026-01-05 16:07:30 -05:00
1 parent 5823ca3c39
commit a475dfeab6
5218 files changed
+1643729 -13229

No files matched your search

@@ -0,0 +1,83 @@
/* region BLOCK */
.v-text-field input {
color: inherit;
flex: 1;
transition: 0.15s opacity cubic-bezier(0.4, 0, 0.2, 1);
min-width: 0;
}
.v-text-field input:focus, .v-text-field input:active {
outline: none;
}
.v-text-field input:invalid {
box-shadow: none;
}
.v-text-field .v-field {
cursor: text;
}
.v-text-field--prefixed.v-text-field .v-field:not(.v-field--reverse) .v-field__input {
--v-field-padding-start: 6px;
}
.v-text-field--suffixed.v-text-field .v-field:not(.v-field--reverse) .v-field__input {
--v-field-padding-end: 0;
}
.v-text-field--prefixed.v-text-field .v-field.v-field--reverse .v-field__input {
--v-field-padding-end: 6px;
}
.v-text-field--suffixed.v-text-field .v-field.v-field--reverse .v-field__input {
--v-field-padding-start: 0;
}
.v-text-field .v-field:not(.v-field--no-label, .v-field--active) input::placeholder {
opacity: 0;
}
.v-text-field .v-input__details {
padding-inline: 16px;
}
.v-input--plain-underlined.v-text-field .v-input__details {
padding-inline: 0;
}
.v-text-field .v-field--single-line input {
transition: none;
}
/* endregion */
/* region ELEMENTS */
.v-text-field__prefix, .v-text-field__suffix {
align-items: center;
color: rgba(var(--v-theme-on-surface), var(--v-medium-emphasis-opacity));
cursor: default;
display: flex;
opacity: 0;
transition: inherit;
white-space: nowrap;
min-height: max(var(--v-input-control-height, 56px), 1.5rem + var(--v-field-input-padding-top) + var(--v-field-input-padding-bottom));
padding-top: calc(var(--v-field-padding-top, 4px) + var(--v-input-padding-top, 0));
padding-bottom: var(--v-field-padding-bottom, 6px);
}
.v-field--active .v-text-field__prefix, .v-field--active .v-text-field__suffix {
opacity: 1;
}
.v-field--disabled .v-text-field__prefix, .v-field--disabled .v-text-field__suffix {
color: rgba(var(--v-theme-on-surface), var(--v-disabled-opacity));
}
.v-field:not(.v-field--reverse) .v-text-field__prefix {
padding-inline-start: var(--v-field-padding-start);
}
.v-field.v-field--reverse .v-text-field__prefix {
padding-inline-end: var(--v-field-padding-end);
}
.v-field:not(.v-field--reverse) .v-text-field__suffix {
padding-inline-end: var(--v-field-padding-end);
}
.v-field.v-field--reverse .v-text-field__suffix {
padding-inline-start: var(--v-field-padding-start);
}
/* endregion */
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,236 @@
import { mergeProps as _mergeProps, createElementVNode as _createElementVNode, Fragment as _Fragment, normalizeClass as _normalizeClass, createVNode as _createVNode } from "vue";
// Styles
import "./VTextField.css";
// Components
import { VCounter } from "../VCounter/VCounter.js";
import { makeVFieldProps, VField } from "../VField/VField.js";
import { makeVInputProps, VInput } from "../VInput/VInput.js"; // Composables
import { makeAutocompleteProps, useAutocomplete } from "../../composables/autocomplete.js";
import { useAutofocus } from "../../composables/autofocus.js";
import { useFocus } from "../../composables/focus.js";
import { forwardRefs } from "../../composables/forwardRefs.js";
import { useProxiedModel } from "../../composables/proxiedModel.js"; // Directives
import vIntersect from "../../directives/intersect/index.js"; // Utilities
import { cloneVNode, computed, nextTick, ref, withDirectives } from 'vue';
import { callEvent, filterInputAttrs, genericComponent, omit, propsFactory, useRender } from "../../util/index.js"; // Types
const activeTypes = ['color', 'file', 'time', 'date', 'datetime-local', 'week', 'month'];
export const makeVTextFieldProps = propsFactory({
autofocus: Boolean,
counter: [Boolean, Number, String],
counterValue: [Number, Function],
prefix: String,
placeholder: String,
persistentPlaceholder: Boolean,
persistentCounter: Boolean,
suffix: String,
role: String,
type: {
type: String,
default: 'text'
},
modelModifiers: Object,
...makeAutocompleteProps(),
...makeVInputProps(),
...makeVFieldProps()
}, 'VTextField');
export const VTextField = genericComponent()({
name: 'VTextField',
directives: {
vIntersect
},
inheritAttrs: false,
props: makeVTextFieldProps(),
emits: {
'click:control': e => true,
'mousedown:control': e => true,
'update:focused': focused => true,
'update:modelValue': val => true
},
setup(props, _ref) {
let {
attrs,
emit,
slots
} = _ref;
const model = useProxiedModel(props, 'modelValue');
const {
isFocused,
focus,
blur
} = useFocus(props);
const {
onIntersect
} = useAutofocus(props);
const counterValue = computed(() => {
return typeof props.counterValue === 'function' ? props.counterValue(model.value) : typeof props.counterValue === 'number' ? props.counterValue : (model.value ?? '').toString().length;
});
const max = computed(() => {
if (attrs.maxlength) return attrs.maxlength;
if (!props.counter || typeof props.counter !== 'number' && typeof props.counter !== 'string') return undefined;
return props.counter;
});
const isPlainOrUnderlined = computed(() => ['plain', 'underlined'].includes(props.variant));
const vInputRef = ref();
const vFieldRef = ref();
const inputRef = ref();
const autocomplete = useAutocomplete(props);
const isActive = computed(() => activeTypes.includes(props.type) || props.persistentPlaceholder || isFocused.value || props.active);
function onFocus() {
if (autocomplete.isSuppressing.value) {
autocomplete.update();
}
if (!isFocused.value) focus();
nextTick(() => {
if (inputRef.value !== document.activeElement) {
inputRef.value?.focus();
}
});
}
function onControlMousedown(e) {
emit('mousedown:control', e);
if (e.target === inputRef.value) return;
onFocus();
e.preventDefault();
}
function onControlClick(e) {
emit('click:control', e);
}
function onClear(e, reset) {
e.stopPropagation();
onFocus();
nextTick(() => {
reset();
callEvent(props['onClick:clear'], e);
});
}
function onInput(e) {
const el = e.target;
if (!(props.modelModifiers?.trim && ['text', 'search', 'password', 'tel', 'url'].includes(props.type))) {
model.value = el.value;
return;
}
const value = el.value;
const start = el.selectionStart;
const end = el.selectionEnd;
model.value = value;
nextTick(() => {
let offset = 0;
if (value.trimStart().length === el.value.length) {
// #22307 - Whitespace has been removed from the
// start, offset the caret position to compensate
offset = value.length - el.value.length;
}
if (start != null) el.selectionStart = start - offset;
if (end != null) el.selectionEnd = end - offset;
});
}
useRender(() => {
const hasCounter = !!(slots.counter || props.counter !== false && props.counter != null);
const hasDetails = !!(hasCounter || slots.details);
const [rootAttrs, inputAttrs] = filterInputAttrs(attrs);
const {
modelValue: _,
...inputProps
} = VInput.filterProps(props);
const fieldProps = VField.filterProps(props);
return _createVNode(VInput, _mergeProps({
"ref": vInputRef,
"modelValue": model.value,
"onUpdate:modelValue": $event => model.value = $event,
"class": ['v-text-field', {
'v-text-field--prefixed': props.prefix,
'v-text-field--suffixed': props.suffix,
'v-input--plain-underlined': isPlainOrUnderlined.value
}, props.class],
"style": props.style
}, rootAttrs, inputProps, {
"centerAffix": !isPlainOrUnderlined.value,
"focused": isFocused.value
}), {
...slots,
default: _ref2 => {
let {
id,
isDisabled,
isDirty,
isReadonly,
isValid,
hasDetails,
reset
} = _ref2;
return _createVNode(VField, _mergeProps({
"ref": vFieldRef,
"onMousedown": onControlMousedown,
"onClick": onControlClick,
"onClick:clear": e => onClear(e, reset),
"role": props.role
}, omit(fieldProps, ['onClick:clear']), {
"id": id.value,
"labelId": `${id.value}-label`,
"active": isActive.value || isDirty.value,
"dirty": isDirty.value || props.dirty,
"disabled": isDisabled.value,
"focused": isFocused.value,
"details": hasDetails.value,
"error": isValid.value === false
}), {
...slots,
default: _ref3 => {
let {
props: {
class: fieldClass,
...slotProps
},
controlRef
} = _ref3;
const inputNode = _createElementVNode("input", _mergeProps({
"ref": val => inputRef.value = controlRef.value = val,
"value": model.value,
"onInput": onInput,
"autofocus": props.autofocus,
"readonly": isReadonly.value,
"disabled": isDisabled.value,
"name": autocomplete.fieldName.value,
"autocomplete": autocomplete.fieldAutocomplete.value,
"placeholder": props.placeholder,
"size": 1,
"role": props.role,
"type": props.type,
"onFocus": focus,
"onBlur": blur,
"aria-labelledby": `${id.value}-label`
}, slotProps, inputAttrs), null);
return _createElementVNode(_Fragment, null, [props.prefix && _createElementVNode("span", {
"class": "v-text-field__prefix"
}, [_createElementVNode("span", {
"class": "v-text-field__prefix__text"
}, [props.prefix])]), withDirectives(slots.default ? _createElementVNode("div", {
"class": _normalizeClass(fieldClass),
"data-no-activator": ""
}, [slots.default({
id
}), inputNode]) : cloneVNode(inputNode, {
class: fieldClass
}), [[vIntersect, onIntersect, null, {
once: true
}]]), props.suffix && _createElementVNode("span", {
"class": "v-text-field__suffix"
}, [_createElementVNode("span", {
"class": "v-text-field__suffix__text"
}, [props.suffix])])]);
}
});
},
details: hasDetails ? slotProps => _createElementVNode(_Fragment, null, [slots.details?.(slotProps), hasCounter && _createElementVNode(_Fragment, null, [_createElementVNode("span", null, null), _createVNode(VCounter, {
"active": props.persistentCounter || isFocused.value,
"value": counterValue.value,
"max": max.value,
"disabled": props.disabled
}, slots.counter)])]) : undefined
});
});
return forwardRefs({}, vInputRef, vFieldRef, inputRef);
}
});
//# sourceMappingURL=VTextField.js.map
@@ -0,0 +1 @@
{"version":3,"file":"VTextField.js","names":["VCounter","makeVFieldProps","VField","makeVInputProps","VInput","makeAutocompleteProps","useAutocomplete","useAutofocus","useFocus","forwardRefs","useProxiedModel","vIntersect","cloneVNode","computed","nextTick","ref","withDirectives","callEvent","filterInputAttrs","genericComponent","omit","propsFactory","useRender","activeTypes","makeVTextFieldProps","autofocus","Boolean","counter","Number","String","counterValue","Function","prefix","placeholder","persistentPlaceholder","persistentCounter","suffix","role","type","default","modelModifiers","Object","VTextField","name","directives","inheritAttrs","props","emits","e","focused","val","setup","_ref","attrs","emit","slots","model","isFocused","focus","blur","onIntersect","value","toString","length","max","maxlength","undefined","isPlainOrUnderlined","includes","variant","vInputRef","vFieldRef","inputRef","autocomplete","isActive","active","onFocus","isSuppressing","update","document","activeElement","onControlMousedown","target","preventDefault","onControlClick","onClear","reset","stopPropagation","onInput","el","trim","start","selectionStart","end","selectionEnd","offset","trimStart","hasCounter","hasDetails","details","rootAttrs","inputAttrs","modelValue","_","inputProps","filterProps","fieldProps","_createVNode","_mergeProps","$event","class","style","_ref2","id","isDisabled","isDirty","isReadonly","isValid","dirty","_ref3","fieldClass","slotProps","controlRef","inputNode","_createElementVNode","fieldName","fieldAutocomplete","_Fragment","_normalizeClass","once","disabled"],"sources":["../../../src/components/VTextField/VTextField.tsx"],"sourcesContent":["// Styles\nimport './VTextField.sass'\n\n// Components\nimport { VCounter } from '@/components/VCounter/VCounter'\nimport { makeVFieldProps, VField } from '@/components/VField/VField'\nimport { makeVInputProps, VInput } from '@/components/VInput/VInput'\n\n// Composables\nimport { makeAutocompleteProps, useAutocomplete } from '@/composables/autocomplete'\nimport { useAutofocus } from '@/composables/autofocus'\nimport { useFocus } from '@/composables/focus'\nimport { forwardRefs } from '@/composables/forwardRefs'\nimport { useProxiedModel } from '@/composables/proxiedModel'\n\n// Directives\nimport vIntersect from '@/directives/intersect'\n\n// Utilities\nimport { cloneVNode, computed, nextTick, ref, withDirectives } from 'vue'\nimport { callEvent, filterInputAttrs, genericComponent, omit, propsFactory, useRender } from '@/util'\n\n// Types\nimport type { PropType, Ref } from 'vue'\nimport type { VCounterSlot } from '@/components/VCounter/VCounter'\nimport type { VFieldSlots } from '@/components/VField/VField'\nimport type { VInputSlots } from '@/components/VInput/VInput'\n\nconst activeTypes = ['color', 'file', 'time', 'date', 'datetime-local', 'week', 'month']\n\nexport const makeVTextFieldProps = propsFactory({\n autofocus: Boolean,\n counter: [Boolean, Number, String],\n counterValue: [Number, Function] as PropType<number | ((value: any) => number)>,\n prefix: String,\n placeholder: String,\n persistentPlaceholder: Boolean,\n persistentCounter: Boolean,\n suffix: String,\n role: String,\n type: {\n type: String,\n default: 'text',\n },\n modelModifiers: Object as PropType<Record<string, boolean>>,\n\n ...makeAutocompleteProps(),\n ...makeVInputProps(),\n ...makeVFieldProps(),\n}, 'VTextField')\n\nexport type VTextFieldSlots = Omit<VInputSlots & VFieldSlots, 'default'> & {\n default: { id: Readonly<Ref<string>> }\n counter: VCounterSlot\n}\n\nexport const VTextField = genericComponent<VTextFieldSlots>()({\n name: 'VTextField',\n\n directives: { vIntersect },\n\n inheritAttrs: false,\n\n props: makeVTextFieldProps(),\n\n emits: {\n 'click:control': (e: MouseEvent) => true,\n 'mousedown:control': (e: MouseEvent) => true,\n 'update:focused': (focused: boolean) => true,\n 'update:modelValue': (val: string) => true,\n },\n\n setup (props, { attrs, emit, slots }) {\n const model = useProxiedModel(props, 'modelValue')\n const { isFocused, focus, blur } = useFocus(props)\n const { onIntersect } = useAutofocus(props)\n const counterValue = computed(() => {\n return typeof props.counterValue === 'function' ? props.counterValue(model.value)\n : typeof props.counterValue === 'number' ? props.counterValue\n : (model.value ?? '').toString().length\n })\n const max = computed(() => {\n if (attrs.maxlength) return attrs.maxlength as unknown as undefined\n\n if (\n !props.counter ||\n (typeof props.counter !== 'number' &&\n typeof props.counter !== 'string')\n ) return undefined\n\n return props.counter\n })\n\n const isPlainOrUnderlined = computed(() => ['plain', 'underlined'].includes(props.variant))\n\n const vInputRef = ref<VInput>()\n const vFieldRef = ref<VField>()\n const inputRef = ref<HTMLInputElement>()\n const autocomplete = useLine truncated
@@ -0,0 +1,89 @@
@use 'sass:selector'
@use '../../styles/settings'
@use '../../styles/tools'
@use './variables' as *
@include tools.layer('components')
/* region BLOCK */
.v-text-field
input
color: inherit
flex: $text-field-input-flex
transition: $text-field-input-transition
min-width: 0
&:focus,
&:active
outline: none
// Remove Firefox red outline
&:invalid
box-shadow: none
.v-field
cursor: text
&:not(.v-field--reverse)
.v-field__input
@at-root #{selector.append('.v-text-field--prefixed', &)}
--v-field-padding-start: #{$text-field-input-padding-start}
@at-root #{selector.append('.v-text-field--suffixed', &)}
--v-field-padding-end: #{$text-field-input-padding-end}
&.v-field--reverse
.v-field__input
@at-root #{selector.append('.v-text-field--prefixed', &)}
--v-field-padding-end: #{$text-field-input-padding-start}
@at-root #{selector.append('.v-text-field--suffixed', &)}
--v-field-padding-start: #{$text-field-input-padding-end}
&:not(.v-field--no-label, .v-field--active)
input::placeholder
opacity: 0
.v-input__details
padding-inline: $text-field-details-padding-inline
@at-root #{selector.append('.v-input--plain-underlined', &)}
padding-inline: 0
.v-field--single-line
input
transition: none
/* endregion */
/* region ELEMENTS */
.v-text-field
&__prefix,
&__suffix
align-items: center
color: $text-field-affix-color
cursor: default
display: flex
opacity: 0
transition: inherit
white-space: nowrap
min-height: $field-input-min-height
padding-top: calc(var(--v-field-padding-top, 4px) + var(--v-input-padding-top, 0))
padding-bottom: var(--v-field-padding-bottom, 6px)
.v-field--active &
opacity: 1
.v-field--disabled &
color: $text-field-disabled-affix-color
&__prefix
@at-root #{selector.nest('.v-field:not(.v-field--reverse)', &)}
padding-inline-start: var(--v-field-padding-start)
@at-root #{selector.nest('.v-field.v-field--reverse', &)}
padding-inline-end: var(--v-field-padding-end)
&__suffix
@at-root #{selector.nest('.v-field:not(.v-field--reverse)', &)}
padding-inline-end: var(--v-field-padding-end)
@at-root #{selector.nest('.v-field.v-field--reverse', &)}
padding-inline-start: var(--v-field-padding-start)
/* endregion */
@@ -0,0 +1,12 @@
@forward '../VField/variables';
@use '../../styles/settings';
// VTextField
$text-field-affix-color: rgba(var(--v-theme-on-surface), var(--v-medium-emphasis-opacity)) !default;
$text-field-border-radius: settings.$border-radius-root !default;
$text-field-details-padding-inline: 16px !default;
$text-field-disabled-affix-color: rgba(var(--v-theme-on-surface), var(--v-disabled-opacity)) !default;
$text-field-input-flex: 1 !default;
$text-field-input-padding-end: 0 !default;
$text-field-input-padding-start: 6px !default;
$text-field-input-transition: .15s opacity settings.$standard-easing !default;
@@ -0,0 +1 @@
export { VTextField } from './VTextField.js';
@@ -0,0 +1,2 @@
export { VTextField } from "./VTextField.js";
//# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
{"version":3,"file":"index.js","names":["VTextField"],"sources":["../../../src/components/VTextField/index.ts"],"sourcesContent":["export { VTextField } from './VTextField'\n"],"mappings":"SAASA,UAAU","ignoreList":[]}