@budibase/bbui 0.9.184 → 0.9.185-alpha.11

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": "0.9.184",
4
+ "version": "0.9.185-alpha.11",
5
5
  "license": "AGPL-3.0",
6
6
  "svelte": "src/index.js",
7
7
  "module": "dist/bbui.es.js",
@@ -51,6 +51,7 @@
51
51
  "@spectrum-css/fieldlabel": "^3.0.1",
52
52
  "@spectrum-css/icon": "^3.0.1",
53
53
  "@spectrum-css/illustratedmessage": "^3.0.2",
54
+ "@spectrum-css/inlinealert": "^2.0.1",
54
55
  "@spectrum-css/inputgroup": "^3.0.2",
55
56
  "@spectrum-css/label": "^2.0.10",
56
57
  "@spectrum-css/link": "^3.1.1",
@@ -81,5 +82,5 @@
81
82
  "svelte-flatpickr": "^3.2.3",
82
83
  "svelte-portal": "^1.0.0"
83
84
  },
84
- "gitHead": "4db512d87ec1a8cb90196a5428ad48e4411e1985"
85
+ "gitHead": "d6018c2c9cb114e5daa8e9e12f5ccc461e0f6f0b"
85
86
  }
@@ -36,5 +36,7 @@
36
36
  {getOptionLabel}
37
37
  {getOptionValue}
38
38
  on:change={onChange}
39
+ on:pick
40
+ on:type
39
41
  />
40
42
  </Field>
@@ -21,6 +21,7 @@
21
21
  <label
22
22
  class="spectrum-Checkbox spectrum-Checkbox--emphasized {sizeClass}"
23
23
  class:is-invalid={!!error}
24
+ class:checked={value}
24
25
  >
25
26
  <input
26
27
  checked={value}
@@ -50,6 +51,16 @@
50
51
  </label>
51
52
 
52
53
  <style>
54
+ .spectrum-Checkbox--sizeL .spectrum-Checkbox-checkmark {
55
+ transform: scale(1.1);
56
+ left: 55%;
57
+ top: 55%;
58
+ }
59
+ .spectrum-Checkbox--sizeXL .spectrum-Checkbox-checkmark {
60
+ transform: scale(1.2);
61
+ left: 60%;
62
+ top: 60%;
63
+ }
53
64
  .spectrum-Checkbox-input {
54
65
  opacity: 0;
55
66
  }
@@ -40,8 +40,15 @@
40
40
  open = false
41
41
  }
42
42
 
43
- const onChange = e => {
44
- selectOption(e.target.value)
43
+ const onType = e => {
44
+ const value = e.target.value
45
+ dispatch("type", value)
46
+ selectOption(value)
47
+ }
48
+
49
+ const onPick = value => {
50
+ dispatch("pick", value)
51
+ selectOption(value)
45
52
  }
46
53
  </script>
47
54
 
@@ -62,7 +69,7 @@
62
69
  type="text"
63
70
  on:focus={() => (focus = true)}
64
71
  on:blur={() => (focus = false)}
65
- on:change={onChange}
72
+ on:change={onType}
66
73
  value={value || ""}
67
74
  placeholder={placeholder || ""}
68
75
  {disabled}
@@ -99,7 +106,7 @@
99
106
  role="option"
100
107
  aria-selected="true"
101
108
  tabindex="0"
102
- on:click={() => selectOption(getOptionValue(option))}
109
+ on:click={() => onPick(getOptionValue(option))}
103
110
  >
104
111
  <span class="spectrum-Menu-itemLabel"
105
112
  >{getOptionLabel(option)}</span
@@ -0,0 +1,52 @@
1
+ <script>
2
+ import "@spectrum-css/inlinealert/dist/index-vars.css"
3
+ import Button from "../Button/Button.svelte"
4
+
5
+ export let type = "info"
6
+ export let header = ""
7
+ export let message = ""
8
+ export let onConfirm = undefined
9
+
10
+ $: icon = selectIcon(type)
11
+
12
+ function selectIcon(alertType) {
13
+ switch (alertType) {
14
+ case "error":
15
+ case "negative":
16
+ return "Alert"
17
+ case "success":
18
+ return "CheckmarkCircle"
19
+ case "help":
20
+ return "Help"
21
+ default:
22
+ return "Info"
23
+ }
24
+ }
25
+ </script>
26
+
27
+ <div class="spectrum-InLineAlert spectrum-InLineAlert--{type}">
28
+ <svg
29
+ class="spectrum-Icon spectrum-Icon--sizeM spectrum-InLineAlert-icon"
30
+ focusable="false"
31
+ aria-hidden="true"
32
+ >
33
+ <use xlink:href="#spectrum-icon-18-{icon}" />
34
+ </svg>
35
+ <div class="spectrum-InLineAlert-header">{header}</div>
36
+ <div class="spectrum-InLineAlert-content">{message}</div>
37
+ {#if onConfirm}
38
+ <div class="spectrum-InLineAlert-footer">
39
+ <Button secondary on:click={onConfirm}>OK</Button>
40
+ </div>
41
+ {/if}
42
+ </div>
43
+
44
+ <style>
45
+ .spectrum-InLineAlert {
46
+ --spectrum-semantic-negative-border-color: #e34850;
47
+ --spectrum-semantic-positive-border-color: #2d9d78;
48
+ --spectrum-semantic-positive-icon-color: #2d9d78;
49
+ --spectrum-semantic-negative-icon-color: #e34850;
50
+ min-width: 100px;
51
+ }
52
+ </style>
@@ -1,16 +1,67 @@
1
1
  <script>
2
2
  import "@spectrum-css/fieldlabel/dist/index-vars.css"
3
+ import Tooltip from "../Tooltip/Tooltip.svelte"
4
+ import Icon from "../Icon/Icon.svelte"
3
5
 
4
6
  export let size = "M"
7
+ export let tooltip = ""
8
+ export let showTooltip = false
5
9
  </script>
6
10
 
7
- <label for="" class={`spectrum-FieldLabel spectrum-FieldLabel--size${size}`}>
8
- <slot />
9
- </label>
11
+ {#if tooltip}
12
+ <div class="container">
13
+ <label
14
+ for=""
15
+ class={`spectrum-FieldLabel spectrum-FieldLabel--size${size}`}
16
+ >
17
+ <slot />
18
+ </label>
19
+ <div class="icon-container">
20
+ <div
21
+ class="icon"
22
+ on:mouseover={() => (showTooltip = true)}
23
+ on:mouseleave={() => (showTooltip = false)}
24
+ >
25
+ <Icon name="InfoOutline" size="S" disabled={true} />
26
+ </div>
27
+ {#if showTooltip}
28
+ <div class="tooltip">
29
+ <Tooltip textWrapping={true} direction={"bottom"} text={tooltip} />
30
+ </div>
31
+ {/if}
32
+ </div>
33
+ </div>
34
+ {:else}
35
+ <label for="" class={`spectrum-FieldLabel spectrum-FieldLabel--size${size}`}>
36
+ <slot />
37
+ </label>
38
+ {/if}
10
39
 
11
40
  <style>
12
41
  label {
13
42
  padding: 0;
14
43
  white-space: nowrap;
15
44
  }
45
+ .container {
46
+ display: flex;
47
+ }
48
+ .icon-container {
49
+ position: relative;
50
+ display: flex;
51
+ justify-content: center;
52
+ margin-top: 1px;
53
+ margin-left: 5px;
54
+ margin-right: 5px;
55
+ }
56
+ .tooltip {
57
+ position: absolute;
58
+ display: flex;
59
+ justify-content: center;
60
+ top: 15px;
61
+ z-index: 1;
62
+ width: 160px;
63
+ }
64
+ .icon {
65
+ transform: scale(0.75);
66
+ }
16
67
  </style>
@@ -3,12 +3,22 @@
3
3
 
4
4
  export let direction = "top"
5
5
  export let text = ""
6
+ export let textWrapping = false
6
7
  </script>
7
8
 
8
- <span class="u-tooltip-showOnHover tooltip">
9
- <slot />
10
- <div class={`spectrum-Tooltip spectrum-Tooltip--${direction}`}>
9
+ <!-- Showing / Hiding a text wrapped tooltip should be handled outside the component -->
10
+ {#if textWrapping}
11
+ <span class="spectrum-Tooltip spectrum-Tooltip--{direction} is-open">
11
12
  <span class="spectrum-Tooltip-label">{text}</span>
12
13
  <span class="spectrum-Tooltip-tip" />
13
- </div>
14
- </span>
14
+ </span>
15
+ {:else}
16
+ <!-- The default show on hover tooltip does not support text wrapping -->
17
+ <span class="u-tooltip-showOnHover tooltip">
18
+ <slot />
19
+ <div class={`spectrum-Tooltip spectrum-Tooltip--${direction}`}>
20
+ <span class="spectrum-Tooltip-label">{text}</span>
21
+ <span class="spectrum-Tooltip-tip" />
22
+ </div>
23
+ </span>
24
+ {/if}
package/src/index.js CHANGED
@@ -58,6 +58,7 @@ export { default as Pagination } from "./Pagination/Pagination.svelte"
58
58
  export { default as Badge } from "./Badge/Badge.svelte"
59
59
  export { default as StatusLight } from "./StatusLight/StatusLight.svelte"
60
60
  export { default as ColorPicker } from "./ColorPicker/ColorPicker.svelte"
61
+ export { default as InlineAlert } from "./InlineAlert/InlineAlert.svelte"
61
62
 
62
63
  // Typography
63
64
  export { default as Body } from "./Typography/Body.svelte"