@budibase/bbui 3.30.0 → 3.30.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": "3.30.0",
4
+ "version": "3.30.2",
5
5
  "license": "MPL-2.0",
6
6
  "module": "dist/bbui.mjs",
7
7
  "exports": {
@@ -107,5 +107,5 @@
107
107
  }
108
108
  }
109
109
  },
110
- "gitHead": "58456cc695d2c71a354bcf5c064943b247ad4969"
110
+ "gitHead": "13dbc5b25ef09b4c6ae6ef16c6e16d7ef37f5589"
111
111
  }
@@ -27,6 +27,7 @@
27
27
  export let searchPlaceholder: string = "Search"
28
28
  export let showSelectAll = false
29
29
  export let selectAllText = "Select all"
30
+ export let wrapText: boolean = false
30
31
 
31
32
  const dispatch = createEventDispatcher()
32
33
 
@@ -149,4 +150,5 @@
149
150
  {indeterminate}
150
151
  {allSelected}
151
152
  {toggleSelectAll}
153
+ {wrapText}
152
154
  />
@@ -76,6 +76,7 @@
76
76
  export let allSelected: boolean = false
77
77
  export let toggleSelectAll: () => void = () => {}
78
78
  export let hideChevron: boolean = false
79
+ export let wrapText: boolean = false
79
80
 
80
81
  const maxHeight = 360
81
82
  const VIRTUALIZATION_THRESHOLD = 200
@@ -115,7 +116,8 @@
115
116
  searchTerm,
116
117
  getOptionLabel
117
118
  )
118
- $: virtualizationEnabled = filteredOptions.length > VIRTUALIZATION_THRESHOLD
119
+ $: virtualizationEnabled =
120
+ !wrapText && filteredOptions.length > VIRTUALIZATION_THRESHOLD
119
121
  $: {
120
122
  if (!virtualizationEnabled) {
121
123
  virtualizedOptions = filteredOptions.map((option, idx) => ({
@@ -254,6 +256,7 @@
254
256
  class:is-placeholder={isPlaceholder}
255
257
  class:auto-width={autoWidth}
256
258
  class:has-subtitle={!!fieldSubtitle}
259
+ class:wrap-text={wrapText}
257
260
  >
258
261
  <span class="picker-label-text">{fieldText}</span>
259
262
  {#if fieldSubtitle}
@@ -279,6 +282,7 @@
279
282
  <div
280
283
  class="popover-content"
281
284
  class:auto-width={autoWidth}
285
+ class:wrap-text={wrapText}
282
286
  use:clickOutside={() => {
283
287
  open = false
284
288
  }}
@@ -486,6 +490,30 @@
486
490
  pointer-events: none;
487
491
  }
488
492
 
493
+ .spectrum-Picker-label.wrap-text {
494
+ white-space: normal;
495
+ overflow: visible;
496
+ text-overflow: unset;
497
+ width: auto;
498
+ }
499
+ .spectrum-Picker-label.wrap-text .picker-label-text {
500
+ white-space: normal;
501
+ overflow-wrap: anywhere;
502
+ }
503
+ .popover-content.wrap-text .spectrum-Menu-item {
504
+ height: auto;
505
+ min-height: var(--spectrum-menu-item-height);
506
+ align-items: flex-start;
507
+ }
508
+ .popover-content.wrap-text .spectrum-Menu-itemLabel {
509
+ white-space: normal;
510
+ overflow: visible;
511
+ text-overflow: unset;
512
+ overflow-wrap: anywhere;
513
+ width: auto;
514
+ flex: 1 1 auto;
515
+ }
516
+
489
517
  /* Search styles inside popover */
490
518
  .popover-content :global(.spectrum-Search) {
491
519
  margin-top: -1px;
@@ -47,6 +47,7 @@
47
47
  export let customPopoverHeight: string | undefined = undefined
48
48
  export let searchPlaceholder: string = "Search"
49
49
  export let hideChevron: boolean = false
50
+ export let wrapText: boolean = false
50
51
 
51
52
  const dispatch = createEventDispatcher()
52
53
 
@@ -140,4 +141,5 @@
140
141
  {customPopoverHeight}
141
142
  {searchPlaceholder}
142
143
  {hideChevron}
144
+ {wrapText}
143
145
  />
@@ -3,18 +3,32 @@
3
3
  import FieldLabel from "./FieldLabel.svelte"
4
4
  import Icon from "../Icon/Icon.svelte"
5
5
  import type { LabelPosition } from "../types"
6
+ import Label from "../Label/Label.svelte"
6
7
 
7
8
  export let id: string | undefined = undefined
8
9
  export let label: string | undefined = undefined
9
10
  export let labelPosition: LabelPosition = "above"
10
11
  export let error: string | undefined | false = undefined
12
+ export let description: string | undefined = undefined
11
13
  export let helpText: string | undefined = undefined
12
14
  export let tooltip: string | undefined = undefined
15
+ export let required: boolean = false
13
16
  </script>
14
17
 
15
18
  <div class="spectrum-Form-item" class:above={labelPosition === "above"}>
16
19
  {#if label}
17
- <FieldLabel forId={id} {label} position={labelPosition} {tooltip} />
20
+ <FieldLabel
21
+ forId={id}
22
+ {label}
23
+ position={labelPosition}
24
+ {tooltip}
25
+ {required}
26
+ />
27
+ {/if}
28
+ {#if description}
29
+ <div class="description">
30
+ <Label muted>{description}</Label>
31
+ </div>
18
32
  {/if}
19
33
  <div class="spectrum-Form-itemField">
20
34
  <slot />
@@ -61,4 +75,7 @@
61
75
  color: var(--spectrum-global-color-gray-800);
62
76
  font-size: var(--spectrum-global-dimension-font-size-75);
63
77
  }
78
+ .description {
79
+ margin-bottom: var(--spacing-xs);
80
+ }
64
81
  </style>
@@ -1,12 +1,14 @@
1
- <script>
1
+ <script lang="ts">
2
2
  import TooltipWrapper from "../Tooltip/TooltipWrapper.svelte"
3
+ import type { LabelPosition } from "../types"
3
4
 
4
5
  import "@spectrum-css/fieldlabel/dist/index-vars.css"
5
6
 
6
- export let forId
7
- export let label
8
- export let position = "above"
9
- export let tooltip = ""
7
+ export let forId: string | undefined = undefined
8
+ export let label: string
9
+ export let position: LabelPosition = "above"
10
+ export let tooltip: string = ""
11
+ export let required: boolean = false
10
12
 
11
13
  $: className = position === "above" ? "" : `spectrum-FieldLabel--${position}`
12
14
  </script>
@@ -17,6 +19,9 @@
17
19
  class={`spectrum-FieldLabel spectrum-FieldLabel--sizeM spectrum-Form-itemLabel ${className}`}
18
20
  >
19
21
  {label || ""}
22
+ {#if required}
23
+ <sup class="required-asterisk">*</sup>
24
+ {/if}
20
25
  </label>
21
26
  </TooltipWrapper>
22
27
 
@@ -29,4 +34,8 @@
29
34
  .spectrum-FieldLabel--left {
30
35
  padding-right: var(--spectrum-global-dimension-size-200);
31
36
  }
37
+ .required-asterisk {
38
+ color: var(--spectrum-global-color-red-500);
39
+ margin-left: -2px;
40
+ }
32
41
  </style>
@@ -17,6 +17,8 @@
17
17
  export let autofocus: boolean | undefined = undefined
18
18
  export let autocomplete: FullAutoFill | boolean | null | undefined = undefined
19
19
  export let helpText: string | undefined = undefined
20
+ export let required: boolean | undefined = false
21
+ export let description: string | undefined = undefined
20
22
 
21
23
  const dispatch = createEventDispatcher<{
22
24
  change: any
@@ -42,7 +44,7 @@
42
44
  }
43
45
  </script>
44
46
 
45
- <Field {helpText} {label} {labelPosition} {error}>
47
+ <Field {helpText} {label} {labelPosition} {error} {required} {description}>
46
48
  <TextField
47
49
  {updateOnChange}
48
50
  {disabled}
@@ -48,6 +48,8 @@
48
48
  export let loading: boolean | undefined = false
49
49
  export let searchPlaceholder: string | undefined = undefined
50
50
  export let hideChevron: boolean = false
51
+ export let required: boolean = false
52
+ export let description: string | undefined = undefined
51
53
 
52
54
  const dispatch = createEventDispatcher()
53
55
  const onChange = (e: CustomEvent<any>) => {
@@ -63,7 +65,15 @@
63
65
  }
64
66
  </script>
65
67
 
66
- <Field {helpText} {label} {labelPosition} {error} {tooltip}>
68
+ <Field
69
+ {helpText}
70
+ {label}
71
+ {labelPosition}
72
+ {error}
73
+ {tooltip}
74
+ {required}
75
+ {description}
76
+ >
67
77
  <Select
68
78
  {size}
69
79
  {bordered}
@@ -36,6 +36,7 @@
36
36
  export let allowEditRows: boolean = true
37
37
  export let allowEditColumns: boolean = true
38
38
  export let allowClickRows: boolean = true
39
+ export let selectOnRowClick: boolean = true
39
40
  export let selectedRows: any[] = []
40
41
  export let customRenderers: any[] = []
41
42
  export let disableSorting: boolean = false
@@ -488,7 +489,9 @@
488
489
  on:click={() => {
489
490
  if (!schema[field]?.preventSelectRow) {
490
491
  dispatch("click", row)
491
- toggleSelectRow(row)
492
+ if (selectOnRowClick) {
493
+ toggleSelectRow(row)
494
+ }
492
495
  }
493
496
  }}
494
497
  >