@wonderflow/react-components 10.18.1 → 10.19.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/components/accordion/accordion-context.js +1 -1
- package/dist/components/accordion/accordion-item.js +1 -1
- package/dist/components/accordion/accordion.js +1 -1
- package/dist/components/accordion/accordion.test.d.ts +2 -0
- package/dist/components/accordion/accordion.test.d.ts.map +1 -0
- package/dist/components/accordion/accordion.test.js +35 -0
- package/dist/components/accordion/index.js +1 -1
- package/dist/components/aspect-ratio/aspect-ratio.js +1 -1
- package/dist/components/aspect-ratio/aspect-ratio.test.d.ts +2 -0
- package/dist/components/aspect-ratio/aspect-ratio.test.d.ts.map +1 -0
- package/dist/components/aspect-ratio/aspect-ratio.test.js +24 -0
- package/dist/components/aspect-ratio/index.js +1 -1
- package/dist/components/autocomplete/autocomplete-option.d.ts.map +1 -1
- package/dist/components/autocomplete/autocomplete-option.js +2 -2
- package/dist/components/autocomplete/autocomplete.d.ts.map +1 -1
- package/dist/components/autocomplete/autocomplete.js +7 -4
- package/dist/components/autocomplete/autocomplete.test.d.ts +2 -0
- package/dist/components/autocomplete/autocomplete.test.d.ts.map +1 -0
- package/dist/components/autocomplete/autocomplete.test.js +42 -0
- package/dist/components/autocomplete/index.js +1 -1
- package/dist/components/avatar/avatar.js +1 -1
- package/dist/components/avatar/avatar.test.d.ts +2 -0
- package/dist/components/avatar/avatar.test.d.ts.map +1 -0
- package/dist/components/avatar/avatar.test.js +28 -0
- package/dist/components/avatar/index.js +1 -1
- package/dist/components/button/button.d.ts.map +1 -1
- package/dist/components/button/button.js +2 -2
- package/dist/components/button/button.test.d.ts +2 -0
- package/dist/components/button/button.test.d.ts.map +1 -0
- package/dist/components/button/button.test.js +56 -0
- package/dist/components/button/index.js +1 -1
- package/dist/components/card/card.test.d.ts +2 -0
- package/dist/components/card/card.test.d.ts.map +1 -0
- package/dist/components/card/card.test.js +41 -0
- package/dist/components/card/index.js +1 -1
- package/dist/components/chip/chip.js +1 -1
- package/dist/components/chip/chip.test.d.ts +2 -0
- package/dist/components/chip/chip.test.d.ts.map +1 -0
- package/dist/components/chip/chip.test.js +29 -0
- package/dist/components/chip/index.js +1 -1
- package/dist/components/circular-progress/circular-progress.js +1 -1
- package/dist/components/circular-progress/circular-progress.test.d.ts +2 -0
- package/dist/components/circular-progress/circular-progress.test.d.ts.map +1 -0
- package/dist/components/circular-progress/circular-progress.test.js +28 -0
- package/dist/components/circular-progress/index.js +1 -1
- package/dist/components/clamp-text/clamp-text.d.ts.map +1 -1
- package/dist/components/clamp-text/clamp-text.js +2 -2
- package/dist/components/clamp-text/clamp-text.test.d.ts +2 -0
- package/dist/components/clamp-text/clamp-text.test.d.ts.map +1 -0
- package/dist/components/clamp-text/clamp-text.test.js +37 -0
- package/dist/components/clamp-text/index.js +1 -1
- package/dist/components/container/container.js +1 -1
- package/dist/components/container/container.test.d.ts +2 -0
- package/dist/components/container/container.test.d.ts.map +1 -0
- package/dist/components/container/container.test.js +28 -0
- package/dist/components/container/index.js +1 -1
- package/dist/components/datetime/datetime.js +1 -1
- package/dist/components/datetime/datetime.test.d.ts +2 -0
- package/dist/components/datetime/datetime.test.d.ts.map +1 -0
- package/dist/components/datetime/datetime.test.js +41 -0
- package/dist/components/datetime/index.js +1 -1
- package/dist/components/disclosure/disclosure.d.ts.map +1 -1
- package/dist/components/disclosure/disclosure.js +2 -2
- package/dist/components/disclosure/disclosure.stories.d.ts +7 -7
- package/dist/components/disclosure/disclosure.stories.d.ts.map +1 -1
- package/dist/components/disclosure/disclosure.stories.js +7 -2
- package/dist/components/disclosure/disclosure.test.d.ts +2 -0
- package/dist/components/disclosure/disclosure.test.d.ts.map +1 -0
- package/dist/components/disclosure/disclosure.test.js +38 -0
- package/dist/components/disclosure/index.js +1 -1
- package/dist/components/drawer/drawer.js +1 -1
- package/dist/components/drawer/index.js +1 -1
- package/dist/components/elevator/elevator.js +1 -1
- package/dist/components/elevator/elevator.test.d.ts +2 -0
- package/dist/components/elevator/elevator.test.d.ts.map +1 -0
- package/dist/components/elevator/elevator.test.js +25 -0
- package/dist/components/elevator/index.js +1 -1
- package/dist/components/expander/expander.d.ts.map +1 -1
- package/dist/components/expander/expander.js +2 -2
- package/dist/components/expander/expander.test.d.ts +2 -0
- package/dist/components/expander/expander.test.d.ts.map +1 -0
- package/dist/components/expander/expander.test.js +32 -0
- package/dist/components/expander/index.js +1 -1
- package/dist/components/grid/grid.test.d.ts +2 -0
- package/dist/components/grid/grid.test.d.ts.map +1 -0
- package/dist/components/grid/grid.test.js +28 -0
- package/dist/components/grid/index.js +1 -1
- package/dist/components/grid/item/grid-item.js +1 -1
- package/dist/components/icon-button/icon-button.js +1 -1
- package/dist/components/icon-button/index.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/info-state/index.js +1 -1
- package/dist/components/info-state/info-state.js +1 -1
- package/dist/components/info-state/info-state.test.d.ts +2 -0
- package/dist/components/info-state/info-state.test.d.ts.map +1 -0
- package/dist/components/info-state/info-state.test.js +33 -0
- package/dist/components/input-group/index.js +1 -1
- package/dist/components/input-group/input-group.js +1 -1
- package/dist/components/input-group/input-group.test.d.ts +2 -0
- package/dist/components/input-group/input-group.test.d.ts.map +1 -0
- package/dist/components/input-group/input-group.test.js +30 -0
- package/dist/components/linear-progress/index.js +1 -1
- package/dist/components/linear-progress/linear-progress.js +1 -1
- package/dist/components/linear-progress/linear-progress.test.d.ts +2 -0
- package/dist/components/linear-progress/linear-progress.test.d.ts.map +1 -0
- package/dist/components/linear-progress/linear-progress.test.js +32 -0
- package/dist/components/list/index.js +1 -1
- package/dist/components/list/list-item.js +1 -1
- package/dist/components/list/list.js +1 -1
- package/dist/components/list/list.test.d.ts +2 -0
- package/dist/components/list/list.test.d.ts.map +1 -0
- package/dist/components/list/list.test.js +28 -0
- package/dist/components/masonry/index.js +1 -1
- package/dist/components/masonry/masonry.test.d.ts +2 -0
- package/dist/components/masonry/masonry.test.d.ts.map +1 -0
- package/dist/components/masonry/masonry.test.js +28 -0
- package/dist/components/menu/index.js +1 -1
- package/dist/components/menu/menu-item/menu-item-checkbox.js +1 -1
- package/dist/components/menu/menu-item/menu-item.d.ts +0 -2
- package/dist/components/menu/menu-item/menu-item.d.ts.map +1 -1
- package/dist/components/menu/menu-item/menu-item.js +2 -2
- package/dist/components/menu/menu-separator/menu-separator.js +1 -1
- package/dist/components/menu/menu.js +1 -1
- package/dist/components/menu/menu.test.d.ts +2 -0
- package/dist/components/menu/menu.test.d.ts.map +1 -0
- package/dist/components/menu/menu.test.js +25 -0
- package/dist/components/modal/content/modal-content.js +1 -1
- package/dist/components/modal/index.js +1 -1
- package/dist/components/modal/modal.js +1 -1
- package/dist/components/overlay-container/index.js +1 -1
- package/dist/components/overlay-container/overlay-container.js +1 -1
- package/dist/components/overlay-container/overlay-container.stories.js +2 -2
- package/dist/components/pagination/index.js +1 -1
- package/dist/components/pagination/pagination.js +2 -2
- package/dist/components/pagination/pagination.test.d.ts +2 -0
- package/dist/components/pagination/pagination.test.d.ts.map +1 -0
- package/dist/components/pagination/pagination.test.js +29 -0
- package/dist/components/popover/index.js +1 -1
- package/dist/components/popover/popover.d.ts.map +1 -1
- package/dist/components/popover/popover.js +5 -2
- package/dist/components/popover/popover.stories.d.ts.map +1 -1
- package/dist/components/popover/popover.stories.js +1 -1
- package/dist/components/popover/popover.test.d.ts +2 -0
- package/dist/components/popover/popover.test.d.ts.map +1 -0
- package/dist/components/popover/popover.test.js +41 -0
- package/dist/components/prose/index.js +1 -1
- package/dist/components/prose/prose.js +1 -1
- package/dist/components/prose/prose.test.d.ts +2 -0
- package/dist/components/prose/prose.test.d.ts.map +1 -0
- package/dist/components/prose/prose.test.js +26 -0
- package/dist/components/select/index.js +1 -1
- package/dist/components/select/select.js +1 -1
- package/dist/components/select/select.test.d.ts +2 -0
- package/dist/components/select/select.test.d.ts.map +1 -0
- package/dist/components/select/select.test.js +28 -0
- package/dist/components/selection-controls/checkbox.js +1 -1
- package/dist/components/selection-controls/index.js +1 -1
- package/dist/components/selection-controls/radio.js +1 -1
- package/dist/components/selection-controls/selection-controls.module.css +1 -1
- package/dist/components/selection-controls/selection-controls.test.d.ts +2 -0
- package/dist/components/selection-controls/selection-controls.test.d.ts.map +1 -0
- package/dist/components/selection-controls/selection-controls.test.js +30 -0
- package/dist/components/selection-controls/toggle.js +1 -1
- package/dist/components/separator/index.js +1 -1
- package/dist/components/separator/separator.js +1 -1
- package/dist/components/separator/separator.test.d.ts +2 -0
- package/dist/components/separator/separator.test.d.ts.map +1 -0
- package/dist/components/separator/separator.test.js +24 -0
- package/dist/components/skeleton/index.js +1 -1
- package/dist/components/skeleton/skeleton.test.d.ts +2 -0
- package/dist/components/skeleton/skeleton.test.d.ts.map +1 -0
- package/dist/components/skeleton/skeleton.test.js +28 -0
- package/dist/components/slider/index.js +1 -1
- package/dist/components/slider/slider.d.ts.map +1 -1
- package/dist/components/slider/slider.js +2 -2
- package/dist/components/slider/slider.test.d.ts +2 -0
- package/dist/components/slider/slider.test.d.ts.map +1 -0
- package/dist/components/slider/slider.test.js +30 -0
- package/dist/components/snackbar/index.js +1 -1
- package/dist/components/snackbar/snackbar.js +1 -1
- package/dist/components/snackbar/snackbar.test.d.ts +2 -0
- package/dist/components/snackbar/snackbar.test.d.ts.map +1 -0
- package/dist/components/snackbar/snackbar.test.js +28 -0
- package/dist/components/spinner/index.js +1 -1
- package/dist/components/spinner/spinner.js +1 -1
- package/dist/components/spinner/spinner.test.d.ts +2 -0
- package/dist/components/spinner/spinner.test.d.ts.map +1 -0
- package/dist/components/spinner/spinner.test.js +28 -0
- package/dist/components/split-button/index.js +1 -1
- package/dist/components/split-button/split-button.js +1 -1
- package/dist/components/split-button/split-button.test.d.ts +2 -0
- package/dist/components/split-button/split-button.test.d.ts.map +1 -0
- package/dist/components/split-button/split-button.test.js +24 -0
- package/dist/components/stack/index.js +1 -1
- package/dist/components/stack/stack.test.d.ts +2 -0
- package/dist/components/stack/stack.test.d.ts.map +1 -0
- package/dist/components/stack/stack.test.js +28 -0
- package/dist/components/star-meter/index.js +1 -1
- package/dist/components/star-meter/star-meter.d.ts.map +1 -1
- package/dist/components/star-meter/star-meter.js +2 -5
- package/dist/components/star-meter/star-meter.test.d.ts +2 -0
- package/dist/components/star-meter/star-meter.test.d.ts.map +1 -0
- package/dist/components/star-meter/star-meter.test.js +36 -0
- package/dist/components/symbol/index.js +1 -1
- package/dist/components/symbol/symbol.test.d.ts +2 -0
- package/dist/components/symbol/symbol.test.d.ts.map +1 -0
- package/dist/components/symbol/symbol.test.js +29 -0
- package/dist/components/tab/index.js +1 -1
- package/dist/components/tab/tab.d.ts.map +1 -1
- package/dist/components/tab/tab.js +2 -2
- package/dist/components/tab/tab.test.d.ts +2 -0
- package/dist/components/tab/tab.test.d.ts.map +1 -0
- package/dist/components/tab/tab.test.js +30 -0
- package/dist/components/tab/tabs-panel.js +1 -1
- package/dist/components/table/index.js +1 -1
- package/dist/components/table/table-cell/index.js +1 -1
- package/dist/components/table/table-cell/table-cell.js +1 -1
- package/dist/components/table/table-cell/table-cell.test.d.ts +2 -0
- package/dist/components/table/table-cell/table-cell.test.d.ts.map +1 -0
- package/dist/components/table/table-cell/table-cell.test.js +28 -0
- package/dist/components/table/table-checkbox/index.js +1 -1
- package/dist/components/table/table-checkbox/table-checkbox.js +1 -1
- package/dist/components/table/table-checkbox/table-checkbox.test.d.ts +2 -0
- package/dist/components/table/table-checkbox/table-checkbox.test.d.ts.map +1 -0
- package/dist/components/table/table-checkbox/table-checkbox.test.js +24 -0
- package/dist/components/table/table-controls/index.js +1 -1
- package/dist/components/table/table-controls/table-controls.test.d.ts +2 -0
- package/dist/components/table/table-controls/table-controls.test.d.ts.map +1 -0
- package/dist/components/table/table-controls/table-controls.test.js +35 -0
- package/dist/components/table/table-controls/toggle-columns.d.ts.map +1 -1
- package/dist/components/table/table-controls/toggle-columns.js +2 -2
- package/dist/components/table/table-expand/index.js +1 -1
- package/dist/components/table/table-header/index.js +1 -1
- package/dist/components/table/table-header/table-header.test.d.ts +2 -0
- package/dist/components/table/table-header/table-header.test.d.ts.map +1 -0
- package/dist/components/table/table-header/table-header.test.js +24 -0
- package/dist/components/table/table-pagination/index.js +1 -1
- package/dist/components/table/table-pagination/table-pagination.js +1 -1
- package/dist/components/table/table-pagination/table-pagination.test.d.ts +2 -0
- package/dist/components/table/table-pagination/table-pagination.test.d.ts.map +1 -0
- package/dist/components/table/table-pagination/table-pagination.test.js +28 -0
- package/dist/components/table/table-row/index.js +1 -1
- package/dist/components/table/table-row/table-row.js +1 -1
- package/dist/components/table/table-row/table-row.test.d.ts +2 -0
- package/dist/components/table/table-row/table-row.test.d.ts.map +1 -0
- package/dist/components/table/table-row/table-row.test.js +24 -0
- package/dist/components/table/table.js +1 -1
- package/dist/components/table/table.test.d.ts +2 -0
- package/dist/components/table/table.test.d.ts.map +1 -0
- package/dist/components/table/table.test.js +62 -0
- package/dist/components/table/types.js +1 -1
- package/dist/components/text/index.js +1 -1
- package/dist/components/text/text.test.d.ts +2 -0
- package/dist/components/text/text.test.d.ts.map +1 -0
- package/dist/components/text/text.test.js +24 -0
- package/dist/components/textfield/base-field/index.js +1 -1
- package/dist/components/textfield/index.js +1 -1
- package/dist/components/textfield/textfield.d.ts.map +1 -1
- package/dist/components/textfield/textfield.js +2 -2
- package/dist/components/textfield/textfield.test.d.ts +2 -0
- package/dist/components/textfield/textfield.test.d.ts.map +1 -0
- package/dist/components/textfield/textfield.test.js +37 -0
- package/dist/components/title/index.js +1 -1
- package/dist/components/title/title.js +1 -1
- package/dist/components/title/title.test.d.ts +2 -0
- package/dist/components/title/title.test.d.ts.map +1 -0
- package/dist/components/title/title.test.js +33 -0
- package/dist/components/toggle-button/index.js +1 -1
- package/dist/components/toggle-button/toggle-button.d.ts.map +1 -1
- package/dist/components/toggle-button/toggle-button.js +2 -2
- package/dist/components/toggle-button/toggle-button.test.d.ts +2 -0
- package/dist/components/toggle-button/toggle-button.test.d.ts.map +1 -0
- package/dist/components/toggle-button/toggle-button.test.js +30 -0
- package/dist/components/tooltip/index.js +1 -1
- package/dist/components/tooltip/tooltip.d.ts.map +1 -1
- package/dist/components/tooltip/tooltip.js +7 -3
- package/dist/components/tooltip/tooltip.test.d.ts +2 -0
- package/dist/components/tooltip/tooltip.test.d.ts.map +1 -0
- package/dist/components/tooltip/tooltip.test.js +29 -0
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +16 -0
- package/dist/hooks/usePopupWrapper.d.ts +4 -0
- package/dist/hooks/usePopupWrapper.d.ts.map +1 -0
- package/dist/hooks/usePopupWrapper.js +40 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/providers/index.js +1 -1
- package/dist/providers/overlay.js +1 -1
- package/dist/providers/providers.test.d.ts +2 -0
- package/dist/providers/providers.test.d.ts.map +1 -0
- package/dist/providers/providers.test.js +34 -0
- package/dist/providers/responsive.js +1 -1
- package/dist/types/index.js +1 -1
- package/dist/types/polymorphic/index.js +1 -1
- package/package.json +18 -11
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2023 Wonderflow Design Team
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { render } from '@testing-library/react';
|
|
18
|
+
import { Button } from '../button';
|
|
19
|
+
import { InfoState } from './info-state';
|
|
20
|
+
describe('<InfoState>', () => {
|
|
21
|
+
test(' it should render properly', () => {
|
|
22
|
+
const { container } = render(_jsx(InfoState, { title: "My title", icon: "compass", children: "Content" }));
|
|
23
|
+
expect(container).not.toBeNull();
|
|
24
|
+
});
|
|
25
|
+
test(' it should render properly with props', () => {
|
|
26
|
+
const { container } = render(_jsx(InfoState, { title: "My title", direction: "column", image: "https://svgshare.com/i/b5f.svg", actions: _jsx(Button, { children: "Click" }), children: "Content" }));
|
|
27
|
+
expect(container).not.toBeNull();
|
|
28
|
+
});
|
|
29
|
+
test(' it should render properly with image row', () => {
|
|
30
|
+
const { container } = render(_jsx(InfoState, { title: "My title", direction: "row", image: "https://svgshare.com/i/b5f.svg", actions: _jsx(Button, { children: "Click" }), children: "Content" }));
|
|
31
|
+
expect(container).not.toBeNull();
|
|
32
|
+
});
|
|
33
|
+
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
/*
|
|
3
|
-
* Copyright 2022-2023 Wonderflow
|
|
3
|
+
* Copyright 2022-2023 Wonderflow Design Team
|
|
4
4
|
*
|
|
5
5
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
6
|
* you may not use this file except in compliance with the License.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input-group.test.d.ts","sourceRoot":"","sources":["../../../src/components/input-group/input-group.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2023 Wonderflow Design Team
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { render } from '@testing-library/react';
|
|
18
|
+
import { Select } from '../select';
|
|
19
|
+
import { Textfield } from '../textfield';
|
|
20
|
+
import { InputGroup } from './input-group';
|
|
21
|
+
describe('<InputGroup>', () => {
|
|
22
|
+
test(' it should render properly', () => {
|
|
23
|
+
const { container } = render(_jsx(InputGroup, { label: "Sample label", prefix: _jsx(Textfield, { readOnly: true, size: 6, value: "https://" }), input: _jsx(Textfield, { type: "text", defaultValue: "sample-domain" }), suffix: (_jsxs(Select, { defaultValue: 1, children: [_jsx("option", { value: "1", children: ".com" }), _jsx("option", { value: "2", children: ".it" }), _jsx("option", { value: "3", children: ".org" }), _jsx("option", { value: "4", children: ".dev" }), _jsx("option", { value: "5", children: ".io" })] })) }));
|
|
24
|
+
expect(container).not.toBeNull();
|
|
25
|
+
});
|
|
26
|
+
test(' it should render properly', () => {
|
|
27
|
+
const { container } = render(_jsx(InputGroup, { label: "Sample label", dimension: "small", prefix: _jsx(Textfield, { readOnly: true, size: 6, value: "https://" }), input: _jsx(Textfield, { type: "text", defaultValue: "sample-domain" }), suffix: (_jsxs(Select, { defaultValue: 1, children: [_jsx("option", { value: "1", children: ".com" }), _jsx("option", { value: "2", children: ".it" }), _jsx("option", { value: "3", children: ".org" }), _jsx("option", { value: "4", children: ".dev" }), _jsx("option", { value: "5", children: ".io" })] })) }));
|
|
28
|
+
expect(container).not.toBeNull();
|
|
29
|
+
});
|
|
30
|
+
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
/*
|
|
3
|
-
* Copyright 2022 Wonderflow
|
|
3
|
+
* Copyright 2022-2023 Wonderflow Design Team
|
|
4
4
|
*
|
|
5
5
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
6
|
* you may not use this file except in compliance with the License.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"linear-progress.test.d.ts","sourceRoot":"","sources":["../../../src/components/linear-progress/linear-progress.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2023 Wonderflow Design Team
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { render } from '@testing-library/react';
|
|
18
|
+
import { LinearProgress } from './linear-progress';
|
|
19
|
+
describe('<LinearProgress>', () => {
|
|
20
|
+
test(' it should render properly', () => {
|
|
21
|
+
const { container } = render(_jsx(LinearProgress, {}));
|
|
22
|
+
expect(container).not.toBeNull();
|
|
23
|
+
});
|
|
24
|
+
test(' it should render properly with pros', () => {
|
|
25
|
+
const { container } = render(_jsx(LinearProgress, { value: 50, max: 99, dimension: "big", showProgress: true }));
|
|
26
|
+
expect(container).not.toBeNull();
|
|
27
|
+
});
|
|
28
|
+
test(' it should render properly with value 0', () => {
|
|
29
|
+
const { container } = render(_jsx(LinearProgress, { value: 0, max: 99, dimension: "regular", showProgress: true }));
|
|
30
|
+
expect(container).not.toBeNull();
|
|
31
|
+
});
|
|
32
|
+
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
/*
|
|
3
|
-
* Copyright 2022 Wonderflow
|
|
3
|
+
* Copyright 2022-2023 Wonderflow Design Team
|
|
4
4
|
*
|
|
5
5
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
6
|
* you may not use this file except in compliance with the License.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
/*
|
|
3
|
-
* Copyright 2022 Wonderflow
|
|
3
|
+
* Copyright 2022-2023 Wonderflow Design Team
|
|
4
4
|
*
|
|
5
5
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
6
|
* you may not use this file except in compliance with the License.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.test.d.ts","sourceRoot":"","sources":["../../../src/components/list/list.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2023 Wonderflow Design Team
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { render } from '@testing-library/react';
|
|
18
|
+
import { List } from './list';
|
|
19
|
+
describe('<List>', () => {
|
|
20
|
+
test(' it should render properly', () => {
|
|
21
|
+
const { container } = render(_jsxs(List, { children: [_jsx(List.Li, { marker: "circle-check", markerColor: "var(--highlight-green-foreground)", children: "List item text" }), _jsx(List.Li, { dimension: "small", children: "List item text no props" })] }));
|
|
22
|
+
expect(container).not.toBeNull();
|
|
23
|
+
});
|
|
24
|
+
test(' it should render properly with no marker as "ol"', () => {
|
|
25
|
+
const { container } = render(_jsxs(List, { hideMarker: true, as: "ol", children: [_jsx(List.Li, { marker: "circle-check", markerColor: "var(--highlight-green-foreground)", children: "List item text" }), _jsx(List.Li, { dimension: "small", children: "List item text no props" })] }));
|
|
26
|
+
expect(container).not.toBeNull();
|
|
27
|
+
});
|
|
28
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"masonry.test.d.ts","sourceRoot":"","sources":["../../../src/components/masonry/masonry.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2023 Wonderflow Design Team
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { render } from '@testing-library/react';
|
|
18
|
+
import { Masonry } from './masonry';
|
|
19
|
+
describe('<Masonry>', () => {
|
|
20
|
+
test(' it should render properly', () => {
|
|
21
|
+
const { container } = render(_jsxs(Masonry, { children: [_jsx("div", { children: "1" }), _jsx("div", { children: "2" }), _jsx("div", { children: "3" }), _jsx("div", { children: "4" }), _jsx("div", { children: "5" })] }));
|
|
22
|
+
expect(container).not.toBeNull();
|
|
23
|
+
});
|
|
24
|
+
test(' it should render properly with props', () => {
|
|
25
|
+
const { container } = render(_jsxs(Masonry, { columns: { default: 1, small: 3 }, children: [_jsx("div", { children: "1" }), _jsx("div", { children: "2" }), _jsx("div", { children: "3" }), _jsx("div", { children: "4" }), _jsx("div", { children: "5" })] }));
|
|
26
|
+
expect(container).not.toBeNull();
|
|
27
|
+
});
|
|
28
|
+
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
/*
|
|
3
|
-
* Copyright 2022 Wonderflow
|
|
3
|
+
* Copyright 2022-2023 Wonderflow Design Team
|
|
4
4
|
*
|
|
5
5
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
6
|
* you may not use this file except in compliance with the License.
|
|
@@ -40,8 +40,6 @@ export declare type MenuItemProps = {
|
|
|
40
40
|
* This space is used to keep the content aligned across items with or without icons.
|
|
41
41
|
* We suggest to not remove the padding if you have items with icons in the same menu to
|
|
42
42
|
* keep a good readability.
|
|
43
|
-
*
|
|
44
|
-
* Read more: https://design.wonderflow.ai/design/recipes/menu/#items-with-icons
|
|
45
43
|
*/
|
|
46
44
|
padding?: boolean;
|
|
47
45
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menu-item.d.ts","sourceRoot":"","sources":["../../../../src/components/menu/menu-item/menu-item.tsx"],"names":[],"mappings":"AAiBA,OAAO,EACO,SAAS,EACtB,MAAM,OAAO,CAAC;AAGf,OAAO,EACL,WAAW,EAAiB,WAAW,EAExC,MAAM,cAAc,CAAC;AAItB,oBAAY,aAAa,GAAG;IAC1B;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC;IAC7B;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAChC;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAChC;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAChD;;;OAGG;IACH,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB
|
|
1
|
+
{"version":3,"file":"menu-item.d.ts","sourceRoot":"","sources":["../../../../src/components/menu/menu-item/menu-item.tsx"],"names":[],"mappings":"AAiBA,OAAO,EACO,SAAS,EACtB,MAAM,OAAO,CAAC;AAGf,OAAO,EACL,WAAW,EAAiB,WAAW,EAExC,MAAM,cAAc,CAAC;AAItB,oBAAY,aAAa,GAAG;IAC1B;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC;IAC7B;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAChC;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAChC;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAChD;;;OAGG;IACH,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;CACf,CAAA;AAED,aAAK,mBAAmB,GAAG,WAAW,CAAC,mBAAmB,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;AAEpF,eAAO,MAAM,QAAQ,qBAmGI,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
/*
|
|
3
|
-
* Copyright 2022 Wonderflow
|
|
3
|
+
* Copyright 2022-2023 Wonderflow Design Team
|
|
4
4
|
*
|
|
5
5
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
6
|
* you may not use this file except in compliance with the License.
|
|
@@ -31,7 +31,7 @@ export const MenuItem = forwardRef(({ className, children, subtext, onClick, ico
|
|
|
31
31
|
}
|
|
32
32
|
}, [handleClick, onClick, value]);
|
|
33
33
|
const InnerContent = useMemo(() => (_jsxs(Stack, { direction: isIconRight ? 'row-reverse' : 'row', as: "span", fill: false, className: styles.ItemContent, hAlign: isIconRight ? 'space-between' : 'start', vAlign: "center", columnGap: 8, hPadding: 16, vPadding: 8, "data-menu-item-icon-right": isIconRight, "data-menu-item-has-icon": Boolean(icon), "data-menu-item-padding": padding, style: { inlineSize: '100%' }, children: [icon && (_jsx(Symbol, { className: styles.Icon, source: icon, dimension: dimension === 'small' ? 12 : 16 })), _jsxs(Stack, { className: styles.DecorationContent, columnGap: 16, fill: false, direction: "row", hAlign: "space-between", children: [_jsxs(Stack, { direction: "column", children: [children, subtext && _jsx(Text, { size: 14, style: { fontWeight: '400' }, children: subtext })] }), decoration] })] })), [children, subtext, dimension, icon, isIconRight, decoration, padding]);
|
|
34
|
-
return (_jsx(Stack, { as: "li", role: "none", children: _jsx(Wrapper, { autoFocus: autoFocus, ref: itemRef, role: "menuitem", className: clsx(styles.MenuItem, className), onClick: disabled ? undefined : triggerClick, onKeyDown: disabled ? undefined : handleKeyDown, tabIndex: tabIndex, "aria-disabled": disabled, type: Wrapper === 'button' ? 'button' : undefined, "data-menu-item-dimension": dimension, ...otherProps, children: description
|
|
34
|
+
return (_jsx(Stack, { as: "li", role: "none", children: _jsx(Wrapper, { autoFocus: autoFocus, ref: itemRef, role: "menuitem", className: clsx(styles.MenuItem, className), onClick: disabled ? undefined : triggerClick, onKeyDown: disabled ? undefined : handleKeyDown, tabIndex: tabIndex, "aria-disabled": disabled, type: Wrapper === 'button' ? 'button' : undefined, "data-menu-item-dimension": dimension, "data-testid": "MenuItem", ...otherProps, children: description
|
|
35
35
|
? (_jsx(Tooltip, { fill: true, open: isFocused, placement: "right-start", interactive: true, trigger: InnerContent, children: description }))
|
|
36
36
|
: InnerContent }) }));
|
|
37
37
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
/*
|
|
3
|
-
* Copyright 2022 Wonderflow
|
|
3
|
+
* Copyright 2022-2023 Wonderflow Design Team
|
|
4
4
|
*
|
|
5
5
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
6
|
* you may not use this file except in compliance with the License.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
/*
|
|
3
|
-
* Copyright 2022 Wonderflow
|
|
3
|
+
* Copyright 2022-2023 Wonderflow Design Team
|
|
4
4
|
*
|
|
5
5
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
6
|
* you may not use this file except in compliance with the License.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"menu.test.d.ts","sourceRoot":"","sources":["../../../src/components/menu/menu.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2023 Wonderflow Design Team
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { fireEvent, render } from '@testing-library/react';
|
|
18
|
+
import { Menu } from './menu';
|
|
19
|
+
describe('<Menu>', () => {
|
|
20
|
+
test(' it should render properly', () => {
|
|
21
|
+
const { container, getByText } = render(_jsxs(Menu, { children: [_jsx(Menu.Item, { value: "Item1", children: "Item 1" }), _jsx(Menu.Item, { value: "Item2", subtext: "hint text", children: "Item 2" }), _jsx(Menu.ItemCheckbox, { value: "Check1", children: "Checkable item" }), _jsx(Menu.ItemCheckbox, { value: "Check2", checked: true, children: "Checked item" }), _jsx(Menu.Separator, {}), _jsx(Menu.Item, { value: "Item3", icon: "bell", children: "Item 3" }), _jsx(Menu.Item, { value: "Item4", icon: "bell", iconPosition: "right", children: "Item 4" }), _jsx(Menu.Item, { value: "Item5", icon: "bell", iconPosition: "left", dimension: "small", children: "Item 5" }), _jsx(Menu.Item, { value: "Item6", description: _jsx("p", { children: "some description" }), children: "Item 6" }), _jsx(Menu.Item, { value: "Item7", disabled: true, children: "Item 7" }), _jsx(Menu.Item, { value: "Item8", as: "div", children: "Item 8" })] }));
|
|
22
|
+
fireEvent.click(getByText(/Item 1/));
|
|
23
|
+
expect(container).not.toBeNull();
|
|
24
|
+
});
|
|
25
|
+
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
/*
|
|
3
|
-
* Copyright 2022 Wonderflow
|
|
3
|
+
* Copyright 2022-2023 Wonderflow Design Team
|
|
4
4
|
*
|
|
5
5
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
6
|
* you may not use this file except in compliance with the License.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
/*
|
|
3
|
-
* Copyright 2022 Wonderflow
|
|
3
|
+
* Copyright 2022-2023 Wonderflow Design Team
|
|
4
4
|
*
|
|
5
5
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
6
|
* you may not use this file except in compliance with the License.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
/*
|
|
3
|
-
* Copyright 2022 Wonderflow
|
|
3
|
+
* Copyright 2022-2023 Wonderflow Design Team
|
|
4
4
|
*
|
|
5
5
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
6
|
* you may not use this file except in compliance with the License.
|
|
@@ -11,7 +11,7 @@ const story = {
|
|
|
11
11
|
};
|
|
12
12
|
export default story;
|
|
13
13
|
const Template = ({ children, ...otherProps }) => {
|
|
14
|
-
const [
|
|
15
|
-
return (_jsxs(_Fragment, { children: [_jsx(Button, { onClick: () =>
|
|
14
|
+
const [isVisible, setIsVisible] = useState(false);
|
|
15
|
+
return (_jsxs(_Fragment, { children: [_jsx(Button, { onClick: () => setIsVisible(true), children: "Open Overlay" }), _jsx(OverlayContainer, { ...otherProps, children: isVisible && (_jsxs(Stack, { fill: false, hAlign: "center", vAlign: "center", children: ["I am over the top", _jsx(Button, { kind: "secondary", onClick: () => setIsVisible(false), children: "Close me" })] })) })] }));
|
|
16
16
|
};
|
|
17
17
|
export const Default = Template.bind({});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
/*
|
|
3
|
-
* Copyright 2022 Wonderflow
|
|
3
|
+
* Copyright 2022-2023 Wonderflow Design Team
|
|
4
4
|
*
|
|
5
5
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
6
|
* you may not use this file except in compliance with the License.
|
|
@@ -29,5 +29,5 @@ export const Pagination = ({ className, itemsCount, itemsPerPage = 10, onPageCli
|
|
|
29
29
|
const newOffset = (event.selected * itemsPerPage) % itemsCount;
|
|
30
30
|
onPageClick?.({ ...event, offset: newOffset });
|
|
31
31
|
};
|
|
32
|
-
return (_jsx(ReactPaginate, { containerClassName: clsx(styles.Pagination, className), breakLabel: "...", nextLabel: _jsx(Symbol, { dimension: 16, source: "chevron-right" }), previousLabel: _jsx(Symbol, { dimension: 16, source: "chevron-left" }), onPageChange: handlePageClick, pageRangeDisplayed: pageRangeDisplayed, pageCount: pageCount ?? computedPageCount, marginPagesDisplayed: marginPagesDisplayed, ...otherProps }));
|
|
32
|
+
return (_jsx(ReactPaginate, { containerClassName: clsx(styles.Pagination, className), breakLabel: "...", nextLabel: _jsx(Symbol, { dimension: 16, source: "chevron-right", "data-testid": "RightChevron" }), previousLabel: _jsx(Symbol, { dimension: 16, source: "chevron-left", "data-testid": "LeftChevron" }), onPageChange: handlePageClick, pageRangeDisplayed: pageRangeDisplayed, pageCount: pageCount ?? computedPageCount, marginPagesDisplayed: marginPagesDisplayed, ...otherProps }));
|
|
33
33
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination.test.d.ts","sourceRoot":"","sources":["../../../src/components/pagination/pagination.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2023 Wonderflow Design Team
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { fireEvent, render } from '@testing-library/react';
|
|
18
|
+
import { Pagination } from './pagination';
|
|
19
|
+
describe('<Pagination>', () => {
|
|
20
|
+
test(' it should render properly', () => {
|
|
21
|
+
const fn = jest.fn();
|
|
22
|
+
const { container, getByTestId } = render(_jsx(Pagination, { itemsCount: 100, onPageClick: fn }));
|
|
23
|
+
fireEvent.click(getByTestId('RightChevron'));
|
|
24
|
+
expect(fn).toHaveBeenCalled();
|
|
25
|
+
fireEvent.click(getByTestId('RightChevron'));
|
|
26
|
+
expect(fn).toHaveBeenCalled();
|
|
27
|
+
expect(container).not.toBeNull();
|
|
28
|
+
});
|
|
29
|
+
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popover.d.ts","sourceRoot":"","sources":["../../../src/components/popover/popover.tsx"],"names":[],"mappings":"AAgBA,OAAO,EACL,aAAa,EAAE,aAAa,EAAY,kBAAkB,EAC3D,MAAM,gBAAgB,CAAC;AAOxB,OAAO,EAML,SAAS,EAKV,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"popover.d.ts","sourceRoot":"","sources":["../../../src/components/popover/popover.tsx"],"names":[],"mappings":"AAgBA,OAAO,EACL,aAAa,EAAE,aAAa,EAAY,kBAAkB,EAC3D,MAAM,gBAAgB,CAAC;AAOxB,OAAO,EAML,SAAS,EAKV,MAAM,OAAO,CAAC;AASf,oBAAY,YAAY,GAAG;IACzB;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;;OAGG;IACH,OAAO,EAAE,SAAS,CAAC;IACnB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,aAAa,GAAG,aAAa,GAAG,kBAAkB,CAAC;IAC/D;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;OAEG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;OAEG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B,CAAA;AA0BD,eAAO,MAAM,OAAO;;;iEA+HlB,CAAC"}
|
|
@@ -4,9 +4,11 @@ import { useFocusWithin, useKeyPress } from 'ahooks';
|
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
import { AnimatePresence, domMax, LazyMotion, m, } from 'framer-motion';
|
|
6
6
|
import { Children, cloneElement, forwardRef, isValidElement, useEffect, useMemo, useRef, useState, } from 'react';
|
|
7
|
+
import { createPortal } from 'react-dom';
|
|
7
8
|
import { mergeRefs } from 'react-merge-refs';
|
|
8
9
|
import { usePopperTooltip } from 'react-popper-tooltip';
|
|
9
10
|
import { useUIDSeed } from 'react-uid';
|
|
11
|
+
import { usePopUpWrapper } from '../../hooks';
|
|
10
12
|
import * as styles from './popover.module.css';
|
|
11
13
|
const cssEasingToArray = (cssEasing) => {
|
|
12
14
|
const [x1, y1, x2, y2] = cssEasing.replace(/[^0-9.,]+/g, '').split(',').map(i => parseFloat(i));
|
|
@@ -34,6 +36,7 @@ export const Popover = forwardRef(({ children, trigger, offset = 8, placement =
|
|
|
34
36
|
const seedID = useUIDSeed();
|
|
35
37
|
const [isOpen, setIsOpen] = useState(false);
|
|
36
38
|
const popoverContainerRef = useRef(null);
|
|
39
|
+
const { wrapper } = usePopUpWrapper('popover-popup-root');
|
|
37
40
|
const sameWidth = useMemo(() => ({
|
|
38
41
|
name: 'sameWidth',
|
|
39
42
|
enabled: true,
|
|
@@ -96,9 +99,9 @@ export const Popover = forwardRef(({ children, trigger, offset = 8, placement =
|
|
|
96
99
|
'aria-controls': seedID('popover-dialog'),
|
|
97
100
|
'aria-expanded': isOpen,
|
|
98
101
|
...otherProps,
|
|
99
|
-
}), _jsx(AnimatePresence, { children:
|
|
102
|
+
}), visible && createPortal(_jsx(AnimatePresence, { children: _jsx("div", { ref: setTooltipRef, role: "tooltip", id: seedID('tooltip-content'), ...getTooltipProps({ className: styles.PopUp }), children: _jsx(LazyMotion, { features: domMax, children: _jsx(m.div, { variants: PopoverAnimation, initial: "hidden", animate: "visible", exit: "hidden", children: Children.map(children, child => isValidElement(child) && cloneElement(child, {
|
|
100
103
|
id: seedID('popover-dialog'),
|
|
101
104
|
'aria-labelledby': seedID('popover-trigger'),
|
|
102
|
-
})) }) }) }, seedID('tooltip-content'))
|
|
105
|
+
})) }) }) }, seedID('tooltip-content')) }), wrapper)] }));
|
|
103
106
|
});
|
|
104
107
|
Popover.displayName = 'Popover';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popover.stories.d.ts","sourceRoot":"","sources":["../../../src/components/popover/popover.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,KAAmB,MAAM,OAAO,CAAC;AAKxC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,QAAA,MAAM,KAAK,EAAE,aAAa,CAAC,OAAO,OAAO,CAOxC,CAAC;AAEF,eAAe,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"popover.stories.d.ts","sourceRoot":"","sources":["../../../src/components/popover/popover.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,KAAmB,MAAM,OAAO,CAAC;AAKxC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,QAAA,MAAM,KAAK,EAAE,aAAa,CAAC,OAAO,OAAO,CAOxC,CAAC;AAEF,eAAe,KAAK,CAAC;AA4CrB,eAAO,MAAM,OAAO;;;4EAA2B,CAAC;AAyBhD,eAAO,MAAM,aAAa;;;4EAA0B,CAAC;AAuBrD,eAAO,MAAM,SAAS;;;4EAA6B,CAAC;AAoCpD,eAAO,MAAM,UAAU;;;4EAA8B,CAAC"}
|
|
@@ -13,7 +13,7 @@ const story = {
|
|
|
13
13
|
export default story;
|
|
14
14
|
const DefaultTemplate = (args) => {
|
|
15
15
|
const [isChecked, setIsChecked] = useState(false);
|
|
16
|
-
return (_jsx(Popover, { ...args, children: _jsxs(Menu, { children: [_jsx(Menu.Item, {
|
|
16
|
+
return (_jsx(Popover, { ...args, children: _jsxs(Menu, { children: [_jsx(Menu.Item, { icon: "arrow-right", description: _jsx(_Fragment, { children: "Description for this item" }), value: "1", children: "Sample long menu item" }), _jsx(Menu.ItemCheckbox, { onClick: () => setIsChecked(val => !val), checked: isChecked, icon: isChecked ? 'check' : undefined, value: "2", children: "Checkbox item" }), _jsx(Menu.Item, { icon: "user", value: "3", description: (_jsxs(_Fragment, { children: [_jsx(Title, { as: "h2", level: "5", children: "Sample H2 Title longlonglonglonglonglonglonglonglonglonglong" }), _jsx("p", { children: "long text content placeholder to test wrapping and sizes" }), _jsx("img", { style: { width: '100%' }, alt: "", src: "https://images.unsplash.com/photo-1593963171957-d87a6279226d?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1350&q=80" })] })), children: "Short menu label" }), _jsx(Menu.Separator, {}), _jsx(Menu.Item, { value: "4", icon: "arrow-down-to-bracket", children: "Even shorter" }), _jsx(Menu.Item, { value: "5", disabled: true, children: "Really?" })] }) }));
|
|
17
17
|
};
|
|
18
18
|
export const Default = DefaultTemplate.bind({});
|
|
19
19
|
const CustomTemplate = args => (_jsxs(_Fragment, { children: [_jsx(Popover, { ...args, children: _jsx("div", { style: {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"popover.test.d.ts","sourceRoot":"","sources":["../../../src/components/popover/popover.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2023 Wonderflow Design Team
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { fireEvent, render } from '@testing-library/react';
|
|
18
|
+
import { Button } from '../button';
|
|
19
|
+
import { Popover } from './popover';
|
|
20
|
+
describe('<Popover>', () => {
|
|
21
|
+
test(' it should render properly', () => {
|
|
22
|
+
const { container, getByTestId } = render(_jsx(Popover, { placement: "bottom-start", trigger: _jsx(Button, { kind: "flat", children: "Open popover" }), children: _jsx("div", { children: "Some Content" }) }));
|
|
23
|
+
const btn = getByTestId('Button');
|
|
24
|
+
fireEvent.click(btn);
|
|
25
|
+
fireEvent.blur(btn);
|
|
26
|
+
fireEvent.keyPress(btn, { key: 'esc' });
|
|
27
|
+
expect(container).not.toBeNull();
|
|
28
|
+
});
|
|
29
|
+
test(' it should render properly open', () => {
|
|
30
|
+
const { container, getByTestId } = render(_jsx(Popover, { placement: "bottom-start", trigger: _jsx(Button, { kind: "flat", children: "Open popover" }), open: true, matchTriggerWidth: true, children: _jsx("div", { children: "Some Content" }) }));
|
|
31
|
+
const btn = getByTestId('Button');
|
|
32
|
+
fireEvent.click(btn);
|
|
33
|
+
fireEvent.blur(btn);
|
|
34
|
+
fireEvent.keyPress(btn, { key: 'esc' });
|
|
35
|
+
expect(container).not.toBeNull();
|
|
36
|
+
});
|
|
37
|
+
test(' it should render properly with props', () => {
|
|
38
|
+
const { container } = render(_jsx(Popover, { placement: "bottom-start", trigger: _jsx(Button, { kind: "flat", children: "Open popover" }), disabled: true, children: _jsx("div", { children: "Some Content" }) }));
|
|
39
|
+
expect(container).not.toBeNull();
|
|
40
|
+
});
|
|
41
|
+
});
|