@jsonresume/core 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +689 -0
- package/dist/resume-print.css +425 -0
- package/dist/tokens.css +139 -0
- package/package.json +66 -0
- package/src/badges/BadgeRowOutline.jsx +118 -0
- package/src/badges/BadgeRowOutline.stories.tsx +160 -0
- package/src/badges/index.jsx +5 -0
- package/src/callouts/Callout.jsx +80 -0
- package/src/callouts/Callout.stories.tsx +27 -0
- package/src/callouts/HighlightCard.jsx +114 -0
- package/src/callouts/HighlightCard.stories.tsx +27 -0
- package/src/callouts/InfoBox.jsx +82 -0
- package/src/callouts/InfoBox.stories.tsx +26 -0
- package/src/callouts/index.jsx +4 -0
- package/src/certifications/AwardCard.jsx +83 -0
- package/src/certifications/AwardCard.stories.tsx +32 -0
- package/src/certifications/CertificationBadge.jsx +85 -0
- package/src/certifications/CertificationBadge.stories.tsx +29 -0
- package/src/certifications/CertificationRow.jsx +150 -0
- package/src/certifications/CertificationRow.stories.tsx +64 -0
- package/src/certifications/HonorsList.jsx +87 -0
- package/src/certifications/HonorsList.stories.tsx +36 -0
- package/src/certifications/index.jsx +5 -0
- package/src/containers/AccentCalloutPanel.jsx +176 -0
- package/src/containers/AccentCalloutPanel.stories.tsx +105 -0
- package/src/containers/MutedPanel.jsx +125 -0
- package/src/containers/MutedPanel.stories.tsx +113 -0
- package/src/containers/RoleBlockFramed.jsx +191 -0
- package/src/containers/RoleBlockFramed.stories.tsx +230 -0
- package/src/containers/SoftCardOutline.jsx +161 -0
- package/src/containers/SoftCardOutline.stories.tsx +174 -0
- package/src/containers/index.jsx +9 -0
- package/src/data/KPIChipLine.jsx +158 -0
- package/src/data/KPIChipLine.stories.tsx +99 -0
- package/src/data/KeyValueInline.jsx +150 -0
- package/src/data/KeyValueInline.stories.tsx +136 -0
- package/src/data/MetricBar.jsx +93 -0
- package/src/data/MetricBar.stories.tsx +31 -0
- package/src/data/MetricBullet.jsx +129 -0
- package/src/data/MetricBullet.stories.tsx +99 -0
- package/src/data/MetricInline.jsx +60 -0
- package/src/data/MetricInline.stories.tsx +53 -0
- package/src/data/ProgressCircle.jsx +81 -0
- package/src/data/ProgressCircle.stories.tsx +102 -0
- package/src/data/StatCard.jsx +65 -0
- package/src/data/StatCard.stories.tsx +29 -0
- package/src/data/index.jsx +12 -0
- package/src/dates/DateBadge.jsx +73 -0
- package/src/dates/DateBadge.stories.tsx +30 -0
- package/src/dates/RelativeDate.jsx +121 -0
- package/src/dates/RelativeDate.stories.tsx +29 -0
- package/src/dates/index.jsx +3 -0
- package/src/experience/ExperienceCard.jsx +82 -0
- package/src/experience/ExperienceCard.stories.tsx +36 -0
- package/src/experience/ExperienceCompact.jsx +72 -0
- package/src/experience/ExperienceCompact.stories.tsx +53 -0
- package/src/experience/ExperienceGrid.jsx +65 -0
- package/src/experience/ExperienceGrid.stories.tsx +63 -0
- package/src/experience/ExperienceTimeline.jsx +24 -0
- package/src/experience/ExperienceTimeline.stories.tsx +63 -0
- package/src/experience/RoleHeaderCompact.jsx +99 -0
- package/src/experience/index.jsx +9 -0
- package/src/header/ContactRowLine.jsx +125 -0
- package/src/header/ContactRowLine.stories.tsx +65 -0
- package/src/header/CornerInitials.jsx +178 -0
- package/src/header/CornerInitials.stories.tsx +129 -0
- package/src/header/Footer.jsx +50 -0
- package/src/header/Footer.stories.tsx +25 -0
- package/src/header/HeaderCentered.jsx +51 -0
- package/src/header/HeaderCentered.stories.tsx +30 -0
- package/src/header/HeaderMinimal.jsx +50 -0
- package/src/header/HeaderMinimal.stories.tsx +29 -0
- package/src/header/HeaderSplit.jsx +65 -0
- package/src/header/HeaderSplit.stories.tsx +29 -0
- package/src/header/HeroNameBlock.jsx +71 -0
- package/src/header/HeroNameBlock.stories.tsx +37 -0
- package/src/header/NameStackElegant.jsx +104 -0
- package/src/header/NameStackElegant.stories.tsx +60 -0
- package/src/header/PageBreak.jsx +25 -0
- package/src/header/PageBreak.stories.tsx +22 -0
- package/src/header/SectionFlagTitle.jsx +87 -0
- package/src/header/SectionFlagTitle.stories.tsx +53 -0
- package/src/header/SectionRuleTitle.jsx +84 -0
- package/src/header/SectionRuleTitle.stories.tsx +52 -0
- package/src/header/index.jsx +18 -0
- package/src/helpers/calculations.js +428 -0
- package/src/index.js +253 -0
- package/src/languages/LanguageBar.jsx +90 -0
- package/src/languages/LanguageBar.stories.tsx +28 -0
- package/src/languages/LanguageGrid.jsx +118 -0
- package/src/languages/LanguageGrid.stories.tsx +33 -0
- package/src/languages/LanguageLevelBarLite.jsx +147 -0
- package/src/languages/LanguageLevelBarLite.stories.tsx +74 -0
- package/src/languages/ProficiencyScale.jsx +107 -0
- package/src/languages/ProficiencyScale.stories.tsx +30 -0
- package/src/languages/index.jsx +5 -0
- package/src/layouts/CardLayout.jsx +46 -0
- package/src/layouts/CardLayout.stories.tsx +272 -0
- package/src/layouts/FlexLayout.jsx +53 -0
- package/src/layouts/FlexLayout.stories.tsx +270 -0
- package/src/layouts/GridLayout.jsx +38 -0
- package/src/layouts/GridLayout.stories.tsx +183 -0
- package/src/layouts/SidebarLayout.jsx +63 -0
- package/src/layouts/SidebarLayout.stories.tsx +162 -0
- package/src/layouts/StackLayout.jsx +26 -0
- package/src/layouts/StackLayout.stories.tsx +192 -0
- package/src/layouts/TwoColumnMicroGrid.jsx +87 -0
- package/src/layouts/TwoColumnMicroGrid.stories.tsx +96 -0
- package/src/layouts/index.jsx +11 -0
- package/src/lists/AchievementListSpacious.jsx +81 -0
- package/src/lists/AchievementListSpacious.stories.tsx +49 -0
- package/src/lists/AchievementListTight.jsx +80 -0
- package/src/lists/AchievementListTight.stories.tsx +49 -0
- package/src/lists/BulletList.jsx +66 -0
- package/src/lists/BulletList.stories.tsx +38 -0
- package/src/lists/CheckList.jsx +94 -0
- package/src/lists/CheckList.stories.tsx +38 -0
- package/src/lists/CompactList.jsx +90 -0
- package/src/lists/CompactList.stories.tsx +34 -0
- package/src/lists/DefinitionKeyline.jsx +114 -0
- package/src/lists/DefinitionKeyline.stories.tsx +90 -0
- package/src/lists/HangingBulletList.jsx +82 -0
- package/src/lists/HangingBulletList.stories.tsx +50 -0
- package/src/lists/IconList.jsx +89 -0
- package/src/lists/IconList.stories.tsx +36 -0
- package/src/lists/ListDashCompact.jsx +69 -0
- package/src/lists/ListDashCompact.stories.tsx +60 -0
- package/src/lists/MiniDotLeaderList.jsx +69 -0
- package/src/lists/MiniDotLeaderList.stories.tsx +73 -0
- package/src/lists/NumberedList.jsx +74 -0
- package/src/lists/NumberedList.stories.tsx +39 -0
- package/src/lists/index.jsx +12 -0
- package/src/metadata/GreyLabelCaps.jsx +66 -0
- package/src/metadata/GreyLabelCaps.stories.tsx +40 -0
- package/src/metadata/InlineKicker.jsx +61 -0
- package/src/metadata/InlineKicker.stories.tsx +35 -0
- package/src/metadata/MetaRow.jsx +96 -0
- package/src/metadata/MetaRow.stories.tsx +38 -0
- package/src/metadata/SmallCapsHeading.jsx +75 -0
- package/src/metadata/SmallCapsHeading.stories.tsx +54 -0
- package/src/metadata/SubsectionLabel.jsx +92 -0
- package/src/metadata/SubsectionLabel.stories.tsx +40 -0
- package/src/metadata/index.jsx +10 -0
- package/src/primitives/AccentSidebarStripe.stories.tsx +65 -0
- package/src/primitives/AccentSidebarStripe.tsx +95 -0
- package/src/primitives/AccentTopRule.stories.tsx +102 -0
- package/src/primitives/AccentTopRule.tsx +103 -0
- package/src/primitives/Badge.jsx +125 -0
- package/src/primitives/Badge.stories.tsx +27 -0
- package/src/primitives/ContactInfo.jsx +133 -0
- package/src/primitives/ContactInfo.stories.tsx +30 -0
- package/src/primitives/DIVIDERS.md +333 -0
- package/src/primitives/DateRange.jsx +178 -0
- package/src/primitives/DateRange.stories.tsx +28 -0
- package/src/primitives/DottedDivider.stories.tsx +54 -0
- package/src/primitives/DottedDivider.tsx +102 -0
- package/src/primitives/InlineSeparatorPipe.jsx +64 -0
- package/src/primitives/InlineSeparatorPipe.stories.tsx +96 -0
- package/src/primitives/KeylineDivider.stories.tsx +48 -0
- package/src/primitives/KeylineDivider.tsx +80 -0
- package/src/primitives/Link.jsx +59 -0
- package/src/primitives/Link.stories.tsx +29 -0
- package/src/primitives/ListItem.jsx +127 -0
- package/src/primitives/ListItem.stories.tsx +27 -0
- package/src/primitives/RulesetStack.stories.tsx +85 -0
- package/src/primitives/RulesetStack.tsx +117 -0
- package/src/primitives/Section.jsx +37 -0
- package/src/primitives/Section.stories.tsx +28 -0
- package/src/primitives/SectionTitle.jsx +62 -0
- package/src/primitives/SectionTitle.stories.tsx +27 -0
- package/src/primitives/index.jsx +36 -0
- package/src/print/ColumnBreak.jsx +44 -0
- package/src/print/ColumnBreak.stories.tsx +22 -0
- package/src/print/KeepTogether.jsx +24 -0
- package/src/print/KeepTogether.stories.tsx +26 -0
- package/src/print/LetterheadBar.jsx +100 -0
- package/src/print/LetterheadBar.stories.tsx +141 -0
- package/src/print/PageFooterLine.jsx +93 -0
- package/src/print/PageFooterLine.stories.tsx +121 -0
- package/src/print/PageHeaderLine.jsx +59 -0
- package/src/print/PageHeaderLine.stories.tsx +108 -0
- package/src/print/PrintOnly.jsx +49 -0
- package/src/print/PrintOnly.stories.tsx +26 -0
- package/src/print/SoftShadowEmulation.jsx +88 -0
- package/src/print/SoftShadowEmulation.stories.tsx +214 -0
- package/src/print/index.jsx +8 -0
- package/src/profile/Avatar.jsx +66 -0
- package/src/profile/Avatar.stories.tsx +84 -0
- package/src/profile/ContactGrid.jsx +63 -0
- package/src/profile/ContactGrid.stories.tsx +33 -0
- package/src/profile/ProfileCard.jsx +73 -0
- package/src/profile/ProfileCard.stories.tsx +35 -0
- package/src/profile/SocialLinks.jsx +61 -0
- package/src/profile/SocialLinks.stories.tsx +33 -0
- package/src/profile/index.jsx +9 -0
- package/src/providers/ThemeProvider.jsx +56 -0
- package/src/providers/ThemeProvider.stories.tsx +149 -0
- package/src/publications/PortfolioGrid.jsx +122 -0
- package/src/publications/PortfolioGrid.stories.tsx +62 -0
- package/src/publications/ProjectCard.jsx +151 -0
- package/src/publications/ProjectCard.stories.tsx +36 -0
- package/src/publications/PublicationEntryPlain.jsx +127 -0
- package/src/publications/PublicationEntryPlain.stories.tsx +58 -0
- package/src/publications/PublicationItem.jsx +120 -0
- package/src/publications/PublicationItem.stories.tsx +32 -0
- package/src/publications/index.jsx +5 -0
- package/src/quotes/BlockQuote.jsx +55 -0
- package/src/quotes/BlockQuote.stories.tsx +33 -0
- package/src/quotes/PullQuote.jsx +70 -0
- package/src/quotes/PullQuote.stories.tsx +32 -0
- package/src/quotes/Testimonial.jsx +99 -0
- package/src/quotes/Testimonial.stories.tsx +36 -0
- package/src/quotes/index.jsx +4 -0
- package/src/skills/SkillBar.jsx +66 -0
- package/src/skills/SkillBar.stories.tsx +112 -0
- package/src/skills/SkillCategory.jsx +71 -0
- package/src/skills/SkillCategory.stories.tsx +197 -0
- package/src/skills/SkillCloud.jsx +53 -0
- package/src/skills/SkillCloud.stories.tsx +132 -0
- package/src/skills/SkillGroup.jsx +56 -0
- package/src/skills/SkillGroup.stories.tsx +162 -0
- package/src/skills/SkillPill.jsx +56 -0
- package/src/skills/SkillPill.stories.tsx +157 -0
- package/src/skills/SkillRating.jsx +60 -0
- package/src/skills/SkillRating.stories.tsx +115 -0
- package/src/skills/index.jsx +11 -0
- package/src/styles/tokens.css +139 -0
- package/src/tables/ComparisonTable.jsx +128 -0
- package/src/tables/ComparisonTable.stories.tsx +41 -0
- package/src/tables/DataTable.jsx +149 -0
- package/src/tables/DataTable.stories.tsx +64 -0
- package/src/tables/SkillMatrix.jsx +139 -0
- package/src/tables/SkillMatrix.stories.tsx +90 -0
- package/src/tables/index.jsx +4 -0
- package/src/tags/ToolTagRibbon.jsx +106 -0
- package/src/tags/ToolTagRibbon.stories.tsx +121 -0
- package/src/tags/index.jsx +5 -0
- package/src/timeline/TimelineInline.stories.tsx +83 -0
- package/src/timeline/TimelineInline.tsx +202 -0
- package/src/timeline/TimelineItem.jsx +106 -0
- package/src/timeline/TimelineItem.stories.tsx +64 -0
- package/src/timeline/TimelineRuleMinimal.stories.tsx +68 -0
- package/src/timeline/TimelineRuleMinimal.tsx +165 -0
- package/src/timeline/TimelineSection.jsx +21 -0
- package/src/timeline/TimelineSection.stories.tsx +44 -0
- package/src/timeline/index.jsx +9 -0
- package/src/tokens/index.js +164 -0
- package/src/typography/Heading.jsx +48 -0
- package/src/typography/Heading.stories.tsx +46 -0
- package/src/typography/HyphenationSafeParagraph.jsx +98 -0
- package/src/typography/HyphenationSafeParagraph.stories.tsx +151 -0
- package/src/typography/Label.jsx +38 -0
- package/src/typography/Label.stories.tsx +27 -0
- package/src/typography/QuoteStripe.jsx +78 -0
- package/src/typography/QuoteStripe.stories.tsx +63 -0
- package/src/typography/SectionIntroParagraph.jsx +62 -0
- package/src/typography/SectionIntroParagraph.stories.tsx +57 -0
- package/src/typography/Text.jsx +42 -0
- package/src/typography/Text.stories.tsx +35 -0
- package/src/typography/index.jsx +11 -0
- package/src/utils/Divider.jsx +32 -0
- package/src/utils/Divider.stories.tsx +24 -0
- package/src/utils/Flex.jsx +6 -0
- package/src/utils/Flex.stories.tsx +28 -0
- package/src/utils/Grid.jsx +6 -0
- package/src/utils/Grid.stories.tsx +28 -0
- package/src/utils/Spacer.jsx +18 -0
- package/src/utils/Spacer.stories.tsx +26 -0
- package/src/utils/index.jsx +9 -0
- package/src/utils/security.js +155 -0
- package/src/visuals/BackgroundPattern.jsx +65 -0
- package/src/visuals/BackgroundPattern.stories.tsx +27 -0
- package/src/visuals/BorderAccent.jsx +147 -0
- package/src/visuals/BorderAccent.stories.tsx +27 -0
- package/src/visuals/ColorBlock.jsx +60 -0
- package/src/visuals/ColorBlock.stories.tsx +27 -0
- package/src/visuals/DividerVariants.jsx +120 -0
- package/src/visuals/DividerVariants.stories.tsx +27 -0
- package/src/visuals/index.jsx +5 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Grid Stories
|
|
4
|
+
*/
|
|
5
|
+
import { Grid } from './Grid';
|
|
6
|
+
|
|
7
|
+
const meta = {
|
|
8
|
+
title: 'Resume Core/Utils/Grid',
|
|
9
|
+
component: Grid,
|
|
10
|
+
parameters: { layout: 'padded' },
|
|
11
|
+
tags: ['autodocs'],
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export default meta;
|
|
15
|
+
|
|
16
|
+
export const Default = {
|
|
17
|
+
args: {
|
|
18
|
+
children: 'Grid container content',
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const Example = {
|
|
23
|
+
args: {
|
|
24
|
+
columns: 3,
|
|
25
|
+
gap: 'large',
|
|
26
|
+
children: 'Three column grid',
|
|
27
|
+
},
|
|
28
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Spacer
|
|
4
|
+
* Empty space component for layouts
|
|
5
|
+
*/
|
|
6
|
+
import styled from 'styled-components';
|
|
7
|
+
|
|
8
|
+
const StyledSpacer = styled.div`
|
|
9
|
+
width: ${(props) => props.$width || '100%'};
|
|
10
|
+
height: ${(props) => props.$height || 'var(--resume-space-item)'};
|
|
11
|
+
flex-shrink: 0;
|
|
12
|
+
`;
|
|
13
|
+
|
|
14
|
+
export function Spacer({ width, height, className }) {
|
|
15
|
+
return <StyledSpacer $width={width} $height={height} className={className} />;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default Spacer;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Spacer Stories
|
|
4
|
+
*/
|
|
5
|
+
import { Spacer } from './Spacer';
|
|
6
|
+
|
|
7
|
+
const meta = {
|
|
8
|
+
title: 'Resume Core/Utils/Spacer',
|
|
9
|
+
component: Spacer,
|
|
10
|
+
parameters: { layout: 'padded' },
|
|
11
|
+
tags: ['autodocs'],
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export default meta;
|
|
15
|
+
|
|
16
|
+
export const Default = {
|
|
17
|
+
args: {
|
|
18
|
+
size: 'medium',
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const Example = {
|
|
23
|
+
args: {
|
|
24
|
+
size: 'large',
|
|
25
|
+
},
|
|
26
|
+
};
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Security utilities for @resume/core
|
|
3
|
+
* Prevents XSS attacks and ensures safe URL handling
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Sanitizes URLs to prevent XSS attacks
|
|
8
|
+
* - Blocks javascript:, data:, vbscript: schemes
|
|
9
|
+
* - Allows http:, https:, mailto:, tel: schemes
|
|
10
|
+
* - Returns null for invalid/dangerous URLs
|
|
11
|
+
*
|
|
12
|
+
* @param {string} url - The URL to sanitize
|
|
13
|
+
* @returns {string|null} - Safe URL or null if dangerous
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* safeUrl('https://example.com') // 'https://example.com'
|
|
17
|
+
* safeUrl('javascript:alert(1)') // null
|
|
18
|
+
* safeUrl('mailto:user@example.com') // 'mailto:user@example.com'
|
|
19
|
+
*/
|
|
20
|
+
export function safeUrl(url) {
|
|
21
|
+
if (!url || typeof url !== 'string') {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Trim whitespace
|
|
26
|
+
const trimmed = url.trim();
|
|
27
|
+
|
|
28
|
+
// Check for dangerous protocols
|
|
29
|
+
const dangerousProtocols = /^(javascript|data|vbscript|file|about):/i;
|
|
30
|
+
if (dangerousProtocols.test(trimmed)) {
|
|
31
|
+
console.warn(`[Security] Blocked dangerous URL: ${trimmed.slice(0, 50)}`);
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Allow safe protocols
|
|
36
|
+
const safeProtocols = /^(https?|mailto|tel|sms|ftp):/i;
|
|
37
|
+
if (safeProtocols.test(trimmed)) {
|
|
38
|
+
return trimmed;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Allow relative URLs (starting with / or .)
|
|
42
|
+
if (trimmed.startsWith('/') || trimmed.startsWith('.')) {
|
|
43
|
+
return trimmed;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Allow URLs without protocol (assume https)
|
|
47
|
+
if (/^www\./i.test(trimmed)) {
|
|
48
|
+
return `https://${trimmed}`;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// For other cases, check if it looks like a valid domain
|
|
52
|
+
// Allow alphanumeric, hyphens, dots, and common TLDs
|
|
53
|
+
if (/^[a-z0-9][a-z0-9.-]+\.[a-z]{2,}$/i.test(trimmed)) {
|
|
54
|
+
return `https://${trimmed}`;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// If we can't determine safety, return the original
|
|
58
|
+
// (Let the browser handle it, but log a warning)
|
|
59
|
+
console.warn(`[Security] Uncertain URL safety: ${trimmed.slice(0, 50)}`);
|
|
60
|
+
return trimmed;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Returns proper rel attribute for external links
|
|
65
|
+
* Adds security attributes for links opening in new windows
|
|
66
|
+
*
|
|
67
|
+
* @param {string} url - The URL to check
|
|
68
|
+
* @param {boolean} openInNewTab - Whether link opens in new tab
|
|
69
|
+
* @returns {string} - rel attribute value
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* getLinkRel('https://example.com', true) // 'noopener noreferrer'
|
|
73
|
+
* getLinkRel('mailto:user@example.com', false) // ''
|
|
74
|
+
*/
|
|
75
|
+
export function getLinkRel(url, openInNewTab = false) {
|
|
76
|
+
if (!url || typeof url !== 'string') {
|
|
77
|
+
return '';
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// Only add security attributes for http(s) links opening in new tabs
|
|
81
|
+
if (openInNewTab && /^https?:/i.test(url)) {
|
|
82
|
+
return 'noopener noreferrer';
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return '';
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Sanitizes HTML to prevent XSS
|
|
90
|
+
* Simple implementation that escapes dangerous characters
|
|
91
|
+
* For more complex needs, use DOMPurify
|
|
92
|
+
*
|
|
93
|
+
* @param {string} html - HTML string to sanitize
|
|
94
|
+
* @returns {string} - Sanitized HTML
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* sanitizeHtml('<script>alert(1)</script>') // '<script>alert(1)</script>'
|
|
98
|
+
*/
|
|
99
|
+
export function sanitizeHtml(html) {
|
|
100
|
+
if (!html || typeof html !== 'string') {
|
|
101
|
+
return '';
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return html
|
|
105
|
+
.replace(/&/g, '&')
|
|
106
|
+
.replace(/</g, '<')
|
|
107
|
+
.replace(/>/g, '>')
|
|
108
|
+
.replace(/"/g, '"')
|
|
109
|
+
.replace(/'/g, ''');
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Checks if a URL is external (different origin)
|
|
114
|
+
*
|
|
115
|
+
* @param {string} url - URL to check
|
|
116
|
+
* @param {string} currentOrigin - Current site origin (default: window.location.origin if available)
|
|
117
|
+
* @returns {boolean} - True if URL is external
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* isExternalUrl('https://example.com') // true (if on different domain)
|
|
121
|
+
* isExternalUrl('/about') // false
|
|
122
|
+
*/
|
|
123
|
+
export function isExternalUrl(url, currentOrigin = null) {
|
|
124
|
+
if (!url || typeof url !== 'string') {
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// Relative URLs are not external
|
|
129
|
+
if (url.startsWith('/') || url.startsWith('.') || url.startsWith('#')) {
|
|
130
|
+
return false;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// mailto:, tel:, etc. are not external in the HTTP sense
|
|
134
|
+
if (/^(mailto|tel|sms):/i.test(url)) {
|
|
135
|
+
return false;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// If no origin provided and we're in a browser, use window.location
|
|
139
|
+
if (!currentOrigin && typeof window !== 'undefined') {
|
|
140
|
+
currentOrigin = window.location.origin;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// If still no origin, we can't determine (assume external for safety)
|
|
144
|
+
if (!currentOrigin) {
|
|
145
|
+
return true;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
try {
|
|
149
|
+
const urlObj = new URL(url, currentOrigin);
|
|
150
|
+
return urlObj.origin !== currentOrigin;
|
|
151
|
+
} catch (e) {
|
|
152
|
+
// Invalid URL, treat as external for safety
|
|
153
|
+
return true;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* BackgroundPattern
|
|
4
|
+
* Background pattern overlay for visual interest
|
|
5
|
+
*/
|
|
6
|
+
import styled from 'styled-components';
|
|
7
|
+
|
|
8
|
+
const Pattern = styled.div`
|
|
9
|
+
position: absolute;
|
|
10
|
+
top: 0;
|
|
11
|
+
left: 0;
|
|
12
|
+
right: 0;
|
|
13
|
+
bottom: 0;
|
|
14
|
+
pointer-events: none;
|
|
15
|
+
opacity: ${(props) => props.$opacity || 0.05};
|
|
16
|
+
z-index: 0;
|
|
17
|
+
background-image: ${(props) => {
|
|
18
|
+
if (props.$pattern === 'dots') {
|
|
19
|
+
return `radial-gradient(circle, var(--resume-color-primary) 1px, transparent 1px)`;
|
|
20
|
+
}
|
|
21
|
+
if (props.$pattern === 'grid') {
|
|
22
|
+
return `
|
|
23
|
+
linear-gradient(var(--resume-color-border) 1px, transparent 1px),
|
|
24
|
+
linear-gradient(90deg, var(--resume-color-border) 1px, transparent 1px)
|
|
25
|
+
`;
|
|
26
|
+
}
|
|
27
|
+
if (props.$pattern === 'diagonal') {
|
|
28
|
+
return `repeating-linear-gradient(
|
|
29
|
+
45deg,
|
|
30
|
+
transparent,
|
|
31
|
+
transparent 10px,
|
|
32
|
+
var(--resume-color-border) 10px,
|
|
33
|
+
var(--resume-color-border) 11px
|
|
34
|
+
)`;
|
|
35
|
+
}
|
|
36
|
+
return 'none';
|
|
37
|
+
}};
|
|
38
|
+
background-size: ${(props) => {
|
|
39
|
+
if (props.$pattern === 'dots') return '20px 20px';
|
|
40
|
+
if (props.$pattern === 'grid') return '20px 20px';
|
|
41
|
+
return 'auto';
|
|
42
|
+
}};
|
|
43
|
+
|
|
44
|
+
@media print {
|
|
45
|
+
display: none;
|
|
46
|
+
}
|
|
47
|
+
`;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* @param {Object} props
|
|
51
|
+
* @param {string} [props.pattern='dots'] - Pattern type (dots, grid, diagonal)
|
|
52
|
+
* @param {number} [props.opacity=0.05] - Pattern opacity
|
|
53
|
+
* @param {string} [props.className] - Additional CSS classes
|
|
54
|
+
*/
|
|
55
|
+
export function BackgroundPattern({
|
|
56
|
+
pattern = 'dots',
|
|
57
|
+
opacity = 0.05,
|
|
58
|
+
className,
|
|
59
|
+
}) {
|
|
60
|
+
return (
|
|
61
|
+
<Pattern $pattern={pattern} $opacity={opacity} className={className} />
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export default BackgroundPattern;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* BackgroundPattern Stories
|
|
4
|
+
*/
|
|
5
|
+
import { BackgroundPattern } from './BackgroundPattern';
|
|
6
|
+
|
|
7
|
+
const meta = {
|
|
8
|
+
title: 'Resume Core/Visuals/BackgroundPattern',
|
|
9
|
+
component: BackgroundPattern,
|
|
10
|
+
parameters: { layout: 'padded' },
|
|
11
|
+
tags: ['autodocs'],
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export default meta;
|
|
15
|
+
|
|
16
|
+
export const Default = {
|
|
17
|
+
args: {
|
|
18
|
+
pattern: 'dots',
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const Example = {
|
|
23
|
+
args: {
|
|
24
|
+
pattern: 'grid',
|
|
25
|
+
opacity: 0.1,
|
|
26
|
+
},
|
|
27
|
+
};
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* BorderAccent
|
|
4
|
+
* Decorative border accent for sections
|
|
5
|
+
*/
|
|
6
|
+
import styled from 'styled-components';
|
|
7
|
+
|
|
8
|
+
const Container = styled.div`
|
|
9
|
+
position: relative;
|
|
10
|
+
padding: ${(props) => props.$padding || 'var(--resume-space-item)'};
|
|
11
|
+
border: ${(props) => {
|
|
12
|
+
const color = props.$color || 'var(--resume-color-accent)';
|
|
13
|
+
if (props.$position === 'all') return `2px solid ${color}`;
|
|
14
|
+
return 'none';
|
|
15
|
+
}};
|
|
16
|
+
border-left: ${(props) => {
|
|
17
|
+
if (props.$position === 'left' || props.$position === 'all') {
|
|
18
|
+
return `4px solid ${props.$color || 'var(--resume-color-accent)'}`;
|
|
19
|
+
}
|
|
20
|
+
return 'none';
|
|
21
|
+
}};
|
|
22
|
+
border-right: ${(props) => {
|
|
23
|
+
if (props.$position === 'right') {
|
|
24
|
+
return `4px solid ${props.$color || 'var(--resume-color-accent)'}`;
|
|
25
|
+
}
|
|
26
|
+
return 'none';
|
|
27
|
+
}};
|
|
28
|
+
border-top: ${(props) => {
|
|
29
|
+
if (props.$position === 'top' || props.$position === 'all') {
|
|
30
|
+
return `4px solid ${props.$color || 'var(--resume-color-accent)'}`;
|
|
31
|
+
}
|
|
32
|
+
return 'none';
|
|
33
|
+
}};
|
|
34
|
+
border-bottom: ${(props) => {
|
|
35
|
+
if (props.$position === 'bottom' || props.$position === 'all') {
|
|
36
|
+
return `4px solid ${props.$color || 'var(--resume-color-accent)'}`;
|
|
37
|
+
}
|
|
38
|
+
return 'none';
|
|
39
|
+
}};
|
|
40
|
+
border-radius: ${(props) =>
|
|
41
|
+
props.$rounded ? 'var(--resume-radius-md)' : '0'};
|
|
42
|
+
break-inside: avoid;
|
|
43
|
+
|
|
44
|
+
@media print {
|
|
45
|
+
-webkit-print-color-adjust: exact;
|
|
46
|
+
print-color-adjust: exact;
|
|
47
|
+
break-inside: avoid;
|
|
48
|
+
page-break-inside: avoid;
|
|
49
|
+
}
|
|
50
|
+
`;
|
|
51
|
+
|
|
52
|
+
const Corner = styled.div`
|
|
53
|
+
position: absolute;
|
|
54
|
+
width: 20px;
|
|
55
|
+
height: 20px;
|
|
56
|
+
border-color: ${(props) => props.$color || 'var(--resume-color-accent)'};
|
|
57
|
+
border-style: solid;
|
|
58
|
+
border-width: 0;
|
|
59
|
+
|
|
60
|
+
${(props) => {
|
|
61
|
+
if (props.$corner === 'top-left') {
|
|
62
|
+
return `
|
|
63
|
+
top: -2px;
|
|
64
|
+
left: -2px;
|
|
65
|
+
border-top-width: 3px;
|
|
66
|
+
border-left-width: 3px;
|
|
67
|
+
`;
|
|
68
|
+
}
|
|
69
|
+
if (props.$corner === 'top-right') {
|
|
70
|
+
return `
|
|
71
|
+
top: -2px;
|
|
72
|
+
right: -2px;
|
|
73
|
+
border-top-width: 3px;
|
|
74
|
+
border-right-width: 3px;
|
|
75
|
+
`;
|
|
76
|
+
}
|
|
77
|
+
if (props.$corner === 'bottom-left') {
|
|
78
|
+
return `
|
|
79
|
+
bottom: -2px;
|
|
80
|
+
left: -2px;
|
|
81
|
+
border-bottom-width: 3px;
|
|
82
|
+
border-left-width: 3px;
|
|
83
|
+
`;
|
|
84
|
+
}
|
|
85
|
+
if (props.$corner === 'bottom-right') {
|
|
86
|
+
return `
|
|
87
|
+
bottom: -2px;
|
|
88
|
+
right: -2px;
|
|
89
|
+
border-bottom-width: 3px;
|
|
90
|
+
border-right-width: 3px;
|
|
91
|
+
`;
|
|
92
|
+
}
|
|
93
|
+
}}
|
|
94
|
+
|
|
95
|
+
@media print {
|
|
96
|
+
-webkit-print-color-adjust: exact;
|
|
97
|
+
print-color-adjust: exact;
|
|
98
|
+
}
|
|
99
|
+
`;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* @param {Object} props
|
|
103
|
+
* @param {string|React.ReactNode} props.children - Content
|
|
104
|
+
* @param {string} [props.position='left'] - Border position (left, right, top, bottom, all, corners)
|
|
105
|
+
* @param {string} [props.color] - Border color
|
|
106
|
+
* @param {boolean} [props.rounded=false] - Apply border radius
|
|
107
|
+
* @param {string} [props.padding] - Custom padding
|
|
108
|
+
* @param {string} [props.className] - Additional CSS classes
|
|
109
|
+
*/
|
|
110
|
+
export function BorderAccent({
|
|
111
|
+
children,
|
|
112
|
+
position = 'left',
|
|
113
|
+
color,
|
|
114
|
+
rounded = false,
|
|
115
|
+
padding,
|
|
116
|
+
className,
|
|
117
|
+
}) {
|
|
118
|
+
if (position === 'corners') {
|
|
119
|
+
return (
|
|
120
|
+
<Container
|
|
121
|
+
$padding={padding}
|
|
122
|
+
className={className}
|
|
123
|
+
style={{ position: 'relative' }}
|
|
124
|
+
>
|
|
125
|
+
<Corner $corner="top-left" $color={color} />
|
|
126
|
+
<Corner $corner="top-right" $color={color} />
|
|
127
|
+
<Corner $corner="bottom-left" $color={color} />
|
|
128
|
+
<Corner $corner="bottom-right" $color={color} />
|
|
129
|
+
{children}
|
|
130
|
+
</Container>
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return (
|
|
135
|
+
<Container
|
|
136
|
+
$position={position}
|
|
137
|
+
$color={color}
|
|
138
|
+
$rounded={rounded}
|
|
139
|
+
$padding={padding}
|
|
140
|
+
className={className}
|
|
141
|
+
>
|
|
142
|
+
{children}
|
|
143
|
+
</Container>
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export default BorderAccent;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* BorderAccent Stories
|
|
4
|
+
*/
|
|
5
|
+
import { BorderAccent } from './BorderAccent';
|
|
6
|
+
|
|
7
|
+
const meta = {
|
|
8
|
+
title: 'Resume Core/Visuals/BorderAccent',
|
|
9
|
+
component: BorderAccent,
|
|
10
|
+
parameters: { layout: 'padded' },
|
|
11
|
+
tags: ['autodocs'],
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export default meta;
|
|
15
|
+
|
|
16
|
+
export const Default = {
|
|
17
|
+
args: {
|
|
18
|
+
side: 'left',
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const Example = {
|
|
23
|
+
args: {
|
|
24
|
+
side: 'top',
|
|
25
|
+
color: 'accent',
|
|
26
|
+
},
|
|
27
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* ColorBlock
|
|
4
|
+
* Colored block/section for visual hierarchy
|
|
5
|
+
*/
|
|
6
|
+
import styled from 'styled-components';
|
|
7
|
+
|
|
8
|
+
const Block = styled.div`
|
|
9
|
+
padding: var(--resume-space-section);
|
|
10
|
+
background-color: ${(props) => props.$color || 'var(--resume-color-muted)'};
|
|
11
|
+
border-radius: ${(props) =>
|
|
12
|
+
props.$rounded ? 'var(--resume-radius-md)' : '0'};
|
|
13
|
+
margin: ${(props) => props.$margin || 'var(--resume-space-section) 0'};
|
|
14
|
+
break-inside: avoid;
|
|
15
|
+
|
|
16
|
+
@media print {
|
|
17
|
+
-webkit-print-color-adjust: exact;
|
|
18
|
+
print-color-adjust: exact;
|
|
19
|
+
break-inside: avoid;
|
|
20
|
+
page-break-inside: avoid;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@media (max-width: 768px) {
|
|
24
|
+
padding: var(--resume-space-item);
|
|
25
|
+
}
|
|
26
|
+
`;
|
|
27
|
+
|
|
28
|
+
const Content = styled.div`
|
|
29
|
+
position: relative;
|
|
30
|
+
z-index: 1;
|
|
31
|
+
`;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* @param {Object} props
|
|
35
|
+
* @param {string|React.ReactNode} props.children - Block content
|
|
36
|
+
* @param {string} [props.color] - Background color
|
|
37
|
+
* @param {boolean} [props.rounded=false] - Apply border radius
|
|
38
|
+
* @param {string} [props.margin] - Custom margin
|
|
39
|
+
* @param {string} [props.className] - Additional CSS classes
|
|
40
|
+
*/
|
|
41
|
+
export function ColorBlock({
|
|
42
|
+
children,
|
|
43
|
+
color,
|
|
44
|
+
rounded = false,
|
|
45
|
+
margin,
|
|
46
|
+
className,
|
|
47
|
+
}) {
|
|
48
|
+
return (
|
|
49
|
+
<Block
|
|
50
|
+
$color={color}
|
|
51
|
+
$rounded={rounded}
|
|
52
|
+
$margin={margin}
|
|
53
|
+
className={className}
|
|
54
|
+
>
|
|
55
|
+
<Content>{children}</Content>
|
|
56
|
+
</Block>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export default ColorBlock;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* ColorBlock Stories
|
|
4
|
+
*/
|
|
5
|
+
import { ColorBlock } from './ColorBlock';
|
|
6
|
+
|
|
7
|
+
const meta = {
|
|
8
|
+
title: 'Resume Core/Visuals/ColorBlock',
|
|
9
|
+
component: ColorBlock,
|
|
10
|
+
parameters: { layout: 'padded' },
|
|
11
|
+
tags: ['autodocs'],
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export default meta;
|
|
15
|
+
|
|
16
|
+
export const Default = {
|
|
17
|
+
args: {
|
|
18
|
+
color: 'primary',
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const Example = {
|
|
23
|
+
args: {
|
|
24
|
+
color: 'accent',
|
|
25
|
+
children: 'Content with colored background',
|
|
26
|
+
},
|
|
27
|
+
};
|