@budibase/bbui 1.0.217 → 1.0.219-alpha.1

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.217",
4
+ "version": "1.0.219-alpha.1",
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.217",
41
+ "@budibase/string-templates": "^1.0.219-alpha.1",
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": "8bc247cbba648c3c52b8a71ae7e5517f284f4bea"
87
+ "gitHead": "58d9fc1384c304fb9c442b7605745512ba4c70d9"
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>
@@ -14,6 +14,7 @@
14
14
  export let active = false
15
15
  export let tooltip = undefined
16
16
  export let dataCy
17
+ export let newStyles = false
17
18
 
18
19
  let showTooltip = false
19
20
  </script>
@@ -25,6 +26,7 @@
25
26
  class:spectrum-Button--warning={warning}
26
27
  class:spectrum-Button--overBackground={overBackground}
27
28
  class:spectrum-Button--quiet={quiet}
29
+ class:new-styles={newStyles}
28
30
  class:active
29
31
  class="spectrum-Button spectrum-Button--size{size.toUpperCase()}"
30
32
  {disabled}
@@ -93,4 +95,20 @@
93
95
  padding-left: var(--spacing-m);
94
96
  line-height: 0;
95
97
  }
98
+ .spectrum-Button--primary.new-styles {
99
+ background: var(--spectrum-global-color-gray-800);
100
+ border-color: transparent;
101
+ color: var(--spectrum-global-color-gray-50);
102
+ }
103
+ .spectrum-Button--primary.new-styles:hover {
104
+ background: var(--spectrum-global-color-gray-900);
105
+ }
106
+ .spectrum-Button--secondary.new-styles {
107
+ background: var(--spectrum-global-color-gray-200);
108
+ border-color: transparent;
109
+ color: var(--spectrum-global-color-gray-900);
110
+ }
111
+ .spectrum-Button--secondary.new-styles:hover {
112
+ background: var(--spectrum-global-color-gray-300);
113
+ }
96
114
  </style>
@@ -40,5 +40,6 @@
40
40
  on:change={onChange}
41
41
  on:pick
42
42
  on:type
43
+ on:blur
43
44
  />
44
45
  </Field>
@@ -18,23 +18,6 @@
18
18
  const dispatch = createEventDispatcher()
19
19
  let open = false
20
20
  let focus = false
21
- $: fieldText = getFieldText(value, options, placeholder)
22
-
23
- const getFieldText = (value, options, placeholder) => {
24
- // Always use placeholder if no value
25
- if (value == null || value === "") {
26
- return placeholder || "Choose an option or type"
27
- }
28
-
29
- // Wait for options to load if there is a value but no options
30
- if (!options?.length) {
31
- return ""
32
- }
33
-
34
- // Render the label if the selected option is found, otherwise raw value
35
- const selected = options.find(option => getOptionValue(option) === value)
36
- return selected ? getOptionLabel(selected) : value
37
- }
38
21
 
39
22
  const selectOption = value => {
40
23
  dispatch("change", value)
@@ -69,7 +52,10 @@
69
52
  {id}
70
53
  type="text"
71
54
  on:focus={() => (focus = true)}
72
- on:blur={() => (focus = false)}
55
+ on:blur={() => {
56
+ focus = false
57
+ dispatch("blur")
58
+ }}
73
59
  on:change={onType}
74
60
  value={value || ""}
75
61
  placeholder={placeholder || ""}
@@ -199,6 +199,7 @@
199
199
  }
200
200
  .spectrum-Picker {
201
201
  width: 100%;
202
+ box-shadow: none;
202
203
  }
203
204
  .spectrum-Picker-label:not(.auto-width) {
204
205
  overflow: hidden;
@@ -112,4 +112,8 @@
112
112
  .spectrum-Textfield {
113
113
  width: 100%;
114
114
  }
115
+ input:disabled {
116
+ color: var(--spectrum-global-color-gray-600) !important;
117
+ -webkit-text-fill-color: var(--spectrum-global-color-gray-600) !important;
118
+ }
115
119
  </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
  }
@@ -26,12 +26,20 @@
26
26
  array: ArrayRenderer,
27
27
  internal: InternalRenderer,
28
28
  }
29
- $: type = schema?.type ?? "string"
29
+ $: type = getType(schema)
30
30
  $: customRenderer = customRenderers?.find(x => x.column === schema?.name)
31
31
  $: renderer = customRenderer?.component ?? typeMap[type] ?? StringRenderer
32
32
  $: width = schema?.width || "150px"
33
33
  $: cellValue = getCellValue(value, schema.template)
34
34
 
35
+ const getType = schema => {
36
+ // Use a string renderer for dates if we use a custom template
37
+ if (schema?.type === "datetime" && schema?.template) {
38
+ return "string"
39
+ }
40
+ return schema?.type || "string"
41
+ }
42
+
35
43
  const getCellValue = (value, template) => {
36
44
  if (!template) {
37
45
  return value
@@ -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>
@@ -1,9 +1,7 @@
1
1
  <script>
2
2
  import "@spectrum-css/typography/dist/index-vars.css"
3
3
 
4
- // Sizes
5
4
  export let size = "M"
6
-
7
5
  export let serif = false
8
6
  </script>
9
7