@db-ux/react-core-components 4.3.2 → 4.4.0-loading-567cd0c
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 +8 -0
- package/dist/components/badge/badge.d.ts +1 -1
- package/dist/components/custom-select/custom-select.js +7 -8
- package/dist/components/infotext/infotext.d.ts +1 -1
- package/dist/components/link/link.d.ts +1 -1
- package/dist/components/link/model.d.ts +2 -2
- package/dist/components/loading-indicator/examples/_indicators.data.d.ts +49 -0
- package/dist/components/loading-indicator/examples/_indicators.data.js +91 -0
- package/dist/components/loading-indicator/index.d.ts +1 -0
- package/dist/components/loading-indicator/index.js +1 -0
- package/dist/components/loading-indicator/loading-indicator.d.ts +3 -0
- package/dist/components/loading-indicator/loading-indicator.js +153 -0
- package/dist/components/loading-indicator/model.d.ts +39 -0
- package/dist/components/loading-indicator/model.js +2 -0
- package/dist/components/notification/model.d.ts +2 -2
- package/dist/components/notification/notification.d.ts +4 -1
- package/dist/components/notification/notification.js +6 -2
- package/dist/components/popover/popover.d.ts +4 -1
- package/dist/components/select/model.d.ts +10 -0
- package/dist/components/select/select.js +12 -1
- package/dist/components/tag/tag.d.ts +1 -1
- package/dist/components/tooltip/tooltip.d.ts +4 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/shared/model.d.ts +12 -8
- package/dist/utils/index.d.ts +12 -0
- package/dist/utils/index.js +25 -0
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @db-ux/react-core-components
|
|
2
2
|
|
|
3
|
+
## 4.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- feat: add `role` property to DBNotification & automatically add role based on semantic if no `role` or `ariaLive` is provided to increase UX for screen-reader users - [see commit 177d71e](https://github.com/db-ux-design-system/core-web/commit/177d71e287a64a6491ba446e7812d0adbda1717e)
|
|
8
|
+
|
|
9
|
+
- feat(DBSelect): hide empty first option in `required` selects with placeholder after the first user selection, and add `showEmptyOption` prop to overwrite this - [see commit 4280bc4](https://github.com/db-ux-design-system/core-web/commit/4280bc47538d6983d6bb5575f012b6c6b25b40e8)
|
|
10
|
+
|
|
3
11
|
## 4.3.2
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
declare const DBBadge: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<any>, "text" | keyof import("../..").GlobalProps | keyof import("./model").DBBadgeDefaultProps | "
|
|
2
|
+
declare const DBBadge: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<any>, "semantic" | "text" | keyof import("../..").GlobalProps | keyof import("./model").DBBadgeDefaultProps | "size" | "emphasis"> & import("./model").DBBadgeDefaultProps & import("../..").GlobalProps & import("../..").SemanticProps & import("../..").SizeProps & import("../..").EmphasisProps & import("../..").TextProps & React.RefAttributes<any>>;
|
|
3
3
|
export default DBBadge;
|
|
@@ -14,10 +14,11 @@ import DBCustomSelectListItem from "../custom-select-list-item/custom-select-lis
|
|
|
14
14
|
import DBCustomSelectList from "../custom-select-list/custom-select-list";
|
|
15
15
|
import DBInfotext from "../infotext/infotext";
|
|
16
16
|
import DBInput from "../input/input";
|
|
17
|
+
import DBLoadingIndicator from "../loading-indicator/loading-indicator";
|
|
17
18
|
import DBTag from "../tag/tag";
|
|
18
19
|
import DBTooltip from "../tooltip/tooltip";
|
|
19
20
|
function DBCustomSelectFn(props, component) {
|
|
20
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
21
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
21
22
|
props = Object.assign({ clearSelectionText: "Clear selection", showClearSelection: true }, props);
|
|
22
23
|
const _ref = component || useRef(component);
|
|
23
24
|
const detailsRef = useRef(null);
|
|
@@ -689,22 +690,20 @@ function DBCustomSelectFn(props, component) {
|
|
|
689
690
|
React.createElement(DBInput, { type: "search", ref: searchInputRef, name: _id, form: _id, showLabel: false, value: _searchValue, label: (_d = props.searchLabel) !== null && _d !== void 0 ? _d : DEFAULT_LABEL, placeholder: (_e = props.searchPlaceholder) !== null && _e !== void 0 ? _e : props.searchLabel, ariaDescribedBy: _hasNoOptions || props.showLoading
|
|
690
691
|
? _infoTextId
|
|
691
692
|
: undefined, onInput: (event) => handleSearch(event) }))) : null,
|
|
692
|
-
_hasNoOptions || props.showLoading ? (React.createElement(
|
|
693
|
-
? props.loadingText
|
|
694
|
-
: props.noResultsText)) !== null && _f !== void 0 ? _f : DEFAULT_MESSAGE)) : (React.createElement(React.Fragment, null,
|
|
693
|
+
_hasNoOptions || props.showLoading ? (React.createElement(React.Fragment, null, props.showLoading ? (React.createElement(DBLoadingIndicator, { id: _infoTextId }, (_f = props.loadingText) !== null && _f !== void 0 ? _f : DEFAULT_MESSAGE)) : (React.createElement(DBInfotext, { semantic: "warning", id: _infoTextId }, (_g = props.noResultsText) !== null && _g !== void 0 ? _g : DEFAULT_MESSAGE)))) : (React.createElement(React.Fragment, null,
|
|
695
694
|
React.createElement(React.Fragment, null,
|
|
696
695
|
selectAllEnabled ? (React.createElement("div", null,
|
|
697
696
|
React.createElement("div", { className: "db-checkbox db-custom-select-list-item" },
|
|
698
697
|
React.createElement("label", null,
|
|
699
698
|
React.createElement("input", { type: "checkbox", value: "select-all", ref: selectAllRef, form: _id, checked: selectAllChecked, onChange: (event) => handleSelectAll(event) }),
|
|
700
699
|
getSelectAllLabel())))) : null,
|
|
701
|
-
React.createElement(DBCustomSelectList, { multiple: getBoolean(props.multiple, "multiple"), label: (
|
|
700
|
+
React.createElement(DBCustomSelectList, { multiple: getBoolean(props.multiple, "multiple"), label: (_j = (_h = props.listLabel) !== null && _h !== void 0 ? _h : props.label) !== null && _j !== void 0 ? _j : DEFAULT_LABEL }, _options === null || _options === void 0 ? void 0 : _options.map((option) => (React.createElement(DBCustomSelectListItem, { type: props.multiple ? "checkbox" : "radio", showDivider: option.showDivider, icon: option.icon, isGroupTitle: option.isGroupTitle, groupTitle: getOptionLabel(option), name: _id, checked: getOptionChecked(option.value), disabled: option.disabled, value: option.value, onChange: (event) => handleSelect(option.value), key: getOptionKey(option, "custom-select-list-item-") }, !option.isGroupTitle ? (React.createElement(React.Fragment, null, getOptionLabel(option))) : null))))))),
|
|
702
701
|
React.createElement("div", null,
|
|
703
|
-
React.createElement(DBButton, { variant: "ghost", width: "full", icon: "cross", size: "small", name: _id, form: _id, onClick: (event) => handleClose(undefined, true) }, (
|
|
704
|
-
((
|
|
702
|
+
React.createElement(DBButton, { variant: "ghost", width: "full", icon: "cross", size: "small", name: _id, form: _id, onClick: (event) => handleClose(undefined, true) }, (_k = props.mobileCloseButtonText) !== null && _k !== void 0 ? _k : DEFAULT_CLOSE_BUTTON))))) : null),
|
|
703
|
+
((_l = props.showClearSelection) !== null && _l !== void 0 ? _l : true) && (_values === null || _values === void 0 ? void 0 : _values.length) ? (React.createElement(DBButton, { icon: "cross", variant: "ghost", size: "small", noText: true, name: _id, form: _id, onClick: (event) => handleClearAll(event) },
|
|
705
704
|
props.clearSelectionText,
|
|
706
705
|
React.createElement(DBTooltip, { placement: "top" }, props.clearSelectionText))) : null,
|
|
707
|
-
React.createElement("span", { className: "db-custom-select-placeholder", "aria-hidden": getBooleanAsString(true), id: _placeholderId }, (
|
|
706
|
+
React.createElement("span", { className: "db-custom-select-placeholder", "aria-hidden": getBooleanAsString(true), id: _placeholderId }, (_m = props.placeholder) !== null && _m !== void 0 ? _m : props.label),
|
|
708
707
|
stringPropVisible(props.message, props.showMessage) ? (React.createElement(DBInfotext, { size: "small", icon: props.messageIcon, id: _messageId }, props.message)) : null,
|
|
709
708
|
hasValidState() ? (React.createElement(DBInfotext, { size: "small", semantic: "successful", id: _validMessageId }, props.validMessage || DEFAULT_VALID_MESSAGE)) : null,
|
|
710
709
|
React.createElement(DBInfotext, { size: "small", semantic: "critical", id: _invalidMessageId }, _invalidMessage),
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
declare const DBInfotext: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<any>, "text" | keyof import("../..").GlobalProps | "
|
|
2
|
+
declare const DBInfotext: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<any>, "semantic" | "text" | keyof import("../..").GlobalProps | "size" | "icon" | "showIcon"> & import("../..").GlobalProps & import("../..").SemanticProps & import("../..").IconProps & import("../..").SizeProps & import("../..").ShowIconProps & import("../..").TextProps & React.RefAttributes<any>>;
|
|
3
3
|
export default DBInfotext;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
declare const DBLink: React.ForwardRefExoticComponent<Omit<React.AnchorHTMLAttributes<any>, "text" | keyof import("../..").GlobalProps | "showIcon" | keyof import("./model").DBLinkDefaultProps | keyof import("../..").ClickEventProps<HTMLAnchorElement> | keyof import("../..").LinkProps | "wrap"> & import("./model").DBLinkDefaultProps & import("../..").GlobalProps & import("../..").ClickEventProps<HTMLAnchorElement> & import("../..").LinkProps & import("../..").ShowIconProps & import("../..").TextProps & import("../..").WrapProps & React.RefAttributes<any>>;
|
|
2
|
+
declare const DBLink: React.ForwardRefExoticComponent<Omit<React.AnchorHTMLAttributes<any>, "role" | "text" | keyof import("../..").GlobalProps | "showIcon" | keyof import("./model").DBLinkDefaultProps | keyof import("../..").ClickEventProps<HTMLAnchorElement> | keyof import("../..").LinkProps | "wrap"> & import("./model").DBLinkDefaultProps & import("../..").GlobalProps & import("../..").ClickEventProps<HTMLAnchorElement> & import("../..").LinkProps & import("../..").RoleProps & import("../..").ShowIconProps & import("../..").TextProps & import("../..").WrapProps & React.RefAttributes<any>>;
|
|
3
3
|
export default DBLink;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ClickEventProps, ClickEventState, GlobalProps, GlobalState, LinkProps, ShowIconProps, TextProps, WrapProps } from '../../shared/model';
|
|
1
|
+
import { ClickEventProps, ClickEventState, GlobalProps, GlobalState, LinkProps, RoleProps, ShowIconProps, TextProps, WrapProps } from '../../shared/model';
|
|
2
2
|
export declare const LinkVariantList: readonly ["adaptive", "brand", "inline"];
|
|
3
3
|
export type LinkVariantType = (typeof LinkVariantList)[number];
|
|
4
4
|
export declare const LinkSizeList: readonly ["medium", "small"];
|
|
@@ -19,6 +19,6 @@ export type DBLinkDefaultProps = {
|
|
|
19
19
|
*/
|
|
20
20
|
variant?: LinkVariantType;
|
|
21
21
|
};
|
|
22
|
-
export type DBLinkProps = DBLinkDefaultProps & GlobalProps & ClickEventProps<HTMLAnchorElement> & LinkProps & ShowIconProps & TextProps & WrapProps;
|
|
22
|
+
export type DBLinkProps = DBLinkDefaultProps & GlobalProps & ClickEventProps<HTMLAnchorElement> & LinkProps & RoleProps & ShowIconProps & TextProps & WrapProps;
|
|
23
23
|
export type DBLinkDefaultState = {};
|
|
24
24
|
export type DBLinkState = DBLinkDefaultState & GlobalState & ClickEventState<HTMLAnchorElement>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { PopoverDelayType, SizeType } from '../../../shared/model';
|
|
2
|
+
import { LoadingIndicatorStateType, LoadingIndicatorVariantType } from '../model';
|
|
3
|
+
export declare const indicators: {
|
|
4
|
+
variant: LoadingIndicatorVariantType;
|
|
5
|
+
progressText: string;
|
|
6
|
+
progressTextState: string;
|
|
7
|
+
label: string;
|
|
8
|
+
}[];
|
|
9
|
+
export declare const densities: {
|
|
10
|
+
value: string;
|
|
11
|
+
name: string;
|
|
12
|
+
}[];
|
|
13
|
+
export declare const indeterminateArray: {
|
|
14
|
+
value: boolean;
|
|
15
|
+
name: string;
|
|
16
|
+
}[];
|
|
17
|
+
export declare const sizes: {
|
|
18
|
+
value: SizeType;
|
|
19
|
+
name: string;
|
|
20
|
+
}[];
|
|
21
|
+
export declare const statesArray: {
|
|
22
|
+
value: LoadingIndicatorStateType;
|
|
23
|
+
name: string;
|
|
24
|
+
}[];
|
|
25
|
+
export declare const showLabels: {
|
|
26
|
+
value: boolean;
|
|
27
|
+
name: string;
|
|
28
|
+
}[];
|
|
29
|
+
export declare const showProgressTexts: {
|
|
30
|
+
value: boolean;
|
|
31
|
+
name: string;
|
|
32
|
+
}[];
|
|
33
|
+
export declare const overlays: {
|
|
34
|
+
value: boolean;
|
|
35
|
+
name: string;
|
|
36
|
+
}[];
|
|
37
|
+
export declare const delays: {
|
|
38
|
+
value: PopoverDelayType;
|
|
39
|
+
name: string;
|
|
40
|
+
}[];
|
|
41
|
+
export declare const buttonExamples: {
|
|
42
|
+
overlay: boolean;
|
|
43
|
+
name: string;
|
|
44
|
+
}[];
|
|
45
|
+
export type TimeoutStore = {
|
|
46
|
+
loadingState: LoadingIndicatorStateType;
|
|
47
|
+
onTimeoutFn: () => void;
|
|
48
|
+
getLabel: (loadingState: LoadingIndicatorStateType | string) => string;
|
|
49
|
+
};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
export const indicators = [{
|
|
2
|
+
variant: 'inline',
|
|
3
|
+
progressText: '42 of 100',
|
|
4
|
+
progressTextState: '100 of 100',
|
|
5
|
+
label: 'Inline'
|
|
6
|
+
}, {
|
|
7
|
+
variant: 'onsite',
|
|
8
|
+
progressText: '42%',
|
|
9
|
+
progressTextState: '100%',
|
|
10
|
+
label: 'Onsite'
|
|
11
|
+
}, {
|
|
12
|
+
variant: 'progress-bar',
|
|
13
|
+
progressText: '42 of 100',
|
|
14
|
+
progressTextState: '100 of 100',
|
|
15
|
+
label: 'Progress'
|
|
16
|
+
}];
|
|
17
|
+
export const densities = [{
|
|
18
|
+
value: 'functional',
|
|
19
|
+
name: 'Functional'
|
|
20
|
+
}, {
|
|
21
|
+
value: 'regular',
|
|
22
|
+
name: '(Default) Regular'
|
|
23
|
+
}, {
|
|
24
|
+
value: 'expressive',
|
|
25
|
+
name: 'Expressive'
|
|
26
|
+
}];
|
|
27
|
+
export const indeterminateArray = [{
|
|
28
|
+
value: true,
|
|
29
|
+
name: '(Default) True'
|
|
30
|
+
}, {
|
|
31
|
+
value: false,
|
|
32
|
+
name: 'False'
|
|
33
|
+
}];
|
|
34
|
+
export const sizes = [{
|
|
35
|
+
value: 'small',
|
|
36
|
+
name: 'Small'
|
|
37
|
+
}, {
|
|
38
|
+
value: 'medium',
|
|
39
|
+
name: '(Default) Medium'
|
|
40
|
+
}];
|
|
41
|
+
export const statesArray = [{
|
|
42
|
+
value: 'inactive',
|
|
43
|
+
name: 'Inactive'
|
|
44
|
+
}, {
|
|
45
|
+
value: 'active',
|
|
46
|
+
name: 'Active'
|
|
47
|
+
}, {
|
|
48
|
+
value: 'successful',
|
|
49
|
+
name: 'Successful'
|
|
50
|
+
}, {
|
|
51
|
+
value: 'critical',
|
|
52
|
+
name: 'Critical'
|
|
53
|
+
}];
|
|
54
|
+
export const showLabels = [{
|
|
55
|
+
value: true,
|
|
56
|
+
name: '(Default) True'
|
|
57
|
+
}, {
|
|
58
|
+
value: false,
|
|
59
|
+
name: 'False'
|
|
60
|
+
}];
|
|
61
|
+
export const showProgressTexts = [{
|
|
62
|
+
value: true,
|
|
63
|
+
name: '(Default) True'
|
|
64
|
+
}, {
|
|
65
|
+
value: false,
|
|
66
|
+
name: 'False'
|
|
67
|
+
}];
|
|
68
|
+
export const overlays = [{
|
|
69
|
+
value: false,
|
|
70
|
+
name: '(Default) False'
|
|
71
|
+
}, {
|
|
72
|
+
value: true,
|
|
73
|
+
name: 'True'
|
|
74
|
+
}];
|
|
75
|
+
export const delays = [{
|
|
76
|
+
value: 'none',
|
|
77
|
+
name: '(Default) None'
|
|
78
|
+
}, {
|
|
79
|
+
value: 'slow',
|
|
80
|
+
name: 'Slow'
|
|
81
|
+
}, {
|
|
82
|
+
value: 'fast',
|
|
83
|
+
name: 'Fast'
|
|
84
|
+
}];
|
|
85
|
+
export const buttonExamples = [{
|
|
86
|
+
overlay: false,
|
|
87
|
+
name: 'Without overlay'
|
|
88
|
+
}, {
|
|
89
|
+
overlay: true,
|
|
90
|
+
name: 'With overlay'
|
|
91
|
+
}];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as DBLoadingIndicator } from "./loading-indicator";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as DBLoadingIndicator } from "./loading-indicator";
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
declare const DBLoadingIndicator: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<any>, keyof import("../..").GlobalProps | "size" | "showLabel" | keyof import("./model").DBLoadingIndicatorDefaultProps | "delay"> & import("./model").DBLoadingIndicatorDefaultProps & import("../..").GlobalProps & import("../..").SizeProps & import("../..").ShowLabelProps & import("../..").DelayProps & React.RefAttributes<any>>;
|
|
3
|
+
export default DBLoadingIndicator;
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { filterPassingProps, getRootProps } from "../../utils/react";
|
|
4
|
+
import { useState, useRef, useEffect, forwardRef } from "react";
|
|
5
|
+
import { DEFAULT_ID } from "../../shared/constants";
|
|
6
|
+
import { cls, delay as delayFn, getBooleanAsString, uuid } from "../../utils";
|
|
7
|
+
function DBLoadingIndicatorFn(props, component) {
|
|
8
|
+
var _a, _b;
|
|
9
|
+
props = Object.assign({ indeterminate: true, variant: "inline", size: "medium", autoDisable: true }, props);
|
|
10
|
+
const _ref = component || useRef(undefined);
|
|
11
|
+
const [_id, set_id] = useState(() => DEFAULT_ID);
|
|
12
|
+
const [_loadingState, set_loadingState] = useState(() => "inactive");
|
|
13
|
+
const [_previousLoadingState, set_previousLoadingState] = useState(() => undefined);
|
|
14
|
+
const [_style, set_style] = useState(() => ({}));
|
|
15
|
+
const [initialized, setInitialized] = useState(() => false);
|
|
16
|
+
function getPercentage() {
|
|
17
|
+
if (props.indeterminate || !props.value || !props.max) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
return `${(Number(props.value) / Number(props.max)).toFixed(2)}`;
|
|
21
|
+
}
|
|
22
|
+
function getRole() {
|
|
23
|
+
if (props.role) {
|
|
24
|
+
if (props.role === "none") {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
return props.role;
|
|
28
|
+
}
|
|
29
|
+
return "status";
|
|
30
|
+
}
|
|
31
|
+
function handleParentDisabled() {
|
|
32
|
+
if (_ref.current && props.autoDisable && initialized) {
|
|
33
|
+
let parent = _ref.current.parentElement;
|
|
34
|
+
if (parent && parent.localName === "db-loading-indicator") {
|
|
35
|
+
parent = parent.parentElement;
|
|
36
|
+
}
|
|
37
|
+
if (parent && "disabled" in parent) {
|
|
38
|
+
parent.disabled = _loadingState !== "inactive";
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function handleParentAria(remove) {
|
|
43
|
+
if (_ref.current && _id && initialized) {
|
|
44
|
+
let parent = _ref.current.parentElement;
|
|
45
|
+
if (parent && parent.localName === "db-loading-indicator") {
|
|
46
|
+
parent = parent.parentElement;
|
|
47
|
+
}
|
|
48
|
+
if (!parent)
|
|
49
|
+
return;
|
|
50
|
+
const isButton = (parent === null || parent === void 0 ? void 0 : parent.localName) === "button";
|
|
51
|
+
if (!(isButton || props.overlay))
|
|
52
|
+
return;
|
|
53
|
+
const ariaAttribute = isButton ? "aria-labelledby" : "aria-describedby";
|
|
54
|
+
const ariaLabelledBy = parent.getAttribute(ariaAttribute);
|
|
55
|
+
let labelledByElements = ariaLabelledBy ? ariaLabelledBy.split(",") : [];
|
|
56
|
+
if (remove || _loadingState === "inactive") {
|
|
57
|
+
if (labelledByElements.includes(_id)) {
|
|
58
|
+
labelledByElements = labelledByElements.filter((elementId) => elementId !== _id);
|
|
59
|
+
if (!isButton) {
|
|
60
|
+
parent.ariaBusy = null;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
if (!labelledByElements.includes(_id)) {
|
|
69
|
+
labelledByElements.push(_id);
|
|
70
|
+
}
|
|
71
|
+
if (!isButton) {
|
|
72
|
+
parent.ariaBusy = _loadingState === "active" ? "true" : null;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
if (labelledByElements.length) {
|
|
76
|
+
parent.setAttribute(ariaAttribute, labelledByElements.join(","));
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
parent.removeAttribute(ariaAttribute);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
useEffect(() => {
|
|
84
|
+
set_id(props.id || "loading-indicator-" + uuid());
|
|
85
|
+
setInitialized(true);
|
|
86
|
+
}, []);
|
|
87
|
+
useEffect(() => {
|
|
88
|
+
handleParentDisabled();
|
|
89
|
+
}, [_ref.current, initialized, props.autoDisable, _loadingState]);
|
|
90
|
+
useEffect(() => {
|
|
91
|
+
handleParentAria(false);
|
|
92
|
+
}, [_ref.current, initialized, _loadingState, props.overlay, _id]);
|
|
93
|
+
useEffect(() => {
|
|
94
|
+
if (props.onTimeout) {
|
|
95
|
+
// Not merged if as workaround for angular
|
|
96
|
+
if (_loadingState !== "inactive" &&
|
|
97
|
+
_loadingState !== _previousLoadingState) {
|
|
98
|
+
set_previousLoadingState(_loadingState);
|
|
99
|
+
void delayFn(() => {
|
|
100
|
+
if (props.onTimeout) {
|
|
101
|
+
props.onTimeout(_loadingState);
|
|
102
|
+
}
|
|
103
|
+
}, _loadingState === "active" ? 5000 : 2000);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}, [_loadingState, props.onTimeout]);
|
|
107
|
+
useEffect(() => {
|
|
108
|
+
if (_loadingState === props.state)
|
|
109
|
+
return;
|
|
110
|
+
if (props.state) {
|
|
111
|
+
set_loadingState(props.state);
|
|
112
|
+
}
|
|
113
|
+
else if (props.indeterminate === undefined || props.indeterminate) {
|
|
114
|
+
set_loadingState("active");
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
set_loadingState("inactive");
|
|
118
|
+
}
|
|
119
|
+
}, [props.state]);
|
|
120
|
+
useEffect(() => {
|
|
121
|
+
if (_ref.current) {
|
|
122
|
+
if (props.delay === "slow" || props.delay === "fast") {
|
|
123
|
+
void delayFn(() => {
|
|
124
|
+
if (_ref.current) {
|
|
125
|
+
_ref.current.dataset["delay"] = "";
|
|
126
|
+
}
|
|
127
|
+
}, props.delay === "slow" ? 500 : 250);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}, [_ref.current, props.delay]);
|
|
131
|
+
useEffect(() => {
|
|
132
|
+
set_style({
|
|
133
|
+
"--db-loading-indicator-percentage": getPercentage(),
|
|
134
|
+
});
|
|
135
|
+
}, [props.indeterminate, props.value, props.max]);
|
|
136
|
+
useEffect(() => {
|
|
137
|
+
return () => {
|
|
138
|
+
handleParentAria(true);
|
|
139
|
+
handleParentDisabled();
|
|
140
|
+
};
|
|
141
|
+
}, []);
|
|
142
|
+
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", "autoDisable", "onTimeout"]), 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-loading-indicator", props.className), style: _style, "data-indeterminate": getBooleanAsString(props.indeterminate), "data-size": props.size, "data-variant": props.variant, "data-delay": props.delay, "data-state": _loadingState, "data-overlay": getBooleanAsString(props.overlay) }),
|
|
143
|
+
props.variant !== "progress-bar" ? (React.createElement("svg", { className: "db-loading-indicator-circle", "aria-hidden": "true", viewBox: props.variant === "inline" ? "10 10 20 20" : "32 32 64 64" },
|
|
144
|
+
React.createElement("circle", { className: "db-loading-indicator-circle-track" }),
|
|
145
|
+
React.createElement("circle", { className: "db-loading-indicator-circle-segment" }))) : null,
|
|
146
|
+
React.createElement("div", { role: getRole() },
|
|
147
|
+
React.createElement("label", { "data-show-label": getBooleanAsString(props.showLabel), id: _id },
|
|
148
|
+
props.label ? React.createElement(React.Fragment, null, props.label) : React.createElement(React.Fragment, null, props.children),
|
|
149
|
+
React.createElement("progress", { value: props.indeterminate ? undefined : (_a = props.value) !== null && _a !== void 0 ? _a : 0, max: props.indeterminate ? undefined : (_b = props.max) !== null && _b !== void 0 ? _b : 100 }, props.indeterminate ? React.createElement(React.Fragment, null, undefined) : React.createElement(React.Fragment, null, props.progressText))),
|
|
150
|
+
!props.indeterminate ? (React.createElement("span", { "aria-hidden": "true", "data-show-progress-text": getBooleanAsString(props.showProgressText) }, props.progressText)) : null)));
|
|
151
|
+
}
|
|
152
|
+
const DBLoadingIndicator = forwardRef(DBLoadingIndicatorFn);
|
|
153
|
+
export default DBLoadingIndicator;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { DelayProps, GlobalProps, GlobalState, InitializedState, ShowLabelProps, SizeProps } from '../../shared/model';
|
|
2
|
+
export declare const LoadingIndicatorVariantList: readonly ["progress-bar", "onsite", "inline"];
|
|
3
|
+
export type LoadingIndicatorVariantType = (typeof LoadingIndicatorVariantList)[number];
|
|
4
|
+
export declare const LoadingIndicatorStateList: readonly ["inactive", "active", "successful", "critical"];
|
|
5
|
+
export type LoadingIndicatorStateType = (typeof LoadingIndicatorStateList)[number];
|
|
6
|
+
export type DBLoadingIndicatorDefaultProps = {
|
|
7
|
+
indeterminate?: boolean | string;
|
|
8
|
+
label?: string;
|
|
9
|
+
max?: number | string;
|
|
10
|
+
progressText?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Enables/disables the visibility of the progressText
|
|
13
|
+
*/
|
|
14
|
+
showProgressText?: boolean | string;
|
|
15
|
+
value?: string | number;
|
|
16
|
+
overlay?: boolean | string;
|
|
17
|
+
variant?: LoadingIndicatorVariantType;
|
|
18
|
+
state?: LoadingIndicatorStateType | string;
|
|
19
|
+
/**
|
|
20
|
+
* Disable the parent component (e.g. a DBButton) when loading indicator is inside it
|
|
21
|
+
*/
|
|
22
|
+
autoDisable?: boolean | string;
|
|
23
|
+
role?: 'alert' | 'status' | 'none';
|
|
24
|
+
/**
|
|
25
|
+
* Triggers after a timeout. For "active" after 5 seconds, for "successful" and "critical" after 2 seconds
|
|
26
|
+
*/
|
|
27
|
+
onTimeout?: (state?: LoadingIndicatorStateType | string) => void;
|
|
28
|
+
};
|
|
29
|
+
export type DBLoadingIndicatorProps = DBLoadingIndicatorDefaultProps & GlobalProps & SizeProps & ShowLabelProps & DelayProps;
|
|
30
|
+
export type DBLoadingIndicatorDefaultState = {
|
|
31
|
+
_loadingState?: LoadingIndicatorStateType | string;
|
|
32
|
+
_previousLoadingState?: LoadingIndicatorStateType | string;
|
|
33
|
+
_style: any;
|
|
34
|
+
getPercentage: () => string | undefined;
|
|
35
|
+
getRole: () => string | undefined;
|
|
36
|
+
handleParentAria: (remove: boolean) => void;
|
|
37
|
+
handleParentDisabled: () => void;
|
|
38
|
+
};
|
|
39
|
+
export type DBLoadingIndicatorState = DBLoadingIndicatorDefaultState & GlobalState & InitializedState;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ClickEvent, CloseEventProps, CloseEventState, GlobalProps, GlobalState, IconProps, InnerCloseButtonProps, PopoverProps, SemanticProps, ShowIconProps, TextProps } from '../../shared/model';
|
|
1
|
+
import { ClickEvent, CloseEventProps, CloseEventState, GlobalProps, GlobalState, IconProps, InnerCloseButtonProps, PopoverProps, RoleProps, SemanticProps, ShowIconProps, TextProps } from '../../shared/model';
|
|
2
2
|
export declare const NotificationVariantList: readonly ["docked", "standalone", "overlay"];
|
|
3
3
|
export type NotificationVariantType = (typeof NotificationVariantList)[number];
|
|
4
4
|
export declare const NotificationLinkVariantList: readonly ["block", "inline"];
|
|
@@ -52,6 +52,6 @@ export type DBNotificationDefaultProps = {
|
|
|
52
52
|
*/
|
|
53
53
|
variant?: NotificationVariantType;
|
|
54
54
|
};
|
|
55
|
-
export type DBNotificationProps = DBNotificationDefaultProps & GlobalProps & CloseEventProps<ClickEvent<HTMLButtonElement>> & IconProps & SemanticProps & InnerCloseButtonProps & PopoverProps & ShowIconProps & TextProps;
|
|
55
|
+
export type DBNotificationProps = DBNotificationDefaultProps & GlobalProps & RoleProps & CloseEventProps<ClickEvent<HTMLButtonElement>> & IconProps & SemanticProps & InnerCloseButtonProps & PopoverProps & ShowIconProps & TextProps;
|
|
56
56
|
export type DBNotificationDefaultState = {};
|
|
57
57
|
export type DBNotificationState = DBNotificationDefaultState & GlobalState & CloseEventState<ClickEvent<HTMLButtonElement>>;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { ClickEvent } from "../../shared/model";
|
|
3
|
-
declare const DBNotification: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<any>, "text" | keyof import("../../shared/model").GlobalProps | "
|
|
3
|
+
declare const DBNotification: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<any>, "role" | "semantic" | "text" | keyof import("../../shared/model").GlobalProps | "icon" | "showIcon" | "width" | "delay" | "animation" | keyof import("../../shared/model").InnerCloseButtonProps | keyof import("./model").DBNotificationDefaultProps | keyof import("../../shared/model").CloseEventProps<ClickEvent<HTMLButtonElement>>> & import("./model").DBNotificationDefaultProps & import("../../shared/model").GlobalProps & import("../../shared/model").RoleProps & import("../../shared/model").CloseEventProps<ClickEvent<HTMLButtonElement>> & import("../../shared/model").IconProps & import("../../shared/model").SemanticProps & import("../../shared/model").InnerCloseButtonProps & {
|
|
4
|
+
animation?: boolean | string;
|
|
5
|
+
width?: import("../../shared/model").PopoverWidthType;
|
|
6
|
+
} & import("../../shared/model").DelayProps & import("../../shared/model").ShowIconProps & import("../../shared/model").TextProps & React.RefAttributes<any>>;
|
|
4
7
|
export default DBNotification;
|
|
@@ -3,7 +3,7 @@ import * as React from "react";
|
|
|
3
3
|
import { filterPassingProps, getRootProps } from "../../utils/react";
|
|
4
4
|
import { useRef, forwardRef } from "react";
|
|
5
5
|
import { DEFAULT_CLOSE_BUTTON } from "../../shared/constants";
|
|
6
|
-
import { cls, getBoolean, getBooleanAsString, stringPropVisible, } from "../../utils";
|
|
6
|
+
import { cls, getBoolean, getBooleanAsString, getNotificationRole, stringPropVisible, } from "../../utils";
|
|
7
7
|
import DBButton from "../button/button";
|
|
8
8
|
function DBNotificationFn(props, component) {
|
|
9
9
|
var _a;
|
|
@@ -16,7 +16,11 @@ function DBNotificationFn(props, component) {
|
|
|
16
16
|
props.onClose(event);
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
-
return (React.createElement("
|
|
19
|
+
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", "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), role: getNotificationRole({
|
|
20
|
+
semantic: props.semantic,
|
|
21
|
+
role: props.role,
|
|
22
|
+
ariaLive: props.ariaLive,
|
|
23
|
+
}), "aria-live": props.ariaLive, "data-semantic": props.semantic, "data-variant": props.variant, "data-icon": getBoolean(props.showIcon) !== false ? props.icon : undefined, "data-show-icon": getBooleanAsString(props.showIcon), "data-link-variant": props.linkVariant }),
|
|
20
24
|
React.createElement(React.Fragment, null, props.image),
|
|
21
25
|
stringPropVisible(props.headline, props.showHeadline) ? (React.createElement("header", null, props.headline)) : null,
|
|
22
26
|
React.createElement("p", null, props.text ? React.createElement(React.Fragment, null, props.text) : React.createElement(React.Fragment, null, props.children)),
|
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
declare const DBPopover: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<any>, keyof import("../..").GlobalProps | "placement" | "spacing" |
|
|
2
|
+
declare const DBPopover: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<any>, keyof import("../..").GlobalProps | "placement" | "width" | "spacing" | "delay" | "animation" | keyof import("./model").DBPopoverDefaultProps | "gap"> & import("./model").DBPopoverDefaultProps & import("../..").GlobalProps & import("../..").SpacingProps & import("../..").PlacementProps & import("../..").GapProps & {
|
|
3
|
+
animation?: boolean | string;
|
|
4
|
+
width?: import("../..").PopoverWidthType;
|
|
5
|
+
} & import("../..").DelayProps & React.RefAttributes<any>>;
|
|
3
6
|
export default DBPopover;
|
|
@@ -9,6 +9,15 @@ export type DBSelectDefaultProps = {
|
|
|
9
9
|
* If you don't/can't use children/slots you can pass in the options as an array.
|
|
10
10
|
*/
|
|
11
11
|
options?: DBSelectOptionType[];
|
|
12
|
+
/**
|
|
13
|
+
* Controls whether the empty placeholder option is shown in the dropdown after the user's selection of another option.
|
|
14
|
+
* By default, it is shown for non-required selects and hidden for required selects.
|
|
15
|
+
* Set to `true` to always show or `false` to always hide the empty option.
|
|
16
|
+
*
|
|
17
|
+
* Note: The empty option is only rendered when `variant === 'floating'` or a `placeholder` is set.
|
|
18
|
+
* Setting `showEmptyOption` alone has no effect if neither of these conditions is met.
|
|
19
|
+
*/
|
|
20
|
+
showEmptyOption?: boolean;
|
|
12
21
|
};
|
|
13
22
|
export type DBSelectOptionType = {
|
|
14
23
|
/**
|
|
@@ -40,5 +49,6 @@ export type DBSelectProps = GlobalProps & ClickEventProps<HTMLSelectElement> & C
|
|
|
40
49
|
export type DBSelectDefaultState = {
|
|
41
50
|
_placeholderId: string;
|
|
42
51
|
getOptionLabel: (option: DBSelectOptionType) => string;
|
|
52
|
+
shouldShowEmptyOption: () => boolean;
|
|
43
53
|
};
|
|
44
54
|
export type DBSelectState = DBSelectDefaultState & GlobalState & ClickEventState<HTMLSelectElement> & ChangeEventState<HTMLSelectElement> & FocusEventState<HTMLSelectElement> & InputEventState<HTMLSelectElement> & FormState & InitializedState & FromValidState;
|
|
@@ -87,6 +87,17 @@ function DBSelectFn(props, component) {
|
|
|
87
87
|
var _a, _b;
|
|
88
88
|
return (_a = option.label) !== null && _a !== void 0 ? _a : (_b = option.value) === null || _b === void 0 ? void 0 : _b.toString();
|
|
89
89
|
}
|
|
90
|
+
function shouldShowEmptyOption() {
|
|
91
|
+
const hasPlaceholderOrFloating = props.variant === "floating" || !!props.placeholder;
|
|
92
|
+
if (!hasPlaceholderOrFloating) {
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
if (props.showEmptyOption !== undefined) {
|
|
96
|
+
return props.showEmptyOption;
|
|
97
|
+
}
|
|
98
|
+
// Default: show empty option for non-required selects
|
|
99
|
+
return !props.required;
|
|
100
|
+
}
|
|
90
101
|
useEffect(() => {
|
|
91
102
|
var _a;
|
|
92
103
|
setInitialized(true);
|
|
@@ -156,7 +167,7 @@ function DBSelectFn(props, component) {
|
|
|
156
167
|
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-hide-asterisk": getHideProp(props.showRequiredAsterisk), "data-icon": props.icon, "data-show-icon": getBooleanAsString(props.showIcon) }),
|
|
157
168
|
React.createElement("label", { htmlFor: _id }, (_a = props.label) !== null && _a !== void 0 ? _a : DEFAULT_LABEL),
|
|
158
169
|
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: getBoolean(props.required, "required"), disabled: getBoolean(props.disabled, "disabled"), id: _id, name: props.name, size: props.size, value: props.value, autoComplete: props.autocomplete, multiple: props.multiple, onInput: (event) => handleInput(event), onClick: (event) => handleClick(event), onChange: (event) => handleChange(event), onBlur: (event) => handleBlur(event), onFocus: (event) => handleFocus(event), "aria-describedby": (_b = props.ariaDescribedBy) !== null && _b !== void 0 ? _b : _descByIds }),
|
|
159
|
-
props.variant === "floating" || props.placeholder ? (React.createElement("option", { className: "placeholder", value: "" })) : null,
|
|
170
|
+
props.variant === "floating" || !!props.placeholder ? (React.createElement("option", { className: "placeholder", value: "", "data-show-empty-option": getBooleanAsString(shouldShowEmptyOption()) })) : null,
|
|
160
171
|
((_c = props.options) === null || _c === void 0 ? void 0 : _c.length) ? (React.createElement(React.Fragment, null, (_d = props.options) === null || _d === void 0 ? void 0 : _d.map((option) => {
|
|
161
172
|
var _a;
|
|
162
173
|
return option.options ? (React.createElement("optgroup", { label: getOptionLabel(option), key: getOptionKey(option, "select-optgroup-") }, (_a = option.options) === null || _a === void 0 ? void 0 : _a.map((optgroupOption) => (React.createElement("option", { value: optgroupOption.value, disabled: optgroupOption.disabled, key: getOptionKey(optgroupOption, "select-optgroup-option-") }, getOptionLabel(optgroupOption)))))) : (React.createElement("option", { value: option.value, disabled: option.disabled, key: getOptionKey(option, "select-option-") }, getOptionLabel(option)));
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
declare const DBTag: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<any>, "content" | keyof import("../../shared/model").GlobalProps | "
|
|
2
|
+
declare const DBTag: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<any>, "content" | "semantic" | keyof import("../../shared/model").GlobalProps | "emphasis" | "icon" | "showIcon" | 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 & React.RefAttributes<any>>;
|
|
3
3
|
export default DBTag;
|
|
@@ -1,3 +1,6 @@
|
|
|
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 |
|
|
2
|
+
declare const DBTooltip: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<any>, keyof import("../../shared/model").GlobalProps | "placement" | "emphasis" | "width" | "delay" | keyof import("./model").DBTooltipDefaultProps | "animation"> & import("./model").DBTooltipDefaultProps & import("../../shared/model").GlobalProps & import("../../shared/model").EmphasisProps & import("../../shared/model").PlacementProps & {
|
|
3
|
+
animation?: boolean | string;
|
|
4
|
+
width?: import("../../shared/model").PopoverWidthType;
|
|
5
|
+
} & import("../../shared/model").DelayProps & React.RefAttributes<any>>;
|
|
3
6
|
export default DBTooltip;
|
package/dist/index.d.ts
CHANGED
|
@@ -77,3 +77,5 @@ export * from './utils/document-scroll-listener';
|
|
|
77
77
|
export * from './utils/floating-components';
|
|
78
78
|
export * from './utils/index';
|
|
79
79
|
export * from './utils/navigation';
|
|
80
|
+
export * from "./components/loading-indicator";
|
|
81
|
+
export * from "./components/loading-indicator/model";
|
package/dist/index.js
CHANGED
|
@@ -77,3 +77,5 @@ export * from './utils/document-scroll-listener';
|
|
|
77
77
|
export * from './utils/floating-components';
|
|
78
78
|
export * from './utils/index';
|
|
79
79
|
export * from './utils/navigation';
|
|
80
|
+
export * from "./components/loading-indicator";
|
|
81
|
+
export * from "./components/loading-indicator/model";
|
package/dist/shared/model.d.ts
CHANGED
|
@@ -158,10 +158,6 @@ export type PopoverDelayType = (typeof PopoverDelayList)[number];
|
|
|
158
158
|
export declare const PopoverWidthList: readonly ["auto", "fixed"];
|
|
159
159
|
export type PopoverWidthType = (typeof PopoverWidthList)[number];
|
|
160
160
|
export type PopoverProps = {
|
|
161
|
-
/**
|
|
162
|
-
* Add a delay before showing the tooltip
|
|
163
|
-
*/
|
|
164
|
-
delay?: PopoverDelayType;
|
|
165
161
|
/**
|
|
166
162
|
* Disable animation
|
|
167
163
|
*/
|
|
@@ -170,6 +166,12 @@ export type PopoverProps = {
|
|
|
170
166
|
* Use fixed with for default max-width
|
|
171
167
|
*/
|
|
172
168
|
width?: PopoverWidthType;
|
|
169
|
+
} & DelayProps;
|
|
170
|
+
export type DelayProps = {
|
|
171
|
+
/**
|
|
172
|
+
* Add a delay before showing the component
|
|
173
|
+
*/
|
|
174
|
+
delay?: PopoverDelayType;
|
|
173
175
|
};
|
|
174
176
|
export type NameProps = {
|
|
175
177
|
/**
|
|
@@ -398,10 +400,6 @@ export type LinkProps = {
|
|
|
398
400
|
* The relationship of the linked URL as space-separated link types.
|
|
399
401
|
*/
|
|
400
402
|
rel?: string;
|
|
401
|
-
/**
|
|
402
|
-
* Sets aria role based on [`aria-role`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles).
|
|
403
|
-
*/
|
|
404
|
-
role?: string;
|
|
405
403
|
/**
|
|
406
404
|
* How much of the referrer to send when following the link.
|
|
407
405
|
* @deprecated use `referrerPolicy` instead
|
|
@@ -412,6 +410,12 @@ export type LinkProps = {
|
|
|
412
410
|
*/
|
|
413
411
|
referrerPolicy?: LinkReferrerPolicyType;
|
|
414
412
|
};
|
|
413
|
+
export type RoleProps = {
|
|
414
|
+
/**
|
|
415
|
+
* Sets aria role based on [`aria-role`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles).
|
|
416
|
+
*/
|
|
417
|
+
role?: string;
|
|
418
|
+
};
|
|
415
419
|
export type TextProps = {
|
|
416
420
|
/**
|
|
417
421
|
* Alternative for default slot/children.
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -58,3 +58,15 @@ export declare const getOptionKey: (option: {
|
|
|
58
58
|
value?: string | number | string[] | undefined;
|
|
59
59
|
}, prefix: string) => string;
|
|
60
60
|
export declare const isKeyboardEvent: <T>(event?: ClickEvent<T> | GeneralKeyboardEvent<T>) => event is GeneralKeyboardEvent<T>;
|
|
61
|
+
/**
|
|
62
|
+
* Maps semantic values to appropriate ARIA roles for notifications
|
|
63
|
+
* @param semantic - The semantic type of the notification
|
|
64
|
+
* @param role - The aria role of the notification
|
|
65
|
+
* @param ariaLive - The aria-live of the notification
|
|
66
|
+
* @returns The appropriate ARIA role or undefined for default behavior
|
|
67
|
+
*/
|
|
68
|
+
export declare const getNotificationRole: ({ semantic, role, ariaLive }: {
|
|
69
|
+
semantic?: string;
|
|
70
|
+
role?: string;
|
|
71
|
+
ariaLive?: string;
|
|
72
|
+
}) => string | undefined;
|
package/dist/utils/index.js
CHANGED
|
@@ -141,3 +141,28 @@ export const getOptionKey = (option, prefix) => {
|
|
|
141
141
|
return `${prefix}${key}`;
|
|
142
142
|
};
|
|
143
143
|
export const isKeyboardEvent = (event) => event.key !== undefined;
|
|
144
|
+
/**
|
|
145
|
+
* Maps semantic values to appropriate ARIA roles for notifications
|
|
146
|
+
* @param semantic - The semantic type of the notification
|
|
147
|
+
* @param role - The aria role of the notification
|
|
148
|
+
* @param ariaLive - The aria-live of the notification
|
|
149
|
+
* @returns The appropriate ARIA role or undefined for default behavior
|
|
150
|
+
*/
|
|
151
|
+
export const getNotificationRole = ({ semantic, role, ariaLive }) => {
|
|
152
|
+
if (role) {
|
|
153
|
+
return role;
|
|
154
|
+
}
|
|
155
|
+
if (ariaLive) {
|
|
156
|
+
return 'article';
|
|
157
|
+
}
|
|
158
|
+
switch (semantic) {
|
|
159
|
+
case 'critical':
|
|
160
|
+
case 'warning':
|
|
161
|
+
return 'alert';
|
|
162
|
+
case 'informational':
|
|
163
|
+
case 'successful':
|
|
164
|
+
return 'status';
|
|
165
|
+
default:
|
|
166
|
+
return 'article';
|
|
167
|
+
}
|
|
168
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@db-ux/react-core-components",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.4.0-loading-567cd0c",
|
|
4
4
|
"description": "React components for @db-ux/core-components",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@playwright/experimental-ct-react": "1.57.0",
|
|
34
|
-
"@types/react": "19.2.
|
|
35
|
-
"react": "19.2.
|
|
36
|
-
"react-dom": "19.2.
|
|
34
|
+
"@types/react": "19.2.10",
|
|
35
|
+
"react": "19.2.4",
|
|
36
|
+
"react-dom": "19.2.4"
|
|
37
37
|
},
|
|
38
38
|
"publishConfig": {
|
|
39
39
|
"registry": "https://registry.npmjs.org/",
|
|
@@ -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.4.0-loading-567cd0c",
|
|
45
|
+
"@db-ux/core-foundations": "4.4.0-loading-567cd0c"
|
|
46
46
|
}
|
|
47
47
|
}
|