@bimdata/design-system 2.1.0-rc.10 → 2.1.0-rc.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bimdata/design-system",
3
- "version": "2.1.0-rc.10",
3
+ "version": "2.1.0-rc.11",
4
4
  "main": "./src/BIMDataComponents/index.js",
5
5
  "module": "./src/BIMDataComponents/index.js",
6
6
  "files": [
@@ -0,0 +1,182 @@
1
+ <template>
2
+ <div
3
+ class="bimdata-input-outlined"
4
+ :class="{
5
+ error,
6
+ success,
7
+ disabled,
8
+ loading,
9
+ empty:
10
+ modelValue === undefined || modelValue === null || modelValue === '',
11
+ }"
12
+ :style="style"
13
+ >
14
+ <fieldset>
15
+ <label v-if="label" :for="`bimdata-input-outlined-${uuid}`" class="m-b-6"
16
+ ><slot name="label">Label here</slot></label
17
+ >
18
+ <div class="flex items-center">
19
+ <slot name="prefix"></slot>
20
+ <div class="bimdata-input-outlined__container">
21
+ <div class="bimdata-input-outlined__container__prefix-inner">
22
+ <slot name="prefixInner"></slot>
23
+ </div>
24
+ <input
25
+ ref="input"
26
+ :type="inputType"
27
+ :id="`bimdata-input-${uuid}`"
28
+ @input="$emit('update:modelValue', $event.currentTarget.value)"
29
+ :disabled="disabled"
30
+ :value="modelValue"
31
+ :placeholder="placeholder"
32
+ @focus="
33
+ $event.target.select();
34
+ $emit('focus', $event);
35
+ "
36
+ @blur="$emit('blur', $event)"
37
+ @keypress="$emit('keypress', $event)"
38
+ @change="$emit('change', $event)"
39
+ :autocomplete="autocomplete ? 'on' : 'off'"
40
+ v-bind="$attrs"
41
+ :maxlength="maxLength"
42
+ />
43
+ <BIMDataSpinner v-if="loading" class="items-center"></BIMDataSpinner>
44
+ <div class="bimdata-input-outlined__container__suffix-inner">
45
+ <slot name="suffixInner"></slot>
46
+ </div>
47
+ </div>
48
+ <slot name="suffix"></slot>
49
+ </div>
50
+ </fieldset>
51
+ <div
52
+ class="flex items-center"
53
+ :class="error || success ? 'justify-between' : 'justify-end'"
54
+ >
55
+ <span v-if="error" class="error">{{ errorMessage }}</span>
56
+ <span v-if="success" class="success">{{ successMessage }}</span>
57
+ <span v-if="counter" class="counter m-l-12">
58
+ {{ modelValue.length }}
59
+ / {{ maxLength }}
60
+ </span>
61
+ </div>
62
+ </div>
63
+ </template>
64
+
65
+ <script>
66
+ let uuid = 0;
67
+
68
+ export default {
69
+ model: {
70
+ prop: "modelValue",
71
+ event: "update:modelValue",
72
+ },
73
+ props: {
74
+ autocomplete: {
75
+ type: Boolean,
76
+ default: false,
77
+ },
78
+ counter: {
79
+ type: Boolean,
80
+ default: false,
81
+ },
82
+ disabled: {
83
+ type: Boolean,
84
+ default: false,
85
+ },
86
+ error: {
87
+ type: Boolean,
88
+ default: false,
89
+ },
90
+ errorMessage: {
91
+ type: String,
92
+ default: "",
93
+ },
94
+ inputType: {
95
+ type: String,
96
+ default: "text",
97
+ validator: type => {
98
+ const possibleTypes = [
99
+ "text",
100
+ "password",
101
+ "number",
102
+ "file",
103
+ "url",
104
+ "time",
105
+ "email",
106
+ "tel",
107
+ ];
108
+ return possibleTypes.includes(type);
109
+ },
110
+ },
111
+ label: {
112
+ type: Boolean,
113
+ default: false,
114
+ },
115
+ loading: {
116
+ type: Boolean,
117
+ default: false,
118
+ },
119
+ margin: {
120
+ type: String,
121
+ default: "12px 0px",
122
+ },
123
+ maxLength: {
124
+ type: Number,
125
+ default: 100,
126
+ },
127
+ modelValue: {
128
+ type: [String, Number],
129
+ default: "",
130
+ },
131
+ placeholder: {
132
+ type: String,
133
+ default: "",
134
+ },
135
+ success: {
136
+ type: Boolean,
137
+ default: false,
138
+ },
139
+ successMessage: {
140
+ type: String,
141
+ default: "",
142
+ },
143
+ width: {
144
+ type: String,
145
+ default: "250px",
146
+ },
147
+ },
148
+ emits: ["update:modelValue", "blur", "keypress", "focus", "change"],
149
+ computed: {
150
+ style() {
151
+ return {
152
+ margin: `${this.margin}`,
153
+ width: `${this.width}`,
154
+ };
155
+ },
156
+ },
157
+ beforeCreate() {
158
+ this.uuid = uuid.toString();
159
+ uuid += 1;
160
+ },
161
+ created() {
162
+ this.$watch(
163
+ () => this.success && this.error,
164
+ successAndError => {
165
+ if (successAndError) {
166
+ throw new Error("Input state cannot be both success and error.");
167
+ }
168
+ },
169
+ );
170
+ },
171
+ methods: {
172
+ focus() {
173
+ this.$refs.input?.focus();
174
+ },
175
+ blur() {
176
+ this.$refs.input?.blur();
177
+ },
178
+ },
179
+ };
180
+ </script>
181
+
182
+ <style scoped lang="scss" src="./_BIMDataInputOutlined.scss"></style>
@@ -0,0 +1,96 @@
1
+ @import "../../assets/scss/mixins/_font-size.scss";
2
+
3
+ input:-webkit-autofill {
4
+ box-shadow: 0 0 0px 1000px var(--color-white) inset;
5
+ }
6
+
7
+ .bimdata-input-outlined {
8
+ position: relative;
9
+ font-family: var(--primary-font);
10
+ color: var(--color-primary);
11
+ fieldset {
12
+ margin: 0;
13
+ padding: 0;
14
+ border: none;
15
+ label {
16
+ display: block;
17
+ font-size: 10px;
18
+ text-transform: uppercase;
19
+ font-weight: bold;
20
+ letter-spacing: 0.6px;
21
+ color: var(--color-granite-light);
22
+ }
23
+ }
24
+ &__container {
25
+ padding: 0 calc(var(--spacing-unit) / 2);
26
+ width: 100%;
27
+ height: 100%;
28
+ border: 1px solid var(--color-silver);
29
+ border-radius: 3px;
30
+ display: flex;
31
+ flex: 1;
32
+ font-size: 14px;
33
+ overflow: hidden;
34
+ position: relative;
35
+ z-index: 0;
36
+ input {
37
+ width: 100%;
38
+ min-height: 32px;
39
+ font-size: 14px;
40
+ color: var(--color-primary);
41
+ background-color: transparent;
42
+ border-style: none;
43
+ cursor: auto;
44
+ font-family: inherit;
45
+ &:focus {
46
+ outline: none;
47
+ }
48
+ }
49
+ &__prefix-inner,
50
+ &__suffix-inner {
51
+ align-content: center;
52
+ align-items: center;
53
+ display: flex;
54
+ justify-content: center;
55
+ }
56
+ }
57
+ .error {
58
+ color: var(--color-high);
59
+ font-size: 11px;
60
+ }
61
+ .success {
62
+ color: var(--color-success);
63
+ font-size: 11px;
64
+ }
65
+ &.disabled {
66
+ opacity: 0.6;
67
+ cursor: default;
68
+ }
69
+ &.error {
70
+ .bimdata-input-outlined__container {
71
+ border-color: var(--color-high);
72
+ background-color: var(--color-high-lighter);
73
+ }
74
+ }
75
+ &.success {
76
+ .bimdata-input-outlined__container {
77
+ border-color: var(--color-success);
78
+ background-color: var(--color-success-lighter);
79
+ }
80
+ }
81
+ .counter {
82
+ font-size: 11px;
83
+ letter-spacing: -0.5px;
84
+ color: var(--color-granite-light);
85
+ }
86
+ &[type="file"] {
87
+ .bimdata-input-outlined__container {
88
+ border: none;
89
+ }
90
+ }
91
+ &[type="number"] {
92
+ input {
93
+ appearance: textfield;
94
+ }
95
+ }
96
+ }
@@ -21,6 +21,7 @@ export { default as BIMDataIcon } from "./BIMDataIcon/BIMDataIcon.vue";
21
21
  export * from "./BIMDataIcon/BIMDataIconStandalone/index.js";
22
22
  export { default as BIMDataIllustration } from "./BIMDataIllustration/BIMDataIllustration.vue";
23
23
  export { default as BIMDataInput } from "./BIMDataInput/BIMDataInput.vue";
24
+ export { default as BIMDataInputOutlined } from "./BIMDataInputOutlined/BIMDataInputOutlined.vue";
24
25
  export { default as BIMDataLoading } from "./BIMDataLoading/BIMDataLoading.vue";
25
26
  export { default as BIMDataMenu } from "./BIMDataMenu/BIMDataMenu.vue";
26
27
  export { default as BIMDataMenuInline } from "./BIMDataMenuInline/BIMDataMenuInline.vue";