@budibase/bbui 1.0.212-alpha.12 → 1.0.212-alpha.13

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.212-alpha.12",
4
+ "version": "1.0.212-alpha.13",
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.212-alpha.12",
41
+ "@budibase/string-templates": "^1.0.212-alpha.13",
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": "2a15345a18bfeb1764cc1cd15a67fa3f881f8d9d"
87
+ "gitHead": "1b460f45a10f98573cb9fe7ca5269550155c5bed"
88
88
  }
@@ -13,6 +13,7 @@
13
13
  export let size = "M"
14
14
  export let active = false
15
15
  export let fullWidth = false
16
+ export let noPadding = false
16
17
 
17
18
  function longPress(element) {
18
19
  if (!longPressable) return
@@ -41,6 +42,7 @@
41
42
  class:spectrum-ActionButton--quiet={quiet}
42
43
  class:spectrum-ActionButton--emphasized={emphasized}
43
44
  class:is-selected={selected}
45
+ class:noPadding
44
46
  class:fullWidth
45
47
  class="spectrum-ActionButton spectrum-ActionButton--size{size}"
46
48
  class:active
@@ -80,4 +82,8 @@
80
82
  .active svg {
81
83
  color: var(--spectrum-global-color-blue-600);
82
84
  }
85
+ .noPadding {
86
+ padding: 0;
87
+ min-width: 0;
88
+ }
83
89
  </style>
@@ -1,15 +1,20 @@
1
1
  <script>
2
+ import { ActionButton } from "../"
3
+
2
4
  import { createEventDispatcher } from "svelte"
3
5
 
4
6
  export let type = "info"
5
7
  export let icon = "Info"
6
8
  export let message = ""
7
9
  export let dismissable = false
10
+ export let actionMessage = null
11
+ export let action = null
12
+ export let wide = false
8
13
 
9
14
  const dispatch = createEventDispatcher()
10
15
  </script>
11
16
 
12
- <div class="spectrum-Toast spectrum-Toast--{type}">
17
+ <div class="spectrum-Toast spectrum-Toast--{type}" class:wide>
13
18
  {#if icon}
14
19
  <svg
15
20
  class="spectrum-Icon spectrum-Icon--sizeM spectrum-Toast-typeIcon"
@@ -19,8 +24,13 @@
19
24
  <use xlink:href="#spectrum-icon-18-{icon}" />
20
25
  </svg>
21
26
  {/if}
22
- <div class="spectrum-Toast-body">
27
+ <div class="spectrum-Toast-body" class:actionBody={!!action}>
23
28
  <div class="spectrum-Toast-content">{message || ""}</div>
29
+ {#if action}
30
+ <ActionButton quiet emphasized on:click={action}>
31
+ <div style="color: white; font-weight: 600;">{actionMessage}</div>
32
+ </ActionButton>
33
+ {/if}
24
34
  </div>
25
35
  {#if dismissable}
26
36
  <div class="spectrum-Toast-buttons">
@@ -46,4 +56,15 @@
46
56
  .spectrum-Toast {
47
57
  pointer-events: all;
48
58
  }
59
+
60
+ .wide {
61
+ width: 100%;
62
+ }
63
+
64
+ .actionBody {
65
+ justify-content: space-between;
66
+ display: flex;
67
+ width: 100%;
68
+ align-items: center;
69
+ }
49
70
  </style>
@@ -8,13 +8,15 @@
8
8
 
9
9
  <Portal target=".modal-container">
10
10
  <div class="notifications">
11
- {#each $notifications as { type, icon, message, id, dismissable } (id)}
11
+ {#each $notifications as { type, icon, message, id, dismissable, action, wide } (id)}
12
12
  <div transition:fly={{ y: -30 }}>
13
13
  <Notification
14
14
  {type}
15
15
  {icon}
16
16
  {message}
17
17
  {dismissable}
18
+ {action}
19
+ {wide}
18
20
  on:dismiss={() => notifications.dismiss(id)}
19
21
  />
20
22
  </div>
@@ -20,7 +20,16 @@ export const createNotificationStore = () => {
20
20
  setTimeout(() => (block = false), timeout)
21
21
  }
22
22
 
23
- const send = (message, type = "default", icon = "", autoDismiss = true) => {
23
+ const send = (
24
+ message,
25
+ {
26
+ type = "default",
27
+ icon = "",
28
+ autoDismiss = true,
29
+ action = null,
30
+ wide = false,
31
+ }
32
+ ) => {
24
33
  if (block) {
25
34
  return
26
35
  }
@@ -28,7 +37,15 @@ export const createNotificationStore = () => {
28
37
  _notifications.update(state => {
29
38
  return [
30
39
  ...state,
31
- { id: _id, type, message, icon, dismissable: !autoDismiss },
40
+ {
41
+ id: _id,
42
+ type,
43
+ message,
44
+ icon,
45
+ dismissable: !autoDismiss,
46
+ action,
47
+ wide,
48
+ },
32
49
  ]
33
50
  })
34
51
  if (autoDismiss) {
@@ -50,10 +67,11 @@ export const createNotificationStore = () => {
50
67
  return {
51
68
  subscribe,
52
69
  send,
53
- info: msg => send(msg, "info", "Info"),
54
- error: msg => send(msg, "error", "Alert", false),
55
- warning: msg => send(msg, "warning", "Alert"),
56
- success: msg => send(msg, "success", "CheckmarkCircle"),
70
+ info: msg => send(msg, { type: "info", icon: "Info" }),
71
+ error: msg =>
72
+ send(msg, { type: "error", icon: "Alert", autoDismiss: false }),
73
+ warning: msg => send(msg, { type: "warning", icon: "Alert" }),
74
+ success: msg => send(msg, { type: "success", icon: "CheckmarkCircle" }),
57
75
  blockNotifications,
58
76
  dismiss: dismissNotification,
59
77
  }
@@ -37,6 +37,7 @@
37
37
  export let autoSortColumns = true
38
38
  export let compact = false
39
39
  export let customPlaceholder = false
40
+ export let placeholderText = "No rows found"
40
41
 
41
42
  const dispatch = createEventDispatcher()
42
43
 
@@ -405,7 +406,7 @@
405
406
  >
406
407
  <use xlink:href="#spectrum-icon-18-Table" />
407
408
  </svg>
408
- <div>No rows found</div>
409
+ <div>{placeholderText}</div>
409
410
  </div>
410
411
  {/if}
411
412
  </div>