@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,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
|
+
});
|
|
@@ -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({});
|
|
@@ -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,
|
|
@@ -76,7 +79,7 @@ export const Popover = forwardRef(({ children, trigger, offset = 8, placement =
|
|
|
76
79
|
},
|
|
77
80
|
],
|
|
78
81
|
});
|
|
79
|
-
const isFocusWithin = useFocusWithin(
|
|
82
|
+
const isFocusWithin = useFocusWithin(document.getElementById(seedID('tooltip-content')), {
|
|
80
83
|
onBlur: (e) => {
|
|
81
84
|
if (e.relatedTarget && visible) {
|
|
82
85
|
setIsOpen(false);
|
|
@@ -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,
|
|
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,CAgBxC,CAAC;AAEF,eAAe,KAAK,CAAC;AA4CrB,eAAO,MAAM,OAAO;;;4EAA2B,CAAC;AAyBhD,eAAO,MAAM,aAAa;;;4EAA0B,CAAC;AAuBrD,eAAO,MAAM,SAAS;;;4EAA6B,CAAC;AAwCpD,eAAO,MAAM,UAAU;;;4EAA8B,CAAC"}
|
|
@@ -1,22 +1,31 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useState } from 'react';
|
|
3
|
-
import { Button, Menu, Textfield, Title, } from '../..';
|
|
3
|
+
import { Button, Menu, Stack, Textfield, Title, } from '../..';
|
|
4
4
|
import { Popover } from './popover';
|
|
5
5
|
const story = {
|
|
6
6
|
title: 'Dialogs/Popover',
|
|
7
7
|
component: Popover,
|
|
8
8
|
args: {
|
|
9
9
|
placement: 'auto-start',
|
|
10
|
+
offset: 8,
|
|
11
|
+
closeOnOutsideClick: true,
|
|
12
|
+
matchTriggerWidth: false,
|
|
10
13
|
trigger: _jsx(Button, { children: "Open Popover" }),
|
|
11
14
|
},
|
|
15
|
+
argTypes: {
|
|
16
|
+
placement: {
|
|
17
|
+
options: ['auto', 'auto-start', 'auto-end', 'top', 'bottom', 'right', 'left', 'top-start', 'top-end', 'bottom-start', 'bottom-end', 'right-start', 'right-end', 'left-start', 'left-end'],
|
|
18
|
+
control: { type: 'select' },
|
|
19
|
+
},
|
|
20
|
+
},
|
|
12
21
|
};
|
|
13
22
|
export default story;
|
|
14
23
|
const DefaultTemplate = (args) => {
|
|
15
24
|
const [isChecked, setIsChecked] = useState(false);
|
|
16
|
-
return (_jsx(Popover, { ...args, children: _jsxs(Menu, { children: [_jsx(Menu.Item, {
|
|
25
|
+
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
26
|
};
|
|
18
27
|
export const Default = DefaultTemplate.bind({});
|
|
19
|
-
const CustomTemplate = args => (_jsxs(
|
|
28
|
+
const CustomTemplate = args => (_jsxs(Stack, { direction: "row", columnGap: 8, children: [_jsx(Popover, { ...args, children: _jsx("div", { style: {
|
|
20
29
|
background: 'var(--global-vibrancy-background)', backdropFilter: 'blur(10px)', border: '2px solid black', padding: 24,
|
|
21
30
|
}, children: "Lorem." }) }), _jsx(Popover, { ...args, children: _jsx("div", { style: {
|
|
22
31
|
background: 'var(--global-vibrancy-background)', backdropFilter: 'blur(10px)', border: '2px solid black', padding: 24,
|
|
@@ -38,7 +47,11 @@ WithField.args = {
|
|
|
38
47
|
const ControlledTemplate = (args) => {
|
|
39
48
|
const [isOpen, setIsOpen] = useState(false);
|
|
40
49
|
return (_jsx(Popover, { ...args, trigger: (_jsx(Button, { onClick: () => setIsOpen(val => !val), children: `${isOpen ? 'Close' : 'Open'} Popover` })), onOpenChange: state => setIsOpen(state), open: isOpen, children: _jsxs("div", { style: {
|
|
41
|
-
background: 'var(--global-vibrancy-background)',
|
|
50
|
+
background: 'var(--global-vibrancy-background)',
|
|
51
|
+
backdropFilter: 'blur(10px)',
|
|
52
|
+
border: '2px solid black',
|
|
53
|
+
padding: 24,
|
|
54
|
+
maxWidth: '300px',
|
|
42
55
|
}, children: ["Lorem ipsum dolor, sit amet consectetur adipisicing elit. Magni error unde sapiente beatae! Nostrum praesentium similique veniam non ut nulla, incidunt velit et, placeat cupiditate, aliquid saepe. Atque, provident perferendis?", _jsx("button", { type: "button", onClick: () => setIsOpen(val => !val), children: "Close popover" })] }) }));
|
|
43
56
|
};
|
|
44
57
|
export const Controlled = ControlledTemplate.bind({});
|
|
@@ -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
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prose.test.d.ts","sourceRoot":"","sources":["../../../src/components/prose/prose.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
/* eslint-disable max-len */
|
|
18
|
+
import { render } from '@testing-library/react';
|
|
19
|
+
import { Prose } from './prose';
|
|
20
|
+
const innerText = 'Lorem, ipsum dolor sit amet consectetur adipisicing elit. Ullam hic illo quam ipsa. Aspernatur, eveniet? Optio dolore minima magni culpa necessitatibus facilis quam libero nam.';
|
|
21
|
+
describe('<Prose>', () => {
|
|
22
|
+
test(' it should render properly', () => {
|
|
23
|
+
const { container } = render(_jsx(Prose, { children: innerText }));
|
|
24
|
+
expect(container).not.toBeNull();
|
|
25
|
+
});
|
|
26
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"select.test.d.ts","sourceRoot":"","sources":["../../../src/components/select/select.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 { Select } from './select';
|
|
19
|
+
describe('<Select>', () => {
|
|
20
|
+
test(' it should render properly', () => {
|
|
21
|
+
const { container } = render(_jsxs(Select, { defaultValue: "placeholder", label: "My Label", children: [_jsx("option", { value: "placeholder", hidden: true, disabled: true, children: "Pick an option" }), _jsxs("optgroup", { label: "Option Group One", children: [_jsx("option", { value: "1", children: "This is a very long option selected" }), _jsx("option", { value: "2", children: "Option 2" })] }), _jsxs("optgroup", { label: "Option Group Two", children: [_jsx("option", { value: "3", children: "Option 1" }), _jsx("option", { value: "4", children: "Option 2" }), _jsx("option", { value: "5", children: "Option 3" })] })] }));
|
|
22
|
+
expect(container).not.toBeNull();
|
|
23
|
+
});
|
|
24
|
+
test(' it should render properly with props', () => {
|
|
25
|
+
const { container } = render(_jsxs(Select, { defaultValue: "placeholder", label: "My Label", dimension: "small", disabled: true, children: [_jsx("option", { value: "placeholder", hidden: true, disabled: true, children: "Pick an option" }), _jsxs("optgroup", { label: "Option Group One", children: [_jsx("option", { value: "1", children: "This is a very long option selected" }), _jsx("option", { value: "2", children: "Option 2" })] }), _jsxs("optgroup", { label: "Option Group Two", children: [_jsx("option", { value: "3", children: "Option 1" }), _jsx("option", { value: "4", children: "Option 2" }), _jsx("option", { value: "5", children: "Option 3" })] })] }));
|
|
26
|
+
expect(container).not.toBeNull();
|
|
27
|
+
});
|
|
28
|
+
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer components{.InputWrapper{display:inline-block;line-height:0}.InputWrapper[data-radio-control=true]{position:absolute}.CheckboxInput{--w:24px;--h:24px;appearance:none;-webkit-backdrop-filter:saturate(180%) blur(62px);backdrop-filter:saturate(180%) blur(62px);background-color:var(--global-vibrancy-background);block-size:var(--h);border-radius:.25rem;box-shadow:0 0 0 1px var(--global-background),inset 0 0 0 1px var(--dimmed-2);color:var(--global-background);inline-size:var(--w);max-block-size:var(--h);max-inline-size:var(--w);position:relative}.CheckboxInput:after{block-size:27%;border-bottom:2px solid;border-left:2px solid;content:"";display:none;inline-size:50%;left:50%;position:absolute;top:50%;transform:translate(-50%,-80%) rotate(-45deg)}.CheckboxInput:active{background-color:var(--global-vibrancy-background-hard)}.CheckboxInput:checked,.CheckboxInput:indeterminate{background:var(--dimmed-7);box-shadow:0 0 0 1px var(--global-background),inset 0 0 0 1px transparent}.CheckboxInput:checked:after,.CheckboxInput:indeterminate:after{display:block}.CheckboxInput:disabled{background-color:var(--global-disabled-background);color:var(--global-disabled-foreground);cursor:not-allowed}.CheckboxInput[data-control-dimension=small]{--w:16px;--h:16px}.CheckboxInput:indeterminate:after{block-size:2px;border-left:0;transform:translate(-50%,-50%)}.RadioInput{composes:CheckboxInput;border-radius:100%}.RadioInput:after{background-color:currentcolor;block-size:50%;border:0;border-radius:100%;inline-size:50%;transform:translate(-50%,-50%)}.Toggle{--w:44px;--h:24px;--p:2px;composes:RadioInput;border-radius:200px;color:var(--dimmed-7)}.Toggle:checked{color:var(--global-background)}.Toggle:disabled{color:var(--global-disabled-foreground)}.Toggle:after{block-size:calc(var(--h) - var(--p)*2);bottom:var(--p);display:block;inline-size:calc(var(--h) - var(--p)*2);left:var(--p);top:var(--p);transform:none;transition:transform .1s cubic-bezier(.3,.07,.34,1),background-color .1s cubic-bezier(.3,.07,.34,1)}.Toggle:checked:after{display:block;transform:translateX(100%)}.Toggle[data-control-dimension=small]{--w:28px;--h:16px}.Label[aria-disabled=true]{color:var(--global-disabled-foreground);cursor:not-allowed}}
|
|
1
|
+
@layer components{.InputWrapper{display:inline-block;line-height:0}.InputWrapper[data-radio-control=true]{position:absolute}.CheckboxInput{--w:24px;--h:24px;appearance:none;-webkit-backdrop-filter:saturate(180%) blur(62px);backdrop-filter:saturate(180%) blur(62px);background-color:var(--global-vibrancy-background);block-size:var(--h);border-radius:.25rem;box-shadow:0 0 0 1px var(--global-background),inset 0 0 0 1px var(--dimmed-2);color:var(--global-background);inline-size:var(--w);max-block-size:var(--h);max-inline-size:var(--w);position:relative}.CheckboxInput:after{block-size:27%;border-bottom:2px solid;border-left:2px solid;content:"";display:none;inline-size:50%;left:50%;position:absolute;top:50%;transform:translate(-50%,-80%) rotate(-45deg)}.CheckboxInput:active{background-color:var(--global-vibrancy-background-hard)}.CheckboxInput:checked,.CheckboxInput:indeterminate{background:var(--dimmed-7);box-shadow:0 0 0 1px var(--global-background),inset 0 0 0 1px transparent}.CheckboxInput:checked:after,.CheckboxInput:indeterminate:after{display:block}.CheckboxInput:disabled{background-color:var(--global-disabled-background);box-shadow:none;color:var(--global-disabled-foreground);cursor:not-allowed}.CheckboxInput[data-control-dimension=small]{--w:16px;--h:16px}.CheckboxInput:indeterminate:after{block-size:2px;border-left:0;transform:translate(-50%,-50%)}.RadioInput{composes:CheckboxInput;border-radius:100%}.RadioInput:after{background-color:currentcolor;block-size:50%;border:0;border-radius:100%;inline-size:50%;transform:translate(-50%,-50%)}.RadioInput:disabled{box-shadow:none}.RadioInput:indeterminate{background-color:var(--global-vibrancy-background);box-shadow:0 0 0 1px var(--global-background),inset 0 0 0 1px var(--dimmed-2)}.RadioInput:indeterminate:disabled{box-shadow:none}.RadioInput:indeterminate:after{block-size:0}.Toggle{--w:44px;--h:24px;--p:2px;composes:RadioInput;border-radius:200px;color:var(--dimmed-7)}.Toggle:checked{color:var(--global-background)}.Toggle:disabled{color:var(--global-disabled-foreground)}.Toggle:after{block-size:calc(var(--h) - var(--p)*2);bottom:var(--p);display:block;inline-size:calc(var(--h) - var(--p)*2);left:var(--p);top:var(--p);transform:none;transition:transform .1s cubic-bezier(.3,.07,.34,1),background-color .1s cubic-bezier(.3,.07,.34,1)}.Toggle:checked:after{display:block;transform:translateX(100%)}.Toggle[data-control-dimension=small]{--w:28px;--h:16px}.Label[aria-disabled=true]{color:var(--global-disabled-foreground);cursor:not-allowed}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selection-controls.test.d.ts","sourceRoot":"","sources":["../../../src/components/selection-controls/selection-controls.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,30 @@
|
|
|
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 { Checkbox } from './checkbox';
|
|
19
|
+
import { Radio } from './radio';
|
|
20
|
+
import { Toggle } from './toggle';
|
|
21
|
+
describe('<Checkbox><Rdio><Toggle>', () => {
|
|
22
|
+
test(' they should render properly', () => {
|
|
23
|
+
const { container } = render(_jsxs(_Fragment, { children: [_jsx(Checkbox, { label: "My Checkbox" }), _jsx(Radio, { label: "My Radio Button" }), _jsx(Toggle, { label: "My Toggle" })] }));
|
|
24
|
+
expect(container).not.toBeNull();
|
|
25
|
+
});
|
|
26
|
+
test(' they should render properly with props', () => {
|
|
27
|
+
const { container } = render(_jsxs(_Fragment, { children: [_jsx(Checkbox, { label: "My Checkbox", dimension: "small", indeterminate: true }), _jsx(Radio, { label: "My Radio Button", dimension: "small" }), _jsx(Toggle, { label: "My Toggle", dimension: "small" })] }));
|
|
28
|
+
expect(container).not.toBeNull();
|
|
29
|
+
});
|
|
30
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"separator.test.d.ts","sourceRoot":"","sources":["../../../src/components/separator/separator.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 { Separator } from './separator';
|
|
19
|
+
describe('<Separator>', () => {
|
|
20
|
+
test(' it should render properly', () => {
|
|
21
|
+
const { container } = render(_jsx(Separator, {}));
|
|
22
|
+
expect(container).not.toBeNull();
|
|
23
|
+
});
|
|
24
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skeleton.test.d.ts","sourceRoot":"","sources":["../../../src/components/skeleton/skeleton.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 { Skeleton } from './skeleton';
|
|
19
|
+
describe('<Skeleton>', () => {
|
|
20
|
+
test(' it should render properly', () => {
|
|
21
|
+
const { container } = render(_jsx(Skeleton, {}));
|
|
22
|
+
expect(container).not.toBeNull();
|
|
23
|
+
});
|
|
24
|
+
test(' it should render properly with props', () => {
|
|
25
|
+
const { container } = render(_jsx(Skeleton, { width: 100, height: 100, gap: "16", count: 10, inline: true }));
|
|
26
|
+
expect(container).not.toBeNull();
|
|
27
|
+
});
|
|
28
|
+
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slider.d.ts","sourceRoot":"","sources":["../../../src/components/slider/slider.tsx"],"names":[],"mappings":"AAiBA,OAAO,EACO,mBAAmB,EAChC,MAAM,OAAO,CAAC;AAGf,OAAO,EACU,WAAW,EAC3B,MAAM,cAAc,CAAC;AAItB,oBAAY,WAAW,GAAG,mBAAmB,CAAC,gBAAgB,CAAC,GAAG;IAChE;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,OAAO,CAAC,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC;IAChC;;;OAGG;IACH,OAAO,CAAC,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC;IAChC;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAChC;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAA;AAED,eAAO,MAAM,MAAM;IAhDjB;;OAEG;;IAEH;;OAEG;;IAEH;;;OAGG;;IAEH;;;OAGG;uBACe,MAAM,KAAK,IAAI;IACjC;;OAEG;;IAEH;;OAEG;;IAEH;;;OAGG;;IAEH;;;OAGG;;IAEH;;OAEG;;IAEH;;;;OAIG;;
|
|
1
|
+
{"version":3,"file":"slider.d.ts","sourceRoot":"","sources":["../../../src/components/slider/slider.tsx"],"names":[],"mappings":"AAiBA,OAAO,EACO,mBAAmB,EAChC,MAAM,OAAO,CAAC;AAGf,OAAO,EACU,WAAW,EAC3B,MAAM,cAAc,CAAC;AAItB,oBAAY,WAAW,GAAG,mBAAmB,CAAC,gBAAgB,CAAC,GAAG;IAChE;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,OAAO,CAAC,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC;IAChC;;;OAGG;IACH,OAAO,CAAC,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC;IAChC;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAChC;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAA;AAED,eAAO,MAAM,MAAM;IAhDjB;;OAEG;;IAEH;;OAEG;;IAEH;;;OAGG;;IAEH;;;OAGG;uBACe,MAAM,KAAK,IAAI;IACjC;;OAEG;;IAEH;;OAEG;;IAEH;;;OAGG;;IAEH;;;OAGG;;IAEH;;OAEG;;IAEH;;;;OAIG;;oDAsFH,CAAC"}
|
|
@@ -28,6 +28,6 @@ export const Slider = forwardRef(({ min = 0, max = 100, step, onInput, className
|
|
|
28
28
|
}, [onInput]);
|
|
29
29
|
const seedID = useUIDSeed();
|
|
30
30
|
const fieldID = useMemo(() => id ?? seedID('slider'), [id, seedID]);
|
|
31
|
-
return (_jsxs(Stack, { direction: "column", rowGap: 8, children: [label && _jsx(Text, { as: "label", size: isSmall ? 14 : 16, className: styles.Label, "aria-disabled": disabled, htmlFor: fieldID, children: label }), _jsxs(Stack, { direction: "row", vAlign: "center", columnGap: 8, className: clsx(styles.Slider, className), "data-slider-dimension": dimension, children: [showValues && _jsx(Text, { as: "span", size: isSmall ? 14 : 16, weight: "bold", textAlign: "end", className: styles.Value, "aria-disabled": disabled, children: min }), (iconMin && !showValues) && (_jsx(Symbol, { source: iconMin, dimension: isSmall ? 16 : 24, className: styles.Icon, "aria-disabled": disabled })), _jsx("input", { ref: forwardedRef, className: styles.Input, type: "range", min: min, max: max, defaultValue: value, "aria-valuemin": min, "aria-valuemax": max, "aria-valuenow": value, "aria-disabled": disabled, step: step, onInput: handleInput, disabled: disabled, id: fieldID, ...otherProps }), showValues && _jsx(Text, { as: "span", size: isSmall ? 14 : 16, weight: "bold", className: styles.Value, "aria-disabled": disabled, children: max }), showValues && _jsx(Textfield, { readOnly: true, dimension: "small", size: String(max).length, value: value, disabled: disabled }), (iconMax && !showValues) && (_jsx(Symbol, { source: iconMax, dimension: isSmall ? 16 : 24, className: styles.Icon, "aria-disabled": disabled }))] })] }));
|
|
31
|
+
return (_jsxs(Stack, { direction: "column", rowGap: 8, children: [label && _jsx(Text, { as: "label", size: isSmall ? 14 : 16, className: styles.Label, "aria-disabled": disabled, htmlFor: fieldID, children: label }), _jsxs(Stack, { direction: "row", vAlign: "center", columnGap: 8, className: clsx(styles.Slider, className), "data-slider-dimension": dimension, children: [showValues && _jsx(Text, { as: "span", size: isSmall ? 14 : 16, weight: "bold", textAlign: "end", className: styles.Value, "aria-disabled": disabled, children: min }), (iconMin && !showValues) && (_jsx(Symbol, { source: iconMin, dimension: isSmall ? 16 : 24, className: styles.Icon, "aria-disabled": disabled })), _jsx("input", { ref: forwardedRef, className: styles.Input, type: "range", min: min, max: max, defaultValue: value, "aria-valuemin": min, "aria-valuemax": max, "aria-valuenow": value, "aria-disabled": disabled, step: step, onInput: handleInput, disabled: disabled, id: fieldID, "data-testid": "SliderInput", ...otherProps }), showValues && _jsx(Text, { as: "span", size: isSmall ? 14 : 16, weight: "bold", className: styles.Value, "aria-disabled": disabled, children: max }), showValues && _jsx(Textfield, { readOnly: true, dimension: "small", size: String(max).length, value: value, disabled: disabled }), (iconMax && !showValues) && (_jsx(Symbol, { source: iconMax, dimension: isSmall ? 16 : 24, className: styles.Icon, "aria-disabled": disabled }))] })] }));
|
|
32
32
|
});
|
|
33
33
|
Slider.displayName = 'Slider';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slider.test.d.ts","sourceRoot":"","sources":["../../../src/components/slider/slider.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
/* eslint-disable @typescript-eslint/comma-dangle */
|
|
18
|
+
import { fireEvent, render } from '@testing-library/react';
|
|
19
|
+
import { Slider } from './slider';
|
|
20
|
+
describe('<Slider>', () => {
|
|
21
|
+
test(' it should render properly', () => {
|
|
22
|
+
const { container } = render(_jsxs(_Fragment, { children: [_jsx(Slider, { label: "Qty", iconMin: "minus", iconMax: "plus" }), _jsx(Slider, { label: "Qty", iconMin: "minus", iconMax: "plus", dimension: "small" }), _jsx(Slider, { label: "Qty", showValues: true, dimension: "small" }), _jsx(Slider, { showValues: true, dimension: "regular" })] }));
|
|
23
|
+
expect(container).not.toBeNull();
|
|
24
|
+
});
|
|
25
|
+
test(' it should slide properly', () => {
|
|
26
|
+
const { container, getByTestId } = render(_jsx(_Fragment, { children: _jsx(Slider, { defaultValue: 0, label: "Qty", iconMin: "minus", iconMax: "plus" }) }));
|
|
27
|
+
fireEvent.change(getByTestId('SliderInput'), { target: { value: 25 } });
|
|
28
|
+
expect(container).not.toBeNull();
|
|
29
|
+
});
|
|
30
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snackbar.test.d.ts","sourceRoot":"","sources":["../../../src/components/snackbar/snackbar.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 { Snackbar } from './snackbar';
|
|
19
|
+
describe('<Snackbar>', () => {
|
|
20
|
+
test(' it should render properly', () => {
|
|
21
|
+
const { container } = render(_jsx(Snackbar, { children: "Content" }));
|
|
22
|
+
expect(container).not.toBeNull();
|
|
23
|
+
});
|
|
24
|
+
test(' it should render properly with props', () => {
|
|
25
|
+
const { container } = render(_jsx(Snackbar, { title: "My title", dismissable: true, children: "Content" }));
|
|
26
|
+
expect(container).not.toBeNull();
|
|
27
|
+
});
|
|
28
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spinner.test.d.ts","sourceRoot":"","sources":["../../../src/components/spinner/spinner.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 { Spinner } from './spinner';
|
|
19
|
+
describe('<Spinner>', () => {
|
|
20
|
+
test(' it should render properly', () => {
|
|
21
|
+
const { container } = render(_jsx(Spinner, {}));
|
|
22
|
+
expect(container).not.toBeNull();
|
|
23
|
+
});
|
|
24
|
+
test(' it should render properly with props', () => {
|
|
25
|
+
const { container } = render(_jsx(Spinner, { dimension: "small" }));
|
|
26
|
+
expect(container).not.toBeNull();
|
|
27
|
+
});
|
|
28
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"split-button.test.d.ts","sourceRoot":"","sources":["../../../src/components/split-button/split-button.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 { SplitButton } from './split-button';
|
|
19
|
+
describe('<SplitButton>', () => {
|
|
20
|
+
test(' it should render properly', () => {
|
|
21
|
+
const { container } = render(_jsx(SplitButton, { label: "My Label", children: "Text" }));
|
|
22
|
+
expect(container).not.toBeNull();
|
|
23
|
+
});
|
|
24
|
+
});
|