@budibase/bbui 3.2.45 → 3.2.47
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/dist/bbui.mjs +11351 -11311
- package/package.json +5 -4
- package/src/Icon/Icon.svelte +11 -11
- package/src/Label/Label.svelte +1 -1
- package/src/Tooltip/AbsTooltip.svelte +1 -1
- package/src/Typography/Heading.svelte +4 -4
- package/src/{helpers.js → helpers.ts} +23 -26
- package/src/helpers.d.ts +0 -3
- /package/src/{index.js → index.ts} +0 -0
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@budibase/bbui",
|
|
3
3
|
"description": "A UI solution used in the different Budibase projects.",
|
|
4
|
-
"version": "3.2.
|
|
4
|
+
"version": "3.2.47",
|
|
5
5
|
"license": "MPL-2.0",
|
|
6
|
-
"svelte": "src/index.
|
|
6
|
+
"svelte": "src/index.ts",
|
|
7
7
|
"module": "dist/bbui.mjs",
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
"./spectrum-icons-vite.js": "./src/spectrum-icons-vite.js"
|
|
15
15
|
},
|
|
16
16
|
"scripts": {
|
|
17
|
-
"build": "vite build"
|
|
17
|
+
"build": "vite build",
|
|
18
|
+
"dev": "vite build --watch --mode=dev"
|
|
18
19
|
},
|
|
19
20
|
"devDependencies": {
|
|
20
21
|
"@sveltejs/vite-plugin-svelte": "1.4.0",
|
|
@@ -98,5 +99,5 @@
|
|
|
98
99
|
}
|
|
99
100
|
}
|
|
100
101
|
},
|
|
101
|
-
"gitHead": "
|
|
102
|
+
"gitHead": "b05548bb07650275f45856cff116a59b5e78f5d3"
|
|
102
103
|
}
|
package/src/Icon/Icon.svelte
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
<script>
|
|
1
|
+
<script lang="ts">
|
|
2
2
|
import {
|
|
3
3
|
default as AbsTooltip,
|
|
4
4
|
TooltipPosition,
|
|
5
5
|
TooltipType,
|
|
6
6
|
} from "../Tooltip/AbsTooltip.svelte"
|
|
7
7
|
|
|
8
|
-
export let name = "Add"
|
|
9
|
-
export let hidden = false
|
|
8
|
+
export let name: string = "Add"
|
|
9
|
+
export let hidden: boolean = false
|
|
10
10
|
export let size = "M"
|
|
11
|
-
export let hoverable = false
|
|
12
|
-
export let disabled = false
|
|
13
|
-
export let color
|
|
14
|
-
export let hoverColor
|
|
15
|
-
export let tooltip
|
|
11
|
+
export let hoverable: boolean = false
|
|
12
|
+
export let disabled: boolean = false
|
|
13
|
+
export let color: string | undefined = undefined
|
|
14
|
+
export let hoverColor: string | undefined = undefined
|
|
15
|
+
export let tooltip: string | undefined = undefined
|
|
16
16
|
export let tooltipPosition = TooltipPosition.Bottom
|
|
17
17
|
export let tooltipType = TooltipType.Default
|
|
18
|
-
export let tooltipColor
|
|
19
|
-
export let tooltipWrap = true
|
|
20
|
-
export let newStyles = false
|
|
18
|
+
export let tooltipColor: string | undefined = undefined
|
|
19
|
+
export let tooltipWrap: boolean = true
|
|
20
|
+
export let newStyles: boolean = false
|
|
21
21
|
</script>
|
|
22
22
|
|
|
23
23
|
<AbsTooltip
|
package/src/Label/Label.svelte
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import "@spectrum-css/typography/dist/index-vars.css"
|
|
3
3
|
|
|
4
4
|
// Sizes
|
|
5
|
-
export let size = "M"
|
|
6
|
-
export let textAlign = undefined
|
|
7
|
-
export let noPadding = false
|
|
8
|
-
export let weight
|
|
5
|
+
export let size: "XS" | "S" | "M" | "L" = "M"
|
|
6
|
+
export let textAlign: string | undefined = undefined
|
|
7
|
+
export let noPadding: boolean = false
|
|
8
|
+
export let weight: "light" | "heavy" | "default" = "default"
|
|
9
9
|
</script>
|
|
10
10
|
|
|
11
11
|
<h1
|
|
@@ -6,9 +6,8 @@ export const deepGet = helpers.deepGet
|
|
|
6
6
|
/**
|
|
7
7
|
* Generates a DOM safe UUID.
|
|
8
8
|
* Starting with a letter is important to make it DOM safe.
|
|
9
|
-
* @return {string} a random DOM safe UUID
|
|
10
9
|
*/
|
|
11
|
-
export function uuid() {
|
|
10
|
+
export function uuid(): string {
|
|
12
11
|
return "cxxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g, c => {
|
|
13
12
|
const r = (Math.random() * 16) | 0
|
|
14
13
|
const v = c === "x" ? r : (r & 0x3) | 0x8
|
|
@@ -18,22 +17,18 @@ export function uuid() {
|
|
|
18
17
|
|
|
19
18
|
/**
|
|
20
19
|
* Capitalises a string
|
|
21
|
-
* @param string the string to capitalise
|
|
22
|
-
* @return {string} the capitalised string
|
|
23
20
|
*/
|
|
24
|
-
export const capitalise = string => {
|
|
21
|
+
export const capitalise = (string?: string | null): string => {
|
|
25
22
|
if (!string) {
|
|
26
|
-
return
|
|
23
|
+
return ""
|
|
27
24
|
}
|
|
28
25
|
return string.substring(0, 1).toUpperCase() + string.substring(1)
|
|
29
26
|
}
|
|
30
27
|
|
|
31
28
|
/**
|
|
32
29
|
* Computes a short hash of a string
|
|
33
|
-
* @param string the string to compute a hash of
|
|
34
|
-
* @return {string} the hash string
|
|
35
30
|
*/
|
|
36
|
-
export const hashString = string => {
|
|
31
|
+
export const hashString = (string?: string | null): string => {
|
|
37
32
|
if (!string) {
|
|
38
33
|
return "0"
|
|
39
34
|
}
|
|
@@ -54,11 +49,12 @@ export const hashString = string => {
|
|
|
54
49
|
* will override the value "foo" rather than "bar".
|
|
55
50
|
* If a deep path is specified and the parent keys don't exist then these will
|
|
56
51
|
* be created.
|
|
57
|
-
* @param obj the object
|
|
58
|
-
* @param key the key
|
|
59
|
-
* @param value the value
|
|
60
52
|
*/
|
|
61
|
-
export const deepSet = (
|
|
53
|
+
export const deepSet = (
|
|
54
|
+
obj: Record<string, any> | null,
|
|
55
|
+
key: string | null,
|
|
56
|
+
value: any
|
|
57
|
+
): void => {
|
|
62
58
|
if (!obj || !key) {
|
|
63
59
|
return
|
|
64
60
|
}
|
|
@@ -82,9 +78,8 @@ export const deepSet = (obj, key, value) => {
|
|
|
82
78
|
|
|
83
79
|
/**
|
|
84
80
|
* Deeply clones an object. Functions are not supported.
|
|
85
|
-
* @param obj the object to clone
|
|
86
81
|
*/
|
|
87
|
-
export const cloneDeep = obj => {
|
|
82
|
+
export const cloneDeep = <T>(obj: T): T => {
|
|
88
83
|
if (!obj) {
|
|
89
84
|
return obj
|
|
90
85
|
}
|
|
@@ -93,9 +88,8 @@ export const cloneDeep = obj => {
|
|
|
93
88
|
|
|
94
89
|
/**
|
|
95
90
|
* Copies a value to the clipboard
|
|
96
|
-
* @param value the value to copy
|
|
97
91
|
*/
|
|
98
|
-
export const copyToClipboard = value => {
|
|
92
|
+
export const copyToClipboard = (value: any): Promise<void> => {
|
|
99
93
|
return new Promise(res => {
|
|
100
94
|
if (navigator.clipboard && window.isSecureContext) {
|
|
101
95
|
// Try using the clipboard API first
|
|
@@ -117,9 +111,12 @@ export const copyToClipboard = value => {
|
|
|
117
111
|
})
|
|
118
112
|
}
|
|
119
113
|
|
|
120
|
-
//
|
|
114
|
+
// Parse a date value. This is usually an ISO string, but can be a
|
|
121
115
|
// bunch of different formats and shapes depending on schema flags.
|
|
122
|
-
export const parseDate = (
|
|
116
|
+
export const parseDate = (
|
|
117
|
+
value: string | dayjs.Dayjs | null,
|
|
118
|
+
{ enableTime = true }
|
|
119
|
+
): dayjs.Dayjs | null => {
|
|
123
120
|
// If empty then invalid
|
|
124
121
|
if (!value) {
|
|
125
122
|
return null
|
|
@@ -128,7 +125,7 @@ export const parseDate = (value, { enableTime = true }) => {
|
|
|
128
125
|
// Certain string values need transformed
|
|
129
126
|
if (typeof value === "string") {
|
|
130
127
|
// Check for time only values
|
|
131
|
-
if (!isNaN(new Date(`0-${value}`))) {
|
|
128
|
+
if (!isNaN(new Date(`0-${value}`).valueOf())) {
|
|
132
129
|
value = `0-${value}`
|
|
133
130
|
}
|
|
134
131
|
|
|
@@ -153,9 +150,9 @@ export const parseDate = (value, { enableTime = true }) => {
|
|
|
153
150
|
// Stringifies a dayjs object to create an ISO string that respects the various
|
|
154
151
|
// schema flags
|
|
155
152
|
export const stringifyDate = (
|
|
156
|
-
value,
|
|
153
|
+
value: null | dayjs.Dayjs,
|
|
157
154
|
{ enableTime = true, timeOnly = false, ignoreTimezones = false } = {}
|
|
158
|
-
) => {
|
|
155
|
+
): string | null => {
|
|
159
156
|
if (!value) {
|
|
160
157
|
return null
|
|
161
158
|
}
|
|
@@ -192,7 +189,7 @@ export const stringifyDate = (
|
|
|
192
189
|
}
|
|
193
190
|
|
|
194
191
|
// Determine the dayjs-compatible format of the browser's default locale
|
|
195
|
-
const getPatternForPart = part => {
|
|
192
|
+
const getPatternForPart = (part: Intl.DateTimeFormatPart): string => {
|
|
196
193
|
switch (part.type) {
|
|
197
194
|
case "day":
|
|
198
195
|
return "D".repeat(part.value.length)
|
|
@@ -214,9 +211,9 @@ const localeDateFormat = new Intl.DateTimeFormat()
|
|
|
214
211
|
|
|
215
212
|
// Formats a dayjs date according to schema flags
|
|
216
213
|
export const getDateDisplayValue = (
|
|
217
|
-
value,
|
|
214
|
+
value: dayjs.Dayjs | null,
|
|
218
215
|
{ enableTime = true, timeOnly = false } = {}
|
|
219
|
-
) => {
|
|
216
|
+
): string => {
|
|
220
217
|
if (!value?.isValid()) {
|
|
221
218
|
return ""
|
|
222
219
|
}
|
|
@@ -229,7 +226,7 @@ export const getDateDisplayValue = (
|
|
|
229
226
|
}
|
|
230
227
|
}
|
|
231
228
|
|
|
232
|
-
export const hexToRGBA = (color, opacity) => {
|
|
229
|
+
export const hexToRGBA = (color: string, opacity: number): string => {
|
|
233
230
|
if (color.includes("#")) {
|
|
234
231
|
color = color.replace("#", "")
|
|
235
232
|
}
|
package/src/helpers.d.ts
DELETED
|
File without changes
|