@budibase/bbui 2.23.0 → 2.23.2

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": "2.23.0",
4
+ "version": "2.23.2",
5
5
  "license": "MPL-2.0",
6
6
  "svelte": "src/index.js",
7
7
  "module": "dist/bbui.es.js",
@@ -35,8 +35,8 @@
35
35
  ],
36
36
  "dependencies": {
37
37
  "@adobe/spectrum-css-workflow-icons": "1.2.1",
38
- "@budibase/shared-core": "2.23.0",
39
- "@budibase/string-templates": "2.23.0",
38
+ "@budibase/shared-core": "2.23.2",
39
+ "@budibase/string-templates": "2.23.2",
40
40
  "@spectrum-css/accordion": "3.0.24",
41
41
  "@spectrum-css/actionbutton": "1.0.1",
42
42
  "@spectrum-css/actiongroup": "1.0.1",
@@ -103,5 +103,5 @@
103
103
  }
104
104
  }
105
105
  },
106
- "gitHead": "2c4277877da1c0053f7e41ea7156758a1ef844a4"
106
+ "gitHead": "af9ebd252bc5d907ea71d45f696e0eb05a803dbe"
107
107
  }
@@ -4,6 +4,7 @@
4
4
  import "@spectrum-css/menu/dist/index-vars.css"
5
5
  import { createEventDispatcher } from "svelte"
6
6
  import clickOutside from "../../Actions/click_outside"
7
+ import Popover from "../../Popover/Popover.svelte"
7
8
 
8
9
  export let value = null
9
10
  export let id = null
@@ -15,8 +16,10 @@
15
16
  export let getOptionValue = option => option
16
17
 
17
18
  const dispatch = createEventDispatcher()
19
+
18
20
  let open = false
19
21
  let focus = false
22
+ let anchor
20
23
 
21
24
  const selectOption = value => {
22
25
  dispatch("change", value)
@@ -35,11 +38,11 @@
35
38
  }
36
39
  </script>
37
40
 
38
- <!-- svelte-ignore a11y-click-events-have-key-events -->
39
41
  <div
40
42
  class="spectrum-InputGroup"
41
43
  class:is-focused={open || focus}
42
44
  class:is-disabled={disabled}
45
+ bind:this={anchor}
43
46
  >
44
47
  <div
45
48
  class="spectrum-Textfield spectrum-InputGroup-textfield"
@@ -67,7 +70,7 @@
67
70
  tabindex="-1"
68
71
  aria-haspopup="true"
69
72
  {disabled}
70
- on:click={() => (open = true)}
73
+ on:click={() => (open = !open)}
71
74
  >
72
75
  <svg
73
76
  class="spectrum-Icon spectrum-UIIcon-ChevronDown100 spectrum-Picker-menuIcon spectrum-InputGroup-icon"
@@ -77,42 +80,44 @@
77
80
  <use xlink:href="#spectrum-css-icon-Chevron100" />
78
81
  </svg>
79
82
  </button>
80
- {#if open}
81
- <div
82
- class="spectrum-Popover spectrum-Popover--bottom is-open"
83
- use:clickOutside={() => {
84
- open = false
85
- }}
86
- >
87
- <ul class="spectrum-Menu" role="listbox">
88
- {#if options && Array.isArray(options)}
89
- {#each options as option}
90
- <li
91
- class="spectrum-Menu-item"
92
- class:is-selected={getOptionValue(option) === value}
93
- role="option"
94
- aria-selected="true"
95
- tabindex="0"
96
- on:click={() => onPick(getOptionValue(option))}
97
- >
98
- <span class="spectrum-Menu-itemLabel"
99
- >{getOptionLabel(option)}</span
100
- >
101
- <svg
102
- class="spectrum-Icon spectrum-UIIcon-Checkmark100 spectrum-Menu-checkmark spectrum-Menu-itemIcon"
103
- focusable="false"
104
- aria-hidden="true"
105
- >
106
- <use xlink:href="#spectrum-css-icon-Checkmark100" />
107
- </svg>
108
- </li>
109
- {/each}
110
- {/if}
111
- </ul>
112
- </div>
113
- {/if}
114
83
  </div>
115
84
 
85
+ <!-- svelte-ignore a11y-click-events-have-key-events -->
86
+ <Popover
87
+ {anchor}
88
+ {open}
89
+ align="left"
90
+ on:close={() => (open = false)}
91
+ useAnchorWidth
92
+ >
93
+ <div class="popover-content" use:clickOutside={() => (open = false)}>
94
+ <ul class="spectrum-Menu" role="listbox">
95
+ {#if options && Array.isArray(options)}
96
+ {#each options as option}
97
+ <li
98
+ class="spectrum-Menu-item"
99
+ class:is-selected={getOptionValue(option) === value}
100
+ role="option"
101
+ aria-selected="true"
102
+ tabindex="0"
103
+ on:click={() => onPick(getOptionValue(option))}
104
+ >
105
+ <span class="spectrum-Menu-itemLabel">{getOptionLabel(option)}</span
106
+ >
107
+ <svg
108
+ class="spectrum-Icon spectrum-UIIcon-Checkmark100 spectrum-Menu-checkmark spectrum-Menu-itemIcon"
109
+ focusable="false"
110
+ aria-hidden="true"
111
+ >
112
+ <use xlink:href="#spectrum-css-icon-Checkmark100" />
113
+ </svg>
114
+ </li>
115
+ {/each}
116
+ {/if}
117
+ </ul>
118
+ </div>
119
+ </Popover>
120
+
116
121
  <style>
117
122
  .spectrum-InputGroup {
118
123
  min-width: 0;
@@ -124,10 +129,13 @@
124
129
  .spectrum-Textfield-input {
125
130
  width: 0;
126
131
  }
127
- .spectrum-Popover {
128
- max-height: 240px;
129
- width: 100%;
130
- z-index: 999;
131
- top: 100%;
132
+
133
+ /* Popover */
134
+ .popover-content {
135
+ display: contents;
136
+ }
137
+ .popover-content:not(.auto-width) .spectrum-Menu-itemLabel {
138
+ width: 0;
139
+ flex: 1 1 auto;
132
140
  }
133
141
  </style>
@@ -45,7 +45,6 @@
45
45
  const dispatch = createEventDispatcher()
46
46
 
47
47
  let button
48
- let popover
49
48
  let component
50
49
 
51
50
  $: sortedOptions = getSortedOptions(options, getOptionLabel, sort)
@@ -146,11 +145,11 @@
146
145
  <use xlink:href="#spectrum-css-icon-Chevron100" />
147
146
  </svg>
148
147
  </button>
148
+
149
149
  <!-- svelte-ignore a11y-click-events-have-key-events -->
150
150
  <Popover
151
151
  anchor={customAnchor ? customAnchor : button}
152
152
  align={align || "left"}
153
- bind:this={popover}
154
153
  {open}
155
154
  on:close={() => (open = false)}
156
155
  useAnchorWidth={!autoWidth}
@@ -266,16 +265,6 @@
266
265
  width: 100%;
267
266
  box-shadow: none;
268
267
  }
269
-
270
- .subtitle-text {
271
- font-size: 12px;
272
- line-height: 15px;
273
- font-weight: 500;
274
- color: var(--spectrum-global-color-gray-600);
275
- display: block;
276
- margin-top: var(--spacing-s);
277
- }
278
-
279
268
  .spectrum-Picker-label.auto-width {
280
269
  margin-right: var(--spacing-xs);
281
270
  }
@@ -356,11 +345,9 @@
356
345
  .option-extra.icon.field-icon {
357
346
  display: flex;
358
347
  }
359
-
360
348
  .option-tag {
361
349
  margin: 0 var(--spacing-m) 0 var(--spacing-m);
362
350
  }
363
-
364
351
  .option-tag :global(.spectrum-Tags-item > .spectrum-Icon) {
365
352
  margin-top: 2px;
366
353
  }
@@ -374,4 +361,13 @@
374
361
  .loading--withAutocomplete {
375
362
  top: calc(34px + var(--spacing-m));
376
363
  }
364
+
365
+ .subtitle-text {
366
+ font-size: 12px;
367
+ line-height: 15px;
368
+ font-weight: 500;
369
+ color: var(--spectrum-global-color-gray-600);
370
+ display: block;
371
+ margin-top: var(--spacing-s);
372
+ }
377
373
  </style>
@@ -99,10 +99,10 @@
99
99
  on:keydown={handleEscape}
100
100
  class="spectrum-Popover is-open"
101
101
  class:customZindex
102
- class:hide-popover={open && !showPopover}
102
+ class:hidden={!showPopover}
103
103
  role="presentation"
104
104
  style="height: {customHeight}; --customZindex: {customZindex};"
105
- transition:fly|local={{ y: -20, duration: animate ? 200 : 0 }}
105
+ transition:fly|local={{ y: -20, duration: animate ? 260 : 0 }}
106
106
  on:mouseenter
107
107
  on:mouseleave
108
108
  >
@@ -112,16 +112,17 @@
112
112
  {/if}
113
113
 
114
114
  <style>
115
- .hide-popover {
116
- display: contents;
117
- }
118
-
119
115
  .spectrum-Popover {
120
116
  min-width: var(--spectrum-global-dimension-size-2000);
121
117
  border-color: var(--spectrum-global-color-gray-300);
122
118
  overflow: auto;
119
+ transition: opacity 260ms ease-out, transform 260ms ease-out;
120
+ }
121
+ .hidden {
122
+ opacity: 0;
123
+ pointer-events: none;
124
+ transform: translateY(-20px);
123
125
  }
124
-
125
126
  .customZindex {
126
127
  z-index: var(--customZindex) !important;
127
128
  }