@budibase/bbui 1.2.41-alpha.4 → 1.2.42

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.2.41-alpha.4",
4
+ "version": "1.2.42",
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.2.41-alpha.4",
41
+ "@budibase/string-templates": "^1.2.42",
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": "1d79a9f3506ed748ab167afe925a85065d845437"
88
+ "gitHead": "111226abbd5e491027931e272d2267f25057fb13"
89
89
  }
@@ -16,7 +16,6 @@
16
16
  export let appendTo = undefined
17
17
  export let timeOnly = false
18
18
  export let ignoreTimezones = false
19
- export let time24hr = false
20
19
 
21
20
  const dispatch = createEventDispatcher()
22
21
  const flatpickrId = `${uuid()}-wrapper`
@@ -38,7 +37,6 @@
38
37
  enableTime: timeOnly || enableTime || false,
39
38
  noCalendar: timeOnly || false,
40
39
  altInput: true,
41
- time_24hr: time24hr || false,
42
40
  altFormat: timeOnly ? "H:i" : enableTime ? "F j Y, H:i" : "F j, Y",
43
41
  wrap: true,
44
42
  appendTo,
@@ -51,12 +49,6 @@
51
49
  },
52
50
  }
53
51
 
54
- $: redrawOptions = {
55
- timeOnly,
56
- enableTime,
57
- time24hr,
58
- }
59
-
60
52
  const handleChange = event => {
61
53
  const [dates] = event.detail
62
54
  const noTimezone = enableTime && !timeOnly && ignoreTimezones
@@ -150,7 +142,7 @@
150
142
  }
151
143
  </script>
152
144
 
153
- {#key redrawOptions}
145
+ {#key timeOnly}
154
146
  <Flatpickr
155
147
  bind:flatpickr
156
148
  value={parseDate(value)}
@@ -17,7 +17,6 @@
17
17
  export let disabled = false
18
18
  export let fileSizeLimit = BYTES_IN_MB * 20
19
19
  export let processFiles = null
20
- export let deleteAttachments = null
21
20
  export let handleFileTooLarge = null
22
21
  export let handleTooManyFiles = null
23
22
  export let gallery = true
@@ -95,11 +94,6 @@
95
94
  "change",
96
95
  value.filter((x, idx) => idx !== selectedImageIdx)
97
96
  )
98
- if (deleteAttachments) {
99
- await deleteAttachments(
100
- value.filter((x, idx) => idx === selectedImageIdx).map(item => item.key)
101
- )
102
- }
103
97
  selectedImageIdx = 0
104
98
  }
105
99
 
@@ -23,7 +23,7 @@
23
23
  $: toggleOption = makeToggleOption(selectedLookupMap, value)
24
24
 
25
25
  const getFieldText = (value, map, placeholder) => {
26
- if (Array.isArray(value) && value.length > 0) {
26
+ if (value?.length) {
27
27
  if (!map) {
28
28
  return ""
29
29
  }
@@ -36,7 +36,7 @@
36
36
 
37
37
  const getSelectedLookupMap = value => {
38
38
  let map = {}
39
- if (Array.isArray(value) && value.length > 0) {
39
+ if (value?.length) {
40
40
  value.forEach(option => {
41
41
  if (option) {
42
42
  map[option] = true
@@ -10,7 +10,6 @@
10
10
  export let error = null
11
11
  export let enableTime = true
12
12
  export let timeOnly = false
13
- export let time24hr = false
14
13
  export let placeholder = null
15
14
  export let appendTo = undefined
16
15
  export let ignoreTimezones = false
@@ -31,7 +30,6 @@
31
30
  {placeholder}
32
31
  {enableTime}
33
32
  {timeOnly}
34
- {time24hr}
35
33
  {appendTo}
36
34
  {ignoreTimezones}
37
35
  on:change={onChange}
@@ -10,7 +10,6 @@
10
10
  export let error = null
11
11
  export let fileSizeLimit = undefined
12
12
  export let processFiles = undefined
13
- export let deleteAttachments = undefined
14
13
  export let handleFileTooLarge = undefined
15
14
  export let handleTooManyFiles = undefined
16
15
  export let gallery = true
@@ -31,7 +30,6 @@
31
30
  {value}
32
31
  {fileSizeLimit}
33
32
  {processFiles}
34
- {deleteAttachments}
35
33
  {handleFileTooLarge}
36
34
  {handleTooManyFiles}
37
35
  {gallery}
@@ -83,9 +83,4 @@
83
83
  transform: translateX(-50%);
84
84
  text-align: center;
85
85
  }
86
-
87
- .spectrum-Icon--sizeXS {
88
- width: 10px;
89
- height: 10px;
90
- }
91
86
  </style>
@@ -1,6 +1,5 @@
1
1
  <script>
2
2
  import { createEventDispatcher, getContext } from "svelte"
3
- import Icon from "../Icon/Icon.svelte"
4
3
 
5
4
  const dispatch = createEventDispatcher()
6
5
  const actionMenu = getContext("actionMenu")
@@ -9,22 +8,6 @@
9
8
  export let icon = undefined
10
9
  export let disabled = undefined
11
10
  export let noClose = false
12
- export let keyBind = undefined
13
-
14
- $: keys = getKeys(keyBind)
15
-
16
- const getKeys = keyBind => {
17
- let keys = keyBind?.split("+") || []
18
- for (let i = 0; i < keys.length; i++) {
19
- if (
20
- keys[i].toLowerCase() === "ctrl" &&
21
- navigator.platform.startsWith("Mac")
22
- ) {
23
- keys[i] = "⌘"
24
- }
25
- }
26
- return keys
27
- }
28
11
 
29
12
  const onClick = () => {
30
13
  if (actionMenu && !noClose) {
@@ -43,54 +26,20 @@
43
26
  tabindex="0"
44
27
  >
45
28
  {#if icon}
46
- <div class="icon">
47
- <Icon name={icon} size="S" />
48
- </div>
29
+ <svg
30
+ class="spectrum-Icon spectrum-Icon--sizeS spectrum-Menu-itemIcon"
31
+ focusable="false"
32
+ aria-hidden="true"
33
+ aria-label={icon}
34
+ >
35
+ <use xlink:href="#spectrum-icon-18-{icon}" />
36
+ </svg>
49
37
  {/if}
50
38
  <span class="spectrum-Menu-itemLabel"><slot /></span>
51
- {#if keys?.length}
52
- <div class="keys">
53
- {#each keys as key}
54
- <div class="key">
55
- {#if key.startsWith("!")}
56
- <Icon size="XS" name={key.split("!")[1]} />
57
- {:else}
58
- {key}
59
- {/if}
60
- </div>
61
- {/each}
62
- </div>
63
- {/if}
64
39
  </li>
65
40
 
66
41
  <style>
67
- .icon {
42
+ .spectrum-Menu-itemIcon {
68
43
  align-self: center;
69
- margin-right: var(--spacing-s);
70
- }
71
- .keys {
72
- margin-left: 30px;
73
- display: flex;
74
- flex-direction: row;
75
- justify-content: flex-end;
76
- align-items: center;
77
- gap: 4px;
78
- }
79
- .key {
80
- color: var(--spectrum-global-color-gray-900);
81
- padding: 2px 4px;
82
- font-size: 12px;
83
- font-weight: 600;
84
- background-color: var(--spectrum-global-color-gray-300);
85
- border-radius: 4px;
86
- min-width: 12px;
87
- height: 16px;
88
- text-align: center;
89
- margin: -1px 0;
90
- display: grid;
91
- place-items: center;
92
- }
93
- .is-disabled .key {
94
- color: var(--spectrum-global-color-gray-600);
95
44
  }
96
45
  </style>
@@ -11,8 +11,6 @@
11
11
 
12
12
  const dispatch = createEventDispatcher()
13
13
  let visible = fixed || inline
14
- let modal
15
-
16
14
  $: dispatch(visible ? "show" : "hide")
17
15
 
18
16
  export function show() {
@@ -43,22 +41,12 @@
43
41
  }
44
42
  }
45
43
 
46
- async function focusModal(node) {
47
- await tick()
48
-
49
- // Try to focus first input
44
+ async function focusFirstInput(node) {
50
45
  const inputs = node.querySelectorAll("input")
51
46
  if (inputs?.length) {
47
+ await tick()
52
48
  inputs[0].focus()
53
49
  }
54
-
55
- // Otherwise try to focus confirmation button
56
- else if (modal) {
57
- const confirm = modal.querySelector(".confirm-wrap .spectrum-Button")
58
- if (confirm) {
59
- confirm.focus()
60
- }
61
- }
62
50
  }
63
51
 
64
52
  setContext(Context.Modal, { show, hide, cancel })
@@ -68,7 +56,7 @@
68
56
 
69
57
  {#if inline}
70
58
  {#if visible}
71
- <div use:focusModal bind:this={modal} class="spectrum-Modal inline is-open">
59
+ <div use:focusFirstInput class="spectrum-Modal inline is-open">
72
60
  <slot />
73
61
  </div>
74
62
  {/if}
@@ -82,18 +70,17 @@
82
70
  -->
83
71
  <Portal target=".modal-container">
84
72
  {#if visible}
85
- <div class="spectrum-Underlay is-open" on:mousedown|self={cancel}>
86
- <div
87
- class="background"
88
- in:fade={{ duration: 200 }}
89
- out:fade|local={{ duration: 200 }}
90
- />
73
+ <div
74
+ class="spectrum-Underlay is-open"
75
+ in:fade={{ duration: 200 }}
76
+ out:fade|local={{ duration: 200 }}
77
+ on:mousedown|self={cancel}
78
+ >
91
79
  <div class="modal-wrapper" on:mousedown|self={cancel}>
92
80
  <div class="modal-inner-wrapper" on:mousedown|self={cancel}>
93
81
  <slot name="outside" />
94
82
  <div
95
- use:focusModal
96
- bind:this={modal}
83
+ use:focusFirstInput
97
84
  class="spectrum-Modal is-open"
98
85
  in:fly={{ y: 30, duration: 200 }}
99
86
  out:fly|local={{ y: 30, duration: 200 }}
@@ -116,17 +103,7 @@
116
103
  z-index: 999;
117
104
  overflow: auto;
118
105
  overflow-x: hidden;
119
- background: transparent;
120
- }
121
- .background {
122
- background: var(--modal-background, rgba(0, 0, 0, 0.75));
123
- position: fixed;
124
- top: 0;
125
- left: 0;
126
- height: 100vh;
127
- width: 100vw;
128
- opacity: 0.65;
129
- pointer-events: none;
106
+ background: rgba(0, 0, 0, 0.75);
130
107
  }
131
108
 
132
109
  .modal-wrapper {
@@ -63,7 +63,7 @@
63
63
 
64
64
  <style>
65
65
  .spectrum-Popover {
66
- min-width: var(--spectrum-global-dimension-size-2000);
66
+ min-width: var(--spectrum-global-dimension-size-2000) !important;
67
67
  }
68
68
  .spectrum-Popover.is-open.spectrum-Popover--withTip {
69
69
  margin-top: var(--spacing-xs);