@ndlib/component-library 0.0.120 → 0.0.122

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.
@@ -20,6 +20,7 @@ import { firstChildAltSelector } from '../../../utils/misc';
20
20
  import sanitizeHtml from 'sanitize-html';
21
21
  import remarkGfm from 'remark-gfm';
22
22
  import { BlockQuote } from '../BlockQuote';
23
+ import { Caption } from '../text/Caption';
23
24
  export const DEFAULT_ALLOWED_TAGS = sanitizeHtml.defaults.allowedTags.concat([
24
25
  'iframe',
25
26
  'img',
@@ -83,6 +84,7 @@ export const Markdown = (_a) => {
83
84
  h4: (props) => (_jsx(Heading, Object.assign({ size: HEADING_SIZE.SM }, props, { level: props.level + headingLevelOffset, standalone: true, sx: Object.assign(Object.assign({}, dynamicTopMarginStyles), customStyles.h4) }))),
84
85
  h5: (props) => (_jsx(Heading, Object.assign({ size: HEADING_SIZE.SM }, props, { standalone: true, level: props.level + headingLevelOffset, sx: Object.assign(Object.assign({}, dynamicTopMarginStyles), customStyles.h5) }))),
85
86
  h6: (props) => (_jsx(Heading, Object.assign({ size: HEADING_SIZE.SM }, props, { standalone: true, level: props.level + headingLevelOffset, sx: Object.assign(Object.assign({}, dynamicTopMarginStyles), customStyles.h6) }))),
87
+ code: (props) => _jsx(Caption, Object.assign({}, props)),
86
88
  ol: (props) => (_jsx(List, Object.assign({}, props, { ordered: true, sx: Object.assign({ mt: 4 }, customStyles.ol) }))),
87
89
  ul: (props) => (_jsx(List, Object.assign({}, props, { sx: Object.assign({ mt: 4 }, customStyles.ul) }))),
88
90
  li: (_a) => {
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ import { TYPOGRAPHY_TYPE } from '../../../../theme/typography';
3
+ import { StyledElementProps } from '../../../../theme';
4
+ export declare enum LABEL_SIZE {
5
+ SM = "sm",
6
+ MD = "md",
7
+ LG = "lg"
8
+ }
9
+ export declare const SIZE_TYPOGRAPHY_MAP: {
10
+ sm: TYPOGRAPHY_TYPE;
11
+ md: TYPOGRAPHY_TYPE;
12
+ lg: TYPOGRAPHY_TYPE;
13
+ };
14
+ type LabelProps = StyledElementProps<HTMLDivElement, {
15
+ size?: LABEL_SIZE;
16
+ typography?: TYPOGRAPHY_TYPE;
17
+ }>;
18
+ export declare const Caption: React.FC<LabelProps>;
19
+ export {};
@@ -0,0 +1,29 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { jsx as _jsx } from "theme-ui/jsx-runtime";
13
+ import { getTypographyStyles, TYPOGRAPHY_TYPE, } from '../../../../theme/typography';
14
+ export var LABEL_SIZE;
15
+ (function (LABEL_SIZE) {
16
+ LABEL_SIZE["SM"] = "sm";
17
+ LABEL_SIZE["MD"] = "md";
18
+ LABEL_SIZE["LG"] = "lg";
19
+ })(LABEL_SIZE || (LABEL_SIZE = {}));
20
+ export const SIZE_TYPOGRAPHY_MAP = {
21
+ [LABEL_SIZE.SM]: TYPOGRAPHY_TYPE.CONTROL_SMALL,
22
+ [LABEL_SIZE.MD]: TYPOGRAPHY_TYPE.CONTROL_MEDIUM,
23
+ [LABEL_SIZE.LG]: TYPOGRAPHY_TYPE.CONTROL_LARGE,
24
+ };
25
+ export const Caption = (_a) => {
26
+ var { sx, size, typography: typographyParam } = _a, rest = __rest(_a, ["sx", "size", "typography"]);
27
+ const typography = typographyParam || SIZE_TYPOGRAPHY_MAP[size || LABEL_SIZE.MD];
28
+ return (_jsx("caption", Object.assign({ sx: Object.assign(Object.assign({ display: 'block', fontStyle: 'italic', fontWeight: '400' }, getTypographyStyles(typography)), sx) }, rest)));
29
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ndlib/component-library",
3
- "version": "0.0.120",
3
+ "version": "0.0.122",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "files": [