@budibase/bbui 1.0.81 → 1.0.82

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": "1.0.81",
4
+ "version": "1.0.82",
5
5
  "license": "MPL-2.0",
6
6
  "svelte": "src/index.js",
7
7
  "module": "dist/bbui.es.js",
@@ -38,7 +38,7 @@
38
38
  ],
39
39
  "dependencies": {
40
40
  "@adobe/spectrum-css-workflow-icons": "^1.2.1",
41
- "@budibase/string-templates": "^1.0.81",
41
+ "@budibase/string-templates": "^1.0.82",
42
42
  "@spectrum-css/actionbutton": "^1.0.1",
43
43
  "@spectrum-css/actiongroup": "^1.0.1",
44
44
  "@spectrum-css/avatar": "^3.0.2",
@@ -84,5 +84,5 @@
84
84
  "svelte-flatpickr": "^3.2.3",
85
85
  "svelte-portal": "^1.0.0"
86
86
  },
87
- "gitHead": "60fae11087000f6e76be33e7b469776d323a871d"
87
+ "gitHead": "66b565b0712acc5a3df988b8e0108a90f0d094c8"
88
88
  }
@@ -57,3 +57,10 @@
57
57
  </div>
58
58
  </div>
59
59
  {/if}
60
+
61
+ <style>
62
+ .spectrum-Toast {
63
+ pointer-events: all;
64
+ width: 100%;
65
+ }
66
+ </style>
@@ -0,0 +1,31 @@
1
+ <script>
2
+ import "@spectrum-css/toast/dist/index-vars.css"
3
+ import Portal from "svelte-portal"
4
+ import { banner } from "../Stores/banner"
5
+ import Banner from "./Banner.svelte"
6
+ import { fly } from "svelte/transition"
7
+ </script>
8
+
9
+ <Portal target=".banner-container">
10
+ <div class="banner">
11
+ {#if $banner.message}
12
+ <div transition:fly={{ y: -30 }}>
13
+ <Banner
14
+ type={$banner.type}
15
+ extraButtonText={$banner.extraButtonText}
16
+ extraButtonAction={$banner.extraButtonAction}
17
+ on:change={$banner.onChange}
18
+ >
19
+ {$banner.message}
20
+ </Banner>
21
+ </div>
22
+ {/if}
23
+ </div>
24
+ </Portal>
25
+
26
+ <style>
27
+ .banner {
28
+ pointer-events: none;
29
+ width: 100%;
30
+ }
31
+ </style>
@@ -0,0 +1,37 @@
1
+ import { writable } from "svelte/store"
2
+
3
+ export function createBannerStore() {
4
+ const DEFAULT_CONFIG = {}
5
+
6
+ const banner = writable(DEFAULT_CONFIG)
7
+
8
+ const show = async (
9
+ // eslint-disable-next-line
10
+ config = { message, type, extraButtonText, extraButtonAction, onChange }
11
+ ) => {
12
+ banner.update(store => {
13
+ return {
14
+ ...store,
15
+ ...config,
16
+ }
17
+ })
18
+ }
19
+
20
+ const showStatus = async () => {
21
+ const config = {
22
+ message: "Some systems are experiencing issues",
23
+ type: "negative",
24
+ extraButtonText: "View Status",
25
+ extraButtonAction: () => window.open("https://status.budibase.com/"),
26
+ }
27
+
28
+ await show(config)
29
+ }
30
+
31
+ return {
32
+ subscribe: banner.subscribe,
33
+ showStatus,
34
+ }
35
+ }
36
+
37
+ export const banner = createBannerStore()
@@ -60,7 +60,7 @@ export const createNotificationStore = () => {
60
60
  }
61
61
 
62
62
  function id() {
63
- return "_" + Math.random().toString(36).substr(2, 9)
63
+ return "_" + Math.random().toString(36).slice(2, 9)
64
64
  }
65
65
 
66
66
  export const notifications = createNotificationStore()
@@ -68,7 +68,7 @@
68
68
  })
69
69
 
70
70
  function id() {
71
- return "_" + Math.random().toString(36).substr(2, 9)
71
+ return "_" + Math.random().toString(36).slice(2, 9)
72
72
  }
73
73
  </script>
74
74
 
package/src/index.js CHANGED
@@ -60,6 +60,7 @@ export { default as StatusLight } from "./StatusLight/StatusLight.svelte"
60
60
  export { default as ColorPicker } from "./ColorPicker/ColorPicker.svelte"
61
61
  export { default as InlineAlert } from "./InlineAlert/InlineAlert.svelte"
62
62
  export { default as Banner } from "./Banner/Banner.svelte"
63
+ export { default as BannerDisplay } from "./Banner/BannerDisplay.svelte"
63
64
  export { default as MarkdownEditor } from "./Markdown/MarkdownEditor.svelte"
64
65
  export { default as MarkdownViewer } from "./Markdown/MarkdownViewer.svelte"
65
66
  export { default as RichTextField } from "./Form/RichTextField.svelte"
@@ -84,6 +85,7 @@ export { default as clickOutside } from "./Actions/click_outside"
84
85
 
85
86
  // Stores
86
87
  export { notifications, createNotificationStore } from "./Stores/notifications"
88
+ export { banner } from "./Stores/banner"
87
89
 
88
90
  // Helpers
89
91
  export * as Helpers from "./helpers"