@db-ux/react-core-components 2.4.4 → 3.0.1
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.js +2 -2
- package/dist/components/button/button.d.ts +1 -1
- package/dist/components/button/button.js +12 -2
- package/dist/components/button/model.d.ts +6 -22
- package/dist/components/button/model.js +0 -1
- package/dist/components/card/card.js +1 -1
- package/dist/components/checkbox/checkbox.js +3 -2
- package/dist/components/custom-select/custom-select.js +15 -7
- package/dist/components/custom-select/model.d.ts +1 -0
- package/dist/components/custom-select-list-item/custom-select-list-item.js +3 -3
- package/dist/components/custom-select-list-item/model.d.ts +1 -1
- package/dist/components/header/header.js +12 -17
- package/dist/components/infotext/infotext.js +2 -2
- package/dist/components/input/input.d.ts +1 -1
- package/dist/components/input/input.js +11 -10
- package/dist/components/input/model.d.ts +6 -2
- package/dist/components/link/link.d.ts +1 -1
- package/dist/components/link/link.js +2 -2
- package/dist/components/link/model.d.ts +3 -3
- package/dist/components/link/model.js +1 -1
- package/dist/components/navigation/model.d.ts +2 -2
- package/dist/components/navigation/navigation.d.ts +1 -1
- package/dist/components/navigation/navigation.js +1 -1
- package/dist/components/navigation-item/model.d.ts +2 -6
- package/dist/components/navigation-item/navigation-item.d.ts +1 -1
- package/dist/components/navigation-item/navigation-item.js +2 -2
- package/dist/components/notification/notification.js +2 -2
- package/dist/components/radio/radio.js +1 -2
- package/dist/components/select/select.js +4 -3
- package/dist/components/switch/model.d.ts +2 -2
- package/dist/components/switch/switch.d.ts +1 -1
- package/dist/components/switch/switch.js +1 -1
- package/dist/components/tab-item/model.d.ts +2 -2
- package/dist/components/tab-item/tab-item.d.ts +1 -1
- package/dist/components/tab-item/tab-item.js +4 -3
- package/dist/components/tab-panel/model.d.ts +2 -2
- package/dist/components/tab-panel/tab-panel.d.ts +1 -1
- package/dist/components/tab-panel/tab-panel.js +1 -1
- package/dist/components/tabs/tabs.js +1 -1
- package/dist/components/tag/model.d.ts +2 -6
- package/dist/components/tag/tag.js +3 -21
- package/dist/components/textarea/textarea.js +3 -2
- package/dist/index.d.ts +39 -0
- package/dist/index.js +39 -0
- package/dist/shared/model.d.ts +28 -27
- package/dist/shared/model.js +0 -1
- package/package.json +14 -14
|
@@ -3,11 +3,11 @@ import * as React from "react";
|
|
|
3
3
|
import { filterPassingProps, getRootProps } from "../../utils/react";
|
|
4
4
|
import { useRef, forwardRef } from "react";
|
|
5
5
|
import { DEFAULT_ICON } from "../../shared/constants";
|
|
6
|
-
import { cls,
|
|
6
|
+
import { cls, getBooleanAsString } from "../../utils";
|
|
7
7
|
function DBBrandFn(props, component) {
|
|
8
8
|
var _a;
|
|
9
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-
|
|
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
11
|
}
|
|
12
12
|
const DBBrand = forwardRef(DBBrandFn);
|
|
13
13
|
export default DBBrand;
|
|
@@ -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 | "showIcon" | keyof import("./model").DBButtonDefaultProps> & import("./model").DBButtonDefaultProps & import("../..").GlobalProps & import("../..").ClickEventProps<HTMLButtonElement> & import("../..").IconProps & import("../..").WidthProps & import("../..").SizeProps & import("../..").ShowIconProps & import("../..").TextProps & React.RefAttributes<any>>;
|
|
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;
|
|
@@ -2,10 +2,20 @@
|
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { filterPassingProps, getRootProps } from "../../utils/react";
|
|
4
4
|
import { useRef, forwardRef } from "react";
|
|
5
|
-
import { cls, getBoolean, getBooleanAsString
|
|
5
|
+
import { cls, getBoolean, getBooleanAsString } from "../../utils";
|
|
6
6
|
function DBButtonFn(props, component) {
|
|
7
|
+
var _a, _b;
|
|
7
8
|
const _ref = component || useRef(component);
|
|
8
|
-
|
|
9
|
+
function getButtonType() {
|
|
10
|
+
if (props.type) {
|
|
11
|
+
return props.type;
|
|
12
|
+
}
|
|
13
|
+
else if (props.onClick) {
|
|
14
|
+
return "button";
|
|
15
|
+
}
|
|
16
|
+
return "submit";
|
|
17
|
+
}
|
|
18
|
+
return (React.createElement("button", 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 }, 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-button", props.className), type: getButtonType(), disabled: getBoolean(props.disabled, "disabled"), "data-icon": (_a = props.iconLeading) !== null && _a !== void 0 ? _a : props.icon, "data-show-icon": getBooleanAsString((_b = props.showIconLeading) !== null && _b !== void 0 ? _b : props.showIcon), "data-icon-trailing": props.iconTrailing, "data-show-icon-trailing": getBooleanAsString(props.showIconTrailing), "data-size": props.size, "data-width": props.width, "data-variant": props.variant, "data-no-text": getBooleanAsString(props.noText), name: props.name, form: props.form, value: props.value }), props.text ? React.createElement(React.Fragment, null, props.text) : React.createElement(React.Fragment, null, props.children)));
|
|
9
19
|
}
|
|
10
20
|
const DBButton = forwardRef(DBButtonFn);
|
|
11
21
|
export default DBButton;
|
|
@@ -1,19 +1,9 @@
|
|
|
1
|
-
import { ClickEventProps,
|
|
1
|
+
import { ClickEventProps, GlobalProps, GlobalState, IconLeadingProps, IconProps, IconTrailingProps, ShowIconLeadingProps, ShowIconProps, ShowIconTrailingProps, SizeProps, TextProps, WidthProps } from '../../shared/model';
|
|
2
2
|
export declare const ButtonVariantList: readonly ["outlined", "brand", "filled", "ghost"];
|
|
3
3
|
export type ButtonVariantType = (typeof ButtonVariantList)[number];
|
|
4
4
|
export declare const ButtonTypeList: readonly ["button", "reset", "submit"];
|
|
5
5
|
export type ButtonTypeType = (typeof ButtonTypeList)[number];
|
|
6
|
-
export declare const ButtonStateList: readonly ["loading"];
|
|
7
|
-
export type ButtonStateType = (typeof ButtonStateList)[number];
|
|
8
6
|
export type DBButtonDefaultProps = {
|
|
9
|
-
/**
|
|
10
|
-
* If the button controls a grouping of other elements, the ariaexpanded state [indicates whether the controlled grouping is currently expanded or collapsed](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-expanded).
|
|
11
|
-
*/
|
|
12
|
-
ariaexpanded?: boolean;
|
|
13
|
-
/**
|
|
14
|
-
* Defines the button as a toggle button. The value of [ariapressed describes the state of the button](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-pressed).
|
|
15
|
-
*/
|
|
16
|
-
ariapressed?: boolean;
|
|
17
7
|
/**
|
|
18
8
|
* The disabled attribute can be set to [keep a user from clicking on the button](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#disabled).
|
|
19
9
|
*/
|
|
@@ -22,10 +12,6 @@ export type DBButtonDefaultProps = {
|
|
|
22
12
|
* Associates the control with a form element
|
|
23
13
|
*/
|
|
24
14
|
form?: string;
|
|
25
|
-
/**
|
|
26
|
-
* The label represents the [aria-label attributes](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label) value of the button
|
|
27
|
-
*/
|
|
28
|
-
label?: string;
|
|
29
15
|
/**
|
|
30
16
|
* The name attribute specifies a [name attributes value](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#name) for the button.
|
|
31
17
|
*/
|
|
@@ -34,10 +20,6 @@ export type DBButtonDefaultProps = {
|
|
|
34
20
|
* Define the text next to the icon specified via the icon Property to get hidden.
|
|
35
21
|
*/
|
|
36
22
|
noText?: boolean | string;
|
|
37
|
-
/**
|
|
38
|
-
* Show loading progress inside button.
|
|
39
|
-
*/
|
|
40
|
-
state?: ButtonStateType;
|
|
41
23
|
/**
|
|
42
24
|
* The type attribute specifies the [type of button](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#type).
|
|
43
25
|
*/
|
|
@@ -51,6 +33,8 @@ export type DBButtonDefaultProps = {
|
|
|
51
33
|
*/
|
|
52
34
|
variant?: ButtonVariantType | string;
|
|
53
35
|
};
|
|
54
|
-
export type DBButtonProps = DBButtonDefaultProps & GlobalProps & ClickEventProps<HTMLButtonElement> & IconProps & WidthProps & SizeProps & ShowIconProps & TextProps;
|
|
55
|
-
export type DBButtonDefaultState = {
|
|
56
|
-
|
|
36
|
+
export type DBButtonProps = DBButtonDefaultProps & GlobalProps & ClickEventProps<HTMLButtonElement> & IconProps & WidthProps & SizeProps & ShowIconProps & TextProps & ShowIconLeadingProps & ShowIconTrailingProps & IconLeadingProps & IconTrailingProps;
|
|
37
|
+
export type DBButtonDefaultState = {
|
|
38
|
+
getButtonType: () => ButtonTypeType;
|
|
39
|
+
};
|
|
40
|
+
export type DBButtonState = DBButtonDefaultState & GlobalState;
|
|
@@ -10,7 +10,7 @@ function DBCardFn(props, component) {
|
|
|
10
10
|
props.onClick(event);
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
|
-
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"]), { 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-card", props.className), "data-behavior": props.behavior, "data-elevation-level": props.elevationLevel, "data-spacing": props.spacing,
|
|
13
|
+
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"]), { 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-card", props.className), "data-behavior": props.behavior, "data-elevation-level": props.elevationLevel, "data-spacing": props.spacing, onClick: (event) => handleClick(event) }), props.children));
|
|
14
14
|
}
|
|
15
15
|
const DBCard = forwardRef(DBCardFn);
|
|
16
16
|
export default DBCard;
|
|
@@ -14,7 +14,7 @@ function DBCheckboxFn(props, component) {
|
|
|
14
14
|
const [_validMessageId, set_validMessageId] = useState(() => undefined);
|
|
15
15
|
const [_invalidMessageId, set_invalidMessageId] = useState(() => undefined);
|
|
16
16
|
const [_invalidMessage, set_invalidMessage] = useState(() => undefined);
|
|
17
|
-
const [_descByIds, set_descByIds] = useState(() =>
|
|
17
|
+
const [_descByIds, set_descByIds] = useState(() => undefined);
|
|
18
18
|
const [_voiceOverFallback, set_voiceOverFallback] = useState(() => "");
|
|
19
19
|
function hasValidState() {
|
|
20
20
|
var _a;
|
|
@@ -46,7 +46,7 @@ function DBCheckboxFn(props, component) {
|
|
|
46
46
|
set_descByIds(_messageId);
|
|
47
47
|
}
|
|
48
48
|
else {
|
|
49
|
-
set_descByIds(
|
|
49
|
+
set_descByIds(undefined);
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
function handleChange(event) {
|
|
@@ -90,6 +90,7 @@ function DBCheckboxFn(props, component) {
|
|
|
90
90
|
if (stringPropVisible(props.message, props.showMessage)) {
|
|
91
91
|
set_descByIds(messageId);
|
|
92
92
|
}
|
|
93
|
+
handleValidation();
|
|
93
94
|
}
|
|
94
95
|
}, [_id]);
|
|
95
96
|
useEffect(() => {
|
|
@@ -34,7 +34,8 @@ function DBCustomSelectFn(props, component) {
|
|
|
34
34
|
const [_placeholderId, set_placeholderId] = useState(() => undefined);
|
|
35
35
|
const [_infoTextId, set_infoTextId] = useState(() => undefined);
|
|
36
36
|
const [_validity, set_validity] = useState(() => "no-validation");
|
|
37
|
-
const [
|
|
37
|
+
const [_userInteraction, set_userInteraction] = useState(() => false);
|
|
38
|
+
const [_descByIds, set_descByIds] = useState(() => undefined);
|
|
38
39
|
const [_selectedLabels, set_selectedLabels] = useState(() => "");
|
|
39
40
|
const [_selectedLabelsId, set_selectedLabelsId] = useState(() => undefined);
|
|
40
41
|
const [_voiceOverFallback, set_voiceOverFallback] = useState(() => "");
|
|
@@ -76,7 +77,9 @@ function DBCustomSelectFn(props, component) {
|
|
|
76
77
|
set_voiceOverFallback(_invalidMessage);
|
|
77
78
|
delay(() => set_voiceOverFallback(""), 1000);
|
|
78
79
|
}
|
|
79
|
-
|
|
80
|
+
if (_userInteraction) {
|
|
81
|
+
set_validity((_c = props.validation) !== null && _c !== void 0 ? _c : "invalid");
|
|
82
|
+
}
|
|
80
83
|
}
|
|
81
84
|
else if (hasValidState() &&
|
|
82
85
|
((_d = selectRef.current) === null || _d === void 0 ? void 0 : _d.validity.valid) &&
|
|
@@ -300,6 +303,7 @@ function DBCustomSelectFn(props, component) {
|
|
|
300
303
|
if (skip)
|
|
301
304
|
return;
|
|
302
305
|
set_values(values);
|
|
306
|
+
set_userInteraction(true);
|
|
303
307
|
if (props.onOptionSelected) {
|
|
304
308
|
props.onOptionSelected(values !== null && values !== void 0 ? values : []);
|
|
305
309
|
}
|
|
@@ -485,7 +489,7 @@ function DBCustomSelectFn(props, component) {
|
|
|
485
489
|
else if (_options) {
|
|
486
490
|
set_hasNoOptions(_options.length === 0);
|
|
487
491
|
}
|
|
488
|
-
}, [props.showNoResults, _options]);
|
|
492
|
+
}, [props.showNoResults, props.showLoading, _options]);
|
|
489
493
|
useEffect(() => {
|
|
490
494
|
var _a;
|
|
491
495
|
setSelectAllEnabled(Boolean(props.multiple && ((_a = props.showSelectAll) !== null && _a !== void 0 ? _a : amountOptions > 5)));
|
|
@@ -503,8 +507,10 @@ function DBCustomSelectFn(props, component) {
|
|
|
503
507
|
}
|
|
504
508
|
}, [props.values]);
|
|
505
509
|
useEffect(() => {
|
|
506
|
-
|
|
507
|
-
|
|
510
|
+
if (selectRef.current) {
|
|
511
|
+
handleValidation();
|
|
512
|
+
}
|
|
513
|
+
}, [_values, selectRef.current]);
|
|
508
514
|
useEffect(() => {
|
|
509
515
|
set_validity(props.validation);
|
|
510
516
|
}, [props.validation]);
|
|
@@ -597,7 +603,7 @@ function DBCustomSelectFn(props, component) {
|
|
|
597
603
|
props.selectedType === "tag" &&
|
|
598
604
|
props.multiple
|
|
599
605
|
? "above"
|
|
600
|
-
: props.variant, "data-required": getBooleanAsString(props.required), "data-hide-asterisk": getHideProp(props.showRequiredAsterisk), "data-placement": props.placement, "data-selected-type": props.multiple ? props.selectedType : "text", "data-hide-label": getHideProp(props.showLabel), "data-icon": props.icon, "data-
|
|
606
|
+
: props.variant, "data-required": getBooleanAsString(props.required), "data-hide-asterisk": getHideProp(props.showRequiredAsterisk), "data-placement": props.placement, "data-selected-type": props.multiple ? props.selectedType : "text", "data-hide-label": getHideProp(props.showLabel), "data-icon": props.icon, "data-show-icon": getBooleanAsString(props.showIcon) }),
|
|
601
607
|
React.createElement("label", { id: _labelId }, (_a = props.label) !== null && _a !== void 0 ? _a : DEFAULT_LABEL,
|
|
602
608
|
React.createElement("select", { role: "none", hidden: true, id: _selectId, tabIndex: -1, ref: selectRef, form: props.form, name: props.name, multiple: getBoolean(props.multiple, "multiple"), disabled: getBoolean(props.disabled, "disabled"), required: getBoolean(props.required, "required"), onChange: (event) => satisfyReact(event) }, ((_b = props.options) === null || _b === void 0 ? void 0 : _b.length) ? (React.createElement(React.Fragment, null, (_c = props.options) === null || _c === void 0 ? void 0 : _c.map((option) => (React.createElement("option", { disabled: option.disabled, value: option.value, key: getOptionKey(option, "native-select-option-") }, getOptionLabel(option)))))) : null)),
|
|
603
609
|
React.createElement("details", { ref: detailsRef, open: props.open, onToggle: (event) => handleDropdownToggle(event), onKeyDown: (event) => handleKeyboardPress(event) },
|
|
@@ -611,7 +617,9 @@ function DBCustomSelectFn(props, component) {
|
|
|
611
617
|
React.createElement(DBInput, { type: "search", ref: searchInputRef, name: _id, form: _id, showLabel: false, value: _searchValue, label: (_d = props.searchLabel) !== null && _d !== void 0 ? _d : DEFAULT_LABEL, placeholder: (_e = props.searchPlaceholder) !== null && _e !== void 0 ? _e : props.searchLabel, ariaDescribedBy: _hasNoOptions || props.showLoading
|
|
612
618
|
? _infoTextId
|
|
613
619
|
: undefined, onInput: (event) => handleSearch(event) }))) : null,
|
|
614
|
-
_hasNoOptions || props.showLoading ? (React.createElement(DBInfotext, { id: _infoTextId, icon:
|
|
620
|
+
_hasNoOptions || props.showLoading ? (React.createElement(DBInfotext, { id: _infoTextId, icon: props.showLoading ? "circular_arrows" : undefined, semantic: props.showLoading ? "informational" : "warning" }, (_f = (props.showLoading
|
|
621
|
+
? props.loadingText
|
|
622
|
+
: props.noResultsText)) !== null && _f !== void 0 ? _f : DEFAULT_MESSAGE)) : (React.createElement(React.Fragment, null,
|
|
615
623
|
React.createElement(React.Fragment, null,
|
|
616
624
|
selectAllEnabled ? (React.createElement("div", null,
|
|
617
625
|
React.createElement("div", { className: "db-checkbox db-custom-select-list-item" },
|
|
@@ -190,6 +190,7 @@ export type DBCustomSelectDefaultState = {
|
|
|
190
190
|
_internalChangeTimestamp: number;
|
|
191
191
|
_documentClickListenerCallbackId?: string;
|
|
192
192
|
_searchValue?: string;
|
|
193
|
+
_userInteraction?: boolean;
|
|
193
194
|
getNativeSelectValue: () => string;
|
|
194
195
|
getOptionLabel: (option: CustomSelectOptionType) => string;
|
|
195
196
|
getOptionChecked: (value?: string) => boolean;
|
|
@@ -2,7 +2,7 @@
|
|
|
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 { cls, getBoolean, getBooleanAsString,
|
|
5
|
+
import { cls, getBoolean, getBooleanAsString, uuid } from "../../utils";
|
|
6
6
|
function DBCustomSelectListItemFn(props, component) {
|
|
7
7
|
const _ref = component || useRef(component);
|
|
8
8
|
const [_id, set_id] = useState(() => undefined);
|
|
@@ -13,7 +13,7 @@ function DBCustomSelectListItemFn(props, component) {
|
|
|
13
13
|
props.onChange(event);
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
-
function
|
|
16
|
+
function getIconTrailing() {
|
|
17
17
|
if (props.isGroupTitle || props.type === "checkbox") {
|
|
18
18
|
return;
|
|
19
19
|
}
|
|
@@ -29,7 +29,7 @@ function DBCustomSelectListItemFn(props, component) {
|
|
|
29
29
|
return (React.createElement("li", 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-custom-select-list-item", props.className, {
|
|
30
30
|
"db-checkbox": props.type === "checkbox" && !props.isGroupTitle,
|
|
31
31
|
"db-radio": props.type !== "checkbox" && !props.isGroupTitle,
|
|
32
|
-
}), "data-divider": getBooleanAsString(hasDivider) }), !props.isGroupTitle ? (React.createElement("label", { "data-icon": props.type !== "checkbox" && props.icon ? props.icon : undefined, "data-
|
|
32
|
+
}), "data-divider": getBooleanAsString(hasDivider) }), !props.isGroupTitle ? (React.createElement("label", { "data-icon": props.type !== "checkbox" && props.icon ? props.icon : undefined, "data-show-icon": getBooleanAsString(props.showIcon), "data-icon-trailing": getIconTrailing() },
|
|
33
33
|
React.createElement("input", { className: "db-custom-select-list-item-checkbox", "data-disable-focus": "true", type: props.type, name: props.name, form: props.name, checked: getBoolean(props.checked, "checked"), disabled: getBoolean(props.disabled, "disabled"), value: props.value, onChange: (event) => handleChange(event) }),
|
|
34
34
|
props.label ? React.createElement(React.Fragment, null, props.label) : React.createElement(React.Fragment, null, props.children))) : (React.createElement("span", null, props.groupTitle))));
|
|
35
35
|
}
|
|
@@ -23,7 +23,7 @@ export type DBCustomSelectListItemDefaultProps = {
|
|
|
23
23
|
};
|
|
24
24
|
export type DBCustomSelectListItemProps = DBCustomSelectListItemDefaultProps & GlobalProps & BaseFormProps & ValueProps & FormCheckProps & ChangeEventProps<HTMLInputElement> & DBCustomSelectListItemExtraProps;
|
|
25
25
|
export type DBCustomSelectListItemDefaultState = {
|
|
26
|
-
|
|
26
|
+
getIconTrailing: () => string | undefined;
|
|
27
27
|
hasDivider?: boolean;
|
|
28
28
|
};
|
|
29
29
|
export type DBCustomSelectListItemState = DBCustomSelectListItemDefaultState & ChangeEventState<HTMLInputElement> & GlobalState;
|
|
@@ -2,15 +2,14 @@
|
|
|
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 { DEFAULT_BURGER_MENU
|
|
6
|
-
import { addAttributeToChildren, cls, getBoolean
|
|
5
|
+
import { DEFAULT_BURGER_MENU } from "../../shared/constants";
|
|
6
|
+
import { addAttributeToChildren, cls, getBoolean } from "../../utils";
|
|
7
7
|
import { isEventTargetNavigationItem } from "../../utils/navigation";
|
|
8
8
|
import DBButton from "../button/button";
|
|
9
9
|
import DBDrawer from "../drawer/drawer";
|
|
10
10
|
function DBHeaderFn(props, component) {
|
|
11
11
|
var _a;
|
|
12
12
|
const _ref = component || useRef(component);
|
|
13
|
-
const [_id, set_id] = useState(() => DEFAULT_ID);
|
|
14
13
|
const [initialized, setInitialized] = useState(() => false);
|
|
15
14
|
const [forcedToMobile, setForcedToMobile] = useState(() => false);
|
|
16
15
|
function handleToggle(event) {
|
|
@@ -29,23 +28,19 @@ function DBHeaderFn(props, component) {
|
|
|
29
28
|
}
|
|
30
29
|
useEffect(() => {
|
|
31
30
|
setInitialized(true);
|
|
32
|
-
set_id(props.id || "header-" + uuid());
|
|
33
31
|
}, []);
|
|
34
32
|
useEffect(() => {
|
|
35
|
-
if (initialized &&
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
value: "true",
|
|
43
|
-
});
|
|
44
|
-
}
|
|
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
|
+
});
|
|
45
40
|
setForcedToMobile(true);
|
|
46
41
|
}
|
|
47
|
-
}, [initialized]);
|
|
48
|
-
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:
|
|
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 }),
|
|
49
44
|
React.createElement(DBDrawer, { className: "db-header-drawer", spacing: "small", rounded: true, open: getBoolean(props.drawerOpen), onClose: (event) => handleToggle() },
|
|
50
45
|
React.createElement("div", { className: "db-header-drawer-navigation" },
|
|
51
46
|
React.createElement("div", { className: "db-header-navigation", onClick: (event) => handleNavigationItemClick(event) }, props.children),
|
|
@@ -64,7 +59,7 @@ function DBHeaderFn(props, component) {
|
|
|
64
59
|
React.createElement(React.Fragment, null, props.primaryAction))),
|
|
65
60
|
React.createElement("div", { className: "db-header-action-container" },
|
|
66
61
|
React.createElement("div", { className: "db-header-burger-menu-container" },
|
|
67
|
-
React.createElement(DBButton, { icon: "menu", variant: "ghost",
|
|
62
|
+
React.createElement(DBButton, { icon: "menu", variant: "ghost", noText: true, onClick: (event) => handleToggle() }, (_a = props.burgerMenuLabel) !== null && _a !== void 0 ? _a : DEFAULT_BURGER_MENU)),
|
|
68
63
|
React.createElement("div", { className: "db-header-secondary-action" },
|
|
69
64
|
React.createElement(React.Fragment, null, props.secondaryAction))))));
|
|
70
65
|
}
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { filterPassingProps, getRootProps } from "../../utils/react";
|
|
4
4
|
import { useRef, forwardRef } from "react";
|
|
5
|
-
import { cls,
|
|
5
|
+
import { cls, getBooleanAsString } from "../../utils";
|
|
6
6
|
function DBInfotextFn(props, component) {
|
|
7
7
|
var _a;
|
|
8
8
|
const _ref = component || useRef(component);
|
|
9
|
-
return (React.createElement("span", 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 }, 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-infotext", props.className), "data-icon": props.icon, "data-semantic": props.semantic, "data-size": props.size, "data-
|
|
9
|
+
return (React.createElement("span", 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 }, 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-infotext", props.className), "data-icon": props.icon, "data-semantic": props.semantic, "data-size": props.size, "data-show-icon-leading": getBooleanAsString((_a = props.showIcon) !== null && _a !== void 0 ? _a : true) }), props.text ? React.createElement(React.Fragment, null, props.text) : React.createElement(React.Fragment, null, props.children)));
|
|
10
10
|
}
|
|
11
11
|
const DBInfotext = forwardRef(DBInfotextFn);
|
|
12
12
|
export default DBInfotext;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
declare const DBInput: React.ForwardRefExoticComponent<Omit<React.InputHTMLAttributes<any>, "value" | "size" | "icon" | keyof import("../../shared/model").GlobalProps | "showIcon" | 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
|
|
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>>;
|
|
3
3
|
export default DBInput;
|
|
@@ -3,10 +3,10 @@ import * as React from "react";
|
|
|
3
3
|
import { filterPassingProps, getRootProps } from "../../utils/react";
|
|
4
4
|
import { useState, useRef, useEffect, forwardRef } from "react";
|
|
5
5
|
import { DEFAULT_DATALIST_ID_SUFFIX, DEFAULT_INVALID_MESSAGE, DEFAULT_INVALID_MESSAGE_ID_SUFFIX, DEFAULT_LABEL, DEFAULT_MESSAGE_ID_SUFFIX, DEFAULT_PLACEHOLDER, DEFAULT_VALID_MESSAGE, DEFAULT_VALID_MESSAGE_ID_SUFFIX, } from "../../shared/constants";
|
|
6
|
-
import { cls, delay, getBoolean, getHideProp, getInputValue, getNumber, hasVoiceOver, isArrayOfStrings, stringPropVisible, uuid, } from "../../utils";
|
|
6
|
+
import { cls, delay, getBoolean, getBooleanAsString, getHideProp, getInputValue, getNumber, hasVoiceOver, isArrayOfStrings, stringPropVisible, uuid, } from "../../utils";
|
|
7
7
|
import DBInfotext from "../infotext/infotext";
|
|
8
8
|
function DBInputFn(props, component) {
|
|
9
|
-
var _a, _b, _c, _d;
|
|
9
|
+
var _a, _b, _c, _d, _e, _f;
|
|
10
10
|
const _ref = component || useRef(component);
|
|
11
11
|
const [_id, set_id] = useState(() => undefined);
|
|
12
12
|
const [_messageId, set_messageId] = useState(() => undefined);
|
|
@@ -14,8 +14,8 @@ function DBInputFn(props, component) {
|
|
|
14
14
|
const [_invalidMessageId, set_invalidMessageId] = useState(() => undefined);
|
|
15
15
|
const [_invalidMessage, set_invalidMessage] = useState(() => undefined);
|
|
16
16
|
const [_dataListId, set_dataListId] = useState(() => undefined);
|
|
17
|
-
const [_descByIds, set_descByIds] = useState(() =>
|
|
18
|
-
const [_value, set_value] = useState(() =>
|
|
17
|
+
const [_descByIds, set_descByIds] = useState(() => undefined);
|
|
18
|
+
const [_value, set_value] = useState(() => undefined);
|
|
19
19
|
const [_voiceOverFallback, set_voiceOverFallback] = useState(() => "");
|
|
20
20
|
function hasValidState() {
|
|
21
21
|
var _a;
|
|
@@ -47,7 +47,7 @@ function DBInputFn(props, component) {
|
|
|
47
47
|
set_descByIds(_messageId);
|
|
48
48
|
}
|
|
49
49
|
else {
|
|
50
|
-
set_descByIds(
|
|
50
|
+
set_descByIds(undefined);
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
function handleInput(event) {
|
|
@@ -108,16 +108,17 @@ function DBInputFn(props, component) {
|
|
|
108
108
|
if (stringPropVisible(props.message, props.showMessage)) {
|
|
109
109
|
set_descByIds(messageId);
|
|
110
110
|
}
|
|
111
|
+
handleValidation();
|
|
111
112
|
}
|
|
112
113
|
}, [_id]);
|
|
113
114
|
useEffect(() => {
|
|
114
115
|
set_value(props.value);
|
|
115
116
|
}, [props.value]);
|
|
116
|
-
return (React.createElement("div", Object.assign({}, 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-input", props.className), "data-variant": props.variant, "data-hide-label": getHideProp(props.showLabel), "data-
|
|
117
|
-
React.createElement("label", { htmlFor: _id }, (
|
|
118
|
-
React.createElement("input", Object.assign({ "aria-invalid": props.validation === "invalid", "data-custom-validity": props.validation, "data-field-sizing": props.fieldSizing, 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, name: props.name, type: props.type || "text", placeholder: (
|
|
119
|
-
getBoolean(props.readonly, "readonly"), form: props.form, pattern: props.pattern, size: props.size, autoComplete: props.autocomplete, autoFocus: getBoolean(props.autofocus, "autofocus"), onInput: (event) => handleInput(event), onChange: (event) => handleChange(event), onBlur: (event) => handleBlur(event), onFocus: (event) => handleFocus(event), list: props.dataList && _dataListId, "aria-describedby": (
|
|
120
|
-
props.dataList ? (React.createElement("datalist", { id: _dataListId }, (
|
|
117
|
+
return (React.createElement("div", Object.assign({}, 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-input", props.className), "data-variant": props.variant, "data-hide-label": getHideProp(props.showLabel), "data-show-icon": getBooleanAsString((_a = props.showIconLeading) !== null && _a !== void 0 ? _a : props.showIcon), "data-icon": (_b = props.iconLeading) !== null && _b !== void 0 ? _b : props.icon, "data-icon-trailing": props.iconTrailing, "data-hide-asterisk": getHideProp(props.showRequiredAsterisk), "data-show-icon-trailing": getBooleanAsString(props.showIconTrailing) }),
|
|
118
|
+
React.createElement("label", { htmlFor: _id }, (_c = props.label) !== null && _c !== void 0 ? _c : DEFAULT_LABEL),
|
|
119
|
+
React.createElement("input", Object.assign({ "aria-invalid": props.validation === "invalid", "data-custom-validity": props.validation, "data-field-sizing": props.fieldSizing, 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, name: props.name, type: props.type || "text", multiple: getBoolean(props.multiple, "multiple"), placeholder: (_d = props.placeholder) !== null && _d !== void 0 ? _d : DEFAULT_PLACEHOLDER, disabled: getBoolean(props.disabled, "disabled"), required: getBoolean(props.required, "required"), step: getNumber(props.step), value: props.value, maxLength: getNumber(props.maxLength, props.maxlength), minLength: getNumber(props.minLength, props.minlength), max: getInputValue(props.max, props.type), min: getInputValue(props.min, props.type), readOnly: getBoolean(props.readOnly, "readOnly") ||
|
|
120
|
+
getBoolean(props.readonly, "readonly"), form: props.form, pattern: props.pattern, size: props.size, autoComplete: props.autocomplete, autoFocus: getBoolean(props.autofocus, "autofocus"), onInput: (event) => handleInput(event), onChange: (event) => handleChange(event), onBlur: (event) => handleBlur(event), onFocus: (event) => handleFocus(event), list: props.dataList && _dataListId, "aria-describedby": (_e = props.ariaDescribedBy) !== null && _e !== void 0 ? _e : _descByIds })),
|
|
121
|
+
props.dataList ? (React.createElement("datalist", { id: _dataListId }, (_f = getDataList()) === null || _f === void 0 ? void 0 : _f.map((option) => (React.createElement("option", { key: _dataListId + "-option-" + option.value, value: option.value }, option.label))))) : null,
|
|
121
122
|
props.children,
|
|
122
123
|
stringPropVisible(props.message, props.showMessage) ? (React.createElement(DBInfotext, { size: "small", icon: props.messageIcon, id: _messageId }, props.message)) : null,
|
|
123
124
|
hasValidState() ? (React.createElement(DBInfotext, { size: "small", semantic: "successful", id: _validMessageId }, props.validMessage || DEFAULT_VALID_MESSAGE)) : null,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChangeEventProps, ChangeEventState, FocusEventProps, FocusEventState, FormMessageProps, FormProps, FormSizeProps, FormState, FormTextProps, FromValidState, GlobalProps, GlobalState,
|
|
1
|
+
import { ChangeEventProps, ChangeEventState, FocusEventProps, FocusEventState, FormMessageProps, FormProps, FormSizeProps, FormState, FormTextProps, FromValidState, GlobalProps, GlobalState, IconLeadingProps, IconProps, IconTrailingProps, InputEventProps, InputEventState, ShowIconLeadingProps, ShowIconProps, ShowIconTrailingProps, ValueLabelType } from '../../shared/model';
|
|
2
2
|
export declare const InputTypeList: readonly ["color", "date", "datetime-local", "email", "file", "hidden", "month", "number", "password", "range", "search", "tel", "text", "time", "url", "week"];
|
|
3
3
|
export type InputTypeType = (typeof InputTypeList)[number];
|
|
4
4
|
export type DBInputDefaultProps = {
|
|
@@ -10,6 +10,10 @@ export type DBInputDefaultProps = {
|
|
|
10
10
|
* Add a custom id to [data list](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/datalist) if you're using `dataList` attribute.
|
|
11
11
|
*/
|
|
12
12
|
dataListId?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Allow selecting multiple files. https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input/file#multiple
|
|
15
|
+
*/
|
|
16
|
+
multiple?: boolean | string;
|
|
13
17
|
/**
|
|
14
18
|
* Maximum value
|
|
15
19
|
*/
|
|
@@ -31,7 +35,7 @@ export type DBInputDefaultProps = {
|
|
|
31
35
|
*/
|
|
32
36
|
step?: number | string;
|
|
33
37
|
};
|
|
34
|
-
export type DBInputProps = DBInputDefaultProps & GlobalProps & FormTextProps & InputEventProps<HTMLInputElement> & ChangeEventProps<HTMLInputElement> & FocusEventProps<HTMLInputElement> & FormProps & IconProps &
|
|
38
|
+
export type DBInputProps = DBInputDefaultProps & GlobalProps & FormTextProps & InputEventProps<HTMLInputElement> & ChangeEventProps<HTMLInputElement> & FocusEventProps<HTMLInputElement> & FormProps & IconProps & IconTrailingProps & FormMessageProps & ShowIconProps & IconLeadingProps & ShowIconLeadingProps & ShowIconTrailingProps & FormSizeProps;
|
|
35
39
|
export type DBInputDefaultState = {
|
|
36
40
|
_dataListId?: string;
|
|
37
41
|
getDataList: () => ValueLabelType[];
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
declare const DBLink: React.ForwardRefExoticComponent<Omit<React.AnchorHTMLAttributes<any>, "text" | "onClick" | keyof import("../..").GlobalProps | "showIcon" | keyof import("./model").DBLinkDefaultProps | keyof import("../..").LinkProps> & import("./model").DBLinkDefaultProps & import("../..").GlobalProps & import("../..").ClickEventProps<HTMLAnchorElement> & import("../..").LinkProps & import("../..").ShowIconProps & import("../..").TextProps & React.RefAttributes<any>>;
|
|
2
|
+
declare const DBLink: React.ForwardRefExoticComponent<Omit<React.AnchorHTMLAttributes<any>, "text" | "wrap" | "onClick" | keyof import("../..").GlobalProps | "showIcon" | keyof import("./model").DBLinkDefaultProps | keyof import("../..").LinkProps> & import("./model").DBLinkDefaultProps & import("../..").GlobalProps & import("../..").ClickEventProps<HTMLAnchorElement> & import("../..").LinkProps & import("../..").ShowIconProps & import("../..").TextProps & import("../..").WrapProps & React.RefAttributes<any>>;
|
|
3
3
|
export default DBLink;
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { filterPassingProps, getRootProps } from "../../utils/react";
|
|
4
4
|
import { useRef, forwardRef } from "react";
|
|
5
|
-
import { cls, getBooleanAsString
|
|
5
|
+
import { cls, getBooleanAsString } from "../../utils";
|
|
6
6
|
function DBLinkFn(props, component) {
|
|
7
7
|
var _a;
|
|
8
8
|
const _ref = component || useRef(component);
|
|
9
|
-
return (React.createElement("a", 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 }, 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-link", props.className), href: props.href, target: props.target, rel: props.rel, role: props.role, hrefLang: props.hreflang, "aria-disabled": getBooleanAsString(props.disabled), tabIndex: props.disabled ? -1 : 0, "
|
|
9
|
+
return (React.createElement("a", 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 }, 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-link", props.className), href: props.href, target: props.target, rel: props.rel, role: props.role, hrefLang: props.hreflang, "aria-disabled": getBooleanAsString(props.disabled), tabIndex: props.disabled ? -1 : 0, "data-size": props.size, "data-show-icon-trailing": getBooleanAsString((_a = props.showIcon) !== null && _a !== void 0 ? _a : true), "data-variant": props.variant, "data-content": props.content || "internal", "data-wrap": getBooleanAsString(props.wrap) }), props.text ? React.createElement(React.Fragment, null, props.text) : React.createElement(React.Fragment, null, props.children)));
|
|
10
10
|
}
|
|
11
11
|
const DBLink = forwardRef(DBLinkFn);
|
|
12
12
|
export default DBLink;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ClickEventProps, ClickEventState, GlobalProps, GlobalState, LinkProps, ShowIconProps, TextProps } from '../../shared/model';
|
|
2
|
-
export declare const LinkVariantList: readonly ["adaptive", "brand"];
|
|
1
|
+
import { ClickEventProps, ClickEventState, GlobalProps, GlobalState, LinkProps, ShowIconProps, TextProps, WrapProps } from '../../shared/model';
|
|
2
|
+
export declare const LinkVariantList: readonly ["adaptive", "brand", "inline"];
|
|
3
3
|
export type LinkVariantType = (typeof LinkVariantList)[number];
|
|
4
4
|
export declare const LinkSizeList: readonly ["medium", "small"];
|
|
5
5
|
export type LinkSizeType = (typeof LinkSizeList)[number];
|
|
@@ -19,6 +19,6 @@ export type DBLinkDefaultProps = {
|
|
|
19
19
|
*/
|
|
20
20
|
variant?: LinkVariantType;
|
|
21
21
|
};
|
|
22
|
-
export type DBLinkProps = DBLinkDefaultProps & GlobalProps & ClickEventProps<HTMLAnchorElement> & LinkProps & ShowIconProps & TextProps;
|
|
22
|
+
export type DBLinkProps = DBLinkDefaultProps & GlobalProps & ClickEventProps<HTMLAnchorElement> & LinkProps & ShowIconProps & TextProps & WrapProps;
|
|
23
23
|
export type DBLinkDefaultState = {};
|
|
24
24
|
export type DBLinkState = DBLinkDefaultState & GlobalState & ClickEventState<HTMLAnchorElement>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { GlobalProps, GlobalState } from '../../shared/model';
|
|
2
2
|
export type DBNavigationDefaultProps = {};
|
|
3
|
-
export type DBNavigationProps = DBNavigationDefaultProps & GlobalProps
|
|
3
|
+
export type DBNavigationProps = DBNavigationDefaultProps & GlobalProps;
|
|
4
4
|
export type DBNavigationDefaultState = {};
|
|
5
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>, keyof import("../..").GlobalProps
|
|
2
|
+
declare const DBNavigation: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<any>, keyof import("../..").GlobalProps> & import("../..").GlobalProps & React.RefAttributes<any>>;
|
|
3
3
|
export default DBNavigation;
|
|
@@ -10,7 +10,7 @@ function DBNavigationFn(props, component) {
|
|
|
10
10
|
useEffect(() => {
|
|
11
11
|
set_id(props.id || "navigation-" + uuid());
|
|
12
12
|
}, []);
|
|
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
|
|
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
14
|
React.createElement("menu", null, props.children)));
|
|
15
15
|
}
|
|
16
16
|
const DBNavigation = forwardRef(DBNavigationFn);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ClickEvent, ClickEventProps, ClickEventState, GlobalProps, GlobalState, IconProps, InitializedState, NavigationBackButtonProps, NavigationBehaviorState, ShowIconProps, TextProps, WidthProps } from '../../shared/model';
|
|
1
|
+
import { ClickEvent, ClickEventProps, ClickEventState, GlobalProps, GlobalState, IconProps, InitializedState, NavigationBackButtonProps, NavigationBehaviorState, ShowIconProps, TextProps, WidthProps, WrapProps } from '../../shared/model';
|
|
2
2
|
import { NavigationItemSafeTriangle } from '../../utils/navigation';
|
|
3
3
|
export type DBNavigationItemDefaultProps = {
|
|
4
4
|
/**
|
|
@@ -17,12 +17,8 @@ export type DBNavigationItemDefaultProps = {
|
|
|
17
17
|
* This is for mobile navigation only, if it is set the sub-navigation is a static overlay
|
|
18
18
|
*/
|
|
19
19
|
subNavigationExpanded?: boolean | string;
|
|
20
|
-
/**
|
|
21
|
-
* Determines whether the text should wrap when its parent container is too small, preventing overflow.
|
|
22
|
-
*/
|
|
23
|
-
wrap?: boolean | string;
|
|
24
20
|
};
|
|
25
|
-
export type DBNavigationItemProps = DBNavigationItemDefaultProps & GlobalProps & ClickEventProps<HTMLButtonElement> & IconProps & WidthProps & NavigationBackButtonProps & ShowIconProps & TextProps;
|
|
21
|
+
export type DBNavigationItemProps = DBNavigationItemDefaultProps & GlobalProps & ClickEventProps<HTMLButtonElement> & IconProps & WidthProps & WrapProps & NavigationBackButtonProps & ShowIconProps & TextProps;
|
|
26
22
|
export type DBNavigationItemDefaultState = {
|
|
27
23
|
handleBackClick: (event: ClickEvent<HTMLButtonElement>) => void;
|
|
28
24
|
hasAreaPopup: boolean;
|