@wonderflow/react-components 10.18.2 → 10.20.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.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/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/autocomplete/autocomplete-option.d.ts.map +1 -1
- package/dist/components/autocomplete/autocomplete-option.js +1 -1
- package/dist/components/autocomplete/autocomplete.d.ts.map +1 -1
- package/dist/components/autocomplete/autocomplete.js +10 -5
- 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/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/button/button.d.ts.map +1 -1
- package/dist/components/button/button.js +1 -1
- 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/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/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/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/clamp-text/clamp-text.d.ts.map +1 -1
- package/dist/components/clamp-text/clamp-text.js +1 -1
- 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/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/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/disclosure/disclosure.d.ts.map +1 -1
- package/dist/components/disclosure/disclosure.js +1 -1
- 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/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/expander/expander.d.ts.map +1 -1
- package/dist/components/expander/expander.js +1 -1
- 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/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/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/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/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/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/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/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 +1 -1
- package/dist/components/menu/menu-item/menu-item.module.css +1 -1
- package/dist/components/menu/menu.module.css +1 -1
- package/dist/components/menu/menu.stories.d.ts.map +1 -1
- package/dist/components/menu/menu.stories.js +2 -2
- 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/overlay-container/overlay-container.stories.js +2 -2
- package/dist/components/pagination/pagination.js +1 -1
- 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/popover.d.ts.map +1 -1
- package/dist/components/popover/popover.js +6 -3
- package/dist/components/popover/popover.stories.d.ts.map +1 -1
- package/dist/components/popover/popover.stories.js +17 -4
- 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/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/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/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/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/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/slider.d.ts.map +1 -1
- package/dist/components/slider/slider.js +1 -1
- 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/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/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/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/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/star-meter.d.ts.map +1 -1
- package/dist/components/star-meter/star-meter.js +1 -4
- 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/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/tab.d.ts.map +1 -1
- package/dist/components/tab/tab.js +1 -1
- 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/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/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/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 +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/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/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.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/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/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/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/toggle-button.d.ts.map +1 -1
- package/dist/components/toggle-button/toggle-button.js +1 -1
- 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/tooltip.d.ts.map +1 -1
- package/dist/components/tooltip/tooltip.js +7 -3
- package/dist/components/tooltip/tooltip.stories.d.ts +3 -1
- package/dist/components/tooltip/tooltip.stories.d.ts.map +1 -1
- package/dist/components/tooltip/tooltip.stories.js +33 -5
- 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 +42 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- 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/package.json +17 -15
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stack.test.d.ts","sourceRoot":"","sources":["../../../src/components/stack/stack.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 { Stack } from './stack';
|
|
19
|
+
describe('<Stack>', () => {
|
|
20
|
+
test(' it should render properly', () => {
|
|
21
|
+
const { container } = render(_jsxs(Stack, { children: [_jsx("div", { children: "1" }), _jsx("div", { children: "2" }), _jsx("div", { children: "3" })] }));
|
|
22
|
+
expect(container).not.toBeNull();
|
|
23
|
+
});
|
|
24
|
+
test(' it should render properly with props', () => {
|
|
25
|
+
const { container } = render(_jsxs(Stack, { direction: "row", rowGap: 2, columnGap: 2, vPadding: 2, hPadding: 2, vAlign: "start", hAlign: "end", children: [_jsx("div", { children: "1" }), _jsx("div", { children: "2" }), _jsx("div", { children: "3" })] }));
|
|
26
|
+
expect(container).not.toBeNull();
|
|
27
|
+
});
|
|
28
|
+
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"star-meter.d.ts","sourceRoot":"","sources":["../../../src/components/star-meter/star-meter.tsx"],"names":[],"mappings":"AAiBA,OAAO,EACO,SAAS,EACtB,MAAM,OAAO,CAAC;AAGf,OAAO,EACL,WAAW,EAAE,KAAK,EACnB,MAAM,cAAc,CAAC;AAItB,oBAAY,cAAc,GAAG;IAC3B;;;;;;;;;;;OAWG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,KAAK,CAAC;IACxC;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAA;AAED,aAAK,oBAAoB,GAAG,WAAW,CAAC,mBAAmB,CAC3D,WAAW,CAAC,gBAAgB,CAAC,OAAO,KAAK,CAAC,EAC1C,WAAW,CAAC,QAAQ,CAAC,OAAO,KAAK,CAAC,GAAG,cAAc,CAClD,CAAC;AAEF,eAAO,MAAM,SAAS,
|
|
1
|
+
{"version":3,"file":"star-meter.d.ts","sourceRoot":"","sources":["../../../src/components/star-meter/star-meter.tsx"],"names":[],"mappings":"AAiBA,OAAO,EACO,SAAS,EACtB,MAAM,OAAO,CAAC;AAGf,OAAO,EACL,WAAW,EAAE,KAAK,EACnB,MAAM,cAAc,CAAC;AAItB,oBAAY,cAAc,GAAG;IAC3B;;;;;;;;;;;OAWG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,KAAK,CAAC;IACxC;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAA;AAED,aAAK,oBAAoB,GAAG,WAAW,CAAC,mBAAmB,CAC3D,WAAW,CAAC,gBAAgB,CAAC,OAAO,KAAK,CAAC,EAC1C,WAAW,CAAC,QAAQ,CAAC,OAAO,KAAK,CAAC,GAAG,cAAc,CAClD,CAAC;AAEF,eAAO,MAAM,SAAS,sBAyGI,CAAC"}
|
|
@@ -45,10 +45,7 @@ export const StarMeter = forwardRef(({ className, value = 0, starCount = 5, labe
|
|
|
45
45
|
if (fraction < 0.25) {
|
|
46
46
|
return Math.floor(value);
|
|
47
47
|
}
|
|
48
|
-
|
|
49
|
-
return integer + 0.5;
|
|
50
|
-
}
|
|
51
|
-
return 0;
|
|
48
|
+
return integer + 0.5;
|
|
52
49
|
}, []);
|
|
53
50
|
const starType = useCallback((maxStars, value) => {
|
|
54
51
|
const roundedValue = roundValue(value);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"star-meter.test.d.ts","sourceRoot":"","sources":["../../../src/components/star-meter/star-meter.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,36 @@
|
|
|
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 { StarMeter } from './star-meter';
|
|
19
|
+
describe('<StarMeter>', () => {
|
|
20
|
+
test(' it should render properly', () => {
|
|
21
|
+
const { container } = render(_jsx(StarMeter, { value: 0, dimension: "small" }));
|
|
22
|
+
expect(container).not.toBeNull();
|
|
23
|
+
});
|
|
24
|
+
test(' it should render properly with half value', () => {
|
|
25
|
+
const { container } = render(_jsx(StarMeter, { value: 1.5 }));
|
|
26
|
+
expect(container).not.toBeNull();
|
|
27
|
+
});
|
|
28
|
+
test(' it should render properly with fraction value', () => {
|
|
29
|
+
const { container } = render(_jsx(StarMeter, { value: 1.33 }));
|
|
30
|
+
expect(container).not.toBeNull();
|
|
31
|
+
});
|
|
32
|
+
test(' it should render properly with high fraction value', () => {
|
|
33
|
+
const { container } = render(_jsx(StarMeter, { value: 1.83 }));
|
|
34
|
+
expect(container).not.toBeNull();
|
|
35
|
+
});
|
|
36
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"symbol.test.d.ts","sourceRoot":"","sources":["../../../src/components/symbol/symbol.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 { render } from '@testing-library/react';
|
|
18
|
+
import { Symbol } from './symbol';
|
|
19
|
+
const CustomReactIcon = ({ ...props }) => (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: 48, height: 48, viewBox: "0 0 256 256", ...props, children: _jsx("path", { d: "M128 16a96.2 96.2 0 0 0-96 96c0 24 12.6 55.1 33.6 83s44.5 45 62.4 45 41.2-16.8 62.4-45 33.6-59 33.6-83a96.2 96.2 0 0 0-96-96ZM64 116v-4a12 12 0 0 1 12-12 36 36 0 0 1 36 36v4a12 12 0 0 1-12 12 36 36 0 0 1-36-36Zm80 84h-32a8 8 0 0 1 0-16h32a8 8 0 0 1 0 16Zm48-84a36 36 0 0 1-36 36 12 12 0 0 1-12-12v-4a36 36 0 0 1 36-36 12 12 0 0 1 12 12Z" }) }));
|
|
20
|
+
describe('<Symbol>', () => {
|
|
21
|
+
test(' it should render properly', () => {
|
|
22
|
+
const { container } = render(_jsx(Symbol, { source: "bell" }));
|
|
23
|
+
expect(container).not.toBeNull();
|
|
24
|
+
});
|
|
25
|
+
test(' it should render properly with custom icon', () => {
|
|
26
|
+
const { container } = render(_jsx(Symbol, { source: _jsx(CustomReactIcon, {}) }));
|
|
27
|
+
expect(container).not.toBeNull();
|
|
28
|
+
});
|
|
29
|
+
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tab.d.ts","sourceRoot":"","sources":["../../../src/components/tab/tab.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,aAAa,MAAM,sBAAsB,CAAC;AAEtD,OAAO,EACqB,iBAAiB,EAC5C,MAAM,OAAO,CAAC;AAMf,OAAO,EAAY,aAAa,EAAE,MAAM,cAAc,CAAC;AAEvD,oBAAY,QAAQ,GAAG,iBAAiB,CAAC,cAAc,CAAC,GAAG;IACzD;;OAEG;IACH,KAAK,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IACzC;;OAEG;IACH,YAAY,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IACvD;;OAEG;IACH,aAAa,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC;IACzD;;;OAGG;IACH,GAAG,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IACrC;;;OAGG;IACH,cAAc,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC;IAC3D;;;OAGG;IACH,IAAI,CAAC,EAAE,aAAa,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;IAC3C;;;;OAIG;IACH,SAAS,CAAC,EAAE,SAAS,GAAG,KAAK,CAAC;CAC/B,CAAC;AAEF,eAAO,MAAM,GAAG;kGASb,QAAQ;;
|
|
1
|
+
{"version":3,"file":"tab.d.ts","sourceRoot":"","sources":["../../../src/components/tab/tab.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,aAAa,MAAM,sBAAsB,CAAC;AAEtD,OAAO,EACqB,iBAAiB,EAC5C,MAAM,OAAO,CAAC;AAMf,OAAO,EAAY,aAAa,EAAE,MAAM,cAAc,CAAC;AAEvD,oBAAY,QAAQ,GAAG,iBAAiB,CAAC,cAAc,CAAC,GAAG;IACzD;;OAEG;IACH,KAAK,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IACzC;;OAEG;IACH,YAAY,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IACvD;;OAEG;IACH,aAAa,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC;IACzD;;;OAGG;IACH,GAAG,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IACrC;;;OAGG;IACH,cAAc,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC;IAC3D;;;OAGG;IACH,IAAI,CAAC,EAAE,aAAa,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;IAC3C;;;;OAIG;IACH,SAAS,CAAC,EAAE,SAAS,GAAG,KAAK,CAAC;CAC/B,CAAC;AAEF,eAAO,MAAM,GAAG;kGASb,QAAQ;;CA4CV,CAAC"}
|
|
@@ -28,6 +28,6 @@ export const Tab = ({ className, children, onValueChange, defaultValue, value, l
|
|
|
28
28
|
onValueChange?.(value);
|
|
29
29
|
setActiveItem(value);
|
|
30
30
|
}, [onValueChange]);
|
|
31
|
-
return (_jsxs(TabsPrimitive.Root, { defaultValue: defaultValue, onValueChange: handleOnVlaueChange, className: className, value: value, ...otherProps, children: [_jsx(LazyMotion, { features: domMax, strict: true, children: _jsx(TabsPrimitive.List, { className: styles.List, loop: loop, children: Children.map(children, child => isValidElement(child) && (_jsx(TabsPrimitive.Trigger, { value: child.props.value, disabled: child.props.disabled, className: styles.Trigger, "data-tab-dimension": dimension, asChild: true, children: _jsxs(Button, { kind: "flat", dimension: "big", children: [child.props.icon && _jsx(Symbol, { source: child.props.icon, dimension: dimension === 'big' ? 24 : 16, weight: dimension === 'big' ? 'duotone' : 'solid' }), child.props.label, (child.props.value === activeItem) && (_jsx(m.span, { className: styles.Highlight, layoutId: uid('tab-highlight') }))] }) }))) }) }), children] }));
|
|
31
|
+
return (_jsxs(TabsPrimitive.Root, { defaultValue: defaultValue, onValueChange: handleOnVlaueChange, className: className, value: value, "data-testid": "TabRoot", ...otherProps, children: [_jsx(LazyMotion, { features: domMax, strict: true, children: _jsx(TabsPrimitive.List, { className: styles.List, loop: loop, children: Children.map(children, child => isValidElement(child) && (_jsx(TabsPrimitive.Trigger, { value: child.props.value, disabled: child.props.disabled, className: styles.Trigger, "data-tab-dimension": dimension, asChild: true, children: _jsxs(Button, { kind: "flat", dimension: "big", children: [child.props.icon && _jsx(Symbol, { source: child.props.icon, dimension: dimension === 'big' ? 24 : 16, weight: dimension === 'big' ? 'duotone' : 'solid' }), child.props.label, (child.props.value === activeItem) && (_jsx(m.span, { className: styles.Highlight, layoutId: uid('tab-highlight') }))] }) }))) }) }), children] }));
|
|
32
32
|
};
|
|
33
33
|
Tab.Panel = TabPanel;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tab.test.d.ts","sourceRoot":"","sources":["../../../src/components/tab/tab.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 { fireEvent, render } from '@testing-library/react';
|
|
18
|
+
import { Tab } from './tab';
|
|
19
|
+
describe('<Tab>', () => {
|
|
20
|
+
test(' it should render properly', () => {
|
|
21
|
+
const { container } = render(_jsxs(Tab, { children: [_jsx(Tab.Panel, { value: "1", label: "Tab 1", children: "Panel 1" }), _jsx(Tab.Panel, { value: "2", label: "Tab mid long 2", children: "Panel 2" }), _jsx(Tab.Panel, { value: "3", label: "Tab short 3", children: "Panel 3" }), _jsx(Tab.Panel, { value: "4", label: "Tab veryy long 4", children: "Panel 4" }), _jsx(Tab.Panel, { value: "5", label: "Tab 5", children: "Panel 5" }), _jsx(Tab.Panel, { value: "6", label: "Tab 6", icon: "bell", children: "Panel 6" })] }));
|
|
22
|
+
expect(container).not.toBeNull();
|
|
23
|
+
});
|
|
24
|
+
test(' it should render properly with props', async () => {
|
|
25
|
+
const { container, getByLabelText, getByTestId } = render(_jsxs(Tab, { dimension: "big", value: "1", children: [_jsx(Tab.Panel, { value: "1", label: "Tab 1", children: "Panel 1" }), _jsx(Tab.Panel, { value: "2", label: "Tab mid long 2", children: "Panel 2" }), _jsx(Tab.Panel, { value: "3", label: "Tab short 3", children: "Panel 3" }), _jsx(Tab.Panel, { value: "4", label: "Tab veryy long 4", children: "Panel 4" }), _jsx(Tab.Panel, { value: "5", label: "Tab 5", children: "Panel 5" }), _jsx(Tab.Panel, { value: "6", label: "Tab 6", icon: "bell", children: "Panel 6" })] }));
|
|
26
|
+
fireEvent.click(getByTestId('TabRoot'));
|
|
27
|
+
fireEvent.click(getByLabelText('Tab 5'));
|
|
28
|
+
expect(container).not.toBeNull();
|
|
29
|
+
});
|
|
30
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-cell.test.d.ts","sourceRoot":"","sources":["../../../../src/components/table/table-cell/table-cell.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, 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 { TableCell } from './table-cell';
|
|
19
|
+
describe('<TableCell>', () => {
|
|
20
|
+
test('it should render properly', () => {
|
|
21
|
+
const { container } = render(_jsx(TableCell, {}));
|
|
22
|
+
expect(container).not.toBeNull();
|
|
23
|
+
});
|
|
24
|
+
test('it should render properly with props', () => {
|
|
25
|
+
const { container } = render(_jsxs(_Fragment, { children: [_jsx(TableCell, { width: "100", isSorted: true }), _jsx(TableCell, { width: 100, isSorted: true, isSortedDesc: true })] }));
|
|
26
|
+
expect(container).not.toBeNull();
|
|
27
|
+
});
|
|
28
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-checkbox.test.d.ts","sourceRoot":"","sources":["../../../../src/components/table/table-checkbox/table-checkbox.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,24 @@
|
|
|
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 { TableCheckbox } from './table-checkbox';
|
|
19
|
+
describe('<TableCheckbox>', () => {
|
|
20
|
+
test('it should render properly', () => {
|
|
21
|
+
const { container } = render(_jsx(TableCheckbox, {}));
|
|
22
|
+
expect(container).not.toBeNull();
|
|
23
|
+
});
|
|
24
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-controls.test.d.ts","sourceRoot":"","sources":["../../../../src/components/table/table-controls/table-controls.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,35 @@
|
|
|
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 { ToggleColumnsControl } from './toggle-columns';
|
|
19
|
+
const COLUMNS = [
|
|
20
|
+
{
|
|
21
|
+
isToggable: true,
|
|
22
|
+
isVisible: true,
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
isToggable: true,
|
|
26
|
+
isVisible: true,
|
|
27
|
+
},
|
|
28
|
+
];
|
|
29
|
+
describe('<ToggleColumnsControl>', () => {
|
|
30
|
+
test('it should render properly', () => {
|
|
31
|
+
const { container, getByTestId } = render(_jsx(ToggleColumnsControl, { columns: COLUMNS, visibleColumns: COLUMNS }));
|
|
32
|
+
fireEvent.click(getByTestId('Button'));
|
|
33
|
+
expect(container).not.toBeNull();
|
|
34
|
+
});
|
|
35
|
+
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toggle-columns.d.ts","sourceRoot":"","sources":["../../../../src/components/table/table-controls/toggle-columns.tsx"],"names":[],"mappings":";AAoBA,OAAO,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AAEpD,aAAK,yBAAyB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI;IAClE,OAAO,EAAE,KAAK,CAAC,wBAAwB,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5C,cAAc,EAAE,KAAK,CAAC,wBAAwB,CAAC,CAAC,CAAC,CAAC,CAAC;CACpD,CAAA;AAED,eAAO,MAAM,oBAAoB,
|
|
1
|
+
{"version":3,"file":"toggle-columns.d.ts","sourceRoot":"","sources":["../../../../src/components/table/table-controls/toggle-columns.tsx"],"names":[],"mappings":";AAoBA,OAAO,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AAEpD,aAAK,yBAAyB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI;IAClE,OAAO,EAAE,KAAK,CAAC,wBAAwB,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5C,cAAc,EAAE,KAAK,CAAC,wBAAwB,CAAC,CAAC,CAAC,CAAC,CAAC;CACpD,CAAA;AAED,eAAO,MAAM,oBAAoB,gHA0DhC,CAAC"}
|
|
@@ -34,5 +34,5 @@ export const ToggleColumnsControl = ({ columns, visibleColumns, }) => {
|
|
|
34
34
|
*/
|
|
35
35
|
filteredColumns.forEach(col => col.toggleHidden(false));
|
|
36
36
|
}, [hasSomeVisibleColums, filteredColumns, visibleColumns]);
|
|
37
|
-
return (_jsx(Popover, { placement: "bottom-start", trigger: _jsx(Button, { kind: "secondary", children: "Toggle columns" }), children: _jsxs(Menu, { maxHeight: "350px", children: [_jsx(Menu.ItemCheckbox, { value: "toggle-all", onClick: () => handleToggleAll(), checked: true, icon: visibleColumns.length === 0 ? 'check' : 'minus', children: "Toggle All" }), columns.filter(col => !col.isToggable).map((column, i) => (_jsx(Menu.ItemCheckbox, { value: column.id, autoFocus: i === 0, checked: column.isVisible, icon: column.isVisible ? 'check' : undefined, onClick: () => column.toggleHidden(), children: column.render('Header') }, column.id)))] }) }));
|
|
37
|
+
return (_jsx(Popover, { placement: "bottom-start", trigger: _jsx(Button, { kind: "secondary", children: "Toggle columns" }), children: _jsxs(Menu, { maxHeight: "350px", children: [_jsx(Menu.ItemCheckbox, { value: "toggle-all", onClick: () => handleToggleAll(), checked: true, icon: visibleColumns.length === 0 ? 'check' : 'minus', "data-testid": "ColumnCheckbox", children: "Toggle All" }), columns.filter(col => !col.isToggable).map((column, i) => (_jsx(Menu.ItemCheckbox, { value: column.id, autoFocus: i === 0, checked: column.isVisible, icon: column.isVisible ? 'check' : undefined, onClick: () => column.toggleHidden(), "data-testid": "ColumnCheckboxInner", children: column.render('Header') }, column.id)))] }) }));
|
|
38
38
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-header.test.d.ts","sourceRoot":"","sources":["../../../../src/components/table/table-header/table-header.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,24 @@
|
|
|
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 { TableHeader } from './table-header';
|
|
19
|
+
describe('<TableHeader>', () => {
|
|
20
|
+
test('it should render properly', () => {
|
|
21
|
+
const { container } = render(_jsx(TableHeader, {}));
|
|
22
|
+
expect(container).not.toBeNull();
|
|
23
|
+
});
|
|
24
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-pagination.test.d.ts","sourceRoot":"","sources":["../../../../src/components/table/table-pagination/table-pagination.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,28 @@
|
|
|
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 { TablePagination } from './table-pagination';
|
|
19
|
+
describe('<TablePagination>', () => {
|
|
20
|
+
test('it should render properly', () => {
|
|
21
|
+
const { container } = render(_jsx(TablePagination, { pageSize: 5, totalItems: 10, totalPages: 2, currentPage: 1 }));
|
|
22
|
+
expect(container).not.toBeNull();
|
|
23
|
+
});
|
|
24
|
+
test('it should render properly', () => {
|
|
25
|
+
const { container } = render(_jsx(TablePagination, { pageSize: 5, totalItems: 10, totalPages: 2, currentPage: 1, isManual: true }));
|
|
26
|
+
expect(container).not.toBeNull();
|
|
27
|
+
});
|
|
28
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-row.test.d.ts","sourceRoot":"","sources":["../../../../src/components/table/table-row/table-row.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,24 @@
|
|
|
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 { TableRow } from './table-row';
|
|
19
|
+
describe('<TableRow>', () => {
|
|
20
|
+
test('it should render properly', () => {
|
|
21
|
+
const { container } = render(_jsx("table", { children: _jsx("tbody", { children: _jsx(TableRow, { rowData: undefined, expandedRows: ['test'] }) }) }));
|
|
22
|
+
expect(container).not.toBeNull();
|
|
23
|
+
});
|
|
24
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table.test.d.ts","sourceRoot":"","sources":["../../../src/components/table/table.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, 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 { Table } from './table';
|
|
19
|
+
const DATA = [
|
|
20
|
+
{
|
|
21
|
+
id: 1,
|
|
22
|
+
letter: 'A',
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
id: 2,
|
|
26
|
+
letter: 'B',
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
id: 3,
|
|
30
|
+
letter: 'C',
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
id: 4,
|
|
34
|
+
letter: 'D',
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
id: 5,
|
|
38
|
+
letter: 'E',
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
id: 6,
|
|
42
|
+
letter: 'F',
|
|
43
|
+
},
|
|
44
|
+
];
|
|
45
|
+
const COLUMNS = [
|
|
46
|
+
{
|
|
47
|
+
id: 'id',
|
|
48
|
+
Header: '#',
|
|
49
|
+
accessor: (row) => row.id,
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
id: 'letter',
|
|
53
|
+
Header: 'Letter',
|
|
54
|
+
accessor: (row) => row.letter,
|
|
55
|
+
},
|
|
56
|
+
];
|
|
57
|
+
describe('<Table>', () => {
|
|
58
|
+
test(' it should render properly', () => {
|
|
59
|
+
const { container } = render(_jsxs(_Fragment, { children: [_jsx(Table, { title: "Table", columns: COLUMNS, data: DATA, expandableRowComponent: subRow => (_jsx("div", { children: JSON.stringify(subRow, null, 2) })), showHeader: true, showPagination: true, isManualSorted: true }), _jsx(Table, { title: "Table", columns: COLUMNS, data: [] }), ","] }));
|
|
60
|
+
expect(container).not.toBeNull();
|
|
61
|
+
});
|
|
62
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text.test.d.ts","sourceRoot":"","sources":["../../../src/components/text/text.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,24 @@
|
|
|
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 { Text } from './text';
|
|
19
|
+
describe('<Text>', () => {
|
|
20
|
+
test(' it should render properly', () => {
|
|
21
|
+
const { container } = render(_jsx(Text, { children: "Some text" }));
|
|
22
|
+
expect(container).not.toBeNull();
|
|
23
|
+
});
|
|
24
|
+
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"textfield.d.ts","sourceRoot":"","sources":["../../../src/components/textfield/textfield.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,WAAW,EACZ,MAAM,OAAO,CAAC;AAGf,OAAO,EACuC,WAAW,EACxD,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAa,cAAc,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAG7E,oBAAY,cAAc,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,cAAc,CAAC;IACvE;;OAEG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC;IAC7B;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAChC;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,SAAS,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,KAAK,CAAC;IACxC;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,kBAAkB,CAAC,KAAK,IAAI,CAAC;IAC5D;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC,GAAG,CAAC,CAAA;AAEN,eAAO,MAAM,SAAS,
|
|
1
|
+
{"version":3,"file":"textfield.d.ts","sourceRoot":"","sources":["../../../src/components/textfield/textfield.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,WAAW,EACZ,MAAM,OAAO,CAAC;AAGf,OAAO,EACuC,WAAW,EACxD,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAa,cAAc,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAG7E,oBAAY,cAAc,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,cAAc,CAAC;IACvE;;OAEG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC;IAC7B;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAChC;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,SAAS,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,KAAK,CAAC;IACxC;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,kBAAkB,CAAC,KAAK,IAAI,CAAC;IAC5D;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC,GAAG,CAAC,CAAA;AAEN,eAAO,MAAM,SAAS,sJAqHpB,CAAC"}
|
|
@@ -29,8 +29,8 @@ export const Textfield = forwardRef(({ children, className, disabled = false, ic
|
|
|
29
29
|
disabled,
|
|
30
30
|
onChange,
|
|
31
31
|
};
|
|
32
|
-
return (_jsxs(Stack, { as: "fieldset", rowGap: 4, className: clsx(styles.Textfield, className), "data-textfield-has-icon": isPassword || Boolean(icon), "data-textfield-icon-position": iconPosition, "data-textfield-dimension": dimension, "data-textfield-invalid": invalid && !disabled, "data-textfield-fullwidth": fullWidth, "aria-disabled": disabled, hAlign: "stretch", vAlign: "start", tabIndex: disabled ? 0 : undefined, style: style, children: [label && _jsx(Text, { as: "label", lineHeight: "small", "aria-disabled": disabled, className: styles.Label, size: dimension === 'small' ? 14 : 16, htmlFor: fieldID, children: label }), _jsxs("div", { className: styles.FieldContainer, children: [textarea
|
|
32
|
+
return (_jsxs(Stack, { as: "fieldset", rowGap: 4, className: clsx(styles.Textfield, className), "data-testid": "Textfield", "data-textfield-has-icon": isPassword || Boolean(icon), "data-textfield-icon-position": iconPosition, "data-textfield-dimension": dimension, "data-textfield-invalid": invalid && !disabled, "data-textfield-fullwidth": fullWidth, "aria-disabled": disabled, hAlign: "stretch", vAlign: "start", tabIndex: disabled ? 0 : undefined, style: style, children: [label && _jsx(Text, { as: "label", lineHeight: "small", "aria-disabled": disabled, className: styles.Label, size: dimension === 'small' ? 14 : 16, htmlFor: fieldID, children: label }), _jsxs("div", { className: styles.FieldContainer, children: [textarea
|
|
33
33
|
? (_jsx(BaseField, { ref: forwardedRef, as: "textarea", id: fieldID, ...commonProps, ...otherProps }))
|
|
34
|
-
: (_jsx(BaseField, { className: styles.InputField, id: fieldID, ref: forwardedRef, type: isPasswordVisible ? 'text' : type, spellCheck: isPassword ? false : undefined, ...commonProps, ...otherProps })), isPassword && (_jsx(IconButton, { className: styles.IconButton, dimension: actionSizes[dimension], onClick: handlePasswordVisibility, kind: "flat", "aria-label": "Reveal password", icon: isPasswordVisible ? 'eye-slash' : 'eye' })), !textarea && icon && !isPassword && (_jsx(Symbol, { className: styles.Icon, source: icon, dimension: iconSizes[dimension] }))] }), message && _jsx(Text, { as: "label", lineHeight: "small", sentiment: (invalid && !disabled) ? 'danger' : undefined, "aria-disabled": disabled, className: styles.Label, size: 14, children: message })] }));
|
|
34
|
+
: (_jsx(BaseField, { className: styles.InputField, id: fieldID, ref: forwardedRef, type: isPasswordVisible ? 'text' : type, spellCheck: isPassword ? false : undefined, ...commonProps, ...otherProps })), isPassword && (_jsx(IconButton, { className: styles.IconButton, dimension: actionSizes[dimension], onClick: handlePasswordVisibility, kind: "flat", "aria-label": "Reveal password", "data-testid": "RevealIcon", icon: isPasswordVisible ? 'eye-slash' : 'eye' })), !textarea && icon && !isPassword && (_jsx(Symbol, { className: styles.Icon, source: icon, dimension: iconSizes[dimension] }))] }), message && _jsx(Text, { as: "label", lineHeight: "small", sentiment: (invalid && !disabled) ? 'danger' : undefined, "aria-disabled": disabled, className: styles.Label, size: 14, children: message })] }));
|
|
35
35
|
});
|
|
36
36
|
Textfield.displayName = 'Textfield';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"textfield.test.d.ts","sourceRoot":"","sources":["../../../src/components/textfield/textfield.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,37 @@
|
|
|
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 { Textfield } from './textfield';
|
|
19
|
+
describe('<Textfield>', () => {
|
|
20
|
+
test(' it should render properly', () => {
|
|
21
|
+
const { container } = render(_jsx(Textfield, { icon: "bell", children: "Lorem ipsum dolor sit amet" }));
|
|
22
|
+
expect(container).not.toBeNull();
|
|
23
|
+
});
|
|
24
|
+
test(' it should render properly as password', () => {
|
|
25
|
+
const { container, getByTestId } = render(_jsx(Textfield, { type: "password", label: "Password", invalid: true, message: "Wrong password" }));
|
|
26
|
+
fireEvent.click(getByTestId('RevealIcon'));
|
|
27
|
+
expect(container).not.toBeNull();
|
|
28
|
+
});
|
|
29
|
+
test(' it should render properly as visible password', () => {
|
|
30
|
+
const { container } = render(_jsx(Textfield, { type: "text", label: "Password", dimension: "small", message: "Enter password" }));
|
|
31
|
+
expect(container).not.toBeNull();
|
|
32
|
+
});
|
|
33
|
+
test(' it should render properly as textarea', () => {
|
|
34
|
+
const { container } = render(_jsx(Textfield, { type: "textarea", textarea: true, dimension: "small", disabled: true }));
|
|
35
|
+
expect(container).not.toBeNull();
|
|
36
|
+
});
|
|
37
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"title.test.d.ts","sourceRoot":"","sources":["../../../src/components/title/title.test.tsx"],"names":[],"mappings":""}
|