@db-ux/react-core-components 1.0.0-test-13b991d

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.
Files changed (200) hide show
  1. package/README.md +76 -0
  2. package/dist/components/accordion/accordion.d.ts +3 -0
  3. package/dist/components/accordion/accordion.js +92 -0
  4. package/dist/components/accordion/index.d.ts +1 -0
  5. package/dist/components/accordion/index.js +1 -0
  6. package/dist/components/accordion/model.d.ts +41 -0
  7. package/dist/components/accordion/model.js +2 -0
  8. package/dist/components/accordion-item/accordion-item.d.ts +8 -0
  9. package/dist/components/accordion-item/accordion-item.js +34 -0
  10. package/dist/components/accordion-item/index.d.ts +1 -0
  11. package/dist/components/accordion-item/index.js +1 -0
  12. package/dist/components/accordion-item/model.d.ts +24 -0
  13. package/dist/components/accordion-item/model.js +1 -0
  14. package/dist/components/badge/badge.d.ts +3 -0
  15. package/dist/components/badge/badge.js +32 -0
  16. package/dist/components/badge/index.d.ts +1 -0
  17. package/dist/components/badge/index.js +1 -0
  18. package/dist/components/badge/model.d.ts +16 -0
  19. package/dist/components/badge/model.js +1 -0
  20. package/dist/components/brand/brand.d.ts +3 -0
  21. package/dist/components/brand/brand.js +13 -0
  22. package/dist/components/brand/index.d.ts +1 -0
  23. package/dist/components/brand/index.js +1 -0
  24. package/dist/components/brand/model.d.ts +10 -0
  25. package/dist/components/brand/model.js +1 -0
  26. package/dist/components/button/button.d.ts +3 -0
  27. package/dist/components/button/button.js +16 -0
  28. package/dist/components/button/index.d.ts +1 -0
  29. package/dist/components/button/index.js +1 -0
  30. package/dist/components/button/model.d.ts +52 -0
  31. package/dist/components/button/model.js +3 -0
  32. package/dist/components/card/card.d.ts +3 -0
  33. package/dist/components/card/card.js +16 -0
  34. package/dist/components/card/index.d.ts +1 -0
  35. package/dist/components/card/index.js +1 -0
  36. package/dist/components/card/model.d.ts +18 -0
  37. package/dist/components/card/model.js +2 -0
  38. package/dist/components/checkbox/checkbox.d.ts +3 -0
  39. package/dist/components/checkbox/checkbox.js +112 -0
  40. package/dist/components/checkbox/index.d.ts +1 -0
  41. package/dist/components/checkbox/index.js +1 -0
  42. package/dist/components/checkbox/model.d.ts +10 -0
  43. package/dist/components/checkbox/model.js +1 -0
  44. package/dist/components/divider/divider.d.ts +3 -0
  45. package/dist/components/divider/divider.js +11 -0
  46. package/dist/components/divider/index.d.ts +1 -0
  47. package/dist/components/divider/index.js +1 -0
  48. package/dist/components/divider/model.d.ts +18 -0
  49. package/dist/components/divider/model.js +2 -0
  50. package/dist/components/drawer/drawer.d.ts +3 -0
  51. package/dist/components/drawer/drawer.js +70 -0
  52. package/dist/components/drawer/index.d.ts +1 -0
  53. package/dist/components/drawer/index.js +1 -0
  54. package/dist/components/drawer/model.d.ts +41 -0
  55. package/dist/components/drawer/model.js +3 -0
  56. package/dist/components/header/header.d.ts +3 -0
  57. package/dist/components/header/header.js +68 -0
  58. package/dist/components/header/index.d.ts +1 -0
  59. package/dist/components/header/index.js +1 -0
  60. package/dist/components/header/model.d.ts +44 -0
  61. package/dist/components/header/model.js +1 -0
  62. package/dist/components/icon/icon.d.ts +3 -0
  63. package/dist/components/icon/icon.js +11 -0
  64. package/dist/components/icon/index.d.ts +1 -0
  65. package/dist/components/icon/index.js +1 -0
  66. package/dist/components/icon/model.d.ts +12 -0
  67. package/dist/components/icon/model.js +2 -0
  68. package/dist/components/infotext/index.d.ts +1 -0
  69. package/dist/components/infotext/index.js +1 -0
  70. package/dist/components/infotext/infotext.d.ts +3 -0
  71. package/dist/components/infotext/infotext.js +12 -0
  72. package/dist/components/infotext/model.d.ts +5 -0
  73. package/dist/components/infotext/model.js +1 -0
  74. package/dist/components/input/index.d.ts +1 -0
  75. package/dist/components/input/index.js +1 -0
  76. package/dist/components/input/input.d.ts +3 -0
  77. package/dist/components/input/input.js +119 -0
  78. package/dist/components/input/model.d.ts +39 -0
  79. package/dist/components/input/model.js +5 -0
  80. package/dist/components/link/index.d.ts +1 -0
  81. package/dist/components/link/index.js +1 -0
  82. package/dist/components/link/link.d.ts +3 -0
  83. package/dist/components/link/link.js +17 -0
  84. package/dist/components/link/model.d.ts +24 -0
  85. package/dist/components/link/model.js +3 -0
  86. package/dist/components/navigation/index.d.ts +1 -0
  87. package/dist/components/navigation/index.js +1 -0
  88. package/dist/components/navigation/model.d.ts +5 -0
  89. package/dist/components/navigation/model.js +1 -0
  90. package/dist/components/navigation/navigation.d.ts +3 -0
  91. package/dist/components/navigation/navigation.js +17 -0
  92. package/dist/components/navigation-item/index.d.ts +1 -0
  93. package/dist/components/navigation-item/index.js +1 -0
  94. package/dist/components/navigation-item/model.d.ts +34 -0
  95. package/dist/components/navigation-item/model.js +1 -0
  96. package/dist/components/navigation-item/navigation-item.d.ts +3 -0
  97. package/dist/components/navigation-item/navigation-item.js +68 -0
  98. package/dist/components/notification/index.d.ts +1 -0
  99. package/dist/components/notification/index.js +1 -0
  100. package/dist/components/notification/model.d.ts +57 -0
  101. package/dist/components/notification/model.js +3 -0
  102. package/dist/components/notification/notification.d.ts +3 -0
  103. package/dist/components/notification/notification.js +25 -0
  104. package/dist/components/page/index.d.ts +1 -0
  105. package/dist/components/page/index.js +1 -0
  106. package/dist/components/page/model.d.ts +32 -0
  107. package/dist/components/page/model.js +2 -0
  108. package/dist/components/page/page.d.ts +3 -0
  109. package/dist/components/page/page.js +47 -0
  110. package/dist/components/popover/index.d.ts +1 -0
  111. package/dist/components/popover/index.js +1 -0
  112. package/dist/components/popover/model.d.ts +18 -0
  113. package/dist/components/popover/model.js +1 -0
  114. package/dist/components/popover/popover.d.ts +3 -0
  115. package/dist/components/popover/popover.js +74 -0
  116. package/dist/components/radio/index.d.ts +1 -0
  117. package/dist/components/radio/index.js +1 -0
  118. package/dist/components/radio/model.d.ts +7 -0
  119. package/dist/components/radio/model.js +1 -0
  120. package/dist/components/radio/radio.d.ts +3 -0
  121. package/dist/components/radio/radio.js +54 -0
  122. package/dist/components/section/index.d.ts +1 -0
  123. package/dist/components/section/index.js +1 -0
  124. package/dist/components/section/model.d.ts +5 -0
  125. package/dist/components/section/model.js +1 -0
  126. package/dist/components/section/section.d.ts +3 -0
  127. package/dist/components/section/section.js +16 -0
  128. package/dist/components/select/index.d.ts +1 -0
  129. package/dist/components/select/index.js +1 -0
  130. package/dist/components/select/model.d.ts +43 -0
  131. package/dist/components/select/model.js +1 -0
  132. package/dist/components/select/select.d.ts +3 -0
  133. package/dist/components/select/select.js +132 -0
  134. package/dist/components/stack/index.d.ts +1 -0
  135. package/dist/components/stack/index.js +1 -0
  136. package/dist/components/stack/model.d.ts +34 -0
  137. package/dist/components/stack/model.js +4 -0
  138. package/dist/components/stack/stack.d.ts +3 -0
  139. package/dist/components/stack/stack.js +11 -0
  140. package/dist/components/switch/index.d.ts +1 -0
  141. package/dist/components/switch/index.js +1 -0
  142. package/dist/components/switch/model.d.ts +12 -0
  143. package/dist/components/switch/model.js +1 -0
  144. package/dist/components/switch/switch.d.ts +3 -0
  145. package/dist/components/switch/switch.js +47 -0
  146. package/dist/components/tab-item/index.d.ts +1 -0
  147. package/dist/components/tab-item/index.js +1 -0
  148. package/dist/components/tab-item/model.d.ts +24 -0
  149. package/dist/components/tab-item/model.js +1 -0
  150. package/dist/components/tab-item/tab-item.d.ts +3 -0
  151. package/dist/components/tab-item/tab-item.js +37 -0
  152. package/dist/components/tab-list/index.d.ts +1 -0
  153. package/dist/components/tab-list/index.js +1 -0
  154. package/dist/components/tab-list/model.d.ts +5 -0
  155. package/dist/components/tab-list/model.js +1 -0
  156. package/dist/components/tab-list/tab-list.d.ts +3 -0
  157. package/dist/components/tab-list/tab-list.js +17 -0
  158. package/dist/components/tab-panel/index.d.ts +1 -0
  159. package/dist/components/tab-panel/index.js +1 -0
  160. package/dist/components/tab-panel/model.d.ts +10 -0
  161. package/dist/components/tab-panel/model.js +1 -0
  162. package/dist/components/tab-panel/tab-panel.d.ts +3 -0
  163. package/dist/components/tab-panel/tab-panel.js +14 -0
  164. package/dist/components/tabs/index.d.ts +1 -0
  165. package/dist/components/tabs/index.js +1 -0
  166. package/dist/components/tabs/model.d.ts +47 -0
  167. package/dist/components/tabs/model.js +2 -0
  168. package/dist/components/tabs/tabs.d.ts +3 -0
  169. package/dist/components/tabs/tabs.js +138 -0
  170. package/dist/components/tag/index.d.ts +1 -0
  171. package/dist/components/tag/index.js +1 -0
  172. package/dist/components/tag/model.d.ts +45 -0
  173. package/dist/components/tag/model.js +1 -0
  174. package/dist/components/tag/tag.d.ts +3 -0
  175. package/dist/components/tag/tag.js +46 -0
  176. package/dist/components/textarea/index.d.ts +1 -0
  177. package/dist/components/textarea/index.js +1 -0
  178. package/dist/components/textarea/model.d.ts +30 -0
  179. package/dist/components/textarea/model.js +2 -0
  180. package/dist/components/textarea/textarea.d.ts +3 -0
  181. package/dist/components/textarea/textarea.js +105 -0
  182. package/dist/components/tooltip/index.d.ts +1 -0
  183. package/dist/components/tooltip/index.js +1 -0
  184. package/dist/components/tooltip/model.d.ts +7 -0
  185. package/dist/components/tooltip/model.js +1 -0
  186. package/dist/components/tooltip/tooltip.d.ts +3 -0
  187. package/dist/components/tooltip/tooltip.js +43 -0
  188. package/dist/index.d.ts +36 -0
  189. package/dist/index.js +36 -0
  190. package/dist/shared/constants.d.ts +83 -0
  191. package/dist/shared/constants.js +87 -0
  192. package/dist/shared/model.d.ts +446 -0
  193. package/dist/shared/model.js +20 -0
  194. package/dist/utils/form-components.d.ts +2 -0
  195. package/dist/utils/form-components.js +10 -0
  196. package/dist/utils/index.d.ts +61 -0
  197. package/dist/utils/index.js +166 -0
  198. package/dist/utils/navigation.d.ts +32 -0
  199. package/dist/utils/navigation.js +136 -0
  200. package/package.json +43 -0
@@ -0,0 +1,119 @@
1
+ "use client";
2
+ import * as React from "react";
3
+ import { useState, useRef, useEffect, forwardRef } from "react";
4
+ import { cls, delay, getHideProp, hasVoiceOver, isArrayOfStrings, stringPropVisible, uuid, filterPassingProps, getRootProps } from "../../utils";
5
+ import { DEFAULT_DATALIST_ID_SUFFIX, DEFAULT_INVALID_MESSAGE, DEFAULT_INVALID_MESSAGE_ID_SUFFIX, DEFAULT_LABEL, DEFAULT_MESSAGE_ID_SUFFIX, DEFAULT_PLACEHOLDER, DEFAULT_VALID_MESSAGE, DEFAULT_VALID_MESSAGE_ID_SUFFIX, } from "../../shared/constants";
6
+ import DBInfotext from "../infotext/infotext";
7
+ function DBInputFn(props, component) {
8
+ var _a, _b, _c, _d, _e, _f, _g;
9
+ const _ref = component || useRef(component);
10
+ const [_id, set_id] = useState(() => undefined);
11
+ const [_messageId, set_messageId] = useState(() => undefined);
12
+ const [_validMessageId, set_validMessageId] = useState(() => undefined);
13
+ const [_invalidMessageId, set_invalidMessageId] = useState(() => undefined);
14
+ const [_dataListId, set_dataListId] = useState(() => undefined);
15
+ const [_descByIds, set_descByIds] = useState(() => "");
16
+ const [_value, set_value] = useState(() => "");
17
+ const [_voiceOverFallback, set_voiceOverFallback] = useState(() => "");
18
+ function handleInput(event) {
19
+ if (props.onInput) {
20
+ props.onInput(event);
21
+ }
22
+ if (props.input) {
23
+ props.input(event);
24
+ }
25
+ }
26
+ function handleChange(event) {
27
+ var _a, _b, _c, _d, _e, _f;
28
+ if (props.onChange) {
29
+ props.onChange(event);
30
+ }
31
+ if (props.change) {
32
+ props.change(event);
33
+ }
34
+ /* For a11y reasons we need to map the correct message with the input */
35
+ if (!((_a = _ref.current) === null || _a === void 0 ? void 0 : _a.validity.valid) || props.validation === "invalid") {
36
+ set_descByIds(_invalidMessageId);
37
+ if (hasVoiceOver()) {
38
+ set_voiceOverFallback((_d = (_b = props.invalidMessage) !== null && _b !== void 0 ? _b : (_c = _ref.current) === null || _c === void 0 ? void 0 : _c.validationMessage) !== null && _d !== void 0 ? _d : DEFAULT_INVALID_MESSAGE);
39
+ delay(() => set_voiceOverFallback(""), 1000);
40
+ }
41
+ }
42
+ else if (props.validation === "valid" ||
43
+ (((_e = _ref.current) === null || _e === void 0 ? void 0 : _e.validity.valid) &&
44
+ (props.required || props.minLength || props.maxLength || props.pattern))) {
45
+ set_descByIds(_validMessageId);
46
+ if (hasVoiceOver()) {
47
+ set_voiceOverFallback((_f = props.validMessage) !== null && _f !== void 0 ? _f : DEFAULT_VALID_MESSAGE);
48
+ delay(() => set_voiceOverFallback(""), 1000);
49
+ }
50
+ }
51
+ else if (stringPropVisible(props.message, props.showMessage)) {
52
+ set_descByIds(_messageId);
53
+ }
54
+ else {
55
+ set_descByIds("");
56
+ }
57
+ }
58
+ function handleBlur(event) {
59
+ if (props.onBlur) {
60
+ props.onBlur(event);
61
+ }
62
+ if (props.blur) {
63
+ props.blur(event);
64
+ }
65
+ }
66
+ function handleFocus(event) {
67
+ if (props.onFocus) {
68
+ props.onFocus(event);
69
+ }
70
+ if (props.focus) {
71
+ props.focus(event);
72
+ }
73
+ }
74
+ function getDataList(_list) {
75
+ return Array.from((isArrayOfStrings(_list)
76
+ ? _list.map((val) => ({
77
+ value: val,
78
+ label: undefined,
79
+ }))
80
+ : _list) || []);
81
+ }
82
+ useEffect(() => {
83
+ var _a;
84
+ const mId = (_a = props.id) !== null && _a !== void 0 ? _a : `input-${uuid()}`;
85
+ set_id(mId);
86
+ set_messageId(mId + DEFAULT_MESSAGE_ID_SUFFIX);
87
+ set_validMessageId(mId + DEFAULT_VALID_MESSAGE_ID_SUFFIX);
88
+ set_invalidMessageId(mId + DEFAULT_INVALID_MESSAGE_ID_SUFFIX);
89
+ set_dataListId(mId + DEFAULT_DATALIST_ID_SUFFIX);
90
+ }, []);
91
+ useEffect(() => {
92
+ var _a;
93
+ if (_id) {
94
+ const messageId = _id + DEFAULT_MESSAGE_ID_SUFFIX;
95
+ set_messageId(messageId);
96
+ set_validMessageId(_id + DEFAULT_VALID_MESSAGE_ID_SUFFIX);
97
+ set_invalidMessageId(_id + DEFAULT_INVALID_MESSAGE_ID_SUFFIX);
98
+ set_dataListId((_a = props.dataListId) !== null && _a !== void 0 ? _a : _id + DEFAULT_DATALIST_ID_SUFFIX);
99
+ if (stringPropVisible(props.message, props.showMessage)) {
100
+ set_descByIds(messageId);
101
+ }
102
+ }
103
+ }, [_id]);
104
+ useEffect(() => {
105
+ set_value(props.value);
106
+ }, [props.value]);
107
+ 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
+ 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
+ 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
+ props.children,
112
+ stringPropVisible(props.message, props.showMessage) ? (React.createElement(DBInfotext, { size: "small", icon: props.messageIcon, id: _messageId }, props.message)) : null,
113
+ React.createElement(DBInfotext, { size: "small", semantic: "successful", id: _validMessageId }, (_d = props.validMessage) !== null && _d !== void 0 ? _d : DEFAULT_VALID_MESSAGE),
114
+ React.createElement(DBInfotext, { size: "small", semantic: "critical", id: _invalidMessageId }, (_g = (_e = props.invalidMessage) !== null && _e !== void 0 ? _e : (_f = _ref.current) === null || _f === void 0 ? void 0 : _f.validationMessage) !== null && _g !== void 0 ? _g : DEFAULT_INVALID_MESSAGE),
115
+ React.createElement("span", { "data-visually-hidden": "true", role: "status" }, _voiceOverFallback)));
116
+ }
117
+ const DBInput = forwardRef(DBInputFn);
118
+ DBInput.defaultProps = {};
119
+ export default DBInput;
@@ -0,0 +1,39 @@
1
+ import { ChangeEventProps, ChangeEventState, FocusEventProps, FocusEventState, FormMessageProps, FormProps, FormState, FormTextProps, GlobalProps, GlobalState, IconAfterProps, IconProps, InputEventProps, InputEventState, ShowIconProps, ValueLabelType } from '../../shared/model';
2
+ export declare const InputTypeList: readonly ["color", "date", "datetime-local", "email", "file", "hidden", "month", "number", "password", "range", "search", "tel", "text", "time", "url", "week"];
3
+ export type InputTypeType = (typeof InputTypeList)[number];
4
+ export type DBInputDefaultProps = {
5
+ /**
6
+ * Set a [data list](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/datalist) via attribute instead of children.
7
+ */
8
+ dataList?: string[] | ValueLabelType[];
9
+ /**
10
+ * Add a custom id to [data list](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/datalist) if you're using `dataList` attribute.
11
+ */
12
+ dataListId?: string;
13
+ /**
14
+ * Maximum value
15
+ */
16
+ max?: number | string;
17
+ /**
18
+ * Minimum value
19
+ */
20
+ min?: number | string;
21
+ /**
22
+ * Pattern the value must match to be valid
23
+ */
24
+ pattern?: string;
25
+ /**
26
+ * Type of form control
27
+ */
28
+ type?: InputTypeType | string;
29
+ /**
30
+ * Sets [step value](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/step).
31
+ */
32
+ step?: number | string;
33
+ };
34
+ export type DBInputProps = DBInputDefaultProps & GlobalProps & FormTextProps & InputEventProps<HTMLInputElement> & ChangeEventProps<HTMLInputElement> & FocusEventProps<HTMLInputElement> & FormProps & IconProps & IconAfterProps & FormMessageProps & ShowIconProps;
35
+ export type DBInputDefaultState = {
36
+ _dataListId?: string;
37
+ getDataList: (_list?: string[] | ValueLabelType[]) => ValueLabelType[];
38
+ };
39
+ export type DBInputState = DBInputDefaultState & GlobalState & InputEventState<HTMLInputElement> & ChangeEventState<HTMLInputElement> & FocusEventState<HTMLInputElement> & FormState;
@@ -0,0 +1,5 @@
1
+ export const InputTypeList = ['color', 'date', 'datetime-local', 'email', 'file',
2
+ // TODO: move this to own component
3
+ 'hidden', 'month', 'number', 'password', 'range',
4
+ // TODO: move this to own component
5
+ 'search', 'tel', 'text', 'time', 'url', 'week'];
@@ -0,0 +1 @@
1
+ export { default as DBLink } from './link';
@@ -0,0 +1 @@
1
+ export { default as DBLink } from './link';
@@ -0,0 +1,3 @@
1
+ import * as React from "react";
2
+ declare const DBLink: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<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
+ export default DBLink;
@@ -0,0 +1,17 @@
1
+ "use client";
2
+ import * as React from "react";
3
+ import { useRef, forwardRef } from "react";
4
+ import { cls, getBooleanAsString, getHideProp, filterPassingProps, getRootProps } from "../../utils";
5
+ function DBLinkFn(props, component) {
6
+ var _a;
7
+ const _ref = component || useRef(component);
8
+ function handleClick(event) {
9
+ if (props.onClick) {
10
+ props.onClick(event);
11
+ }
12
+ }
13
+ return (React.createElement("a", Object.assign({ ref: _ref }, filterPassingProps(props, ["data-icon-variant", "data-icon-variant-before", "data-icon-variant-after", "data-icon-weight", "data-icon-weight-before", "data-icon-weight-after", "data-interactive", "data-force-mobile", "data-color", "data-container-color", "data-bg-color", "data-on-bg-color", "data-color-scheme", "data-font-size", "data-headline-size", "data-divider", "data-focus", "data-font"]), { id: props.id }, getRootProps(props, ["data-icon-variant", "data-icon-variant-before", "data-icon-variant-after", "data-icon-weight", "data-icon-weight-before", "data-icon-weight-after", "data-interactive", "data-force-mobile", "data-color", "data-container-color", "data-bg-color", "data-on-bg-color", "data-color-scheme", "data-font-size", "data-headline-size", "data-divider", "data-focus", "data-font"]), { className: cls("db-link", props.className), href: props.href, target: props.target, rel: props.rel, role: props.role, hrefLang: props.hreflang, "aria-disabled": getBooleanAsString(props.disabled), tabIndex: props.disabled ? -1 : 0, "aria-selected": props.selected, "aria-label": props.label, "aria-current": props.current, "data-size": props.size, "data-hide-icon-after": getHideProp((_a = props.showIcon) !== null && _a !== void 0 ? _a : true), "data-variant": props.variant, "data-content": props.content || "internal", onClick: (event) => handleClick(event) }), props.text ? React.createElement(React.Fragment, null, props.text) : React.createElement(React.Fragment, null, props.children)));
14
+ }
15
+ const DBLink = forwardRef(DBLinkFn);
16
+ DBLink.defaultProps = {};
17
+ export default DBLink;
@@ -0,0 +1,24 @@
1
+ import { ClickEventProps, ClickEventState, GlobalProps, GlobalState, LinkProps, ShowIconProps, TextProps } from '../../shared/model';
2
+ export declare const LinkVariantList: readonly ["adaptive", "brand"];
3
+ export type LinkVariantType = (typeof LinkVariantList)[number];
4
+ export declare const LinkSizeList: readonly ["medium", "small"];
5
+ export type LinkSizeType = (typeof LinkSizeList)[number];
6
+ export declare const LinkContentList: readonly ["external", "internal"];
7
+ export type LinkContentType = (typeof LinkContentList)[number];
8
+ export type DBLinkDefaultProps = {
9
+ /**
10
+ * Adds a different arrow after the link to indicate external or internal link
11
+ */
12
+ content?: LinkContentType;
13
+ /**
14
+ * Change the size of the link
15
+ */
16
+ size?: LinkSizeType;
17
+ /**
18
+ * Change the styling of the link. `inline` will remove the arrow. Defaults to adaptive.
19
+ */
20
+ variant?: LinkVariantType;
21
+ };
22
+ export type DBLinkProps = DBLinkDefaultProps & GlobalProps & ClickEventProps<HTMLAnchorElement> & LinkProps & ShowIconProps & TextProps;
23
+ export type DBLinkDefaultState = {};
24
+ export type DBLinkState = DBLinkDefaultState & GlobalState & ClickEventState<HTMLAnchorElement>;
@@ -0,0 +1,3 @@
1
+ export const LinkVariantList = ['adaptive', 'brand'];
2
+ export const LinkSizeList = ['medium', 'small'];
3
+ export const LinkContentList = ['external', 'internal'];
@@ -0,0 +1 @@
1
+ export { default as DBNavigation } from './navigation';
@@ -0,0 +1 @@
1
+ export { default as DBNavigation } from './navigation';
@@ -0,0 +1,5 @@
1
+ import { AriaLabelledByProps, GlobalProps, GlobalState } from '../../shared/model';
2
+ export type DBNavigationDefaultProps = {};
3
+ export type DBNavigationProps = DBNavigationDefaultProps & GlobalProps & AriaLabelledByProps;
4
+ export type DBNavigationDefaultState = {};
5
+ export type DBNavigationState = DBNavigationDefaultState & GlobalState;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ import * as React from "react";
2
+ declare const DBNavigation: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<HTMLDivElement>, keyof import("../..").GlobalProps | "labelledBy"> & import("../..").GlobalProps & import("../..").AriaLabelledByProps & React.RefAttributes<HTMLDivElement>>;
3
+ export default DBNavigation;
@@ -0,0 +1,17 @@
1
+ "use client";
2
+ import * as React from "react";
3
+ import { useState, useRef, useEffect, forwardRef } from "react";
4
+ import { cls, uuid, filterPassingProps, getRootProps } from "../../utils";
5
+ import { DEFAULT_ID } from "../../shared/constants";
6
+ function DBNavigationFn(props, component) {
7
+ const _ref = component || useRef(component);
8
+ const [_id, set_id] = useState(() => DEFAULT_ID);
9
+ useEffect(() => {
10
+ set_id(props.id || "navigation-" + uuid());
11
+ }, []);
12
+ return (React.createElement("nav", Object.assign({ ref: _ref }, filterPassingProps(props, ["data-icon-variant", "data-icon-variant-before", "data-icon-variant-after", "data-icon-weight", "data-icon-weight-before", "data-icon-weight-after", "data-interactive", "data-force-mobile", "data-color", "data-container-color", "data-bg-color", "data-on-bg-color", "data-color-scheme", "data-font-size", "data-headline-size", "data-divider", "data-focus", "data-font"]), { id: _id, "aria-labelledby": props.labelledBy }, getRootProps(props, ["data-icon-variant", "data-icon-variant-before", "data-icon-variant-after", "data-icon-weight", "data-icon-weight-before", "data-icon-weight-after", "data-interactive", "data-force-mobile", "data-color", "data-container-color", "data-bg-color", "data-on-bg-color", "data-color-scheme", "data-font-size", "data-headline-size", "data-divider", "data-focus", "data-font"]), { className: cls("db-navigation", props.className) }),
13
+ React.createElement("menu", null, props.children)));
14
+ }
15
+ const DBNavigation = forwardRef(DBNavigationFn);
16
+ DBNavigation.defaultProps = {};
17
+ export default DBNavigation;
@@ -0,0 +1 @@
1
+ export { default as DBNavigationItem } from './navigation-item';
@@ -0,0 +1 @@
1
+ export { default as DBNavigationItem } from './navigation-item';
@@ -0,0 +1,34 @@
1
+ import { ClickEvent, ClickEventProps, ClickEventState, GlobalProps, GlobalState, IconProps, InitializedState, NavigationBackButtonProps, ShowIconProps, TextProps, WidthProps } from '../../shared/model';
2
+ import { NavigationItemSafeTriangle } from '../../utils/navigation';
3
+ export type DBNavigationItemDefaultProps = {
4
+ /**
5
+ * Alternative indicator for active navigation item (bold font). In contrast to the use of aria-current="page" on the contained anchor, this does not guarantee correct a11y.
6
+ */
7
+ active?: boolean;
8
+ /**
9
+ * The disabled attribute can be set to [keep a user from clicking on the item](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#disabled).
10
+ */
11
+ disabled?: boolean;
12
+ /**
13
+ * React-specific property to pass in a slot for sub-navigation
14
+ */
15
+ subNavigation?: any;
16
+ /**
17
+ * This is for mobile navigation only, if it is set the sub-navigation is a static overlay
18
+ */
19
+ subNavigationExpanded?: boolean;
20
+ };
21
+ export type DBNavigationItemProps = DBNavigationItemDefaultProps & GlobalProps & ClickEventProps<HTMLButtonElement> & IconProps & WidthProps & NavigationBackButtonProps & ShowIconProps & TextProps;
22
+ export type DBNavigationItemDefaultState = {
23
+ handleBackClick: (event: ClickEvent<HTMLButtonElement>) => void;
24
+ hasAreaPopup: boolean;
25
+ isSubNavigationExpanded: boolean;
26
+ subNavigationId: string;
27
+ /**
28
+ * Internal state property to show/hide sub-navigation button
29
+ */
30
+ hasSubNavigation?: boolean;
31
+ updateSubNavigationState: () => void;
32
+ navigationItemSafeTriangle?: NavigationItemSafeTriangle;
33
+ };
34
+ export type DBNavigationItemState = DBNavigationItemDefaultState & ClickEventState<HTMLButtonElement> & GlobalState & InitializedState;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ import * as React from "react";
2
+ declare const DBNavigationItem: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<HTMLLIElement>, "width" | "text" | "icon" | "onClick" | keyof import("../../shared/model").GlobalProps | "showIcon" | keyof import("./model").DBNavigationItemDefaultProps | keyof import("../../shared/model").NavigationBackButtonProps> & import("./model").DBNavigationItemDefaultProps & import("../../shared/model").GlobalProps & import("../../shared/model").ClickEventProps<HTMLButtonElement> & import("../../shared/model").IconProps & import("../../shared/model").WidthProps & import("../../shared/model").NavigationBackButtonProps & import("../../shared/model").ShowIconProps & import("../../shared/model").TextProps & React.RefAttributes<HTMLLIElement>>;
3
+ export default DBNavigationItem;
@@ -0,0 +1,68 @@
1
+ "use client";
2
+ import * as React from "react";
3
+ import { useState, useRef, useEffect, forwardRef } from "react";
4
+ import DBButton from "../button/button";
5
+ import { cls, getBooleanAsString, getHideProp, uuid, filterPassingProps, getRootProps } from "../../utils";
6
+ import { NavigationItemSafeTriangle } from "../../utils/navigation";
7
+ import { DEFAULT_BACK } from "../../shared/constants";
8
+ function DBNavigationItemFn(props, component) {
9
+ var _a;
10
+ const _ref = component || useRef(component);
11
+ const [initialized, setInitialized] = useState(() => false);
12
+ const [hasAreaPopup, setHasAreaPopup] = useState(() => false);
13
+ const [hasSubNavigation, setHasSubNavigation] = useState(() => true);
14
+ const [isSubNavigationExpanded, setIsSubNavigationExpanded] = useState(() => false);
15
+ const [subNavigationId, setSubNavigationId] = useState(() => "sub-navigation-" + uuid());
16
+ const [navigationItemSafeTriangle, setNavigationItemSafeTriangle] = useState(() => undefined);
17
+ function handleClick(event) {
18
+ if (props.onClick) {
19
+ props.onClick(event);
20
+ }
21
+ if (hasAreaPopup) {
22
+ setIsSubNavigationExpanded(true);
23
+ }
24
+ }
25
+ function handleBackClick(event) {
26
+ event.stopPropagation();
27
+ setIsSubNavigationExpanded(false);
28
+ }
29
+ function updateSubNavigationState() {
30
+ var _a;
31
+ if (initialized && document && subNavigationId) {
32
+ const subNavigationSlot = document === null || document === void 0 ? void 0 : document.getElementById(subNavigationId);
33
+ if (subNavigationSlot) {
34
+ if (((_a = subNavigationSlot.children) === null || _a === void 0 ? void 0 : _a.length) > 0) {
35
+ setHasAreaPopup(true);
36
+ if (!navigationItemSafeTriangle) {
37
+ setNavigationItemSafeTriangle(new NavigationItemSafeTriangle(_ref.current, subNavigationSlot));
38
+ }
39
+ }
40
+ else {
41
+ setHasSubNavigation(false);
42
+ }
43
+ }
44
+ }
45
+ }
46
+ useEffect(() => {
47
+ setInitialized(true);
48
+ }, []);
49
+ useEffect(() => {
50
+ if (props.subNavigationExpanded !== undefined) {
51
+ setIsSubNavigationExpanded(!!props.subNavigationExpanded);
52
+ }
53
+ }, [props.subNavigationExpanded]);
54
+ useEffect(() => {
55
+ updateSubNavigationState();
56
+ }, [initialized]);
57
+ return (React.createElement("li", Object.assign({ ref: _ref }, filterPassingProps(props, ["data-icon-variant", "data-icon-variant-before", "data-icon-variant-after", "data-icon-weight", "data-icon-weight-before", "data-icon-weight-after", "data-interactive", "data-force-mobile", "data-color", "data-container-color", "data-bg-color", "data-on-bg-color", "data-color-scheme", "data-font-size", "data-headline-size", "data-divider", "data-focus", "data-font"]), { id: props.id, onMouseOver: (event) => navigationItemSafeTriangle === null || navigationItemSafeTriangle === void 0 ? void 0 : navigationItemSafeTriangle.enableFollow(), onMouseLeave: (event) => navigationItemSafeTriangle === null || navigationItemSafeTriangle === void 0 ? void 0 : navigationItemSafeTriangle.disableFollow(), onMouseMove: (event) => navigationItemSafeTriangle === null || navigationItemSafeTriangle === void 0 ? void 0 : navigationItemSafeTriangle.followByMouseEvent(event) }, getRootProps(props, ["data-icon-variant", "data-icon-variant-before", "data-icon-variant-after", "data-icon-weight", "data-icon-weight-before", "data-icon-weight-after", "data-interactive", "data-force-mobile", "data-color", "data-container-color", "data-bg-color", "data-on-bg-color", "data-color-scheme", "data-font-size", "data-headline-size", "data-divider", "data-focus", "data-font"]), { className: cls("db-navigation-item", props.className), "data-width": props.width, "data-icon": props.icon, "data-hide-icon": getHideProp(props.showIcon), "data-active": props.active, "aria-disabled": getBooleanAsString(props.disabled) }),
58
+ !hasSubNavigation ? (React.createElement(React.Fragment, null, props.text ? React.createElement(React.Fragment, null, props.text) : React.createElement(React.Fragment, null, props.children))) : null,
59
+ hasSubNavigation ? (React.createElement(React.Fragment, null,
60
+ 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 },
62
+ hasAreaPopup ? (React.createElement("div", { className: "db-mobile-navigation-back" },
63
+ 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
+ React.createElement(React.Fragment, null, props.subNavigation)))) : null));
65
+ }
66
+ const DBNavigationItem = forwardRef(DBNavigationItemFn);
67
+ DBNavigationItem.defaultProps = {};
68
+ export default DBNavigationItem;
@@ -0,0 +1 @@
1
+ export { default as DBNotification } from './notification';
@@ -0,0 +1 @@
1
+ export { default as DBNotification } from './notification';
@@ -0,0 +1,57 @@
1
+ import { CloseEventProps, CloseEventState, GlobalProps, GlobalState, IconProps, InnerCloseButtonProps, PopoverProps, SemanticProps, ShowIconProps, TextProps } from '../../shared/model';
2
+ export declare const NotificationVariantList: readonly ["docked", "standalone", "overlay"];
3
+ export type NotificationVariantType = (typeof NotificationVariantList)[number];
4
+ export declare const NotificationLinkVariantList: readonly ["block", "inline"];
5
+ export type NotificationLinkVariantType = (typeof NotificationLinkVariantList)[number];
6
+ export declare const NotificationAriaLiveList: readonly ["assertive", "polite", "off"];
7
+ export type NotificationAriaLiveType = (typeof NotificationAriaLiveList)[number];
8
+ export type DBNotificationDefaultProps = {
9
+ /**
10
+ * The arialive attribute will lead to that the screenreader interrupts immediately
11
+ * and reads out the notification if set to "assertive", while it will wait for the
12
+ * user's idleness when set to "polite", compare to [aria-live](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-live)
13
+ */
14
+ ariaLive?: NotificationAriaLiveType;
15
+ /**
16
+ * The closeable attribute shows/hides the close button on the top right.
17
+ */
18
+ closeable?: boolean;
19
+ /**
20
+ * The headline attribute changes the text of the bold headline.
21
+ */
22
+ headline?: string | any;
23
+ /**
24
+ * The slotImage can be set instead of an icon.
25
+ */
26
+ image?: any;
27
+ /**
28
+ * The slotLink can be set for non overlay-notifications
29
+ */
30
+ link?: any;
31
+ /**
32
+ * The linkVariant will be used if slotLink is set.
33
+ */
34
+ linkVariant?: NotificationLinkVariantType;
35
+ /**
36
+ * Enables or disables the visibility of the headline.
37
+ */
38
+ showHeadline?: boolean;
39
+ /**
40
+ * The timestamp attribute can be set for overlay notifications
41
+ */
42
+ timestamp?: string;
43
+ /**
44
+ * Enables or disables the visibility of the timestamp.
45
+ */
46
+ showTimestamp?: boolean;
47
+ /**
48
+ * The variant attribute changes the styling of the notification.
49
+ * The docked notifications are used e.g. between header and main content to show a global alert.
50
+ * The standalone notifications are used e.g. inside a form to show an alert for a specific field.
51
+ * The overlay notifications are used for absolute and floating notifications like snackbars etc.
52
+ */
53
+ variant?: NotificationVariantType;
54
+ };
55
+ export type DBNotificationProps = DBNotificationDefaultProps & GlobalProps & CloseEventProps & IconProps & SemanticProps & InnerCloseButtonProps & PopoverProps & ShowIconProps & TextProps;
56
+ export type DBNotificationDefaultState = {};
57
+ export type DBNotificationState = DBNotificationDefaultState & GlobalState & CloseEventState;
@@ -0,0 +1,3 @@
1
+ export const NotificationVariantList = ['docked', 'standalone', 'overlay'];
2
+ export const NotificationLinkVariantList = ['block', 'inline'];
3
+ export const NotificationAriaLiveList = ['assertive', 'polite', 'off'];
@@ -0,0 +1,3 @@
1
+ import * as React from "react";
2
+ declare const DBNotification: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<HTMLDivElement>, "text" | "icon" | "onClose" | keyof import("../../shared/model").GlobalProps | "showIcon" | keyof import("./model").DBNotificationDefaultProps | "semantic" | keyof import("../../shared/model").InnerCloseButtonProps | keyof import("../../shared/model").PopoverProps> & import("./model").DBNotificationDefaultProps & import("../../shared/model").GlobalProps & import("../../shared/model").CloseEventProps & import("../../shared/model").IconProps & import("../../shared/model").SemanticProps & import("../../shared/model").InnerCloseButtonProps & import("../../shared/model").PopoverProps & import("../../shared/model").ShowIconProps & import("../../shared/model").TextProps & React.RefAttributes<HTMLDivElement>>;
3
+ export default DBNotification;
@@ -0,0 +1,25 @@
1
+ "use client";
2
+ import * as React from "react";
3
+ import { useRef, forwardRef } from "react";
4
+ import DBButton from "../button/button";
5
+ import { DEFAULT_CLOSE_BUTTON } from "../../shared/constants";
6
+ import { cls, getHideProp, stringPropVisible, filterPassingProps, getRootProps } from "../../utils";
7
+ function DBNotificationFn(props, component) {
8
+ var _a;
9
+ const _ref = component || useRef(component);
10
+ function handleClose(event) {
11
+ if (props.onClose) {
12
+ props.onClose();
13
+ }
14
+ }
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
+ React.createElement(React.Fragment, null, props.image),
17
+ stringPropVisible(props.headline, props.showHeadline) ? (React.createElement("header", null, props.headline)) : null,
18
+ React.createElement("p", null, props.text ? React.createElement(React.Fragment, null, props.text) : React.createElement(React.Fragment, null, props.children)),
19
+ stringPropVisible(props.timestamp, props.showTimestamp) ? (React.createElement("span", null, props.timestamp)) : null,
20
+ React.createElement(React.Fragment, null, props.link),
21
+ props.closeable ? (React.createElement(DBButton, { icon: "cross", variant: "ghost", size: "small", id: props.closeButtonId, noText: true, onClick: (event) => handleClose(event) }, (_a = props.closeButtonText) !== null && _a !== void 0 ? _a : DEFAULT_CLOSE_BUTTON)) : null));
22
+ }
23
+ const DBNotification = forwardRef(DBNotificationFn);
24
+ DBNotification.defaultProps = {};
25
+ export default DBNotification;
@@ -0,0 +1 @@
1
+ export { default as DBPage } from './page';
@@ -0,0 +1 @@
1
+ export { default as DBPage } from './page';
@@ -0,0 +1,32 @@
1
+ import { GlobalProps, GlobalState } from '../../shared/model';
2
+ export declare const PageVariantList: readonly ["auto", "fixed"];
3
+ export type PageVariantType = (typeof PageVariantList)[number];
4
+ export declare const PageDocumentOverflowList: readonly ["hidden", "auto"];
5
+ export type PageDocumentOverflowType = (typeof PageDocumentOverflowList)[number];
6
+ export type DBPageDefaultProps = {
7
+ /**
8
+ * The documentOverflow sets the overflow:hidden/auto to the root document
9
+ */
10
+ documentOverflow?: PageDocumentOverflowType;
11
+ /**
12
+ * Set this to have a transition with opacity to avoid layout-shifts https://simonhearne.com/2021/layout-shifts-webfonts/
13
+ */
14
+ fadeIn?: boolean;
15
+ /**
16
+ * The slot can be used for React to set a footer.
17
+ */
18
+ footer?: any;
19
+ /**
20
+ * The slot can be used for React to set a header.
21
+ */
22
+ header?: any;
23
+ /**
24
+ * The variant=fixed uses flex-box to make header and footer static
25
+ */
26
+ variant?: PageVariantType;
27
+ };
28
+ export type DBPageProps = DBPageDefaultProps & GlobalProps;
29
+ export type DBPageDefaultState = {
30
+ fontsLoaded?: boolean;
31
+ };
32
+ export type DBPageState = DBPageDefaultState & GlobalState;
@@ -0,0 +1,2 @@
1
+ export const PageVariantList = ['auto', 'fixed'];
2
+ export const PageDocumentOverflowList = ['hidden', 'auto'];
@@ -0,0 +1,3 @@
1
+ import * as React from "react";
2
+ declare const DBPage: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<HTMLDivElement>, keyof import("../..").GlobalProps | keyof import("./model").DBPageDefaultProps> & import("./model").DBPageDefaultProps & import("../..").GlobalProps & React.RefAttributes<HTMLDivElement>>;
3
+ export default DBPage;
@@ -0,0 +1,47 @@
1
+ "use client";
2
+ import * as React from "react";
3
+ import { useState, useRef, useEffect, forwardRef } from "react";
4
+ import { cls, getBooleanAsString, filterPassingProps, getRootProps } from "../../utils";
5
+ function DBPageFn(props, component) {
6
+ const _ref = component || useRef(component);
7
+ const [fontsLoaded, setFontsLoaded] = useState(() => false);
8
+ const hasInitialized = useRef(false);
9
+ if (!hasInitialized.current) {
10
+ if (typeof window !== "undefined" &&
11
+ document &&
12
+ (props.documentOverflow === "hidden" ||
13
+ (props.variant === "fixed" && props.documentOverflow !== "auto"))) {
14
+ // We need to set this to `html` element that the flex-box solution works
15
+ // See https://stackoverflow.com/a/43710216 - Approach 1 - flexbox
16
+ document.documentElement.classList.add("db-page-document");
17
+ }
18
+ hasInitialized.current = true;
19
+ }
20
+ useEffect(() => {
21
+ setFontsLoaded(!props.fadeIn);
22
+ if (document && props.fadeIn) {
23
+ document.fonts.ready.then(() => {
24
+ setFontsLoaded(true);
25
+ });
26
+ }
27
+ else {
28
+ setFontsLoaded(true);
29
+ }
30
+ }, []);
31
+ useEffect(() => {
32
+ return () => {
33
+ if (typeof window !== "undefined" &&
34
+ document.documentElement.classList.contains("db-page-document")) {
35
+ // remove document styles set by this
36
+ document.documentElement.classList.remove("db-page-document");
37
+ }
38
+ };
39
+ }, []);
40
+ 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-page", props.className), "data-variant": props.variant, "data-fade-in": props.fadeIn, "data-fonts-loaded": getBooleanAsString(fontsLoaded) }),
41
+ React.createElement(React.Fragment, null, props.header),
42
+ React.createElement("main", { className: "db-main" }, props.children),
43
+ React.createElement(React.Fragment, null, props.footer)));
44
+ }
45
+ const DBPage = forwardRef(DBPageFn);
46
+ DBPage.defaultProps = {};
47
+ export default DBPage;
@@ -0,0 +1 @@
1
+ export { default as DBPopover } from './popover';
@@ -0,0 +1 @@
1
+ export { default as DBPopover } from './popover';