@ndlib/component-library 1.0.41 → 1.0.42
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/dist/components/elements/AlertsV2/AlertV2.stories.d.ts +10 -0
- package/dist/components/elements/AlertsV2/AlertV2.stories.js +51 -0
- package/dist/components/elements/AlertsV2/AlertsV2.module.css +49 -0
- package/dist/components/elements/AlertsV2/AlertsV2.stories.d.ts +7 -0
- package/dist/components/elements/AlertsV2/AlertsV2.stories.js +17 -0
- package/dist/components/elements/AlertsV2/index.d.ts +15 -0
- package/dist/components/elements/AlertsV2/index.js +50 -0
- package/dist/components/elements/BlockQuoteV2/BlockQuoteV2.module.css +6 -0
- package/dist/components/elements/BlockQuoteV2/index.d.ts +4 -0
- package/dist/components/elements/BlockQuoteV2/index.js +21 -0
- package/dist/components/elements/BrandingBarV2/BrandingBarV2.module.css +68 -0
- package/dist/components/elements/BrandingBarV2/BrandingBarV2.stories.d.ts +6 -0
- package/dist/components/elements/BrandingBarV2/BrandingBarV2.stories.js +13 -0
- package/dist/components/elements/BrandingBarV2/index.d.ts +2 -0
- package/dist/components/elements/BrandingBarV2/index.js +10 -0
- package/dist/components/elements/CaptionV2/index.d.ts +2 -0
- package/dist/components/elements/CaptionV2/index.js +22 -0
- package/dist/components/elements/DatePickerV2/DatePickerV2.stories.d.ts +8 -0
- package/dist/components/elements/DatePickerV2/DatePickerV2.stories.js +53 -0
- package/dist/components/elements/DatePickerV2/index.d.ts +23 -0
- package/dist/components/elements/DatePickerV2/index.js +57 -0
- package/dist/components/elements/DropdownV2/DropdownV2.stories.d.ts +8 -0
- package/dist/components/elements/DropdownV2/DropdownV2.stories.js +26 -0
- package/dist/components/elements/DropdownV2/index.d.ts +26 -0
- package/dist/components/elements/DropdownV2/index.js +81 -0
- package/dist/components/elements/InlineV2/InlineV2.stories.d.ts +6 -0
- package/dist/components/elements/InlineV2/InlineV2.stories.js +14 -0
- package/dist/components/elements/InlineV2/index.d.ts +6 -0
- package/dist/components/elements/InlineV2/index.js +23 -0
- package/dist/components/elements/ListV2/ListV2.stories.d.ts +10 -0
- package/dist/components/elements/ListV2/ListV2.stories.js +39 -0
- package/dist/components/elements/ListV2/index.d.ts +27 -0
- package/dist/components/elements/ListV2/index.js +102 -0
- package/dist/components/elements/MarkdownV2/MarkdownV2.module.css +39 -0
- package/dist/components/elements/MarkdownV2/MarkdownV2.stories.d.ts +10 -0
- package/dist/components/elements/MarkdownV2/MarkdownV2.stories.js +130 -0
- package/dist/components/elements/MarkdownV2/index.d.ts +11 -0
- package/dist/components/elements/MarkdownV2/index.js +123 -0
- package/dist/components/elements/MonthPickerV2/MonthPickerV2.stories.d.ts +7 -0
- package/dist/components/elements/MonthPickerV2/MonthPickerV2.stories.js +33 -0
- package/dist/components/elements/MonthPickerV2/index.d.ts +14 -0
- package/dist/components/elements/MonthPickerV2/index.js +26 -0
- package/dist/components/elements/PillV2/PillV2.module.css +29 -0
- package/dist/components/elements/PillV2/PillV2.stories.d.ts +8 -0
- package/dist/components/elements/PillV2/PillV2.stories.js +42 -0
- package/dist/components/elements/PillV2/index.d.ts +21 -0
- package/dist/components/elements/PillV2/index.js +79 -0
- package/dist/components/elements/RadioGroupV2/RadioGroupV2.stories.d.ts +7 -0
- package/dist/components/elements/RadioGroupV2/RadioGroupV2.stories.js +28 -0
- package/dist/components/elements/RadioGroupV2/index.d.ts +16 -0
- package/dist/components/elements/RadioGroupV2/index.js +27 -0
- package/dist/components/elements/RadioV2/RadioV2.module.css +17 -0
- package/dist/components/elements/RadioV2/RadioV2.stories.d.ts +6 -0
- package/dist/components/elements/RadioV2/RadioV2.stories.js +19 -0
- package/dist/components/elements/RadioV2/index.d.ts +8 -0
- package/dist/components/elements/RadioV2/index.js +23 -0
- package/dist/components/elements/TabListV2/TabListV2.module.css +21 -0
- package/dist/components/elements/TabListV2/TabListV2.stories.d.ts +6 -0
- package/dist/components/elements/TabListV2/TabListV2.stories.js +14 -0
- package/dist/components/elements/TabListV2/example.d.ts +7 -0
- package/dist/components/elements/TabListV2/example.js +36 -0
- package/dist/components/elements/TabListV2/index.d.ts +10 -0
- package/dist/components/elements/TabListV2/index.js +31 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +11 -0
- package/package.json +1 -1
|
@@ -0,0 +1,81 @@
|
|
|
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, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { useCallback, useMemo, useState } from 'react';
|
|
14
|
+
import { BOX_SHADOW } from '../../../theme';
|
|
15
|
+
import { autoPlacement, offset, size, useFloating } from '@floating-ui/react';
|
|
16
|
+
import { BoxV2 } from '../BoxV2';
|
|
17
|
+
import { useUniqueId } from '../../providers/uniqueIds';
|
|
18
|
+
import { Z_INDEX } from '../../../theme/custom';
|
|
19
|
+
import { COLOR, colors } from '../../../theme/colors';
|
|
20
|
+
export const OverlayV2 = (props) => (_jsx(BoxV2, Object.assign({}, props, { sx: {
|
|
21
|
+
position: 'fixed',
|
|
22
|
+
top: 0,
|
|
23
|
+
left: 0,
|
|
24
|
+
width: '100vw',
|
|
25
|
+
height: '100vh',
|
|
26
|
+
zIndex: Z_INDEX.ELEVATED,
|
|
27
|
+
} })));
|
|
28
|
+
export const DropdownV2 = (_a) => {
|
|
29
|
+
var { renderAnchor, renderDropdown, matchWidth, shouldRenderDropdownContainer = true, allowedPlacements = ['top-start', 'bottom-start', 'top-end', 'bottom-end'], sx } = _a, rest = __rest(_a, ["renderAnchor", "renderDropdown", "matchWidth", "shouldRenderDropdownContainer", "allowedPlacements", "sx"]);
|
|
30
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
31
|
+
const [dropdownMinWidth, setDropdownMinWidth] = useState('0px');
|
|
32
|
+
const [dropdownMaxWidth, setDropdownMaxWidth] = useState();
|
|
33
|
+
const dropdownId = useUniqueId('dropdown');
|
|
34
|
+
const anchorId = useUniqueId('dropdown-anchor');
|
|
35
|
+
const { refs, floatingStyles } = useFloating({
|
|
36
|
+
placement: 'bottom-start',
|
|
37
|
+
middleware: [
|
|
38
|
+
offset(2),
|
|
39
|
+
size({
|
|
40
|
+
apply({ rects }) {
|
|
41
|
+
setDropdownMinWidth(`${rects.reference.width}px`);
|
|
42
|
+
if (matchWidth) {
|
|
43
|
+
setDropdownMaxWidth(`${rects.reference.width}px`);
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
}),
|
|
47
|
+
autoPlacement({
|
|
48
|
+
allowedPlacements,
|
|
49
|
+
}),
|
|
50
|
+
],
|
|
51
|
+
});
|
|
52
|
+
const dropdownBoxStyles = Object.assign(Object.assign({}, floatingStyles), { minWidth: dropdownMinWidth, maxWidth: dropdownMaxWidth, zIndex: Z_INDEX.DIALOG, backgroundColor: colors[COLOR.WHITE], boxShadow: BOX_SHADOW.NORMAL });
|
|
53
|
+
const onClick = useCallback(() => {
|
|
54
|
+
setIsOpen(!isOpen);
|
|
55
|
+
}, [isOpen]);
|
|
56
|
+
const dropdownAnchorProps = useMemo(() => ({
|
|
57
|
+
id: anchorId,
|
|
58
|
+
'aria-haspopup': true,
|
|
59
|
+
'aria-expanded': isOpen,
|
|
60
|
+
'aria-owns': dropdownId,
|
|
61
|
+
ref: refs.setReference,
|
|
62
|
+
onClick,
|
|
63
|
+
}), [refs, onClick, anchorId, isOpen, dropdownId]);
|
|
64
|
+
return (_jsxs(BoxV2, Object.assign({ sx: sx }, rest, { children: [renderAnchor({
|
|
65
|
+
anchorProps: dropdownAnchorProps,
|
|
66
|
+
isOpen,
|
|
67
|
+
setIsOpen,
|
|
68
|
+
}), isOpen && (_jsxs(_Fragment, { children: [shouldRenderDropdownContainer ? (_jsx("div", Object.assign({ id: dropdownId, ref: refs.setFloating, style: dropdownBoxStyles }, { children: renderDropdown({
|
|
69
|
+
styles: dropdownBoxStyles,
|
|
70
|
+
ref: refs.setFloating,
|
|
71
|
+
setIsOpen,
|
|
72
|
+
isOpen,
|
|
73
|
+
id: dropdownId,
|
|
74
|
+
}) }))) : (renderDropdown({
|
|
75
|
+
styles: dropdownBoxStyles,
|
|
76
|
+
ref: refs.setFloating,
|
|
77
|
+
isOpen,
|
|
78
|
+
setIsOpen,
|
|
79
|
+
id: dropdownId,
|
|
80
|
+
})), _jsx(OverlayV2, { onClick: () => setIsOpen(false) })] }))] })));
|
|
81
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { BoldV2, ItalicV2 } from '.';
|
|
3
|
+
import { ParagraphV2 } from '../ParagraphV2';
|
|
4
|
+
import { UIVersion2 } from '../../../utils/decorators/UIVersion2';
|
|
5
|
+
const meta = {
|
|
6
|
+
title: 'Elements/InlineV2',
|
|
7
|
+
component: BoldV2,
|
|
8
|
+
tags: ['autodocs'],
|
|
9
|
+
decorators: [UIVersion2],
|
|
10
|
+
};
|
|
11
|
+
export default meta;
|
|
12
|
+
export const Default = {
|
|
13
|
+
render: () => (_jsxs(ParagraphV2, { children: ["Text with ", _jsx(BoldV2, { children: "bold content" }), " and", ' ', _jsx(ItalicV2, { children: "italic content" })] })),
|
|
14
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StyledElementPropsV2 } from '../../../theme';
|
|
3
|
+
type InlineV2Props = StyledElementPropsV2<HTMLSpanElement>;
|
|
4
|
+
export declare const BoldV2: React.FC<InlineV2Props>;
|
|
5
|
+
export declare const ItalicV2: React.FC<InlineV2Props>;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
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 "react/jsx-runtime";
|
|
13
|
+
import { processSx } from '../../../utils/processSx';
|
|
14
|
+
export const BoldV2 = (_a) => {
|
|
15
|
+
var { sx } = _a, rest = __rest(_a, ["sx"]);
|
|
16
|
+
const processedStyles = processSx(sx);
|
|
17
|
+
return (_jsx("span", Object.assign({ style: Object.assign({ fontWeight: 'bold' }, processedStyles) }, rest)));
|
|
18
|
+
};
|
|
19
|
+
export const ItalicV2 = (_a) => {
|
|
20
|
+
var { sx } = _a, rest = __rest(_a, ["sx"]);
|
|
21
|
+
const processedStyles = processSx(sx);
|
|
22
|
+
return (_jsx("span", Object.assign({ style: Object.assign({ fontStyle: 'italic' }, processedStyles) }, rest)));
|
|
23
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { ListV2 } from '.';
|
|
3
|
+
declare const meta: Meta<typeof ListV2>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof ListV2>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const Sizes: Story;
|
|
8
|
+
export declare const Ordered: Story;
|
|
9
|
+
export declare const CustomIcon: Story;
|
|
10
|
+
export declare const CustomIconPerItem: Story;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import ChevronRightIcon from '@mui/icons-material/ChevronRight';
|
|
3
|
+
import BookmarkIcon from '@mui/icons-material/Bookmark';
|
|
4
|
+
import BookmarkBorderIcon from '@mui/icons-material/BookmarkBorder';
|
|
5
|
+
import { LISTV2_SIZE, ListV2, ListItemV2 } from '.';
|
|
6
|
+
import { RowV2 } from '../RowV2';
|
|
7
|
+
import { ColumnV2 } from '../ColumnV2';
|
|
8
|
+
import { HEADINGV2_SIZE, HeadingV2 } from '../HeadingV2';
|
|
9
|
+
import { GROUPV2_TYPE, GroupV2 } from '../GroupV2';
|
|
10
|
+
import { COLOR } from '../../../theme/colors';
|
|
11
|
+
import { FONT_SIZE } from '../../../theme/typography';
|
|
12
|
+
import { UIVersion2 } from '../../../utils/decorators/UIVersion2';
|
|
13
|
+
const meta = {
|
|
14
|
+
title: 'Elements/ListV2',
|
|
15
|
+
component: ListV2,
|
|
16
|
+
tags: ['autodocs'],
|
|
17
|
+
decorators: [UIVersion2],
|
|
18
|
+
};
|
|
19
|
+
export default meta;
|
|
20
|
+
export const Default = {
|
|
21
|
+
render: () => (_jsx(RowV2, { children: _jsxs(ListV2, { children: [_jsx(ListItemV2, Object.assign({ index: 0 }, { children: "List Item 1" })), _jsx(ListItemV2, Object.assign({ index: 1 }, { children: "List Item 2" })), _jsxs(ListItemV2, Object.assign({ index: 2 }, { children: ["List Item 3", _jsxs(ListV2, { children: [_jsx(ListItemV2, Object.assign({ index: 0 }, { children: "List Item 3.1" })), _jsx(ListItemV2, Object.assign({ index: 1 }, { children: "List Item 3.2" }))] })] }))] }) })),
|
|
22
|
+
};
|
|
23
|
+
const sizes = [
|
|
24
|
+
{ size: LISTV2_SIZE.LG, label: 'Large' },
|
|
25
|
+
{ size: LISTV2_SIZE.MD, label: 'Medium' },
|
|
26
|
+
{ size: LISTV2_SIZE.SM, label: 'Small' },
|
|
27
|
+
];
|
|
28
|
+
export const Sizes = {
|
|
29
|
+
render: () => (_jsx(ColumnV2, { children: sizes.map((size, i) => (_jsxs(GroupV2, Object.assign({ type: GROUPV2_TYPE.REGION, sx: { mt: 3 } }, { children: [_jsx(HeadingV2, Object.assign({ size: HEADINGV2_SIZE.MD }, { children: size.label })), _jsx(RowV2, Object.assign({ sx: { mt: 2 } }, { children: _jsxs(ListV2, Object.assign({ size: size.size }, { children: [_jsx(ListItemV2, Object.assign({ index: 0 }, { children: "List Item 1" })), _jsx(ListItemV2, Object.assign({ index: 1 }, { children: "List Item 2" })), _jsx(ListItemV2, Object.assign({ index: 2 }, { children: "List Item 3" }))] })) }))] }), i))) })),
|
|
30
|
+
};
|
|
31
|
+
export const Ordered = {
|
|
32
|
+
render: () => (_jsx(RowV2, { children: _jsxs(ListV2, Object.assign({ icon: ChevronRightIcon, ordered: true }, { children: [_jsx(ListItemV2, Object.assign({ index: 0 }, { children: "List Item 1" })), _jsx(ListItemV2, Object.assign({ index: 1 }, { children: "List Item 2" })), _jsx(ListItemV2, Object.assign({ index: 2 }, { children: "List Item 3" }))] })) })),
|
|
33
|
+
};
|
|
34
|
+
export const CustomIcon = {
|
|
35
|
+
render: () => (_jsx(RowV2, { children: _jsxs(ListV2, Object.assign({ icon: ChevronRightIcon, iconColor: COLOR.PRIMARY }, { children: [_jsx(ListItemV2, Object.assign({ index: 0 }, { children: "List Item 1" })), _jsx(ListItemV2, Object.assign({ index: 1 }, { children: "List Item 2" })), _jsx(ListItemV2, Object.assign({ index: 2 }, { children: "List Item 3" }))] })) })),
|
|
36
|
+
};
|
|
37
|
+
export const CustomIconPerItem = {
|
|
38
|
+
render: () => (_jsx(RowV2, { children: _jsxs(ListV2, Object.assign({ iconSize: FONT_SIZE.ML }, { children: [_jsx(ListItemV2, Object.assign({ index: 0, icon: BookmarkIcon, onIconClick: () => { }, iconLabel: "Unfavorite" }, { children: "Favorite 1" })), _jsx(ListItemV2, Object.assign({ index: 1, icon: BookmarkIcon, onIconClick: () => { }, iconLabel: "Favorite" }, { children: "Favorited 2" })), _jsx(ListItemV2, Object.assign({ index: 2, icon: BookmarkBorderIcon, onIconClick: () => { }, iconLabel: "Favorite" }, { children: "Not Favorited" }))] })) })),
|
|
39
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StyledElementPropsV2 } from '../../../theme';
|
|
3
|
+
import { COLOR } from '../../../theme/colors';
|
|
4
|
+
import { FONT_SIZE } from '../../../theme/typography';
|
|
5
|
+
type ListV2Props = StyledElementPropsV2<HTMLUListElement, {
|
|
6
|
+
ordered?: boolean;
|
|
7
|
+
size?: LISTV2_SIZE;
|
|
8
|
+
icon?: React.FC<any>;
|
|
9
|
+
iconColor?: COLOR;
|
|
10
|
+
iconSize?: FONT_SIZE;
|
|
11
|
+
}>;
|
|
12
|
+
export declare enum LISTV2_SIZE {
|
|
13
|
+
SM = "sm",
|
|
14
|
+
MD = "md",
|
|
15
|
+
LG = "lg"
|
|
16
|
+
}
|
|
17
|
+
export declare const ListV2: React.FC<ListV2Props>;
|
|
18
|
+
type ListItemV2Props = StyledElementPropsV2<HTMLLIElement, {
|
|
19
|
+
index: number;
|
|
20
|
+
icon?: React.FC<any>;
|
|
21
|
+
iconSize?: FONT_SIZE;
|
|
22
|
+
iconColor?: COLOR;
|
|
23
|
+
iconLabel?: string;
|
|
24
|
+
onIconClick?: () => void;
|
|
25
|
+
}>;
|
|
26
|
+
export declare const ListItemV2: React.FC<ListItemV2Props>;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,102 @@
|
|
|
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, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import React from 'react';
|
|
14
|
+
import _CircleIcon from '@mui/icons-material/Circle';
|
|
15
|
+
import _CircleOutlinedIcon from '@mui/icons-material/CircleOutlined';
|
|
16
|
+
import _SquareIcon from '@mui/icons-material/Square';
|
|
17
|
+
import _SquareOutlinedIcon from '@mui/icons-material/SquareOutlined';
|
|
18
|
+
import { COLOR } from '../../../theme/colors';
|
|
19
|
+
import { FONT_SIZE, TYPOGRAPHY_TYPE, getTypographyStyles, } from '../../../theme/typography';
|
|
20
|
+
import { IconV2 } from '../IconV2';
|
|
21
|
+
import { importedDefaultComponentShim } from '../../../utils/misc';
|
|
22
|
+
import { useLinesHeightV2 } from '../ReadMoreV2';
|
|
23
|
+
import { ColumnV2 } from '../ColumnV2';
|
|
24
|
+
import { LabelV2 } from '../LabelV2';
|
|
25
|
+
import { processSx } from '../../../utils/processSx';
|
|
26
|
+
import { BoxV2 } from '../BoxV2';
|
|
27
|
+
const CircleIcon = importedDefaultComponentShim(_CircleIcon);
|
|
28
|
+
const CircleOutlinedIcon = importedDefaultComponentShim(_CircleOutlinedIcon);
|
|
29
|
+
const SquareIcon = importedDefaultComponentShim(_SquareIcon);
|
|
30
|
+
const SquareOutlinedIcon = importedDefaultComponentShim(_SquareOutlinedIcon);
|
|
31
|
+
export var LISTV2_SIZE;
|
|
32
|
+
(function (LISTV2_SIZE) {
|
|
33
|
+
LISTV2_SIZE["SM"] = "sm";
|
|
34
|
+
LISTV2_SIZE["MD"] = "md";
|
|
35
|
+
LISTV2_SIZE["LG"] = "lg";
|
|
36
|
+
})(LISTV2_SIZE || (LISTV2_SIZE = {}));
|
|
37
|
+
const marginSizeMap = {
|
|
38
|
+
[LISTV2_SIZE.SM]: '0.5rem',
|
|
39
|
+
[LISTV2_SIZE.MD]: '0.75rem',
|
|
40
|
+
[LISTV2_SIZE.LG]: '1rem',
|
|
41
|
+
};
|
|
42
|
+
const iconSizeMap = {
|
|
43
|
+
[LISTV2_SIZE.SM]: FONT_SIZE.XXS,
|
|
44
|
+
[LISTV2_SIZE.MD]: FONT_SIZE.XXS,
|
|
45
|
+
[LISTV2_SIZE.LG]: FONT_SIZE.XS,
|
|
46
|
+
};
|
|
47
|
+
const defaultIcons = [
|
|
48
|
+
CircleIcon,
|
|
49
|
+
CircleOutlinedIcon,
|
|
50
|
+
SquareIcon,
|
|
51
|
+
SquareOutlinedIcon,
|
|
52
|
+
];
|
|
53
|
+
const sizeTypographyMap = {
|
|
54
|
+
[LISTV2_SIZE.SM]: TYPOGRAPHY_TYPE.CONDENSED_TEXT_SMALL,
|
|
55
|
+
[LISTV2_SIZE.MD]: TYPOGRAPHY_TYPE.CONDENSED_TEXT_MEDIUM,
|
|
56
|
+
[LISTV2_SIZE.LG]: TYPOGRAPHY_TYPE.CONDENSED_TEXT_LARGE,
|
|
57
|
+
};
|
|
58
|
+
const ListConfigContext = React.createContext({
|
|
59
|
+
size: LISTV2_SIZE.MD,
|
|
60
|
+
ordered: false,
|
|
61
|
+
icon: CircleIcon,
|
|
62
|
+
iconColor: COLOR.TEXT,
|
|
63
|
+
iconSize: undefined,
|
|
64
|
+
depth: -1,
|
|
65
|
+
});
|
|
66
|
+
const useListConfig = () => React.useContext(ListConfigContext);
|
|
67
|
+
export const ListV2 = ({ sx, size: sizeParam, ordered, icon, iconSize: iconSizeParam, iconColor: iconColorParam, children, }) => {
|
|
68
|
+
const { depth: parentDepth, size: parentSize, iconColor: parentIconColor, iconSize: parentIconSize, } = useListConfig();
|
|
69
|
+
const depth = parentDepth + 1;
|
|
70
|
+
const defaultStyles = Object.assign({ listStyleType: 'none' }, getTypographyStyles());
|
|
71
|
+
const defaultIcon = defaultIcons[depth] || CircleIcon;
|
|
72
|
+
const size = sizeParam || parentSize || LISTV2_SIZE.MD;
|
|
73
|
+
const iconSize = iconSizeParam || parentIconSize || iconSizeMap[size];
|
|
74
|
+
const iconColor = iconColorParam || parentIconColor || COLOR.TEXT;
|
|
75
|
+
const processedStyles = processSx(Object.assign(Object.assign({}, defaultStyles), sx));
|
|
76
|
+
return (_jsx(ListConfigContext.Provider, Object.assign({ value: {
|
|
77
|
+
size,
|
|
78
|
+
icon: icon || defaultIcon,
|
|
79
|
+
iconColor,
|
|
80
|
+
iconSize,
|
|
81
|
+
ordered: ordered || false,
|
|
82
|
+
depth,
|
|
83
|
+
} }, { children: ordered ? (_jsx("ul", Object.assign({ style: processedStyles }, { children: children }))) : (_jsx("ol", Object.assign({ style: processedStyles }, { children: children }))) })));
|
|
84
|
+
};
|
|
85
|
+
export const ListItemV2 = (_a) => {
|
|
86
|
+
var { index, sx, icon: iconParam, iconSize: iconSizeParam, iconColor: iconColorParam, onIconClick, onClick, children, iconLabel, tabIndex: tabIndexParam } = _a, rest = __rest(_a, ["index", "sx", "icon", "iconSize", "iconColor", "onIconClick", "onClick", "children", "iconLabel", "tabIndex"]);
|
|
87
|
+
const { ordered, icon: listIcon, iconColor: listIconColor, iconSize: listIconSize, size, depth, } = useListConfig();
|
|
88
|
+
const icon = iconParam || listIcon;
|
|
89
|
+
const iconSize = iconSizeParam || listIconSize;
|
|
90
|
+
const iconColor = iconColorParam || listIconColor;
|
|
91
|
+
const typography = sizeTypographyMap[size];
|
|
92
|
+
const typographyStyles = getTypographyStyles(sizeTypographyMap[size]);
|
|
93
|
+
const lineHeight = useLinesHeightV2({ typography, lines: 1 });
|
|
94
|
+
const tabIndex = tabIndexParam || (onClick ? 0 : undefined);
|
|
95
|
+
const processedStyles = processSx(Object.assign(Object.assign({}, sx), typographyStyles));
|
|
96
|
+
return (_jsxs("li", Object.assign({ style: Object.assign({ display: 'flex', marginTop: index === 0 && depth === 0 ? 0 : marginSizeMap[size], marginLeft: '0.25rem' }, processedStyles), tabIndex: tabIndex }, rest, { children: [ordered ? (_jsxs(LabelV2, Object.assign({ standalone: true, sx: { mr: 2 } }, { children: [index + 1, "."] }))) : (_jsx(ColumnV2, Object.assign({ sx: { height: lineHeight }, justify: "center" }, { children: _jsx(IconV2, { icon: icon, color: iconColor, size: iconSize, onClick: onIconClick, "aria-label": iconLabel, sx: {
|
|
97
|
+
mr: 3,
|
|
98
|
+
alignItems: 'flex-start',
|
|
99
|
+
} }) }))), _jsx(BoxV2, Object.assign({ style: {
|
|
100
|
+
cursor: onClick ? 'pointer' : 'default',
|
|
101
|
+
} }, { children: children }))] })));
|
|
102
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
.markdownWrapper p:first-of-type:not(style):not(:first-of-type ~ *),
|
|
2
|
+
.markdownWrapper style + p {
|
|
3
|
+
margin-top: 0 !important;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.markdownWrapper h1:first-of-type:not(style):not(:first-of-type ~ *),
|
|
7
|
+
.markdownWrapper style + h1 {
|
|
8
|
+
margin-top: 0 !important;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.markdownWrapper h2:first-of-type:not(style):not(:first-of-type ~ *),
|
|
12
|
+
.markdownWrapper style + h2 {
|
|
13
|
+
margin-top: 0 !important;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.markdownWrapper h3:first-of-type:not(style):not(:first-of-type ~ *),
|
|
17
|
+
.markdownWrapper style + h3 {
|
|
18
|
+
margin-top: 0 !important;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.markdownWrapper h4:first-of-type:not(style):not(:first-of-type ~ *),
|
|
22
|
+
.markdownWrapper style + h4 {
|
|
23
|
+
margin-top: 0 !important;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.markdownWrapper h5:first-of-type:not(style):not(:first-of-type ~ *),
|
|
27
|
+
.markdownWrapper style + h5 {
|
|
28
|
+
margin-top: 0 !important;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.markdownWrapper h6:first-of-type:not(style):not(:first-of-type ~ *),
|
|
32
|
+
.markdownWrapper style + h6 {
|
|
33
|
+
margin-top: 0 !important;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.markdownWrapper blockquote:first-of-type:not(style):not(:first-of-type ~ *),
|
|
37
|
+
.markdownWrapper style + blockquote {
|
|
38
|
+
margin-top: 0 !important;
|
|
39
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { MarkdownV2 } from '.';
|
|
3
|
+
declare const meta: Meta<typeof MarkdownV2>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof MarkdownV2>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const WithHTML: Story;
|
|
8
|
+
export declare const CustomizeImages: Story;
|
|
9
|
+
export declare const CustomizeStyles: Story;
|
|
10
|
+
export declare const NoHtml: Story;
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { MarkdownV2 } from '.';
|
|
3
|
+
import { FONT_WEIGHT } from '../../../theme/typography';
|
|
4
|
+
import { COLOR } from '../../../theme/colors';
|
|
5
|
+
import { UIVersion2 } from '../../../utils/decorators/UIVersion2';
|
|
6
|
+
const meta = {
|
|
7
|
+
title: 'Elements/MarkdownV2',
|
|
8
|
+
component: MarkdownV2,
|
|
9
|
+
tags: ['autodocs'],
|
|
10
|
+
decorators: [UIVersion2],
|
|
11
|
+
};
|
|
12
|
+
const sampleParagraph = `
|
|
13
|
+
Lorem ipsum dolor sit amet consectetur adipiscing elit, urna consequat felis vehicula class ultricies
|
|
14
|
+
mollis dictumst, aenean non a in donec nulla. Phasellus ante pellentesque erat cum risus consequat
|
|
15
|
+
imperdiet aliquam, integer placerat et turpis mi eros nec lobortis taciti, vehicula nisl
|
|
16
|
+
litora tellus ligula porttitor metus.
|
|
17
|
+
`;
|
|
18
|
+
export default meta;
|
|
19
|
+
const startingContent = `
|
|
20
|
+
# Inline styles
|
|
21
|
+
This paragraph has __bold content__ and **more bold content** and _italic content_ and *more italic content*
|
|
22
|
+
|
|
23
|
+
# Image
|
|
24
|
+

|
|
25
|
+
|
|
26
|
+
# Heading 2
|
|
27
|
+
${sampleParagraph}
|
|
28
|
+
|
|
29
|
+
${sampleParagraph}
|
|
30
|
+
|
|
31
|
+
## Heading 3
|
|
32
|
+
${sampleParagraph}
|
|
33
|
+
|
|
34
|
+
### Heading 4
|
|
35
|
+
${sampleParagraph}
|
|
36
|
+
|
|
37
|
+
#### Heading 5
|
|
38
|
+
${sampleParagraph}
|
|
39
|
+
|
|
40
|
+
##### Heading 6
|
|
41
|
+
${sampleParagraph}
|
|
42
|
+
|
|
43
|
+
###### Heading 6
|
|
44
|
+
${sampleParagraph}
|
|
45
|
+
|
|
46
|
+
- List item 1
|
|
47
|
+
- List item 2
|
|
48
|
+
- List item 2.1
|
|
49
|
+
- List item 2.2
|
|
50
|
+
|
|
51
|
+
1. List item 1
|
|
52
|
+
2. List item 2
|
|
53
|
+
3. List item 3
|
|
54
|
+
|
|
55
|
+
> Lorem ipsum dolor sit amet, consectetur adipiscing elit,
|
|
56
|
+
sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
|
|
57
|
+
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris
|
|
58
|
+
nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in
|
|
59
|
+
reprehenderit in voluptate velit esse cillum dolore eu fugiat
|
|
60
|
+
nulla pariatur. [block quote link](test.com)
|
|
61
|
+
|
|
62
|
+

|
|
63
|
+
|
|
64
|
+
An inline images should appear to the right of this paragraph
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
https://this-should-be-auto-linked.nd.edu
|
|
68
|
+
|
|
69
|
+
While Gura says that the exhibit was inspired by the themes of the Medieval conference and will appeal to its attendees, the displays are curated to interest Notre Dame students and faculty across various disciplines, as well as the general public.
|
|
70
|
+
|
|
71
|
+
“I'm trying to pick items to tell a story that viewers can appreciate on different levels at the same time,” he said.
|
|
72
|
+
|
|
73
|
+
To tell that story, Gura decided to give each of the seven cases housing this exhibit a theme.
|
|
74
|
+
|
|
75
|
+
> “I think it's an exciting way to create a journey through time and space using the objects themselves as the primary storyteller,” he said. [test](test.com) “They will drive the narrative from case to case. You can be exposed to different things that the average person never really thought about.”
|
|
76
|
+
`;
|
|
77
|
+
export const Default = {
|
|
78
|
+
render: (args) => _jsx(MarkdownV2, Object.assign({}, args)),
|
|
79
|
+
args: {
|
|
80
|
+
content: startingContent,
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
const htmlContent = `
|
|
84
|
+
## HTML Content
|
|
85
|
+
<p style='color: red;'>hello world </p>
|
|
86
|
+
|
|
87
|
+
https://www.youtube.com/embed/dQw4w9WgXcQ?si=mzI8wJ8NkHgn9RUy
|
|
88
|
+
|
|
89
|
+
> Block quote [block quote link](test.com)
|
|
90
|
+
|
|
91
|
+
<img
|
|
92
|
+
style="width: 300px"
|
|
93
|
+
src="https://s3.amazonaws.com/resources.library.nd.edu/images/website/search.banner.fall.jpg"
|
|
94
|
+
></img>
|
|
95
|
+
<a href="https://google.com" class="embedly-card" data-card-width="100px" data-card-controls="0">Embedded content: https://google.com</a>
|
|
96
|
+
<iframe src="https://www.facebook.com/plugins/video.php?href=https%3A%2F%2Fwww.facebook.com%2FNDLibraries%2Fvideos%2F1673794309311939%2F&show_text=0&width=560" width="560" height="315" style="border:none;overflow:hidden" scrolling="no" frameborder="0" ></iframe>
|
|
97
|
+
${startingContent}
|
|
98
|
+
`;
|
|
99
|
+
export const WithHTML = {
|
|
100
|
+
render: (args) => _jsx(MarkdownV2, Object.assign({}, args)),
|
|
101
|
+
args: {
|
|
102
|
+
content: htmlContent,
|
|
103
|
+
enableHtml: true,
|
|
104
|
+
},
|
|
105
|
+
};
|
|
106
|
+
export const CustomizeImages = {
|
|
107
|
+
render: (args) => _jsx(MarkdownV2, Object.assign({}, args, { imageStyles: { width: '200px' } })),
|
|
108
|
+
args: {
|
|
109
|
+
content: startingContent,
|
|
110
|
+
},
|
|
111
|
+
};
|
|
112
|
+
export const CustomizeStyles = {
|
|
113
|
+
render: (args) => (_jsx(MarkdownV2, Object.assign({}, args, { customStyles: {
|
|
114
|
+
p: {
|
|
115
|
+
fontWeight: FONT_WEIGHT.BOLD,
|
|
116
|
+
},
|
|
117
|
+
h2: {
|
|
118
|
+
color: COLOR.SECONDARY,
|
|
119
|
+
},
|
|
120
|
+
} }))),
|
|
121
|
+
args: {
|
|
122
|
+
content: startingContent,
|
|
123
|
+
},
|
|
124
|
+
};
|
|
125
|
+
export const NoHtml = {
|
|
126
|
+
render: (args) => _jsx(MarkdownV2, Object.assign({}, args)),
|
|
127
|
+
args: {
|
|
128
|
+
content: htmlContent,
|
|
129
|
+
},
|
|
130
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { StyledElementPropsV2, StylesPropV2 } from '../../../theme';
|
|
3
|
+
type MarkdownV2Props = StyledElementPropsV2<HTMLDivElement, {
|
|
4
|
+
content: string;
|
|
5
|
+
enableHtml?: boolean;
|
|
6
|
+
imageStyles?: React.CSSProperties;
|
|
7
|
+
headingLevelOffset?: number;
|
|
8
|
+
customStyles?: Record<string, StylesPropV2>;
|
|
9
|
+
}>;
|
|
10
|
+
export declare const MarkdownV2: React.FC<MarkdownV2Props>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,123 @@
|
|
|
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 "react/jsx-runtime";
|
|
13
|
+
import { ReactMarkdown } from 'react-markdown/lib/react-markdown';
|
|
14
|
+
import rehypeRaw from 'rehype-raw';
|
|
15
|
+
import { ListV2, ListItemV2 } from '../ListV2';
|
|
16
|
+
import { ParagraphV2 } from '../ParagraphV2';
|
|
17
|
+
import { HEADINGV2_SIZE, HeadingV2 } from '../HeadingV2';
|
|
18
|
+
import { BoldV2, ItalicV2 } from '../InlineV2';
|
|
19
|
+
import remarkGfm from 'remark-gfm';
|
|
20
|
+
import { BlockQuoteV2 } from '../BlockQuoteV2';
|
|
21
|
+
import { CaptionV2 } from '../CaptionV2';
|
|
22
|
+
import { sanitizeHtml } from '../../../utils/sanitizeHtml';
|
|
23
|
+
import * as styles from './MarkdownV2.module.css';
|
|
24
|
+
import clsx from 'clsx';
|
|
25
|
+
const typeSafeStyles = styles;
|
|
26
|
+
const parseBlockquotes = (content) => {
|
|
27
|
+
const contentArray = content.split('\n');
|
|
28
|
+
const newContent = [];
|
|
29
|
+
let isAddingBlockquote = false;
|
|
30
|
+
for (const line of contentArray) {
|
|
31
|
+
if (line.startsWith('> ') && !isAddingBlockquote) {
|
|
32
|
+
const newLine = line.replace('> ', '');
|
|
33
|
+
newContent.push(`<blockquote>${newLine}`);
|
|
34
|
+
isAddingBlockquote = true;
|
|
35
|
+
}
|
|
36
|
+
else if (line.startsWith('> ') && isAddingBlockquote) {
|
|
37
|
+
newContent.push(line.replace('> ', ''));
|
|
38
|
+
}
|
|
39
|
+
else if (isAddingBlockquote) {
|
|
40
|
+
newContent.push(`</blockquote>\n\n${line}`);
|
|
41
|
+
isAddingBlockquote = false;
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
newContent.push(line);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
if (isAddingBlockquote) {
|
|
48
|
+
newContent.push('</blockquote>');
|
|
49
|
+
}
|
|
50
|
+
let newString = newContent.join('\n');
|
|
51
|
+
const blockquoteRegex = /<blockquote>(.*?)<\/blockquote>/g;
|
|
52
|
+
const blockquotes = newString.match(blockquoteRegex);
|
|
53
|
+
blockquotes === null || blockquotes === void 0 ? void 0 : blockquotes.forEach((blockquote) => {
|
|
54
|
+
const linkRegex = /\[(.*?)\]\((.*?)\)/g;
|
|
55
|
+
const links = blockquote.match(linkRegex);
|
|
56
|
+
let newBlockquote = blockquote;
|
|
57
|
+
links === null || links === void 0 ? void 0 : links.forEach((link) => {
|
|
58
|
+
const newLink = link.replace(/\[(.*?)\]\((.*?)\)/, '<a href="$2">$1</a>');
|
|
59
|
+
newBlockquote = newBlockquote.replace(link, newLink);
|
|
60
|
+
});
|
|
61
|
+
newString = newString.replace(blockquote, newBlockquote);
|
|
62
|
+
});
|
|
63
|
+
return newString;
|
|
64
|
+
};
|
|
65
|
+
const youtubeRegex = /^(?:https?:\/\/)?(?:www\.)?youtube\.com/;
|
|
66
|
+
const pullOutVideos = (content) => {
|
|
67
|
+
const lines = content.split('\n');
|
|
68
|
+
const mapped = lines.map((line) => {
|
|
69
|
+
const lineText = line.trim();
|
|
70
|
+
if (youtubeRegex.test(lineText)) {
|
|
71
|
+
return `<iframe src="${lineText}" width="560" height="315" style="margin-top:24px;"></iframe>`;
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
return line;
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
return mapped.join('\n');
|
|
78
|
+
};
|
|
79
|
+
export const MarkdownV2 = (_a) => {
|
|
80
|
+
var { content, enableHtml, imageStyles, customStyles = {}, headingLevelOffset = 1, className } = _a, rest = __rest(_a, ["content", "enableHtml", "imageStyles", "customStyles", "headingLevelOffset", "className"]);
|
|
81
|
+
let sanitizedContent = content;
|
|
82
|
+
if (enableHtml) {
|
|
83
|
+
sanitizedContent = parseBlockquotes(content);
|
|
84
|
+
sanitizedContent = pullOutVideos(sanitizedContent);
|
|
85
|
+
sanitizedContent = sanitizeHtml(sanitizedContent);
|
|
86
|
+
}
|
|
87
|
+
const slugify = (text) => {
|
|
88
|
+
return (text
|
|
89
|
+
.toString()
|
|
90
|
+
.toLowerCase()
|
|
91
|
+
.trim()
|
|
92
|
+
.replace(/\s+/g, '-')
|
|
93
|
+
.replace(/[^\w\-]+/g, '')
|
|
94
|
+
.replace(/--+/g, '-')
|
|
95
|
+
.replace(/^-+/, '')
|
|
96
|
+
.replace(/-+$/, ''));
|
|
97
|
+
};
|
|
98
|
+
return (_jsx("div", Object.assign({ className: clsx(typeSafeStyles.markdownWrapper, className) }, rest, { children: _jsx(ReactMarkdown, Object.assign({ rehypePlugins: enableHtml ? [rehypeRaw, remarkGfm] : [remarkGfm], components: {
|
|
99
|
+
h1: (props) => (_jsx(HeadingV2, Object.assign({ size: HEADINGV2_SIZE.XL }, props, { level: props.level + headingLevelOffset, standalone: true, id: slugify(props.children.toString()), sx: customStyles.h1 }))),
|
|
100
|
+
h2: (props) => (_jsx(HeadingV2, Object.assign({ size: HEADINGV2_SIZE.LG }, props, { level: props.level + headingLevelOffset, standalone: true, id: slugify(props.children.toString()), sx: customStyles.h2 }))),
|
|
101
|
+
h3: (props) => (_jsx(HeadingV2, Object.assign({ size: HEADINGV2_SIZE.MD }, props, { level: props.level + headingLevelOffset, standalone: true, id: slugify(props.children.toString()), sx: customStyles.h3 }))),
|
|
102
|
+
h4: (props) => (_jsx(HeadingV2, Object.assign({ size: HEADINGV2_SIZE.SM }, props, { level: props.level + headingLevelOffset, standalone: true, id: slugify(props.children.toString()), sx: customStyles.h4 }))),
|
|
103
|
+
h5: (props) => (_jsx(HeadingV2, Object.assign({ size: HEADINGV2_SIZE.SM }, props, { standalone: true, id: slugify(props.children.toString()), level: props.level + headingLevelOffset, sx: customStyles.h5 }))),
|
|
104
|
+
h6: (props) => (_jsx(HeadingV2, Object.assign({ size: HEADINGV2_SIZE.SM }, props, { standalone: true, id: slugify(props.children.toString()), level: props.level + headingLevelOffset, sx: customStyles.h6 }))),
|
|
105
|
+
code: (props) => _jsx(CaptionV2, Object.assign({}, props)),
|
|
106
|
+
ol: (props) => (_jsx(ListV2, Object.assign({}, props, { ordered: true, sx: Object.assign({ mt: 4 }, customStyles.ol) }))),
|
|
107
|
+
ul: (props) => (_jsx(ListV2, Object.assign({}, props, { sx: Object.assign({ mt: 4 }, customStyles.ul) }))),
|
|
108
|
+
li: (_a) => {
|
|
109
|
+
var { index, ordered } = _a, props = __rest(_a, ["index", "ordered"]);
|
|
110
|
+
return (_jsx(ListItemV2, Object.assign({ index: index }, props, { sx: customStyles.li })));
|
|
111
|
+
},
|
|
112
|
+
p: (props) => (_jsx(ParagraphV2, Object.assign({}, props, { sx: Object.assign({ fontSize: 'inherit' }, customStyles.p) }))),
|
|
113
|
+
strong: (props) => _jsx(BoldV2, Object.assign({}, props, { sx: customStyles.strong })),
|
|
114
|
+
em: (props) => _jsx(ItalicV2, Object.assign({}, props, { sx: customStyles.em })),
|
|
115
|
+
img: (props) => {
|
|
116
|
+
const alt = props.alt || '';
|
|
117
|
+
const inlineStyles = {};
|
|
118
|
+
const styles = Object.assign(Object.assign({}, inlineStyles), imageStyles);
|
|
119
|
+
return _jsx("img", Object.assign({}, props, { style: styles, alt: alt }));
|
|
120
|
+
},
|
|
121
|
+
blockquote: (props) => (_jsx(BlockQuoteV2, Object.assign({}, props, { sx: Object.assign({ my: 5 }, customStyles.blockquote) }))),
|
|
122
|
+
} }, { children: sanitizedContent })) })));
|
|
123
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { MonthPickerV2 } from '.';
|
|
3
|
+
declare const meta: Meta<typeof MonthPickerV2>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof MonthPickerV2>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const Inline: Story;
|