@budibase/bbui 2.2.12-alpha.21 → 2.2.12-alpha.23

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.
@@ -1,32 +1,95 @@
1
1
  <script>
2
+ import { setContext } from "svelte"
3
+ import clickOutside from "../Actions/click_outside"
4
+
2
5
  export let wide = false
3
- export let maxWidth = "80ch"
6
+ export let narrow = false
4
7
  export let noPadding = false
8
+
9
+ let sidePanelVisble = false
10
+
11
+ setContext("side-panel", {
12
+ open: () => (sidePanelVisble = true),
13
+ close: () => (sidePanelVisble = false),
14
+ })
5
15
  </script>
6
16
 
7
- <div style="--max-width: {maxWidth}" class:wide class:noPadding>
8
- <slot />
17
+ <div class="page">
18
+ <div class="main">
19
+ <div class="content" class:wide class:noPadding class:narrow>
20
+ <slot />
21
+ </div>
22
+ </div>
23
+ <div
24
+ id="side-panel"
25
+ class:visible={sidePanelVisble}
26
+ use:clickOutside={() => {
27
+ sidePanelVisble = false
28
+ }}
29
+ >
30
+ <slot name="side-panel" />
31
+ </div>
9
32
  </div>
10
33
 
11
34
  <style>
12
- div {
35
+ .page {
36
+ position: relative;
37
+ }
38
+ .page,
39
+ .main {
40
+ display: flex;
41
+ flex-direction: row;
42
+ justify-content: flex-start;
43
+ align-items: stretch;
44
+ flex: 1 1 auto;
45
+ overflow-x: hidden;
46
+ }
47
+ .main {
48
+ overflow: auto;
49
+ }
50
+ .content {
13
51
  display: flex;
14
52
  flex-direction: column;
15
53
  justify-content: flex-start;
16
54
  align-items: stretch;
17
- max-width: var(--max-width);
55
+ max-width: 1080px;
18
56
  margin: 0 auto;
19
- padding: calc(var(--spacing-xl) * 2);
20
- min-height: calc(100% - var(--spacing-xl) * 4);
57
+ flex: 1 1 auto;
58
+ padding: 50px;
59
+ z-index: 1;
21
60
  }
22
-
23
- .wide {
61
+ .content.wide {
24
62
  max-width: none;
25
- margin: 0;
63
+ }
64
+ .content.narrow {
65
+ max-width: 840px;
66
+ }
67
+ #side-panel {
68
+ position: absolute;
69
+ right: 0;
70
+ top: 0;
71
+ padding: 24px;
72
+ background: var(--background);
73
+ border-left: var(--border-light);
74
+ width: 320px;
75
+ max-width: calc(100vw - 48px - 48px);
76
+ overflow: auto;
77
+ overflow-x: hidden;
78
+ transform: translateX(100%);
79
+ transition: transform 130ms ease-out;
80
+ height: calc(100% - 48px);
81
+ z-index: 2;
82
+ }
83
+ #side-panel.visible {
84
+ transform: translateX(0);
26
85
  }
27
86
 
28
- .noPadding {
29
- padding: 0px;
30
- margin: 0px;
87
+ @media (max-width: 640px) {
88
+ .content {
89
+ padding: 24px;
90
+ max-width: calc(100vw - 48px) !important;
91
+ width: calc(100vw - 48px) !important;
92
+ overflow: auto;
93
+ }
31
94
  }
32
95
  </style>
@@ -30,9 +30,11 @@
30
30
  <Label>{subtitle}</Label>
31
31
  {/if}
32
32
  </div>
33
- <div class="right">
34
- <slot />
35
- </div>
33
+ {#if $$slots.default}
34
+ <div class="right">
35
+ <slot />
36
+ </div>
37
+ {/if}
36
38
  </div>
37
39
 
38
40
  <style>
@@ -45,6 +47,7 @@
45
47
  justify-content: space-between;
46
48
  border: 1px solid var(--spectrum-global-color-gray-300);
47
49
  transition: background 130ms ease-out;
50
+ gap: var(--spacing-m);
48
51
  }
49
52
  .list-item:not(:first-child) {
50
53
  border-top: none;
@@ -26,7 +26,6 @@
26
26
  padding: 40px;
27
27
  background-color: var(--purple);
28
28
  color: white;
29
- font-family: var(--font-sans);
30
29
  font-weight: bold;
31
30
  text-align: center;
32
31
  user-select: none;
@@ -19,7 +19,6 @@
19
19
 
20
20
  <style>
21
21
  p, span {
22
- font-family: var(--font-sans);
23
22
  font-size: var(--font-size-s);
24
23
  }
25
24
 
@@ -104,7 +104,7 @@
104
104
  {/if}
105
105
 
106
106
  {#if showCancelButton}
107
- <Button group secondary newStyles on:click={close}>
107
+ <Button group secondary on:click={close}>
108
108
  {cancelText}
109
109
  </Button>
110
110
  {/if}
@@ -151,7 +151,8 @@
151
151
  overflow: visible;
152
152
  }
153
153
  .spectrum-Dialog-heading {
154
- font-family: var(--font-sans);
154
+ font-family: var(--font-accent);
155
+ font-weight: 600;
155
156
  }
156
157
  .spectrum-Dialog-heading.noDivider {
157
158
  margin-bottom: 12px;
@@ -42,7 +42,6 @@
42
42
  <style>
43
43
  p {
44
44
  margin: 0;
45
- font-family: var(--font-sans);
46
45
  font-size: var(--font-size-s);
47
46
  }
48
47
  p.error {
@@ -4,6 +4,7 @@
4
4
  import { createEventDispatcher } from "svelte"
5
5
  import positionDropdown from "../Actions/position_dropdown"
6
6
  import clickOutside from "../Actions/click_outside"
7
+ import { fly } from "svelte/transition"
7
8
 
8
9
  const dispatch = createEventDispatcher()
9
10
 
@@ -12,9 +13,10 @@
12
13
  export let portalTarget
13
14
  export let dataCy
14
15
  export let maxWidth
15
-
16
16
  export let direction = "bottom"
17
17
  export let showTip = false
18
+ export let open = false
19
+ export let useAnchorWidth = false
18
20
 
19
21
  let tipSvg =
20
22
  '<svg xmlns="http://www.w3.org/svg/2000" width="23" height="12" class="spectrum-Popover-tip" > <path class="spectrum-Popover-tip-triangle" d="M 0.7071067811865476 0 L 11.414213562373096 10.707106781186548 L 22.121320343559645 0" /> </svg>'
@@ -35,13 +37,22 @@
35
37
 
36
38
  const handleOutsideClick = e => {
37
39
  if (open) {
38
- e.stopPropagation()
40
+ // Stop propagation if the source is the anchor
41
+ let node = e.target
42
+ let fromAnchor = false
43
+ while (!fromAnchor && node && node.parentNode) {
44
+ fromAnchor = node === anchor
45
+ node = node.parentNode
46
+ }
47
+ if (fromAnchor) {
48
+ e.stopPropagation()
49
+ }
50
+
51
+ // Hide the popover
39
52
  hide()
40
53
  }
41
54
  }
42
55
 
43
- let open = null
44
-
45
56
  function handleEscape(e) {
46
57
  if (open && e.key === "Escape") {
47
58
  hide()
@@ -53,12 +64,13 @@
53
64
  <Portal target={portalTarget}>
54
65
  <div
55
66
  tabindex="0"
56
- use:positionDropdown={{ anchor, align, maxWidth }}
67
+ use:positionDropdown={{ anchor, align, maxWidth, useAnchorWidth }}
57
68
  use:clickOutside={handleOutsideClick}
58
69
  on:keydown={handleEscape}
59
70
  class={"spectrum-Popover is-open " + (tooltipClasses || "")}
60
71
  role="presentation"
61
72
  data-cy={dataCy}
73
+ transition:fly|local={{ y: -20, duration: 200 }}
62
74
  >
63
75
  {#if showTip}
64
76
  {@html tipSvg}
@@ -29,7 +29,6 @@
29
29
  font-size: var(--font-size-m);
30
30
  margin: 0 0 var(--spacing-l) 0;
31
31
  font-weight: 600;
32
- font-family: var(--font-sans);
33
32
  }
34
33
 
35
34
  .input-group-column {
@@ -1,8 +1,11 @@
1
1
  <script>
2
2
  export let value
3
+ export let schema
3
4
  </script>
4
5
 
5
- <div>{typeof value === "object" ? JSON.stringify(value) : value}</div>
6
+ <div class:capitalise={schema?.capitalise}>
7
+ {typeof value === "object" ? JSON.stringify(value) : value}
8
+ </div>
6
9
 
7
10
  <style>
8
11
  div {
@@ -10,5 +13,10 @@
10
13
  text-overflow: ellipsis;
11
14
  white-space: nowrap;
12
15
  max-width: var(--max-cell-width);
16
+ width: 0;
17
+ flex: 1 1 auto;
18
+ }
19
+ div.capitalise {
20
+ text-transform: capitalize;
13
21
  }
14
22
  </style>
@@ -21,6 +21,8 @@
21
21
  * template: a HBS or JS binding to use as the value
22
22
  * background: the background color
23
23
  * color: the text color
24
+ * borderLeft: show a left border
25
+ * borderRight: show a right border
24
26
  */
25
27
  export let data = []
26
28
  export let schema = {}
@@ -31,6 +33,7 @@
31
33
  export let allowSelectRows
32
34
  export let allowEditRows = true
33
35
  export let allowEditColumns = true
36
+ export let allowClickRows = true
34
37
  export let selectedRows = []
35
38
  export let customRenderers = []
36
39
  export let disableSorting = false
@@ -270,6 +273,17 @@
270
273
  if (schema[field].align === "Right") {
271
274
  styles[field] += "justify-content: flex-end; text-align: right;"
272
275
  }
276
+ if (schema[field].borderLeft) {
277
+ styles[field] +=
278
+ "border-left: 1px solid var(--spectrum-global-color-gray-200);"
279
+ }
280
+ if (schema[field].borderLeft) {
281
+ styles[field] +=
282
+ "border-right: 1px solid var(--spectrum-global-color-gray-200);"
283
+ }
284
+ if (schema[field].minWidth) {
285
+ styles[field] += `min-width: ${schema[field].minWidth};`
286
+ }
273
287
  })
274
288
  return styles
275
289
  }
@@ -290,7 +304,11 @@
290
304
  </slot>
291
305
  </div>
292
306
  {:else}
293
- <div class="spectrum-Table" style={`${heightStyle}${gridStyle}`}>
307
+ <div
308
+ class="spectrum-Table"
309
+ class:no-scroll={!rowCount}
310
+ style={`${heightStyle}${gridStyle}`}
311
+ >
294
312
  {#if fields.length}
295
313
  <div class="spectrum-Table-head">
296
314
  {#if showEditColumn}
@@ -356,7 +374,7 @@
356
374
  {/if}
357
375
  {#if sortedRows?.length}
358
376
  {#each sortedRows as row, idx}
359
- <div class="spectrum-Table-row">
377
+ <div class="spectrum-Table-row" class:clickable={allowClickRows}>
360
378
  {#if showEditColumn}
361
379
  <div
362
380
  class:noBorderCheckbox={!showHeaderBorder}
@@ -433,10 +451,10 @@
433
451
  /* Wrapper */
434
452
  .wrapper {
435
453
  position: relative;
436
- z-index: 0;
437
454
  --table-bg: var(--spectrum-global-color-gray-50);
438
455
  --table-border: 1px solid var(--spectrum-alias-border-color-mid);
439
456
  --cell-padding: var(--spectrum-global-dimension-size-250);
457
+ overflow: auto;
440
458
  }
441
459
  .wrapper--quiet {
442
460
  --table-bg: var(--spectrum-alias-background-color-transparent);
@@ -460,6 +478,9 @@
460
478
  display: grid;
461
479
  overflow: auto;
462
480
  }
481
+ .spectrum-Table.no-scroll {
482
+ overflow: visible;
483
+ }
463
484
 
464
485
  /* Header */
465
486
  .spectrum-Table-head {
@@ -546,12 +567,13 @@
546
567
  /* Table rows */
547
568
  .spectrum-Table-row {
548
569
  display: contents;
570
+ cursor: auto;
549
571
  }
550
- .spectrum-Table-row:hover .spectrum-Table-cell {
551
- /*background-color: var(--hover-bg) !important;*/
572
+ .spectrum-Table-row.clickable {
573
+ cursor: pointer;
552
574
  }
553
- .spectrum-Table-row:hover .spectrum-Table-cell:after {
554
- background-color: var(--spectrum-alias-highlight-hover);
575
+ .spectrum-Table-row.clickable:hover .spectrum-Table-cell {
576
+ background-color: var(--spectrum-global-color-gray-100);
555
577
  }
556
578
  .wrapper--quiet .spectrum-Table-row {
557
579
  border-left: none;
@@ -584,24 +606,13 @@
584
606
  border-bottom: 1px solid var(--spectrum-alias-border-color-mid);
585
607
  background-color: var(--table-bg);
586
608
  z-index: auto;
609
+ transition: background-color 130ms ease-out;
587
610
  }
588
611
  .spectrum-Table-cell--edit {
589
612
  position: sticky;
590
613
  left: 0;
591
614
  z-index: 2;
592
615
  }
593
- .spectrum-Table-cell:after {
594
- content: "";
595
- position: absolute;
596
- width: 100%;
597
- height: 100%;
598
- background-color: transparent;
599
- top: 0;
600
- left: 0;
601
- pointer-events: none;
602
- transition: background-color
603
- var(--spectrum-global-animation-duration-100, 0.13s) ease-in-out;
604
- }
605
616
 
606
617
  /* Placeholder */
607
618
  .placeholder {
@@ -82,7 +82,8 @@
82
82
  .spectrum-Tabs-item {
83
83
  color: var(--spectrum-global-color-gray-600);
84
84
  }
85
- .spectrum-Tabs-item.is-selected {
85
+ .spectrum-Tabs-item.is-selected,
86
+ .spectrum-Tabs-item:hover {
86
87
  color: var(--spectrum-global-color-gray-900);
87
88
  }
88
89
  </style>
@@ -37,7 +37,7 @@
37
37
 
38
38
  <style>
39
39
  .spectrum-Tags-item {
40
- margin-top: 0;
41
40
  margin-bottom: 0;
41
+ margin-top: 0;
42
42
  }
43
43
  </style>
@@ -5,3 +5,13 @@
5
5
  <div class="spectrum-Tags" role="list" aria-label="list">
6
6
  <slot />
7
7
  </div>
8
+
9
+ <style>
10
+ .spectrum-Tags {
11
+ margin-top: -8px;
12
+ margin-left: -4px;
13
+ }
14
+ .spectrum-Tags :global(.spectrum-Tags-item) {
15
+ margin: 8px 0 0 4px !important;
16
+ }
17
+ </style>
@@ -15,3 +15,9 @@
15
15
  >
16
16
  <slot />
17
17
  </h1>
18
+
19
+ <style>
20
+ h1 {
21
+ font-family: var(--font-accent);
22
+ }
23
+ </style>
package/src/bbui.css CHANGED
@@ -40,12 +40,14 @@
40
40
  --rounded-medium: 8px;
41
41
  --rounded-large: 16px;
42
42
 
43
- --font-sans: Source Sans Pro, -apple-system, BlinkMacSystemFont, Segoe UI, "Inter",
44
- "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji",
45
- "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
43
+ --font-sans: "Source Sans Pro", -apple-system, BlinkMacSystemFont, Segoe UI, "Inter",
44
+ "Helvetica Neue", Arial, "Noto Sans", sans-serif;
45
+ --font-accent: "Source Sans Pro", -apple-system, BlinkMacSystemFont, Segoe UI, "Inter",
46
+ "Helvetica Neue", Arial, "Noto Sans", sans-serif;
46
47
  --font-serif: "Georgia", Cambria, Times New Roman, Times, serif;
47
48
  --font-mono: Menlo, Monaco, Consolas, "Liberation Mono", "Courier New",
48
49
  monospace;
50
+ --spectrum-alias-body-text-font-family: var(--font-sans);
49
51
 
50
52
  font-size: 16px;
51
53
  --font-size-xs: 0.75rem;
@@ -89,6 +91,8 @@
89
91
  --border-light-2: 2px var(--grey-3) solid;
90
92
  --border-blue: 2px var(--blue) solid;
91
93
  --border-transparent: 2px transparent solid;
94
+
95
+ --spectrum-alias-text-color-disabled: var(--spectrum-global-color-gray-600);
92
96
  }
93
97
 
94
98
  a {