@atlaskit/primitives 1.4.3 → 1.5.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/CHANGELOG.md +16 -0
- package/constellation/heading/code.mdx +19 -0
- package/constellation/heading/examples.mdx +28 -0
- package/constellation/heading/usage.mdx +21 -0
- package/constellation/responsive/usage.mdx +1 -1
- package/dist/cjs/components/box.js +1 -1
- package/dist/cjs/components/heading-context.js +44 -0
- package/dist/cjs/components/heading.js +95 -0
- package/dist/cjs/components/internal/surface-provider.js +27 -0
- package/dist/cjs/components/text.js +131 -0
- package/dist/cjs/xcss/style-maps.partial.js +114 -6
- package/dist/es2019/components/box.js +2 -2
- package/dist/es2019/components/heading-context.js +35 -0
- package/dist/es2019/components/heading.js +87 -0
- package/dist/es2019/components/internal/surface-provider.js +19 -0
- package/dist/es2019/components/text.js +127 -0
- package/dist/es2019/xcss/style-maps.partial.js +92 -4
- package/dist/esm/components/box.js +2 -2
- package/dist/esm/components/heading-context.js +34 -0
- package/dist/esm/components/heading.js +87 -0
- package/dist/esm/components/internal/surface-provider.js +19 -0
- package/dist/esm/components/text.js +128 -0
- package/dist/esm/xcss/style-maps.partial.js +94 -4
- package/dist/types/components/heading-context.d.ts +31 -0
- package/dist/types/components/heading.d.ts +45 -0
- package/dist/types/components/internal/surface-provider.d.ts +15 -0
- package/dist/types/components/text.d.ts +57 -0
- package/dist/types/xcss/style-maps.partial.d.ts +114 -2
- package/dist/types-ts4.5/components/heading-context.d.ts +31 -0
- package/dist/types-ts4.5/components/heading.d.ts +45 -0
- package/dist/types-ts4.5/components/internal/surface-provider.d.ts +15 -0
- package/dist/types-ts4.5/components/text.d.ts +63 -0
- package/dist/types-ts4.5/xcss/style-maps.partial.d.ts +114 -2
- package/extract-react-types/box-props.tsx +3 -1
- package/extract-react-types/heading-props.tsx +3 -0
- package/heading/package.json +15 -0
- package/heading-context/package.json +15 -0
- package/package.json +17 -4
- package/report.api.md +1 -0
- package/scripts/__tests__/__snapshots__/codegen.test.tsx.snap +34 -0
- package/scripts/__tests__/codegen.test.tsx +4 -0
- package/scripts/codegen-styles.tsx +12 -0
- package/scripts/color-codegen-template.tsx +9 -0
- package/scripts/typography-codegen-template.tsx +107 -0
- package/tmp/api-report-tmp.d.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/primitives
|
|
2
2
|
|
|
3
|
+
## 1.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`fa6c592fdb2`](https://bitbucket.org/atlassian/atlassian-frontend/commits/fa6c592fdb2) - Introduce `Heading` into package in immediate alpha state. This is more or less a port of `@atlaskit/heading`. Component is not yet stable and implementation is likely to change.
|
|
8
|
+
- [`c2e55a9b782`](https://bitbucket.org/atlassian/atlassian-frontend/commits/c2e55a9b782) - Adds surface detection support to the Box primitive:
|
|
9
|
+
|
|
10
|
+
- Enable a `Box` background colour to be set to the `utility.elevation.surface.current` token.
|
|
11
|
+
- Internally set the current surface CSS variable value when the background color of a Box is set to a surface token (e.g. `elevation.surface.raised`).
|
|
12
|
+
|
|
13
|
+
## 1.4.4
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [`4e58672502e`](https://bitbucket.org/atlassian/atlassian-frontend/commits/4e58672502e) - Create text component.
|
|
18
|
+
|
|
3
19
|
## 1.4.3
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Heading
|
|
3
|
+
description: A heading is a typography component used to display text in different sizes and formats.
|
|
4
|
+
order: 1
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
import { CodeDocsHeader } from '@af/design-system-docs-ui';
|
|
8
|
+
|
|
9
|
+
<CodeDocsHeader
|
|
10
|
+
name="@atlaskit/primitives"
|
|
11
|
+
repository="https://bitbucket.org/atlassian/atlassian-frontend-mirror"
|
|
12
|
+
directoryName="primitives"
|
|
13
|
+
/>
|
|
14
|
+
|
|
15
|
+
import ERTHeading from '!!extract-react-types-loader!../../extract-react-types/heading-props'
|
|
16
|
+
|
|
17
|
+
## Props
|
|
18
|
+
|
|
19
|
+
<PropsTable heading="" props={ERTHeading} />
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Heading
|
|
3
|
+
description: A heading is a typography component used to display text in different sizes and formats.
|
|
4
|
+
order: 0
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
import HeadingDefault from '../../examples/constellation/heading/heading-default';
|
|
8
|
+
import HeadingInverse from '../../examples/constellation/heading/heading-inverse';
|
|
9
|
+
|
|
10
|
+
## Basic
|
|
11
|
+
|
|
12
|
+
Implements the [Atlassian typography set](/foundations/typography/) as a component.
|
|
13
|
+
|
|
14
|
+
A selected `level` will affect the final HTML element rendered in the DOM.
|
|
15
|
+
It's important to note that the final DOM may be impacted by the parent heading level context
|
|
16
|
+
because of inferred accessibility level correction. Therefore, it is recommended to check the final
|
|
17
|
+
DOM to confirm the actual rendered HTML element.
|
|
18
|
+
|
|
19
|
+
The typography `level` can be configured to one of the following types.
|
|
20
|
+
|
|
21
|
+
<Example Component={HeadingDefault} packageName="@atlaskit/heading" />
|
|
22
|
+
|
|
23
|
+
## Inverse
|
|
24
|
+
|
|
25
|
+
Set `color` to change the text color of the heading. Use `color="inverse"` for headings placed on a dark
|
|
26
|
+
surface for better color contrast.
|
|
27
|
+
|
|
28
|
+
<Example Component={HeadingInverse} packageName="@atlaskit/heading" />
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Heading
|
|
3
|
+
description: A heading is a typography component used to display text in different sizes and formats.
|
|
4
|
+
order: 2
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
Use headings to create section and subsection titles on a page.
|
|
10
|
+
|
|
11
|
+
## Accessibility
|
|
12
|
+
|
|
13
|
+
Nest headings by their rank (or level).
|
|
14
|
+
|
|
15
|
+
The most important heading has the rank 1 (`<h1>`), the least important heading rank 6 (`<h6>`).
|
|
16
|
+
Headings with an equal or higher rank start a new section, headings with a lower rank start new subsections that are part of the higher ranked section.
|
|
17
|
+
There should **only be one rank 1 (`<h1>`) heading per page** consisting of the name or main purpose of the overall site/platform.
|
|
18
|
+
|
|
19
|
+
Skipping heading ranks can be confusing and should be avoided where possible: make sure that a `<h2>` is **not** followed directly by an `<h4>`, for example.
|
|
20
|
+
It is ok to skip ranks when closing subsections, for instance, a `<h2>` beginning a new section, can follow an `<h4>` as it closes the previous section.
|
|
21
|
+
|
|
@@ -6,7 +6,7 @@ order: 2
|
|
|
6
6
|
|
|
7
7
|
## Media query helpers
|
|
8
8
|
|
|
9
|
-
The media query helper object `media.above[breakpoint]` maps to our [breakpoints](/components/
|
|
9
|
+
The media query helper object `media.above[breakpoint]` maps to our [breakpoints](/components/primitives/responsive/breakpoints/examples) as a media query for use in CSS-in-JS. `media.above[breakpoint]` targets all viewports **above** (larger than) the min-width of a given breakpoint
|
|
10
10
|
|
|
11
11
|
These responsive helpers are designed be used in conjunction with [xcss](/components/primitives/xcss). It is recommended that both are used when available as this uses our media queries to allow for safe, responsive styling.
|
|
12
12
|
|
|
@@ -60,7 +60,7 @@ var Box = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
60
60
|
ref: ref
|
|
61
61
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
62
62
|
}, safeHtmlAttributes, {
|
|
63
|
-
css: [baseStyles, backgroundColor && _styleMaps.backgroundColorStylesMap[backgroundColor], padding && _styleMaps.paddingStylesMap.padding[padding], paddingBlock && _styleMaps.paddingStylesMap.paddingBlock[paddingBlock], paddingBlockStart && _styleMaps.paddingStylesMap.paddingBlockStart[paddingBlockStart], paddingBlockEnd && _styleMaps.paddingStylesMap.paddingBlockEnd[paddingBlockEnd], paddingInline && _styleMaps.paddingStylesMap.paddingInline[paddingInline], paddingInlineStart && _styleMaps.paddingStylesMap.paddingInlineStart[paddingInlineStart], paddingInlineEnd && _styleMaps.paddingStylesMap.paddingInlineEnd[paddingInlineEnd],
|
|
63
|
+
css: [baseStyles, backgroundColor && _styleMaps.backgroundColorStylesMap[backgroundColor], (0, _styleMaps.isSurfaceColorToken)(backgroundColor) && _styleMaps.surfaceColorStylesMap[backgroundColor], padding && _styleMaps.paddingStylesMap.padding[padding], paddingBlock && _styleMaps.paddingStylesMap.paddingBlock[paddingBlock], paddingBlockStart && _styleMaps.paddingStylesMap.paddingBlockStart[paddingBlockStart], paddingBlockEnd && _styleMaps.paddingStylesMap.paddingBlockEnd[paddingBlockEnd], paddingInline && _styleMaps.paddingStylesMap.paddingInline[paddingInline], paddingInlineStart && _styleMaps.paddingStylesMap.paddingInlineStart[paddingInlineStart], paddingInlineEnd && _styleMaps.paddingStylesMap.paddingInlineEnd[paddingInlineEnd],
|
|
64
64
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
65
65
|
className],
|
|
66
66
|
"data-testid": testId
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.useHeadingElement = exports.default = void 0;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
10
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
11
|
+
// Allows support for heading levels 1-9 via aria-level
|
|
12
|
+
|
|
13
|
+
var HeadingContext = /*#__PURE__*/(0, _react.createContext)(0);
|
|
14
|
+
var useHeadingElement = function useHeadingElement() {
|
|
15
|
+
return (0, _react.useContext)(HeadingContext);
|
|
16
|
+
};
|
|
17
|
+
exports.useHeadingElement = useHeadingElement;
|
|
18
|
+
/**
|
|
19
|
+
* __Heading context__
|
|
20
|
+
*
|
|
21
|
+
* The HeadingContext
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```tsx
|
|
25
|
+
* // Will correctly infer the heading level
|
|
26
|
+
* <HeadingContext value={1}>
|
|
27
|
+
* <Heading>H1</Heading>
|
|
28
|
+
* <HeadingContext>
|
|
29
|
+
* <Heading>H2</Heading>
|
|
30
|
+
* </HeadingContext>
|
|
31
|
+
* </HeadingContext>
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
var HeadingContextProvider = function HeadingContextProvider(_ref) {
|
|
35
|
+
var children = _ref.children,
|
|
36
|
+
value = _ref.value;
|
|
37
|
+
var parentHeadingLevel = useHeadingElement();
|
|
38
|
+
var headingLevel = parentHeadingLevel + 1;
|
|
39
|
+
return /*#__PURE__*/_react.default.createElement(HeadingContext.Provider, {
|
|
40
|
+
value: value || headingLevel
|
|
41
|
+
}, children);
|
|
42
|
+
};
|
|
43
|
+
var _default = HeadingContextProvider;
|
|
44
|
+
exports.default = _default;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = require("@emotion/react");
|
|
8
|
+
var _headingContext = require("./heading-context");
|
|
9
|
+
/** @jsx jsx */
|
|
10
|
+
|
|
11
|
+
// https://atlassian.design/foundations/typography
|
|
12
|
+
var levelMap = {
|
|
13
|
+
xxl: 'h1',
|
|
14
|
+
xl: 'h2',
|
|
15
|
+
lg: 'h3',
|
|
16
|
+
md: 'h4',
|
|
17
|
+
sm: 'h5',
|
|
18
|
+
xs: 'h6',
|
|
19
|
+
xxs: 'div'
|
|
20
|
+
};
|
|
21
|
+
var headingResetStyles = (0, _react.css)({
|
|
22
|
+
color: "var(--ds-text, #172B4D)",
|
|
23
|
+
letterSpacing: 'normal',
|
|
24
|
+
marginBlock: 0,
|
|
25
|
+
textTransform: 'none'
|
|
26
|
+
});
|
|
27
|
+
var headingStylesMap = {
|
|
28
|
+
xxl: (0, _react.css)({
|
|
29
|
+
font: "var(--ds-font-heading-xxl, inherit)"
|
|
30
|
+
}),
|
|
31
|
+
xl: (0, _react.css)({
|
|
32
|
+
font: "var(--ds-font-heading-xl, inherit)"
|
|
33
|
+
}),
|
|
34
|
+
lg: (0, _react.css)({
|
|
35
|
+
font: "var(--ds-font-heading-lg, inherit)"
|
|
36
|
+
}),
|
|
37
|
+
md: (0, _react.css)({
|
|
38
|
+
font: "var(--ds-font-heading-md, inherit)"
|
|
39
|
+
}),
|
|
40
|
+
sm: (0, _react.css)({
|
|
41
|
+
font: "var(--ds-font-heading-sm, inherit)"
|
|
42
|
+
}),
|
|
43
|
+
xs: (0, _react.css)({
|
|
44
|
+
font: "var(--ds-font-heading-xs, inherit)"
|
|
45
|
+
}),
|
|
46
|
+
xxs: (0, _react.css)({
|
|
47
|
+
font: "var(--ds-font-heading-xxs, inherit)"
|
|
48
|
+
})
|
|
49
|
+
};
|
|
50
|
+
var inverseStyles = (0, _react.css)({
|
|
51
|
+
color: "var(--ds-text-inverse, #FFF)"
|
|
52
|
+
});
|
|
53
|
+
/**
|
|
54
|
+
* __Heading__
|
|
55
|
+
*
|
|
56
|
+
* A heading is a typography component used to display text in different sizes and formats.
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
*
|
|
60
|
+
* ```jsx
|
|
61
|
+
* import Heading from '@atlaskit/heading';
|
|
62
|
+
*
|
|
63
|
+
* const HeadingXXL = () => (
|
|
64
|
+
* <Heading level="xxl">XXL</Heading>
|
|
65
|
+
* );
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
var Heading = function Heading(_ref) {
|
|
69
|
+
var children = _ref.children,
|
|
70
|
+
level = _ref.level,
|
|
71
|
+
id = _ref.id,
|
|
72
|
+
testId = _ref.testId,
|
|
73
|
+
as = _ref.as,
|
|
74
|
+
_ref$color = _ref.color,
|
|
75
|
+
color = _ref$color === void 0 ? 'default' : _ref$color;
|
|
76
|
+
if (typeof process !== 'undefined' && process.env.NODE_ENV !== 'production' && as && typeof as !== 'string') {
|
|
77
|
+
throw new Error('`as` prop should be a string.');
|
|
78
|
+
}
|
|
79
|
+
var hLevel = (0, _headingContext.useHeadingElement)();
|
|
80
|
+
/**
|
|
81
|
+
* Order here is important, we for now apply
|
|
82
|
+
* 1. user choice
|
|
83
|
+
* 2. inferred a11y level
|
|
84
|
+
* 3. default final fallback
|
|
85
|
+
*/
|
|
86
|
+
var Markup = as || hLevel && (hLevel > 6 ? 'div' : "h".concat(hLevel)) || levelMap[level];
|
|
87
|
+
return (0, _react.jsx)(Markup, {
|
|
88
|
+
id: id,
|
|
89
|
+
"data-testid": testId,
|
|
90
|
+
role: Markup === 'div' ? 'heading' : undefined,
|
|
91
|
+
css: [headingResetStyles, level && headingStylesMap[level], color === 'inverse' && inverseStyles]
|
|
92
|
+
}, children);
|
|
93
|
+
};
|
|
94
|
+
var _default = Heading;
|
|
95
|
+
exports.default = _default;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useSurface = exports.SurfaceContext = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
/**
|
|
9
|
+
* __Surface context__
|
|
10
|
+
*
|
|
11
|
+
* A surface context provides context information on the current background (if set).
|
|
12
|
+
*/
|
|
13
|
+
var SurfaceContext = /*#__PURE__*/(0, _react.createContext)('elevation.surface');
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* __useSurface__
|
|
17
|
+
*
|
|
18
|
+
* Return the current surface. If no parent sets a surface color it falls back to the default surface.
|
|
19
|
+
*
|
|
20
|
+
* @see SurfaceContext
|
|
21
|
+
*/
|
|
22
|
+
exports.SurfaceContext = SurfaceContext;
|
|
23
|
+
var useSurface = function useSurface() {
|
|
24
|
+
return (0, _react.useContext)(SurfaceContext);
|
|
25
|
+
};
|
|
26
|
+
exports.useSurface = useSurface;
|
|
27
|
+
SurfaceContext.displayName = 'SurfaceProvider';
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
9
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
|
+
var _react = require("react");
|
|
11
|
+
var _react2 = require("@emotion/react");
|
|
12
|
+
var _tinyInvariant = _interopRequireDefault(require("tiny-invariant"));
|
|
13
|
+
var _styleMaps = require("../xcss/style-maps.partial");
|
|
14
|
+
var _excluded = ["children"];
|
|
15
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
16
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } /** @jsx jsx */
|
|
17
|
+
// import surfaceColorMap from '../internal/color-map';
|
|
18
|
+
|
|
19
|
+
// import { useSurface } from './internal/surface-provider';
|
|
20
|
+
var asAllowlist = ['span', 'p', 'strong', 'em', 'label'];
|
|
21
|
+
var variantStyles = _objectSpread(_objectSpread({}, _styleMaps.bodyTextStylesMap), _styleMaps.uiTextStylesMap);
|
|
22
|
+
var textAlignMap = {
|
|
23
|
+
center: (0, _react2.css)({
|
|
24
|
+
textAlign: 'center'
|
|
25
|
+
}),
|
|
26
|
+
end: (0, _react2.css)({
|
|
27
|
+
textAlign: 'end'
|
|
28
|
+
}),
|
|
29
|
+
start: (0, _react2.css)({
|
|
30
|
+
textAlign: 'start'
|
|
31
|
+
})
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
// p tag has padding on top in css-reset. dont know if we want to add it here
|
|
35
|
+
var baseStyles = (0, _react2.css)({
|
|
36
|
+
margin: "var(--ds-space-0, 0px)",
|
|
37
|
+
padding: "var(--ds-space-0, 0px)"
|
|
38
|
+
});
|
|
39
|
+
var truncateStyles = (0, _react2.css)({
|
|
40
|
+
overflow: 'hidden',
|
|
41
|
+
textOverflow: 'ellipsis',
|
|
42
|
+
whiteSpace: 'nowrap'
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
// TODO
|
|
46
|
+
// const asElementStyles: Record<AsElement, SerializedStyles> = {
|
|
47
|
+
// abbr: css({
|
|
48
|
+
// borderBottom: `1px ${token('color.border', '#ccc')} dotted`,
|
|
49
|
+
// cursor: 'help',
|
|
50
|
+
// }),
|
|
51
|
+
// };
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Custom hook designed to abstract the parsing of the color props and make it clearer in the future how color is reconciled between themes and tokens.
|
|
55
|
+
*/
|
|
56
|
+
// const useColor = (colorProp: TextColor): NonNullable<TextColor> => {
|
|
57
|
+
// const surface = useSurface();
|
|
58
|
+
// const inverseTextColor =
|
|
59
|
+
// surfaceColorMap[surface as keyof typeof surfaceColorMap];
|
|
60
|
+
|
|
61
|
+
// /**
|
|
62
|
+
// * Where the color of the surface is inverted we override the user choice
|
|
63
|
+
// * as there is no valid choice that is not covered by the override.
|
|
64
|
+
// */
|
|
65
|
+
// const color = inverseTextColor ?? colorProp;
|
|
66
|
+
|
|
67
|
+
// return color;
|
|
68
|
+
// };
|
|
69
|
+
|
|
70
|
+
var HasTextAncestorContext = /*#__PURE__*/(0, _react.createContext)(false);
|
|
71
|
+
var useHasTextAncestor = function useHasTextAncestor() {
|
|
72
|
+
return (0, _react.useContext)(HasTextAncestorContext);
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* __Text__
|
|
77
|
+
*
|
|
78
|
+
* Text is a primitive component that has the Atlassian Design System's design guidelines baked in.
|
|
79
|
+
* This includes considerations for text attributes such as color, font size, font weight, and line height.
|
|
80
|
+
* It renders a `span` by default.
|
|
81
|
+
*
|
|
82
|
+
* @internal
|
|
83
|
+
*/
|
|
84
|
+
var Text = function Text(_ref) {
|
|
85
|
+
var children = _ref.children,
|
|
86
|
+
props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
87
|
+
var asElement = props.as,
|
|
88
|
+
_props$shouldTruncate = props.shouldTruncate,
|
|
89
|
+
shouldTruncate = _props$shouldTruncate === void 0 ? false : _props$shouldTruncate,
|
|
90
|
+
textAlign = props.textAlign,
|
|
91
|
+
testId = props.testId,
|
|
92
|
+
id = props.id,
|
|
93
|
+
variant = props.variant;
|
|
94
|
+
var Component = asElement;
|
|
95
|
+
if (!Component) {
|
|
96
|
+
if (variant.includes('body')) {
|
|
97
|
+
Component = 'p';
|
|
98
|
+
} else {
|
|
99
|
+
// ui text and default => span
|
|
100
|
+
Component = 'span';
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
(0, _tinyInvariant.default)(asAllowlist.includes(Component), "@atlaskit/ds-explorations: Text received an invalid \"as\" value of \"".concat(Component, "\""));
|
|
104
|
+
// const color = useColor(colorProp!);
|
|
105
|
+
var isWrapped = useHasTextAncestor();
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* If the text is already wrapped and applies no props we can just
|
|
109
|
+
* render the children directly as a fragment.
|
|
110
|
+
*/
|
|
111
|
+
if (isWrapped && Object.keys(props).length === 0) {
|
|
112
|
+
return (0, _react2.jsx)(_react.Fragment, null, children);
|
|
113
|
+
}
|
|
114
|
+
var component = (0, _react2.jsx)(Component
|
|
115
|
+
// style={UNSAFE_style}
|
|
116
|
+
, {
|
|
117
|
+
css: [baseStyles, variant && variantStyles[variant],
|
|
118
|
+
// color && textColorMap[color],
|
|
119
|
+
// colorProp && textColorMap[colorProp],
|
|
120
|
+
shouldTruncate && truncateStyles, textAlign && textAlignMap[textAlign]],
|
|
121
|
+
"data-testid": testId,
|
|
122
|
+
id: id
|
|
123
|
+
}, children);
|
|
124
|
+
return isWrapped ?
|
|
125
|
+
// no need to re-apply context if the text is already wrapped
|
|
126
|
+
component : (0, _react2.jsx)(HasTextAncestorContext.Provider, {
|
|
127
|
+
value: true
|
|
128
|
+
}, component);
|
|
129
|
+
};
|
|
130
|
+
var _default = Text;
|
|
131
|
+
exports.default = _default;
|
|
@@ -4,9 +4,10 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.textColorMap = exports.spaceStylesMap = exports.spaceMap = exports.shadowMap = exports.paddingStylesMap = exports.layerMap = exports.fillMap = exports.dimensionMap = exports.borderWidthMap = exports.borderRadiusMap = exports.borderColorMap = exports.backgroundColorStylesMap = exports.backgroundColorMap = void 0;
|
|
7
|
+
exports.uiTextStylesMap = exports.uiTextMap = exports.textColorStylesMap = exports.textColorMap = exports.surfaceColorStylesMap = exports.surfaceColorMap = exports.spaceStylesMap = exports.spaceMap = exports.shadowMap = exports.paddingStylesMap = exports.lineHeightStylesMap = exports.lineHeightMap = exports.layerMap = exports.isSurfaceColorToken = exports.headingTextStylesMap = exports.headingTextMap = exports.fontWeightStylesMap = exports.fontWeightMap = exports.fontSizeStylesMap = exports.fontSizeMap = exports.fontFamilyStylesMap = exports.fontFamilyMap = exports.fillMap = exports.dimensionMap = exports.borderWidthMap = exports.borderRadiusMap = exports.borderColorMap = exports.bodyTextStylesMap = exports.bodyTextMap = exports.backgroundColorStylesMap = exports.backgroundColorMap = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _react = require("@emotion/react");
|
|
10
|
+
var _tokens = require("@atlaskit/tokens");
|
|
10
11
|
/**
|
|
11
12
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
12
13
|
* @codegen <<SignedSource::7af6097e56f7fb03635b6f8aaf121b02>>
|
|
@@ -60,10 +61,10 @@ exports.spaceMap = spaceMap;
|
|
|
60
61
|
|
|
61
62
|
/**
|
|
62
63
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
63
|
-
* @codegen <<SignedSource::
|
|
64
|
+
* @codegen <<SignedSource::3db44f53b728773bb3ba1473d4567724>>
|
|
64
65
|
* @codegenId colors
|
|
65
66
|
* @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
|
|
66
|
-
* @codegenParams ["border", "background", "shadow", "text", "fill"]
|
|
67
|
+
* @codegenParams ["border", "background", "shadow", "text", "fill", "surface"]
|
|
67
68
|
* @codegenDependency ../../../tokens/src/artifacts/tokens-raw/atlassian-light.tsx <<SignedSource::815ddd719715ae06521cad06e1921e40>>
|
|
68
69
|
*/
|
|
69
70
|
var borderColorMap = {
|
|
@@ -286,7 +287,8 @@ var backgroundColorMap = {
|
|
|
286
287
|
'elevation.surface.raised': "var(--ds-surface-raised, #FFFFFF)",
|
|
287
288
|
'elevation.surface.raised.hovered': "var(--ds-surface-raised-hovered, #FAFBFC)",
|
|
288
289
|
'elevation.surface.raised.pressed': "var(--ds-surface-raised-pressed, #F4F5F7)",
|
|
289
|
-
'elevation.surface.sunken': "var(--ds-surface-sunken, #F4F5F7)"
|
|
290
|
+
'elevation.surface.sunken': "var(--ds-surface-sunken, #F4F5F7)",
|
|
291
|
+
'utility.elevation.surface.current': "var(--ds-elevation-surface-current, #FFFFFF)"
|
|
290
292
|
};
|
|
291
293
|
exports.backgroundColorMap = backgroundColorMap;
|
|
292
294
|
var shadowMap = {
|
|
@@ -360,6 +362,19 @@ var fillMap = {
|
|
|
360
362
|
'color.icon.subtle': "var(--ds-icon-subtle, #6B778C)"
|
|
361
363
|
};
|
|
362
364
|
exports.fillMap = fillMap;
|
|
365
|
+
var surfaceColorMap = {
|
|
366
|
+
'elevation.surface': "var(--ds-surface, #FFFFFF)",
|
|
367
|
+
'elevation.surface.hovered': "var(--ds-surface-hovered, #FAFBFC)",
|
|
368
|
+
'elevation.surface.pressed': "var(--ds-surface-pressed, #F4F5F7)",
|
|
369
|
+
'elevation.surface.overlay': "var(--ds-surface-overlay, #FFFFFF)",
|
|
370
|
+
'elevation.surface.overlay.hovered': "var(--ds-surface-overlay-hovered, #FAFBFC)",
|
|
371
|
+
'elevation.surface.overlay.pressed': "var(--ds-surface-overlay-pressed, #F4F5F7)",
|
|
372
|
+
'elevation.surface.raised': "var(--ds-surface-raised, #FFFFFF)",
|
|
373
|
+
'elevation.surface.raised.hovered': "var(--ds-surface-raised-hovered, #FAFBFC)",
|
|
374
|
+
'elevation.surface.raised.pressed': "var(--ds-surface-raised-pressed, #F4F5F7)",
|
|
375
|
+
'elevation.surface.sunken': "var(--ds-surface-sunken, #F4F5F7)"
|
|
376
|
+
};
|
|
377
|
+
exports.surfaceColorMap = surfaceColorMap;
|
|
363
378
|
/**
|
|
364
379
|
* @codegenEnd
|
|
365
380
|
*/
|
|
@@ -413,11 +428,82 @@ var borderRadiusMap = {
|
|
|
413
428
|
'border.radius.400': "var(--ds-border-radius-400, 16px)",
|
|
414
429
|
'border.radius.circle': "var(--ds-border-radius-circle, 32032px)"
|
|
415
430
|
};
|
|
431
|
+
exports.borderRadiusMap = borderRadiusMap;
|
|
432
|
+
/**
|
|
433
|
+
* @codegenEnd
|
|
434
|
+
*/
|
|
435
|
+
|
|
436
|
+
/**
|
|
437
|
+
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
438
|
+
* @codegen <<SignedSource::752c1b8bdc7db62e519dd729222d57ad>>
|
|
439
|
+
* @codegenId typography
|
|
440
|
+
* @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
|
|
441
|
+
* @codegenParams ["fontSize", "fontWeight", "fontFamily", "lineHeight", "body", "heading", "ui"]
|
|
442
|
+
* @codegenDependency ../../scripts/codegen-file-templates/dimensions.tsx <<SignedSource::0cd422575c3f2a3784eeef767abe71f4>>
|
|
443
|
+
* @codegenDependency ../../scripts/codegen-file-templates/layer.tsx <<SignedSource::79d24a1e558f12d671c06a7609f90dc1>>
|
|
444
|
+
*/
|
|
445
|
+
var fontSizeMap = {
|
|
446
|
+
'font.size.050': "var(--ds-font-size-050, 11px)",
|
|
447
|
+
'font.size.075': "var(--ds-font-size-075, 12px)",
|
|
448
|
+
'font.size.100': "var(--ds-font-size-100, 14px)",
|
|
449
|
+
'font.size.200': "var(--ds-font-size-200, 16px)",
|
|
450
|
+
'font.size.300': "var(--ds-font-size-300, 20px)",
|
|
451
|
+
'font.size.400': "var(--ds-font-size-400, 24px)",
|
|
452
|
+
'font.size.500': "var(--ds-font-size-500, 29px)",
|
|
453
|
+
'font.size.600': "var(--ds-font-size-600, 35px)"
|
|
454
|
+
};
|
|
455
|
+
exports.fontSizeMap = fontSizeMap;
|
|
456
|
+
var fontWeightMap = {
|
|
457
|
+
'font.weight.bold': "var(--ds-font-weight-bold, 700)",
|
|
458
|
+
'font.weight.medium': "var(--ds-font-weight-medium, 500)",
|
|
459
|
+
'font.weight.regular': "var(--ds-font-weight-regular, 400)",
|
|
460
|
+
'font.weight.semibold': "var(--ds-font-weight-semibold, 600)"
|
|
461
|
+
};
|
|
462
|
+
exports.fontWeightMap = fontWeightMap;
|
|
463
|
+
var fontFamilyMap = {
|
|
464
|
+
'font.family.body': "var(--ds-font-family-body, ui-sans-serif, \"Segoe UI\", system-ui, Ubuntu, \"Helvetica Neue\", sans-serif)",
|
|
465
|
+
'font.family.brand': "var(--ds-font-family-brand, Charlie Sans)",
|
|
466
|
+
'font.family.code': "var(--ds-font-family-code, ui-monospace, Menlo, \"Segoe UI Mono\", \"Ubuntu Mono\", monospace)",
|
|
467
|
+
'font.family.heading': "var(--ds-font-family-heading, ui-sans-serif, \"Segoe UI\", system-ui, Ubuntu, \"Helvetica Neue\", sans-serif)",
|
|
468
|
+
'font.family.monospace': "var(--ds-font-family-monospace, ui-monospace, Menlo, \"Segoe UI Mono\", \"Ubuntu Mono\", monospace)",
|
|
469
|
+
'font.family.sans': "var(--ds-font-family-sans, -apple-system, BlinkMacSystemFont, \"Segoe UI\", \"Roboto\", \"Oxygen\", \"Ubuntu\", \"Fira Sans\", \"Droid Sans\", \"Helvetica Neue\", sans-serif)"
|
|
470
|
+
};
|
|
471
|
+
exports.fontFamilyMap = fontFamilyMap;
|
|
472
|
+
var lineHeightMap = {
|
|
473
|
+
'font.lineHeight.1': "var(--ds-font-lineHeight-1, 1)",
|
|
474
|
+
'font.lineHeight.100': "var(--ds-font-lineHeight-100, 16px)",
|
|
475
|
+
'font.lineHeight.200': "var(--ds-font-lineHeight-200, 20px)",
|
|
476
|
+
'font.lineHeight.300': "var(--ds-font-lineHeight-300, 24px)",
|
|
477
|
+
'font.lineHeight.400': "var(--ds-font-lineHeight-400, 28px)",
|
|
478
|
+
'font.lineHeight.500': "var(--ds-font-lineHeight-500, 32px)",
|
|
479
|
+
'font.lineHeight.600': "var(--ds-font-lineHeight-600, 40px)"
|
|
480
|
+
};
|
|
481
|
+
exports.lineHeightMap = lineHeightMap;
|
|
482
|
+
var bodyTextMap = {
|
|
483
|
+
body: "var(--ds-font-body, normal 400 14px/20px var(--ds-font-family-body))",
|
|
484
|
+
'body.lg': "var(--ds-font-body-lg, normal 400 16px/24px var(--ds-font-family-body))",
|
|
485
|
+
'body.sm': "var(--ds-font-body-sm, normal 400 11px/20px var(--ds-font-family-body))"
|
|
486
|
+
};
|
|
487
|
+
exports.bodyTextMap = bodyTextMap;
|
|
488
|
+
var headingTextMap = {
|
|
489
|
+
'heading.lg': "var(--ds-font-heading-lg, normal 500 24px/28px var(--ds-font-family-heading))",
|
|
490
|
+
'heading.md': "var(--ds-font-heading-md, normal 500 20px/24px var(--ds-font-family-heading))",
|
|
491
|
+
'heading.sm': "var(--ds-font-heading-sm, normal 600 16px/20px var(--ds-font-family-heading))",
|
|
492
|
+
'heading.xl': "var(--ds-font-heading-xl, normal 600 29px/32px var(--ds-font-family-heading))",
|
|
493
|
+
'heading.xs': "var(--ds-font-heading-xs, normal 600 14px/16px var(--ds-font-family-heading))",
|
|
494
|
+
'heading.xxl': "var(--ds-font-heading-xxl, normal 500 35px/40px var(--ds-font-family-heading))",
|
|
495
|
+
'heading.xxs': "var(--ds-font-heading-xxs, normal 600 12px/16px var(--ds-font-family-heading))"
|
|
496
|
+
};
|
|
497
|
+
exports.headingTextMap = headingTextMap;
|
|
498
|
+
var uiTextMap = {
|
|
499
|
+
ui: "var(--ds-font-ui, normal 400 14px/1 var(--ds-font-family-body))",
|
|
500
|
+
'ui.sm': "var(--ds-font-ui-sm, normal 400 11px/1 var(--ds-font-family-body))"
|
|
501
|
+
};
|
|
416
502
|
|
|
417
503
|
/**
|
|
418
504
|
* @codegenEnd
|
|
419
505
|
*/
|
|
420
|
-
exports.
|
|
506
|
+
exports.uiTextMap = uiTextMap;
|
|
421
507
|
// Generate maps for Box props. backgroundColor, padding, etc
|
|
422
508
|
var spacingProperties = [
|
|
423
509
|
// Used by Box
|
|
@@ -441,4 +527,26 @@ var spaceStylesMap = spacingProperties.reduce(function (styleMap, spacingPropert
|
|
|
441
527
|
}, {});
|
|
442
528
|
exports.spaceStylesMap = spaceStylesMap;
|
|
443
529
|
var backgroundColorStylesMap = getSerializedStylesMap('backgroundColor', backgroundColorMap);
|
|
444
|
-
exports.backgroundColorStylesMap = backgroundColorStylesMap;
|
|
530
|
+
exports.backgroundColorStylesMap = backgroundColorStylesMap;
|
|
531
|
+
var textColorStylesMap = getSerializedStylesMap('color', textColorMap);
|
|
532
|
+
exports.textColorStylesMap = textColorStylesMap;
|
|
533
|
+
var fontSizeStylesMap = getSerializedStylesMap('fontSize', fontSizeMap);
|
|
534
|
+
exports.fontSizeStylesMap = fontSizeStylesMap;
|
|
535
|
+
var fontWeightStylesMap = getSerializedStylesMap('fontWeight', fontWeightMap);
|
|
536
|
+
exports.fontWeightStylesMap = fontWeightStylesMap;
|
|
537
|
+
var fontFamilyStylesMap = getSerializedStylesMap('fontFamily', fontFamilyMap);
|
|
538
|
+
exports.fontFamilyStylesMap = fontFamilyStylesMap;
|
|
539
|
+
var lineHeightStylesMap = getSerializedStylesMap('lineHeight', lineHeightMap);
|
|
540
|
+
exports.lineHeightStylesMap = lineHeightStylesMap;
|
|
541
|
+
var headingTextStylesMap = getSerializedStylesMap('font', headingTextMap);
|
|
542
|
+
exports.headingTextStylesMap = headingTextStylesMap;
|
|
543
|
+
var bodyTextStylesMap = getSerializedStylesMap('font', bodyTextMap);
|
|
544
|
+
exports.bodyTextStylesMap = bodyTextStylesMap;
|
|
545
|
+
var uiTextStylesMap = getSerializedStylesMap('font', uiTextMap);
|
|
546
|
+
exports.uiTextStylesMap = uiTextStylesMap;
|
|
547
|
+
var surfaceColorStylesMap = getSerializedStylesMap(_tokens.CURRENT_SURFACE_CSS_VAR, surfaceColorMap);
|
|
548
|
+
exports.surfaceColorStylesMap = surfaceColorStylesMap;
|
|
549
|
+
var isSurfaceColorToken = function isSurfaceColorToken(color) {
|
|
550
|
+
return surfaceColorMap[color] !== undefined;
|
|
551
|
+
};
|
|
552
|
+
exports.isSurfaceColorToken = isSurfaceColorToken;
|
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
/** @jsx jsx */
|
|
3
3
|
import { forwardRef } from 'react';
|
|
4
4
|
import { css, jsx } from '@emotion/react';
|
|
5
|
-
import { backgroundColorStylesMap, paddingStylesMap } from '../xcss/style-maps.partial';
|
|
5
|
+
import { backgroundColorStylesMap, isSurfaceColorToken, paddingStylesMap, surfaceColorStylesMap } from '../xcss/style-maps.partial';
|
|
6
6
|
import { parseXcss } from '../xcss/xcss';
|
|
7
7
|
|
|
8
8
|
// Can either Exclude or Extract - here we're excluding all SVG-related elements
|
|
@@ -52,7 +52,7 @@ export const Box = /*#__PURE__*/forwardRef(({
|
|
|
52
52
|
ref: ref
|
|
53
53
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
54
54
|
}, safeHtmlAttributes, {
|
|
55
|
-
css: [baseStyles, backgroundColor && backgroundColorStylesMap[backgroundColor], padding && paddingStylesMap.padding[padding], paddingBlock && paddingStylesMap.paddingBlock[paddingBlock], paddingBlockStart && paddingStylesMap.paddingBlockStart[paddingBlockStart], paddingBlockEnd && paddingStylesMap.paddingBlockEnd[paddingBlockEnd], paddingInline && paddingStylesMap.paddingInline[paddingInline], paddingInlineStart && paddingStylesMap.paddingInlineStart[paddingInlineStart], paddingInlineEnd && paddingStylesMap.paddingInlineEnd[paddingInlineEnd],
|
|
55
|
+
css: [baseStyles, backgroundColor && backgroundColorStylesMap[backgroundColor], isSurfaceColorToken(backgroundColor) && surfaceColorStylesMap[backgroundColor], padding && paddingStylesMap.padding[padding], paddingBlock && paddingStylesMap.paddingBlock[paddingBlock], paddingBlockStart && paddingStylesMap.paddingBlockStart[paddingBlockStart], paddingBlockEnd && paddingStylesMap.paddingBlockEnd[paddingBlockEnd], paddingInline && paddingStylesMap.paddingInline[paddingInline], paddingInlineStart && paddingStylesMap.paddingInlineStart[paddingInlineStart], paddingInlineEnd && paddingStylesMap.paddingInlineEnd[paddingInlineEnd],
|
|
56
56
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
57
57
|
className],
|
|
58
58
|
"data-testid": testId
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React, { createContext, useContext } from 'react';
|
|
2
|
+
|
|
3
|
+
// Allows support for heading levels 1-9 via aria-level
|
|
4
|
+
|
|
5
|
+
const HeadingContext = /*#__PURE__*/createContext(0);
|
|
6
|
+
export const useHeadingElement = () => {
|
|
7
|
+
return useContext(HeadingContext);
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* __Heading context__
|
|
11
|
+
*
|
|
12
|
+
* The HeadingContext
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```tsx
|
|
16
|
+
* // Will correctly infer the heading level
|
|
17
|
+
* <HeadingContext value={1}>
|
|
18
|
+
* <Heading>H1</Heading>
|
|
19
|
+
* <HeadingContext>
|
|
20
|
+
* <Heading>H2</Heading>
|
|
21
|
+
* </HeadingContext>
|
|
22
|
+
* </HeadingContext>
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
const HeadingContextProvider = ({
|
|
26
|
+
children,
|
|
27
|
+
value
|
|
28
|
+
}) => {
|
|
29
|
+
const parentHeadingLevel = useHeadingElement();
|
|
30
|
+
const headingLevel = parentHeadingLevel + 1;
|
|
31
|
+
return /*#__PURE__*/React.createElement(HeadingContext.Provider, {
|
|
32
|
+
value: value || headingLevel
|
|
33
|
+
}, children);
|
|
34
|
+
};
|
|
35
|
+
export default HeadingContextProvider;
|