@bimdata/design-system 3.0.0-beta.35 → 3.0.0-beta.37

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": "3.0.0-beta.35",
3
+ "version": "3.0.0-beta.37",
4
4
  "type": "module",
5
5
  "main": "./src/BIMDataComponents/index.js",
6
6
  "module": "./src/BIMDataComponents/index.js",
@@ -32,9 +32,9 @@
32
32
  "eslint-plugin-vue": "^10.6.2",
33
33
  "prettier": "^3.7.4",
34
34
  "prismjs": "^1.30.0",
35
- "sass-embedded": "^1.97.1",
35
+ "sass-embedded": "^1.97.2",
36
36
  "semantic-release": "^25.0.2",
37
- "vite": "^7.3.0",
37
+ "vite": "^7.3.1",
38
38
  "vue": "^3.5.26",
39
39
  "vue-router": "^4.6.4",
40
40
  "vue3-clipboard": "^1.0.0"
@@ -4,7 +4,6 @@
4
4
  display: flex;
5
5
  align-items: center;
6
6
  font-family: var(--primary-font);
7
- font-size: 14px;
8
7
  cursor: pointer;
9
8
  user-select: none;
10
9
  :after,
@@ -14,8 +13,9 @@
14
13
  }
15
14
  /* custom CHECKMARK */
16
15
  .bimdata-checkbox__mark {
17
- width: 13px;
18
- height: 13px;
16
+ aspect-ratio: 1 / 1;
17
+ width: 100%;
18
+ height: auto;
19
19
  position: relative;
20
20
  top: 0;
21
21
  left: 0;
@@ -23,13 +23,13 @@
23
23
  border-radius: 2px;
24
24
  box-sizing: border-box;
25
25
  &::after {
26
- width: 4px;
27
- height: 7px;
26
+ width: 40%;
27
+ height: 60%;
28
28
  content: '';
29
29
  display: block;
30
30
  position: absolute;
31
- top: 1px;
32
- left: 3px;
31
+ top: 5%;
32
+ left: 30%;
33
33
  border: solid transparent;
34
34
  opacity: 0;
35
35
  transform: rotate(45deg);
@@ -37,9 +37,8 @@
37
37
  }
38
38
  /* custom TEXT CHECKBOX */
39
39
  .bimdata-checkbox__text {
40
- width: calc(100% - 13px - 5px);
41
40
  margin-left: 6px;
42
- font-size: 12px;
41
+ font-size: inherit;
43
42
  }
44
43
  /* custom DARK CHECKBOX */
45
44
  &.dark {
@@ -6,7 +6,7 @@
6
6
  :style="style"
7
7
  v-bind="$attrs"
8
8
  >
9
- <span class="bimdata-checkbox__mark"></span>
9
+ <span class="bimdata-checkbox__mark" :style="checkboxStyle"></span>
10
10
  <span class="bimdata-checkbox__text" v-if="text">
11
11
  <slot>{{ text }}</slot>
12
12
  </span>
@@ -42,6 +42,10 @@ export default {
42
42
  type: String,
43
43
  default: "0px",
44
44
  },
45
+ fontSize: {
46
+ type: [String, Number],
47
+ default: "12px",
48
+ },
45
49
  },
46
50
  emits: ["update:modelValue"],
47
51
  computed: {
@@ -54,6 +58,22 @@ export default {
54
58
  style() {
55
59
  return {
56
60
  margin: `${this.margin}`,
61
+ fontSize: this.fontSize
62
+ ? typeof this.fontSize === "number"
63
+ ? `${this.fontSize}px`
64
+ : this.fontSize
65
+ : null,
66
+ };
67
+ },
68
+ checkboxStyle() {
69
+ const size =
70
+ typeof this.fontSize === "number"
71
+ ? `${this.fontSize}px`
72
+ : this.fontSize;
73
+
74
+ return {
75
+ width: `clamp(14px, calc(${size} * 1.1), 20px)`,
76
+ height: `clamp(14px, calc(${size} * 1.1), 20px)`,
57
77
  };
58
78
  },
59
79
  isDark() {
@@ -5,16 +5,18 @@
5
5
  user-select: none;
6
6
 
7
7
  & .bimdata-select__content {
8
- height: 32px;
8
+ height: 100%;
9
9
  border-radius: 50px;
10
10
 
11
11
  & .bimdata-select__content__value {
12
12
  padding: 0 12px;
13
- height: 32px;
13
+ height: 100%;
14
14
  display: flex;
15
15
  justify-content: space-between;
16
16
  align-items: center;
17
17
  cursor: pointer;
18
+ z-index: 2;
19
+ position: relative;
18
20
 
19
21
  span {
20
22
  height: auto;
@@ -26,11 +28,18 @@
26
28
 
27
29
  & .bimdata-select__content__label {
28
30
  position: absolute;
29
- top: 8px;
31
+ top: 50%;
30
32
  left: 12px;
33
+ transform: translateY(-50%);
31
34
  font-size: 12px;
32
35
  transition: 0.2s ease all;
33
- transition: 0.2s ease all;
36
+ }
37
+
38
+ & .bimdata-select__content__placeholder {
39
+ position: absolute;
40
+ top: 50%;
41
+ left: 12px;
42
+ transform: translateY(-50%);
34
43
  }
35
44
  }
36
45
 
@@ -46,6 +55,7 @@
46
55
  left: 0;
47
56
  font-size: 10px;
48
57
  color: var(--color-primary);
58
+ transform: none;
49
59
  }
50
60
  }
51
61
  }
@@ -61,12 +71,13 @@
61
71
  background-color: var(--color-white);
62
72
 
63
73
  & .bimdata-select__option-list__entry {
64
- height: 29px;
74
+ min-height: 29px;
65
75
  padding: 0 var(--spacing-unit);
66
76
  display: flex;
67
77
  align-items: center;
68
78
  font-size: 12px;
69
79
  cursor: pointer;
80
+ line-height: 2;
70
81
 
71
82
  &:hover {
72
83
  background-color: var(--color-silver-light);
@@ -100,6 +111,7 @@
100
111
  }
101
112
 
102
113
  &.rounded-element {
114
+ border-radius: 18px;
103
115
  .bimdata-select__option-list__entry {
104
116
  border-radius: 50px;
105
117
  }
@@ -240,6 +252,42 @@
240
252
  }
241
253
  }
242
254
  }
255
+ &.tertiary-darker {
256
+ .bimdata-select__content {
257
+ background-color: var(--color-tertiary-darker);
258
+ .bimdata-select__content__label {
259
+ color: var(--color-white);
260
+ }
261
+ .bimdata-select__content__value {
262
+ color: var(--color-white);
263
+ }
264
+ }
265
+ &.active {
266
+ .bimdata-select__content {
267
+ .bimdata-select__content__value, .bimdata-select__content__label {
268
+ color: var(--color-white);
269
+ }
270
+ }
271
+ .bimdata-select__option-list {
272
+ .bimdata-select__option-list__entry {
273
+ &.selected, &:hover {
274
+ background-color: #e7f0f5;
275
+ }
276
+ }
277
+ }
278
+ }
279
+ &.dark {
280
+ .bimdata-select__option-list {
281
+ background-color: var(--color-tertiary-darker);
282
+ color: var(--color-white);
283
+ .bimdata-select__option-list__entry {
284
+ &.selected, &:hover {
285
+ background-color: #234254;
286
+ }
287
+ }
288
+ }
289
+ }
290
+ }
243
291
  &.tertiary-light {
244
292
  .bimdata-select__content {
245
293
  background-color: var(--color-tertiary-lighter);
@@ -18,6 +18,10 @@ export default {
18
18
  type: [String, Number],
19
19
  default: "100%",
20
20
  },
21
+ height: {
22
+ type: [String, Number],
23
+ default: "32px",
24
+ },
21
25
  label: {
22
26
  type: String,
23
27
  default: null,
@@ -64,9 +68,7 @@ export default {
64
68
  ...props,
65
69
  "onUpdate:modelValue": event => emit("update:modelValue", event),
66
70
  },
67
- {
68
- empty: () => slots.empty?.(),
69
- },
71
+ slots,
70
72
  );
71
73
  },
72
74
  };
@@ -4,26 +4,40 @@
4
4
  :class="{
5
5
  disabled,
6
6
  active: isOpen,
7
- dark: isDark,
8
7
  'not-empty': modelValue.length > 0,
8
+ dark: isDark,
9
9
  [color]: true,
10
10
  }"
11
- :style="{ width }"
11
+ :style="{ width, height, fontSize }"
12
12
  v-clickaway="away"
13
13
  >
14
14
  <div class="bimdata-select__content">
15
15
  <div class="bimdata-select__content__value" @click="toggle">
16
16
  <span class="m-r-6">{{ displayedValue }}</span>
17
- <BIMDataIconChevron size="xxs" :rotate="isOpen ? 90 : 0" />
17
+ <slot name="contentRight">
18
+ <BIMDataIconChevron size="xxs" :rotate="isOpen ? 90 : 0" />
19
+ </slot>
18
20
  </div>
19
- <label class="bimdata-select__content__label">
21
+ <label v-if="showLabel" class="bimdata-select__content__label">
22
+ <slot name="labelLeft"></slot>
20
23
  {{ label }}
24
+ <slot name="labelRight"></slot>
25
+ </label>
26
+ <label
27
+ v-if="shouldDisplayPlaceholder"
28
+ class="bimdata-select__content__placeholder"
29
+ >
30
+ <slot name="placeholder">{{ placeholder }}</slot>
21
31
  </label>
22
32
  <span class="bimdata-select__content__underline"></span>
23
33
  </div>
24
34
 
25
35
  <transition name="slide-fade-down">
26
- <div v-show="!disabled && isOpen" class="bimdata-select__option-list" :class="{ 'rounded-element': isSelectedAndHoveredElementsRounded }">
36
+ <div
37
+ v-show="!disabled && isOpen"
38
+ class="bimdata-select__option-list"
39
+ :class="{ 'rounded-element': isSelectedAndHoveredElementsRounded }"
40
+ >
27
41
  <BIMDataSearch
28
42
  v-if="search"
29
43
  width="calc(100% - 12px)"
@@ -47,6 +61,7 @@
47
61
  'option-group': isOptionGroup(option),
48
62
  }"
49
63
  @click="onOptionClick(option)"
64
+ :style="{ fontSize }"
50
65
  >
51
66
  <template v-if="isOptionGroup(option)">
52
67
  {{ optionLabel(option) }}
@@ -56,6 +71,8 @@
56
71
  :modelValue="isSelected(option)"
57
72
  :disabled="isDisabled(option)"
58
73
  :text="optionLabel(option)"
74
+ :style="{ fontSize }"
75
+ :fontSize="fontSize"
59
76
  ></BIMDataCheckbox>
60
77
  </li>
61
78
  </ul>
@@ -93,7 +110,16 @@ export default {
93
110
  type: String,
94
111
  default: "default",
95
112
  validator: value =>
96
- ["default", "primary", "secondary", "tertiary", "tertiary-light", "quaternary", "white"].includes(value),
113
+ [
114
+ "default",
115
+ "primary",
116
+ "secondary",
117
+ "tertiary",
118
+ "tertiary-light",
119
+ "tertiary-darker",
120
+ "quaternary",
121
+ "white",
122
+ ].includes(value),
97
123
  },
98
124
  disabled: {
99
125
  type: Boolean,
@@ -109,6 +135,10 @@ export default {
109
135
  nullLabel: {
110
136
  type: String,
111
137
  },
138
+ showLabel: {
139
+ type: Boolean,
140
+ default: true,
141
+ },
112
142
  options: {
113
143
  type: Array,
114
144
  default: () => [],
@@ -119,6 +149,10 @@ export default {
119
149
  optionLabelKey: {
120
150
  type: String,
121
151
  },
152
+ placeholder: {
153
+ type: String,
154
+ default: null,
155
+ },
122
156
  resetOnLeave: {
123
157
  type: Boolean,
124
158
  default: false,
@@ -131,7 +165,13 @@ export default {
131
165
  type: String,
132
166
  default: "primary",
133
167
  validator: value =>
134
- ["primary", "secondary", "tertiary", "quaternary", "quaternary-light"].includes(value),
168
+ [
169
+ "primary",
170
+ "secondary",
171
+ "tertiary",
172
+ "quaternary",
173
+ "quaternary-light",
174
+ ].includes(value),
135
175
  },
136
176
  searchPlaceholder: {
137
177
  type: String,
@@ -140,6 +180,10 @@ export default {
140
180
  width: {
141
181
  type: [String, Number],
142
182
  },
183
+ height: {
184
+ type: [String, Number],
185
+ },
186
+ fontSize: [String, Number],
143
187
  isSelectedAndHoveredElementsRounded: {
144
188
  type: Boolean,
145
189
  default: false,
@@ -153,6 +197,9 @@ export default {
153
197
  };
154
198
  },
155
199
  computed: {
200
+ shouldDisplayPlaceholder() {
201
+ return !this.showLabel && this.modelValue.length === 0 && !this.isOpen;
202
+ },
156
203
  displayedValue() {
157
204
  return this.modelValue.map(this.optionLabel).join(", ");
158
205
  },
@@ -4,25 +4,41 @@
4
4
  :class="{
5
5
  disabled,
6
6
  active: isOpen,
7
- 'not-empty': modelValue !== undefined && modelValue !== null,
7
+ 'not-empty': isModelValueNotEmpty,
8
8
  dark: isDark,
9
9
  [color]: true,
10
10
  }"
11
- :style="{ width }"
11
+ :style="{ width, height, fontSize }"
12
12
  v-clickaway="away"
13
13
  >
14
14
  <div class="bimdata-select__content">
15
15
  <div class="bimdata-select__content__value" @click="toggle">
16
16
  <span class="m-r-6">{{ displayedValue }}</span>
17
- <BIMDataIconChevron size="xxs" :rotate="isOpen ? 90 : 0" />
17
+ <slot name="contentRight">
18
+ <BIMDataIconChevron size="xxs" :rotate="isOpen ? 90 : 0" />
19
+ </slot>
18
20
  </div>
19
- <label v-if="isLabel" class="bimdata-select__content__label">
21
+
22
+ <label v-if="showLabel" class="bimdata-select__content__label">
23
+ <slot name="labelLeft"></slot>
20
24
  {{ label }}
21
- </label>
25
+ <slot name="labelRight"></slot>
26
+ </label>
27
+
28
+ <label
29
+ v-if="shouldDisplayPlaceholder"
30
+ class="bimdata-select__content__placeholder"
31
+ >
32
+ <slot name="placeholder">{{ placeholder }}</slot>
33
+ </label>
22
34
  </div>
23
35
 
24
36
  <transition name="slide-fade-down">
25
- <div v-show="!disabled && isOpen" class="bimdata-select__option-list" :class="{ 'rounded-element': isSelectedAndHoveredElementsRounded }">
37
+ <div
38
+ v-show="!disabled && isOpen"
39
+ class="bimdata-select__option-list"
40
+ :class="{ 'rounded-element': isSelectedAndHoveredElementsRounded }"
41
+ >
26
42
  <BIMDataSearch
27
43
  v-if="search"
28
44
  width="calc(100% - 12px)"
@@ -39,20 +55,22 @@
39
55
  <li
40
56
  v-if="nullValue"
41
57
  class="bimdata-select__option-list__entry"
42
- @click="onNullValueClick()"
58
+ @click="selectOption(null)"
59
+ :style="{ fontSize }"
43
60
  >
44
61
  {{ nullLabel || "None" }}
45
62
  </li>
46
63
  <li
47
64
  class="bimdata-select__option-list__entry"
48
- v-for="(option, index) of filteredOptions"
65
+ v-for="(option, index) in filteredOptions"
49
66
  :key="index"
50
67
  :class="{
51
68
  selected: isSelected(option),
52
69
  disabled: isDisabled(option),
53
70
  'option-group': isOptionGroup(option),
54
71
  }"
55
- @click="onOptionClick(option)"
72
+ @click="selectOption(option)"
73
+ :style="{ fontSize }"
56
74
  >
57
75
  {{ optionLabel(option) }}
58
76
  </li>
@@ -64,7 +82,6 @@
64
82
 
65
83
  <script>
66
84
  import clickaway from "../../BIMDataDirectives/click-away.js";
67
- // Components
68
85
  import BIMDataIconChevron from "../BIMDataIcon/BIMDataIconStandalone/BIMDataIconChevron.vue";
69
86
 
70
87
  export default {
@@ -85,14 +102,18 @@ export default {
85
102
  },
86
103
  },
87
104
  props: {
88
- width: {
89
- type: [String, Number],
90
- },
105
+ width: [String, Number],
106
+ height: [String, Number],
107
+ fontSize: [String, Number],
91
108
  label: {
92
109
  type: String,
93
110
  default: null,
94
111
  },
95
- isLabel: {
112
+ placeholder: {
113
+ type: String,
114
+ default: null,
115
+ },
116
+ showLabel: {
96
117
  type: Boolean,
97
118
  default: true,
98
119
  },
@@ -100,22 +121,14 @@ export default {
100
121
  type: Array,
101
122
  default: () => [],
102
123
  },
103
- optionKey: {
104
- type: String,
105
- },
106
- optionLabelKey: {
107
- type: String,
108
- },
109
- modelValue: {
110
- type: [String, Object],
111
- },
124
+ optionKey: String,
125
+ optionLabelKey: String,
126
+ modelValue: [String, Object],
112
127
  nullValue: {
113
128
  type: Boolean,
114
129
  default: false,
115
130
  },
116
- nullLabel: {
117
- type: String,
118
- },
131
+ nullLabel: String,
119
132
  disabled: {
120
133
  type: Boolean,
121
134
  default: false,
@@ -136,13 +149,28 @@ export default {
136
149
  type: String,
137
150
  default: "default",
138
151
  validator: value =>
139
- ["default", "primary", "secondary", "tertiary", "tertiary-light", "quaternary", "white"].includes(value),
152
+ [
153
+ "default",
154
+ "primary",
155
+ "secondary",
156
+ "tertiary",
157
+ "tertiary-light",
158
+ "tertiary-darker",
159
+ "quaternary",
160
+ "white",
161
+ ].includes(value),
140
162
  },
141
163
  searchColor: {
142
164
  type: String,
143
165
  default: "primary",
144
166
  validator: value =>
145
- ["primary", "secondary", "tertiary", "quaternary", "quaternary-light"].includes(value),
167
+ [
168
+ "primary",
169
+ "secondary",
170
+ "tertiary",
171
+ "quaternary",
172
+ "quaternary-light",
173
+ ].includes(value),
146
174
  },
147
175
  isSelectedAndHoveredElementsRounded: {
148
176
  type: Boolean,
@@ -157,93 +185,70 @@ export default {
157
185
  };
158
186
  },
159
187
  computed: {
188
+ isModelValueNotEmpty() {
189
+ return this.modelValue != null;
190
+ },
191
+
192
+ shouldDisplayPlaceholder() {
193
+ return !this.showLabel && this.modelValue == null && !this.isOpen;
194
+ },
195
+
160
196
  displayedValue() {
161
197
  return this.optionLabel(this.modelValue);
162
198
  },
199
+
163
200
  filteredOptions() {
164
- if (this.searchText === "") {
165
- return this.options;
166
- } else {
167
- const lowerCaseSearchText = this.searchText.toLowerCase();
168
- if (this.optionLabelKey) {
169
- return this.options.filter(option =>
170
- option[this.optionLabelKey]
171
- .toLowerCase()
172
- .includes(lowerCaseSearchText),
173
- );
174
- }
175
- if (this.optionKey) {
176
- return this.options.filter(
177
- option =>
178
- option.optionGroup ||
179
- option[this.optionKey]
180
- .toLowerCase()
181
- .includes(lowerCaseSearchText),
182
- );
183
- } else {
184
- return this.options.filter(option =>
185
- option.toLowerCase().includes(lowerCaseSearchText),
186
- );
187
- }
188
- }
201
+ const lowerCaseSearchText = this.searchText.toLowerCase();
202
+ return this.options.filter(option => {
203
+ const label = this.optionLabel(option).toLowerCase();
204
+ return label.includes(lowerCaseSearchText);
205
+ });
189
206
  },
207
+
190
208
  isDark() {
191
209
  return this.darkThemeRef;
192
210
  },
193
211
  },
194
212
  methods: {
195
213
  toggle() {
196
- if (!this.disabled) {
197
- this.isOpen = !this.isOpen;
198
- }
214
+ if (!this.disabled) this.isOpen = !this.isOpen;
199
215
  },
216
+
200
217
  optionValue(option) {
201
- if (this.optionKey && option) {
202
- return option[this.optionKey];
203
- }
204
- return option;
218
+ return this.optionKey ? option[this.optionKey] : option;
205
219
  },
220
+
206
221
  optionLabel(option) {
207
- if (this.nullLabel && option == null) {
208
- return this.nullLabel;
209
- }
210
- if (this.optionLabelKey && option) {
211
- return option[this.optionLabelKey];
212
- }
213
- if (this.optionKey && option) {
214
- return option[this.optionKey];
215
- }
216
- return option;
222
+ if (option == null) return this.nullLabel ?? "";
223
+ if (typeof option !== "object") return option;
224
+ return this.optionLabelKey && option[this.optionLabelKey] != null
225
+ ? option[this.optionLabelKey]
226
+ : "";
217
227
  },
228
+
218
229
  isSelected(option) {
219
- const value = this.optionValue(option);
220
- const currentValue = this.optionValue(this.modelValue);
221
- return currentValue === value;
230
+ return this.optionValue(option) === this.optionValue(this.modelValue);
222
231
  },
232
+
223
233
  isDisabled(option) {
224
- return this.optionKey && option && option.disabled;
234
+ return option && option.disabled;
225
235
  },
236
+
226
237
  isOptionGroup(option) {
227
- return this.optionKey && option && option.optionGroup;
238
+ return option && option.optionGroup;
228
239
  },
240
+
229
241
  resetSearch() {
230
- if (this.clearSearchOnLeave) {
231
- this.searchText = "";
232
- }
233
- },
234
- onOptionClick(option) {
235
- if (this.optionKey && (option.disabled || option.optionGroup)) {
236
- return;
237
- }
238
- this.$emit("update:modelValue", option);
239
- this.resetSearch();
240
- this.isOpen = false;
242
+ if (this.clearSearchOnLeave) this.searchText = "";
241
243
  },
242
- onNullValueClick() {
243
- this.$emit("update:modelValue", null);
244
+
245
+ selectOption(option) {
246
+ if (option && (option.disabled || option.optionGroup)) return;
247
+ this.$emit("update:modelValue", option);
244
248
  this.resetSearch();
245
249
  this.isOpen = false;
246
250
  },
251
+
247
252
  away() {
248
253
  this.isOpen = false;
249
254
  this.resetSearch();
@@ -22,7 +22,7 @@
22
22
  ></div>
23
23
  <div
24
24
  class="bimdata-tree__node__content"
25
- :style="`padding-left: calc(var(--spacing-unit) * 2 * ${depth});`"
25
+ :style="`padding-left: calc(var(--indent-spacing) * ${depth});`"
26
26
  >
27
27
  <div class="bimdata-tree__node__content__arrow" @mousedown.stop>
28
28
  <div
@@ -206,6 +206,8 @@ export default Node;
206
206
 
207
207
  <style scoped lang="scss">
208
208
  .bimdata-tree__node {
209
+ --indent-spacing: calc(var(--spacing-unit) * 2);
210
+
209
211
  height: 32px;
210
212
  display: flex;
211
213
  align-items: center;