@grucloud/bau-ui 0.43.1 → 0.43.3

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.
@@ -19,7 +19,7 @@ const colorsToCss = () =>
19
19
  `
20
20
  ).join("\n");
21
21
 
22
- export default function (context, options) {
22
+ export default function (context, options = {}) {
23
23
  const { bau, css } = context;
24
24
  const { div, ul, li, h3, button } = bau.tags;
25
25
 
@@ -69,8 +69,15 @@ export default function (context, options) {
69
69
  `;
70
70
 
71
71
  return function Accordion(...args) {
72
- let [{ color, variant = "outline", size = "md", data = [], ...props }] =
73
- toPropsAndChildren(args);
72
+ let [
73
+ {
74
+ size = options.size ?? "md",
75
+ variant = options.variant ?? "plain",
76
+ color = options.color ?? "neutral",
77
+ data = [],
78
+ ...props
79
+ },
80
+ ] = toPropsAndChildren(args);
74
81
 
75
82
  const itemNameState = bau.state("");
76
83
 
package/alert/alert.js CHANGED
@@ -75,9 +75,9 @@ export default function (context, options = {}) {
75
75
  return function Alert(...args) {
76
76
  let [
77
77
  {
78
- color = options.color ?? "neutral",
78
+ size = options.size ?? "md",
79
79
  variant = options.variant ?? "outline",
80
- size = "md",
80
+ color = options.color ?? "neutral",
81
81
  onRemove,
82
82
  ...props
83
83
  },
@@ -91,9 +91,6 @@ export default function (context, options = {}) {
91
91
  "alert",
92
92
  `alert-${variant}`,
93
93
  options.class,
94
- options.variant,
95
- options.size,
96
- options.color,
97
94
  variant,
98
95
  color,
99
96
  size,
@@ -20,7 +20,7 @@ const colorsToCss = () =>
20
20
  `
21
21
  ).join("\n");
22
22
 
23
- export default function (context, componentOptions) {
23
+ export default function (context, componentOptions = {}) {
24
24
  const { bau, css } = context;
25
25
  const { div, li } = bau.tags;
26
26
 
@@ -53,9 +53,9 @@ export default function (context, componentOptions) {
53
53
  return function AutoComplete(...args) {
54
54
  let [
55
55
  {
56
- variant = "outline",
57
- color,
58
- size = "md",
56
+ size = componentOptions.size ?? "md",
57
+ variant = componentOptions.variant ?? "plain",
58
+ color = componentOptions.color ?? "neutral",
59
59
  id,
60
60
  label,
61
61
  placeholder,
package/avatar/avatar.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { toPropsAndChildren } from "@grucloud/bau/bau.js";
2
2
  import classNames from "@grucloud/bau-css/classNames.js";
3
3
 
4
- export default function (context, options) {
4
+ export default function (context, options = {}) {
5
5
  const { bau, css } = context;
6
6
  const { span, img } = bau.tags;
7
7
 
@@ -35,9 +35,9 @@ export default function (context, options) {
35
35
  return function Avatar(...args) {
36
36
  let [
37
37
  {
38
- color,
39
- variant = "outline",
40
- size = "md",
38
+ size = options.size ?? "md",
39
+ variant = options.variant ?? "plain",
40
+ color = options.color ?? "neutral",
41
41
  width = 40,
42
42
  height = 40,
43
43
  ...props
package/badge/badge.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import classNames from "@grucloud/bau-css/classNames.js";
2
2
  import { toPropsAndChildren } from "@grucloud/bau/bau.js";
3
3
 
4
- export default function (context, options) {
4
+ export default function (context, options = {}) {
5
5
  const { bau, css } = context;
6
6
  const { span } = bau.tags;
7
7
 
@@ -28,7 +28,13 @@ export default function (context, options) {
28
28
 
29
29
  return function Badge(...args) {
30
30
  let [
31
- { color, variant = "outline", size = "md", content, ...props },
31
+ {
32
+ size = options.size ?? "md",
33
+ variant = options.variant ?? "plain",
34
+ color = options.color ?? "neutral",
35
+ content,
36
+ ...props
37
+ },
32
38
  ...children
33
39
  ] = toPropsAndChildren(args);
34
40
  return span(
@@ -2,8 +2,8 @@ import { toPropsAndChildren } from "@grucloud/bau/bau.js";
2
2
  import classNames from "@grucloud/bau-css/classNames.js";
3
3
  import button from "../button/button.js";
4
4
 
5
- export default function (context, options) {
6
- const { bau, css } = context;
5
+ export default function (context, options = {}) {
6
+ const { bau, css, config } = context;
7
7
  const { ul, li, span } = bau.tags;
8
8
 
9
9
  const Button = button(context);
@@ -42,7 +42,13 @@ export default function (context, options) {
42
42
 
43
43
  return function Breadcrumbs(...args) {
44
44
  let [
45
- { color = "neutral", variant = "plain", size = "md", items, ...props },
45
+ {
46
+ size = options.size ?? "md",
47
+ variant = options.variant ?? "plain",
48
+ color = options.color ?? "neutral",
49
+ items,
50
+ ...props
51
+ },
46
52
  ...children
47
53
  ] = toPropsAndChildren(args);
48
54
  return ul(
@@ -54,7 +60,7 @@ export default function (context, options) {
54
60
  li(
55
61
  (href ? Button : span)(
56
62
  {
57
- href,
63
+ href: `${config.base}${href}`,
58
64
  color,
59
65
  variant,
60
66
  size,
package/button/button.js CHANGED
@@ -56,8 +56,16 @@ export default function (context, options = {}) {
56
56
  `;
57
57
 
58
58
  return function Button(...args) {
59
- let [{ color, variant, size = "md", href, ...props }, ...children] =
60
- toPropsAndChildren(args);
59
+ let [
60
+ {
61
+ size = options.size ?? "md",
62
+ variant = options.variant ?? "none",
63
+ color = options.color ?? "none",
64
+ href,
65
+ ...props
66
+ },
67
+ ...children
68
+ ] = toPropsAndChildren(args);
61
69
 
62
70
  const tagButton = href ? bau.tags.a : bau.tags.button;
63
71
 
@@ -68,9 +76,6 @@ export default function (context, options = {}) {
68
76
  class: classNames(
69
77
  "button",
70
78
  options.class,
71
- options.variant,
72
- options.size,
73
- options.color,
74
79
  variant,
75
80
  size,
76
81
  color,
@@ -27,7 +27,7 @@ const colorsToCss = () =>
27
27
  `
28
28
  ).join("\n");
29
29
 
30
- export default function (context, options) {
30
+ export default function (context, options = {}) {
31
31
  const { bau, css } = context;
32
32
  const { div } = bau.tags;
33
33
 
@@ -47,8 +47,15 @@ export default function (context, options) {
47
47
  `;
48
48
 
49
49
  return function ButtonGroup(...args) {
50
- let [{ variant = "outline", size = "md", color, ...props }, ...children] =
51
- toPropsAndChildren(args);
50
+ let [
51
+ {
52
+ size = options.size ?? "md",
53
+ variant = options.variant ?? "plain",
54
+ color = options.color ?? "neutral",
55
+ ...props
56
+ },
57
+ ...children
58
+ ] = toPropsAndChildren(args);
52
59
 
53
60
  return div(
54
61
  {
@@ -2,7 +2,7 @@ import classNames from "@grucloud/bau-css/classNames.js";
2
2
  import { toPropsAndChildren } from "@grucloud/bau/bau.js";
3
3
  import { Colors } from "../constants.js";
4
4
 
5
- export default function (context, options) {
5
+ export default function (context, options = {}) {
6
6
  const { bau, css } = context;
7
7
  const { input } = bau.tags;
8
8
 
@@ -28,7 +28,12 @@ export default function (context, options) {
28
28
 
29
29
  return function Calendar(...args) {
30
30
  let [
31
- { color = "neutral", variant = "plain", size, ...props },
31
+ {
32
+ size = options.size ?? "md",
33
+ variant = options.variant ?? "plain",
34
+ color = options.color ?? "neutral",
35
+ ...props
36
+ },
32
37
  ...children
33
38
  ] = toPropsAndChildren(args);
34
39
  return input(
@@ -1,7 +1,7 @@
1
1
  import classNames from "@grucloud/bau-css/classNames.js";
2
2
  import { toPropsAndChildren } from "@grucloud/bau/bau.js";
3
3
 
4
- export default function (context, options) {
4
+ export default function (context, options = {}) {
5
5
  const { bau, css } = context;
6
6
  const { div } = bau.tags;
7
7
  const className = css`
@@ -38,9 +38,9 @@ export default function (context, options) {
38
38
  return function Carousel(...args) {
39
39
  let [
40
40
  {
41
- color,
42
- variant = "plain",
43
- size = "md",
41
+ size = options.size ?? "md",
42
+ variant = options.variant ?? "plain",
43
+ color = options.color ?? "neutral",
44
44
  slides,
45
45
  Slide,
46
46
  Previous,
@@ -60,8 +60,15 @@ export default function (context, options = {}) {
60
60
  `;
61
61
 
62
62
  return function Checkbox(...args) {
63
- let [{ color, variant = "outline", size = "md", ...props }, ...children] =
64
- toPropsAndChildren(args);
63
+ let [
64
+ {
65
+ size = options.size ?? "md",
66
+ variant = options.variant ?? "plain",
67
+ color = options.color ?? "neutral",
68
+ ...props
69
+ },
70
+ ...children
71
+ ] = toPropsAndChildren(args);
65
72
 
66
73
  return input({
67
74
  type: "checkbox",
@@ -213,9 +213,9 @@ export default function (context, options = {}) {
213
213
 
214
214
  return function DrillDownMenu(props) {
215
215
  const {
216
- variant = "plain",
217
- color = "neutral",
218
- size = "md",
216
+ size = options.size ?? "md",
217
+ variant = options.variant ?? "plain",
218
+ color = options.color ?? "neutral",
219
219
  tree,
220
220
  ...otherProps
221
221
  } = props;
@@ -1,7 +1,7 @@
1
1
  import { toPropsAndChildren } from "@grucloud/bau/bau.js";
2
2
  import classNames from "@grucloud/bau-css/classNames.js";
3
3
 
4
- export default function (context, options) {
4
+ export default function (context, options = {}) {
5
5
  const { bau, css } = context;
6
6
  const { div, span, label, input } = bau.tags;
7
7
 
@@ -50,9 +50,9 @@ export default function (context, options) {
50
50
 
51
51
  return function FileInput(props, ...children) {
52
52
  const {
53
- variant = "outline",
54
- color = "neutral",
55
- size = "md",
53
+ size = options.size ?? "md",
54
+ variant = options.variant ?? "plain",
55
+ color = options.color ?? "neutral",
56
56
  Component,
57
57
  disabled,
58
58
  ...otherProps
package/form/form.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import classNames from "@grucloud/bau-css/classNames.js";
2
2
  import { toPropsAndChildren } from "@grucloud/bau/bau.js";
3
3
 
4
- export default function (context, options) {
4
+ export default function (context, options = {}) {
5
5
  const { bau, css } = context;
6
6
  const { form } = bau.tags;
7
7
 
@@ -40,7 +40,13 @@ export default function (context, options) {
40
40
 
41
41
  return function Form(...args) {
42
42
  let [
43
- { color, variant = "outline", size = "md", content, ...props },
43
+ {
44
+ size = options.size ?? "md",
45
+ variant = options.variant ?? "plain",
46
+ color = options.color ?? "neutral",
47
+ content,
48
+ ...props
49
+ },
44
50
  ...children
45
51
  ] = toPropsAndChildren(args);
46
52
  return form(
package/input/input.js CHANGED
@@ -70,14 +70,12 @@ export default function (context, options = {}) {
70
70
  size = options.size ?? "md",
71
71
  variant = options.variant ?? "outline",
72
72
  color = options.color ?? "neutral",
73
- disabled,
74
73
  ...otherProps
75
74
  } = props;
76
75
 
77
76
  return input({
78
77
  type: "text",
79
78
  ...otherProps,
80
- disabled,
81
79
  class: classNames(
82
80
  "input",
83
81
  options.class,
@@ -85,7 +83,6 @@ export default function (context, options = {}) {
85
83
  color,
86
84
  variant,
87
85
  className,
88
- disabled && "disabled",
89
86
  otherProps.class
90
87
  ),
91
88
  });
@@ -2,7 +2,7 @@ import classNames from "@grucloud/bau-css/classNames.js";
2
2
  import { toPropsAndChildren } from "@grucloud/bau/bau.js";
3
3
  import { Colors } from "../constants.js";
4
4
 
5
- export default function (context, options) {
5
+ export default function (context, options = {}) {
6
6
  const { bau, css, keyframes } = context;
7
7
  const { div } = bau.tags;
8
8
 
@@ -60,7 +60,13 @@ export default function (context, options) {
60
60
 
61
61
  return function LinearProgress(...args) {
62
62
  let [
63
- { color = "neutral", variant = "plain", size = "md", running, ...props },
63
+ {
64
+ size = options.size ?? "md",
65
+ variant = options.variant ?? "plain",
66
+ color = options.color ?? "neutral",
67
+ running,
68
+ ...props
69
+ },
64
70
  ] = toPropsAndChildren(args);
65
71
 
66
72
  return div({
package/list/list.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import classNames from "@grucloud/bau-css/classNames.js";
2
2
  import { toPropsAndChildren } from "@grucloud/bau/bau.js";
3
3
 
4
- export default function (context, options) {
4
+ export default function (context, options = {}) {
5
5
  const { bau, css } = context;
6
6
  const { ul } = bau.tags;
7
7
 
@@ -36,7 +36,12 @@ export default function (context, options) {
36
36
 
37
37
  return function List(...args) {
38
38
  let [
39
- { color = "neutral", variant = "plain", size, ...props },
39
+ {
40
+ size = options.size ?? "md",
41
+ variant = options.variant ?? "plain",
42
+ color = options.color ?? "neutral",
43
+ ...props
44
+ },
40
45
  ...children
41
46
  ] = toPropsAndChildren(args);
42
47
  return ul(
@@ -3,7 +3,7 @@ import { toPropsAndChildren } from "@grucloud/bau/bau.js";
3
3
  import button from "../button";
4
4
  import spinner from "../spinner";
5
5
 
6
- export default function (context, options) {
6
+ export default function (context, options = {}) {
7
7
  const { bau, css, keyframes } = context;
8
8
  const { span } = bau.tags;
9
9
 
@@ -38,7 +38,13 @@ export default function (context, options) {
38
38
 
39
39
  return function LoadingButton(...args) {
40
40
  let [
41
- { color, variant = "plain", size = "md", loading, ...props },
41
+ {
42
+ size = options.size ?? "md",
43
+ variant = options.variant ?? "plain",
44
+ color = options.color ?? "neutral",
45
+ loading,
46
+ ...props
47
+ },
42
48
  ...children
43
49
  ] = toPropsAndChildren(args);
44
50
 
package/modal/modal.js CHANGED
@@ -2,7 +2,7 @@ import classNames from "@grucloud/bau-css/classNames.js";
2
2
  import { toPropsAndChildren } from "@grucloud/bau/bau.js";
3
3
  import { Colors } from "../constants.js";
4
4
 
5
- export default function (context, options) {
5
+ export default function (context, options = {}) {
6
6
  const { bau, css } = context;
7
7
  const { dialog, div } = bau.tags;
8
8
 
@@ -59,7 +59,12 @@ export default function (context, options) {
59
59
 
60
60
  return function Modal(...args) {
61
61
  let [
62
- { color = "neutral", variant = "outline", size = "md", ...props },
62
+ {
63
+ size = options.size ?? "md",
64
+ variant = options.variant ?? "plain",
65
+ color = options.color ?? "neutral",
66
+ ...props
67
+ },
63
68
  ...children
64
69
  ] = toPropsAndChildren(args);
65
70
 
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.43.1",
4
+ "version": "0.43.3",
5
5
  "type": "module",
6
6
  "license": "BSD",
7
7
  "keywords": [
@@ -26,5 +26,5 @@
26
26
  "devDependencies": {
27
27
  "typedoc": "0.24.8"
28
28
  },
29
- "gitHead": "3950ebd435d5cc3f5b459331d5a56c49760b8357"
29
+ "gitHead": "ce7f711af9f5588ed94daab1e48147978e061ab5"
30
30
  }
@@ -1,7 +1,7 @@
1
1
  import classNames from "@grucloud/bau-css/classNames.js";
2
2
  import { toPropsAndChildren } from "@grucloud/bau/bau.js";
3
3
 
4
- export default function (context, options) {
4
+ export default function (context, options = {}) {
5
5
  const { bau, css, config } = context;
6
6
  const { div, a, span, nav } = bau.tags;
7
7
 
@@ -55,8 +55,15 @@ export default function (context, options) {
55
55
  );
56
56
 
57
57
  return function PaginationNavigation(...args) {
58
- let [{ color, variant = "plain", size = "md", data = {}, ...props }] =
59
- toPropsAndChildren(args);
58
+ let [
59
+ {
60
+ size = options.size ?? "md",
61
+ variant = options.variant ?? "plain",
62
+ color = options.color ?? "neutral",
63
+ data = {},
64
+ ...props
65
+ },
66
+ ] = toPropsAndChildren(args);
60
67
  const { next, previous } = data;
61
68
  return nav(
62
69
  {
package/paper/paper.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import classNames from "@grucloud/bau-css/classNames.js";
2
2
  import { toPropsAndChildren } from "@grucloud/bau/bau.js";
3
3
 
4
- export default function (context, options) {
4
+ export default function (context, options = {}) {
5
5
  const { bau, css } = context;
6
6
  const { div } = bau.tags;
7
7
  const className = css`
@@ -32,8 +32,15 @@ export default function (context, options) {
32
32
  `;
33
33
 
34
34
  return function Paper(...args) {
35
- let [{ color, variant = "outline", size = "md", ...props }, ...children] =
36
- toPropsAndChildren(args);
35
+ let [
36
+ {
37
+ size = options.size ?? "md",
38
+ variant = options.variant ?? "plain",
39
+ color = options.color ?? "neutral",
40
+ ...props
41
+ },
42
+ ...children
43
+ ] = toPropsAndChildren(args);
37
44
  return div(
38
45
  {
39
46
  ...props,
@@ -2,7 +2,7 @@ import classNames from "@grucloud/bau-css/classNames.js";
2
2
  import { toPropsAndChildren } from "@grucloud/bau/bau.js";
3
3
  import { Colors } from "../constants.js";
4
4
 
5
- export default function (context, options) {
5
+ export default function (context, options = {}) {
6
6
  const { bau, css } = context;
7
7
  const { input } = bau.tags;
8
8
 
@@ -29,8 +29,14 @@ export default function (context, options) {
29
29
  `;
30
30
 
31
31
  return function RadioButton(...args) {
32
- let [{ color = "neutral", variant = "plain", size = "md", ...props }] =
33
- toPropsAndChildren(args);
32
+ let [
33
+ {
34
+ size = options.size ?? "md",
35
+ variant = options.variant ?? "plain",
36
+ color = options.color ?? "neutral",
37
+ ...props
38
+ },
39
+ ] = toPropsAndChildren(args);
34
40
 
35
41
  return input({
36
42
  ...props,
package/select/select.js CHANGED
@@ -19,7 +19,7 @@ const colorsToCss = () =>
19
19
  `
20
20
  ).join("\n");
21
21
 
22
- export default function (context, componentOptions) {
22
+ export default function (context, componentOptions = {}) {
23
23
  const { bau, css } = context;
24
24
  const { div, li, select, option } = bau.tags;
25
25
  const Button = button(context);
@@ -43,9 +43,9 @@ export default function (context, componentOptions) {
43
43
  return function Select(...args) {
44
44
  let [
45
45
  {
46
- color = "neutral",
47
- variant = "outline",
48
- size = "md",
46
+ size = componentOptions.size ?? "md",
47
+ variant = componentOptions.variant ?? "plain",
48
+ color = componentOptions.color ?? "neutral",
49
49
  label,
50
50
  Option,
51
51
  options,
package/slider/slider.js CHANGED
@@ -2,7 +2,7 @@ import { toPropsAndChildren } from "@grucloud/bau/bau.js";
2
2
  import classNames from "@grucloud/bau-css/classNames.js";
3
3
  import { Colors } from "../constants.js";
4
4
 
5
- export default function (context, options) {
5
+ export default function (context, options = {}) {
6
6
  const { bau, css } = context;
7
7
  const { input } = bau.tags;
8
8
 
@@ -22,7 +22,12 @@ export default function (context, options) {
22
22
 
23
23
  return function Slider(...args) {
24
24
  let [
25
- { color = "neutral", variant = "outline", size, ...props },
25
+ {
26
+ size = options.size ?? "md",
27
+ variant = options.variant ?? "plain",
28
+ color = options.color ?? "neutral",
29
+ ...props
30
+ },
26
31
  ...children
27
32
  ] = toPropsAndChildren(args);
28
33
 
@@ -36,7 +41,6 @@ export default function (context, options) {
36
41
  variant,
37
42
  size,
38
43
  className,
39
-
40
44
  options?.class,
41
45
  props.class
42
46
  ),
@@ -10,7 +10,7 @@ const colorsToCss = () =>
10
10
  `
11
11
  ).join("\n");
12
12
 
13
- export default function (context, options) {
13
+ export default function (context, options = {}) {
14
14
  const { bau, css } = context;
15
15
  const { div, ul, li, span } = bau.tags;
16
16
 
package/switch/switch.js CHANGED
@@ -45,7 +45,7 @@ const colorsToCss = () =>
45
45
  `
46
46
  ).join("\n");
47
47
 
48
- export default function (context, options) {
48
+ export default function (context, options = {}) {
49
49
  const { bau, css } = context;
50
50
  const { input } = bau.tags;
51
51
 
@@ -109,7 +109,12 @@ export default function (context, options) {
109
109
 
110
110
  return function Switch(...args) {
111
111
  let [
112
- { color = "neutral", variant = "plain", size = "md", ...props },
112
+ {
113
+ size = options.size ?? "md",
114
+ variant = options.variant ?? "plain",
115
+ color = options.color ?? "neutral",
116
+ ...props
117
+ },
113
118
  ...children
114
119
  ] = toPropsAndChildren(args);
115
120
  return input(
@@ -115,8 +115,15 @@ export default function (context, options = {}) {
115
115
  };
116
116
 
117
117
  return function TableOfContent(...args) {
118
- let [{ color, variant, size = "md", contentEl, ...props }] =
119
- toPropsAndChildren(args);
118
+ let [
119
+ {
120
+ size = options.size ?? "md",
121
+ variant = options.variant ?? "plain",
122
+ color = options.color ?? "neutral",
123
+ contentEl,
124
+ ...props
125
+ },
126
+ ] = toPropsAndChildren(args);
120
127
 
121
128
  const toc = createToc({ contentEl });
122
129
 
@@ -5,7 +5,7 @@ import buttonGroup from "../buttonGroup/buttonGroup.js";
5
5
 
6
6
  import spinner from "../spinner/spinner.js";
7
7
 
8
- export default function (context, options) {
8
+ export default function (context, options = {}) {
9
9
  const { bau, css } = context;
10
10
  const { div } = bau.tags;
11
11
  const ButtonGroup = buttonGroup(context);
@@ -55,6 +55,9 @@ export default function (context, options) {
55
55
  return function TablePagination(...args) {
56
56
  let [
57
57
  {
58
+ size = options.size ?? "md",
59
+ variant = options.variant ?? "outline",
60
+ color = options.color ?? "neutral",
58
61
  count = 0,
59
62
  totalCount = 0,
60
63
  page = 1,
@@ -121,10 +124,8 @@ export default function (context, options) {
121
124
  : PagesNumbersNoTotal({ count, page, maxPages, rowsPerPage }),
122
125
 
123
126
  ButtonGroup(
124
- { variant: "outline", color: "neutral" },
125
- actions.map((action) =>
126
- ActionButton({ ...action, variant: "outline", color: "neutral" })
127
- )
127
+ { variant, color },
128
+ actions.map((action) => ActionButton({ ...action, variant, color }))
128
129
  )
129
130
  );
130
131
  };
package/tabs/tabs.js CHANGED
@@ -12,7 +12,7 @@ const colorsToCss = () =>
12
12
  `
13
13
  ).join("\n");
14
14
 
15
- export default function (context, options) {
15
+ export default function (context, options = {}) {
16
16
  const { bau, css } = context;
17
17
  const { tabDefs } = options;
18
18
  const { div, ul, li } = bau.tags;
@@ -74,8 +74,15 @@ export default function (context, options) {
74
74
  `;
75
75
 
76
76
  return function Tabs(...args) {
77
- let [{ color, variant = "plain", size, ...props }, ...children] =
78
- toPropsAndChildren(args);
77
+ let [
78
+ {
79
+ size = options.size ?? "md",
80
+ variant = options.variant ?? "outline",
81
+ color = options.color ?? "neutral",
82
+ ...props
83
+ },
84
+ ...children
85
+ ] = toPropsAndChildren(args);
79
86
 
80
87
  const tabsState = bau.state(tabDefs);
81
88
 
@@ -14,7 +14,7 @@ const colorsToCss = () =>
14
14
  `
15
15
  ).join("\n");
16
16
 
17
- export default function (context, options) {
17
+ export default function (context, options = {}) {
18
18
  const { bau, css, window } = context;
19
19
  const { input } = bau.tags;
20
20
 
@@ -95,8 +95,15 @@ export default function (context, options) {
95
95
  `;
96
96
 
97
97
  return function ThemeSwitch(...args) {
98
- let [{ color, variant = "outline", size = "md", ...props }, ...children] =
99
- toPropsAndChildren(args);
98
+ let [
99
+ {
100
+ size = options.size ?? "md",
101
+ variant = options.variant ?? "plain",
102
+ color = options.color ?? "neutral",
103
+ ...props
104
+ },
105
+ ...children
106
+ ] = toPropsAndChildren(args);
100
107
 
101
108
  return input(
102
109
  {
package/toggle/toggle.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { toPropsAndChildren } from "@grucloud/bau/bau.js";
2
2
  import classNames from "@grucloud/bau-css/classNames.js";
3
3
 
4
- export default function (context, options) {
4
+ export default function (context, options = {}) {
5
5
  const { bau, css, createGlobalStyles } = context;
6
6
  const { button } = bau.tags;
7
7
 
@@ -65,9 +65,9 @@ export default function (context, options) {
65
65
  return function Toggle(...args) {
66
66
  let [
67
67
  {
68
- color,
69
- variant,
70
- size = "md",
68
+ size = options.size ?? "md",
69
+ variant = options.variant ?? "outline",
70
+ color = options.color ?? "neutral",
71
71
  selected = false,
72
72
  disabled,
73
73
  onChange,
@@ -27,7 +27,7 @@ const colorsToCss = () =>
27
27
  `
28
28
  ).join("\n");
29
29
 
30
- export default function (context, options) {
30
+ export default function (context, options = {}) {
31
31
  const { bau, css } = context;
32
32
  const { div } = bau.tags;
33
33
  const className = css`
@@ -47,9 +47,9 @@ export default function (context, options) {
47
47
  return function ToggleGroup(...args) {
48
48
  let [
49
49
  {
50
- color,
51
- variant = "plain",
52
- size = "md",
50
+ size = options.size ?? "md",
51
+ variant = options.variant ?? "outline",
52
+ color = options.color ?? "neutral",
53
53
  exclusive = false,
54
54
  onChange = () => {},
55
55
  ...props
@@ -1,7 +1,7 @@
1
1
  import classNames from "@grucloud/bau-css/classNames.js";
2
2
  import { toPropsAndChildren } from "@grucloud/bau/bau.js";
3
3
 
4
- export default function (context, options) {
4
+ export default function (context, options = {}) {
5
5
  const { bau, css, window } = context;
6
6
  const { div } = bau.tags;
7
7
 
@@ -92,9 +92,9 @@ export default function (context, options) {
92
92
  {
93
93
  titleEl,
94
94
  side = "bottom-start",
95
- color = "neutral",
96
- variant = "outline",
97
- size = "md",
95
+ size = options.size ?? "md",
96
+ variant = options.variant ?? "outline",
97
+ color = options.color ?? "neutral",
98
98
  ...props
99
99
  },
100
100
  ...children
@@ -64,7 +64,7 @@ const createStyles = ({ css, createGlobalStyles }) => {
64
64
  };
65
65
  };
66
66
 
67
- export default function (context, options) {
67
+ export default function (context, options = {}) {
68
68
  const { bau, css, createGlobalStyles } = context;
69
69
  const { renderMenuItem } = options;
70
70
  const { ul, li, nav, div } = bau.tags;
@@ -114,9 +114,9 @@ export default function (context, options) {
114
114
  return function TreeView({
115
115
  tree,
116
116
  maxDepth = Infinity,
117
- size = "md",
118
- variant = "plain",
119
- color = "neutral",
117
+ size = options.size ?? "md",
118
+ variant = options.variant ?? "outline",
119
+ color = options.color ?? "neutral",
120
120
  ...otherProps
121
121
  }) {
122
122
  return nav(