@grucloud/bau-ui 0.40.0 → 0.42.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/README.md +4 -2
- package/accordion/accordion.js +162 -0
- package/accordion/index.d.ts +26 -0
- package/accordion/index.js +1 -0
- package/alert/alert.js +65 -55
- package/alert/index.d.ts +8 -9
- package/alertStack/alertStack.js +5 -3
- package/alertStack/index.d.ts +5 -2
- package/animate/animate.js +47 -33
- package/animate/index.d.ts +2 -3
- package/autocomplete/autocomplete.js +222 -0
- package/autocomplete/index.d.ts +21 -0
- package/autocomplete/index.js +1 -0
- package/avatar/avatar.js +46 -6
- package/avatar/index.d.ts +5 -2
- package/badge/badge.js +43 -0
- package/badge/index.d.ts +12 -0
- package/badge/index.js +1 -0
- package/bau-ui.d.ts +14 -7
- package/breadcrumbs/breadcrumbs.js +30 -6
- package/breadcrumbs/index.d.ts +8 -2
- package/button/button.js +38 -105
- package/button/index.d.ts +4 -7
- package/buttonGroup/buttonGroup.js +68 -0
- package/buttonGroup/index.d.ts +10 -0
- package/buttonGroup/index.js +1 -0
- package/calendar/calendar.js +51 -0
- package/calendar/index.d.ts +13 -0
- package/calendar/index.js +1 -0
- package/checkbox/checkbox.js +66 -39
- package/checkbox/index.d.ts +5 -2
- package/chip/chip.js +60 -0
- package/chip/index.d.ts +10 -0
- package/chip/index.js +1 -0
- package/constants.d.ts +13 -0
- package/constants.js +3 -0
- package/context.d.ts +12 -0
- package/context.js +17 -0
- package/drawer/drawer.js +10 -5
- package/drawer/index.d.ts +5 -2
- package/drillDownMenu/drillDownMenu.js +157 -138
- package/drillDownMenu/index.d.ts +11 -3
- package/fileInput/fileInput.js +25 -11
- package/fileInput/index.d.ts +9 -3
- package/form/form.js +31 -0
- package/form/index.d.ts +10 -0
- package/form/index.js +1 -0
- package/globalStyle/globalStyle.js +133 -61
- package/globalStyle/index.d.ts +14 -0
- package/input/index.d.ts +6 -8
- package/input/input.js +78 -107
- package/list/index.d.ts +10 -0
- package/list/index.js +1 -0
- package/list/list.js +66 -0
- package/modal/index.d.ts +5 -2
- package/modal/modal.js +47 -10
- package/package.json +4 -4
- package/pages/login/index.d.ts +4 -5
- package/pages/login/login.js +1 -1
- package/popover/index.d.ts +18 -0
- package/popover/index.js +1 -0
- package/popover/popover.js +69 -0
- package/select/index.d.ts +16 -0
- package/select/index.js +1 -0
- package/select/select.js +176 -0
- package/slider/index.d.ts +10 -0
- package/slider/index.js +1 -0
- package/slider/slider.js +47 -0
- package/spinner/index.d.ts +7 -4
- package/spinner/spinner.js +13 -5
- package/switch/index.d.ts +5 -2
- package/switch/switch.js +101 -18
- package/tableContainer/index.d.ts +9 -0
- package/tableContainer/index.js +1 -0
- package/tableContainer/tableContainer.js +78 -0
- package/tablePagination/index.d.ts +17 -0
- package/tablePagination/index.js +1 -0
- package/tablePagination/tablePagination.js +131 -0
- package/tabs/index.d.ts +3 -1
- package/tabs/tabs.js +34 -15
- package/themeSwitch/index.d.ts +3 -1
- package/themeSwitch/themeSwitch.js +58 -15
- package/tooltip/index.d.ts +24 -0
- package/tooltip/index.js +1 -0
- package/tooltip/tooltip.js +184 -0
- package/treeView/index.d.ts +7 -2
- package/treeView/treeView.js +37 -9
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import { toPropsAndChildren } from "@grucloud/bau/bau.js";
|
|
1
2
|
import cn from "@grucloud/bau-css/classNames.js";
|
|
2
3
|
import animate from "../animate/animate.js";
|
|
4
|
+
import button from "../button/button.js";
|
|
5
|
+
import list from "../list/list.js";
|
|
3
6
|
|
|
4
7
|
const animationDuration = "0.3s";
|
|
5
8
|
|
|
@@ -36,18 +39,7 @@ const findSubTree = (initialPathname) => (tree) => {
|
|
|
36
39
|
}
|
|
37
40
|
};
|
|
38
41
|
|
|
39
|
-
const
|
|
40
|
-
window.location.pathname === subTree?.data?.href;
|
|
41
|
-
|
|
42
|
-
const createStyles = ({ createGlobalStyles, keyframes }) => {
|
|
43
|
-
createGlobalStyles`
|
|
44
|
-
:root {
|
|
45
|
-
--drill-down-menu-color: var(--font-color-base);
|
|
46
|
-
--drill-down-menu-padding: 0.4rem;
|
|
47
|
-
--drill-down-menu-bg-active: var(--color-emphasis-50);
|
|
48
|
-
--drill-down-menu-bg-hover: var(--color-emphasis-50);
|
|
49
|
-
}
|
|
50
|
-
`;
|
|
42
|
+
const createStyles = ({ keyframes }) => {
|
|
51
43
|
return {
|
|
52
44
|
hideToLeft: keyframes`
|
|
53
45
|
from {
|
|
@@ -58,16 +50,6 @@ const createStyles = ({ createGlobalStyles, keyframes }) => {
|
|
|
58
50
|
transform: translateX(-100%);
|
|
59
51
|
opacity: 0;
|
|
60
52
|
}
|
|
61
|
-
`,
|
|
62
|
-
showFromLeft: keyframes`
|
|
63
|
-
from {
|
|
64
|
-
transform: translateX(-100%);
|
|
65
|
-
opacity: 0;
|
|
66
|
-
}
|
|
67
|
-
to {
|
|
68
|
-
transform: translateX(0%);
|
|
69
|
-
opacity: 1;
|
|
70
|
-
}
|
|
71
53
|
`,
|
|
72
54
|
hideToRight: keyframes`
|
|
73
55
|
from {
|
|
@@ -79,59 +61,86 @@ const createStyles = ({ createGlobalStyles, keyframes }) => {
|
|
|
79
61
|
opacity: 0;
|
|
80
62
|
}
|
|
81
63
|
`,
|
|
82
|
-
showFromRight: keyframes`
|
|
83
|
-
from {
|
|
84
|
-
transform: translateX(100%);
|
|
85
|
-
opacity: 0;
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
to {
|
|
89
|
-
transform: translateX(0%);
|
|
90
|
-
opacity: 1;
|
|
91
|
-
}
|
|
92
|
-
`,
|
|
93
64
|
};
|
|
94
65
|
};
|
|
95
66
|
|
|
96
|
-
export default function (context,
|
|
67
|
+
export default function (context, options) {
|
|
97
68
|
const { bau, css, window } = context;
|
|
98
|
-
const {
|
|
69
|
+
const { base = "" } = options;
|
|
70
|
+
|
|
71
|
+
const renderHeaderDefault = ({ currentTree, data }) =>
|
|
72
|
+
header(
|
|
73
|
+
Button(
|
|
74
|
+
{
|
|
75
|
+
variant: "plain",
|
|
76
|
+
href: `${base}${currentTree.parentTree.children[0].data.href}`,
|
|
77
|
+
class: css`
|
|
78
|
+
flex-grow: 0;
|
|
79
|
+
`,
|
|
80
|
+
"data-buttonback": true,
|
|
81
|
+
},
|
|
82
|
+
"\u2190"
|
|
83
|
+
),
|
|
84
|
+
Button(
|
|
85
|
+
{
|
|
86
|
+
variant: "plain",
|
|
87
|
+
href: `${base}${data.href}`,
|
|
88
|
+
class: css`
|
|
89
|
+
flex-grow: 1;
|
|
90
|
+
`,
|
|
91
|
+
"data-ischild": true,
|
|
92
|
+
},
|
|
93
|
+
data.name
|
|
94
|
+
)
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
const renderMenuItemDefault = ({ data: { name, href }, children = [] }) =>
|
|
98
|
+
Button(
|
|
99
|
+
{
|
|
100
|
+
href: `${base}${href}`,
|
|
101
|
+
"data-ischild": !children.length,
|
|
102
|
+
},
|
|
103
|
+
name
|
|
104
|
+
);
|
|
105
|
+
|
|
106
|
+
const isActiveDefault = ({ subTree }) =>
|
|
107
|
+
window.location.pathname.replace(base, "") === subTree?.data?.href;
|
|
108
|
+
|
|
109
|
+
const {
|
|
110
|
+
renderHeader = renderHeaderDefault,
|
|
111
|
+
renderMenuItem = renderMenuItemDefault,
|
|
112
|
+
isActive = isActiveDefault,
|
|
113
|
+
} = options;
|
|
114
|
+
|
|
115
|
+
const { li, nav, div, header, a } = bau.tags;
|
|
99
116
|
const Animate = animate(context);
|
|
117
|
+
const List = list(context);
|
|
100
118
|
|
|
101
|
-
const
|
|
102
|
-
|
|
119
|
+
const Button = button(context, {
|
|
120
|
+
class: css`
|
|
121
|
+
&.button {
|
|
122
|
+
justify-content: flex-start;
|
|
123
|
+
}
|
|
124
|
+
`,
|
|
125
|
+
});
|
|
126
|
+
const { hideToLeft, hideToRight } = createStyles(context);
|
|
103
127
|
|
|
104
128
|
const className = css`
|
|
105
129
|
font-weight: var(--font-weight-semibold);
|
|
106
130
|
overflow: hidden;
|
|
107
131
|
position: relative;
|
|
108
|
-
|
|
109
|
-
span {
|
|
110
|
-
flex-grow: 1;
|
|
111
|
-
text-decoration: none;
|
|
112
|
-
color: var(--drill-down-menu-color);
|
|
113
|
-
}
|
|
132
|
+
|
|
114
133
|
& header {
|
|
115
134
|
display: flex;
|
|
116
135
|
align-items: center;
|
|
117
|
-
cursor: pointer;
|
|
118
136
|
font-weight: var(--font-weight-bold);
|
|
119
|
-
border-bottom: 1px solid var(--color-emphasis-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
background: var(--drill-down-menu-bg-hover);
|
|
124
|
-
}
|
|
125
|
-
&::before {
|
|
126
|
-
content: "\u2190";
|
|
127
|
-
margin-right: 0.5rem;
|
|
137
|
+
border-bottom: 1px solid var(--color-emphasis-200);
|
|
138
|
+
& a {
|
|
139
|
+
padding: 0.6rem;
|
|
140
|
+
border-radius: 0;
|
|
128
141
|
}
|
|
129
142
|
}
|
|
130
143
|
& ul {
|
|
131
|
-
display: block;
|
|
132
|
-
list-style: none;
|
|
133
|
-
margin: 0;
|
|
134
|
-
padding-left: 0;
|
|
135
144
|
overflow: hidden;
|
|
136
145
|
& .has-children {
|
|
137
146
|
&::after {
|
|
@@ -139,112 +148,122 @@ export default function (context, { renderMenuItem }) {
|
|
|
139
148
|
padding: 0 0.5rem 0 0.5rem;
|
|
140
149
|
}
|
|
141
150
|
}
|
|
142
|
-
& .is-active {
|
|
143
|
-
background-color: var(--drill-down-menu-bg-active);
|
|
144
|
-
}
|
|
145
151
|
& li {
|
|
146
|
-
padding:
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
justify-content: space-between;
|
|
150
|
-
align-items: center;
|
|
151
|
-
background-color: transparent;
|
|
152
|
-
transition: background-color var(--transition-slow) ease-in-out;
|
|
153
|
-
&:hover {
|
|
154
|
-
background-color: var(--drill-down-menu-bg-hover);
|
|
155
|
-
cursor: pointer;
|
|
152
|
+
padding: 0;
|
|
153
|
+
& a {
|
|
154
|
+
width: 100%;
|
|
156
155
|
}
|
|
157
156
|
}
|
|
158
157
|
}
|
|
159
158
|
`;
|
|
160
159
|
|
|
161
|
-
const Menu = ({
|
|
160
|
+
const Menu = ({ variant, color, size, currentTree, pathnameState }) => {
|
|
162
161
|
const { children, parentTree, data } = currentTree;
|
|
162
|
+
//console.log("Menu", currentTree, pathnameState.val);
|
|
163
163
|
return div(
|
|
164
|
-
{ class: "drillDownMenu" },
|
|
165
|
-
parentTree &&
|
|
166
|
-
header(
|
|
167
|
-
{
|
|
168
|
-
onclick: onclickBack({ currentTree }),
|
|
169
|
-
},
|
|
170
|
-
a({ href: currentTree.parentTree.children[0].data.href }, data.name)
|
|
171
|
-
),
|
|
164
|
+
{ class: cn("drillDownMenu", variant, color, size) },
|
|
165
|
+
parentTree && renderHeader({ data, currentTree }),
|
|
172
166
|
children &&
|
|
173
|
-
|
|
167
|
+
List(
|
|
168
|
+
{ class: cn(variant, color, size) },
|
|
174
169
|
children.map((subTree) =>
|
|
175
170
|
li(
|
|
176
171
|
{
|
|
177
|
-
class:
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
172
|
+
class: () =>
|
|
173
|
+
cn(
|
|
174
|
+
subTree.children && "has-children",
|
|
175
|
+
isActive({ pathname: pathnameState.val, subTree }) &&
|
|
176
|
+
"active"
|
|
177
|
+
),
|
|
183
178
|
},
|
|
184
|
-
renderMenuItem(subTree
|
|
179
|
+
renderMenuItem(subTree)
|
|
185
180
|
)
|
|
186
181
|
)
|
|
187
182
|
)
|
|
188
183
|
);
|
|
189
184
|
};
|
|
190
185
|
|
|
191
|
-
|
|
192
|
-
tree
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
186
|
+
const findInitialTree = ({ tree, pathname }) => {
|
|
187
|
+
let currentTree = treeAddParent({})(structuredClone(tree));
|
|
188
|
+
let subTree = findSubTree(pathname)(currentTree);
|
|
189
|
+
if (!subTree) {
|
|
190
|
+
console.log("drilldown no sub tree", pathname);
|
|
191
|
+
subTree = currentTree;
|
|
192
|
+
}
|
|
193
|
+
return subTree;
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
return function DrillDownMenu(props) {
|
|
197
|
+
const {
|
|
198
|
+
variant = "plain",
|
|
199
|
+
color = "neutral",
|
|
200
|
+
size = "md",
|
|
201
|
+
tree,
|
|
202
|
+
pathnameState = bau.state(window.location.pathname),
|
|
203
|
+
...otherProps
|
|
204
|
+
} = props;
|
|
205
|
+
|
|
206
|
+
let direction = 1;
|
|
207
|
+
|
|
208
|
+
const onclick = (event) => {
|
|
209
|
+
const { dataset } = event.target;
|
|
210
|
+
if (dataset.buttonback == "true") {
|
|
211
|
+
direction = -1;
|
|
212
|
+
} else if (dataset.ischild == "false") {
|
|
213
|
+
direction = 1;
|
|
214
|
+
} else if (dataset.ischild == "true") {
|
|
215
|
+
direction = 0;
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
const treeState = bau.derive(() =>
|
|
220
|
+
findInitialTree({
|
|
221
|
+
tree,
|
|
222
|
+
pathname: pathnameState.val,
|
|
223
|
+
})
|
|
224
|
+
);
|
|
225
|
+
|
|
226
|
+
const animationHide = (direction) => {
|
|
227
|
+
switch (direction) {
|
|
228
|
+
case 1:
|
|
229
|
+
return `${hideToLeft} ${animationDuration}`;
|
|
230
|
+
case -1:
|
|
231
|
+
return `${hideToRight} ${animationDuration}`;
|
|
232
|
+
default:
|
|
233
|
+
return "";
|
|
234
|
+
}
|
|
226
235
|
};
|
|
227
236
|
|
|
228
|
-
const
|
|
237
|
+
const animationShow = (direction) => {
|
|
238
|
+
switch (direction) {
|
|
239
|
+
case 1:
|
|
240
|
+
return `${hideToRight} ${animationDuration} reverse`;
|
|
241
|
+
case -1:
|
|
242
|
+
return `${hideToLeft} ${animationDuration} reverse`;
|
|
243
|
+
default:
|
|
244
|
+
return "";
|
|
245
|
+
}
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
return nav(
|
|
229
249
|
{
|
|
230
|
-
class: cn(className, otherProps.class),
|
|
250
|
+
class: cn(className, options?.class, otherProps.class),
|
|
251
|
+
onclick,
|
|
231
252
|
},
|
|
232
|
-
(
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
return div(
|
|
253
|
+
Animate(
|
|
254
|
+
{
|
|
255
|
+
animationHide: () => animationHide(direction),
|
|
256
|
+
animationShow: () => animationShow(direction),
|
|
257
|
+
},
|
|
258
|
+
() =>
|
|
239
259
|
Menu({
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
260
|
+
variant,
|
|
261
|
+
color,
|
|
262
|
+
size,
|
|
263
|
+
currentTree: treeState.val,
|
|
264
|
+
pathnameState,
|
|
243
265
|
})
|
|
244
|
-
|
|
245
|
-
}
|
|
266
|
+
)
|
|
246
267
|
);
|
|
247
|
-
|
|
248
|
-
return navEl;
|
|
249
268
|
};
|
|
250
269
|
}
|
package/drillDownMenu/index.d.ts
CHANGED
|
@@ -1,18 +1,26 @@
|
|
|
1
1
|
declare module "@grucloud/bau-ui/drillDownMenu" {
|
|
2
|
+
type DefaultDesignProps = import("../constants").DefaultDesignProps;
|
|
3
|
+
type ComponentOption = import("../bau-ui").ComponentOption;
|
|
4
|
+
|
|
2
5
|
type Tree = {
|
|
3
6
|
data?: object;
|
|
4
7
|
children?: Tree[];
|
|
5
8
|
};
|
|
9
|
+
|
|
6
10
|
export type TreeViewProps = {
|
|
7
11
|
tree: Tree;
|
|
8
|
-
};
|
|
12
|
+
} & DefaultDesignProps;
|
|
9
13
|
|
|
10
14
|
type Component = import("../bau-ui").Component<TreeViewProps>;
|
|
11
15
|
|
|
12
16
|
type ComponentGeneric = import("../bau-ui").ComponentGeneric;
|
|
13
17
|
|
|
14
18
|
type Option = {
|
|
15
|
-
|
|
16
|
-
|
|
19
|
+
renderHeader?: ComponentGeneric;
|
|
20
|
+
renderMenuItem?: ComponentGeneric;
|
|
21
|
+
isActive?: (input: { subTree: object }) => boolean;
|
|
22
|
+
base?: string;
|
|
23
|
+
} & ComponentOption;
|
|
24
|
+
|
|
17
25
|
export default function (context: Object, option: Option): Component;
|
|
18
26
|
}
|
package/fileInput/fileInput.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { toPropsAndChildren } from "@grucloud/bau/bau.js";
|
|
2
|
+
import classNames from "@grucloud/bau-css/classNames.js";
|
|
2
3
|
|
|
3
|
-
export default function (context, options
|
|
4
|
+
export default function (context, options) {
|
|
4
5
|
const { bau, css } = context;
|
|
5
6
|
const { div, span, label, input } = bau.tags;
|
|
6
7
|
|
|
7
8
|
const style = {
|
|
8
9
|
base: css`
|
|
9
10
|
display: inline-block;
|
|
10
|
-
width: 20rem;
|
|
11
11
|
> * {
|
|
12
12
|
margin: 1rem 0;
|
|
13
13
|
}
|
|
@@ -31,18 +31,17 @@ export default function (context, options = {}) {
|
|
|
31
31
|
justify-content: center;
|
|
32
32
|
align-items: center;
|
|
33
33
|
cursor: pointer;
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
transition: all var(--transition-slow) ease-out;
|
|
35
|
+
&:hover.solid {
|
|
36
|
+
filter: brightness(var(--brightness-hover-always)) !important;
|
|
37
|
+
}
|
|
36
38
|
&:hover {
|
|
37
|
-
|
|
39
|
+
filter: brightness(var(--brightness-hover));
|
|
38
40
|
}
|
|
39
41
|
}
|
|
40
42
|
`,
|
|
41
43
|
disabled: css`
|
|
42
|
-
color: var(--color-gray-500);
|
|
43
44
|
& label {
|
|
44
|
-
background-color: var(--color-gray-100);
|
|
45
|
-
border: var(--global-border-width) var(--color-gray-500) dotted;
|
|
46
45
|
&:hover {
|
|
47
46
|
box-shadow: var(--shadow-s);
|
|
48
47
|
}
|
|
@@ -52,13 +51,28 @@ export default function (context, options = {}) {
|
|
|
52
51
|
};
|
|
53
52
|
|
|
54
53
|
return function FileInput(props, ...children) {
|
|
55
|
-
const {
|
|
54
|
+
const {
|
|
55
|
+
variant = "outline",
|
|
56
|
+
color = "neutral",
|
|
57
|
+
size = "md",
|
|
58
|
+
Component,
|
|
59
|
+
disabled,
|
|
60
|
+
...otherProps
|
|
61
|
+
} = props;
|
|
56
62
|
|
|
57
63
|
return div(
|
|
58
64
|
{
|
|
59
|
-
class: classNames(
|
|
65
|
+
class: classNames(
|
|
66
|
+
style.base,
|
|
67
|
+
disabled && style.disabled,
|
|
68
|
+
options?.class,
|
|
69
|
+
props.class
|
|
70
|
+
),
|
|
60
71
|
},
|
|
61
72
|
label(
|
|
73
|
+
{
|
|
74
|
+
class: classNames(variant, color, size),
|
|
75
|
+
},
|
|
62
76
|
Component({ disabled }),
|
|
63
77
|
input({ type: "file", disabled, ...otherProps })
|
|
64
78
|
),
|
package/fileInput/index.d.ts
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
declare module "@grucloud/bau-ui/fileInput" {
|
|
2
|
+
type DefaultDesignProps = import("../constants").DefaultDesignProps;
|
|
3
|
+
type ComponentOption = import("../bau-ui").ComponentOption;
|
|
4
|
+
|
|
2
5
|
export type FileInputProps = {
|
|
3
6
|
disabled?: boolean;
|
|
4
|
-
};
|
|
7
|
+
} & DefaultDesignProps;
|
|
5
8
|
|
|
6
|
-
type Component = import("../bau-ui").Component<
|
|
9
|
+
type Component = import("../bau-ui").Component<
|
|
10
|
+
FileInputProps,
|
|
11
|
+
HTMLInputElement
|
|
12
|
+
>;
|
|
7
13
|
|
|
8
|
-
export default function (context: any): Component;
|
|
14
|
+
export default function (context: any, option?: ComponentOption): Component;
|
|
9
15
|
}
|
package/form/form.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import classNames from "@grucloud/bau-css/classNames.js";
|
|
2
|
+
import { toPropsAndChildren } from "@grucloud/bau/bau.js";
|
|
3
|
+
|
|
4
|
+
export default function (context, options) {
|
|
5
|
+
const { bau, css } = context;
|
|
6
|
+
const { form } = bau.tags;
|
|
7
|
+
|
|
8
|
+
const className = css``;
|
|
9
|
+
|
|
10
|
+
return function Form(...args) {
|
|
11
|
+
let [
|
|
12
|
+
{ color, variant = "outline", size = "md", content, ...props },
|
|
13
|
+
...children
|
|
14
|
+
] = toPropsAndChildren(args);
|
|
15
|
+
return form(
|
|
16
|
+
{
|
|
17
|
+
...props,
|
|
18
|
+
class: classNames(
|
|
19
|
+
"form",
|
|
20
|
+
color,
|
|
21
|
+
variant,
|
|
22
|
+
size,
|
|
23
|
+
className,
|
|
24
|
+
options?.class,
|
|
25
|
+
props?.class
|
|
26
|
+
),
|
|
27
|
+
},
|
|
28
|
+
...children
|
|
29
|
+
);
|
|
30
|
+
};
|
|
31
|
+
}
|
package/form/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare module "@grucloud/bau-ui/form" {
|
|
2
|
+
type DefaultDesignProps = import("../constants").DefaultDesignProps;
|
|
3
|
+
type ComponentOption = import("../bau-ui").ComponentOption;
|
|
4
|
+
|
|
5
|
+
export type FormProps = {} & DefaultDesignProps;
|
|
6
|
+
|
|
7
|
+
type Component = import("../bau-ui").Component<FormProps>;
|
|
8
|
+
|
|
9
|
+
export default function (context: any, option?: ComponentOption): Component;
|
|
10
|
+
}
|
package/form/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./form";
|