@budibase/bbui 3.11.2 → 3.12.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": "3.11.2",
4
+ "version": "3.12.0",
5
5
  "license": "MPL-2.0",
6
6
  "svelte": "src/index.ts",
7
7
  "module": "dist/bbui.mjs",
@@ -99,5 +99,5 @@
99
99
  }
100
100
  }
101
101
  },
102
- "gitHead": "4c2f13e1b36fa559124df22462d83d2b4d1e7e9d"
102
+ "gitHead": "4d3f7719ab1ae02d3d01908b8a14a31a0c81445d"
103
103
  }
@@ -68,8 +68,11 @@
68
68
 
69
69
  <style>
70
70
  button {
71
- transition: filter 130ms ease-out, background 130ms ease-out,
72
- border 130ms ease-out, color 130ms ease-out;
71
+ transition:
72
+ filter 130ms ease-out,
73
+ background 130ms ease-out,
74
+ border 130ms ease-out,
75
+ color 130ms ease-out;
73
76
  }
74
77
  .fullWidth {
75
78
  width: 100%;
@@ -70,6 +70,9 @@
70
70
  button.is-disabled {
71
71
  cursor: default;
72
72
  }
73
+ .spectrum-Button {
74
+ padding-bottom: calc(var(--spectrum-button-padding-y) - 1px);
75
+ }
73
76
  .spectrum-Button-label {
74
77
  white-space: nowrap;
75
78
  overflow: hidden;
@@ -100,8 +103,11 @@
100
103
  .spectrum-Button .spectrum-Button-label + .spectrum-Icon {
101
104
  margin-left: var(--spectrum-button-primary-icon-gap);
102
105
  margin-right: calc(
103
- -1 * (var(--spectrum-button-primary-textonly-padding-left-adjusted) -
104
- var(--spectrum-button-primary-padding-left-adjusted))
106
+ -1 *
107
+ (
108
+ var(--spectrum-button-primary-textonly-padding-left-adjusted) -
109
+ var(--spectrum-button-primary-padding-left-adjusted)
110
+ )
105
111
  );
106
112
  }
107
113
  </style>
@@ -8,10 +8,10 @@
8
8
  gap === "L"
9
9
  ? "var(--spacing-l)"
10
10
  : gap === "M"
11
- ? "var(--spacing-m)"
12
- : gap === "S"
13
- ? "var(--spacing-s)"
14
- : null
11
+ ? "var(--spacing-m)"
12
+ : gap === "S"
13
+ ? "var(--spacing-s)"
14
+ : null
15
15
 
16
16
  function group(element) {
17
17
  const buttons = Array.from(element.getElementsByTagName("button"))
@@ -278,9 +278,12 @@
278
278
  place-items: center;
279
279
  }
280
280
  .fill.placeholder {
281
- background-position: 0 0, 10px 10px;
281
+ background-position:
282
+ 0 0,
283
+ 10px 10px;
282
284
  background-size: 20px 20px;
283
- background-image: linear-gradient(
285
+ background-image:
286
+ linear-gradient(
284
287
  45deg,
285
288
  #eee 25%,
286
289
  transparent 25%,
@@ -227,8 +227,12 @@
227
227
  border-radius: 8px;
228
228
  overflow: hidden;
229
229
  box-sizing: border-box;
230
- transition: transform 260ms ease-out, bottom 260ms ease-out,
231
- left 260ms ease-out, width 260ms ease-out, height 260ms ease-out;
230
+ transition:
231
+ transform 260ms ease-out,
232
+ bottom 260ms ease-out,
233
+ left 260ms ease-out,
234
+ width 260ms ease-out,
235
+ height 260ms ease-out;
232
236
  display: flex;
233
237
  flex-direction: column;
234
238
  align-items: stretch;
@@ -69,7 +69,9 @@
69
69
  border: 1px solid var(--spectrum-global-color-gray-300);
70
70
  border-radius: 4px;
71
71
  box-sizing: border-box;
72
- transition: border-color 130ms ease-out, background 130ms ease-out,
72
+ transition:
73
+ border-color 130ms ease-out,
74
+ background 130ms ease-out,
73
75
  background 130ms ease-out;
74
76
  color: var(--spectrum-global-color-gray-800);
75
77
  --padding: 16px;
@@ -14,7 +14,9 @@
14
14
  position: absolute;
15
15
  top: 10px;
16
16
  color: var(--spectrum-global-color-gray-600);
17
- transition: font-size 130ms ease-out, top 130ms ease-out,
17
+ transition:
18
+ font-size 130ms ease-out,
19
+ top 130ms ease-out,
18
20
  transform 130ms ease-out;
19
21
  }
20
22
  div.placeholder {
@@ -113,7 +113,9 @@
113
113
  border-radius: 2px;
114
114
  -webkit-box-shadow: 0 0 0 100px var(--spectrum-global-color-gray-300) inset;
115
115
  -webkit-text-fill-color: var(--spectrum-global-color-gray-900);
116
- transition: -webkit-box-shadow 130ms 200ms, background-color 0s 86400s;
116
+ transition:
117
+ -webkit-box-shadow 130ms 200ms,
118
+ background-color 0s 86400s;
117
119
  padding: 3px 8px 4px 8px;
118
120
  }
119
121
  </style>
@@ -125,7 +125,9 @@
125
125
  font-size: 15px;
126
126
  line-height: 17px;
127
127
  color: var(--spectrum-global-color-gray-900);
128
- transition: transform 130ms ease-out, opacity 130ms ease-out;
128
+ transition:
129
+ transform 130ms ease-out,
130
+ opacity 130ms ease-out;
129
131
  opacity: 1;
130
132
  white-space: nowrap;
131
133
  text-overflow: ellipsis;
@@ -139,7 +141,9 @@
139
141
  font-size: 15px;
140
142
  line-height: 17px;
141
143
  color: var(--spectrum-global-color-gray-900);
142
- transition: transform 130ms ease-out, opacity 130ms ease-out;
144
+ transition:
145
+ transform 130ms ease-out,
146
+ opacity 130ms ease-out;
143
147
  transform: translateY(9px);
144
148
  }
145
149
 
@@ -121,6 +121,7 @@
121
121
  <style>
122
122
  .spectrum-Textfield {
123
123
  width: 100%;
124
+ --spectrum-textfield-padding-bottom: var(--spectrum-textfield-padding-top);
124
125
  }
125
126
 
126
127
  input::placeholder {
@@ -48,8 +48,8 @@
48
48
  width: 31px;
49
49
  color: var(--spectrum-alias-text-color);
50
50
  background-color: var(--spectrum-global-color-gray-75);
51
- transition: background-color
52
- var(--spectrum-global-animation-duration-100, 130ms),
51
+ transition:
52
+ background-color var(--spectrum-global-animation-duration-100, 130ms),
53
53
  box-shadow var(--spectrum-global-animation-duration-100, 130ms),
54
54
  border-color var(--spectrum-global-animation-duration-100, 130ms);
55
55
  height: calc(var(--spectrum-alias-item-height-m) - 2px);
@@ -57,7 +57,9 @@
57
57
  flex-direction: row;
58
58
  justify-content: space-between;
59
59
  border: 1px solid var(--spectrum-global-color-gray-300);
60
- transition: background 130ms ease-out, border-color 130ms ease-out;
60
+ transition:
61
+ background 130ms ease-out,
62
+ border-color 130ms ease-out;
61
63
  gap: var(--spacing-m);
62
64
  color: var(--spectrum-global-color-gray-800);
63
65
  cursor: pointer;
@@ -112,7 +114,9 @@
112
114
  padding: 4px;
113
115
  border-radius: 4px;
114
116
  border: 1px solid var(--spectrum-global-color-gray-300);
115
- transition: background-color 130ms ease-out, border-color 130ms ease-out,
117
+ transition:
118
+ background-color 130ms ease-out,
119
+ border-color 130ms ease-out,
116
120
  color 130ms ease-out;
117
121
  }
118
122
  .list-item.large.hoverable:not(.selected):hover .list-item__icon {
@@ -2,7 +2,7 @@
2
2
  import { getContext } from "svelte"
3
3
  import Context from "../context"
4
4
 
5
- const { hide } = getContext(Context.Modal) as { hide: () => void }
5
+ const { hide } = getContext(Context.Modal)
6
6
 
7
7
  let count: number = 0
8
8
  const clicks: number = 5
@@ -5,6 +5,7 @@
5
5
  import { fade, fly } from "svelte/transition"
6
6
  import Portal from "svelte-portal"
7
7
  import Context from "../context"
8
+ import { ModalCancelFrom } from "../constants"
8
9
 
9
10
  export let fixed: boolean = false
10
11
  export let inline: boolean = false
@@ -15,7 +16,7 @@
15
16
  const dispatch = createEventDispatcher<{
16
17
  show: void
17
18
  hide: void
18
- cancel: void
19
+ cancel: ModalCancelFrom
19
20
  }>()
20
21
  let visible: boolean = fixed || inline
21
22
  let modal: HTMLElement | undefined
@@ -44,17 +45,17 @@
44
45
  }
45
46
  }
46
47
 
47
- export function cancel(): void {
48
+ export function cancel(from: ModalCancelFrom): void {
48
49
  if (!visible || disableCancel) {
49
50
  return
50
51
  }
51
- dispatch("cancel")
52
+ dispatch("cancel", from)
52
53
  hide()
53
54
  }
54
55
 
55
56
  function handleKey(e: KeyboardEvent): void {
56
57
  if (visible && e.key === "Escape") {
57
- cancel()
58
+ cancel(ModalCancelFrom.ESCAPE_KEY)
58
59
  }
59
60
  }
60
61
 
@@ -78,7 +79,12 @@
78
79
  hide,
79
80
  toggle,
80
81
  cancel,
81
- } as { show: () => void; hide: () => void; toggle: () => void; cancel: () => void })
82
+ } as {
83
+ show: () => void
84
+ hide: () => void
85
+ toggle: () => void
86
+ cancel: () => void
87
+ })
82
88
 
83
89
  onMount(() => {
84
90
  document.addEventListener("keydown", handleKey)
@@ -107,7 +113,7 @@
107
113
  <!-- svelte-ignore a11y-no-static-element-interactions -->
108
114
  <div
109
115
  class="spectrum-Underlay is-open"
110
- on:mousedown|self={cancel}
116
+ on:mousedown|self={() => cancel(ModalCancelFrom.OUTSIDE_CLICK)}
111
117
  style="z-index:{zIndex || 999}"
112
118
  >
113
119
  <div
@@ -115,8 +121,14 @@
115
121
  in:fade={{ duration: 200 }}
116
122
  out:fade|local={{ duration: 200 }}
117
123
  />
118
- <div class="modal-wrapper" on:mousedown|self={cancel}>
119
- <div class="modal-inner-wrapper" on:mousedown|self={cancel}>
124
+ <div
125
+ class="modal-wrapper"
126
+ on:mousedown|self={() => cancel(ModalCancelFrom.OUTSIDE_CLICK)}
127
+ >
128
+ <div
129
+ class="modal-inner-wrapper"
130
+ on:mousedown|self={() => cancel(ModalCancelFrom.OUTSIDE_CLICK)}
131
+ >
120
132
  <slot name="outside" />
121
133
  <div
122
134
  use:focusModal
@@ -10,6 +10,7 @@
10
10
  import Icon from "../Icon/Icon.svelte"
11
11
  import Context from "../context"
12
12
  import ProgressCircle from "../ProgressCircle/ProgressCircle.svelte"
13
+ import { ModalCancelFrom } from "../constants"
13
14
 
14
15
  export let title: string | undefined = undefined
15
16
  export let size: "S" | "M" | "L" | "XL" = "S"
@@ -30,10 +31,7 @@
30
31
  export let secondaryButtonWarning: boolean = false
31
32
  export let custom: boolean = false
32
33
 
33
- const { hide, cancel } = getContext(Context.Modal) as {
34
- hide: () => void
35
- cancel: () => void
36
- }
34
+ const { hide, cancel } = getContext(Context.Modal)
37
35
 
38
36
  let loading: boolean = false
39
37
 
@@ -59,7 +57,7 @@
59
57
  async function close(): Promise<void> {
60
58
  loading = true
61
59
  if (!onCancel || (await onCancel()) !== keepOpen) {
62
- cancel()
60
+ cancel(ModalCancelFrom.CANCEL_BUTTON)
63
61
  }
64
62
  loading = false
65
63
  }
@@ -139,7 +137,11 @@
139
137
  {/if}
140
138
  {#if showCloseIcon}
141
139
  <div class="close-icon">
142
- <Icon hoverable name="Close" on:click={cancel} />
140
+ <Icon
141
+ hoverable
142
+ name="Close"
143
+ on:click={() => cancel(ModalCancelFrom.CLOSE_BUTTON)}
144
+ />
143
145
  </div>
144
146
  {/if}
145
147
  </div>
@@ -12,8 +12,8 @@
12
12
  $: format = isTimeOnly
13
13
  ? "HH:mm:ss"
14
14
  : isDateOnly
15
- ? "MMMM D YYYY"
16
- : "MMMM D YYYY, HH:mm"
15
+ ? "MMMM D YYYY"
16
+ : "MMMM D YYYY, HH:mm"
17
17
  </script>
18
18
 
19
19
  <div>
@@ -115,7 +115,9 @@
115
115
  pointer-events: none;
116
116
  margin: 0;
117
117
  max-width: 280px;
118
- transition: top 130ms ease-out, left 130ms ease-out;
118
+ transition:
119
+ top 130ms ease-out,
120
+ left 130ms ease-out;
119
121
  }
120
122
  .spectrum-Tooltip-label {
121
123
  display: -webkit-box;
package/src/bbui.css CHANGED
@@ -1,3 +1,4 @@
1
+ /* Custom variables */
1
2
  :root {
2
3
  --background: #ffffff;
3
4
  --ink: #000000;
@@ -71,7 +72,6 @@
71
72
  --font-serif: "Georgia", Cambria, Times New Roman, Times, serif;
72
73
  --font-mono: Menlo, Monaco, Consolas, "Liberation Mono", "Courier New",
73
74
  monospace;
74
- --spectrum-alias-body-text-font-family: var(--font-sans);
75
75
 
76
76
  font-size: 16px;
77
77
  --font-size-xs: 0.75rem;
@@ -116,9 +116,17 @@
116
116
  --border-blue: 2px var(--blue) solid;
117
117
  --border-transparent: 2px transparent solid;
118
118
 
119
- --spectrum-alias-text-color-disabled: var(--spectrum-global-color-gray-600);
120
119
  }
121
120
 
121
+ /* Spectrum overrides */
122
+ .spectrum {
123
+ --spectrum-alias-body-text-font-family: var(--font-sans) !important;
124
+ --spectrum-global-font-family-base: var(--font-sans) !important;
125
+ --spectrum-global-font-line-height-small: 1.4 !important;
126
+ --spectrum-alias-text-color-disabled: var(--spectrum-global-color-gray-600) !important;
127
+ }
128
+
129
+ /* Generic styles */
122
130
  a {
123
131
  text-decoration: none;
124
132
  }
package/src/constants.ts CHANGED
@@ -21,3 +21,10 @@ export enum TooltipType {
21
21
  Positive = "positive",
22
22
  Negative = "negative",
23
23
  }
24
+
25
+ export const enum ModalCancelFrom {
26
+ CLOSE_BUTTON = "close_button",
27
+ CANCEL_BUTTON = "cancel_button",
28
+ ESCAPE_KEY = "escape_key",
29
+ OUTSIDE_CLICK = "outside_click",
30
+ }
@@ -1,3 +1,6 @@
1
+ import { ModalCancelFrom } from "../constants"
2
+
1
3
  export interface ModalContext {
4
+ cancel: (from: ModalCancelFrom) => void
2
5
  hide: () => void
3
6
  }