@budibase/bbui 2.10.15 → 2.10.16-alpha.0

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.10.15",
4
+ "version": "2.10.16-alpha.0",
5
5
  "license": "MPL-2.0",
6
6
  "svelte": "src/index.js",
7
7
  "module": "dist/bbui.es.js",
@@ -20,14 +20,12 @@
20
20
  "@rollup/plugin-commonjs": "^16.0.0",
21
21
  "@rollup/plugin-json": "^4.1.0",
22
22
  "@rollup/plugin-node-resolve": "^11.2.1",
23
- "cross-env": "^7.0.2",
24
- "nollup": "^0.14.1",
25
23
  "postcss": "^8.2.9",
26
24
  "rollup": "^2.45.2",
27
25
  "rollup-plugin-postcss": "^4.0.0",
28
26
  "rollup-plugin-svelte": "^7.1.0",
29
27
  "rollup-plugin-terser": "^7.0.2",
30
- "svelte": "^3.38.2"
28
+ "svelte": "3.49.0"
31
29
  },
32
30
  "keywords": [
33
31
  "svelte"
@@ -38,8 +36,8 @@
38
36
  ],
39
37
  "dependencies": {
40
38
  "@adobe/spectrum-css-workflow-icons": "1.2.1",
41
- "@budibase/shared-core": "2.10.15",
42
- "@budibase/string-templates": "2.10.15",
39
+ "@budibase/shared-core": "2.10.16-alpha.0",
40
+ "@budibase/string-templates": "2.10.16-alpha.0",
43
41
  "@spectrum-css/accordion": "3.0.24",
44
42
  "@spectrum-css/actionbutton": "1.0.1",
45
43
  "@spectrum-css/actiongroup": "1.0.1",
@@ -82,7 +80,7 @@
82
80
  "@spectrum-css/typography": "3.0.1",
83
81
  "@spectrum-css/underlay": "2.0.9",
84
82
  "@spectrum-css/vars": "3.0.1",
85
- "dayjs": "^1.10.4",
83
+ "dayjs": "^1.10.8",
86
84
  "easymde": "^2.16.1",
87
85
  "svelte-dnd-action": "^0.9.8",
88
86
  "svelte-flatpickr": "3.2.3",
@@ -106,5 +104,5 @@
106
104
  }
107
105
  }
108
106
  },
109
- "gitHead": "1aff0770f2da0ed9c21e4079284f08587fe3ed7d"
107
+ "gitHead": "f373448384d66541cf3dfaf59bd1df32efd3661b"
110
108
  }
@@ -66,6 +66,10 @@
66
66
  pointer-events: all;
67
67
  width: 100%;
68
68
  }
69
+
70
+ .spectrum-Toast--neutral {
71
+ background-color: var(--grey-2);
72
+ }
69
73
  .spectrum-Button {
70
74
  border: 1px solid rgba(255, 255, 255, 0.2);
71
75
  }
@@ -14,12 +14,12 @@
14
14
  export let autocomplete = false
15
15
  export let sort = false
16
16
  export let autoWidth = false
17
- export let fetchTerm = null
18
- export let useFetch = false
17
+ export let searchTerm = null
19
18
  export let customPopoverHeight
20
19
  export let customPopoverOffsetBelow
21
20
  export let customPopoverMaxHeight
22
21
  export let open = false
22
+ export let loading
23
23
 
24
24
  const dispatch = createEventDispatcher()
25
25
 
@@ -82,6 +82,7 @@
82
82
  </script>
83
83
 
84
84
  <Picker
85
+ on:loadMore
85
86
  {id}
86
87
  {error}
87
88
  {disabled}
@@ -90,9 +91,8 @@
90
91
  {options}
91
92
  isPlaceholder={!arrayValue.length}
92
93
  {autocomplete}
93
- bind:fetchTerm
94
+ bind:searchTerm
94
95
  bind:open
95
- {useFetch}
96
96
  {isOptionSelected}
97
97
  {getOptionLabel}
98
98
  {getOptionValue}
@@ -102,4 +102,5 @@
102
102
  {customPopoverHeight}
103
103
  {customPopoverOffsetBelow}
104
104
  {customPopoverMaxHeight}
105
+ {loading}
105
106
  />
@@ -2,7 +2,7 @@
2
2
  import "@spectrum-css/picker/dist/index-vars.css"
3
3
  import "@spectrum-css/popover/dist/index-vars.css"
4
4
  import "@spectrum-css/menu/dist/index-vars.css"
5
- import { createEventDispatcher } from "svelte"
5
+ import { createEventDispatcher, onDestroy } from "svelte"
6
6
  import clickOutside from "../../Actions/click_outside"
7
7
  import Search from "./Search.svelte"
8
8
  import Icon from "../../Icon/Icon.svelte"
@@ -10,6 +10,7 @@
10
10
  import Popover from "../../Popover/Popover.svelte"
11
11
  import Tags from "../../Tags/Tags.svelte"
12
12
  import Tag from "../../Tags/Tag.svelte"
13
+ import ProgressCircle from "../../ProgressCircle/ProgressCircle.svelte"
13
14
 
14
15
  export let id = null
15
16
  export let disabled = false
@@ -35,19 +36,20 @@
35
36
  export let autoWidth = false
36
37
  export let autocomplete = false
37
38
  export let sort = false
38
- export let fetchTerm = null
39
- export let useFetch = false
39
+ export let searchTerm = null
40
40
  export let customPopoverHeight
41
41
  export let customPopoverOffsetBelow
42
42
  export let customPopoverMaxHeight
43
43
  export let align = "left"
44
44
  export let footer = null
45
45
  export let customAnchor = null
46
+ export let loading
47
+
46
48
  const dispatch = createEventDispatcher()
47
49
 
48
- let searchTerm = null
49
50
  let button
50
51
  let popover
52
+ let component
51
53
 
52
54
  $: sortedOptions = getSortedOptions(options, getOptionLabel, sort)
53
55
  $: filteredOptions = getFilteredOptions(
@@ -82,7 +84,7 @@
82
84
  }
83
85
 
84
86
  const getFilteredOptions = (options, term, getLabel) => {
85
- if (autocomplete && term && !fetchTerm) {
87
+ if (autocomplete && term) {
86
88
  const lowerCaseTerm = term.toLowerCase()
87
89
  return options.filter(option => {
88
90
  return `${getLabel(option)}`.toLowerCase().includes(lowerCaseTerm)
@@ -90,6 +92,20 @@
90
92
  }
91
93
  return options
92
94
  }
95
+
96
+ const onScroll = e => {
97
+ const scrollPxThreshold = 100
98
+ const scrollPositionFromBottom =
99
+ e.target.scrollHeight - e.target.clientHeight - e.target.scrollTop
100
+ if (scrollPositionFromBottom < scrollPxThreshold) {
101
+ dispatch("loadMore")
102
+ }
103
+ }
104
+
105
+ $: component?.addEventListener("scroll", onScroll)
106
+ onDestroy(() => {
107
+ component?.removeEventListener("scroll", null)
108
+ })
93
109
  </script>
94
110
 
95
111
  <button
@@ -163,14 +179,13 @@
163
179
  >
164
180
  {#if autocomplete}
165
181
  <Search
166
- value={useFetch ? fetchTerm : searchTerm}
167
- on:change={event =>
168
- useFetch ? (fetchTerm = event.detail) : (searchTerm = event.detail)}
182
+ value={searchTerm}
183
+ on:change={event => (searchTerm = event.detail)}
169
184
  {disabled}
170
185
  placeholder="Search"
171
186
  />
172
187
  {/if}
173
- <ul class="spectrum-Menu" role="listbox">
188
+ <ul class="spectrum-Menu" role="listbox" bind:this={component}>
174
189
  {#if placeholderOption}
175
190
  <li
176
191
  class="spectrum-Menu-item placeholder"
@@ -248,6 +263,12 @@
248
263
  {/if}
249
264
  </ul>
250
265
 
266
+ {#if loading}
267
+ <div class="loading" class:loading--withAutocomplete={autocomplete}>
268
+ <ProgressCircle size="S" />
269
+ </div>
270
+ {/if}
271
+
251
272
  {#if footer}
252
273
  <div class="footer">
253
274
  {footer}
@@ -323,18 +344,19 @@
323
344
  /* Search styles inside popover */
324
345
  .popover-content :global(.spectrum-Search) {
325
346
  margin-top: -1px;
326
- margin-left: -1px;
327
- width: calc(100% + 2px);
347
+ width: 100%;
328
348
  }
329
349
  .popover-content :global(.spectrum-Search input) {
330
350
  height: auto;
331
351
  border-bottom-left-radius: 0;
332
352
  border-bottom-right-radius: 0;
353
+ border-left: 0;
354
+ border-right: 0;
333
355
  padding-top: var(--spectrum-global-dimension-size-100);
334
356
  padding-bottom: var(--spectrum-global-dimension-size-100);
335
357
  }
336
358
  .popover-content :global(.spectrum-Search .spectrum-ClearButton) {
337
- right: 1px;
359
+ right: 2px;
338
360
  top: 2px;
339
361
  }
340
362
  .popover-content :global(.spectrum-Search .spectrum-Textfield-icon) {
@@ -359,4 +381,14 @@
359
381
  .option-tag :global(.spectrum-Tags-item > .spectrum-Icon) {
360
382
  margin-top: 2px;
361
383
  }
384
+
385
+ .loading {
386
+ position: fixed;
387
+ justify-content: center;
388
+ right: var(--spacing-s);
389
+ top: var(--spacing-s);
390
+ }
391
+ .loading--withAutocomplete {
392
+ top: calc(34px + var(--spacing-m));
393
+ }
362
394
  </style>
@@ -25,6 +25,8 @@
25
25
  export let tag = null
26
26
  export let customPopoverOffsetBelow
27
27
  export let customPopoverMaxHeight
28
+ export let searchTerm = null
29
+ export let loading
28
30
 
29
31
  const dispatch = createEventDispatcher()
30
32
 
@@ -65,6 +67,8 @@
65
67
  <Picker
66
68
  on:click
67
69
  bind:open
70
+ bind:searchTerm
71
+ on:loadMore
68
72
  {quiet}
69
73
  {id}
70
74
  {error}
@@ -92,4 +96,5 @@
92
96
  placeholderOption={placeholder === false ? null : placeholder}
93
97
  isOptionSelected={option => option === value}
94
98
  onSelectOption={selectOption}
99
+ {loading}
95
100
  />
@@ -96,8 +96,8 @@
96
96
  {disabled}
97
97
  {readonly}
98
98
  {id}
99
- value={value || ""}
100
- placeholder={placeholder || ""}
99
+ value={value ?? ""}
100
+ placeholder={placeholder ?? ""}
101
101
  on:click
102
102
  on:blur
103
103
  on:focus
@@ -16,8 +16,7 @@
16
16
  export let sort = false
17
17
  export let autoWidth = false
18
18
  export let autocomplete = false
19
- export let fetchTerm = null
20
- export let useFetch = false
19
+ export let searchTerm = null
21
20
  export let customPopoverHeight
22
21
 
23
22
  const dispatch = createEventDispatcher()
@@ -41,8 +40,7 @@
41
40
  {autoWidth}
42
41
  {autocomplete}
43
42
  {customPopoverHeight}
44
- bind:fetchTerm
45
- {useFetch}
43
+ bind:searchTerm
46
44
  on:change={onChange}
47
45
  on:click
48
46
  />
@@ -27,7 +27,11 @@
27
27
  <div class="spectrum-Toast-body" class:actionBody={!!action}>
28
28
  <div class="wrap spectrum-Toast-content">{message || ""}</div>
29
29
  {#if action}
30
- <ActionButton quiet emphasized on:click={action}>
30
+ <ActionButton
31
+ quiet
32
+ emphasized
33
+ on:click={() => action(() => dispatch("dismiss"))}
34
+ >
31
35
  <div style="color: white; font-weight: 600;">{actionMessage}</div>
32
36
  </ActionButton>
33
37
  {/if}
@@ -8,7 +8,7 @@
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, action, actionMessage, wide } (id)}
12
12
  <div transition:fly={{ y: 30 }}>
13
13
  <Notification
14
14
  {type}
@@ -16,6 +16,7 @@
16
16
  {message}
17
17
  {dismissable}
18
18
  {action}
19
+ {actionMessage}
19
20
  {wide}
20
21
  on:dismiss={() => notifications.dismiss(id)}
21
22
  />
@@ -1,6 +1,7 @@
1
1
  import { writable } from "svelte/store"
2
2
 
3
3
  export const BANNER_TYPES = {
4
+ NEUTRAL: "neutral",
4
5
  INFO: "info",
5
6
  NEGATIVE: "negative",
6
7
  WARNING: "warning",
@@ -27,7 +27,9 @@ export const createNotificationStore = () => {
27
27
  icon = "",
28
28
  autoDismiss = true,
29
29
  action = null,
30
+ actionMessage = null,
30
31
  wide = false,
32
+ dismissTimeout = NOTIFICATION_TIMEOUT,
31
33
  }
32
34
  ) => {
33
35
  if (block) {
@@ -44,14 +46,16 @@ export const createNotificationStore = () => {
44
46
  icon,
45
47
  dismissable: !autoDismiss,
46
48
  action,
49
+ actionMessage,
47
50
  wide,
51
+ dismissTimeout,
48
52
  },
49
53
  ]
50
54
  })
51
55
  if (autoDismiss) {
52
56
  const timeoutId = setTimeout(() => {
53
57
  dismissNotification(_id)
54
- }, NOTIFICATION_TIMEOUT)
58
+ }, dismissTimeout)
55
59
  timeoutIds.add(timeoutId)
56
60
  }
57
61
  }
@@ -25,6 +25,7 @@
25
25
  longform: StringRenderer,
26
26
  array: ArrayRenderer,
27
27
  internal: InternalRenderer,
28
+ bb_reference: RelationshipRenderer,
28
29
  }
29
30
  $: type = getType(schema)
30
31
  $: customRenderer = customRenderers?.find(x => x.column === schema?.name)
@@ -126,8 +126,9 @@
126
126
  transition: top 130ms ease-out, left 130ms ease-out;
127
127
  }
128
128
  .spectrum-Tooltip-label {
129
- text-overflow: ellipsis;
130
- white-space: nowrap;
129
+ display: -webkit-box;
130
+ -webkit-line-clamp: 3;
131
+ -webkit-box-orient: vertical;
131
132
  overflow: hidden;
132
133
  font-size: 12px;
133
134
  font-weight: 600;