@automattic/jetpack-components 0.41.1 → 0.42.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/CHANGELOG.md +23 -0
- package/components/boost-score-graph/background.tsx +183 -0
- package/components/boost-score-graph/day-highlight-plugin.ts +82 -0
- package/components/boost-score-graph/get-date-format.ts +59 -0
- package/components/boost-score-graph/index.native.js +1 -0
- package/components/boost-score-graph/index.tsx +76 -0
- package/components/boost-score-graph/style-tooltip.scss +52 -0
- package/components/boost-score-graph/style-uplot.scss +5 -0
- package/components/boost-score-graph/style.scss +17 -0
- package/components/boost-score-graph/tooltip.tsx +87 -0
- package/components/boost-score-graph/tooltips-plugin.ts +98 -0
- package/components/boost-score-graph/types/declarations.d.ts +4 -0
- package/components/boost-score-graph/uplot-line-chart.tsx +193 -0
- package/components/boost-score-graph/use-boost-score-transform.ts +36 -0
- package/components/boost-score-graph/use-resize.ts +40 -0
- package/components/gridicon/index.tsx +13 -0
- package/components/{pricing-slider → number-slider}/index.tsx +12 -12
- package/components/{pricing-slider → number-slider}/style.scss +8 -8
- package/components/{pricing-slider → number-slider}/types.ts +2 -2
- package/components/popover/index.tsx +19 -0
- package/components/popover/style.scss +25 -0
- package/components/product-price/index.tsx +5 -5
- package/components/product-price/style.module.scss +8 -1
- package/index.ts +3 -1
- package/package.json +6 -3
- package/.gitattributes +0 -8
- package/components/action-button/stories/index.stories.jsx +0 -38
- package/components/action-button/test/component.jsx +0 -16
- package/components/action-popover/stories/index.stories.jsx +0 -115
- package/components/action-popover/stories/styles.module.scss +0 -7
- package/components/admin-page/stories/index.stories.tsx +0 -35
- package/components/admin-page/stories/style.module.scss +0 -13
- package/components/admin-section/stories/index.stories.tsx +0 -60
- package/components/alert/stories/index.stories.jsx +0 -24
- package/components/automattic-byline-logo/stories/index.stories.tsx +0 -20
- package/components/automattic-byline-logo/test/component.tsx +0 -28
- package/components/boost-score-bar/stories/index.stories.tsx +0 -39
- package/components/boost-score-bar/test/component.tsx +0 -102
- package/components/button/stories/index.mdx +0 -90
- package/components/button/stories/index.stories.tsx +0 -400
- package/components/button/stories/style.module.scss +0 -20
- package/components/contextual-upgrade-trigger/stories/index.stories.tsx +0 -25
- package/components/decorative-card/stories/index.stories.tsx +0 -18
- package/components/dialog/stories/boost.png +0 -0
- package/components/dialog/stories/declaration.d.ts +0 -1
- package/components/dialog/stories/index.stories.tsx +0 -118
- package/components/dialog/stories/js-components.components.dialog.mdx +0 -62
- package/components/dialog/stories/js-components.components.dialog.stories.js +0 -37
- package/components/dialog/stories/style.module.scss +0 -21
- package/components/donut-meter/stories/index.stories.tsx +0 -51
- package/components/donut-meter/test/component.tsx +0 -24
- package/components/gridicon/stories/index.stories.tsx +0 -18
- package/components/icon-tooltip/stories/index.stories.tsx +0 -108
- package/components/icon-tooltip/stories/style.scss +0 -36
- package/components/icon-tooltip/test/component.tsx +0 -15
- package/components/icons/stories/index.stories.tsx +0 -65
- package/components/icons/stories/style.module.scss +0 -33
- package/components/indeterminate-progress-bar/stories/index.stories.tsx +0 -14
- package/components/jetpack-footer/stories/index.stories.tsx +0 -39
- package/components/jetpack-footer/test/__snapshots__/component.tsx.snap +0 -186
- package/components/jetpack-footer/test/component.tsx +0 -159
- package/components/jetpack-logo/stories/index.stories.tsx +0 -20
- package/components/jetpack-logo/test/component.tsx +0 -16
- package/components/jetpack-search-logo/stories/index.stories.tsx +0 -21
- package/components/jetpack-search-logo/test/component.tsx +0 -16
- package/components/jetpack-vaultpress-backup-logo/stories/index.stories.tsx +0 -20
- package/components/jetpack-vaultpress-backup-logo/test/component.tsx +0 -18
- package/components/jetpack-videopress-logo/stories/index.stories.tsx +0 -20
- package/components/jetpack-videopress-logo/test/component.tsx +0 -16
- package/components/layout/stories/index.stories.tsx +0 -145
- package/components/layout/stories/styles.module.scss +0 -22
- package/components/loading-placeholder/stories/index.stories.tsx +0 -78
- package/components/notice/stories/index.stories.jsx +0 -90
- package/components/pricing-card/stories/index.stories.tsx +0 -55
- package/components/pricing-card/test/component.tsx +0 -89
- package/components/pricing-slider/stories/index.stories.tsx +0 -44
- package/components/pricing-slider/test/component.tsx +0 -14
- package/components/pricing-table/stories/index.stories.tsx +0 -74
- package/components/pricing-table/test/component.tsx +0 -41
- package/components/product-offer/stories/index.stories.tsx +0 -104
- package/components/product-price/stories/index.stories.tsx +0 -33
- package/components/product-price/test/component.tsx +0 -26
- package/components/qr-code/stories/index.stories.tsx +0 -32
- package/components/record-meter-bar/stories/index.stories.tsx +0 -39
- package/components/record-meter-bar/test/component.tsx +0 -52
- package/components/spinner/stories/index.stories.jsx +0 -20
- package/components/spinner/test/component.jsx +0 -17
- package/components/split-button/stories/index.stories.tsx +0 -35
- package/components/stat-card/stories/index.mdx +0 -35
- package/components/stat-card/stories/index.stories.tsx +0 -41
- package/components/stat-card/test/component.tsx +0 -24
- package/components/status/stories/index.stories.tsx +0 -44
- package/components/terms-of-service/test/index.test.jsx +0 -52
- package/components/testimonials/test/component.tsx +0 -103
- package/components/text/stories/headings.index.stories.tsx +0 -80
- package/components/text/stories/index.mdx +0 -195
- package/components/text/stories/index.stories.tsx +0 -69
- package/components/text/stories/style.module.scss +0 -64
- package/components/text/stories/title.index.stories.tsx +0 -34
- package/components/theme-provider/stories/index.stories.tsx +0 -164
- package/components/theme-provider/stories/style.module.scss +0 -79
- package/components/toggle-control/stories/index.stories.tsx +0 -83
- package/components/zendesk-chat/stories/index.stories.tsx +0 -15
- package/components/zendesk-chat/test/component.tsx +0 -16
- package/lib/locale/test/index.ts +0 -21
- package/tools/jp-redirect/test/index.tsx +0 -89
- package/tools/pricing-utils/test/index.ts +0 -39
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { Meta, Source, Story } from '@storybook/blocks';
|
|
2
|
-
import dedent from 'ts-dedent';
|
|
3
|
-
import * as JsComponentsComponentsDialogStories from './js-components.components.dialog.stories';
|
|
4
|
-
|
|
5
|
-
<Meta of={JsComponentsComponentsDialogStories} />
|
|
6
|
-
|
|
7
|
-
# Dialog
|
|
8
|
-
|
|
9
|
-
Render a two-sections layout simple composition, built based on the primary <a href="?path=/docs/js-packages-components-layout--default">Layout component</a>.
|
|
10
|
-
|
|
11
|
-
<Source
|
|
12
|
-
language="jsx"
|
|
13
|
-
code={dedent`
|
|
14
|
-
import Dialog from '@automattic/jetpack-components';
|
|
15
|
-
// ...
|
|
16
|
-
|
|
17
|
-
<Dialog
|
|
18
|
-
primary={ <PrimaryComponent /> }
|
|
19
|
-
secondary={ <SecondaryComponent /> }
|
|
20
|
-
isTwoSections={ true }
|
|
21
|
-
/>
|
|
22
|
-
`}
|
|
23
|
-
/>
|
|
24
|
-
|
|
25
|
-
<Story of={JsComponentsComponentsDialogStories.Readme} />
|
|
26
|
-
|
|
27
|
-
The cols number for each section depends on the viewport width. The following table shows how they are defined:
|
|
28
|
-
|
|
29
|
-
| Small (sm) | Medium (md) | Large (lg)
|
|
30
|
-
------|------|------|-----
|
|
31
|
-
primary | 4 | 5 | 7
|
|
32
|
-
secondary | 4 | 3 | 5
|
|
33
|
-
|
|
34
|
-
Finally, when the Dialog is defined as not a two-sections layout (<a href="#istwosections">isTwoSections property</a>), the secondary section won't show in Mobile (sm breakpoint).
|
|
35
|
-
|
|
36
|
-
## API
|
|
37
|
-
|
|
38
|
-
The components accepts the following properties:
|
|
39
|
-
|
|
40
|
-
### primary
|
|
41
|
-
|
|
42
|
-
* Type: `React.ReactNode`, `string`.
|
|
43
|
-
|
|
44
|
-
Primary-section content.
|
|
45
|
-
|
|
46
|
-
### secondary
|
|
47
|
-
|
|
48
|
-
* Type: `React.ReactNode`, `string`.
|
|
49
|
-
* Optional.
|
|
50
|
-
|
|
51
|
-
Primary-section content.
|
|
52
|
-
|
|
53
|
-
### isTwoSections
|
|
54
|
-
|
|
55
|
-
* Type: `boolean`.
|
|
56
|
-
* Optional.
|
|
57
|
-
* Default: `false`
|
|
58
|
-
|
|
59
|
-
It handles two sections layout:
|
|
60
|
-
|
|
61
|
-
* Add card styles to the main wrapper when it is not a two-sections layout.
|
|
62
|
-
* When it's false, the secondary section won't show in Mobile.
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import Dialog from '../index';
|
|
2
|
-
import styles from './style.module.scss';
|
|
3
|
-
|
|
4
|
-
const Template = ( { isTwoSections } ) => (
|
|
5
|
-
<Dialog
|
|
6
|
-
primary={
|
|
7
|
-
<div className={ styles.section }>
|
|
8
|
-
<div>Primary</div>
|
|
9
|
-
<strong>4 | 5 | 7</strong>
|
|
10
|
-
</div>
|
|
11
|
-
}
|
|
12
|
-
secondary={
|
|
13
|
-
<div className={ styles.section }>
|
|
14
|
-
<div>Secondary</div>
|
|
15
|
-
<strong>4 | 3 | 5</strong>
|
|
16
|
-
<div>
|
|
17
|
-
isTwoSections: <strong>{ isTwoSections ? 'yes' : 'no' }</strong>
|
|
18
|
-
</div>
|
|
19
|
-
</div>
|
|
20
|
-
}
|
|
21
|
-
isTwoSections={ isTwoSections }
|
|
22
|
-
/>
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
export default {
|
|
26
|
-
title: 'JS Packages/Components/Dialog',
|
|
27
|
-
component: Dialog,
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export const Readme = {
|
|
31
|
-
render: Template.bind( {} ),
|
|
32
|
-
name: 'Readme',
|
|
33
|
-
|
|
34
|
-
args: {
|
|
35
|
-
isTwoSections: true,
|
|
36
|
-
},
|
|
37
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
.section {
|
|
3
|
-
display: flex;
|
|
4
|
-
padding: calc( var( --spacing-base ) * 6 ) 0;
|
|
5
|
-
border: 1px dotted var( --jp-green-60 );
|
|
6
|
-
box-sizing: border-box;
|
|
7
|
-
align-items: center;
|
|
8
|
-
color: var( --jp-white );
|
|
9
|
-
flex-wrap: nowrap;
|
|
10
|
-
flex-direction: column;
|
|
11
|
-
justify-content: space-between;
|
|
12
|
-
height: calc( var( --spacing-base ) * 20 );
|
|
13
|
-
flex-grow: 2;
|
|
14
|
-
background: repeating-linear-gradient(
|
|
15
|
-
-45deg,
|
|
16
|
-
var( --jp-green-50 ),
|
|
17
|
-
var( --jp-green-50 ) 20px,
|
|
18
|
-
var( --jp-green-60 ) 20px,
|
|
19
|
-
var( --jp-green-60 ) 40px
|
|
20
|
-
);
|
|
21
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import DonutMeter, { DonutMeterProps } from '../index';
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
title: 'JS Packages/Components/DonutMeter',
|
|
5
|
-
component: DonutMeter,
|
|
6
|
-
parameters: {
|
|
7
|
-
layout: 'centered',
|
|
8
|
-
},
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
const Template = args => <DonutMeter { ...args } />;
|
|
12
|
-
|
|
13
|
-
const DefaultArgs: DonutMeterProps = {
|
|
14
|
-
segmentCount: 16,
|
|
15
|
-
totalCount: 100,
|
|
16
|
-
thickness: '3.5',
|
|
17
|
-
donutWidth: '64px',
|
|
18
|
-
title: 'Meter title goes here',
|
|
19
|
-
description: 'Meter description goes here',
|
|
20
|
-
};
|
|
21
|
-
export const _Default = Template.bind( {} );
|
|
22
|
-
_Default.args = DefaultArgs;
|
|
23
|
-
|
|
24
|
-
const WarningArgs: DonutMeterProps = {
|
|
25
|
-
...DefaultArgs,
|
|
26
|
-
type: 'warning',
|
|
27
|
-
};
|
|
28
|
-
export const Warning = Template.bind( {} );
|
|
29
|
-
Warning.args = WarningArgs;
|
|
30
|
-
|
|
31
|
-
const DangerArgs: DonutMeterProps = {
|
|
32
|
-
...DefaultArgs,
|
|
33
|
-
type: 'danger',
|
|
34
|
-
};
|
|
35
|
-
export const Danger = Template.bind( {} );
|
|
36
|
-
Danger.args = DangerArgs;
|
|
37
|
-
|
|
38
|
-
export const AdaptiveColors = args => (
|
|
39
|
-
<div>
|
|
40
|
-
<div style={ { display: 'flex', flexFlow: 'row' } }>
|
|
41
|
-
<DonutMeter { ...args } segmentCount={ 0 } useAdaptiveColors />
|
|
42
|
-
<DonutMeter { ...args } segmentCount={ 20 } useAdaptiveColors />
|
|
43
|
-
<DonutMeter { ...args } segmentCount={ 40 } useAdaptiveColors />
|
|
44
|
-
<DonutMeter { ...args } segmentCount={ 60 } useAdaptiveColors />
|
|
45
|
-
<DonutMeter { ...args } segmentCount={ 80 } useAdaptiveColors />
|
|
46
|
-
<DonutMeter { ...args } segmentCount={ 100 } useAdaptiveColors />
|
|
47
|
-
</div>
|
|
48
|
-
<p>Color changing according to the fullness of the meter.</p>
|
|
49
|
-
</div>
|
|
50
|
-
);
|
|
51
|
-
AdaptiveColors.args = { ...DefaultArgs };
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { render, screen } from '@testing-library/react';
|
|
2
|
-
import DonutMeter, { DonutMeterProps } from '../index';
|
|
3
|
-
|
|
4
|
-
describe( 'DonutMeter', () => {
|
|
5
|
-
const testProps: DonutMeterProps = {
|
|
6
|
-
segmentCount: 18,
|
|
7
|
-
totalCount: 100,
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
it( 'renders the donut meter container', () => {
|
|
11
|
-
render( <DonutMeter { ...testProps } /> );
|
|
12
|
-
expect( screen.getByTestId( 'donut-meter' ) ).toBeInTheDocument();
|
|
13
|
-
} );
|
|
14
|
-
|
|
15
|
-
it( 'renders with the correct type class name', () => {
|
|
16
|
-
render( <DonutMeter { ...testProps } useAdaptiveColors type="warning" /> );
|
|
17
|
-
expect( screen.getByTestId( 'donut-meter' ) ).toHaveClass( 'is-warning' );
|
|
18
|
-
} );
|
|
19
|
-
|
|
20
|
-
it( 'overrides adaptive colors when an explicit type is specified', () => {
|
|
21
|
-
render( <DonutMeter { ...testProps } useAdaptiveColors type="danger" /> );
|
|
22
|
-
expect( screen.getByTestId( 'donut-meter' ) ).toHaveClass( 'is-danger' );
|
|
23
|
-
} );
|
|
24
|
-
} );
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import Gridicon from '../index';
|
|
2
|
-
import type { ComponentStory, ComponentMeta } from '@storybook/react';
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
title: 'JS Packages/Components/Gridicon',
|
|
6
|
-
component: Gridicon,
|
|
7
|
-
} as ComponentMeta< typeof Gridicon >;
|
|
8
|
-
|
|
9
|
-
// Export additional stories using pre-defined values
|
|
10
|
-
const Template: ComponentStory< typeof Gridicon > = args => <Gridicon { ...args } />;
|
|
11
|
-
|
|
12
|
-
// Export Default story
|
|
13
|
-
export const _default = Template.bind( {} );
|
|
14
|
-
|
|
15
|
-
export const InfoOutline = Template.bind( {} );
|
|
16
|
-
InfoOutline.args = {
|
|
17
|
-
icon: 'info-outline',
|
|
18
|
-
};
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import IconTooltip from '../index';
|
|
2
|
-
import './style.scss';
|
|
3
|
-
import type { Placement } from '../types';
|
|
4
|
-
|
|
5
|
-
const AVAILABLE_PLACEMENTS: Placement[] = [
|
|
6
|
-
'top',
|
|
7
|
-
'top-start',
|
|
8
|
-
'top-end',
|
|
9
|
-
'bottom',
|
|
10
|
-
'bottom-start',
|
|
11
|
-
'bottom-end',
|
|
12
|
-
];
|
|
13
|
-
|
|
14
|
-
export default {
|
|
15
|
-
title: 'JS Packages/Components/IconTooltip',
|
|
16
|
-
component: IconTooltip,
|
|
17
|
-
argTypes: {
|
|
18
|
-
className: {
|
|
19
|
-
control: { type: 'text' },
|
|
20
|
-
},
|
|
21
|
-
iconClassName: {
|
|
22
|
-
control: { type: 'text' },
|
|
23
|
-
},
|
|
24
|
-
placement: {
|
|
25
|
-
control: { type: 'select' },
|
|
26
|
-
options: AVAILABLE_PLACEMENTS,
|
|
27
|
-
},
|
|
28
|
-
animate: {
|
|
29
|
-
control: { type: 'boolean' },
|
|
30
|
-
},
|
|
31
|
-
iconCode: {
|
|
32
|
-
control: { type: 'text' },
|
|
33
|
-
},
|
|
34
|
-
iconSize: {
|
|
35
|
-
control: { type: 'number' },
|
|
36
|
-
},
|
|
37
|
-
offset: {
|
|
38
|
-
control: { type: 'number' },
|
|
39
|
-
},
|
|
40
|
-
title: {
|
|
41
|
-
control: { type: 'text' },
|
|
42
|
-
},
|
|
43
|
-
children: {
|
|
44
|
-
control: { type: null },
|
|
45
|
-
},
|
|
46
|
-
wide: {
|
|
47
|
-
control: { type: 'boolean' },
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
const Template = args => (
|
|
53
|
-
<div style={ { position: 'absolute', height: '1000px', left: '300px', top: '200px' } }>
|
|
54
|
-
<IconTooltip { ...args } />
|
|
55
|
-
</div>
|
|
56
|
-
);
|
|
57
|
-
|
|
58
|
-
const WrapperAnchorTemplate = args => (
|
|
59
|
-
<div style={ { position: 'absolute', height: '1000px', left: '300px', top: '300px' } }>
|
|
60
|
-
<div className="tooltip-wrapper">
|
|
61
|
-
<div className="tooltip-wrapper-anchor">
|
|
62
|
-
<IconTooltip { ...args }>
|
|
63
|
-
<>
|
|
64
|
-
<div>Thank you for upgrading! Now your visitors can search up to 500 records.</div>
|
|
65
|
-
<div className="tooltip-actions">
|
|
66
|
-
<span>1 of 2</span>
|
|
67
|
-
</div>
|
|
68
|
-
</>
|
|
69
|
-
</IconTooltip>
|
|
70
|
-
</div>
|
|
71
|
-
</div>
|
|
72
|
-
</div>
|
|
73
|
-
);
|
|
74
|
-
|
|
75
|
-
// Export Default story
|
|
76
|
-
export const _default = Template.bind( {} );
|
|
77
|
-
|
|
78
|
-
export const HasContent = Template.bind( {} );
|
|
79
|
-
HasContent.args = {
|
|
80
|
-
title: 'This is title!',
|
|
81
|
-
children: (
|
|
82
|
-
<div>
|
|
83
|
-
This is children block!<br></br>
|
|
84
|
-
<br></br>Break Line!
|
|
85
|
-
<br></br>
|
|
86
|
-
<ul>
|
|
87
|
-
<li>Item 1</li>
|
|
88
|
-
<li>Item 2</li>
|
|
89
|
-
</ul>
|
|
90
|
-
</div>
|
|
91
|
-
),
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
export const WrapperAnchor = WrapperAnchorTemplate.bind( {} );
|
|
95
|
-
WrapperAnchor.args = {
|
|
96
|
-
popoverAnchorStyle: 'wrapper',
|
|
97
|
-
title: 'Site records increased',
|
|
98
|
-
placement: 'top',
|
|
99
|
-
forceShow: true,
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
export const Wide = Template.bind( {} );
|
|
103
|
-
Wide.args = {
|
|
104
|
-
title: 'This is title!',
|
|
105
|
-
children: <div>This is a wide tooltip!</div>,
|
|
106
|
-
wide: true,
|
|
107
|
-
placement: 'bottom-start',
|
|
108
|
-
};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
.tooltip-wrapper-anchor {
|
|
2
|
-
position: absolute;
|
|
3
|
-
top: 0;
|
|
4
|
-
left: 0;
|
|
5
|
-
width: 64px;
|
|
6
|
-
height: 64px;
|
|
7
|
-
|
|
8
|
-
.icon-tooltip-wrapper {
|
|
9
|
-
width: 100%;
|
|
10
|
-
height: 100%;
|
|
11
|
-
|
|
12
|
-
// To overwrite `margin-bottom`
|
|
13
|
-
.icon-tooltip-title {
|
|
14
|
-
font-size: var( --font-title-small );
|
|
15
|
-
font-weight: 500;
|
|
16
|
-
margin-bottom: 16px;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
.icon-tooltip-helper {
|
|
21
|
-
width: 100%;
|
|
22
|
-
height: 100%;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.icon-tooltip-content {
|
|
26
|
-
font-size: var( --font-body );
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
.tooltip-actions {
|
|
30
|
-
display: flex;
|
|
31
|
-
align-items: center;
|
|
32
|
-
justify-content: space-between;
|
|
33
|
-
color: var( --jp-gray-60 );
|
|
34
|
-
margin-top: 24px;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { render, screen } from '@testing-library/react';
|
|
2
|
-
import IconTooltip from '../index';
|
|
3
|
-
import { IconTooltipProps } from '../types';
|
|
4
|
-
|
|
5
|
-
describe( 'IconTooltip', () => {
|
|
6
|
-
const testProps: IconTooltipProps = {
|
|
7
|
-
title: 'Title',
|
|
8
|
-
children: <div>Content block</div>,
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
it( 'renders the icon tooltip', () => {
|
|
12
|
-
render( <IconTooltip { ...testProps } /> );
|
|
13
|
-
expect( screen.getByTestId( 'icon-tooltip_wrapper' ) ).toBeInTheDocument();
|
|
14
|
-
} );
|
|
15
|
-
} );
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import * as allIcons from '../index';
|
|
2
|
-
import styles from './style.module.scss';
|
|
3
|
-
import type { ComponentStory, ComponentMeta } from '@storybook/react';
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
title: 'JS Packages/Components/Icons',
|
|
7
|
-
component: allIcons,
|
|
8
|
-
parameters: {},
|
|
9
|
-
} as ComponentMeta< typeof allIcons >;
|
|
10
|
-
|
|
11
|
-
const sizes = [
|
|
12
|
-
{
|
|
13
|
-
label: 'small',
|
|
14
|
-
value: '24',
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
label: 'medium',
|
|
18
|
-
value: '48',
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
label: 'large',
|
|
22
|
-
value: '72',
|
|
23
|
-
},
|
|
24
|
-
];
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Icons story components.
|
|
28
|
-
*
|
|
29
|
-
* @returns {object} - story component
|
|
30
|
-
*/
|
|
31
|
-
function IconsStory() {
|
|
32
|
-
return (
|
|
33
|
-
<div>
|
|
34
|
-
{ sizes.map( size => (
|
|
35
|
-
<div key={ size.label }>
|
|
36
|
-
<h3>{ size.label }</h3>
|
|
37
|
-
<div className={ styles[ 'icons-container' ] }>
|
|
38
|
-
{ Object.keys( allIcons ).map( key => {
|
|
39
|
-
const Icon = allIcons[ key ];
|
|
40
|
-
if ( ! Icon.displayName || 'getIconBySlug' === Icon.displayName ) {
|
|
41
|
-
return null;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
return (
|
|
45
|
-
<div
|
|
46
|
-
className={ `${ styles[ 'icon-wrapper' ] } ${ styles[ size.label ] }` }
|
|
47
|
-
key={ key }
|
|
48
|
-
>
|
|
49
|
-
<Icon size={ size.value } />
|
|
50
|
-
<span>{ Icon.displayName.replace( /icon/gi, '' ) }</span>
|
|
51
|
-
</div>
|
|
52
|
-
);
|
|
53
|
-
} ) }
|
|
54
|
-
</div>
|
|
55
|
-
</div>
|
|
56
|
-
) ) }
|
|
57
|
-
</div>
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
const Template: ComponentStory< typeof allIcons > = args => <IconsStory { ...args } />;
|
|
62
|
-
|
|
63
|
-
const DefaultArgs = {};
|
|
64
|
-
export const Default = Template.bind( {} );
|
|
65
|
-
Default.args = DefaultArgs;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
.icons-container {
|
|
2
|
-
display: flex;
|
|
3
|
-
flex-wrap: wrap;
|
|
4
|
-
margin-bottom: 20px;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
.icon-wrapper {
|
|
8
|
-
padding: 10px;
|
|
9
|
-
box-shadow: 0 0 1px inset rgba(0, 0, 0 , 0.5 );
|
|
10
|
-
background-color: white;
|
|
11
|
-
border-radius: 5px;
|
|
12
|
-
margin: 2px;
|
|
13
|
-
display: flex;
|
|
14
|
-
flex-direction: column;
|
|
15
|
-
align-items: center;
|
|
16
|
-
|
|
17
|
-
&.small {
|
|
18
|
-
font-size: 11px;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
&.medium {
|
|
22
|
-
font-size: 12px;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
&.large {
|
|
26
|
-
font-size: 14px;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
span {
|
|
30
|
-
margin-top: 10px;
|
|
31
|
-
color: #444;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import IndeterminateProgressBar from '..';
|
|
2
|
-
import type { ComponentStory, ComponentMeta } from '@storybook/react';
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
title: 'JS Packages/Components/Indeterminate Progress Bar',
|
|
6
|
-
component: IndeterminateProgressBar,
|
|
7
|
-
} as ComponentMeta< typeof IndeterminateProgressBar >;
|
|
8
|
-
|
|
9
|
-
const Template: ComponentStory< typeof IndeterminateProgressBar > = args => {
|
|
10
|
-
return <IndeterminateProgressBar { ...args } />;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export const _default = Template.bind( {} );
|
|
14
|
-
_default.args = {};
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import JetpackFooter from '../index';
|
|
2
|
-
import type { ComponentStory, ComponentMeta } from '@storybook/react';
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
title: 'JS Packages/Components/Jetpack Footer',
|
|
6
|
-
component: JetpackFooter,
|
|
7
|
-
} as ComponentMeta< typeof JetpackFooter >;
|
|
8
|
-
|
|
9
|
-
const Template: ComponentStory< typeof JetpackFooter > = args => <JetpackFooter { ...args } />;
|
|
10
|
-
|
|
11
|
-
const DefaultArgs = {
|
|
12
|
-
moduleName: 'Jetpack',
|
|
13
|
-
className: '',
|
|
14
|
-
moduleNameHref: 'https://jetpack.com',
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export const _default = Template.bind( {} );
|
|
18
|
-
_default.args = DefaultArgs;
|
|
19
|
-
|
|
20
|
-
export const WithMenu = Template.bind( {} );
|
|
21
|
-
WithMenu.args = {
|
|
22
|
-
...DefaultArgs,
|
|
23
|
-
menu: [
|
|
24
|
-
{
|
|
25
|
-
label: 'Menu Item',
|
|
26
|
-
href: '#',
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
label: 'External Menu Item',
|
|
30
|
-
href: '#',
|
|
31
|
-
target: '_blank',
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
label: 'Menu Item With Title',
|
|
35
|
-
title: 'Hello, World!',
|
|
36
|
-
href: '#',
|
|
37
|
-
},
|
|
38
|
-
],
|
|
39
|
-
};
|