@budibase/bbui 1.0.164-alpha.3 → 1.0.166

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.0.164-alpha.3",
4
+ "version": "1.0.166",
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.0.164-alpha.3",
41
+ "@budibase/string-templates": "^1.0.166",
42
42
  "@spectrum-css/actionbutton": "^1.0.1",
43
43
  "@spectrum-css/actiongroup": "^1.0.1",
44
44
  "@spectrum-css/avatar": "^3.0.2",
@@ -84,5 +84,5 @@
84
84
  "svelte-flatpickr": "^3.2.3",
85
85
  "svelte-portal": "^1.0.0"
86
86
  },
87
- "gitHead": "4f770d911cfe73a5b32f42d389b86c9baf58c848"
87
+ "gitHead": "a77f1e1a377a8c040528eb35cb1cd5673b07ead2"
88
88
  }
@@ -161,8 +161,8 @@
161
161
  <input
162
162
  data-input
163
163
  type="text"
164
+ {disabled}
164
165
  class="spectrum-Textfield-input spectrum-InputGroup-input"
165
- class:is-disabled={disabled}
166
166
  {placeholder}
167
167
  {id}
168
168
  {value}
@@ -172,7 +172,7 @@
172
172
  type="button"
173
173
  class="spectrum-Picker spectrum-Picker--sizeM spectrum-InputGroup-button"
174
174
  tabindex="-1"
175
- class:is-disabled={disabled}
175
+ {disabled}
176
176
  class:is-invalid={!!error}
177
177
  on:click={flatpickr?.open}
178
178
  >
@@ -217,7 +217,4 @@
217
217
  :global(.flatpickr-calendar) {
218
218
  font-family: "Source Sans Pro", sans-serif;
219
219
  }
220
- .is-disabled {
221
- pointer-events: none !important;
222
- }
223
220
  </style>
@@ -43,7 +43,7 @@
43
43
  return
44
44
  }
45
45
  searchTerm = null
46
- open = !open
46
+ open = true
47
47
  }
48
48
 
49
49
  const getSortedOptions = (options, getLabel, sort) => {
@@ -71,73 +71,105 @@
71
71
  }
72
72
  </script>
73
73
 
74
- <div use:clickOutside={() => (open = false)}>
75
- <button
76
- {id}
77
- class="spectrum-Picker spectrum-Picker--sizeM"
78
- class:spectrum-Picker--quiet={quiet}
79
- {disabled}
80
- class:is-invalid={!!error}
81
- class:is-open={open}
82
- aria-haspopup="listbox"
83
- on:mousedown={onClick}
84
- >
85
- {#if fieldIcon}
86
- <span class="icon-Placeholder-Padding">
87
- <img src={fieldIcon} alt="icon" width="20" height="15" />
88
- </span>
89
- {/if}
90
-
91
- <span
92
- class="spectrum-Picker-label"
93
- class:is-placeholder={isPlaceholder}
94
- class:auto-width={autoWidth}
95
- >
96
- {fieldText}
74
+ <button
75
+ {id}
76
+ class="spectrum-Picker spectrum-Picker--sizeM"
77
+ class:spectrum-Picker--quiet={quiet}
78
+ {disabled}
79
+ class:is-invalid={!!error}
80
+ class:is-open={open}
81
+ aria-haspopup="listbox"
82
+ on:mousedown={onClick}
83
+ >
84
+ {#if fieldIcon}
85
+ <span class="icon-Placeholder-Padding">
86
+ <img src={fieldIcon} alt="icon" width="20" height="15" />
97
87
  </span>
98
- {#if error}
99
- <svg
100
- class="spectrum-Icon spectrum-Icon--sizeM spectrum-Picker-validationIcon"
101
- focusable="false"
102
- aria-hidden="true"
103
- aria-label="Folder"
104
- >
105
- <use xlink:href="#spectrum-icon-18-Alert" />
106
- </svg>
107
- {/if}
88
+ {/if}
89
+
90
+ <span
91
+ class="spectrum-Picker-label"
92
+ class:is-placeholder={isPlaceholder}
93
+ class:auto-width={autoWidth}
94
+ >
95
+ {fieldText}
96
+ </span>
97
+ {#if error}
108
98
  <svg
109
- class="spectrum-Icon spectrum-UIIcon-ChevronDown100 spectrum-Picker-menuIcon"
99
+ class="spectrum-Icon spectrum-Icon--sizeM spectrum-Picker-validationIcon"
110
100
  focusable="false"
111
101
  aria-hidden="true"
102
+ aria-label="Folder"
112
103
  >
113
- <use xlink:href="#spectrum-css-icon-Chevron100" />
104
+ <use xlink:href="#spectrum-icon-18-Alert" />
114
105
  </svg>
115
- </button>
116
- {#if open}
117
- <div
118
- transition:fly|local={{ y: -20, duration: 200 }}
119
- class="spectrum-Popover spectrum-Popover--bottom spectrum-Picker-popover is-open"
120
- class:auto-width={autoWidth}
121
- >
122
- {#if autocomplete}
123
- <Search
124
- value={searchTerm}
125
- on:change={event => (searchTerm = event.detail)}
126
- {disabled}
127
- placeholder="Search"
128
- />
106
+ {/if}
107
+ <svg
108
+ class="spectrum-Icon spectrum-UIIcon-ChevronDown100 spectrum-Picker-menuIcon"
109
+ focusable="false"
110
+ aria-hidden="true"
111
+ >
112
+ <use xlink:href="#spectrum-css-icon-Chevron100" />
113
+ </svg>
114
+ </button>
115
+ {#if open}
116
+ <div
117
+ use:clickOutside={() => (open = false)}
118
+ transition:fly|local={{ y: -20, duration: 200 }}
119
+ class="spectrum-Popover spectrum-Popover--bottom spectrum-Picker-popover is-open"
120
+ class:auto-width={autoWidth}
121
+ >
122
+ {#if autocomplete}
123
+ <Search
124
+ value={searchTerm}
125
+ on:change={event => (searchTerm = event.detail)}
126
+ {disabled}
127
+ placeholder="Search"
128
+ />
129
+ {/if}
130
+ <ul class="spectrum-Menu" role="listbox">
131
+ {#if placeholderOption}
132
+ <li
133
+ class="spectrum-Menu-item placeholder"
134
+ class:is-selected={isPlaceholder}
135
+ role="option"
136
+ aria-selected="true"
137
+ tabindex="0"
138
+ on:click={() => onSelectOption(null)}
139
+ >
140
+ <span class="spectrum-Menu-itemLabel">{placeholderOption}</span>
141
+ <svg
142
+ class="spectrum-Icon spectrum-UIIcon-Checkmark100 spectrum-Menu-checkmark spectrum-Menu-itemIcon"
143
+ focusable="false"
144
+ aria-hidden="true"
145
+ >
146
+ <use xlink:href="#spectrum-css-icon-Checkmark100" />
147
+ </svg>
148
+ </li>
129
149
  {/if}
130
- <ul class="spectrum-Menu" role="listbox">
131
- {#if placeholderOption}
150
+ {#if filteredOptions.length}
151
+ {#each filteredOptions as option, idx}
132
152
  <li
133
- class="spectrum-Menu-item placeholder"
134
- class:is-selected={isPlaceholder}
153
+ class="spectrum-Menu-item"
154
+ class:is-selected={isOptionSelected(getOptionValue(option, idx))}
135
155
  role="option"
136
156
  aria-selected="true"
137
157
  tabindex="0"
138
- on:click={() => onSelectOption(null)}
158
+ on:click={() => onSelectOption(getOptionValue(option, idx))}
139
159
  >
140
- <span class="spectrum-Menu-itemLabel">{placeholderOption}</span>
160
+ {#if getOptionIcon(option, idx)}
161
+ <span class="icon-Padding">
162
+ <img
163
+ src={getOptionIcon(option, idx)}
164
+ alt="icon"
165
+ width="20"
166
+ height="15"
167
+ />
168
+ </span>
169
+ {/if}
170
+ <span class="spectrum-Menu-itemLabel">
171
+ {getOptionLabel(option, idx)}
172
+ </span>
141
173
  <svg
142
174
  class="spectrum-Icon spectrum-UIIcon-Checkmark100 spectrum-Menu-checkmark spectrum-Menu-itemIcon"
143
175
  focusable="false"
@@ -146,44 +178,11 @@
146
178
  <use xlink:href="#spectrum-css-icon-Checkmark100" />
147
179
  </svg>
148
180
  </li>
149
- {/if}
150
- {#if filteredOptions.length}
151
- {#each filteredOptions as option, idx}
152
- <li
153
- class="spectrum-Menu-item"
154
- class:is-selected={isOptionSelected(getOptionValue(option, idx))}
155
- role="option"
156
- aria-selected="true"
157
- tabindex="0"
158
- on:click={() => onSelectOption(getOptionValue(option, idx))}
159
- >
160
- {#if getOptionIcon(option, idx)}
161
- <span class="icon-Padding">
162
- <img
163
- src={getOptionIcon(option, idx)}
164
- alt="icon"
165
- width="20"
166
- height="15"
167
- />
168
- </span>
169
- {/if}
170
- <span class="spectrum-Menu-itemLabel">
171
- {getOptionLabel(option, idx)}
172
- </span>
173
- <svg
174
- class="spectrum-Icon spectrum-UIIcon-Checkmark100 spectrum-Menu-checkmark spectrum-Menu-itemIcon"
175
- focusable="false"
176
- aria-hidden="true"
177
- >
178
- <use xlink:href="#spectrum-css-icon-Checkmark100" />
179
- </svg>
180
- </li>
181
- {/each}
182
- {/if}
183
- </ul>
184
- </div>
185
- {/if}
186
- </div>
181
+ {/each}
182
+ {/if}
183
+ </ul>
184
+ </div>
185
+ {/if}
187
186
 
188
187
  <style>
189
188
  .spectrum-Popover {
@@ -1,6 +1,6 @@
1
1
  <script>
2
2
  import "@spectrum-css/textfield/dist/index-vars.css"
3
- import { createEventDispatcher, onMount } from "svelte"
3
+ import { createEventDispatcher } from "svelte"
4
4
 
5
5
  export let value = null
6
6
  export let placeholder = null
@@ -13,11 +13,8 @@
13
13
  export let quiet = false
14
14
  export let dataCy
15
15
  export let align
16
- export let autofocus = false
17
16
 
18
17
  const dispatch = createEventDispatcher()
19
-
20
- let field
21
18
  let focus = false
22
19
 
23
20
  const updateValue = newValue => {
@@ -61,11 +58,6 @@
61
58
  updateValue(event.target.value)
62
59
  }
63
60
  }
64
-
65
- onMount(() => {
66
- focus = autofocus
67
- if (focus) field.focus()
68
- })
69
61
  </script>
70
62
 
71
63
  <div
@@ -85,7 +77,6 @@
85
77
  </svg>
86
78
  {/if}
87
79
  <input
88
- bind:this={field}
89
80
  {disabled}
90
81
  {readonly}
91
82
  {id}
@@ -3,7 +3,6 @@ export { default as CoreSelect } from "./Select.svelte"
3
3
  export { default as CoreMultiselect } from "./Multiselect.svelte"
4
4
  export { default as CoreCheckbox } from "./Checkbox.svelte"
5
5
  export { default as CoreRadioGroup } from "./RadioGroup.svelte"
6
- export { default as CoreCheckboxGroup } from "./CheckboxGroup.svelte"
7
6
  export { default as CoreTextArea } from "./TextArea.svelte"
8
7
  export { default as CoreCombobox } from "./Combobox.svelte"
9
8
  export { default as CoreSwitch } from "./Switch.svelte"
@@ -14,7 +14,6 @@
14
14
  export let updateOnChange = true
15
15
  export let quiet = false
16
16
  export let dataCy
17
- export let autofocus
18
17
 
19
18
  const dispatch = createEventDispatcher()
20
19
  const onChange = e => {
@@ -34,7 +33,6 @@
34
33
  {placeholder}
35
34
  {type}
36
35
  {quiet}
37
- {autofocus}
38
36
  on:change={onChange}
39
37
  on:click
40
38
  on:input
@@ -1,68 +0,0 @@
1
- <script>
2
- import "@spectrum-css/fieldgroup/dist/index-vars.css"
3
- import "@spectrum-css/radio/dist/index-vars.css"
4
- import { createEventDispatcher } from "svelte"
5
-
6
- export let direction = "vertical"
7
- export let value = []
8
- export let options = []
9
- export let error = null
10
- export let disabled = false
11
- export let getOptionLabel = option => option
12
- export let getOptionValue = option => option
13
-
14
- const dispatch = createEventDispatcher()
15
- const onChange = e => {
16
- let tempValue = value
17
- let isChecked = e.target.checked
18
- if (!tempValue.includes(e.target.value) && isChecked) {
19
- tempValue.push(e.target.value)
20
- }
21
- value = tempValue
22
- dispatch(
23
- "change",
24
- tempValue.filter(val => val !== e.target.value || isChecked)
25
- )
26
- }
27
- </script>
28
-
29
- <div class={`spectrum-FieldGroup spectrum-FieldGroup--${direction}`}>
30
- {#if options && Array.isArray(options)}
31
- {#each options as option}
32
- <div
33
- title={getOptionLabel(option)}
34
- class="spectrum-Checkbox spectrum-FieldGroup-item"
35
- class:is-invalid={!!error}
36
- >
37
- <label
38
- class="spectrum-Checkbox spectrum-Checkbox--sizeM spectrum-FieldGroup-item"
39
- >
40
- <input
41
- on:change={onChange}
42
- value={getOptionValue(option)}
43
- type="checkbox"
44
- class="spectrum-Checkbox-input"
45
- {disabled}
46
- checked={value.includes(getOptionValue(option))}
47
- />
48
- <span class="spectrum-Checkbox-box">
49
- <svg
50
- class="spectrum-Icon spectrum-UIIcon-Checkmark100 spectrum-Checkbox-checkmark"
51
- focusable="false"
52
- aria-hidden="true"
53
- >
54
- <use xlink:href="#spectrum-css-icon-Checkmark100" />
55
- </svg>
56
- </span>
57
- <span class="spectrum-Checkbox-label">{getOptionLabel(option)}</span>
58
- </label>
59
- </div>
60
- {/each}
61
- {/if}
62
- </div>
63
-
64
- <style>
65
- .spectrum-Checkbox-input {
66
- opacity: 0;
67
- }
68
- </style>