@onewelcome/react-lib-components 1.2.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/hooks/useDebouncedCallback.d.ts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/react-lib-components.cjs.development.js +472 -395
- 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 +473 -397
- 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.module.scss +9 -0
- 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.module.scss +1 -0
- 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/hooks/useDebouncedCallback.test.ts +140 -0
- package/src/hooks/useDebouncedCallback.tsx +32 -0
- package/src/index.ts +1 -0
- 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/index.ts
CHANGED
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>>;
|
|
@@ -1,92 +0,0 @@
|
|
|
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 from "react";
|
|
18
|
-
import { TabPanel, Props } from "./TabPanel";
|
|
19
|
-
import { render } from "@testing-library/react";
|
|
20
|
-
|
|
21
|
-
const defaultParams: Props = {
|
|
22
|
-
tabId: "fakeTabId",
|
|
23
|
-
tabPanelId: "fakeTabPanelId",
|
|
24
|
-
children: []
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
const createTabPanel = (params?: (defaultParams: Props) => Props) => {
|
|
28
|
-
let parameters: Props = defaultParams;
|
|
29
|
-
if (params) {
|
|
30
|
-
parameters = params(defaultParams);
|
|
31
|
-
}
|
|
32
|
-
const queries = render(
|
|
33
|
-
<TabPanel {...parameters} data-testid="tabpanel">
|
|
34
|
-
tabpanel content
|
|
35
|
-
</TabPanel>
|
|
36
|
-
);
|
|
37
|
-
const tabpanel = queries.getByTestId("tabpanel");
|
|
38
|
-
|
|
39
|
-
return {
|
|
40
|
-
...queries,
|
|
41
|
-
tabpanel
|
|
42
|
-
};
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
describe("TabPanel should render", () => {
|
|
46
|
-
it("renders without crashing", () => {
|
|
47
|
-
const { tabpanel } = createTabPanel();
|
|
48
|
-
|
|
49
|
-
expect(tabpanel).toBeTruthy();
|
|
50
|
-
|
|
51
|
-
expect(tabpanel).toHaveAttribute("aria-hidden", "true");
|
|
52
|
-
expect(tabpanel).toHaveAttribute("hidden");
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
it("should be visible when prop selected is passed", () => {
|
|
56
|
-
const { tabpanel } = createTabPanel(defaultParams => ({
|
|
57
|
-
...defaultParams,
|
|
58
|
-
selected: true
|
|
59
|
-
}));
|
|
60
|
-
|
|
61
|
-
expect(tabpanel).toHaveClass("selected");
|
|
62
|
-
expect(tabpanel).toHaveAttribute("aria-hidden", "false");
|
|
63
|
-
expect(tabpanel).not.toHaveAttribute("hidden");
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
it("should set id when prop tabPanelId is passed", () => {
|
|
67
|
-
const { tabpanel } = createTabPanel(defaultParams => ({
|
|
68
|
-
...defaultParams,
|
|
69
|
-
tabPanelId: "fakeId"
|
|
70
|
-
}));
|
|
71
|
-
|
|
72
|
-
expect(tabpanel).toHaveAttribute("id", "fakeId");
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
it("should set accessibility attributes when prop tabId is passed", () => {
|
|
76
|
-
const { tabpanel } = createTabPanel(defaultParams => ({
|
|
77
|
-
...defaultParams,
|
|
78
|
-
tabId: "fakeId"
|
|
79
|
-
}));
|
|
80
|
-
|
|
81
|
-
expect(tabpanel).toHaveAttribute("aria-labelledby", "fakeId");
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
it("should set class when prop className is passed", () => {
|
|
85
|
-
const { tabpanel } = createTabPanel(defaultParams => ({
|
|
86
|
-
...defaultParams,
|
|
87
|
-
className: "customclass"
|
|
88
|
-
}));
|
|
89
|
-
|
|
90
|
-
expect(tabpanel).toHaveClass("customclass");
|
|
91
|
-
});
|
|
92
|
-
});
|
package/src/Tabs/TabPanel.tsx
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
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 classes from "./TabPanel.module.scss";
|
|
19
|
-
|
|
20
|
-
export interface Props extends ComponentPropsWithRef<"div"> {
|
|
21
|
-
children: React.ReactNode;
|
|
22
|
-
tabId: string;
|
|
23
|
-
tabPanelId: string;
|
|
24
|
-
selected?: boolean;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export const TabPanel = React.forwardRef<HTMLDivElement, Props>(
|
|
28
|
-
({ children, tabId, tabPanelId, selected = false, className, ...rest }: Props, ref) => (
|
|
29
|
-
<div
|
|
30
|
-
{...rest}
|
|
31
|
-
ref={ref}
|
|
32
|
-
aria-labelledby={tabId}
|
|
33
|
-
className={`${classes["tabpanel"]} ${selected ? classes["selected"] : ""} ${className ?? ""}`}
|
|
34
|
-
id={tabPanelId}
|
|
35
|
-
role="tabpanel"
|
|
36
|
-
tabIndex={0}
|
|
37
|
-
hidden={!selected || undefined}
|
|
38
|
-
aria-hidden={!selected}
|
|
39
|
-
>
|
|
40
|
-
{children}
|
|
41
|
-
</div>
|
|
42
|
-
)
|
|
43
|
-
);
|