@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,159 @@
|
|
|
1
|
+
import { toPropsAndChildren } from "@grucloud/bau/bau.js";
|
|
2
|
+
import classNames from "@grucloud/bau-css/classNames.js";
|
|
3
|
+
|
|
4
|
+
import { Colors } from "../constants.js";
|
|
5
|
+
|
|
6
|
+
const colorsToCss = () =>
|
|
7
|
+
Colors.map(
|
|
8
|
+
(color) =>
|
|
9
|
+
`
|
|
10
|
+
`
|
|
11
|
+
).join("\n");
|
|
12
|
+
|
|
13
|
+
export default function (context, options) {
|
|
14
|
+
const { bau, css } = context;
|
|
15
|
+
const { div, ul, li, span } = bau.tags;
|
|
16
|
+
|
|
17
|
+
const className = css`
|
|
18
|
+
display: flex;
|
|
19
|
+
flex-direction: column;
|
|
20
|
+
padding: 1rem;
|
|
21
|
+
& > ul {
|
|
22
|
+
display: flex;
|
|
23
|
+
align-items: flex-end;
|
|
24
|
+
justify-content: space-around;
|
|
25
|
+
align-items: flex-start;
|
|
26
|
+
padding: 0;
|
|
27
|
+
list-style: none;
|
|
28
|
+
& > li {
|
|
29
|
+
display: flex;
|
|
30
|
+
flex-direction: column;
|
|
31
|
+
align-items: center;
|
|
32
|
+
box-sizing: border-box;
|
|
33
|
+
flex-grow: 1;
|
|
34
|
+
padding: 0.5rem;
|
|
35
|
+
padding-bottom: 0rem;
|
|
36
|
+
color: inherit;
|
|
37
|
+
font-weight: var(--font-weight-semibold);
|
|
38
|
+
transition: all var(--transition-slow) ease-in-out;
|
|
39
|
+
background-color: var(--background-color);
|
|
40
|
+
overflow: hidden;
|
|
41
|
+
& .step-number {
|
|
42
|
+
background-color: var(--color-primary);
|
|
43
|
+
color: var(--font-color-inverse);
|
|
44
|
+
height: 1.5rem;
|
|
45
|
+
width: 1.5rem;
|
|
46
|
+
display: flex;
|
|
47
|
+
justify-content: center;
|
|
48
|
+
align-items: center;
|
|
49
|
+
border-radius: 100%;
|
|
50
|
+
}
|
|
51
|
+
& .step-label {
|
|
52
|
+
text-align: center;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
& .not-completed {
|
|
56
|
+
& .step-number {
|
|
57
|
+
background-color: var(--color-neutral);
|
|
58
|
+
}
|
|
59
|
+
& .step-label {
|
|
60
|
+
color: var(--font-color-secondary);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
& .completed {
|
|
64
|
+
& .step-number {
|
|
65
|
+
background-color: var(--color-success);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
& .active {
|
|
70
|
+
filter: brightness(var(--brightness-active));
|
|
71
|
+
}
|
|
72
|
+
& .disabled {
|
|
73
|
+
cursor: not-allowed;
|
|
74
|
+
font-style: italic;
|
|
75
|
+
transform: none;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
${colorsToCss()}
|
|
79
|
+
`;
|
|
80
|
+
|
|
81
|
+
return function Stepper(...args) {
|
|
82
|
+
let [
|
|
83
|
+
{
|
|
84
|
+
color,
|
|
85
|
+
variant = "plain",
|
|
86
|
+
size,
|
|
87
|
+
stepperDefs = [],
|
|
88
|
+
activeStepIndex,
|
|
89
|
+
...props
|
|
90
|
+
},
|
|
91
|
+
...children
|
|
92
|
+
] = toPropsAndChildren(args);
|
|
93
|
+
|
|
94
|
+
const stepperState = bau.state(
|
|
95
|
+
stepperDefs.map((stepper, index) => ({ ...stepper, index }))
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
const stepperCurrentState = bau.derive(
|
|
99
|
+
() => stepperState.val[activeStepIndex.val]
|
|
100
|
+
);
|
|
101
|
+
|
|
102
|
+
const StepperHeader = (stepper) => {
|
|
103
|
+
const { Header, disabled, name, index } = stepper;
|
|
104
|
+
return li(
|
|
105
|
+
{
|
|
106
|
+
class: () =>
|
|
107
|
+
classNames(
|
|
108
|
+
stepperCurrentState.val.name == name && "active",
|
|
109
|
+
activeStepIndex.val < index && "not-completed",
|
|
110
|
+
activeStepIndex.val > index && "completed",
|
|
111
|
+
disabled && "disabled"
|
|
112
|
+
),
|
|
113
|
+
},
|
|
114
|
+
span({ class: "step-number" }, index + 1),
|
|
115
|
+
span({ class: "step-label" }, () => Header(stepper))
|
|
116
|
+
);
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
const rootEl = div(
|
|
120
|
+
{
|
|
121
|
+
class: classNames(
|
|
122
|
+
"stepper",
|
|
123
|
+
variant,
|
|
124
|
+
size,
|
|
125
|
+
color,
|
|
126
|
+
className,
|
|
127
|
+
options?.class,
|
|
128
|
+
props.class
|
|
129
|
+
),
|
|
130
|
+
},
|
|
131
|
+
// Header
|
|
132
|
+
bau.loop(stepperState, ul(), StepperHeader),
|
|
133
|
+
// Content
|
|
134
|
+
// No automatic binding possible in this case. Content contains states that would be automatically binded.
|
|
135
|
+
bau.bind({
|
|
136
|
+
deps: [stepperCurrentState],
|
|
137
|
+
render: () => (stepperCurrent) =>
|
|
138
|
+
stepperCurrent.Content ? stepperCurrent.Content({}) : "",
|
|
139
|
+
})
|
|
140
|
+
);
|
|
141
|
+
|
|
142
|
+
// rootEl.addEventListener(
|
|
143
|
+
// "stepper.select",
|
|
144
|
+
// (event) => {
|
|
145
|
+
// const { stepperName } = event.detail;
|
|
146
|
+
// const nextStepper = stepperByName(stepperName);
|
|
147
|
+
// if (!nextStepper) {
|
|
148
|
+
// return;
|
|
149
|
+
// }
|
|
150
|
+
// stepperCurrentState.val.exit?.call();
|
|
151
|
+
// stepperCurrentState.val = nextStepper;
|
|
152
|
+
// nextStepper.enter?.call();
|
|
153
|
+
// },
|
|
154
|
+
// false
|
|
155
|
+
// );
|
|
156
|
+
|
|
157
|
+
return rootEl;
|
|
158
|
+
};
|
|
159
|
+
}
|
|
@@ -13,7 +13,7 @@ export default function (context, options) {
|
|
|
13
13
|
--table-border-width: 1px;
|
|
14
14
|
--table-border-color: var(--color-emphasis-300);
|
|
15
15
|
--table-head-background: inherit;
|
|
16
|
-
--table-head-color:
|
|
16
|
+
--table-head-color: var(--font-color-secondary);
|
|
17
17
|
--table-cell-color: inherit;
|
|
18
18
|
}
|
|
19
19
|
|
|
@@ -56,8 +56,7 @@ export default function (context, options) {
|
|
|
56
56
|
const className = css`
|
|
57
57
|
display: inline-block;
|
|
58
58
|
border: 1px solid var(--color-emphasis-50);
|
|
59
|
-
|
|
60
|
-
border-radius: var(--global-radius);
|
|
59
|
+
width: fit-content;
|
|
61
60
|
`;
|
|
62
61
|
|
|
63
62
|
return function TableContainer(...args) {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare module "@grucloud/bau-ui/tableOfContent" {
|
|
2
|
+
type DefaultDesignProps = import("../constants").DefaultDesignProps;
|
|
3
|
+
type ComponentOption = import("../bau-ui").ComponentOption;
|
|
4
|
+
|
|
5
|
+
export type TableOfContentProps = {} & DefaultDesignProps;
|
|
6
|
+
|
|
7
|
+
type Component = import("../bau-ui").Component<TableOfContentProps>;
|
|
8
|
+
|
|
9
|
+
export default function (context: any, option?: ComponentOption): Component;
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./tableOfContent";
|
|
@@ -0,0 +1,159 @@
|
|
|
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, window } = context;
|
|
6
|
+
const { nav, ul, li, a } = bau.tags;
|
|
7
|
+
const { headerSelector = "h2,h3" } = options;
|
|
8
|
+
const activeHeadingId = bau.state("no");
|
|
9
|
+
|
|
10
|
+
const debounce = (callback, wait) => {
|
|
11
|
+
let timeoutId = null;
|
|
12
|
+
return (...args) => {
|
|
13
|
+
window.clearTimeout(timeoutId);
|
|
14
|
+
timeoutId = window.setTimeout(() => callback(...args), wait);
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const className = css`
|
|
19
|
+
grid-area: toc;
|
|
20
|
+
position: sticky;
|
|
21
|
+
right: 0;
|
|
22
|
+
z-index: 1;
|
|
23
|
+
top: calc(var(--header-height));
|
|
24
|
+
height: fit-content;
|
|
25
|
+
max-height: calc(100vh - var(--header-height));
|
|
26
|
+
background-color: var(--background-color);
|
|
27
|
+
border-left: 1px solid var(--color-emphasis-200);
|
|
28
|
+
& ul {
|
|
29
|
+
padding-left: 0rem;
|
|
30
|
+
& ul {
|
|
31
|
+
padding-left: 1rem;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
& li {
|
|
35
|
+
display: block;
|
|
36
|
+
&::before {
|
|
37
|
+
content: "";
|
|
38
|
+
border: 1px solid transparent;
|
|
39
|
+
margin-right: 1rem;
|
|
40
|
+
display: inline;
|
|
41
|
+
height: 100%;
|
|
42
|
+
vertical-align: middle;
|
|
43
|
+
}
|
|
44
|
+
&.active::before {
|
|
45
|
+
transition: all 0.4s ease-in-out;
|
|
46
|
+
border-color: var(--link-color);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
& a {
|
|
50
|
+
font-size: 0.8rem;
|
|
51
|
+
text-decoration: none;
|
|
52
|
+
color: var(--color-content-secondary);
|
|
53
|
+
&:hover {
|
|
54
|
+
text-decoration: underline;
|
|
55
|
+
}
|
|
56
|
+
&.active {
|
|
57
|
+
color: var(--link-color);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
`;
|
|
61
|
+
|
|
62
|
+
const TocItem = ({ value, id, children = [] }) => {
|
|
63
|
+
const link = a({
|
|
64
|
+
class: () => (activeHeadingId.val == id ? "active" : ""),
|
|
65
|
+
href: `#${id}`,
|
|
66
|
+
});
|
|
67
|
+
link.innerHTML = value;
|
|
68
|
+
return li(
|
|
69
|
+
{ class: () => (activeHeadingId.val == id ? "active" : "") },
|
|
70
|
+
link,
|
|
71
|
+
children.length > 0 && ul(children.map(TocItem))
|
|
72
|
+
);
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
const headerLevel = (el) => el.tagName.charAt(1);
|
|
76
|
+
const createToc = ({ contentEl }) => {
|
|
77
|
+
const headings = contentEl.querySelectorAll(headerSelector);
|
|
78
|
+
|
|
79
|
+
let levelCurrent = 2;
|
|
80
|
+
let newNode = {};
|
|
81
|
+
let nodeCurrent = { children: [] };
|
|
82
|
+
let parentNode = nodeCurrent;
|
|
83
|
+
const tree = parentNode;
|
|
84
|
+
let parents = [parentNode];
|
|
85
|
+
[...headings].forEach((heading) => {
|
|
86
|
+
const level = headerLevel(heading);
|
|
87
|
+
heading.setAttribute("id", heading.textContent);
|
|
88
|
+
//TODO
|
|
89
|
+
if (heading.innerHTML.includes("<button")) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
newNode = {
|
|
93
|
+
value: heading.innerHTML,
|
|
94
|
+
id: heading.id ?? heading.textContent,
|
|
95
|
+
children: [],
|
|
96
|
+
};
|
|
97
|
+
if (levelCurrent == level) {
|
|
98
|
+
nodeCurrent = newNode;
|
|
99
|
+
parentNode.children.push(nodeCurrent);
|
|
100
|
+
} else if (levelCurrent < level) {
|
|
101
|
+
parents.push(parentNode);
|
|
102
|
+
parentNode = nodeCurrent;
|
|
103
|
+
nodeCurrent.children.push(newNode);
|
|
104
|
+
nodeCurrent = newNode;
|
|
105
|
+
} else if (levelCurrent > level) {
|
|
106
|
+
parentNode = parents[level - 1];
|
|
107
|
+
parents = parents.slice(0, level - 1);
|
|
108
|
+
parentNode.children.push(newNode);
|
|
109
|
+
nodeCurrent = newNode;
|
|
110
|
+
}
|
|
111
|
+
levelCurrent = level;
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
return tree;
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
return function TableOfContent(...args) {
|
|
118
|
+
let [{ color, variant, size = "md", contentEl, ...props }] =
|
|
119
|
+
toPropsAndChildren(args);
|
|
120
|
+
|
|
121
|
+
const toc = createToc({ contentEl });
|
|
122
|
+
|
|
123
|
+
const handleScroll = debounce(() => {
|
|
124
|
+
const headings = contentEl.querySelectorAll(headerSelector);
|
|
125
|
+
const activeHeading = [...headings].find((heading) => {
|
|
126
|
+
const { top, height } = heading.getBoundingClientRect();
|
|
127
|
+
//TODO
|
|
128
|
+
if (top + height > 60) {
|
|
129
|
+
return true;
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
if (activeHeading) {
|
|
133
|
+
activeHeadingId.val = activeHeading?.id;
|
|
134
|
+
}
|
|
135
|
+
}, 100);
|
|
136
|
+
|
|
137
|
+
return nav(
|
|
138
|
+
{
|
|
139
|
+
...props,
|
|
140
|
+
class: classNames(
|
|
141
|
+
"tableOfContent",
|
|
142
|
+
size,
|
|
143
|
+
variant,
|
|
144
|
+
color,
|
|
145
|
+
className,
|
|
146
|
+
options?.class,
|
|
147
|
+
props?.class
|
|
148
|
+
),
|
|
149
|
+
bauMounted: (/*{ element }*/) => {
|
|
150
|
+
window.addEventListener("scroll", handleScroll);
|
|
151
|
+
},
|
|
152
|
+
bauUnmounted: (/*{ element }*/) => {
|
|
153
|
+
window.removeEventListener("scroll", handleScroll);
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
toc.children && ul(toc.children.map(TocItem))
|
|
157
|
+
);
|
|
158
|
+
};
|
|
159
|
+
}
|
package/tabs/tabs.js
CHANGED
|
@@ -16,73 +16,73 @@ export default function (context, options) {
|
|
|
16
16
|
const { bau, css } = context;
|
|
17
17
|
const { tabDefs } = options;
|
|
18
18
|
const { div, ul, li } = bau.tags;
|
|
19
|
-
const tabsState = bau.state(tabDefs);
|
|
20
19
|
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const style = {
|
|
26
|
-
base: css`
|
|
20
|
+
const className = css`
|
|
21
|
+
display: flex;
|
|
22
|
+
flex-direction: column;
|
|
23
|
+
& > ul {
|
|
27
24
|
display: flex;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
&:hover {
|
|
47
|
-
color: var(--color-primary-light);
|
|
48
|
-
background-color: var(--color-emphasis-300);
|
|
49
|
-
&::after {
|
|
50
|
-
transform: translateY(0%);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
&::after {
|
|
54
|
-
transition: var(--transition-fast) ease-in-out;
|
|
55
|
-
transform: translateY(400%);
|
|
56
|
-
opacity: 1;
|
|
57
|
-
content: "";
|
|
58
|
-
margin-top: 0.3rem;
|
|
59
|
-
height: 2px;
|
|
60
|
-
width: 100%;
|
|
61
|
-
display: block;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
& .active {
|
|
65
|
-
font-weight: bolder;
|
|
25
|
+
align-items: flex-end;
|
|
26
|
+
justify-content: flex-start;
|
|
27
|
+
align-items: flex-start;
|
|
28
|
+
padding: 0;
|
|
29
|
+
list-style: none;
|
|
30
|
+
border-bottom: 2px solid var(--color-emphasis-200);
|
|
31
|
+
& li {
|
|
32
|
+
text-align: center;
|
|
33
|
+
padding: 0.5rem;
|
|
34
|
+
padding-bottom: 0rem;
|
|
35
|
+
color: inherit;
|
|
36
|
+
cursor: pointer;
|
|
37
|
+
font-weight: var(--font-weight-semibold);
|
|
38
|
+
transition: var(--transition-fast) ease-in-out;
|
|
39
|
+
overflow: hidden;
|
|
40
|
+
&:hover {
|
|
41
|
+
color: var(--color-primary-light);
|
|
42
|
+
background-color: var(--color-emphasis-300);
|
|
66
43
|
&::after {
|
|
67
44
|
transform: translateY(0%);
|
|
68
45
|
}
|
|
69
46
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
47
|
+
&::after {
|
|
48
|
+
transition: var(--transition-fast) ease-in-out;
|
|
49
|
+
transform: translateY(400%);
|
|
50
|
+
opacity: 1;
|
|
51
|
+
content: "";
|
|
52
|
+
margin-top: 0.3rem;
|
|
53
|
+
height: 2px;
|
|
54
|
+
width: 100%;
|
|
55
|
+
display: block;
|
|
77
56
|
}
|
|
78
57
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
58
|
+
& .active {
|
|
59
|
+
font-weight: bolder;
|
|
60
|
+
&::after {
|
|
61
|
+
transform: translateY(0%);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
& .disabled {
|
|
65
|
+
cursor: not-allowed;
|
|
66
|
+
font-style: italic;
|
|
67
|
+
transform: none;
|
|
68
|
+
&:hover {
|
|
69
|
+
border: none;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
${colorsToCss()}
|
|
74
|
+
`;
|
|
82
75
|
|
|
83
76
|
return function Tabs(...args) {
|
|
84
77
|
let [{ color, variant = "plain", size, ...props }, ...children] =
|
|
85
78
|
toPropsAndChildren(args);
|
|
79
|
+
|
|
80
|
+
const tabsState = bau.state(tabDefs);
|
|
81
|
+
|
|
82
|
+
const tabCurrentState = bau.state(tabDefs[0]);
|
|
83
|
+
|
|
84
|
+
const tabByName = (name) => tabsState.val.find((tab) => tab.name == name);
|
|
85
|
+
|
|
86
86
|
const TabHeader = (tab) => {
|
|
87
87
|
const { Header, disabled, name } = tab;
|
|
88
88
|
return li(
|
|
@@ -108,10 +108,10 @@ export default function (context, options) {
|
|
|
108
108
|
{
|
|
109
109
|
class: classNames(
|
|
110
110
|
"tabs",
|
|
111
|
-
style.base,
|
|
112
111
|
variant,
|
|
113
112
|
size,
|
|
114
113
|
color,
|
|
114
|
+
className,
|
|
115
115
|
options?.class,
|
|
116
116
|
props.class
|
|
117
117
|
),
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare module "@grucloud/bau-ui/toggle" {
|
|
2
|
+
type DefaultDesignProps = import("../constants").DefaultDesignProps;
|
|
3
|
+
type ComponentOption = import("../bau-ui").ComponentOption;
|
|
4
|
+
|
|
5
|
+
export type ToggleProps = {} & DefaultDesignProps;
|
|
6
|
+
|
|
7
|
+
type Component = import("../bau-ui").Component<ToggleProps>;
|
|
8
|
+
|
|
9
|
+
export default function (context: any, option?: ComponentOption): Component;
|
|
10
|
+
}
|
package/toggle/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./toggle";
|
package/toggle/toggle.js
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { toPropsAndChildren } from "@grucloud/bau/bau.js";
|
|
2
|
+
import classNames from "@grucloud/bau-css/classNames.js";
|
|
3
|
+
|
|
4
|
+
export default function (context, options) {
|
|
5
|
+
const { bau, css, createGlobalStyles } = context;
|
|
6
|
+
const { button } = bau.tags;
|
|
7
|
+
|
|
8
|
+
createGlobalStyles`
|
|
9
|
+
:root {
|
|
10
|
+
--toggle-background-color: rgba(0, 0, 0, 0.2);
|
|
11
|
+
}
|
|
12
|
+
html[data-theme="dark"] {
|
|
13
|
+
--toggle-background-color: rgba(255, 255, 255, 0.16)
|
|
14
|
+
}
|
|
15
|
+
`;
|
|
16
|
+
const className = css`
|
|
17
|
+
color: inherit;
|
|
18
|
+
display: inline-flex;
|
|
19
|
+
align-items: center;
|
|
20
|
+
justify-content: center;
|
|
21
|
+
background: transparent;
|
|
22
|
+
min-width: 2rem;
|
|
23
|
+
min-height: 2rem;
|
|
24
|
+
border: none;
|
|
25
|
+
border-radius: var(--global-radius);
|
|
26
|
+
font-weight: var(--font-weight-semibold);
|
|
27
|
+
text-align: center;
|
|
28
|
+
text-decoration: none;
|
|
29
|
+
overflow: hidden;
|
|
30
|
+
box-sizing: border-box;
|
|
31
|
+
user-select: none;
|
|
32
|
+
transition: all var(--transition-slow);
|
|
33
|
+
box-sizing: border-box;
|
|
34
|
+
&.selected {
|
|
35
|
+
background-color: var(--toggle-background-color);
|
|
36
|
+
}
|
|
37
|
+
&.selected.solid {
|
|
38
|
+
filter: brightness(80%) !important;
|
|
39
|
+
}
|
|
40
|
+
&.outline,
|
|
41
|
+
&.solid {
|
|
42
|
+
box-shadow: var(--shadow-m);
|
|
43
|
+
}
|
|
44
|
+
&.outline:hover,
|
|
45
|
+
&.solid:hover {
|
|
46
|
+
box-shadow: var(--shadow-lg);
|
|
47
|
+
}
|
|
48
|
+
&:hover {
|
|
49
|
+
filter: brightness(var(--brightness-hover));
|
|
50
|
+
}
|
|
51
|
+
&:hover.solid {
|
|
52
|
+
filter: brightness(var(--brightness-hover-always));
|
|
53
|
+
}
|
|
54
|
+
&.sm {
|
|
55
|
+
padding: 0.3rem;
|
|
56
|
+
}
|
|
57
|
+
&.md {
|
|
58
|
+
padding: 0.2rem 0.8rem;
|
|
59
|
+
}
|
|
60
|
+
&.lg {
|
|
61
|
+
padding: 0.2rem 2rem;
|
|
62
|
+
}
|
|
63
|
+
`;
|
|
64
|
+
|
|
65
|
+
return function Toggle(...args) {
|
|
66
|
+
let [
|
|
67
|
+
{
|
|
68
|
+
color,
|
|
69
|
+
variant,
|
|
70
|
+
size = "md",
|
|
71
|
+
selected = false,
|
|
72
|
+
disabled,
|
|
73
|
+
onChange,
|
|
74
|
+
...props
|
|
75
|
+
},
|
|
76
|
+
...children
|
|
77
|
+
] = toPropsAndChildren(args);
|
|
78
|
+
|
|
79
|
+
return button(
|
|
80
|
+
{
|
|
81
|
+
type: "button",
|
|
82
|
+
...props,
|
|
83
|
+
"aria-pressed": {
|
|
84
|
+
deps: [selected],
|
|
85
|
+
renderProp: () => (selected) => selected,
|
|
86
|
+
},
|
|
87
|
+
class: {
|
|
88
|
+
deps: [selected],
|
|
89
|
+
renderProp: () => (selected) =>
|
|
90
|
+
classNames(
|
|
91
|
+
"toggle",
|
|
92
|
+
size,
|
|
93
|
+
color,
|
|
94
|
+
variant,
|
|
95
|
+
className,
|
|
96
|
+
selected && "selected",
|
|
97
|
+
options?.class,
|
|
98
|
+
props?.class
|
|
99
|
+
),
|
|
100
|
+
},
|
|
101
|
+
disabled,
|
|
102
|
+
},
|
|
103
|
+
children
|
|
104
|
+
);
|
|
105
|
+
};
|
|
106
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
declare module "@grucloud/bau-ui/toggleGroup" {
|
|
2
|
+
type DefaultDesignProps = import("../constants").DefaultDesignProps;
|
|
3
|
+
type ComponentOption = import("../bau-ui").ComponentOption;
|
|
4
|
+
|
|
5
|
+
export type ToggleGroupProps = {
|
|
6
|
+
exclusive?: boolean;
|
|
7
|
+
onChange: (input: { values: string[] }) => void;
|
|
8
|
+
} & DefaultDesignProps;
|
|
9
|
+
|
|
10
|
+
type Component = import("../bau-ui").Component<ToggleGroupProps>;
|
|
11
|
+
|
|
12
|
+
export default function (context: any, option?: ComponentOption): Component;
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./toggleGroup";
|