@grucloud/bau-ui 0.41.0 → 0.43.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 +32 -62
- package/accordion/index.d.ts +5 -7
- package/alert/alert.js +33 -30
- package/animate/animate.js +48 -34
- package/animate/index.d.ts +2 -3
- package/autocomplete/autocomplete.js +14 -11
- package/avatar/avatar.js +5 -2
- package/badge/index.d.ts +0 -4
- package/bau-ui.d.ts +3 -1
- package/breadcrumbs/breadcrumbs.js +2 -5
- package/button/button.js +59 -52
- package/buttonGroup/buttonGroup.js +4 -3
- package/carousel/carousel.js +105 -0
- package/carousel/index.d.ts +22 -0
- package/carousel/index.js +1 -0
- package/chip/chip.js +11 -11
- package/collapsible/collapsible.js +121 -0
- package/collapsible/index.d.ts +10 -0
- package/collapsible/index.js +1 -0
- package/constants.d.ts +8 -2
- package/constants.js +8 -1
- package/context.d.ts +2 -0
- package/context.js +5 -1
- package/docs/.nojekyll +1 -0
- package/docs/assets/highlight.css +22 -0
- package/docs/assets/main.js +58 -0
- package/docs/assets/search.js +1 -0
- package/docs/assets/style.css +1367 -0
- package/docs/functions/accordion.default.html +100 -0
- package/docs/functions/alert.default.html +97 -0
- package/docs/functions/alertStack.default.html +97 -0
- package/docs/functions/animate.default.html +93 -0
- package/docs/functions/autocomplete.default.html +97 -0
- package/docs/functions/avatar.default.html +97 -0
- package/docs/functions/badge.default.html +97 -0
- package/docs/functions/breadcrumbs.default.html +98 -0
- package/docs/functions/button.default.html +97 -0
- package/docs/functions/buttonGroup.default.html +97 -0
- package/docs/functions/calendar.default.html +97 -0
- package/docs/functions/checkbox.default.html +97 -0
- package/docs/functions/chip.default.html +97 -0
- package/docs/functions/context.createContext.html +92 -0
- package/docs/functions/drawer.default.html +97 -0
- package/docs/functions/drillDownMenu.default.html +100 -0
- package/docs/functions/fileInput.default.html +97 -0
- package/docs/functions/form.default.html +97 -0
- package/docs/functions/globalStyle.default.html +96 -0
- package/docs/functions/input.default.html +97 -0
- package/docs/functions/list.default.html +97 -0
- package/docs/functions/modal.default.html +97 -0
- package/docs/functions/paper.default.html +97 -0
- package/docs/functions/popover.default.html +97 -0
- package/docs/functions/select.default.html +97 -0
- package/docs/functions/slider.default.html +97 -0
- package/docs/functions/spinner.default.html +97 -0
- package/docs/functions/switch.default.html +97 -0
- package/docs/functions/tableContainer.default.html +96 -0
- package/docs/functions/tablePagination.default.html +97 -0
- package/docs/functions/tabs.default.html +101 -0
- package/docs/functions/themeSwitch.default.html +96 -0
- package/docs/functions/tooltip.default.html +97 -0
- package/docs/functions/treeView.default.html +100 -0
- package/docs/index.html +82 -0
- package/docs/modules/accordion.html +104 -0
- package/docs/modules/alert.html +98 -0
- package/docs/modules/alertStack.html +98 -0
- package/docs/modules/animate.html +94 -0
- package/docs/modules/autocomplete.html +98 -0
- package/docs/modules/avatar.html +98 -0
- package/docs/modules/badge.html +98 -0
- package/docs/modules/bau_ui.html +97 -0
- package/docs/modules/breadcrumbs.html +100 -0
- package/docs/modules/button.html +98 -0
- package/docs/modules/buttonGroup.html +98 -0
- package/docs/modules/calendar.html +98 -0
- package/docs/modules/checkbox.html +98 -0
- package/docs/modules/chip.html +98 -0
- package/docs/modules/constants.html +102 -0
- package/docs/modules/context.html +92 -0
- package/docs/modules/drawer.html +98 -0
- package/docs/modules/drillDownMenu.html +104 -0
- package/docs/modules/fileInput.html +98 -0
- package/docs/modules/form.html +98 -0
- package/docs/modules/globalStyle.html +96 -0
- package/docs/modules/input.html +98 -0
- package/docs/modules/list.html +98 -0
- package/docs/modules/modal.html +98 -0
- package/docs/modules/paper.html +98 -0
- package/docs/modules/popover.html +98 -0
- package/docs/modules/select.html +98 -0
- package/docs/modules/slider.html +98 -0
- package/docs/modules/spinner.html +98 -0
- package/docs/modules/switch.html +98 -0
- package/docs/modules/tableContainer.html +96 -0
- package/docs/modules/tablePagination.html +98 -0
- package/docs/modules/tabs.html +106 -0
- package/docs/modules/themeSwitch.html +96 -0
- package/docs/modules/tooltip.html +98 -0
- package/docs/modules/treeView.html +104 -0
- package/docs/types/accordion.Accordion.html +96 -0
- package/docs/types/accordion.AccordionItem.html +89 -0
- package/docs/types/accordion.AccordionItemPropBase.html +94 -0
- package/docs/types/accordion.AccordionProps.html +94 -0
- package/docs/types/accordion.Component.html +89 -0
- package/docs/types/accordion.ComponentOption.html +89 -0
- package/docs/types/accordion.DefaultDesignProps.html +89 -0
- package/docs/types/alert.AnimateProps.html +91 -0
- package/docs/types/alert.Component.html +86 -0
- package/docs/types/alert.ComponentOption.html +86 -0
- package/docs/types/alert.DefaultDesignProps.html +86 -0
- package/docs/types/alertStack.AlertStack.html +86 -0
- package/docs/types/alertStack.AlertStackProps.html +89 -0
- package/docs/types/alertStack.ComponentOption.html +86 -0
- package/docs/types/alertStack.DefaultDesignProps.html +86 -0
- package/docs/types/animate.AnimateProps.html +103 -0
- package/docs/types/animate.Component.html +84 -0
- package/docs/types/autocomplete.Autocomplete.html +125 -0
- package/docs/types/autocomplete.Component.html +86 -0
- package/docs/types/autocomplete.ComponentOption.html +86 -0
- package/docs/types/autocomplete.DefaultDesignProps.html +86 -0
- package/docs/types/avatar.AvatarProps.html +99 -0
- package/docs/types/avatar.Component.html +86 -0
- package/docs/types/avatar.ComponentOption.html +86 -0
- package/docs/types/avatar.DefaultDesignProps.html +86 -0
- package/docs/types/badge.BadgeProps.html +91 -0
- package/docs/types/badge.Component.html +86 -0
- package/docs/types/badge.ComponentOption.html +86 -0
- package/docs/types/badge.DefaultDesignProps.html +86 -0
- package/docs/types/bau_ui.ChildDom.html +87 -0
- package/docs/types/bau_ui.Component.html +111 -0
- package/docs/types/bau_ui.ComponentGeneric.html +102 -0
- package/docs/types/bau_ui.ComponentOneChild.html +109 -0
- package/docs/types/bau_ui.ComponentOption.html +92 -0
- package/docs/types/bau_ui.ComponentWithProp.html +109 -0
- package/docs/types/breadcrumbs.BreadcrumbsProps.html +94 -0
- package/docs/types/breadcrumbs.Component.html +87 -0
- package/docs/types/breadcrumbs.ComponentGeneric.html +87 -0
- package/docs/types/breadcrumbs.ComponentOption.html +87 -0
- package/docs/types/breadcrumbs.DefaultDesignProps.html +87 -0
- package/docs/types/button.ButtonProps.html +93 -0
- package/docs/types/button.Component.html +86 -0
- package/docs/types/button.ComponentOption.html +86 -0
- package/docs/types/button.DefaultDesignProps.html +86 -0
- package/docs/types/buttonGroup.ButtonGroupProps.html +89 -0
- package/docs/types/buttonGroup.Component.html +86 -0
- package/docs/types/buttonGroup.ComponentOption.html +86 -0
- package/docs/types/buttonGroup.DefaultDesignProps.html +86 -0
- package/docs/types/calendar.CalendarProps.html +89 -0
- package/docs/types/calendar.Component.html +86 -0
- package/docs/types/calendar.ComponentOption.html +86 -0
- package/docs/types/calendar.DefaultDesignProps.html +86 -0
- package/docs/types/checkbox.CheckboxProps.html +89 -0
- package/docs/types/checkbox.Component.html +86 -0
- package/docs/types/checkbox.ComponentOption.html +86 -0
- package/docs/types/checkbox.DefaultDesignProps.html +86 -0
- package/docs/types/chip.ChipProps.html +89 -0
- package/docs/types/chip.Component.html +86 -0
- package/docs/types/chip.ComponentOption.html +86 -0
- package/docs/types/chip.DefaultDesignProps.html +86 -0
- package/docs/types/constants.Color.html +88 -0
- package/docs/types/constants.DefaultDesignProps.html +97 -0
- package/docs/types/constants.Size.html +88 -0
- package/docs/types/constants.Variant.html +88 -0
- package/docs/types/context.Context.html +107 -0
- package/docs/types/drawer.Component.html +86 -0
- package/docs/types/drawer.ComponentOption.html +86 -0
- package/docs/types/drawer.DefaultDesignProps.html +86 -0
- package/docs/types/drawer.DrawerProps.html +89 -0
- package/docs/types/drillDownMenu.Component.html +89 -0
- package/docs/types/drillDownMenu.ComponentGeneric.html +89 -0
- package/docs/types/drillDownMenu.ComponentOption.html +89 -0
- package/docs/types/drillDownMenu.DefaultDesignProps.html +89 -0
- package/docs/types/drillDownMenu.Option.html +116 -0
- package/docs/types/drillDownMenu.Tree.html +96 -0
- package/docs/types/drillDownMenu.TreeViewProps.html +94 -0
- package/docs/types/fileInput.Component.html +86 -0
- package/docs/types/fileInput.ComponentOption.html +86 -0
- package/docs/types/fileInput.DefaultDesignProps.html +86 -0
- package/docs/types/fileInput.FileInputProps.html +91 -0
- package/docs/types/form.Component.html +86 -0
- package/docs/types/form.ComponentOption.html +86 -0
- package/docs/types/form.DefaultDesignProps.html +86 -0
- package/docs/types/form.FormProps.html +89 -0
- package/docs/types/globalStyle.ColorDefs.html +85 -0
- package/docs/types/globalStyle.HSL.html +94 -0
- package/docs/types/globalStyle.StyleOption.html +90 -0
- package/docs/types/input.Component.html +86 -0
- package/docs/types/input.ComponentOption.html +86 -0
- package/docs/types/input.DefaultDesignProps.html +86 -0
- package/docs/types/input.InputProps.html +89 -0
- package/docs/types/list.Component.html +86 -0
- package/docs/types/list.ComponentOption.html +86 -0
- package/docs/types/list.DefaultDesignProps.html +86 -0
- package/docs/types/list.ListProps.html +89 -0
- package/docs/types/modal.Component.html +86 -0
- package/docs/types/modal.ComponentOption.html +86 -0
- package/docs/types/modal.DefaultDesignProps.html +86 -0
- package/docs/types/modal.ModalProps.html +89 -0
- package/docs/types/paper.Component.html +86 -0
- package/docs/types/paper.ComponentOption.html +86 -0
- package/docs/types/paper.DefaultDesignProps.html +86 -0
- package/docs/types/paper.PaperProps.html +89 -0
- package/docs/types/popover.Action.html +105 -0
- package/docs/types/popover.Component.html +86 -0
- package/docs/types/popover.ComponentOption.html +86 -0
- package/docs/types/popover.PopoverProps.html +89 -0
- package/docs/types/select.Component.html +86 -0
- package/docs/types/select.ComponentOption.html +86 -0
- package/docs/types/select.DefaultDesignProps.html +86 -0
- package/docs/types/select.SelectProps.html +121 -0
- package/docs/types/slider.Component.html +86 -0
- package/docs/types/slider.ComponentOption.html +86 -0
- package/docs/types/slider.DefaultDesignProps.html +86 -0
- package/docs/types/slider.SliderProps.html +89 -0
- package/docs/types/spinner.Component.html +86 -0
- package/docs/types/spinner.ComponentOption.html +86 -0
- package/docs/types/spinner.DefaultDesignProps.html +86 -0
- package/docs/types/spinner.SpinnerProps.html +91 -0
- package/docs/types/switch.Component.html +86 -0
- package/docs/types/switch.ComponentOption.html +86 -0
- package/docs/types/switch.DefaultDesignProps.html +86 -0
- package/docs/types/switch.SwitchProps.html +89 -0
- package/docs/types/tableContainer.Component.html +85 -0
- package/docs/types/tableContainer.ComponentOption.html +85 -0
- package/docs/types/tableContainer.TableProps.html +88 -0
- package/docs/types/tablePagination.Component.html +86 -0
- package/docs/types/tablePagination.ComponentOption.html +86 -0
- package/docs/types/tablePagination.TablePaginationProps.html +99 -0
- package/docs/types/tablePagination.onPageChange.html +110 -0
- package/docs/types/tabs.Component.html +90 -0
- package/docs/types/tabs.ComponentOption.html +90 -0
- package/docs/types/tabs.ComponentTab.html +90 -0
- package/docs/types/tabs.Option.html +95 -0
- package/docs/types/tabs.Tab.html +97 -0
- package/docs/types/tabs.TabPropBase.html +101 -0
- package/docs/types/tabs.Tabs.html +90 -0
- package/docs/types/tabs.TabsProps.html +93 -0
- package/docs/types/themeSwitch.Component.html +85 -0
- package/docs/types/themeSwitch.ComponentOption.html +85 -0
- package/docs/types/themeSwitch.ThemeSwitchProps.html +88 -0
- package/docs/types/tooltip.Component.html +86 -0
- package/docs/types/tooltip.ComponentOption.html +86 -0
- package/docs/types/tooltip.DefaultDesignProps.html +86 -0
- package/docs/types/tooltip.TooltipProps.html +91 -0
- package/docs/types/treeView.Component.html +89 -0
- package/docs/types/treeView.ComponentGeneric.html +89 -0
- package/docs/types/treeView.ComponentOption.html +89 -0
- package/docs/types/treeView.DefaultDesignProps.html +89 -0
- package/docs/types/treeView.Option.html +94 -0
- package/docs/types/treeView.Tree.html +98 -0
- package/docs/types/treeView.TreeViewProps.html +94 -0
- package/docs/variables/constants.Colors.html +88 -0
- package/docs/variables/constants.Sizes.html +88 -0
- package/docs/variables/constants.Variants.html +88 -0
- package/drillDownMenu/drillDownMenu.js +120 -106
- package/drillDownMenu/index.d.ts +1 -0
- package/fileInput/fileInput.js +8 -6
- package/form/form.js +62 -0
- package/form/index.d.ts +10 -0
- package/form/index.js +1 -0
- package/globalStyle/globalStyle.js +35 -13
- package/globalStyle/index.d.ts +14 -0
- package/input/input.js +13 -13
- package/linearProgress/index.d.ts +12 -0
- package/linearProgress/index.js +1 -0
- package/linearProgress/linearProgress.js +84 -0
- package/list/list.js +3 -11
- package/loadingButton/index.d.ts +12 -0
- package/loadingButton/index.js +1 -0
- package/loadingButton/loadingButton.js +70 -0
- package/modal/modal.js +25 -27
- package/package.json +10 -5
- package/pages/login/index.d.ts +3 -6
- package/pages/login/login.js +1 -1
- package/paginationNavigation/index.d.ts +10 -0
- package/paginationNavigation/index.js +1 -0
- package/paginationNavigation/paginationNavigation.js +78 -0
- package/paper/index.d.ts +10 -0
- package/paper/index.js +1 -0
- package/paper/paper.js +51 -0
- package/popover/popover.js +14 -3
- package/radioButton/index.d.ts +15 -0
- package/radioButton/index.js +1 -0
- package/radioButton/radioButton.js +49 -0
- package/select/select.js +21 -8
- package/spinner/index.d.ts +1 -3
- package/spinner/spinner.js +98 -55
- package/stepper/index.d.ts +28 -0
- package/stepper/index.js +1 -0
- package/stepper/stepper.js +159 -0
- package/tableContainer/tableContainer.js +2 -3
- package/tableOfContent/index.d.ts +10 -0
- package/tableOfContent/index.js +1 -0
- package/tableOfContent/tableOfContent.js +159 -0
- package/tabs/tabs.js +56 -56
- package/toggle/index.d.ts +10 -0
- package/toggle/index.js +1 -0
- package/toggle/toggle.js +106 -0
- package/toggleGroup/index.d.ts +13 -0
- package/toggleGroup/index.js +1 -0
- package/toggleGroup/toggleGroup.js +94 -0
- package/tooltip/tooltip.js +2 -7
- package/treeView/treeView.js +30 -88
- package/tsconfig.json +23 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import classNames from "@grucloud/bau-css/classNames.js";
|
|
2
|
+
import { toPropsAndChildren } from "@grucloud/bau/bau.js";
|
|
3
|
+
import { Colors } from "../constants.js";
|
|
4
|
+
|
|
5
|
+
const colorsToCss = () =>
|
|
6
|
+
Colors.map(
|
|
7
|
+
(color) =>
|
|
8
|
+
`
|
|
9
|
+
&.toggle-group.${color} {
|
|
10
|
+
& button:not(:last-child) {
|
|
11
|
+
border-right: 1px solid var(--color-${color}) !important;
|
|
12
|
+
}
|
|
13
|
+
& button:not(:first-child) {
|
|
14
|
+
border-left: 1px solid var(--color-${color}) !important;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
&.toggle-group.outline.${color} {
|
|
19
|
+
border: none;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
&.toggle-group.solid.${color} {
|
|
23
|
+
& button:not(:last-child) {
|
|
24
|
+
border-right: 1px solid var(--color-${color}-lightest) !important;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
`
|
|
28
|
+
).join("\n");
|
|
29
|
+
|
|
30
|
+
export default function (context, options) {
|
|
31
|
+
const { bau, css } = context;
|
|
32
|
+
const { div } = bau.tags;
|
|
33
|
+
const className = css`
|
|
34
|
+
display: inline-flex;
|
|
35
|
+
border-radius: var(--global-radius);
|
|
36
|
+
& button:not(:last-child) {
|
|
37
|
+
border-top-right-radius: 0;
|
|
38
|
+
border-bottom-right-radius: 0;
|
|
39
|
+
}
|
|
40
|
+
& button:not(:first-child) {
|
|
41
|
+
border-top-left-radius: 0;
|
|
42
|
+
border-bottom-left-radius: 0;
|
|
43
|
+
}
|
|
44
|
+
${colorsToCss()}
|
|
45
|
+
`;
|
|
46
|
+
|
|
47
|
+
return function ToggleGroup(...args) {
|
|
48
|
+
let [
|
|
49
|
+
{
|
|
50
|
+
color,
|
|
51
|
+
variant = "plain",
|
|
52
|
+
size = "md",
|
|
53
|
+
exclusive = false,
|
|
54
|
+
onChange = () => {},
|
|
55
|
+
...props
|
|
56
|
+
},
|
|
57
|
+
...children
|
|
58
|
+
] = toPropsAndChildren(args);
|
|
59
|
+
|
|
60
|
+
const selectedSet = new Set();
|
|
61
|
+
|
|
62
|
+
const onclick = (event) => {
|
|
63
|
+
const { value } = event.target;
|
|
64
|
+
if (exclusive) {
|
|
65
|
+
selectedSet.clear();
|
|
66
|
+
selectedSet.add(value);
|
|
67
|
+
} else {
|
|
68
|
+
if (selectedSet.has(value)) {
|
|
69
|
+
selectedSet.delete(value);
|
|
70
|
+
} else {
|
|
71
|
+
selectedSet.add(value);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
onChange({ event, values: [...selectedSet] });
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
return div(
|
|
78
|
+
{
|
|
79
|
+
...props,
|
|
80
|
+
class: classNames(
|
|
81
|
+
"toggle-group",
|
|
82
|
+
size,
|
|
83
|
+
color,
|
|
84
|
+
variant,
|
|
85
|
+
className,
|
|
86
|
+
options?.class,
|
|
87
|
+
props?.class
|
|
88
|
+
),
|
|
89
|
+
onclick,
|
|
90
|
+
},
|
|
91
|
+
...children
|
|
92
|
+
);
|
|
93
|
+
};
|
|
94
|
+
}
|
package/tooltip/tooltip.js
CHANGED
|
@@ -11,13 +11,12 @@ export default function (context, options) {
|
|
|
11
11
|
& .container {
|
|
12
12
|
& .content {
|
|
13
13
|
box-shadow: var(--shadow-m);
|
|
14
|
-
font-size: smaller;
|
|
15
14
|
border-radius: var(--global-radius);
|
|
16
15
|
padding: 0.3rem;
|
|
17
16
|
}
|
|
18
17
|
white-space: nowrap;
|
|
19
18
|
position: absolute;
|
|
20
|
-
z-index:
|
|
19
|
+
z-index: 10;
|
|
21
20
|
opacity: 0;
|
|
22
21
|
visibility: hidden;
|
|
23
22
|
transition: opacity 0.3s ease-in-out;
|
|
@@ -103,11 +102,7 @@ export default function (context, options) {
|
|
|
103
102
|
|
|
104
103
|
const tooltipContentEl = div(
|
|
105
104
|
{
|
|
106
|
-
class: classNames(
|
|
107
|
-
"container",
|
|
108
|
-
|
|
109
|
-
...side.split("-")
|
|
110
|
-
),
|
|
105
|
+
class: classNames("container", ...side.split("-")),
|
|
111
106
|
},
|
|
112
107
|
div(
|
|
113
108
|
{ class: classNames("content", color, variant, size), role: "tooltip" },
|
package/treeView/treeView.js
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
import { toPropsAndChildren } from "@grucloud/bau/bau.js";
|
|
2
2
|
import classNames from "@grucloud/bau-css/classNames.js";
|
|
3
|
+
import collapsible from "../collapsible";
|
|
3
4
|
|
|
4
5
|
const createStyles = ({ css, createGlobalStyles }) => {
|
|
5
6
|
createGlobalStyles`
|
|
6
7
|
:root {
|
|
7
|
-
--
|
|
8
|
-
--
|
|
9
|
-
--menu-color-background-active: var(--hover-overlay);
|
|
10
|
-
--menu-color-background-hover: var(--hover-overlay);
|
|
11
|
-
--menu-link-padding-horizontal: 0.75rem;
|
|
12
|
-
--menu-link-padding-vertical: 0.375rem;
|
|
8
|
+
--treeview-link-padding-horizontal: 0.75rem;
|
|
9
|
+
--treeview-link-padding-vertical: 0.375rem;
|
|
13
10
|
}
|
|
14
11
|
`;
|
|
15
12
|
|
|
@@ -28,38 +25,30 @@ const createStyles = ({ css, createGlobalStyles }) => {
|
|
|
28
25
|
margin: 0;
|
|
29
26
|
padding-left: 0;
|
|
30
27
|
overflow: hidden;
|
|
31
|
-
will-change: height;
|
|
32
|
-
transition: height var(--transition-fast) ease-out;
|
|
33
28
|
background: inherit;
|
|
34
29
|
|
|
35
|
-
& li {
|
|
36
|
-
padding-left: var(--
|
|
30
|
+
& > li {
|
|
31
|
+
padding-left: var(--treeview-link-padding-horizontal);
|
|
37
32
|
border-radius: 0.25rem;
|
|
38
33
|
background: inherit;
|
|
39
34
|
|
|
40
|
-
|
|
35
|
+
& .header {
|
|
41
36
|
width: 100%;
|
|
42
37
|
display: flex;
|
|
43
38
|
justify-content: space-between;
|
|
44
39
|
align-items: center;
|
|
45
|
-
transition: all var(--transition-fast) ease-in-out;
|
|
46
40
|
background: inherit;
|
|
47
41
|
&:hover {
|
|
48
42
|
filter: brightness(var(--brightness-hover));
|
|
49
43
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
font-size: x-large;
|
|
53
|
-
margin-right: 1rem;
|
|
54
|
-
}
|
|
55
|
-
> a,
|
|
56
|
-
span {
|
|
44
|
+
& a,
|
|
45
|
+
& span {
|
|
57
46
|
display: flex;
|
|
58
47
|
flex-grow: 1;
|
|
59
48
|
text-decoration: none;
|
|
60
49
|
color: inherit;
|
|
61
|
-
padding: var(--
|
|
62
|
-
var(--
|
|
50
|
+
padding: var(--treeview-link-padding-vertical)
|
|
51
|
+
var(--treeview-link-padding-horizontal);
|
|
63
52
|
}
|
|
64
53
|
}
|
|
65
54
|
}
|
|
@@ -72,76 +61,31 @@ const createStyles = ({ css, createGlobalStyles }) => {
|
|
|
72
61
|
|
|
73
62
|
return {
|
|
74
63
|
nav,
|
|
75
|
-
expanded: css`
|
|
76
|
-
> div {
|
|
77
|
-
&::after {
|
|
78
|
-
content: "\u203A";
|
|
79
|
-
transform: rotate(90deg);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
`,
|
|
83
|
-
collapsed: css`
|
|
84
|
-
> div {
|
|
85
|
-
&::after {
|
|
86
|
-
content: "\u203A";
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
`,
|
|
90
64
|
};
|
|
91
65
|
};
|
|
92
66
|
|
|
93
67
|
export default function (context, options) {
|
|
94
|
-
const { bau, css, createGlobalStyles
|
|
68
|
+
const { bau, css, createGlobalStyles } = context;
|
|
95
69
|
const { renderMenuItem } = options;
|
|
96
70
|
const { ul, li, nav, div } = bau.tags;
|
|
97
71
|
|
|
98
72
|
const styles = createStyles({ css, createGlobalStyles });
|
|
99
73
|
|
|
100
|
-
const
|
|
101
|
-
if (element.scrollHeight == 0) return;
|
|
102
|
-
closeState.val ? collapseSection(element) : expandSection(element);
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
function collapseSection(element) {
|
|
106
|
-
element.style.height = element.scrollHeight + "px";
|
|
107
|
-
const animationEndHandler = () => {
|
|
108
|
-
element.removeEventListener("transitionend", animationEndHandler);
|
|
109
|
-
};
|
|
110
|
-
element.addEventListener("transitionend", animationEndHandler);
|
|
111
|
-
window.requestAnimationFrame(() => {
|
|
112
|
-
element.style.height = "0px";
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
function expandSection(element) {
|
|
117
|
-
const animationEndHandler = () => {
|
|
118
|
-
element.removeEventListener("transitionend", animationEndHandler);
|
|
119
|
-
element.style.height = null;
|
|
120
|
-
};
|
|
121
|
-
element.addEventListener("transitionend", animationEndHandler);
|
|
122
|
-
element.style.height = element.scrollHeight + "px";
|
|
123
|
-
}
|
|
74
|
+
const Collapsible = collapsible(context);
|
|
124
75
|
|
|
125
76
|
const Tree =
|
|
126
77
|
({ depth = 1, maxDepth, color, variant, size }) =>
|
|
127
78
|
(item) => {
|
|
128
79
|
const { children, expanded } = item;
|
|
129
80
|
const closeState = bau.state(!expanded);
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
class: () =>
|
|
133
|
-
classNames(
|
|
134
|
-
children
|
|
135
|
-
? closeState.val
|
|
136
|
-
? styles.collapsed
|
|
137
|
-
: styles.expanded
|
|
138
|
-
: ""
|
|
139
|
-
),
|
|
140
|
-
},
|
|
81
|
+
|
|
82
|
+
const Header = () =>
|
|
141
83
|
div(
|
|
142
84
|
{
|
|
143
85
|
class: css`
|
|
144
86
|
cursor: pointer;
|
|
87
|
+
display: flex;
|
|
88
|
+
width: 100%;
|
|
145
89
|
`,
|
|
146
90
|
onclick: (event) => {
|
|
147
91
|
if (children) {
|
|
@@ -150,22 +94,20 @@ export default function (context, options) {
|
|
|
150
94
|
},
|
|
151
95
|
},
|
|
152
96
|
renderMenuItem(item.data)
|
|
153
|
-
)
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
children.map(Tree({ depth: depth + 1, maxDepth }))
|
|
168
|
-
)
|
|
97
|
+
);
|
|
98
|
+
|
|
99
|
+
const Content = () =>
|
|
100
|
+
ul(
|
|
101
|
+
{
|
|
102
|
+
class: classNames(color, size),
|
|
103
|
+
},
|
|
104
|
+
children.map(Tree({ depth: depth + 1, maxDepth }))
|
|
105
|
+
);
|
|
106
|
+
return li(
|
|
107
|
+
Collapsible({
|
|
108
|
+
Header,
|
|
109
|
+
Content: children && depth < maxDepth && Content,
|
|
110
|
+
})
|
|
169
111
|
);
|
|
170
112
|
};
|
|
171
113
|
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2020",
|
|
4
|
+
"useDefineForClassFields": true,
|
|
5
|
+
"module": "ESNext",
|
|
6
|
+
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
|
7
|
+
"skipLibCheck": true,
|
|
8
|
+
|
|
9
|
+
/* Bundler mode */
|
|
10
|
+
"moduleResolution": "bundler",
|
|
11
|
+
"allowImportingTsExtensions": true,
|
|
12
|
+
"resolveJsonModule": true,
|
|
13
|
+
"isolatedModules": true,
|
|
14
|
+
"noEmit": true,
|
|
15
|
+
|
|
16
|
+
/* Linting */
|
|
17
|
+
"strict": true,
|
|
18
|
+
"noUnusedLocals": true,
|
|
19
|
+
"noUnusedParameters": true,
|
|
20
|
+
"noFallthroughCasesInSwitch": true
|
|
21
|
+
},
|
|
22
|
+
"include": ["./**/*.d.ts"]
|
|
23
|
+
}
|