@budibase/bbui 2.6.19-alpha.3 → 2.6.19-alpha.30

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,7 +1,7 @@
1
1
  {
2
2
  "name": "@budibase/bbui",
3
3
  "description": "A UI solution used in the different Budibase projects.",
4
- "version": "2.6.19-alpha.3",
4
+ "version": "2.6.19-alpha.30",
5
5
  "license": "MPL-2.0",
6
6
  "svelte": "src/index.js",
7
7
  "module": "dist/bbui.es.js",
@@ -38,8 +38,8 @@
38
38
  ],
39
39
  "dependencies": {
40
40
  "@adobe/spectrum-css-workflow-icons": "1.2.1",
41
- "@budibase/shared-core": "2.6.19-alpha.3",
42
- "@budibase/string-templates": "2.6.19-alpha.3",
41
+ "@budibase/shared-core": "2.6.19-alpha.30",
42
+ "@budibase/string-templates": "2.6.19-alpha.30",
43
43
  "@spectrum-css/accordion": "3.0.24",
44
44
  "@spectrum-css/actionbutton": "1.0.1",
45
45
  "@spectrum-css/actiongroup": "1.0.1",
@@ -90,5 +90,19 @@
90
90
  "resolutions": {
91
91
  "loader-utils": "1.4.1"
92
92
  },
93
- "gitHead": "9a3ddfba7931018031a3160c4972119a8bf4a0ac"
93
+ "nx": {
94
+ "targets": {
95
+ "build": {
96
+ "dependsOn": [
97
+ {
98
+ "projects": [
99
+ "@budibase/string-templates"
100
+ ],
101
+ "target": "build"
102
+ }
103
+ ]
104
+ }
105
+ }
106
+ },
107
+ "gitHead": "c62ae2d9ea7f29de54c4cb6ef9a8f22e82eb8460"
94
108
  }
@@ -102,7 +102,9 @@
102
102
  margin-left: 0;
103
103
  transition: color ease-out 130ms;
104
104
  }
105
- .is-selected:not(.spectrum-ActionButton--emphasized):not(.spectrum-ActionButton--quiet) {
105
+ .is-selected:not(.spectrum-ActionButton--emphasized):not(
106
+ .spectrum-ActionButton--quiet
107
+ ) {
106
108
  background: var(--spectrum-global-color-gray-300);
107
109
  border-color: var(--spectrum-global-color-gray-500);
108
110
  }
@@ -13,10 +13,12 @@
13
13
  export let url = ""
14
14
  export let disabled = false
15
15
  export let initials = "JD"
16
+ export let color = null
16
17
 
17
18
  const DefaultColor = "#3aab87"
18
19
 
19
- $: color = getColor(initials)
20
+ $: avatarColor = color || getColor(initials)
21
+ $: style = getStyle(size, avatarColor)
20
22
 
21
23
  const getColor = initials => {
22
24
  if (!initials?.length) {
@@ -26,6 +28,12 @@
26
28
  const hue = ((code % 26) / 26) * 360
27
29
  return `hsl(${hue}, 50%, 50%)`
28
30
  }
31
+
32
+ const getStyle = (sizeKey, color) => {
33
+ const size = `var(${sizes.get(sizeKey)})`
34
+ const fontSize = `calc(${size} / 2)`
35
+ return `width:${size}; height:${size}; font-size:${fontSize}; background:${color};`
36
+ }
29
37
  </script>
30
38
 
31
39
  {#if url}
@@ -37,13 +45,7 @@
37
45
  style="width: var({sizes.get(size)}); height: var({sizes.get(size)});"
38
46
  />
39
47
  {:else}
40
- <div
41
- class="spectrum-Avatar"
42
- class:is-disabled={disabled}
43
- style="width: var({sizes.get(size)}); height: var({sizes.get(
44
- size
45
- )}); font-size: calc(var({sizes.get(size)}) / 2); background: {color};"
46
- >
48
+ <div class="spectrum-Avatar" class:is-disabled={disabled} {style}>
47
49
  {initials || ""}
48
50
  </div>
49
51
  {/if}