@budibase/bbui 1.0.219-alpha.7 → 1.0.219

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.219-alpha.7",
4
+ "version": "1.0.219",
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.219-alpha.7",
41
+ "@budibase/string-templates": "^1.0.219",
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": "57e5d6fa3b84deffdd8ec86c3b1b9ff8ebaab101"
87
+ "gitHead": "231b038a3c99f730dd27a595f870663dd84b7837"
88
88
  }
@@ -13,7 +13,6 @@
13
13
  export let size = "M"
14
14
  export let active = false
15
15
  export let fullWidth = false
16
- export let noPadding = false
17
16
 
18
17
  function longPress(element) {
19
18
  if (!longPressable) return
@@ -42,7 +41,6 @@
42
41
  class:spectrum-ActionButton--quiet={quiet}
43
42
  class:spectrum-ActionButton--emphasized={emphasized}
44
43
  class:is-selected={selected}
45
- class:noPadding
46
44
  class:fullWidth
47
45
  class="spectrum-ActionButton spectrum-ActionButton--size{size}"
48
46
  class:active
@@ -82,8 +80,4 @@
82
80
  .active svg {
83
81
  color: var(--spectrum-global-color-blue-600);
84
82
  }
85
- .noPadding {
86
- padding: 0;
87
- min-width: 0;
88
- }
89
83
  </style>
@@ -14,7 +14,6 @@
14
14
  export let active = false
15
15
  export let tooltip = undefined
16
16
  export let dataCy
17
- export let newStyles = false
18
17
 
19
18
  let showTooltip = false
20
19
  </script>
@@ -26,7 +25,6 @@
26
25
  class:spectrum-Button--warning={warning}
27
26
  class:spectrum-Button--overBackground={overBackground}
28
27
  class:spectrum-Button--quiet={quiet}
29
- class:new-styles={newStyles}
30
28
  class:active
31
29
  class="spectrum-Button spectrum-Button--size{size.toUpperCase()}"
32
30
  {disabled}
@@ -95,20 +93,4 @@
95
93
  padding-left: var(--spacing-m);
96
94
  line-height: 0;
97
95
  }
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
- }
114
96
  </style>
@@ -40,6 +40,5 @@
40
40
  on:change={onChange}
41
41
  on:pick
42
42
  on:type
43
- on:blur
44
43
  />
45
44
  </Field>
@@ -18,6 +18,23 @@
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
+ }
21
38
 
22
39
  const selectOption = value => {
23
40
  dispatch("change", value)
@@ -52,10 +69,7 @@
52
69
  {id}
53
70
  type="text"
54
71
  on:focus={() => (focus = true)}
55
- on:blur={() => {
56
- focus = false
57
- dispatch("blur")
58
- }}
72
+ on:blur={() => (focus = false)}
59
73
  on:change={onType}
60
74
  value={value || ""}
61
75
  placeholder={placeholder || ""}
@@ -199,7 +199,6 @@
199
199
  }
200
200
  .spectrum-Picker {
201
201
  width: 100%;
202
- box-shadow: none;
203
202
  }
204
203
  .spectrum-Picker-label:not(.auto-width) {
205
204
  overflow: hidden;
@@ -112,8 +112,4 @@
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
- }
119
115
  </style>
@@ -1,20 +1,15 @@
1
1
  <script>
2
- import { ActionButton } from "../"
3
-
4
2
  import { createEventDispatcher } from "svelte"
5
3
 
6
4
  export let type = "info"
7
5
  export let icon = "Info"
8
6
  export let message = ""
9
7
  export let dismissable = false
10
- export let actionMessage = null
11
- export let action = null
12
- export let wide = false
13
8
 
14
9
  const dispatch = createEventDispatcher()
15
10
  </script>
16
11
 
17
- <div class="spectrum-Toast spectrum-Toast--{type}" class:wide>
12
+ <div class="spectrum-Toast spectrum-Toast--{type}">
18
13
  {#if icon}
19
14
  <svg
20
15
  class="spectrum-Icon spectrum-Icon--sizeM spectrum-Toast-typeIcon"
@@ -24,13 +19,8 @@
24
19
  <use xlink:href="#spectrum-icon-18-{icon}" />
25
20
  </svg>
26
21
  {/if}
27
- <div class="spectrum-Toast-body" class:actionBody={!!action}>
22
+ <div class="spectrum-Toast-body">
28
23
  <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}
34
24
  </div>
35
25
  {#if dismissable}
36
26
  <div class="spectrum-Toast-buttons">
@@ -56,15 +46,4 @@
56
46
  .spectrum-Toast {
57
47
  pointer-events: all;
58
48
  }
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
- }
70
49
  </style>
@@ -8,15 +8,13 @@
8
8
 
9
9
  <Portal target=".modal-container">
10
10
  <div class="notifications">
11
- {#each $notifications as { type, icon, message, id, dismissable, action, wide } (id)}
11
+ {#each $notifications as { type, icon, message, id, dismissable } (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}
20
18
  on:dismiss={() => notifications.dismiss(id)}
21
19
  />
22
20
  </div>
@@ -20,16 +20,7 @@ export const createNotificationStore = () => {
20
20
  setTimeout(() => (block = false), timeout)
21
21
  }
22
22
 
23
- const send = (
24
- message,
25
- {
26
- type = "default",
27
- icon = "",
28
- autoDismiss = true,
29
- action = null,
30
- wide = false,
31
- }
32
- ) => {
23
+ const send = (message, type = "default", icon = "", autoDismiss = true) => {
33
24
  if (block) {
34
25
  return
35
26
  }
@@ -37,15 +28,7 @@ export const createNotificationStore = () => {
37
28
  _notifications.update(state => {
38
29
  return [
39
30
  ...state,
40
- {
41
- id: _id,
42
- type,
43
- message,
44
- icon,
45
- dismissable: !autoDismiss,
46
- action,
47
- wide,
48
- },
31
+ { id: _id, type, message, icon, dismissable: !autoDismiss },
49
32
  ]
50
33
  })
51
34
  if (autoDismiss) {
@@ -67,11 +50,10 @@ export const createNotificationStore = () => {
67
50
  return {
68
51
  subscribe,
69
52
  send,
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" }),
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"),
75
57
  blockNotifications,
76
58
  dismiss: dismissNotification,
77
59
  }
@@ -26,20 +26,12 @@
26
26
  array: ArrayRenderer,
27
27
  internal: InternalRenderer,
28
28
  }
29
- $: type = getType(schema)
29
+ $: type = schema?.type ?? "string"
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
-
43
35
  const getCellValue = (value, template) => {
44
36
  if (!template) {
45
37
  return value
@@ -37,7 +37,6 @@
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"
41
40
 
42
41
  const dispatch = createEventDispatcher()
43
42
 
@@ -406,7 +405,7 @@
406
405
  >
407
406
  <use xlink:href="#spectrum-icon-18-Table" />
408
407
  </svg>
409
- <div>{placeholderText}</div>
408
+ <div>No rows found</div>
410
409
  </div>
411
410
  {/if}
412
411
  </div>
@@ -1,7 +1,9 @@
1
1
  <script>
2
2
  import "@spectrum-css/typography/dist/index-vars.css"
3
3
 
4
+ // Sizes
4
5
  export let size = "M"
6
+
5
7
  export let serif = false
6
8
  </script>
7
9