@db-ux/react-core-components 4.4.3 → 4.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/dist/components/accordion/accordion.js +3 -3
- package/dist/components/accordion-item/accordion-item.d.ts +1 -1
- package/dist/components/accordion-item/accordion-item.js +2 -1
- package/dist/components/badge/badge.d.ts +1 -1
- package/dist/components/badge/badge.js +3 -3
- package/dist/components/badge/model.d.ts +2 -2
- package/dist/components/brand/brand.d.ts +1 -1
- package/dist/components/brand/brand.js +2 -2
- package/dist/components/button/button.d.ts +1 -1
- package/dist/components/button/button.js +2 -2
- package/dist/components/button/model.d.ts +8 -10
- package/dist/components/card/card.js +2 -1
- package/dist/components/checkbox/checkbox.js +15 -6
- package/dist/components/custom-button/custom-button.d.ts +3 -0
- package/dist/components/custom-button/custom-button.js +12 -0
- package/dist/components/custom-button/index.d.ts +1 -0
- package/dist/components/custom-button/index.js +1 -0
- package/dist/components/custom-button/model.d.ts +6 -0
- package/dist/components/custom-button/model.js +1 -0
- package/dist/components/custom-select/custom-select.js +26 -17
- package/dist/components/custom-select-dropdown/custom-select-dropdown.js +2 -1
- package/dist/components/custom-select-form-field/custom-select-form-field.js +2 -1
- package/dist/components/custom-select-list/custom-select-list.js +2 -1
- package/dist/components/custom-select-list-item/custom-select-list-item.js +2 -1
- package/dist/components/divider/divider.js +2 -1
- package/dist/components/drawer/drawer.js +3 -3
- package/dist/components/header/header.js +3 -3
- package/dist/components/icon/icon.d.ts +1 -1
- package/dist/components/icon/icon.js +2 -1
- package/dist/components/infotext/infotext.d.ts +1 -1
- package/dist/components/infotext/infotext.js +2 -2
- package/dist/components/infotext/model.d.ts +2 -2
- package/dist/components/input/input.js +18 -9
- package/dist/components/link/link.d.ts +1 -1
- package/dist/components/link/link.js +2 -2
- package/dist/components/navigation/navigation.js +2 -1
- package/dist/components/navigation-item/navigation-item.d.ts +1 -1
- package/dist/components/navigation-item/navigation-item.js +3 -3
- package/dist/components/notification/model.d.ts +2 -2
- package/dist/components/notification/notification.d.ts +1 -1
- package/dist/components/notification/notification.js +3 -3
- package/dist/components/page/page.js +2 -1
- package/dist/components/popover/popover.js +3 -3
- package/dist/components/radio/radio.js +12 -2
- package/dist/components/section/section.js +2 -1
- package/dist/components/select/select.js +17 -8
- package/dist/components/stack/stack.js +2 -1
- package/dist/components/switch/switch.js +25 -8
- package/dist/components/tab-item/tab-item.d.ts +1 -1
- package/dist/components/tab-item/tab-item.js +3 -3
- package/dist/components/tab-list/tab-list.js +2 -1
- package/dist/components/tab-panel/tab-panel.js +2 -1
- package/dist/components/tabs/tabs.js +4 -4
- package/dist/components/tag/model.d.ts +2 -6
- package/dist/components/tag/tag.d.ts +1 -1
- package/dist/components/tag/tag.js +2 -2
- package/dist/components/textarea/textarea.js +16 -7
- package/dist/components/tooltip/model.d.ts +3 -3
- package/dist/components/tooltip/tooltip.d.ts +1 -1
- package/dist/components/tooltip/tooltip.js +11 -6
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/shared/model.d.ts +15 -1
- package/dist/utils/index.js +6 -7
- package/package.json +3 -3
|
@@ -4,7 +4,7 @@ import { filterPassingProps, getRootProps } from "../../utils/react";
|
|
|
4
4
|
import { useState, useRef, useEffect, forwardRef } from "react";
|
|
5
5
|
import { cls, getBoolean, getBooleanAsString } from "../../utils";
|
|
6
6
|
function DBTabItemFn(props, component) {
|
|
7
|
-
var _a, _b;
|
|
7
|
+
var _a, _b, _c, _d, _e, _f;
|
|
8
8
|
const _ref = component || useRef(component);
|
|
9
9
|
const [_selected, set_selected] = useState(() => false);
|
|
10
10
|
const [_name, set_name] = useState(() => undefined);
|
|
@@ -69,8 +69,8 @@ function DBTabItemFn(props, component) {
|
|
|
69
69
|
};
|
|
70
70
|
}, []);
|
|
71
71
|
return (React.createElement("li", Object.assign({ role: "none" }, 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", "data-density"]), { className: cls("db-tab-item", props.className) }),
|
|
72
|
-
React.createElement("label", { htmlFor: props.id, "data-icon": (
|
|
73
|
-
React.createElement("input", Object.assign({ type: "radio", role: "tab", disabled: getBoolean(props.disabled, "disabled"), "aria-selected": _selected, checked: getBoolean(props.checked, "checked"), 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-density"]), { name: _name, id: props.id, onInput: (event) => handleChange(event) })),
|
|
72
|
+
React.createElement("label", { htmlFor: (_a = props.id) !== null && _a !== void 0 ? _a : (_b = props.propOverrides) === null || _b === void 0 ? void 0 : _b.id, "data-icon": (_c = props.iconLeading) !== null && _c !== void 0 ? _c : props.icon, "data-icon-trailing": props.iconTrailing, "data-show-icon": getBooleanAsString((_d = props.showIconLeading) !== null && _d !== void 0 ? _d : props.showIcon), "data-show-icon-trailing": getBooleanAsString(props.showIconTrailing), "data-no-text": getBooleanAsString(props.noText) },
|
|
73
|
+
React.createElement("input", Object.assign({ type: "radio", role: "tab", disabled: getBoolean(props.disabled, "disabled"), "aria-selected": _selected, checked: getBoolean(props.checked, "checked"), 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-density"]), { name: _name, id: (_e = props.id) !== null && _e !== void 0 ? _e : (_f = props.propOverrides) === null || _f === void 0 ? void 0 : _f.id, onInput: (event) => handleChange(event) })),
|
|
74
74
|
props.label ? React.createElement(React.Fragment, null, props.label) : null,
|
|
75
75
|
props.children)));
|
|
76
76
|
}
|
|
@@ -4,8 +4,9 @@ import { filterPassingProps, getRootProps } from "../../utils/react";
|
|
|
4
4
|
import { useRef, forwardRef } from "react";
|
|
5
5
|
import { cls } from "../../utils";
|
|
6
6
|
function DBTabListFn(props, component) {
|
|
7
|
+
var _a, _b;
|
|
7
8
|
const _ref = component || useRef(component);
|
|
8
|
-
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-density"]), { 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", "data-density"]), { className: cls("db-tab-list", props.className) }),
|
|
9
|
+
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-density"]), { id: (_a = props.id) !== null && _a !== void 0 ? _a : (_b = props.propOverrides) === null || _b === void 0 ? void 0 : _b.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", "data-density"]), { className: cls("db-tab-list", props.className) }),
|
|
9
10
|
React.createElement("ul", { role: "tablist" }, props.children)));
|
|
10
11
|
}
|
|
11
12
|
const DBTabList = forwardRef(DBTabListFn);
|
|
@@ -4,9 +4,10 @@ import { filterPassingProps, getRootProps } from "../../utils/react";
|
|
|
4
4
|
import { useRef, useEffect, forwardRef } from "react";
|
|
5
5
|
import { cls } from "../../utils";
|
|
6
6
|
function DBTabPanelFn(props, component) {
|
|
7
|
+
var _a, _b;
|
|
7
8
|
const _ref = component || useRef(component);
|
|
8
9
|
useEffect(() => { }, []);
|
|
9
|
-
return (React.createElement("section", Object.assign({ role: "tabpanel", 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-density"]), 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", "data-density"]), { className: cls("db-tab-panel", props.className), id: props.id }),
|
|
10
|
+
return (React.createElement("section", Object.assign({ role: "tabpanel", 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-density"]), 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", "data-density"]), { className: cls("db-tab-panel", props.className), id: (_a = props.id) !== null && _a !== void 0 ? _a : (_b = props.propOverrides) === null || _b === void 0 ? void 0 : _b.id }),
|
|
10
11
|
props.content ? React.createElement(React.Fragment, null, props.content) : null,
|
|
11
12
|
props.children));
|
|
12
13
|
}
|
|
@@ -9,7 +9,7 @@ import DBTabList from "../tab-list/tab-list";
|
|
|
9
9
|
import DBTabPanel from "../tab-panel/tab-panel";
|
|
10
10
|
import { useId } from "react";
|
|
11
11
|
function DBTabsFn(props, component) {
|
|
12
|
-
var _a, _b, _c, _d;
|
|
12
|
+
var _a, _b, _c, _d, _e, _f;
|
|
13
13
|
const uuid = useId();
|
|
14
14
|
const _ref = component || useRef(component);
|
|
15
15
|
const [_name, set_name] = useState(() => "");
|
|
@@ -168,11 +168,11 @@ function DBTabsFn(props, component) {
|
|
|
168
168
|
set_resizeObserver(undefined);
|
|
169
169
|
};
|
|
170
170
|
}, []);
|
|
171
|
-
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-density", "onTabSelect", "onIndexChange"]), { 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", "data-density"]), { className: cls("db-tabs", props.className), "data-orientation": props.orientation, "data-scroll-behavior": props.behavior, "data-alignment": (
|
|
171
|
+
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-density", "onTabSelect", "onIndexChange"]), { id: (_a = props.id) !== null && _a !== void 0 ? _a : (_b = props.propOverrides) === null || _b === void 0 ? void 0 : _b.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", "data-density"]), { className: cls("db-tabs", props.className), "data-orientation": props.orientation, "data-scroll-behavior": props.behavior, "data-alignment": (_c = props.alignment) !== null && _c !== void 0 ? _c : "start", "data-width": (_d = props.width) !== null && _d !== void 0 ? _d : "auto", onInput: (event) => handleChange(event), onChange: (event) => handleChange(event) }),
|
|
172
172
|
showScrollLeft ? (React.createElement(DBButton, { className: "tabs-scroll-left", variant: "ghost", icon: "chevron_left", type: "button", noText: true, onClick: (event) => scroll(true) }, "Scroll left")) : null,
|
|
173
173
|
props.tabs ? (React.createElement(React.Fragment, null,
|
|
174
|
-
React.createElement(DBTabList, null, (
|
|
175
|
-
|
|
174
|
+
React.createElement(DBTabList, null, (_e = convertTabs()) === null || _e === void 0 ? void 0 : _e.map((tab, index) => (React.createElement(DBTabItem, { key: props.name + "tab-item" + index, active: tab.active, label: tab.label, iconTrailing: tab.iconTrailing, icon: tab.icon, noText: tab.noText })))), (_f = convertTabs()) === null || _f === void 0 ? void 0 :
|
|
175
|
+
_f.map((tab, index) => (React.createElement(DBTabPanel, { key: props.name + "tab-panel" + index, content: tab.content }, tab.children))))) : null,
|
|
176
176
|
showScrollRight ? (React.createElement(DBButton, { className: "tabs-scroll-right", variant: "ghost", icon: "chevron_right", type: "button", noText: true, onClick: (event) => scroll() }, "Scroll right")) : null,
|
|
177
177
|
props.children));
|
|
178
178
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ClickEvent, ContentSlotProps, EmphasisProps, GlobalProps, GlobalState, IconProps, OverflowProps, SemanticProps, ShowIconProps } from '../../shared/model';
|
|
1
|
+
import { ClickEvent, ContentSlotProps, EmphasisProps, GlobalProps, GlobalState, IconProps, NoTextProps, OverflowProps, SemanticProps, ShowIconProps } from '../../shared/model';
|
|
2
2
|
export declare const TagBehaviorList: readonly ["static", "removable"];
|
|
3
3
|
export type TagBehaviorType = (typeof TagBehaviorList)[number];
|
|
4
4
|
export type DBTagEventsProps = {
|
|
@@ -18,10 +18,6 @@ export type DBTagDefaultProps = {
|
|
|
18
18
|
* - removable: add a remove button at the end of the tag
|
|
19
19
|
*/
|
|
20
20
|
behavior?: TagBehaviorType | string;
|
|
21
|
-
/**
|
|
22
|
-
* Define the text next to the icon specified via the icon Property to get hidden.
|
|
23
|
-
*/
|
|
24
|
-
noText?: boolean | string;
|
|
25
21
|
/**
|
|
26
22
|
* The removeButton attribute shows the cancel button.
|
|
27
23
|
*/
|
|
@@ -39,7 +35,7 @@ export type DBTagDefaultProps = {
|
|
|
39
35
|
*/
|
|
40
36
|
value?: string;
|
|
41
37
|
};
|
|
42
|
-
export type DBTagProps = DBTagDefaultProps & GlobalProps & IconProps & SemanticProps & OverflowProps & EmphasisProps & ShowIconProps & ContentSlotProps & DBTagEventsProps;
|
|
38
|
+
export type DBTagProps = DBTagDefaultProps & GlobalProps & IconProps & SemanticProps & OverflowProps & EmphasisProps & ShowIconProps & ContentSlotProps & DBTagEventsProps & NoTextProps;
|
|
43
39
|
export type DBTagDefaultState = {
|
|
44
40
|
getRemoveButtonText: () => string;
|
|
45
41
|
handleRemove: (event?: ClickEvent<HTMLButtonElement> | void) => void;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
declare const DBTag: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<any>, "content" |
|
|
2
|
+
declare const DBTag: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<any>, "content" | keyof import("../../shared/model").GlobalProps | "semantic" | "emphasis" | "icon" | "showIcon" | "noText" | keyof import("./model").DBTagDefaultProps | "overflow" | keyof import("./model").DBTagEventsProps> & import("./model").DBTagDefaultProps & import("../../shared/model").GlobalProps & import("../../shared/model").IconProps & import("../../shared/model").SemanticProps & import("../../shared/model").OverflowProps & import("../../shared/model").EmphasisProps & import("../../shared/model").ShowIconProps & import("../../shared/model").ContentSlotProps & import("./model").DBTagEventsProps & import("../../shared/model").NoTextProps & React.RefAttributes<any>>;
|
|
3
3
|
export default DBTag;
|
|
@@ -6,7 +6,7 @@ import { DEFAULT_REMOVE } from "../../shared/constants";
|
|
|
6
6
|
import { cls, getBooleanAsString } from "../../utils";
|
|
7
7
|
import DBTooltip from "../tooltip/tooltip";
|
|
8
8
|
function DBTagFn(props, component) {
|
|
9
|
-
var _a;
|
|
9
|
+
var _a, _b, _c;
|
|
10
10
|
const _ref = component || useRef(component);
|
|
11
11
|
function handleRemove(event) {
|
|
12
12
|
if (!event)
|
|
@@ -23,7 +23,7 @@ function DBTagFn(props, component) {
|
|
|
23
23
|
// TODO: We should think this through again, if we would really like to have default and especially english, instead of german labels in here
|
|
24
24
|
return DEFAULT_REMOVE;
|
|
25
25
|
}
|
|
26
|
-
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-density", "onRemove"]), { 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", "data-density"]), { className: cls("db-tag", props.className), "data-semantic": props.semantic, "data-emphasis": props.emphasis, "data-icon": props.icon, "data-show-check-state": getBooleanAsString((
|
|
26
|
+
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-density", "onRemove"]), { id: (_a = props.id) !== null && _a !== void 0 ? _a : (_b = props.propOverrides) === null || _b === void 0 ? void 0 : _b.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", "data-density"]), { className: cls("db-tag", props.className), "data-semantic": props.semantic, "data-emphasis": props.emphasis, "data-icon": props.icon, "data-show-check-state": getBooleanAsString((_c = props.showCheckState) !== null && _c !== void 0 ? _c : true), "data-show-icon": getBooleanAsString(props.showIcon), "data-no-text": getBooleanAsString(props.noText), "data-overflow": getBooleanAsString(props.overflow) }),
|
|
27
27
|
React.createElement(React.Fragment, null, props.content),
|
|
28
28
|
props.children,
|
|
29
29
|
props.text ? React.createElement(React.Fragment, null, props.text) : null,
|
|
@@ -8,7 +8,7 @@ import { addValueResetEventListener, } from "../../utils/form-components";
|
|
|
8
8
|
import DBInfotext from "../infotext/infotext";
|
|
9
9
|
import { useId } from "react";
|
|
10
10
|
function DBTextareaFn(props, component) {
|
|
11
|
-
var _a, _b, _c, _d;
|
|
11
|
+
var _a, _b, _c, _d, _e;
|
|
12
12
|
const uuid = useId();
|
|
13
13
|
const _ref = component || useRef(component);
|
|
14
14
|
const [_id, set_id] = useState(() => undefined);
|
|
@@ -75,15 +75,24 @@ function DBTextareaFn(props, component) {
|
|
|
75
75
|
props.onFocus(event);
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
|
-
|
|
79
|
-
var _a;
|
|
80
|
-
const mId = (_a = props.id) !== null && _a !== void 0 ? _a : `textarea-${uuid}`;
|
|
78
|
+
function resetIds() {
|
|
79
|
+
var _a, _b, _c;
|
|
80
|
+
const mId = (_c = (_a = props.id) !== null && _a !== void 0 ? _a : (_b = props.propOverrides) === null || _b === void 0 ? void 0 : _b.id) !== null && _c !== void 0 ? _c : `textarea-${uuid}`;
|
|
81
81
|
set_id(mId);
|
|
82
82
|
set_messageId(mId + DEFAULT_MESSAGE_ID_SUFFIX);
|
|
83
83
|
set_validMessageId(mId + DEFAULT_VALID_MESSAGE_ID_SUFFIX);
|
|
84
84
|
set_invalidMessageId(mId + DEFAULT_INVALID_MESSAGE_ID_SUFFIX);
|
|
85
|
+
}
|
|
86
|
+
useEffect(() => {
|
|
87
|
+
resetIds();
|
|
85
88
|
set_invalidMessage(props.invalidMessage || DEFAULT_INVALID_MESSAGE);
|
|
86
89
|
}, []);
|
|
90
|
+
useEffect(() => {
|
|
91
|
+
var _a, _b;
|
|
92
|
+
if ((_a = props.id) !== null && _a !== void 0 ? _a : (_b = props.propOverrides) === null || _b === void 0 ? void 0 : _b.id) {
|
|
93
|
+
resetIds();
|
|
94
|
+
}
|
|
95
|
+
}, [props.id, (_a = props.propOverrides) === null || _a === void 0 ? void 0 : _a.id]);
|
|
87
96
|
useEffect(() => {
|
|
88
97
|
var _a;
|
|
89
98
|
set_invalidMessage(props.invalidMessage ||
|
|
@@ -133,9 +142,9 @@ function DBTextareaFn(props, component) {
|
|
|
133
142
|
};
|
|
134
143
|
}, []);
|
|
135
144
|
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", "data-density"]), { className: cls("db-textarea", props.className), "data-variant": props.variant, "data-hide-asterisk": getHideProp(props.showRequiredAsterisk), "data-hide-label": getHideProp(props.showLabel) }),
|
|
136
|
-
React.createElement("label", { htmlFor: _id }, (
|
|
137
|
-
React.createElement("textarea", 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", "data-density"]), { id: _id, "data-resize": props.resize, "data-hide-resizer": getHideProp((
|
|
138
|
-
getBoolean(props.readonly, "readonly"), form: props.form, maxLength: getNumber(props.maxLength, props.maxlength), minLength: getNumber(props.minLength, props.minlength), name: props.name, wrap: props.wrap, spellCheck: props.spellCheck, autoComplete: props.autocomplete, onInput: (event) => handleInput(event), onChange: (event) => handleChange(event), onBlur: (event) => handleBlur(event), onFocus: (event) => handleFocus(event), value: props.value, "aria-describedby": (
|
|
145
|
+
React.createElement("label", { htmlFor: _id }, (_b = props.label) !== null && _b !== void 0 ? _b : DEFAULT_LABEL),
|
|
146
|
+
React.createElement("textarea", 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", "data-density"]), { id: _id, "data-resize": props.resize, "data-hide-resizer": getHideProp((_c = props.showResizer) !== null && _c !== void 0 ? _c : true), disabled: getBoolean(props.disabled, "disabled"), required: getBoolean(props.required, "required"), readOnly: getBoolean(props.readOnly, "readOnly") ||
|
|
147
|
+
getBoolean(props.readonly, "readonly"), form: props.form, maxLength: getNumber(props.maxLength, props.maxlength), minLength: getNumber(props.minLength, props.minlength), name: props.name, wrap: props.wrap, spellCheck: props.spellCheck, autoComplete: props.autocomplete, onInput: (event) => handleInput(event), onChange: (event) => handleChange(event), onBlur: (event) => handleBlur(event), onFocus: (event) => handleFocus(event), value: props.value, "aria-describedby": (_d = props.ariaDescribedBy) !== null && _d !== void 0 ? _d : _descByIds, placeholder: (_e = props.placeholder) !== null && _e !== void 0 ? _e : DEFAULT_PLACEHOLDER, rows: getNumber(props.rows, DEFAULT_ROWS), cols: getNumber(props.cols) })),
|
|
139
148
|
stringPropVisible(props.message, props.showMessage) ? (React.createElement(DBInfotext, { size: "small", icon: props.messageIcon, id: _messageId }, props.message)) : null,
|
|
140
149
|
hasValidState() ? (React.createElement(DBInfotext, { size: "small", semantic: "successful", id: _validMessageId }, props.validMessage || DEFAULT_VALID_MESSAGE)) : null,
|
|
141
150
|
React.createElement(DBInfotext, { size: "small", semantic: "critical", id: _invalidMessageId }, _invalidMessage),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ClickEventState, DocumentScrollState, EmphasisProps, GlobalProps, GlobalState, InitializedState, PlacementProps, PopoverProps, PopoverState } from '../../shared/model';
|
|
1
|
+
import { ClickEventState, DocumentScrollState, EmphasisProps, GlobalProps, GlobalState, InitializedState, PlacementProps, PopoverProps, PopoverState, ResetIdState, WrapProps } from '../../shared/model';
|
|
2
2
|
export declare const TooltipVariantList: readonly ["description", "label"];
|
|
3
3
|
export type TooltipVariantType = (typeof TooltipVariantList)[number];
|
|
4
4
|
export type DBTooltipDefaultProps = {
|
|
@@ -13,8 +13,8 @@ export type DBTooltipDefaultProps = {
|
|
|
13
13
|
*/
|
|
14
14
|
variant?: TooltipVariantType;
|
|
15
15
|
};
|
|
16
|
-
export type DBTooltipProps = DBTooltipDefaultProps & GlobalProps & EmphasisProps & PlacementProps & PopoverProps;
|
|
16
|
+
export type DBTooltipProps = DBTooltipDefaultProps & GlobalProps & EmphasisProps & PlacementProps & PopoverProps & WrapProps;
|
|
17
17
|
export type DBTooltipDefaultState = {
|
|
18
18
|
getParent: () => HTMLElement;
|
|
19
19
|
};
|
|
20
|
-
export type DBTooltipState = DBTooltipDefaultState & GlobalState & ClickEventState<HTMLElement> & PopoverState & InitializedState & DocumentScrollState;
|
|
20
|
+
export type DBTooltipState = DBTooltipDefaultState & GlobalState & ClickEventState<HTMLElement> & PopoverState & InitializedState & DocumentScrollState & ResetIdState;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
declare const DBTooltip: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<any>, keyof import("../../shared/model").GlobalProps | "placement" | "emphasis" | keyof import("./model").DBTooltipDefaultProps | keyof import("../../shared/model").PopoverProps> & import("./model").DBTooltipDefaultProps & import("../../shared/model").GlobalProps & import("../../shared/model").EmphasisProps & import("../../shared/model").PlacementProps & import("../../shared/model").PopoverProps & React.RefAttributes<any>>;
|
|
2
|
+
declare const DBTooltip: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<any>, keyof import("../../shared/model").GlobalProps | "placement" | "emphasis" | "wrap" | keyof import("./model").DBTooltipDefaultProps | keyof import("../../shared/model").PopoverProps> & import("./model").DBTooltipDefaultProps & import("../../shared/model").GlobalProps & import("../../shared/model").EmphasisProps & import("../../shared/model").PlacementProps & import("../../shared/model").PopoverProps & import("../../shared/model").WrapProps & React.RefAttributes<any>>;
|
|
3
3
|
export default DBTooltip;
|
|
@@ -8,7 +8,7 @@ import { DocumentScrollListener } from "../../utils/document-scroll-listener";
|
|
|
8
8
|
import { handleFixedPopover } from "../../utils/floating-components";
|
|
9
9
|
import { useId } from "react";
|
|
10
10
|
function DBTooltipFn(props, component) {
|
|
11
|
-
var _a, _b;
|
|
11
|
+
var _a, _b, _c;
|
|
12
12
|
const uuid = useId();
|
|
13
13
|
const _ref = component || useRef(component);
|
|
14
14
|
const [_id, set_id] = useState(() => DEFAULT_ID);
|
|
@@ -64,15 +64,20 @@ function DBTooltipFn(props, component) {
|
|
|
64
64
|
handleAutoPlacement(parent);
|
|
65
65
|
_observer === null || _observer === void 0 ? void 0 : _observer.observe(getParent());
|
|
66
66
|
}
|
|
67
|
+
function resetIds() {
|
|
68
|
+
var _a, _b, _c;
|
|
69
|
+
set_id((_c = (_a = props.id) !== null && _a !== void 0 ? _a : (_b = props.propOverrides) === null || _b === void 0 ? void 0 : _b.id) !== null && _c !== void 0 ? _c : "tooltip-" + uuid);
|
|
70
|
+
}
|
|
67
71
|
useEffect(() => {
|
|
68
|
-
|
|
72
|
+
resetIds();
|
|
69
73
|
setInitialized(true);
|
|
70
74
|
}, []);
|
|
71
75
|
useEffect(() => {
|
|
72
|
-
|
|
73
|
-
|
|
76
|
+
var _a, _b;
|
|
77
|
+
if ((_a = props.id) !== null && _a !== void 0 ? _a : (_b = props.propOverrides) === null || _b === void 0 ? void 0 : _b.id) {
|
|
78
|
+
resetIds();
|
|
74
79
|
}
|
|
75
|
-
}, [props.id]);
|
|
80
|
+
}, [props.id, (_a = props.propOverrides) === null || _a === void 0 ? void 0 : _a.id]);
|
|
76
81
|
useEffect(() => {
|
|
77
82
|
if (_ref.current && initialized && _id) {
|
|
78
83
|
const parent = getParent();
|
|
@@ -104,7 +109,7 @@ function DBTooltipFn(props, component) {
|
|
|
104
109
|
setInitialized(false);
|
|
105
110
|
}
|
|
106
111
|
}, [_ref.current, initialized, _id]);
|
|
107
|
-
return (React.createElement("i", Object.assign({ role: "tooltip", "aria-hidden": "true", "data-gap": "true", 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-density"]), 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", "data-density"]), { className: cls("db-tooltip", props.className), id: _id, "data-emphasis": props.emphasis, "data-animation": getBooleanAsString((
|
|
112
|
+
return (React.createElement("i", Object.assign({ role: "tooltip", "aria-hidden": "true", "data-gap": "true", 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-density"]), 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", "data-density"]), { className: cls("db-tooltip", props.className), id: _id, "data-emphasis": props.emphasis, "data-wrap": getBooleanAsString(props.wrap), "data-animation": getBooleanAsString((_b = props.animation) !== null && _b !== void 0 ? _b : true), "data-delay": props.delay, "data-width": props.width, "data-show-arrow": getBooleanAsString((_c = props.showArrow) !== null && _c !== void 0 ? _c : true), "data-placement": props.placement, onClick: (event) => handleClick(event) }), props.children));
|
|
108
113
|
}
|
|
109
114
|
const DBTooltip = forwardRef(DBTooltipFn);
|
|
110
115
|
export default DBTooltip;
|
package/dist/index.d.ts
CHANGED
|
@@ -12,6 +12,8 @@ export * from './components/card';
|
|
|
12
12
|
export * from './components/card/model';
|
|
13
13
|
export * from './components/checkbox';
|
|
14
14
|
export * from './components/checkbox/model';
|
|
15
|
+
export * from './components/custom-button';
|
|
16
|
+
export * from './components/custom-button/model';
|
|
15
17
|
export * from './components/custom-select';
|
|
16
18
|
export * from './components/custom-select-dropdown';
|
|
17
19
|
export * from './components/custom-select-dropdown/model';
|
package/dist/index.js
CHANGED
|
@@ -12,6 +12,8 @@ export * from './components/card';
|
|
|
12
12
|
export * from './components/card/model';
|
|
13
13
|
export * from './components/checkbox';
|
|
14
14
|
export * from './components/checkbox/model';
|
|
15
|
+
export * from './components/custom-button';
|
|
16
|
+
export * from './components/custom-button/model';
|
|
15
17
|
export * from './components/custom-select';
|
|
16
18
|
export * from './components/custom-select-dropdown';
|
|
17
19
|
export * from './components/custom-select-dropdown/model';
|
package/dist/shared/model.d.ts
CHANGED
|
@@ -21,7 +21,12 @@ export interface GlobalProps {
|
|
|
21
21
|
* Before using please check for the [accessibility concerns](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autofocus#accessibility_concerns)
|
|
22
22
|
*/
|
|
23
23
|
autofocus?: boolean | string;
|
|
24
|
+
/**
|
|
25
|
+
* Allows overriding specific props on nested elements or internal component structure.
|
|
26
|
+
*/
|
|
27
|
+
propOverrides?: PropOverridesType;
|
|
24
28
|
}
|
|
29
|
+
export type PropOverridesType = Pick<GlobalProps, 'id'>;
|
|
25
30
|
export type GlobalState = {
|
|
26
31
|
_id?: string;
|
|
27
32
|
};
|
|
@@ -352,6 +357,9 @@ export type FromValidState = {
|
|
|
352
357
|
handleValidation: () => void;
|
|
353
358
|
_invalidMessage?: string;
|
|
354
359
|
};
|
|
360
|
+
export type ResetIdState = {
|
|
361
|
+
resetIds: () => void;
|
|
362
|
+
};
|
|
355
363
|
export type FormState = {
|
|
356
364
|
_messageId?: string;
|
|
357
365
|
_validMessageId?: string;
|
|
@@ -369,7 +377,7 @@ export type FormState = {
|
|
|
369
377
|
* We use this to remove form event listener
|
|
370
378
|
*/
|
|
371
379
|
abortController?: AbortController;
|
|
372
|
-
};
|
|
380
|
+
} & ResetIdState;
|
|
373
381
|
export type InitializedState = {
|
|
374
382
|
initialized: boolean;
|
|
375
383
|
};
|
|
@@ -520,6 +528,12 @@ export type AriaControlsProps = {
|
|
|
520
528
|
*/
|
|
521
529
|
controls?: string;
|
|
522
530
|
};
|
|
531
|
+
export type NoTextProps = {
|
|
532
|
+
/**
|
|
533
|
+
* Define the text next to the icon specified via the icon Property to get hidden.
|
|
534
|
+
*/
|
|
535
|
+
noText?: boolean | string;
|
|
536
|
+
};
|
|
523
537
|
export type ValueLabelType = {
|
|
524
538
|
value: string;
|
|
525
539
|
label?: string;
|
package/dist/utils/index.js
CHANGED
|
@@ -70,15 +70,15 @@ export const getBooleanAsString = (originBool) => {
|
|
|
70
70
|
if (originBool === undefined || originBool === null)
|
|
71
71
|
return;
|
|
72
72
|
if (typeof originBool === 'string') {
|
|
73
|
-
return String(
|
|
73
|
+
return String(originBool === 'true');
|
|
74
74
|
}
|
|
75
75
|
return String(originBool);
|
|
76
76
|
};
|
|
77
77
|
export const getBoolean = (originBool, propertyName) => {
|
|
78
78
|
if (originBool === undefined || originBool === null)
|
|
79
79
|
return;
|
|
80
|
-
if (typeof originBool === 'string'
|
|
81
|
-
return Boolean(propertyName === originBool || originBool);
|
|
80
|
+
if (typeof originBool === 'string') {
|
|
81
|
+
return Boolean(propertyName === originBool || originBool === 'true');
|
|
82
82
|
}
|
|
83
83
|
return Boolean(originBool);
|
|
84
84
|
};
|
|
@@ -119,20 +119,19 @@ export const getStep = (step) => {
|
|
|
119
119
|
export const getInputValue = (value, inputType) => {
|
|
120
120
|
return inputType && ['number', 'range'].includes(inputType) ? getNumber(value) : value;
|
|
121
121
|
};
|
|
122
|
+
const toBool = (value) => typeof value === 'string' ? value === 'true' : value;
|
|
122
123
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
123
124
|
export const getHideProp = (show) => {
|
|
124
125
|
if (show === undefined || show === null) {
|
|
125
126
|
return undefined;
|
|
126
127
|
}
|
|
127
|
-
return getBooleanAsString(!
|
|
128
|
+
return getBooleanAsString(!toBool(show));
|
|
128
129
|
};
|
|
129
130
|
export const stringPropVisible = (givenString, showString) => {
|
|
130
131
|
if (showString === undefined) {
|
|
131
132
|
return !!givenString;
|
|
132
133
|
}
|
|
133
|
-
|
|
134
|
-
return Boolean(showString) && Boolean(givenString);
|
|
135
|
-
}
|
|
134
|
+
return toBool(showString) && Boolean(givenString);
|
|
136
135
|
};
|
|
137
136
|
export const getSearchInput = (element) => element.querySelector(`input[type="search"]`);
|
|
138
137
|
export const getOptionKey = (option, prefix) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@db-ux/react-core-components",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.5.0",
|
|
4
4
|
"description": "React components for @db-ux/core-components",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
},
|
|
42
42
|
"sideEffects": false,
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@db-ux/core-components": "4.
|
|
45
|
-
"@db-ux/core-foundations": "4.
|
|
44
|
+
"@db-ux/core-components": "4.5.0",
|
|
45
|
+
"@db-ux/core-foundations": "4.5.0"
|
|
46
46
|
}
|
|
47
47
|
}
|