@onewelcome/react-lib-components 0.1.10-alpha → 0.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/README.md +13 -11
- package/dist/Tiles/Tile.d.ts +3 -3
- package/dist/Typography/Typography.d.ts +1 -2
- package/dist/_BaseStyling_/BaseStyling.d.ts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/react-lib-components.cjs.development.js +129 -99
- 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 +129 -100
- package/dist/react-lib-components.esm.js.map +1 -1
- package/package.json +8 -8
- package/src/ContextMenu/ContextMenu.module.scss +2 -5
- package/src/ContextMenu/ContextMenu.tsx +1 -1
- package/src/DataGrid/DataGridActions/DataGridColumnsToggle.module.scss +1 -0
- package/src/Form/Input/Input.module.scss +15 -2
- package/src/Form/Select/Select.module.scss +25 -18
- package/src/Form/Select/Select.tsx +1 -1
- package/src/Form/Textarea/Textarea.module.scss +8 -7
- package/src/Form/Wrapper/InputWrapper/InputWrapper.tsx +2 -1
- package/src/Form/Wrapper/TextareaWrapper/TextareaWrapper.module.scss +4 -1
- package/src/Form/Wrapper/TextareaWrapper/TextareaWrapper.tsx +2 -2
- package/src/Notifications/BaseModal/BaseModalActions/BaseModalActions.module.scss +1 -1
- package/src/Notifications/Snackbar/SnackbarItem/SnackbarItem.module.scss +13 -13
- package/src/Notifications/Snackbar/SnackbarItem/SnackbarItem.tsx +1 -1
- package/src/Pagination/Pagination.module.scss +4 -0
- package/src/Pagination/Pagination.tsx +1 -1
- package/src/Popover/Popover.tsx +1 -1
- package/src/Tiles/Tile.tsx +7 -2
- package/src/Typography/Typography.tsx +10 -2
- package/src/_BaseStyling_/BaseStyling.tsx +2 -0
- package/src/index.ts +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onewelcome/react-lib-components",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"author": "OneWelcome B.V.",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
}
|
|
48
48
|
],
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@babel/core": "^7.18.
|
|
50
|
+
"@babel/core": "^7.18.6",
|
|
51
51
|
"@size-limit/preset-small-lib": "^7.0.8",
|
|
52
52
|
"@storybook/addon-a11y": "^6.5.9",
|
|
53
53
|
"@storybook/addon-docs": "^6.5.9",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"@storybook/preset-scss": "^1.0.3",
|
|
60
60
|
"@storybook/react": "^6.5.9",
|
|
61
61
|
"@storybook/theming": "^6.5.9",
|
|
62
|
-
"@testing-library/dom": "^8.
|
|
62
|
+
"@testing-library/dom": "^8.16.0",
|
|
63
63
|
"@testing-library/jest-dom": "^5.16.4",
|
|
64
64
|
"@testing-library/react": "^12.1.5",
|
|
65
65
|
"@testing-library/react-hooks": "^7.0.2",
|
|
@@ -68,15 +68,15 @@
|
|
|
68
68
|
"@tsconfig/recommended": "^1.0.1",
|
|
69
69
|
"@types/color-convert": "^2.0.0",
|
|
70
70
|
"@types/mdx": "^2.0.2",
|
|
71
|
-
"@types/react": "^17.0.
|
|
71
|
+
"@types/react": "^17.0.47",
|
|
72
72
|
"@types/react-dom": "^17.0.17",
|
|
73
73
|
"babel-loader": "^8.2.5",
|
|
74
|
-
"dts-cli": "^1.5.
|
|
74
|
+
"dts-cli": "^1.5.2",
|
|
75
75
|
"html-webpack-plugin": "^5.5.0",
|
|
76
76
|
"husky": "^7.0.4",
|
|
77
77
|
"identity-obj-proxy": "^3.0.0",
|
|
78
78
|
"jest-junit": "^13.2.0",
|
|
79
|
-
"lint-staged": "^
|
|
79
|
+
"lint-staged": "^13.0.3",
|
|
80
80
|
"npm-run-all": "^4.1.5",
|
|
81
81
|
"react": "^17.0.2",
|
|
82
82
|
"react-dom": "^17.0.2",
|
|
@@ -84,9 +84,9 @@
|
|
|
84
84
|
"react-router": "^6.3.0",
|
|
85
85
|
"react-router-dom": "^6.3.0",
|
|
86
86
|
"rollup-plugin-styles": "^4.0.0",
|
|
87
|
-
"sass": "^1.
|
|
87
|
+
"sass": "^1.53.0",
|
|
88
88
|
"size-limit": "^7.0.8",
|
|
89
89
|
"tslib": "^2.4.0",
|
|
90
|
-
"typescript": "^4.
|
|
90
|
+
"typescript": "^4.7.4"
|
|
91
91
|
}
|
|
92
92
|
}
|
|
@@ -177,7 +177,7 @@ export const ContextMenu = React.forwardRef<HTMLDivElement, Props>(
|
|
|
177
177
|
anchorEl={anchorEl}
|
|
178
178
|
show={showContextMenu}
|
|
179
179
|
>
|
|
180
|
-
<ul className={classes
|
|
180
|
+
<ul className={classes['menu']} id={`${id}-menu`} aria-describedby={id} role="menu">
|
|
181
181
|
{renderChildren()}
|
|
182
182
|
</ul>
|
|
183
183
|
</Popover>,
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
position: relative;
|
|
3
3
|
display: flex;
|
|
4
4
|
align-items: center;
|
|
5
|
+
height: calc(4rem - (2 * var(--input-border-width)));
|
|
5
6
|
padding: 0 1.25rem;
|
|
7
|
+
|
|
6
8
|
background-color: var(--input-background-color);
|
|
7
9
|
border-color: var(--input-border-color);
|
|
8
10
|
border-style: var(--input-border-style);
|
|
@@ -10,8 +12,12 @@
|
|
|
10
12
|
border-radius: var(--input-border-radius);
|
|
11
13
|
transition: all 0.2s ease-in-out;
|
|
12
14
|
|
|
13
|
-
&:hover:not(:disabled) {
|
|
15
|
+
&:hover:not(:disabled):not(.error) {
|
|
16
|
+
height: calc(4rem - (2 * var(--input-border-width)));
|
|
17
|
+
padding: 0 1.25rem;
|
|
18
|
+
|
|
14
19
|
border-color: var(--default);
|
|
20
|
+
border-width: var(--input-border-width);
|
|
15
21
|
}
|
|
16
22
|
|
|
17
23
|
&.disabled,
|
|
@@ -26,12 +32,18 @@
|
|
|
26
32
|
}
|
|
27
33
|
|
|
28
34
|
&.focus {
|
|
35
|
+
height: calc(4rem - (2 * var(--input-border-width-focus)));
|
|
36
|
+
padding: 0 calc(1.25rem - var(--input-border-width));
|
|
37
|
+
border-width: var(--input-border-width-focus);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&.focus:not(.error) {
|
|
29
41
|
border-color: var(--color-primary);
|
|
30
42
|
}
|
|
31
43
|
}
|
|
32
44
|
|
|
33
45
|
.input {
|
|
34
|
-
height: 4rem;
|
|
46
|
+
height: calc(4rem - (2 * var(--input-border-width)));
|
|
35
47
|
border: 0;
|
|
36
48
|
color: var(--greyed-out);
|
|
37
49
|
font-size: var(--font-size);
|
|
@@ -41,6 +53,7 @@
|
|
|
41
53
|
padding: 0;
|
|
42
54
|
|
|
43
55
|
&:focus:not(:disabled) {
|
|
56
|
+
height: calc(4rem - (2 * var(--input-border-width-focus)));
|
|
44
57
|
outline: none;
|
|
45
58
|
border-color: var(--color-primary);
|
|
46
59
|
}
|
|
@@ -3,10 +3,6 @@
|
|
|
3
3
|
$listItemHeight: 2.125rem;
|
|
4
4
|
|
|
5
5
|
.select {
|
|
6
|
-
border-color: var(--input-border-color);
|
|
7
|
-
border-style: var(--input-border-style);
|
|
8
|
-
border-width: var(--input-border-width);
|
|
9
|
-
border-radius: var(--input-border-radius);
|
|
10
6
|
position: relative;
|
|
11
7
|
box-sizing: border-box;
|
|
12
8
|
transition: all 0.2s ease-in-out;
|
|
@@ -28,29 +24,45 @@ $listItemHeight: 2.125rem;
|
|
|
28
24
|
}
|
|
29
25
|
|
|
30
26
|
&:not(.expanded) {
|
|
31
|
-
button:focus-visible {
|
|
32
|
-
|
|
27
|
+
button:focus-visible:not(.error) {
|
|
28
|
+
border: var(--input-border-width-focus) solid var(--color-primary);
|
|
33
29
|
}
|
|
34
30
|
}
|
|
35
31
|
|
|
36
|
-
&:hover:not(.disabled):not(.expanded) {
|
|
37
|
-
|
|
32
|
+
&:hover:not(.disabled):not(.expanded):not(.error) {
|
|
33
|
+
button {
|
|
34
|
+
border-color: var(--default);
|
|
35
|
+
border-width: var(--input-border-width);
|
|
36
|
+
}
|
|
38
37
|
}
|
|
39
38
|
|
|
40
39
|
.custom-select {
|
|
40
|
+
position: relative;
|
|
41
41
|
width: 100%;
|
|
42
|
-
min-height: 4rem;
|
|
43
|
-
background-color: transparent;
|
|
42
|
+
min-height: calc(4rem - (2 * var(--input-border-width)));
|
|
44
43
|
border: 0;
|
|
45
|
-
cursor: pointer;
|
|
46
44
|
padding: 0 1.25rem;
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
background-color: transparent;
|
|
46
|
+
border-color: var(--input-border-color);
|
|
47
|
+
border-style: var(--input-border-style);
|
|
48
|
+
border-width: var(--input-border-width);
|
|
49
49
|
border-radius: var(--input-border-radius);
|
|
50
|
+
font-size: var(--font-size);
|
|
51
|
+
cursor: pointer;
|
|
52
|
+
transition: all 0.2s ease-in-out;
|
|
50
53
|
|
|
51
54
|
&:focus-visible {
|
|
52
55
|
outline: 0;
|
|
53
56
|
}
|
|
57
|
+
|
|
58
|
+
&.error {
|
|
59
|
+
border-color: var(--error);
|
|
60
|
+
color: var(--error);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
&.error:focus-visible {
|
|
64
|
+
border-width: var(--input-border-width-focus);
|
|
65
|
+
}
|
|
54
66
|
}
|
|
55
67
|
|
|
56
68
|
.list-wrapper {
|
|
@@ -166,11 +178,6 @@ $listItemHeight: 2.125rem;
|
|
|
166
178
|
color: var(--greyed-out);
|
|
167
179
|
}
|
|
168
180
|
|
|
169
|
-
.error {
|
|
170
|
-
border-color: var(--error);
|
|
171
|
-
color: var(--error);
|
|
172
|
-
}
|
|
173
|
-
|
|
174
181
|
.select-search-wrapper + ul {
|
|
175
182
|
border-radius: 0 0 var(--input-border-radius) var(--input-border-radius);
|
|
176
183
|
}
|
|
@@ -403,6 +403,7 @@ export const Select = React.forwardRef<HTMLSelectElement, Props>(
|
|
|
403
403
|
}}
|
|
404
404
|
type="button"
|
|
405
405
|
name={name}
|
|
406
|
+
className={`${classes['custom-select']} ${additionalClasses.join(' ')} `}
|
|
406
407
|
disabled={disabled}
|
|
407
408
|
aria-disabled={disabled}
|
|
408
409
|
aria-invalid={error}
|
|
@@ -410,7 +411,6 @@ export const Select = React.forwardRef<HTMLSelectElement, Props>(
|
|
|
410
411
|
aria-haspopup="listbox"
|
|
411
412
|
aria-labelledby={labeledBy}
|
|
412
413
|
aria-describedby={describedBy}
|
|
413
|
-
className={classes['custom-select']}
|
|
414
414
|
>
|
|
415
415
|
<div data-display className={classes['selected']}>
|
|
416
416
|
{!value && placeholder && (
|
|
@@ -26,17 +26,18 @@
|
|
|
26
26
|
cursor: not-allowed;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
&:
|
|
30
|
-
|
|
29
|
+
&:focus:not(:disabled) {
|
|
30
|
+
outline: none;
|
|
31
|
+
border-width: var(--input-border-width-focus);
|
|
31
32
|
}
|
|
32
33
|
|
|
33
|
-
&:
|
|
34
|
-
border-color: var(--
|
|
34
|
+
&:focus:not(:disabled):not(.error) {
|
|
35
|
+
border-color: var(--color-primary);
|
|
35
36
|
}
|
|
36
37
|
|
|
37
|
-
&:
|
|
38
|
-
border-color: var(--
|
|
39
|
-
|
|
38
|
+
&:hover:not(:disabled):not(.error) {
|
|
39
|
+
border-color: var(--default);
|
|
40
|
+
border-width: var(--input-border-width);
|
|
40
41
|
}
|
|
41
42
|
}
|
|
42
43
|
|
|
@@ -133,7 +133,8 @@ export const InputWrapper = React.forwardRef<HTMLDivElement, Props>(
|
|
|
133
133
|
e.target.placeholder ||
|
|
134
134
|
inputProps?.placeholder?.length ||
|
|
135
135
|
type === 'datetime-local' ||
|
|
136
|
-
type === 'time'
|
|
136
|
+
type === 'time' ||
|
|
137
|
+
type === 'date'
|
|
137
138
|
? setFloatingLabelActive(true)
|
|
138
139
|
: setFloatingLabelActive(false);
|
|
139
140
|
}}
|
|
@@ -6,6 +6,9 @@
|
|
|
6
6
|
&.focus {
|
|
7
7
|
color: var(--color-primary);
|
|
8
8
|
}
|
|
9
|
+
&.error {
|
|
10
|
+
color: var(--error);
|
|
11
|
+
}
|
|
9
12
|
}
|
|
10
13
|
|
|
11
14
|
.textarea {
|
|
@@ -15,7 +18,7 @@
|
|
|
15
18
|
border-color: var(--color-primary);
|
|
16
19
|
}
|
|
17
20
|
|
|
18
|
-
&:hover:not(:disabled) {
|
|
21
|
+
&:hover:not(:disabled):not(.error) {
|
|
19
22
|
border-color: var(--default);
|
|
20
23
|
}
|
|
21
24
|
|
|
@@ -65,7 +65,7 @@ export const TextareaWrapper = React.forwardRef<HTMLDivElement, Props>(
|
|
|
65
65
|
disabled={disabled}
|
|
66
66
|
labelProps={{
|
|
67
67
|
id: labelId,
|
|
68
|
-
className: `${classes['textarea-label']} ${
|
|
68
|
+
className: `${classes['textarea-label']} ${optionalClasses.join('')}`,
|
|
69
69
|
}}
|
|
70
70
|
name={name}
|
|
71
71
|
label={label}
|
|
@@ -108,7 +108,7 @@ export const TextareaWrapper = React.forwardRef<HTMLDivElement, Props>(
|
|
|
108
108
|
onMouseLeave && onMouseLeave(e);
|
|
109
109
|
setHover(false);
|
|
110
110
|
}}
|
|
111
|
-
className={classes['textarea']}
|
|
111
|
+
className={`${classes['textarea']} ${error ? classes['error'] : ''}`}
|
|
112
112
|
wrapperProps={{
|
|
113
113
|
className: `${classes['textarea-wrapper']}} ${optionalClasses.join(' ')}`,
|
|
114
114
|
}}
|
|
@@ -30,23 +30,23 @@
|
|
|
30
30
|
.headline {
|
|
31
31
|
display: flex;
|
|
32
32
|
color: var(--snackbar-text-color);
|
|
33
|
+
}
|
|
33
34
|
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
#close-btn {
|
|
36
|
+
color: var(--snackbar-text-color);
|
|
36
37
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
&:hover,
|
|
39
|
+
&:focus {
|
|
40
|
+
border-color: var(--snackbar-text-color);
|
|
41
|
+
}
|
|
41
42
|
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
&:active {
|
|
44
|
+
border-color: transparent;
|
|
44
45
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
46
|
+
&:after {
|
|
47
|
+
top: 0;
|
|
48
|
+
height: 100%;
|
|
49
|
+
background-color: var(--snackbar-text-color);
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
}
|
|
@@ -82,7 +82,7 @@ export const Pagination = React.forwardRef<HTMLDivElement, Props>(
|
|
|
82
82
|
<Label
|
|
83
83
|
id="current-value-input-label"
|
|
84
84
|
htmlFor="current-value-input"
|
|
85
|
-
className={readyclasses['sr-only']}
|
|
85
|
+
className={`${readyclasses['sr-only']} ${classes['current-value-input-label']}`}
|
|
86
86
|
>
|
|
87
87
|
{translate.currentPageLabel}
|
|
88
88
|
</Label>
|
package/src/Popover/Popover.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { ComponentPropsWithRef, ReactNode, RefObject, useEffect, useRef } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { Offset, Placement, usePosition } from '../hooks/usePosition';
|
|
3
3
|
import classes from './Popover.module.scss';
|
|
4
4
|
|
|
5
5
|
export interface Props extends ComponentPropsWithRef<'div'> {
|
package/src/Tiles/Tile.tsx
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, {
|
|
2
|
+
ComponentPropsWithoutRef,
|
|
3
|
+
ComponentPropsWithRef,
|
|
4
|
+
ReactElement,
|
|
5
|
+
useState,
|
|
6
|
+
} from 'react';
|
|
2
7
|
import { Icon, Icons } from '../Icon/Icon';
|
|
3
8
|
import classes from './Tile.module.scss';
|
|
4
9
|
import readyClasses from '../readyclasses.module.scss';
|
|
@@ -7,7 +12,7 @@ import { Props as ContextMenuProps } from '../ContextMenu/ContextMenu';
|
|
|
7
12
|
import { generateID } from '../util/helper';
|
|
8
13
|
import { Props as IconButtonProps } from '../Button/IconButton';
|
|
9
14
|
|
|
10
|
-
interface ImageProps {
|
|
15
|
+
interface ImageProps extends ComponentPropsWithoutRef<'img'> {
|
|
11
16
|
src: string;
|
|
12
17
|
}
|
|
13
18
|
|
|
@@ -2,7 +2,16 @@ import React, { ComponentPropsWithRef, ReactNode } from 'react';
|
|
|
2
2
|
import classes from './Typography.module.scss';
|
|
3
3
|
import { Spacing, useSpacing } from '../hooks/useSpacing';
|
|
4
4
|
|
|
5
|
-
const validVariants = [
|
|
5
|
+
export const validVariants = [
|
|
6
|
+
'h1',
|
|
7
|
+
'h2',
|
|
8
|
+
'h3',
|
|
9
|
+
'h4',
|
|
10
|
+
'body',
|
|
11
|
+
'body-bold',
|
|
12
|
+
'sub-text',
|
|
13
|
+
'code',
|
|
14
|
+
] as const;
|
|
6
15
|
export type Variant = typeof validVariants[number];
|
|
7
16
|
|
|
8
17
|
type Tags =
|
|
@@ -24,7 +33,6 @@ type Tags =
|
|
|
24
33
|
| 'ins'
|
|
25
34
|
| 'blockquote';
|
|
26
35
|
|
|
27
|
-
/** I couldn't find anything on the internet that indicated that ComponentPropsWithRef can take multiple tags. Since the TagName can be many different things I have to use any here. Using a mix of tags (like the Tags type) will throw an error. */
|
|
28
36
|
export interface Props extends ComponentPropsWithRef<any> {
|
|
29
37
|
children: ReactNode;
|
|
30
38
|
variant: Variant;
|
|
@@ -16,6 +16,7 @@ interface CSSProperties {
|
|
|
16
16
|
inputBorderColor?: string;
|
|
17
17
|
inputBorderRadius?: string;
|
|
18
18
|
inputBorderWidth?: string;
|
|
19
|
+
inputBorderWidthFocus?: string;
|
|
19
20
|
inputBorderStyle?: string;
|
|
20
21
|
inputBackgroundColor?: string;
|
|
21
22
|
modalShadowColor?: string;
|
|
@@ -74,6 +75,7 @@ export const BaseStyling = ({ children, properties = {} }: Props) => {
|
|
|
74
75
|
inputBorderColor: '#e9e9eb',
|
|
75
76
|
inputBorderRadius: '8px',
|
|
76
77
|
inputBorderWidth: '1px',
|
|
78
|
+
inputBorderWidthFocus: '2px',
|
|
77
79
|
inputBorderStyle: 'solid',
|
|
78
80
|
inputBackgroundColor: '#fff',
|
|
79
81
|
modalShadowColor: 'rgba(0, 0, 0, 0.16)',
|
package/src/index.ts
CHANGED
|
@@ -15,6 +15,7 @@ export { Tiles, Props as TilesProps } from './Tiles/Tiles';
|
|
|
15
15
|
export { Tooltip, Props as TooltipProps } from './Tooltip/Tooltip';
|
|
16
16
|
export { Typography, Variant, Props as TypographyProps } from './Typography/Typography';
|
|
17
17
|
export { Skeleton, Props as SkeletonProps } from './Skeleton/Skeleton';
|
|
18
|
+
export { StatusIndicator, Props as StatusIndicatorProps } from './StatusIndicator/StatusIndicator';
|
|
18
19
|
export {
|
|
19
20
|
Pagination,
|
|
20
21
|
Props as PaginationProps,
|