From 6a7f848f611830bfd7bc30c2ef6527188f6ee6d0 Mon Sep 17 00:00:00 2001 From: LrxGaelle Date: Fri, 8 Sep 2023 16:45:19 +0200 Subject: [PATCH] MINOR: Feature/bimdata slider (#313) * create BIMDataSlider component & Slider documentation * create slider icon * add tooltip for slider * add parameters for slider documentation * delete dead code * delete dead code * refacto * add boolean props for tooltip * add slider documentation * add text description for slider component * fix BIMDataInput for 0 Number * add tooltip documentation * fix input modelValue --- .../BIMDataInput/BIMDataInput.vue | 10 +- .../BIMDataSlider/BIMDataSlider.vue | 101 ++++++++++++++++++ .../BIMDataSlider/_BIMDataSlider.scss | 80 ++++++++++++++ src/BIMDataComponents/index.js | 1 + src/web/assets/img/icon-slider.svg | 24 +++++ src/web/router.js | 5 + src/web/store.js | 8 ++ src/web/views/Components/Slider/Slider.vue | 101 ++++++++++++++++++ .../views/Components/Slider/events-data.js | 5 + src/web/views/Components/Slider/props-data.js | 59 ++++++++++ 10 files changed, 392 insertions(+), 2 deletions(-) create mode 100644 src/BIMDataComponents/BIMDataSlider/BIMDataSlider.vue create mode 100644 src/BIMDataComponents/BIMDataSlider/_BIMDataSlider.scss create mode 100644 src/web/assets/img/icon-slider.svg create mode 100644 src/web/views/Components/Slider/Slider.vue create mode 100644 src/web/views/Components/Slider/events-data.js create mode 100644 src/web/views/Components/Slider/props-data.js diff --git a/src/BIMDataComponents/BIMDataInput/BIMDataInput.vue b/src/BIMDataComponents/BIMDataInput/BIMDataInput.vue index 1df5fdf2..04822185 100644 --- a/src/BIMDataComponents/BIMDataInput/BIMDataInput.vue +++ b/src/BIMDataComponents/BIMDataInput/BIMDataInput.vue @@ -1,7 +1,13 @@ + + + + diff --git a/src/BIMDataComponents/BIMDataSlider/_BIMDataSlider.scss b/src/BIMDataComponents/BIMDataSlider/_BIMDataSlider.scss new file mode 100644 index 00000000..f26b8dec --- /dev/null +++ b/src/BIMDataComponents/BIMDataSlider/_BIMDataSlider.scss @@ -0,0 +1,80 @@ +.bimdata-slider { + position: relative; + .bimdata-slider-input { + &::-webkit-slider-runnable-track { + height: 3px; + background: linear-gradient( + to right, + var(--color-primary), + var(--color-primary) + ), + var(--color-silver); + background-size: var(--background-size, 0%) 100%; + background-repeat: no-repeat; + border-radius: 5px; + } + &::-webkit-slider-thumb { + width: 15px; + height: 15px; + cursor: pointer; + background: var(--color-primary); + border: solid var(--color-white) 1px; + border-radius: 50%; + margin-top: -6px; + box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.4); + } + &::-moz-range-progress { + background-color: var(--color-primary); + border-radius: 5px; + } + &::-moz-range-track { + background-color: var(--color-silver); + border-radius: 5px; + } + &::-moz-range-thumb { + width: 15px; + height: 15px; + cursor: pointer; + background: var(--color-primary); + border: solid var(--color-white) 1px; + border-radius: 50%; + margin-top: -6px; + box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.4); + } + } + &:hover { + .bimdata-slider-tooltip { + opacity: 1; + transition: opacity 0.2s ease-out; + } + } + &-tooltip { + background: var(--color-primary); + color: var(--color-white); + padding: calc(var(--spacing-unit) / 2); + position: absolute; + border-radius: 4px; + bottom: calc(var(--spacing-unit) * 3); + left: 50%; + transform: translateX(-50%); + opacity: 0; + transition: opacity 0.2s ease-out; + &::after { + border: 5px solid transparent; + border-top-color: var(--color-primary); + bottom: 5px * -2; + content: ""; + height: 0; + left: 50%; + position: absolute; + transform: translate(-50%); + width: 0; + } + } + .bimdata-slider-input, + .bimdata-slider-input::-webkit-slider-runnable-track, + .bimdata-slider-input::-webkit-slider-thumb { + appearance: none; + -webkit-appearance: none; + } +} diff --git a/src/BIMDataComponents/index.js b/src/BIMDataComponents/index.js index 1b55be36..cb169df1 100644 --- a/src/BIMDataComponents/index.js +++ b/src/BIMDataComponents/index.js @@ -35,6 +35,7 @@ export { default as BIMDataSearchAutocomplete } from "./BIMDataSearchAutocomplet export { default as BIMDataSelect } from "./BIMDataSelect/BIMDataSelect.vue"; export { default as BIMDataSimplePieChart } from "./BIMDataSimplePieChart/BIMDataSimplePieChart.vue"; export { default as BIMDataSpinner } from "./BIMDataSpinner/BIMDataSpinner.vue"; +export { default as BIMDataSlider } from "./BIMDataSlider/BIMDataSlider.vue"; export { default as BIMDataTable } from "./BIMDataTable/BIMDataTable.vue"; export { default as BIMDataTabs } from "./BIMDataTabs/BIMDataTabs.vue"; export { default as BIMDataText } from "./BIMDataText/BIMDataText.vue"; diff --git a/src/web/assets/img/icon-slider.svg b/src/web/assets/img/icon-slider.svg new file mode 100644 index 00000000..42206e53 --- /dev/null +++ b/src/web/assets/img/icon-slider.svg @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/web/router.js b/src/web/router.js index e708f8f8..f6371625 100644 --- a/src/web/router.js +++ b/src/web/router.js @@ -207,6 +207,11 @@ const routes = [ name: "select", component: () => import("./views/Components/Select/Select.vue"), }, + { + path: "slider", + name: "slider", + component: () => import("./views/Components/Slider/Slider.vue"), + }, { path: "table", name: "table", diff --git a/src/web/store.js b/src/web/store.js index 6731e789..0bbb9885 100644 --- a/src/web/store.js +++ b/src/web/store.js @@ -31,6 +31,7 @@ import safe_zone_inline from "./assets/img/icon-safe_zone_inline.svg"; import search from "./assets/img/icon-search.svg"; import search_autocomplete from "./assets/img/icon-search_autocomplete.svg"; import select from "./assets/img/icon-select.svg"; +import slider from "./assets/img/icon-slider.svg"; import table from "./assets/img/icon-table.svg"; import tabs from "./assets/img/icon-tabs.svg"; import text from "./assets/img/icon-text.svg"; @@ -282,6 +283,13 @@ export default { text: "Select (dropdown) is used to enabled a user to select a single item from a list of options.", btn: "View select", }, + { + title: "Slider", + img: slider, + path: "slider", + text: "Sliders allow users to make selections from a range of values.", + btn: "View slider", + }, { title: "Table", img: table, diff --git a/src/web/views/Components/Slider/Slider.vue b/src/web/views/Components/Slider/Slider.vue new file mode 100644 index 00000000..9d5f0c26 --- /dev/null +++ b/src/web/views/Components/Slider/Slider.vue @@ -0,0 +1,101 @@ + + + + + diff --git a/src/web/views/Components/Slider/events-data.js b/src/web/views/Components/Slider/events-data.js new file mode 100644 index 00000000..de4891f9 --- /dev/null +++ b/src/web/views/Components/Slider/events-data.js @@ -0,0 +1,5 @@ +/* eslint-disable */ +export default [ + [ "Event name", "Payload" ], + [ "update:modelValue", "The slider input range value." ], +]; diff --git a/src/web/views/Components/Slider/props-data.js b/src/web/views/Components/Slider/props-data.js new file mode 100644 index 00000000..96714079 --- /dev/null +++ b/src/web/views/Components/Slider/props-data.js @@ -0,0 +1,59 @@ +/* eslint-disable */ +export default [ + [ + "Props", + "Type", + "Required", + "Default value", + "Description", + "Example", + ], + [ + "min", + "Number, String", + "", + "null", + "Use this props to define min range.", + "0", + ], + [ + "max", + "Number, String", + "", + "null", + "Use this props to define max range.", + "100", + ], + [ + "step", + "Number, String", + "", + "null", + "You can change the default step increment.", + "10", + ], + [ + "modelValue", + "Number", + "", + "0", + "Slider input range value.", + "", + ], + [ + "disabled", + "Boolean", + "", + "false", + "Use this props to disable slider.", + "true", + ], + [ + "tooltip", + "Boolean", + "", + "false", + "Use this props to enable tooltip with slider value.", + "true", + ], +];