carbon-react 153.7.1 → 154.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/__internal__/utils/{createStrictContext.js → createStrictContext/createStrictContext.js} +1 -1
- package/esm/__internal__/utils/createStrictContext/index.d.ts +1 -0
- package/esm/__internal__/utils/createStrictContext/index.js +1 -0
- package/esm/components/action-popover/__internal__/action-popover.context.d.ts +4 -3
- package/esm/components/action-popover/__internal__/action-popover.context.js +9 -3
- package/esm/components/action-popover/action-popover-item/action-popover-item.component.js +3 -5
- package/esm/components/action-popover/action-popover-menu/action-popover-menu.component.js +3 -5
- package/esm/components/action-popover/action-popover.component.js +2 -2
- package/esm/components/breadcrumbs/__internal__/breadcrumbs.context.d.ts +3 -3
- package/esm/components/breadcrumbs/__internal__/breadcrumbs.context.js +8 -4
- package/esm/components/breadcrumbs/breadcrumbs.component.js +2 -2
- package/esm/components/breadcrumbs/crumb/crumb.component.js +3 -3
- package/esm/components/button-toggle/button-toggle-group/__internal__/button-toggle-group.context.d.ts +5 -5
- package/esm/components/button-toggle/button-toggle-group/__internal__/button-toggle-group.context.js +14 -9
- package/esm/components/button-toggle/button-toggle-group/button-toggle-group.component.js +10 -4
- package/esm/components/button-toggle/button-toggle.component.d.ts +4 -1
- package/esm/components/button-toggle/button-toggle.component.js +17 -32
- package/esm/components/card/__internal__/card.context.d.ts +4 -4
- package/esm/components/card/__internal__/card.context.js +10 -4
- package/esm/components/card/card-column/card-column.component.d.ts +1 -1
- package/esm/components/card/card-footer/card-footer.component.d.ts +1 -1
- package/esm/components/card/card-footer/card-footer.component.js +3 -3
- package/esm/components/card/card-footer/card-footer.style.d.ts +2 -7
- package/esm/components/card/card-footer/card-footer.style.js +1 -1
- package/esm/components/card/card-row/card-row.component.d.ts +1 -1
- package/esm/components/card/card-row/card-row.component.js +3 -3
- package/esm/components/card/card.component.d.ts +1 -1
- package/esm/components/card/card.component.js +2 -2
- package/esm/components/definition-list/__internal__/dl.context.d.ts +4 -12
- package/esm/components/definition-list/__internal__/dl.context.js +11 -2
- package/esm/components/definition-list/dd/dd.component.js +3 -3
- package/esm/components/definition-list/dl.component.d.ts +8 -2
- package/esm/components/definition-list/dl.component.js +2 -2
- package/esm/components/definition-list/dt/dt.component.js +3 -3
- package/esm/components/flat-table/__internal__/flat-table.context.d.ts +6 -8
- package/esm/components/flat-table/__internal__/flat-table.context.js +6 -5
- package/esm/components/flat-table/__internal__/strict-flat-table.context.d.ts +7 -0
- package/esm/components/flat-table/__internal__/strict-flat-table.context.js +9 -0
- package/esm/components/flat-table/__internal__/use-table-cell.js +2 -2
- package/esm/components/flat-table/flat-table-header/flat-table-header.component.js +3 -3
- package/esm/components/flat-table/flat-table-row/flat-table-row.component.js +2 -2
- package/esm/components/flat-table/flat-table.component.js +7 -3
- package/esm/components/flat-table/sort/sort.component.js +3 -3
- package/esm/components/step-flow/__internal__/step-flow.context.d.ts +3 -3
- package/esm/components/step-flow/__internal__/step-flow.context.js +7 -3
- package/esm/components/step-flow/step-flow-title/step-flow-title.component.js +3 -3
- package/esm/components/step-flow/step-flow.component.js +2 -2
- package/esm/components/step-sequence/__internal__/step-sequence.context.d.ts +6 -0
- package/esm/components/step-sequence/__internal__/step-sequence.context.js +9 -0
- package/esm/components/step-sequence/step-sequence-item/step-sequence-item.component.js +3 -3
- package/esm/components/step-sequence/step-sequence.component.d.ts +0 -3
- package/esm/components/step-sequence/step-sequence.component.js +2 -4
- package/esm/components/text-editor/__internal__/helpers.js +1 -1
- package/esm/components/text-editor/__internal__/plugins/EditorRef/editor-ref.plugin.d.ts +5 -0
- package/esm/components/text-editor/__internal__/plugins/EditorRef/editor-ref.plugin.js +17 -0
- package/esm/components/text-editor/__internal__/plugins/EditorRef/index.d.ts +1 -0
- package/esm/components/text-editor/__internal__/plugins/EditorRef/index.js +1 -0
- package/esm/components/text-editor/__internal__/plugins/Toolbar/toolbar.component.js +0 -1
- package/esm/components/text-editor/text-editor.component.d.ts +5 -1
- package/esm/components/text-editor/text-editor.component.js +19 -11
- package/esm/components/tile/__internal__/tile.context.d.ts +4 -4
- package/esm/components/tile/__internal__/tile.context.js +10 -4
- package/esm/components/tile/tile-content/tile-content.component.js +3 -3
- package/esm/components/tile/tile.component.js +2 -2
- package/esm/components/vertical-menu/__internal__/vertical-menu.context.d.ts +6 -0
- package/esm/components/vertical-menu/__internal__/vertical-menu.context.js +9 -0
- package/esm/components/vertical-menu/vertical-menu-full-screen/vertical-menu-full-screen.component.js +2 -2
- package/esm/components/vertical-menu/vertical-menu-item/vertical-menu-item.component.js +2 -2
- package/esm/components/vertical-menu/vertical-menu.component.js +6 -1
- package/lib/__internal__/utils/{createStrictContext.js → createStrictContext/createStrictContext.js} +1 -1
- package/lib/__internal__/utils/createStrictContext/index.d.ts +1 -0
- package/lib/__internal__/utils/createStrictContext/index.js +13 -0
- package/lib/__internal__/utils/createStrictContext/package.json +6 -0
- package/lib/components/action-popover/__internal__/action-popover.context.d.ts +4 -3
- package/lib/components/action-popover/__internal__/action-popover.context.js +11 -4
- package/lib/components/action-popover/action-popover-item/action-popover-item.component.js +2 -4
- package/lib/components/action-popover/action-popover-menu/action-popover-menu.component.js +2 -4
- package/lib/components/action-popover/action-popover.component.js +2 -2
- package/lib/components/breadcrumbs/__internal__/breadcrumbs.context.d.ts +3 -3
- package/lib/components/breadcrumbs/__internal__/breadcrumbs.context.js +10 -5
- package/lib/components/breadcrumbs/breadcrumbs.component.js +2 -2
- package/lib/components/breadcrumbs/crumb/crumb.component.js +3 -5
- package/lib/components/button-toggle/button-toggle-group/__internal__/button-toggle-group.context.d.ts +5 -5
- package/lib/components/button-toggle/button-toggle-group/__internal__/button-toggle-group.context.js +16 -10
- package/lib/components/button-toggle/button-toggle-group/button-toggle-group.component.js +10 -4
- package/lib/components/button-toggle/button-toggle.component.d.ts +4 -1
- package/lib/components/button-toggle/button-toggle.component.js +17 -32
- package/lib/components/card/__internal__/card.context.d.ts +4 -4
- package/lib/components/card/__internal__/card.context.js +12 -5
- package/lib/components/card/card-column/card-column.component.d.ts +1 -1
- package/lib/components/card/card-footer/card-footer.component.d.ts +1 -1
- package/lib/components/card/card-footer/card-footer.component.js +3 -5
- package/lib/components/card/card-footer/card-footer.style.d.ts +2 -7
- package/lib/components/card/card-footer/card-footer.style.js +1 -1
- package/lib/components/card/card-row/card-row.component.d.ts +1 -1
- package/lib/components/card/card-row/card-row.component.js +2 -2
- package/lib/components/card/card.component.d.ts +1 -1
- package/lib/components/card/card.component.js +2 -2
- package/lib/components/definition-list/__internal__/dl.context.d.ts +4 -12
- package/lib/components/definition-list/__internal__/dl.context.js +13 -3
- package/lib/components/definition-list/dd/dd.component.js +3 -5
- package/lib/components/definition-list/dl.component.d.ts +8 -2
- package/lib/components/definition-list/dl.component.js +2 -2
- package/lib/components/definition-list/dt/dt.component.js +3 -5
- package/lib/components/flat-table/__internal__/flat-table.context.d.ts +6 -8
- package/lib/components/flat-table/__internal__/flat-table.context.js +6 -6
- package/lib/components/flat-table/__internal__/strict-flat-table.context.d.ts +7 -0
- package/lib/components/flat-table/__internal__/strict-flat-table.context.js +17 -0
- package/lib/components/flat-table/__internal__/use-table-cell.js +2 -2
- package/lib/components/flat-table/flat-table-header/flat-table-header.component.js +2 -2
- package/lib/components/flat-table/flat-table-row/flat-table-row.component.js +2 -2
- package/lib/components/flat-table/flat-table.component.js +7 -3
- package/lib/components/flat-table/sort/sort.component.js +2 -2
- package/lib/components/step-flow/__internal__/step-flow.context.d.ts +3 -3
- package/lib/components/step-flow/__internal__/step-flow.context.js +9 -4
- package/lib/components/step-flow/step-flow-title/step-flow-title.component.js +3 -5
- package/lib/components/step-flow/step-flow.component.js +2 -2
- package/lib/components/step-sequence/__internal__/step-sequence.context.d.ts +6 -0
- package/lib/components/step-sequence/__internal__/step-sequence.context.js +17 -0
- package/lib/components/step-sequence/step-sequence-item/step-sequence-item.component.js +3 -5
- package/lib/components/step-sequence/step-sequence.component.d.ts +0 -3
- package/lib/components/step-sequence/step-sequence.component.js +3 -5
- package/lib/components/text-editor/__internal__/helpers.js +1 -1
- package/lib/components/text-editor/__internal__/plugins/EditorRef/editor-ref.plugin.d.ts +5 -0
- package/lib/components/text-editor/__internal__/plugins/EditorRef/editor-ref.plugin.js +24 -0
- package/lib/components/text-editor/__internal__/plugins/EditorRef/index.d.ts +1 -0
- package/lib/components/text-editor/__internal__/plugins/EditorRef/index.js +13 -0
- package/lib/components/text-editor/__internal__/plugins/EditorRef/package.json +6 -0
- package/lib/components/text-editor/__internal__/plugins/Toolbar/toolbar.component.js +0 -1
- package/lib/components/text-editor/text-editor.component.d.ts +5 -1
- package/lib/components/text-editor/text-editor.component.js +19 -11
- package/lib/components/tile/__internal__/tile.context.d.ts +4 -4
- package/lib/components/tile/__internal__/tile.context.js +13 -5
- package/lib/components/tile/tile-content/tile-content.component.js +3 -5
- package/lib/components/tile/tile.component.js +2 -2
- package/lib/components/vertical-menu/__internal__/vertical-menu.context.d.ts +6 -0
- package/lib/components/vertical-menu/__internal__/vertical-menu.context.js +17 -0
- package/lib/components/vertical-menu/vertical-menu-full-screen/vertical-menu-full-screen.component.js +2 -2
- package/lib/components/vertical-menu/vertical-menu-item/vertical-menu-item.component.js +2 -2
- package/lib/components/vertical-menu/vertical-menu.component.js +6 -1
- package/package.json +1 -1
- package/esm/components/vertical-menu/vertical-menu-full-screen/__internal__/vertical-menu-full-screen.context.d.ts +0 -5
- package/esm/components/vertical-menu/vertical-menu-full-screen/__internal__/vertical-menu-full-screen.context.js +0 -5
- package/lib/components/vertical-menu/vertical-menu-full-screen/__internal__/vertical-menu-full-screen.context.d.ts +0 -5
- package/lib/components/vertical-menu/vertical-menu-full-screen/__internal__/vertical-menu-full-screen.context.js +0 -12
- /package/esm/__internal__/utils/{createStrictContext.d.ts → createStrictContext/createStrictContext.d.ts} +0 -0
- /package/lib/__internal__/utils/{createStrictContext.d.ts → createStrictContext/createStrictContext.d.ts} +0 -0
package/esm/__internal__/utils/{createStrictContext.js → createStrictContext/createStrictContext.js}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import Logger from "
|
|
2
|
+
import Logger from "../logger";
|
|
3
3
|
/**
|
|
4
4
|
* Creates a React context with a provider and a hook for accessing the context.
|
|
5
5
|
* Logs an error and returns a default value if the hook is used outside of the provider.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./createStrictContext";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./createStrictContext";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
export type Alignment = "left" | "right";
|
|
3
3
|
type ActionPopoverContextType = {
|
|
4
4
|
setOpenPopover: (isOpen: boolean) => void;
|
|
@@ -6,5 +6,6 @@ type ActionPopoverContextType = {
|
|
|
6
6
|
submenuPosition: Alignment;
|
|
7
7
|
isOpenPopover: boolean;
|
|
8
8
|
};
|
|
9
|
-
declare const
|
|
10
|
-
export
|
|
9
|
+
export declare const ActionPopoverProvider: import("react").Provider<ActionPopoverContextType | null>;
|
|
10
|
+
export declare const useActionPopoverContext: () => ActionPopoverContextType;
|
|
11
|
+
export {};
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { createContext, useContext } from "react";
|
|
2
|
+
import invariant from "invariant";
|
|
3
|
+
const ActionPopoverContext = /*#__PURE__*/createContext(null);
|
|
4
|
+
export const ActionPopoverProvider = ActionPopoverContext.Provider;
|
|
5
|
+
export const useActionPopoverContext = () => {
|
|
6
|
+
const context = useContext(ActionPopoverContext);
|
|
7
|
+
!context ? process.env.NODE_ENV !== "production" ? invariant(false, "Carbon ActionPopover: Context not found. Have you wrapped your Carbon subcomponents properly? See stack trace for more details.") : invariant(false) : void 0;
|
|
8
|
+
return context;
|
|
9
|
+
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
-
import React, { useCallback, useEffect, useRef, useState
|
|
2
|
+
import React, { useCallback, useEffect, useRef, useState } from "react";
|
|
3
3
|
import invariant from "invariant";
|
|
4
4
|
import { MenuItemIcon, SubMenuItemIcon, StyledMenuItem, StyledMenuItemInnerText, StyledMenuItemOuterContainer, StyledMenuItemWrapper } from "../action-popover.style";
|
|
5
5
|
import Events from "../../../__internal__/utils/helpers/events";
|
|
6
6
|
import createGuid from "../../../__internal__/utils/helpers/guid";
|
|
7
|
-
import
|
|
7
|
+
import { useActionPopoverContext } from "../__internal__/action-popover.context";
|
|
8
8
|
import ActionPopoverMenu from "../action-popover-menu/action-popover-menu.component";
|
|
9
9
|
const INTERVAL = 150;
|
|
10
10
|
function checkRef(ref) {
|
|
@@ -47,15 +47,13 @@ export const ActionPopoverItem = ({
|
|
|
47
47
|
isASubmenu = false,
|
|
48
48
|
...rest
|
|
49
49
|
}) => {
|
|
50
|
-
const context = useContext(ActionPopoverContext);
|
|
51
|
-
!context ? process.env.NODE_ENV !== "production" ? invariant(false, "ActionPopoverItem must be used within an ActionPopover component") : invariant(false) : void 0;
|
|
52
50
|
!(/*#__PURE__*/React.isValidElement(submenu) ? submenu.type === ActionPopoverMenu : true) ? process.env.NODE_ENV !== "production" ? invariant(false, "ActionPopoverItem only accepts submenu of type `ActionPopoverMenu`") : invariant(false) : void 0;
|
|
53
51
|
const {
|
|
54
52
|
setOpenPopover,
|
|
55
53
|
isOpenPopover,
|
|
56
54
|
focusButton,
|
|
57
55
|
submenuPosition
|
|
58
|
-
} =
|
|
56
|
+
} = useActionPopoverContext();
|
|
59
57
|
const isHref = !!href;
|
|
60
58
|
const [containerPosition, setContainerPosition] = useState(undefined);
|
|
61
59
|
const [guid] = useState(createGuid());
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
-
import React, { useCallback, useMemo,
|
|
2
|
+
import React, { useCallback, useMemo, useState } from "react";
|
|
3
3
|
import invariant from "invariant";
|
|
4
4
|
import { Menu } from "../action-popover.style";
|
|
5
5
|
import Events from "../../../__internal__/utils/helpers/events";
|
|
6
6
|
import ActionPopoverItem from "../action-popover-item/action-popover-item.component";
|
|
7
7
|
import ActionPopoverDivider from "../action-popover-divider/action-popover-divider.component";
|
|
8
|
-
import
|
|
8
|
+
import { useActionPopoverContext } from "../__internal__/action-popover.context";
|
|
9
9
|
import { findFirstFocusableItem, findLastFocusableItem, getItems, isItemDisabled } from "../__internal__/action-popover-utils";
|
|
10
10
|
const ActionPopoverMenu = /*#__PURE__*/React.forwardRef(({
|
|
11
11
|
children,
|
|
@@ -20,12 +20,10 @@ const ActionPopoverMenu = /*#__PURE__*/React.forwardRef(({
|
|
|
20
20
|
isASubmenu,
|
|
21
21
|
...rest
|
|
22
22
|
}, ref) => {
|
|
23
|
-
const context = useContext(ActionPopoverContext);
|
|
24
|
-
!context ? process.env.NODE_ENV !== "production" ? invariant(false, "ActionPopoverMenu must be used within an ActionPopover component") : invariant(false) : void 0;
|
|
25
23
|
const {
|
|
26
24
|
focusButton,
|
|
27
25
|
submenuPosition
|
|
28
|
-
} =
|
|
26
|
+
} = useActionPopoverContext();
|
|
29
27
|
!(setOpen && setFocusIndex && typeof focusIndex !== "undefined") ? process.env.NODE_ENV !== "production" ? invariant(false, "ActionPopoverMenu must be used within an ActionPopover or ActionPopoverItem component") : invariant(false) : void 0;
|
|
30
28
|
const hasProperChildren = useMemo(() => {
|
|
31
29
|
const incorrectChild = React.Children.toArray(children).find(child => ! /*#__PURE__*/React.isValidElement(child) || child.type.displayName !== "ActionPopoverItem" && child.type.displayName !== "ActionPopoverDivider");
|
|
@@ -10,7 +10,7 @@ import useLocale from "../../hooks/__internal__/useLocale";
|
|
|
10
10
|
import ActionPopoverMenu from "./action-popover-menu/action-popover-menu.component";
|
|
11
11
|
import ActionPopoverItem from "./action-popover-item/action-popover-item.component";
|
|
12
12
|
import ActionPopoverDivider from "./action-popover-divider/action-popover-divider.component";
|
|
13
|
-
import
|
|
13
|
+
import { ActionPopoverProvider } from "./__internal__/action-popover.context";
|
|
14
14
|
import useModalManager from "../../hooks/__internal__/useModalManager";
|
|
15
15
|
import { findFirstFocusableItem, findLastFocusableItem, getItems, checkChildrenForString } from "./__internal__/action-popover-utils";
|
|
16
16
|
import FlatTableContext from "../flat-table/__internal__/flat-table.context";
|
|
@@ -208,7 +208,7 @@ export const ActionPopover = /*#__PURE__*/forwardRef(({
|
|
|
208
208
|
onClick: onButtonClick,
|
|
209
209
|
isOpen,
|
|
210
210
|
ref: buttonRef
|
|
211
|
-
}, rest, tagComponent("action-popover-wrapper", rest)), menuButton(menuID), /*#__PURE__*/React.createElement(
|
|
211
|
+
}, rest, tagComponent("action-popover-wrapper", rest)), menuButton(menuID), /*#__PURE__*/React.createElement(ActionPopoverProvider, {
|
|
212
212
|
value: {
|
|
213
213
|
setOpenPopover: setOpen,
|
|
214
214
|
focusButton,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
export type BreadcrumbsContextType = {
|
|
3
3
|
isDarkBackground: boolean;
|
|
4
4
|
};
|
|
5
|
-
declare const
|
|
6
|
-
export
|
|
5
|
+
declare const BreadcrumbsProvider: import("react").Provider<BreadcrumbsContextType | null>, useBreadcrumbsContext: () => BreadcrumbsContextType;
|
|
6
|
+
export { BreadcrumbsProvider, useBreadcrumbsContext };
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
const
|
|
3
|
-
|
|
1
|
+
import createStrictContext from "../../../__internal__/utils/createStrictContext";
|
|
2
|
+
const [BreadcrumbsProvider, useBreadcrumbsContext] = createStrictContext({
|
|
3
|
+
name: "BreadcrumbsContext",
|
|
4
|
+
errorMessage: "Carbon Breadcrumbs: Context not found. Have you wrapped your Carbon subcomponents properly? See stack trace for more details.",
|
|
5
|
+
defaultValue: {
|
|
6
|
+
isDarkBackground: false
|
|
7
|
+
}
|
|
4
8
|
});
|
|
5
|
-
export
|
|
9
|
+
export { BreadcrumbsProvider, useBreadcrumbsContext };
|
|
@@ -3,14 +3,14 @@ import React from "react";
|
|
|
3
3
|
import tagComponent from "../../__internal__/utils/helpers/tags";
|
|
4
4
|
import StyledBreadcrumbs from "./breadcrumbs.style";
|
|
5
5
|
import useLocale from "../../hooks/__internal__/useLocale";
|
|
6
|
-
import
|
|
6
|
+
import { BreadcrumbsProvider } from "./__internal__/breadcrumbs.context";
|
|
7
7
|
export const Breadcrumbs = /*#__PURE__*/React.forwardRef(({
|
|
8
8
|
children,
|
|
9
9
|
isDarkBackground = false,
|
|
10
10
|
...rest
|
|
11
11
|
}, ref) => {
|
|
12
12
|
const l = useLocale();
|
|
13
|
-
return /*#__PURE__*/React.createElement(
|
|
13
|
+
return /*#__PURE__*/React.createElement(BreadcrumbsProvider, {
|
|
14
14
|
value: {
|
|
15
15
|
isDarkBackground
|
|
16
16
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
-
import React
|
|
2
|
+
import React from "react";
|
|
3
3
|
import tagComponent from "../../../__internal__/utils/helpers/tags";
|
|
4
4
|
import { StyledCrumb, Divider } from "./crumb.style";
|
|
5
|
-
import
|
|
5
|
+
import { useBreadcrumbsContext } from "../__internal__/breadcrumbs.context";
|
|
6
6
|
const Crumb = /*#__PURE__*/React.forwardRef(({
|
|
7
7
|
href,
|
|
8
8
|
isCurrent,
|
|
@@ -12,7 +12,7 @@ const Crumb = /*#__PURE__*/React.forwardRef(({
|
|
|
12
12
|
}, ref) => {
|
|
13
13
|
const {
|
|
14
14
|
isDarkBackground
|
|
15
|
-
} =
|
|
15
|
+
} = useBreadcrumbsContext();
|
|
16
16
|
return /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement(StyledCrumb, _extends({
|
|
17
17
|
ref: ref,
|
|
18
18
|
isCurrent: isCurrent,
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
type ButtonToggleGroupContextType = {
|
|
3
3
|
onButtonClick: (value: string) => void;
|
|
4
4
|
handleKeyDown: (ev: React.KeyboardEvent<HTMLButtonElement>) => void;
|
|
5
5
|
pressedButtonValue?: string;
|
|
6
6
|
onChange?: (ev: React.MouseEvent<HTMLButtonElement>, value?: string) => void;
|
|
7
|
-
allowDeselect
|
|
7
|
+
allowDeselect: boolean;
|
|
8
8
|
isInGroup: boolean;
|
|
9
|
-
isDisabled
|
|
9
|
+
isDisabled: boolean;
|
|
10
10
|
firstButton?: HTMLButtonElement;
|
|
11
11
|
childButtonCallbackRef?: (button: HTMLButtonElement | null) => void;
|
|
12
12
|
/** Identifier for the hint text, if it exists, that is rendered by ButtonToggleGroup */
|
|
13
13
|
hintTextId?: string;
|
|
14
14
|
};
|
|
15
|
-
declare const
|
|
16
|
-
export
|
|
15
|
+
declare const ButtonToggleGroupProvider: import("react").Provider<ButtonToggleGroupContextType | null>, useButtonToggleGroupContext: () => ButtonToggleGroupContextType;
|
|
16
|
+
export { ButtonToggleGroupProvider, useButtonToggleGroupContext };
|
package/esm/components/button-toggle/button-toggle-group/__internal__/button-toggle-group.context.js
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import createStrictContext from "../../../../__internal__/utils/createStrictContext";
|
|
2
|
+
const [ButtonToggleGroupProvider, useButtonToggleGroupContext] = createStrictContext({
|
|
3
|
+
name: "ButtonToggleGroupContext",
|
|
4
|
+
errorMessage: "Carbon ButtonToggleGroup: Context not found. Have you wrapped your Carbon subcomponents properly? See stack trace for more details.",
|
|
5
|
+
defaultValue: {
|
|
6
|
+
onButtonClick: /* istanbul ignore next */() => {},
|
|
7
|
+
handleKeyDown: /* istanbul ignore next */() => {},
|
|
8
|
+
pressedButtonValue: undefined,
|
|
9
|
+
allowDeselect: false,
|
|
10
|
+
isInGroup: false,
|
|
11
|
+
isDisabled: false
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
export { ButtonToggleGroupProvider, useButtonToggleGroupContext };
|
|
@@ -11,8 +11,10 @@ import { TooltipProvider } from "../../../__internal__/tooltip-provider";
|
|
|
11
11
|
import { InputGroupBehaviour } from "../../../__internal__/input-behaviour";
|
|
12
12
|
import Events from "../../../__internal__/utils/helpers/events";
|
|
13
13
|
import NewValidationContext from "../../carbon-provider/__internal__/new-validation.context";
|
|
14
|
-
import
|
|
14
|
+
import { ButtonToggleGroupProvider } from "./__internal__/button-toggle-group.context";
|
|
15
15
|
import HintText from "../../../__internal__/hint-text";
|
|
16
|
+
import Logger from "../../../__internal__/utils/logger";
|
|
17
|
+
let deprecateUncontrolledWarnTriggered = false;
|
|
16
18
|
const BUTTON_TOGGLE_SELECTOR = '[data-element="button-toggle-button"]';
|
|
17
19
|
const ButtonToggleGroup = ({
|
|
18
20
|
children,
|
|
@@ -31,8 +33,8 @@ const ButtonToggleGroup = ({
|
|
|
31
33
|
value,
|
|
32
34
|
helpAriaLabel,
|
|
33
35
|
id,
|
|
34
|
-
allowDeselect,
|
|
35
|
-
disabled,
|
|
36
|
+
allowDeselect = false,
|
|
37
|
+
disabled = false,
|
|
36
38
|
...props
|
|
37
39
|
}) => {
|
|
38
40
|
const hasCorrectItemStructure = useMemo(() => {
|
|
@@ -40,6 +42,10 @@ const ButtonToggleGroup = ({
|
|
|
40
42
|
return !incorrectChild;
|
|
41
43
|
}, [children]);
|
|
42
44
|
!hasCorrectItemStructure ? process.env.NODE_ENV !== "production" ? invariant(false, `\`ButtonToggleGroup\` only accepts children of type \`${ButtonToggle.displayName}\``) : invariant(false) : void 0;
|
|
45
|
+
if (!deprecateUncontrolledWarnTriggered && !onChange) {
|
|
46
|
+
deprecateUncontrolledWarnTriggered = true;
|
|
47
|
+
Logger.deprecate("Uncontrolled behaviour in `Button Toggle Group` is deprecated and support will soon be removed. Please make sure all your inputs are controlled.");
|
|
48
|
+
}
|
|
43
49
|
const labelId = useRef(guid());
|
|
44
50
|
const hintTextId = useRef(guid());
|
|
45
51
|
const wrapperRef = useRef(null);
|
|
@@ -111,7 +117,7 @@ const ButtonToggleGroup = ({
|
|
|
111
117
|
id: id,
|
|
112
118
|
labelAs: "span",
|
|
113
119
|
disabled: disabled
|
|
114
|
-
}, filterStyledSystemMarginProps(props), tagComponent(props["data-component"] ?? "button-toggle-group", props)), /*#__PURE__*/React.createElement(
|
|
120
|
+
}, filterStyledSystemMarginProps(props), tagComponent(props["data-component"] ?? "button-toggle-group", props)), /*#__PURE__*/React.createElement(ButtonToggleGroupProvider, {
|
|
115
121
|
value: {
|
|
116
122
|
onButtonClick,
|
|
117
123
|
handleKeyDown,
|
|
@@ -14,7 +14,10 @@ export interface ButtonToggleProps extends Partial<StyledButtonToggleProps>, Tag
|
|
|
14
14
|
onFocus?: (ev: React.FocusEvent<HTMLButtonElement>) => void;
|
|
15
15
|
/** Callback triggered by click event on the button. */
|
|
16
16
|
onClick?: (ev: React.MouseEvent<HTMLButtonElement>) => void;
|
|
17
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* Set the pressed state of the toggle button
|
|
19
|
+
* @deprecated
|
|
20
|
+
* */
|
|
18
21
|
pressed?: boolean;
|
|
19
22
|
/** An optional string by which to identify the button in either an onClick handler, or an onChange handler on the parent ButtonToggleGroup. */
|
|
20
23
|
value?: string;
|
|
@@ -3,11 +3,11 @@ import React, { useContext, useRef } from "react";
|
|
|
3
3
|
import invariant from "invariant";
|
|
4
4
|
import { StyledButtonToggle, StyledButtonToggleWrapper } from "./button-toggle.style";
|
|
5
5
|
import guid from "../../__internal__/utils/helpers/guid";
|
|
6
|
-
import
|
|
6
|
+
import { useButtonToggleGroupContext } from "./button-toggle-group/__internal__/button-toggle-group.context";
|
|
7
7
|
import ButtonToggleIcon from "./button-toggle-icon.component";
|
|
8
|
-
import Logger from "../../__internal__/utils/logger";
|
|
9
8
|
import { InputGroupContext } from "../../__internal__/input-behaviour";
|
|
10
|
-
|
|
9
|
+
import Logger from "../../__internal__/utils/logger";
|
|
10
|
+
let deprecatePressedWarnTriggered = false;
|
|
11
11
|
export const ButtonToggle = ({
|
|
12
12
|
"aria-label": ariaLabel,
|
|
13
13
|
"aria-labelledby": ariaLabelledBy,
|
|
@@ -26,6 +26,10 @@ export const ButtonToggle = ({
|
|
|
26
26
|
value
|
|
27
27
|
}) => {
|
|
28
28
|
!!!(children || buttonIcon) ? process.env.NODE_ENV !== "production" ? invariant(false, "Either prop `buttonIcon` must be defined, or this node must have children") : invariant(false) : void 0;
|
|
29
|
+
if (pressed && !deprecatePressedWarnTriggered) {
|
|
30
|
+
Logger.deprecate("The `pressed` prop is deprecated.");
|
|
31
|
+
deprecatePressedWarnTriggered = true;
|
|
32
|
+
}
|
|
29
33
|
const buttonRef = useRef(null);
|
|
30
34
|
const {
|
|
31
35
|
onMouseEnter,
|
|
@@ -44,50 +48,31 @@ export const ButtonToggle = ({
|
|
|
44
48
|
firstButton,
|
|
45
49
|
childButtonCallbackRef,
|
|
46
50
|
hintTextId
|
|
47
|
-
} =
|
|
51
|
+
} = useButtonToggleGroupContext();
|
|
48
52
|
const callbackRef = element => {
|
|
49
53
|
buttonRef.current = element;
|
|
50
|
-
|
|
51
|
-
childButtonCallbackRef(element);
|
|
52
|
-
}
|
|
54
|
+
childButtonCallbackRef?.(element);
|
|
53
55
|
};
|
|
54
56
|
const inputGuid = useRef(guid());
|
|
55
57
|
function handleClick(ev) {
|
|
56
58
|
if (onClick) {
|
|
57
59
|
onClick(ev);
|
|
58
60
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
if (allowDeselect && pressedButtonValue === value) {
|
|
62
|
-
newValue = undefined;
|
|
63
|
-
}
|
|
64
|
-
onChange(ev, newValue);
|
|
65
|
-
}
|
|
61
|
+
const newValue = allowDeselect && pressedButtonValue && pressedButtonValue === value ? undefined : value;
|
|
62
|
+
onChange?.(ev, newValue);
|
|
66
63
|
if (value) {
|
|
67
64
|
onButtonClick(value);
|
|
68
65
|
}
|
|
69
66
|
}
|
|
70
|
-
if (!deprecateUncontrolledWarnTriggered && !onChange) {
|
|
71
|
-
deprecateUncontrolledWarnTriggered = true;
|
|
72
|
-
Logger.deprecate("Uncontrolled behaviour in `Button Toggle` is deprecated and support will soon be removed. Please make sure all your inputs are controlled.");
|
|
73
|
-
}
|
|
74
67
|
function handleFocus(ev) {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
-
if (inputGroupOnFocus) {
|
|
79
|
-
inputGroupOnFocus();
|
|
80
|
-
}
|
|
68
|
+
onFocus?.(ev);
|
|
69
|
+
inputGroupOnFocus?.();
|
|
81
70
|
}
|
|
82
71
|
function handleBlur(ev) {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
86
|
-
if (inputGroupOnBlur) {
|
|
87
|
-
inputGroupOnBlur();
|
|
88
|
-
}
|
|
72
|
+
onBlur?.(ev);
|
|
73
|
+
inputGroupOnBlur?.();
|
|
89
74
|
}
|
|
90
|
-
const isPressed = isInGroup ? pressedButtonValue === value : pressed;
|
|
75
|
+
const isPressed = isInGroup ? pressedButtonValue && pressedButtonValue === value : pressed;
|
|
91
76
|
const isFirstButton = buttonRef.current === firstButton;
|
|
92
77
|
|
|
93
78
|
// if we're in a ButtonToggleGroup, only one button should be tabbable - the pressed button if there is one, or
|
|
@@ -100,7 +85,7 @@ export const ButtonToggle = ({
|
|
|
100
85
|
}, /*#__PURE__*/React.createElement(StyledButtonToggle, _extends({
|
|
101
86
|
"aria-label": ariaLabel,
|
|
102
87
|
"aria-labelledby": ariaLabelledBy,
|
|
103
|
-
"aria-describedby": hintTextId
|
|
88
|
+
"aria-describedby": hintTextId,
|
|
104
89
|
"aria-pressed": !!isPressed,
|
|
105
90
|
buttonIcon: buttonIcon,
|
|
106
91
|
buttonIconSize: buttonIconSize,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import { CardSpacing } from "../card.config";
|
|
3
3
|
export interface CardContextProps {
|
|
4
4
|
/** Sets the level of roundness of the corners, "default" is 8px and "large" is 16px */
|
|
5
|
-
roundness
|
|
5
|
+
roundness: "default" | "large";
|
|
6
6
|
/** Size of card for applying padding */
|
|
7
7
|
spacing: CardSpacing;
|
|
8
8
|
}
|
|
9
|
-
declare const
|
|
10
|
-
export
|
|
9
|
+
declare const CardProvider: import("react").Provider<CardContextProps | null>, useCardContext: () => CardContextProps;
|
|
10
|
+
export { CardProvider, useCardContext };
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import createStrictContext from "../../../__internal__/utils/createStrictContext";
|
|
2
|
+
const [CardProvider, useCardContext] = createStrictContext({
|
|
3
|
+
name: "CardContext",
|
|
4
|
+
errorMessage: "Carbon Card: Context not found. Have you wrapped your Carbon subcomponents properly? See stack trace for more details.",
|
|
5
|
+
defaultValue: {
|
|
6
|
+
spacing: "medium",
|
|
7
|
+
roundness: "default"
|
|
8
|
+
}
|
|
9
|
+
});
|
|
10
|
+
export { CardProvider, useCardContext };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { StyledCardColumnProps } from "./card-column.style";
|
|
3
3
|
import { TagProps } from "../../../__internal__/utils/helpers/tags/tags";
|
|
4
|
-
export interface CardColumnProps extends Partial<StyledCardColumnProps>,
|
|
4
|
+
export interface CardColumnProps extends Partial<StyledCardColumnProps>, TagProps {
|
|
5
5
|
/** Child elements */
|
|
6
6
|
children: React.ReactNode;
|
|
7
7
|
}
|
|
@@ -2,7 +2,7 @@ import React from "react";
|
|
|
2
2
|
import { SpaceProps } from "styled-system";
|
|
3
3
|
import { CardContextProps } from "../__internal__/card.context";
|
|
4
4
|
import { TagProps } from "../../../__internal__/utils/helpers/tags/tags";
|
|
5
|
-
export interface CardFooterProps extends SpaceProps, Pick<CardContextProps, "roundness"
|
|
5
|
+
export interface CardFooterProps extends SpaceProps, Partial<Pick<CardContextProps, "roundness">>, TagProps {
|
|
6
6
|
/** Child nodes */
|
|
7
7
|
children: React.ReactNode;
|
|
8
8
|
/** Specify styling variant to render */
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
-
import React
|
|
2
|
+
import React from "react";
|
|
3
3
|
import { filterStyledSystemMarginProps, filterStyledSystemPaddingProps } from "../../../style/utils";
|
|
4
4
|
import StyledCardFooter from "./card-footer.style";
|
|
5
|
-
import
|
|
5
|
+
import { useCardContext } from "../__internal__/card.context";
|
|
6
6
|
import tagComponent from "../../../__internal__/utils/helpers/tags/tags";
|
|
7
7
|
const CardFooter = ({
|
|
8
8
|
children,
|
|
@@ -12,7 +12,7 @@ const CardFooter = ({
|
|
|
12
12
|
const {
|
|
13
13
|
roundness,
|
|
14
14
|
spacing
|
|
15
|
-
} =
|
|
15
|
+
} = useCardContext();
|
|
16
16
|
return /*#__PURE__*/React.createElement(StyledCardFooter, _extends({
|
|
17
17
|
spacing: spacing,
|
|
18
18
|
variant: variant
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import { SpaceProps } from "styled-system";
|
|
2
2
|
import { CardContextProps } from "../__internal__/card.context";
|
|
3
3
|
import { CardFooterProps } from "./card-footer.component";
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
variant: Required<CardFooterProps>["variant"];
|
|
7
|
-
roundness: CardFooterProps["roundness"];
|
|
8
|
-
spacing: CardContextProps["spacing"];
|
|
9
|
-
}
|
|
10
|
-
declare const StyledCardFooter: import("styled-components").StyledComponent<"div", any, StyledCardFooterProps, never>;
|
|
4
|
+
export type StyledCardFooterProps = SpaceProps & Required<Pick<CardFooterProps, "variant">> & Pick<CardContextProps, "roundness" | "spacing">;
|
|
5
|
+
declare const StyledCardFooter: import("styled-components").StyledComponent<"div", any, SpaceProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, string | number | symbol> & Required<Pick<CardFooterProps, "variant">> & Pick<CardContextProps, "spacing" | "roundness">, never>;
|
|
11
6
|
export default StyledCardFooter;
|
|
@@ -17,7 +17,7 @@ const StyledCardFooter = styled.div`
|
|
|
17
17
|
${({
|
|
18
18
|
spacing,
|
|
19
19
|
variant,
|
|
20
|
-
roundness
|
|
20
|
+
roundness
|
|
21
21
|
}) => css`
|
|
22
22
|
background-color: ${variant === "transparent" ? "transparent" : "var(--colorsUtilityMajor025)"};
|
|
23
23
|
border-top: var(--colorsUtilityMajor100);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { PaddingProps } from "styled-system";
|
|
3
3
|
import { TagProps } from "../../../__internal__/utils/helpers/tags/tags";
|
|
4
|
-
export interface CardRowProps extends PaddingProps,
|
|
4
|
+
export interface CardRowProps extends PaddingProps, TagProps {
|
|
5
5
|
/** Child nodes */
|
|
6
6
|
children: React.ReactNode;
|
|
7
7
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
-
import React, {
|
|
2
|
+
import React, { useRef } from "react";
|
|
3
3
|
import { filterStyledSystemPaddingProps } from "../../../style/utils";
|
|
4
4
|
import StyledCardRow from "./card-row.style";
|
|
5
5
|
import tagComponent from "../../../__internal__/utils/helpers/tags/tags";
|
|
6
|
-
import
|
|
6
|
+
import { useCardContext } from "../__internal__/card.context";
|
|
7
7
|
import guid from "../../../__internal__/utils/helpers/guid";
|
|
8
8
|
const CardRow = ({
|
|
9
9
|
children,
|
|
@@ -11,7 +11,7 @@ const CardRow = ({
|
|
|
11
11
|
}) => {
|
|
12
12
|
const {
|
|
13
13
|
spacing
|
|
14
|
-
} =
|
|
14
|
+
} = useCardContext();
|
|
15
15
|
const id = useRef(guid());
|
|
16
16
|
return /*#__PURE__*/React.createElement(StyledCardRow, _extends({
|
|
17
17
|
id: id.current,
|
|
@@ -5,7 +5,7 @@ import { CardContextProps } from "./__internal__/card.context";
|
|
|
5
5
|
import { TagProps } from "../../__internal__/utils/helpers/tags/tags";
|
|
6
6
|
type DesignTokensType = keyof typeof DesignTokens;
|
|
7
7
|
type BoxShadowsType = Extract<DesignTokensType, `boxShadow${string}`>;
|
|
8
|
-
export interface CardProps extends MarginProps,
|
|
8
|
+
export interface CardProps extends MarginProps, TagProps {
|
|
9
9
|
/** Action to be executed when card is clicked or enter pressed.
|
|
10
10
|
* Renders a button when passed and no draggable or href props set
|
|
11
11
|
* */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
2
|
import React, { useState } from "react";
|
|
3
3
|
import { filterStyledSystemMarginProps } from "../../style/utils";
|
|
4
|
-
import
|
|
4
|
+
import { CardProvider } from "./__internal__/card.context";
|
|
5
5
|
import { StyledCard, StyledCardContent } from "./card.style";
|
|
6
6
|
import Icon from "../icon";
|
|
7
7
|
import tagComponent from "../../__internal__/utils/helpers/tags/tags";
|
|
@@ -46,7 +46,7 @@ const Card = ({
|
|
|
46
46
|
"data-role": dataRole
|
|
47
47
|
})), draggable && /*#__PURE__*/React.createElement(Icon, {
|
|
48
48
|
type: "drag"
|
|
49
|
-
}), /*#__PURE__*/React.createElement(
|
|
49
|
+
}), /*#__PURE__*/React.createElement(CardProvider, {
|
|
50
50
|
value: {
|
|
51
51
|
roundness,
|
|
52
52
|
spacing
|
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
asSingleColumn?: boolean;
|
|
6
|
-
/** This string will specify the text align styling of the `<dt></dt>`. */
|
|
7
|
-
dtTextAlign?: ElementAlignment;
|
|
8
|
-
/** This string will specify the text align styling of the `<dd></dd>`. */
|
|
9
|
-
ddTextAlign?: ElementAlignment;
|
|
10
|
-
}
|
|
11
|
-
declare const _default: React.Context<DlContextProps>;
|
|
12
|
-
export default _default;
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { DlProps } from "../dl.component";
|
|
3
|
+
declare const DlProvider: import("react").Provider<Required<Pick<DlProps, "dtTextAlign" | "ddTextAlign" | "asSingleColumn">> | null>, useDlContext: () => Required<Pick<DlProps, "dtTextAlign" | "ddTextAlign" | "asSingleColumn">>;
|
|
4
|
+
export { DlProvider, useDlContext };
|
|
@@ -1,2 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import createStrictContext from "../../../__internal__/utils/createStrictContext";
|
|
2
|
+
const [DlProvider, useDlContext] = createStrictContext({
|
|
3
|
+
name: "DlContext",
|
|
4
|
+
errorMessage: "Carbon DefinitionList: Context not found. Have you wrapped your Carbon subcomponents properly? See stack trace for more details.",
|
|
5
|
+
defaultValue: {
|
|
6
|
+
asSingleColumn: false,
|
|
7
|
+
dtTextAlign: "right",
|
|
8
|
+
ddTextAlign: "left"
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
export { DlProvider, useDlContext };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
-
import React
|
|
2
|
+
import React from "react";
|
|
3
3
|
import { StyledDd } from "../definition-list.style";
|
|
4
|
-
import
|
|
4
|
+
import { useDlContext } from "../__internal__/dl.context";
|
|
5
5
|
import tagComponent from "../../../__internal__/utils/helpers/tags";
|
|
6
6
|
const Dd = ({
|
|
7
7
|
children,
|
|
@@ -13,7 +13,7 @@ const Dd = ({
|
|
|
13
13
|
const {
|
|
14
14
|
asSingleColumn,
|
|
15
15
|
ddTextAlign
|
|
16
|
-
} =
|
|
16
|
+
} = useDlContext();
|
|
17
17
|
return /*#__PURE__*/React.createElement(StyledDd, _extends({
|
|
18
18
|
"data-element": "dd",
|
|
19
19
|
"data-role": "dd",
|