diff --git a/app/assets/stylesheets/shared_styles/constants/fonts.scss b/app/assets/stylesheets/shared_styles/constants/fonts.scss index 10b034128..e59c450e1 100644 --- a/app/assets/stylesheets/shared_styles/constants/fonts.scss +++ b/app/assets/stylesheets/shared_styles/constants/fonts.scss @@ -51,6 +51,30 @@ $sn-icon-check: "\e95f"; } } +.sn-checkbox-icon { + background-position: center center; + background-repeat: no-repeat; + background-size: contain; + height: 1rem; + width: 1rem; + + &.unchecked { + background-image: asset-url("checkbox/default.svg"); + } + + &.checked { + background-image: asset-url("checkbox/checked.svg"); + } + + &.disabled { + background-image: asset-url("checkbox/disabled.svg"); + } + + &.indeterminate { + background-image: asset-url("checkbox/indeterminate.svg"); + } +} + @mixin font-h1 { font-size: 24px; font-weight: bold; diff --git a/app/controllers/design_elements_controller.rb b/app/controllers/design_elements_controller.rb new file mode 100644 index 000000000..c74bfe83f --- /dev/null +++ b/app/controllers/design_elements_controller.rb @@ -0,0 +1,19 @@ +class DesignElementsController < ApplicationController + def index + end + + def test_select + render json: { data: [ + ['1', 'One'], + ['2', 'Two'], + ['3', 'Three'], + ['4', 'Four'], + ['5', 'Five'], + ['6', 'Six'], + ['7', 'Seven'], + ['8', 'Eight'], + ['9', 'Nine'], + ['10', 'Ten'] + ].select { |item| item[1].downcase.include?(params[:query].downcase) } } + end +end diff --git a/app/javascript/packs/vue/design_system/select.js b/app/javascript/packs/vue/design_system/select.js new file mode 100644 index 000000000..174e331e1 --- /dev/null +++ b/app/javascript/packs/vue/design_system/select.js @@ -0,0 +1,45 @@ +import { createApp } from 'vue/dist/vue.esm-bundler.js'; +import SelectDropdown from '../../../vue/shared/select_dropdown.vue'; +import PerfectScrollbar from 'vue3-perfect-scrollbar'; +import { mountWithTurbolinks } from '../helpers/turbolinks.js'; + +const app = createApp({ + data() { + return { + size: 'md', + } + }, + computed: { + simpleOptions() { + return [ + ['1', 'One', { icon: 'sn-icon-edit' }], + ['2', 'Two', { icon: 'sn-icon-drag' }], + ['3', 'Three', { icon: 'sn-icon-delete' }], + ['4', 'Four', { icon: 'sn-icon-visibility-show' }], + ['5', 'Five', { icon: 'sn-icon-edit' }], + ['6', 'Six', { icon: 'sn-icon-locked-task' }], + ['7', 'Seven', { icon: 'sn-icon-drag' }], + ['8', 'Eight', { icon: 'sn-icon-delete' }], + ['9', 'Nine', { icon: 'sn-icon-edit' }], + ['10', 'Ten', { icon: 'sn-icon-close' }], + ]; + }, + longOptions() { + return [ + ['1', 'Very long long long option and label to test responsivness'], + ['2', 'Two'], + ['3', 'Three'], + ['4', 'Four'], + ] + }, + renderer() { + return (option) => { + return ` ${option[1]}`; + } + } + }, +}); +app.component('SelectDropdown', SelectDropdown); +app.config.globalProperties.i18n = window.I18n; +app.use(PerfectScrollbar); +mountWithTurbolinks(app, '#selects'); diff --git a/app/javascript/vue/navigation/top_menu.vue b/app/javascript/vue/navigation/top_menu.vue index 9d134732a..d1d3a1c65 100644 --- a/app/javascript/vue/navigation/top_menu.vue +++ b/app/javascript/vue/navigation/top_menu.vue @@ -5,14 +5,11 @@