From b4dadf15c48ffb3aa37ec3c74d74b3956efeca65 Mon Sep 17 00:00:00 2001 From: Gaelle Date: Thu, 7 Dec 2023 16:30:47 +0100 Subject: [PATCH 1/5] create BIMDataInputOutlined component and add documentation --- .../BIMDataInputOutlined.vue | 181 ++++++++++++ .../_BIMDataInputOutlined.scss | 96 +++++++ src/BIMDataComponents/index.js | 1 + src/web/views/Components/Input/Input.vue | 21 +- .../views/Components/Input/InputOutlined.vue | 271 ++++++++++++++++++ src/web/views/Components/Input/events-data.js | 7 +- src/web/views/Components/Input/props-data.js | 56 ++-- .../Components/Input/props-outlined-input.js | 82 ++++++ .../Components/Input/slots-outlined-input.js | 10 + 9 files changed, 681 insertions(+), 44 deletions(-) create mode 100644 src/BIMDataComponents/BIMDataInputOutlined/BIMDataInputOutlined.vue create mode 100644 src/BIMDataComponents/BIMDataInputOutlined/_BIMDataInputOutlined.scss create mode 100644 src/web/views/Components/Input/InputOutlined.vue create mode 100644 src/web/views/Components/Input/props-outlined-input.js create mode 100644 src/web/views/Components/Input/slots-outlined-input.js diff --git a/src/BIMDataComponents/BIMDataInputOutlined/BIMDataInputOutlined.vue b/src/BIMDataComponents/BIMDataInputOutlined/BIMDataInputOutlined.vue new file mode 100644 index 00000000..7fa5d688 --- /dev/null +++ b/src/BIMDataComponents/BIMDataInputOutlined/BIMDataInputOutlined.vue @@ -0,0 +1,181 @@ + + + + + diff --git a/src/BIMDataComponents/BIMDataInputOutlined/_BIMDataInputOutlined.scss b/src/BIMDataComponents/BIMDataInputOutlined/_BIMDataInputOutlined.scss new file mode 100644 index 00000000..28f5fab2 --- /dev/null +++ b/src/BIMDataComponents/BIMDataInputOutlined/_BIMDataInputOutlined.scss @@ -0,0 +1,96 @@ +@import "../../assets/scss/mixins/_font-size.scss"; + +input:-webkit-autofill { + box-shadow: 0 0 0px 1000px var(--color-white) inset; +} + +.bimdata-input-outlined { + position: relative; + font-family: var(--primary-font); + color: var(--color-primary); + fieldset { + margin: 0; + padding: 0; + border: none; + label { + display: block; + font-size: 10px; + text-transform: uppercase; + font-weight: bold; + letter-spacing: 0.6px; + color: var(--color-granite-light); + } + } + &__container { + padding: 0 calc(var(--spacing-unit) / 2); + width: 100%; + height: 100%; + border: 1px solid var(--color-silver); + border-radius: 3px; + display: flex; + flex: 1; + font-size: 14px; + overflow: hidden; + position: relative; + z-index: 0; + input { + width: 100%; + min-height: 32px; + font-size: 14px; + color: var(--color-primary); + background-color: transparent; + border-style: none; + cursor: inherit; + font-family: inherit; + &:focus { + outline: none; + } + } + &__prefix-inner, + &__suffix-inner { + align-content: center; + align-items: center; + display: flex; + justify-content: center; + } + } + .error { + color: var(--color-high); + font-size: 11px; + } + .success { + color: var(--color-success); + font-size: 11px; + } + &.disabled { + opacity: 0.6; + cursor: default; + } + &.error { + .bimdata-input-outlined__container { + border-color: var(--color-high); + background-color: var(--color-high-lighter); + } + } + &.success { + .bimdata-input-outlined__container { + border-color: var(--color-success); + background-color: var(--color-success-lighter); + } + } + .counter { + font-size: 11px; + letter-spacing: -0.5px; + color: var(--color-granite-light); + } + &[type="file"] { + .bimdata-input-outlined__container { + border: none; + } + } + &[type="number"] { + input { + appearance: textfield; + } + } +} diff --git a/src/BIMDataComponents/index.js b/src/BIMDataComponents/index.js index cb169df1..dee2bb2c 100644 --- a/src/BIMDataComponents/index.js +++ b/src/BIMDataComponents/index.js @@ -21,6 +21,7 @@ export { default as BIMDataIcon } from "./BIMDataIcon/BIMDataIcon.vue"; export * from "./BIMDataIcon/BIMDataIconStandalone/index.js"; export { default as BIMDataIllustration } from "./BIMDataIllustration/BIMDataIllustration.vue"; export { default as BIMDataInput } from "./BIMDataInput/BIMDataInput.vue"; +export { default as BIMDataInputOutlined } from "./BIMDataInputOutlined/BIMDataInputOutlined.vue"; export { default as BIMDataLoading } from "./BIMDataLoading/BIMDataLoading.vue"; export { default as BIMDataMenu } from "./BIMDataMenu/BIMDataMenu.vue"; export { default as BIMDataMenuInline } from "./BIMDataMenuInline/BIMDataMenuInline.vue"; diff --git a/src/web/views/Components/Input/Input.vue b/src/web/views/Components/Input/Input.vue index a2cd392a..8878b884 100644 --- a/src/web/views/Components/Input/Input.vue +++ b/src/web/views/Components/Input/Input.vue @@ -4,6 +4,7 @@ {{ $route.name }} +

Basic input

@@ -113,6 +114,8 @@ + + @@ -123,10 +126,12 @@ import propsData from "./props-data.js"; import slotsData from "./slots-data.js"; // Components import ComponentCode from "../../Elements/ComponentCode/ComponentCode.vue"; +import InputOutlined from "./InputOutlined.vue"; export default { components: { ComponentCode, + InputOutlined, }, data() { return { @@ -165,18 +170,10 @@ export default { } }, getLoading() { - if (this.loading) { - return true; - } else { - return false; - } + return this.loading; }, getDisabled() { - if (this.disabled) { - return true; - } else { - return false; - } + return this.disabled; }, getInputIcon() { if (this.inputIcon) { diff --git a/src/web/views/Components/Input/InputOutlined.vue b/src/web/views/Components/Input/InputOutlined.vue new file mode 100644 index 00000000..0dfd1f55 --- /dev/null +++ b/src/web/views/Components/Input/InputOutlined.vue @@ -0,0 +1,271 @@ + + + diff --git a/src/web/views/Components/Input/events-data.js b/src/web/views/Components/Input/events-data.js index 037d022f..771522f0 100644 --- a/src/web/views/Components/Input/events-data.js +++ b/src/web/views/Components/Input/events-data.js @@ -1,10 +1,9 @@ /* eslint-disable */ export default [ [ "Event name", "Payload" ], - [ "update:modelValue", "The input value." ], [ "blur", "The native blur event." ], - [ "keypress", "The native keypress event." ], + [ "change", "To catch the Event object"], [ "focus", "The native focus event." ], - ["change", "To catch the Event object"], - + [ "keypress", "The native keypress event." ], + [ "update:modelValue", "The input value." ], ]; diff --git a/src/web/views/Components/Input/props-data.js b/src/web/views/Components/Input/props-data.js index 237533aa..7063b62b 100644 --- a/src/web/views/Components/Input/props-data.js +++ b/src/web/views/Components/Input/props-data.js @@ -1,24 +1,6 @@ /* eslint-disable */ export default [ [ "Props", "Type", "Default value", "Description" ], - [ - "modelValue", - "String", - "", - "Use this prop to bind the input value to a variable.", - ], - [ - "margin", - "String", - "12px 0", - "Custom input margins", - ], - [ - "placeholder", - "String", - "' '", - "Use this props to add a placeholder to your input.", - ], [ "autocomplete", "Boolean", @@ -32,33 +14,51 @@ export default [ "Use this boolean to disabled your input.", ], [ - "loading", + "error", "Boolean", "false", - "", + "Use this boolean to check if your input is bad.", ], [ - "success", + "errorMessage", + "String", + "' '", + "Use this props to add an error message to your input.", + ], + [ + "loading", "Boolean", "false", - "Use this boolean to check if your input is good.", + "", ], [ - "successMessage", + "margin", + "String", + "12px 0", + "Custom input margins", + ], + [ + "modelValue", + "String", + "", + "Use this prop to bind the input value to a variable.", + ], + [ + "placeholder", "String", "' '", - "Use this props to add a success message to your input.", + "Use this props to add a placeholder to your input.", ], [ - "error", + "success", "Boolean", "false", - "Use this boolean to check if your input is bad.", + "Use this boolean to check if your input is good.", ], [ - "errorMessage", + "successMessage", "String", "' '", - "Use this props to add an error message to your input.", + "Use this props to add a success message to your input.", ], ]; diff --git a/src/web/views/Components/Input/props-outlined-input.js b/src/web/views/Components/Input/props-outlined-input.js new file mode 100644 index 00000000..bb495418 --- /dev/null +++ b/src/web/views/Components/Input/props-outlined-input.js @@ -0,0 +1,82 @@ +/* eslint-disable */ +export default [ + [ "Props", "Type", "Default value", "Description" ], + [ + "autocomplete", + "Boolean", + "false", + "Whether 'autocomplete' attribute is 'on' or 'off'." + ], + [ + "counter", + "Boolean", + "false", + "Specifies whether the input should have a counter at the bottom.", + ], + [ + "disabled", + "Boolean", + "false", + "Use this boolean to disabled your input.", + ], + [ + "error", + "Boolean", + "false", + "Use this boolean to check if your input is bad.", + ], + [ + "errorMessage", + "String", + "' '", + "Use this props to add an error message to your input.", + ], + [ + "loading", + "Boolean", + "false", + "", + ], + [ + "margin", + "String", + "12px 0", + "Custom input margins", + ], + [ + "maxLength", + "Number", + "100", + "Specifies maximum length of input.", + ], + [ + "modelValue", + "String", + "", + "Use this prop to bind the input value to a variable.", + ], + [ + "placeholder", + "String", + "' '", + "Use this props to add a placeholder to your input.", + ], + [ + "success", + "Boolean", + "false", + "Use this boolean to check if your input is good.", + ], + [ + "successMessage", + "String", + "' '", + "Use this props to add a success message to your input.", + ], + [ + "width", + "String", + "'250px'", + "Use this props to custom input width.", + ], +]; diff --git a/src/web/views/Components/Input/slots-outlined-input.js b/src/web/views/Components/Input/slots-outlined-input.js new file mode 100644 index 00000000..52d95216 --- /dev/null +++ b/src/web/views/Components/Input/slots-outlined-input.js @@ -0,0 +1,10 @@ +/* eslint-disable */ +export default [ + [ "Slot name", "Description" ], + [ "label", "Use this slot to add a label." ], + [ "prefix", "Use this slot for pass custom elements in front of outer input, such as is icons etc." ], + [ "prefixInner", "Use this slot for pass custom elements in front of inner input, such as is icons etc." ], + [ "suffixInner", "Use this slot for pass custom elements behind inner input, such as is icons etc." ], + [ "suffix", "Use this slot for pass custom elements behind outer input, such as is icons etc." ], + +]; From 92752496b0a12bff2840646af00c3e0dd28d2e72 Mon Sep 17 00:00:00 2001 From: Gaelle Date: Thu, 7 Dec 2023 16:48:44 +0100 Subject: [PATCH 2/5] add missing props documentation --- .../BIMDataInputOutlined.vue | 67 ++++++++++--------- .../views/Components/Input/InputOutlined.vue | 1 + .../Components/Input/props-outlined-input.js | 16 ++++- 3 files changed, 49 insertions(+), 35 deletions(-) diff --git a/src/BIMDataComponents/BIMDataInputOutlined/BIMDataInputOutlined.vue b/src/BIMDataComponents/BIMDataInputOutlined/BIMDataInputOutlined.vue index 7fa5d688..23045cfc 100644 --- a/src/BIMDataComponents/BIMDataInputOutlined/BIMDataInputOutlined.vue +++ b/src/BIMDataComponents/BIMDataInputOutlined/BIMDataInputOutlined.vue @@ -71,22 +71,26 @@ export default { event: "update:modelValue", }, props: { - width: { - type: String, - default: "250px", + autocomplete: { + type: Boolean, + default: false, }, - modelValue: { - type: [String, Number], - default: "", + counter: { + type: Boolean, + default: false, }, - placeholder: { + disabled: { + type: Boolean, + default: false, + }, + error: { + type: Boolean, + default: false, + }, + errorMessage: { type: String, default: "", }, - maxLength: { - type: Number, - default: 100, - }, inputType: { type: String, default: "text", @@ -99,49 +103,46 @@ export default { "url", "time", "email", + "tel", ]; return possibleTypes.includes(type); }, }, - error: { + label: { type: Boolean, default: false, }, - success: { + loading: { type: Boolean, default: false, }, - errorMessage: { + margin: { type: String, + default: "12px 0px", + }, + maxLength: { + type: Number, + default: 100, + }, + modelValue: { + type: [String, Number], default: "", }, - successMessage: { + placeholder: { type: String, default: "", }, - loading: { - type: Boolean, - default: false, - }, - label: { - type: Boolean, - default: false, - }, - disabled: { + success: { type: Boolean, default: false, }, - margin: { + successMessage: { type: String, - default: "12px 0px", - }, - autocomplete: { - type: Boolean, - default: false, + default: "", }, - counter: { - type: Boolean, - default: false, + width: { + type: String, + default: "250px", }, }, emits: ["update:modelValue", "blur", "keypress", "focus", "change"], diff --git a/src/web/views/Components/Input/InputOutlined.vue b/src/web/views/Components/Input/InputOutlined.vue index 0dfd1f55..1dc3c214 100644 --- a/src/web/views/Components/Input/InputOutlined.vue +++ b/src/web/views/Components/Input/InputOutlined.vue @@ -199,6 +199,7 @@ export default { "url", "time", "email", + "tel", ], inputTypeSelection: "text", }; diff --git a/src/web/views/Components/Input/props-outlined-input.js b/src/web/views/Components/Input/props-outlined-input.js index bb495418..96139d31 100644 --- a/src/web/views/Components/Input/props-outlined-input.js +++ b/src/web/views/Components/Input/props-outlined-input.js @@ -1,6 +1,6 @@ /* eslint-disable */ export default [ - [ "Props", "Type", "Default value", "Description" ], + [ "Props", "Type", "Default value", "Description"], [ "autocomplete", "Boolean", @@ -31,6 +31,18 @@ export default [ "' '", "Use this props to add an error message to your input.", ], + [ + "inputType", + "String", + "'text'", + "Will be used as the type attribute of the input element among the following possibilities : 'email', 'file', 'password', 'number', 'text', 'tel', 'time', 'url'.", + ], + [ + "label", + "Boolean", + "false", + "Add a label above the input field.", + ], [ "loading", "Boolean", @@ -41,7 +53,7 @@ export default [ "margin", "String", "12px 0", - "Custom input margins", + "Custom input margins.", ], [ "maxLength", From 871d107bba8c4df48884fb0de1aa27b221002679 Mon Sep 17 00:00:00 2001 From: Gaelle Date: Fri, 8 Dec 2023 16:44:37 +0100 Subject: [PATCH 3/5] fix BIMDataInputOutlined cursor --- .../BIMDataInputOutlined/_BIMDataInputOutlined.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/BIMDataComponents/BIMDataInputOutlined/_BIMDataInputOutlined.scss b/src/BIMDataComponents/BIMDataInputOutlined/_BIMDataInputOutlined.scss index 28f5fab2..4194ab44 100644 --- a/src/BIMDataComponents/BIMDataInputOutlined/_BIMDataInputOutlined.scss +++ b/src/BIMDataComponents/BIMDataInputOutlined/_BIMDataInputOutlined.scss @@ -40,7 +40,7 @@ input:-webkit-autofill { color: var(--color-primary); background-color: transparent; border-style: none; - cursor: inherit; + cursor: auto; font-family: inherit; &:focus { outline: none; From bb2019a83b0b453638bd71e9028a3c8006c0f7fd Mon Sep 17 00:00:00 2001 From: Gaelle Date: Tue, 12 Dec 2023 14:15:09 +0100 Subject: [PATCH 4/5] fix documentation --- src/web/views/Components/Input/props-data.js | 4 ++-- src/web/views/Components/Input/props-outlined-input.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/web/views/Components/Input/props-data.js b/src/web/views/Components/Input/props-data.js index 7063b62b..1e802373 100644 --- a/src/web/views/Components/Input/props-data.js +++ b/src/web/views/Components/Input/props-data.js @@ -17,7 +17,7 @@ export default [ "error", "Boolean", "false", - "Use this boolean to check if your input is bad.", + "Use this boolean to check if your input is incorrect.", ], [ "errorMessage", @@ -53,7 +53,7 @@ export default [ "success", "Boolean", "false", - "Use this boolean to check if your input is good.", + "Use this boolean to check if your input is correct.", ], [ "successMessage", diff --git a/src/web/views/Components/Input/props-outlined-input.js b/src/web/views/Components/Input/props-outlined-input.js index 96139d31..a96b6dc8 100644 --- a/src/web/views/Components/Input/props-outlined-input.js +++ b/src/web/views/Components/Input/props-outlined-input.js @@ -23,7 +23,7 @@ export default [ "error", "Boolean", "false", - "Use this boolean to check if your input is bad.", + "Use this boolean to check if your input is incorrect.", ], [ "errorMessage", @@ -77,7 +77,7 @@ export default [ "success", "Boolean", "false", - "Use this boolean to check if your input is good.", + "Use this boolean to check if your input is correct.", ], [ "successMessage", From bd524a25cc487bd5af613d5ea2a5981468c7c0a4 Mon Sep 17 00:00:00 2001 From: Gaelle Date: Tue, 12 Dec 2023 14:15:55 +0100 Subject: [PATCH 5/5] use optional chaining --- .../BIMDataInputOutlined/BIMDataInputOutlined.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/BIMDataComponents/BIMDataInputOutlined/BIMDataInputOutlined.vue b/src/BIMDataComponents/BIMDataInputOutlined/BIMDataInputOutlined.vue index 23045cfc..b3e3f1c2 100644 --- a/src/BIMDataComponents/BIMDataInputOutlined/BIMDataInputOutlined.vue +++ b/src/BIMDataComponents/BIMDataInputOutlined/BIMDataInputOutlined.vue @@ -170,10 +170,10 @@ export default { }, methods: { focus() { - this.$refs.input && this.$refs.input.focus(); + this.$refs.input?.focus(); }, blur() { - this.$refs.input && this.$refs.input.blur(); + this.$refs.input?.blur(); }, }, };