@budibase/bbui 2.2.26 → 2.2.27

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.
Files changed (57) hide show
  1. package/dist/bbui.es.js +3 -3
  2. package/dist/bbui.es.js.map +1 -1
  3. package/package.json +4 -3
  4. package/src/Accordion/Accordion.svelte +58 -0
  5. package/src/ActionButton/ActionButton.svelte +2 -3
  6. package/src/ActionMenu/ActionMenu.svelte +1 -2
  7. package/src/Actions/click_outside.js +28 -9
  8. package/src/Actions/position_dropdown.js +85 -53
  9. package/src/Avatar/Avatar.svelte +1 -0
  10. package/src/Badge/Badge.svelte +13 -0
  11. package/src/Button/Button.svelte +8 -4
  12. package/src/Drawer/DrawerContent.svelte +0 -1
  13. package/src/FancyForm/FancyButton.svelte +30 -0
  14. package/src/FancyForm/FancyButtonRadio.svelte +70 -0
  15. package/src/FancyForm/FancyCheckbox.svelte +53 -0
  16. package/src/FancyForm/FancyField.svelte +126 -0
  17. package/src/FancyForm/FancyFieldLabel.svelte +25 -0
  18. package/src/FancyForm/FancyForm.svelte +40 -0
  19. package/src/FancyForm/FancyInput.svelte +77 -0
  20. package/src/FancyForm/FancySelect.svelte +147 -0
  21. package/src/FancyForm/index.js +6 -0
  22. package/src/Form/Core/DatePicker.svelte +1 -1
  23. package/src/Form/Core/Dropzone.svelte +71 -66
  24. package/src/Form/Core/EnvDropdown.svelte +276 -0
  25. package/src/Form/Core/Picker.svelte +141 -124
  26. package/src/Form/Core/Select.svelte +3 -0
  27. package/src/Form/Core/Switch.svelte +0 -2
  28. package/src/Form/Core/TextField.svelte +0 -6
  29. package/src/Form/EnvDropdown.svelte +50 -0
  30. package/src/Form/Input.svelte +0 -2
  31. package/src/Form/InputDropdown.svelte +0 -2
  32. package/src/Form/PickerDropdown.svelte +0 -2
  33. package/src/Form/Toggle.svelte +1 -2
  34. package/src/Icon/IconAvatar.svelte +3 -0
  35. package/src/InlineAlert/InlineAlert.svelte +1 -0
  36. package/src/Label/Label.svelte +1 -0
  37. package/src/Layout/Page.svelte +82 -13
  38. package/src/Link/Link.svelte +4 -1
  39. package/src/List/ListItem.svelte +6 -3
  40. package/src/Menu/Item.svelte +0 -2
  41. package/src/Modal/CustomContent.svelte +0 -1
  42. package/src/Modal/Modal.svench +0 -1
  43. package/src/Modal/ModalContent.svelte +4 -4
  44. package/src/Modal/QuizModal.svelte +0 -1
  45. package/src/Popover/Popover.svelte +35 -31
  46. package/src/Popover/Popover.svench +0 -1
  47. package/src/SideNavigation/Item.svelte +0 -2
  48. package/src/Table/RelationshipRenderer.svelte +3 -8
  49. package/src/Table/StringRenderer.svelte +9 -1
  50. package/src/Table/Table.svelte +30 -19
  51. package/src/Tabs/Tab.svelte +5 -5
  52. package/src/Tags/Tag.svelte +1 -1
  53. package/src/Tags/Tags.svelte +10 -0
  54. package/src/Typography/Heading.svelte +6 -0
  55. package/src/bbui.css +7 -3
  56. package/src/context.js +1 -0
  57. package/src/index.js +5 -0
@@ -0,0 +1,50 @@
1
+ <script>
2
+ import Field from "./Field.svelte"
3
+ import EnvDropdown from "./Core/EnvDropdown.svelte"
4
+ import { createEventDispatcher } from "svelte"
5
+
6
+ export let value = null
7
+ export let label = null
8
+ export let labelPosition = "above"
9
+ export let placeholder = null
10
+ export let type = "text"
11
+ export let disabled = false
12
+ export let readonly = false
13
+ export let error = null
14
+ export let updateOnChange = true
15
+ export let quiet = false
16
+ export let autofocus
17
+ export let variables
18
+ export let showModal
19
+ export let environmentVariablesEnabled
20
+ export let handleUpgradePanel
21
+ const dispatch = createEventDispatcher()
22
+ const onChange = e => {
23
+ value = e.detail
24
+ dispatch("change", e.detail)
25
+ }
26
+ </script>
27
+
28
+ <Field {label} {labelPosition} {error}>
29
+ <EnvDropdown
30
+ {updateOnChange}
31
+ {error}
32
+ {disabled}
33
+ {readonly}
34
+ {value}
35
+ {placeholder}
36
+ {type}
37
+ {quiet}
38
+ {autofocus}
39
+ {variables}
40
+ {showModal}
41
+ {environmentVariablesEnabled}
42
+ {handleUpgradePanel}
43
+ on:change={onChange}
44
+ on:click
45
+ on:input
46
+ on:blur
47
+ on:focus
48
+ on:keyup
49
+ />
50
+ </Field>
@@ -13,7 +13,6 @@
13
13
  export let error = null
14
14
  export let updateOnChange = true
15
15
  export let quiet = false
16
- export let dataCy
17
16
  export let autofocus
18
17
 
19
18
  const dispatch = createEventDispatcher()
@@ -25,7 +24,6 @@
25
24
 
26
25
  <Field {label} {labelPosition} {error}>
27
26
  <TextField
28
- {dataCy}
29
27
  {updateOnChange}
30
28
  {error}
31
29
  {disabled}
@@ -14,7 +14,6 @@
14
14
  export let error = null
15
15
  export let updateOnChange = true
16
16
  export let quiet = false
17
- export let dataCy
18
17
  export let autofocus
19
18
  export let options = []
20
19
 
@@ -32,7 +31,6 @@
32
31
 
33
32
  <Field {label} {labelPosition} {error}>
34
33
  <InputDropdown
35
- {dataCy}
36
34
  {updateOnChange}
37
35
  {error}
38
36
  {disabled}
@@ -21,7 +21,6 @@
21
21
  export let getSecondaryOptionColour = () => {}
22
22
  export let getSecondaryOptionIcon = () => {}
23
23
  export let quiet = false
24
- export let dataCy
25
24
  export let autofocus
26
25
  export let primaryOptions = []
27
26
  export let secondaryOptions = []
@@ -98,7 +97,6 @@
98
97
  <PickerDropdown
99
98
  {searchTerm}
100
99
  {autocomplete}
101
- {dataCy}
102
100
  {error}
103
101
  {disabled}
104
102
  {readonly}
@@ -9,7 +9,6 @@
9
9
  export let text = null
10
10
  export let disabled = false
11
11
  export let error = null
12
- export let dataCy = null
13
12
 
14
13
  const dispatch = createEventDispatcher()
15
14
  const onChange = e => {
@@ -19,5 +18,5 @@
19
18
  </script>
20
19
 
21
20
  <Field {label} {labelPosition} {error}>
22
- <Switch {dataCy} {error} {disabled} {text} {value} on:change={onChange} />
21
+ <Switch {error} {disabled} {text} {value} on:change={onChange} />
23
22
  </Field>
@@ -19,6 +19,7 @@
19
19
  .icon {
20
20
  width: 28px;
21
21
  height: 28px;
22
+ flex: 0 0 28px;
22
23
  display: grid;
23
24
  place-items: center;
24
25
  border-radius: 50%;
@@ -34,6 +35,7 @@
34
35
  .icon.size--S {
35
36
  width: 22px;
36
37
  height: 22px;
38
+ flex: 0 0 22px;
37
39
  }
38
40
  .icon.size--S :global(.spectrum-Icon) {
39
41
  width: 16px;
@@ -46,6 +48,7 @@
46
48
  .icon.size--L {
47
49
  width: 40px;
48
50
  height: 40px;
51
+ flex: 0 0 40px;
49
52
  }
50
53
  .icon.size--L :global(.spectrum-Icon) {
51
54
  width: 28px;
@@ -56,5 +56,6 @@
56
56
  --spectrum-semantic-positive-icon-color: #2d9d78;
57
57
  --spectrum-semantic-negative-icon-color: #e34850;
58
58
  min-width: 100px;
59
+ margin: 0;
59
60
  }
60
61
  </style>
@@ -21,6 +21,7 @@
21
21
  label {
22
22
  padding: 0;
23
23
  white-space: nowrap;
24
+ color: var(--spectrum-global-color-gray-600);
24
25
  }
25
26
 
26
27
  .muted {
@@ -1,32 +1,101 @@
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 class="fix-scroll-padding" />
22
+ </div>
23
+ </div>
24
+ <div
25
+ id="side-panel"
26
+ class:visible={sidePanelVisble}
27
+ use:clickOutside={() => {
28
+ sidePanelVisble = false
29
+ }}
30
+ >
31
+ <slot name="side-panel" />
32
+ </div>
9
33
  </div>
10
34
 
11
35
  <style>
12
- div {
36
+ .page {
37
+ position: relative;
38
+ }
39
+ .page,
40
+ .main {
41
+ display: flex;
42
+ flex-direction: row;
43
+ justify-content: flex-start;
44
+ align-items: stretch;
45
+ flex: 1 1 auto;
46
+ overflow-x: hidden;
47
+ }
48
+ .main {
49
+ overflow: auto;
50
+ }
51
+ .content {
13
52
  display: flex;
14
53
  flex-direction: column;
15
54
  justify-content: flex-start;
16
55
  align-items: stretch;
17
- max-width: var(--max-width);
56
+ max-width: 1080px;
18
57
  margin: 0 auto;
19
- padding: calc(var(--spacing-xl) * 2);
20
- min-height: calc(100% - var(--spacing-xl) * 4);
58
+ flex: 1 1 auto;
59
+ padding: 50px 50px 0 50px;
60
+ z-index: 1;
21
61
  }
22
-
23
- .wide {
62
+ .fix-scroll-padding {
63
+ content: "";
64
+ display: block;
65
+ flex: 0 0 50px;
66
+ }
67
+ .content.wide {
24
68
  max-width: none;
25
- margin: 0;
69
+ }
70
+ .content.narrow {
71
+ max-width: 840px;
72
+ }
73
+ #side-panel {
74
+ position: absolute;
75
+ right: 0;
76
+ top: 0;
77
+ padding: 24px;
78
+ background: var(--background);
79
+ border-left: var(--border-light);
80
+ width: 320px;
81
+ max-width: calc(100vw - 48px - 48px);
82
+ overflow: auto;
83
+ overflow-x: hidden;
84
+ transform: translateX(100%);
85
+ transition: transform 130ms ease-out;
86
+ height: calc(100% - 48px);
87
+ z-index: 2;
88
+ }
89
+ #side-panel.visible {
90
+ transform: translateX(0);
26
91
  }
27
92
 
28
- .noPadding {
29
- padding: 0px;
30
- margin: 0px;
93
+ @media (max-width: 640px) {
94
+ .content {
95
+ padding: 24px;
96
+ max-width: calc(100vw - 48px) !important;
97
+ width: calc(100vw - 48px) !important;
98
+ overflow: auto;
99
+ }
31
100
  }
32
101
  </style>
@@ -1,5 +1,6 @@
1
1
  <script>
2
2
  import "@spectrum-css/link/dist/index-vars.css"
3
+ import { createEventDispatcher } from "svelte"
3
4
 
4
5
  export let href = "#"
5
6
  export let size = "M"
@@ -9,10 +10,12 @@
9
10
  export let overBackground = false
10
11
  export let target
11
12
  export let download
13
+
14
+ const dispatch = createEventDispatcher()
12
15
  </script>
13
16
 
14
17
  <a
15
- on:click
18
+ on:click={e => dispatch("click") && e.stopPropagation()}
16
19
  {href}
17
20
  {target}
18
21
  {download}
@@ -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;
@@ -5,7 +5,6 @@
5
5
  const dispatch = createEventDispatcher()
6
6
  const actionMenu = getContext("actionMenu")
7
7
 
8
- export let dataCy
9
8
  export let icon = undefined
10
9
  export let disabled = undefined
11
10
  export let noClose = false
@@ -35,7 +34,6 @@
35
34
  </script>
36
35
 
37
36
  <li
38
- data-cy={dataCy}
39
37
  on:click|preventDefault={disabled ? null : onClick}
40
38
  class="spectrum-Menu-item"
41
39
  class:is-disabled={disabled}
@@ -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
 
@@ -23,7 +23,7 @@
23
23
  export let secondaryButtonText = undefined
24
24
  export let secondaryAction = undefined
25
25
  export let secondaryButtonWarning = false
26
- export let dataCy = null
26
+
27
27
  const { hide, cancel } = getContext(Context.Modal)
28
28
  let loading = false
29
29
  $: confirmDisabled = disabled || loading
@@ -63,7 +63,6 @@
63
63
  role="dialog"
64
64
  tabindex="-1"
65
65
  aria-modal="true"
66
- data-cy={dataCy}
67
66
  >
68
67
  <div class="spectrum-Dialog-grid">
69
68
  {#if title || $$slots.header}
@@ -104,7 +103,7 @@
104
103
  {/if}
105
104
 
106
105
  {#if showCancelButton}
107
- <Button group secondary newStyles on:click={close}>
106
+ <Button group secondary on:click={close}>
108
107
  {cancelText}
109
108
  </Button>
110
109
  {/if}
@@ -151,7 +150,8 @@
151
150
  overflow: visible;
152
151
  }
153
152
  .spectrum-Dialog-heading {
154
- font-family: var(--font-sans);
153
+ font-family: var(--font-accent);
154
+ font-weight: 600;
155
155
  }
156
156
  .spectrum-Dialog-heading.noDivider {
157
157
  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,24 +4,22 @@
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"
8
+ import { getContext } from "svelte"
9
+ import Context from "../context"
7
10
 
8
11
  const dispatch = createEventDispatcher()
9
12
 
10
13
  export let anchor
11
14
  export let align = "right"
12
15
  export let portalTarget
13
- export let dataCy
14
16
  export let maxWidth
17
+ export let open = false
18
+ export let useAnchorWidth = false
19
+ export let dismissible = true
20
+ export let offset = 5
15
21
 
16
- export let direction = "bottom"
17
- export let showTip = false
18
-
19
- let tipSvg =
20
- '<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>'
21
-
22
- $: tooltipClasses = showTip
23
- ? `spectrum-Popover--withTip spectrum-Popover--${direction}`
24
- : ""
22
+ $: target = portalTarget || getContext(Context.PopoverRoot) || ".spectrum"
25
23
 
26
24
  export const show = () => {
27
25
  dispatch("open")
@@ -35,13 +33,22 @@
35
33
 
36
34
  const handleOutsideClick = e => {
37
35
  if (open) {
38
- e.stopPropagation()
36
+ // Stop propagation if the source is the anchor
37
+ let node = e.target
38
+ let fromAnchor = false
39
+ while (!fromAnchor && node && node.parentNode) {
40
+ fromAnchor = node === anchor
41
+ node = node.parentNode
42
+ }
43
+ if (fromAnchor) {
44
+ e.stopPropagation()
45
+ }
46
+
47
+ // Hide the popover
39
48
  hide()
40
49
  }
41
50
  }
42
51
 
43
- let open = null
44
-
45
52
  function handleEscape(e) {
46
53
  if (open && e.key === "Escape") {
47
54
  hide()
@@ -50,20 +57,25 @@
50
57
  </script>
51
58
 
52
59
  {#if open}
53
- <Portal target={portalTarget}>
60
+ <Portal {target}>
54
61
  <div
55
62
  tabindex="0"
56
- use:positionDropdown={{ anchor, align, maxWidth }}
57
- use:clickOutside={handleOutsideClick}
63
+ use:positionDropdown={{
64
+ anchor,
65
+ align,
66
+ maxWidth,
67
+ useAnchorWidth,
68
+ offset,
69
+ }}
70
+ use:clickOutside={{
71
+ callback: dismissible ? handleOutsideClick : () => {},
72
+ anchor,
73
+ }}
58
74
  on:keydown={handleEscape}
59
- class={"spectrum-Popover is-open " + (tooltipClasses || "")}
75
+ class="spectrum-Popover is-open"
60
76
  role="presentation"
61
- data-cy={dataCy}
77
+ transition:fly|local={{ y: -20, duration: 200 }}
62
78
  >
63
- {#if showTip}
64
- {@html tipSvg}
65
- {/if}
66
-
67
79
  <slot />
68
80
  </div>
69
81
  </Portal>
@@ -73,14 +85,6 @@
73
85
  .spectrum-Popover {
74
86
  min-width: var(--spectrum-global-dimension-size-2000);
75
87
  border-color: var(--spectrum-global-color-gray-300);
76
- }
77
- .spectrum-Popover.is-open.spectrum-Popover--withTip {
78
- margin-top: var(--spacing-xs);
79
- margin-left: var(--spacing-xl);
80
- }
81
- :global(.spectrum-Popover--bottom .spectrum-Popover-tip),
82
- :global(.spectrum-Popover--top .spectrum-Popover-tip) {
83
- left: 90%;
84
- margin-left: calc(var(--spectrum-global-dimension-size-150) * -1);
88
+ overflow: auto;
85
89
  }
86
90
  </style>
@@ -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 {
@@ -8,7 +8,6 @@
8
8
  export let icon = ""
9
9
  export let selected = false
10
10
  export let disabled = false
11
- export let dataCy
12
11
  export let badge = ""
13
12
  </script>
14
13
 
@@ -17,7 +16,6 @@
17
16
  class:is-selected={selected}
18
17
  class:is-disabled={disabled}
19
18
  on:click
20
- data-cy={dataCy}
21
19
  >
22
20
  {#if heading}
23
21
  <h2 class="spectrum-SideNav-heading" id="nav-heading-{heading}">
@@ -1,6 +1,7 @@
1
1
  <script>
2
2
  import "@spectrum-css/label/dist/index-vars.css"
3
3
  import { createEventDispatcher } from "svelte"
4
+ import Badge from "../Badge/Badge.svelte"
4
5
 
5
6
  export let row
6
7
  export let value
@@ -24,17 +25,11 @@
24
25
 
25
26
  {#each relationships as relationship}
26
27
  {#if relationship?.primaryDisplay}
27
- <span class="spectrum-Label spectrum-Label--grey" on:click={onClick}>
28
+ <Badge hoverable grey on:click={onClick}>
28
29
  {relationship.primaryDisplay}
29
- </span>
30
+ </Badge>
30
31
  {/if}
31
32
  {/each}
32
33
  {#if leftover}
33
34
  <div>+{leftover} more</div>
34
35
  {/if}
35
-
36
- <style>
37
- span:hover {
38
- cursor: pointer;
39
- }
40
- </style>
@@ -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>