From fa5bc737f7c30ac64e95d6c98e8aba3ec9e5be26 Mon Sep 17 00:00:00 2001 From: Anton Date: Wed, 26 Feb 2025 11:29:54 +0100 Subject: [PATCH] Add new input component [SCI-11598] --- .../packs/vue/design_system/inputs.js | 19 +++ app/javascript/vue/shared/input_field.vue | 109 ++++++++++++++++++ app/views/design_elements/_inputs.html.erb | 16 +++ app/views/design_elements/index.html.erb | 2 + config/webpack/webpack.config.js | 3 +- 5 files changed, 148 insertions(+), 1 deletion(-) create mode 100644 app/javascript/packs/vue/design_system/inputs.js create mode 100644 app/javascript/vue/shared/input_field.vue create mode 100644 app/views/design_elements/_inputs.html.erb diff --git a/app/javascript/packs/vue/design_system/inputs.js b/app/javascript/packs/vue/design_system/inputs.js new file mode 100644 index 000000000..bbea07e6d --- /dev/null +++ b/app/javascript/packs/vue/design_system/inputs.js @@ -0,0 +1,19 @@ +import { createApp } from 'vue/dist/vue.esm-bundler.js'; +import InputField from '../../../vue/shared/input_field.vue'; +import { mountWithTurbolinks } from '../helpers/turbolinks.js'; + +const app = createApp({ + data() { + return { + testValue: '' + }; + }, + watch: { + testValue(value) { + console.log(value); + } + } +}); +app.component('InputField', InputField); +app.config.globalProperties.i18n = window.I18n; +mountWithTurbolinks(app, '#inputs'); diff --git a/app/javascript/vue/shared/input_field.vue b/app/javascript/vue/shared/input_field.vue new file mode 100644 index 000000000..5bf565fd7 --- /dev/null +++ b/app/javascript/vue/shared/input_field.vue @@ -0,0 +1,109 @@ + + + diff --git a/app/views/design_elements/_inputs.html.erb b/app/views/design_elements/_inputs.html.erb new file mode 100644 index 000000000..475665ccf --- /dev/null +++ b/app/views/design_elements/_inputs.html.erb @@ -0,0 +1,16 @@ +

Input Field

+
+ + + + + + + + + + + +
+ +<%= javascript_include_tag 'vue_design_system_inputs' %> diff --git a/app/views/design_elements/index.html.erb b/app/views/design_elements/index.html.erb index 5f9585a19..44ede7e38 100644 --- a/app/views/design_elements/index.html.erb +++ b/app/views/design_elements/index.html.erb @@ -12,6 +12,8 @@ <%= render partial: 'radio' %> +<%= render partial: 'inputs', locals: {icons_list: icons_list} %> + <%= render partial: 'select' %> <%= render partial: 'breadcrumbs' %> diff --git a/config/webpack/webpack.config.js b/config/webpack/webpack.config.js index 58b8ef2d6..e1b785228 100644 --- a/config/webpack/webpack.config.js +++ b/config/webpack/webpack.config.js @@ -71,7 +71,8 @@ const entryList = { vue_storage_locations_container: './app/javascript/packs/vue/storage_locations_container.js', vue_form_show: './app/javascript/packs/vue/forms_show.js', vue_form_table: './app/javascript/packs/vue/forms_table.js', - vue_my_module_assigned_items: './app/javascript/packs/vue/my_module_assigned_items.js' + vue_my_module_assigned_items: './app/javascript/packs/vue/my_module_assigned_items.js', + vue_design_system_inputs: './app/javascript/packs/vue/design_system/inputs.js' }; // Engine pack loading based on https://github.com/rails/webpacker/issues/348#issuecomment-635480949