diff --git a/assets/js/formkit-custom.js b/assets/js/formkit-custom.js index 93cdfb7..18c06fd 100644 --- a/assets/js/formkit-custom.js +++ b/assets/js/formkit-custom.js @@ -2,6 +2,7 @@ import { createInput } from "@formkit/vue"; import OneTimePassword from "~/components/formkit/OneTimePassword.vue"; import MaskText from "~/components/formkit/TextMask.vue"; import FileDropzone from "~/components/formkit/FileDropzone.vue"; +import Switch from "~/components/formkit/Switch.vue"; export default { otp: createInput(OneTimePassword, { @@ -13,4 +14,7 @@ export default { dropzone: createInput(FileDropzone, { props: ["accept", "multiple", "maxSize", "minSize", "maxFiles", "disabled"], }), + switch: createInput(Switch, { + props: ["value"], + }), }; diff --git a/assets/js/formkit-theme.js b/assets/js/formkit-theme.js index dd57e22..f664a52 100644 --- a/assets/js/formkit-theme.js +++ b/assets/js/formkit-theme.js @@ -29,6 +29,13 @@ const OtpClassification = { message: "formkit-message-otp", }; +const switchClassification = { + label: "formkit-label-switch", + inner: "formkit-inner-switch", + input: "formkit-input-switch", + message: "formkit-message-switch", +}; + const colorClassification = { label: "formkit-label-color", input: "formkit-input-color", @@ -86,6 +93,7 @@ export default { week: textClassification, otp: OtpClassification, mask: textClassification, + switch: switchClassification, dropzone: { ...textClassification, inner: "formkit-inner-dropzone", diff --git a/assets/style/css/form/switch.css b/assets/style/css/form/switch.css new file mode 100644 index 0000000..69b5eb8 --- /dev/null +++ b/assets/style/css/form/switch.css @@ -0,0 +1,15 @@ +.formkit-label-switch { + @apply block mb-2 font-semibold text-sm formkit-invalid:text-red-500 dark:formkit-invalid:text-danger; +} + +.formkit-inner-switch { + @apply flex items-center justify-between w-full; +} + +.formkit-input-switch { + @apply sr-only; +} + +.formkit-message-switch { + @apply formkit-invalid:text-red-500 dark:formkit-invalid:text-danger; +} \ No newline at end of file diff --git a/components/ComponentPreview.vue b/components/ComponentPreview.vue index 1252adf..8503ff0 100644 --- a/components/ComponentPreview.vue +++ b/components/ComponentPreview.vue @@ -5,9 +5,30 @@ :data-name="component.props.name" :data-type="component.type" > + +
{{ template.description }}
+ +No templates found
+Try selecting a different category
+