carbon-react 153.7.1 → 153.8.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/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/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
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { SpaceProps } from "styled-system";
|
|
3
|
-
import { DlContextProps } from "./__internal__/dl.context";
|
|
4
3
|
import { TagProps } from "../../__internal__/utils/helpers/tags";
|
|
5
|
-
|
|
4
|
+
type ElementAlignment = "left" | "center" | "right";
|
|
5
|
+
export interface DlProps extends SpaceProps, TagProps {
|
|
6
6
|
/** HTML id attribute of the input */
|
|
7
7
|
id?: string;
|
|
8
8
|
/** prop to render children. */
|
|
@@ -11,6 +11,12 @@ export interface DlProps extends SpaceProps, DlContextProps, TagProps {
|
|
|
11
11
|
by the `StyledDdDiv`. This prop has no effect when `asSingleColumn` is set.
|
|
12
12
|
*/
|
|
13
13
|
w?: number;
|
|
14
|
+
/** Render the DefinitionList as a single column */
|
|
15
|
+
asSingleColumn?: boolean;
|
|
16
|
+
/** This string will specify the text align styling of the `<dt></dt>`. */
|
|
17
|
+
dtTextAlign?: ElementAlignment;
|
|
18
|
+
/** This string will specify the text align styling of the `<dd></dd>`. */
|
|
19
|
+
ddTextAlign?: ElementAlignment;
|
|
14
20
|
}
|
|
15
21
|
declare const Dl: {
|
|
16
22
|
({ children, w, dtTextAlign, ddTextAlign, asSingleColumn, ...rest }: DlProps): React.JSX.Element;
|
|
@@ -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 from "react";
|
|
3
3
|
import { StyledDl } from "./definition-list.style";
|
|
4
|
-
import
|
|
4
|
+
import { DlProvider } from "./__internal__/dl.context";
|
|
5
5
|
import tagComponent from "../../__internal__/utils/helpers/tags";
|
|
6
6
|
const Dl = ({
|
|
7
7
|
children,
|
|
@@ -14,7 +14,7 @@ const Dl = ({
|
|
|
14
14
|
return /*#__PURE__*/React.createElement(StyledDl, _extends({
|
|
15
15
|
w: w,
|
|
16
16
|
asSingleColumn: asSingleColumn
|
|
17
|
-
}, rest, tagComponent("dl", rest)), /*#__PURE__*/React.createElement(
|
|
17
|
+
}, rest, tagComponent("dl", rest)), /*#__PURE__*/React.createElement(DlProvider, {
|
|
18
18
|
value: {
|
|
19
19
|
asSingleColumn,
|
|
20
20
|
dtTextAlign,
|
|
@@ -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 { StyledDt } 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 Dt = ({
|
|
7
7
|
children,
|
|
@@ -10,7 +10,7 @@ const Dt = ({
|
|
|
10
10
|
const {
|
|
11
11
|
asSingleColumn,
|
|
12
12
|
dtTextAlign
|
|
13
|
-
} =
|
|
13
|
+
} = useDlContext();
|
|
14
14
|
const {
|
|
15
15
|
mb,
|
|
16
16
|
pr
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
isInFlatTable?: boolean;
|
|
6
|
-
setHasOpenDatePicker?: Dispatch<SetStateAction<boolean>>;
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
interface FlatTableContextType {
|
|
3
|
+
isInFlatTable: boolean;
|
|
4
|
+
setHasOpenDatePicker?: (value: boolean) => void;
|
|
7
5
|
}
|
|
8
|
-
declare const
|
|
9
|
-
export default
|
|
6
|
+
declare const FlatTableContext: import("react").Context<FlatTableContextType>;
|
|
7
|
+
export default FlatTableContext;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
});
|
|
1
|
+
import { createContext } from "react";
|
|
2
|
+
const FlatTableContext = /*#__PURE__*/createContext({
|
|
3
|
+
isInFlatTable: false,
|
|
4
|
+
setHasOpenDatePicker: undefined
|
|
5
|
+
});
|
|
6
|
+
export default FlatTableContext;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { FlatTableProps } from "../flat-table.component";
|
|
3
|
+
export interface StrictFlatTableContextType extends Pick<FlatTableProps, "colorTheme" | "size"> {
|
|
4
|
+
getTabStopElementId: () => string;
|
|
5
|
+
}
|
|
6
|
+
declare const StrictFlatTableProvider: import("react").Provider<StrictFlatTableContextType | null>, useStrictFlatTableContext: () => StrictFlatTableContextType;
|
|
7
|
+
export { StrictFlatTableProvider, useStrictFlatTableContext };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import createStrictContext from "../../../__internal__/utils/createStrictContext";
|
|
2
|
+
const [StrictFlatTableProvider, useStrictFlatTableContext] = createStrictContext({
|
|
3
|
+
name: "FlatTableContext",
|
|
4
|
+
errorMessage: "Carbon FlatTable: Context not found. Have you wrapped your Carbon subcomponents properly? See stack trace for more details.",
|
|
5
|
+
defaultValue: {
|
|
6
|
+
getTabStopElementId: () => ""
|
|
7
|
+
}
|
|
8
|
+
});
|
|
9
|
+
export { StrictFlatTableProvider, useStrictFlatTableContext };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { useContext, useEffect, useState } from "react";
|
|
2
2
|
import FlatTableRowContext from "../flat-table-row/__internal__/flat-table-row.context";
|
|
3
|
-
import
|
|
3
|
+
import { useStrictFlatTableContext } from "./strict-flat-table.context";
|
|
4
4
|
export default id => {
|
|
5
5
|
const {
|
|
6
6
|
getTabStopElementId
|
|
7
|
-
} =
|
|
7
|
+
} = useStrictFlatTableContext();
|
|
8
8
|
const [tabIndex, setTabIndex] = useState(-1);
|
|
9
9
|
const {
|
|
10
10
|
expandable,
|
|
@@ -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, { useRef
|
|
2
|
+
import React, { useRef } from "react";
|
|
3
3
|
import StyledFlatTableHeader from "./flat-table-header.style";
|
|
4
|
-
import
|
|
4
|
+
import { useStrictFlatTableContext } from "../__internal__/strict-flat-table.context";
|
|
5
5
|
import guid from "../../../__internal__/utils/helpers/guid";
|
|
6
6
|
import useTableCell from "../__internal__/use-table-cell";
|
|
7
7
|
export const FlatTableHeader = ({
|
|
@@ -21,7 +21,7 @@ export const FlatTableHeader = ({
|
|
|
21
21
|
const internalId = useRef(id || guid());
|
|
22
22
|
const {
|
|
23
23
|
colorTheme
|
|
24
|
-
} =
|
|
24
|
+
} = useStrictFlatTableContext();
|
|
25
25
|
const {
|
|
26
26
|
leftPosition,
|
|
27
27
|
rightPosition,
|
|
@@ -6,7 +6,7 @@ import StyledFlatTableRow from "./flat-table-row.style";
|
|
|
6
6
|
import DrawerSidebarContext from "../../drawer/__internal__/drawer-sidebar.context";
|
|
7
7
|
import FlatTableRowHeader from "../flat-table-row-header";
|
|
8
8
|
import FlatTableRowDraggable from "./__internal__/flat-table-row-draggable.component";
|
|
9
|
-
import
|
|
9
|
+
import { useStrictFlatTableContext } from "../__internal__/strict-flat-table.context";
|
|
10
10
|
import guid from "../../../__internal__/utils/helpers/guid";
|
|
11
11
|
import FlatTableRowContext from "./__internal__/flat-table-row.context";
|
|
12
12
|
import SubRowProvider, { SubRowContext } from "./__internal__/sub-row-provider";
|
|
@@ -95,7 +95,7 @@ export const FlatTableRow = /*#__PURE__*/React.forwardRef(({
|
|
|
95
95
|
colorTheme,
|
|
96
96
|
size,
|
|
97
97
|
getTabStopElementId
|
|
98
|
-
} =
|
|
98
|
+
} = useStrictFlatTableContext();
|
|
99
99
|
const {
|
|
100
100
|
isInSidebar
|
|
101
101
|
} = useContext(DrawerSidebarContext);
|
|
@@ -3,6 +3,7 @@ import React, { useLayoutEffect, useRef, useState, useContext } from "react";
|
|
|
3
3
|
import { StyledFlatTableWrapper, StyledFlatTable, StyledFlatTableFooter, StyledTableContainer } from "./flat-table.style";
|
|
4
4
|
import DrawerSidebarContext from "../drawer/__internal__/drawer-sidebar.context";
|
|
5
5
|
import Events from "../../__internal__/utils/helpers/events/events";
|
|
6
|
+
import { StrictFlatTableProvider } from "./__internal__/strict-flat-table.context";
|
|
6
7
|
import FlatTableContext from "./__internal__/flat-table.context";
|
|
7
8
|
const FOCUSABLE_ROW_AND_CELL_QUERY = "tbody tr[tabindex], tbody tr td[tabindex], tbody tr th[tabindex]";
|
|
8
9
|
export const FlatTable = ({
|
|
@@ -186,15 +187,18 @@ export const FlatTable = ({
|
|
|
186
187
|
}, /*#__PURE__*/React.createElement(StyledFlatTable, _extends({
|
|
187
188
|
ref: tableRef,
|
|
188
189
|
"data-component": "flat-table"
|
|
189
|
-
}, tableStylingProps), caption ? /*#__PURE__*/React.createElement("caption", null, caption) : null, /*#__PURE__*/React.createElement(
|
|
190
|
+
}, tableStylingProps), caption ? /*#__PURE__*/React.createElement("caption", null, caption) : null, /*#__PURE__*/React.createElement(StrictFlatTableProvider, {
|
|
190
191
|
value: {
|
|
191
192
|
colorTheme,
|
|
192
193
|
size,
|
|
193
|
-
getTabStopElementId
|
|
194
|
+
getTabStopElementId
|
|
195
|
+
}
|
|
196
|
+
}, /*#__PURE__*/React.createElement(FlatTableContext.Provider, {
|
|
197
|
+
value: {
|
|
194
198
|
isInFlatTable: true,
|
|
195
199
|
setHasOpenDatePicker
|
|
196
200
|
}
|
|
197
|
-
}, children))), footer && /*#__PURE__*/React.createElement(StyledFlatTableFooter, {
|
|
201
|
+
}, children)))), footer && /*#__PURE__*/React.createElement(StyledFlatTableFooter, {
|
|
198
202
|
hasStickyFooter: hasStickyFooter,
|
|
199
203
|
"data-role": "flat-table-footer"
|
|
200
204
|
}, footer));
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import React, { useRef
|
|
1
|
+
import React, { useRef } from "react";
|
|
2
2
|
import Event from "../../../__internal__/utils/helpers/events";
|
|
3
3
|
import Typography from "../../typography";
|
|
4
4
|
import { StyledSort, StyledSpaceHolder, StyledSortIcon } from "./sort.style";
|
|
5
5
|
import guid from "../../../__internal__/utils/helpers/guid";
|
|
6
6
|
import useLocale from "../../../hooks/__internal__/useLocale";
|
|
7
|
-
import
|
|
7
|
+
import { useStrictFlatTableContext } from "../__internal__/strict-flat-table.context";
|
|
8
8
|
export const Sort = ({
|
|
9
9
|
children,
|
|
10
10
|
onClick,
|
|
@@ -24,7 +24,7 @@ export const Sort = ({
|
|
|
24
24
|
};
|
|
25
25
|
const {
|
|
26
26
|
colorTheme
|
|
27
|
-
} =
|
|
27
|
+
} = useStrictFlatTableContext();
|
|
28
28
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Typography, {
|
|
29
29
|
screenReaderOnly: true,
|
|
30
30
|
id: id.current
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
export type StepFlowContextType = {
|
|
3
3
|
validatedCurrentStep?: number;
|
|
4
4
|
totalSteps?: number;
|
|
@@ -6,5 +6,5 @@ export type StepFlowContextType = {
|
|
|
6
6
|
category?: string;
|
|
7
7
|
titleRef?: React.RefObject<HTMLDivElement>;
|
|
8
8
|
};
|
|
9
|
-
declare const
|
|
10
|
-
export
|
|
9
|
+
declare const StepFlowProvider: import("react").Provider<StepFlowContextType | null>, useStepFlowContext: () => StepFlowContextType;
|
|
10
|
+
export { StepFlowProvider, useStepFlowContext };
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
const
|
|
3
|
-
|
|
1
|
+
import createStrictContext from "../../../__internal__/utils/createStrictContext";
|
|
2
|
+
const [StepFlowProvider, useStepFlowContext] = createStrictContext({
|
|
3
|
+
name: "StepFlowContext",
|
|
4
|
+
errorMessage: "Carbon StepFlow: Context not found. Have you wrapped your Carbon subcomponents properly? See stack trace for more details.",
|
|
5
|
+
defaultValue: {}
|
|
6
|
+
});
|
|
7
|
+
export { StepFlowProvider, useStepFlowContext };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from "react";
|
|
2
2
|
import Typography from "../../typography";
|
|
3
3
|
import useLocale from "../../../hooks/__internal__/useLocale";
|
|
4
|
-
import
|
|
4
|
+
import { useStepFlowContext } from "../__internal__/step-flow.context";
|
|
5
5
|
import { StyledTitleFocusWrapper } from "../step-flow.style";
|
|
6
6
|
export const StepFlowTitle = ({
|
|
7
7
|
titleString,
|
|
@@ -15,7 +15,7 @@ export const StepFlowTitle = ({
|
|
|
15
15
|
totalSteps,
|
|
16
16
|
category,
|
|
17
17
|
titleVariant: titleVariantContext
|
|
18
|
-
} =
|
|
18
|
+
} = useStepFlowContext();
|
|
19
19
|
return /*#__PURE__*/React.createElement(StyledTitleFocusWrapper, {
|
|
20
20
|
"data-role": "title-text-wrapper",
|
|
21
21
|
"data-element": "title-text-wrapper",
|
|
@@ -6,7 +6,7 @@ import { StyledStepFlow, StyledStepContent, StyledStepContentText, StyledStepLab
|
|
|
6
6
|
import tagComponent from "../../__internal__/utils/helpers/tags/tags";
|
|
7
7
|
import Typography from "../typography";
|
|
8
8
|
import useLocale from "../../hooks/__internal__/useLocale";
|
|
9
|
-
import
|
|
9
|
+
import { StepFlowProvider } from "./__internal__/step-flow.context";
|
|
10
10
|
import StepFlowTitle from "./step-flow-title/step-flow-title.component";
|
|
11
11
|
export const StepFlow = /*#__PURE__*/forwardRef(({
|
|
12
12
|
category,
|
|
@@ -72,7 +72,7 @@ export const StepFlow = /*#__PURE__*/forwardRef(({
|
|
|
72
72
|
titleRef.current?.focus();
|
|
73
73
|
}
|
|
74
74
|
}), []);
|
|
75
|
-
const stepFlowTitle = /*#__PURE__*/React.createElement(
|
|
75
|
+
const stepFlowTitle = /*#__PURE__*/React.createElement(StepFlowProvider, {
|
|
76
76
|
value: {
|
|
77
77
|
validatedCurrentStep,
|
|
78
78
|
totalSteps,
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
interface StepSequenceContextType {
|
|
3
|
+
orientation: "horizontal" | "vertical";
|
|
4
|
+
}
|
|
5
|
+
declare const StepSequenceProvider: import("react").Provider<StepSequenceContextType | null>, useStepSequenceContext: () => StepSequenceContextType;
|
|
6
|
+
export { StepSequenceProvider, useStepSequenceContext };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import createStrictContext from "../../../__internal__/utils/createStrictContext";
|
|
2
|
+
const [StepSequenceProvider, useStepSequenceContext] = createStrictContext({
|
|
3
|
+
name: "StepSequenceContext",
|
|
4
|
+
errorMessage: "Carbon StepSequence: Context not found. Have you wrapped your Carbon subcomponents properly? See stack trace for more details.",
|
|
5
|
+
defaultValue: {
|
|
6
|
+
orientation: "horizontal"
|
|
7
|
+
}
|
|
8
|
+
});
|
|
9
|
+
export { StepSequenceProvider, useStepSequenceContext };
|
|
@@ -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 { StyledStepSequenceItem, StyledStepSequenceItemContent, StyledStepSequenceItemIndicator, StyledStepSequenceItemHiddenLabel } from "./step-sequence-item.style";
|
|
4
4
|
import Icon from "../../icon";
|
|
5
|
-
import {
|
|
5
|
+
import { useStepSequenceContext } from "../__internal__/step-sequence.context";
|
|
6
6
|
import tagComponent from "../../../__internal__/utils/helpers/tags";
|
|
7
7
|
export const StepSequenceItem = ({
|
|
8
8
|
hideIndicator = false,
|
|
@@ -16,7 +16,7 @@ export const StepSequenceItem = ({
|
|
|
16
16
|
}) => {
|
|
17
17
|
const {
|
|
18
18
|
orientation
|
|
19
|
-
} =
|
|
19
|
+
} = useStepSequenceContext();
|
|
20
20
|
const indicatorText = () => {
|
|
21
21
|
return !hideIndicator ? /*#__PURE__*/React.createElement(StyledStepSequenceItemIndicator, null, indicator) : null;
|
|
22
22
|
};
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { SpaceProps } from "styled-system";
|
|
3
3
|
import { TagProps } from "../../__internal__/utils/helpers/tags";
|
|
4
|
-
export declare const StepSequenceContext: React.Context<{
|
|
5
|
-
orientation: "horizontal" | "vertical";
|
|
6
|
-
}>;
|
|
7
4
|
export interface StepSequenceProps extends SpaceProps, TagProps {
|
|
8
5
|
/** Step sequence items to be rendered */
|
|
9
6
|
children: React.ReactNode;
|
|
@@ -2,9 +2,7 @@ function _extends() { return _extends = Object.assign ? Object.assign.bind() : f
|
|
|
2
2
|
import React from "react";
|
|
3
3
|
import tagComponent from "../../__internal__/utils/helpers/tags";
|
|
4
4
|
import StyledStepSequence from "./step-sequence.style";
|
|
5
|
-
|
|
6
|
-
orientation: "horizontal"
|
|
7
|
-
});
|
|
5
|
+
import { StepSequenceProvider } from "./__internal__/step-sequence.context";
|
|
8
6
|
export const StepSequence = ({
|
|
9
7
|
children,
|
|
10
8
|
orientation = "horizontal",
|
|
@@ -13,7 +11,7 @@ export const StepSequence = ({
|
|
|
13
11
|
return /*#__PURE__*/React.createElement(StyledStepSequence, _extends({
|
|
14
12
|
orientation: orientation,
|
|
15
13
|
p: 0
|
|
16
|
-
}, props, tagComponent("step-sequence", props)), /*#__PURE__*/React.createElement(
|
|
14
|
+
}, props, tagComponent("step-sequence", props)), /*#__PURE__*/React.createElement(StepSequenceProvider, {
|
|
17
15
|
value: {
|
|
18
16
|
orientation
|
|
19
17
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { PaddingProps } from "styled-system";
|
|
3
|
-
interface
|
|
4
|
-
isHorizontal
|
|
3
|
+
interface TileContextType {
|
|
4
|
+
isHorizontal: boolean;
|
|
5
5
|
paddingPropsFromTile: PaddingProps;
|
|
6
6
|
}
|
|
7
|
-
declare const
|
|
8
|
-
export
|
|
7
|
+
declare const TileProvider: import("react").Provider<TileContextType | null>, useTileContext: () => TileContextType;
|
|
8
|
+
export { TileProvider, useTileContext };
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import createStrictContext from "../../../__internal__/utils/createStrictContext";
|
|
2
|
+
const [TileProvider, useTileContext] = createStrictContext({
|
|
3
|
+
name: "TileContext",
|
|
4
|
+
errorMessage: "Carbon Tile: Context not found. Have you wrapped your Carbon subcomponents properly? See stack trace for more details.",
|
|
5
|
+
defaultValue: {
|
|
6
|
+
paddingPropsFromTile: {},
|
|
7
|
+
isHorizontal: false
|
|
8
|
+
}
|
|
9
|
+
});
|
|
10
|
+
export { TileProvider, useTileContext };
|
|
@@ -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 StyledTileContent from "./tile-content.style";
|
|
4
|
-
import
|
|
4
|
+
import { useTileContext } from "../__internal__/tile.context";
|
|
5
5
|
import tagComponent from "../../../__internal__/utils/helpers/tags";
|
|
6
6
|
import filterStyledSystemPaddingProps from "../../../style/utils/filter-styled-system-padding-props";
|
|
7
7
|
import filterStyledSystemMarginProps from "../../../style/utils/filter-styled-system-margin-props";
|
|
@@ -14,7 +14,7 @@ const TileContent = ({
|
|
|
14
14
|
const {
|
|
15
15
|
isHorizontal,
|
|
16
16
|
paddingPropsFromTile
|
|
17
|
-
} =
|
|
17
|
+
} = useTileContext();
|
|
18
18
|
if (!children) {
|
|
19
19
|
return null;
|
|
20
20
|
}
|
|
@@ -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 from "react";
|
|
3
3
|
import StyledTile from "./tile.style";
|
|
4
|
-
import
|
|
4
|
+
import { TileProvider } from "./__internal__/tile.context";
|
|
5
5
|
import filterStyledSystemPaddingProps from "../../style/utils/filter-styled-system-padding-props";
|
|
6
6
|
import filterStyledSystemMarginProps from "../../style/utils/filter-styled-system-margin-props";
|
|
7
7
|
import computeContentPadding from "./__internal__/compute-content-padding";
|
|
@@ -36,7 +36,7 @@ export const Tile = ({
|
|
|
36
36
|
highlightVariant: highlightVariant,
|
|
37
37
|
borderWidth: borderWidth,
|
|
38
38
|
borderVariant: borderVariant
|
|
39
|
-
}, paddingProps, marginProps, tagComponent("tile", rest)), /*#__PURE__*/React.createElement(
|
|
39
|
+
}, paddingProps, marginProps, tagComponent("tile", rest)), /*#__PURE__*/React.createElement(TileProvider, {
|
|
40
40
|
value: {
|
|
41
41
|
isHorizontal,
|
|
42
42
|
paddingPropsFromTile: contentPaddingProps
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
interface VerticalMenuContextType {
|
|
3
|
+
isFullScreen: boolean;
|
|
4
|
+
}
|
|
5
|
+
declare const VerticalMenuProvider: import("react").Provider<VerticalMenuContextType | null>, useVerticalMenuContext: () => VerticalMenuContextType;
|
|
6
|
+
export { VerticalMenuProvider, useVerticalMenuContext };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import createStrictContext from "../../../__internal__/utils/createStrictContext";
|
|
2
|
+
const [VerticalMenuProvider, useVerticalMenuContext] = createStrictContext({
|
|
3
|
+
name: "VerticalMenuContext",
|
|
4
|
+
errorMessage: "Carbon VerticalMenu: Context not found. Have you wrapped your Carbon subcomponents properly? See stack trace for more details.",
|
|
5
|
+
defaultValue: {
|
|
6
|
+
isFullScreen: false
|
|
7
|
+
}
|
|
8
|
+
});
|
|
9
|
+
export { VerticalMenuProvider, useVerticalMenuContext };
|
|
@@ -8,7 +8,7 @@ import IconButton from "../../icon-button";
|
|
|
8
8
|
import Icon from "../../icon";
|
|
9
9
|
import Box from "../../box";
|
|
10
10
|
import { StyledList, StyledVerticalMenuFullScreen } from "../vertical-menu.style";
|
|
11
|
-
import
|
|
11
|
+
import { VerticalMenuProvider } from "../__internal__/vertical-menu.context";
|
|
12
12
|
import { getDocument } from "../../../__internal__/dom/globals";
|
|
13
13
|
import Events from "../../../__internal__/utils/helpers/events/events";
|
|
14
14
|
import useModalManager from "../../../hooks/__internal__/useModalManager";
|
|
@@ -64,7 +64,7 @@ export const VerticalMenuFullScreen = ({
|
|
|
64
64
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
65
65
|
type: "close",
|
|
66
66
|
color: "var(--colorsComponentsLeftnavWinterStandardContent)"
|
|
67
|
-
}))), /*#__PURE__*/React.createElement(
|
|
67
|
+
}))), /*#__PURE__*/React.createElement(VerticalMenuProvider, {
|
|
68
68
|
value: {
|
|
69
69
|
isFullScreen: true
|
|
70
70
|
}
|
|
@@ -2,9 +2,9 @@ function _extends() { return _extends = Object.assign ? Object.assign.bind() : f
|
|
|
2
2
|
import React, { useState, useContext } from "react";
|
|
3
3
|
import tagComponent from "../../../__internal__/utils/helpers/tags";
|
|
4
4
|
import { filterStyledSystemPaddingProps } from "../../../style/utils";
|
|
5
|
-
import VerticalMenuFullScreenContext from "../vertical-menu-full-screen/__internal__/vertical-menu-full-screen.context";
|
|
6
5
|
import { StyledVerticalMenuItem, StyledTitle, StyledAdornment, StyledList, StyledChevronIcon, StyledTitleIcon } from "../vertical-menu.style";
|
|
7
6
|
import MenuItemContext from "./__internal__/menu-item.context";
|
|
7
|
+
import { useVerticalMenuContext } from "../__internal__/vertical-menu.context";
|
|
8
8
|
export const VerticalMenuItem = ({
|
|
9
9
|
defaultOpen = false,
|
|
10
10
|
title,
|
|
@@ -26,7 +26,7 @@ export const VerticalMenuItem = ({
|
|
|
26
26
|
} = useContext(MenuItemContext);
|
|
27
27
|
const {
|
|
28
28
|
isFullScreen
|
|
29
|
-
} =
|
|
29
|
+
} = useVerticalMenuContext();
|
|
30
30
|
const renderAdornment = () => typeof adornment === "function" ? adornment(isOpen) : adornment;
|
|
31
31
|
const shouldDisplayActiveState = typeof active === "function" ? active(isOpen) : active;
|
|
32
32
|
let itemProps = {};
|
|
@@ -2,6 +2,7 @@ function _extends() { return _extends = Object.assign ? Object.assign.bind() : f
|
|
|
2
2
|
import React from "react";
|
|
3
3
|
import tagComponent from "../../__internal__/utils/helpers/tags";
|
|
4
4
|
import { StyledVerticalMenu, StyledList } from "./vertical-menu.style";
|
|
5
|
+
import { VerticalMenuProvider } from "./__internal__/vertical-menu.context";
|
|
5
6
|
export const VerticalMenu = ({
|
|
6
7
|
"aria-label": ariaLabel,
|
|
7
8
|
"aria-labelledby": ariaLabelledBy,
|
|
@@ -21,6 +22,10 @@ export const VerticalMenu = ({
|
|
|
21
22
|
overflow: "auto",
|
|
22
23
|
"aria-label": ariaLabel,
|
|
23
24
|
"aria-labelledby": ariaLabelledBy
|
|
24
|
-
}, tagComponent("vertical-menu", rest)), /*#__PURE__*/React.createElement(StyledList, null,
|
|
25
|
+
}, tagComponent("vertical-menu", rest)), /*#__PURE__*/React.createElement(StyledList, null, /*#__PURE__*/React.createElement(VerticalMenuProvider, {
|
|
26
|
+
value: {
|
|
27
|
+
isFullScreen: false
|
|
28
|
+
}
|
|
29
|
+
}, children)));
|
|
25
30
|
};
|
|
26
31
|
export default VerticalMenu;
|
package/lib/__internal__/utils/{createStrictContext.js → createStrictContext/createStrictContext.js}
RENAMED
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var _logger = _interopRequireDefault(require("
|
|
8
|
+
var _logger = _interopRequireDefault(require("../logger"));
|
|
9
9
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
10
|
/**
|
|
11
11
|
* Creates a React context with a provider and a hook for accessing the context.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./createStrictContext";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "default", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _createStrictContext.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _createStrictContext = _interopRequireDefault(require("./createStrictContext"));
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -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 {};
|
|
@@ -3,8 +3,15 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
7
|
-
var _react =
|
|
6
|
+
exports.useActionPopoverContext = exports.ActionPopoverProvider = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _invariant = _interopRequireDefault(require("invariant"));
|
|
8
9
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
-
const ActionPopoverContext = /*#__PURE__*/_react.
|
|
10
|
-
|
|
10
|
+
const ActionPopoverContext = /*#__PURE__*/(0, _react.createContext)(null);
|
|
11
|
+
const ActionPopoverProvider = exports.ActionPopoverProvider = ActionPopoverContext.Provider;
|
|
12
|
+
const useActionPopoverContext = () => {
|
|
13
|
+
const context = (0, _react.useContext)(ActionPopoverContext);
|
|
14
|
+
!context ? process.env.NODE_ENV !== "production" ? (0, _invariant.default)(false, "Carbon ActionPopover: Context not found. Have you wrapped your Carbon subcomponents properly? See stack trace for more details.") : (0, _invariant.default)(false) : void 0;
|
|
15
|
+
return context;
|
|
16
|
+
};
|
|
17
|
+
exports.useActionPopoverContext = useActionPopoverContext;
|
|
@@ -9,7 +9,7 @@ var _invariant = _interopRequireDefault(require("invariant"));
|
|
|
9
9
|
var _actionPopover = require("../action-popover.style");
|
|
10
10
|
var _events = _interopRequireDefault(require("../../../__internal__/utils/helpers/events"));
|
|
11
11
|
var _guid = _interopRequireDefault(require("../../../__internal__/utils/helpers/guid"));
|
|
12
|
-
var _actionPopover2 =
|
|
12
|
+
var _actionPopover2 = require("../__internal__/action-popover.context");
|
|
13
13
|
var _actionPopoverMenu = _interopRequireDefault(require("../action-popover-menu/action-popover-menu.component"));
|
|
14
14
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
15
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
@@ -56,15 +56,13 @@ const ActionPopoverItem = ({
|
|
|
56
56
|
isASubmenu = false,
|
|
57
57
|
...rest
|
|
58
58
|
}) => {
|
|
59
|
-
const context = (0, _react.useContext)(_actionPopover2.default);
|
|
60
|
-
!context ? process.env.NODE_ENV !== "production" ? (0, _invariant.default)(false, "ActionPopoverItem must be used within an ActionPopover component") : (0, _invariant.default)(false) : void 0;
|
|
61
59
|
!(/*#__PURE__*/_react.default.isValidElement(submenu) ? submenu.type === _actionPopoverMenu.default : true) ? process.env.NODE_ENV !== "production" ? (0, _invariant.default)(false, "ActionPopoverItem only accepts submenu of type `ActionPopoverMenu`") : (0, _invariant.default)(false) : void 0;
|
|
62
60
|
const {
|
|
63
61
|
setOpenPopover,
|
|
64
62
|
isOpenPopover,
|
|
65
63
|
focusButton,
|
|
66
64
|
submenuPosition
|
|
67
|
-
} =
|
|
65
|
+
} = (0, _actionPopover2.useActionPopoverContext)();
|
|
68
66
|
const isHref = !!href;
|
|
69
67
|
const [containerPosition, setContainerPosition] = (0, _react.useState)(undefined);
|
|
70
68
|
const [guid] = (0, _react.useState)((0, _guid.default)());
|