@scm-manager/ui-components 2.25.1-20211003-143409 → 2.26.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/package.json +10 -8
- package/src/Autocomplete.tsx +6 -6
- package/src/BranchSelector.stories.tsx +1 -1
- package/src/Breadcrumb.tsx +4 -1
- package/src/CardColumn.stories.tsx +2 -2
- package/src/CardColumn.tsx +1 -2
- package/src/HelpIcon.tsx +3 -1
- package/src/Icon.stories.tsx +3 -3
- package/src/Notification.stories.tsx +1 -1
- package/src/Paginator.test.tsx +16 -16
- package/src/ProtectedRoute.tsx +3 -3
- package/src/Tag.tsx +1 -1
- package/src/__resources__/Diff.markdown.ts +19 -21
- package/src/__resources__/changesets.tsx +73 -109
- package/src/__resources__/repository.ts +8 -8
- package/src/__snapshots__/storyshots.test.ts.snap +71237 -71286
- package/src/buttons/Button.tsx +63 -74
- package/src/buttons/ButtonAddons.tsx +1 -1
- package/src/buttons/ButtonGroup.tsx +1 -1
- package/src/buttons/SubmitButton.tsx +1 -1
- package/src/buttons/index.stories.tsx +5 -6
- package/src/comparators.test.ts +6 -6
- package/src/comparators.ts +1 -1
- package/src/devBuild.ts +1 -1
- package/src/forms/AddKeyValueEntryToTableField.stories.tsx +1 -1
- package/src/forms/AutocompleteAddEntryToTableField.tsx +1 -1
- package/src/forms/Checkbox.stories.tsx +4 -4
- package/src/forms/DropDown.stories.tsx +4 -4
- package/src/forms/DropDown.tsx +1 -1
- package/src/forms/FileInput.stories.tsx +1 -1
- package/src/forms/FilterInput.tsx +1 -1
- package/src/forms/InputField.stories.tsx +1 -1
- package/src/forms/MemberNameTagGroup.tsx +3 -3
- package/src/forms/PasswordConfirmation.tsx +4 -4
- package/src/forms/Radio.stories.tsx +2 -2
- package/src/forms/Select.stories.tsx +4 -5
- package/src/forms/Textarea.stories.tsx +1 -1
- package/src/languages.ts +1 -1
- package/src/layout/Footer.stories.tsx +3 -3
- package/src/layout/SecondaryNavigationColumn.tsx +1 -1
- package/src/layout/Title.tsx +2 -2
- package/src/markdown/MarkdownCodeRenderer.tsx +1 -1
- package/src/markdown/MarkdownHeadingRenderer.tsx +2 -2
- package/src/markdown/MarkdownLinkRenderer.test.tsx +1 -1
- package/src/markdown/MarkdownLinkRenderer.tsx +1 -1
- package/src/markdown/MarkdownView.stories.tsx +4 -4
- package/src/markdown/MarkdownView.tsx +9 -9
- package/src/markdown/createComponentList.ts +1 -1
- package/src/markdown/createMdastPlugin.ts +1 -1
- package/src/markdown/markdownExtensions.ts +1 -1
- package/src/markdown/remarkChangesetShortLinkParser.ts +7 -7
- package/src/markdown/remarkToRehypeRendererAdapters.ts +10 -9
- package/src/modals/ConfirmAlert.stories.tsx +5 -5
- package/src/modals/ConfirmAlert.tsx +2 -2
- package/src/modals/CreateTagModal.tsx +4 -4
- package/src/modals/Modal.stories.tsx +1 -1
- package/src/navigation/MenuContext.tsx +2 -2
- package/src/navigation/NavAction.tsx +3 -3
- package/src/navigation/SecondaryNavigation.stories.tsx +4 -4
- package/src/navigation/SubNavigation.tsx +2 -2
- package/src/popover/Popover.stories.tsx +37 -35
- package/src/popover/usePopover.ts +10 -10
- package/src/repos/Diff.stories.tsx +1 -1
- package/src/repos/DiffExpander.test.ts +39 -41
- package/src/repos/DiffExpander.ts +10 -10
- package/src/repos/RepositoryEntry.stories.tsx +1 -1
- package/src/repos/RepositoryFlag.tsx +1 -1
- package/src/repos/Tokenize.worker.ts +3 -3
- package/src/repos/TokenizedDiffView.tsx +1 -1
- package/src/repos/annotate/Annotate.stories.tsx +29 -29
- package/src/repos/changesets/ChangesetAuthor.tsx +4 -4
- package/src/repos/changesets/ChangesetDescription.tsx +2 -2
- package/src/repos/changesets/ChangesetDiff.test.ts +18 -18
- package/src/repos/changesets/ChangesetId.tsx +1 -1
- package/src/repos/changesets/ChangesetList.tsx +1 -1
- package/src/repos/changesets/ChangesetTagsCollapsed.tsx +1 -1
- package/src/repos/changesets/Changesets.stories.tsx +185 -142
- package/src/repos/changesets/SignatureIcon.tsx +4 -4
- package/src/repos/changesets/changesets.ts +1 -1
- package/src/repos/diffs.test.ts +3 -3
- package/src/repos/refractorAdapter.ts +3 -3
- package/src/repositories.test.ts +18 -18
- package/src/storyshots.test.ts +3 -3
- package/src/syntax-highlighting.module.css +17 -16
- package/src/syntax-highlighting.ts +59 -54
- package/src/table/Table.stories.tsx +7 -7
- package/src/table/Table.tsx +1 -1
- package/src/table/TextColumn.tsx +1 -1
- package/src/textSplitAndReplace.test.ts +3 -3
- package/src/textSplitAndReplace.ts +2 -2
- package/src/toast/Toast.tsx +2 -2
- package/src/toast/index.stories.tsx +2 -2
- package/src/toast/themes.ts +6 -6
- package/src/useDateFormatter.ts +3 -3
- package/src/validation.test.ts +6 -6
- package/src/validation.ts +1 -4
|
@@ -85,7 +85,7 @@ const MarkdownErrorNotification: FC = () => {
|
|
|
85
85
|
</pre>
|
|
86
86
|
<p>
|
|
87
87
|
{t("markdownErrorNotification.spec")}:{" "}
|
|
88
|
-
<a href="https://github.github.com/gfm/" target="_blank">
|
|
88
|
+
<a href="https://github.github.com/gfm/" target="_blank" rel="noreferrer">
|
|
89
89
|
GitHub Flavored Markdown Spec
|
|
90
90
|
</a>
|
|
91
91
|
</p>
|
|
@@ -99,13 +99,13 @@ class MarkdownView extends React.Component<Props, State> {
|
|
|
99
99
|
|
|
100
100
|
static defaultProps: Partial<Props> = {
|
|
101
101
|
enableAnchorHeadings: false,
|
|
102
|
-
skipHtml: false
|
|
102
|
+
skipHtml: false,
|
|
103
103
|
};
|
|
104
104
|
|
|
105
105
|
constructor(props: Props) {
|
|
106
106
|
super(props);
|
|
107
107
|
this.state = {
|
|
108
|
-
contentRef: null
|
|
108
|
+
contentRef: null,
|
|
109
109
|
};
|
|
110
110
|
}
|
|
111
111
|
|
|
@@ -143,7 +143,7 @@ class MarkdownView extends React.Component<Props, State> {
|
|
|
143
143
|
basePath,
|
|
144
144
|
permalink,
|
|
145
145
|
t,
|
|
146
|
-
mdastPlugins = []
|
|
146
|
+
mdastPlugins = [],
|
|
147
147
|
} = this.props;
|
|
148
148
|
|
|
149
149
|
const rendererFactory = this.context.getExtension("markdown-renderer-factory");
|
|
@@ -200,25 +200,25 @@ class MarkdownView extends React.Component<Props, State> {
|
|
|
200
200
|
sanitize,
|
|
201
201
|
merge(gh, {
|
|
202
202
|
attributes: {
|
|
203
|
-
code: ["className"] // Allow className for code elements, this is necessary to extract the code language
|
|
203
|
+
code: ["className"], // Allow className for code elements, this is necessary to extract the code language
|
|
204
204
|
},
|
|
205
205
|
clobberPrefix: "", // Do not prefix user-provided ids and class names,
|
|
206
206
|
protocols: {
|
|
207
|
-
href: Object.keys(protocolLinkRendererExtensions)
|
|
208
|
-
}
|
|
207
|
+
href: Object.keys(protocolLinkRendererExtensions),
|
|
208
|
+
},
|
|
209
209
|
})
|
|
210
210
|
)
|
|
211
211
|
.use(rehype2react, {
|
|
212
212
|
createElement: React.createElement,
|
|
213
213
|
passNode: true,
|
|
214
|
-
components: createComponentList(remarkRendererList, { permalink })
|
|
214
|
+
components: createComponentList(remarkRendererList, { permalink }),
|
|
215
215
|
});
|
|
216
216
|
|
|
217
217
|
const renderedMarkdown: any = processor.processSync(content).result;
|
|
218
218
|
|
|
219
219
|
return (
|
|
220
220
|
<ErrorBoundary fallback={MarkdownErrorNotification}>
|
|
221
|
-
<div ref={el => this.setState({ contentRef: el })} className="content is-word-break">
|
|
221
|
+
<div ref={(el) => this.setState({ contentRef: el })} className="content is-word-break">
|
|
222
222
|
{renderedMarkdown}
|
|
223
223
|
</div>
|
|
224
224
|
</ErrorBoundary>
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
import {
|
|
25
25
|
createRemark2RehypeCodeRendererAdapter,
|
|
26
26
|
createRemark2RehypeHeadingRendererAdapterFactory,
|
|
27
|
-
createRemark2RehypeLinkRendererAdapter
|
|
27
|
+
createRemark2RehypeLinkRendererAdapter,
|
|
28
28
|
} from "./remarkToRehypeRendererAdapters";
|
|
29
29
|
|
|
30
30
|
export type CreateComponentListOptions = {
|
|
@@ -34,7 +34,7 @@ export default function createMdastPlugin(plugin: AstPlugin): any {
|
|
|
34
34
|
return function attach() {
|
|
35
35
|
return function transform(tree: any) {
|
|
36
36
|
plugin({
|
|
37
|
-
visit: (type, visitor) => visit(tree, type, visitor)
|
|
37
|
+
visit: (type, visitor) => visit(tree, type, visitor),
|
|
38
38
|
});
|
|
39
39
|
return tree;
|
|
40
40
|
};
|
|
@@ -59,7 +59,7 @@ export const createTransformer = (t: TFunction): AstPlugin => {
|
|
|
59
59
|
if (i > 0) {
|
|
60
60
|
children.push({
|
|
61
61
|
type: "text",
|
|
62
|
-
value: nodeText.substring(0, i)
|
|
62
|
+
value: nodeText.substring(0, i),
|
|
63
63
|
});
|
|
64
64
|
}
|
|
65
65
|
|
|
@@ -69,14 +69,14 @@ export const createTransformer = (t: TFunction): AstPlugin => {
|
|
|
69
69
|
title: t("changeset.shortlink.title", {
|
|
70
70
|
namespace: m[1],
|
|
71
71
|
name: m[2],
|
|
72
|
-
id: m[3]
|
|
72
|
+
id: m[3],
|
|
73
73
|
}),
|
|
74
74
|
children: [
|
|
75
75
|
{
|
|
76
76
|
type: "text",
|
|
77
|
-
value: m[0]
|
|
78
|
-
}
|
|
79
|
-
]
|
|
77
|
+
value: m[0],
|
|
78
|
+
},
|
|
79
|
+
],
|
|
80
80
|
});
|
|
81
81
|
|
|
82
82
|
nodeText = nodeText.substring(i + m[0].length);
|
|
@@ -85,13 +85,13 @@ export const createTransformer = (t: TFunction): AstPlugin => {
|
|
|
85
85
|
if (nodeText.length > 0) {
|
|
86
86
|
children.push({
|
|
87
87
|
type: "text",
|
|
88
|
-
value: nodeText
|
|
88
|
+
value: nodeText,
|
|
89
89
|
});
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
parent.children[index] = {
|
|
93
93
|
type: "text",
|
|
94
|
-
children
|
|
94
|
+
children,
|
|
95
95
|
};
|
|
96
96
|
}
|
|
97
97
|
});
|
|
@@ -28,7 +28,7 @@ export const createRemark2RehypeCodeRendererAdapter = (remarkRenderer: any) => {
|
|
|
28
28
|
children = children || [];
|
|
29
29
|
const renderProps = {
|
|
30
30
|
value: children[0],
|
|
31
|
-
language: Array.isArray(node.properties.className) ? node.properties.className[0].split("language-")[1] : ""
|
|
31
|
+
language: Array.isArray(node.properties.className) ? node.properties.className[0].split("language-")[1] : "",
|
|
32
32
|
};
|
|
33
33
|
return React.createElement(remarkRenderer, renderProps, ...children);
|
|
34
34
|
};
|
|
@@ -54,13 +54,14 @@ export const createRemark2RehypeLinkRendererAdapter = (remarkRenderer: any) => {
|
|
|
54
54
|
};
|
|
55
55
|
|
|
56
56
|
export const createRemark2RehypeHeadingRendererAdapterFactory = (remarkRenderer: any, permalink?: string) => {
|
|
57
|
-
return (level: number) =>
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
57
|
+
return (level: number) =>
|
|
58
|
+
({ node, children }: any) => {
|
|
59
|
+
const renderProps = {
|
|
60
|
+
id: node.properties.id,
|
|
61
|
+
level,
|
|
62
|
+
permalink,
|
|
63
|
+
};
|
|
64
|
+
children = children || [];
|
|
65
|
+
return React.createElement(remarkRenderer, renderProps, ...children);
|
|
62
66
|
};
|
|
63
|
-
children = children || [];
|
|
64
|
-
return React.createElement(remarkRenderer, renderProps, ...children);
|
|
65
|
-
};
|
|
66
67
|
};
|
|
@@ -37,15 +37,15 @@ const buttons = [
|
|
|
37
37
|
{
|
|
38
38
|
className: "is-outlined",
|
|
39
39
|
label: "Cancel",
|
|
40
|
-
onClick: () => null
|
|
40
|
+
onClick: () => null,
|
|
41
41
|
},
|
|
42
42
|
{
|
|
43
|
-
label: "Submit"
|
|
44
|
-
}
|
|
43
|
+
label: "Submit",
|
|
44
|
+
},
|
|
45
45
|
];
|
|
46
46
|
|
|
47
|
-
storiesOf("Modal
|
|
48
|
-
.addDecorator(story => <MemoryRouter initialEntries={["/"]}>{story()}</MemoryRouter>)
|
|
47
|
+
storiesOf("Modal/ConfirmAlert", module)
|
|
48
|
+
.addDecorator((story) => <MemoryRouter initialEntries={["/"]}>{story()}</MemoryRouter>)
|
|
49
49
|
.add("Default", () => <ConfirmAlert message={body} title={"Are you sure about that?"} buttons={buttons} />)
|
|
50
50
|
.add("WithButton", () => {
|
|
51
51
|
const buttonClick = () => {
|
|
@@ -65,13 +65,13 @@ export const ConfirmAlert: FC<Props> = ({ title, message, buttons, close }) => {
|
|
|
65
65
|
<div className="field is-grouped">
|
|
66
66
|
{buttons.map((button, index) => (
|
|
67
67
|
<p className="control" key={index}>
|
|
68
|
-
<
|
|
68
|
+
<button
|
|
69
69
|
className={classNames("button", "is-info", button.className, button.isLoading ? "is-loading" : "")}
|
|
70
70
|
key={index}
|
|
71
71
|
onClick={() => handleClickButton(button)}
|
|
72
72
|
>
|
|
73
73
|
{button.label}
|
|
74
|
-
</
|
|
74
|
+
</button>
|
|
75
75
|
</p>
|
|
76
76
|
))}
|
|
77
77
|
</div>
|
|
@@ -48,8 +48,8 @@ const CreateTagModal: FC<Props> = ({ t, onClose, tagCreationLink, existingTagsLi
|
|
|
48
48
|
useEffect(() => {
|
|
49
49
|
apiClient
|
|
50
50
|
.get(existingTagsLink)
|
|
51
|
-
.then(response => response.json())
|
|
52
|
-
.then(json => setTagNames(json._embedded.tags.map((tag: Tag) => tag.name)));
|
|
51
|
+
.then((response) => response.json())
|
|
52
|
+
.then((json) => setTagNames(json._embedded.tags.map((tag: Tag) => tag.name)));
|
|
53
53
|
}, [existingTagsLink]);
|
|
54
54
|
|
|
55
55
|
const createTag = () => {
|
|
@@ -57,7 +57,7 @@ const CreateTagModal: FC<Props> = ({ t, onClose, tagCreationLink, existingTagsLi
|
|
|
57
57
|
apiClient
|
|
58
58
|
.post(tagCreationLink, {
|
|
59
59
|
revision,
|
|
60
|
-
name: newTagName
|
|
60
|
+
name: newTagName,
|
|
61
61
|
})
|
|
62
62
|
.then(onCreated)
|
|
63
63
|
.catch(onError)
|
|
@@ -83,7 +83,7 @@ const CreateTagModal: FC<Props> = ({ t, onClose, tagCreationLink, existingTagsLi
|
|
|
83
83
|
<InputField
|
|
84
84
|
name="name"
|
|
85
85
|
label={t("tags.create.form.field.name.label")}
|
|
86
|
-
onChange={val => setNewTagName(val)}
|
|
86
|
+
onChange={(val) => setNewTagName(val)}
|
|
87
87
|
value={newTagName}
|
|
88
88
|
validationError={!!validationError}
|
|
89
89
|
errorMessage={t(validationError)}
|
|
@@ -71,7 +71,7 @@ const withFormElementsFooter = (
|
|
|
71
71
|
</ButtonGroup>
|
|
72
72
|
);
|
|
73
73
|
|
|
74
|
-
storiesOf("Modal
|
|
74
|
+
storiesOf("Modal/Modal", module)
|
|
75
75
|
.addDecorator((story) => <MemoryRouter initialEntries={["/"]}>{story()}</MemoryRouter>)
|
|
76
76
|
.add("Default", () => (
|
|
77
77
|
<NonCloseableModal>
|
|
@@ -33,7 +33,7 @@ export const MenuContext = React.createContext<MenuContext>({
|
|
|
33
33
|
isCollapsed() {
|
|
34
34
|
return false;
|
|
35
35
|
},
|
|
36
|
-
setCollapsed() {}
|
|
36
|
+
setCollapsed() {},
|
|
37
37
|
});
|
|
38
38
|
|
|
39
39
|
export const StateMenuContextProvider: FC = ({ children }) => {
|
|
@@ -43,7 +43,7 @@ export const StateMenuContextProvider: FC = ({ children }) => {
|
|
|
43
43
|
isCollapsed() {
|
|
44
44
|
return collapsed;
|
|
45
45
|
},
|
|
46
|
-
setCollapsed
|
|
46
|
+
setCollapsed,
|
|
47
47
|
};
|
|
48
48
|
|
|
49
49
|
return <MenuContext.Provider value={context}>{children}</MenuContext.Provider>;
|
|
@@ -39,17 +39,17 @@ class NavAction extends React.Component<Props> {
|
|
|
39
39
|
if (icon) {
|
|
40
40
|
showIcon = (
|
|
41
41
|
<>
|
|
42
|
-
<i className={icon}
|
|
42
|
+
<i className={icon} />{" "}
|
|
43
43
|
</>
|
|
44
44
|
);
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
return (
|
|
48
48
|
<li>
|
|
49
|
-
<
|
|
49
|
+
<button onClick={action}>
|
|
50
50
|
{showIcon}
|
|
51
51
|
{label}
|
|
52
|
-
</
|
|
52
|
+
</button>
|
|
53
53
|
</li>
|
|
54
54
|
);
|
|
55
55
|
}
|
|
@@ -52,9 +52,9 @@ const withRoute = (route: string) => {
|
|
|
52
52
|
return (story: ReactElement<any>) => <MemoryRouter initialEntries={[route]}>{story}</MemoryRouter>;
|
|
53
53
|
};
|
|
54
54
|
|
|
55
|
-
storiesOf("Navigation
|
|
56
|
-
.addDecorator(story => <StateMenuContextProvider>{story()}</StateMenuContextProvider>)
|
|
57
|
-
.addDecorator(story => (
|
|
55
|
+
storiesOf("Secondary Navigation", module)
|
|
56
|
+
.addDecorator((story) => <StateMenuContextProvider>{story()}</StateMenuContextProvider>)
|
|
57
|
+
.addDecorator((story) => (
|
|
58
58
|
<Columns className="columns">
|
|
59
59
|
<div className="column is-3">{story()}</div>
|
|
60
60
|
</Columns>
|
|
@@ -92,7 +92,7 @@ storiesOf("Navigation|Secondary", module)
|
|
|
92
92
|
<SecondaryNavigation label="Hitchhiker">
|
|
93
93
|
<SecondaryNavigationItem to="/42" icon="fas fa-puzzle-piece" label="Puzzle 42" title="Puzzle 42" />
|
|
94
94
|
<SecondaryNavigationItem
|
|
95
|
-
activeWhenMatch={route => route.location.pathname === "/hog"}
|
|
95
|
+
activeWhenMatch={(route) => route.location.pathname === "/hog"}
|
|
96
96
|
to="/heart-of-gold"
|
|
97
97
|
icon="fas fa-star"
|
|
98
98
|
label="Heart Of Gold"
|
|
@@ -44,7 +44,7 @@ const SubNavigation: FC<Props> = ({
|
|
|
44
44
|
title,
|
|
45
45
|
label,
|
|
46
46
|
children,
|
|
47
|
-
testId
|
|
47
|
+
testId,
|
|
48
48
|
}) => {
|
|
49
49
|
const context = useMenuContext();
|
|
50
50
|
const collapsed = context.isCollapsed();
|
|
@@ -56,7 +56,7 @@ const SubNavigation: FC<Props> = ({
|
|
|
56
56
|
const active = useActiveMatch({
|
|
57
57
|
to: parent,
|
|
58
58
|
activeOnlyWhenExact,
|
|
59
|
-
activeWhenMatch
|
|
59
|
+
activeWhenMatch,
|
|
60
60
|
});
|
|
61
61
|
|
|
62
62
|
let defaultIcon = "fas fa-cog";
|
|
@@ -34,40 +34,42 @@ const Wrapper = styled.div`
|
|
|
34
34
|
`;
|
|
35
35
|
|
|
36
36
|
storiesOf("Popover", module)
|
|
37
|
-
.addDecorator(storyFn => <Wrapper>{storyFn()}</Wrapper>)
|
|
38
|
-
.add("Default", () =>
|
|
39
|
-
|
|
37
|
+
.addDecorator((storyFn) => <Wrapper>{storyFn()}</Wrapper>)
|
|
38
|
+
.add("Default", () =>
|
|
39
|
+
React.createElement(() => {
|
|
40
|
+
const { triggerProps, popoverProps } = usePopover();
|
|
40
41
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
42
|
+
return (
|
|
43
|
+
<div>
|
|
44
|
+
<Popover title={<strong>Spaceship Heart of Gold</strong>} width={512} {...popoverProps}>
|
|
45
|
+
<p>
|
|
46
|
+
The Heart of Gold is the sleekest, most advanced, coolest spaceship in the galaxy. Its stunning good looks
|
|
47
|
+
mirror its awesome speed and power. It is powered by the revolutionary new Infinite Improbability Drive,
|
|
48
|
+
which lets the ship pass through every point in every universe simultaneously.
|
|
49
|
+
</p>
|
|
50
|
+
</Popover>
|
|
51
|
+
<button className="button" {...triggerProps}>
|
|
52
|
+
Trigger
|
|
53
|
+
</button>
|
|
54
|
+
</div>
|
|
55
|
+
);
|
|
56
|
+
})
|
|
57
|
+
)
|
|
58
|
+
.add("Link", () =>
|
|
59
|
+
React.createElement(() => {
|
|
60
|
+
const { triggerProps, popoverProps } = usePopover();
|
|
58
61
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}));
|
|
62
|
+
return (
|
|
63
|
+
<div>
|
|
64
|
+
<Popover title={<strong>Spaceship Heart of Gold</strong>} width={512} {...popoverProps}>
|
|
65
|
+
<p>
|
|
66
|
+
The Heart of Gold is the sleekest, most advanced, coolest spaceship in the galaxy. Its stunning good looks
|
|
67
|
+
mirror its awesome speed and power. It is powered by the revolutionary new Infinite Improbability Drive,
|
|
68
|
+
which lets the ship pass through every point in every universe simultaneously.
|
|
69
|
+
</p>
|
|
70
|
+
</Popover>
|
|
71
|
+
<button {...triggerProps}>Trigger</button>
|
|
72
|
+
</div>
|
|
73
|
+
);
|
|
74
|
+
})
|
|
75
|
+
);
|
|
@@ -53,7 +53,7 @@ type State = {
|
|
|
53
53
|
|
|
54
54
|
const initialState = {
|
|
55
55
|
onPopover: false,
|
|
56
|
-
onTrigger: false
|
|
56
|
+
onTrigger: false,
|
|
57
57
|
};
|
|
58
58
|
|
|
59
59
|
const reducer = (state: State, action: Action): State => {
|
|
@@ -66,14 +66,14 @@ const reducer = (state: State, action: Action): State => {
|
|
|
66
66
|
offsetTop: action.offsetTop,
|
|
67
67
|
offsetLeft: action.offsetLeft,
|
|
68
68
|
onTrigger: true,
|
|
69
|
-
onPopover: false
|
|
69
|
+
onPopover: false,
|
|
70
70
|
};
|
|
71
71
|
}
|
|
72
72
|
case "leave-trigger": {
|
|
73
73
|
if (state.onPopover) {
|
|
74
74
|
return {
|
|
75
75
|
...state,
|
|
76
|
-
onTrigger: false
|
|
76
|
+
onTrigger: false,
|
|
77
77
|
};
|
|
78
78
|
}
|
|
79
79
|
return initialState;
|
|
@@ -81,14 +81,14 @@ const reducer = (state: State, action: Action): State => {
|
|
|
81
81
|
case "enter-popover": {
|
|
82
82
|
return {
|
|
83
83
|
...state,
|
|
84
|
-
onPopover: true
|
|
84
|
+
onPopover: true,
|
|
85
85
|
};
|
|
86
86
|
}
|
|
87
87
|
case "leave-popover": {
|
|
88
88
|
if (state.onTrigger) {
|
|
89
89
|
return {
|
|
90
90
|
...state,
|
|
91
|
-
onPopover: false
|
|
91
|
+
onPopover: false,
|
|
92
92
|
};
|
|
93
93
|
}
|
|
94
94
|
return initialState;
|
|
@@ -109,13 +109,13 @@ const usePopover = () => {
|
|
|
109
109
|
dispatchDeferred(dispatch, {
|
|
110
110
|
type: "enter-trigger",
|
|
111
111
|
offsetTop: current.offsetTop,
|
|
112
|
-
offsetLeft: current.offsetLeft + current.offsetWidth / 2
|
|
112
|
+
offsetLeft: current.offsetLeft + current.offsetWidth / 2,
|
|
113
113
|
});
|
|
114
114
|
};
|
|
115
115
|
|
|
116
116
|
const onMouseLeave = () => {
|
|
117
117
|
dispatchDeferred(dispatch, {
|
|
118
|
-
type: "leave-trigger"
|
|
118
|
+
type: "leave-trigger",
|
|
119
119
|
});
|
|
120
120
|
};
|
|
121
121
|
|
|
@@ -123,14 +123,14 @@ const usePopover = () => {
|
|
|
123
123
|
triggerProps: {
|
|
124
124
|
onMouseOver,
|
|
125
125
|
onMouseLeave,
|
|
126
|
-
ref: (node: HTMLElement | null) => (triggerRef.current = node)
|
|
126
|
+
ref: (node: HTMLElement | null) => (triggerRef.current = node),
|
|
127
127
|
},
|
|
128
128
|
popoverProps: {
|
|
129
129
|
dispatch,
|
|
130
130
|
show: state.onPopover || state.onTrigger,
|
|
131
131
|
offsetTop: state.offsetTop,
|
|
132
|
-
offsetLeft: state.offsetLeft
|
|
133
|
-
}
|
|
132
|
+
offsetLeft: state.offsetLeft,
|
|
133
|
+
},
|
|
134
134
|
};
|
|
135
135
|
};
|
|
136
136
|
|
|
@@ -85,7 +85,7 @@ const fileControlFactory: (changeset: Changeset) => FileControlFactory = (change
|
|
|
85
85
|
return links.map(({ url, label }) => <JumpToFileButton tooltip={label} link={url} />);
|
|
86
86
|
};
|
|
87
87
|
|
|
88
|
-
storiesOf("Diff", module)
|
|
88
|
+
storiesOf("Repositories/Diff", module)
|
|
89
89
|
.addDecorator(RoutingDecorator)
|
|
90
90
|
.addDecorator((storyFn) => <Container>{storyFn()}</Container>)
|
|
91
91
|
.add("Default", () => <Diff diff={diffFiles} />)
|