@onewelcome/react-lib-components 1.3.0 → 1.4.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/Button/IconButton.d.ts +2 -1
- package/dist/DataGrid/DataGrid.d.ts +1 -0
- package/dist/DataGrid/DataGridActions/DataGridActions.d.ts +2 -1
- package/dist/Form/Form.d.ts +3 -3
- package/dist/Notifications/SlideInModal/SlideInModal.d.ts +1 -1
- package/dist/Tabs/Tab.d.ts +5 -9
- package/dist/Tabs/TabButton.d.ts +3 -6
- package/dist/Tabs/Tabs.d.ts +1 -2
- package/dist/react-lib-components.cjs.development.js +437 -392
- 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 +438 -393
- package/dist/react-lib-components.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/Breadcrumbs/Breadcrumbs.tsx +46 -38
- package/src/Button/BaseButton.tsx +23 -20
- package/src/Button/Button.tsx +40 -40
- package/src/Button/IconButton.tsx +28 -28
- package/src/ContextMenu/ContextMenu.tsx +161 -160
- package/src/ContextMenu/ContextMenuItem.tsx +55 -49
- package/src/DataGrid/DataGrid.tsx +1 -0
- package/src/DataGrid/DataGridActions/DataGridActions.module.scss +1 -1
- package/src/DataGrid/DataGridActions/DataGridActions.test.tsx +4 -2
- package/src/DataGrid/DataGridActions/DataGridActions.tsx +95 -87
- package/src/DataGrid/DataGridActions/DataGridColumnsToggle.tsx +64 -64
- package/src/DataGrid/DataGridBody/DataGridCell.tsx +42 -44
- package/src/DataGrid/DataGridBody/DataGridRow.tsx +29 -29
- package/src/DataGrid/DataGridHeader/DataGridHeader.tsx +78 -78
- package/src/DataGrid/DataGridHeader/DataGridHeaderCell.tsx +48 -48
- package/src/Form/Checkbox/Checkbox.tsx +134 -130
- package/src/Form/Fieldset/Fieldset.tsx +81 -78
- package/src/Form/Form.tsx +9 -4
- package/src/Form/FormControl/FormControl.module.scss +1 -20
- package/src/Form/FormControl/FormControl.tsx +36 -35
- package/src/Form/FormGroup/FormGroup.tsx +62 -62
- package/src/Form/FormHelperText/FormHelperText.tsx +19 -18
- package/src/Form/FormSelectorWrapper/FormSelectorWrapper.tsx +58 -53
- package/src/Form/Input/Input.tsx +90 -87
- package/src/Form/Label/Label.tsx +17 -16
- package/src/Form/Radio/Radio.tsx +91 -91
- package/src/Form/Select/Option.tsx +66 -60
- package/src/Form/Select/Select.tsx +207 -209
- package/src/Form/Textarea/Textarea.tsx +51 -53
- package/src/Form/Toggle/Toggle.tsx +26 -23
- package/src/Form/Wrapper/CheckboxWrapper/CheckboxWrapper.tsx +51 -43
- package/src/Form/Wrapper/InputWrapper/InputWrapper.tsx +112 -106
- package/src/Form/Wrapper/RadioWrapper/RadioWrapper.tsx +67 -62
- package/src/Form/Wrapper/SelectWrapper/SelectWrapper.tsx +42 -37
- package/src/Form/Wrapper/TextareaWrapper/TextareaWrapper.tsx +94 -94
- package/src/Form/Wrapper/Wrapper/Wrapper.tsx +73 -73
- package/src/Icon/Icon.tsx +19 -16
- package/src/Link/Link.tsx +68 -63
- package/src/Notifications/BaseModal/BaseModal.tsx +68 -68
- package/src/Notifications/BaseModal/BaseModalActions/BaseModalActions.tsx +13 -10
- package/src/Notifications/BaseModal/BaseModalContent/BaseModalContent.tsx +33 -25
- package/src/Notifications/BaseModal/BaseModalHeader/BaseModalHeader.tsx +20 -17
- package/src/Notifications/Dialog/Dialog.tsx +83 -83
- package/src/Notifications/Dialog/DialogActions/DialogActions.tsx +17 -14
- package/src/Notifications/Dialog/DialogTitle/DialogTitle.tsx +15 -12
- package/src/Notifications/DiscardChangesModal/DiscardChangesDialog/DiscardChangesDialog.tsx +40 -40
- package/src/Notifications/SlideInModal/SlideInModal.module.scss +5 -5
- package/src/Notifications/SlideInModal/SlideInModal.test.tsx +7 -2
- package/src/Notifications/SlideInModal/SlideInModal.tsx +47 -27
- package/src/Pagination/Pagination.tsx +169 -169
- package/src/Popover/Popover.module.scss +1 -0
- package/src/Popover/Popover.tsx +43 -33
- package/src/ProgressBar/ProgressBar.tsx +17 -14
- package/src/Skeleton/Skeleton.tsx +23 -20
- package/src/StatusIndicator/StatusIndicator.tsx +18 -15
- package/src/Tabs/{TabPanel.module.scss → Tab.module.scss} +1 -1
- package/src/Tabs/Tab.test.tsx +1 -39
- package/src/Tabs/Tab.tsx +16 -10
- package/src/Tabs/TabButton.module.scss +0 -4
- package/src/Tabs/TabButton.test.tsx +3 -31
- package/src/Tabs/TabButton.tsx +35 -49
- package/src/Tabs/Tabs.test.tsx +40 -33
- package/src/Tabs/Tabs.tsx +107 -101
- package/src/TextEllipsis/TextEllipsis.tsx +50 -41
- package/src/Tiles/Tile.tsx +58 -56
- package/src/Tiles/Tiles.tsx +44 -41
- package/src/Tooltip/Tooltip.tsx +101 -100
- package/src/Typography/Typography.tsx +47 -44
- package/src/Wizard/BaseWizardSteps/BaseWizardSteps.tsx +55 -52
- package/src/Wizard/WizardSteps/WizardSteps.tsx +25 -22
- package/src/mixins.module.scss +2 -2
- package/src/util/helper.test.tsx +0 -28
- package/dist/Tabs/TabPanel.d.ts +0 -8
- package/src/Tabs/TabPanel.test.tsx +0 -92
- package/src/Tabs/TabPanel.tsx +0 -43
package/src/Tooltip/Tooltip.tsx
CHANGED
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
import React, {
|
|
18
18
|
ComponentPropsWithRef,
|
|
19
|
+
ForwardRefRenderFunction,
|
|
19
20
|
ReactElement,
|
|
20
21
|
ReactNode,
|
|
21
22
|
useEffect,
|
|
@@ -50,110 +51,110 @@ const defaultPosition: DefaultPosition = {
|
|
|
50
51
|
transformOrigin: { horizontal: "left", vertical: "center" }
|
|
51
52
|
};
|
|
52
53
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
useEffect(() => {
|
|
82
|
-
if (!visible) return;
|
|
83
|
-
|
|
84
|
-
function escapePressHandler(event: KeyboardEvent) {
|
|
85
|
-
if (event.key === "Escape") {
|
|
86
|
-
setVisible(false);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
54
|
+
const TooltipComponent: ForwardRefRenderFunction<HTMLDivElement, Props> = (
|
|
55
|
+
{
|
|
56
|
+
children,
|
|
57
|
+
className,
|
|
58
|
+
placement = defaultPosition.placement,
|
|
59
|
+
offset = defaultPosition.offset,
|
|
60
|
+
transformOrigin = defaultPosition.transformOrigin,
|
|
61
|
+
domRoot = document.body,
|
|
62
|
+
label,
|
|
63
|
+
...rest
|
|
64
|
+
}: Props,
|
|
65
|
+
ref
|
|
66
|
+
) => {
|
|
67
|
+
const [identifier] = useState(generateID());
|
|
68
|
+
const [visible, setVisible] = useState(false);
|
|
69
|
+
|
|
70
|
+
const relativeElement = useRef<HTMLDivElement>(null);
|
|
71
|
+
const elementToBePositioned = useRef<HTMLDivElement>(null);
|
|
72
|
+
|
|
73
|
+
const { top, bottom, right, left, calculatePosition } = usePosition({
|
|
74
|
+
relativeElement: relativeElement,
|
|
75
|
+
elementToBePositioned: elementToBePositioned,
|
|
76
|
+
placement: placement,
|
|
77
|
+
offset: offset,
|
|
78
|
+
transformOrigin: transformOrigin
|
|
79
|
+
});
|
|
89
80
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
useLayoutEffect(() => {
|
|
98
|
-
calculatePosition();
|
|
99
|
-
}, [visible]);
|
|
100
|
-
|
|
101
|
-
const renderChildren = () => {
|
|
102
|
-
if (React.isValidElement(label)) {
|
|
103
|
-
return React.cloneElement(label as ReactElement, {
|
|
104
|
-
onFocus: () => setVisible(true),
|
|
105
|
-
onBlur: () => setVisible(false),
|
|
106
|
-
"aria-describedby": identifier,
|
|
107
|
-
tabIndex: 0,
|
|
108
|
-
className: classes["label"]
|
|
109
|
-
});
|
|
81
|
+
useEffect(() => {
|
|
82
|
+
if (!visible) return;
|
|
83
|
+
|
|
84
|
+
function escapePressHandler(event: KeyboardEvent) {
|
|
85
|
+
if (event.key === "Escape") {
|
|
86
|
+
setVisible(false);
|
|
110
87
|
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
document.addEventListener("keyup", escapePressHandler);
|
|
111
91
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
className={classes["label"]}
|
|
115
|
-
tabIndex={0}
|
|
116
|
-
onFocus={() => setVisible(true)}
|
|
117
|
-
onBlur={() => setVisible(false)}
|
|
118
|
-
aria-describedby={identifier}
|
|
119
|
-
>
|
|
120
|
-
{label}
|
|
121
|
-
</span>
|
|
122
|
-
);
|
|
92
|
+
return () => {
|
|
93
|
+
document.removeEventListener("keyup", escapePressHandler);
|
|
123
94
|
};
|
|
95
|
+
}, [visible]);
|
|
96
|
+
|
|
97
|
+
useLayoutEffect(() => {
|
|
98
|
+
calculatePosition();
|
|
99
|
+
}, [visible]);
|
|
100
|
+
|
|
101
|
+
const renderChildren = () => {
|
|
102
|
+
if (React.isValidElement(label)) {
|
|
103
|
+
return React.cloneElement(label as ReactElement, {
|
|
104
|
+
onFocus: () => setVisible(true),
|
|
105
|
+
onBlur: () => setVisible(false),
|
|
106
|
+
"aria-describedby": identifier,
|
|
107
|
+
tabIndex: 0,
|
|
108
|
+
className: classes["label"]
|
|
109
|
+
});
|
|
110
|
+
}
|
|
124
111
|
|
|
125
112
|
return (
|
|
126
|
-
<
|
|
127
|
-
{
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
className={classes.icon}
|
|
136
|
-
/>
|
|
137
|
-
{createPortal(
|
|
138
|
-
<div
|
|
139
|
-
ref={elementToBePositioned}
|
|
140
|
-
style={{
|
|
141
|
-
...rest.style,
|
|
142
|
-
top: top,
|
|
143
|
-
left: left,
|
|
144
|
-
right: right,
|
|
145
|
-
bottom: bottom
|
|
146
|
-
}}
|
|
147
|
-
aria-hidden={!visible}
|
|
148
|
-
id={identifier}
|
|
149
|
-
className={`${classes.tooltip} ${visible ? classes.visible : ""}`}
|
|
150
|
-
>
|
|
151
|
-
{children}
|
|
152
|
-
</div>,
|
|
153
|
-
domRoot
|
|
154
|
-
)}
|
|
155
|
-
</div>
|
|
156
|
-
</div>
|
|
113
|
+
<span
|
|
114
|
+
className={classes["label"]}
|
|
115
|
+
tabIndex={0}
|
|
116
|
+
onFocus={() => setVisible(true)}
|
|
117
|
+
onBlur={() => setVisible(false)}
|
|
118
|
+
aria-describedby={identifier}
|
|
119
|
+
>
|
|
120
|
+
{label}
|
|
121
|
+
</span>
|
|
157
122
|
);
|
|
158
|
-
}
|
|
159
|
-
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
return (
|
|
126
|
+
<div {...rest} ref={ref} className={`${classes.wrapper} ${className ?? ""}`}>
|
|
127
|
+
{renderChildren()}
|
|
128
|
+
<div className={`${classes["tooltip-wrapper"]}`}>
|
|
129
|
+
<Icon
|
|
130
|
+
ref={relativeElement}
|
|
131
|
+
tag="div"
|
|
132
|
+
onMouseEnter={() => setVisible(true)}
|
|
133
|
+
onMouseLeave={() => setVisible(false)}
|
|
134
|
+
icon={Icons.InfoCircle}
|
|
135
|
+
className={classes.icon}
|
|
136
|
+
/>
|
|
137
|
+
{createPortal(
|
|
138
|
+
<div
|
|
139
|
+
ref={elementToBePositioned}
|
|
140
|
+
style={{
|
|
141
|
+
...rest.style,
|
|
142
|
+
top: top,
|
|
143
|
+
left: left,
|
|
144
|
+
right: right,
|
|
145
|
+
bottom: bottom
|
|
146
|
+
}}
|
|
147
|
+
aria-hidden={!visible}
|
|
148
|
+
id={identifier}
|
|
149
|
+
className={`${classes.tooltip} ${visible ? classes.visible : ""}`}
|
|
150
|
+
>
|
|
151
|
+
{children}
|
|
152
|
+
</div>,
|
|
153
|
+
domRoot
|
|
154
|
+
)}
|
|
155
|
+
</div>
|
|
156
|
+
</div>
|
|
157
|
+
);
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
export const Tooltip = React.forwardRef(TooltipComponent);
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import React, { ComponentPropsWithRef, ReactNode } from "react";
|
|
17
|
+
import React, { ForwardRefRenderFunction, ComponentPropsWithRef, ReactNode } from "react";
|
|
18
18
|
import classes from "./Typography.module.scss";
|
|
19
19
|
import { Spacing, useSpacing } from "../hooks/useSpacing";
|
|
20
20
|
|
|
@@ -56,51 +56,54 @@ export interface Props extends ComponentPropsWithRef<any> {
|
|
|
56
56
|
spacing?: Spacing;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
59
|
+
const TypographyComponent: ForwardRefRenderFunction<any, Props> = (
|
|
60
|
+
{ children, variant, tag, style, spacing, className = "", ...rest }: Props,
|
|
61
|
+
ref
|
|
62
|
+
) => {
|
|
63
|
+
if (!validVariants.includes(variant)) {
|
|
64
|
+
throw new Error(
|
|
65
|
+
`You entered an invalid variant. You can choose from: ${validVariants}, you entered: ${variant}`
|
|
66
|
+
);
|
|
67
|
+
}
|
|
66
68
|
|
|
67
|
-
|
|
69
|
+
const styleWithSpacing = useSpacing(spacing, style);
|
|
68
70
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
71
|
+
if (!tag) {
|
|
72
|
+
switch (variant) {
|
|
73
|
+
case "h1":
|
|
74
|
+
case "h2":
|
|
75
|
+
case "h3":
|
|
76
|
+
case "h4":
|
|
77
|
+
case "code":
|
|
78
|
+
tag = variant;
|
|
79
|
+
break;
|
|
80
|
+
case "body":
|
|
81
|
+
tag = "p";
|
|
82
|
+
break;
|
|
83
|
+
case "body-bold":
|
|
84
|
+
tag = "p";
|
|
85
|
+
break;
|
|
86
|
+
case "sub-text":
|
|
87
|
+
tag = "span";
|
|
88
|
+
break;
|
|
89
|
+
default:
|
|
90
|
+
tag = "div";
|
|
91
|
+
break;
|
|
91
92
|
}
|
|
93
|
+
}
|
|
92
94
|
|
|
93
|
-
|
|
95
|
+
let TagName = tag;
|
|
94
96
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
97
|
+
return (
|
|
98
|
+
<TagName
|
|
99
|
+
{...rest}
|
|
100
|
+
ref={ref}
|
|
101
|
+
style={styleWithSpacing}
|
|
102
|
+
className={`${classes["typography_style_" + variant]} ${className}`}
|
|
103
|
+
>
|
|
104
|
+
{children}
|
|
105
|
+
</TagName>
|
|
106
|
+
);
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
export const Typography = React.forwardRef(TypographyComponent);
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import React, { ComponentPropsWithRef, Fragment } from "react";
|
|
17
|
+
import React, { ForwardRefRenderFunction, ComponentPropsWithRef, Fragment } from "react";
|
|
18
18
|
import classes from "./BaseWizardSteps.module.scss";
|
|
19
19
|
import { Icon, Icons } from "../../Icon/Icon";
|
|
20
20
|
|
|
@@ -32,59 +32,62 @@ export interface Props extends Omit<ComponentPropsWithRef<"div">, "onClick"> {
|
|
|
32
32
|
futureStepsClickable?: boolean;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
return "
|
|
44
|
-
}
|
|
35
|
+
const BaseWizardStepsComponent: ForwardRefRenderFunction<HTMLDivElement, Props> = (
|
|
36
|
+
{ steps, currentStepNo, onClick, futureStepsClickable = false, ...rest }: Props,
|
|
37
|
+
ref
|
|
38
|
+
) => {
|
|
39
|
+
const getStepState = (stepNo: number): StepState => {
|
|
40
|
+
if (currentStepNo === stepNo) {
|
|
41
|
+
return "current";
|
|
42
|
+
} else if (stepNo < currentStepNo) {
|
|
43
|
+
return "finished";
|
|
44
|
+
}
|
|
45
|
+
return "future";
|
|
46
|
+
};
|
|
45
47
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
48
|
+
const getStepContent = (stepState: StepState, index: number, disabled?: boolean) => {
|
|
49
|
+
const stepNumberString = String(index + 1);
|
|
50
|
+
if (stepState === "finished") {
|
|
51
|
+
return disabled ? null : <Icon className={classes["checkmark"]} icon={Icons.Checkmark} />;
|
|
52
|
+
} else {
|
|
53
|
+
return <Fragment>{stepNumberString}</Fragment>;
|
|
54
|
+
}
|
|
55
|
+
};
|
|
54
56
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
return (
|
|
61
|
-
<button
|
|
62
|
-
key={step.label.toLowerCase().replace(/\s/, "-")}
|
|
63
|
-
disabled={
|
|
64
|
-
step.disabled ||
|
|
65
|
-
(stepState === "future" && !futureStepsClickable) ||
|
|
66
|
-
stepState === "current"
|
|
67
|
-
}
|
|
68
|
-
aria-current={stepState === "current" ? "step" : undefined}
|
|
69
|
-
onClick={() => onClick && onClick(index)}
|
|
70
|
-
className={`${classes["wizard-element"]} ${classes[stepState]} ${clickableClassName} ${disabledStyleClassName}`}
|
|
71
|
-
>
|
|
72
|
-
<div className={classes["number-wrapper"]}>
|
|
73
|
-
<span className={classes["number"]}>
|
|
74
|
-
{getStepContent(stepState, index, step.disabled)}
|
|
75
|
-
</span>
|
|
76
|
-
</div>
|
|
77
|
-
<div className={classes["two-line-text-overflow"]}>
|
|
78
|
-
<span className={classes["label"]}>{step.label}</span>
|
|
79
|
-
</div>
|
|
80
|
-
</button>
|
|
81
|
-
);
|
|
82
|
-
});
|
|
57
|
+
const generatedSteps = steps.map((step, index) => {
|
|
58
|
+
const stepState = getStepState(index);
|
|
59
|
+
const disabledStyleClassName = step.disabled ? classes["disabled"] : "";
|
|
60
|
+
const clickableClassName = futureStepsClickable ? classes["clickable"] : "";
|
|
83
61
|
|
|
84
62
|
return (
|
|
85
|
-
<
|
|
86
|
-
{
|
|
87
|
-
|
|
63
|
+
<button
|
|
64
|
+
key={step.label.toLowerCase().replace(/\s/, "-")}
|
|
65
|
+
disabled={
|
|
66
|
+
step.disabled ||
|
|
67
|
+
(stepState === "future" && !futureStepsClickable) ||
|
|
68
|
+
stepState === "current"
|
|
69
|
+
}
|
|
70
|
+
aria-current={stepState === "current" ? "step" : undefined}
|
|
71
|
+
onClick={() => onClick && onClick(index)}
|
|
72
|
+
className={`${classes["wizard-element"]} ${classes[stepState]} ${clickableClassName} ${disabledStyleClassName}`}
|
|
73
|
+
>
|
|
74
|
+
<div className={classes["number-wrapper"]}>
|
|
75
|
+
<span className={classes["number"]}>
|
|
76
|
+
{getStepContent(stepState, index, step.disabled)}
|
|
77
|
+
</span>
|
|
78
|
+
</div>
|
|
79
|
+
<div className={classes["two-line-text-overflow"]}>
|
|
80
|
+
<span className={classes["label"]}>{step.label}</span>
|
|
81
|
+
</div>
|
|
82
|
+
</button>
|
|
88
83
|
);
|
|
89
|
-
}
|
|
90
|
-
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
return (
|
|
87
|
+
<div {...rest} ref={ref} className={classes["wizard"]}>
|
|
88
|
+
{generatedSteps}
|
|
89
|
+
</div>
|
|
90
|
+
);
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
export const BaseWizardSteps = React.forwardRef(BaseWizardStepsComponent);
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import React, { ComponentPropsWithRef, useContext } from "react";
|
|
17
|
+
import React, { ForwardRefRenderFunction, ComponentPropsWithRef, useContext } from "react";
|
|
18
18
|
import { WizardStateContext } from "../WizardStateProvider";
|
|
19
19
|
import { BaseWizardSteps } from "../BaseWizardSteps/BaseWizardSteps";
|
|
20
20
|
import { changeCurrentStepNo } from "../wizardStateReducer";
|
|
@@ -23,26 +23,29 @@ export interface Props extends ComponentPropsWithRef<"div"> {
|
|
|
23
23
|
onStepClick: (currentStepNo: number, selectedStepNo: number) => boolean;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
const WizardStepsComponent: ForwardRefRenderFunction<HTMLDivElement, Props> = (
|
|
27
|
+
{ onStepClick, ...rest }: Props,
|
|
28
|
+
ref
|
|
29
|
+
) => {
|
|
30
|
+
const {
|
|
31
|
+
state: { currentStepNo, mode, steps },
|
|
32
|
+
dispatch
|
|
33
|
+
} = useContext(WizardStateContext);
|
|
32
34
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
const onClick = (selectedStepNo: number) => {
|
|
36
|
+
onStepClick(currentStepNo, selectedStepNo) && dispatch(changeCurrentStepNo(selectedStepNo));
|
|
37
|
+
};
|
|
36
38
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
39
|
+
return (
|
|
40
|
+
<BaseWizardSteps
|
|
41
|
+
{...rest}
|
|
42
|
+
ref={ref}
|
|
43
|
+
onClick={onClick}
|
|
44
|
+
steps={steps}
|
|
45
|
+
currentStepNo={currentStepNo}
|
|
46
|
+
futureStepsClickable={mode === "edit"}
|
|
47
|
+
/>
|
|
48
|
+
);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export const WizardSteps = React.forwardRef(WizardStepsComponent);
|
package/src/mixins.module.scss
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
@
|
|
17
|
+
@use "./readyclasses.module.scss";
|
|
18
18
|
|
|
19
19
|
@mixin button($variant: "text", $type: "default") {
|
|
20
20
|
$disabledSelector: if($type == "link", ".disabled", ":disabled");
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
color: $color;
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
@include focusOutline(var(--color-focus));
|
|
87
|
+
@include readyclasses.focusOutline(var(--color-focus));
|
|
88
88
|
|
|
89
89
|
&:hover:not(.disabled),
|
|
90
90
|
&:focus:not(.disabled) {
|
package/src/util/helper.test.tsx
CHANGED
|
@@ -123,34 +123,6 @@ describe("debounce function", () => {
|
|
|
123
123
|
});
|
|
124
124
|
|
|
125
125
|
describe("throttling works", () => {
|
|
126
|
-
it("throttles the function", async () => {
|
|
127
|
-
const throttledFunction = jest.fn();
|
|
128
|
-
|
|
129
|
-
window.addEventListener("resize", throttle(throttledFunction, 1));
|
|
130
|
-
|
|
131
|
-
await fireEvent.resize(window);
|
|
132
|
-
await fireEvent.resize(window);
|
|
133
|
-
await fireEvent.resize(window);
|
|
134
|
-
await fireEvent.resize(window);
|
|
135
|
-
await fireEvent.resize(window);
|
|
136
|
-
await fireEvent.resize(window);
|
|
137
|
-
await fireEvent.resize(window);
|
|
138
|
-
await fireEvent.resize(window);
|
|
139
|
-
await fireEvent.resize(window);
|
|
140
|
-
await fireEvent.resize(window);
|
|
141
|
-
await fireEvent.resize(window);
|
|
142
|
-
await fireEvent.resize(window);
|
|
143
|
-
await fireEvent.resize(window);
|
|
144
|
-
await fireEvent.resize(window);
|
|
145
|
-
await fireEvent.resize(window);
|
|
146
|
-
await fireEvent.resize(window);
|
|
147
|
-
await fireEvent.resize(window);
|
|
148
|
-
await fireEvent.resize(window);
|
|
149
|
-
|
|
150
|
-
expect(throttledFunction).not.toHaveBeenCalledTimes(1);
|
|
151
|
-
expect(throttledFunction).not.toHaveBeenCalledTimes(10);
|
|
152
|
-
});
|
|
153
|
-
|
|
154
126
|
it("Works in a react component as well, it should only fire the exampleFunction once.", async () => {
|
|
155
127
|
const ExampleComponent = ({
|
|
156
128
|
throttledFunction
|
package/dist/Tabs/TabPanel.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import React, { ComponentPropsWithRef } from "react";
|
|
2
|
-
export interface Props extends ComponentPropsWithRef<"div"> {
|
|
3
|
-
children: React.ReactNode;
|
|
4
|
-
tabId: string;
|
|
5
|
-
tabPanelId: string;
|
|
6
|
-
selected?: boolean;
|
|
7
|
-
}
|
|
8
|
-
export declare const TabPanel: React.ForwardRefExoticComponent<Pick<Props, "slot" | "style" | "title" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "nonce" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "tabId" | "tabPanelId" | "selected"> & React.RefAttributes<HTMLDivElement>>;
|