@grucloud/bau-ui 0.92.0 → 0.94.0
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/lazy/lazy.js
CHANGED
|
@@ -35,10 +35,8 @@ export default function (context, options = {}) {
|
|
|
35
35
|
|
|
36
36
|
getModule()
|
|
37
37
|
.then((module) => {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
loadingState.val = false;
|
|
41
|
-
});
|
|
38
|
+
componentState.val = module.default(context);
|
|
39
|
+
loadingState.val = false;
|
|
42
40
|
})
|
|
43
41
|
.catch((error) => {
|
|
44
42
|
errorState.val = error.message;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@grucloud/bau-ui",
|
|
3
3
|
"description": "Components library built with Bau",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.94.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "BSD",
|
|
7
7
|
"keywords": [
|
|
@@ -20,11 +20,11 @@
|
|
|
20
20
|
"directory": "bau-ui"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@grucloud/bau": "^0.
|
|
24
|
-
"@grucloud/bau-css": "^0.
|
|
23
|
+
"@grucloud/bau": "^0.94.0",
|
|
24
|
+
"@grucloud/bau-css": "^0.94.0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"typedoc": "0.24.8"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "aa3cb962cfc14ea167415bf4e605eaceea0e1a8c"
|
|
30
30
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
declare module "@grucloud/bau-ui/textareaAutosize" {
|
|
2
|
+
type DefaultDesignProps = import("../constants").DefaultDesignProps;
|
|
3
|
+
type ComponentOption = import("../bau-ui").ComponentOption;
|
|
4
|
+
|
|
5
|
+
export type TextareaAutosizeProps = {} & DefaultDesignProps;
|
|
6
|
+
|
|
7
|
+
type Component = import("../bau-ui").Component<
|
|
8
|
+
TextareaAutosizeProps,
|
|
9
|
+
HTMLTextAreaElement
|
|
10
|
+
>;
|
|
11
|
+
|
|
12
|
+
export default function (context: any, option?: ComponentOption): Component;
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./textareaAutosize";
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Colors } from "../constants.js";
|
|
2
|
+
|
|
3
|
+
const colorsToCss = () =>
|
|
4
|
+
Colors.map(
|
|
5
|
+
(color) =>
|
|
6
|
+
`
|
|
7
|
+
`
|
|
8
|
+
).join("\n");
|
|
9
|
+
|
|
10
|
+
// Inspired by https://css-tricks.com/auto-growing-inputs-textareas/#aa-other-ideas
|
|
11
|
+
|
|
12
|
+
export default function (context, options = {}) {
|
|
13
|
+
const { bau, css } = context;
|
|
14
|
+
const { textarea, div } = bau.tags;
|
|
15
|
+
|
|
16
|
+
const oninput = (event) => {
|
|
17
|
+
event.target.parentNode.dataset.value = event.target.value;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
return function TextareaAutosize({
|
|
21
|
+
size = options.size ?? "md",
|
|
22
|
+
color = options.color ?? "primary",
|
|
23
|
+
variant = options.variant ?? "outline",
|
|
24
|
+
...otherProps
|
|
25
|
+
} = {}) {
|
|
26
|
+
const className = css`
|
|
27
|
+
${colorsToCss()}
|
|
28
|
+
display: inline-grid;
|
|
29
|
+
&::after,
|
|
30
|
+
textarea {
|
|
31
|
+
grid-area: 1 / 1;
|
|
32
|
+
font: inherit;
|
|
33
|
+
padding: 0.25em;
|
|
34
|
+
}
|
|
35
|
+
&::after {
|
|
36
|
+
content: attr(data-value) " ";
|
|
37
|
+
visibility: hidden;
|
|
38
|
+
white-space: pre-wrap;
|
|
39
|
+
}
|
|
40
|
+
`;
|
|
41
|
+
|
|
42
|
+
return div(
|
|
43
|
+
{ class: ["textarea-autosize", className] },
|
|
44
|
+
textarea({
|
|
45
|
+
...otherProps,
|
|
46
|
+
oninput,
|
|
47
|
+
})
|
|
48
|
+
);
|
|
49
|
+
};
|
|
50
|
+
}
|