@db-ux/react-core-components 3.0.2-shell4-bdb351c → 3.0.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.
- package/dist/components/brand/brand.d.ts +3 -0
- package/dist/components/brand/brand.js +13 -0
- package/dist/components/brand/index.d.ts +1 -0
- package/dist/components/brand/index.js +1 -0
- package/dist/components/brand/model.d.ts +10 -0
- package/dist/components/button/button.d.ts +1 -1
- package/dist/components/checkbox/checkbox.d.ts +1 -4
- package/dist/components/checkbox/checkbox.js +2 -2
- package/dist/components/custom-select/custom-select.d.ts +1 -4
- package/dist/components/custom-select/custom-select.js +7 -7
- package/dist/components/custom-select/model.d.ts +1 -4
- package/dist/components/custom-select-list-item/custom-select-list-item.d.ts +1 -4
- package/dist/components/drawer/drawer.js +4 -4
- package/dist/components/drawer/model.d.ts +1 -5
- package/dist/components/drawer/model.js +1 -1
- package/dist/components/header/header.d.ts +3 -0
- package/dist/components/header/header.js +67 -0
- package/dist/components/header/index.d.ts +1 -0
- package/dist/components/header/index.js +1 -0
- package/dist/components/header/model.d.ts +44 -0
- package/dist/components/input/input.d.ts +1 -4
- package/dist/components/input/input.js +2 -2
- package/dist/components/navigation/model.d.ts +5 -14
- package/dist/components/navigation/navigation.d.ts +1 -1
- package/dist/components/navigation/navigation.js +6 -96
- package/dist/components/navigation-item/model.d.ts +24 -9
- package/dist/components/navigation-item/navigation-item.d.ts +1 -1
- package/dist/components/navigation-item/navigation-item.js +67 -8
- package/dist/components/page/index.d.ts +1 -0
- package/dist/components/page/index.js +1 -0
- package/dist/components/page/model.d.ts +36 -0
- package/dist/components/page/model.js +2 -0
- package/dist/components/page/page.d.ts +3 -0
- package/dist/components/{shell/shell.js → page/page.js} +28 -9
- package/dist/components/popover/popover.js +2 -1
- package/dist/components/radio/radio.d.ts +1 -4
- package/dist/components/select/select.d.ts +1 -4
- package/dist/components/select/select.js +2 -2
- package/dist/components/switch/switch.d.ts +1 -4
- package/dist/components/tabs/model.d.ts +11 -3
- package/dist/components/tabs/tabs.d.ts +1 -1
- package/dist/components/tabs/tabs.js +3 -3
- package/dist/components/textarea/textarea.d.ts +1 -4
- package/dist/components/textarea/textarea.js +2 -2
- package/dist/components/tooltip/tooltip.js +3 -2
- package/dist/index.d.ts +6 -19
- package/dist/index.js +6 -19
- package/dist/shared/constants.d.ts +0 -3
- package/dist/shared/constants.js +0 -3
- package/dist/shared/model.d.ts +3 -82
- package/dist/shared/model.js +0 -3
- package/dist/utils/floating-components.d.ts +1 -17
- package/dist/utils/floating-components.js +48 -76
- package/dist/utils/navigation.d.ts +6 -2
- package/dist/utils/navigation.js +22 -34
- package/package.json +4 -4
- package/dist/components/control-panel-brand/control-panel-brand.d.ts +0 -3
- package/dist/components/control-panel-brand/control-panel-brand.js +0 -15
- package/dist/components/control-panel-brand/index.d.ts +0 -1
- package/dist/components/control-panel-brand/index.js +0 -1
- package/dist/components/control-panel-brand/model.d.ts +0 -5
- package/dist/components/control-panel-desktop/control-panel-desktop.d.ts +0 -3
- package/dist/components/control-panel-desktop/control-panel-desktop.js +0 -62
- package/dist/components/control-panel-desktop/index.d.ts +0 -1
- package/dist/components/control-panel-desktop/index.js +0 -1
- package/dist/components/control-panel-desktop/model.d.ts +0 -7
- package/dist/components/control-panel-flat-icon-navigation/control-panel-flat-icon-navigation.d.ts +0 -3
- package/dist/components/control-panel-flat-icon-navigation/control-panel-flat-icon-navigation.js +0 -26
- package/dist/components/control-panel-flat-icon-navigation/index.d.ts +0 -1
- package/dist/components/control-panel-flat-icon-navigation/index.js +0 -1
- package/dist/components/control-panel-flat-icon-navigation/model.d.ts +0 -7
- package/dist/components/control-panel-flat-icon-navigation/model.js +0 -1
- package/dist/components/control-panel-meta-navigation/control-panel-meta-navigation.d.ts +0 -3
- package/dist/components/control-panel-meta-navigation/control-panel-meta-navigation.js +0 -11
- package/dist/components/control-panel-meta-navigation/index.d.ts +0 -1
- package/dist/components/control-panel-meta-navigation/index.js +0 -1
- package/dist/components/control-panel-meta-navigation/model.d.ts +0 -5
- package/dist/components/control-panel-meta-navigation/model.js +0 -1
- package/dist/components/control-panel-mobile/control-panel-mobile.d.ts +0 -3
- package/dist/components/control-panel-mobile/control-panel-mobile.js +0 -41
- package/dist/components/control-panel-mobile/index.d.ts +0 -1
- package/dist/components/control-panel-mobile/index.js +0 -1
- package/dist/components/control-panel-mobile/model.d.ts +0 -30
- package/dist/components/control-panel-mobile/model.js +0 -1
- package/dist/components/control-panel-primary-actions/control-panel-primary-actions.d.ts +0 -3
- package/dist/components/control-panel-primary-actions/control-panel-primary-actions.js +0 -11
- package/dist/components/control-panel-primary-actions/index.d.ts +0 -1
- package/dist/components/control-panel-primary-actions/index.js +0 -1
- package/dist/components/control-panel-primary-actions/model.d.ts +0 -5
- package/dist/components/control-panel-primary-actions/model.js +0 -1
- package/dist/components/control-panel-secondary-actions/control-panel-secondary-actions.d.ts +0 -3
- package/dist/components/control-panel-secondary-actions/control-panel-secondary-actions.js +0 -11
- package/dist/components/control-panel-secondary-actions/index.d.ts +0 -1
- package/dist/components/control-panel-secondary-actions/index.js +0 -1
- package/dist/components/control-panel-secondary-actions/model.d.ts +0 -5
- package/dist/components/control-panel-secondary-actions/model.js +0 -1
- package/dist/components/navigation-item-group/index.d.ts +0 -1
- package/dist/components/navigation-item-group/index.js +0 -1
- package/dist/components/navigation-item-group/model.d.ts +0 -26
- package/dist/components/navigation-item-group/model.js +0 -1
- package/dist/components/navigation-item-group/navigation-item-group.d.ts +0 -3
- package/dist/components/navigation-item-group/navigation-item-group.js +0 -100
- package/dist/components/shell/index.d.ts +0 -1
- package/dist/components/shell/index.js +0 -1
- package/dist/components/shell/model.d.ts +0 -50
- package/dist/components/shell/model.js +0 -1
- package/dist/components/shell/shell.d.ts +0 -3
- package/dist/components/shell-sub-navigation/index.d.ts +0 -1
- package/dist/components/shell-sub-navigation/index.js +0 -1
- package/dist/components/shell-sub-navigation/model.d.ts +0 -5
- package/dist/components/shell-sub-navigation/model.js +0 -1
- package/dist/components/shell-sub-navigation/shell-sub-navigation.d.ts +0 -3
- package/dist/components/shell-sub-navigation/shell-sub-navigation.js +0 -45
- /package/dist/components/{control-panel-brand → brand}/model.js +0 -0
- /package/dist/components/{control-panel-desktop → header}/model.js +0 -0
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
declare const DBBrand: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<any>, "text" | "icon" | keyof import("../..").GlobalProps | "hideLogo" | "showIcon"> & import("./model").DBBrandDefaultProps & import("../..").GlobalProps & import("../..").IconProps & import("../..").ShowIconProps & import("../..").TextProps & React.RefAttributes<any>>;
|
|
3
|
+
export default DBBrand;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { filterPassingProps, getRootProps } from "../../utils/react";
|
|
4
|
+
import { useRef, forwardRef } from "react";
|
|
5
|
+
import { DEFAULT_ICON } from "../../shared/constants";
|
|
6
|
+
import { cls, getBooleanAsString } from "../../utils";
|
|
7
|
+
function DBBrandFn(props, component) {
|
|
8
|
+
var _a;
|
|
9
|
+
const _ref = component || useRef(component);
|
|
10
|
+
return (React.createElement("div", Object.assign({ ref: _ref }, filterPassingProps(props, ["data-icon-variant", "data-icon-variant-before", "data-icon-variant-after", "data-icon-weight", "data-icon-weight-before", "data-icon-weight-after", "data-interactive", "data-force-mobile", "data-color", "data-container-color", "data-bg-color", "data-on-bg-color", "data-color-scheme", "data-font-size", "data-headline-size", "data-divider", "data-focus", "data-font"]), { "data-icon": props.hideLogo ? "none" : (_a = props.icon) !== null && _a !== void 0 ? _a : DEFAULT_ICON, "data-show-icon": getBooleanAsString(props.showIcon), id: props.id }, getRootProps(props, ["data-icon-variant", "data-icon-variant-before", "data-icon-variant-after", "data-icon-weight", "data-icon-weight-before", "data-icon-weight-after", "data-interactive", "data-force-mobile", "data-color", "data-container-color", "data-bg-color", "data-on-bg-color", "data-color-scheme", "data-font-size", "data-headline-size", "data-divider", "data-focus", "data-font"]), { className: cls("db-brand", props.className) }), props.text ? React.createElement(React.Fragment, null, props.text) : React.createElement(React.Fragment, null, props.children)));
|
|
11
|
+
}
|
|
12
|
+
const DBBrand = forwardRef(DBBrandFn);
|
|
13
|
+
export default DBBrand;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as DBBrand } from './brand';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as DBBrand } from './brand';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { GlobalProps, GlobalState, IconProps, ShowIconProps, TextProps } from '../../shared/model';
|
|
2
|
+
export type DBBrandDefaultProps = {
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated: Disable the default logo svg to pass in a custom `img`
|
|
5
|
+
*/
|
|
6
|
+
hideLogo?: boolean;
|
|
7
|
+
};
|
|
8
|
+
export type DBBrandProps = DBBrandDefaultProps & GlobalProps & IconProps & ShowIconProps & TextProps;
|
|
9
|
+
export type DBBrandDefaultState = {};
|
|
10
|
+
export type DBBrandState = DBBrandDefaultState & GlobalState;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
declare const DBButton: React.ForwardRefExoticComponent<Omit<React.ButtonHTMLAttributes<any>, "width" | "text" | "size" | "icon" | "onClick" | keyof import("../..").GlobalProps | keyof import("./model").DBButtonDefaultProps | "
|
|
2
|
+
declare const DBButton: React.ForwardRefExoticComponent<Omit<React.ButtonHTMLAttributes<any>, "width" | "text" | "size" | "icon" | "onClick" | keyof import("../..").GlobalProps | "showIcon" | keyof import("./model").DBButtonDefaultProps | "showIconLeading" | "showIconTrailing" | "iconLeading" | "iconTrailing"> & import("./model").DBButtonDefaultProps & import("../..").GlobalProps & import("../..").ClickEventProps<HTMLButtonElement> & import("../..").IconProps & import("../..").WidthProps & import("../..").SizeProps & import("../..").ShowIconProps & import("../..").TextProps & import("../..").ShowIconLeadingProps & import("../..").ShowIconTrailingProps & import("../..").IconLeadingProps & import("../..").IconTrailingProps & React.RefAttributes<any>>;
|
|
3
3
|
export default DBButton;
|
|
@@ -1,6 +1,3 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
declare const DBCheckbox: React.ForwardRefExoticComponent<Omit<React.InputHTMLAttributes<any>, "
|
|
3
|
-
label?: string;
|
|
4
|
-
name?: string;
|
|
5
|
-
} & import("../../shared/model").DisabledProps & import("../../shared/model").RequiredProps & import("../../shared/model").ShowLabelProps & import("../../shared/model").ValueProps & import("../../shared/model").FormCheckProps & import("../../shared/model").FormMessageProps & import("../../shared/model").SizeProps & React.RefAttributes<any>>;
|
|
2
|
+
declare const DBCheckbox: React.ForwardRefExoticComponent<Omit<React.InputHTMLAttributes<any>, "value" | "size" | "checked" | keyof import("../../shared/model").GlobalProps | "indeterminate" | keyof import("../../shared/model").ChangeEventProps<HTMLInputElement> | keyof import("../../shared/model").FocusEventProps<HTMLInputElement> | keyof import("../../shared/model").CustomFormProps | keyof import("../../shared/model").BaseFormProps | keyof import("../../shared/model").RequiredProps | "showLabel" | keyof import("../../shared/model").FormMessageProps> & import("./model").DBCheckboxDefaultProps & import("../../shared/model").GlobalProps & import("../../shared/model").ChangeEventProps<HTMLInputElement> & import("../../shared/model").FocusEventProps<HTMLInputElement> & import("../../shared/model").CustomFormProps & import("../../shared/model").BaseFormProps & import("../../shared/model").RequiredProps & import("../../shared/model").ShowLabelProps & import("../../shared/model").ValueProps & import("../../shared/model").FormCheckProps & import("../../shared/model").FormMessageProps & import("../../shared/model").SizeProps & React.RefAttributes<any>>;
|
|
6
3
|
export default DBCheckbox;
|
|
@@ -30,7 +30,7 @@ function DBCheckboxFn(props, component) {
|
|
|
30
30
|
DEFAULT_INVALID_MESSAGE);
|
|
31
31
|
if (hasVoiceOver()) {
|
|
32
32
|
set_voiceOverFallback(_invalidMessage);
|
|
33
|
-
|
|
33
|
+
delay(() => set_voiceOverFallback(""), 1000);
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
else if (hasValidState() &&
|
|
@@ -39,7 +39,7 @@ function DBCheckboxFn(props, component) {
|
|
|
39
39
|
set_descByIds(_validMessageId);
|
|
40
40
|
if (hasVoiceOver()) {
|
|
41
41
|
set_voiceOverFallback((_d = props.validMessage) !== null && _d !== void 0 ? _d : DEFAULT_VALID_MESSAGE);
|
|
42
|
-
|
|
42
|
+
delay(() => set_voiceOverFallback(""), 1000);
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
else if (stringPropVisible(props.message, props.showMessage)) {
|
|
@@ -1,6 +1,3 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
declare const DBCustomSelect: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<any>, "
|
|
3
|
-
label?: string;
|
|
4
|
-
name?: string;
|
|
5
|
-
} & import("../../shared/model").DisabledProps & import("../../shared/model").RequiredProps & import("../../shared/model").FormMessageProps & import("./model").DBCustomSelectDefaultProps & import("./model").DBCustomSelectEvents & import("../../shared/model").IconProps & import("../../shared/model").ShowIconProps & import("../../shared/model").ShowLabelProps & React.RefAttributes<any>>;
|
|
2
|
+
declare const DBCustomSelect: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<any>, "icon" | keyof import("../../shared/model").GlobalProps | "showIcon" | keyof import("../../shared/model").CustomFormProps | keyof import("../../shared/model").BaseFormProps | keyof import("../../shared/model").RequiredProps | "showLabel" | keyof import("../../shared/model").FormMessageProps | keyof import("./model").DBCustomSelectDefaultProps | keyof import("./model").DBCustomSelectEvents> & import("../../shared/model").GlobalProps & import("../../shared/model").CustomFormProps & import("../../shared/model").BaseFormProps & import("../../shared/model").RequiredProps & import("../../shared/model").FormMessageProps & import("./model").DBCustomSelectDefaultProps & import("./model").DBCustomSelectEvents & import("../../shared/model").IconProps & import("../../shared/model").ShowIconProps & import("../../shared/model").ShowLabelProps & React.RefAttributes<any>>;
|
|
6
3
|
export default DBCustomSelect;
|
|
@@ -75,7 +75,7 @@ function DBCustomSelectFn(props, component) {
|
|
|
75
75
|
DEFAULT_INVALID_MESSAGE);
|
|
76
76
|
if (hasVoiceOver()) {
|
|
77
77
|
set_voiceOverFallback(_invalidMessage);
|
|
78
|
-
|
|
78
|
+
delay(() => set_voiceOverFallback(""), 1000);
|
|
79
79
|
}
|
|
80
80
|
if (_userInteraction) {
|
|
81
81
|
set_validity((_c = props.validation) !== null && _c !== void 0 ? _c : "invalid");
|
|
@@ -87,7 +87,7 @@ function DBCustomSelectFn(props, component) {
|
|
|
87
87
|
set_descByIds(_validMessageId);
|
|
88
88
|
if (hasVoiceOver()) {
|
|
89
89
|
set_voiceOverFallback((_e = props.validMessage) !== null && _e !== void 0 ? _e : DEFAULT_VALID_MESSAGE);
|
|
90
|
-
|
|
90
|
+
delay(() => set_voiceOverFallback(""), 1000);
|
|
91
91
|
}
|
|
92
92
|
set_validity((_f = props.validation) !== null && _f !== void 0 ? _f : "valid");
|
|
93
93
|
}
|
|
@@ -176,7 +176,7 @@ function DBCustomSelectFn(props, component) {
|
|
|
176
176
|
const dropdown = detailsRef.current.querySelector("article");
|
|
177
177
|
if (dropdown) {
|
|
178
178
|
// This is a workaround for Angular
|
|
179
|
-
|
|
179
|
+
delay(() => {
|
|
180
180
|
var _a;
|
|
181
181
|
handleFixedDropdown(dropdown, detailsRef.current, (_a = props.placement) !== null && _a !== void 0 ? _a : "bottom");
|
|
182
182
|
}, 1);
|
|
@@ -217,7 +217,7 @@ function DBCustomSelectFn(props, component) {
|
|
|
217
217
|
// or to the last checkbox
|
|
218
218
|
const search = getSearchInput(detailsRef.current);
|
|
219
219
|
if (search) {
|
|
220
|
-
|
|
220
|
+
delay(() => {
|
|
221
221
|
search.focus();
|
|
222
222
|
}, 100);
|
|
223
223
|
}
|
|
@@ -282,7 +282,7 @@ function DBCustomSelectFn(props, component) {
|
|
|
282
282
|
if (!detailsRef.current.contains(relatedTarget)) {
|
|
283
283
|
// We need to use delay here because the combination of `contains`
|
|
284
284
|
// and changing the DOM element causes a race condition inside browser
|
|
285
|
-
|
|
285
|
+
delay(() => (detailsRef.current.open = false), 1);
|
|
286
286
|
}
|
|
287
287
|
}
|
|
288
288
|
}
|
|
@@ -355,7 +355,7 @@ function DBCustomSelectFn(props, component) {
|
|
|
355
355
|
? checkboxes.at(1)
|
|
356
356
|
: first;
|
|
357
357
|
if (checkbox) {
|
|
358
|
-
|
|
358
|
+
delay(() => {
|
|
359
359
|
// Takes some time until element can be focused
|
|
360
360
|
checkbox.focus();
|
|
361
361
|
}, 1);
|
|
@@ -368,7 +368,7 @@ function DBCustomSelectFn(props, component) {
|
|
|
368
368
|
// Focus search if possible
|
|
369
369
|
const search = getSearchInput(detailsRef.current);
|
|
370
370
|
if (search) {
|
|
371
|
-
|
|
371
|
+
delay(() => {
|
|
372
372
|
// Takes some time until element can be focused
|
|
373
373
|
search.focus();
|
|
374
374
|
}, 1);
|
|
@@ -189,9 +189,6 @@ export type DBCustomSelectDefaultState = {
|
|
|
189
189
|
_infoTextId?: string;
|
|
190
190
|
_internalChangeTimestamp: number;
|
|
191
191
|
_documentClickListenerCallbackId?: string;
|
|
192
|
-
_documentScrollListenerCallbackId?: string;
|
|
193
|
-
handleDocumentScroll: (event: any) => void;
|
|
194
|
-
_observer?: IntersectionObserver;
|
|
195
192
|
_searchValue?: string;
|
|
196
193
|
_userInteraction?: boolean;
|
|
197
194
|
getNativeSelectValue: () => string;
|
|
@@ -202,7 +199,7 @@ export type DBCustomSelectDefaultState = {
|
|
|
202
199
|
searchEnabled: boolean;
|
|
203
200
|
amountOptions: number;
|
|
204
201
|
setDescById: (descId?: string) => void;
|
|
205
|
-
handleTagRemove: (option: CustomSelectOptionType, event?: ClickEvent<HTMLButtonElement> | void
|
|
202
|
+
handleTagRemove: (option: CustomSelectOptionType, event?: ClickEvent<HTMLButtonElement> | void) => void;
|
|
206
203
|
handleSummaryFocus: () => void;
|
|
207
204
|
handleSelect: (value?: string) => void;
|
|
208
205
|
handleSelectAll: (event: any) => void;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
declare const DBCustomSelectListItem: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<any>, "
|
|
3
|
-
label?: string;
|
|
4
|
-
name?: string;
|
|
5
|
-
} & import("../../shared/model").DisabledProps & import("../../shared/model").ValueProps & import("../../shared/model").FormCheckProps & import("../../shared/model").ChangeEventProps<HTMLInputElement> & {
|
|
2
|
+
declare const DBCustomSelectListItem: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<any>, "value" | "icon" | "checked" | keyof import("../../shared/model").GlobalProps | "showIcon" | keyof import("../../shared/model").ChangeEventProps<HTMLInputElement> | keyof import("../../shared/model").BaseFormProps | keyof import("./model").DBCustomSelectListItemDefaultProps | "isGroupTitle" | "showDivider"> & import("./model").DBCustomSelectListItemDefaultProps & import("../../shared/model").GlobalProps & import("../../shared/model").BaseFormProps & import("../../shared/model").ValueProps & import("../../shared/model").FormCheckProps & import("../../shared/model").ChangeEventProps<HTMLInputElement> & {
|
|
6
3
|
isGroupTitle?: boolean;
|
|
7
4
|
showDivider?: boolean;
|
|
8
5
|
} & import("../../shared/model").IconProps & import("../../shared/model").ShowIconProps & React.RefAttributes<any>>;
|
|
@@ -58,7 +58,7 @@ function DBDrawerFn(props, component) {
|
|
|
58
58
|
if (dialogContainerRef.current) {
|
|
59
59
|
dialogContainerRef.current.hidden = true;
|
|
60
60
|
}
|
|
61
|
-
|
|
61
|
+
delay(() => {
|
|
62
62
|
var _a;
|
|
63
63
|
if (dialogContainerRef.current) {
|
|
64
64
|
dialogContainerRef.current.hidden = false;
|
|
@@ -87,9 +87,9 @@ function DBDrawerFn(props, component) {
|
|
|
87
87
|
return (React.createElement("dialog", Object.assign({ className: "db-drawer", id: props.id, ref: _ref }, filterPassingProps(props, ["data-icon-variant", "data-icon-variant-before", "data-icon-variant-after", "data-icon-weight", "data-icon-weight-before", "data-icon-weight-after", "data-interactive", "data-force-mobile", "data-color", "data-container-color", "data-bg-color", "data-on-bg-color", "data-color-scheme", "data-font-size", "data-headline-size", "data-divider", "data-focus", "data-font", "onClose"]), { onClick: (event) => handleClose(event), onKeyDown: (event) => handleClose(event), "data-position": props.position, "data-backdrop": props.backdrop, "data-direction": props.direction, "data-variant": props.variant }),
|
|
88
88
|
React.createElement("article", Object.assign({ ref: dialogContainerRef }, getRootProps(props, ["data-icon-variant", "data-icon-variant-before", "data-icon-variant-after", "data-icon-weight", "data-icon-weight-before", "data-icon-weight-after", "data-interactive", "data-force-mobile", "data-color", "data-container-color", "data-bg-color", "data-on-bg-color", "data-color-scheme", "data-font-size", "data-headline-size", "data-divider", "data-focus", "data-font"]), { className: cls("db-drawer-container", props.className), "data-spacing": props.spacing, "data-width": props.width, "data-direction": props.direction, "data-rounded": getBooleanAsString(props.rounded) }),
|
|
89
89
|
React.createElement("header", { className: "db-drawer-header" },
|
|
90
|
-
React.createElement("div", { className: "db-drawer-header-text" },
|
|
91
|
-
React.createElement(React.Fragment, null, props.drawerHeader))
|
|
92
|
-
React.createElement(DBButton, { className: "button-close-drawer", icon: "cross", variant: "ghost",
|
|
90
|
+
React.createElement("div", { className: "db-drawer-header-text" },
|
|
91
|
+
React.createElement(React.Fragment, null, props.drawerHeader)),
|
|
92
|
+
React.createElement(DBButton, { className: "button-close-drawer", icon: "cross", variant: "ghost", id: props.closeButtonId, noText: true, onClick: (event) => handleClose(event, true) }, (_a = props.closeButtonText) !== null && _a !== void 0 ? _a : DEFAULT_CLOSE_BUTTON)),
|
|
93
93
|
React.createElement("div", { className: "db-drawer-content" }, props.children))));
|
|
94
94
|
}
|
|
95
95
|
const DBDrawer = forwardRef(DBDrawerFn);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ClickEvent, CloseEventProps, CloseEventState, GeneralKeyboardEvent, GlobalProps, GlobalState, InitializedState, InnerCloseButtonProps, SpacingProps, WidthProps } from '../../shared/model';
|
|
2
2
|
export declare const DrawerBackdropList: readonly ["none", "strong", "weak", "invisible"];
|
|
3
3
|
export type DrawerBackdropType = (typeof DrawerBackdropList)[number];
|
|
4
|
-
export declare const DrawerDirectionList: readonly ["
|
|
4
|
+
export declare const DrawerDirectionList: readonly ["left", "right", "up", "down"];
|
|
5
5
|
export type DrawerDirectionType = (typeof DrawerDirectionList)[number];
|
|
6
6
|
export declare const DrawerVariantList: readonly ["modal", "inside"];
|
|
7
7
|
export type DrawerVariantType = (typeof DrawerVariantList)[number];
|
|
@@ -22,10 +22,6 @@ export type DBDrawerDefaultProps = {
|
|
|
22
22
|
* Slot for changing the header of the drawer.
|
|
23
23
|
*/
|
|
24
24
|
drawerHeader?: any;
|
|
25
|
-
/**
|
|
26
|
-
* Text for changing the header of the drawer.
|
|
27
|
-
*/
|
|
28
|
-
drawerHeaderPlain?: string;
|
|
29
25
|
/**
|
|
30
26
|
* The open attribute opens or closes the drawer based on the state.
|
|
31
27
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export const DrawerBackdropList = ['none', 'strong', 'weak', 'invisible'];
|
|
2
|
-
export const DrawerDirectionList = ['
|
|
2
|
+
export const DrawerDirectionList = ['left', 'right', 'up', 'down'];
|
|
3
3
|
export const DrawerVariantList = ['modal', 'inside'];
|
|
4
4
|
export const DrawerPositionList = ['fixed', 'absolute'];
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
declare const DBHeader: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<any>, "width" | keyof import("../..").GlobalProps | keyof import("../..").ToggleEventProps | keyof import("./model").DBHeaderDefaultProps> & import("./model").DBHeaderDefaultProps & import("../..").GlobalProps & import("../..").ToggleEventProps & import("../..").ContainerWidthProps & React.RefAttributes<any>>;
|
|
3
|
+
export default DBHeader;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { filterPassingProps, getRootProps } from "../../utils/react";
|
|
4
|
+
import { useState, useRef, useEffect, forwardRef } from "react";
|
|
5
|
+
import { DEFAULT_BURGER_MENU } from "../../shared/constants";
|
|
6
|
+
import { addAttributeToChildren, cls, getBoolean } from "../../utils";
|
|
7
|
+
import { isEventTargetNavigationItem } from "../../utils/navigation";
|
|
8
|
+
import DBButton from "../button/button";
|
|
9
|
+
import DBDrawer from "../drawer/drawer";
|
|
10
|
+
function DBHeaderFn(props, component) {
|
|
11
|
+
var _a;
|
|
12
|
+
const _ref = component || useRef(component);
|
|
13
|
+
const [initialized, setInitialized] = useState(() => false);
|
|
14
|
+
const [forcedToMobile, setForcedToMobile] = useState(() => false);
|
|
15
|
+
function handleToggle(event) {
|
|
16
|
+
if (event && event.stopPropagation) {
|
|
17
|
+
event.stopPropagation();
|
|
18
|
+
}
|
|
19
|
+
const open = !getBoolean(props.drawerOpen, "drawerOpen");
|
|
20
|
+
if (props.onToggle) {
|
|
21
|
+
props.onToggle(open);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function handleNavigationItemClick(event) {
|
|
25
|
+
if (isEventTargetNavigationItem(event)) {
|
|
26
|
+
handleToggle();
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
setInitialized(true);
|
|
31
|
+
}, []);
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
if (initialized && _ref.current && props.forceMobile) {
|
|
34
|
+
// Adds this attribute to the header to enable all styling which would have
|
|
35
|
+
// @media screen and (min-width: $db-screens-m) to show mobile navigation on a desktop device
|
|
36
|
+
addAttributeToChildren(_ref.current, {
|
|
37
|
+
key: "data-force-mobile",
|
|
38
|
+
value: "true",
|
|
39
|
+
});
|
|
40
|
+
setForcedToMobile(true);
|
|
41
|
+
}
|
|
42
|
+
}, [initialized, _ref.current]);
|
|
43
|
+
return (React.createElement("header", Object.assign({ ref: _ref }, filterPassingProps(props, ["data-icon-variant", "data-icon-variant-before", "data-icon-variant-after", "data-icon-weight", "data-icon-weight-before", "data-icon-weight-after", "data-interactive", "data-force-mobile", "data-color", "data-container-color", "data-bg-color", "data-on-bg-color", "data-color-scheme", "data-font-size", "data-headline-size", "data-divider", "data-focus", "data-font", "onToggle"]), getRootProps(props, ["data-icon-variant", "data-icon-variant-before", "data-icon-variant-after", "data-icon-weight", "data-icon-weight-before", "data-icon-weight-after", "data-interactive", "data-force-mobile", "data-color", "data-container-color", "data-bg-color", "data-on-bg-color", "data-color-scheme", "data-font-size", "data-headline-size", "data-divider", "data-focus", "data-font"]), { className: cls("db-header", props.className), id: props.id, "data-width": props.width, "data-on-forcing-mobile": props.forceMobile && !forcedToMobile }),
|
|
44
|
+
React.createElement(DBDrawer, { className: "db-header-drawer", spacing: "small", rounded: true, open: getBoolean(props.drawerOpen), onClose: (event) => handleToggle() },
|
|
45
|
+
React.createElement("div", { className: "db-header-drawer-navigation" },
|
|
46
|
+
React.createElement("div", { className: "db-header-navigation", onClick: (event) => handleNavigationItemClick(event) }, props.children),
|
|
47
|
+
React.createElement("div", { className: "db-header-meta-navigation" },
|
|
48
|
+
React.createElement(React.Fragment, null, props.metaNavigation))),
|
|
49
|
+
React.createElement("div", { className: "db-header-secondary-action" },
|
|
50
|
+
React.createElement(React.Fragment, null, props.secondaryAction))),
|
|
51
|
+
React.createElement("div", { className: "db-header-meta-navigation" },
|
|
52
|
+
React.createElement(React.Fragment, null, props.metaNavigation)),
|
|
53
|
+
React.createElement("div", { className: "db-header-navigation-bar" },
|
|
54
|
+
React.createElement("div", { className: "db-header-brand-container" },
|
|
55
|
+
React.createElement(React.Fragment, null, props.brand)),
|
|
56
|
+
React.createElement("div", { className: "db-header-navigation-container" },
|
|
57
|
+
React.createElement("div", { className: "db-header-navigation" }, props.children),
|
|
58
|
+
React.createElement("div", { className: "db-header-primary-action" },
|
|
59
|
+
React.createElement(React.Fragment, null, props.primaryAction))),
|
|
60
|
+
React.createElement("div", { className: "db-header-action-container" },
|
|
61
|
+
React.createElement("div", { className: "db-header-burger-menu-container" },
|
|
62
|
+
React.createElement(DBButton, { icon: "menu", variant: "ghost", noText: true, onClick: (event) => handleToggle() }, (_a = props.burgerMenuLabel) !== null && _a !== void 0 ? _a : DEFAULT_BURGER_MENU)),
|
|
63
|
+
React.createElement("div", { className: "db-header-secondary-action" },
|
|
64
|
+
React.createElement(React.Fragment, null, props.secondaryAction))))));
|
|
65
|
+
}
|
|
66
|
+
const DBHeader = forwardRef(DBHeaderFn);
|
|
67
|
+
export default DBHeader;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as DBHeader } from './header';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as DBHeader } from './header';
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { ContainerWidthProps, GlobalProps, GlobalState, InitializedState, NavigationBehaviorState, ToggleEventProps, ToggleEventState } from '../../shared/model';
|
|
2
|
+
export type DBHeaderDefaultProps = {
|
|
3
|
+
/**
|
|
4
|
+
* Slot to pass in the DBBrand component
|
|
5
|
+
*/
|
|
6
|
+
brand?: any;
|
|
7
|
+
/**
|
|
8
|
+
* Slot to pass in a meta navigation.
|
|
9
|
+
* - Desktop: Above the regular header
|
|
10
|
+
* - Mobile: Inside the drawer
|
|
11
|
+
*/
|
|
12
|
+
metaNavigation?: any;
|
|
13
|
+
/**
|
|
14
|
+
* Slot to pass one or more elements like DBButton (e.g. search) as primary action.
|
|
15
|
+
* - Desktop: Shown next to the main-navigation
|
|
16
|
+
* - Mobile: Shown next to the brand
|
|
17
|
+
*/
|
|
18
|
+
primaryAction?: any;
|
|
19
|
+
/**
|
|
20
|
+
* Slot to pass one or more elements like DBButton (e.g. profile, language, etc.) as secondary action.
|
|
21
|
+
* - Desktop: Shown separated by divider at the end of the header
|
|
22
|
+
* - Mobile: Shown inside the drawer at the bottom.
|
|
23
|
+
*/
|
|
24
|
+
secondaryAction?: any;
|
|
25
|
+
/**
|
|
26
|
+
* Open/closes the drawer for mobile header or if `forceMobile` is true.
|
|
27
|
+
*/
|
|
28
|
+
drawerOpen?: boolean | string;
|
|
29
|
+
/**
|
|
30
|
+
* Forces the header to use mobile layout for desktop as well.
|
|
31
|
+
* You should only use this setting if you really can't provide a smaller navigation.
|
|
32
|
+
* Overwrite size of the drawer with '--db-drawer-max-width: xxx'
|
|
33
|
+
*/
|
|
34
|
+
forceMobile?: boolean | string;
|
|
35
|
+
/**
|
|
36
|
+
* This attribute sets the label for the burger menu button for mobile headers.
|
|
37
|
+
*/
|
|
38
|
+
burgerMenuLabel?: string;
|
|
39
|
+
};
|
|
40
|
+
export type DBHeaderProps = DBHeaderDefaultProps & GlobalProps & ToggleEventProps & ContainerWidthProps;
|
|
41
|
+
export type DBHeaderDefaultState = {
|
|
42
|
+
forcedToMobile?: boolean;
|
|
43
|
+
};
|
|
44
|
+
export type DBHeaderState = DBHeaderDefaultState & GlobalState & ToggleEventState<HTMLElement> & InitializedState & NavigationBehaviorState;
|
|
@@ -1,6 +1,3 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
declare const DBInput: React.ForwardRefExoticComponent<Omit<React.InputHTMLAttributes<any>, "
|
|
3
|
-
label?: string;
|
|
4
|
-
name?: string;
|
|
5
|
-
} & import("../../shared/model").DisabledProps & import("../../shared/model").RequiredProps & import("../../shared/model").ShowLabelProps & import("../../shared/model").ValueProps & import("../../shared/model").IconProps & import("../../shared/model").IconTrailingProps & import("../../shared/model").FormMessageProps & import("../../shared/model").ShowIconProps & import("../../shared/model").IconLeadingProps & import("../../shared/model").ShowIconLeadingProps & import("../../shared/model").ShowIconTrailingProps & import("../../shared/model").FormSizeProps & React.RefAttributes<any>>;
|
|
2
|
+
declare const DBInput: React.ForwardRefExoticComponent<Omit<React.InputHTMLAttributes<any>, "value" | "size" | "icon" | keyof import("../../shared/model").GlobalProps | "showIcon" | "showIconLeading" | "showIconTrailing" | "iconLeading" | "iconTrailing" | keyof import("../../shared/model").ChangeEventProps<HTMLInputElement> | keyof import("../../shared/model").FocusEventProps<HTMLInputElement> | keyof import("../../shared/model").CustomFormProps | keyof import("../../shared/model").BaseFormProps | keyof import("../../shared/model").RequiredProps | "showLabel" | keyof import("../../shared/model").FormMessageProps | keyof import("./model").DBInputDefaultProps | keyof import("../../shared/model").FormTextProps | keyof import("../../shared/model").InputEventProps<HTMLInputElement>> & import("./model").DBInputDefaultProps & import("../../shared/model").GlobalProps & import("../../shared/model").FormTextProps & import("../../shared/model").InputEventProps<HTMLInputElement> & import("../../shared/model").ChangeEventProps<HTMLInputElement> & import("../../shared/model").FocusEventProps<HTMLInputElement> & import("../../shared/model").CustomFormProps & import("../../shared/model").BaseFormProps & import("../../shared/model").RequiredProps & import("../../shared/model").ShowLabelProps & import("../../shared/model").ValueProps & import("../../shared/model").IconProps & import("../../shared/model").IconTrailingProps & import("../../shared/model").FormMessageProps & import("../../shared/model").ShowIconProps & import("../../shared/model").IconLeadingProps & import("../../shared/model").ShowIconLeadingProps & import("../../shared/model").ShowIconTrailingProps & import("../../shared/model").FormSizeProps & React.RefAttributes<any>>;
|
|
6
3
|
export default DBInput;
|
|
@@ -31,7 +31,7 @@ function DBInputFn(props, component) {
|
|
|
31
31
|
DEFAULT_INVALID_MESSAGE);
|
|
32
32
|
if (hasVoiceOver()) {
|
|
33
33
|
set_voiceOverFallback(_invalidMessage);
|
|
34
|
-
|
|
34
|
+
delay(() => set_voiceOverFallback(""), 1000);
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
else if (hasValidState() &&
|
|
@@ -40,7 +40,7 @@ function DBInputFn(props, component) {
|
|
|
40
40
|
set_descByIds(_validMessageId);
|
|
41
41
|
if (hasVoiceOver()) {
|
|
42
42
|
set_voiceOverFallback((_d = props.validMessage) !== null && _d !== void 0 ? _d : DEFAULT_VALID_MESSAGE);
|
|
43
|
-
|
|
43
|
+
delay(() => set_voiceOverFallback(""), 1000);
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
else if (stringPropVisible(props.message, props.showMessage)) {
|
|
@@ -1,14 +1,5 @@
|
|
|
1
|
-
import { GlobalProps, GlobalState
|
|
2
|
-
export type DBNavigationDefaultProps = {
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
export type
|
|
6
|
-
export type DBNavigationDefaultState = {
|
|
7
|
-
onScroll: () => void;
|
|
8
|
-
_variant?: NavigationItemGroupVariantType;
|
|
9
|
-
_shellDesktopPosition?: string | null;
|
|
10
|
-
_subNavigationDesktopPosition?: string | null;
|
|
11
|
-
_handleSubNavigation: () => void;
|
|
12
|
-
_isSubNavigation?: boolean;
|
|
13
|
-
};
|
|
14
|
-
export type DBNavigationState = DBNavigationDefaultState & GlobalState & OverflowScrollButtonState & InitializedState;
|
|
1
|
+
import { GlobalProps, GlobalState } from '../../shared/model';
|
|
2
|
+
export type DBNavigationDefaultProps = {};
|
|
3
|
+
export type DBNavigationProps = DBNavigationDefaultProps & GlobalProps;
|
|
4
|
+
export type DBNavigationDefaultState = {};
|
|
5
|
+
export type DBNavigationState = DBNavigationDefaultState & GlobalState;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
declare const DBNavigation: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<any>,
|
|
2
|
+
declare const DBNavigation: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<any>, keyof import("../..").GlobalProps> & import("../..").GlobalProps & React.RefAttributes<any>>;
|
|
3
3
|
export default DBNavigation;
|
|
@@ -2,106 +2,16 @@
|
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { filterPassingProps, getRootProps } from "../../utils/react";
|
|
4
4
|
import { useState, useRef, useEffect, forwardRef } from "react";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import DBButton from "../button/button";
|
|
5
|
+
import { DEFAULT_ID } from "../../shared/constants";
|
|
6
|
+
import { cls, uuid } from "../../utils";
|
|
8
7
|
function DBNavigationFn(props, component) {
|
|
9
|
-
var _a;
|
|
10
8
|
const _ref = component || useRef(component);
|
|
11
|
-
const
|
|
12
|
-
const [showScrollLeft, setShowScrollLeft] = useState(() => false);
|
|
13
|
-
const [showScrollRight, setShowScrollRight] = useState(() => false);
|
|
14
|
-
const [_shellDesktopPosition, set_shellDesktopPosition] = useState(() => undefined);
|
|
15
|
-
const [_subNavigationDesktopPosition, set_subNavigationDesktopPosition] = useState(() => undefined);
|
|
16
|
-
const [_variant, set_variant] = useState(() => undefined);
|
|
17
|
-
const [initialized, setInitialized] = useState(() => false);
|
|
18
|
-
const [_isSubNavigation, set_isSubNavigation] = useState(() => false);
|
|
19
|
-
function evaluateScrollButtons(tList) {
|
|
20
|
-
const needsScroll = tList.scrollWidth > tList.clientWidth;
|
|
21
|
-
const scrollLeft = Math.ceil(tList.scrollLeft);
|
|
22
|
-
setShowScrollLeft(needsScroll && scrollLeft > 1);
|
|
23
|
-
setShowScrollRight(needsScroll && scrollLeft < tList.scrollWidth - tList.clientWidth);
|
|
24
|
-
}
|
|
25
|
-
function scroll(left) {
|
|
26
|
-
var _a;
|
|
27
|
-
let step = Number(props.arrowScrollDistance) || 100;
|
|
28
|
-
if (left) {
|
|
29
|
-
step *= -1;
|
|
30
|
-
}
|
|
31
|
-
(_a = menuRef.current) === null || _a === void 0 ? void 0 : _a.scrollBy({
|
|
32
|
-
top: 0,
|
|
33
|
-
left: step,
|
|
34
|
-
behavior: "smooth",
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
function onScroll() {
|
|
38
|
-
evaluateScrollButtons(menuRef.current);
|
|
39
|
-
_handleSubNavigation();
|
|
40
|
-
}
|
|
41
|
-
function _handleSubNavigation() {
|
|
42
|
-
handleSubNavigationPosition(menuRef.current, _shellDesktopPosition === "left" ||
|
|
43
|
-
(_shellDesktopPosition === "top" &&
|
|
44
|
-
_subNavigationDesktopPosition === "left" &&
|
|
45
|
-
_isSubNavigation)
|
|
46
|
-
? 1
|
|
47
|
-
: 0);
|
|
48
|
-
}
|
|
9
|
+
const [_id, set_id] = useState(() => DEFAULT_ID);
|
|
49
10
|
useEffect(() => {
|
|
50
|
-
|
|
11
|
+
set_id(props.id || "navigation-" + uuid());
|
|
51
12
|
}, []);
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
void delay(() => {
|
|
55
|
-
var _a, _b, _c, _d, _e;
|
|
56
|
-
const element = _ref.current;
|
|
57
|
-
if (!element)
|
|
58
|
-
return;
|
|
59
|
-
let endVariant = (_a = props.variant) !== null && _a !== void 0 ? _a : "popover";
|
|
60
|
-
const parentClassList = ((_b = element.parentElement) === null || _b === void 0 ? void 0 : _b.nodeName.startsWith("DB"))
|
|
61
|
-
? (_d = (_c = element.parentElement) === null || _c === void 0 ? void 0 : _c.parentElement) === null || _d === void 0 ? void 0 : _d.classList
|
|
62
|
-
: (_e = element.parentElement) === null || _e === void 0 ? void 0 : _e.classList;
|
|
63
|
-
const shell = element.closest(".db-shell");
|
|
64
|
-
const shellDesktopPosition = shell === null || shell === void 0 ? void 0 : shell.getAttribute("data-control-panel-desktop-position");
|
|
65
|
-
const shellSubNaviDesktopPosition = shell === null || shell === void 0 ? void 0 : shell.getAttribute("data-sub-navigation-desktop-position");
|
|
66
|
-
set_shellDesktopPosition(shellDesktopPosition);
|
|
67
|
-
set_subNavigationDesktopPosition(shellSubNaviDesktopPosition);
|
|
68
|
-
const isSubNavigation = parentClassList === null || parentClassList === void 0 ? void 0 : parentClassList.contains("db-shell-sub-navigation");
|
|
69
|
-
set_isSubNavigation(isSubNavigation);
|
|
70
|
-
const requiresPopover = (shellDesktopPosition === "top" &&
|
|
71
|
-
(parentClassList === null || parentClassList === void 0 ? void 0 : parentClassList.contains("db-control-panel-desktop-scroll-container"))) ||
|
|
72
|
-
((shellSubNaviDesktopPosition === "top" ||
|
|
73
|
-
shellDesktopPosition === "left") &&
|
|
74
|
-
isSubNavigation);
|
|
75
|
-
if (requiresPopover) {
|
|
76
|
-
endVariant = "popover";
|
|
77
|
-
}
|
|
78
|
-
set_variant(endVariant);
|
|
79
|
-
}, 1);
|
|
80
|
-
}
|
|
81
|
-
}, [_ref.current, props.variant, initialized]);
|
|
82
|
-
useEffect(() => {
|
|
83
|
-
var _a;
|
|
84
|
-
if (menuRef.current && _variant) {
|
|
85
|
-
if (!_variant || _variant === "popover") {
|
|
86
|
-
_handleSubNavigation();
|
|
87
|
-
}
|
|
88
|
-
else if (_variant === "tree") {
|
|
89
|
-
for (const menu of Array.from(menuRef.current.querySelectorAll(".db-navigation-item-group-menu"))) {
|
|
90
|
-
menu.style.position = "";
|
|
91
|
-
}
|
|
92
|
-
for (const navItem of Array.from(menuRef.current.querySelectorAll(".db-navigation-item, .db-navigation-item-group"))) {
|
|
93
|
-
// TODO: Add keyboard navigation support
|
|
94
|
-
navItem.setAttribute("role", "none");
|
|
95
|
-
(_a = navItem.querySelector("a, button")) === null || _a === void 0 ? void 0 : _a.setAttribute("role", "treeitem");
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
evaluateScrollButtons(menuRef.current);
|
|
99
|
-
}
|
|
100
|
-
}, [menuRef.current, _variant, _shellDesktopPosition]);
|
|
101
|
-
return (React.createElement("nav", Object.assign({ ref: _ref }, filterPassingProps(props, ["data-icon-variant", "data-icon-variant-before", "data-icon-variant-after", "data-icon-weight", "data-icon-weight-before", "data-icon-weight-after", "data-interactive", "data-force-mobile", "data-color", "data-container-color", "data-bg-color", "data-on-bg-color", "data-color-scheme", "data-font-size", "data-headline-size", "data-divider", "data-focus", "data-font"]), { id: props.id, "data-variant": _variant, "data-show-tree-line": getBooleanAsString((_a = props.showTreeLine) !== null && _a !== void 0 ? _a : "true"), onScroll: (event) => onScroll() }, getRootProps(props, ["data-icon-variant", "data-icon-variant-before", "data-icon-variant-after", "data-icon-weight", "data-icon-weight-before", "data-icon-weight-after", "data-interactive", "data-force-mobile", "data-color", "data-container-color", "data-bg-color", "data-on-bg-color", "data-color-scheme", "data-font-size", "data-headline-size", "data-divider", "data-focus", "data-font"]), { className: cls("db-navigation", props.className) }),
|
|
102
|
-
showScrollLeft ? (React.createElement(DBButton, { className: "overflow-scroll-left-button", variant: "filled", icon: "chevron_left", type: "button", noText: true, onClick: (event) => scroll(true) }, "Scroll left")) : null,
|
|
103
|
-
React.createElement("menu", { role: _variant === "tree" ? "tree" : undefined, ref: menuRef, onScroll: (event) => onScroll() }, props.children),
|
|
104
|
-
showScrollRight ? (React.createElement(DBButton, { className: "overflow-scroll-right-button", variant: "filled", icon: "chevron_right", type: "button", noText: true, onClick: (event) => scroll() }, "Scroll right")) : null));
|
|
13
|
+
return (React.createElement("nav", Object.assign({ ref: _ref }, filterPassingProps(props, ["data-icon-variant", "data-icon-variant-before", "data-icon-variant-after", "data-icon-weight", "data-icon-weight-before", "data-icon-weight-after", "data-interactive", "data-force-mobile", "data-color", "data-container-color", "data-bg-color", "data-on-bg-color", "data-color-scheme", "data-font-size", "data-headline-size", "data-divider", "data-focus", "data-font"]), { id: _id }, getRootProps(props, ["data-icon-variant", "data-icon-variant-before", "data-icon-variant-after", "data-icon-weight", "data-icon-weight-before", "data-icon-weight-after", "data-interactive", "data-force-mobile", "data-color", "data-container-color", "data-bg-color", "data-on-bg-color", "data-color-scheme", "data-font-size", "data-headline-size", "data-divider", "data-focus", "data-font"]), { className: cls("db-navigation", props.className) }),
|
|
14
|
+
React.createElement("menu", null, props.children)));
|
|
105
15
|
}
|
|
106
16
|
const DBNavigation = forwardRef(DBNavigationFn);
|
|
107
17
|
export default DBNavigation;
|
|
@@ -1,19 +1,34 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ClickEvent, ClickEventProps, ClickEventState, GlobalProps, GlobalState, IconProps, InitializedState, NavigationBackButtonProps, NavigationBehaviorState, ShowIconProps, TextProps, WidthProps, WrapProps } from '../../shared/model';
|
|
2
|
+
import { NavigationItemSafeTriangle } from '../../utils/navigation';
|
|
2
3
|
export type DBNavigationItemDefaultProps = {
|
|
3
4
|
/**
|
|
4
5
|
* Alternative indicator for active navigation item (bold font). In contrast to the use of aria-current="page" on the contained anchor, this does not guarantee correct a11y.
|
|
5
6
|
*/
|
|
6
7
|
active?: boolean;
|
|
7
8
|
/**
|
|
8
|
-
*
|
|
9
|
-
* to add a tooltip for collapsed navigation
|
|
9
|
+
* The disabled attribute can be set to [keep a user from clicking on the item](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#disabled).
|
|
10
10
|
*/
|
|
11
|
-
|
|
11
|
+
disabled?: boolean | string;
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* React-specific property to pass in a slot for sub-navigation
|
|
14
14
|
*/
|
|
15
|
-
|
|
15
|
+
subNavigation?: any;
|
|
16
|
+
/**
|
|
17
|
+
* This is for mobile navigation only, if it is set the sub-navigation is a static overlay
|
|
18
|
+
*/
|
|
19
|
+
subNavigationExpanded?: boolean | string;
|
|
20
|
+
};
|
|
21
|
+
export type DBNavigationItemProps = DBNavigationItemDefaultProps & GlobalProps & ClickEventProps<HTMLButtonElement> & IconProps & WidthProps & WrapProps & NavigationBackButtonProps & ShowIconProps & TextProps;
|
|
22
|
+
export type DBNavigationItemDefaultState = {
|
|
23
|
+
handleBackClick: (event: ClickEvent<HTMLButtonElement>) => void;
|
|
24
|
+
hasAreaPopup: boolean;
|
|
25
|
+
isSubNavigationExpanded: boolean;
|
|
26
|
+
subNavigationId: string;
|
|
27
|
+
/**
|
|
28
|
+
* Internal state property to show/hide sub-navigation button
|
|
29
|
+
*/
|
|
30
|
+
hasSubNavigation?: boolean;
|
|
31
|
+
navigationItemSafeTriangle?: NavigationItemSafeTriangle;
|
|
32
|
+
autoClose?: boolean;
|
|
16
33
|
};
|
|
17
|
-
export type
|
|
18
|
-
export type DBNavigationItemDefaultState = {};
|
|
19
|
-
export type DBNavigationItemState = DBNavigationItemDefaultState & GlobalState;
|
|
34
|
+
export type DBNavigationItemState = DBNavigationItemDefaultState & ClickEventState<HTMLButtonElement> & GlobalState & InitializedState & NavigationBehaviorState;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
declare const DBNavigationItem: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<any>, "
|
|
2
|
+
declare const DBNavigationItem: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<any>, "width" | "text" | "wrap" | "icon" | "onClick" | keyof import("../../shared/model").GlobalProps | "showIcon" | keyof import("./model").DBNavigationItemDefaultProps | keyof import("../../shared/model").NavigationBackButtonProps> & import("./model").DBNavigationItemDefaultProps & import("../../shared/model").GlobalProps & import("../../shared/model").ClickEventProps<HTMLButtonElement> & import("../../shared/model").IconProps & import("../../shared/model").WidthProps & import("../../shared/model").WrapProps & import("../../shared/model").NavigationBackButtonProps & import("../../shared/model").ShowIconProps & import("../../shared/model").TextProps & React.RefAttributes<any>>;
|
|
3
3
|
export default DBNavigationItem;
|