@hubspot/cms-component-library 0.3.0 → 0.3.2
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/components/componentLibrary/Button/index.tsx +1 -1
- package/components/componentLibrary/Divider/StyleFields.tsx +72 -14
- package/components/componentLibrary/Divider/index.tsx +31 -16
- package/components/componentLibrary/Divider/llm.txt +97 -103
- package/components/componentLibrary/Divider/stories/Divider.stories.tsx +30 -19
- package/components/componentLibrary/Divider/types.ts +31 -20
- package/components/componentLibrary/Flex/index.module.scss +4 -6
- package/components/componentLibrary/Flex/llm.txt +5 -7
- package/components/componentLibrary/Flex/types.ts +0 -4
- package/components/componentLibrary/Icon/StyleFields.tsx +69 -0
- package/components/componentLibrary/Icon/index.module.scss +2 -2
- package/components/componentLibrary/Icon/index.tsx +6 -2
- package/components/componentLibrary/Icon/llm.txt +7 -6
- package/components/componentLibrary/Icon/stories/Icon.stories.tsx +11 -11
- package/components/componentLibrary/Icon/stories/IconDecorator.module.scss +1 -2
- package/components/componentLibrary/Icon/types.ts +26 -1
- package/components/componentLibrary/Text/ContentFields.tsx +66 -0
- package/components/componentLibrary/Text/index.module.scss +3 -0
- package/components/componentLibrary/Text/index.tsx +27 -0
- package/components/componentLibrary/Text/llm.txt +170 -0
- package/components/componentLibrary/Text/types.ts +16 -0
- package/components/componentLibrary/_patterns/css-patterns.md +7 -18
- package/package.json +4 -4
- package/components/componentLibrary/Divider/ContentFields.tsx +0 -63
- package/components/componentLibrary/Heading/ContentFields.tsx +0 -37
- package/components/componentLibrary/Heading/StyleFields.tsx +0 -40
- package/components/componentLibrary/Heading/index.module.scss +0 -11
- package/components/componentLibrary/Heading/index.tsx +0 -52
- package/components/componentLibrary/Heading/llm.txt +0 -175
- package/components/componentLibrary/Heading/stories/Heading.stories.tsx +0 -88
- package/components/componentLibrary/Heading/stories/HeadingDecorator.module.scss +0 -47
- package/components/componentLibrary/Heading/stories/HeadingDecorator.tsx +0 -8
- package/components/componentLibrary/Heading/types.ts +0 -35
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
import Heading from '../index.js';
|
|
3
|
-
import { HeadingProps } from '../types.js';
|
|
4
|
-
import { withHeadingStyles } from './HeadingDecorator.js';
|
|
5
|
-
import { SBContainer } from '@sb-utils/SBContainer.js';
|
|
6
|
-
|
|
7
|
-
const meta: Meta<HeadingProps> = {
|
|
8
|
-
title: 'Component Library/Heading',
|
|
9
|
-
component: Heading,
|
|
10
|
-
parameters: {
|
|
11
|
-
layout: 'centered',
|
|
12
|
-
docs: {
|
|
13
|
-
description: {
|
|
14
|
-
component: `The Heading component provides a flexible and accessible way to render semantic HTML headings (h1-h6) with customizable visual styles through the displayAs prop.`,
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
decorators: [withHeadingStyles],
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export default meta;
|
|
22
|
-
type Story = StoryObj<typeof meta>;
|
|
23
|
-
|
|
24
|
-
export const Default: Story = {
|
|
25
|
-
args: {
|
|
26
|
-
headingLevel: 'h2',
|
|
27
|
-
children: 'A clear and bold heading',
|
|
28
|
-
},
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
export const AllHeadingLevels: Story = {
|
|
32
|
-
name: 'All Heading Levels',
|
|
33
|
-
render: () => (
|
|
34
|
-
<SBContainer flex direction="column" gap="large">
|
|
35
|
-
<SBContainer addBackground>
|
|
36
|
-
<p>
|
|
37
|
-
Each heading level has different semantic meaning and default styling
|
|
38
|
-
</p>
|
|
39
|
-
<Heading headingLevel="h1">Heading Level 1</Heading>
|
|
40
|
-
<Heading headingLevel="h2">Heading Level 2</Heading>
|
|
41
|
-
<Heading headingLevel="h3">Heading Level 3</Heading>
|
|
42
|
-
<Heading headingLevel="h4">Heading Level 4</Heading>
|
|
43
|
-
<Heading headingLevel="h5">Heading Level 5</Heading>
|
|
44
|
-
<Heading headingLevel="h6">Heading Level 6</Heading>
|
|
45
|
-
</SBContainer>
|
|
46
|
-
</SBContainer>
|
|
47
|
-
),
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
export const TextAlignment: Story = {
|
|
51
|
-
name: 'Text Alignment',
|
|
52
|
-
render: () => (
|
|
53
|
-
<SBContainer flex direction="column" gap="large" minWidth="500px">
|
|
54
|
-
<SBContainer addBackground>
|
|
55
|
-
<Heading headingLevel="h2" textAlign="LEFT">
|
|
56
|
-
Left Aligned
|
|
57
|
-
</Heading>
|
|
58
|
-
</SBContainer>
|
|
59
|
-
<SBContainer addBackground>
|
|
60
|
-
<Heading headingLevel="h2" textAlign="CENTER">
|
|
61
|
-
Center Aligned
|
|
62
|
-
</Heading>
|
|
63
|
-
</SBContainer>
|
|
64
|
-
<SBContainer addBackground>
|
|
65
|
-
<Heading headingLevel="h2" textAlign="RIGHT">
|
|
66
|
-
Right Aligned
|
|
67
|
-
</Heading>
|
|
68
|
-
</SBContainer>
|
|
69
|
-
</SBContainer>
|
|
70
|
-
),
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
export const LongText: Story = {
|
|
74
|
-
name: 'Long Text',
|
|
75
|
-
render: () => (
|
|
76
|
-
<SBContainer flex direction="column" gap="large" maxWidth="500px">
|
|
77
|
-
<SBContainer addBackground>
|
|
78
|
-
<h4>Long Heading Text</h4>
|
|
79
|
-
<p>Headings should handle long text gracefully</p>
|
|
80
|
-
<Heading headingLevel="h2">
|
|
81
|
-
This is a very long heading that demonstrates how the component
|
|
82
|
-
handles extensive text content that may wrap across multiple lines in
|
|
83
|
-
the layout
|
|
84
|
-
</Heading>
|
|
85
|
-
</SBContainer>
|
|
86
|
-
</SBContainer>
|
|
87
|
-
),
|
|
88
|
-
};
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
.decoratorContainer {
|
|
2
|
-
padding: 20px;
|
|
3
|
-
--hscl-heading-h1-font: Arial, sans-serif;
|
|
4
|
-
--hscl-heading-h1-fontSize: 48px;
|
|
5
|
-
--hscl-heading-h1-fontStyle: normal;
|
|
6
|
-
--hscl-heading-h1-fontWeight: 700;
|
|
7
|
-
--hscl-heading-h2-font: Arial, sans-serif;
|
|
8
|
-
--hscl-heading-h2-fontSize: 36px;
|
|
9
|
-
--hscl-heading-h2-fontStyle: normal;
|
|
10
|
-
--hscl-heading-h2-fontWeight: 600;
|
|
11
|
-
--hscl-heading-h3-font: Arial, sans-serif;
|
|
12
|
-
--hscl-heading-h3-fontSize: 28px;
|
|
13
|
-
--hscl-heading-h3-fontStyle: normal;
|
|
14
|
-
--hscl-heading-h3-fontWeight: 600;
|
|
15
|
-
--hscl-heading-h4-font: Arial, sans-serif;
|
|
16
|
-
--hscl-heading-h4-fontSize: 24px;
|
|
17
|
-
--hscl-heading-h4-fontStyle: normal;
|
|
18
|
-
--hscl-heading-h4-fontWeight: 500;
|
|
19
|
-
--hscl-heading-h5-font: Arial, sans-serif;
|
|
20
|
-
--hscl-heading-h5-fontSize: 20px;
|
|
21
|
-
--hscl-heading-h5-fontStyle: normal;
|
|
22
|
-
--hscl-heading-h5-fontWeight: 500;
|
|
23
|
-
--hscl-heading-h6-font: Arial, sans-serif;
|
|
24
|
-
--hscl-heading-h6-fontSize: 16px;
|
|
25
|
-
--hscl-heading-h6-fontStyle: normal;
|
|
26
|
-
--hscl-heading-h6-fontWeight: 500;
|
|
27
|
-
--hscl-heading-display_1-font: Arial, sans-serif;
|
|
28
|
-
--hscl-heading-display_1-fontSize: 72px;
|
|
29
|
-
--hscl-heading-display_1-fontStyle: normal;
|
|
30
|
-
--hscl-heading-display_1-fontWeight: 800;
|
|
31
|
-
--hscl-heading-display_2-font: Arial, sans-serif;
|
|
32
|
-
--hscl-heading-display_2-fontSize: 60px;
|
|
33
|
-
--hscl-heading-display_2-fontStyle: normal;
|
|
34
|
-
--hscl-heading-display_2-fontWeight: 800;
|
|
35
|
-
--hscl-heading-lineHeight: 1.2;
|
|
36
|
-
--hscl-heading-margin: 0;
|
|
37
|
-
--hscl-heading-color: #2d3e50;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
.decoratorContainer h1,
|
|
41
|
-
.decoratorContainer h2,
|
|
42
|
-
.decoratorContainer h3,
|
|
43
|
-
.decoratorContainer h4,
|
|
44
|
-
.decoratorContainer h5,
|
|
45
|
-
.decoratorContainer h6 {
|
|
46
|
-
margin-bottom: 1rem;
|
|
47
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
AlignmentFieldDefaults,
|
|
3
|
-
TextFieldDefaults,
|
|
4
|
-
} from '@hubspot/cms-components/fields';
|
|
5
|
-
|
|
6
|
-
export type HeadingLevel = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
7
|
-
|
|
8
|
-
export type DisplayAs = HeadingLevel | 'display_1' | 'display_2';
|
|
9
|
-
|
|
10
|
-
export type HeadingProps = {
|
|
11
|
-
headingLevel: HeadingLevel;
|
|
12
|
-
displayAs?: DisplayAs;
|
|
13
|
-
textAlign?: (typeof AlignmentFieldDefaults)['horizontal_align'];
|
|
14
|
-
className?: string;
|
|
15
|
-
style?: React.CSSProperties;
|
|
16
|
-
children?: React.ReactNode;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export type ContentFieldsProps = {
|
|
20
|
-
headingTextLabel?: string;
|
|
21
|
-
headingTextName?: string;
|
|
22
|
-
headingTextDefault?: typeof TextFieldDefaults;
|
|
23
|
-
headingLevelLabel?: string;
|
|
24
|
-
headingLevelName?: string;
|
|
25
|
-
headingLevelDefault?: HeadingLevel;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export type StyleFieldsProps = {
|
|
29
|
-
textAlignLabel?: string;
|
|
30
|
-
textAlignName?: string;
|
|
31
|
-
textAlignDefault?: (typeof AlignmentFieldDefaults)['horizontal_align'];
|
|
32
|
-
displayAsLabel?: string;
|
|
33
|
-
displayAsName?: string;
|
|
34
|
-
displayAsDefault?: DisplayAs;
|
|
35
|
-
};
|