@aarhus-university/au-lib-react-components 11.0.0 → 11.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/__tests__/jest/AUButtonComponent.test.tsx +3 -3
- package/__tests__/jest/AUModalComponent.test.tsx +10 -10
- package/package.json +2 -2
- package/src/components/AUModalComponent.tsx +6 -2
- package/src/components/AUStepComponent.tsx +41 -0
- package/stories/AUModalComponent.stories.tsx +3 -3
- package/stories/AUStepComponent.stories.tsx +40 -0
- package/stories/AUToolbarComponent.stories.tsx +5 -3
|
@@ -65,7 +65,7 @@ describe('<AUButtonComponent />', () => {
|
|
|
65
65
|
<AUButtonComponent
|
|
66
66
|
label="Min knap"
|
|
67
67
|
type="text"
|
|
68
|
-
icon="
|
|
68
|
+
icon="delphinus"
|
|
69
69
|
iconPosition="right"
|
|
70
70
|
/>,
|
|
71
71
|
);
|
|
@@ -84,7 +84,7 @@ describe('<AUButtonComponent />', () => {
|
|
|
84
84
|
const { container } = render(
|
|
85
85
|
<AUButtonComponent
|
|
86
86
|
label="Min knap"
|
|
87
|
-
icon="
|
|
87
|
+
icon="delphinus"
|
|
88
88
|
hideLabel
|
|
89
89
|
/>,
|
|
90
90
|
);
|
|
@@ -115,7 +115,7 @@ describe('<AUButtonComponent />', () => {
|
|
|
115
115
|
label="Min knap"
|
|
116
116
|
size="large"
|
|
117
117
|
mode="confirmable-action"
|
|
118
|
-
icon="
|
|
118
|
+
icon="delphinus"
|
|
119
119
|
hideLabel
|
|
120
120
|
/>,
|
|
121
121
|
);
|
|
@@ -27,14 +27,14 @@ const ModalWrapper: React.FC = () => {
|
|
|
27
27
|
sender={btnRef.current}
|
|
28
28
|
onClose={() => setShowModal(false)}
|
|
29
29
|
>
|
|
30
|
-
|
|
30
|
+
<>
|
|
31
31
|
<h2 className="modal-view__header theme--dark">
|
|
32
32
|
Header
|
|
33
33
|
</h2>
|
|
34
34
|
<div className="modal-view__content">
|
|
35
35
|
<p>Content</p>
|
|
36
36
|
</div>
|
|
37
|
-
|
|
37
|
+
</>
|
|
38
38
|
</AUModalComponent>
|
|
39
39
|
</>
|
|
40
40
|
);
|
|
@@ -58,14 +58,14 @@ describe('<AUModalComponent />', () => {
|
|
|
58
58
|
show
|
|
59
59
|
sender={fakeBtn}
|
|
60
60
|
>
|
|
61
|
-
|
|
61
|
+
<>
|
|
62
62
|
<h2 className="modal-view__header theme--dark">
|
|
63
63
|
Header
|
|
64
64
|
</h2>
|
|
65
65
|
<div className="modal-view__content">
|
|
66
66
|
<p>Content</p>
|
|
67
67
|
</div>
|
|
68
|
-
|
|
68
|
+
</>
|
|
69
69
|
</AUModalComponent>
|
|
70
70
|
</div>,
|
|
71
71
|
);
|
|
@@ -82,14 +82,14 @@ describe('<AUModalComponent />', () => {
|
|
|
82
82
|
show={false}
|
|
83
83
|
sender={fakeBtn}
|
|
84
84
|
>
|
|
85
|
-
|
|
85
|
+
<>
|
|
86
86
|
<h2 className="modal-view__header theme--dark">
|
|
87
87
|
Header
|
|
88
88
|
</h2>
|
|
89
89
|
<div className="modal-view__content">
|
|
90
90
|
<p>Content</p>
|
|
91
91
|
</div>
|
|
92
|
-
|
|
92
|
+
</>
|
|
93
93
|
</AUModalComponent>
|
|
94
94
|
</div>,
|
|
95
95
|
);
|
|
@@ -122,14 +122,14 @@ describe('<AUModalComponent />', () => {
|
|
|
122
122
|
show
|
|
123
123
|
sender={fakeBtn}
|
|
124
124
|
>
|
|
125
|
-
|
|
125
|
+
<>
|
|
126
126
|
<h2 className="modal-view__header theme--dark">
|
|
127
127
|
Header
|
|
128
128
|
</h2>
|
|
129
129
|
<div className="modal-view__content">
|
|
130
130
|
<p>Content</p>
|
|
131
131
|
</div>
|
|
132
|
-
|
|
132
|
+
</>
|
|
133
133
|
</AUModalComponent>
|
|
134
134
|
</div>,
|
|
135
135
|
);
|
|
@@ -148,14 +148,14 @@ describe('<AUModalComponent />', () => {
|
|
|
148
148
|
show
|
|
149
149
|
sender={fakeBtn}
|
|
150
150
|
>
|
|
151
|
-
|
|
151
|
+
<>
|
|
152
152
|
<h2 className="modal-view__header theme--dark">
|
|
153
153
|
Header
|
|
154
154
|
</h2>
|
|
155
155
|
<div className="modal-view__content">
|
|
156
156
|
<p>Content</p>
|
|
157
157
|
</div>
|
|
158
|
-
|
|
158
|
+
</>
|
|
159
159
|
</AUModalComponent>
|
|
160
160
|
</div>,
|
|
161
161
|
);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"sideEffects": false,
|
|
3
3
|
"name": "@aarhus-university/au-lib-react-components",
|
|
4
|
-
"version": "11.
|
|
4
|
+
"version": "11.1.0",
|
|
5
5
|
"description": "Library for shared React components for various applications on au.dk",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"test": "jest",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"dependencies": {
|
|
75
75
|
"@aarhus-university/au-designsystem-delphinus": "0.34.2",
|
|
76
76
|
"@aarhus-university/au-designsystem-delphinus-dev": "0.2.0",
|
|
77
|
-
"@aarhus-university/types": "^0.
|
|
77
|
+
"@aarhus-university/types": "^0.17.2",
|
|
78
78
|
"@reduxjs/toolkit": "^1.8.3",
|
|
79
79
|
"@types/google.analytics": "^0.0.42",
|
|
80
80
|
"@types/history": "^5.0.0",
|
|
@@ -32,7 +32,7 @@ const AUModalComponent: FC<AUModalComponentProps> = ({
|
|
|
32
32
|
<AUButtonComponent
|
|
33
33
|
label={lang === 'da' ? 'Luk' : 'Close'}
|
|
34
34
|
disabled={closeButtonDisabled}
|
|
35
|
-
icon="
|
|
35
|
+
icon="close"
|
|
36
36
|
hideLabel
|
|
37
37
|
classNames={['modal-view__close']}
|
|
38
38
|
dataGtm="au-btn-modal-close"
|
|
@@ -44,7 +44,11 @@ const AUModalComponent: FC<AUModalComponentProps> = ({
|
|
|
44
44
|
/>
|
|
45
45
|
)
|
|
46
46
|
}
|
|
47
|
-
|
|
47
|
+
<div className="modal-view__container">
|
|
48
|
+
<div className="modal-view__body">
|
|
49
|
+
{children}
|
|
50
|
+
</div>
|
|
51
|
+
</div>
|
|
48
52
|
</div>
|
|
49
53
|
</div>,
|
|
50
54
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React, { FC } from 'react';
|
|
2
|
+
|
|
3
|
+
const AUStepComponent: FC<AUStepComponentProps> = ({
|
|
4
|
+
step,
|
|
5
|
+
children,
|
|
6
|
+
stepHeadlines,
|
|
7
|
+
introElement,
|
|
8
|
+
outroElement,
|
|
9
|
+
}: AUStepComponentProps) => (
|
|
10
|
+
<>
|
|
11
|
+
{
|
|
12
|
+
(step > -1 && step < children.length) && (
|
|
13
|
+
<ol className="stepper" data-steps={children.length}>
|
|
14
|
+
{
|
|
15
|
+
stepHeadlines.map((headline, index) => (
|
|
16
|
+
<li key={headline} className={`stepper__item${index === step ? ' stepper__item--active' : ''}`}>
|
|
17
|
+
<span className="stepper__item__label">{headline}</span>
|
|
18
|
+
</li>
|
|
19
|
+
))
|
|
20
|
+
}
|
|
21
|
+
</ol>
|
|
22
|
+
)
|
|
23
|
+
}
|
|
24
|
+
{
|
|
25
|
+
step < 0 && introElement
|
|
26
|
+
}
|
|
27
|
+
{(
|
|
28
|
+
children[step]) || null}
|
|
29
|
+
{
|
|
30
|
+
(step > children.length - 1) && outroElement
|
|
31
|
+
}
|
|
32
|
+
</>
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
AUStepComponent.defaultProps = {
|
|
36
|
+
introElement: undefined,
|
|
37
|
+
outroElement: undefined,
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
AUStepComponent.displayName = 'AUStepComponent';
|
|
41
|
+
export default AUStepComponent;
|
|
@@ -13,7 +13,7 @@ export default {
|
|
|
13
13
|
sender: {
|
|
14
14
|
table: {
|
|
15
15
|
disable: true,
|
|
16
|
-
},
|
|
16
|
+
},
|
|
17
17
|
},
|
|
18
18
|
},
|
|
19
19
|
decorators: [
|
|
@@ -36,14 +36,14 @@ const Template: ComponentStory<typeof AUModalComponent> = (args) => {
|
|
|
36
36
|
onClick={() => updateArgs({ ...args, show: true })}
|
|
37
37
|
/>
|
|
38
38
|
<AUModalComponent {...args} onClose={() => updateArgs({ ...args, show: false })}>
|
|
39
|
-
|
|
39
|
+
<>
|
|
40
40
|
<h2 className="modal-view__header">
|
|
41
41
|
The quick brown fox jumps over the lazy dog
|
|
42
42
|
</h2>
|
|
43
43
|
<div className="modal-view__content">
|
|
44
44
|
<p>"The quick brown fox jumps over the lazy dog" is an English-language pangram—a sentence that contains all of the letters of the alphabet. It is commonly used for touch-typing practice, testing typewriters and computer keyboards, displaying examples of fonts, and other applications involving text where the use of all letters in the alphabet is desired. Owing to its brevity and coherence, it has become widely known.</p><h3>History</h3><p>The earliest known appearance of the phrase is from The Boston Journal. In an article titled "Current Notes" in the February 10, 1885, morning edition, the phrase is mentioned as a good practice sentence for writing students: "A favorite copy set by writing teachers for their pupils is the following, because it contains every letter of the alphabet: 'A quick brown fox jumps over the lazy dog.'"[1] Dozens of other newspapers published the phrase over the next few months, all using the version of the sentence starting with "A" rather than "The".[2] The earliest known use of the phrase in its modern form (starting with "The") is from the 1888 book Illustrative Shorthand by Linda Bronson.[3] The modern form (starting with "The") became more common despite the fact that it is slightly longer than the original (starting with "A").</p>
|
|
45
45
|
</div>
|
|
46
|
-
|
|
46
|
+
</>
|
|
47
47
|
</AUModalComponent>
|
|
48
48
|
</div>
|
|
49
49
|
)
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ComponentStory, ComponentMeta } from '@storybook/react';
|
|
3
|
+
import AUStepComponent from '../src/components/AUStepComponent';
|
|
4
|
+
import { ThemeWrapper } from './lib/helpers';
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: 'Delphinus/Stepper',
|
|
8
|
+
component: AUStepComponent,
|
|
9
|
+
argTypes: {
|
|
10
|
+
},
|
|
11
|
+
decorators: [
|
|
12
|
+
(Story, context) => (
|
|
13
|
+
<ThemeWrapper theme={context.globals.theme}>
|
|
14
|
+
{Story()}
|
|
15
|
+
</ThemeWrapper>
|
|
16
|
+
)
|
|
17
|
+
],
|
|
18
|
+
} as ComponentMeta<typeof AUStepComponent>;
|
|
19
|
+
|
|
20
|
+
const Template: ComponentStory<typeof AUStepComponent> = (args) => (
|
|
21
|
+
<>
|
|
22
|
+
<AUStepComponent {...args} />
|
|
23
|
+
</>
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
export const Five_Steps = Template.bind({});
|
|
27
|
+
Five_Steps.args = {
|
|
28
|
+
step: -1,
|
|
29
|
+
children: [
|
|
30
|
+
<p>Step 1</p>,
|
|
31
|
+
<p>Step 2</p>,
|
|
32
|
+
<p>Step 3</p>,
|
|
33
|
+
<p>Step 4</p>,
|
|
34
|
+
<p>Step 5</p>,
|
|
35
|
+
],
|
|
36
|
+
stepHeadlines: ['Introduction', 'Network connection', 'Sign out devices', 'Change password', 'Update device'],
|
|
37
|
+
introElement: <p>Her begynder vi</p>,
|
|
38
|
+
outroElement: <p>Her slutter vi</p>,
|
|
39
|
+
};
|
|
40
|
+
|
|
@@ -44,8 +44,8 @@ Form_Field_and_Buttons_and_Link.args = {
|
|
|
44
44
|
<label htmlFor="demo-search">Search</label>
|
|
45
45
|
<input type="search" autoComplete="off" autoCorrect="off" autoCapitalize="off" id="demo-search" />
|
|
46
46
|
</div>,
|
|
47
|
-
<AUButtonComponent icon="
|
|
48
|
-
<AUButtonComponent icon="
|
|
47
|
+
<AUButtonComponent icon="confirm-circle" label="Mark as read" />,
|
|
48
|
+
<AUButtonComponent icon="delete" hideLabel label="Delete" />,
|
|
49
49
|
<AUButtonComponent type="text" label="Select all" />,
|
|
50
50
|
<div className="toolbar__split" />,
|
|
51
51
|
<div className="toolbar__text-item">
|
|
@@ -103,6 +103,7 @@ Filter.args = {
|
|
|
103
103
|
<AUContentToggleComponent
|
|
104
104
|
toggled={false}
|
|
105
105
|
beforeCallback={(content: HTMLElement) => closeAllContentTogglesInToolbar(findToolbar(content))}
|
|
106
|
+
onClick={(content: HTMLElement, button: HTMLButtonElement) => console.log(content, button)}
|
|
106
107
|
afterCallback={(content: HTMLElement, button: HTMLButtonElement) => {
|
|
107
108
|
const toolbar = findToolbar(content);
|
|
108
109
|
const ariaExpanded = button.getAttribute('aria-expanded');
|
|
@@ -158,6 +159,7 @@ Filter.args = {
|
|
|
158
159
|
<AUContentToggleComponent
|
|
159
160
|
toggled={false}
|
|
160
161
|
beforeCallback={(content: HTMLElement) => closeAllContentTogglesInToolbar(findToolbar(content))}
|
|
162
|
+
onClick={(content: HTMLElement, button: HTMLButtonElement) => console.log(content, button)}
|
|
161
163
|
afterCallback={(content: HTMLElement, button: HTMLButtonElement) => {
|
|
162
164
|
const toolbar = findToolbar(content);
|
|
163
165
|
const ariaExpanded = button.getAttribute('aria-expanded');
|
|
@@ -208,7 +210,7 @@ Filter.args = {
|
|
|
208
210
|
<div className="selection-list__option">
|
|
209
211
|
<input type="checkbox" id="option-9" />
|
|
210
212
|
<label htmlFor="option-9">Aarhus BSS</label>
|
|
211
|
-
</div>
|
|
213
|
+
</div>
|
|
212
214
|
</div>
|
|
213
215
|
</fieldset>
|
|
214
216
|
</div>
|