Skip to content

Beautiful Open-Source Form Builder

Tailwind variants migration (#880)

Julien Nahum325eed4f5ffe
diff --git a/client/components/forms/core/CheckboxInput.vue b/client/components/forms/core/CheckboxInput.vue
index 1634a9e1c..1e7ac57a0 100644
--- a/client/components/forms/core/CheckboxInput.vue
+++ b/client/components/forms/core/CheckboxInput.vue
@@ -12,7 +12,6 @@
:disabled="disabled ? true : null"
:name="name"
:color="color"
- :theme="theme"
/>
<div>
<slot
@@ -21,7 +20,7 @@
>
<InputHelp
:help="help"
- :help-classes="theme.default.help"
+ :help-classes="ui.help()"
>
<template #after-help>
<slot name="bottom_after_help" />
@@ -32,7 +31,7 @@
<label
:aria-label="id ? id : name"
:for="id ? id : name"
- :class="theme.default.fontSize"
+ :class="ui.label()"
>
{{ label }}
<span
@@ -47,7 +46,7 @@
>
<InputHelp
:help="help"
- :help-classes="theme.default.help"
+ :help-classes="ui.help()"
>
<template #after-help>
<slot name="bottom_after_help" />
@@ -70,6 +69,7 @@
<script>
import { inputProps, useFormInput } from '../useFormInput.js'
import VCheckbox from './components/VCheckbox.vue'
+import { checkboxInputTheme } from "~/lib/forms/themes/checkbox-input.theme.js"
export default {
name: 'CheckboxInput',
@@ -81,8 +81,11 @@ export default {
},
setup(props, context) {
+ const formInput = useFormInput(props, context, {
+ variants: checkboxInputTheme
+ })
return {
- ...useFormInput(props, context),
+ ...formInput
}
},
diff --git a/client/components/forms/core/ColorInput.vue b/client/components/forms/core/ColorInput.vue
index 3a5443f29..90bb1e9c6 100644
--- a/client/components/forms/core/ColorInput.vue
+++ b/client/components/forms/core/ColorInput.vue
@@ -15,9 +15,7 @@
>
<slot name="label">
<span
- :class="[
- theme.SelectInput.fontSize,
- ]"
+ :class="ui.label()"
>{{ label }}
<span
v-if="required"
@@ -38,6 +36,7 @@
<script setup>
import { inputProps, useFormInput } from "../useFormInput.js"
+import { colorInputTheme } from "~/lib/forms/themes/color-input.theme.js"
const props = defineProps({
...inputProps,
@@ -45,5 +44,7 @@ const props = defineProps({
const emit = defineEmits(['update:modelValue', 'focus', 'blur'])
-const { compVal, inputWrapperProps} = useFormInput(props, { emit })
+const { compVal, inputWrapperProps, ui } = useFormInput(props, { emit }, {
+ variants: colorInputTheme
+})
</script>
diff --git a/client/components/forms/core/FlatSelectInput.vue b/client/components/forms/core/FlatSelectInput.vue
index db9e88281..c7fcbcd03 100644
--- a/client/components/forms/core/FlatSelectInput.vue
+++ b/client/components/forms/core/FlatSelectInput.vue
@@ -12,46 +12,41 @@
<div
v-else
class="relative overflow-hidden"
- :class="[
- theme.default.input,
- theme.default.borderRadius,
- {
- '!ring-red-500 !ring-2 !border-transparent': hasError,
- '!cursor-not-allowed !bg-neutral-200 dark:!bg-neutral-800': disabled,
- },
- ]"
+ :class="ui.container()"
+ :role="multiple ? 'group' : 'radiogroup'"
+ :aria-label="label || `Select ${multiple ? 'options' : 'option'}`"
>
<template
v-if="options && options.length"
>
<div
- v-for="(option) in options"
+ v-for="(option, index) in options"
:key="option[optionKey]"
:role="multiple?'checkbox':'radio'"
:aria-checked="isSelected(option[optionKey])"
- class="relative"
:class="[
- theme.FlatSelectInput.spacing.vertical,
- theme.FlatSelectInput.fontSize,
- theme.FlatSelectInput.option,
- {
- '!cursor-not-allowed !bg-neutral-200 dark:!bg-neutral-800': disableOptions.includes(option[optionKey]),
- },
+ 'relative',
+ ui.option(),
+ ui.hover(),
+ { '!cursor-not-allowed !bg-neutral-200 dark:!bg-neutral-800': disableOptions.includes(option[optionKey]) }
]"
+ class="focus-visible:ring-2 focus-visible:ring-form/100 focus-visible:outline-none"
+ :tabindex="getOptionTabIndex(index)"
@click="onSelect(option[optionKey])"
+ @keydown="handleKeydown($event, index)"
>
<template v-if="multiple">
<CheckboxIcon
:is-checked="isSelected(option[optionKey])"
:color="color"
- :theme="theme"
+ :theme="resolvedTheme"
/>
</template>
<template v-else>
<RadioButtonIcon
:is-checked="isSelected(option[optionKey])"
:color="color"
- :theme="theme"
+ :theme="resolvedTheme"
/>
</template>
<UTooltip
@@ -73,13 +68,7 @@
</template>
<div
v-else
- :class="[
- theme.FlatSelectInput.spacing.horizontal,
- theme.FlatSelectInput.spacing.vertical,
- theme.FlatSelectInput.fontSize,
- theme.FlatSelectInput.option,
- '!text-neutral-500 !cursor-not-allowed'
- ]"
+ :class="[ui.option(), '!text-neutral-500 !cursor-not-allowed']"
>
{{ $t('forms.select.noOptionAvailable') }}
</div>
@@ -93,7 +82,7 @@
v-if="multiple && (minSelection || maxSelection) && selectedCount > 0"
#bottom_after_help
>
- <small :class="theme.default.help">
+ <small :class="ui.help()">
<span v-if="minSelection && maxSelection">
{{ selectedCount }} of {{ minSelection }}-{{ maxSelection }}
</span>
@@ -116,6 +105,7 @@
import {inputProps, useFormInput} from "../useFormInput.js"
import RadioButtonIcon from "./components/RadioButtonIcon.vue"
import CheckboxIcon from "./components/CheckboxIcon.vue"
+import { flatSelectInputTheme } from "~/lib/forms/themes/flat-select-input.theme.js"
/**
* Options: {name,value} objects
@@ -139,8 +129,15 @@ export default {
maxSelection: { type: Number, default: null }
},
setup(props, context) {
+ const formInput = useFormInput(props, context, {
+ variants: flatSelectInputTheme,
+ additionalVariants: {
+ loading: props.loading,
+ multiple: props.multiple
+ }
+ })
return {
- ...useFormInput(props, context),
+ ...formInput
}
},
data() {
@@ -176,7 +173,9 @@ export default {
// Already in value, remove it only if clearable or not the last item
if (this.isSelected(value)) {
- if (this.clearable || emitValue.length > 1) {
+ const nextLen = emitValue.length - 1
+ if (this.minSelection && nextLen < this.minSelection) return
+ if (this.clearable || nextLen >= 1) {
this.compVal = emitValue.filter((item) => item !== value)
}
return
@@ -218,6 +217,91 @@ export default {
return [this.getOptionName(this.selectedOptions)]
},
+ handleKeydown(event, currentIndex) {
+ if (this.disabled || !this.options || this.options.length === 0) return
+
+ const maxIndex = this.options.length - 1
+ let nextIndex = currentIndex
+
+ switch (event.key) {
+ case 'ArrowDown':
+ event.preventDefault()
+ nextIndex = Math.min(currentIndex + 1, maxIndex)
+ break
+ case 'ArrowUp':
+ event.preventDefault()
+ nextIndex = Math.max(currentIndex - 1, 0)
+ break
+ case 'Enter':
+ case ' ':
+ event.preventDefault()
+ if (this.options[currentIndex]) {
+ this.onSelect(this.options[currentIndex][this.optionKey])
+ }
+ return
+ case 'Home':
+ event.preventDefault()
+ nextIndex = 0
+ break
+ case 'End':
+ event.preventDefault()
+ nextIndex = maxIndex
+ break
+ default:
+ // For single select, allow typing to jump to options
+ if (!this.multiple && event.key.length === 1) {
+ const char = event.key.toLowerCase()
+ const startIndex = (currentIndex + 1) % this.options.length
+
+ for (let i = 0; i < this.options.length; i++) {
+ const searchIndex = (startIndex + i) % this.options.length
+ const option = this.options[searchIndex]
+ const optionText = option[this.displayKey].toLowerCase()
+
+ if (optionText.startsWith(char)) {
+ event.preventDefault()
+ nextIndex = searchIndex
+ break
+ }
+ }
+ } else {
+ return
+ }
+ break
+ }
+
+ // Move focus to the next option
+ if (nextIndex !== currentIndex) {
+ this.focusOnOption(nextIndex)
+ }
+ },
+ focusOnOption(index) {
+ // Find the option element and focus it
+ this.$nextTick(() => {
+ const optionElements = this.$el.querySelectorAll('[role="checkbox"], [role="radio"]')
+ const optionElement = optionElements[index]
+ if (optionElement) {
+ optionElement.focus()
+ }
+ })
+ },
+ getOptionTabIndex(index) {
+ // Make the first selected option focusable, or first option if none selected
+ if (this.compVal) {
+ if (this.multiple && Array.isArray(this.compVal) && this.compVal.length > 0) {
+ const firstSelectedIndex = this.options.findIndex(option =>
+ this.compVal.includes(option[this.optionKey])
+ )
+ return index === (firstSelectedIndex >= 0 ? firstSelectedIndex : 0) ? '0' : '-1'
+ } else if (!this.multiple) {
+ const selectedIndex = this.options.findIndex(option =>
+ option[this.optionKey] === this.compVal
+ )
+ return index === (selectedIndex >= 0 ? selectedIndex : 0) ? '0' : '-1'
+ }
+ }
+ return index === 0 ? '0' : '-1'
+ },
},
}
-</script>
\ No newline at end of file
+</script>
diff --git a/client/components/forms/core/OptionSelectorInput.vue b/client/components/forms/core/OptionSelectorInput.vue
index b675a7791..27f5d3e64 100644
--- a/client/components/forms/core/OptionSelectorInput.vue
+++ b/client/components/forms/core/OptionSelectorInput.vue
@@ -21,35 +21,11 @@
:key="option[optionKey]"
:text="option.tooltip"
:disabled="!option.tooltip"
- :class="[
- 'w-full border transition-colors shadow-xs',
- {
- // Background colors
- 'bg-form/10': isSelected(option),
- 'hover:bg-neutral-100': !isSelected(option),
- // Border colors
- 'border-form': isSelected(option),
- 'border-neutral-300': !isSelected(option),
- // Border radius for seamless mode
- 'rounded-lg': !seamless,
- 'first:rounded-l-lg': seamless,
- 'last:rounded-r-lg': seamless,
- 'not-first:not-last:rounded-none': seamless,
- // Z-index
- 'relative focus-within:z-10': seamless,
- 'relative z-10': seamless && isSelected(option),
- }
- ]"
+ :class="optionClasses(isSelected(option))"
>
<button
- class="flex flex-col items-center justify-center p-1.5 transition-colors text-neutral-500 focus:outline-hidden w-full h-full"
- :class="[
- option.class ? (typeof option.class === 'function' ? option.class(isSelected(option)) : option.class) : {},
- {
- 'text-form-color': isSelected(option),
- 'opacity-50 pointer-events-none': disabled || option.disabled,
- }
- ]"
+ class="flex flex-col items-center justify-center transition-colors focus:outline-hidden w-full h-full"
+ :class="[buttonClasses(disabled || option.disabled), option.class ? (typeof option.class === 'function' ? option.class(isSelected(option)) : option.class) : {}, isSelected(option) ? 'text-form-color' : 'text-inherit']"
:aria-selected="isSelected(option) ? 'true' : 'false'"
:tabindex="disabled || option.disabled ? -1 : 0"
:disabled="disabled || option.disabled"
@@ -72,11 +48,7 @@
</slot>
<span
v-if="option.label || !option.icon"
- class="text-xs"
- :class="{
- 'text-form-color': isSelected(option),
- 'text-inherit': !isSelected(option),
- }"
+ :class="[labelClasses(), isSelected(option) ? 'text-form-color' : 'text-inherit']"
>{{ isSelected(option) ? option.selectedLabel ?? option.label : option.label }}</span>
</button>
</UTooltip>
@@ -93,8 +65,9 @@
</template>
<script setup>
-import { ref, computed, watch, nextTick } from 'vue'
import { inputProps, useFormInput } from '../useFormInput.js'
+import { tv } from 'tailwind-variants'
+import { optionSelectorInputTheme } from '~/lib/forms/themes/option-selector-input.theme.js'
/**
* OptionSelectorInput.vue
@@ -132,7 +105,9 @@ const emit = defineEmits(['update:modelValue', 'focus', 'blur'])
// Use form input composable
const {
compVal,
- inputWrapperProps
+ inputWrapperProps,
+ resolvedTheme,
+ resolvedSize
} = useFormInput(props, { emit })
// Local state
@@ -146,6 +121,20 @@ const optionStyle = computed(() => ({
'--bg-form-color': props.color
}))
+const variants = computed(() => tv(optionSelectorInputTheme, props.ui))
+const optionClasses = (selected) => variants.value({
+ theme: resolvedTheme.value,
+ size: resolvedSize.value,
+ seamless: props.seamless,
+ selected
+}).option()
+const buttonClasses = (isDisabled) => variants.value({
+ theme: resolvedTheme.value,
+ size: resolvedSize.value,
+ disabled: isDisabled
+}).button()
+const labelClasses = () => variants.value({ size: resolvedSize.value }).label()
+
// Methods
function isSelected(option) {
if (props.multiple) {
@@ -207,4 +196,4 @@ watch(compVal, (val) => {
if (idx !== -1) focusedIdx.value = idx
}
})
-</script>
\ No newline at end of file
+</script>
diff --git a/client/components/forms/core/ScaleInput.vue b/client/components/forms/core/ScaleInput.vue
index b8148b04b..60c9bc1a2 100644
--- a/client/components/forms/core/ScaleInput.vue
+++ b/client/components/forms/core/ScaleInput.vue
@@ -4,22 +4,28 @@
<slot name="label" />
</template>
- <div class="rectangle-outer grid grid-cols-5 gap-2">
+ <div
+ class="rectangle-outer grid grid-cols-5 gap-2"
+ role="radiogroup"
+ :aria-label="`Scale from ${minScale} to ${maxScale}`"
+ >
<div
- v-for="i in scaleList"
+ v-for="(i, index) in scaleList"
:key="i"
:class="[
{ 'font-semibold': compVal === i },
- theme.ScaleInput.button,
- theme.ScaleInput.borderRadius,
- theme.ScaleInput.spacing.horizontal,
- theme.ScaleInput.spacing.vertical,
- theme.ScaleInput.fontSize,
- compVal !== i ? unselectedButtonClass : '',
+ ui.button(),
+ compVal !== i ? ui.buttonUnselected() : '',
+ compVal !== i ? ui.buttonHover() : ''
]"
+ class="focus-visible:ring-2 focus-visible:ring-form/100 focus-visible:outline-none"
:style="btnStyle(i === compVal)"
- role="button"
+ role="radio"
+ :tabindex="getScaleTabIndex(i)"
+ :aria-checked="compVal === i"
+ :aria-label="`Scale value ${formatNumber(i)}`"
@click="setScale(i)"
+ @keydown="handleKeydown($event, index)"
>
{{ formatNumber(i) }}
</div>
@@ -36,6 +42,7 @@
<script>
import { inputProps, useFormInput } from "../useFormInput.js"
+import { scaleInputTheme } from "~/lib/forms/themes/scale-input.theme.js"
export default {
name: "ScaleInput",
@@ -49,8 +56,11 @@ export default {
},
setup(props, context) {
+ const formInput = useFormInput(props, context, {
+ variants: scaleInputTheme
+ })
return {
- ...useFormInput(props, context),
+ ...formInput
}
},
@@ -70,9 +80,7 @@ export default {
}
return list
},
- unselectedButtonClass() {
- return this.theme.ScaleInput.unselectedButton
- },
+ // No longer used; kept for compatibility if referenced elsewhere
textColor() {
const color =
this.color.charAt(0) === "#" ? this.color.substring(1, 7) : this.color
@@ -124,6 +132,75 @@ export default {
this.compVal = val
}
},
+ handleKeydown(event, currentIndex) {
+ if (this.disabled) return
+
+ const maxIndex = this.scaleList.length - 1
+ let nextIndex = currentIndex
+
+ switch (event.key) {
+ case 'ArrowRight':
+ case 'ArrowUp':
+ event.preventDefault()
+ nextIndex = Math.min(currentIndex + 1, maxIndex)
+ break
+ case 'ArrowLeft':
+ case 'ArrowDown':
+ event.preventDefault()
+ nextIndex = Math.max(currentIndex - 1, 0)
+ break
+ case 'Enter':
+ case ' ':
+ event.preventDefault()
+ this.setScale(this.scaleList[currentIndex])
+ return
+ case 'Home':
+ event.preventDefault()
+ nextIndex = 0
+ break
+ case 'End':
+ event.preventDefault()
+ nextIndex = maxIndex
+ break
+ default: {
+ // Handle direct number input
+ const inputNum = parseFloat(event.key)
+ const scaleIndex = this.scaleList.findIndex(scale => scale === inputNum)
+ if (scaleIndex >= 0) {
+ event.preventDefault()
+ this.setScale(inputNum)
+ nextIndex = scaleIndex
+ } else {
+ return
+ }
+ break
+ }
+ }
+
+ // Move focus to the next scale button
+ if (nextIndex !== currentIndex) {
+ this.focusOnScale(nextIndex)
+ }
+ },
+ focusOnScale(index) {
+ // Find the scale element and focus it
+ this.$nextTick(() => {
+ const scaleElements = this.$el.querySelectorAll('[role="radio"]')
+ const scaleElement = scaleElements[index]
+ if (scaleElement) {
+ scaleElement.focus()
+ }
+ })
+ },
+ getScaleTabIndex(scaleValue) {
+ // Make the current value focusable, or first scale if no value
+ const currentIndex = this.compVal !== null && this.compVal !== undefined
+ ? this.scaleList.findIndex(scale => scale === this.compVal)
+ : 0
+ const targetIndex = currentIndex >= 0 ? currentIndex : 0
+ const thisIndex = this.scaleList.findIndex(scale => scale === scaleValue)
+ return thisIndex === targetIndex ? '0' : '-1'
+ },
},
}
</script>
diff --git a/client/components/forms/core/SelectInput.vue b/client/components/forms/core/SelectInput.vue
index b69df9554..01ce152b1 100644
--- a/client/components/forms/core/SelectInput.vue
+++ b/client/components/forms/core/SelectInput.vue
@@ -19,16 +19,17 @@
:color="color"
:placeholder="placeholder"
:uppercase-labels="uppercaseLabels"
- :theme="theme"
:has-error="hasError"
:allow-creation="allowCreation"
:disabled="disabled"
- :help="help"
- :help-position="helpPosition"
:remote="remote"
:dropdown-class="dropdownClass"
:min-selection="minSelection"
:max-selection="maxSelection"
+ :theme="resolvedTheme"
+ :size="resolvedSize"
+ :border-radius="resolvedBorderRadius"
+ :ui="ui"
@update-options="updateOptions"
@update:model-value="updateModelValue"
>
@@ -37,9 +38,7 @@
<div class="flex items-center truncate mr-6">
<span
class="truncate"
- :class="[
- theme.SelectInput.fontSize,
- ]"
+ :class="ui.selected()"
>
{{ getOptionNames(selectedValues).join(', ') }}
</span>
@@ -52,11 +51,7 @@
:option-name="getOptionName(option)"
>
<div class="flex items-center truncate mr-6">
- <div
- :class="[
- theme.SelectInput.fontSize,
- ]"
- >
+ <div :class="ui.selected()">
{{ getOptionName(option) }}
</div>
</div>
@@ -72,9 +67,7 @@
<span class="flex">
<p
class="flex-grow"
- :class="[
- theme.SelectInput.fontSize,
- ]"
+ :class="ui.option()"
>
{{ getOptionName(option) }}
</p>
@@ -100,7 +93,7 @@
v-if="multiple && (minSelection || maxSelection) && selectedCount > 0"
#bottom_after_help
>
- <small :class="theme.default.help">
+ <small :class="ui.help()">
<span v-if="minSelection && maxSelection">
{{ selectedCount }} of {{ minSelection }}-{{ maxSelection }}
</span>
@@ -120,7 +113,9 @@
</template>
<script>
+import { computed } from 'vue'
import { inputProps, useFormInput } from '../useFormInput.js'
+import { selectInputTheme } from '~/lib/forms/themes/select-input.theme.js'
/**
* Options: {name,value} objects
@@ -146,8 +141,20 @@ export default {
maxSelection: { type: Number, default: null }
},
setup(props, context) {
+ const additionalVariants = computed(() => ({
+ loading: props.loading,
+ multiple: props.multiple,
+ searchable: props.searchable,
+ clearable: props.clearable
+ }))
+
+ const formInput = useFormInput(props, context, {
+ variants: selectInputTheme,
+ additionalVariants
+ })
+
return {
- ...useFormInput(props, context)
+ ...formInput
}
},
data() {
diff --git a/client/components/forms/core/SliderInput.vue b/client/components/forms/core/SliderInput.vue
index 4c146463e..b9ea62a91 100644
--- a/client/components/forms/core/SliderInput.vue
+++ b/client/components/forms/core/SliderInput.vue
@@ -16,22 +16,22 @@
<input
v-model="compVal"
type="range"
- class="w-full mt-3 slider"
+ :class="[ui.slider(), 'slider']"
:style="{ '--thumb-color': color }"
:disabled="disabled"
:min="minSlider"
:max="maxSlider"
:step="stepSlider"
>
- <div class="grid grid-cols-3 gap-2 -mt-1">
- <div
- v-for="i in sliderLabelsList"
- :key="i"
- :class="[theme.SliderInput.stepLabel, i.style]"
- >
- {{ i.label }}
+ <div class="grid grid-cols-3 gap-2 -mt-1">
+ <div
+ v-for="(i, idx) in sliderLabelsList"
+ :key="i.label ?? idx"
+ :class="[ui.stepLabel(), i.style]"
+ >
+ {{ i.label }}
+ </div>
</div>
- </div>
</div>
</div>
@@ -46,6 +46,7 @@
<script>
import { inputProps, useFormInput } from "../useFormInput.js"
+import { sliderInputTheme } from "~/lib/forms/themes/slider-input.theme.js"
export default {
name: "SliderInput",
@@ -59,8 +60,15 @@ export default {
},
setup(props, context) {
+ const formInput = useFormInput(props, context, {
+ variants: sliderInputTheme,
+ additionalVariants: {
+ disabled: props.disabled
+ }
+ })
+
return {
- ...useFormInput(props, context),
+ ...formInput
}
},
computed: {
diff --git a/client/components/forms/core/TextAreaInput.vue b/client/components/forms/core/TextAreaInput.vue
index 93498c8b9..22ab9e7ec 100644
--- a/client/components/forms/core/TextAreaInput.vue
+++ b/client/components/forms/core/TextAreaInput.vue
@@ -8,18 +8,7 @@
:id="id ? id : name"
v-model="compVal"
:disabled="disabled ? true : null"
- :class="[
- theme.default.input,
- theme.default.borderRadius,
- theme.default.spacing.horizontal,
- theme.default.spacing.vertical,
- theme.default.fontSize,
- {
- '!ring-red-500 !ring-2 !border-transparent': hasError,
- '!cursor-not-allowed !bg-neutral-200 dark:!bg-neutral-800': disabled,
- },
- ]"
- class="resize-y block"
+ :class="ui.input()"
:name="name"
:style="inputStyle"
:placeholder="placeholder"
@@ -37,7 +26,7 @@
v-if="maxCharLimit && showCharLimit"
#bottom_after_help
>
- <small :class="theme.default.help">
+ <small :class="ui.help()">
{{ charCount }}/{{ maxCharLimit }}
</small>
</template>
@@ -53,6 +42,7 @@
<script>
import {inputProps, useFormInput} from "../useFormInput.js"
+import { textAreaInputTheme } from "~/lib/forms/themes/text-area-input.theme.js"
export default {
name: "TextAreaInput",
@@ -65,8 +55,12 @@ export default {
},
setup(props, context) {
+ const formInput = useFormInput(props, context, {
+ variants: textAreaInputTheme
+ })
+
return {
- ...useFormInput(props, context),
+ ...formInput
}
},
diff --git a/client/components/forms/core/TextBlock.vue b/client/components/forms/core/TextBlock.vue
index 19339b1fa..4e4e13c49 100644
--- a/client/components/forms/core/TextBlock.vue
+++ b/client/components/forms/core/TextBlock.vue
@@ -1,32 +1,29 @@
<template>
<div
- class="break-words whitespace-break-spaces"
+ :class="classes"
v-html="processedContent"
/>
</template>
-
- <script setup>
- import { useParseMention } from '@/composables/components/useParseMention'
-
- const props = defineProps({
- content: {
- type: String,
- required: true
- },
- mentionsAllowed: {
- type: Boolean,
- default: false
- },
- form: {
- type: Object,
- default: null
- },
- formData: {
- type: Object,
- default: null
- }
- })
- const processedContent = computed(() => {
- return useParseMention(props.content, props.mentionsAllowed, props.form, props.formData)
- })
- </script>
\ No newline at end of file
+
+<script setup>
+import { useParseMention } from '@/composables/components/useParseMention'
+import { tv } from 'tailwind-variants'
+import { textBlockTheme } from '~/lib/forms/themes/text-block.theme.js'
+
+const props = defineProps({
+ content: { type: String, required: true },
+ mentionsAllowed: { type: Boolean, default: false },
+ form: { type: Object, default: null },
+ formData: { type: Object, default: null },
+ size: { type: String, default: null },
+})
+
+const processedContent = computed(() => {
+ return useParseMention(props.content, props.mentionsAllowed, props.form, props.formData)
+})
+
+const injectedSize = inject('formSize', null)
+const resolvedSize = computed(() => props.size || injectedSize?.value || 'md')
+const variants = computed(() => tv(textBlockTheme))
+const classes = computed(() => variants.value({ size: resolvedSize.value }).root())
+</script>
diff --git a/client/components/forms/core/TextInput.vue b/client/components/forms/core/TextInput.vue
index cc7963865..4995b36c0 100644
--- a/client/components/forms/core/TextInput.vue
+++ b/client/components/forms/core/TextInput.vue
@@ -12,17 +12,7 @@
:autocomplete="autocomplete"
:pattern="pattern"
:style="inputStyle"
- :class="[
- theme.default.input,
- theme.default.borderRadius,
- theme.default.spacing.horizontal,
- theme.default.spacing.vertical,
- theme.default.fontSize,
- {
- '!ring-red-500 !ring-2 !border-transparent': hasError,
- '!cursor-not-allowed !bg-neutral-200 dark:!bg-neutral-800': disabled,
- },
- ]"
+ :class="ui.input()"
:name="name"
:accept="accept"
:placeholder="placeholder"
@@ -46,7 +36,7 @@
v-if="maxCharLimit && showCharLimit"
#bottom_after_help
>
- <small :class="theme.default.help">
+ <small :class="ui.help()">
{{ charCount }}/{{ maxCharLimit }}
</small>
</template>
@@ -62,6 +52,7 @@
<script>
import {inputProps, useFormInput} from "../useFormInput.js"
+import { textInputTheme } from "~/lib/forms/themes/text-input.theme.js"
export default {
name: "TextInput",
@@ -79,6 +70,15 @@ export default {
},
setup(props, context) {
+ const formInput = useFormInput(
+ props,
+ context,
+ {
+ formPrefixKey: props.nativeType === "file" ? "file-" : null,
+ variants: textInputTheme
+ },
+ )
+
const onChange = (event) => {
if (props.nativeType !== "file") return
@@ -93,13 +93,7 @@ export default {
}
return {
- ...useFormInput(
- props,
- context,
- {
- formPrefixKey: props.nativeType === "file" ? "file-" : null
- },
- ),
+ ...formInput,
onEnterPress,
onChange
}
diff --git a/client/components/forms/core/ToggleSwitchInput.vue b/client/components/forms/core/ToggleSwitchInput.vue
index 0186ce84f..1d155bcad 100644
--- a/client/components/forms/core/ToggleSwitchInput.vue
+++ b/client/components/forms/core/ToggleSwitchInput.vue
@@ -9,10 +9,11 @@
:id="id ? id : name"
v-model="compVal"
:disabled="disabled ? true : null"
+ :style="colorStyle"
:ui="{
- active: 'bg-[var(--form-color,#3B82F6)]',
- ring: 'focus:ring-[var(--form-color,#3B82F6)]/50'
+ base: 'data-[state=checked]:bg-[var(--form-color,#3B82F6)] focus-visible:outline-[var(--form-color,#3B82F6)]'
}"
+ @keydown="handleKeydown"
/>
<div>
@@ -22,7 +23,7 @@
>
<InputHelp
:help="help"
- :help-classes="theme.default.help"
+ :help-classes="ui.help()"
>
<template #after-help>
<slot name="bottom_after_help" />
@@ -33,7 +34,7 @@
<label
:aria-label="id ? id : name"
:for="id ? id : name"
- :class="theme.default.fontSize"
+ :class="ui.label()"
>
{{ label }}
<span
@@ -48,7 +49,7 @@
>
<InputHelp
:help="help"
- :help-classes="theme.default.help"
+ :help-classes="ui.help()"
>
<template #after-help>
<slot name="bottom_after_help" />
@@ -71,6 +72,7 @@
<script>
import {inputProps, useFormInput} from "../useFormInput.js"
import InputHelp from "~/components/forms/core/components/InputHelp.vue"
+import { toggleSwitchInputTheme } from "~/lib/forms/themes/toggle-switch-input.theme.js"
export default {
name: "ToggleSwitchInput",
@@ -81,8 +83,27 @@ export default {
},
setup(props, context) {
+ const formInput = useFormInput(props, context, {
+ variants: toggleSwitchInputTheme
+ })
+
+ const colorStyle = computed(() => ({
+ '--form-color': props.color
+ }))
+
+ const handleKeydown = (event) => {
+ if (props.disabled) return
+
+ if (event.key === 'Enter' || event.key === ' ') {
+ event.preventDefault()
+ formInput.compVal.value = !formInput.compVal.value
+ }
+ }
+
return {
- ...useFormInput(props, context),
+ ...formInput,
+ colorStyle,
+ handleKeydown
}
},
@@ -90,4 +111,4 @@ export default {
this.compVal = !!this.compVal
},
}
-</script>
\ No newline at end of file
+</script>
diff --git a/client/components/forms/core/VForm.vue b/client/components/forms/core/VForm.vue
index 963828639..d173187df 100644
--- a/client/components/forms/core/VForm.vue
+++ b/client/components/forms/core/VForm.vue
@@ -8,13 +8,15 @@
/**
* Used to pass props to children input components
*/
-import ThemeBuilder from "~/lib/forms/themes/ThemeBuilder.js"
const props = defineProps({
- themeName: { type: String, default: 'default' },
+ theme: { type: String, default: 'default' },
size: { type: String, default: "md" },
+ borderRadius: { type: String, default: "small" }
})
-const theme = computed(() => (new ThemeBuilder(props.themeName, {size: props.size})).getAllComponents())
-provide('theme', theme)
+// Provide individual theme props for tailwind-variants approach
+provide('formTheme', computed(() => props.theme))
+provide('formSize', computed(() => props.size))
+provide('formBorderRadius', computed(() => props.borderRadius))
</script>
diff --git a/client/components/forms/core/components/CheckboxIcon.vue b/client/components/forms/core/components/CheckboxIcon.vue
index 43428690a..4ac548cbb 100644
--- a/client/components/forms/core/components/CheckboxIcon.vue
+++ b/client/components/forms/core/components/CheckboxIcon.vue
@@ -1,39 +1,61 @@
<template>
- <div>
+ <div :style="colorStyle">
<Icon
v-show="isChecked"
name="i-material-symbols-check-box"
- class="block"
- :class="[
- theme.FlatSelectInput.icon,
- 'bg-[var(--form-color,#3B82F6)]'
- ]"
+ :class="ui.checkedIcon()"
/>
<Icon
v-show="!isChecked"
name="i-material-symbols-check-box-outline-blank"
- class="block"
- :class="[
- theme.FlatSelectInput.icon,
- theme.FlatSelectInput.unselectedIcon,
- ]"
+ :class="ui.uncheckedIcon()"
/>
</div>
</template>
<script setup>
-defineProps({
+import { tv } from "tailwind-variants"
+import { checkboxIconTheme } from "~/lib/forms/themes/checkbox-icon.theme.js"
+
+const props = defineProps({
isChecked: {
type: Boolean,
required: true
},
color: {
type: String,
- default: ''
+ default: '#3B82F6'
},
- theme: {
- type: Object,
- required: true
- }
+ // Theme configuration as strings for tailwind-variants
+ size: {type: String, default: null},
+ theme: {type: String, default: null},
+ ui: {type: Object, default: () => ({})}
+})
+
+// Inject theme values for centralized resolution
+const injectedSize = inject('formSize', null)
+const injectedTheme = inject('formTheme', null)
+
+// Resolve size and theme with proper reactivity
+const resolvedSize = computed(() => {
+ return props.size || injectedSize?.value || 'md'
})
+
+const resolvedTheme = computed(() => {
+ return props.theme || injectedTheme?.value || 'default'
+})
+
+// Color style for CSS custom property
+const colorStyle = computed(() => ({
+ '--form-color': props.color
+}))
+
+// OPTIMIZED: Single computed following Nuxt UI pattern
+const ui = computed(() => {
+ return tv(checkboxIconTheme, props.ui)({
+ size: resolvedSize.value,
+ theme: resolvedTheme.value
+ })
+})
+
</script>
\ No newline at end of file
diff --git a/client/components/forms/core/components/InputLabel.vue b/client/components/forms/core/components/InputLabel.vue
index d1df99b24..a52f92ac5 100644
--- a/client/components/forms/core/components/InputLabel.vue
+++ b/client/components/forms/core/components/InputLabel.vue
@@ -1,41 +1,39 @@
<template>
<label
:for="nativeFor"
- class="input-label"
- :class="[
- theme.default.label,
- { 'uppercase text-xs': uppercaseLabels, 'text-sm/none': !uppercaseLabels },
- ]"
+ :class="ui.label()"
>
<slot>
{{ label }}
<span
v-if="required"
- class="text-red-500 required-dot"
+ :class="ui.requiredDot()"
>*</span>
</slot>
</label>
</template>
-<script>
-import CachedDefaultTheme from "~/lib/forms/themes/CachedDefaultTheme.js"
-export default {
- name: "InputLabel",
+<script setup>
+import { tv } from "tailwind-variants"
+import { inputLabelTheme } from "~/lib/forms/themes/input-label.theme.js"
+
+defineOptions({
+ name: "InputLabel"
+})
+
+const props = defineProps({
+ nativeFor: { type: String, default: null },
+ uppercaseLabels: { type: Boolean, default: false },
+ required: { type: Boolean, default: false },
+ label: { type: String, required: true },
+ ui: {type: Object, default: () => ({})}
+})
+
+// OPTIMIZED: Single computed following Nuxt UI pattern
+const ui = computed(() => {
+ return tv(inputLabelTheme, props.ui)({
+ uppercaseLabels: props.uppercaseLabels
+ })
+})
- props: {
- nativeFor: { type: String, default: null },
- theme: {
- type: Object, default: () => {
- const theme = inject("theme", null)
- if (theme) {
- return theme.value
- }
- return CachedDefaultTheme.getInstance()
- }
- },
- uppercaseLabels: { type: Boolean, default: false },
- required: { type: Boolean, default: false },
- label: { type: String, required: true },
- },
-}
</script>
diff --git a/client/components/forms/core/components/InputWrapper.vue b/client/components/forms/core/components/InputWrapper.vue
index e6be640f2..5fcb3c24f 100644
--- a/client/components/forms/core/components/InputWrapper.vue
+++ b/client/components/forms/core/components/InputWrapper.vue
@@ -1,6 +1,6 @@
<template>
<div
- :class="[ twMerge(theme.default.wrapper,wrapperClass)]"
+ :class="wrapperClasses"
:style="inputStyle"
>
<slot name="label">
@@ -8,10 +8,10 @@
<InputLabel
v-if="label && !hideFieldName"
:label="label"
- :theme="theme"
:required="required"
:native-for="id ? id : name"
:uppercase-labels="uppercaseLabels"
+ :ui="ui?.label"
/>
</VTransition>
</slot>
@@ -23,7 +23,7 @@
<VTransition name="fadeHeight">
<InputHelp
:help="help"
- :help-classes="theme.default.help"
+ :help-classes="ui.help()"
>
<template #after-help>
<slot name="bottom_after_help" />
@@ -40,7 +40,7 @@
<VTransition name="fadeHeightDown">
<InputHelp
:help="help"
- :help-classes="theme.default.help"
+ :help-classes="ui.help()"
>
<template #after-help>
<slot name="bottom_after_help" />
@@ -65,22 +65,14 @@
import InputLabel from './InputLabel.vue'
import InputHelp from './InputHelp.vue'
import {twMerge} from "tailwind-merge"
-import CachedDefaultTheme from '~/lib/forms/themes/CachedDefaultTheme.js'
+import { tv } from "tailwind-variants"
+import { inputWrapperTheme } from "~/lib/forms/themes/input-wrapper.theme.js"
-defineProps({
+const props = defineProps({
id: { type: String, required: false },
name: { type: String, required: false },
label: { type: String, required: false },
form: { type: Object, required: false },
- theme: {
- type: Object, default: () => {
- const theme = inject('theme', null)
- if (theme) {
- return theme.value
- }
- return CachedDefaultTheme.getInstance()
- }
- },
wrapperClass: { type: String, required: false },
inputStyle: { type: Object, required: false },
help: { type: String, required: false },
@@ -89,5 +81,27 @@ defineProps({
hideFieldName: { type: Boolean, default: true },
required: { type: Boolean, default: false },
hasValidation: { type: Boolean, default: true },
+ // Theme configuration as strings for tailwind-variants
+ size: {type: String, default: null},
+ ui: {type: Object, default: () => ({})}
})
+
+// Inject theme values for centralized resolution
+const injectedSize = inject('formSize', null)
+
+// Resolve size with proper reactivity
+const resolvedSize = computed(() => {
+ return props.size || injectedSize?.value || 'md'
+})
+
+// OPTIMIZED: Single computed following Nuxt UI pattern
+const ui = computed(() => {
+ return tv(inputWrapperTheme, props.ui)({
+ size: resolvedSize.value
+ })
+})
+
+// Wrapper classes with twMerge operation - makes sense as computed property
+const wrapperClasses = computed(() => twMerge(ui.value.wrapper(), props.wrapperClass))
+
</script>
diff --git a/client/components/forms/core/components/RadioButtonIcon.vue b/client/components/forms/core/components/RadioButtonIcon.vue
index 112bcaf26..835913f64 100644
--- a/client/components/forms/core/components/RadioButtonIcon.vue
+++ b/client/components/forms/core/components/RadioButtonIcon.vue
@@ -1,39 +1,61 @@
<template>
- <div>
+ <div :style="colorStyle">
<Icon
v-show="isChecked"
name="ic:round-radio-button-checked"
- class="block"
- :class="[
- theme.FlatSelectInput.icon,
- 'bg-[var(--form-color,#3B82F6)]'
- ]"
+ :class="ui.checkedIcon()"
/>
<Icon
v-show="!isChecked"
name="ic:round-radio-button-unchecked"
- class="block"
- :class="[
- theme.FlatSelectInput.icon,
- theme.FlatSelectInput.unselectedIcon,
- ]"
+ :class="ui.uncheckedIcon()"
/>
</div>
</template>
<script setup>
-defineProps({
+import { tv } from "tailwind-variants"
+import { radioButtonIconTheme } from "~/lib/forms/themes/radio-button-icon.theme.js"
+
+const props = defineProps({
isChecked: {
type: Boolean,
required: true
},
color: {
type: String,
- default: ''
+ default: '#3B82F6'
},
- theme: {
- type: Object,
- required: true
- }
+ // Theme configuration as strings for tailwind-variants
+ size: {type: String, default: null},
+ theme: {type: String, default: null},
+ ui: {type: Object, default: () => ({})}
+})
+
+// Inject theme values for centralized resolution
+const injectedSize = inject('formSize', null)
+const injectedTheme = inject('formTheme', null)
+
+// Resolve size and theme with proper reactivity
+const resolvedSize = computed(() => {
+ return props.size || injectedSize?.value || 'md'
})
+
+const resolvedTheme = computed(() => {
+ return props.theme || injectedTheme?.value || 'default'
+})
+
+// Color style for CSS custom property
+const colorStyle = computed(() => ({
+ '--form-color': props.color
+}))
+
+// OPTIMIZED: Single computed following Nuxt UI pattern
+const ui = computed(() => {
+ return tv(radioButtonIconTheme, props.ui)({
+ size: resolvedSize.value,
+ theme: resolvedTheme.value
+ })
+})
+
</script>
\ No newline at end of file
diff --git a/client/components/forms/core/components/VCheckbox.vue b/client/components/forms/core/components/VCheckbox.vue
index 4516c77b0..7c26f3838 100644
--- a/client/components/forms/core/components/VCheckbox.vue
+++ b/client/components/forms/core/components/VCheckbox.vue
@@ -1,20 +1,19 @@
<template>
- <div class="flex items-center">
+ <div :class="ui.container()">
<input
:id="id || name"
v-model="internalValue"
:value="value"
:name="name"
type="checkbox"
- class="rounded border-neutral-500 size-6 checkbox"
- :class="[theme.CheckboxInput.size,{'cursor-pointer': !disabled}]"
- :style="{ '--accent-color': color }"
+ :class="ui.input()"
+ :style="colorStyle"
:disabled="disabled ? true : null"
+ @keydown="handleKeydown"
>
<label
:for="id || name"
- class="text-neutral-700 dark:text-neutral-300 ml-2"
- :class="{ '!cursor-not-allowed': disabled }"
+ :class="ui.label()"
>
<slot />
</label>
@@ -22,15 +21,8 @@
</template>
<script setup>
-import {
- defineEmits,
- defineOptions,
- defineProps,
- onMounted,
- ref,
- watch,
-} from 'vue'
-import CachedDefaultTheme from '~/lib/forms/themes/CachedDefaultTheme.js'
+import { tv } from "tailwind-variants"
+import { vCheckboxTheme } from "~/lib/forms/themes/v-checkbox.theme.js"
defineOptions({
name: 'VCheckbox',
@@ -42,31 +34,40 @@ const props = defineProps({
modelValue: { type: [Boolean, String], default: false },
value: { type: [Boolean, String, Number, Object], required: false },
disabled: { type: Boolean, default: false },
- theme: {
- type: Object, default: () => {
- const theme = inject('theme', null)
- if (theme) {
- return theme.value
- }
- return CachedDefaultTheme.getInstance()
- }
- },
color: { type: String, default: null },
+ // Theme configuration as strings for tailwind-variants
+ size: {type: String, default: null},
+ ui: {type: Object, default: () => ({})}
})
const emit = defineEmits(['update:modelValue', 'click'])
const internalValue = ref(props.modelValue)
-watch(
- () => props.modelValue,
- (val) => {
- internalValue.value = val
- },
-)
+// Inject theme values for centralized resolution
+const injectedSize = inject('formSize', null)
+
+// Resolve size with proper reactivity
+const resolvedSize = computed(() => {
+ return props.size || injectedSize?.value || 'md'
+})
+
+// Color style for CSS custom property
+const colorStyle = computed(() => ({
+ '--accent-color': props.color,
+ '--form-color': props.color
+}))
+
+// OPTIMIZED: Single computed following Nuxt UI pattern
+const ui = computed(() => {
+ return tv(vCheckboxTheme, props.ui)({
+ size: resolvedSize.value,
+ disabled: props.disabled
+ })
+})
watch(
- () => props.checked,
+ () => props.modelValue,
(val) => {
internalValue.value = val
},
@@ -85,6 +86,15 @@ watch(
},
)
+const handleKeydown = (event) => {
+ if (props.disabled) return
+
+ if (event.key === 'Enter' || event.key === ' ') {
+ event.preventDefault()
+ internalValue.value = !internalValue.value
+ }
+}
+
onMounted(() => {
if (internalValue.value === null)
internalValue.value = false
diff --git a/client/components/forms/core/components/VSelect.vue b/client/components/forms/core/components/VSelect.vue
index fbe6e6fc2..49e336155 100644
--- a/client/components/forms/core/components/VSelect.vue
+++ b/client/components/forms/core/components/VSelect.vue
@@ -1,8 +1,7 @@
<template>
<div
ref="select"
- class="v-select relative"
- :class="[{ 'w-0': multiple, 'min-w-full': multiple }]"
+ :class="variantSlots.container()"
>
<UPopover
v-model:open="isOpen"
@@ -12,44 +11,26 @@
sideOffset: 4
}"
:ui="{
- content: 'w-(--reka-popper-anchor-width) bg-white dark:!bg-notion-dark-light shadow-xl z-30 overflow-auto ' + [theme.SelectInput.borderRadius].join(' ')
+ content: 'w-(--reka-popper-anchor-width) bg-white dark:!bg-notion-dark-light shadow-xl z-30 overflow-auto ' + borderRadiusClass
}"
>
<template #anchor>
<div
- class="w-full flex overflow-hidden"
:style="inputStyle"
- :class="[
- theme.SelectInput.input,
- theme.SelectInput.borderRadius,
- {
- 'ring-red-500! ring-2! border-transparent!': hasError,
- '!cursor-not-allowed bg-neutral-200! dark:bg-neutral-800!': disabled,
- 'focus-within:ring-2 focus-within:ring-form/100 focus-within:border-transparent': !hasError && !disabled
- },
- inputClass
- ]"
+ :class="[variantSlots.anchor(), inputClass]"
>
<button
type="button"
aria-haspopup="listbox"
:aria-expanded="isOpen"
aria-labelledby="listbox-label"
- class="cursor-pointer w-full grow relative focus:outline-hidden min-w-0 truncate"
- :class="[
- theme.SelectInput.spacing.horizontal,
- theme.SelectInput.spacing.vertical
- ]"
+ :class="variantSlots.button()"
@click.stop="toggleDropdown"
@focus="onFocus"
@blur="onBlur"
>
<div
- class="flex items-center"
- :class="[
- theme.SelectInput.minHeight,
- 'ltr:pr-8 rtl:pl-8'
- ]"
+ :class="variantSlots.buttonInner()"
>
<transition
name="fade"
@@ -77,10 +58,9 @@
>
<slot name="placeholder">
<div
- class="text-neutral-400 dark:text-neutral-500 w-full ltr:text-left rtl:text-right! truncate ltr:pr-3 rtl:pl-3 rtl:pr-0!"
:class="[
- { 'py-1': multiple && !loading },
- theme.SelectInput.fontSize
+ variantSlots.placeholder(),
+ { 'py-1': multiple && !loading }
]"
>
{{ placeholder }}
@@ -90,28 +70,25 @@
</transition>
</div>
<div
- class="absolute inset-y-0 ltr:right-6 rtl:left-6 w-10 pointer-events-none -z-1"
- :class="[disabled ? 'bg-linear-to-r from-transparent to-neutral-200 dark:to-neutral-800' : theme.SelectInput.chevronGradient]"
+ :class="variantSlots.chevronGradient()"
/>
<span
- class="absolute inset-y-0 ltr:right-0 rtl:left-0 rtl:right-auto! flex items-center ltr:pr-2 rtl:pl-2 rtl:pr-0! pointer-events-none"
- :class="[disabled ? 'bg-neutral-200 dark:bg-neutral-800' : theme.SelectInput.background]"
+ :class="variantSlots.chevronContainer()"
>
<Icon
name="heroicons:chevron-up-down-16-solid"
- class="h-5 w-5 text-neutral-500"
+ :class="variantSlots.chevronIcon()"
/>
</span>
</button>
<button
v-if="clearable && showClearButton && !disabled && !isEmpty"
- class="hover:bg-neutral-50 dark:hover:bg-neutral-900 ltr:border-l rtl:border-l-0! rtl:border-r px-2 flex items-center shrink-0"
- :class="[theme.SelectInput.spacing.vertical]"
+ :class="variantSlots.clearButton()"
@click.stop.prevent="clear()"
>
<Icon
name="heroicons:x-mark-20-solid"
- class="w-5 h-5 text-neutral-500"
+ :class="variantSlots.clearIcon()"
width="2em"
dynamic
/>
@@ -123,40 +100,36 @@
<ul
tabindex="-1"
role="listbox"
- class="leading-6 shadow-xs overflow-auto focus:outline-hidden sm:text-sm sm:leading-5 relative"
- :class="[
- { 'max-h-42': !isSearchable, 'max-h-48': isSearchable },
- theme.SelectInput.fontSize
- ]"
+ :class="variantSlots.dropdown()"
>
<div
v-if="isSearchable"
- class="sticky top-0 z-10 flex border-b bg-white dark:!bg-notion-dark-light"
+ :class="variantSlots.searchContainer()"
>
<input
v-model="searchTerm"
type="text"
- class="grow ltr:pl-3 ltr:pr-7 rtl:pr-3! rtl:pl-7 py-2 w-full focus:outline-hidden dark:text-white"
+ :class="variantSlots.searchInput()"
:placeholder="allowCreation ? $t('forms.select.searchOrTypeToCreateNew') : $t('forms.select.search')"
>
<div
v-if="!searchTerm"
- class="flex absolute ltr:right-0 rtl:left-0 rtl:right-auto! inset-y-0 items-center px-2 justify-center pointer-events-none"
+ :class="variantSlots.searchIconContainer()"
>
<Icon
name="heroicons:magnifying-glass-solid"
- class="h-5 w-5 text-neutral-500 dark:text-neutral-400"
+ :class="variantSlots.searchIcon()"
/>
</div>
<div
v-else
role="button"
- class="flex absolute ltr:right-0 rtl:right-auto! rtl:left-0 inset-y-0 items-center px-2 justify-center"
+ :class="variantSlots.searchClearContainer()"
@click.stop="searchTerm = ''"
>
<Icon
name="heroicons:backspace"
- class="h-5 w-5 rtl:rotate-180 text-neutral-500 dark:text-neutral-400"
+ :class="variantSlots.searchClearIcon()"
/>
</div>
</div>
@@ -168,7 +141,7 @@
</div>
<div
v-if="filteredOptions.length > 0"
- class="p-1"
+ :class="variantSlots.optionsContainer()"
>
<li
v-for="item in filteredOptions"
@@ -176,17 +149,14 @@
role="option"
:style="optionStyle"
:class="[
+ variantSlots.option(),
dropdownClass,
- theme.SelectInput.option,
- theme.SelectInput.spacing.horizontal,
- theme.SelectInput.spacing.vertical,
{ 'pr-9': multiple},
{
'opacity-50 cursor-not-allowed': disabledOptionsMap[item[optionKey]],
'cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-900': !disabledOptionsMap[item[optionKey]]
}
]"
- class="text-neutral-900 dark:text-neutral-50 select-none relative group rounded-sm focus:outline-hidden"
@click.stop="select(item)"
>
<slot
@@ -201,7 +171,7 @@
name="empty-placeholder"
>
<p
- class="w-full text-neutral-500 text-center py-2"
+ :class="variantSlots.emptyMessage()"
>
{{ (allowCreation ? $t('forms.select.typeSomethingToAddAnOption') : $t('forms.select.noOptionAvailable')) }}.
</p>
@@ -213,11 +183,14 @@
<li
role="option"
:style="optionStyle"
- :class="[{ 'px-3 pr-9': multiple, 'px-3': !multiple },dropdownClass,theme.SelectInput.option]"
- class="text-neutral-900 select-none relative py-2 cursor-pointer group hover:bg-neutral-100 dark:hover:bg-neutral-900 rounded-sm focus:outline-hidden"
+ :class="[
+ variantSlots.createOption(),
+ { 'px-3 pr-9': multiple, 'px-3': !multiple },
+ dropdownClass
+ ]"
@click.stop="createOption(searchTerm)"
>
- {{ $t('forms.select.create') }} <span class="px-2 bg-neutral-100 border border-neutral-300 rounded-sm group-hover-text-black">{{
+ {{ $t('forms.select.create') }} <span :class="variantSlots.createLabel()">{{
searchTerm
}}</span>
</li>
@@ -232,7 +205,8 @@
<script>
import debounce from 'debounce'
import Fuse from 'fuse.js'
-import CachedDefaultTheme from '~/lib/forms/themes/CachedDefaultTheme.js'
+import { tv } from "tailwind-variants"
+import { vSelectTheme } from "~/lib/forms/themes/v-select.theme.js"
export default {
name: 'VSelect',
@@ -257,15 +231,11 @@ export default {
placeholder: { type: String, default: null },
uppercaseLabels: { type: Boolean, default: true },
showClearButton: { type: Boolean, default: true },
- theme: {
- type: Object, default: () => {
- const theme = inject('theme', null)
- if (theme) {
- return theme.value
- }
- return CachedDefaultTheme.getInstance()
- }
- },
+ // Theme configuration as strings for tailwind-variants
+ theme: {type: String, default: null},
+ size: {type: String, default: null},
+ borderRadius: {type: String, default: null},
+ ui: {type: Object, default: () => ({})},
allowCreation: { type: Boolean, default: false },
disabled: { type: Boolean, default: false },
minSelection: { type: Number, default: null },
@@ -281,6 +251,41 @@ export default {
}
},
computed: {
+ // Resolve theme values with proper reactivity
+ resolvedTheme() {
+ return this.theme || 'default'
+ },
+ resolvedSize() {
+ return this.size || 'md'
+ },
+ resolvedBorderRadius() {
+ return this.borderRadius || 'small'
+ },
+
+ // Create select variants with UI prop merging
+ vSelectVariants() {
+ return tv(vSelectTheme, this.ui)
+ },
+
+ // Single variant computation
+ variantSlots() {
+ return this.vSelectVariants({
+ theme: this.resolvedTheme,
+ size: this.resolvedSize,
+ borderRadius: this.resolvedBorderRadius,
+ hasError: this.hasError,
+ disabled: this.disabled,
+ focused: this.isFocused,
+ multiple: this.multiple,
+ searchable: this.isSearchable
+ })
+ },
+
+ // Use variantSlots directly in the template for classes
+ borderRadiusClass() {
+ return this.variantSlots.anchor().match(/rounded-\S+/)?.[0] || 'rounded-lg'
+ },
+
optionStyle () {
return {
'--bg-form-color': this.color
diff --git a/client/components/forms/heavy/BarcodeInput.vue b/client/components/forms/heavy/BarcodeInput.vue
index 8f3b627dc..da4c7890e 100644
--- a/client/components/forms/heavy/BarcodeInput.vue
+++ b/client/components/forms/heavy/BarcodeInput.vue
@@ -41,18 +41,8 @@
<div
v-else
:style="inputStyle"
- class="flex flex-col w-full items-center justify-center transition-colors duration-40"
- :class="[
- {'!cursor-not-allowed':disabled, 'cursor-pointer':!disabled},
- theme.fileInput.input,
- theme.fileInput.borderRadius,
- theme.fileInput.spacing.horizontal,
- theme.fileInput.spacing.vertical,
- theme.fileInput.fontSize,
- theme.fileInput.minHeight,
- {'border-red-500 border-2':hasError},
- 'focus:outline-hidden focus:ring-2'
- ]"
+ class="cursor-pointer"
+ :class="ui.container()"
tabindex="0"
role="button"
aria-label="Click to open a camera"
@@ -86,6 +76,7 @@
<script>
import { inputProps, useFormInput } from '../useFormInput.js'
import CameraUpload from './components/CameraUpload.vue'
+import { fileInputTheme } from '~/lib/forms/themes/file-input.theme.js'
export default {
name: 'BarcodeInput',
@@ -100,8 +91,11 @@ export default {
},
setup(props, context) {
+ const formInput = useFormInput(props, context, {
+ variants: fileInputTheme
+ })
return {
- ...useFormInput(props, context),
+ ...formInput
}
},
@@ -151,4 +145,4 @@ video {
max-width: 100%;
height: auto;
}
-</style>
\ No newline at end of file
+</style>
diff --git a/client/components/forms/heavy/CodeInput.client.vue b/client/components/forms/heavy/CodeInput.client.vue
index 338e43779..fdd58a6e9 100644
--- a/client/components/forms/heavy/CodeInput.client.vue
+++ b/client/components/forms/heavy/CodeInput.client.vue
@@ -8,17 +8,7 @@
<slot name="help" />
</template>
- <div
- :class="[
- 'h-40 max-h-96 overflow-y-auto relative',
- theme.CodeInput.input,
- theme.CodeInput.borderRadius,
- {
- '!ring-red-500 !ring-2 !border-transparent': hasError,
- '!cursor-not-allowed !bg-neutral-200 dark:!bg-neutral-800': disabled,
- },
- ]"
- >
+ <div :class="ui.container()">
<!-- Fullscreen button -->
<UTooltip text="Open in fullscreen" :popper="{ placement: 'left' }">
<UButton
@@ -102,6 +92,7 @@
import { Codemirror } from "vue-codemirror"
import { html } from "@codemirror/lang-html"
import { inputProps, useFormInput } from "../useFormInput.js"
+import { codeInputTheme } from '~/lib/forms/themes/code-input.theme.js'
const props = defineProps({
...inputProps,
@@ -136,8 +127,13 @@ defineShortcuts({
}
})
-// Get form input composable
-const { compVal, inputWrapperProps, hasError, disabled, inputStyle, id, name } = useFormInput(props, { emit })
+// Get form input composable
+const { compVal, inputWrapperProps, inputStyle, id, name, ui } = useFormInput(props, { emit }, {
+ variants: codeInputTheme,
+ additionalVariants: {
+ fullscreen: false // Could be extended for fullscreen mode
+ }
+})
</script>
<style>
diff --git a/client/components/forms/heavy/DateInput.vue b/client/components/forms/heavy/DateInput.vue
index af75e6b5d..8c016c831 100644
--- a/client/components/forms/heavy/DateInput.vue
+++ b/client/components/forms/heavy/DateInput.vue
@@ -1,5 +1,5 @@
<template>
- <InputWrapper v-bind="props">
+ <InputWrapper v-bind="inputWrapperProps">
<template #label>
<slot name="label" />
</template>
@@ -11,19 +11,19 @@
:content="{ side: 'bottom', align: 'center' }"
>
<button
- ref="datepicker"
+ ref="triggerButton"
class="cursor-pointer overflow-hidden"
- :class="inputClasses"
+ :class="ui.input()"
:disabled="props.disabled"
+ :aria-expanded="pickerOpen"
+ :aria-haspopup="true"
+ :aria-label="formattedDatePreview ? `Selected date: ${formattedDatePreview}` : 'Select date'"
+ @keydown="handleTriggerKeydown"
>
<div class="flex items-stretch min-w-0">
<div
class="grow min-w-0 flex items-center gap-x-2"
- :class="[
- props.theme.DateInput.spacing.horizontal,
- props.theme.DateInput.spacing.vertical,
- props.theme.DateInput.fontSize,
- ]"
+ :class="ui.inner()"
>
<Icon
name="heroicons:calendar-20-solid"
@@ -47,8 +47,10 @@
</div>
<button
v-if="fromDate && !props.disabled"
- class="hover:bg-neutral-50 dark:hover:bg-neutral-900 ltr:border-l rtl:border-r px-2 flex items-center"
+ class="hover:bg-neutral-50 dark:hover:bg-neutral-900 ltr:border-l rtl:border-r px-2 flex items-center focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-form/100 focus-visible:ring-inset"
+ :aria-label="'Clear date'"
@click.prevent="clear()"
+ @keydown="handleClearKeydown"
>
<Icon
name="heroicons:x-mark-20-solid"
@@ -62,6 +64,7 @@
<template #content>
<DatePicker
+ ref="datePicker"
class="rounded-md"
v-if="props.dateRange"
v-model.range="modeledValue"
@@ -78,6 +81,7 @@
:style="datePickerStyles"
/>
<DatePicker
+ ref="datePicker"
class="rounded-md"
v-else
v-model="modeledValue"
@@ -107,11 +111,12 @@
<script setup>
import { inputProps, useFormInput } from '../useFormInput.js'
-import { getCurrentInstance } from 'vue'
+import { getCurrentInstance, nextTick } from 'vue'
import { DatePicker } from 'v-calendar'
import 'v-calendar/dist/style.css'
import { format, startOfDay, endOfDay } from 'date-fns'
import { tailwindcssPaletteGenerator } from '~/lib/colors.js'
+import { dateInputTheme } from '~/lib/forms/themes/date-input.theme.js'
const props = defineProps({
...inputProps,
@@ -125,10 +130,20 @@ const props = defineProps({
isDark: { type: Boolean, default: false }
})
-const input = useFormInput(props, getCurrentInstance())
+const {
+ ui,
+ compVal,
+ inputWrapperProps
+} = useFormInput(props, getCurrentInstance(), {
+ variants: dateInputTheme,
+ additionalVariants: {
+ disabled: props.disabled
+ }
+})
const fromDate = ref(null)
const toDate = ref(null)
-const datepicker = ref(null)
+const triggerButton = ref(null)
+const datePicker = ref(null)
const pickerOpen = ref(false)
const twColors = computed(() => {
@@ -163,22 +178,11 @@ const modeledValue = computed({
const updateModelValue = () => {
if (!props.withTime && !props.dateRange && modeledValue.value) {
pickerOpen.value = false
+ // Return focus to trigger button after selection
+ returnFocusToTrigger()
}
}
-const inputClasses = computed(() => {
- const classes = [props.theme.DateInput.input, props.theme.DateInput.borderRadius]
- if (props.disabled) {
- classes.push('!cursor-not-allowed bg-neutral-200! dark:bg-neutral-800!')
- }
- if (input.hasError.value) {
- classes.push('ring-red-500! ring-2! border-transparent!')
- }
- if (!props.disabled && !input.hasError.value && pickerOpen.value) {
- classes.push('ring-2 ring-form/100 border-transparent')
- }
- return classes.join(' ')
-})
const minDate = computed(() => {
if (props.disablePastDates) {
@@ -193,19 +197,19 @@ const maxDate = computed(() => {
return undefined
})
const handleCompValChange = () => {
- if (input.compVal.value) {
- if (Array.isArray(input.compVal.value)) {
- fromDate.value = input.compVal.value[0] ?? null
- toDate.value = input.compVal.value[1] ?? null
+ if (compVal.value) {
+ if (Array.isArray(compVal.value)) {
+ fromDate.value = compVal.value[0] ?? null
+ toDate.value = compVal.value[1] ?? null
} else {
- fromDate.value = input.compVal.value
+ fromDate.value = compVal.value
}
}
}
const setInputColor = () => {
- if (datepicker.value) {
- datepicker.value.style.setProperty('--tw-ring-color', props.color)
+ if (triggerButton.value) {
+ triggerButton.value.style.setProperty('--tw-ring-color', props.color)
}
}
@@ -213,6 +217,81 @@ const clear = () => {
fromDate.value = null
toDate.value = null
pickerOpen.value = false
+ // Return focus to trigger button after clearing
+ returnFocusToTrigger()
+}
+
+// Focus management helpers
+const returnFocusToTrigger = () => {
+ nextTick(() => {
+ triggerButton.value?.focus()
+ })
+}
+
+const focusDatePicker = () => {
+ // Give v-calendar a moment to render before focusing
+ setTimeout(() => {
+ // Look for the date picker in the DOM using a more generic approach
+ const popoverElement = document.querySelector('[data-headlessui-state], .vc-container')
+ if (popoverElement) {
+ // Look for the first focusable element within the date picker
+ const focusable = popoverElement.querySelector('button:not([disabled]), .vc-day:not([disabled]), .vc-nav-arrow, [tabindex="0"]')
+ if (focusable) {
+ focusable.focus()
+ }
+ }
+ }, 50)
+}
+
+const handleTriggerKeydown = (event) => {
+ if (props.disabled) return
+
+ switch (event.key) {
+ case 'Escape':
+ if (pickerOpen.value) {
+ event.preventDefault()
+ pickerOpen.value = false
+ }
+ break
+ case 'Enter':
+ case ' ':
+ if (!pickerOpen.value) {
+ event.preventDefault()
+ pickerOpen.value = true
+ }
+ break
+ case 'Backspace':
+ case 'Delete':
+ if (fromDate.value && !pickerOpen.value) {
+ event.preventDefault()
+ clear()
+ }
+ break
+ }
+}
+
+const handleClearKeydown = (event) => {
+ if (props.disabled) return
+
+ switch (event.key) {
+ case 'Enter':
+ case ' ':
+ event.preventDefault()
+ clear()
+ break
+ }
+}
+
+// Global keydown handler for when picker is open
+const handleGlobalKeydown = (event) => {
+ if (!pickerOpen.value || props.disabled) return
+
+ if (event.key === 'Escape') {
+ event.preventDefault()
+ pickerOpen.value = false
+ returnFocusToTrigger()
+ }
+ // Let v-calendar handle Tab and other keys naturally
}
const formattedDate = (value) => {
@@ -251,28 +330,55 @@ watch(() => props.dateRange, () => {
watch(() => fromDate.value, (val) => {
if (props.dateRange) {
- if (!Array.isArray(input.compVal.value)) input.compVal.value = []
- input.compVal.value[0] = val
+ if (!Array.isArray(compVal.value)) compVal.value = []
+ compVal.value[0] = val
} else {
- input.compVal.value = val
+ compVal.value = val
}
}, { immediate: false })
watch(() => toDate.value, (val) => {
if (props.dateRange) {
- if (!Array.isArray(input.compVal.value)) input.compVal.value = [null]
- input.compVal.value[1] = val
+ if (!Array.isArray(compVal.value)) compVal.value = [null]
+ compVal.value[1] = val
} else {
- input.compVal.value = null
+ compVal.value = null
}
}, { immediate: false })
-watch(() => input.compVal.value, (val, oldVal) => {
+watch(() => compVal.value, (val, oldVal) => {
if (!oldVal) handleCompValChange()
}, { immediate: false })
+// Watch picker open state to manage global event listeners and focus
+watch(pickerOpen, (isOpen) => {
+ if (isOpen) {
+ document.addEventListener('keydown', handleGlobalKeydown)
+ // Focus the date picker when it opens
+ focusDatePicker()
+ } else {
+ document.removeEventListener('keydown', handleGlobalKeydown)
+ }
+})
+
onMounted(() => {
handleCompValChange()
setInputColor()
})
-</script>
\ No newline at end of file
+
+onUnmounted(() => {
+ // Clean up global event listener
+ document.removeEventListener('keydown', handleGlobalKeydown)
+})
+</script>
+
+<style>
+.vc-title {
+ padding: 0px 4px;
+ border-radius: 4px;
+}
+
+.vc-title:focus, .vc-title:hover {
+ background: var(--vc-header-arrow-hover-bg) !important;
+}
+</style>
\ No newline at end of file
diff --git a/client/components/forms/heavy/FileInput.vue b/client/components/forms/heavy/FileInput.vue
index 5a90a1572..cc6c86d7d 100644
--- a/client/components/forms/heavy/FileInput.vue
+++ b/client/components/forms/heavy/FileInput.vue
@@ -6,14 +6,11 @@
<div
v-if="cameraUpload && isInWebcam"
class="hidden sm:block w-full"
- :class="[
- theme.fileInput.minHeight
- ]"
+ :class="ui.container()"
>
<ClientOnly>
<CameraUpload
v-if="cameraUpload"
- :theme="theme"
@upload-image="cameraFileUpload"
@stop-webcam="isInWebcam=false"
/>
@@ -22,21 +19,8 @@
<div
v-else
:style="inputStyle"
- class="flex flex-col w-full items-center justify-center transition-colors duration-40"
- :class="[
- {'!cursor-not-allowed':disabled, 'cursor-pointer':!disabled,
- '!bg-neutral-200 dark:!bg-neutral-800': disabled,
- [theme.fileInput.inputHover.light + ' dark:'+theme.fileInput.inputHover.dark]: uploadDragoverEvent,
- ['hover:'+theme.fileInput.inputHover.light +' dark:hover:'+theme.fileInput.inputHover.dark]: !loading},
- theme.fileInput.input,
- theme.fileInput.borderRadius,
- theme.fileInput.spacing.horizontal,
- theme.fileInput.spacing.vertical,
- theme.fileInput.fontSize,
- theme.fileInput.minHeight,
- {'border-red-500 border-2':hasError},
- 'focus:outline-hidden focus:ring-2'
- ]"
+ class="cursor-pointer"
+ :class="ui.container()"
tabindex="0"
role="button"
:aria-label="multiple ? 'Choose files or drag here' : 'Choose a file or drag here'"
@@ -72,12 +56,11 @@
class="flex flex-wrap items-center justify-center gap-4"
>
<uploaded-file
- v-for="file in files"
+ v-for="(file, index) in files"
:key="file.url"
:file="file"
- :theme="theme"
:disabled="disabled"
- @remove="clearFile(file)"
+ @remove="clearFile(index)"
/>
</div>
<template v-else>
@@ -136,6 +119,7 @@ import UploadedFile from './components/UploadedFile.vue'
import CameraUpload from './components/CameraUpload.vue'
import {storeFile} from "~/lib/file-uploads.js"
import { formsApi } from '~/api'
+import { fileInputTheme } from '~/lib/forms/themes/file-input.theme.js'
export default {
name: 'FileInput',
@@ -151,8 +135,11 @@ export default {
},
setup(props, context) {
+ const formInput = useFormInput(props, context, {
+ variants: fileInputTheme
+ })
return {
- ...useFormInput(props, context)
+ ...formInput
}
},
@@ -229,9 +216,19 @@ export default {
this.loading = false
},
clearAll() {
+ // Revoke object URLs to prevent memory leaks
+ this.files.forEach(f => {
+ if (f && f.src) {
+ URL.revokeObjectURL(f.src)
+ }
+ })
this.files = []
},
clearFile(index) {
+ const f = this.files[index]
+ if (f && f.src) {
+ URL.revokeObjectURL(f.src)
+ }
this.files.splice(index, 1)
},
onUploadDropEvent(e) {
diff --git a/client/components/forms/heavy/ImageInput.vue b/client/components/forms/heavy/ImageInput.vue
index 72e6cd025..7b8421e07 100644
--- a/client/components/forms/heavy/ImageInput.vue
+++ b/client/components/forms/heavy/ImageInput.vue
@@ -11,14 +11,7 @@
aria-expanded="true"
aria-labelledby="listbox-label"
class="cursor-pointer relative w-full"
- :class="[
- theme.default.input,
- theme.default.spacing.horizontal,
- theme.default.spacing.vertical,
- theme.default.fontSize,
- theme.default.borderRadius,
- { 'ring-red-500 ring-2': hasError }
- ]"
+ :class="ui.button()"
:style="inputStyle"
@click.prevent="showUploadModal = true"
>
@@ -140,6 +133,7 @@
import { inputProps, useFormInput } from "../useFormInput.js"
import { storeFile } from "~/lib/file-uploads.js"
import { formsApi } from '~/api'
+import { imageInputTheme } from '~/lib/forms/themes/image-input.theme.js'
export default {
components: { },
@@ -149,8 +143,11 @@ export default {
},
setup(props, context) {
+ const formInput = useFormInput(props, context, {
+ variants: imageInputTheme
+ })
return {
- ...useFormInput(props, context),
+ ...formInput
}
},
@@ -228,21 +225,16 @@ export default {
response.extension,
})
.then((moveFileResponseData) => {
- if (!this.multiple) {
- this.files = []
- }
this.compVal = moveFileResponseData.url
- this.showUploadModal = false
- this.loading = false
})
.catch(() => {
this.compVal = null
- this.showUploadModal = false
- this.loading = false
})
})
.catch(() => {
this.compVal = null
+ })
+ .finally(() => {
this.showUploadModal = false
this.loading = false
})
diff --git a/client/components/forms/heavy/MatrixInput.vue b/client/components/forms/heavy/MatrixInput.vue
index c081ca1bb..3bc2d36cd 100644
--- a/client/components/forms/heavy/MatrixInput.vue
+++ b/client/components/forms/heavy/MatrixInput.vue
@@ -3,28 +3,18 @@
<template #label>
<slot name="label" />
</template>
- <div
- class="border overflow-x-auto"
- :class="[
- theme.default.borderRadius,
- theme.MatrixInput.cell,
- theme.MatrixInput.table,
- {
- '!ring-red-500 !ring-2 !border-transparent': hasError,
- },
- ]"
- >
+ <div :class="ui.container()">
<table class="w-full table-auto">
<thead class="">
<tr>
- <th class="ltr:text-left rtl:text-right p-2 w-auto max-w-xs" />
+ <th class="ltr:text-left rtl:text-right w-auto max-w-xs" :class="ui.headerCell()" />
<td
v-for="column in columns"
:key="column"
class="ltr:border-l rtl:border-r rtl:!border-l-0 max-w-24 overflow-hidden"
- :class="theme.MatrixInput.cell"
+ :class="ui.cell()"
>
- <div class="p-2 w-full flex items-center justify-center text-sm">
+ <div :class="ui.headerCell()">
{{ column }}
</div>
</td>
@@ -32,47 +22,39 @@
</thead>
<tbody>
<tr
- v-for="row, rowIndex in rows"
+ v-for="(row, rowIndex) in rows"
:key="rowIndex"
- class="border-t border-neutral-300"
+ class="border-t border-neutral-300 dark:border-neutral-600"
+ role="radiogroup"
+ :aria-label="`${row} options`"
>
<td class="ltr:text-left rtl:text-right w-auto max-w-24 overflow-hidden">
- <div class="w-full p-2 text-sm">
+ <div :class="ui.rowCell()">
{{ row }}
</div>
</td>
<td
v-for="column in columns"
:key="row + column"
- class="ltr:border-l rtl:border-r rtl:!border-l-0"
+ role="radio"
+ :tabindex="props.disabled ? -1 : 0"
+ :aria-checked="compVal && compVal[row] === column"
:class="[
- theme.MatrixInput.cell,
- theme.MatrixInput.cellHover,
- {
- '!cursor-not-allowed !bg-neutral-200 dark:!bg-neutral-800 hover:!bg-neutral-200 dark:hover:!bg-neutral-800': disabled,
- },
+ 'ltr:border-l rtl:border-r rtl:!border-l-0',
+ ui.cell(),
+ ui.cellHover(),
+ ui.option()
]"
+ @click="onSelect(row, column)"
+ @keydown="onKeyDown($event, row, column)"
>
- <div
- v-if="compVal"
- class="w-full flex items-center justify-center relative"
- role="radio"
- :aria-checked="compVal[row] === column"
- :class="[
- theme.FlatSelectInput.spacing.vertical,
- theme.FlatSelectInput.fontSize,
- theme.FlatSelectInput.option,
- {
- '!cursor-not-allowed !bg-transparent hover:!bg-transparent dark:hover:!bg-transparent': disabled,
- }
- ]"
- @click="onSelect(row, column)"
- >
+ <div :class="ui.iconWrapper()">
<RadioButtonIcon
+ v-if="compVal"
:key="row+column"
:is-checked="compVal[row] === column"
:color="color"
- :theme="theme"
+ :theme="resolvedTheme"
/>
</div>
</td>
@@ -92,6 +74,7 @@
import { watch } from "vue"
import { inputProps, useFormInput } from "../useFormInput.js"
import RadioButtonIcon from "../core/components/RadioButtonIcon.vue"
+import { matrixInputTheme } from '~/lib/forms/themes/matrix-input.theme.js'
const props = defineProps({
...inputProps,
@@ -101,7 +84,9 @@ const props = defineProps({
const emit = defineEmits(['update:modelValue', 'focus', 'blur'])
-const { compVal, inputWrapperProps, hasError } = useFormInput(props, { emit })
+const { compVal, inputWrapperProps, ui, resolvedTheme } = useFormInput(props, { emit }, {
+ variants: matrixInputTheme
+})
const onSelect = (row, column) => {
if (props.disabled) {
@@ -122,9 +107,16 @@ const onSelect = (row, column) => {
compVal.value = newValue
}
+const onKeyDown = (event, row, column) => {
+ if (event.key === 'Enter' || event.key === ' ') {
+ event.preventDefault()
+ onSelect(row, column)
+ }
+}
+
watch(compVal, (val) => {
if (!val || typeof val !== 'object') {
compVal.value = {}
}
}, { immediate: true, deep: true })
-</script>
\ No newline at end of file
+</script>
diff --git a/client/components/forms/heavy/MentionInput.vue b/client/components/forms/heavy/MentionInput.vue
index 10cb60ed9..5909e2969 100644
--- a/client/components/forms/heavy/MentionInput.vue
+++ b/client/components/forms/heavy/MentionInput.vue
@@ -10,18 +10,7 @@
:contenteditable="!disabled"
class="mention-input"
:style="inputStyle"
- :class="[
- theme.default.input,
- theme.default.borderRadius,
- theme.default.spacing.horizontal,
- theme.default.spacing.vertical,
- theme.default.fontSize,
- {
- '!ring-red-500 !ring-2 !border-transparent': hasError,
- '!cursor-not-allowed !bg-neutral-200 dark:!bg-neutral-800': disabled,
- },
- 'pr-12'
- ]"
+ :class="ui.input()"
:placeholder="placeholder"
@input="onInput"
/>
@@ -72,6 +61,7 @@
import { ref, onMounted, watch, reactive } from 'vue'
import { inputProps, useFormInput } from '../useFormInput.js'
import MentionDropdown from './components/MentionDropdown.vue'
+import { mentionInputTheme } from '~/lib/forms/themes/mention-input.theme.js'
const props = defineProps({
...inputProps,
@@ -81,7 +71,9 @@ const props = defineProps({
const emit = defineEmits(['update:modelValue'])
-const { compVal, inputStyle, hasError, inputWrapperProps } = useFormInput(props, { emit })
+const { compVal, inputStyle, inputWrapperProps, ui } = useFormInput(props, { emit }, {
+ variants: mentionInputTheme
+})
const editableDiv = ref(null)
const savedRange = ref(null)
const { openSubscriptionModal } = useAppModals()
diff --git a/client/components/forms/heavy/PaymentInput.client.vue b/client/components/forms/heavy/PaymentInput.client.vue
index a412a4df0..d68592ada 100644
--- a/client/components/forms/heavy/PaymentInput.client.vue
+++ b/client/components/forms/heavy/PaymentInput.client.vue
@@ -4,20 +4,7 @@
<slot name="label" />
</template>
- <div
- :class="[
- theme.default.input,
- theme.default.borderRadius,
- theme.default.spacing.horizontal,
- theme.default.spacing.vertical,
- theme.default.fontSize,
- {
- '!ring-red-500 !ring-2 !border-transparent': hasError,
- '!cursor-not-allowed !bg-neutral-200 dark:!bg-neutral-800': disabled,
- },
- 'dark:bg-neutral-900 dark:border-neutral-700 dark:text-neutral-200'
- ]"
- >
+ <div :class="ui.container()">
<div v-if="!oauthProviderId">
<div class="space-y-4 mt-3">
<div class="animate-pulse flex flex-col gap-3">
@@ -72,15 +59,7 @@
v-else-if="stripeState && stripeState.stripeAccountId && isStripeJsLoaded && publishableKey"
class="my-2"
>
- <div
- :class="[
- theme.default.borderRadius,
- theme.default.spacing.horizontal,
- theme.default.spacing.vertical,
- theme.default.fontSize,
- ]"
- class="mb-4 flex border border-neutral-300 dark:border-neutral-600 items-center justify-between bg-neutral-50 dark:bg-neutral-800"
- >
+ <div :class="ui.amountBar()">
<span class="text-sm font-medium text-neutral-700 dark:text-neutral-300">{{ $t('forms.payment.amount_to_pay') }}</span>
<span class="text-sm font-medium text-neutral-900 dark:text-neutral-100">{{ currencySymbol }}{{ amount }}</span>
</div>
@@ -95,21 +74,7 @@
>
<template #default="{ elements }">
<div class="space-y-4">
- <div
- :class="[
- theme.default.input,
- theme.default.borderRadius,
- theme.default.spacing.horizontal,
- theme.default.spacing.vertical,
- theme.default.fontSize,
- theme.PaymentInput?.cardContainer || '',
- {
- [theme.PaymentInput?.focusRing || 'ring-2 ring-form border-transparent']: isCardFocused && !hasError,
- '!ring-red-500 !ring-2 !border-transparent': hasError
- },
- 'dark:bg-neutral-800 dark:border-neutral-700'
- ]"
- >
+ <div :class="[ui.container(), isCardFocused && !hasError ? 'ring-2 ring-form border-transparent' : '']">
<StripeElement
v-if="elements"
ref="card"
@@ -126,7 +91,6 @@
name="cardholder_name"
:placeholder="$t('forms.payment.name_on_card')"
class="w-full"
- :theme="theme"
:disabled="disabled"
/>
<TextInput
@@ -134,7 +98,6 @@
name="billing_email"
:placeholder="$t('forms.payment.billing_email')"
class="w-full"
- :theme="theme"
:disabled="disabled"
/>
</div>
@@ -178,6 +141,7 @@ import { StripeElements, StripeElement } from 'vue-stripe-js'
import stripeCurrencies from "~/data/stripe_currencies.json"
import { useAlert } from '~/composables/useAlert'
import { useFeatureFlag } from '~/composables/useFeatureFlag'
+import { paymentInputTheme } from '~/lib/forms/themes/payment-input.theme.js'
const props = defineProps({
...inputProps,
@@ -192,7 +156,9 @@ const props = defineProps({
})
const emit = defineEmits([])
-const { compVal, hasError, inputWrapperProps } = useFormInput(props, { emit })
+const { compVal, hasError, inputWrapperProps, ui } = useFormInput(props, { emit }, {
+ variants: paymentInputTheme
+})
const route = useRoute()
const alert = useAlert()
@@ -414,8 +380,8 @@ const currencySymbol = computed(() => {
})
const cardOptions = computed(() => {
- const darkPlaceholderColor = props.theme.default?.input?.includes('dark:placeholder-neutral-500') ? '#6B7280' : '#9CA3AF'
- const lightPlaceholderColor = props.theme.default?.input?.includes('placeholder-neutral-400') ? '#9CA3AF' : '#A0AEC0'
+ const darkPlaceholderColor = '#6B7280'
+ const lightPlaceholderColor = '#9CA3AF'
return {
hidePostalCode: true,
diff --git a/client/components/forms/heavy/PhoneInput.vue b/client/components/forms/heavy/PhoneInput.vue
index e2b34ef99..09048d743 100644
--- a/client/components/forms/heavy/PhoneInput.vue
+++ b/client/components/forms/heavy/PhoneInput.vue
@@ -14,19 +14,21 @@
>
<v-select
v-model="selectedCountryCode"
- :class="theme.PhoneInput.countrySelectWidth"
dropdown-class="max-w-[300px]"
input-class="ltr-only:rounded-r-none rtl:rounded-l-none!"
:data="countries"
- :disabled="(disabled || countries.length===1)?true:null"
+ :disabled="disabled || countries.length===1"
:searchable="true"
:search-keys="['name']"
:option-key="'code'"
:color="color"
:has-error="hasError"
+ :theme="resolvedTheme"
+ :size="resolvedSize"
+ :border-radius="resolvedBorderRadius"
+ :ui="{ container: ui.countrySelectWidth() }"
:placeholder="'Select a country'"
:uppercase-labels="true"
- :theme="theme"
@update:model-value="onChangeCountryCode"
>
<template #option="props">
@@ -43,12 +45,12 @@
<template #selected="props">
<div
class="flex items-center gap-2 justify-center overflow-hidden"
- :class="theme.PhoneInput.maxHeight"
+ :class="ui.selectedMaxHeight()"
>
<country-flag
- :size="theme.PhoneInput.flagSize"
+ :size="countryFlagSize"
class="rounded-lg!"
- :class="theme.PhoneInput.flag"
+ :class="ui.flag()"
:country="props.option.code"
/>
<span class="text-sm">{{ props.option.dial_code }}</span>
@@ -60,13 +62,7 @@
type="text"
class="inline-flex-grow ltr-only:border-l-0 ltr-only:!rounded-l-none rtl:border-r-0 rtl:rounded-r-none"
:disabled="disabled?true:null"
- :class="[
- theme.PhoneInput.input,
- theme.PhoneInput.spacing.horizontal,
- theme.PhoneInput.spacing.vertical,
- theme.PhoneInput.fontSize,
- theme.PhoneInput.borderRadius,
- { 'ring-red-500! ring-2! border-transparent!': hasError, '!cursor-not-allowed bg-neutral-200! dark:bg-neutral-800!': disabled }]"
+ :class="ui.input()"
:placeholder="placeholder"
:style="inputStyle"
@input="onInput"
@@ -88,6 +84,7 @@ import { inputProps, useFormInput } from '../useFormInput.js'
import countryCodes from '~/data/country_codes.json'
import CountryFlag from 'vue-country-flag-next'
import parsePhoneNumber from 'libphonenumber-js'
+import { phoneInputTheme } from '~/lib/forms/themes/phone-input.theme.js'
export default {
phone: 'PhoneInput',
@@ -99,8 +96,16 @@ export default {
},
setup (props, context) {
+ const formInput = useFormInput(props, context, {
+ variants: phoneInputTheme
+ })
+ const countryFlagSize = computed(() => {
+ const size = formInput.resolvedSize.value
+ return (size === 'xs' || size === 'sm') ? 'small' : 'normal'
+ })
return {
- ...useFormInput(props, context)
+ ...formInput,
+ countryFlagSize
}
},
diff --git a/client/components/forms/heavy/RatingInput.vue b/client/components/forms/heavy/RatingInput.vue
index 3ac36115d..0554eef07 100644
--- a/client/components/forms/heavy/RatingInput.vue
+++ b/client/components/forms/heavy/RatingInput.vue
@@ -4,25 +4,33 @@
<slot name="label" />
</template>
- <div class="stars-outer">
+ <div
+ class="stars-outer"
+ role="slider"
+ :aria-valuemin="0"
+ :aria-valuemax="starsCount"
+ :aria-valuenow="compVal"
+ :aria-label="`Rating: ${compVal} out of ${starsCount} stars`"
+ >
<div
v-for="i in starsCount"
:key="i"
- class="cursor-pointer inline-block text-neutral-200 dark:text-neutral-800"
- :class="{
- '!text-yellow-400 active-star': i <= compVal,
- '!text-yellow-200 !dark:text-yellow-800 hover-star':
- i > compVal && i <= hoverRating,
- '!cursor-not-allowed': disabled,
- }"
+ :class="ui.star({
+ disabled: disabled,
+ isActive: i <= compVal,
+ isHover: i > compVal && i <= hoverRating
+ })"
role="button"
+ :tabindex="getStarTabIndex(i)"
+ :aria-label="`${i} star${i > 1 ? 's' : ''}`"
@click="setRating(i)"
@mouseenter="onMouseHover(i)"
@mouseleave="hoverRating = -1"
+ @keydown="handleKeydown($event, i)"
>
<Icon
name="heroicons:star-20-solid"
- :class="theme.RatingInput.size"
+ :class="ui.icon()"
/>
</div>
</div>
@@ -38,6 +46,7 @@
<script>
import { inputProps, useFormInput } from "../useFormInput.js"
+import { ratingInputTheme } from "~/lib/forms/themes/rating-input.theme.js"
export default {
name: "RatingInput",
@@ -49,8 +58,11 @@ export default {
},
setup(props, context) {
+ const formInput = useFormInput(props, context, {
+ variants: ratingInputTheme
+ })
return {
- ...useFormInput(props, context),
+ ...formInput
}
},
@@ -93,6 +105,75 @@ export default {
this.compVal = val
}
},
+ handleKeydown(event, currentStar) {
+ if (this.disabled) return
+
+ let nextStar = currentStar
+
+ switch (event.key) {
+ case 'ArrowRight':
+ case 'ArrowUp':
+ event.preventDefault()
+ nextStar = Math.min(currentStar + 1, this.starsCount)
+ break
+ case 'ArrowLeft':
+ case 'ArrowDown':
+ event.preventDefault()
+ nextStar = Math.max(currentStar - 1, 1)
+ break
+ case 'Enter':
+ case ' ':
+ event.preventDefault()
+ this.setRating(currentStar)
+ return
+ case 'Home':
+ event.preventDefault()
+ nextStar = 1
+ break
+ case 'End':
+ event.preventDefault()
+ nextStar = this.starsCount
+ break
+ case '0':
+ case 'Backspace':
+ case 'Delete':
+ event.preventDefault()
+ this.setRating(0)
+ return
+ default: {
+ // Handle number keys 1-9
+ const num = parseInt(event.key)
+ if (num >= 1 && num <= this.starsCount) {
+ event.preventDefault()
+ this.setRating(num)
+ nextStar = num
+ } else {
+ return
+ }
+ break
+ }
+ }
+
+ // Move focus to the next star
+ if (nextStar !== currentStar) {
+ this.focusOnStar(nextStar)
+ }
+ },
+ focusOnStar(starNumber) {
+ // Find the star element and focus it
+ this.$nextTick(() => {
+ const starElements = this.$el.querySelectorAll('[role="button"]')
+ const starElement = starElements[starNumber - 1]
+ if (starElement) {
+ starElement.focus()
+ }
+ })
+ },
+ getStarTabIndex(starNumber) {
+ // Make the current value focusable, or first star if no value
+ const targetStar = this.compVal || 1
+ return starNumber === targetStar ? '0' : '-1'
+ },
},
}
</script>
diff --git a/client/components/forms/heavy/RichTextAreaInput.client.vue b/client/components/forms/heavy/RichTextAreaInput.client.vue
index f8dfd4aa5..bb2612226 100644
--- a/client/components/forms/heavy/RichTextAreaInput.client.vue
+++ b/client/components/forms/heavy/RichTextAreaInput.client.vue
@@ -9,20 +9,8 @@
<div
class="rich-editor resize-y notranslate relative"
- :class="[
- {
- 'ring-red-500! ring-2! border-transparent!': hasError,
- '!cursor-not-allowed bg-neutral-200! dark:bg-neutral-800!': disabled,
- 'focus-within:ring-2 focus-within:ring-form/100 focus-within:border-transparent': !hasError && !disabled
- },
- theme.RichTextAreaInput.input,
- theme.RichTextAreaInput.borderRadius,
- theme.default.fontSize,
- ]"
- :style="{
- '--font-size': theme.default.fontSize,
- ...inputStyle
- }"
+ :class="ui.container()"
+ :style="inputStyle"
>
<MentionDropdown
v-if="enableMentions && mentionState"
@@ -111,7 +99,7 @@
v-if="maxCharLimit && showCharLimit"
#bottom_after_help
>
- <small :class="theme.default.help">
+ <small :class="ui.help()">
{{ charCount }}/{{ maxCharLimit }}
</small>
</template>
@@ -131,6 +119,7 @@ import { inputProps, useFormInput } from '../useFormInput.js'
import QuillyEditor from './components/QuillyEditor.vue'
import MentionDropdown from './components/MentionDropdown.vue'
import registerMentionExtension from '~/lib/quill/quillMentionExtension.js'
+import { richTextAreaInputTheme } from '~/lib/forms/themes/rich-text-area-input.theme.js'
// Global icon registration - only happens once
if (import.meta.client) {
@@ -164,7 +153,12 @@ const props = defineProps({
})
const emit = defineEmits(['update:modelValue'])
-const { compVal, inputStyle, hasError, inputWrapperProps } = useFormInput(props, { emit })
+const { compVal, inputStyle, inputWrapperProps, ui } = useFormInput(props, { emit }, {
+ variants: richTextAreaInputTheme,
+ additionalVariants: {
+ focused: true // focus style is handled via focus-within by CSS
+ }
+})
const editor = ref(null)
const mentionState = ref(null)
@@ -249,10 +243,8 @@ const buildQuillOptions = (includeFullscreen = false) => {
keyboard: {
bindings: {
tab: {
- key: 9,
- handler (range) {
- this.quill.insertText(range.index, ' ', 'user')
- }
+ key: 'Tab',
+ handler: () => true // Allow Tab to navigate out of editor for accessibility
}
}
}
@@ -388,4 +380,4 @@ const showCharLimit = computed(() => {
height: 100% !important;
min-height: 100% !important;
}
-</style>
\ No newline at end of file
+</style>
diff --git a/client/components/forms/heavy/SignatureInput.vue b/client/components/forms/heavy/SignatureInput.vue
index 266a8d53d..4e795ba63 100644
--- a/client/components/forms/heavy/SignatureInput.vue
+++ b/client/components/forms/heavy/SignatureInput.vue
@@ -6,19 +6,7 @@
<div
v-if="loading || file"
- :class="[
- theme.default.input,
- theme.SignatureInput.input,
- theme.SignatureInput.spacing.horizontal,
- theme.SignatureInput.spacing.vertical,
- theme.SignatureInput.fontSize,
- theme.SignatureInput.borderRadius,
- {
- '!ring-red-500 !ring-2 !border-transparent': hasError,
- '!cursor-not-allowed !bg-neutral-200 dark:!bg-neutral-800': disabled,
- },
- ]"
- class="flex flex-wrap items-center justify-center gap-4"
+ :class="ui.container()"
>
<div
v-if="loading"
@@ -34,7 +22,6 @@
v-else
:key="file.url"
:file="file"
- :theme="theme"
:show-remove="false"
:disabled="disabled"
/>
@@ -44,18 +31,7 @@
v-else
ref="signaturePad"
class="not-draggable"
- :class="[
- theme.default.input,
- theme.SignatureInput.input,
- theme.SignatureInput.spacing.horizontal,
- theme.SignatureInput.spacing.vertical,
- theme.SignatureInput.fontSize,
- theme.SignatureInput.borderRadius,
- {
- '!ring-red-500 !ring-2 !border-transparent': hasError,
- '!cursor-not-allowed !bg-neutral-200 dark:!bg-neutral-800': disabled,
- },
- ]"
+ :class="ui.container()"
height="150px"
:name="name"
:options="{ onEnd, penColor }"
@@ -64,7 +40,7 @@
<template #bottom_after_help>
<small
v-if="!file"
- :class="theme.default.help"
+ :class="ui.help()"
class="flex-auto"
>
<input
@@ -76,15 +52,15 @@
@change="manualFileUpload"
>
<a
- :class="theme.default.help"
+ :class="ui.help()"
href="#"
@click.prevent="openFileUpload"
>{{ $t('forms.signatureInput.uploadFileInstead') }}</a>
</small>
- <small :class="theme.default.help">
+ <small :class="ui.help()">
<a
- :class="theme.default.help"
+ :class="ui.help()"
href="#"
@click.prevent="clear"
>{{ $t('forms.signatureInput.clear') }}</a>
@@ -101,6 +77,7 @@
import { VueSignaturePad } from 'vue-signature-pad'
import { inputProps, useFormInput } from '../useFormInput.js'
import { storeFile } from '~/lib/file-uploads.js'
+import { signatureInputTheme } from '~/lib/forms/themes/signature-input.theme.js'
export default {
name: 'SignatureInput',
@@ -111,8 +88,11 @@ export default {
},
setup(props, context) {
+ const formInput = useFormInput(props, context, {
+ variants: signatureInputTheme
+ })
return {
- ...useFormInput(props, context),
+ ...formInput
}
},
diff --git a/client/components/forms/heavy/components/CameraUpload.vue b/client/components/forms/heavy/components/CameraUpload.vue
index 6ba37065c..7fdbce16b 100644
--- a/client/components/forms/heavy/components/CameraUpload.vue
+++ b/client/components/forms/heavy/components/CameraUpload.vue
@@ -1,7 +1,7 @@
<template>
<div
class="relative overflow-hidden"
- :class="[theme.fileInput.borderRadius]"
+ :class="variantSlots.container()"
>
<video
ref="webcamRef"
@@ -10,8 +10,6 @@
muted
:class="[
{ hidden: !isCapturing },
- theme.fileInput.minHeight,
- theme.fileInput.borderRadius,
'w-full h-full object-cover bg-neutral-500'
]"
webkit-playsinline
@@ -20,8 +18,6 @@
ref="canvasRef"
:class="[
{ hidden: !capturedImage },
- theme.fileInput.borderRadius,
- theme.fileInput.minHeight,
'w-full h-full object-cover'
]"
/>
@@ -86,7 +82,7 @@
<div
v-else-if="cameraPermissionStatus === 'blocked'"
class="absolute p-5 top-0 inset-x-0 flex flex-col items-center justify-center space-y-4 text-center border border-neutral-400/30 h-full"
- :class="[theme.fileInput.borderRadius]"
+ :class="variantSlots.container()"
@click="openCameraUpload"
>
<Icon
@@ -111,7 +107,7 @@
<div
v-else-if="cameraPermissionStatus === 'loading'"
class="absolute p-5 top-0 inset-x-0 flex flex-col items-center justify-center space-y-4 text-center border border-neutral-400/30 h-full"
- :class="[theme.fileInput.borderRadius]"
+ :class="variantSlots.container()"
>
<div class="w-6 h-6">
<Loader />
@@ -120,7 +116,7 @@
<div
v-else
class="absolute p-5 top-0 inset-x-0 flex flex-col items-center justify-center space-y-4 text-center border border-neutral-400/30 h-full"
- :class="[theme.fileInput.borderRadius]"
+ :class="variantSlots.container()"
@click="openCameraUpload"
>
<Icon
@@ -146,21 +142,13 @@
<script>
import Webcam from "webcam-easy"
-import CachedDefaultTheme from "~/lib/forms/themes/CachedDefaultTheme.js"
import { BrowserMultiFormatReader, DecodeHintType, BarcodeFormat } from '@zxing/library'
+import { tv } from 'tailwind-variants'
+import { fileInputTheme } from '~/lib/forms/themes/file-input.theme.js'
export default {
name: "CameraUpload",
props: {
- theme: {
- type: Object, default: () => {
- const theme = inject("theme", null)
- if (theme) {
- return theme.value
- }
- return CachedDefaultTheme.getInstance()
- }
- },
isBarcodeMode: {
type: Boolean,
default: false
@@ -180,6 +168,21 @@ export default {
currentFacingMode: 'user',
mediaStream: null
}),
+ setup() {
+ const themeName = inject('formTheme', null)
+ const size = inject('formSize', null)
+ const borderRadius = inject('formBorderRadius', null)
+ const resolvedTheme = computed(() => themeName?.value || 'default')
+ const resolvedSize = computed(() => size?.value || 'md')
+ const resolvedBorderRadius = computed(() => borderRadius?.value || 'small')
+ const variants = computed(() => tv(fileInputTheme, {}))
+ const variantSlots = computed(() => variants.value({
+ theme: resolvedTheme.value,
+ size: resolvedSize.value,
+ borderRadius: resolvedBorderRadius.value
+ }))
+ return { variantSlots }
+ },
computed: {
videoDisplay() {
return this.isCapturing ? "" : "hidden"
@@ -436,4 +439,3 @@ export default {
},
}
</script>
-
diff --git a/client/components/forms/heavy/components/UploadedFile.vue b/client/components/forms/heavy/components/UploadedFile.vue
index da0daf42f..f771f4fdf 100644
--- a/client/components/forms/heavy/components/UploadedFile.vue
+++ b/client/components/forms/heavy/components/UploadedFile.vue
@@ -1,10 +1,7 @@
<template>
<div
class="overflow-hidden"
- :class="[
- theme.fileInput.uploadedFile,
- { 'bg-white': !disabled, 'bg-gray-300': disabled }
- ]"
+ :class="[variantSlots.root(), { 'bg-white': !disabled, 'bg-gray-300': disabled }]"
:title="file.file.name"
>
<div
@@ -68,7 +65,8 @@
</template>
<script>
-import CachedDefaultTheme from "~/lib/forms/themes/CachedDefaultTheme.js"
+import { tv } from 'tailwind-variants'
+import { uploadedFileTheme } from '~/lib/forms/themes/uploaded-file.theme.js'
export default {
name: "UploadedFile",
@@ -77,21 +75,17 @@ export default {
file: { type: Object, default: null },
disabled: { type: Boolean, default: false },
showRemove: { type: Boolean, default: true },
- theme: {
- type: Object, default: () => {
- const theme = inject("theme", null)
- if (theme) {
- return theme.value
- }
- return CachedDefaultTheme.getInstance()
- }
- },
},
emits: ['remove'],
data: () => ({
isImageHide: false,
}),
-
- computed: {},
+ setup() {
+ const injectedTheme = inject('formTheme', null)
+ const resolvedTheme = computed(() => injectedTheme?.value || 'default')
+ const uploadedVariants = computed(() => tv(uploadedFileTheme, {}))
+ const variantSlots = computed(() => uploadedVariants.value({ theme: resolvedTheme.value }))
+ return { variantSlots }
+ },
}
</script>
diff --git a/client/components/forms/useFormInput.js b/client/components/forms/useFormInput.js
index bf30b6939..4d5ea8a05 100644
--- a/client/components/forms/useFormInput.js
+++ b/client/components/forms/useFormInput.js
@@ -1,23 +1,19 @@
-import {ref, computed, watch} from "vue"
+import {ref, computed, watch, inject} from "vue"
import {default as _get} from "lodash/get"
import {default as _set} from "lodash/set"
import {default as _has} from "lodash/has"
-import CachedDefaultTheme from "~/lib/forms/themes/CachedDefaultTheme.js"
+import { tv } from "tailwind-variants"
export const inputProps = {
id: {type: String, default: null},
name: {type: String, required: true},
label: {type: String, required: false},
form: {type: Object, required: false},
- theme: {
- type: Object, default: () => {
- const theme = inject("theme", null)
- if (theme) {
- return theme.value
- }
- return CachedDefaultTheme.getInstance()
- }
- },
+ // Theme configuration as strings for tailwind-variants
+ theme: {type: String, default: null},
+ size: {type: String, default: null},
+ borderRadius: {type: String, default: null},
+ ui: {type: Object, default: () => ({})},
modelValue: {required: false},
required: {type: Boolean, default: false},
disabled: {type: Boolean, default: false},
@@ -37,10 +33,30 @@ export const inputProps = {
export function useFormInput(props, context, options = {}) {
const composableOptions = {
formPrefixKey: null,
+ variants: null, // Tailwind-variants configuration object
+ additionalVariants: {}, // Component-specific variants
...options
}
const content = ref(props.modelValue)
+ // Inject theme values at composable level - centralized for all form inputs
+ const injectedTheme = inject('formTheme', null)
+ const injectedSize = inject('formSize', null)
+ const injectedBorderRadius = inject('formBorderRadius', null)
+
+ // Resolve theme values with proper reactivity
+ const resolvedTheme = computed(() => {
+ return props.theme || injectedTheme?.value || 'default'
+ })
+
+ const resolvedSize = computed(() => {
+ return props.size || injectedSize?.value || 'md'
+ })
+
+ const resolvedBorderRadius = computed(() => {
+ return props.borderRadius || injectedBorderRadius?.value || 'small'
+ })
+
const inputStyle = computed(() => {
return {
"--tw-ring-color": props.color,
@@ -84,13 +100,29 @@ export function useFormInput(props, context, options = {}) {
const inputWrapperProps = computed(() => {
const wrapperProps = {}
Object.keys(inputProps).forEach((key) => {
- if (!["modelValue", "disabled", "placeholder", "color"].includes(key)) {
+ if (!["modelValue", "disabled", "placeholder", "color", "theme", "size", "borderRadius", "ui"].includes(key)) {
wrapperProps[key] = props[key]
}
})
return wrapperProps
})
+ // CENTRALIZED VARIANTS: Single computed property for all tailwind-variants
+ // Following Nuxt UI pattern - only computed when variants config is provided
+ const ui = computed(() => {
+ if (!composableOptions.variants) return {}
+
+ return tv(composableOptions.variants, props.ui)({
+ theme: resolvedTheme.value, // props.theme resolved with injection
+ size: resolvedSize.value,
+ borderRadius: resolvedBorderRadius.value,
+ hasError: hasError.value,
+ disabled: props.disabled,
+ // Component-specific variants (e.g., loading, multiple, etc.)
+ ...composableOptions.additionalVariants
+ })
+ })
+
const onFocus = (event) => {
context.emit('focus', event)
}
@@ -117,5 +149,12 @@ export function useFormInput(props, context, options = {}) {
inputWrapperProps,
onFocus,
onBlur,
+ // Resolved theme values - available to all form input components
+ resolvedTheme,
+ resolvedSize,
+ resolvedBorderRadius,
+ // Centralized UI variants - ready to use in templates
+ ui,
}
}
+
diff --git a/client/components/open/components/EditSubmissionModal.vue b/client/components/open/components/EditSubmissionModal.vue
index 4858a6289..f2ce334ee 100644
--- a/client/components/open/components/EditSubmissionModal.vue
+++ b/client/components/open/components/EditSubmissionModal.vue
@@ -8,7 +8,6 @@
<OpenForm
v-if="form"
:form-manager="formManager"
- :theme="theme"
@submit="updateForm"
>
<template #submit-btn="{ isProcessing }">
@@ -27,22 +26,12 @@
<script setup>
import { ref, defineProps, defineEmits, computed } from "vue"
import OpenForm from "../forms/OpenForm.vue"
-import CachedDefaultTheme from "~/lib/forms/themes/CachedDefaultTheme.js"
import { FormMode } from "~/lib/forms/FormModeStrategy.js"
import { useFormManager } from '~/lib/forms/composables/useFormManager'
const props = defineProps({
show: { type: Boolean, required: true },
form: { type: Object, required: true },
- theme: {
- type: Object, default: () => {
- const theme = inject("theme", null)
- if (theme) {
- return theme.value
- }
- return CachedDefaultTheme.getInstance()
- }
- },
submission: { type: Object },
})
diff --git a/client/components/open/components/ViewSubmissionModal.vue b/client/components/open/components/ViewSubmissionModal.vue
index 1edfa3b36..225bd93bb 100644
--- a/client/components/open/components/ViewSubmissionModal.vue
+++ b/client/components/open/components/ViewSubmissionModal.vue
@@ -33,7 +33,6 @@
<OpenForm
v-if="form"
:form-manager="formManager"
- :theme="theme"
@submit="isModalOpen = false"
>
<template #submit-btn="{ loading }">
@@ -52,7 +51,6 @@
<script setup>
import OpenForm from "../forms/OpenForm.vue"
-import CachedDefaultTheme from "~/lib/forms/themes/CachedDefaultTheme.js"
import { FormMode } from "~/lib/forms/FormModeStrategy.js"
import { useFormManager } from '~/lib/forms/composables/useFormManager'
@@ -66,16 +64,7 @@ const props = defineProps({
default: () => [],
},
show: { type: Boolean, required: true },
- form: { type: Object, required: true },
- theme: {
- type: Object, default: () => {
- const theme = inject("theme", null)
- if (theme) {
- return theme.value
- }
- return CachedDefaultTheme.getInstance()
- }
- }
+ form: { type: Object, required: true }
})
const emit = defineEmits(["close"])
diff --git a/client/components/open/forms/OpenCompleteForm.vue b/client/components/open/forms/OpenCompleteForm.vue
index 64cd50e8f..0c61977bb 100644
--- a/client/components/open/forms/OpenCompleteForm.vue
+++ b/client/components/open/forms/OpenCompleteForm.vue
@@ -31,7 +31,6 @@
<div class="form-group flex flex-wrap w-full">
<div class="relative w-full px-2">
<text-input
- :theme="theme"
:form="passwordForm"
name="password"
native-type="password"
@@ -110,7 +109,6 @@
<open-form
v-if="formManager && form && shouldDisplayForm"
:form-manager="formManager"
- :theme="theme"
@submit="triggerSubmit"
>
<template #submit-btn="{loading}">
@@ -174,7 +172,6 @@
<script setup>
import { useFormManager } from '~/lib/forms/composables/useFormManager'
import { FormMode, createFormModeStrategy } from "~/lib/forms/FormModeStrategy.js"
-import ThemeBuilder from "~/lib/forms/themes/ThemeBuilder.js"
import OpenForm from './OpenForm.vue'
import OpenFormButton from './OpenFormButton.vue'
import FormCleanings from '../../pages/forms/show/FormCleanings.vue'
@@ -227,14 +224,10 @@ const darkModeRef = toRef(props, 'darkMode')
// Create a reactive reference for the mode prop
const modeRef = toRef(props, 'mode')
-// Add back the local theme computation
-const theme = computed(() => {
- return new ThemeBuilder(props.form.theme, {
- size: props.form.size,
- borderRadius: props.form.border_radius
- }).getAllComponents()
-})
-provide('theme', theme)
+// Provide theme context for components outside OpenForm (password input, TextBlock)
+provide('formTheme', computed(() => props.form.theme || 'default'))
+provide('formSize', computed(() => props.form.size || 'md'))
+provide('formBorderRadius', computed(() => props.form.border_radius || 'small'))
let formManager = null
if (props.form) {
diff --git a/client/components/open/forms/OpenForm.vue b/client/components/open/forms/OpenForm.vue
index 7e2121fa0..13257e2dd 100644
--- a/client/components/open/forms/OpenForm.vue
+++ b/client/components/open/forms/OpenForm.vue
@@ -5,7 +5,6 @@
>
<FormProgressbar
:form-manager="formManager"
- :theme="theme"
/>
<transition
name="fade"
@@ -34,7 +33,6 @@
<open-form-field
:field="element"
:form-manager="formManager"
- :theme="theme"
/>
</VTransition>
</template>
@@ -46,7 +44,6 @@
<CaptchaWrapper
v-if="form.use_captcha"
:form-manager="formManager"
- :theme="theme"
/>
<!-- Submit, Next and previous buttons -->
@@ -100,8 +97,7 @@ import FormProgressbar from './FormProgressbar.vue'
import { useWorkingFormStore } from '~/stores/working_form'
const props = defineProps({
- formManager: { type: Object, required: true },
- theme: { type: Object, required: true }
+ formManager: { type: Object, required: true }
})
const workingFormStore = useWorkingFormStore()
@@ -113,6 +109,11 @@ const formPageIndex = computed(() => props.formManager.state.currentPage)
const strategy = computed(() => props.formManager.strategy.value)
const structure = computed(() => props.formManager.structure)
+// Provide theme context for all child form components
+provide('formTheme', computed(() => form.value?.theme || 'default'))
+provide('formSize', computed(() => form.value?.size || 'md'))
+provide('formBorderRadius', computed(() => form.value?.border_radius || 'small'))
+
const hasPaymentBlock = computed(() => {
return structure.value?.currentPageHasPaymentBlock.value ?? false
})
diff --git a/client/components/open/forms/OpenFormField.vue b/client/components/open/forms/OpenFormField.vue
index 1ed057b84..d508c35c6 100644
--- a/client/components/open/forms/OpenFormField.vue
+++ b/client/components/open/forms/OpenFormField.vue
@@ -139,8 +139,7 @@
v-else
:alt="field.name"
:src="field.image_block"
- class="max-w-full inline-block"
- :class="theme.default.borderRadius"
+ class="max-w-full inline-block rounded-lg"
>
</div>
</template>
@@ -162,7 +161,6 @@
<script setup>
import FormLogicPropertyResolver from "~/lib/forms/FormLogicPropertyResolver.js"
-import CachedDefaultTheme from "~/lib/forms/themes/CachedDefaultTheme.js"
import { default as _has } from 'lodash/has'
import { FormMode, createFormModeStrategy } from "~/lib/forms/FormModeStrategy.js"
import { useWorkingFormStore } from '~/stores/working_form'
@@ -177,10 +175,6 @@ const props = defineProps({
formManager: {
type: Object,
required: true
- },
- theme: {
- type: Object,
- required: true
}
})
@@ -334,7 +328,6 @@ function inputProperties(field) {
help: field.help,
helpPosition: (field.help_position) ? field.help_position : 'below_input',
uppercaseLabels: form.value.uppercase_labels == 1 || form.value.uppercase_labels == true,
- theme: props.theme || CachedDefaultTheme.getInstance(),
maxCharLimit: (field.max_char_limit) ? parseInt(field.max_char_limit) : null,
showCharLimit: field.show_char_limit || false,
isDark: darkMode.value,
diff --git a/client/components/open/forms/components/form-logic-components/ColumnCondition.vue b/client/components/open/forms/components/form-logic-components/ColumnCondition.vue
index 3dae66d26..5e781af9e 100644
--- a/client/components/open/forms/components/form-logic-components/ColumnCondition.vue
+++ b/client/components/open/forms/components/form-logic-components/ColumnCondition.vue
@@ -38,7 +38,6 @@
<script>
import OpenFilters from "../../../../../data/open_filters.json"
-import ThemeBuilder from "~/lib/forms/themes/ThemeBuilder.js"
export default {
components: {},
@@ -68,12 +67,7 @@ export default {
email: "TextInput",
phone_number: "TextInput",
matrix: "MatrixInput",
- },
- // Create small-sized theme for all child components
- smallTheme: new ThemeBuilder('simple', {
- size: 'xs',
- borderRadius: 'small'
- }).getAllComponents()
+ }
}
},
@@ -84,7 +78,8 @@ export default {
component: this.inputComponent[this.property.type],
name: this.property.id,
required: true,
- theme: this.smallTheme,
+ size: 'xs',
+ borderRadius: 'small',
wrapperClass: 'm-0',
}
diff --git a/client/components/open/forms/components/templates/QuestionsEditor.vue b/client/components/open/forms/components/templates/QuestionsEditor.vue
index 90ee4555a..f38db1a20 100644
--- a/client/components/open/forms/components/templates/QuestionsEditor.vue
+++ b/client/components/open/forms/components/templates/QuestionsEditor.vue
@@ -1,16 +1,14 @@
<template>
- <div :class="wrapperClass">
+ <div :class="inputWrapperProps.wrapperClass">
<label
- v-if="label"
- :for="id ? id : name"
- :class="[
- theme.default.label,
- { 'uppercase text-xs': uppercaseLabels, 'text-sm': !uppercaseLabels },
- ]"
+ v-if="inputWrapperProps.label"
+ :for="inputWrapperProps.id || inputWrapperProps.name"
+ class="text-neutral-700 dark:text-neutral-300 font-semibold"
+ :class="{ 'uppercase text-xs': inputWrapperProps.uppercaseLabels, 'text-sm': !inputWrapperProps.uppercaseLabels }"
>
- {{ label }}
+ {{ inputWrapperProps.label }}
<span
- v-if="required"
+ v-if="inputWrapperProps.required"
class="text-red-500 required-dot"
>*</span>
</label>
@@ -63,58 +61,54 @@
</div>
<small
- v-if="help"
- :class="theme.SelectInput.help"
+ v-if="inputWrapperProps.help"
+ class="text-neutral-500"
>
- <slot name="help">{{ help }}</slot>
+ <slot name="help">{{ inputWrapperProps.help }}</slot>
</small>
<has-error
v-if="hasValidation"
- :form="form"
- :field-id="name"
+ :form="inputWrapperProps.form"
+ :field-id="inputWrapperProps.name"
/>
</div>
</template>
-<script>
-import inputMixin from "~/mixins/forms/input.js"
+<script setup>
+import { ref, onMounted } from "vue"
+import { useFormInput, inputProps } from "~/components/forms/useFormInput.js"
+import Loader from "~/components/global/Loader.vue"
-export default {
- name: "QuestionsEditor",
- mixins: [inputMixin],
+const props = defineProps({
+ ...inputProps,
+ loading: { type: Boolean, default: false },
+ addNew: { type: Boolean, default: true },
+ questions: { type: Array, default: () => [] },
+})
- props: {
- loading: { type: Boolean, default: false },
- addNew: { type: Boolean, default: true },
- questions: { type: Array, default: ()=>[] },
- },
+const emit = defineEmits(['update:modelValue'])
- data() {
- return {
- allQuestions: null,
- newQuestion: {
- question: "",
- answer: "",
- },
- }
- },
+// Use form input composable
+const { hasValidation, inputWrapperProps } = useFormInput(props, { emit })
- computed: {},
+// Component-specific state
+const allQuestions = ref(null)
+const newQuestion = ref({
+ question: "",
+ answer: "",
+})
- watch: {},
-
- mounted() {
- this.allQuestions =
- this.questions.length > 0 ? this.questions : [this.newQuestion]
- },
+// Methods
+const onAdd = () => {
+ allQuestions.value.push({ ...newQuestion.value })
+}
- methods: {
- onAdd() {
- this.allQuestions.push(this.newQuestion)
- },
- onRemove(key) {
- this.allQuestions.splice(key, 1)
- },
- },
+const onRemove = (key) => {
+ allQuestions.value.splice(key, 1)
}
+
+// Initialize on mount
+onMounted(() => {
+ allQuestions.value = props.questions.length > 0 ? props.questions : [{ ...newQuestion.value }]
+})
</script>
diff --git a/client/components/pages/auth/components/QuickRegister.vue b/client/components/pages/auth/components/QuickRegister.vue
index 37b8b5df9..810d4cd20 100644
--- a/client/components/pages/auth/components/QuickRegister.vue
+++ b/client/components/pages/auth/components/QuickRegister.vue
@@ -5,6 +5,9 @@
v-model:open="isLoginModalOpen"
title="Login to OpnForm"
:dismissible="!appStore.isUnauthorizedError"
+ :content="{
+ onPointerDownOutside: (event) => { if (event.target?.closest('#credential_picker_container')) {return event.preventDefault()}}
+ }"
>
<template #body>
<template v-if="appStore.isUnauthorizedError">
diff --git a/client/components/pages/forms/show/UrlFormPrefill.vue b/client/components/pages/forms/show/UrlFormPrefill.vue
index f6339b349..858a2fe1b 100644
--- a/client/components/pages/forms/show/UrlFormPrefill.vue
+++ b/client/components/pages/forms/show/UrlFormPrefill.vue
@@ -58,7 +58,6 @@
<div class="rounded-lg p-5 bg-neutral-100 dark:bg-neutral-900 mt-4">
<OpenForm
v-if="formManager"
- :theme="theme"
:form-manager="formManager"
@submit="generateUrl"
>
@@ -88,7 +87,6 @@
</template>
<script setup>
-import ThemeBuilder from "~/lib/forms/themes/ThemeBuilder"
import FormUrlPrefill from "~/components/open/forms/components/FormUrlPrefill.vue"
import OpenForm from "~/components/open/forms/OpenForm.vue"
import { FormMode } from "~/lib/forms/FormModeStrategy.js"
@@ -117,14 +115,6 @@ const isModalOpen = computed({
}
})
-// Theme computation
-const theme = computed(() => {
- return new ThemeBuilder(props.form.theme, {
- size: props.form.size,
- borderRadius: props.form.border_radius
- }).getAllComponents()
-})
-
// Set up form manager with proper mode
let formManager = null
const setupFormManager = () => {
diff --git a/client/lib/forms/themes/CachedDefaultTheme.js b/client/lib/forms/themes/CachedDefaultTheme.js
deleted file mode 100644
index 2318e0e62..000000000
--- a/client/lib/forms/themes/CachedDefaultTheme.js
+++ /dev/null
@@ -1,21 +0,0 @@
-import ThemeBuilder from './ThemeBuilder.js'
-
-const CachedDefaultTheme = (function() {
- let instance
-
- function createInstance() {
- const themeBuilder = new ThemeBuilder()
- return themeBuilder.getAllComponents()
- }
-
- return {
- getInstance: function() {
- if (!instance) {
- instance = createInstance()
- }
- return instance
- }
- }
-})()
-
-export default CachedDefaultTheme
diff --git a/client/lib/forms/themes/ThemeBuilder.js b/client/lib/forms/themes/ThemeBuilder.js
deleted file mode 100644
index ec78f9136..000000000
--- a/client/lib/forms/themes/ThemeBuilder.js
+++ /dev/null
@@ -1,69 +0,0 @@
-import {twMerge} from 'tailwind-merge'
-import {themes} from './form-themes.js'
-
-export const sizes = ['xs', 'sm', 'md', 'lg']
-
-class ThemeBuilder {
- constructor(theme = 'default', options = {}) {
- this.theme = themes[theme] || themes.default
- this.size = options.size || 'md'
- this.borderRadius = options.borderRadius || 'small'
- }
-
- extractSizedClasses(baseConfig) {
- if (typeof baseConfig === 'object' &&
- sizes.every((size) => baseConfig[size])) {
- return baseConfig[this.size]
- }
-
- return baseConfig
- }
-
- mergeNestedClasses(baseConfig, componentConfig) {
- const mergedConfig = {}
-
- const allKeys = new Set([
- ...Object.keys(baseConfig),
- ...Object.keys(componentConfig),
- ])
-
- allKeys.forEach((key) => {
- const baseValue = this.extractSizedClasses(baseConfig[key])
- const componentValue = this.extractSizedClasses(componentConfig[key])
-
- if (key === 'borderRadius') {
- // Special case for border radius
- const borderRadiusClass = baseConfig.borderRadius?.[this.borderRadius] || ''
- mergedConfig[key] = twMerge(borderRadiusClass, componentValue)
- } else if (
- typeof baseValue === 'object' &&
- baseValue !== null &&
- !Array.isArray(baseValue)) {
- mergedConfig[key] = this.mergeNestedClasses(baseValue, componentValue || {})
- } else {
- mergedConfig[key] = twMerge(baseValue || '', componentValue || '')
- }
- })
-
- return mergedConfig
- }
-
- getComponentTheme(componentName = 'default') {
- const baseComponentConfig = this.theme.default || {}
- const componentConfig = this.theme[componentName] || {}
- return this.mergeNestedClasses(baseComponentConfig, componentConfig)
- }
-
- // Get all components classes for the selected theme
- getAllComponents() {
- const allComponents = {}
-
- Object.keys(this.theme).forEach((componentName) => {
- allComponents[componentName] = this.getComponentTheme(componentName)
- })
-
- return allComponents
- }
-}
-
-export default ThemeBuilder
diff --git a/client/lib/forms/themes/checkbox-icon.theme.js b/client/lib/forms/themes/checkbox-icon.theme.js
new file mode 100644
index 000000000..ce053f950
--- /dev/null
+++ b/client/lib/forms/themes/checkbox-icon.theme.js
@@ -0,0 +1,51 @@
+/**
+ * CheckboxIcon tailwind-variants configuration
+ * Used for checkbox icons in FlatSelectInput and similar components
+ * Colors match text input border colors for consistency
+ */
+export const checkboxIconTheme = {
+ slots: {
+ checkedIcon: [
+ 'block',
+ 'text-[var(--form-color,#3B82F6)]'
+ ],
+ uncheckedIcon: [
+ 'block'
+ ]
+ },
+ variants: {
+ theme: {
+ default: {
+ uncheckedIcon: 'text-neutral-300 dark:text-neutral-600'
+ },
+ simple: {
+ uncheckedIcon: 'text-neutral-300 dark:text-neutral-600'
+ },
+ notion: {
+ uncheckedIcon: 'text-notion-input-border dark:text-notion-input-borderDark'
+ }
+ },
+ size: {
+ xs: {
+ checkedIcon: 'size-3',
+ uncheckedIcon: 'size-3'
+ },
+ sm: {
+ checkedIcon: 'size-4',
+ uncheckedIcon: 'size-4'
+ },
+ md: {
+ checkedIcon: 'size-5',
+ uncheckedIcon: 'size-5'
+ },
+ lg: {
+ checkedIcon: 'size-6 mx-1',
+ uncheckedIcon: 'size-6 mx-1'
+ }
+ }
+ },
+ defaultVariants: {
+ theme: 'default',
+ size: 'md'
+ }
+}
\ No newline at end of file
diff --git a/client/lib/forms/themes/checkbox-input.theme.js b/client/lib/forms/themes/checkbox-input.theme.js
new file mode 100644
index 000000000..8484ba2e9
--- /dev/null
+++ b/client/lib/forms/themes/checkbox-input.theme.js
@@ -0,0 +1,21 @@
+/**
+ * CheckboxInput tailwind-variants configuration
+ */
+export const checkboxInputTheme = {
+ slots: {
+ label: '',
+ help: 'text-neutral-500'
+ },
+ variants: {
+ size: {
+ xs: { label: 'text-xs' },
+ sm: { label: 'text-sm' },
+ md: { label: 'text-base' },
+ lg: { label: 'text-lg' }
+ }
+ },
+ defaultVariants: {
+ size: 'md'
+ }
+}
+
diff --git a/client/lib/forms/themes/code-input.theme.js b/client/lib/forms/themes/code-input.theme.js
new file mode 100644
index 000000000..a51b51095
--- /dev/null
+++ b/client/lib/forms/themes/code-input.theme.js
@@ -0,0 +1,41 @@
+/**
+ * CodeInput tailwind-variants configuration
+ */
+export const codeInputTheme = {
+ slots: {
+ container: [
+ 'h-40 max-h-96 overflow-y-auto relative'
+ ]
+ },
+ variants: {
+ theme: {
+ default: { container: 'border border-neutral-300 dark:border-neutral-600' },
+ notion: { container: 'border border-notion-input-border dark:border-notion-input-borderDark' }
+ },
+ size: {
+ xs: { container: 'rounded-none' },
+ sm: { container: '' },
+ md: { container: '' },
+ lg: { container: '' }
+ },
+ borderRadius: {
+ none: { container: 'rounded-none' },
+ small: { container: 'rounded-md' },
+ full: { container: 'rounded-[20px]' }
+ },
+ hasError: {
+ true: { container: '!ring-red-500 !ring-2 !border-transparent' }
+ },
+ disabled: {
+ true: { container: '!cursor-not-allowed !bg-neutral-200 dark:!bg-neutral-800' }
+ }
+ },
+ defaultVariants: {
+ theme: 'default',
+ size: 'md',
+ borderRadius: 'small',
+ hasError: false,
+ disabled: false
+ }
+}
+
diff --git a/client/lib/forms/themes/color-input.theme.js b/client/lib/forms/themes/color-input.theme.js
new file mode 100644
index 000000000..f97c3e79a
--- /dev/null
+++ b/client/lib/forms/themes/color-input.theme.js
@@ -0,0 +1,21 @@
+/**
+ * ColorInput tailwind-variants configuration
+ */
+export const colorInputTheme = {
+ slots: {
+ label: '',
+ help: 'text-neutral-500'
+ },
+ variants: {
+ size: {
+ xs: { label: 'text-xs' },
+ sm: { label: 'text-sm' },
+ md: { label: 'text-base' },
+ lg: { label: 'text-lg' }
+ }
+ },
+ defaultVariants: {
+ size: 'md'
+ }
+}
+
diff --git a/client/lib/forms/themes/date-input.theme.js b/client/lib/forms/themes/date-input.theme.js
new file mode 100644
index 000000000..20d92e500
--- /dev/null
+++ b/client/lib/forms/themes/date-input.theme.js
@@ -0,0 +1,66 @@
+/**
+ * DateInput tailwind-variants configuration
+ */
+export const dateInputTheme = {
+ slots: {
+ input: [
+ 'w-full border bg-white dark:bg-notion-dark-light',
+ 'text-neutral-700 dark:text-neutral-300',
+ 'focus-visible:outline-none focus-visible:ring-2 focus-visible:border-transparent'
+ ],
+ inner: ''
+ },
+ variants: {
+ theme: {
+ default: {
+ input: [
+ 'border-neutral-300 dark:border-neutral-600',
+ 'focus-visible:ring-form/100'
+ ]
+ },
+ simple: {
+ input: [
+ 'border-neutral-300 dark:border-neutral-600',
+ 'focus-visible:ring-form/100'
+ ]
+ },
+ notion: {
+ input: [
+ 'border-notion-input-border dark:border-notion-input-borderDark',
+ 'bg-notion-input-background dark:bg-notion-dark-light',
+ 'text-neutral-900 dark:text-neutral-100',
+ 'focus-visible:ring-form/40'
+ ]
+ }
+ },
+ size: {
+ xs: { input: 'text-xs', inner: 'px-2.5 py-1.5 text-xs' },
+ sm: { input: 'text-sm', inner: 'px-2 py-1.5 text-sm' },
+ md: { input: 'text-base', inner: 'px-4 py-2 text-base' },
+ lg: { input: 'text-lg', inner: 'px-5 py-3 text-lg' }
+ },
+ borderRadius: {
+ none: { input: 'rounded-none' },
+ small: { input: 'rounded-lg' },
+ full: { input: 'rounded-[20px]' }
+ },
+ hasError: {
+ true: { input: '!ring-red-500 !ring-2 !border-transparent' }
+ },
+ disabled: {
+ true: {
+ input: [
+ '!cursor-not-allowed !bg-neutral-200 dark:!bg-neutral-800',
+ '!focus-visible:ring-0'
+ ]
+ }
+ }
+ },
+ defaultVariants: {
+ theme: 'default',
+ size: 'md',
+ borderRadius: 'small',
+ hasError: false,
+ disabled: false
+ }
+}
diff --git a/client/lib/forms/themes/file-input.theme.js b/client/lib/forms/themes/file-input.theme.js
new file mode 100644
index 000000000..1a7b11f3d
--- /dev/null
+++ b/client/lib/forms/themes/file-input.theme.js
@@ -0,0 +1,47 @@
+/**
+ * FileInput tailwind-variants configuration (also used by Barcode and Camera)
+ */
+export const fileInputTheme = {
+ slots: {
+ container: [
+ 'flex flex-col w-full items-center justify-center transition-colors duration-40',
+ 'border border-dashed',
+ 'shadow-none',
+ 'hover:bg-neutral-50 dark:hover:bg-notion-dark-light',
+ 'focus:outline-hidden focus:ring-2'
+ ]
+ },
+ variants: {
+ theme: {
+ default: { container: 'border-neutral-300 dark:border-neutral-600' },
+ notion: {
+ container: 'border-notion-input-border dark:border-notion-input-borderDark bg-notion-input-background dark:bg-notion-dark-light text-neutral-900 dark:text-neutral-100'
+ }
+ },
+ size: {
+ xs: { container: 'min-h-20' },
+ sm: { container: 'min-h-28' },
+ md: { container: 'min-h-40' },
+ lg: { container: 'min-h-48' }
+ },
+ borderRadius: {
+ none: { container: 'rounded-none' },
+ small: { container: 'rounded-lg' },
+ full: { container: 'rounded-[20px]' }
+ },
+ hasError: {
+ true: { container: 'border-red-500 border-2' }
+ },
+ disabled: {
+ true: { container: '!cursor-not-allowed !bg-neutral-200 dark:!bg-neutral-800' }
+ }
+ },
+ defaultVariants: {
+ theme: 'default',
+ size: 'md',
+ borderRadius: 'small',
+ hasError: false,
+ disabled: false
+ }
+}
+
diff --git a/client/lib/forms/themes/flat-select-input.theme.js b/client/lib/forms/themes/flat-select-input.theme.js
new file mode 100644
index 000000000..9f57c6326
--- /dev/null
+++ b/client/lib/forms/themes/flat-select-input.theme.js
@@ -0,0 +1,83 @@
+/**
+ * FlatSelectInput tailwind-variants configuration
+ */
+export const flatSelectInputTheme = {
+ slots: {
+ container: [
+ 'border bg-white dark:bg-notion-dark-light',
+ 'text-neutral-700 dark:text-neutral-300',
+ 'focus-within:outline-hidden'
+ ],
+ // Keep base minimal; theme variants add interaction + spacing
+ option: [
+ 'flex items-center',
+ 'border-t first:border-t-0 px-2'
+ ],
+ hover: '',
+ help: 'text-neutral-500'
+ },
+ variants: {
+ theme: {
+ default: {
+ container: [
+ 'border-neutral-300 dark:border-neutral-600',
+ 'shadow-xs'
+ ],
+ option: [
+ 'cursor-pointer',
+ 'border-neutral-300 dark:border-neutral-600',
+ 'gap-x-2'
+ ],
+ hover: 'hover:bg-neutral-50 dark:hover:bg-neutral-900'
+ },
+ simple: {
+ container: [
+ 'border-neutral-300 dark:border-neutral-600'
+ ],
+ option: [
+ 'cursor-pointer',
+ 'border-neutral-300 dark:border-neutral-600',
+ 'gap-x-2'
+ ],
+ hover: 'hover:bg-neutral-50 dark:hover:bg-neutral-900'
+ },
+ notion: {
+ container: [
+ 'border-notion-input-border dark:border-notion-input-borderDark',
+ 'bg-notion-input-background dark:bg-notion-dark-light',
+ 'text-neutral-900 dark:text-neutral-100'
+ ],
+ option: [
+ 'cursor-pointer',
+ 'border-notion-input-border dark:border-notion-input-borderDark',
+ 'space-x-2'
+ ],
+ hover: 'hover:backdrop-brightness-95'
+ }
+ },
+ size: {
+ xs: { option: 'px-2 py-1 text-xs' },
+ sm: { option: 'px-2 py-1.5 text-sm' },
+ md: { option: 'px-3 py-2 text-base' },
+ lg: { option: 'px-4 py-3 text-lg' }
+ },
+ borderRadius: {
+ none: { container: 'rounded-none' },
+ small: { container: 'rounded-lg' },
+ full: { container: 'rounded-[20px]' }
+ },
+ hasError: {
+ true: { container: '!ring-red-500 !ring-2 !border-transparent' }
+ },
+ disabled: {
+ true: { container: '!cursor-not-allowed !bg-neutral-200 dark:!bg-neutral-800' }
+ }
+ },
+ defaultVariants: {
+ theme: 'default',
+ size: 'md',
+ borderRadius: 'small',
+ hasError: false,
+ disabled: false
+ }
+}
diff --git a/client/lib/forms/themes/form-themes.js b/client/lib/forms/themes/form-themes.js
deleted file mode 100644
index 7ce2bd4c4..000000000
--- a/client/lib/forms/themes/form-themes.js
+++ /dev/null
@@ -1,534 +0,0 @@
-/**
- Input classes for each supported form themes
- */
- export const themes = {
- default: {
- default: {
- wrapper: {
- xs: 'relative my-0.5',
- sm: 'relative my-1',
- md: 'relative my-1.5',
- lg: 'relative my-1.5',
- },
- label: 'text-neutral-700 dark:text-neutral-300 font-semibold',
- input:
- 'flex-1 appearance-none border border-neutral-300 dark:border-neutral-600 w-full bg-white text-neutral-700 dark:bg-notion-dark-light dark:text-neutral-300 dark:placeholder-neutral-500 placeholder-neutral-400 shadow-xs focus:outline-hidden focus:ring-2 focus:ring-form/100 focus:border-transparent',
- help: 'text-neutral-500',
- spacing: {
- horizontal: {
- xs: 'px-2.5',
- sm: 'px-2',
- md: 'px-4',
- lg: 'px-5'
- },
- vertical: {
- xs: 'py-1.5',
- sm: 'py-1.5',
- md: 'py-2',
- lg: 'py-3'
- }
- },
- fontSize: {
- xs: 'text-xs',
- sm: 'text-sm',
- md: 'text-base',
- lg: 'text-lg'
- },
- borderRadius: {
- none: 'rounded-none',
- small: 'rounded-lg',
- full: 'rounded-[20px]'
- }
- },
- ScaleInput: {
- button: 'cursor-pointer text-neutral-700 inline-block border-neutral-300 grow dark:bg-notion-dark-light dark:text-neutral-300 text-center',
- unselectedButton: 'bg-white border'
- },
- SliderInput: {
- stepLabel: 'text-neutral-700 dark:text-neutral-300 text-center text-xs'
- },
- Button: {
- body: 'transition ease-in duration-200 text-center font-semibold shadow-md focus:outline-hidden focus:ring-2 focus:ring-offset-2 hover:brightness-90'
- },
- CodeInput: {
- input: 'overflow-hidden'
- },
- RichTextAreaInput: {
- input:
- 'flex-1 appearance-none border border-neutral-300 dark:border-neutral-600 w-full bg-white text-neutral-700 dark:bg-notion-dark-light dark:text-neutral-300 dark:placeholder-neutral-500 placeholder-neutral-400 shadow-xs text-base focus:outline-hidden focus:ring-1 focus:ring-form/100 focus:border-transparent focus:ring-2'
- },
- SelectInput: {
- input:
- 'relative w-full flex-1 appearance-none border border-neutral-300 dark:border-neutral-600 w-full text-neutral-700 dark:text-neutral-300 dark:placeholder-neutral-600 shadow-xs text-base focus:outline-hidden focus:ring-2 focus:border-transparent',
- background: 'bg-white dark:bg-notion-dark-light',
- chevronGradient: 'bg-gradient-to-r from-transparent to-white dark:to-notion-dark-light',
- dropdown: 'border border-neutral-300 dark:border-neutral-600',
- option: 'rounded-xs',
- minHeight: {
- xs: 'min-h-[16px]',
- sm: 'min-h-[20px]',
- md: 'min-h-[24px]',
- lg: 'min-h-[28px]'
- }
- },
- PhoneInput: {
- countrySelectWidth: {
- xs: 'w-[80px]',
- sm: 'w-[100px]',
- md: 'w-[120px]',
- lg: 'w-[120px]'
- },
- flag: {
- xs: '-mt-[16px]!',
- sm: '-mt-[14px]!',
- md: '-mt-[9px]! rounded-xs',
- lg: '-mt-[9px]! rounded-xs'
- },
- flagSize: {
- xs: 'small',
- sm: 'small',
- md: 'normal',
- lg: 'normal'
- },
- maxHeight: {
- xs: 'max-h-[16px]',
- sm: 'max-h-[20px]',
- md: 'max-h-[24px]',
- lg: 'max-h-[28px]'
- }
- },
- FlatSelectInput: {
- option: 'cursor-pointer hover:bg-neutral-50 dark:hover:bg-neutral-900 flex items-center gap-x-2 border-t first:border-t-0 px-2',
- unselectedIcon: 'text-neutral-300 dark:text-neutral-600',
- icon: {
- xs: 'w-3 h-3',
- sm: 'w-4 h-4',
- md: 'w-5 h-5',
- lg: 'w-6 h-6 mx-1'
- }
- },
- DateInput: {
- input:
- 'flex-1 appearance-none border border-neutral-300 dark:border-neutral-600 w-full bg-white text-neutral-700 dark:bg-notion-dark-light dark:text-neutral-300 dark:placeholder-neutral-500 placeholder-neutral-400 shadow-xs text-base focus:outline-hidden focus:ring-2 focus:ring-form/100 focus:border-transparent'
- },
- PaymentInput: {
- cardContainer: 'transition-all duration-200',
- focusRing: 'ring-2 ring-form/100 border-transparent'
- },
- CheckboxInput:{
- size: {
- xs: 'w-3 h-3',
- sm: 'w-4 h-4',
- md: 'w-5 h-5',
- lg: 'w-5 h-5'
- },
- },
- SwitchInput:{
- containerSize: {
- xs: 'h-4 w-8 p-0.5',
- sm: 'h-5 w-10 p-0.5',
- md: 'h-6 w-12 p-1',
- lg: 'h-6 w-12 p-1'
- },
- circleSize: {
- xs: 'h-3 w-3',
- sm: 'h-4 w-4',
- md: 'h-4 w-4',
- lg: 'h-4 w-4'
- },
- translatedClass: {
- xs: 'translate-x-4',
- sm: 'translate-x-5',
- md: 'translate-x-6',
- lg: 'translate-x-6'
- }
- },
- RatingInput:{
- size: {
- xs: 'w-4 h-4',
- sm: 'w-6 h-6',
- md: 'w-8 h-8',
- lg: 'w-10 h-10'
- },
- },
- fileInput: {
- input:
- 'border border-dashed border-neutral-300 dark:border-neutral-600 p-4 shadow-none',
- minHeight: {
- xs: 'min-h-20',
- sm: 'min-h-28',
- md: 'min-h-40',
- lg: 'min-h-58'
- },
- inputHover: {
- light: 'bg-neutral-50',
- dark: 'bg-notion-dark-light'
- },
- uploadedFile:
- 'border border-neutral-300 dark:border-neutral-600 dark:bg-notion-dark-light rounded-lg shadow-xs max-w-10'
- },
- SignatureInput: {
- minHeight: {
- xs: 'min-h-20',
- sm: 'min-h-28',
- md: 'min-h-40',
- lg: 'min-h-48'
- },
- },
- MatrixInput: {
- table: 'bg-white dark:bg-notion-dark-light shadow-xs',
- cell: 'border-neutral-300 dark:border-neutral-600',
- cellHover: 'hover:bg-neutral-50 dark:hover:bg-neutral-900'
- }
- },
- simple: {
- default: {
- wrapper: {
- xs: 'relative my-0.5',
- sm: 'relative my-1',
- md: 'relative my-1.5',
- lg: 'relative my-1.5',
- },
- label: 'text-neutral-700 dark:text-neutral-300 font-medium',
- input:
- 'flex-1 appearance-none border border-neutral-300 dark:border-neutral-600 w-full bg-white text-neutral-700 dark:bg-notion-dark-light dark:text-neutral-300 dark:placeholder-neutral-500 placeholder-neutral-400 focus:outline-hidden focus:ring-2 focus:ring-form/100 focus:border-transparent',
- help: 'text-neutral-500',
- spacing: {
- horizontal: {
- xs: 'px-2.5',
- sm: 'px-2',
- md: 'px-4',
- lg: 'px-5'
- },
- vertical: {
- xs: 'py-1.5',
- sm: 'py-1.5',
- md: 'py-2',
- lg: 'py-3'
- }
- },
- fontSize: {
- xs: 'text-xs',
- sm: 'text-sm',
- md: 'text-base',
- lg: 'text-lg'
- },
- borderRadius: {
- none: 'rounded-none',
- small: 'rounded-lg',
- full: 'rounded-[20px]'
- }
- },
- ScaleInput: {
- button: 'flex-1 appearance-none border-neutral-300 dark:border-neutral-600 w-full bg-neutral-50 text-neutral-700 dark:bg-notion-dark-light dark:text-neutral-300 text-center',
- unselectedButton: 'bg-white border'
- },
- SliderInput: {
- stepLabel: 'text-neutral-700 dark:text-neutral-300 text-center text-xs'
- },
- Button: {
- body: 'transition ease-in duration-200 text-center font-semibold focus:outline-hidden focus:ring-2 focus:ring-offset-2 hover:brightness-90'
- },
- CodeInput: {
- input: 'overflow-hidden'
- },
- RichTextAreaInput: {
- input:
- 'flex-1 appearance-none border border-neutral-300 dark:border-neutral-600 w-full bg-white text-neutral-700 dark:bg-notion-dark-light dark:text-neutral-300 dark:placeholder-neutral-500 placeholder-neutral-400 text-base focus:outline-hidden focus:ring-1 focus:ring-form/100 focus:border-transparent focus:ring-2'
- },
- SelectInput: {
- input:
- 'relative w-full flex-1 appearance-none border border-neutral-300 dark:border-neutral-600 w-full text-neutral-700 dark:text-neutral-300 dark:placeholder-neutral-600 text-base focus:outline-hidden focus:ring-2 focus:border-transparent',
- background: 'bg-white dark:bg-notion-dark-light',
- chevronGradient: 'bg-gradient-to-r from-transparent to-white dark:to-notion-dark-light',
- dropdown: 'border border-neutral-300 dark:border-neutral-600',
- option: 'rounded-xs',
- minHeight: {
- xs: 'min-h-[16px]',
- sm: 'min-h-[20px]',
- md: 'min-h-[24px]',
- lg: 'min-h-[28px]'
- }
- },
- PhoneInput: {
- countrySelectWidth: {
- xs: 'w-[80px]',
- sm: 'w-[100px]',
- md: 'w-[120px]',
- lg: 'w-[120px]'
- },
- flag: {
- xs: '-mt-[16px]!',
- sm: '-mt-[14px]!',
- md: '-mt-[9px]! rounded-xs',
- lg: '-mt-[9px]! rounded-xs'
- },
- flagSize: {
- xs: 'small',
- sm: 'small',
- md: 'normal',
- lg: 'normal'
- },
- maxHeight: {
- xs: 'max-h-[16px]',
- sm: 'max-h-[20px]',
- md: 'max-h-[24px]',
- lg: 'max-h-[28px]'
- }
- },
- FlatSelectInput: {
- option: 'cursor-pointer hover:bg-neutral-50 dark:hover:bg-neutral-900 flex items-center space-x-2 border-t first:border-t-0 px-2',
- unselectedIcon: 'text-neutral-300 dark:text-neutral-600',
- icon: {
- xs: 'w-3 h-3',
- sm: 'w-4 h-4',
- md: 'w-5 h-5',
- lg: 'w-6 h-6 mx-1'
- }
- },
- DateInput: {
- input: 'flex-1 appearance-none border border-neutral-300 dark:border-neutral-600 w-full bg-white text-neutral-700 dark:bg-notion-dark-light dark:text-neutral-300 placeholder-neutral-400 text-base focus:outline-hidden focus:ring-2 focus:ring-form/100 focus:border-transparent'
- },
- PaymentInput: {
- cardContainer: 'transition-all duration-200',
- focusRing: 'ring-2 ring-form/100 border-transparent'
- },
- CheckboxInput:{
- size: {
- xs: 'w-3 h-3',
- sm: 'w-4 h-4',
- md: 'w-5 h-5',
- lg: 'w-5 h-5'
- },
- },
- SwitchInput:{
- containerSize: {
- xs: 'h-4 w-8',
- sm: 'h-5 w-10',
- md: 'h-6 w-12',
- lg: 'h-6 w-12'
- },
- circleSize: {
- xs: 'h-3 w-3',
- sm: 'h-4 w-4',
- md: 'h-4 w-4',
- lg: 'h-4 w-4'
- },
- },
- RatingInput:{
- size: {
- xs: 'w-4 h-4',
- sm: 'w-6 h-6',
- md: 'w-8 h-8',
- lg: 'w-10 h-10'
- },
- },
- fileInput: {
- input:
- 'border border-dashed border-neutral-300 dark:border-neutral-600 p-4 shadow-none',
- minHeight: {
- xs: 'min-h-20',
- sm: 'min-h-28',
- md: 'min-h-40',
- lg: 'min-h-48'
- },
- inputHover: {
- light: 'bg-neutral-50',
- dark: 'bg-notion-dark-light'
- },
- uploadedFile:
- 'border border-neutral-300 dark:border-neutral-600 dark:bg-notion-dark-light shadow-xs max-w-10'
- },
- SignatureInput: {
- minHeight: {
- xs: 'min-h-20',
- sm: 'min-h-28',
- md: 'min-h-40',
- lg: 'min-h-48'
- },
- },
- MatrixInput: {
- table: 'bg-white dark:bg-notion-dark-light',
- cell: 'border-neutral-300 dark:border-neutral-600',
- cellHover: 'hover:bg-neutral-50 dark:hover:bg-neutral-900'
- }
- },
- notion: {
- default: {
- wrapper: {
- xs: 'relative my-0.5',
- sm: 'relative my-1',
- md: 'relative my-1.5',
- lg: 'relative my-1.5',
- },
- label: 'text-neutral-900 dark:text-neutral-100 mb-1 block mt-4',
- input:
- 'rounded-xs border border-notion-input-border dark:border-notion-input-borderDark flex-1 appearance-none w-full bg-notion-input-background dark:bg-notion-dark-light text-neutral-900 dark:text-neutral-100 dark:placeholder-neutral-500 placeholder-neutral-400 focus:outline-hidden focus:ring-2 focus:ring-form/40 focus:border-transparent',
- help: 'text-neutral-500',
- spacing: {
- horizontal: {
- xs: 'px-2.5',
- sm: 'px-2',
- md: 'px-4',
- lg: 'px-5'
- },
- vertical: {
- xs: 'py-1.5',
- sm: 'py-1.5',
- md: 'py-2',
- lg: 'py-3'
- }
- },
- fontSize: {
- xs: 'text-xs',
- sm: 'text-sm',
- md: 'text-base',
- lg: 'text-lg'
- },
- borderRadius: {
- none: 'rounded-none',
- small: 'rounded-xs',
- full: 'rounded-[20px]'
- }
- },
- ScaleInput: {
- button: 'border border-notion-input-border dark:border-notion-input-borderDark flex-1 appearance-none w-full bg-notion-input-background dark:bg-notion-dark-light text-neutral-900 dark:text-neutral-100 text-center focus:outline-hidden focus:ring-2 focus:ring-form/40 focus:border-transparent',
- unselectedButton: 'bg-notion-input-background dark:bg-notion-dark-light'
- },
- SliderInput: {
- stepLabel: 'text-neutral-700 dark:text-neutral-300 text-center text-xs'
- },
- Button: {
- body: 'transition ease-in duration-200 text-center font-semibold border border-notion-input-border dark:border-notion-input-borderDark focus:outline-hidden focus:ring-2 focus:ring-form/40 focus:border-transparent hover:brightness-90'
- },
- CodeInput: {
- input: 'border border-notion-input-border dark:border-notion-input-borderDark focus:outline-hidden focus:ring-2 focus:ring-form/40 focus:border-transparent overflow-hidden'
- },
- RichTextAreaInput: {
- input:
- 'flex-1 appearance-none border border-notion-input-border dark:border-notion-input-borderDark w-full bg-notion-input-background dark:bg-notion-dark-light text-neutral-900 dark:text-neutral-100 dark:placeholder-neutral-500 placeholder-neutral-400 text-base focus:outline-hidden focus:ring-2 focus:ring-form/40 focus:border-transparent'
- },
- SelectInput: {
- input:
- 'relative w-full border border-notion-input-border dark:border-notion-input-borderDark flex-1 appearance-none w-full text-neutral-900 dark:text-neutral-100 placeholder-neutral-400 dark:placeholder-neutral-500 text-base focus:outline-hidden focus:ring-2 focus:ring-form/40 focus:border-transparent',
- background: 'bg-notion-input-background dark:bg-notion-dark-light',
- chevronGradient: 'bg-gradient-to-r from-transparent to-notion-input-background dark:to-notion-dark-light',
- dropdown: 'border border-notion-input-border dark:border-notion-input-borderDark',
- option: 'rounded-xs',
- minHeight: {
- xs: 'min-h-[16px]',
- sm: 'min-h-[20px]',
- md: 'min-h-[24px]',
- lg: 'min-h-[28px]'
- }
- },
- PhoneInput: {
- countrySelectWidth: {
- xs: 'w-[80px]',
- sm: 'w-[100px]',
- md: 'w-[120px]',
- lg: 'w-[120px]'
- },
- flag: {
- xs: '-mt-[16px]!',
- sm: '-mt-[14px]!',
- md: '-mt-[9px]! rounded-xs',
- lg: '-mt-[9px]! rounded-xs'
- },
- flagSize: {
- xs: 'small',
- sm: 'small',
- md: 'normal',
- lg: 'normal'
- },
- maxHeight: {
- xs: 'max-h-[16px]',
- sm: 'max-h-[20px]',
- md: 'max-h-[24px]',
- lg: 'max-h-[28px]'
- }
- },
- FlatSelectInput: {
- option: 'cursor-pointer hover:backdrop-brightness-95 flex items-center space-x-2 border-t border-neutral-300 first:border-t-0 px-2',
- unselectedIcon: 'text-neutral-300 dark:text-neutral-600',
- icon: {
- xs: 'w-3 h-3',
- sm: 'w-4 h-4',
- md: 'w-5 h-5',
- lg: 'w-6 h-6 mx-1'
- }
- },
- DateInput: {
- input: 'border border-notion-input-border dark:border-notion-input-borderDark flex-1 appearance-none w-full bg-notion-input-background dark:bg-notion-dark-light text-neutral-900 dark:text-neutral-100 placeholder-neutral-400 text-base focus:outline-hidden focus:ring-2 focus:ring-form/40 focus:border-transparent'
- },
- PaymentInput: {
- cardContainer: 'transition-all duration-200',
- focusRing: 'ring-2 ring-form/40 border-transparent'
- },
- CheckboxInput:{
- size: {
- xs: 'w-3 h-3',
- sm: 'w-4 h-4',
- md: 'w-5 h-5',
- lg: 'w-5 h-5'
- },
- },
- SwitchInput:{
- containerSize: {
- xs: 'h-4 w-8',
- sm: 'h-5 w-10',
- md: 'h-6 w-12',
- lg: 'h-6 w-12'
- },
- circleSize: {
- xs: 'h-3 w-3',
- sm: 'h-4 w-4',
- md: 'h-4 w-4',
- lg: 'h-4 w-4'
- },
- translatedClass: {
- xs: 'translate-x-4',
- sm: 'translate-x-5',
- md: 'translate-x-6',
- lg: 'translate-x-6'
- }
- },
- RatingInput:{
- size: {
- xs: 'w-4 h-4',
- sm: 'w-6 h-6',
- md: 'w-8 h-8',
- lg: 'w-10 h-10'
- },
- },
- fileInput: {
- input:
- 'p-4 rounded-xs border border-dashed border-notion-input-border dark:border-notion-input-borderDark bg-notion-input-background dark:bg-notion-dark-light focus:outline-hidden focus:ring-2 focus:ring-form/40 focus:border-transparent',
- minHeight: {
- xs: 'min-h-20',
- sm: 'min-h-28',
- md: 'min-h-40',
- lg: 'min-h-48'
- },
- inputHover: {
- light: 'bg-neutral-50',
- dark: 'bg-notion-dark-light'
- },
- uploadedFile:
- 'border border-notion-input-border dark:border-notion-input-borderDark dark:bg-notion-dark-light rounded-xs max-w-10 focus:outline-hidden focus:ring-2 focus:ring-form/40 focus:border-transparent'
- },
- SignatureInput: {
- minHeight: {
- xs: 'min-h-20',
- sm: 'min-h-28',
- md: 'min-h-40',
- lg: 'min-h-48'
- },
- },
- MatrixInput: {
- table: 'bg-notion-input-background dark:bg-notion-dark-light',
- cell: 'border-notion-input-border dark:border-notion-input-borderDark',
- cellHover: 'hover:backdrop-brightness-95'
- }
- }
-}
diff --git a/client/lib/forms/themes/image-input.theme.js b/client/lib/forms/themes/image-input.theme.js
new file mode 100644
index 000000000..21a12790f
--- /dev/null
+++ b/client/lib/forms/themes/image-input.theme.js
@@ -0,0 +1,52 @@
+/**
+ * ImageInput tailwind-variants configuration
+ */
+export const imageInputTheme = {
+ slots: {
+ button: [
+ 'cursor-pointer relative w-full',
+ 'flex-1 appearance-none w-full',
+ 'focus:outline-hidden'
+ ],
+ help: 'text-neutral-500'
+ },
+ variants: {
+ theme: {
+ default: {
+ button: [
+ 'border border-neutral-300 dark:border-neutral-600',
+ 'bg-white text-neutral-700 dark:bg-notion-dark-light dark:text-neutral-300',
+ 'shadow-xs'
+ ]
+ },
+ notion: {
+ button: [
+ 'border border-notion-input-border dark:border-notion-input-borderDark',
+ 'bg-notion-input-background dark:bg-notion-dark-light',
+ 'text-neutral-900 dark:text-neutral-100'
+ ]
+ }
+ },
+ size: {
+ xs: { button: 'px-2.5 py-1.5 text-xs' },
+ sm: { button: 'px-2 py-1.5 text-sm' },
+ md: { button: 'px-4 py-2 text-base' },
+ lg: { button: 'px-5 py-3 text-lg' }
+ },
+ borderRadius: {
+ none: { button: 'rounded-none' },
+ small: { button: 'rounded-lg' },
+ full: { button: 'rounded-[20px]' }
+ },
+ hasError: {
+ true: { button: 'ring-red-500 ring-2 border-transparent' }
+ }
+ },
+ defaultVariants: {
+ theme: 'default',
+ size: 'md',
+ borderRadius: 'small',
+ hasError: false
+ }
+}
+
diff --git a/client/lib/forms/themes/input-label.theme.js b/client/lib/forms/themes/input-label.theme.js
new file mode 100644
index 000000000..bd4102721
--- /dev/null
+++ b/client/lib/forms/themes/input-label.theme.js
@@ -0,0 +1,26 @@
+/**
+ * InputLabel tailwind-variants configuration
+ * Used for form input labels
+ */
+export const inputLabelTheme = {
+ slots: {
+ label: [
+ 'input-label',
+ 'text-neutral-700 dark:text-neutral-300 font-semibold'
+ ],
+ requiredDot: 'text-red-500 required-dot'
+ },
+ variants: {
+ uppercaseLabels: {
+ true: {
+ label: 'uppercase text-xs'
+ },
+ false: {
+ label: 'text-sm/none'
+ }
+ }
+ },
+ defaultVariants: {
+ uppercaseLabels: false
+ }
+}
\ No newline at end of file
diff --git a/client/lib/forms/themes/input-wrapper.theme.js b/client/lib/forms/themes/input-wrapper.theme.js
new file mode 100644
index 000000000..a79480cfa
--- /dev/null
+++ b/client/lib/forms/themes/input-wrapper.theme.js
@@ -0,0 +1,31 @@
+/**
+ * InputWrapper tailwind-variants configuration
+ * Used for wrapping form inputs with labels, help text, and errors
+ */
+export const inputWrapperTheme = {
+ slots: {
+ wrapper: [
+ 'relative'
+ ],
+ help: 'text-neutral-500'
+ },
+ variants: {
+ size: {
+ xs: {
+ wrapper: 'my-0.5'
+ },
+ sm: {
+ wrapper: 'my-1'
+ },
+ md: {
+ wrapper: 'my-1.5'
+ },
+ lg: {
+ wrapper: 'my-1.5'
+ }
+ }
+ },
+ defaultVariants: {
+ size: 'md'
+ }
+}
\ No newline at end of file
diff --git a/client/lib/forms/themes/matrix-input.theme.js b/client/lib/forms/themes/matrix-input.theme.js
new file mode 100644
index 000000000..0b22923b6
--- /dev/null
+++ b/client/lib/forms/themes/matrix-input.theme.js
@@ -0,0 +1,94 @@
+/**
+ * MatrixInput tailwind-variants configuration
+ */
+export const matrixInputTheme = {
+ slots: {
+ container: 'border overflow-x-auto',
+ cell: '',
+ cellHover: '',
+ option: 'relative cursor-pointer',
+ iconWrapper: 'flex items-center justify-center h-full w-full',
+ headerCell: 'w-full flex items-center justify-center text-neutral-900 dark:text-neutral-100',
+ rowCell: 'w-full text-neutral-900 dark:text-neutral-100'
+ },
+ variants: {
+ theme: {
+ default: {
+ container: [
+ 'border-neutral-300 dark:border-neutral-600',
+ 'bg-white dark:bg-notion-dark-light',
+ 'shadow-xs'
+ ],
+ cell: 'border-neutral-300 dark:border-neutral-600',
+ cellHover: 'hover:bg-neutral-50 dark:hover:bg-neutral-900',
+ option: 'hover:bg-neutral-50 dark:hover:bg-neutral-900 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-form/100 focus-visible:ring-inset'
+ },
+ simple: {
+ container: [
+ 'border-neutral-300 dark:border-neutral-600',
+ 'bg-white dark:bg-notion-dark-light'
+ ],
+ cell: 'border-neutral-300 dark:border-neutral-600',
+ cellHover: 'hover:bg-neutral-50 dark:hover:bg-neutral-900',
+ option: 'hover:bg-neutral-50 dark:hover:bg-neutral-900 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-form/100 focus-visible:ring-inset'
+ },
+ notion: {
+ container: [
+ 'border-notion-input-border dark:border-notion-input-borderDark',
+ 'bg-notion-input-background dark:bg-notion-dark-light'
+ ],
+ cell: 'border-notion-input-border dark:border-notion-input-borderDark',
+ cellHover: 'hover:backdrop-brightness-95',
+ option: 'hover:backdrop-brightness-95 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-form/40 focus-visible:ring-inset'
+ }
+ },
+ size: {
+ xs: {
+ headerCell: 'p-1 text-xs text-neutral-900 dark:text-neutral-100',
+ rowCell: 'p-1 text-xs text-neutral-900 dark:text-neutral-100',
+ option: 'p-1'
+ },
+ sm: {
+ headerCell: 'p-1.5 text-sm text-neutral-900 dark:text-neutral-100',
+ rowCell: 'p-1.5 text-sm text-neutral-900 dark:text-neutral-100',
+ option: 'p-1.5'
+ },
+ md: {
+ headerCell: 'p-2 text-base text-neutral-900 dark:text-neutral-100',
+ rowCell: 'p-2 text-base text-neutral-900 dark:text-neutral-100',
+ option: 'p-2'
+ },
+ lg: {
+ headerCell: 'p-3 text-lg text-neutral-900 dark:text-neutral-100',
+ rowCell: 'p-3 text-lg text-neutral-900 dark:text-neutral-100',
+ option: 'p-3'
+ }
+ },
+ borderRadius: {
+ none: { container: 'rounded-none' },
+ small: { container: 'rounded-lg' },
+ full: { container: 'rounded-[20px]' }
+ },
+ hasError: {
+ true: {
+ container: '!ring-red-500 !ring-2 !border-transparent',
+ cell: '!border-red-500'
+ }
+ },
+ disabled: {
+ true: {
+ container: '!cursor-not-allowed !bg-neutral-200 dark:!bg-neutral-800',
+ cellHover: '!hover:bg-neutral-200 dark:!hover:bg-neutral-800',
+ option: '!cursor-not-allowed !hover:bg-neutral-200 dark:!hover:bg-neutral-800 !focus-visible:ring-0'
+ }
+ }
+ },
+ defaultVariants: {
+ theme: 'default',
+ size: 'md',
+ borderRadius: 'small',
+ hasError: false,
+ disabled: false
+ }
+}
+
diff --git a/client/lib/forms/themes/mention-input.theme.js b/client/lib/forms/themes/mention-input.theme.js
new file mode 100644
index 000000000..c7eac8143
--- /dev/null
+++ b/client/lib/forms/themes/mention-input.theme.js
@@ -0,0 +1,48 @@
+/**
+ * MentionInput tailwind-variants configuration
+ */
+export const mentionInputTheme = {
+ slots: {
+ input: [
+ 'flex-1 appearance-none w-full',
+ 'border',
+ 'focus:outline-hidden',
+ 'pr-12'
+ ]
+ },
+ variants: {
+ theme: {
+ default: {
+ input: 'border-neutral-300 dark:border-neutral-600 bg-white text-neutral-700 dark:bg-notion-dark-light dark:text-neutral-300'
+ },
+ notion: {
+ input: 'border-notion-input-border dark:border-notion-input-borderDark bg-notion-input-background dark:bg-notion-dark-light text-neutral-900 dark:text-neutral-100'
+ }
+ },
+ size: {
+ xs: { input: 'px-2.5 py-1.5 text-xs' },
+ sm: { input: 'px-2 py-1.5 text-sm' },
+ md: { input: 'px-4 py-2 text-base' },
+ lg: { input: 'px-5 py-3 text-lg' }
+ },
+ borderRadius: {
+ none: { input: 'rounded-none' },
+ small: { input: 'rounded-lg' },
+ full: { input: 'rounded-[20px]' }
+ },
+ hasError: {
+ true: { input: '!ring-red-500 !ring-2 !border-transparent' }
+ },
+ disabled: {
+ true: { input: '!cursor-not-allowed !bg-neutral-200 dark:!bg-neutral-800' }
+ }
+ },
+ defaultVariants: {
+ theme: 'default',
+ size: 'md',
+ borderRadius: 'small',
+ hasError: false,
+ disabled: false
+ }
+}
+
diff --git a/client/lib/forms/themes/option-selector-input.theme.js b/client/lib/forms/themes/option-selector-input.theme.js
new file mode 100644
index 000000000..cb08471fe
--- /dev/null
+++ b/client/lib/forms/themes/option-selector-input.theme.js
@@ -0,0 +1,50 @@
+/**
+ * OptionSelectorInput tailwind-variants configuration
+ */
+export const optionSelectorInputTheme = {
+ slots: {
+ option: [
+ 'w-full border transition-colors shadow-xs',
+ 'relative'
+ ],
+ button: [
+ 'flex flex-col items-center justify-center transition-colors',
+ 'text-neutral-500 focus:outline-hidden w-full h-full'
+ ],
+ label: ''
+ },
+ variants: {
+ theme: {
+ default: {
+ option: ['border-neutral-300', 'hover:bg-neutral-100']
+ },
+ notion: {
+ option: ['border-notion-input-border dark:border-notion-input-borderDark', 'hover:backdrop-brightness-95']
+ }
+ },
+ size: {
+ xs: { button: 'p-1', label: 'text-[0.7rem]' },
+ sm: { button: 'p-1.5', label: 'text-xs' },
+ md: { button: 'p-2', label: 'text-sm' },
+ lg: { button: 'p-3', label: 'text-base' }
+ },
+ seamless: {
+ true: { option: ['first:rounded-l-lg last:rounded-r-lg not-first:not-last:rounded-none', 'relative focus-within:z-10'] },
+ false: { option: 'rounded-lg' }
+ },
+ selected: {
+ true: { option: ['bg-form/10', 'border-form', 'relative z-10'] }
+ },
+ disabled: {
+ true: { button: 'opacity-50 pointer-events-none' }
+ }
+ },
+ defaultVariants: {
+ theme: 'default',
+ size: 'sm',
+ seamless: false,
+ selected: false,
+ disabled: false
+ }
+}
+
diff --git a/client/lib/forms/themes/payment-input.theme.js b/client/lib/forms/themes/payment-input.theme.js
new file mode 100644
index 000000000..4eace23c7
--- /dev/null
+++ b/client/lib/forms/themes/payment-input.theme.js
@@ -0,0 +1,60 @@
+/**
+ * PaymentInput tailwind-variants configuration
+ */
+export const paymentInputTheme = {
+ slots: {
+ container: [],
+ amountBar: ['mb-4 flex items-center justify-between']
+ },
+ variants: {
+ theme: {
+ default: {
+ container: [
+ 'border border-neutral-300 dark:border-neutral-600',
+ 'bg-white dark:bg-neutral-900',
+ 'text-neutral-700 dark:text-neutral-200'
+ ],
+ amountBar: [
+ 'border border-neutral-300 dark:border-neutral-600',
+ 'bg-neutral-50 dark:bg-neutral-800'
+ ]
+ },
+ notion: {
+ container: [
+ 'border border-notion-input-border dark:border-notion-input-borderDark',
+ 'bg-notion-input-background dark:bg-notion-dark-light',
+ 'text-neutral-900 dark:text-neutral-100'
+ ],
+ amountBar: [
+ 'border border-notion-input-border dark:border-notion-input-borderDark',
+ 'bg-notion-input-background dark:bg-notion-dark-light'
+ ]
+ }
+ },
+ size: {
+ xs: { container: 'px-2.5 py-1.5 text-xs', amountBar: 'px-2.5 py-1.5 text-xs' },
+ sm: { container: 'px-2 py-1.5 text-sm', amountBar: 'px-2 py-1.5 text-sm' },
+ md: { container: 'px-4 py-2 text-base', amountBar: 'px-4 py-2 text-base' },
+ lg: { container: 'px-5 py-3 text-lg', amountBar: 'px-5 py-3 text-lg' }
+ },
+ borderRadius: {
+ none: { container: 'rounded-none', amountBar: 'rounded-none' },
+ small: { container: 'rounded-lg', amountBar: 'rounded-lg' },
+ full: { container: 'rounded-[20px]', amountBar: 'rounded-[20px]' }
+ },
+ hasError: {
+ true: { container: '!ring-red-500 !ring-2 !border-transparent' }
+ },
+ disabled: {
+ true: { container: '!cursor-not-allowed !bg-neutral-200 dark:!bg-neutral-800' }
+ }
+ },
+ defaultVariants: {
+ theme: 'default',
+ size: 'md',
+ borderRadius: 'small',
+ hasError: false,
+ disabled: false
+ }
+}
+
diff --git a/client/lib/forms/themes/phone-input.theme.js b/client/lib/forms/themes/phone-input.theme.js
new file mode 100644
index 000000000..c60996b07
--- /dev/null
+++ b/client/lib/forms/themes/phone-input.theme.js
@@ -0,0 +1,87 @@
+/**
+ * PhoneInput tailwind-variants configuration
+ */
+export const phoneInputTheme = {
+ slots: {
+ countrySelectWidth: '',
+ selectedMaxHeight: '',
+ flag: '',
+ input: [
+ 'grow',
+ 'border',
+ 'bg-white dark:bg-notion-dark-light',
+ 'text-neutral-700 dark:text-neutral-300',
+ 'focus:outline-hidden',
+ 'placeholder-neutral-400 dark:placeholder-neutral-500'
+ ]
+ },
+ variants: {
+ theme: {
+ default: {
+ input: [
+ 'border-neutral-300 dark:border-neutral-600',
+ 'shadow-xs',
+ 'focus:ring-2 focus:ring-form/100 focus:border-transparent'
+ ]
+ },
+ simple: {
+ input: [
+ 'border-neutral-300 dark:border-neutral-600',
+ 'focus:ring-2 focus:ring-form/100 focus:border-transparent'
+ ]
+ },
+ notion: {
+ input: [
+ 'border-notion-input-border dark:border-notion-input-borderDark',
+ 'bg-notion-input-background dark:bg-notion-dark-light',
+ 'text-neutral-900 dark:text-neutral-100',
+ 'focus:ring-2 focus:ring-form/40 focus:border-transparent'
+ ]
+ }
+ },
+ size: {
+ xs: {
+ input: 'px-2.5 py-1.5 text-xs',
+ countrySelectWidth: 'w-[80px]',
+ selectedMaxHeight: 'max-h-[16px]',
+ flag: '-mt-[16px]!'
+ },
+ sm: {
+ input: 'px-2 py-1.5 text-sm',
+ countrySelectWidth: 'w-[100px]',
+ selectedMaxHeight: 'max-h-[20px]',
+ flag: '-mt-[14px]!'
+ },
+ md: {
+ input: 'px-4 py-2 text-base',
+ countrySelectWidth: 'w-[120px]',
+ selectedMaxHeight: 'max-h-[24px]',
+ flag: '-mt-[9px]! rounded-xs'
+ },
+ lg: {
+ input: 'px-5 py-3 text-lg',
+ countrySelectWidth: 'w-[120px]',
+ selectedMaxHeight: 'max-h-[28px]',
+ flag: '-mt-[9px]! rounded-xs'
+ }
+ },
+ borderRadius: {
+ none: { input: 'rounded-none' },
+ small: { input: 'rounded-lg' },
+ full: { input: 'rounded-[20px]' }
+ },
+ hasError: {
+ true: { input: '!ring-red-500 !ring-2 !border-transparent' }
+ },
+ disabled: {
+ true: { input: '!cursor-not-allowed !bg-neutral-200 dark:!bg-neutral-800' }
+ }
+ },
+ defaultVariants: {
+ theme: 'default',
+ size: 'md',
+ borderRadius: 'small',
+ hasError: false,
+ disabled: false
+ }
+}
diff --git a/client/lib/forms/themes/radio-button-icon.theme.js b/client/lib/forms/themes/radio-button-icon.theme.js
new file mode 100644
index 000000000..5121bae00
--- /dev/null
+++ b/client/lib/forms/themes/radio-button-icon.theme.js
@@ -0,0 +1,51 @@
+/**
+ * RadioButtonIcon tailwind-variants configuration
+ * Used for radio button icons in FlatSelectInput and similar components
+ * Colors match text input border colors for consistency
+ */
+export const radioButtonIconTheme = {
+ slots: {
+ checkedIcon: [
+ 'block',
+ 'text-[var(--form-color,#3B82F6)]'
+ ],
+ uncheckedIcon: [
+ 'block'
+ ]
+ },
+ variants: {
+ theme: {
+ default: {
+ uncheckedIcon: 'text-neutral-300 dark:text-neutral-600'
+ },
+ simple: {
+ uncheckedIcon: 'text-neutral-300 dark:text-neutral-600'
+ },
+ notion: {
+ uncheckedIcon: 'text-notion-input-border dark:text-notion-input-borderDark'
+ }
+ },
+ size: {
+ xs: {
+ checkedIcon: 'w-3 h-3',
+ uncheckedIcon: 'w-3 h-3'
+ },
+ sm: {
+ checkedIcon: 'w-4 h-4',
+ uncheckedIcon: 'w-4 h-4'
+ },
+ md: {
+ checkedIcon: 'w-5 h-5',
+ uncheckedIcon: 'w-5 h-5'
+ },
+ lg: {
+ checkedIcon: 'w-6 h-6 mx-1',
+ uncheckedIcon: 'w-6 h-6 mx-1'
+ }
+ }
+ },
+ defaultVariants: {
+ theme: 'default',
+ size: 'md'
+ }
+}
\ No newline at end of file
diff --git a/client/lib/forms/themes/rating-input.theme.js b/client/lib/forms/themes/rating-input.theme.js
new file mode 100644
index 000000000..90966147c
--- /dev/null
+++ b/client/lib/forms/themes/rating-input.theme.js
@@ -0,0 +1,38 @@
+/**
+ * RatingInput tailwind-variants configuration
+ */
+export const ratingInputTheme = {
+ slots: {
+ icon: '',
+ star: 'cursor-pointer inline-block text-neutral-200 dark:text-neutral-700 focus-visible:ring-2 focus-visible:ring-form/100 focus-visible:rounded-full focus-visible:outline-none'
+ },
+ variants: {
+ size: {
+ xs: { icon: 'w-4 h-4' },
+ sm: { icon: 'w-6 h-6' },
+ md: { icon: 'w-8 h-8' },
+ lg: { icon: 'w-10 h-10' }
+ },
+ disabled: {
+ true: {
+ star: '!cursor-not-allowed'
+ }
+ },
+ isActive: {
+ true: {
+ star: '!text-yellow-400'
+ }
+ },
+ isHover: {
+ true: {
+ star: '!text-yellow-200 !dark:text-yellow-800'
+ }
+ }
+ },
+ defaultVariants: {
+ size: 'md',
+ disabled: false,
+ isActive: false,
+ isHover: false
+ }
+}
\ No newline at end of file
diff --git a/client/lib/forms/themes/rich-text-area-input.theme.js b/client/lib/forms/themes/rich-text-area-input.theme.js
new file mode 100644
index 000000000..645c521fd
--- /dev/null
+++ b/client/lib/forms/themes/rich-text-area-input.theme.js
@@ -0,0 +1,63 @@
+/**
+ * RichTextAreaInput tailwind-variants configuration
+ */
+export const richTextAreaInputTheme = {
+ slots: {
+ container: [
+ 'rich-editor resize-y notranslate relative'
+ ],
+ help: 'text-neutral-500'
+ },
+ variants: {
+ theme: {
+ default: {
+ container: [
+ 'border border-neutral-300 dark:border-neutral-600',
+ 'bg-white text-neutral-700 dark:bg-notion-dark-light dark:text-neutral-300'
+ ]
+ },
+ simple: {
+ container: [
+ 'border border-neutral-300 dark:border-neutral-600',
+ 'bg-white text-neutral-700 dark:bg-notion-dark-light dark:text-neutral-300'
+ ]
+ },
+ notion: {
+ container: [
+ 'border border-notion-input-border dark:border-notion-input-borderDark',
+ 'bg-notion-input-background dark:bg-notion-dark-light',
+ 'text-neutral-900 dark:text-neutral-100'
+ ]
+ }
+ },
+ size: {
+ xs: { container: 'text-xs' },
+ sm: { container: 'text-sm' },
+ md: { container: 'text-base' },
+ lg: { container: 'text-lg' }
+ },
+ borderRadius: {
+ none: { container: 'rounded-none' },
+ small: { container: 'rounded-lg' },
+ full: { container: 'rounded-[20px]' }
+ },
+ hasError: {
+ true: { container: '!ring-red-500 !ring-2 !border-transparent' }
+ },
+ disabled: {
+ true: { container: '!cursor-not-allowed !bg-neutral-200 dark:!bg-neutral-800' }
+ },
+ focused: {
+ true: { container: 'focus-within:ring-2 focus-within:ring-form/100 focus-within:border-transparent' }
+ }
+ },
+ defaultVariants: {
+ theme: 'default',
+ size: 'md',
+ borderRadius: 'small',
+ hasError: false,
+ disabled: false,
+ focused: false
+ }
+}
+
diff --git a/client/lib/forms/themes/scale-input.theme.js b/client/lib/forms/themes/scale-input.theme.js
new file mode 100644
index 000000000..a4218fd9d
--- /dev/null
+++ b/client/lib/forms/themes/scale-input.theme.js
@@ -0,0 +1,76 @@
+/**
+ * ScaleInput tailwind-variants configuration
+ */
+export const scaleInputTheme = {
+ slots: {
+ button: [
+ 'cursor-pointer inline-block grow text-center border',
+ 'text-neutral-700 dark:text-neutral-300'
+ ],
+ buttonUnselected: [
+ 'bg-white dark:bg-notion-dark-light'
+ ],
+ buttonHover: ''
+ },
+ variants: {
+ theme: {
+ default: {
+ button: [
+ 'border-neutral-300 dark:border-neutral-600'
+ ],
+ buttonUnselected: [
+ 'bg-white dark:bg-notion-dark-light'
+ ],
+ buttonHover: 'hover:bg-neutral-50 dark:hover:bg-neutral-900'
+ },
+ simple: {
+ button: [
+ 'border-neutral-300 dark:border-neutral-600'
+ ],
+ buttonUnselected: [
+ 'bg-white dark:bg-notion-dark-light'
+ ],
+ buttonHover: 'hover:bg-neutral-50 dark:hover:bg-neutral-900'
+ },
+ notion: {
+ button: [
+ 'border-notion-input-border dark:border-notion-input-borderDark',
+ 'text-neutral-900 dark:text-neutral-100'
+ ],
+ buttonUnselected: [
+ 'bg-notion-input-background dark:bg-notion-dark-light'
+ ],
+ buttonHover: 'hover:brightness-95'
+ }
+ },
+ size: {
+ xs: { button: 'py-1 text-xs' },
+ sm: { button: 'py-1.5 text-sm' },
+ md: { button: 'py-2 text-base' },
+ lg: { button: 'py-3 text-lg' }
+ },
+ borderRadius: {
+ none: { button: 'rounded-none' },
+ small: { button: 'rounded-lg' },
+ full: { button: 'rounded-[20px]' }
+ },
+ hasError: {
+ true: {
+ button: '!border-red-500'
+ }
+ },
+ disabled: {
+ true: {
+ button: '!cursor-not-allowed !bg-neutral-200 dark:!bg-neutral-800',
+ buttonUnselected: '!bg-neutral-200 dark:!bg-neutral-800'
+ }
+ }
+ },
+ defaultVariants: {
+ theme: 'default',
+ size: 'md',
+ borderRadius: 'small',
+ hasError: false,
+ disabled: false
+ }
+}
diff --git a/client/lib/forms/themes/select-input.theme.js b/client/lib/forms/themes/select-input.theme.js
new file mode 100644
index 000000000..708778c2a
--- /dev/null
+++ b/client/lib/forms/themes/select-input.theme.js
@@ -0,0 +1,22 @@
+/**
+ * SelectInput tailwind-variants configuration
+ * Handles text sizing for selected values and options plus help text styling
+ */
+export const selectInputTheme = {
+ slots: {
+ selected: '',
+ option: '',
+ help: 'text-neutral-500'
+ },
+ variants: {
+ size: {
+ xs: { selected: 'text-xs', option: 'text-xs' },
+ sm: { selected: 'text-sm', option: 'text-sm' },
+ md: { selected: 'text-base', option: 'text-base' },
+ lg: { selected: 'text-lg', option: 'text-lg' }
+ }
+ },
+ defaultVariants: {
+ size: 'md'
+ }
+}
diff --git a/client/lib/forms/themes/signature-input.theme.js b/client/lib/forms/themes/signature-input.theme.js
new file mode 100644
index 000000000..a1842f1bc
--- /dev/null
+++ b/client/lib/forms/themes/signature-input.theme.js
@@ -0,0 +1,60 @@
+/**
+ * SignatureInput tailwind-variants configuration
+ */
+export const signatureInputTheme = {
+ slots: {
+ container: [
+ 'flex flex-wrap items-center justify-center gap-4',
+ 'focus:outline-hidden'
+ ],
+ help: 'text-neutral-500'
+ },
+ variants: {
+ theme: {
+ default: {
+ container: [
+ 'border border-neutral-300 dark:border-neutral-600',
+ 'bg-white text-neutral-700 dark:bg-notion-dark-light dark:text-neutral-300'
+ ]
+ },
+ simple: {
+ container: [
+ 'border border-neutral-300 dark:border-neutral-600',
+ 'bg-white text-neutral-700 dark:bg-notion-dark-light dark:text-neutral-300'
+ ]
+ },
+ notion: {
+ container: [
+ 'border border-notion-input-border dark:border-notion-input-borderDark',
+ 'bg-notion-input-background dark:bg-notion-dark-light',
+ 'text-neutral-900 dark:text-neutral-100'
+ ]
+ }
+ },
+ size: {
+ xs: { container: 'px-2.5 py-1.5 text-xs' },
+ sm: { container: 'px-2 py-1.5 text-sm' },
+ md: { container: 'px-4 py-2 text-base' },
+ lg: { container: 'px-5 py-3 text-lg' }
+ },
+ borderRadius: {
+ none: { container: 'rounded-none' },
+ small: { container: 'rounded-lg' },
+ full: { container: 'rounded-[20px]' }
+ },
+ hasError: {
+ true: { container: '!ring-red-500 !ring-2 !border-transparent' }
+ },
+ disabled: {
+ true: { container: '!cursor-not-allowed !bg-neutral-200 dark:!bg-neutral-800' }
+ }
+ },
+ defaultVariants: {
+ theme: 'default',
+ size: 'md',
+ borderRadius: 'small',
+ hasError: false,
+ disabled: false
+ }
+}
+
diff --git a/client/lib/forms/themes/slider-input.theme.js b/client/lib/forms/themes/slider-input.theme.js
new file mode 100644
index 000000000..d3d3ba1ce
--- /dev/null
+++ b/client/lib/forms/themes/slider-input.theme.js
@@ -0,0 +1,39 @@
+/**
+ * SliderInput tailwind-variants configuration
+ */
+export const sliderInputTheme = {
+ slots: {
+ stepLabel: 'text-neutral-700 dark:text-neutral-300 text-center',
+ slider: 'w-full mt-3 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2'
+ },
+ variants: {
+ theme: {
+ default: {
+ slider: 'focus-visible:ring-form/100'
+ },
+ simple: {
+ slider: 'focus-visible:ring-form/100'
+ },
+ notion: {
+ slider: 'focus-visible:ring-form/40'
+ }
+ },
+ size: {
+ xs: { stepLabel: 'text-xs' },
+ sm: { stepLabel: 'text-sm' },
+ md: { stepLabel: 'text-base' },
+ lg: { stepLabel: 'text-lg' }
+ },
+ disabled: {
+ true: {
+ slider: '!cursor-not-allowed !opacity-50 !focus-visible:ring-0'
+ }
+ }
+ },
+ // Legacy theme used text-xs; keep default aligned
+ defaultVariants: {
+ theme: 'default',
+ size: 'xs',
+ disabled: false
+ }
+}
diff --git a/client/lib/forms/themes/text-area-input.theme.js b/client/lib/forms/themes/text-area-input.theme.js
new file mode 100644
index 000000000..6afd7494e
--- /dev/null
+++ b/client/lib/forms/themes/text-area-input.theme.js
@@ -0,0 +1,68 @@
+/**
+ * TextAreaInput tailwind-variants configuration
+ */
+export const textAreaInputTheme = {
+ slots: {
+ input: [
+ 'flex-1 appearance-none w-full',
+ 'border',
+ 'bg-white dark:bg-notion-dark-light',
+ 'text-neutral-700 dark:text-neutral-300',
+ 'placeholder-neutral-400 dark:placeholder-neutral-500',
+ 'focus:outline-hidden',
+ 'disabled:cursor-not-allowed disabled:opacity-75',
+ 'resize-y block'
+ ],
+ help: 'text-neutral-500'
+ },
+ variants: {
+ theme: {
+ default: {
+ input: [
+ 'border-neutral-300 dark:border-neutral-600',
+ 'shadow-xs',
+ 'focus:ring-2 focus:ring-form/100 focus:border-transparent'
+ ]
+ },
+ simple: {
+ input: [
+ 'border-neutral-300 dark:border-neutral-600',
+ 'focus:ring-2 focus:ring-form/100 focus:border-transparent'
+ ]
+ },
+ notion: {
+ input: [
+ 'border-notion-input-border dark:border-notion-input-borderDark',
+ 'bg-notion-input-background dark:bg-notion-dark-light',
+ 'text-neutral-900 dark:text-neutral-100',
+ 'focus:ring-2 focus:ring-form/40 focus:border-transparent'
+ ]
+ }
+ },
+ size: {
+ xs: { input: 'px-2.5 py-1.5 text-xs' },
+ sm: { input: 'px-2 py-1.5 text-sm' },
+ md: { input: 'px-4 py-2 text-base' },
+ lg: { input: 'px-5 py-3 text-lg' }
+ },
+ borderRadius: {
+ none: { input: 'rounded-none' },
+ small: { input: 'rounded-lg' },
+ full: { input: 'rounded-[20px]' }
+ },
+ hasError: {
+ true: { input: '!ring-red-500 !ring-2 !border-transparent' }
+ },
+ disabled: {
+ true: { input: '!cursor-not-allowed !bg-neutral-200 dark:!bg-neutral-800' }
+ }
+ },
+ defaultVariants: {
+ theme: 'default',
+ size: 'md',
+ borderRadius: 'small',
+ hasError: false,
+ disabled: false
+ }
+}
+
diff --git a/client/lib/forms/themes/text-block.theme.js b/client/lib/forms/themes/text-block.theme.js
new file mode 100644
index 000000000..814c50986
--- /dev/null
+++ b/client/lib/forms/themes/text-block.theme.js
@@ -0,0 +1,20 @@
+/**
+ * TextBlock tailwind-variants configuration
+ */
+export const textBlockTheme = {
+ slots: {
+ root: 'break-words whitespace-break-spaces'
+ },
+ variants: {
+ size: {
+ xs: { root: 'text-xs' },
+ sm: { root: 'text-sm' },
+ md: { root: 'text-base' },
+ lg: { root: 'text-lg' }
+ }
+ },
+ defaultVariants: {
+ size: 'md'
+ }
+}
+
diff --git a/client/lib/forms/themes/text-input.theme.js b/client/lib/forms/themes/text-input.theme.js
new file mode 100644
index 000000000..a52423561
--- /dev/null
+++ b/client/lib/forms/themes/text-input.theme.js
@@ -0,0 +1,86 @@
+/**
+ * TextInput tailwind-variants configuration
+ * Proper TV structure: base classes + variant overrides (following Nuxt UI pattern)
+ */
+export const textInputTheme = {
+ slots: {
+ input: [
+ // Base classes applied to all variants
+ 'flex-1 appearance-none w-full',
+ 'border',
+ 'bg-white dark:bg-notion-dark-light',
+ 'text-neutral-700 dark:text-neutral-300',
+ 'placeholder-neutral-400 dark:placeholder-neutral-500',
+ 'focus:outline-hidden',
+ 'disabled:cursor-not-allowed disabled:opacity-75'
+ ],
+ help: 'text-neutral-500'
+ },
+ variants: {
+ theme: {
+ default: {
+ input: [
+ 'border-neutral-300 dark:border-neutral-600',
+ 'shadow-xs',
+ 'focus:ring-2 focus:ring-form/100 focus:border-transparent'
+ ]
+ },
+ simple: {
+ input: [
+ 'border-neutral-300 dark:border-neutral-600',
+ 'focus:ring-2 focus:ring-form/100 focus:border-transparent'
+ ]
+ },
+ notion: {
+ input: [
+ 'border-notion-input-border dark:border-notion-input-borderDark',
+ 'bg-notion-input-background dark:bg-notion-dark-light',
+ 'text-neutral-900 dark:text-neutral-100',
+ 'focus:ring-2 focus:ring-form/40 focus:border-transparent'
+ ]
+ }
+ },
+ size: {
+ xs: {
+ input: 'px-2.5 py-1.5 text-xs'
+ },
+ sm: {
+ input: 'px-2 py-1.5 text-sm'
+ },
+ md: {
+ input: 'px-4 py-2 text-base'
+ },
+ lg: {
+ input: 'px-5 py-3 text-lg'
+ }
+ },
+ borderRadius: {
+ none: {
+ input: 'rounded-none'
+ },
+ small: {
+ input: 'rounded-lg'
+ },
+ full: {
+ input: 'rounded-[20px]'
+ }
+ },
+ hasError: {
+ true: {
+ input: '!ring-red-500 !ring-2 !border-transparent'
+ }
+ },
+ disabled: {
+ true: {
+ input: '!cursor-not-allowed !bg-neutral-200 dark:!bg-neutral-800'
+ }
+ }
+ },
+ defaultVariants: {
+ theme: 'default',
+ size: 'md',
+ borderRadius: 'small',
+ hasError: false,
+ disabled: false
+ }
+}
diff --git a/client/lib/forms/themes/toggle-switch-input.theme.js b/client/lib/forms/themes/toggle-switch-input.theme.js
new file mode 100644
index 000000000..8d0060d87
--- /dev/null
+++ b/client/lib/forms/themes/toggle-switch-input.theme.js
@@ -0,0 +1,21 @@
+/**
+ * ToggleSwitchInput tailwind-variants configuration
+ */
+export const toggleSwitchInputTheme = {
+ slots: {
+ label: '',
+ help: 'text-neutral-500'
+ },
+ variants: {
+ size: {
+ xs: { label: 'text-xs' },
+ sm: { label: 'text-sm' },
+ md: { label: 'text-base' },
+ lg: { label: 'text-lg' }
+ }
+ },
+ defaultVariants: {
+ size: 'md'
+ }
+}
+
diff --git a/client/lib/forms/themes/uploaded-file.theme.js b/client/lib/forms/themes/uploaded-file.theme.js
new file mode 100644
index 000000000..88c674031
--- /dev/null
+++ b/client/lib/forms/themes/uploaded-file.theme.js
@@ -0,0 +1,18 @@
+/**
+ * UploadedFile tailwind-variants configuration
+ */
+export const uploadedFileTheme = {
+ slots: {
+ root: 'border rounded-lg shadow-xs max-w-10'
+ },
+ variants: {
+ theme: {
+ default: { root: 'border-neutral-300 dark:border-neutral-600 dark:bg-notion-dark-light' },
+ notion: { root: 'border-notion-input-border dark:border-notion-input-borderDark dark:bg-notion-dark-light rounded-xs' }
+ }
+ },
+ defaultVariants: {
+ theme: 'default'
+ }
+}
+
diff --git a/client/lib/forms/themes/v-checkbox.theme.js b/client/lib/forms/themes/v-checkbox.theme.js
new file mode 100644
index 000000000..58e70ce7a
--- /dev/null
+++ b/client/lib/forms/themes/v-checkbox.theme.js
@@ -0,0 +1,46 @@
+/**
+ * VCheckbox tailwind-variants configuration
+ * Used for checkbox input components
+ */
+export const vCheckboxTheme = {
+ slots: {
+ container: 'flex items-center',
+ input: [
+ 'rounded border-neutral-500 checkbox',
+ 'size-5', // Default size, overridden by variants
+ 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-form/100 focus-visible:border-transparent'
+ ],
+ label: [
+ 'text-neutral-700 dark:text-neutral-300 ml-2'
+ ]
+ },
+ variants: {
+ size: {
+ xs: {
+ input: 'size-3'
+ },
+ sm: {
+ input: 'size-4'
+ },
+ md: {
+ input: 'size-5'
+ },
+ lg: {
+ input: 'size-6'
+ }
+ },
+ disabled: {
+ true: {
+ input: '!cursor-not-allowed',
+ label: '!cursor-not-allowed'
+ },
+ false: {
+ input: 'cursor-pointer'
+ }
+ }
+ },
+ defaultVariants: {
+ size: 'md',
+ disabled: false
+ }
+}
\ No newline at end of file
diff --git a/client/lib/forms/themes/v-select.theme.js b/client/lib/forms/themes/v-select.theme.js
new file mode 100644
index 000000000..89e0f05b9
--- /dev/null
+++ b/client/lib/forms/themes/v-select.theme.js
@@ -0,0 +1,171 @@
+/**
+ * VSelect tailwind-variants configuration
+ * Used for select dropdown components
+ */
+export const vSelectTheme = {
+ slots: {
+ container: 'v-select relative',
+ anchor: 'w-full flex overflow-hidden',
+ button: [
+ 'cursor-pointer w-full grow relative focus:outline-hidden min-w-0 truncate'
+ ],
+ buttonInner: [
+ 'flex items-center',
+ 'ltr:pr-8 rtl:pl-8'
+ ],
+ placeholder: [
+ 'text-neutral-400 dark:text-neutral-500 w-full ltr:text-left rtl:text-right! truncate ltr:pr-3 rtl:pl-3 rtl:pr-0!'
+ ],
+ chevronGradient: 'absolute inset-y-0 ltr:right-6 rtl:left-6 w-10 pointer-events-none -z-1',
+ chevronContainer: [
+ 'absolute inset-y-0 ltr:right-0 rtl:left-0 rtl:right-auto!',
+ 'flex items-center ltr:pr-2 rtl:pl-2 rtl:pr-0! pointer-events-none'
+ ],
+ chevronIcon: 'h-5 w-5 text-neutral-500',
+ clearButton: [
+ 'hover:bg-neutral-50 dark:hover:bg-neutral-900',
+ 'ltr:border-l rtl:border-l-0! rtl:border-r px-2 flex items-center shrink-0'
+ ],
+ clearIcon: 'w-5 h-5 text-neutral-500',
+ dropdown: [
+ 'leading-6 shadow-xs overflow-auto focus:outline-hidden sm:text-sm sm:leading-5 relative'
+ ],
+ searchContainer: [
+ 'sticky top-0 z-10 flex border-b bg-white dark:!bg-notion-dark-light'
+ ],
+ searchInput: [
+ 'grow ltr:pl-3 ltr:pr-7 rtl:pr-3! rtl:pl-7 py-2 w-full focus:outline-hidden dark:text-white'
+ ],
+ searchIconContainer: [
+ 'flex absolute ltr:right-0 rtl:left-0 rtl:right-auto! inset-y-0 items-center px-2 justify-center pointer-events-none'
+ ],
+ searchClearContainer: [
+ 'flex absolute ltr:right-0 rtl:right-auto! rtl:left-0 inset-y-0 items-center px-2 justify-center'
+ ],
+ searchIcon: 'h-5 w-5 text-neutral-500 dark:text-neutral-400',
+ searchClearIcon: 'h-5 w-5 rtl:rotate-180 text-neutral-500 dark:text-neutral-400',
+ optionsContainer: 'p-1',
+ option: [
+ 'text-neutral-900 dark:text-neutral-50 select-none relative group rounded-sm focus:outline-hidden'
+ ],
+ createOption: [
+ 'text-neutral-900 select-none relative py-2 cursor-pointer group hover:bg-neutral-100 dark:hover:bg-neutral-900 rounded-sm focus:outline-hidden'
+ ],
+ emptyMessage: 'w-full text-neutral-500 text-center py-2',
+ createLabel: 'px-2 bg-neutral-100 border border-neutral-300 rounded-sm group-hover:text-black'
+ },
+ variants: {
+ theme: {
+ default: {
+ anchor: [
+ 'border border-neutral-300 dark:border-neutral-600',
+ 'bg-white dark:bg-notion-dark-light',
+ 'shadow-xs'
+ ],
+ chevronGradient: 'bg-gradient-to-r from-transparent to-white dark:to-notion-dark-light',
+ chevronContainer: 'bg-white dark:bg-notion-dark-light'
+ },
+ simple: {
+ anchor: [
+ 'border border-neutral-300 dark:border-neutral-600',
+ 'bg-white dark:bg-notion-dark-light'
+ ],
+ chevronGradient: 'bg-gradient-to-r from-transparent to-white dark:to-notion-dark-light',
+ chevronContainer: 'bg-white dark:bg-notion-dark-light'
+ },
+ notion: {
+ anchor: [
+ 'border border-notion-input-border dark:border-notion-input-borderDark',
+ 'bg-notion-input-background dark:bg-notion-dark-light'
+ ],
+ chevronGradient: 'bg-gradient-to-r from-transparent to-notion-input-background dark:to-notion-dark-light',
+ chevronContainer: 'bg-notion-input-background dark:bg-notion-dark-light'
+ }
+ },
+ size: {
+ xs: {
+ button: 'px-2.5 py-1.5',
+ buttonInner: 'min-h-[16px]',
+ placeholder: 'text-xs',
+ clearButton: 'py-1.5',
+ dropdown: 'text-xs',
+ option: 'px-2.5 py-1.5'
+ },
+ sm: {
+ button: 'px-2 py-1.5',
+ buttonInner: 'min-h-[20px]',
+ placeholder: 'text-sm',
+ clearButton: 'py-1.5',
+ dropdown: 'text-sm',
+ option: 'px-2 py-1.5'
+ },
+ md: {
+ button: 'px-4 py-2',
+ buttonInner: 'min-h-[24px]',
+ placeholder: 'text-base',
+ clearButton: 'py-2',
+ dropdown: 'text-base',
+ option: 'px-4 py-2'
+ },
+ lg: {
+ button: 'px-5 py-3',
+ buttonInner: 'min-h-[28px]',
+ placeholder: 'text-lg',
+ clearButton: 'py-3',
+ dropdown: 'text-lg',
+ option: 'px-5 py-3'
+ }
+ },
+ borderRadius: {
+ none: {
+ anchor: 'rounded-none'
+ },
+ small: {
+ anchor: 'rounded-lg'
+ },
+ full: {
+ anchor: 'rounded-[20px]'
+ }
+ },
+ hasError: {
+ true: {
+ anchor: '!ring-red-500 !ring-2 !border-transparent'
+ }
+ },
+ disabled: {
+ true: {
+ anchor: '!cursor-not-allowed !bg-neutral-200 dark:!bg-neutral-800',
+ chevronGradient: '!bg-gradient-to-r !from-transparent !to-neutral-200 dark:!to-neutral-800',
+ chevronContainer: '!bg-neutral-200 dark:!bg-neutral-800'
+ }
+ },
+ focused: {
+ true: {
+ anchor: 'focus-within:ring-2 focus-within:ring-form/100 focus-within:border-transparent'
+ }
+ },
+ multiple: {
+ true: {
+ container: 'w-0 min-w-full'
+ }
+ },
+ searchable: {
+ true: {
+ dropdown: 'max-h-48'
+ },
+ false: {
+ dropdown: 'max-h-42'
+ }
+ }
+ },
+ defaultVariants: {
+ theme: 'default',
+ size: 'md',
+ borderRadius: 'small',
+ hasError: false,
+ disabled: false,
+ focused: false,
+ multiple: false,
+ searchable: false
+ }
+}
\ No newline at end of file
diff --git a/client/lib/quill/quillPatches.js b/client/lib/quill/quillPatches.js
index 97264656c..6d2b6e7de 100644
--- a/client/lib/quill/quillPatches.js
+++ b/client/lib/quill/quillPatches.js
@@ -45,6 +45,18 @@ import Quill from 'quill'
Clipboard.DEFAULTS.matchers.push([Node.TEXT_NODE, matcher])
}
+
+ // ---------------------------------------------------------------------------
+ // Tab key accessibility fix: allow Tab to navigate out of editor
+ // ---------------------------------------------------------------------------
+
+ const Keyboard = Quill.import('modules/keyboard')
+
+ // Override Tab key behavior to allow navigation instead of inserting tabs
+ Keyboard.DEFAULTS.bindings.tab = {
+ key: 'Tab',
+ handler: () => true // Return true to let browser handle Tab navigation
+ }
})()
export default {}
\ No newline at end of file
diff --git a/client/mixins/forms/input.js b/client/mixins/forms/input.js
deleted file mode 100644
index 10f5f63b1..000000000
--- a/client/mixins/forms/input.js
+++ /dev/null
@@ -1,77 +0,0 @@
-import CachedDefaultTheme from "~/lib/forms/themes/CachedDefaultTheme.js"
-import { default as _has } from "lodash/has"
-
-export default {
- props: {
- id: { type: String, default: null },
- name: { type: String, required: true },
- label: { type: String, required: false },
- form: { type: Object, required: false },
- value: { required: false },
- required: { type: Boolean, default: false },
- disabled: { type: Boolean, default: false },
- placeholder: { type: String, default: null },
- uppercaseLabels: { type: Boolean, default: false },
- help: { type: String, default: null },
- helpPosition: { type: String, default: "below_input" },
- theme: {
- type: Object, default: () => {
- const theme = inject("theme", null)
- if (theme) {
- return theme.value
- }
- return CachedDefaultTheme.getInstance()
- }
- },
- color: { type: String, default: "#3B82F6" },
- wrapperClass: { type: String, default: "relative mb-3" },
- },
-
- data() {
- return {
- content: this.value,
- }
- },
-
- computed: {
- inputStyle() {
- return {
- "--tw-ring-color": this.color,
- }
- },
- hasValidation() {
- return (
- this.form !== null &&
- this.form !== undefined &&
- _has(this.form, "errors")
- )
- },
- compVal: {
- set(val) {
- if (this.form) {
- this.form[this.name] = val
- } else {
- this.content = val
- }
- if (this.hasValidation) {
- this.form.errors.clear(this.name)
- }
- this.$emit("input", this.compVal)
- },
- get() {
- if (this.form) {
- return this.form[this.name]
- }
- return this.content
- },
- },
- },
-
- watch: {
- value(val) {
- if (val !== this.compVal) {
- this.compVal = val
- }
- },
- },
-}