@bimdata/design-system 3.0.0-beta.46 → 3.0.0-beta.47

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.
Files changed (30) hide show
  1. package/package.json +7 -7
  2. package/src/BIMDataComponents/BIMDataAvatar/BIMDataAvatar.vue +4 -9
  3. package/src/BIMDataComponents/BIMDataCheckbox/BIMDataCheckbox.vue +3 -9
  4. package/src/BIMDataComponents/BIMDataColorSelector/BIMDataColorSelector.vue +2 -11
  5. package/src/BIMDataComponents/BIMDataDatePicker/BIMDataDatePicker.vue +2 -10
  6. package/src/BIMDataComponents/BIMDataDatePicker/components/DateInput.vue +3 -11
  7. package/src/BIMDataComponents/BIMDataDropdownList/BIMDataDropdownList.vue +2 -9
  8. package/src/BIMDataComponents/BIMDataDropdownMenu/BIMDataDropdownMenu.vue +7 -10
  9. package/src/BIMDataComponents/BIMDataIcon/BIMDataIcon.vue +3 -10
  10. package/src/BIMDataComponents/BIMDataIcon/Icon.vue +3 -10
  11. package/src/BIMDataComponents/BIMDataInfobox/BIMDataInfobox.vue +6 -6
  12. package/src/BIMDataComponents/BIMDataInput/BIMDataInput.vue +3 -9
  13. package/src/BIMDataComponents/BIMDataMenu/BIMDataMenu.vue +3 -13
  14. package/src/BIMDataComponents/BIMDataMenuInline/BIMDataMenuInline.vue +2 -9
  15. package/src/BIMDataComponents/BIMDataNavigation/BIMDataNavigation.vue +2 -11
  16. package/src/BIMDataComponents/BIMDataPaginatedList/BIMDataPaginatedList.vue +2 -9
  17. package/src/BIMDataComponents/BIMDataPagination/BIMDataPagination.vue +2 -9
  18. package/src/BIMDataComponents/BIMDataRadio/BIMDataRadio.vue +4 -10
  19. package/src/BIMDataComponents/BIMDataSafeZoneInline/BIMDataSafeZoneInline.vue +6 -12
  20. package/src/BIMDataComponents/BIMDataSearchAutocomplete/BIMDataSearchAutocomplete.vue +6 -10
  21. package/src/BIMDataComponents/BIMDataSelect/BIMDataSelectMulti.vue +2 -9
  22. package/src/BIMDataComponents/BIMDataSelect/BIMDataSelectSingle.vue +2 -10
  23. package/src/BIMDataComponents/BIMDataSlider/BIMDataSlider.vue +4 -12
  24. package/src/BIMDataComponents/BIMDataTable/BIMDataTable.vue +4 -5
  25. package/src/BIMDataComponents/BIMDataTabs/BIMDataTabs.vue +2 -9
  26. package/src/BIMDataComponents/BIMDataText/BIMDataText.vue +10 -11
  27. package/src/BIMDataComponents/BIMDataTextarea/BIMDataTextarea.vue +4 -12
  28. package/src/BIMDataComponents/BIMDataToggle/BIMDataToggle.vue +3 -9
  29. package/src/BIMDataComponents/mixins/darkTheme.js +45 -0
  30. package/src/BIMDataComponents/mixins/useDarkTheme.js +38 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bimdata/design-system",
3
- "version": "3.0.0-beta.46",
3
+ "version": "3.0.0-beta.47",
4
4
  "type": "module",
5
5
  "main": "./src/BIMDataComponents/index.js",
6
6
  "module": "./src/BIMDataComponents/index.js",
@@ -21,21 +21,21 @@
21
21
  "@semantic-release/changelog": "^6.0.3",
22
22
  "@semantic-release/commit-analyzer": "^13.0.1",
23
23
  "@semantic-release/git": "^10.0.1",
24
- "@semantic-release/github": "^12.0.8",
24
+ "@semantic-release/github": "^12.0.9",
25
25
  "@semantic-release/npm": "^13.1.5",
26
26
  "@semantic-release/release-notes-generator": "^14.1.1",
27
27
  "@vitejs/plugin-vue": "^6.0.7",
28
28
  "conventional-changelog-eslint": "^6.1.0",
29
- "eslint": "^10.4.1",
29
+ "eslint": "^10.7.0",
30
30
  "eslint-config-prettier": "^10.1.8",
31
31
  "eslint-plugin-prettier": "^5.5.6",
32
32
  "eslint-plugin-vue": "^10.9.2",
33
- "prettier": "^3.8.3",
33
+ "prettier": "^3.9.5",
34
34
  "prismjs": "^1.30.0",
35
35
  "sass-embedded": "^1.100.0",
36
- "semantic-release": "^25.0.3",
37
- "vite": "^8.0.16",
38
- "vue": "^3.5.35",
36
+ "semantic-release": "^25.0.7",
37
+ "vite": "^8.1.4",
38
+ "vue": "^3.5.39",
39
39
  "vue-router": "^5.1.0",
40
40
  "vue3-clipboard": "^1.0.0"
41
41
  },
@@ -25,12 +25,6 @@ import { computed } from "vue";
25
25
  import BIMDataIconUser from "../BIMDataIcon/BIMDataIconStandalone/BIMDataIconUser.vue";
26
26
 
27
27
  export default {
28
- inject: {
29
- darkThemeRef: {
30
- from: "BIMDATA_DESIGN_SYSTEM_DARK_THEME",
31
- default: () => ({ value: false }),
32
- },
33
- },
34
28
  props: {
35
29
  user: {
36
30
  type: Object,
@@ -39,7 +33,7 @@ export default {
39
33
  size: {
40
34
  type: [Number, String],
41
35
  default: 32,
42
- validate: (value) => value >= 32,
36
+ validate: value => value >= 32,
43
37
  },
44
38
  initialsSize: {
45
39
  type: [Number, String],
@@ -47,7 +41,8 @@ export default {
47
41
  color: {
48
42
  type: String,
49
43
  default: "primary",
50
- validate: (value) => ["primary", "secondary", "silver-light"].includes(value),
44
+ validate: value =>
45
+ ["primary", "secondary", "silver-light"].includes(value),
51
46
  },
52
47
  },
53
48
  setup(props) {
@@ -55,7 +50,7 @@ export default {
55
50
  (
56
51
  `${props.user.firstname?.[0] ?? ""}` +
57
52
  `${props.user.lastname?.[0] ?? ""}`
58
- ).toUpperCase()
53
+ ).toUpperCase(),
59
54
  );
60
55
 
61
56
  return {
@@ -14,15 +14,12 @@
14
14
  </template>
15
15
 
16
16
  <script>
17
+ import darkThemeMixin from "../mixins/darkTheme.js";
18
+
17
19
  export default {
18
20
  name: "BIMDataCheckbox",
19
21
  inheritAttrs: false,
20
- inject: {
21
- darkThemeRef: {
22
- from: "BIMDATA_DESIGN_SYSTEM_DARK_THEME",
23
- default: () => ({ value: false }),
24
- },
25
- },
22
+ mixins: [darkThemeMixin],
26
23
  props: {
27
24
  text: {
28
25
  type: String,
@@ -76,9 +73,6 @@ export default {
76
73
  height: `clamp(14px, calc(${size} * 1.1), 20px)`,
77
74
  };
78
75
  },
79
- isDark() {
80
- return this.darkThemeRef;
81
- },
82
76
  },
83
77
  methods: {
84
78
  onClick() {
@@ -23,6 +23,7 @@
23
23
  <script>
24
24
  import { colors } from "./colors.js";
25
25
  import BIMDataCard from "../BIMDataCard/BIMDataCard.vue";
26
+ import darkThemeMixin from "../mixins/darkTheme.js";
26
27
 
27
28
  const colorLines = Object.entries(colors).reduce((acc, cur, i) => {
28
29
  if (i % 5 === 0) {
@@ -37,12 +38,7 @@ export default {
37
38
  components: {
38
39
  BIMDataCard,
39
40
  },
40
- inject: {
41
- darkThemeRef: {
42
- from: "BIMDATA_DESIGN_SYSTEM_DARK_THEME",
43
- default: () => ({ value: false }),
44
- },
45
- },
41
+ mixins: [darkThemeMixin],
46
42
  props: {
47
43
  modelValue: {
48
44
  type: String,
@@ -56,11 +52,6 @@ export default {
56
52
  colorLines,
57
53
  };
58
54
  },
59
- computed: {
60
- isDark() {
61
- return this.darkThemeRef;
62
- },
63
- }
64
55
  };
65
56
  </script>
66
57
 
@@ -187,6 +187,7 @@ import DisabledDate from "./utils/DisabledDate.js";
187
187
  import inputProps from "./mixins/inputProps.vue";
188
188
  import makeDateUtils from "./utils/DateUtils.js";
189
189
  import navMixin from "./mixins/navMixin.vue";
190
+ import darkThemeMixin from "../mixins/darkTheme.js";
190
191
  import PickerDay from "./components/PickerDay.vue";
191
192
  import PickerMonth from "./components/PickerMonth.vue";
192
193
  import PickerYear from "./components/PickerYear.vue";
@@ -210,17 +211,11 @@ export default {
210
211
  PickerMonth,
211
212
  PickerYear,
212
213
  },
213
- mixins: [inputProps, navMixin],
214
+ mixins: [inputProps, navMixin, darkThemeMixin],
214
215
  model: {
215
216
  prop: "modelValue",
216
217
  event: "update:modelValue",
217
218
  },
218
- inject: {
219
- darkThemeRef: {
220
- from: "BIMDATA_DESIGN_SYSTEM_DARK_THEME",
221
- default: () => ({ value: false }),
222
- },
223
- },
224
219
  props: {
225
220
  autoCloseRange: {
226
221
  type: Boolean,
@@ -444,9 +439,6 @@ export default {
444
439
  translation() {
445
440
  return this.language;
446
441
  },
447
- isDark() {
448
- return this.darkThemeRef;
449
- },
450
442
  },
451
443
  watch: {
452
444
  disabledDates: {
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div :class="{ 'not-empty': formattedValue, 'dark': isDark }">
2
+ <div :class="{ 'not-empty': formattedValue, dark: isDark }">
3
3
  <slot name="beforeDateInput" />
4
4
  <!-- Calendar Button -->
5
5
  <button
@@ -76,17 +76,12 @@ import BIMDataButton from "../../BIMDataButton/BIMDataButton.vue";
76
76
 
77
77
  import makeDateUtils from "../utils/DateUtils.js";
78
78
  import inputProps from "../mixins/inputProps.vue";
79
+ import darkThemeMixin from "../../mixins/darkTheme.js";
79
80
 
80
81
  export default {
81
82
  name: "DateInput",
82
83
  components: { BIMDataIconDelete, BIMDataButton },
83
- mixins: [inputProps],
84
- inject: {
85
- darkThemeRef: {
86
- from: "BIMDATA_DESIGN_SYSTEM_DARK_THEME",
87
- default: () => ({ value: false }),
88
- },
89
- },
84
+ mixins: [inputProps, darkThemeMixin],
90
85
  props: {
91
86
  isOpen: {
92
87
  type: Boolean,
@@ -128,9 +123,6 @@ export default {
128
123
 
129
124
  return this.formatDate(this.selectedDate);
130
125
  },
131
- isDark() {
132
- return this.darkThemeRef;
133
- },
134
126
  },
135
127
  watch: {
136
128
  showCalendarOnFocus: {
@@ -74,6 +74,7 @@ import clickaway from "../../BIMDataDirectives/click-away.js";
74
74
  import BIMDataIconChevron from "../BIMDataIcon/BIMDataIconStandalone/BIMDataIconChevron.vue";
75
75
  import BIMDataPaginatedList from "../BIMDataPaginatedList/BIMDataPaginatedList.vue";
76
76
  import BIMDataButton from "../BIMDataButton/BIMDataButton.vue";
77
+ import darkThemeMixin from "../mixins/darkTheme.js";
77
78
 
78
79
  export default {
79
80
  components: {
@@ -82,12 +83,7 @@ export default {
82
83
  BIMDataButton,
83
84
  },
84
85
  directives: { clickaway },
85
- inject: {
86
- darkThemeRef: {
87
- from: "BIMDATA_DESIGN_SYSTEM_DARK_THEME",
88
- default: () => ({ value: false }),
89
- },
90
- },
86
+ mixins: [darkThemeMixin],
91
87
  props: {
92
88
  list: {
93
89
  type: Array,
@@ -186,9 +182,6 @@ export default {
186
182
  );
187
183
  }
188
184
  },
189
- isDark() {
190
- return this.darkThemeRef;
191
- },
192
185
  },
193
186
  methods: {
194
187
  onHeaderClick() {
@@ -1,5 +1,9 @@
1
1
  <template>
2
- <div class="bimdata-dropdown" v-clickaway="away" :class="{dark: isDark, border}">
2
+ <div
3
+ class="bimdata-dropdown"
4
+ v-clickaway="away"
5
+ :class="{ dark: isDark, border }"
6
+ >
3
7
  <div
4
8
  class="bimdata-dropdown__content"
5
9
  :class="{ active: displayed, disabled }"
@@ -75,16 +79,12 @@
75
79
  import clickaway from "../../BIMDataDirectives/click-away.js";
76
80
  import BIMDataIconChevron from "../BIMDataIcon/BIMDataIconStandalone/BIMDataIconChevron.vue";
77
81
  import BIMDataTextbox from "../../BIMDataComponents/BIMDataTextbox/BIMDataTextbox.vue";
82
+ import darkThemeMixin from "../mixins/darkTheme.js";
78
83
 
79
84
  export default {
80
85
  directives: { clickaway },
81
86
  components: { BIMDataIconChevron, BIMDataTextbox },
82
- inject: {
83
- darkThemeRef: {
84
- from: "BIMDATA_DESIGN_SYSTEM_DARK_THEME",
85
- default: () => ({ value: false }),
86
- },
87
- },
87
+ mixins: [darkThemeMixin],
88
88
  props: {
89
89
  disabled: {
90
90
  type: Boolean,
@@ -142,9 +142,6 @@ export default {
142
142
  visibility: this.menuHeader ? "visible" : "hidden",
143
143
  };
144
144
  },
145
- isDark() {
146
- return this.darkThemeRef;
147
- },
148
145
  },
149
146
  watch: {
150
147
  header: {
@@ -11,6 +11,7 @@
11
11
 
12
12
  <script>
13
13
  import iconsColors from "../../assets/iconsColors.js";
14
+ import darkThemeMixin from "../mixins/darkTheme.js";
14
15
 
15
16
  const sizeToPixel = {
16
17
  xxxs: 10,
@@ -26,12 +27,7 @@ const sizeToPixel = {
26
27
 
27
28
  export default {
28
29
  name: "BIMDataIcon",
29
- inject: {
30
- darkThemeRef: {
31
- from: "BIMDATA_DESIGN_SYSTEM_DARK_THEME",
32
- default: () => ({ value: false }),
33
- },
34
- },
30
+ mixins: [darkThemeMixin],
35
31
  props: {
36
32
  name: {
37
33
  type: String,
@@ -81,7 +77,7 @@ export default {
81
77
  "icon-stroke": this.stroke,
82
78
  [`icon-fill--${this.color}`]: this.fill && this.color,
83
79
  [`icon-stroke--${this.color}`]: this.stroke && this.color,
84
- "dark": this.isDark
80
+ dark: this.isDark,
85
81
  };
86
82
  },
87
83
  style() {
@@ -96,9 +92,6 @@ export default {
96
92
  };
97
93
  return style;
98
94
  },
99
- isDark() {
100
- return this.darkThemeRef;
101
- },
102
95
  },
103
96
  methods: {
104
97
  getPixelSize() {
@@ -15,6 +15,7 @@
15
15
 
16
16
  <script>
17
17
  import iconsColors from "../../assets/iconsColors.js";
18
+ import darkThemeMixin from "../mixins/darkTheme.js";
18
19
 
19
20
  const sizeToPixel = {
20
21
  xxxs: 10,
@@ -30,12 +31,7 @@ const sizeToPixel = {
30
31
 
31
32
  export default {
32
33
  name: "BIMDataIcon",
33
- inject: {
34
- darkThemeRef: {
35
- from: "BIMDATA_DESIGN_SYSTEM_DARK_THEME",
36
- default: () => ({ value: false }),
37
- },
38
- },
34
+ mixins: [darkThemeMixin],
39
35
  props: {
40
36
  color: {
41
37
  type: String,
@@ -81,7 +77,7 @@ export default {
81
77
  "icon-stroke": this.stroke,
82
78
  [`icon-fill--${this.color}`]: this.fill && this.color,
83
79
  [`icon-stroke--${this.color}`]: this.stroke && this.color,
84
- "dark": this.isDark
80
+ dark: this.isDark,
85
81
  };
86
82
  },
87
83
  style() {
@@ -96,9 +92,6 @@ export default {
96
92
  };
97
93
  return style;
98
94
  },
99
- isDark() {
100
- return this.darkThemeRef;
101
- },
102
95
  },
103
96
  methods: {
104
97
  getPixelSize() {
@@ -16,8 +16,9 @@
16
16
  </template>
17
17
 
18
18
  <script setup>
19
- import { inject, computed } from "vue";
20
- defineProps({
19
+ import { useDarkTheme, darkProp } from "../mixins/useDarkTheme.js";
20
+
21
+ const props = defineProps({
21
22
  text: {
22
23
  type: String,
23
24
  default: "",
@@ -40,11 +41,10 @@ defineProps({
40
41
  ].includes(v),
41
42
  default: "neutral",
42
43
  },
44
+ dark: darkProp,
43
45
  });
44
- const darkThemeRef = inject("BIMDATA_DESIGN_SYSTEM_DARK_THEME", {
45
- value: false,
46
- });
47
- const isDark = computed(() => darkThemeRef?.value);
46
+
47
+ const isDark = useDarkTheme(props);
48
48
  </script>
49
49
 
50
50
  <style scoped>
@@ -62,19 +62,16 @@
62
62
  </template>
63
63
 
64
64
  <script>
65
+ import darkThemeMixin from "../mixins/darkTheme.js";
66
+
65
67
  let uuid = 0;
66
68
 
67
69
  export default {
70
+ mixins: [darkThemeMixin],
68
71
  model: {
69
72
  prop: "modelValue",
70
73
  event: "update:modelValue",
71
74
  },
72
- inject: {
73
- darkThemeRef: {
74
- from: "BIMDATA_DESIGN_SYSTEM_DARK_THEME",
75
- default: () => ({ value: false }),
76
- },
77
- },
78
75
  props: {
79
76
  autocomplete: {
80
77
  type: Boolean,
@@ -164,9 +161,6 @@ export default {
164
161
  // Si `label` est vide, utilise la valeur de `placeholder`
165
162
  return this.label || this.placeholder;
166
163
  },
167
- isDark() {
168
- return this.darkThemeRef;
169
- },
170
164
  computedBackgroundColor() {
171
165
  return this.isDark ? this.backgroundColorDark : this.backgroundColor;
172
166
  },
@@ -24,8 +24,7 @@
24
24
  @mouseleave="hoveredItemKey = null"
25
25
  :style="{
26
26
  color: item.color,
27
- 'background-color':
28
- hoveredItemKey === item.key ? item.background : '',
27
+ 'background-color': hoveredItemKey === item.key ? item.background : '',
29
28
  }"
30
29
  >
31
30
  <div v-if="item.groupTitle" class="bimdata-menu__item__title">
@@ -82,6 +81,7 @@
82
81
  import clickaway from "../../BIMDataDirectives/click-away.js";
83
82
  import BIMDataIconChevron from "../../BIMDataComponents/BIMDataIcon/BIMDataIconStandalone/BIMDataIconChevron.vue";
84
83
  import BIMDataTextbox from "../../BIMDataComponents/BIMDataTextbox/BIMDataTextbox.vue";
84
+ import darkThemeMixin from "../mixins/darkTheme.js";
85
85
 
86
86
  export default {
87
87
  directives: { clickaway },
@@ -89,12 +89,7 @@ export default {
89
89
  BIMDataIconChevron,
90
90
  BIMDataTextbox,
91
91
  },
92
- inject: {
93
- darkThemeRef: {
94
- from: "BIMDATA_DESIGN_SYSTEM_DARK_THEME",
95
- default: () => ({ value: false }),
96
- },
97
- },
92
+ mixins: [darkThemeMixin],
98
93
  props: {
99
94
  menuItems: {
100
95
  type: Array,
@@ -150,11 +145,6 @@ export default {
150
145
  this.hoveredItemKey = item.key;
151
146
  },
152
147
  },
153
- computed: {
154
- isDark() {
155
- return this.darkThemeRef;
156
- },
157
- },
158
148
  };
159
149
  </script>
160
150
 
@@ -47,6 +47,7 @@ import {
47
47
  BIMDataIconClose,
48
48
  BIMDataIconEllipsis,
49
49
  } from "../BIMDataIcon/BIMDataIconStandalone/index.js";
50
+ import darkThemeMixin from "../mixins/darkTheme.js";
50
51
 
51
52
  export default {
52
53
  directives: { clickaway },
@@ -55,12 +56,7 @@ export default {
55
56
  BIMDataIconClose,
56
57
  BIMDataIconEllipsis,
57
58
  },
58
- inject: {
59
- darkThemeRef: {
60
- from: "BIMDATA_DESIGN_SYSTEM_DARK_THEME",
61
- default: () => ({ value: false }),
62
- },
63
- },
59
+ mixins: [darkThemeMixin],
64
60
  props: {
65
61
  isSubmenuRight: {
66
62
  type: Boolean,
@@ -103,9 +99,6 @@ export default {
103
99
  }
104
100
  return `right: ${this.width}`;
105
101
  },
106
- isDark() {
107
- return this.darkThemeRef;
108
- },
109
102
  },
110
103
  methods: {
111
104
  away() {
@@ -74,6 +74,7 @@ import {
74
74
  BIMDataIconDoubleChevron,
75
75
  } from "../BIMDataIcon/BIMDataIconStandalone/index.js";
76
76
  import BIMDataButton from "../../BIMDataComponents/BIMDataButton/BIMDataButton.vue";
77
+ import darkThemeMixin from "../mixins/darkTheme.js";
77
78
 
78
79
  export default {
79
80
  components: {
@@ -81,12 +82,7 @@ export default {
81
82
  BIMDataIconDoubleChevron,
82
83
  BIMDataButton,
83
84
  },
84
- inject: {
85
- darkThemeRef: {
86
- from: "BIMDATA_DESIGN_SYSTEM_DARK_THEME",
87
- default: () => ({ value: false }),
88
- },
89
- },
85
+ mixins: [darkThemeMixin],
90
86
  props: {
91
87
  first: {
92
88
  type: Boolean,
@@ -126,11 +122,6 @@ export default {
126
122
  },
127
123
  },
128
124
  emits: ["first", "previous", "next", "last"],
129
- computed: {
130
- isDark() {
131
- return this.darkThemeRef;
132
- },
133
- },
134
125
  };
135
126
  </script>
136
127
 
@@ -41,18 +41,14 @@
41
41
  <script>
42
42
  import BIMDataPagination from "../BIMDataPagination/BIMDataPagination.vue";
43
43
  import BIMDataSpinner from "../BIMDataSpinner/BIMDataSpinner.vue";
44
+ import darkThemeMixin from "../mixins/darkTheme.js";
44
45
 
45
46
  export default {
46
47
  components: {
47
48
  BIMDataPagination,
48
49
  BIMDataSpinner,
49
50
  },
50
- inject: {
51
- darkThemeRef: {
52
- from: "BIMDATA_DESIGN_SYSTEM_DARK_THEME",
53
- default: () => ({ value: false }),
54
- },
55
- },
51
+ mixins: [darkThemeMixin],
56
52
  props: {
57
53
  list: {
58
54
  type: Array,
@@ -129,9 +125,6 @@ export default {
129
125
  !!this.backgroundColor && this.backgroundColor !== "var(--color-white)"
130
126
  );
131
127
  },
132
- isDark() {
133
- return this.darkThemeRef;
134
- },
135
128
  },
136
129
  watch: {
137
130
  list: {
@@ -33,18 +33,14 @@
33
33
  <script>
34
34
  import BIMDataButton from "../BIMDataButton/BIMDataButton.vue";
35
35
  import BIMDataNavigation from "../BIMDataNavigation/BIMDataNavigation.vue";
36
+ import darkThemeMixin from "../mixins/darkTheme.js";
36
37
 
37
38
  export default {
38
39
  components: {
39
40
  BIMDataNavigation,
40
41
  BIMDataButton,
41
42
  },
42
- inject: {
43
- darkThemeRef: {
44
- from: "BIMDATA_DESIGN_SYSTEM_DARK_THEME",
45
- default: () => ({ value: false }),
46
- },
47
- },
43
+ mixins: [darkThemeMixin],
48
44
  props: {
49
45
  length: {
50
46
  type: Number,
@@ -93,9 +89,6 @@ export default {
93
89
  !!this.backgroundColor && this.backgroundColor !== "var(--color-white)"
94
90
  );
95
91
  },
96
- isDark() {
97
- return this.darkThemeRef;
98
- },
99
92
  },
100
93
  methods: {
101
94
  firstPage() {
@@ -6,7 +6,7 @@
6
6
  disabled,
7
7
  'bimdata-radio--checked': checked,
8
8
  'bimdata-radio--big': big,
9
- dark: isDark
9
+ dark: isDark,
10
10
  }"
11
11
  :disabled="disabled"
12
12
  @click="onClick"
@@ -23,17 +23,14 @@
23
23
  </template>
24
24
 
25
25
  <script>
26
+ import darkThemeMixin from "../mixins/darkTheme.js";
27
+
26
28
  export default {
29
+ mixins: [darkThemeMixin],
27
30
  model: {
28
31
  prop: "modelValue",
29
32
  event: "update:modelValue",
30
33
  },
31
- inject: {
32
- darkThemeRef: {
33
- from: "BIMDATA_DESIGN_SYSTEM_DARK_THEME",
34
- default: () => ({ value: false }),
35
- },
36
- },
37
34
  props: {
38
35
  big: {
39
36
  type: Boolean,
@@ -57,9 +54,6 @@ export default {
57
54
  checked() {
58
55
  return this.modelValue === this.value;
59
56
  },
60
- isDark() {
61
- return this.darkThemeRef;
62
- },
63
57
  },
64
58
  methods: {
65
59
  onClick() {
@@ -17,7 +17,10 @@
17
17
  :color="isDark ? 'quaternary' : 'granite'"
18
18
  @click="$emit('cancel-delete')"
19
19
  >
20
- <BIMDataIconClose size="xxs" :color="isDark ? 'quaternary-lighter' : 'granite'" />
20
+ <BIMDataIconClose
21
+ size="xxs"
22
+ :color="isDark ? 'quaternary-lighter' : 'granite'"
23
+ />
21
24
  </BIMDataButton>
22
25
  </div>
23
26
  </template>
@@ -25,18 +28,14 @@
25
28
  <script>
26
29
  import BIMDataIconClose from "../BIMDataIcon/BIMDataIconStandalone/BIMDataIconClose.vue";
27
30
  import BIMDataButton from "../BIMDataButton/BIMDataButton.vue";
31
+ import darkThemeMixin from "../mixins/darkTheme.js";
28
32
 
29
33
  export default {
30
34
  components: {
31
35
  BIMDataIconClose,
32
36
  BIMDataButton,
33
37
  },
34
- inject: {
35
- darkThemeRef: {
36
- from: "BIMDATA_DESIGN_SYSTEM_DARK_THEME",
37
- default: () => ({ value: false }),
38
- },
39
- },
38
+ mixins: [darkThemeMixin],
40
39
  props: {
41
40
  reverse: {
42
41
  type: Boolean,
@@ -44,11 +43,6 @@ export default {
44
43
  },
45
44
  },
46
45
  emits: ["confirm-delete", "cancel-delete"],
47
- computed: {
48
- isDark() {
49
- return this.darkThemeRef;
50
- },
51
- }
52
46
  };
53
47
  </script>
54
48
 
@@ -2,7 +2,10 @@
2
2
  <div
3
3
  class="bimdata-search-autocomplete"
4
4
  v-clickaway="away"
5
- :class="[{ open: openResults, dark: isDark }, `bimdata-search-autocomplete--${color}`]"
5
+ :class="[
6
+ { open: openResults, dark: isDark },
7
+ `bimdata-search-autocomplete--${color}`,
8
+ ]"
6
9
  >
7
10
  <div class="bimdata-search-autocomplete__input flex items-center">
8
11
  <span class="bimdata-search-icon flex">
@@ -86,6 +89,7 @@ import {
86
89
  BIMDataIconSearch,
87
90
  } from "../BIMDataIcon/BIMDataIconStandalone/index.js";
88
91
  import BIMDataTextbox from "../../BIMDataComponents/BIMDataTextbox/BIMDataTextbox.vue";
92
+ import darkThemeMixin from "../mixins/darkTheme.js";
89
93
 
90
94
  export default {
91
95
  components: {
@@ -94,12 +98,7 @@ export default {
94
98
  BIMDataTextbox,
95
99
  },
96
100
  directives: { clickaway },
97
- inject: {
98
- darkThemeRef: {
99
- from: "BIMDATA_DESIGN_SYSTEM_DARK_THEME",
100
- default: () => ({ value: false }),
101
- },
102
- },
101
+ mixins: [darkThemeMixin],
103
102
  props: {
104
103
  items: {
105
104
  type: Array,
@@ -168,9 +167,6 @@ export default {
168
167
  this.search !== "" && this.results.length !== 0 && this.isOpen === true
169
168
  );
170
169
  },
171
- isDark() {
172
- return this.darkThemeRef;
173
- },
174
170
  },
175
171
  methods: {
176
172
  onChange() {
@@ -86,6 +86,7 @@ import clickaway from "../../BIMDataDirectives/click-away.js";
86
86
  // Components
87
87
  import BIMDataCheckbox from "../BIMDataCheckbox/BIMDataCheckbox.vue";
88
88
  import BIMDataIconChevron from "../BIMDataIcon/BIMDataIconStandalone/BIMDataIconChevron.vue";
89
+ import darkThemeMixin from "../mixins/darkTheme.js";
89
90
 
90
91
  export default {
91
92
  components: {
@@ -95,16 +96,11 @@ export default {
95
96
  directives: {
96
97
  clickaway,
97
98
  },
99
+ mixins: [darkThemeMixin],
98
100
  model: {
99
101
  prop: "modelValue",
100
102
  event: "update:modelValue",
101
103
  },
102
- inject: {
103
- darkThemeRef: {
104
- from: "BIMDATA_DESIGN_SYSTEM_DARK_THEME",
105
- default: () => ({ value: false }),
106
- },
107
- },
108
104
  props: {
109
105
  color: {
110
106
  type: String,
@@ -230,9 +226,6 @@ export default {
230
226
  }
231
227
  }
232
228
  },
233
- isDark() {
234
- return this.darkThemeRef;
235
- },
236
229
  },
237
230
  methods: {
238
231
  toggle() {
@@ -83,6 +83,7 @@
83
83
  <script>
84
84
  import clickaway from "../../BIMDataDirectives/click-away.js";
85
85
  import BIMDataIconChevron from "../BIMDataIcon/BIMDataIconStandalone/BIMDataIconChevron.vue";
86
+ import darkThemeMixin from "../mixins/darkTheme.js";
86
87
 
87
88
  export default {
88
89
  components: {
@@ -91,16 +92,11 @@ export default {
91
92
  directives: {
92
93
  clickaway,
93
94
  },
95
+ mixins: [darkThemeMixin],
94
96
  model: {
95
97
  prop: "modelValue",
96
98
  event: "update:modelValue",
97
99
  },
98
- inject: {
99
- darkThemeRef: {
100
- from: "BIMDATA_DESIGN_SYSTEM_DARK_THEME",
101
- default: () => ({ value: false }),
102
- },
103
- },
104
100
  props: {
105
101
  width: [String, Number],
106
102
  height: [String, Number],
@@ -204,10 +200,6 @@ export default {
204
200
  return label.includes(lowerCaseSearchText);
205
201
  });
206
202
  },
207
-
208
- isDark() {
209
- return this.darkThemeRef;
210
- },
211
203
  },
212
204
  methods: {
213
205
  toggle() {
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div class="bimdata-slider" :class="{dark: isDark}">
2
+ <div class="bimdata-slider" :class="{ dark: isDark }">
3
3
  <input
4
4
  ref="input"
5
5
  class="bimdata-slider-input"
@@ -22,13 +22,10 @@
22
22
  </template>
23
23
 
24
24
  <script>
25
+ import darkThemeMixin from "../mixins/darkTheme.js";
26
+
25
27
  export default {
26
- inject: {
27
- darkThemeRef: {
28
- from: "BIMDATA_DESIGN_SYSTEM_DARK_THEME",
29
- default: () => ({ value: false }),
30
- },
31
- },
28
+ mixins: [darkThemeMixin],
32
29
  props: {
33
30
  min: {
34
31
  type: [Number, String],
@@ -101,11 +98,6 @@ export default {
101
98
  this.tooltipPosition = `calc(${newVal}% + (${8 - newVal * 0.18}px))`;
102
99
  },
103
100
  },
104
- computed: {
105
- isDark() {
106
- return this.darkThemeRef;
107
- },
108
- },
109
101
  };
110
102
  </script>
111
103
 
@@ -164,9 +164,10 @@
164
164
  </template>
165
165
 
166
166
  <script>
167
- import { computed, inject, ref, watch, shallowReactive } from "vue";
167
+ import { computed, ref, watch, shallowReactive } from "vue";
168
168
  import { useRowSelection } from "./table-row-selection.js";
169
169
  import clickaway from "../../BIMDataDirectives/click-away.js";
170
+ import { useDarkTheme, darkProp } from "../mixins/useDarkTheme.js";
170
171
 
171
172
  // Components
172
173
  import BIMDataButton from "../BIMDataButton/BIMDataButton.vue";
@@ -234,6 +235,7 @@ export default {
234
235
  type: Function,
235
236
  default: () => false,
236
237
  },
238
+ dark: darkProp,
237
239
  },
238
240
  emits: [
239
241
  "update:selection",
@@ -245,10 +247,7 @@ export default {
245
247
  "row-drop",
246
248
  ],
247
249
  setup(props, { emit }) {
248
- const darkThemeRef = inject("BIMDATA_DESIGN_SYSTEM_DARK_THEME");
249
- const isDark = computed(() => {
250
- return darkThemeRef.value;
251
- });
250
+ const isDark = useDarkTheme(props);
252
251
  // Compute rows keys based on props values.
253
252
  const computedRows = computed(() =>
254
253
  props.rows.map((row, i) => ({ key: row[props.rowKey] ?? i, data: row })),
@@ -42,18 +42,14 @@
42
42
  <script>
43
43
  import BIMDataButton from "../BIMDataButton/BIMDataButton.vue";
44
44
  import BIMDataIconChevron from "../BIMDataIcon/BIMDataIconStandalone/BIMDataIconChevron.vue";
45
+ import darkThemeMixin from "../mixins/darkTheme.js";
45
46
 
46
47
  export default {
47
48
  components: {
48
49
  BIMDataButton,
49
50
  BIMDataIconChevron,
50
51
  },
51
- inject: {
52
- darkThemeRef: {
53
- from: "BIMDATA_DESIGN_SYSTEM_DARK_THEME",
54
- default: () => ({ value: false }),
55
- },
56
- },
52
+ mixins: [darkThemeMixin],
57
53
  props: {
58
54
  width: {
59
55
  type: [String, Number],
@@ -93,9 +89,6 @@ export default {
93
89
  tabWidth() {
94
90
  return Number.isNaN(+this.tabSize) ? this.tabSize : `${this.tabSize}px`;
95
91
  },
96
- isDark() {
97
- return this.darkThemeRef;
98
- },
99
92
  },
100
93
  watch: {
101
94
  tabs() {
@@ -1,17 +1,19 @@
1
1
  <template>
2
- <component :is="component" :style="style" :class="classes" class="bimdata-text">
2
+ <component
3
+ :is="component"
4
+ :style="style"
5
+ :class="classes"
6
+ class="bimdata-text"
7
+ >
3
8
  <slot></slot>
4
9
  </component>
5
10
  </template>
6
11
 
7
12
  <script>
13
+ import darkThemeMixin from "../mixins/darkTheme.js";
14
+
8
15
  export default {
9
- inject: {
10
- darkThemeRef: {
11
- from: "BIMDATA_DESIGN_SYSTEM_DARK_THEME",
12
- default: () => ({ value: false }),
13
- },
14
- },
16
+ mixins: [darkThemeMixin],
15
17
  props: {
16
18
  component: {
17
19
  type: String,
@@ -139,11 +141,8 @@ export default {
139
141
  }
140
142
  }
141
143
  },
142
- isDark() {
143
- return this.darkThemeRef;
144
- },
145
144
  },
146
145
  };
147
146
  </script>
148
147
 
149
- <style scoped src="./BIMDataText.css"></style>
148
+ <style scoped src="./BIMDataText.css"></style>
@@ -29,17 +29,14 @@
29
29
  </template>
30
30
 
31
31
  <script>
32
+ import darkThemeMixin from "../mixins/darkTheme.js";
33
+
32
34
  export default {
35
+ mixins: [darkThemeMixin],
33
36
  model: {
34
37
  prop: "modelValue",
35
38
  event: "update:modelValue",
36
39
  },
37
- inject: {
38
- darkThemeRef: {
39
- from: "BIMDATA_DESIGN_SYSTEM_DARK_THEME",
40
- default: () => ({ value: false }),
41
- },
42
- },
43
40
  props: {
44
41
  name: {
45
42
  type: [String, Number],
@@ -97,7 +94,7 @@ export default {
97
94
  successAndError => {
98
95
  if (successAndError)
99
96
  throw new Error("Textarea state cannot be both success and error.");
100
- }
97
+ },
101
98
  );
102
99
  },
103
100
  mounted() {
@@ -124,11 +121,6 @@ export default {
124
121
  }
125
122
  },
126
123
  },
127
- computed: {
128
- isDark() {
129
- return this.darkThemeRef;
130
- },
131
- },
132
124
  };
133
125
  </script>
134
126
 
@@ -17,17 +17,14 @@
17
17
  </template>
18
18
 
19
19
  <script>
20
+ import darkThemeMixin from "../mixins/darkTheme.js";
21
+
20
22
  export default {
23
+ mixins: [darkThemeMixin],
21
24
  model: {
22
25
  prop: "modelValue",
23
26
  event: "update:modelValue",
24
27
  },
25
- inject: {
26
- darkThemeRef: {
27
- from: "BIMDATA_DESIGN_SYSTEM_DARK_THEME",
28
- default: () => ({ value: false }),
29
- },
30
- },
31
28
  props: {
32
29
  disabled: {
33
30
  type: Boolean,
@@ -53,9 +50,6 @@ export default {
53
50
  this.$emit("update:modelValue", newValue);
54
51
  },
55
52
  },
56
- isDark() {
57
- return this.darkThemeRef;
58
- },
59
53
  },
60
54
  created() {
61
55
  // Math.random is random enough to avoid conflict
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Shared mixin that exposes a normalized `isDark` computed to every
3
+ * BIMData component.
4
+ *
5
+ * Resolution order:
6
+ * 1. If the component receives an explicit `dark` prop (true or false),
7
+ * that value wins — allowing a component to force light or dark
8
+ * independently from any surrounding provider.
9
+ * 2. Otherwise, fall back to the value provided through the
10
+ * `BIMDATA_DESIGN_SYSTEM_DARK_THEME` injection (a `Ref<boolean>` when
11
+ * the design-system plugin is properly wired).
12
+ * 3. When neither a prop nor a provider is set, the component renders
13
+ * in light mode (the default of the design-system).
14
+ *
15
+ * The prop uses `default: null` so we can distinguish between:
16
+ * - `<Comp />` → prop is null → follow the provider
17
+ * - `<Comp dark />` → prop is true → force dark
18
+ * - `<Comp :dark="false" />` → prop is false → force light
19
+ */
20
+ export default {
21
+ inject: {
22
+ darkThemeRef: {
23
+ from: "BIMDATA_DESIGN_SYSTEM_DARK_THEME",
24
+ default: null,
25
+ },
26
+ },
27
+ props: {
28
+ dark: {
29
+ type: Boolean,
30
+ default: null,
31
+ },
32
+ },
33
+ computed: {
34
+ isDark() {
35
+ if (this.dark === true) return true;
36
+ if (this.dark === false) return false;
37
+ const injected = this.darkThemeRef;
38
+ if (injected == null) return false;
39
+ if (typeof injected === "object" && "value" in injected) {
40
+ return !!injected.value;
41
+ }
42
+ return !!injected;
43
+ },
44
+ },
45
+ };
@@ -0,0 +1,38 @@
1
+ import { inject, computed } from "vue";
2
+
3
+ /**
4
+ * Composition API equivalent of the `darkTheme` mixin.
5
+ *
6
+ * Resolution order:
7
+ * 1. Explicit `dark` prop (true / false) wins.
8
+ * 2. Otherwise, injected `BIMDATA_DESIGN_SYSTEM_DARK_THEME` (Ref<boolean>).
9
+ * 3. Default is light mode.
10
+ *
11
+ * @param {object} props The component props object (must expose `dark`).
12
+ * @returns {import("vue").ComputedRef<boolean>} A reactive `isDark` flag.
13
+ */
14
+ export function useDarkTheme(props) {
15
+ const darkThemeRef = inject("BIMDATA_DESIGN_SYSTEM_DARK_THEME", null);
16
+
17
+ return computed(() => {
18
+ if (props?.dark === true) return true;
19
+ if (props?.dark === false) return false;
20
+ if (darkThemeRef == null) return false;
21
+ if (typeof darkThemeRef === "object" && "value" in darkThemeRef) {
22
+ return !!darkThemeRef.value;
23
+ }
24
+ return !!darkThemeRef;
25
+ });
26
+ }
27
+
28
+ /**
29
+ * Shared prop definition for the optional `dark` prop.
30
+ *
31
+ * Using `default: null` allows components to distinguish between
32
+ * "no prop provided" (fall back to the provider) and an explicit
33
+ * `false` (force light mode even inside a dark provider).
34
+ */
35
+ export const darkProp = {
36
+ type: Boolean,
37
+ default: null,
38
+ };