@wonderflow/react-components 10.18.2 → 10.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/accordion/accordion.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 +6 -3
- 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.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 +5 -2
- package/dist/components/popover/popover.stories.d.ts.map +1 -1
- package/dist/components/popover/popover.stories.js +1 -1
- package/dist/components/popover/popover.test.d.ts +2 -0
- package/dist/components/popover/popover.test.d.ts.map +1 -0
- package/dist/components/popover/popover.test.js +41 -0
- package/dist/components/prose/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.test.d.ts +2 -0
- package/dist/components/tooltip/tooltip.test.d.ts.map +1 -0
- package/dist/components/tooltip/tooltip.test.js +29 -0
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +16 -0
- package/dist/hooks/usePopupWrapper.d.ts +4 -0
- package/dist/hooks/usePopupWrapper.d.ts.map +1 -0
- package/dist/hooks/usePopupWrapper.js +40 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +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":"accordion.test.d.ts","sourceRoot":"","sources":["../../../src/components/accordion/accordion.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 { Accordion } from './accordion';
|
|
19
|
+
import { AccordionItem } from './accordion-item';
|
|
20
|
+
describe('<Accordion>', () => {
|
|
21
|
+
it('should render properly with separators', () => {
|
|
22
|
+
const { container } = render(_jsx(Accordion, { defaultOpen: "1", showSeparators: true, children: _jsx(AccordionItem, { value: "1", summary: "Item 1", children: "Item 1" }) }));
|
|
23
|
+
expect(container).not.toBeNull();
|
|
24
|
+
});
|
|
25
|
+
it('should render properly w/o separators', () => {
|
|
26
|
+
const { container } = render(_jsx(Accordion, { defaultOpen: "1", children: _jsx(AccordionItem, { value: "1", summary: "Item 1", children: "Item 1" }) }));
|
|
27
|
+
expect(container).not.toBeNull();
|
|
28
|
+
});
|
|
29
|
+
it('should open properly', () => {
|
|
30
|
+
const { container, getByTestId, getByText } = render(_jsx(Accordion, { children: _jsx(AccordionItem, { value: "1", summary: "Item 1", children: "Inner Item" }) }));
|
|
31
|
+
fireEvent.click(getByTestId('Disclosure'));
|
|
32
|
+
expect(getByText(/Inner Item/i)).toBeDefined();
|
|
33
|
+
expect(container).not.toBeNull();
|
|
34
|
+
});
|
|
35
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aspect-ratio.test.d.ts","sourceRoot":"","sources":["../../../src/components/aspect-ratio/aspect-ratio.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 { AspectRatio } from './aspect-ratio';
|
|
19
|
+
describe('<AspectRatio>', () => {
|
|
20
|
+
test('it should render properly', () => {
|
|
21
|
+
const { container } = render(_jsx(AspectRatio, { ratio: "1", children: _jsx("div", { children: "Some content" }) }));
|
|
22
|
+
expect(container).not.toBeNull();
|
|
23
|
+
});
|
|
24
|
+
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"autocomplete-option.d.ts","sourceRoot":"","sources":["../../../src/components/autocomplete/autocomplete-option.tsx"],"names":[],"mappings":"AAgBA,OAAO,EACO,iBAAiB,EAC9B,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,OAAO,EAAQ,aAAa,EAAE,MAAM,cAAc,CAAC;AAEnD,oBAAY,uBAAuB,GAAG,iBAAiB,CAAC,cAAc,CAAC,GAAG,MAAM,CAChF,aAAa,EACb,SAAS,GAAG,WAAW,GAAG,aAAa,GAAG,SAAS,CAClD,GAAG;IACF;;;OAGG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACrD;;;OAGG;IACH,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAC7B,CAAA;AAED,eAAO,MAAM,kBAAkB,
|
|
1
|
+
{"version":3,"file":"autocomplete-option.d.ts","sourceRoot":"","sources":["../../../src/components/autocomplete/autocomplete-option.tsx"],"names":[],"mappings":"AAgBA,OAAO,EACO,iBAAiB,EAC9B,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,OAAO,EAAQ,aAAa,EAAE,MAAM,cAAc,CAAC;AAEnD,oBAAY,uBAAuB,GAAG,iBAAiB,CAAC,cAAc,CAAC,GAAG,MAAM,CAChF,aAAa,EACb,SAAS,GAAG,WAAW,GAAG,aAAa,GAAG,SAAS,CAClD,GAAG;IACF;;;OAGG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACrD;;;OAGG;IACH,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAC7B,CAAA;AAED,eAAO,MAAM,kBAAkB,qIA2B7B,CAAC"}
|
|
@@ -21,6 +21,6 @@ export const AutocompleteOption = forwardRef(({ children, value, onClick, ...oth
|
|
|
21
21
|
const handleClick = useCallback(() => {
|
|
22
22
|
onClick?.(value, contentRef?.current?.innerText);
|
|
23
23
|
}, [onClick, value]);
|
|
24
|
-
return (_jsx(Menu.Item, { value: value, ref: forwardedRef, role: "option", padding: false, onClick: handleClick, ...otherProps, children: _jsx("span", { ref: contentRef, children: children }) }));
|
|
24
|
+
return (_jsx(Menu.Item, { value: value, ref: forwardedRef, role: "option", padding: false, "data-testid": "AutocompleteOption", onClick: handleClick, ...otherProps, children: _jsx("span", { ref: contentRef, children: children }) }));
|
|
25
25
|
});
|
|
26
26
|
AutocompleteOption.displayName = 'Autocomplete.Option';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"autocomplete.d.ts","sourceRoot":"","sources":["../../../src/components/autocomplete/autocomplete.tsx"],"names":[],"mappings":"AAsBA,OAAO,EAC+B,yBAAyB,EAG7D,SAAS,EAEV,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"autocomplete.d.ts","sourceRoot":"","sources":["../../../src/components/autocomplete/autocomplete.tsx"],"names":[],"mappings":"AAsBA,OAAO,EAC+B,yBAAyB,EAG7D,SAAS,EAEV,MAAM,OAAO,CAAC;AAMf,OAAO,EACmC,cAAc,EACvD,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAiB,SAAS,EAAE,MAAM,SAAS,CAAC;AAEnD,OAAO,EAAsB,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAEpF,aAAK,SAAS,GAAG;IACf,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf,CAAA;AAED,oBAAY,iBAAiB,GAAG,cAAc,CAAC,cAAc,CAAC;IAC5D;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC;IACtC;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;IACnC;;;OAGG;IACH,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC,CAAC,CAAC;AAEJ,aAAK,qBAAqB,GAAG,yBAAyB,CAAC,iBAAiB,CAAC,GAAG;IAC1E,MAAM,EAAE,yBAAyB,CAAC,uBAAuB,CAAC,CAAC;CAC5D,CAAA;AAqBD,eAAO,MAAM,YAAY,uBAsKE,CAAC"}
|
|
@@ -17,10 +17,12 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
17
17
|
import { useDebounce, useFocusWithin, useKeyPress, useSize, } from 'ahooks';
|
|
18
18
|
import { AnimatePresence, domMax, LazyMotion, m, } from 'framer-motion';
|
|
19
19
|
import { Children, cloneElement, forwardRef, isValidElement, useCallback, useEffect, useMemo, useRef, useState, } from 'react';
|
|
20
|
+
import { createPortal } from 'react-dom';
|
|
20
21
|
import { mergeRefs } from 'react-merge-refs';
|
|
21
22
|
import { usePopperTooltip } from 'react-popper-tooltip';
|
|
22
23
|
import { useUIDSeed } from 'react-uid';
|
|
23
24
|
import { Menu, Skeleton, Stack, Text, Textfield, } from '../..';
|
|
25
|
+
import { usePopUpWrapper } from '../../hooks';
|
|
24
26
|
import * as styles from './autocomplete.module.css';
|
|
25
27
|
import { AutocompleteOption } from './autocomplete-option';
|
|
26
28
|
const AutocompleteAnimation = {
|
|
@@ -49,6 +51,7 @@ export const Autocomplete = forwardRef(({ children, onChange, disabled, readOnly
|
|
|
49
51
|
const [value, setValue] = useState(val ? String(val) : '');
|
|
50
52
|
const [optionsValues, setOptionValues] = useState([]);
|
|
51
53
|
const isInteractive = useMemo(() => !disabled && !readOnly, [disabled, readOnly]);
|
|
54
|
+
const { wrapper } = usePopUpWrapper('autocomplete-popup-root');
|
|
52
55
|
const debounceQuery = useDebounce(query, { wait: 100 });
|
|
53
56
|
const filteredOptions = useMemo(() => {
|
|
54
57
|
const items = Children.toArray(children);
|
|
@@ -72,7 +75,7 @@ export const Autocomplete = forwardRef(({ children, onChange, disabled, readOnly
|
|
|
72
75
|
});
|
|
73
76
|
useKeyPress('esc', () => setIsOpen(false));
|
|
74
77
|
const { getTooltipProps, setTooltipRef, setTriggerRef, triggerRef,
|
|
75
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
78
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention, @typescript-eslint/no-unused-vars
|
|
76
79
|
visible, } = usePopperTooltip({
|
|
77
80
|
delayShow: 0,
|
|
78
81
|
delayHide: 0,
|
|
@@ -104,11 +107,11 @@ export const Autocomplete = forwardRef(({ children, onChange, disabled, readOnly
|
|
|
104
107
|
setValue(String(val));
|
|
105
108
|
setOptionValues(currentValues);
|
|
106
109
|
}, [filteredOptions, val]);
|
|
107
|
-
return (_jsxs("div", { ref: autocompleteRef, className: styles.Autocomplete, "data-focus-within": isFocusWithin, children: [_jsx(Textfield, { ref: mergeRefs([setTriggerRef, forwardedRef]), id: seedID('autocomplete-trigger'), "aria-haspopup": "true", "aria-controls": seedID('autocomplete-menu'), "aria-expanded": isOpen, onChange: handleFilter, "data-current-value": value, value: query, autoComplete: "off", disabled: disabled, readOnly: readOnly, ...otherProps }, seedID('autocomplete-trigger')), _jsx(AnimatePresence, { children:
|
|
110
|
+
return (_jsxs("div", { ref: autocompleteRef, className: styles.Autocomplete, "data-focus-within": isFocusWithin, children: [_jsx(Textfield, { ref: mergeRefs([setTriggerRef, forwardedRef]), id: seedID('autocomplete-trigger'), "aria-haspopup": "true", "aria-controls": seedID('autocomplete-menu'), "aria-expanded": isOpen, onChange: handleFilter, "data-testid": "Autocomplete", "data-current-value": value, value: query, autoComplete: "off", disabled: disabled, readOnly: readOnly, ...otherProps }, seedID('autocomplete-trigger')), visible && createPortal(_jsx(AnimatePresence, { children: _jsx("div", { ref: setTooltipRef, ...getTooltipProps({ className: styles.PopUp, style: { minInlineSize: triggerSize ? (triggerSize.width + 2) : 'auto' } }), children: _jsx(LazyMotion, { features: domMax, strict: true, children: _jsx(m.div, { variants: AutocompleteAnimation, initial: "hidden", animate: "visible", exit: "hidden", children: _jsxs(Menu, { role: "listbox", id: seedID('autocomplete-menu'), className: styles.OptionsList, maxHeight: maxHeight, "aria-labelledby": seedID('autocomplete-trigger'), children: [(filteredOptions.length === 0 && !busy) && _jsx(Text, { as: "div", textAlign: "center", dimmed: 5, children: emptyContent }), busy
|
|
108
111
|
? _jsx(Stack, { hPadding: 8, as: "span", children: _jsx(Skeleton, { count: 3 }) })
|
|
109
112
|
: Children.map(filteredOptions, child => isValidElement(child) && cloneElement(child, {
|
|
110
113
|
onClick: handleOptionClick,
|
|
111
|
-
}))] }) }) }) })
|
|
114
|
+
}))] }) }) }) }) }), wrapper)] }));
|
|
112
115
|
});
|
|
113
116
|
Autocomplete.Option = AutocompleteOption;
|
|
114
117
|
Autocomplete.displayName = 'Autocomplete';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"autocomplete.test.d.ts","sourceRoot":"","sources":["../../../src/components/autocomplete/autocomplete.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,42 @@
|
|
|
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, waitFor } from '@testing-library/react';
|
|
18
|
+
import { Autocomplete } from './autocomplete';
|
|
19
|
+
describe('<Autocomplete>', () => {
|
|
20
|
+
test(' it should render properly', () => {
|
|
21
|
+
const { container } = render(_jsx(Autocomplete, {}));
|
|
22
|
+
expect(container).not.toBeNull();
|
|
23
|
+
});
|
|
24
|
+
test(' it should change properly', async () => {
|
|
25
|
+
const { container, getByTestId } = render(_jsxs(Autocomplete, { children: [_jsx(Autocomplete.Option, { value: "1", children: "Option 1" }), _jsx(Autocomplete.Option, { value: "2", children: "Option 2" }), _jsx(Autocomplete.Option, { value: "3", children: "Option 3" })] }));
|
|
26
|
+
const el = getByTestId('Autocomplete');
|
|
27
|
+
fireEvent.focus(el);
|
|
28
|
+
fireEvent.change(el, { target: { value: 'Option 3' } });
|
|
29
|
+
fireEvent.blur(el);
|
|
30
|
+
expect(container).not.toBeNull();
|
|
31
|
+
});
|
|
32
|
+
test(' it should render properly with props', async () => {
|
|
33
|
+
const { container, getByTestId } = render(_jsx(Autocomplete, { children: _jsx(Autocomplete.Option, { value: "1", children: "Option 1" }) }));
|
|
34
|
+
const el = getByTestId('Autocomplete');
|
|
35
|
+
fireEvent.focus(el);
|
|
36
|
+
await waitFor(() => expect(getByTestId('AutocompleteOption')).toBeDefined());
|
|
37
|
+
const elOpt = getByTestId('AutocompleteOption');
|
|
38
|
+
fireEvent.click(elOpt);
|
|
39
|
+
fireEvent.keyPress(el, { key: 'esc' });
|
|
40
|
+
expect(container).not.toBeNull();
|
|
41
|
+
});
|
|
42
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"avatar.test.d.ts","sourceRoot":"","sources":["../../../src/components/avatar/avatar.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 { Avatar } from './avatar';
|
|
19
|
+
describe('<Avatar>', () => {
|
|
20
|
+
test('should render properly', () => {
|
|
21
|
+
const { container } = render(_jsx(Avatar, { src: "https://api.lorem.space/image/face?w=150&h=150", dimension: "small" }));
|
|
22
|
+
expect(container).not.toBeNull();
|
|
23
|
+
});
|
|
24
|
+
test('should render properly - w/o dimension', () => {
|
|
25
|
+
const { container } = render(_jsx(Avatar, { src: "https://api.lorem.space/image/face?w=150&h=150" }));
|
|
26
|
+
expect(container).not.toBeNull();
|
|
27
|
+
});
|
|
28
|
+
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../src/components/button/button.tsx"],"names":[],"mappings":"AAiBA,OAAO,EAC+C,UAAU,EAC/D,MAAM,OAAO,CAAC;AAEf,OAAO,EACL,WAAW,EACH,WAAW,EACpB,MAAM,cAAc,CAAC;AAItB,oBAAY,WAAW,GAAG;IACxB;;;OAGG;IACH,IAAI,CAAC,EAAE,SAAS,GAAG,WAAW,GAAG,MAAM,CAAC;IACxC;;OAEG;IACH,SAAS,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,KAAK,CAAC;IACxC;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC;IAC7B;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAChC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,IAAI,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,QAAQ,CAAC;IACrC;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,iBAAiB,GAAG,iBAAiB,CAAC,KAAK,IAAI,CAAC;CAC9E,CAAA;AAED,aAAK,iBAAiB,GAAG,WAAW,CAAC,mBAAmB,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;AAEhF,eAAO,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../src/components/button/button.tsx"],"names":[],"mappings":"AAiBA,OAAO,EAC+C,UAAU,EAC/D,MAAM,OAAO,CAAC;AAEf,OAAO,EACL,WAAW,EACH,WAAW,EACpB,MAAM,cAAc,CAAC;AAItB,oBAAY,WAAW,GAAG;IACxB;;;OAGG;IACH,IAAI,CAAC,EAAE,SAAS,GAAG,WAAW,GAAG,MAAM,CAAC;IACxC;;OAEG;IACH,SAAS,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,KAAK,CAAC;IACxC;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC;IAC7B;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAChC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,IAAI,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,QAAQ,CAAC;IACrC;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,iBAAiB,GAAG,iBAAiB,CAAC,KAAK,IAAI,CAAC;CAC9E,CAAA;AAED,aAAK,iBAAiB,GAAG,WAAW,CAAC,mBAAmB,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;AAEhF,eAAO,MAAM,MAAM,mBAkEI,CAAC;AAExB,oBAAY,iBAAiB,GAAG,cAAc,GAAG,IAAI,CAAC,WAAW,EAAE,WAAW,GAAG,MAAM,CAAC,CAAA;AAExF,eAAO,MAAM,YAAY,EAAE,UAAU,CAAC,iBAAiB,CAetD,CAAC"}
|
|
@@ -30,7 +30,7 @@ export const Button = forwardRef(({ kind = 'primary', dimension = 'regular', cla
|
|
|
30
30
|
regular: 16,
|
|
31
31
|
small: 12,
|
|
32
32
|
};
|
|
33
|
-
return (_jsxs(Wrapper, { ref: forwardedRef, type: Wrapper === 'button' ? type : undefined, className: clsx(styles.Button, className), "data-button-icon-position": iconPosition, "data-button-dimension": dimension, "data-button-kind": kind, "data-button-fullwidth": fullWidth, "aria-disabled": disabled, "aria-busy": busy, "aria-pressed": pressed, "aria-live": busy ? 'polite' : undefined, onClick: handleClick(), ...otherProps, children: [icon && (_jsx(Symbol, { source: icon, fill: iconColor, weight: "solid", dimension: iconSize[dimension] })), (children && busy) ? _jsx("span", { children: children }) : children, busy && (_jsx("span", { className: styles.SpinnerIndicator, children: _jsx(Spinner, { dimension: dimension }) }))] }));
|
|
33
|
+
return (_jsxs(Wrapper, { ref: forwardedRef, type: Wrapper === 'button' ? type : undefined, className: clsx(styles.Button, className), "data-testid": "Button", "data-button-icon-position": iconPosition, "data-button-dimension": dimension, "data-button-kind": kind, "data-button-fullwidth": fullWidth, "aria-disabled": disabled, "aria-busy": busy, "aria-pressed": pressed, "aria-live": busy ? 'polite' : undefined, onClick: handleClick(), ...otherProps, children: [icon && (_jsx(Symbol, { source: icon, fill: iconColor, weight: "solid", dimension: iconSize[dimension] })), (children && busy) ? _jsx("span", { children: children }) : children, busy && (_jsx("span", { className: styles.SpinnerIndicator, children: _jsx(Spinner, { dimension: dimension }) }))] }));
|
|
34
34
|
});
|
|
35
35
|
export const ButtonsGroup = ({ children, className, kind, dimension = 'regular', }) => (_jsx("div", { className: clsx(styles.ButtonsGroup, className), children: Children.map(children, child => isValidElement(child) && cloneElement(child, {
|
|
36
36
|
kind,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button.test.d.ts","sourceRoot":"","sources":["../../../src/components/button/button.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,56 @@
|
|
|
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 { Button, ButtonsGroup } from './button';
|
|
19
|
+
describe('<Button>', () => {
|
|
20
|
+
test('it should render properly', () => {
|
|
21
|
+
const { container } = render(_jsx(Button, { children: "Click me" }));
|
|
22
|
+
expect(container).not.toBeNull();
|
|
23
|
+
});
|
|
24
|
+
test('it should render properly as different type', () => {
|
|
25
|
+
const { container } = render(_jsx(Button, { as: "a", children: "Click me" }));
|
|
26
|
+
expect(container).not.toBeNull();
|
|
27
|
+
});
|
|
28
|
+
test('it should render properly as busy', () => {
|
|
29
|
+
const { container } = render(_jsx(Button, { busy: true, children: "Click me" }));
|
|
30
|
+
expect(container).not.toBeNull();
|
|
31
|
+
});
|
|
32
|
+
test('it should render properly with icon', () => {
|
|
33
|
+
const { container } = render(_jsx(Button, { icon: "bell", children: "Click me" }));
|
|
34
|
+
expect(container).not.toBeNull();
|
|
35
|
+
});
|
|
36
|
+
test('it should render properly with dimension', () => {
|
|
37
|
+
const { container } = render(_jsx(Button, { dimension: "big", children: "Click me" }));
|
|
38
|
+
expect(container).not.toBeNull();
|
|
39
|
+
});
|
|
40
|
+
test('it should click properly', () => {
|
|
41
|
+
const { container, getByTestId } = render(_jsx(Button, { children: "Click me" }));
|
|
42
|
+
fireEvent.click(getByTestId('Button'));
|
|
43
|
+
expect(container).not.toBeNull();
|
|
44
|
+
});
|
|
45
|
+
test('it should not click while disabled', () => {
|
|
46
|
+
const { container, getByTestId } = render(_jsx(Button, { disabled: true, children: "Click me" }));
|
|
47
|
+
fireEvent.click(getByTestId('Button'));
|
|
48
|
+
expect(container).not.toBeNull();
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
describe('<Buttons Group>', () => {
|
|
52
|
+
test('it should render properly', () => {
|
|
53
|
+
const { container } = render(_jsxs(ButtonsGroup, { children: [_jsx(Button, { pressed: true, children: "Pressed" }), _jsx(Button, { children: "Click" }), _jsx(Button, { disabled: true, children: "Disabled" })] }));
|
|
54
|
+
expect(container).not.toBeNull();
|
|
55
|
+
});
|
|
56
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"card.test.d.ts","sourceRoot":"","sources":["../../../src/components/card/card.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 { render } from '@testing-library/react';
|
|
18
|
+
import { Symbol } from '../symbol';
|
|
19
|
+
import { Card } from './card';
|
|
20
|
+
describe('<Card>', () => {
|
|
21
|
+
test('it should render properly', () => {
|
|
22
|
+
const { container } = render(_jsx(Card, {}));
|
|
23
|
+
expect(container).not.toBeNull();
|
|
24
|
+
});
|
|
25
|
+
test('it should render properly with props', () => {
|
|
26
|
+
const { container } = render(_jsx(Card, { bordered: true, vibrant: true, highlightOnHover: true }));
|
|
27
|
+
expect(container).not.toBeNull();
|
|
28
|
+
});
|
|
29
|
+
test('it should render properly with left element', () => {
|
|
30
|
+
const { container } = render(_jsx(Card, { left: _jsx(Symbol, { source: "bell", dimension: "32" }) }));
|
|
31
|
+
expect(container).not.toBeNull();
|
|
32
|
+
});
|
|
33
|
+
test('it should render properly with right element', () => {
|
|
34
|
+
const { container } = render(_jsx(Card, { right: _jsx(Symbol, { source: "bell", dimension: "32" }) }));
|
|
35
|
+
expect(container).not.toBeNull();
|
|
36
|
+
});
|
|
37
|
+
test('it should render properly with child element', () => {
|
|
38
|
+
const { container } = render(_jsx(Card, { children: "Some content here" }));
|
|
39
|
+
expect(container).not.toBeNull();
|
|
40
|
+
});
|
|
41
|
+
});
|
|
@@ -18,6 +18,6 @@ export const Chip = forwardRef(({ children, className, dimension = 'regular', co
|
|
|
18
18
|
style: 'solid',
|
|
19
19
|
},
|
|
20
20
|
};
|
|
21
|
-
return (_jsxs(Stack, { as: "span", direction: "row", columnGap: 8, inline: true, "data-chip-color": color, "data-chip-dimension": dimension, className: clsx(styles.Chip, className), vAlign: "center", ref: forwardedRef, ...otherProps, children: [(icon && !interactive) && (_jsx(Symbol, { source: icon, weight: properties[dimension].style, dimension: properties[dimension].iconSize })), _jsx("b", { children: children }), interactive && (_jsx("button", { onClick: interactive && onDismissClick, className: styles.Action, type: "button", children: _jsx(Symbol, { source: "xmark", weight: properties[dimension].style, dimension: properties[dimension].iconSize }) }))] }));
|
|
21
|
+
return (_jsxs(Stack, { as: "span", direction: "row", columnGap: 8, inline: true, "data-chip-color": color, "data-chip-dimension": dimension, className: clsx(styles.Chip, className), vAlign: "center", ref: forwardedRef, ...otherProps, children: [(icon && !interactive) && (_jsx(Symbol, { source: icon, weight: properties[dimension].style, dimension: properties[dimension].iconSize })), _jsx("b", { children: children }), interactive && (_jsx("button", { "data-testid": "InteractiveButton", onClick: interactive && onDismissClick, className: styles.Action, type: "button", children: _jsx(Symbol, { source: "xmark", weight: properties[dimension].style, dimension: properties[dimension].iconSize }) }))] }));
|
|
22
22
|
});
|
|
23
23
|
Chip.displayName = 'Chip';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chip.test.d.ts","sourceRoot":"","sources":["../../../src/components/chip/chip.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 { Chip } from './chip';
|
|
19
|
+
describe('<Chip>', () => {
|
|
20
|
+
test(' it should render properly', () => {
|
|
21
|
+
const { container } = render(_jsx(Chip, { icon: "bell", children: "Text" }));
|
|
22
|
+
expect(container).not.toBeNull();
|
|
23
|
+
});
|
|
24
|
+
test(' it should dismiss properly', () => {
|
|
25
|
+
const { container, getByTestId } = render(_jsx(Chip, { interactive: true, children: "Text" }));
|
|
26
|
+
fireEvent.click(getByTestId('InteractiveButton'));
|
|
27
|
+
expect(container).not.toBeNull();
|
|
28
|
+
});
|
|
29
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"circular-progress.test.d.ts","sourceRoot":"","sources":["../../../src/components/circular-progress/circular-progress.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 { CircularProgress } from './circular-progress';
|
|
19
|
+
describe('<CircularProgress>', () => {
|
|
20
|
+
test(' it should render properly', () => {
|
|
21
|
+
const { container } = render(_jsx(CircularProgress, { value: 50 }));
|
|
22
|
+
expect(container).not.toBeNull();
|
|
23
|
+
});
|
|
24
|
+
test(' it should render properly with value 0', () => {
|
|
25
|
+
const { container } = render(_jsx(CircularProgress, { value: 0 }));
|
|
26
|
+
expect(container).not.toBeNull();
|
|
27
|
+
});
|
|
28
|
+
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clamp-text.d.ts","sourceRoot":"","sources":["../../../src/components/clamp-text/clamp-text.tsx"],"names":[],"mappings":"AAiBA,OAAO,EACsB,SAAS,EACrC,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,WAAW,EAAyB,MAAM,cAAc,CAAC;AAIlE,oBAAY,cAAc,GAAG;IAC3B;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAA;AAED,aAAK,oBAAoB,GAAG,WAAW,CAAC,mBAAmB,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC;AAEnF,eAAO,MAAM,SAAS,
|
|
1
|
+
{"version":3,"file":"clamp-text.d.ts","sourceRoot":"","sources":["../../../src/components/clamp-text/clamp-text.tsx"],"names":[],"mappings":"AAiBA,OAAO,EACsB,SAAS,EACrC,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,WAAW,EAAyB,MAAM,cAAc,CAAC;AAIlE,oBAAY,cAAc,GAAG;IAC3B;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAA;AAED,aAAK,oBAAoB,GAAG,WAAW,CAAC,mBAAmB,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC;AAEnF,eAAO,MAAM,SAAS,sBAgDI,CAAC"}
|
|
@@ -24,5 +24,5 @@ export const ClampText = forwardRef(({ className, children, rows = 1, style, exp
|
|
|
24
24
|
'--r': rows,
|
|
25
25
|
'--padding': expandable && '2rem',
|
|
26
26
|
};
|
|
27
|
-
return (_jsxs(Wrapper, { ref: forwardedRef, className: clsx(styles.ClampText, className), ...otherProps, children: [_jsx("span", { className: styles.Content, "data-clamp-text-expanded": isExpanded, style: { ...dynamicStyle, ...style }, children: children }), expandable && (_jsx(Tooltip, { trigger: (_jsx(ToggleButton, { className: styles.Trigger, pressed: isExpanded, onClick: () => setIsExpandend(state => !state), restingIcon: "plus", pressedIcon: "minus", dimension: "small", kind: "secondary" })), children: `${isExpanded ? 'Collapse' : 'Expand'} text` }))] }));
|
|
27
|
+
return (_jsxs(Wrapper, { ref: forwardedRef, className: clsx(styles.ClampText, className), ...otherProps, children: [_jsx("span", { className: styles.Content, "data-clamp-text-expanded": isExpanded, style: { ...dynamicStyle, ...style }, children: children }), expandable && (_jsx(Tooltip, { trigger: (_jsx(ToggleButton, { "data-testid": "ExpandableButton", className: styles.Trigger, pressed: isExpanded, onClick: () => setIsExpandend(state => !state), restingIcon: "plus", pressedIcon: "minus", dimension: "small", kind: "secondary" })), children: `${isExpanded ? 'Collapse' : 'Expand'} text` }))] }));
|
|
28
28
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clamp-text.test.d.ts","sourceRoot":"","sources":["../../../src/components/clamp-text/clamp-text.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
|
+
/* eslint-disable max-len */
|
|
18
|
+
import { fireEvent, render } from '@testing-library/react';
|
|
19
|
+
import { ClampText } from './clamp-text';
|
|
20
|
+
const innerText = 'Lorem, ipsum dolor sit amet consectetur adipisicing elit. Tenetur fugit odit neque mollitia voluptate? Natus quibusdam dicta minus! Officiis velit ex facere, repudiandae cum maiores excepturi porro recusandae necessitatibus voluptatum veniam, unde voluptates fugiat labore voluptas eius tempore, facilis animi ut ipsum quo? Placeat, atque fuga pariatur hic obcaecati, nam accusamus dolor natus nostrum odit rerum iusto suscipit ducimus nobis eos? Voluptas accusamus repellat sit deleniti adipisci eum dolorem repudiandae mollitia, obcaecati rem eius vitae sint expedita cum rerum quos voluptatibus fugit ipsa impedit aliquid voluptates officia. Veniam, beatae laboriosam at quia error harum, adipisci commodi exercitationem cumque repellat doloribus cum aut tenetur animi recusandae. Neque reiciendis dolores, fugiat unde delectus incidunt dolorum temporibus rerum repellendus nemo iusto expedita placeat!';
|
|
21
|
+
describe('<ClampText>', () => {
|
|
22
|
+
test(' it should render properly', () => {
|
|
23
|
+
const { container } = render(_jsx(ClampText, { rows: 3, children: innerText }));
|
|
24
|
+
expect(container).not.toBeNull();
|
|
25
|
+
});
|
|
26
|
+
test(' it should render properly w/o # of rows', () => {
|
|
27
|
+
const { container } = render(_jsx(ClampText, { children: innerText }));
|
|
28
|
+
expect(container).not.toBeNull();
|
|
29
|
+
});
|
|
30
|
+
test(' it should expand properly', () => {
|
|
31
|
+
const { container, getByTestId } = render(_jsx(ClampText, { expandable: true, rows: 1, children: innerText }));
|
|
32
|
+
const btn = getByTestId('ExpandableButton');
|
|
33
|
+
expect(btn).toBeDefined();
|
|
34
|
+
fireEvent.click(btn);
|
|
35
|
+
expect(container).not.toBeNull();
|
|
36
|
+
});
|
|
37
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"container.test.d.ts","sourceRoot":"","sources":["../../../src/components/container/container.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 { Container } from './container';
|
|
19
|
+
describe('<Container>', () => {
|
|
20
|
+
test(' it should render properly', () => {
|
|
21
|
+
const { container } = render(_jsx(Container, { children: "Content" }));
|
|
22
|
+
expect(container).not.toBeNull();
|
|
23
|
+
});
|
|
24
|
+
test(' it should render properly with props', () => {
|
|
25
|
+
const { container } = render(_jsx(Container, { dimension: "medium", padding: true, children: "Content" }));
|
|
26
|
+
expect(container).not.toBeNull();
|
|
27
|
+
});
|
|
28
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"datetime.test.d.ts","sourceRoot":"","sources":["../../../src/components/datetime/datetime.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 { render } from '@testing-library/react';
|
|
18
|
+
import { Datetime } from './datetime';
|
|
19
|
+
describe('<DateTime>', () => {
|
|
20
|
+
test(' it should render properly', () => {
|
|
21
|
+
const dt = '2021-12-15T16:00:32.507981+00:00';
|
|
22
|
+
const edt = 'December 15, 2021';
|
|
23
|
+
const { container, getByText } = render(_jsx(Datetime, { date: dt }));
|
|
24
|
+
expect(getByText(edt)).toBeDefined();
|
|
25
|
+
expect(container).not.toBeNull();
|
|
26
|
+
});
|
|
27
|
+
test(' it should render properly with local ""it-IT', () => {
|
|
28
|
+
const dt = '2021-12-15T16:00:32.507981+00:00';
|
|
29
|
+
const edt = '15 dicembre 2021';
|
|
30
|
+
const { container, getByText } = render(_jsx(Datetime, { date: dt, locale: "it-IT" }));
|
|
31
|
+
expect(getByText(edt)).toBeDefined();
|
|
32
|
+
expect(container).not.toBeNull();
|
|
33
|
+
});
|
|
34
|
+
test(' it should render properly with local ""it-IT and options', () => {
|
|
35
|
+
const dt = '2021-12-15T16:00:32.507981+00:00';
|
|
36
|
+
const edt = '15 dicembre 21';
|
|
37
|
+
const { container, getByText } = render(_jsx(Datetime, { date: dt, locale: "it-IT", options: { year: '2-digit' } }));
|
|
38
|
+
expect(getByText(edt)).toBeDefined();
|
|
39
|
+
expect(container).not.toBeNull();
|
|
40
|
+
});
|
|
41
|
+
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"disclosure.d.ts","sourceRoot":"","sources":["../../../src/components/disclosure/disclosure.tsx"],"names":[],"mappings":"AAoBA,OAAO,EAEL,qBAAqB,EACrB,SAAS,EACV,MAAM,OAAO,CAAC;AASf,oBAAY,eAAe,GAAG,qBAAqB,CAAC,kBAAkB,CAAC,GAAG;IACxE;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;;OAGG;IACH,OAAO,EAAE,SAAS,CAAC;IACnB;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,KAAK,CAAC;IACxC;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAChC;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAA;AAED,eAAO,MAAM,UAAU;IAnCrB;;OAEG;;IAEH;;;OAGG;aACM,SAAS;IAClB;;;;OAIG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;;OAGG;;IAEH;;;OAGG;;
|
|
1
|
+
{"version":3,"file":"disclosure.d.ts","sourceRoot":"","sources":["../../../src/components/disclosure/disclosure.tsx"],"names":[],"mappings":"AAoBA,OAAO,EAEL,qBAAqB,EACrB,SAAS,EACV,MAAM,OAAO,CAAC;AASf,oBAAY,eAAe,GAAG,qBAAqB,CAAC,kBAAkB,CAAC,GAAG;IACxE;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;;OAGG;IACH,OAAO,EAAE,SAAS,CAAC;IACnB;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,KAAK,CAAC;IACxC;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAChC;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAA;AAED,eAAO,MAAM,UAAU;IAnCrB;;OAEG;;IAEH;;;OAGG;aACM,SAAS;IAClB;;;;OAIG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;;OAGG;;IAEH;;;OAGG;;sDAuGH,CAAC"}
|