carbon-react 110.0.1 → 110.0.4

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 (71) hide show
  1. package/esm/__internal__/focus-trap/focus-trap-utils.d.ts +4 -3
  2. package/esm/__internal__/focus-trap/focus-trap-utils.js +3 -12
  3. package/esm/__internal__/focus-trap/focus-trap.component.d.ts +19 -0
  4. package/esm/__internal__/focus-trap/focus-trap.component.js +61 -45
  5. package/esm/__internal__/focus-trap/index.d.ts +2 -0
  6. package/esm/__internal__/utils/helpers/tags/tags-specs/tags-specs.d.ts +1 -1
  7. package/esm/components/definition-list/__internal__/dl.context.d.ts +6 -0
  8. package/esm/components/definition-list/dd.component.d.ts +8 -0
  9. package/esm/components/definition-list/dd.component.js +310 -5
  10. package/esm/components/definition-list/definition-list.style.d.ts +22 -0
  11. package/esm/components/definition-list/definition-list.style.js +3 -4
  12. package/esm/components/definition-list/dl.component.d.ts +9 -0
  13. package/esm/components/definition-list/dl.component.js +323 -27
  14. package/esm/components/definition-list/dt.component.d.ts +8 -0
  15. package/esm/components/definition-list/dt.component.js +310 -5
  16. package/esm/components/definition-list/index.d.ts +6 -3
  17. package/esm/components/definition-list/index.js +2 -2
  18. package/esm/components/dialog/dialog.component.js +3 -3
  19. package/esm/components/dialog-full-screen/dialog-full-screen.component.js +2 -2
  20. package/esm/components/dialog-full-screen/dialog-full-screen.style.js +4 -0
  21. package/esm/components/flat-table/flat-table-row/flat-table-row.style.js +30 -2
  22. package/esm/components/modal/modal.component.d.ts +1 -20
  23. package/esm/components/modal/modal.component.js +8 -21
  24. package/esm/components/profile/index.d.ts +2 -1
  25. package/esm/components/profile/profile.component.d.ts +18 -0
  26. package/esm/components/profile/profile.component.js +8 -21
  27. package/esm/components/profile/profile.config.d.ts +55 -0
  28. package/esm/components/profile/profile.style.d.ts +16 -0
  29. package/esm/components/profile/profile.style.js +5 -14
  30. package/esm/components/sidebar/sidebar.component.js +1 -1
  31. package/esm/components/sidebar/sidebar.style.js +5 -0
  32. package/lib/__internal__/focus-trap/focus-trap-utils.d.ts +4 -3
  33. package/lib/__internal__/focus-trap/focus-trap-utils.js +5 -13
  34. package/lib/__internal__/focus-trap/focus-trap.component.d.ts +19 -0
  35. package/lib/__internal__/focus-trap/focus-trap.component.js +59 -43
  36. package/lib/__internal__/focus-trap/index.d.ts +2 -0
  37. package/lib/__internal__/utils/helpers/tags/tags-specs/tags-specs.d.ts +1 -1
  38. package/lib/components/definition-list/__internal__/dl.context.d.ts +6 -0
  39. package/lib/components/definition-list/dd.component.d.ts +8 -0
  40. package/lib/components/definition-list/dd.component.js +311 -7
  41. package/lib/components/definition-list/definition-list.style.d.ts +22 -0
  42. package/lib/components/definition-list/definition-list.style.js +3 -4
  43. package/lib/components/definition-list/dl.component.d.ts +9 -0
  44. package/lib/components/definition-list/dl.component.js +326 -28
  45. package/lib/components/definition-list/dt.component.d.ts +8 -0
  46. package/lib/components/definition-list/dt.component.js +311 -7
  47. package/lib/components/definition-list/index.d.ts +6 -3
  48. package/lib/components/definition-list/index.js +8 -8
  49. package/lib/components/dialog/dialog.component.js +3 -3
  50. package/lib/components/dialog-full-screen/dialog-full-screen.component.js +2 -2
  51. package/lib/components/dialog-full-screen/dialog-full-screen.style.js +4 -0
  52. package/lib/components/flat-table/flat-table-row/flat-table-row.style.js +30 -2
  53. package/lib/components/modal/modal.component.d.ts +1 -20
  54. package/lib/components/modal/modal.component.js +8 -20
  55. package/lib/components/profile/index.d.ts +2 -1
  56. package/lib/components/profile/profile.component.d.ts +18 -0
  57. package/lib/components/profile/profile.component.js +9 -24
  58. package/lib/components/profile/profile.config.d.ts +55 -0
  59. package/lib/components/profile/profile.style.d.ts +16 -0
  60. package/lib/components/profile/profile.style.js +5 -14
  61. package/lib/components/sidebar/sidebar.component.js +1 -1
  62. package/lib/components/sidebar/sidebar.style.js +5 -0
  63. package/package.json +1 -1
  64. package/esm/components/definition-list/dd.d.ts +0 -11
  65. package/esm/components/definition-list/dl.d.ts +0 -19
  66. package/esm/components/definition-list/dt.d.ts +0 -10
  67. package/esm/components/profile/profile.d.ts +0 -18
  68. package/lib/components/definition-list/dd.d.ts +0 -11
  69. package/lib/components/definition-list/dl.d.ts +0 -19
  70. package/lib/components/definition-list/dt.d.ts +0 -10
  71. package/lib/components/profile/profile.d.ts +0 -18
@@ -1,3 +1,4 @@
1
- export const defaultFocusableSelectors: "button:not([disabled]), [href], input:not([type=\"hidden\"]):not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]";
2
- export function getNextElement(element: any, focusableElements: any, shiftKey: any): any;
3
- export function setElementFocus(element: any): void;
1
+ declare const defaultFocusableSelectors = "button:not([disabled]), [href], input:not([type=\"hidden\"]):not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]";
2
+ declare const setElementFocus: (element: HTMLElement) => void;
3
+ declare const getNextElement: (element: HTMLElement, focusableElements: HTMLElement[], shiftKey: boolean) => HTMLElement;
4
+ export { defaultFocusableSelectors, getNextElement, setElementFocus };
@@ -1,8 +1,8 @@
1
1
  const defaultFocusableSelectors = 'button:not([disabled]), [href], input:not([type="hidden"]):not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]';
2
+ const INTERVAL = 10;
3
+ const MAX_TIME = 100;
2
4
 
3
- const waitForVisibleAndFocus = element => {
4
- const INTERVAL = 10;
5
- const MAX_TIME = 100;
5
+ const setElementFocus = element => {
6
6
  let timeSoFar = 0;
7
7
 
8
8
  const stylesMatch = () => {
@@ -24,15 +24,6 @@ const waitForVisibleAndFocus = element => {
24
24
  check();
25
25
  };
26
26
 
27
- function setElementFocus(element) {
28
- if (typeof element === "function") {
29
- element();
30
- } else {
31
- const el = element.current || element;
32
- waitForVisibleAndFocus(el);
33
- }
34
- }
35
-
36
27
  const isRadio = element => {
37
28
  return element.hasAttribute("type") && element.getAttribute("type") === "radio";
38
29
  };
@@ -0,0 +1,19 @@
1
+ import React from "react";
2
+ declare type CustomRefObject<T> = {
3
+ current?: T | null;
4
+ };
5
+ export interface FocusTrapProps {
6
+ children: React.ReactNode;
7
+ autoFocus?: boolean;
8
+ /** provide a custom first element to focus */
9
+ focusFirstElement?: CustomRefObject<HTMLElement> | HTMLElement;
10
+ /** a custom callback that will override the default focus trap behaviour */
11
+ bespokeTrap?: (ev: KeyboardEvent, firstElement?: HTMLElement, lastElement?: HTMLElement) => void;
12
+ /** a ref to the container wrapping the focusable elements */
13
+ wrapperRef?: CustomRefObject<HTMLElement>;
14
+ isOpen?: boolean;
15
+ /** an optional array of refs to containers whose content should also be reachable from the FocusTrap */
16
+ additionalWrapperRefs?: CustomRefObject<HTMLElement>[];
17
+ }
18
+ declare const FocusTrap: ({ children, autoFocus, focusFirstElement, bespokeTrap, wrapperRef, isOpen, additionalWrapperRefs, }: FocusTrapProps) => JSX.Element;
19
+ export default FocusTrap;
@@ -1,8 +1,8 @@
1
- import React, { useCallback, useContext, useEffect, useLayoutEffect, useRef, useState } from "react";
1
+ import React, { useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
2
2
  import PropTypes from "prop-types";
3
3
  import { defaultFocusableSelectors, getNextElement, setElementFocus } from "./focus-trap-utils";
4
4
  import { ModalContext } from "../../components/modal/modal.component";
5
- import usePrevious from "../../hooks/__internal__/usePrevious";
5
+ import usePrevious from "../../hooks/__internal__/usePrevious"; // TODO investigate why React.RefObject<T> produces a failed prop type when current = null
6
6
 
7
7
  const FocusTrap = ({
8
8
  children,
@@ -29,7 +29,8 @@ const FocusTrap = ({
29
29
 
30
30
  return Array.from(candidate).some((el, i) => el !== focusableElements[i]);
31
31
  }, [focusableElements]);
32
- const allRefs = [wrapperRef, ...additionalWrapperRefs].map(ref => ref === null || ref === void 0 ? void 0 : ref.current);
32
+ const trapWrappers = useMemo(() => additionalWrapperRefs !== null && additionalWrapperRefs !== void 0 && additionalWrapperRefs.length ? [wrapperRef, ...additionalWrapperRefs] : [wrapperRef], [additionalWrapperRefs, wrapperRef]);
33
+ const allRefs = trapWrappers.map(ref => ref === null || ref === void 0 ? void 0 : ref.current);
33
34
  const updateFocusableElements = useCallback(() => {
34
35
  const elements = [];
35
36
  allRefs.forEach(ref => {
@@ -46,14 +47,18 @@ const FocusTrap = ({
46
47
  }, [hasNewInputs, allRefs]);
47
48
  useEffect(() => {
48
49
  const observer = new MutationObserver(updateFocusableElements);
49
- observer.observe(trapRef.current, {
50
- subtree: true,
51
- childList: true,
52
- attributes: true,
53
- characterData: true
50
+ trapWrappers.forEach(wrapper => {
51
+ if (wrapper !== null && wrapper !== void 0 && wrapper.current) {
52
+ observer.observe(wrapper === null || wrapper === void 0 ? void 0 : wrapper.current, {
53
+ subtree: true,
54
+ childList: true,
55
+ attributes: true,
56
+ characterData: true
57
+ });
58
+ }
54
59
  });
55
60
  return () => observer.disconnect();
56
- }, [updateFocusableElements]);
61
+ }, [updateFocusableElements, trapWrappers]);
57
62
  useLayoutEffect(() => {
58
63
  updateFocusableElements();
59
64
  }, [children, updateFocusableElements]);
@@ -61,7 +66,8 @@ const FocusTrap = ({
61
66
  const prevShouldSetFocus = usePrevious(shouldSetFocus);
62
67
  useEffect(() => {
63
68
  if (shouldSetFocus && !prevShouldSetFocus) {
64
- setElementFocus(focusFirstElement || (wrapperRef === null || wrapperRef === void 0 ? void 0 : wrapperRef.current));
69
+ const candidateFirstElement = focusFirstElement && "current" in focusFirstElement ? focusFirstElement.current : focusFirstElement;
70
+ setElementFocus(candidateFirstElement || (wrapperRef === null || wrapperRef === void 0 ? void 0 : wrapperRef.current));
65
71
  }
66
72
  }, [shouldSetFocus, prevShouldSetFocus, focusFirstElement, wrapperRef]);
67
73
  useEffect(() => {
@@ -71,19 +77,17 @@ const FocusTrap = ({
71
77
  return;
72
78
  }
73
79
 
74
- const {
75
- activeElement
76
- } = document;
80
+ const activeElement = document.activeElement;
77
81
 
78
82
  if (ev.key === "Tab") {
79
- if (!focusableElements.length) {
83
+ if (!(focusableElements !== null && focusableElements !== void 0 && focusableElements.length)) {
80
84
  /* Block the trap */
81
85
  ev.preventDefault();
82
86
  } else if (ev.shiftKey) {
83
87
  /* shift + tab */
84
88
  let elementToFocus;
85
89
 
86
- if (activeElement === wrapperRef.current) {
90
+ if (activeElement === (wrapperRef === null || wrapperRef === void 0 ? void 0 : wrapperRef.current)) {
87
91
  elementToFocus = getNextElement(firstElement, focusableElements, ev.shiftKey);
88
92
  } else {
89
93
  elementToFocus = getNextElement(activeElement, focusableElements, ev.shiftKey);
@@ -99,9 +103,9 @@ const FocusTrap = ({
99
103
  }
100
104
  };
101
105
 
102
- document.addEventListener("keydown", trapFn);
106
+ document.addEventListener("keydown", trapFn, true);
103
107
  return function cleanup() {
104
- document.removeEventListener("keydown", trapFn);
108
+ document.removeEventListener("keydown", trapFn, true);
105
109
  };
106
110
  }, [firstElement, lastElement, focusableElements, bespokeTrap, wrapperRef]);
107
111
  const updateCurrentFocusedElement = useCallback(() => {
@@ -153,7 +157,10 @@ const FocusTrap = ({
153
157
 
154
158
 
155
159
  const clonedChildren = React.Children.map(children, child => {
156
- return /*#__PURE__*/React.cloneElement(child, focusProps(child.props.tabIndex === undefined));
160
+ var _focusableChild$props;
161
+
162
+ const focusableChild = child;
163
+ return /*#__PURE__*/React.cloneElement(focusableChild, focusProps((focusableChild === null || focusableChild === void 0 ? void 0 : (_focusableChild$props = focusableChild.props) === null || _focusableChild$props === void 0 ? void 0 : _focusableChild$props.tabIndex) === undefined));
157
164
  });
158
165
  return /*#__PURE__*/React.createElement("div", {
159
166
  ref: trapRef
@@ -161,33 +168,42 @@ const FocusTrap = ({
161
168
  };
162
169
 
163
170
  FocusTrap.propTypes = {
164
- children: PropTypes.node.isRequired,
165
-
166
- /** flag to set focus automatically on first render */
167
- autoFocus: PropTypes.bool,
168
-
169
- /** provide a custom first element to focus */
170
- focusFirstElement: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
171
- current: PropTypes.any
171
+ "additionalWrapperRefs": PropTypes.arrayOf(PropTypes.shape({
172
+ "current": function (props, propName) {
173
+ if (props[propName] == null) {
174
+ return null;
175
+ } else if (typeof props[propName] !== 'object' || props[propName].nodeType !== 1) {
176
+ return new Error("Expected prop '" + propName + "' to be of type Element");
177
+ }
178
+ }
179
+ })),
180
+ "autoFocus": PropTypes.bool,
181
+ "bespokeTrap": PropTypes.func,
182
+ "children": PropTypes.node,
183
+ "focusFirstElement": PropTypes.oneOfType([function (props, propName) {
184
+ if (props[propName] == null) {
185
+ return new Error("Prop '" + propName + "' is required but wasn't specified");
186
+ } else if (typeof props[propName] !== 'object' || props[propName].nodeType !== 1) {
187
+ return new Error("Expected prop '" + propName + "' to be of type Element");
188
+ }
189
+ }, PropTypes.shape({
190
+ "current": function (props, propName) {
191
+ if (props[propName] == null) {
192
+ return null;
193
+ } else if (typeof props[propName] !== 'object' || props[propName].nodeType !== 1) {
194
+ return new Error("Expected prop '" + propName + "' to be of type Element");
195
+ }
196
+ }
172
197
  })]),
173
-
174
- /** a custom callback that will override the default focus trap behaviour */
175
- bespokeTrap: PropTypes.func,
176
-
177
- /** a ref to the container wrapping the focusable elements */
178
- wrapperRef: PropTypes.shape({
179
- current: PropTypes.any
180
- }),
181
-
182
- /* whether the modal (etc.) component that the focus trap is inside is open or not */
183
- isOpen: PropTypes.bool,
184
-
185
- /** an optional array of refs to containers whose content should also be reachable from the FocusTrap */
186
- additionalWrapperRefs: PropTypes.arrayOf(PropTypes.shape({
187
- current: PropTypes.any
188
- }))
189
- };
190
- FocusTrap.defaultProps = {
191
- additionalWrapperRefs: []
198
+ "isOpen": PropTypes.bool,
199
+ "wrapperRef": PropTypes.shape({
200
+ "current": function (props, propName) {
201
+ if (props[propName] == null) {
202
+ return null;
203
+ } else if (typeof props[propName] !== 'object' || props[propName].nodeType !== 1) {
204
+ return new Error("Expected prop '" + propName + "' to be of type Element");
205
+ }
206
+ }
207
+ })
192
208
  };
193
209
  export default FocusTrap;
@@ -0,0 +1,2 @@
1
+ export { default } from "./focus-trap.component";
2
+ export type { FocusTrapProps } from "./focus-trap.component";
@@ -1,4 +1,4 @@
1
1
  import { ReactWrapper, ShallowWrapper } from "enzyme";
2
- declare const elementsTagTest: (wrapper: ReactWrapper, elements: string[]) => void;
2
+ declare const elementsTagTest: (wrapper: ReactWrapper | ShallowWrapper, elements: string[]) => void;
3
3
  declare const rootTagTest: (rootNode: ReactWrapper | ShallowWrapper, comp: string, elem?: string | undefined, role?: string | undefined) => void;
4
4
  export { elementsTagTest, rootTagTest };
@@ -0,0 +1,6 @@
1
+ import React from "react";
2
+ interface DlContextProps {
3
+ asSingleColumn?: boolean;
4
+ }
5
+ declare const _default: React.Context<DlContextProps>;
6
+ export default _default;
@@ -0,0 +1,8 @@
1
+ import React from "react";
2
+ import { SpaceProps } from "styled-system";
3
+ export interface DdProps extends SpaceProps {
4
+ /** Prop for what will render in the `<Dd></Dd>` tags */
5
+ children: React.ReactNode;
6
+ }
7
+ declare const Dd: ({ children, ...rest }: DdProps) => JSX.Element;
8
+ export default Dd;
@@ -1,7 +1,6 @@
1
1
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
2
 
3
3
  import React from "react";
4
- import propTypes from "@styled-system/prop-types";
5
4
  import PropTypes from "prop-types";
6
5
  import { StyledDd } from "./definition-list.style";
7
6
 
@@ -17,9 +16,315 @@ const Dd = ({
17
16
  }, rest), children);
18
17
  };
19
18
 
20
- Dd.propTypes = { ...propTypes.space,
21
-
22
- /** Prop to render string or node in the `<Dd></Dd>` tags */
23
- children: PropTypes.node.isRequired
19
+ Dd.propTypes = {
20
+ "children": PropTypes.node,
21
+ "m": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
22
+ "__@toStringTag": PropTypes.string.isRequired,
23
+ "description": PropTypes.string,
24
+ "toString": PropTypes.func.isRequired,
25
+ "valueOf": PropTypes.func.isRequired
26
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
27
+ "__@toStringTag": PropTypes.string.isRequired,
28
+ "description": PropTypes.string,
29
+ "toString": PropTypes.func.isRequired,
30
+ "valueOf": PropTypes.func.isRequired
31
+ }), PropTypes.string]),
32
+ "margin": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
33
+ "__@toStringTag": PropTypes.string.isRequired,
34
+ "description": PropTypes.string,
35
+ "toString": PropTypes.func.isRequired,
36
+ "valueOf": PropTypes.func.isRequired
37
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
38
+ "__@toStringTag": PropTypes.string.isRequired,
39
+ "description": PropTypes.string,
40
+ "toString": PropTypes.func.isRequired,
41
+ "valueOf": PropTypes.func.isRequired
42
+ }), PropTypes.string]),
43
+ "marginBottom": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
44
+ "__@toStringTag": PropTypes.string.isRequired,
45
+ "description": PropTypes.string,
46
+ "toString": PropTypes.func.isRequired,
47
+ "valueOf": PropTypes.func.isRequired
48
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
49
+ "__@toStringTag": PropTypes.string.isRequired,
50
+ "description": PropTypes.string,
51
+ "toString": PropTypes.func.isRequired,
52
+ "valueOf": PropTypes.func.isRequired
53
+ }), PropTypes.string]),
54
+ "marginLeft": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
55
+ "__@toStringTag": PropTypes.string.isRequired,
56
+ "description": PropTypes.string,
57
+ "toString": PropTypes.func.isRequired,
58
+ "valueOf": PropTypes.func.isRequired
59
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
60
+ "__@toStringTag": PropTypes.string.isRequired,
61
+ "description": PropTypes.string,
62
+ "toString": PropTypes.func.isRequired,
63
+ "valueOf": PropTypes.func.isRequired
64
+ }), PropTypes.string]),
65
+ "marginRight": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
66
+ "__@toStringTag": PropTypes.string.isRequired,
67
+ "description": PropTypes.string,
68
+ "toString": PropTypes.func.isRequired,
69
+ "valueOf": PropTypes.func.isRequired
70
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
71
+ "__@toStringTag": PropTypes.string.isRequired,
72
+ "description": PropTypes.string,
73
+ "toString": PropTypes.func.isRequired,
74
+ "valueOf": PropTypes.func.isRequired
75
+ }), PropTypes.string]),
76
+ "marginTop": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
77
+ "__@toStringTag": PropTypes.string.isRequired,
78
+ "description": PropTypes.string,
79
+ "toString": PropTypes.func.isRequired,
80
+ "valueOf": PropTypes.func.isRequired
81
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
82
+ "__@toStringTag": PropTypes.string.isRequired,
83
+ "description": PropTypes.string,
84
+ "toString": PropTypes.func.isRequired,
85
+ "valueOf": PropTypes.func.isRequired
86
+ }), PropTypes.string]),
87
+ "marginX": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
88
+ "__@toStringTag": PropTypes.string.isRequired,
89
+ "description": PropTypes.string,
90
+ "toString": PropTypes.func.isRequired,
91
+ "valueOf": PropTypes.func.isRequired
92
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
93
+ "__@toStringTag": PropTypes.string.isRequired,
94
+ "description": PropTypes.string,
95
+ "toString": PropTypes.func.isRequired,
96
+ "valueOf": PropTypes.func.isRequired
97
+ }), PropTypes.string]),
98
+ "marginY": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
99
+ "__@toStringTag": PropTypes.string.isRequired,
100
+ "description": PropTypes.string,
101
+ "toString": PropTypes.func.isRequired,
102
+ "valueOf": PropTypes.func.isRequired
103
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
104
+ "__@toStringTag": PropTypes.string.isRequired,
105
+ "description": PropTypes.string,
106
+ "toString": PropTypes.func.isRequired,
107
+ "valueOf": PropTypes.func.isRequired
108
+ }), PropTypes.string]),
109
+ "mb": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
110
+ "__@toStringTag": PropTypes.string.isRequired,
111
+ "description": PropTypes.string,
112
+ "toString": PropTypes.func.isRequired,
113
+ "valueOf": PropTypes.func.isRequired
114
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
115
+ "__@toStringTag": PropTypes.string.isRequired,
116
+ "description": PropTypes.string,
117
+ "toString": PropTypes.func.isRequired,
118
+ "valueOf": PropTypes.func.isRequired
119
+ }), PropTypes.string]),
120
+ "ml": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
121
+ "__@toStringTag": PropTypes.string.isRequired,
122
+ "description": PropTypes.string,
123
+ "toString": PropTypes.func.isRequired,
124
+ "valueOf": PropTypes.func.isRequired
125
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
126
+ "__@toStringTag": PropTypes.string.isRequired,
127
+ "description": PropTypes.string,
128
+ "toString": PropTypes.func.isRequired,
129
+ "valueOf": PropTypes.func.isRequired
130
+ }), PropTypes.string]),
131
+ "mr": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
132
+ "__@toStringTag": PropTypes.string.isRequired,
133
+ "description": PropTypes.string,
134
+ "toString": PropTypes.func.isRequired,
135
+ "valueOf": PropTypes.func.isRequired
136
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
137
+ "__@toStringTag": PropTypes.string.isRequired,
138
+ "description": PropTypes.string,
139
+ "toString": PropTypes.func.isRequired,
140
+ "valueOf": PropTypes.func.isRequired
141
+ }), PropTypes.string]),
142
+ "mt": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
143
+ "__@toStringTag": PropTypes.string.isRequired,
144
+ "description": PropTypes.string,
145
+ "toString": PropTypes.func.isRequired,
146
+ "valueOf": PropTypes.func.isRequired
147
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
148
+ "__@toStringTag": PropTypes.string.isRequired,
149
+ "description": PropTypes.string,
150
+ "toString": PropTypes.func.isRequired,
151
+ "valueOf": PropTypes.func.isRequired
152
+ }), PropTypes.string]),
153
+ "mx": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
154
+ "__@toStringTag": PropTypes.string.isRequired,
155
+ "description": PropTypes.string,
156
+ "toString": PropTypes.func.isRequired,
157
+ "valueOf": PropTypes.func.isRequired
158
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
159
+ "__@toStringTag": PropTypes.string.isRequired,
160
+ "description": PropTypes.string,
161
+ "toString": PropTypes.func.isRequired,
162
+ "valueOf": PropTypes.func.isRequired
163
+ }), PropTypes.string]),
164
+ "my": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
165
+ "__@toStringTag": PropTypes.string.isRequired,
166
+ "description": PropTypes.string,
167
+ "toString": PropTypes.func.isRequired,
168
+ "valueOf": PropTypes.func.isRequired
169
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
170
+ "__@toStringTag": PropTypes.string.isRequired,
171
+ "description": PropTypes.string,
172
+ "toString": PropTypes.func.isRequired,
173
+ "valueOf": PropTypes.func.isRequired
174
+ }), PropTypes.string]),
175
+ "p": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
176
+ "__@toStringTag": PropTypes.string.isRequired,
177
+ "description": PropTypes.string,
178
+ "toString": PropTypes.func.isRequired,
179
+ "valueOf": PropTypes.func.isRequired
180
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
181
+ "__@toStringTag": PropTypes.string.isRequired,
182
+ "description": PropTypes.string,
183
+ "toString": PropTypes.func.isRequired,
184
+ "valueOf": PropTypes.func.isRequired
185
+ }), PropTypes.string]),
186
+ "padding": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
187
+ "__@toStringTag": PropTypes.string.isRequired,
188
+ "description": PropTypes.string,
189
+ "toString": PropTypes.func.isRequired,
190
+ "valueOf": PropTypes.func.isRequired
191
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
192
+ "__@toStringTag": PropTypes.string.isRequired,
193
+ "description": PropTypes.string,
194
+ "toString": PropTypes.func.isRequired,
195
+ "valueOf": PropTypes.func.isRequired
196
+ }), PropTypes.string]),
197
+ "paddingBottom": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
198
+ "__@toStringTag": PropTypes.string.isRequired,
199
+ "description": PropTypes.string,
200
+ "toString": PropTypes.func.isRequired,
201
+ "valueOf": PropTypes.func.isRequired
202
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
203
+ "__@toStringTag": PropTypes.string.isRequired,
204
+ "description": PropTypes.string,
205
+ "toString": PropTypes.func.isRequired,
206
+ "valueOf": PropTypes.func.isRequired
207
+ }), PropTypes.string]),
208
+ "paddingLeft": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
209
+ "__@toStringTag": PropTypes.string.isRequired,
210
+ "description": PropTypes.string,
211
+ "toString": PropTypes.func.isRequired,
212
+ "valueOf": PropTypes.func.isRequired
213
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
214
+ "__@toStringTag": PropTypes.string.isRequired,
215
+ "description": PropTypes.string,
216
+ "toString": PropTypes.func.isRequired,
217
+ "valueOf": PropTypes.func.isRequired
218
+ }), PropTypes.string]),
219
+ "paddingRight": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
220
+ "__@toStringTag": PropTypes.string.isRequired,
221
+ "description": PropTypes.string,
222
+ "toString": PropTypes.func.isRequired,
223
+ "valueOf": PropTypes.func.isRequired
224
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
225
+ "__@toStringTag": PropTypes.string.isRequired,
226
+ "description": PropTypes.string,
227
+ "toString": PropTypes.func.isRequired,
228
+ "valueOf": PropTypes.func.isRequired
229
+ }), PropTypes.string]),
230
+ "paddingTop": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
231
+ "__@toStringTag": PropTypes.string.isRequired,
232
+ "description": PropTypes.string,
233
+ "toString": PropTypes.func.isRequired,
234
+ "valueOf": PropTypes.func.isRequired
235
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
236
+ "__@toStringTag": PropTypes.string.isRequired,
237
+ "description": PropTypes.string,
238
+ "toString": PropTypes.func.isRequired,
239
+ "valueOf": PropTypes.func.isRequired
240
+ }), PropTypes.string]),
241
+ "paddingX": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
242
+ "__@toStringTag": PropTypes.string.isRequired,
243
+ "description": PropTypes.string,
244
+ "toString": PropTypes.func.isRequired,
245
+ "valueOf": PropTypes.func.isRequired
246
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
247
+ "__@toStringTag": PropTypes.string.isRequired,
248
+ "description": PropTypes.string,
249
+ "toString": PropTypes.func.isRequired,
250
+ "valueOf": PropTypes.func.isRequired
251
+ }), PropTypes.string]),
252
+ "paddingY": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
253
+ "__@toStringTag": PropTypes.string.isRequired,
254
+ "description": PropTypes.string,
255
+ "toString": PropTypes.func.isRequired,
256
+ "valueOf": PropTypes.func.isRequired
257
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
258
+ "__@toStringTag": PropTypes.string.isRequired,
259
+ "description": PropTypes.string,
260
+ "toString": PropTypes.func.isRequired,
261
+ "valueOf": PropTypes.func.isRequired
262
+ }), PropTypes.string]),
263
+ "pb": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
264
+ "__@toStringTag": PropTypes.string.isRequired,
265
+ "description": PropTypes.string,
266
+ "toString": PropTypes.func.isRequired,
267
+ "valueOf": PropTypes.func.isRequired
268
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
269
+ "__@toStringTag": PropTypes.string.isRequired,
270
+ "description": PropTypes.string,
271
+ "toString": PropTypes.func.isRequired,
272
+ "valueOf": PropTypes.func.isRequired
273
+ }), PropTypes.string]),
274
+ "pl": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
275
+ "__@toStringTag": PropTypes.string.isRequired,
276
+ "description": PropTypes.string,
277
+ "toString": PropTypes.func.isRequired,
278
+ "valueOf": PropTypes.func.isRequired
279
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
280
+ "__@toStringTag": PropTypes.string.isRequired,
281
+ "description": PropTypes.string,
282
+ "toString": PropTypes.func.isRequired,
283
+ "valueOf": PropTypes.func.isRequired
284
+ }), PropTypes.string]),
285
+ "pr": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
286
+ "__@toStringTag": PropTypes.string.isRequired,
287
+ "description": PropTypes.string,
288
+ "toString": PropTypes.func.isRequired,
289
+ "valueOf": PropTypes.func.isRequired
290
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
291
+ "__@toStringTag": PropTypes.string.isRequired,
292
+ "description": PropTypes.string,
293
+ "toString": PropTypes.func.isRequired,
294
+ "valueOf": PropTypes.func.isRequired
295
+ }), PropTypes.string]),
296
+ "pt": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
297
+ "__@toStringTag": PropTypes.string.isRequired,
298
+ "description": PropTypes.string,
299
+ "toString": PropTypes.func.isRequired,
300
+ "valueOf": PropTypes.func.isRequired
301
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
302
+ "__@toStringTag": PropTypes.string.isRequired,
303
+ "description": PropTypes.string,
304
+ "toString": PropTypes.func.isRequired,
305
+ "valueOf": PropTypes.func.isRequired
306
+ }), PropTypes.string]),
307
+ "px": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
308
+ "__@toStringTag": PropTypes.string.isRequired,
309
+ "description": PropTypes.string,
310
+ "toString": PropTypes.func.isRequired,
311
+ "valueOf": PropTypes.func.isRequired
312
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
313
+ "__@toStringTag": PropTypes.string.isRequired,
314
+ "description": PropTypes.string,
315
+ "toString": PropTypes.func.isRequired,
316
+ "valueOf": PropTypes.func.isRequired
317
+ }), PropTypes.string]),
318
+ "py": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
319
+ "__@toStringTag": PropTypes.string.isRequired,
320
+ "description": PropTypes.string,
321
+ "toString": PropTypes.func.isRequired,
322
+ "valueOf": PropTypes.func.isRequired
323
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
324
+ "__@toStringTag": PropTypes.string.isRequired,
325
+ "description": PropTypes.string,
326
+ "toString": PropTypes.func.isRequired,
327
+ "valueOf": PropTypes.func.isRequired
328
+ }), PropTypes.string])
24
329
  };
25
330
  export default Dd;
@@ -0,0 +1,22 @@
1
+ export interface StyledDlProps {
2
+ /** Render the DefinitionList as a single column */
3
+ asSingleColumn?: boolean;
4
+ /** This value will specify the width of the `StyledDtDiv` as a percentage. The remaining space will be taken up
5
+ by the `StyledDdDiv`. This prop has no effect when `asSingleColumn` is set.
6
+ */
7
+ w?: number;
8
+ }
9
+ export declare type ElementAlignment = "left" | "center" | "right";
10
+ export declare const StyledDl: import("styled-components").StyledComponent<"dl", any, StyledDlProps, never>;
11
+ export interface StyledDtDivProps {
12
+ /** This string will specify the text align styling of the `<dt></dt>`. */
13
+ dtTextAlign?: ElementAlignment;
14
+ }
15
+ export declare const StyledDtDiv: import("styled-components").StyledComponent<"div", any, StyledDtDivProps, never>;
16
+ export interface StyledDdDivProps {
17
+ /** This string will specify the text align styling of the `<dd></dd>`. */
18
+ ddTextAlign?: ElementAlignment;
19
+ }
20
+ export declare const StyledDdDiv: import("styled-components").StyledComponent<"div", any, StyledDdDivProps, never>;
21
+ export declare const StyledDt: import("styled-components").StyledComponent<"dt", any, {}, never>;
22
+ export declare const StyledDd: import("styled-components").StyledComponent<"dd", any, {}, never>;
@@ -7,14 +7,13 @@ export const StyledDl = styled.dl`
7
7
  ${space}
8
8
 
9
9
  ${({
10
- asSingleColumn
10
+ asSingleColumn,
11
+ w
11
12
  }) => css`
12
13
  ${!asSingleColumn && css`
13
14
  display: grid;
14
15
  grid-template-rows: auto;
15
- grid-template-columns: ${({
16
- w
17
- }) => `${w}% auto;`};
16
+ grid-template-columns: ${w}% auto;
18
17
  `}
19
18
  ${asSingleColumn && css`
20
19
  line-height: 21px;
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+ import { SpaceProps } from "styled-system";
3
+ import { StyledDtDivProps, StyledDdDivProps, StyledDlProps } from "./definition-list.style";
4
+ export interface DlProps extends SpaceProps, StyledDlProps, StyledDtDivProps, StyledDdDivProps {
5
+ /** prop to render children. */
6
+ children: React.ReactNode;
7
+ }
8
+ declare const Dl: ({ children, w, dtTextAlign, ddTextAlign, asSingleColumn, ...rest }: DlProps) => JSX.Element;
9
+ export default Dl;