-
-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat/forms #26
Feat/forms #26
Conversation
Add basic support for the following DaisyUI components:
Reconsider component placementPresently the new form components live at I've been exclusively using them within the FormWrapper component and the new Form layout. If we intend to make them individually usable from within markdown content, this should be documented. If not, they should be moved out of the |
Notes on potential relocation/renaming: Despite being located in the If we change this (and we might), it should still remain possible to use the shorthand we've already been using in the YAML template, meaning the dynamic component loading needs a minor adjustment. I believe it would be preferable, particularly in markdown files, to access them via some name like |
The combobox also isn't presently as customisable as I would like. See the example it's modelled after and aiming to be a replacement for on The Definitive Edition: https://github.com/thombruce/TheDefinitiveEdition/blob/main/components/content/SimpleSearchBar.vue We could make it possible to pass whatever component or template script a person would want to the This may be left as an experiment for another PR. |
All form components should also support binding to a Vue object. Still Todo
I'm certain I would like these to be usable from content files, so |
Directory changed to It is worth considering whether tnt-forms deserves to be a separate library. I think long-term it certainly does - not every site will use the form components, they are potentially just bloat in many, many cases. This raises further questions about separation of, say, For the time being, I am happy to contain all components, layouts and utilities within the one core space. But this is worthwhile to consider for the future. |
Here's the basic code for binding a component to <script>
export default {
props: ['modelValue'],
emits: ['update:modelValue']
}
</script>
<template>
<input
:value="modelValue"
@input="$emit('update:modelValue', $event.target.value)"
/>
</template> The present usage does not pass any values to the new form components - wait, no, that isn't a true; a few do... but most don't - so they're already open to having this adaptation implemented. |
I'm discovering that usage from within a content markdown file may require a different naming convention. :input{type="text" name="fields[name]" label="Name" labelAlt="?" hint="This is how your name will be displayed" hintAlt="e.g. Clark Kent" placeholder="What do people call you?"} ...uses the native :tnt-input{type="text" name="fields[name]" label="Name" labelAlt="?" hint="This is how your name will be displayed" hintAlt="e.g. Clark Kent" placeholder="What do people call you?"} ...uses the I guess the idea of enhanced native components is an unworkable one. There are places it would work... For instance, it has been working as a dynamic component, and will work when called with capitalisation from Option 1 Rename all components Option 2 Create a secondary group of components, exclusively for This would mean moving the existing component set into the I'm not sure which way I'm going to go on this. Option 1 has less bloat and more consistency. Option 2 has the nicety of being able to use the components pretty much as if they were native elements (at least outside of |
The v-model binding documented above probably varies for things like radios and checkboxes. Maybe something like this: <input
v-model="modelValue"
:value="option.value || option"
@input="$emit('update:modelValue', $event.target.value)"
type="radio"
:name="name"
class="radio"
/> Note the additional use of
|
closes #25
By submitting this pull request, you agree to follow our Code of Conduct: https://github.com/thombruce/.github/blob/main/CODE_OF_CONDUCT.md
Internal use. Do not delete.