@budibase/bbui 3.5.3 → 3.7.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.
@@ -1,29 +1,31 @@
1
- <script>
1
+ <script lang="ts" generics="Option">
2
2
  import { createEventDispatcher } from "svelte"
3
3
  import Multiselect from "./Core/Multiselect.svelte"
4
4
  import Field from "./Field.svelte"
5
5
 
6
- export let value = []
7
- export let label = null
6
+ export let value: string[] | string = []
7
+ export let label: string | undefined = undefined
8
8
  export let disabled = false
9
9
  export let readonly = false
10
10
  export let labelPosition = "above"
11
- export let error = null
12
- export let placeholder = null
13
- export let options = []
14
- export let getOptionLabel = option => option
15
- export let getOptionValue = option => option
11
+ export let error: string | undefined = undefined
12
+ export let placeholder: string | undefined = undefined
13
+ export let options: Option[] = []
14
+ export let getOptionLabel = (option: Option) => option
15
+ export let getOptionValue = (option: Option) => option
16
16
  export let sort = false
17
17
  export let autoWidth = false
18
18
  export let autocomplete = false
19
- export let searchTerm = null
20
- export let customPopoverHeight
21
- export let helpText = null
19
+ export let searchTerm: string | undefined = undefined
20
+ export let customPopoverHeight: string | undefined = undefined
21
+ export let helpText: string | undefined = undefined
22
22
  export let onOptionMouseenter = () => {}
23
23
  export let onOptionMouseleave = () => {}
24
24
 
25
+ $: arrayValue = value && !Array.isArray(value) ? [value] : (value as string[])
26
+
25
27
  const dispatch = createEventDispatcher()
26
- const onChange = e => {
28
+ const onChange = (e: any) => {
27
29
  value = e.detail
28
30
  dispatch("change", e.detail)
29
31
  }
@@ -31,10 +33,9 @@
31
33
 
32
34
  <Field {helpText} {label} {labelPosition} {error}>
33
35
  <Multiselect
34
- {error}
35
36
  {disabled}
36
37
  {readonly}
37
- {value}
38
+ bind:value={arrayValue}
38
39
  {options}
39
40
  {placeholder}
40
41
  {sort}
@@ -1,9 +1,4 @@
1
- <script lang="ts" context="module">
2
- type O = any
3
- type V = any
4
- </script>
5
-
6
- <script lang="ts">
1
+ <script lang="ts" generics="O extends any,V">
7
2
  import Field from "./Field.svelte"
8
3
  import Select from "./Core/Select.svelte"
9
4
  import { createEventDispatcher } from "svelte"
@@ -22,9 +17,11 @@
22
17
  export let getOptionValue = (option: O, _index?: number) =>
23
18
  extractProperty(option, "value")
24
19
  export let getOptionSubtitle = (option: O, _index?: number) =>
25
- option?.subtitle
26
- export let getOptionIcon = (option: O, _index?: number) => option?.icon
27
- export let getOptionColour = (option: O, _index?: number) => option?.colour
20
+ (option as any)?.subtitle
21
+ export let getOptionIcon = (option: O, _index?: number) =>
22
+ (option as any)?.icon
23
+ export let getOptionColour = (option: O, _index?: number) =>
24
+ (option as any)?.colour
28
25
  export let useOptionIconImage = false
29
26
  export let isOptionEnabled:
30
27
  | ((_option: O, _index?: number) => boolean)
@@ -3,10 +3,10 @@
3
3
  import Switch from "./Core/Switch.svelte"
4
4
  import { createEventDispatcher } from "svelte"
5
5
 
6
- export let value = null
6
+ export let value = undefined
7
7
  export let label = null
8
8
  export let labelPosition = "above"
9
- export let text = null
9
+ export let text = undefined
10
10
  export let disabled = false
11
11
  export let error = null
12
12
  export let helpText = null
@@ -89,7 +89,7 @@
89
89
  /* Selection is only meant for standalone list items (non stacked) so we just set a fixed border radius */
90
90
  .list-item.selected {
91
91
  background-color: var(--spectrum-global-color-blue-100);
92
- border-color: var(--spectrum-global-color-blue-100);
92
+ border: none;
93
93
  }
94
94
  .list-item.selected:after {
95
95
  content: "";
@@ -100,7 +100,7 @@
100
100
  pointer-events: none;
101
101
  top: 0;
102
102
  left: 0;
103
- border-radius: 4px;
103
+ border-radius: inherit;
104
104
  box-sizing: border-box;
105
105
  z-index: 1;
106
106
  opacity: 0.5;
@@ -1,8 +1,8 @@
1
1
  <script lang="ts">
2
2
  import SpectrumMDE from "./SpectrumMDE.svelte"
3
3
 
4
- export let value: string | null = null
5
- export let height: string | null = null
4
+ export let value: string | undefined = undefined
5
+ export let height: string | undefined = undefined
6
6
 
7
7
  let mde: any
8
8
 
@@ -40,6 +40,7 @@
40
40
  border: none;
41
41
  background: transparent;
42
42
  padding: 0;
43
+ color: inherit;
43
44
  }
44
45
  .markdown-viewer :global(.EasyMDEContainer) {
45
46
  background: transparent;
@@ -3,7 +3,7 @@
3
3
  import Icon from "../Icon/Icon.svelte"
4
4
 
5
5
  const dispatch = createEventDispatcher()
6
- const actionMenu = getContext("actionMenu") as { hideAll: () => void }
6
+ const actionMenu = getContext("actionMenu")
7
7
 
8
8
  export let icon: string | undefined = undefined
9
9
  export let disabled: boolean | undefined = undefined
package/src/bbui.css CHANGED
@@ -11,6 +11,16 @@
11
11
  --bb-forest-green: #053835;
12
12
  --bb-beige: #f6efea;
13
13
 
14
+ /* Custom spectrum additions */
15
+ --spectrum-global-color-static-red-1200: #740000;
16
+ --spectrum-global-color-static-orange-1200: #612300;
17
+ --spectrum-global-color-static-yellow-1200: #483300;
18
+ --spectrum-global-color-static-green-1200: #053f27;
19
+ --spectrum-global-color-static-seafoam-1200: #123c3a;
20
+ --spectrum-global-color-static-blue-1200: #003571;
21
+ --spectrum-global-color-static-indigo-1200: #262986;
22
+ --spectrum-global-color-static-magenta-1200: #700037;
23
+
14
24
  --grey-1: #fafafa;
15
25
  --grey-2: #f5f5f5;
16
26
  --grey-3: #eeeeee;
@@ -0,0 +1,10 @@
1
+ import { ActionMenu } from "./types"
2
+ import { ModalContext } from "./types"
3
+
4
+ declare module "svelte" {
5
+ export function getContext(key: "actionMenu"): ActionMenu | undefined
6
+ export function getContext(key: "bbui-modal"): ModalContext
7
+ }
8
+
9
+ export const Modal = "bbui-modal"
10
+ export const PopoverRoot = "bbui-popover-root"
package/src/index.ts CHANGED
@@ -111,3 +111,5 @@ export { banner, BANNER_TYPES } from "./Stores/banner"
111
111
 
112
112
  // Helpers
113
113
  export * as Helpers from "./helpers"
114
+
115
+ export type * from "./types"
@@ -0,0 +1,4 @@
1
+ export interface ActionMenu {
2
+ hide: () => void
3
+ hideAll: () => void
4
+ }
@@ -0,0 +1 @@
1
+ export type EnvDropdownType = "text" | "number" | "password" | "port"
@@ -0,0 +1,3 @@
1
+ export * from "./actionMenu"
2
+ export * from "./envDropdown"
3
+ export * from "./modalContext"
@@ -0,0 +1,3 @@
1
+ export interface ModalContext {
2
+ hide: () => void
3
+ }