@ndlib/component-library 1.0.41 → 1.0.43

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.
Files changed (78) hide show
  1. package/dist/components/composites/NavMenu2/NavMenuV2.stories.d.ts +6 -0
  2. package/dist/components/composites/NavMenu2/NavMenuV2.stories.js +14 -0
  3. package/dist/components/composites/NavMenu2/demoV2.d.ts +1 -0
  4. package/dist/components/composites/NavMenu2/demoV2.js +189 -0
  5. package/dist/components/composites/NavMenu2/index.d.ts +5 -0
  6. package/dist/components/composites/NavMenu2/index.js +56 -0
  7. package/dist/components/composites/NavMenuV2/NavMenuV2.module.css +24 -0
  8. package/dist/components/elements/AlertsV2/AlertV2.stories.d.ts +10 -0
  9. package/dist/components/elements/AlertsV2/AlertV2.stories.js +51 -0
  10. package/dist/components/elements/AlertsV2/AlertsV2.module.css +49 -0
  11. package/dist/components/elements/AlertsV2/AlertsV2.stories.d.ts +7 -0
  12. package/dist/components/elements/AlertsV2/AlertsV2.stories.js +17 -0
  13. package/dist/components/elements/AlertsV2/index.d.ts +15 -0
  14. package/dist/components/elements/AlertsV2/index.js +50 -0
  15. package/dist/components/elements/ArrowLinkV2/ArrowLinkV2.module.css +47 -0
  16. package/dist/components/elements/ArrowLinkV2/ArrowLinkV2.stories.d.ts +6 -0
  17. package/dist/components/elements/ArrowLinkV2/ArrowLinkV2.stories.js +14 -0
  18. package/dist/components/elements/ArrowLinkV2/index.d.ts +7 -0
  19. package/dist/components/elements/ArrowLinkV2/index.js +21 -0
  20. package/dist/components/elements/BlockQuoteV2/BlockQuoteV2.module.css +6 -0
  21. package/dist/components/elements/BlockQuoteV2/index.d.ts +4 -0
  22. package/dist/components/elements/BlockQuoteV2/index.js +21 -0
  23. package/dist/components/elements/BrandingBarV2/BrandingBarV2.module.css +68 -0
  24. package/dist/components/elements/BrandingBarV2/BrandingBarV2.stories.d.ts +6 -0
  25. package/dist/components/elements/BrandingBarV2/BrandingBarV2.stories.js +13 -0
  26. package/dist/components/elements/BrandingBarV2/index.d.ts +2 -0
  27. package/dist/components/elements/BrandingBarV2/index.js +10 -0
  28. package/dist/components/elements/CaptionV2/index.d.ts +2 -0
  29. package/dist/components/elements/CaptionV2/index.js +22 -0
  30. package/dist/components/elements/DatePickerV2/DatePickerV2.stories.d.ts +8 -0
  31. package/dist/components/elements/DatePickerV2/DatePickerV2.stories.js +53 -0
  32. package/dist/components/elements/DatePickerV2/index.d.ts +23 -0
  33. package/dist/components/elements/DatePickerV2/index.js +57 -0
  34. package/dist/components/elements/DropdownV2/DropdownV2.stories.d.ts +8 -0
  35. package/dist/components/elements/DropdownV2/DropdownV2.stories.js +26 -0
  36. package/dist/components/elements/DropdownV2/index.d.ts +26 -0
  37. package/dist/components/elements/DropdownV2/index.js +81 -0
  38. package/dist/components/elements/InlineV2/InlineV2.stories.d.ts +6 -0
  39. package/dist/components/elements/InlineV2/InlineV2.stories.js +14 -0
  40. package/dist/components/elements/InlineV2/index.d.ts +6 -0
  41. package/dist/components/elements/InlineV2/index.js +23 -0
  42. package/dist/components/elements/ListV2/ListV2.stories.d.ts +10 -0
  43. package/dist/components/elements/ListV2/ListV2.stories.js +39 -0
  44. package/dist/components/elements/ListV2/index.d.ts +27 -0
  45. package/dist/components/elements/ListV2/index.js +102 -0
  46. package/dist/components/elements/MarkdownV2/MarkdownV2.module.css +39 -0
  47. package/dist/components/elements/MarkdownV2/MarkdownV2.stories.d.ts +10 -0
  48. package/dist/components/elements/MarkdownV2/MarkdownV2.stories.js +130 -0
  49. package/dist/components/elements/MarkdownV2/index.d.ts +11 -0
  50. package/dist/components/elements/MarkdownV2/index.js +123 -0
  51. package/dist/components/elements/MonthPickerV2/MonthPickerV2.stories.d.ts +7 -0
  52. package/dist/components/elements/MonthPickerV2/MonthPickerV2.stories.js +33 -0
  53. package/dist/components/elements/MonthPickerV2/index.d.ts +14 -0
  54. package/dist/components/elements/MonthPickerV2/index.js +26 -0
  55. package/dist/components/elements/PillV2/PillV2.module.css +29 -0
  56. package/dist/components/elements/PillV2/PillV2.stories.d.ts +8 -0
  57. package/dist/components/elements/PillV2/PillV2.stories.js +42 -0
  58. package/dist/components/elements/PillV2/index.d.ts +21 -0
  59. package/dist/components/elements/PillV2/index.js +79 -0
  60. package/dist/components/elements/RadioGroupV2/RadioGroupV2.stories.d.ts +7 -0
  61. package/dist/components/elements/RadioGroupV2/RadioGroupV2.stories.js +28 -0
  62. package/dist/components/elements/RadioGroupV2/index.d.ts +16 -0
  63. package/dist/components/elements/RadioGroupV2/index.js +27 -0
  64. package/dist/components/elements/RadioV2/RadioV2.module.css +17 -0
  65. package/dist/components/elements/RadioV2/RadioV2.stories.d.ts +6 -0
  66. package/dist/components/elements/RadioV2/RadioV2.stories.js +19 -0
  67. package/dist/components/elements/RadioV2/index.d.ts +8 -0
  68. package/dist/components/elements/RadioV2/index.js +23 -0
  69. package/dist/components/elements/TabListV2/TabListV2.module.css +21 -0
  70. package/dist/components/elements/TabListV2/TabListV2.stories.d.ts +6 -0
  71. package/dist/components/elements/TabListV2/TabListV2.stories.js +14 -0
  72. package/dist/components/elements/TabListV2/example.d.ts +7 -0
  73. package/dist/components/elements/TabListV2/example.js +36 -0
  74. package/dist/components/elements/TabListV2/index.d.ts +10 -0
  75. package/dist/components/elements/TabListV2/index.js +31 -0
  76. package/dist/index.d.ts +13 -0
  77. package/dist/index.js +13 -0
  78. package/package.json +1 -1
@@ -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
+ ![Tux, the Linux mascot](https://www.markdownguide.org/assets/images/tux.png)
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
+ ![Tux, the Linux mascot!!inline](https://www.markdownguide.org/assets/images/tux.png)
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;
@@ -0,0 +1,33 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useState } from 'react';
3
+ import { MonthPickerV2 } from '.';
4
+ import { BoxV2 } from '../BoxV2';
5
+ import { UIVersion2 } from '../../../utils/decorators/UIVersion2';
6
+ const meta = {
7
+ title: 'Elements/Fields/MonthPickerV2',
8
+ component: MonthPickerV2,
9
+ tags: ['autodocs'],
10
+ decorators: [UIVersion2],
11
+ };
12
+ export default meta;
13
+ const StatefulMonthPickerV2 = (props) => {
14
+ const [date, setDate] = useState(new Date());
15
+ return _jsx(MonthPickerV2, Object.assign({}, props, { value: date, onChange: setDate }));
16
+ };
17
+ export const Default = {
18
+ render: () => (_jsx(BoxV2, Object.assign({ sx: { height: '500px' } }, { children: _jsx(StatefulMonthPickerV2, {}) }))),
19
+ };
20
+ export const Inline = {
21
+ argTypes: {
22
+ backgroundColor: {
23
+ options: ['blue', 'gold', 'green', 'red'],
24
+ control: {
25
+ type: 'select',
26
+ },
27
+ },
28
+ },
29
+ render: (args) => {
30
+ const { backgroundColor } = args;
31
+ return (_jsx(BoxV2, Object.assign({ sx: { height: '500px' } }, { children: _jsx(StatefulMonthPickerV2, { backgroundColor: backgroundColor, inline: true }) })));
32
+ },
33
+ };
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import 'react-datepicker/dist/react-datepicker.css';
3
+ import { TextInputV2Props } from '../TextInputV2';
4
+ import { BoxV2Props } from '../BoxV2';
5
+ export declare const MonthPickerV2: React.FC<{
6
+ value: Date;
7
+ onChange: (date: Date) => void;
8
+ minDate?: Date;
9
+ maxDate?: Date;
10
+ inline?: boolean;
11
+ backgroundColor?: string;
12
+ inputProps?: Partial<TextInputV2Props>;
13
+ wrapperProps?: BoxV2Props;
14
+ }>;
@@ -0,0 +1,26 @@
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 _ReactDatePicker from 'react-datepicker';
14
+ import 'react-datepicker/dist/react-datepicker.css';
15
+ import { TextInputV2 } from '../TextInputV2';
16
+ import { InputWrapperV2 } from '../DatePickerV2';
17
+ import { BoxV2 } from '../BoxV2';
18
+ import { importedDefaultComponentShim } from '../../../utils/misc';
19
+ const ReactDatePicker = importedDefaultComponentShim(_ReactDatePicker);
20
+ const PermissiveTextInputV2 = TextInputV2;
21
+ export const MonthPickerV2 = (_a) => {
22
+ var { value, inputProps, backgroundColor, wrapperProps } = _a, rest = __rest(_a, ["value", "inputProps", "backgroundColor", "wrapperProps"]);
23
+ if (!backgroundColor)
24
+ backgroundColor = 'blue';
25
+ return (_jsx(BoxV2, Object.assign({}, wrapperProps, { children: _jsx(ReactDatePicker, Object.assign({ calendarClassName: `ndlib-date-picker ndlib-date-picker-${backgroundColor}`, selected: value, customInput: _jsx(InputWrapperV2, { children: _jsx(PermissiveTextInputV2, Object.assign({}, inputProps)) }), showMonthYearPicker: true }, rest)) })));
26
+ };
@@ -0,0 +1,29 @@
1
+ .pillButton {
2
+ border-radius: 1000px;
3
+ border: solid 1px;
4
+ display: flex;
5
+ flex-direction: row;
6
+ align-items: center;
7
+ justify-content: center;
8
+ }
9
+
10
+ .pillButton.clickable:hover {
11
+ box-shadow: 0 0 8px #dfdfdf;
12
+ transform: scale(1.03);
13
+ }
14
+
15
+ .pillButton.clickable:focus {
16
+ box-shadow: 0 0 8px #dfdfdf;
17
+ transform: scale(1.03);
18
+ outline: 2px solid var(--ndBlueBright);
19
+ outline-offset: 2px;
20
+ }
21
+
22
+ .pillContent {
23
+ flex-grow: 1;
24
+ justify-content: flex-start;
25
+ text-overflow: ellipsis;
26
+ white-space: nowrap;
27
+ overflow: hidden;
28
+ text-align: start;
29
+ }
@@ -0,0 +1,8 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import { PillV2 } from '.';
3
+ declare const meta: Meta<typeof PillV2>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof PillV2>;
6
+ export declare const Default: Story;
7
+ export declare const Icon: Story;
8
+ export declare const NoAction: Story;
@@ -0,0 +1,42 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import SearchIcon from '@mui/icons-material/Search';
3
+ import { PILLV2_SIZE, PILLV2_TYPE, PillV2 } from '.';
4
+ import { GROUPV2_TYPE, GroupV2 } from '../GroupV2';
5
+ import { HEADINGV2_SIZE, HeadingV2 } from '../HeadingV2';
6
+ import { ColumnV2 } from '../ColumnV2';
7
+ import { RowV2 } from '../RowV2';
8
+ import { UIVersion2 } from '../../../utils/decorators/UIVersion2';
9
+ const meta = {
10
+ title: 'Elements/PillV2',
11
+ component: PillV2,
12
+ tags: ['autodocs'],
13
+ decorators: [UIVersion2],
14
+ };
15
+ export default meta;
16
+ const sizes = [
17
+ { size: PILLV2_SIZE.LG, label: 'Large' },
18
+ { size: PILLV2_SIZE.SM, label: 'Small' },
19
+ ];
20
+ export const Default = {
21
+ render: (args) => (_jsx(ColumnV2, { children: sizes.map((size) => (_jsxs(GroupV2, Object.assign({ type: GROUPV2_TYPE.REGION }, { children: [_jsx(HeadingV2, Object.assign({ size: HEADINGV2_SIZE.MD }, { children: size.label })), _jsxs(RowV2, Object.assign({ sx: { mt: 2 } }, { children: [_jsx(PillV2, Object.assign({}, args, { size: size.size, sx: { mr: 1 } })), _jsx(PillV2, Object.assign({}, args, { size: size.size, type: PILLV2_TYPE.OUTLINE }))] }))] })))) })),
22
+ args: {
23
+ type: PILLV2_TYPE.DEFAULT,
24
+ children: 'Virtual Event',
25
+ onClick: () => console.log('clicked'),
26
+ },
27
+ };
28
+ export const Icon = {
29
+ render: (args) => (_jsx(ColumnV2, { children: sizes.map((size) => (_jsxs(GroupV2, Object.assign({ type: GROUPV2_TYPE.REGION }, { children: [_jsx(HeadingV2, Object.assign({ size: HEADINGV2_SIZE.MD }, { children: size.label })), _jsxs(RowV2, Object.assign({ sx: { mt: 2 } }, { children: [_jsx(PillV2, Object.assign({}, args, { size: size.size, sx: { mr: 1 }, icon: SearchIcon })), _jsx(PillV2, Object.assign({}, args, { size: size.size, type: PILLV2_TYPE.OUTLINE, icon: SearchIcon }))] }))] })))) })),
30
+ args: {
31
+ type: PILLV2_TYPE.DEFAULT,
32
+ children: 'Virtual Event',
33
+ onClick: () => console.log('clicked'),
34
+ },
35
+ };
36
+ export const NoAction = {
37
+ render: (args) => (_jsx(ColumnV2, { children: sizes.map((size) => (_jsxs(GroupV2, Object.assign({ type: GROUPV2_TYPE.REGION }, { children: [_jsx(HeadingV2, Object.assign({ size: HEADINGV2_SIZE.MD }, { children: size.label })), _jsxs(RowV2, Object.assign({ sx: { mt: 2 } }, { children: [_jsx(PillV2, Object.assign({}, args, { size: size.size, sx: { mr: 1 } })), _jsx(PillV2, Object.assign({}, args, { size: size.size, type: PILLV2_TYPE.OUTLINE }))] }))] })))) })),
38
+ args: {
39
+ type: PILLV2_TYPE.DEFAULT,
40
+ children: 'Virtual Event',
41
+ },
42
+ };
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ import { COLOR } from '../../../theme/colors';
3
+ export declare enum PILLV2_SIZE {
4
+ SM = "sm",
5
+ LG = "lg"
6
+ }
7
+ export declare enum PILLV2_TYPE {
8
+ DEFAULT = "default",
9
+ OUTLINE = "outline"
10
+ }
11
+ export declare const PillV2: React.ForwardRefExoticComponent<{
12
+ sx?: import("../../../theme").StylesPropV2 | undefined;
13
+ children?: React.ReactNode;
14
+ } & Omit<React.HTMLAttributes<HTMLButtonElement>, "children" | "onChange"> & {
15
+ size?: PILLV2_SIZE | undefined;
16
+ type?: PILLV2_TYPE | undefined;
17
+ color?: COLOR | undefined;
18
+ icon?: React.FC<any> | undefined;
19
+ } & {
20
+ htmlFor?: string | undefined;
21
+ } & React.RefAttributes<HTMLButtonElement>>;