@ndla/ui 45.0.13 → 45.0.15
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/es/Article/Article.js +3 -3
- package/es/BlogPost/BlogPost.js +4 -4
- package/es/CampaignBlock/CampaignBlock.js +6 -6
- package/es/Embed/ConceptEmbed.js +13 -15
- package/es/Embed/conceptComponents.js +19 -12
- package/es/Embed/index.js +2 -1
- package/es/Frontpage/FrontpageMultidisciplinarySubject.js +7 -7
- package/es/Frontpage/FrontpageToolbox.js +4 -4
- package/es/FrontpageArticle/FrontpageArticle.js +3 -3
- package/es/Gloss/Gloss.js +63 -61
- package/es/InfoWidget/InfoWidget.js +8 -8
- package/es/LearningPaths/LearningPathInformation.js +4 -4
- package/es/LinkBlock/LinkBlock.js +6 -6
- package/es/MultidisciplinarySubject/MultidisciplinarySubject.js +7 -7
- package/es/Navigation/NavigationBox.js +20 -20
- package/es/Programme/Programme.js +6 -6
- package/es/RelatedArticleList/RelatedArticleV2.js +1 -1
- package/es/ResourceGroup/ResourceGroup.js +4 -4
- package/es/SectionHeading/SectionHeading.js +2 -2
- package/es/Subject/Subject.js +11 -11
- package/es/Subject/SubjectNewContent.js +8 -8
- package/es/Subject/SubjectSocial.js +2 -2
- package/es/ToolboxPage/ToolboxInfo.js +2 -2
- package/es/Topic/Topic.js +18 -18
- package/es/index.js +1 -2
- package/lib/Article/Article.js +4 -4
- package/lib/BlogPost/BlogPost.d.ts +1 -1
- package/lib/BlogPost/BlogPost.js +4 -4
- package/lib/CampaignBlock/CampaignBlock.d.ts +1 -1
- package/lib/CampaignBlock/CampaignBlock.js +6 -6
- package/lib/Embed/ConceptEmbed.d.ts +8 -1
- package/lib/Embed/ConceptEmbed.js +14 -15
- package/lib/Embed/conceptComponents.d.ts +1 -0
- package/lib/Embed/conceptComponents.js +19 -12
- package/lib/Embed/index.d.ts +1 -0
- package/lib/Embed/index.js +10 -1
- package/lib/Frontpage/FrontpageMultidisciplinarySubject.d.ts +1 -1
- package/lib/Frontpage/FrontpageMultidisciplinarySubject.js +7 -7
- package/lib/Frontpage/FrontpageToolbox.d.ts +1 -1
- package/lib/Frontpage/FrontpageToolbox.js +4 -4
- package/lib/FrontpageArticle/FrontpageArticle.js +4 -4
- package/lib/Gloss/Gloss.d.ts +1 -1
- package/lib/Gloss/Gloss.js +63 -61
- package/lib/InfoWidget/InfoWidget.d.ts +1 -1
- package/lib/InfoWidget/InfoWidget.js +8 -8
- package/lib/LearningPaths/LearningPathInformation.js +5 -5
- package/lib/LinkBlock/LinkBlock.js +7 -7
- package/lib/MultidisciplinarySubject/MultidisciplinarySubject.js +8 -8
- package/lib/Navigation/NavigationBox.js +21 -21
- package/lib/Programme/Programme.js +7 -7
- package/lib/RelatedArticleList/RelatedArticleList.d.ts +1 -1
- package/lib/RelatedArticleList/RelatedArticleV2.d.ts +1 -1
- package/lib/RelatedArticleList/RelatedArticleV2.js +1 -1
- package/lib/ResourceGroup/ResourceGroup.d.ts +1 -1
- package/lib/ResourceGroup/ResourceGroup.js +4 -4
- package/lib/SectionHeading/SectionHeading.d.ts +1 -1
- package/lib/SectionHeading/SectionHeading.js +2 -2
- package/lib/Subject/Subject.d.ts +1 -1
- package/lib/Subject/Subject.js +11 -11
- package/lib/Subject/SubjectNewContent.d.ts +1 -1
- package/lib/Subject/SubjectNewContent.js +8 -8
- package/lib/Subject/SubjectSocial.d.ts +1 -1
- package/lib/Subject/SubjectSocial.js +2 -2
- package/lib/ToolboxPage/ToolboxInfo.js +3 -3
- package/lib/Topic/Topic.js +19 -19
- package/lib/index.d.ts +1 -3
- package/lib/index.js +6 -7
- package/lib/types.d.ts +0 -1
- package/package.json +17 -16
- package/src/Article/Article.tsx +1 -1
- package/src/BlogPost/BlogPost.tsx +1 -1
- package/src/CampaignBlock/CampaignBlock.tsx +1 -1
- package/src/Embed/ConceptEmbed.stories.tsx +96 -1
- package/src/Embed/ConceptEmbed.tsx +8 -12
- package/src/Embed/conceptComponents.tsx +13 -2
- package/src/Embed/index.ts +1 -0
- package/src/Frontpage/FrontpageMultidisciplinarySubject.tsx +1 -1
- package/src/Frontpage/FrontpageToolbox.tsx +1 -1
- package/src/FrontpageArticle/FrontpageArticle.tsx +1 -1
- package/src/Gloss/Gloss.tsx +63 -56
- package/src/InfoWidget/InfoWidget.tsx +1 -1
- package/src/LearningPaths/LearningPathInformation.tsx +1 -1
- package/src/LinkBlock/LinkBlock.tsx +1 -1
- package/src/MultidisciplinarySubject/MultidisciplinarySubject.tsx +1 -1
- package/src/Navigation/NavigationBox.tsx +1 -1
- package/src/Programme/Programme.tsx +1 -1
- package/src/RelatedArticleList/RelatedArticleList.tsx +1 -1
- package/src/RelatedArticleList/RelatedArticleV2.tsx +1 -1
- package/src/ResourceGroup/ResourceGroup.tsx +1 -1
- package/src/SectionHeading/SectionHeading.tsx +1 -1
- package/src/Subject/Subject.tsx +1 -1
- package/src/Subject/SubjectNewContent.tsx +1 -1
- package/src/Subject/SubjectSocial.tsx +1 -1
- package/src/ToolboxPage/ToolboxInfo.tsx +1 -1
- package/src/Topic/Topic.tsx +1 -1
- package/src/index.ts +1 -2
- package/src/types.ts +0 -2
- package/es/Typography/Heading.js +0 -48
- package/es/Typography/index.js +0 -9
- package/lib/Typography/Heading.d.ts +0 -25
- package/lib/Typography/Heading.js +0 -54
- package/lib/Typography/index.d.ts +0 -8
- package/lib/Typography/index.js +0 -13
- package/src/Typography/Heading.tsx +0 -96
- package/src/Typography/index.ts +0 -9
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import styled from '@emotion/styled';
|
|
2
2
|
import { breakpoints, mq, spacing } from '@ndla/core';
|
|
3
3
|
import { useTranslation } from 'react-i18next';
|
|
4
|
+
import { Heading } from '@ndla/typography';
|
|
4
5
|
import LayoutItem, { OneColumn } from '../Layout';
|
|
5
6
|
import ProgrammeSubjects, { GradesProps } from './ProgrammeSubjects';
|
|
6
7
|
import MessageBox from '../Messages/MessageBox';
|
|
7
|
-
import { Heading } from '..';
|
|
8
8
|
const StyledWrapper = styled.div`
|
|
9
9
|
display: flex;
|
|
10
10
|
flex-direction: column;
|
|
@@ -2,8 +2,8 @@ import { Children, cloneElement, ReactElement } from 'react';
|
|
|
2
2
|
import BEMHelper from 'react-bem-helper';
|
|
3
3
|
import { ButtonV2 } from '@ndla/button';
|
|
4
4
|
import SafeLink from '@ndla/safelink';
|
|
5
|
+
import { HeadingLevel } from '@ndla/typography';
|
|
5
6
|
import SectionHeading from '../SectionHeading';
|
|
6
|
-
import { HeadingLevel } from '../types';
|
|
7
7
|
|
|
8
8
|
const classes = new BEMHelper({
|
|
9
9
|
name: 'related-articles',
|
|
@@ -12,8 +12,8 @@ import { useTranslation } from 'react-i18next';
|
|
|
12
12
|
import styled from '@emotion/styled';
|
|
13
13
|
import { ButtonV2 } from '@ndla/button';
|
|
14
14
|
import SafeLink from '@ndla/safelink';
|
|
15
|
+
import { HeadingLevel } from '@ndla/typography';
|
|
15
16
|
import SectionHeading from '../SectionHeading';
|
|
16
|
-
import { HeadingLevel } from '../types';
|
|
17
17
|
import ContentTypeBadge from '../ContentTypeBadge';
|
|
18
18
|
import { contentTypes } from '../model/ContentType';
|
|
19
19
|
|
|
@@ -11,8 +11,8 @@ import styled from '@emotion/styled';
|
|
|
11
11
|
import { css } from '@emotion/react';
|
|
12
12
|
import { colors, fonts, spacing } from '@ndla/core';
|
|
13
13
|
|
|
14
|
+
import { HeadingLevel } from '@ndla/typography';
|
|
14
15
|
import ResourceList, { ResourceListProps } from './ResourceList';
|
|
15
|
-
import { HeadingLevel } from '../types';
|
|
16
16
|
|
|
17
17
|
const Wrapper = styled.section`
|
|
18
18
|
margin-bottom: ${spacing.large};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ElementType, ReactNode } from 'react';
|
|
2
2
|
import { css } from '@emotion/react';
|
|
3
3
|
import { breakpoints, fonts, mq, spacing } from '@ndla/core';
|
|
4
|
-
import { HeadingLevel } from '
|
|
4
|
+
import { HeadingLevel } from '@ndla/typography';
|
|
5
5
|
|
|
6
6
|
const headingStyle = css`
|
|
7
7
|
font-weight: ${fonts.weight.bold};
|
package/src/Subject/Subject.tsx
CHANGED
|
@@ -2,8 +2,8 @@ import { ReactNode } from 'react';
|
|
|
2
2
|
import styled from '@emotion/styled';
|
|
3
3
|
import { css } from '@emotion/react';
|
|
4
4
|
import { breakpoints, colors, mq, spacing, spacingUnit } from '@ndla/core';
|
|
5
|
+
import { HeadingLevel } from '@ndla/typography';
|
|
5
6
|
import SectionHeading from '../SectionHeading';
|
|
6
|
-
import { HeadingLevel } from '../types';
|
|
7
7
|
|
|
8
8
|
const SubjectContentWrapper = styled.div`
|
|
9
9
|
${mq.range({ from: breakpoints.tablet })} {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import styled from '@emotion/styled';
|
|
2
2
|
import SafeLink from '@ndla/safelink';
|
|
3
3
|
import { breakpoints, colors, fonts, mq, spacing } from '@ndla/core';
|
|
4
|
+
import { HeadingLevel } from '@ndla/typography';
|
|
4
5
|
import ContentTypeBadge from '../ContentTypeBadge';
|
|
5
6
|
import { SubjectSectionTitle } from './Subject';
|
|
6
|
-
import { HeadingLevel } from '../types';
|
|
7
7
|
|
|
8
8
|
interface Props {
|
|
9
9
|
headingLevel: HeadingLevel;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import styled from '@emotion/styled';
|
|
2
2
|
import { breakpoints, mq, spacing } from '@ndla/core';
|
|
3
3
|
import { ReactNode } from 'react';
|
|
4
|
-
import { HeadingLevel } from '
|
|
4
|
+
import { HeadingLevel } from '@ndla/typography';
|
|
5
5
|
import { SubjectSectionTitle } from './Subject';
|
|
6
6
|
|
|
7
7
|
const StyledSubjectSocialContent = styled.div`
|
|
@@ -10,9 +10,9 @@ import { MouseEvent } from 'react';
|
|
|
10
10
|
import styled from '@emotion/styled';
|
|
11
11
|
import { breakpoints, fonts, mq } from '@ndla/core';
|
|
12
12
|
import { useTranslation } from 'react-i18next';
|
|
13
|
+
import { Heading } from '@ndla/typography';
|
|
13
14
|
import { ItemProps } from '../Navigation/NavigationBox';
|
|
14
15
|
import { NavigationBox } from '../Navigation';
|
|
15
|
-
import { Heading } from '../Typography';
|
|
16
16
|
|
|
17
17
|
const Introduction = styled.p`
|
|
18
18
|
max-width: 800px;
|
package/src/Topic/Topic.tsx
CHANGED
|
@@ -18,12 +18,12 @@ import { CursorClick, ExpandTwoArrows } from '@ndla/icons/action';
|
|
|
18
18
|
import { css } from '@emotion/react';
|
|
19
19
|
import { useTranslation } from 'react-i18next';
|
|
20
20
|
import { EmbedMetaData } from '@ndla/types-embed';
|
|
21
|
+
import { Heading } from '@ndla/typography';
|
|
21
22
|
import Loader from './Loader';
|
|
22
23
|
import { ItemProps } from '../Navigation/NavigationBox';
|
|
23
24
|
import { NavigationBox } from '../Navigation';
|
|
24
25
|
import { makeSrcQueryString, ImageCrop, ImageFocalPoint } from '../Image';
|
|
25
26
|
import { MessageBox } from '../Messages';
|
|
26
|
-
import { Heading } from '../Typography';
|
|
27
27
|
import { getCrop, getFocalPoint } from '../Embed/ImageEmbed';
|
|
28
28
|
|
|
29
29
|
type InvertItProps = {
|
package/src/index.ts
CHANGED
|
@@ -24,6 +24,7 @@ export {
|
|
|
24
24
|
ConceptEmbed,
|
|
25
25
|
ConceptListEmbed,
|
|
26
26
|
UnknownEmbed,
|
|
27
|
+
InlineConcept,
|
|
27
28
|
} from './Embed';
|
|
28
29
|
|
|
29
30
|
export {
|
|
@@ -267,8 +268,6 @@ export type { HeartButtonType } from './Embed';
|
|
|
267
268
|
export { CampaignBlock } from './CampaignBlock';
|
|
268
269
|
export { Grid, GridParallaxItem } from './Grid';
|
|
269
270
|
export type { GridType } from './Grid';
|
|
270
|
-
export { Heading } from './Typography';
|
|
271
|
-
export type { HeadingLevel } from './types';
|
|
272
271
|
|
|
273
272
|
export {
|
|
274
273
|
default as FrontpageArticle,
|
package/src/types.ts
CHANGED
package/es/Typography/Heading.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
-
var _excluded = ["element", "children", "headingStyle", "margin", "serif"];
|
|
3
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
5
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
7
|
-
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
8
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
9
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
10
|
-
/**
|
|
11
|
-
* Copyright (c) 2023-present, NDLA.
|
|
12
|
-
*
|
|
13
|
-
* This source code is licensed under the GPLv3 license found in the
|
|
14
|
-
* LICENSE file in the root directory of this source tree.
|
|
15
|
-
*
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
import { css } from '@emotion/react';
|
|
19
|
-
import { breakpoints, fonts, mq, spacing } from '@ndla/core';
|
|
20
|
-
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
21
|
-
var style = /*#__PURE__*/css("font-weight:", fonts.weight.bold, ";font-family:", fonts.sans, ";", fonts.sizes('22px', '30px'), ";margin:", spacing.normal, " 0 ", spacing.normal, " 0;&[data-margin='none']{margin:0px;}&[data-margin='xlarge']{margin:", spacing.normal, " 0 ", spacing.small, " 0;", mq.range({
|
|
22
|
-
from: breakpoints.tablet
|
|
23
|
-
}), "{margin-bottom:", spacing.normal, ";}}&[data-margin='large']{margin-top:", spacing.large, ";margin-bottom:", spacing.small, ";}&[data-margin='small']{margin-top:", spacing.normal, ";margin-bottom:", spacing.small, ";}&[data-style='h1']{", fonts.sizes('30px', '36px'), ";", mq.range({
|
|
24
|
-
from: breakpoints.tablet
|
|
25
|
-
}), "{", fonts.sizes('48px', '60px'), ";margin-bottom:", spacing.normal, ";}}&[data-style='h2']{", fonts.sizes('28px', '36px'), ";", mq.range({
|
|
26
|
-
from: breakpoints.tablet
|
|
27
|
-
}), "{", fonts.sizes('30px', '38px'), ";}}&[data-style='h3']{", fonts.sizes('26px', '35px'), ";", mq.range({
|
|
28
|
-
from: breakpoints.tablet
|
|
29
|
-
}), "{", fonts.sizes('26px', '36px'), ";}}&[data-style='list-title']{", fonts.sizes('18px', '24px'), ";text-transform:uppercase;};label:style;" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkhlYWRpbmcudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQWFpQiIsImZpbGUiOiJIZWFkaW5nLnRzeCIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogQ29weXJpZ2h0IChjKSAyMDIzLXByZXNlbnQsIE5ETEEuXG4gKlxuICogVGhpcyBzb3VyY2UgY29kZSBpcyBsaWNlbnNlZCB1bmRlciB0aGUgR1BMdjMgbGljZW5zZSBmb3VuZCBpbiB0aGVcbiAqIExJQ0VOU0UgZmlsZSBpbiB0aGUgcm9vdCBkaXJlY3Rvcnkgb2YgdGhpcyBzb3VyY2UgdHJlZS5cbiAqXG4gKi9cblxuaW1wb3J0IHsgY3NzIH0gZnJvbSAnQGVtb3Rpb24vcmVhY3QnO1xuaW1wb3J0IHsgYnJlYWtwb2ludHMsIGZvbnRzLCBtcSwgc3BhY2luZyB9IGZyb20gJ0BuZGxhL2NvcmUnO1xuaW1wb3J0IHsgQ29tcG9uZW50UHJvcHMsIEVsZW1lbnRUeXBlLCBSZWFjdE5vZGUgfSBmcm9tICdyZWFjdCc7XG5pbXBvcnQgeyBIZWFkaW5nTGV2ZWwgfSBmcm9tICcuLi90eXBlcyc7XG5cbmNvbnN0IHN0eWxlID0gY3NzYFxuICBmb250LXdlaWdodDogJHtmb250cy53ZWlnaHQuYm9sZH07XG4gIGZvbnQtZmFtaWx5OiAke2ZvbnRzLnNhbnN9O1xuICAke2ZvbnRzLnNpemVzKCcyMnB4JywgJzMwcHgnKX07XG4gIG1hcmdpbjogJHtzcGFjaW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mLFxuICAuLi5yZXN0XG59OiBQcm9wczxUPiAmIENvbXBvbmVudFByb3BzPFQ+KSA9PiB7XG4gIGNvbnN0IEVsZW1lbnQgPSBlbGVtZW50IGFzIEVsZW1lbnRUeXBlO1xuICByZXR1cm4gKFxuICAgIDxFbGVtZW50IGNzcz17c3R5bGV9IGRhdGEtc2VyaWY9e3NlcmlmfSBkYXRhLXN0eWxlPXtoZWFkaW5nU3R5bGV9IGRhdGEtbWFyZ2luPXttYXJnaW59IHsuLi5yZXN0fT5cbiAgICAgIHtjaGlsZHJlbn1cbiAgICA8L0VsZW1lbnQ+XG4gICk7XG59O1xuXG5leHBvcnQgZGVmYXVsdCBIZWFkaW5nO1xuIl19 */"));
|
|
30
|
-
var Heading = function Heading(_ref) {
|
|
31
|
-
var element = _ref.element,
|
|
32
|
-
children = _ref.children,
|
|
33
|
-
headingStyle = _ref.headingStyle,
|
|
34
|
-
_ref$margin = _ref.margin,
|
|
35
|
-
margin = _ref$margin === void 0 ? 'normal' : _ref$margin,
|
|
36
|
-
serif = _ref.serif,
|
|
37
|
-
rest = _objectWithoutProperties(_ref, _excluded);
|
|
38
|
-
var Element = element;
|
|
39
|
-
return _jsx(Element, _objectSpread(_objectSpread({
|
|
40
|
-
css: style,
|
|
41
|
-
"data-serif": serif,
|
|
42
|
-
"data-style": headingStyle,
|
|
43
|
-
"data-margin": margin
|
|
44
|
-
}, rest), {}, {
|
|
45
|
-
children: children
|
|
46
|
-
}));
|
|
47
|
-
};
|
|
48
|
-
export default Heading;
|
package/es/Typography/index.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2023-present, NDLA.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the GPLv3 license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
import { ComponentProps, ReactNode } from 'react';
|
|
9
|
-
import { HeadingLevel } from '../types';
|
|
10
|
-
type AllowedElements = HeadingLevel | 'p' | 'span';
|
|
11
|
-
interface Props<T extends AllowedElements> {
|
|
12
|
-
element: T;
|
|
13
|
-
headingStyle: 'h1' | 'h2' | 'h3' | 'list-title' | 'default';
|
|
14
|
-
serif?: boolean;
|
|
15
|
-
/**
|
|
16
|
-
* General usage
|
|
17
|
-
* xlarge -> h1
|
|
18
|
-
* large -> h2
|
|
19
|
-
* normal -> anything else
|
|
20
|
-
*/
|
|
21
|
-
margin?: 'xlarge' | 'large' | 'normal' | 'small' | 'none';
|
|
22
|
-
children: ReactNode;
|
|
23
|
-
}
|
|
24
|
-
declare const Heading: <T extends AllowedElements>({ element, children, headingStyle, margin, serif, ...rest }: Props<T> & ComponentProps<T>) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
25
|
-
export default Heading;
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _react = require("@emotion/react");
|
|
9
|
-
var _core = require("@ndla/core");
|
|
10
|
-
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
11
|
-
var _excluded = ["element", "children", "headingStyle", "margin", "serif"];
|
|
12
|
-
/**
|
|
13
|
-
* Copyright (c) 2023-present, NDLA.
|
|
14
|
-
*
|
|
15
|
-
* This source code is licensed under the GPLv3 license found in the
|
|
16
|
-
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*
|
|
18
|
-
*/
|
|
19
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
20
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
21
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
22
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
23
|
-
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
24
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
25
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
26
|
-
var style = /*#__PURE__*/(0, _react.css)("font-weight:", _core.fonts.weight.bold, ";font-family:", _core.fonts.sans, ";", _core.fonts.sizes('22px', '30px'), ";margin:", _core.spacing.normal, " 0 ", _core.spacing.normal, " 0;&[data-margin='none']{margin:0px;}&[data-margin='xlarge']{margin:", _core.spacing.normal, " 0 ", _core.spacing.small, " 0;", _core.mq.range({
|
|
27
|
-
from: _core.breakpoints.tablet
|
|
28
|
-
}), "{margin-bottom:", _core.spacing.normal, ";}}&[data-margin='large']{margin-top:", _core.spacing.large, ";margin-bottom:", _core.spacing.small, ";}&[data-margin='small']{margin-top:", _core.spacing.normal, ";margin-bottom:", _core.spacing.small, ";}&[data-style='h1']{", _core.fonts.sizes('30px', '36px'), ";", _core.mq.range({
|
|
29
|
-
from: _core.breakpoints.tablet
|
|
30
|
-
}), "{", _core.fonts.sizes('48px', '60px'), ";margin-bottom:", _core.spacing.normal, ";}}&[data-style='h2']{", _core.fonts.sizes('28px', '36px'), ";", _core.mq.range({
|
|
31
|
-
from: _core.breakpoints.tablet
|
|
32
|
-
}), "{", _core.fonts.sizes('30px', '38px'), ";}}&[data-style='h3']{", _core.fonts.sizes('26px', '35px'), ";", _core.mq.range({
|
|
33
|
-
from: _core.breakpoints.tablet
|
|
34
|
-
}), "{", _core.fonts.sizes('26px', '36px'), ";}}&[data-style='list-title']{", _core.fonts.sizes('18px', '24px'), ";text-transform:uppercase;};label:style;" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkhlYWRpbmcudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQWFpQiIsImZpbGUiOiJIZWFkaW5nLnRzeCIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogQ29weXJpZ2h0IChjKSAyMDIzLXByZXNlbnQsIE5ETEEuXG4gKlxuICogVGhpcyBzb3VyY2UgY29kZSBpcyBsaWNlb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children = _ref.children,
|
|
38
|
-
headingStyle = _ref.headingStyle,
|
|
39
|
-
_ref$margin = _ref.margin,
|
|
40
|
-
margin = _ref$margin === void 0 ? 'normal' : _ref$margin,
|
|
41
|
-
serif = _ref.serif,
|
|
42
|
-
rest = _objectWithoutProperties(_ref, _excluded);
|
|
43
|
-
var Element = element;
|
|
44
|
-
return (0, _jsxRuntime.jsx)(Element, _objectSpread(_objectSpread({
|
|
45
|
-
css: style,
|
|
46
|
-
"data-serif": serif,
|
|
47
|
-
"data-style": headingStyle,
|
|
48
|
-
"data-margin": margin
|
|
49
|
-
}, rest), {}, {
|
|
50
|
-
children: children
|
|
51
|
-
}));
|
|
52
|
-
};
|
|
53
|
-
var _default = Heading;
|
|
54
|
-
exports.default = _default;
|
package/lib/Typography/index.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "Heading", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function get() {
|
|
9
|
-
return _Heading.default;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
var _Heading = _interopRequireDefault(require("./Heading"));
|
|
13
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2023-present, NDLA.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the GPLv3 license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import { css } from '@emotion/react';
|
|
10
|
-
import { breakpoints, fonts, mq, spacing } from '@ndla/core';
|
|
11
|
-
import { ComponentProps, ElementType, ReactNode } from 'react';
|
|
12
|
-
import { HeadingLevel } from '../types';
|
|
13
|
-
|
|
14
|
-
const style = css`
|
|
15
|
-
font-weight: ${fonts.weight.bold};
|
|
16
|
-
font-family: ${fonts.sans};
|
|
17
|
-
${fonts.sizes('22px', '30px')};
|
|
18
|
-
margin: ${spacing.normal} 0 ${spacing.normal} 0;
|
|
19
|
-
|
|
20
|
-
&[data-margin='none'] {
|
|
21
|
-
margin: 0px;
|
|
22
|
-
}
|
|
23
|
-
&[data-margin='xlarge'] {
|
|
24
|
-
margin: ${spacing.normal} 0 ${spacing.small} 0;
|
|
25
|
-
${mq.range({ from: breakpoints.tablet })} {
|
|
26
|
-
margin-bottom: ${spacing.normal};
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
&[data-margin='large'] {
|
|
30
|
-
margin-top: ${spacing.large};
|
|
31
|
-
margin-bottom: ${spacing.small};
|
|
32
|
-
}
|
|
33
|
-
&[data-margin='small'] {
|
|
34
|
-
margin-top: ${spacing.normal};
|
|
35
|
-
margin-bottom: ${spacing.small};
|
|
36
|
-
}
|
|
37
|
-
&[data-style='h1'] {
|
|
38
|
-
${fonts.sizes('30px', '36px')};
|
|
39
|
-
${mq.range({ from: breakpoints.tablet })} {
|
|
40
|
-
${fonts.sizes('48px', '60px')};
|
|
41
|
-
margin-bottom: ${spacing.normal};
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
&[data-style='h2'] {
|
|
46
|
-
${fonts.sizes('28px', '36px')};
|
|
47
|
-
${mq.range({ from: breakpoints.tablet })} {
|
|
48
|
-
${fonts.sizes('30px', '38px')};
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
&[data-style='h3'] {
|
|
53
|
-
${fonts.sizes('26px', '35px')};
|
|
54
|
-
${mq.range({ from: breakpoints.tablet })} {
|
|
55
|
-
${fonts.sizes('26px', '36px')};
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
&[data-style='list-title'] {
|
|
59
|
-
${fonts.sizes('18px', '24px')};
|
|
60
|
-
text-transform: uppercase;
|
|
61
|
-
}
|
|
62
|
-
`;
|
|
63
|
-
|
|
64
|
-
type AllowedElements = HeadingLevel | 'p' | 'span';
|
|
65
|
-
|
|
66
|
-
interface Props<T extends AllowedElements> {
|
|
67
|
-
element: T;
|
|
68
|
-
headingStyle: 'h1' | 'h2' | 'h3' | 'list-title' | 'default';
|
|
69
|
-
serif?: boolean;
|
|
70
|
-
/**
|
|
71
|
-
* General usage
|
|
72
|
-
* xlarge -> h1
|
|
73
|
-
* large -> h2
|
|
74
|
-
* normal -> anything else
|
|
75
|
-
*/
|
|
76
|
-
margin?: 'xlarge' | 'large' | 'normal' | 'small' | 'none';
|
|
77
|
-
children: ReactNode;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
const Heading = <T extends AllowedElements>({
|
|
81
|
-
element,
|
|
82
|
-
children,
|
|
83
|
-
headingStyle,
|
|
84
|
-
margin = 'normal',
|
|
85
|
-
serif,
|
|
86
|
-
...rest
|
|
87
|
-
}: Props<T> & ComponentProps<T>) => {
|
|
88
|
-
const Element = element as ElementType;
|
|
89
|
-
return (
|
|
90
|
-
<Element css={style} data-serif={serif} data-style={headingStyle} data-margin={margin} {...rest}>
|
|
91
|
-
{children}
|
|
92
|
-
</Element>
|
|
93
|
-
);
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
export default Heading;
|
package/src/Typography/index.ts
DELETED