@onewelcome/react-lib-components 1.0.1 → 1.2.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/dist/ProgressBar/ProgressBar.d.ts +5 -0
- package/dist/index.d.ts +2 -1
- package/dist/react-lib-components.cjs.development.js +157 -109
- package/dist/react-lib-components.cjs.development.js.map +1 -1
- package/dist/react-lib-components.cjs.production.min.js +1 -1
- package/dist/react-lib-components.cjs.production.min.js.map +1 -1
- package/dist/react-lib-components.esm.js +155 -110
- package/dist/react-lib-components.esm.js.map +1 -1
- package/dist/util/helper.d.ts +2 -0
- package/package.json +1 -1
- package/src/Form/Input/Input.module.scss +5 -5
- package/src/Form/Select/Select.module.scss +3 -2
- package/src/Form/Textarea/Textarea.module.scss +1 -1
- package/src/Form/Toggle/Toggle.module.scss +4 -2
- package/src/Form/Wrapper/InputWrapper/InputWrapper.module.scss +1 -1
- package/src/Form/Wrapper/TextareaWrapper/TextareaWrapper.module.scss +1 -1
- package/src/Form/Wrapper/Wrapper/Wrapper.module.scss +3 -1
- package/src/Notifications/BaseModal/BaseModal.module.scss +3 -1
- package/src/Notifications/SlideInModal/SlideInModal.module.scss +3 -1
- package/src/Notifications/Snackbar/SnackbarContainer/SnackbarContainer.module.scss +2 -1
- package/src/Notifications/Snackbar/SnackbarItem/SnackbarItem.module.scss +3 -3
- package/src/Popover/Popover.module.scss +7 -4
- package/src/ProgressBar/ProgressBar.module.scss +56 -0
- package/src/ProgressBar/ProgressBar.test.tsx +58 -0
- package/src/ProgressBar/ProgressBar.tsx +38 -0
- package/src/Tabs/Tabs.module.scss +6 -3
- package/src/TextEllipsis/TextEllipsis.module.scss +1 -1
- package/src/Tiles/Tile.module.scss +1 -1
- package/src/Tooltip/Tooltip.module.scss +7 -4
- package/src/_BaseStyling_/BaseStyling.tsx +0 -3
- package/src/index.ts +2 -1
- package/src/mixins.module.scss +21 -5
- package/src/readyclasses.module.scss +8 -0
- package/src/util/helper.test.tsx +128 -1
- package/src/util/helper.tsx +28 -0
package/dist/util/helper.d.ts
CHANGED
|
@@ -3,4 +3,6 @@ declare type KeyValuePair = {
|
|
|
3
3
|
};
|
|
4
4
|
export declare const generateID: (length?: number, stringToWeaveIn?: string) => string;
|
|
5
5
|
export declare const filterProps: (props: any, regexPattern: RegExp, returnFiltered?: boolean) => KeyValuePair;
|
|
6
|
+
export declare const debounce: (fn: (...args: unknown[]) => unknown, delay: number) => (...args: unknown[]) => void;
|
|
7
|
+
export declare const throttle: (fn: (...args: unknown[]) => unknown, delay: number) => () => void;
|
|
6
8
|
export {};
|
package/package.json
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
border-radius: var(--input-border-radius);
|
|
26
26
|
background-color: var(--input-background-color);
|
|
27
27
|
padding: 0 1.25rem;
|
|
28
|
-
transition
|
|
28
|
+
@include transition(all, 0.2s, ease-in-out);
|
|
29
29
|
|
|
30
30
|
// General autofill styles
|
|
31
31
|
input:-webkit-autofill,
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
box-sizing: border-box;
|
|
77
77
|
border: 0;
|
|
78
78
|
border-radius: var(--input-border-radius);
|
|
79
|
-
transition
|
|
79
|
+
@include transition(all, 0.2s, ease-in-out);
|
|
80
80
|
background-color: transparent;
|
|
81
81
|
z-index: 1;
|
|
82
82
|
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
padding-right: 3.5rem;
|
|
104
104
|
|
|
105
105
|
&.remove-extra-indent {
|
|
106
|
-
padding-right:
|
|
106
|
+
padding-right: 0;
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
|
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
height: 100%;
|
|
114
114
|
width: 1.25rem;
|
|
115
115
|
right: 1.25rem;
|
|
116
|
-
top:
|
|
116
|
+
top: 0;
|
|
117
117
|
font-size: 1.125rem;
|
|
118
118
|
display: flex;
|
|
119
119
|
align-items: center;
|
|
@@ -127,7 +127,7 @@
|
|
|
127
127
|
|
|
128
128
|
.input-wrapper [data-prefix],
|
|
129
129
|
.input-wrapper [data-suffix] {
|
|
130
|
-
transition
|
|
130
|
+
@include transition(all, 0.2s, ease-in-out);
|
|
131
131
|
display: block;
|
|
132
132
|
z-index: 1;
|
|
133
133
|
}
|
|
@@ -15,13 +15,14 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
@import "../../readyclasses.module.scss";
|
|
18
|
+
@import "../../mixins.module.scss";
|
|
18
19
|
|
|
19
20
|
$listItemHeight: 2.125rem;
|
|
20
21
|
|
|
21
22
|
.select {
|
|
22
23
|
position: relative;
|
|
23
24
|
box-sizing: border-box;
|
|
24
|
-
transition
|
|
25
|
+
@include transition(all, 0.2s, ease-in-out);
|
|
25
26
|
border: 0;
|
|
26
27
|
border-radius: var(--input-border-radius);
|
|
27
28
|
background-color: var(--input-background-color);
|
|
@@ -65,7 +66,7 @@ $listItemHeight: 2.125rem;
|
|
|
65
66
|
border-radius: var(--input-border-radius);
|
|
66
67
|
font-size: var(--font-size);
|
|
67
68
|
cursor: pointer;
|
|
68
|
-
transition
|
|
69
|
+
@include transition(all, 0.2s, ease-in-out);
|
|
69
70
|
|
|
70
71
|
&:focus {
|
|
71
72
|
outline: 0;
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
box-sizing: border-box;
|
|
30
30
|
border: 0;
|
|
31
31
|
border-radius: var(--input-border-radius);
|
|
32
|
-
transition
|
|
32
|
+
@include transition(all, 0.2s, ease-in-out);
|
|
33
33
|
font-family: var(--font-family);
|
|
34
34
|
font-size: var(--font-size);
|
|
35
35
|
color: var(--greyed-out);
|
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
+
@import "../../mixins.module.scss";
|
|
18
|
+
|
|
17
19
|
$borderRadius: 2.5rem;
|
|
18
20
|
|
|
19
21
|
.toggle-wrapper {
|
|
@@ -29,7 +31,7 @@ $borderRadius: 2.5rem;
|
|
|
29
31
|
background-color: var(--default);
|
|
30
32
|
border-radius: $borderRadius;
|
|
31
33
|
position: relative;
|
|
32
|
-
transition
|
|
34
|
+
@include transition(background-color, 0.2s, ease-in-out);
|
|
33
35
|
display: block;
|
|
34
36
|
pointer-events: none;
|
|
35
37
|
|
|
@@ -44,7 +46,7 @@ $borderRadius: 2.5rem;
|
|
|
44
46
|
top: 50%;
|
|
45
47
|
transform: translateY(-50%) translateX(0);
|
|
46
48
|
left: 0.125rem;
|
|
47
|
-
transition
|
|
49
|
+
@include transition(transform, 0.2s, ease-in-out);
|
|
48
50
|
}
|
|
49
51
|
|
|
50
52
|
&.checked {
|
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
+
@import "../../../mixins.module.scss";
|
|
18
|
+
|
|
17
19
|
.floating-wrapper {
|
|
18
20
|
position: relative;
|
|
19
21
|
|
|
@@ -25,7 +27,7 @@
|
|
|
25
27
|
top: 1.3125rem;
|
|
26
28
|
left: 1.25rem;
|
|
27
29
|
transform-origin: left top;
|
|
28
|
-
transition
|
|
30
|
+
@include transition(all, 0.2s, ease-in-out);
|
|
29
31
|
pointer-events: none;
|
|
30
32
|
|
|
31
33
|
&.floating-label-active {
|
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
+
@import "../../mixins.module.scss";
|
|
18
|
+
|
|
17
19
|
$zIndex: 10;
|
|
18
20
|
$marginTop: 3.125rem;
|
|
19
21
|
|
|
@@ -39,7 +41,7 @@ $marginTop: 3.125rem;
|
|
|
39
41
|
left: 0;
|
|
40
42
|
top: 0;
|
|
41
43
|
background-color: transparent;
|
|
42
|
-
transition
|
|
44
|
+
@include transition(background-color, 0.5s, ease);
|
|
43
45
|
}
|
|
44
46
|
|
|
45
47
|
&.visible {
|
|
@@ -14,12 +14,14 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
+
@import "../../mixins.module.scss";
|
|
18
|
+
|
|
17
19
|
.slide-in-modal {
|
|
18
20
|
justify-content: flex-end;
|
|
19
21
|
|
|
20
22
|
visibility: visible;
|
|
21
23
|
|
|
22
|
-
transition
|
|
24
|
+
@include transition(transform, 0.5s, ease-in-out);
|
|
23
25
|
transform: translate(120%);
|
|
24
26
|
|
|
25
27
|
&.hidden {
|
|
@@ -13,14 +13,15 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
@import "../../../mixins.module.scss";
|
|
16
17
|
|
|
17
18
|
.snackbars {
|
|
18
19
|
position: fixed;
|
|
19
20
|
z-index: 20;
|
|
20
21
|
width: 100%;
|
|
21
|
-
transition: height 0.2s ease-in-out;
|
|
22
22
|
display: flex;
|
|
23
23
|
flex-direction: column;
|
|
24
|
+
@include transition(height, 0.2s, ease-in-out);
|
|
24
25
|
|
|
25
26
|
&.bottom {
|
|
26
27
|
bottom: 3.5rem;
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
@import "../../../readyclasses.module.scss";
|
|
18
|
+
@import "../../../mixins.module.scss";
|
|
18
19
|
|
|
19
20
|
.snackbar {
|
|
20
21
|
padding: 1rem 1.25rem;
|
|
@@ -22,7 +23,7 @@
|
|
|
22
23
|
display: flex;
|
|
23
24
|
width: 100%;
|
|
24
25
|
box-sizing: border-box;
|
|
25
|
-
transition
|
|
26
|
+
@include transition(height, 0.2s, ease-in-out);
|
|
26
27
|
flex-grow: 0;
|
|
27
28
|
|
|
28
29
|
&.info {
|
|
@@ -122,8 +123,7 @@
|
|
|
122
123
|
|
|
123
124
|
&:active {
|
|
124
125
|
position: relative;
|
|
125
|
-
border
|
|
126
|
-
border: 0;
|
|
126
|
+
border: 0 transparent;
|
|
127
127
|
padding: calc(0.625rem + var(--button-border-width))
|
|
128
128
|
calc(1.25rem + var(--button-border-width));
|
|
129
129
|
|
|
@@ -14,17 +14,20 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
+
@import "../mixins.module.scss";
|
|
18
|
+
|
|
17
19
|
.popover {
|
|
20
|
+
$transition-property: transform, opacity;
|
|
21
|
+
|
|
18
22
|
position: fixed;
|
|
19
23
|
pointer-events: none;
|
|
20
24
|
background-color: var(--light);
|
|
21
25
|
border-radius: 8px;
|
|
22
|
-
box-shadow:
|
|
26
|
+
box-shadow: 0 30px 50px rgba(0, 0, 0, 0.29);
|
|
23
27
|
opacity: 0;
|
|
24
28
|
transform: scale(0.5);
|
|
25
|
-
|
|
26
|
-
transition-
|
|
27
|
-
transition-timing-function: ease-in-out;
|
|
29
|
+
|
|
30
|
+
@include transition($transition-property, 0.2s, ease-in-out);
|
|
28
31
|
|
|
29
32
|
&.show {
|
|
30
33
|
transform: scale(1);
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2022 OneWelcome B.V.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
.progress-bar {
|
|
18
|
+
position: relative;
|
|
19
|
+
display: block;
|
|
20
|
+
height: 0.5rem;
|
|
21
|
+
width: 100%;
|
|
22
|
+
border-radius: 0.25rem;
|
|
23
|
+
background-color: var(--disabled);
|
|
24
|
+
overflow: hidden;
|
|
25
|
+
|
|
26
|
+
@media (prefers-reduced-motion: reduce) {
|
|
27
|
+
display: none;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.bar {
|
|
31
|
+
position: absolute;
|
|
32
|
+
height: 0.5rem;
|
|
33
|
+
width: 50%;
|
|
34
|
+
border-radius: 0.25rem;
|
|
35
|
+
background-color: var(--color-primary);
|
|
36
|
+
animation: cubic-bezier(0.23, 0.78, 0.78, 0.23) 1s slide-in infinite;
|
|
37
|
+
|
|
38
|
+
@keyframes slide-in {
|
|
39
|
+
0% {
|
|
40
|
+
left: -50%;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
100% {
|
|
44
|
+
left: 100%;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.placeholder {
|
|
51
|
+
display: none;
|
|
52
|
+
|
|
53
|
+
@media (prefers-reduced-motion: reduce) {
|
|
54
|
+
display: unset;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import React, { useEffect, useRef } from "react";
|
|
2
|
+
import { ProgressBar, Props } from "./ProgressBar";
|
|
3
|
+
import { render } from "@testing-library/react";
|
|
4
|
+
|
|
5
|
+
const defaultParams: Props = {
|
|
6
|
+
placeholderText: "Loading"
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const createProgressBar = (params?: (defaultParams: Props) => Props) => {
|
|
10
|
+
let parameters: Props = defaultParams;
|
|
11
|
+
if (params) {
|
|
12
|
+
parameters = params(defaultParams);
|
|
13
|
+
}
|
|
14
|
+
const queries = render(<ProgressBar {...parameters} data-testid="ProgressBar" />);
|
|
15
|
+
const ProgressBarComponent = queries.getByTestId("ProgressBar");
|
|
16
|
+
|
|
17
|
+
return {
|
|
18
|
+
...queries,
|
|
19
|
+
ProgressBarComponent
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
describe("ProgressBar should render", () => {
|
|
24
|
+
it("renders without crashing", () => {
|
|
25
|
+
const { ProgressBarComponent } = createProgressBar(defaultParams => ({
|
|
26
|
+
...defaultParams,
|
|
27
|
+
className: "test"
|
|
28
|
+
}));
|
|
29
|
+
|
|
30
|
+
expect(ProgressBarComponent).toBeDefined();
|
|
31
|
+
expect(ProgressBarComponent).toHaveClass(`test`, { exact: true });
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
describe("ref should work", () => {
|
|
36
|
+
it("should give back the proper data prop, this also checks if the component propagates ...rest properly", () => {
|
|
37
|
+
const ExampleComponent = ({
|
|
38
|
+
propagateRef
|
|
39
|
+
}: {
|
|
40
|
+
propagateRef: (ref: React.RefObject<HTMLElement>) => void;
|
|
41
|
+
}) => {
|
|
42
|
+
const ref = useRef(null);
|
|
43
|
+
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
propagateRef(ref);
|
|
46
|
+
}, [ref]);
|
|
47
|
+
|
|
48
|
+
return <ProgressBar {...defaultParams} data-ref="testing" ref={ref} />;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const refCheck = (ref: React.RefObject<HTMLElement>) => {
|
|
52
|
+
expect(ref.current).toHaveAttribute("data-ref", "testing");
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const container = document.createElement("div");
|
|
56
|
+
render(<ExampleComponent propagateRef={refCheck} />, { container });
|
|
57
|
+
});
|
|
58
|
+
});
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2022 OneWelcome B.V.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import React, { ComponentPropsWithRef } from "react";
|
|
18
|
+
import { Typography } from "../Typography/Typography";
|
|
19
|
+
import classes from "./ProgressBar.module.scss";
|
|
20
|
+
|
|
21
|
+
export interface Props extends Omit<ComponentPropsWithRef<"span">, "children"> {
|
|
22
|
+
placeholderText: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const ProgressBar = React.forwardRef<HTMLSpanElement, Props>(
|
|
26
|
+
({ placeholderText, ...rest }: Props, ref) => {
|
|
27
|
+
return (
|
|
28
|
+
<span {...rest} ref={ref} role="progressbar">
|
|
29
|
+
<span className={classes["progress-bar"]}>
|
|
30
|
+
<span className={classes["bar"]} />
|
|
31
|
+
</span>
|
|
32
|
+
<Typography className={classes["placeholder"]} spacing={{ marginBottom: 0 }} variant="body">
|
|
33
|
+
{placeholderText}
|
|
34
|
+
</Typography>
|
|
35
|
+
</span>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
);
|
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
+
@import "../mixins.module.scss";
|
|
18
|
+
|
|
17
19
|
$focus-width: 5px;
|
|
18
20
|
|
|
19
21
|
.tabs {
|
|
@@ -37,12 +39,13 @@ $focus-width: 5px;
|
|
|
37
39
|
}
|
|
38
40
|
|
|
39
41
|
.indicator {
|
|
42
|
+
$transition-property: left, width;
|
|
43
|
+
|
|
40
44
|
position: absolute;
|
|
41
45
|
height: var(--tab-active-border-height);
|
|
42
46
|
background-color: var(--tab-active-border-color);
|
|
43
|
-
|
|
44
|
-
transition-
|
|
45
|
-
transition-timing-function: ease-in-out;
|
|
47
|
+
|
|
48
|
+
@include transition($transition-property, 0.2s, ease-in-out);
|
|
46
49
|
}
|
|
47
50
|
|
|
48
51
|
.tabdivider {
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
padding: 0.6875rem 0.6875rem 0.6875rem 0.875rem;
|
|
26
26
|
border-radius: 0.25rem;
|
|
27
27
|
|
|
28
|
-
box-shadow:
|
|
28
|
+
box-shadow: 0 0.1875rem 0.375rem rgba(0, 0, 0, 0.29);
|
|
29
29
|
white-space: pre-wrap;
|
|
30
30
|
|
|
31
31
|
transition-property: opacity;
|
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
+
@import "../mixins.module.scss";
|
|
18
|
+
|
|
17
19
|
.wrapper {
|
|
18
20
|
display: flex;
|
|
19
21
|
align-items: center;
|
|
@@ -22,7 +24,7 @@
|
|
|
22
24
|
.tooltip-wrapper {
|
|
23
25
|
.icon {
|
|
24
26
|
margin-left: 0.5rem;
|
|
25
|
-
transition
|
|
27
|
+
@include transition(all, 0.2s, ease-in-out);
|
|
26
28
|
color: var(--greyed-out);
|
|
27
29
|
|
|
28
30
|
&:hover {
|
|
@@ -32,6 +34,8 @@
|
|
|
32
34
|
}
|
|
33
35
|
|
|
34
36
|
.tooltip {
|
|
37
|
+
$transition-property: opacity, transform;
|
|
38
|
+
|
|
35
39
|
position: fixed;
|
|
36
40
|
background-color: var(--default);
|
|
37
41
|
padding: 0.1875rem 0.5rem;
|
|
@@ -39,12 +43,11 @@
|
|
|
39
43
|
max-width: 330px;
|
|
40
44
|
opacity: 0;
|
|
41
45
|
transform: scale(0);
|
|
42
|
-
transition-duration: 0.2s;
|
|
43
|
-
transition-timing-function: ease-in-out;
|
|
44
|
-
transition-property: opacity, transform;
|
|
45
46
|
transform-origin: center left;
|
|
46
47
|
pointer-events: none;
|
|
47
48
|
|
|
49
|
+
@include transition($transition-property, 0.2s, ease-in-out);
|
|
50
|
+
|
|
48
51
|
&.visible {
|
|
49
52
|
opacity: 1;
|
|
50
53
|
transform: scale(1);
|
|
@@ -140,7 +140,6 @@ export const BaseStyling = ({ children, properties = {} }: Props) => {
|
|
|
140
140
|
/** We need a loading state, because otherwise you see the colors flash from the default to the possible overridden ones. */
|
|
141
141
|
const [isLoading, setIsLoading] = useState(true);
|
|
142
142
|
|
|
143
|
-
/** Set the actual CSS properties on the HTML :root object */
|
|
144
143
|
const setCSSProperties = (CSSPropertiesObject: CSSProperties) => {
|
|
145
144
|
for (const [key, value] of Object.entries(CSSPropertiesObject)) {
|
|
146
145
|
const formattedPropertyName = key.replace(/([A-Z])/g, val => `-${val.toLowerCase()}`);
|
|
@@ -148,7 +147,6 @@ export const BaseStyling = ({ children, properties = {} }: Props) => {
|
|
|
148
147
|
}
|
|
149
148
|
};
|
|
150
149
|
|
|
151
|
-
/** Check if the properties prop object is filled with anything. If it is, we want to shallow merge it with the default BaseStyling. */
|
|
152
150
|
useEffect(() => {
|
|
153
151
|
if (Object.keys(properties).length !== 0) {
|
|
154
152
|
const mergedState = { ...defaultProperties, ...properties };
|
|
@@ -159,6 +157,5 @@ export const BaseStyling = ({ children, properties = {} }: Props) => {
|
|
|
159
157
|
setIsLoading(false);
|
|
160
158
|
}, [properties]);
|
|
161
159
|
|
|
162
|
-
/** Only render if we're not loading */
|
|
163
160
|
return !isLoading ? <Fragment>{children}</Fragment> : null;
|
|
164
161
|
};
|
package/src/index.ts
CHANGED
|
@@ -30,6 +30,7 @@ export { Tile, Props as TileProps } from "./Tiles/Tile";
|
|
|
30
30
|
export { Tiles, Props as TilesProps } from "./Tiles/Tiles";
|
|
31
31
|
export { Tooltip, Props as TooltipProps } from "./Tooltip/Tooltip";
|
|
32
32
|
export { Typography, Variant, Props as TypographyProps } from "./Typography/Typography";
|
|
33
|
+
export { ProgressBar, Props as ProgressBarProps } from "./ProgressBar/ProgressBar";
|
|
33
34
|
export { Skeleton, Props as SkeletonProps } from "./Skeleton/Skeleton";
|
|
34
35
|
export { StatusIndicator, Props as StatusIndicatorProps } from "./StatusIndicator/StatusIndicator";
|
|
35
36
|
export {
|
|
@@ -42,7 +43,7 @@ export {
|
|
|
42
43
|
|
|
43
44
|
/* Utils */
|
|
44
45
|
export { useRepeater } from "./hooks/useRepeater";
|
|
45
|
-
export { generateID } from "./util/helper";
|
|
46
|
+
export { generateID, debounce, throttle } from "./util/helper";
|
|
46
47
|
|
|
47
48
|
/* Notifications */
|
|
48
49
|
export { Modal, Props as ModalProps } from "./Notifications/Modal/Modal";
|
package/src/mixins.module.scss
CHANGED
|
@@ -133,6 +133,7 @@
|
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
@mixin buttonBase($type: "default") {
|
|
136
|
+
$transition-property: color, background-color, border-color;
|
|
136
137
|
$disabledSelector: if($type == "link", ".disabled", ":disabled");
|
|
137
138
|
|
|
138
139
|
border-width: var(--button-border-width);
|
|
@@ -144,9 +145,9 @@
|
|
|
144
145
|
padding: 0.5rem 1.25rem;
|
|
145
146
|
min-height: 2.5rem;
|
|
146
147
|
cursor: pointer;
|
|
147
|
-
|
|
148
|
-
transition-
|
|
149
|
-
|
|
148
|
+
|
|
149
|
+
@include transition($transition-property, 0.2s, ease-in-out);
|
|
150
|
+
|
|
150
151
|
font-family: var(--font-family);
|
|
151
152
|
|
|
152
153
|
&#{$disabledSelector} {
|
|
@@ -166,7 +167,7 @@
|
|
|
166
167
|
border-style: var(--input-border-style);
|
|
167
168
|
border-width: var(--input-border-width);
|
|
168
169
|
border-radius: var(--input-border-radius);
|
|
169
|
-
transition
|
|
170
|
+
@include transition(all, 0.2s, ease-in-out);
|
|
170
171
|
}
|
|
171
172
|
}
|
|
172
173
|
|
|
@@ -223,8 +224,13 @@
|
|
|
223
224
|
rgba(#fff, 0.5) 60%,
|
|
224
225
|
rgba(#fff, 0)
|
|
225
226
|
);
|
|
226
|
-
animation: shimmer 2s infinite;
|
|
227
227
|
content: "";
|
|
228
|
+
|
|
229
|
+
animation: shimmer 2s infinite;
|
|
230
|
+
|
|
231
|
+
@media (prefers-reduced-motion: reduce) {
|
|
232
|
+
animation: none;
|
|
233
|
+
}
|
|
228
234
|
}
|
|
229
235
|
|
|
230
236
|
@keyframes shimmer {
|
|
@@ -233,3 +239,13 @@
|
|
|
233
239
|
}
|
|
234
240
|
}
|
|
235
241
|
}
|
|
242
|
+
|
|
243
|
+
@mixin transition($property, $duration, $function) {
|
|
244
|
+
transition-property: $property;
|
|
245
|
+
transition-duration: $duration;
|
|
246
|
+
transition-timing-function: $function;
|
|
247
|
+
|
|
248
|
+
@media (prefers-reduced-motion: reduce) {
|
|
249
|
+
transition-duration: 0.1ms;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
@@ -31,10 +31,18 @@
|
|
|
31
31
|
|
|
32
32
|
.slide-in {
|
|
33
33
|
animation: slide-in 0.5s forwards;
|
|
34
|
+
|
|
35
|
+
@media (prefers-reduced-motion: reduce) {
|
|
36
|
+
animation-duration: 0.1ms;
|
|
37
|
+
}
|
|
34
38
|
}
|
|
35
39
|
|
|
36
40
|
.slide-out {
|
|
37
41
|
animation: slide-out 0.5s forwards;
|
|
42
|
+
|
|
43
|
+
@media (prefers-reduced-motion: reduce) {
|
|
44
|
+
animation-duration: 0.1ms;
|
|
45
|
+
}
|
|
38
46
|
}
|
|
39
47
|
|
|
40
48
|
@keyframes slide-in {
|