@db-ux/react-core-components 1.0.1 → 1.1.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/README.md +6 -1
- package/dist/components/accordion/accordion.js +2 -1
- package/dist/components/accordion-item/accordion-item.js +3 -2
- package/dist/components/badge/badge.js +2 -1
- package/dist/components/brand/brand.js +2 -1
- package/dist/components/button/button.d.ts +1 -1
- package/dist/components/button/button.js +2 -1
- package/dist/components/card/card.js +2 -1
- package/dist/components/checkbox/checkbox.d.ts +1 -1
- package/dist/components/checkbox/checkbox.js +17 -15
- package/dist/components/divider/divider.js +2 -1
- package/dist/components/drawer/drawer.js +2 -1
- package/dist/components/header/header.js +3 -2
- package/dist/components/icon/icon.js +2 -1
- package/dist/components/infotext/infotext.js +2 -1
- package/dist/components/input/input.d.ts +1 -1
- package/dist/components/input/input.js +3 -2
- package/dist/components/input/model.d.ts +2 -2
- package/dist/components/link/link.d.ts +1 -1
- package/dist/components/link/link.js +2 -1
- package/dist/components/navigation/navigation.js +2 -1
- package/dist/components/navigation-item/model.d.ts +3 -2
- package/dist/components/navigation-item/navigation-item.js +13 -3
- package/dist/components/notification/notification.js +3 -2
- package/dist/components/page/page.js +2 -1
- package/dist/components/popover/popover.js +2 -1
- package/dist/components/radio/radio.d.ts +1 -1
- package/dist/components/radio/radio.js +5 -9
- package/dist/components/section/section.js +2 -1
- package/dist/components/select/model.d.ts +2 -2
- package/dist/components/select/select.d.ts +1 -1
- package/dist/components/select/select.js +3 -2
- package/dist/components/stack/stack.js +2 -1
- package/dist/components/switch/model.d.ts +2 -2
- package/dist/components/switch/switch.d.ts +1 -1
- package/dist/components/switch/switch.js +9 -4
- package/dist/components/tab-item/tab-item.d.ts +1 -1
- package/dist/components/tab-item/tab-item.js +3 -2
- package/dist/components/tab-list/tab-list.js +2 -1
- package/dist/components/tab-panel/tab-panel.js +2 -1
- package/dist/components/tabs/model.d.ts +9 -0
- package/dist/components/tabs/tabs.js +20 -4
- package/dist/components/tag/tag.js +3 -2
- package/dist/components/textarea/textarea.d.ts +1 -1
- package/dist/components/textarea/textarea.js +2 -1
- package/dist/components/tooltip/tooltip.js +2 -1
- package/dist/shared/model.d.ts +6 -0
- package/dist/utils/index.d.ts +0 -4
- package/dist/utils/index.js +0 -11
- package/dist/utils/react.d.ts +7 -0
- package/dist/utils/react.js +15 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -46,6 +46,10 @@ import "@db-ux/core-components/build/styles/rollup.css";
|
|
|
46
46
|
|
|
47
47
|
> **Note:** The `@db-ux/core-components/build/styles/relative` file contains optional and all components styles. If you consider performance issues see [@db-ux/core-components](https://www.npmjs.com/package/@db-ux/core-components) for more information.
|
|
48
48
|
|
|
49
|
+
### DB Theme
|
|
50
|
+
|
|
51
|
+
In case that you're building a website or application for Deutsche Bahn, you'll additionally have to install the DB Theme via the [`@db-ux/db-theme`](https://www.npmjs.com/package/@db-ux/db-theme) node package (even also available as an inner source node package, as described within that packages README).
|
|
52
|
+
|
|
49
53
|
## Usage
|
|
50
54
|
|
|
51
55
|
```tsx
|
|
@@ -60,7 +64,8 @@ import { DBButton } from '@db-ux/react-core-components';
|
|
|
60
64
|
As we'd like to perfectly support our users and customers on their digital journey, the usage of Deutsche Bahn brand and trademarks are bound of clear guidelines and restrictions even when being used with the code that we're provide with this product; Deutsche Bahn fully reserves all rights regarding the Deutsche Bahn brand, even though that we're providing the code of DB UX Design System products free to use and release it under the Apache 2.0 license.
|
|
61
65
|
Please have a look at our brand portal at <https://marketingportal.extranet.deutschebahn.com/> for any further questions and whom to contact on any brand issues.
|
|
62
66
|
|
|
63
|
-
|
|
67
|
+
For any usage outside of Deutsche Bahn websites and applications you aren't allowed to use any Deutsche Bahn brand and
|
|
68
|
+
design assets as well as protected characteristics and trademarks, that for not including the DB Theme.
|
|
64
69
|
|
|
65
70
|
## Contributions
|
|
66
71
|
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import * as React from "react";
|
|
3
|
+
import { filterPassingProps, getRootProps } from "../../utils/react";
|
|
3
4
|
import { useState, useRef, useEffect, forwardRef } from "react";
|
|
4
|
-
import { cls, uuid
|
|
5
|
+
import { cls, uuid } from "../../utils";
|
|
5
6
|
import DBAccordionItem from "../accordion-item/accordion-item";
|
|
6
7
|
import { DEFAULT_ID } from "../../shared/constants";
|
|
7
8
|
function DBAccordionFn(props, component) {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import * as React from "react";
|
|
3
|
+
import { filterPassingProps, getRootProps } from "../../utils/react";
|
|
3
4
|
import { useState, useRef, useEffect, forwardRef } from "react";
|
|
4
|
-
import { cls, getBooleanAsString, uuid
|
|
5
|
+
import { cls, getBooleanAsString, uuid } from "../../utils";
|
|
5
6
|
import { DEFAULT_ID } from "../../shared/constants";
|
|
6
7
|
function DBAccordionItemFn(props, component) {
|
|
7
8
|
const _ref = component || useRef(component);
|
|
@@ -23,7 +24,7 @@ function DBAccordionItemFn(props, component) {
|
|
|
23
24
|
}
|
|
24
25
|
}, []);
|
|
25
26
|
return (React.createElement("li", Object.assign({ 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-accordion-item", props.className) }),
|
|
26
|
-
React.createElement("details", Object.assign({ "aria-disabled": getBooleanAsString(props.disabled), 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"]), { open: _open }),
|
|
27
|
+
React.createElement("details", Object.assign({ "aria-disabled": getBooleanAsString(props.disabled), 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"]), { open: _open }),
|
|
27
28
|
React.createElement("summary", { onClick: (event) => toggle(event) },
|
|
28
29
|
props.headlinePlain ? React.createElement(React.Fragment, null, props.headlinePlain) : null,
|
|
29
30
|
!props.headlinePlain ? React.createElement(React.Fragment, null, props.headline) : null),
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import * as React from "react";
|
|
3
|
+
import { filterPassingProps, getRootProps } from "../../utils/react";
|
|
3
4
|
import { useState, useRef, useEffect, forwardRef } from "react";
|
|
4
|
-
import { cls
|
|
5
|
+
import { cls } from "../../utils";
|
|
5
6
|
import { DEFAULT_LABEL } from "../../shared/constants";
|
|
6
7
|
function DBBadgeFn(props, component) {
|
|
7
8
|
var _a, _b;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import * as React from "react";
|
|
3
|
+
import { filterPassingProps, getRootProps } from "../../utils/react";
|
|
3
4
|
import { useRef, forwardRef } from "react";
|
|
4
|
-
import { cls, getHideProp
|
|
5
|
+
import { cls, getHideProp } from "../../utils";
|
|
5
6
|
import { DEFAULT_ICON } from "../../shared/constants";
|
|
6
7
|
function DBBrandFn(props, component) {
|
|
7
8
|
var _a;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
declare const DBButton: React.ForwardRefExoticComponent<Omit<React.
|
|
2
|
+
declare const DBButton: React.ForwardRefExoticComponent<Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "width" | "text" | "size" | "icon" | "onClick" | keyof import("./model").DBButtonDefaultProps | keyof import("../../shared/model").GlobalProps | "showIcon"> & import("./model").DBButtonDefaultProps & import("../../shared/model").GlobalProps & import("../../shared/model").ClickEventProps<HTMLButtonElement> & import("../../shared/model").IconProps & import("../../shared/model").WidthProps & import("../../shared/model").SizeProps & import("../../shared/model").ShowIconProps & import("../../shared/model").TextProps & React.RefAttributes<HTMLButtonElement>>;
|
|
3
3
|
export default DBButton;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import * as React from "react";
|
|
3
|
+
import { filterPassingProps, getRootProps } from "../../utils/react";
|
|
3
4
|
import { useRef, forwardRef } from "react";
|
|
4
|
-
import { cls, getBooleanAsString, getHideProp
|
|
5
|
+
import { cls, getBooleanAsString, getHideProp } from "../../utils";
|
|
5
6
|
function DBButtonFn(props, component) {
|
|
6
7
|
const _ref = component || useRef(component);
|
|
7
8
|
function handleClick(event) {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import * as React from "react";
|
|
3
|
+
import { filterPassingProps, getRootProps } from "../../utils/react";
|
|
3
4
|
import { useRef, forwardRef } from "react";
|
|
4
|
-
import { cls
|
|
5
|
+
import { cls } from "../../utils";
|
|
5
6
|
function DBCardFn(props, component) {
|
|
6
7
|
const _ref = component || useRef(component);
|
|
7
8
|
function handleClick(event) {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
declare const DBCheckbox: React.ForwardRefExoticComponent<Omit<React.
|
|
2
|
+
declare const DBCheckbox: React.ForwardRefExoticComponent<Omit<React.InputHTMLAttributes<HTMLInputElement>, "size" | "checked" | keyof import("../../shared/model").GlobalProps | "indeterminate" | keyof import("../../shared/model").ChangeEventProps<HTMLInputElement> | keyof import("../../shared/model").FocusEventProps<HTMLInputElement> | keyof import("../../shared/model").FormProps | keyof import("../../shared/model").FormMessageProps> & import("./model").DBCheckboxDefaultProps & import("../../shared/model").GlobalProps & import("../../shared/model").ChangeEventProps<HTMLInputElement> & import("../../shared/model").FocusEventProps<HTMLInputElement> & import("../../shared/model").FormProps & import("../../shared/model").FormCheckProps & import("../../shared/model").FormMessageProps & import("../../shared/model").SizeProps & React.RefAttributes<HTMLInputElement>>;
|
|
3
3
|
export default DBCheckbox;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import * as React from "react";
|
|
3
|
+
import { filterPassingProps, getRootProps } from "../../utils/react";
|
|
3
4
|
import { useState, useRef, useEffect, forwardRef } from "react";
|
|
4
|
-
import { cls, delay, getHideProp, hasVoiceOver, stringPropVisible, uuid, filterPassingProps, getRootProps } from "../../utils";
|
|
5
5
|
import { DEFAULT_INVALID_MESSAGE, DEFAULT_INVALID_MESSAGE_ID_SUFFIX, DEFAULT_MESSAGE_ID_SUFFIX, DEFAULT_VALID_MESSAGE, DEFAULT_VALID_MESSAGE_ID_SUFFIX, } from "../../shared/constants";
|
|
6
6
|
import DBInfotext from "../infotext/infotext";
|
|
7
|
+
import { cls, delay, getHideProp, hasVoiceOver, stringPropVisible, uuid, } from "../../utils";
|
|
7
8
|
function DBCheckboxFn(props, component) {
|
|
8
9
|
var _a, _b, _c, _d;
|
|
9
10
|
const _ref = component || useRef(component);
|
|
@@ -82,22 +83,23 @@ function DBCheckboxFn(props, component) {
|
|
|
82
83
|
}
|
|
83
84
|
}, [_id]);
|
|
84
85
|
useEffect(() => {
|
|
85
|
-
if (
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
//
|
|
89
|
-
|
|
90
|
-
checkboxElement.checked = props.checked;
|
|
91
|
-
}
|
|
92
|
-
if (props.indeterminate !== undefined) {
|
|
93
|
-
// When indeterminate is set, the value of the checked prop only impacts the form submitted values.
|
|
94
|
-
// It has no accessibility or UX implications. (https://mui.com/material-ui/react-checkbox/)
|
|
95
|
-
checkboxElement.indeterminate = props.indeterminate;
|
|
96
|
-
}
|
|
97
|
-
setInitialized(false);
|
|
86
|
+
if (_ref.current) {
|
|
87
|
+
if (props.indeterminate !== undefined) {
|
|
88
|
+
// When indeterminate is set, the value of the checked prop only impacts the form submitted values.
|
|
89
|
+
// It has no accessibility or UX implications. (https://mui.com/material-ui/react-checkbox/)
|
|
90
|
+
_ref.current.indeterminate = props.indeterminate;
|
|
98
91
|
}
|
|
99
92
|
}
|
|
100
|
-
}, [initialized,
|
|
93
|
+
}, [initialized, _ref.current, props.indeterminate]);
|
|
94
|
+
useEffect(() => {
|
|
95
|
+
if (initialized && _ref.current) {
|
|
96
|
+
// in angular this must be set via native element
|
|
97
|
+
if (props.checked != undefined) {
|
|
98
|
+
_ref.current.checked = props.checked;
|
|
99
|
+
}
|
|
100
|
+
setInitialized(false);
|
|
101
|
+
}
|
|
102
|
+
}, [initialized, _ref.current, props.checked]);
|
|
101
103
|
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-checkbox", props.className), "data-size": props.size, "data-hide-label": getHideProp(props.showLabel) }),
|
|
102
104
|
React.createElement("label", { htmlFor: _id },
|
|
103
105
|
React.createElement("input", Object.assign({ type: "checkbox", "aria-invalid": props.validation === "invalid", "data-custom-validity": props.validation, 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, checked: props.checked, disabled: props.disabled, value: props.value, required: props.required, onChange: (event) => handleChange(event), onBlur: (event) => handleBlur(event), onFocus: (event) => handleFocus(event), "aria-describedby": _descByIds })),
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import * as React from "react";
|
|
3
|
+
import { filterPassingProps, getRootProps } from "../../utils/react";
|
|
3
4
|
import { useRef, forwardRef } from "react";
|
|
4
|
-
import { cls
|
|
5
|
+
import { cls } from "../../utils";
|
|
5
6
|
function DBDividerFn(props, component) {
|
|
6
7
|
const _ref = component || useRef(component);
|
|
7
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"]), { id: props.id, "data-margin": props.margin, "data-variant": props.variant, "data-emphasis": props.emphasis, "data-width": props.width }, 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-divider", props.className) })));
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import * as React from "react";
|
|
3
|
+
import { filterPassingProps, getRootProps } from "../../utils/react";
|
|
3
4
|
import { useRef, useEffect, forwardRef } from "react";
|
|
4
5
|
import DBButton from "../button/button";
|
|
5
6
|
import { DEFAULT_CLOSE_BUTTON } from "../../shared/constants";
|
|
6
|
-
import { cls, delay
|
|
7
|
+
import { cls, delay } from "../../utils";
|
|
7
8
|
function DBDrawerFn(props, component) {
|
|
8
9
|
var _a;
|
|
9
10
|
const _ref = component || useRef(component);
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import * as React from "react";
|
|
3
|
+
import { filterPassingProps, getRootProps } from "../../utils/react";
|
|
3
4
|
import { useState, useRef, useEffect, forwardRef } from "react";
|
|
4
|
-
import { addAttributeToChildren, cls, uuid
|
|
5
|
+
import { addAttributeToChildren, cls, uuid } from "../../utils";
|
|
5
6
|
import DBButton from "../button/button";
|
|
6
7
|
import DBDrawer from "../drawer/drawer";
|
|
7
8
|
import { DEFAULT_BURGER_MENU, DEFAULT_ID } from "../../shared/constants";
|
|
@@ -40,7 +41,7 @@ function DBHeaderFn(props, component) {
|
|
|
40
41
|
setForcedToMobile(true);
|
|
41
42
|
}
|
|
42
43
|
}, [initialized]);
|
|
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"]), 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: _id, "data-width": props.width, "data-on-forcing-mobile": props.forceMobile && !forcedToMobile }),
|
|
44
|
+
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: _id, "data-width": props.width, "data-on-forcing-mobile": props.forceMobile && !forcedToMobile }),
|
|
44
45
|
React.createElement(DBDrawer, { className: "db-header-drawer", spacing: "small", rounded: true, open: props.drawerOpen, onClose: () => toggle() },
|
|
45
46
|
React.createElement("div", { className: "db-header-drawer-navigation" },
|
|
46
47
|
React.createElement("div", { className: "db-header-navigation", onClick: (event) => handleNavigationItemClick(event) }, props.children),
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import * as React from "react";
|
|
3
|
+
import { filterPassingProps, getRootProps } from "../../utils/react";
|
|
3
4
|
import { useRef, forwardRef } from "react";
|
|
4
|
-
import { cls
|
|
5
|
+
import { cls } from "../../utils";
|
|
5
6
|
function DBIconFn(props, component) {
|
|
6
7
|
const _ref = component || useRef(component);
|
|
7
8
|
return (React.createElement("span", Object.assign({ "aria-hidden": "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"]), { 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-icon", props.className), "data-icon": props.icon, "data-icon-weight": props.weight, "data-icon-variant": props.variant }), props.text ? React.createElement(React.Fragment, null, props.text) : React.createElement(React.Fragment, null, props.children)));
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import * as React from "react";
|
|
3
|
+
import { filterPassingProps, getRootProps } from "../../utils/react";
|
|
3
4
|
import { useRef, forwardRef } from "react";
|
|
4
|
-
import { cls, getHideProp
|
|
5
|
+
import { cls, getHideProp } from "../../utils";
|
|
5
6
|
function DBInfotextFn(props, component) {
|
|
6
7
|
var _a;
|
|
7
8
|
const _ref = component || useRef(component);
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
declare const DBInput: React.ForwardRefExoticComponent<Omit<React.
|
|
2
|
+
declare const DBInput: React.ForwardRefExoticComponent<Omit<React.InputHTMLAttributes<HTMLInputElement>, "size" | "icon" | keyof import("../../shared/model").GlobalProps | "showIcon" | keyof import("../../shared/model").ChangeEventProps<HTMLInputElement> | keyof import("../../shared/model").FocusEventProps<HTMLInputElement> | keyof import("../../shared/model").FormProps | keyof import("../../shared/model").FormMessageProps | keyof import("./model").DBInputDefaultProps | keyof import("../../shared/model").FormTextProps | keyof import("../../shared/model").InputEventProps<HTMLInputElement> | "iconAfter"> & 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").FormProps & import("../../shared/model").IconProps & import("../../shared/model").IconAfterProps & import("../../shared/model").FormMessageProps & import("../../shared/model").ShowIconProps & import("../../shared/model").FormSizeProps & React.RefAttributes<HTMLInputElement>>;
|
|
3
3
|
export default DBInput;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import * as React from "react";
|
|
3
|
+
import { filterPassingProps, getRootProps } from "../../utils/react";
|
|
3
4
|
import { useState, useRef, useEffect, forwardRef } from "react";
|
|
4
|
-
import { cls, delay, getHideProp, hasVoiceOver, isArrayOfStrings, stringPropVisible, uuid,
|
|
5
|
+
import { cls, delay, getHideProp, hasVoiceOver, isArrayOfStrings, stringPropVisible, uuid, } from "../../utils";
|
|
5
6
|
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
7
|
import DBInfotext from "../infotext/infotext";
|
|
7
8
|
function DBInputFn(props, component) {
|
|
@@ -106,7 +107,7 @@ function DBInputFn(props, component) {
|
|
|
106
107
|
}, [props.value]);
|
|
107
108
|
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-hide-icon": getHideProp(props.showIcon), "data-icon": props.icon, "data-icon-after": props.iconAfter, "data-hide-icon-after": getHideProp(props.showIcon) }),
|
|
108
109
|
React.createElement("label", { htmlFor: _id }, (_a = props.label) !== null && _a !== void 0 ? _a : DEFAULT_LABEL),
|
|
109
|
-
React.createElement("input", Object.assign({ "aria-invalid": props.validation === "invalid", "data-custom-validity": props.validation, 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: (_b = props.placeholder) !== null && _b !== void 0 ? _b : DEFAULT_PLACEHOLDER, disabled: props.disabled, required: props.required, step: props.step, value: props.value, maxLength: props.maxLength, minLength: props.minLength, max: props.max, min: props.min, readOnly: props.readOnly, form: props.form, pattern: props.pattern, autoComplete: props.autocomplete, autoFocus: props.autofocus, onInput: (event) => handleInput(event), onChange: (event) => handleChange(event), onBlur: (event) => handleBlur(event), onFocus: (event) => handleFocus(event), list: props.dataList && _dataListId, "aria-describedby": _descByIds })),
|
|
110
|
+
React.createElement("input", Object.assign({ "aria-invalid": props.validation === "invalid", "data-custom-validity": props.validation, 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: (_b = props.placeholder) !== null && _b !== void 0 ? _b : DEFAULT_PLACEHOLDER, disabled: props.disabled, required: props.required, step: props.step, value: props.value, maxLength: props.maxLength, minLength: props.minLength, max: props.max, min: props.min, readOnly: props.readOnly, form: props.form, pattern: props.pattern, size: props.size, autoComplete: props.autocomplete, autoFocus: props.autofocus, onInput: (event) => handleInput(event), onChange: (event) => handleChange(event), onBlur: (event) => handleBlur(event), onFocus: (event) => handleFocus(event), list: props.dataList && _dataListId, "aria-describedby": _descByIds })),
|
|
110
111
|
props.dataList ? (React.createElement("datalist", { id: _dataListId }, (_c = getDataList(props.dataList)) === null || _c === void 0 ? void 0 : _c.map((option) => (React.createElement("option", { key: _dataListId + "-option-" + option.value, value: option.value }, option.label))))) : null,
|
|
111
112
|
props.children,
|
|
112
113
|
stringPropVisible(props.message, props.showMessage) ? (React.createElement(DBInfotext, { size: "small", icon: props.messageIcon, id: _messageId }, props.message)) : null,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChangeEventProps, ChangeEventState, FocusEventProps, FocusEventState, FormMessageProps, FormProps, FormState, FormTextProps, GlobalProps, GlobalState, IconAfterProps, IconProps, InputEventProps, InputEventState, ShowIconProps, ValueLabelType } from '../../shared/model';
|
|
1
|
+
import { ChangeEventProps, ChangeEventState, FocusEventProps, FocusEventState, FormMessageProps, FormProps, FormSizeProps, FormState, FormTextProps, GlobalProps, GlobalState, IconAfterProps, IconProps, InputEventProps, InputEventState, ShowIconProps, 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 = {
|
|
@@ -31,7 +31,7 @@ export type DBInputDefaultProps = {
|
|
|
31
31
|
*/
|
|
32
32
|
step?: number | string;
|
|
33
33
|
};
|
|
34
|
-
export type DBInputProps = DBInputDefaultProps & GlobalProps & FormTextProps & InputEventProps<HTMLInputElement> & ChangeEventProps<HTMLInputElement> & FocusEventProps<HTMLInputElement> & FormProps & IconProps & IconAfterProps & FormMessageProps & ShowIconProps;
|
|
34
|
+
export type DBInputProps = DBInputDefaultProps & GlobalProps & FormTextProps & InputEventProps<HTMLInputElement> & ChangeEventProps<HTMLInputElement> & FocusEventProps<HTMLInputElement> & FormProps & IconProps & IconAfterProps & FormMessageProps & ShowIconProps & FormSizeProps;
|
|
35
35
|
export type DBInputDefaultState = {
|
|
36
36
|
_dataListId?: string;
|
|
37
37
|
getDataList: (_list?: string[] | ValueLabelType[]) => ValueLabelType[];
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
declare const DBLink: React.ForwardRefExoticComponent<Omit<React.
|
|
2
|
+
declare const DBLink: React.ForwardRefExoticComponent<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, "text" | "onClick" | keyof import("../../shared/model").GlobalProps | "showIcon" | keyof import("./model").DBLinkDefaultProps | keyof import("../../shared/model").LinkProps> & import("./model").DBLinkDefaultProps & import("../../shared/model").GlobalProps & import("../../shared/model").ClickEventProps<HTMLAnchorElement> & import("../../shared/model").LinkProps & import("../../shared/model").ShowIconProps & import("../../shared/model").TextProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
3
3
|
export default DBLink;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import * as React from "react";
|
|
3
|
+
import { filterPassingProps, getRootProps } from "../../utils/react";
|
|
3
4
|
import { useRef, forwardRef } from "react";
|
|
4
|
-
import { cls, getBooleanAsString, getHideProp
|
|
5
|
+
import { cls, getBooleanAsString, getHideProp } from "../../utils";
|
|
5
6
|
function DBLinkFn(props, component) {
|
|
6
7
|
var _a;
|
|
7
8
|
const _ref = component || useRef(component);
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import * as React from "react";
|
|
3
|
+
import { filterPassingProps, getRootProps } from "../../utils/react";
|
|
3
4
|
import { useState, useRef, useEffect, forwardRef } from "react";
|
|
4
|
-
import { cls, uuid
|
|
5
|
+
import { cls, uuid } from "../../utils";
|
|
5
6
|
import { DEFAULT_ID } from "../../shared/constants";
|
|
6
7
|
function DBNavigationFn(props, component) {
|
|
7
8
|
const _ref = component || useRef(component);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ClickEvent, ClickEventProps, ClickEventState, GlobalProps, GlobalState, IconProps, InitializedState, NavigationBackButtonProps, ShowIconProps, TextProps, WidthProps } from '../../shared/model';
|
|
1
|
+
import { ClickEvent, ClickEventProps, ClickEventState, GlobalProps, GlobalState, IconProps, InitializedState, NavigationBackButtonProps, NavigationBehaviorState, ShowIconProps, TextProps, WidthProps } from '../../shared/model';
|
|
2
2
|
import { NavigationItemSafeTriangle } from '../../utils/navigation';
|
|
3
3
|
export type DBNavigationItemDefaultProps = {
|
|
4
4
|
/**
|
|
@@ -30,5 +30,6 @@ export type DBNavigationItemDefaultState = {
|
|
|
30
30
|
hasSubNavigation?: boolean;
|
|
31
31
|
updateSubNavigationState: () => void;
|
|
32
32
|
navigationItemSafeTriangle?: NavigationItemSafeTriangle;
|
|
33
|
+
autoClose?: boolean;
|
|
33
34
|
};
|
|
34
|
-
export type DBNavigationItemState = DBNavigationItemDefaultState & ClickEventState<HTMLButtonElement> & GlobalState & InitializedState;
|
|
35
|
+
export type DBNavigationItemState = DBNavigationItemDefaultState & ClickEventState<HTMLButtonElement> & GlobalState & InitializedState & NavigationBehaviorState;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import * as React from "react";
|
|
3
|
+
import { filterPassingProps, getRootProps } from "../../utils/react";
|
|
3
4
|
import { useState, useRef, useEffect, forwardRef } from "react";
|
|
4
5
|
import DBButton from "../button/button";
|
|
5
|
-
import { cls, getBooleanAsString, getHideProp, uuid
|
|
6
|
-
import { NavigationItemSafeTriangle } from "../../utils/navigation";
|
|
6
|
+
import { cls, delay, getBooleanAsString, getHideProp, uuid } from "../../utils";
|
|
7
|
+
import { isEventTargetNavigationItem, NavigationItemSafeTriangle, } from "../../utils/navigation";
|
|
7
8
|
import { DEFAULT_BACK } from "../../shared/constants";
|
|
8
9
|
function DBNavigationItemFn(props, component) {
|
|
9
10
|
var _a;
|
|
@@ -12,8 +13,17 @@ function DBNavigationItemFn(props, component) {
|
|
|
12
13
|
const [hasAreaPopup, setHasAreaPopup] = useState(() => false);
|
|
13
14
|
const [hasSubNavigation, setHasSubNavigation] = useState(() => true);
|
|
14
15
|
const [isSubNavigationExpanded, setIsSubNavigationExpanded] = useState(() => false);
|
|
16
|
+
const [autoClose, setAutoClose] = useState(() => false);
|
|
15
17
|
const [subNavigationId, setSubNavigationId] = useState(() => "sub-navigation-" + uuid());
|
|
16
18
|
const [navigationItemSafeTriangle, setNavigationItemSafeTriangle] = useState(() => undefined);
|
|
19
|
+
function handleNavigationItemClick(event) {
|
|
20
|
+
if (isEventTargetNavigationItem(event)) {
|
|
21
|
+
setAutoClose(true);
|
|
22
|
+
delay(() => {
|
|
23
|
+
setAutoClose(false);
|
|
24
|
+
}, 300);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
17
27
|
function handleClick(event) {
|
|
18
28
|
if (props.onClick) {
|
|
19
29
|
props.onClick(event);
|
|
@@ -58,7 +68,7 @@ function DBNavigationItemFn(props, component) {
|
|
|
58
68
|
!hasSubNavigation ? (React.createElement(React.Fragment, null, props.text ? React.createElement(React.Fragment, null, props.text) : React.createElement(React.Fragment, null, props.children))) : null,
|
|
59
69
|
hasSubNavigation ? (React.createElement(React.Fragment, null,
|
|
60
70
|
React.createElement("button", { className: "db-navigation-item-expand-button", "aria-haspopup": hasAreaPopup, "aria-expanded": isSubNavigationExpanded, disabled: props.disabled, onClick: (event) => handleClick(event) }, props.text ? React.createElement(React.Fragment, null, props.text) : React.createElement(React.Fragment, null, props.children)),
|
|
61
|
-
React.createElement("menu", { className: "db-sub-navigation", id: subNavigationId },
|
|
71
|
+
React.createElement("menu", { className: "db-sub-navigation", "data-auto-close": autoClose, id: subNavigationId, onClick: (event) => handleNavigationItemClick(event) },
|
|
62
72
|
hasAreaPopup ? (React.createElement("div", { className: "db-mobile-navigation-back" },
|
|
63
73
|
React.createElement(DBButton, { icon: "arrow_left", variant: "ghost", id: props.backButtonId, onClick: (event) => handleBackClick(event) }, (_a = props.backButtonText) !== null && _a !== void 0 ? _a : DEFAULT_BACK))) : null,
|
|
64
74
|
React.createElement(React.Fragment, null, props.subNavigation)))) : null));
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import * as React from "react";
|
|
3
|
+
import { filterPassingProps, getRootProps } from "../../utils/react";
|
|
3
4
|
import { useRef, forwardRef } from "react";
|
|
4
5
|
import DBButton from "../button/button";
|
|
5
6
|
import { DEFAULT_CLOSE_BUTTON } from "../../shared/constants";
|
|
6
|
-
import { cls, getHideProp, stringPropVisible
|
|
7
|
+
import { cls, getHideProp, stringPropVisible } from "../../utils";
|
|
7
8
|
function DBNotificationFn(props, component) {
|
|
8
9
|
var _a;
|
|
9
10
|
const _ref = component || useRef(component);
|
|
@@ -12,7 +13,7 @@ function DBNotificationFn(props, component) {
|
|
|
12
13
|
props.onClose();
|
|
13
14
|
}
|
|
14
15
|
}
|
|
15
|
-
return (React.createElement("article", 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-notification", props.className), "aria-live": props.ariaLive, "data-semantic": props.semantic, "data-variant": props.variant, "data-icon": props.icon, "data-hide-icon": getHideProp(props.showIcon), "data-link-variant": props.linkVariant }),
|
|
16
|
+
return (React.createElement("article", 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", "onClose"]), { 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-notification", props.className), "aria-live": props.ariaLive, "data-semantic": props.semantic, "data-variant": props.variant, "data-icon": props.icon, "data-hide-icon": getHideProp(props.showIcon), "data-link-variant": props.linkVariant }),
|
|
16
17
|
React.createElement(React.Fragment, null, props.image),
|
|
17
18
|
stringPropVisible(props.headline, props.showHeadline) ? (React.createElement("header", null, props.headline)) : null,
|
|
18
19
|
React.createElement("p", null, props.text ? React.createElement(React.Fragment, null, props.text) : React.createElement(React.Fragment, null, props.children)),
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import * as React from "react";
|
|
3
|
+
import { filterPassingProps, getRootProps } from "../../utils/react";
|
|
3
4
|
import { useState, useRef, useEffect, forwardRef } from "react";
|
|
4
|
-
import { cls, getBooleanAsString
|
|
5
|
+
import { cls, getBooleanAsString } from "../../utils";
|
|
5
6
|
function DBPageFn(props, component) {
|
|
6
7
|
const _ref = component || useRef(component);
|
|
7
8
|
const [fontsLoaded, setFontsLoaded] = useState(() => false);
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import * as React from "react";
|
|
3
|
+
import { filterPassingProps, getRootProps } from "../../utils/react";
|
|
3
4
|
import { useState, useRef, useEffect, forwardRef } from "react";
|
|
4
|
-
import { cls, getBooleanAsString, handleDataOutside
|
|
5
|
+
import { cls, getBooleanAsString, handleDataOutside } from "../../utils";
|
|
5
6
|
function DBPopoverFn(props, component) {
|
|
6
7
|
var _a;
|
|
7
8
|
const _ref = component || useRef(component);
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
declare const DBRadio: React.ForwardRefExoticComponent<Omit<React.
|
|
2
|
+
declare const DBRadio: React.ForwardRefExoticComponent<Omit<React.InputHTMLAttributes<HTMLInputElement>, "size" | "checked" | keyof import("../../shared/model").GlobalProps | keyof import("../../shared/model").ChangeEventProps<HTMLInputElement> | keyof import("../../shared/model").FocusEventProps<HTMLInputElement> | keyof import("../../shared/model").FormProps> & import("./model").DBRadioDefaultProps & import("../../shared/model").GlobalProps & import("../../shared/model").ChangeEventProps<HTMLInputElement> & import("../../shared/model").FocusEventProps<HTMLInputElement> & import("../../shared/model").FormProps & import("../../shared/model").FormCheckProps & import("../../shared/model").SizeProps & React.RefAttributes<HTMLInputElement>>;
|
|
3
3
|
export default DBRadio;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import * as React from "react";
|
|
3
|
+
import { filterPassingProps, getRootProps } from "../../utils/react";
|
|
3
4
|
import { useState, useRef, useEffect, forwardRef } from "react";
|
|
4
|
-
import { cls, getHideProp, uuid
|
|
5
|
+
import { cls, getHideProp, uuid } from "../../utils";
|
|
5
6
|
function DBRadioFn(props, component) {
|
|
6
7
|
const _ref = component || useRef(component);
|
|
7
8
|
const [initialized, setInitialized] = useState(() => false);
|
|
@@ -36,15 +37,10 @@ function DBRadioFn(props, component) {
|
|
|
36
37
|
set_id((_a = props.id) !== null && _a !== void 0 ? _a : `radio-${uuid()}`);
|
|
37
38
|
}, []);
|
|
38
39
|
useEffect(() => {
|
|
39
|
-
if (props.checked && initialized &&
|
|
40
|
-
|
|
41
|
-
if (radioElement) {
|
|
42
|
-
if (props.checked != undefined) {
|
|
43
|
-
radioElement.checked = true;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
40
|
+
if (props.checked && initialized && _ref.current) {
|
|
41
|
+
_ref.current.checked = true;
|
|
46
42
|
}
|
|
47
|
-
}, [initialized, props.checked]);
|
|
43
|
+
}, [initialized, _ref.current, props.checked]);
|
|
48
44
|
return (React.createElement("label", Object.assign({ "data-size": props.size, "data-hide-label": getHideProp(props.showLabel) }, 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-radio", props.className), htmlFor: _id }),
|
|
49
45
|
React.createElement("input", Object.assign({ type: "radio", "aria-invalid": props.validation === "invalid", "data-custom-validity": props.validation, 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, checked: props.checked, disabled: props.disabled, "aria-describedby": props.describedbyid, value: props.value, required: props.required, onChange: (event) => handleChange(event), onBlur: (event) => handleBlur(event), onFocus: (event) => handleFocus(event) })),
|
|
50
46
|
props.label ? React.createElement(React.Fragment, null, props.label) : React.createElement(React.Fragment, null, props.children)));
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import * as React from "react";
|
|
3
|
+
import { filterPassingProps, getRootProps } from "../../utils/react";
|
|
3
4
|
import { useState, useRef, useEffect, forwardRef } from "react";
|
|
4
|
-
import { cls, uuid
|
|
5
|
+
import { cls, uuid } from "../../utils";
|
|
5
6
|
import { DEFAULT_ID } from "../../shared/constants";
|
|
6
7
|
function DBSectionFn(props, component) {
|
|
7
8
|
const _ref = component || useRef(component);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChangeEventProps, ChangeEventState, ClickEventProps, ClickEventState, FocusEventProps, FocusEventState, FormMessageProps, FormProps, FormState, GlobalProps, GlobalState, IconProps, InitializedState, InputEventProps, InputEventState, ShowIconProps } from '../../shared/model';
|
|
1
|
+
import { ChangeEventProps, ChangeEventState, ClickEventProps, ClickEventState, FocusEventProps, FocusEventState, FormMessageProps, FormProps, FormSizeProps, FormState, GlobalProps, GlobalState, IconProps, InitializedState, InputEventProps, InputEventState, ShowIconProps } from '../../shared/model';
|
|
2
2
|
export type DBSelectDefaultProps = {
|
|
3
3
|
/**
|
|
4
4
|
* The description attribute will add a paragraph below the select.
|
|
@@ -35,7 +35,7 @@ export type DBSelectOptionType = {
|
|
|
35
35
|
*/
|
|
36
36
|
value: string | string[] | number;
|
|
37
37
|
};
|
|
38
|
-
export type DBSelectProps = DBSelectDefaultProps & GlobalProps & ClickEventProps<HTMLSelectElement> & ChangeEventProps<HTMLSelectElement> & FocusEventProps<HTMLSelectElement> & InputEventProps<HTMLSelectElement> & FormProps & IconProps & FormMessageProps & ShowIconProps;
|
|
38
|
+
export type DBSelectProps = DBSelectDefaultProps & GlobalProps & ClickEventProps<HTMLSelectElement> & ChangeEventProps<HTMLSelectElement> & FocusEventProps<HTMLSelectElement> & InputEventProps<HTMLSelectElement> & FormProps & IconProps & FormMessageProps & ShowIconProps & FormSizeProps;
|
|
39
39
|
export type DBSelectDefaultState = {
|
|
40
40
|
_placeholderId: string;
|
|
41
41
|
getOptionLabel: (option: DBSelectOptionType) => string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
declare const DBSelect: React.ForwardRefExoticComponent<Omit<React.
|
|
2
|
+
declare const DBSelect: React.ForwardRefExoticComponent<Omit<React.SelectHTMLAttributes<HTMLSelectElement>, "size" | "icon" | "onClick" | keyof import("../../shared/model").GlobalProps | "showIcon" | keyof import("../../shared/model").FormProps | keyof import("../../shared/model").FormMessageProps | keyof import("./model").DBSelectDefaultProps | keyof import("../../shared/model").ChangeEventProps<HTMLSelectElement> | keyof import("../../shared/model").FocusEventProps<HTMLSelectElement> | keyof import("../../shared/model").InputEventProps<HTMLSelectElement>> & import("./model").DBSelectDefaultProps & import("../../shared/model").GlobalProps & import("../../shared/model").ClickEventProps<HTMLSelectElement> & import("../../shared/model").ChangeEventProps<HTMLSelectElement> & import("../../shared/model").FocusEventProps<HTMLSelectElement> & import("../../shared/model").InputEventProps<HTMLSelectElement> & import("../../shared/model").FormProps & import("../../shared/model").IconProps & import("../../shared/model").FormMessageProps & import("../../shared/model").ShowIconProps & import("../../shared/model").FormSizeProps & React.RefAttributes<HTMLSelectElement>>;
|
|
3
3
|
export default DBSelect;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import * as React from "react";
|
|
3
|
+
import { filterPassingProps, getRootProps } from "../../utils/react";
|
|
3
4
|
import { useState, useRef, useEffect, forwardRef } from "react";
|
|
4
|
-
import { cls, delay, getHideProp, hasVoiceOver, stringPropVisible, uuid,
|
|
5
|
+
import { cls, delay, getHideProp, hasVoiceOver, stringPropVisible, uuid, } from "../../utils";
|
|
5
6
|
import { DEFAULT_INVALID_MESSAGE, DEFAULT_INVALID_MESSAGE_ID_SUFFIX, DEFAULT_LABEL, DEFAULT_MESSAGE_ID_SUFFIX, DEFAULT_PLACEHOLDER_ID_SUFFIX, DEFAULT_VALID_MESSAGE, DEFAULT_VALID_MESSAGE_ID_SUFFIX, } from "../../shared/constants";
|
|
6
7
|
import DBInfotext from "../infotext/infotext";
|
|
7
8
|
function DBSelectFn(props, component) {
|
|
@@ -112,7 +113,7 @@ function DBSelectFn(props, component) {
|
|
|
112
113
|
}, [props.value]);
|
|
113
114
|
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-select", props.className), "data-variant": props.variant, "data-hide-label": getHideProp(props.showLabel), "data-icon": props.icon, "data-hide-icon": getHideProp(props.showIcon) }),
|
|
114
115
|
React.createElement("label", { htmlFor: _id }, (_a = props.label) !== null && _a !== void 0 ? _a : DEFAULT_LABEL),
|
|
115
|
-
React.createElement("select", Object.assign({ "aria-invalid": props.validation === "invalid", "data-custom-validity": props.validation, 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"]), { required: props.required, disabled: props.disabled, id: _id, name: props.name, value: props.value, autoComplete: props.autocomplete, onInput: (event) => handleInput(event), onClick: (event) => handleClick(event), onChange: (event) => handleChange(event), onBlur: (event) => handleBlur(event), onFocus: (event) => handleFocus(event), "aria-describedby": _descByIds }),
|
|
116
|
+
React.createElement("select", Object.assign({ "aria-invalid": props.validation === "invalid", "data-custom-validity": props.validation, 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"]), { required: props.required, disabled: props.disabled, id: _id, name: props.name, size: props.size, value: props.value, autoComplete: props.autocomplete, onInput: (event) => handleInput(event), onClick: (event) => handleClick(event), onChange: (event) => handleChange(event), onBlur: (event) => handleBlur(event), onFocus: (event) => handleFocus(event), "aria-describedby": _descByIds }),
|
|
116
117
|
React.createElement("option", { hidden: true }),
|
|
117
118
|
props.options ? (React.createElement(React.Fragment, { key: uuid() }, (_b = props.options) === null || _b === void 0 ? void 0 : _b.map((option) => {
|
|
118
119
|
var _a;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import * as React from "react";
|
|
3
|
+
import { filterPassingProps, getRootProps } from "../../utils/react";
|
|
3
4
|
import { useRef, forwardRef } from "react";
|
|
4
|
-
import { cls, getBooleanAsString
|
|
5
|
+
import { cls, getBooleanAsString } from "../../utils";
|
|
5
6
|
function DBStackFn(props, component) {
|
|
6
7
|
const _ref = component || useRef(component);
|
|
7
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"]), { 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-stack", props.className), "data-gap": props.gap, "data-variant": props.variant, "data-direction": props.direction, "data-alignment": props.alignment, "data-justify-content": props.justifyContent, "data-wrap": getBooleanAsString(props.wrap) }), props.children));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChangeEventProps, ChangeEventState, EmphasisProps, FocusEventProps, FocusEventState, FormCheckProps, FormProps, FormState, GlobalProps, GlobalState, IconAfterProps, IconProps,
|
|
1
|
+
import { ChangeEventProps, ChangeEventState, EmphasisProps, FocusEventProps, FocusEventState, FormCheckProps, FormProps, FormState, GlobalProps, GlobalState, IconAfterProps, IconProps, SizeProps } from '../../shared/model';
|
|
2
2
|
export type DBSwitchDefaultProps = {
|
|
3
3
|
/**
|
|
4
4
|
* Add additional icons to indicate active/inactive state.
|
|
@@ -9,4 +9,4 @@ export type DBSwitchProps = DBSwitchDefaultProps & GlobalProps & ChangeEventProp
|
|
|
9
9
|
export type DBSwitchDefaultState = {
|
|
10
10
|
_checked: boolean;
|
|
11
11
|
};
|
|
12
|
-
export type DBSwitchState = DBSwitchDefaultState & GlobalState & ChangeEventState<HTMLInputElement> & FocusEventState<HTMLInputElement> & FormState
|
|
12
|
+
export type DBSwitchState = DBSwitchDefaultState & GlobalState & ChangeEventState<HTMLInputElement> & FocusEventState<HTMLInputElement> & FormState;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
declare const DBSwitch: React.ForwardRefExoticComponent<Omit<React.
|
|
2
|
+
declare const DBSwitch: React.ForwardRefExoticComponent<Omit<React.InputHTMLAttributes<HTMLInputElement>, "size" | "icon" | "checked" | keyof import("../../shared/model").GlobalProps | "emphasis" | keyof import("../../shared/model").ChangeEventProps<HTMLInputElement> | keyof import("../../shared/model").FocusEventProps<HTMLInputElement> | keyof import("../../shared/model").FormProps | "iconAfter" | "visualAid"> & import("./model").DBSwitchDefaultProps & import("../../shared/model").GlobalProps & import("../../shared/model").ChangeEventProps<HTMLInputElement> & import("../../shared/model").FocusEventProps<HTMLInputElement> & import("../../shared/model").FormProps & import("../../shared/model").FormCheckProps & import("../../shared/model").EmphasisProps & import("../../shared/model").SizeProps & import("../../shared/model").IconProps & import("../../shared/model").IconAfterProps & React.RefAttributes<HTMLInputElement>>;
|
|
3
3
|
export default DBSwitch;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import * as React from "react";
|
|
3
|
+
import { filterPassingProps, getRootProps } from "../../utils/react";
|
|
3
4
|
import { useState, useRef, useEffect, forwardRef } from "react";
|
|
4
|
-
import { cls, getBooleanAsString, getHideProp, uuid
|
|
5
|
+
import { cls, getBooleanAsString, getHideProp, uuid } from "../../utils";
|
|
5
6
|
function DBSwitchFn(props, component) {
|
|
6
7
|
const _ref = component || useRef(component);
|
|
7
8
|
const [_id, set_id] = useState(() => undefined);
|
|
8
|
-
const [_checked, set_checked] = useState(() => false);
|
|
9
|
-
const [initialized, setInitialized] = useState(() => false);
|
|
9
|
+
const [_checked, set_checked] = useState(() => { var _a; return (_a = props["defaultChecked"]) !== null && _a !== void 0 ? _a : false; });
|
|
10
10
|
function handleChange(event) {
|
|
11
11
|
var _a;
|
|
12
12
|
if (props.onChange) {
|
|
@@ -38,8 +38,13 @@ function DBSwitchFn(props, component) {
|
|
|
38
38
|
var _a;
|
|
39
39
|
set_id((_a = props.id) !== null && _a !== void 0 ? _a : `switch-${uuid()}`);
|
|
40
40
|
}, []);
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
if (props.checked !== undefined && props.checked !== null) {
|
|
43
|
+
set_checked(!!props.checked);
|
|
44
|
+
}
|
|
45
|
+
}, [props.checked]);
|
|
41
46
|
return (React.createElement("label", Object.assign({ "data-visual-aid": getBooleanAsString(props.visualAid), "data-size": props.size, "data-hide-label": getHideProp(props.showLabel), "data-emphasis": props.emphasis, htmlFor: _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-switch", props.className) }),
|
|
42
|
-
React.createElement("input", Object.assign({ type: "checkbox", role: "switch", id: _id, "aria-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"]), { checked: props.checked, disabled: props.disabled, "aria-describedby": props.describedbyid, "aria-invalid": props.validation === "invalid", "data-custom-validity": props.validation, name: props.name, required: props.required, "data-aid-icon": props.icon, "data-aid-icon-after": props.iconAfter, onChange: (event) => handleChange(event), onBlur: (event) => handleBlur(event), onFocus: (event) => handleFocus(event) })),
|
|
47
|
+
React.createElement("input", Object.assign({ type: "checkbox", role: "switch", id: _id, "aria-checked": getBooleanAsString(_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"]), { checked: props.checked, value: props.value, disabled: props.disabled, "aria-describedby": props.describedbyid, "aria-invalid": props.validation === "invalid", "data-custom-validity": props.validation, name: props.name, required: props.required, "data-aid-icon": props.icon, "data-aid-icon-after": props.iconAfter, onChange: (event) => handleChange(event), onBlur: (event) => handleBlur(event), onFocus: (event) => handleFocus(event) })),
|
|
43
48
|
props.label ? React.createElement(React.Fragment, null, props.label) : React.createElement(React.Fragment, null, props.children)));
|
|
44
49
|
}
|
|
45
50
|
const DBSwitch = forwardRef(DBSwitchFn);
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
declare const DBTabItem: React.ForwardRefExoticComponent<Omit<React.
|
|
2
|
+
declare const DBTabItem: React.ForwardRefExoticComponent<Omit<React.InputHTMLAttributes<HTMLInputElement>, "active" | "icon" | "controls" | keyof import("../..").GlobalProps | "showIcon" | keyof import("../..").ChangeEventProps<HTMLInputElement> | "iconAfter" | keyof import("./model").DBTabItemDefaultProps> & import("../..").GlobalProps & import("./model").DBTabItemDefaultProps & import("../..").IconProps & import("../..").IconAfterProps & import("../..").ActiveProps & import("../..").AriaControlsProps & import("../..").ChangeEventProps<HTMLInputElement> & import("../..").ShowIconProps & React.RefAttributes<HTMLInputElement>>;
|
|
3
3
|
export default DBTabItem;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import * as React from "react";
|
|
3
|
+
import { filterPassingProps, getRootProps } from "../../utils/react";
|
|
3
4
|
import { useState, useRef, useEffect, forwardRef } from "react";
|
|
4
|
-
import { cls, getHideProp
|
|
5
|
+
import { cls, getHideProp } from "../../utils";
|
|
5
6
|
function DBTabItemFn(props, component) {
|
|
6
7
|
const _ref = component || useRef(component);
|
|
7
8
|
const [initialized, setInitialized] = useState(() => false);
|
|
@@ -28,7 +29,7 @@ function DBTabItemFn(props, component) {
|
|
|
28
29
|
}, [_ref.current, initialized]);
|
|
29
30
|
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"]), { className: cls("db-tab-item", props.className) }),
|
|
30
31
|
React.createElement("label", { htmlFor: props.id, "data-icon": props.icon, "data-icon-after": props.iconAfter, "data-hide-icon": getHideProp(props.showIcon), "data-hide-icon-after": getHideProp(props.showIcon), "data-no-text": props.noText },
|
|
31
|
-
React.createElement("input", Object.assign({ type: "radio", role: "tab", disabled: props.disabled, "aria-selected": _selected, "aria-controls": props.controls, checked: props.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"]), { id: props.id,
|
|
32
|
+
React.createElement("input", Object.assign({ type: "radio", role: "tab", disabled: props.disabled, "aria-selected": _selected, "aria-controls": props.controls, checked: props.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"]), { id: props.id, onInput: (event) => handleChange(event) })),
|
|
32
33
|
props.label ? React.createElement(React.Fragment, null, props.label) : null,
|
|
33
34
|
props.children)));
|
|
34
35
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import * as React from "react";
|
|
3
|
+
import { filterPassingProps, getRootProps } from "../../utils/react";
|
|
3
4
|
import { useState, useRef, useEffect, forwardRef } from "react";
|
|
4
|
-
import { cls, uuid
|
|
5
|
+
import { cls, uuid } from "../../utils";
|
|
5
6
|
import { DEFAULT_ID } from "../../shared/constants";
|
|
6
7
|
function DBTabListFn(props, component) {
|
|
7
8
|
const _ref = component || useRef(component);
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import * as React from "react";
|
|
3
|
+
import { filterPassingProps, getRootProps } from "../../utils/react";
|
|
3
4
|
import { useRef, useEffect, forwardRef } from "react";
|
|
4
|
-
import { cls
|
|
5
|
+
import { cls } from "../../utils";
|
|
5
6
|
function DBTabPanelFn(props, component) {
|
|
6
7
|
const _ref = component || useRef(component);
|
|
7
8
|
useEffect(() => { }, []);
|
|
@@ -27,6 +27,14 @@ export type DBTabsDefaultProps = {
|
|
|
27
27
|
* The name of the tab bar, is required for grouping multiple tabs together. Will overwrite names from children.
|
|
28
28
|
*/
|
|
29
29
|
name?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Informs the user if the current tab index has changed.
|
|
32
|
+
*/
|
|
33
|
+
onIndexChange?: (index?: number) => void;
|
|
34
|
+
/**
|
|
35
|
+
* Informs the user if another tab has been selected.
|
|
36
|
+
*/
|
|
37
|
+
onTabSelect?: (event?: Event) => void;
|
|
30
38
|
/**
|
|
31
39
|
* Provide simple tabs with label + text as content
|
|
32
40
|
*/
|
|
@@ -43,5 +51,6 @@ export type DBTabsDefaultState = {
|
|
|
43
51
|
convertTabs: (tabs?: unknown[] | string | undefined) => DBSimpleTabProps[];
|
|
44
52
|
initTabList: () => void;
|
|
45
53
|
initTabs: (init?: boolean) => void;
|
|
54
|
+
handleChange: (event: any) => void;
|
|
46
55
|
};
|
|
47
56
|
export type DBTabsState = DBTabsDefaultState & GlobalState & InitializedState;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import * as React from "react";
|
|
3
|
+
import { filterPassingProps, getRootProps } from "../../utils/react";
|
|
3
4
|
import { useState, useRef, useEffect, forwardRef } from "react";
|
|
4
|
-
import { cls, uuid
|
|
5
|
+
import { cls, uuid } from "../../utils";
|
|
5
6
|
import DBButton from "../button/button";
|
|
6
7
|
import DBTabList from "../tab-list/tab-list";
|
|
7
8
|
import DBTabItem from "../tab-item/tab-item";
|
|
@@ -98,6 +99,21 @@ function DBTabsFn(props, component) {
|
|
|
98
99
|
}
|
|
99
100
|
}
|
|
100
101
|
}
|
|
102
|
+
function handleChange(event) {
|
|
103
|
+
var _a;
|
|
104
|
+
if (props.onIndexChange && event.target) {
|
|
105
|
+
const list = event.target.closest("ul");
|
|
106
|
+
const listItem =
|
|
107
|
+
// db-tab-item for angular and stencil wrapping elements
|
|
108
|
+
(_a = event.target.closest("db-tab-item")) !== null && _a !== void 0 ? _a : event.target.closest("li");
|
|
109
|
+
if (list !== null && listItem !== null) {
|
|
110
|
+
props.onIndexChange(Array.from(list.childNodes).indexOf(listItem));
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
if (props.onTabSelect) {
|
|
114
|
+
props.onTabSelect(event);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
101
117
|
useEffect(() => {
|
|
102
118
|
set_id(props.id || _id);
|
|
103
119
|
set_name(`tabs-${props.name || uuid()}`);
|
|
@@ -125,12 +141,12 @@ function DBTabsFn(props, component) {
|
|
|
125
141
|
setInitialized(false);
|
|
126
142
|
}
|
|
127
143
|
}, [_ref.current, initialized]);
|
|
128
|
-
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: _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-tabs", props.className), "data-orientation": props.orientation, "data-scroll-behavior": props.behavior, "data-alignment": (_a = props.alignment) !== null && _a !== void 0 ? _a : "start", "data-width": (_b = props.width) !== null && _b !== void 0 ? _b : "auto" }),
|
|
129
|
-
showScrollLeft ? (React.createElement(DBButton, { className: "tabs-scroll-left", variant: "ghost", icon: "chevron_left", noText: true, onClick: (event) => scroll(true) }, "Scroll left")) : null,
|
|
144
|
+
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", "onTabSelect", "onIndexChange"]), { 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-tabs", props.className), "data-orientation": props.orientation, "data-scroll-behavior": props.behavior, "data-alignment": (_a = props.alignment) !== null && _a !== void 0 ? _a : "start", "data-width": (_b = props.width) !== null && _b !== void 0 ? _b : "auto", onInput: (event) => handleChange(event) }),
|
|
145
|
+
showScrollLeft ? (React.createElement(DBButton, { className: "tabs-scroll-left", variant: "ghost", icon: "chevron_left", type: "button", noText: true, onClick: (event) => scroll(true) }, "Scroll left")) : null,
|
|
130
146
|
props.tabs ? (React.createElement(React.Fragment, null,
|
|
131
147
|
React.createElement(DBTabList, null, (_c = convertTabs(props.tabs)) === null || _c === void 0 ? void 0 : _c.map((tab, index) => (React.createElement(DBTabItem, { key: props.name + "tab-item" + index, active: tab.active, label: tab.label, iconAfter: tab.iconAfter, icon: tab.icon, noText: tab.noText })))), (_d = convertTabs(props.tabs)) === null || _d === void 0 ? void 0 :
|
|
132
148
|
_d.map((tab, index) => (React.createElement(DBTabPanel, { key: props.name + "tab-panel" + index, content: tab.content }, tab.children))))) : null,
|
|
133
|
-
showScrollRight ? (React.createElement(DBButton, { className: "tabs-scroll-right", variant: "ghost", icon: "chevron_right", noText: true, onClick: (event) => scroll() }, "Scroll right")) : null,
|
|
149
|
+
showScrollRight ? (React.createElement(DBButton, { className: "tabs-scroll-right", variant: "ghost", icon: "chevron_right", type: "button", noText: true, onClick: (event) => scroll() }, "Scroll right")) : null,
|
|
134
150
|
props.children));
|
|
135
151
|
}
|
|
136
152
|
const DBTabs = forwardRef(DBTabsFn);
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import * as React from "react";
|
|
3
|
+
import { filterPassingProps, getRootProps } from "../../utils/react";
|
|
3
4
|
import { useState, useRef, useEffect, forwardRef } from "react";
|
|
4
|
-
import { cls, getBooleanAsString, getHideProp
|
|
5
|
+
import { cls, getBooleanAsString, getHideProp } from "../../utils";
|
|
5
6
|
function DBTagFn(props, component) {
|
|
6
7
|
var _a;
|
|
7
8
|
const _ref = component || useRef(component);
|
|
@@ -35,7 +36,7 @@ function DBTagFn(props, component) {
|
|
|
35
36
|
}
|
|
36
37
|
}
|
|
37
38
|
}, [initialized, props.disabled, _ref.current]);
|
|
38
|
-
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-tag", props.className), "data-disabled": getBooleanAsString(props.disabled), "data-semantic": props.semantic, "data-emphasis": props.emphasis, "data-icon": props.icon, "data-show-check-state": getBooleanAsString((_a = props.showCheckState) !== null && _a !== void 0 ? _a : true), "data-hide-icon": getHideProp(props.showIcon), "data-no-text": getBooleanAsString(props.noText), "data-overflow": getBooleanAsString(props.overflow) }),
|
|
39
|
+
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", "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"]), { className: cls("db-tag", props.className), "data-disabled": getBooleanAsString(props.disabled), "data-semantic": props.semantic, "data-emphasis": props.emphasis, "data-icon": props.icon, "data-show-check-state": getBooleanAsString((_a = props.showCheckState) !== null && _a !== void 0 ? _a : true), "data-hide-icon": getHideProp(props.showIcon), "data-no-text": getBooleanAsString(props.noText), "data-overflow": getBooleanAsString(props.overflow) }),
|
|
39
40
|
React.createElement(React.Fragment, null, props.content),
|
|
40
41
|
props.children,
|
|
41
42
|
props.text ? React.createElement(React.Fragment, null, props.text) : null,
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
declare const DBTextarea: React.ForwardRefExoticComponent<Omit<React.
|
|
2
|
+
declare const DBTextarea: React.ForwardRefExoticComponent<Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, keyof import("../../shared/model").GlobalProps | keyof import("../../shared/model").FormProps | keyof import("../../shared/model").FormMessageProps | keyof import("../../shared/model").FormTextProps | keyof import("./model").DBTextareaDefaultProps | keyof import("../../shared/model").ChangeEventProps<HTMLTextAreaElement> | keyof import("../../shared/model").InputEventProps<HTMLTextAreaElement> | keyof import("../../shared/model").FocusEventProps<HTMLTextAreaElement>> & import("./model").DBTextareaDefaultProps & import("../../shared/model").ChangeEventProps<HTMLTextAreaElement> & import("../../shared/model").InputEventProps<HTMLTextAreaElement> & import("../../shared/model").FocusEventProps<HTMLTextAreaElement> & import("../../shared/model").FormProps & import("../../shared/model").GlobalProps & import("../../shared/model").FormTextProps & import("../../shared/model").FormMessageProps & React.RefAttributes<HTMLTextAreaElement>>;
|
|
3
3
|
export default DBTextarea;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import * as React from "react";
|
|
3
|
+
import { filterPassingProps, getRootProps } from "../../utils/react";
|
|
3
4
|
import { useState, useRef, useEffect, forwardRef } from "react";
|
|
4
5
|
import DBInfotext from "../infotext/infotext";
|
|
5
|
-
import { cls, delay, getHideProp, hasVoiceOver, stringPropVisible, uuid,
|
|
6
|
+
import { cls, delay, getHideProp, hasVoiceOver, stringPropVisible, uuid, } from "../../utils";
|
|
6
7
|
import { DEFAULT_INVALID_MESSAGE, DEFAULT_INVALID_MESSAGE_ID_SUFFIX, DEFAULT_LABEL, DEFAULT_MESSAGE_ID_SUFFIX, DEFAULT_PLACEHOLDER, DEFAULT_ROWS, DEFAULT_VALID_MESSAGE, DEFAULT_VALID_MESSAGE_ID_SUFFIX, } from "../../shared/constants";
|
|
7
8
|
function DBTextareaFn(props, component) {
|
|
8
9
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import * as React from "react";
|
|
3
|
+
import { filterPassingProps, getRootProps } from "../../utils/react";
|
|
3
4
|
import { useState, useRef, useEffect, forwardRef } from "react";
|
|
4
|
-
import { cls, getBooleanAsString, handleDataOutside, uuid
|
|
5
|
+
import { cls, getBooleanAsString, handleDataOutside, uuid } from "../../utils";
|
|
5
6
|
import { DEFAULT_ID } from "../../shared/constants";
|
|
6
7
|
function DBTooltipFn(props, component) {
|
|
7
8
|
var _a, _b;
|
package/dist/shared/model.d.ts
CHANGED
|
@@ -228,6 +228,12 @@ export type FormTextProps = {
|
|
|
228
228
|
*/
|
|
229
229
|
readOnly?: boolean;
|
|
230
230
|
};
|
|
231
|
+
export type FormSizeProps = {
|
|
232
|
+
/**
|
|
233
|
+
* Size of the control
|
|
234
|
+
*/
|
|
235
|
+
size?: number;
|
|
236
|
+
};
|
|
231
237
|
export type FormCheckProps = {
|
|
232
238
|
/**
|
|
233
239
|
* Define the radio or checkbox elements checked state
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -7,8 +7,6 @@ export type ClassNameArg = string | {
|
|
|
7
7
|
[key: string]: boolean | undefined;
|
|
8
8
|
} | undefined;
|
|
9
9
|
export declare const cls: (...args: ClassNameArg[]) => string;
|
|
10
|
-
export declare const filterPassingProps: (props: Record<string, unknown>, propsPassingFilter: string[]) => Record<string, unknown>;
|
|
11
|
-
export declare const getRootProps: (props: Record<string, unknown>, rooProps: string[]) => Record<string, unknown>;
|
|
12
10
|
export declare const visibleInVX: (el: Element) => boolean;
|
|
13
11
|
export declare const visibleInVY: (el: Element) => boolean;
|
|
14
12
|
export declare const isInView: (el: Element) => {
|
|
@@ -34,8 +32,6 @@ export declare const getBooleanAsString: (originBool?: boolean) => any;
|
|
|
34
32
|
export declare const getHideProp: (show?: boolean) => any;
|
|
35
33
|
export declare const stringPropVisible: (givenString?: string, showString?: boolean) => string | boolean;
|
|
36
34
|
declare const _default: {
|
|
37
|
-
getRootProps: (props: Record<string, unknown>, rooProps: string[]) => Record<string, unknown>;
|
|
38
|
-
filterPassingProps: (props: Record<string, unknown>, propsPassingFilter: string[]) => Record<string, unknown>;
|
|
39
35
|
cls: (...args: ClassNameArg[]) => string;
|
|
40
36
|
addAttributeToChildren: (element: Element, attribute: {
|
|
41
37
|
key: string;
|
package/dist/utils/index.js
CHANGED
|
@@ -37,15 +37,6 @@ export const cls = (...args) => {
|
|
|
37
37
|
}
|
|
38
38
|
return result.trim();
|
|
39
39
|
};
|
|
40
|
-
const reactHtmlAttributes = ['suppressHydrationWarning', 'suppressContentEditableWarning', 'translate', 'title', 'tabIndex', 'style', 'spellCheck', 'nonce', 'lang', 'hidden', 'draggable', 'dir', 'contextMenu', 'contentEditable', 'autoFocus', 'accessKey', 'is', 'inputMode', 'unselectable', 'security', 'results', 'vocab', 'typeof', 'rev', 'resource', 'rel', 'property', 'inlist', 'datatype', 'content', 'about', 'role', 'radioGroup', 'color'];
|
|
41
|
-
export const filterPassingProps = (props, propsPassingFilter) => Object.keys(props).filter(key => (key.startsWith('data-') || key.startsWith('aria-') || key.startsWith('default') || key.startsWith('auto') || key.startsWith('item') || key.startsWith('on') || reactHtmlAttributes.includes(key)) && !propsPassingFilter.includes(key)).reduce((obj, key) => {
|
|
42
|
-
return Object.assign(Object.assign({}, obj), { [key]: props[key] });
|
|
43
|
-
}, {});
|
|
44
|
-
export const getRootProps = (props, rooProps) => {
|
|
45
|
-
return Object.keys(props).filter(key => rooProps.includes(key)).reduce((obj, key) => {
|
|
46
|
-
return Object.assign(Object.assign({}, obj), { [key]: props[key] });
|
|
47
|
-
}, {});
|
|
48
|
-
};
|
|
49
40
|
export const visibleInVX = (el) => {
|
|
50
41
|
const { left, right } = el.getBoundingClientRect();
|
|
51
42
|
const { innerWidth } = window;
|
|
@@ -148,8 +139,6 @@ export const stringPropVisible = (givenString, showString) => {
|
|
|
148
139
|
}
|
|
149
140
|
};
|
|
150
141
|
export default {
|
|
151
|
-
getRootProps,
|
|
152
|
-
filterPassingProps,
|
|
153
142
|
cls,
|
|
154
143
|
addAttributeToChildren,
|
|
155
144
|
uuid,
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const filterPassingProps: (props: Record<string, unknown>, propsPassingFilter: string[]) => Record<string, unknown>;
|
|
2
|
+
export declare const getRootProps: (props: Record<string, unknown>, rooProps: string[]) => Record<string, unknown>;
|
|
3
|
+
declare const _default: {
|
|
4
|
+
getRootProps: (props: Record<string, unknown>, rooProps: string[]) => Record<string, unknown>;
|
|
5
|
+
filterPassingProps: (props: Record<string, unknown>, propsPassingFilter: string[]) => Record<string, unknown>;
|
|
6
|
+
};
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const reactHtmlAttributes = ['suppressHydrationWarning', 'suppressContentEditableWarning', 'translate', 'title', 'tabIndex', 'style', 'spellCheck', 'nonce', 'lang', 'hidden', 'draggable', 'dir', 'contextMenu', 'contentEditable', 'accessKey', 'is', 'inputMode', 'unselectable', 'security', 'results', 'vocab', 'typeof', 'rev', 'resource', 'rel', 'property', 'inlist', 'datatype', 'content', 'about', 'role', 'radioGroup', 'color',
|
|
2
|
+
// other attributes for button,input,etc.
|
|
3
|
+
'form', 'formAction', 'formEncType', 'formMethod', 'formNoValidate', 'formTarget', 'capture', 'dirName', 'download', 'ping'];
|
|
4
|
+
export const filterPassingProps = (props, propsPassingFilter) => Object.keys(props).filter(key => (key.startsWith('data-') || key.startsWith('aria-') || key.startsWith('default') || key.startsWith('auto') || key.startsWith('item') || key.startsWith('on') || reactHtmlAttributes.includes(key)) && !propsPassingFilter.includes(key)).reduce((obj, key) => {
|
|
5
|
+
return Object.assign(Object.assign({}, obj), { [key]: props[key] });
|
|
6
|
+
}, {});
|
|
7
|
+
export const getRootProps = (props, rooProps) => {
|
|
8
|
+
return Object.keys(props).filter(key => rooProps.includes(key)).reduce((obj, key) => {
|
|
9
|
+
return Object.assign(Object.assign({}, obj), { [key]: props[key] });
|
|
10
|
+
}, {});
|
|
11
|
+
};
|
|
12
|
+
export default {
|
|
13
|
+
getRootProps,
|
|
14
|
+
filterPassingProps
|
|
15
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@db-ux/react-core-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "React components for @db-ux/core-components",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
},
|
|
38
38
|
"sideEffects": false,
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@db-ux/core-components": "1.
|
|
41
|
-
"@db-ux/core-foundations": "1.
|
|
40
|
+
"@db-ux/core-components": "1.1.1",
|
|
41
|
+
"@db-ux/core-foundations": "1.1.1"
|
|
42
42
|
}
|
|
43
43
|
}
|