@budibase/bbui 1.1.32-alpha.2 → 1.1.32-alpha.3

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": "1.1.32-alpha.2",
4
+ "version": "1.1.32-alpha.3",
5
5
  "license": "MPL-2.0",
6
6
  "svelte": "src/index.js",
7
7
  "module": "dist/bbui.es.js",
@@ -38,7 +38,7 @@
38
38
  ],
39
39
  "dependencies": {
40
40
  "@adobe/spectrum-css-workflow-icons": "^1.2.1",
41
- "@budibase/string-templates": "1.1.32-alpha.2",
41
+ "@budibase/string-templates": "1.1.32-alpha.3",
42
42
  "@spectrum-css/actionbutton": "^1.0.1",
43
43
  "@spectrum-css/actiongroup": "^1.0.1",
44
44
  "@spectrum-css/avatar": "^3.0.2",
@@ -85,5 +85,5 @@
85
85
  "svelte-flatpickr": "^3.2.3",
86
86
  "svelte-portal": "^1.0.0"
87
87
  },
88
- "gitHead": "ec8c17db7d93b365efa683cc511c15648e9d5928"
88
+ "gitHead": "1b7322e51adc38e71f59caa2daf057304df07771"
89
89
  }
@@ -115,6 +115,16 @@
115
115
  class:is-disabled={disabled}
116
116
  class:is-focused={focus}
117
117
  >
118
+ {#if error}
119
+ <svg
120
+ class="spectrum-Icon spectrum-Icon--sizeM spectrum-Textfield-validationIcon"
121
+ focusable="false"
122
+ aria-hidden="true"
123
+ >
124
+ <use xlink:href="#spectrum-icon-18-Alert" />
125
+ </svg>
126
+ {/if}
127
+
118
128
  <input
119
129
  {id}
120
130
  on:click
@@ -8,6 +8,7 @@
8
8
  import Icon from "../../Icon/Icon.svelte"
9
9
  import StatusLight from "../../StatusLight/StatusLight.svelte"
10
10
  import Detail from "../../Typography/Detail.svelte"
11
+ import Search from "./Search.svelte"
11
12
 
12
13
  export let primaryLabel = ""
13
14
  export let primaryValue = null
@@ -22,7 +23,6 @@
22
23
  export let secondaryFieldText = ""
23
24
  export let secondaryFieldIcon = ""
24
25
  export let secondaryFieldColour = ""
25
- export let getPrimaryOptionLabel = option => option
26
26
  export let getPrimaryOptionValue = option => option
27
27
  export let getPrimaryOptionColour = () => null
28
28
  export let getPrimaryOptionIcon = () => null
@@ -43,17 +43,12 @@
43
43
  let searchTerm = null
44
44
 
45
45
  $: groupTitles = Object.keys(primaryOptions)
46
- $: filteredOptions = getFilteredOptions(
47
- primaryOptions,
48
- searchTerm,
49
- getPrimaryOptionLabel
50
- )
51
46
  let iconData
52
- /*
53
- $: iconData = primaryOptions?.find(x => {
54
- return x.name === primaryFieldText
55
- })
56
- */
47
+
48
+ const updateSearch = e => {
49
+ dispatch("search", e.detail)
50
+ }
51
+
57
52
  const updateValue = newValue => {
58
53
  if (readonly) {
59
54
  return
@@ -107,16 +102,6 @@
107
102
  updateValue(event.target.value)
108
103
  }
109
104
  }
110
-
111
- const getFilteredOptions = (options, term, getLabel) => {
112
- if (autocomplete && term) {
113
- const lowerCaseTerm = term.toLowerCase()
114
- return options.filter(option => {
115
- return `${getLabel(option)}`.toLowerCase().includes(lowerCaseTerm)
116
- })
117
- }
118
- return options
119
- }
120
105
  </script>
121
106
 
122
107
  <div
@@ -183,6 +168,15 @@
183
168
  class:auto-width={autoWidth}
184
169
  class:is-full-width={!secondaryOptions.length}
185
170
  >
171
+ {#if autocomplete}
172
+ <Search
173
+ value={searchTerm}
174
+ on:change={event => updateSearch(event)}
175
+ {disabled}
176
+ placeholder="Search"
177
+ />
178
+ {/if}
179
+
186
180
  <ul class="spectrum-Menu" role="listbox">
187
181
  {#if placeholderOption}
188
182
  <li
@@ -26,6 +26,7 @@
26
26
  export let autofocus
27
27
  export let primaryOptions = []
28
28
  export let secondaryOptions = []
29
+ export let searchTerm
29
30
 
30
31
  let primaryLabel
31
32
  let secondaryLabel
@@ -87,10 +88,15 @@
87
88
  }
88
89
  return value
89
90
  }
91
+
92
+ const updateSearchTerm = e => {
93
+ searchTerm = e.detail
94
+ }
90
95
  </script>
91
96
 
92
97
  <Field {label} {labelPosition} {error}>
93
98
  <PickerDropdown
99
+ {searchTerm}
94
100
  {autocomplete}
95
101
  {dataCy}
96
102
  {updateOnChange}
@@ -116,6 +122,7 @@
116
122
  {secondaryLabel}
117
123
  on:pickprimary={onPickPrimary}
118
124
  on:picksecondary={onPickSecondary}
125
+ on:search={updateSearchTerm}
119
126
  on:click
120
127
  on:input
121
128
  on:blur