@chayns-components/core 5.6.3 → 5.6.5
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/AGENTS.md +2 -0
- package/lib/cjs/components/accordion/Accordion.js +16 -1
- package/lib/cjs/components/accordion/Accordion.js.map +1 -1
- package/lib/cjs/components/accordion/Accordion.test.js +213 -0
- package/lib/cjs/components/accordion/Accordion.test.js.map +1 -0
- package/lib/cjs/components/sharing-bar/SharingBar.js +2 -0
- package/lib/cjs/components/sharing-bar/SharingBar.js.map +1 -1
- package/lib/cjs/components/sharing-button/SharingButton.js +2 -0
- package/lib/cjs/components/sharing-button/SharingButton.js.map +1 -1
- package/lib/cjs/components/sharing-context-menu/SharingContextMenu.js +73 -22
- package/lib/cjs/components/sharing-context-menu/SharingContextMenu.js.map +1 -1
- package/lib/cjs/components/sharing-context-menu/SharingContextMenu.test.js +106 -2
- package/lib/cjs/components/sharing-context-menu/SharingContextMenu.test.js.map +1 -1
- package/lib/esm/components/accordion/Accordion.js +16 -1
- package/lib/esm/components/accordion/Accordion.js.map +1 -1
- package/lib/esm/components/accordion/Accordion.test.js +209 -0
- package/lib/esm/components/accordion/Accordion.test.js.map +1 -0
- package/lib/esm/components/sharing-bar/SharingBar.js +2 -0
- package/lib/esm/components/sharing-bar/SharingBar.js.map +1 -1
- package/lib/esm/components/sharing-button/SharingButton.js +2 -0
- package/lib/esm/components/sharing-button/SharingButton.js.map +1 -1
- package/lib/esm/components/sharing-context-menu/SharingContextMenu.js +75 -24
- package/lib/esm/components/sharing-context-menu/SharingContextMenu.js.map +1 -1
- package/lib/esm/components/sharing-context-menu/SharingContextMenu.test.js +108 -4
- package/lib/esm/components/sharing-context-menu/SharingContextMenu.test.js.map +1 -1
- package/lib/types/components/sharing-bar/SharingBar.d.ts +4 -0
- package/lib/types/components/sharing-button/SharingButton.d.ts +1 -1
- package/lib/types/components/sharing-context-menu/SharingContextMenu.d.ts +8 -0
- package/package.json +2 -2
|
@@ -1,11 +1,29 @@
|
|
|
1
|
-
import { render } from '@testing-library/react';
|
|
1
|
+
import { fireEvent, render } from '@testing-library/react';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { describe, expect, it, vi } from 'vitest';
|
|
3
|
+
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
|
4
4
|
import SharingContextMenu from './SharingContextMenu';
|
|
5
|
+
const {
|
|
6
|
+
invokeCall,
|
|
7
|
+
isApp,
|
|
8
|
+
shareWithApp,
|
|
9
|
+
shareWithUrl
|
|
10
|
+
} = vi.hoisted(() => ({
|
|
11
|
+
invokeCall: vi.fn(),
|
|
12
|
+
isApp: vi.fn(() => false),
|
|
13
|
+
shareWithApp: vi.fn(),
|
|
14
|
+
shareWithUrl: vi.fn()
|
|
15
|
+
}));
|
|
5
16
|
vi.mock('chayns-api', () => ({
|
|
6
17
|
getSite: () => ({
|
|
7
18
|
color: '#000000'
|
|
8
|
-
})
|
|
19
|
+
}),
|
|
20
|
+
invokeCall,
|
|
21
|
+
isApp
|
|
22
|
+
}));
|
|
23
|
+
vi.mock('../../utils/sharingBar', () => ({
|
|
24
|
+
copyToClipboard: vi.fn(),
|
|
25
|
+
shareWithApp,
|
|
26
|
+
shareWithUrl
|
|
9
27
|
}));
|
|
10
28
|
vi.mock('../../utils/environment', () => ({
|
|
11
29
|
useIsTouch: () => false
|
|
@@ -16,9 +34,95 @@ vi.mock('../context-menu/ContextMenu', () => ({
|
|
|
16
34
|
items
|
|
17
35
|
}) => /*#__PURE__*/React.createElement("div", {
|
|
18
36
|
"data-item-keys": items.map(item => item.key).join(',')
|
|
19
|
-
},
|
|
37
|
+
}, items.map(item => /*#__PURE__*/React.createElement("button", {
|
|
38
|
+
key: item.key,
|
|
39
|
+
type: "button",
|
|
40
|
+
onClick: item.onClick
|
|
41
|
+
}, item.key)), children)
|
|
20
42
|
}));
|
|
21
43
|
describe('SharingContextMenu', () => {
|
|
44
|
+
beforeEach(() => {
|
|
45
|
+
vi.clearAllMocks();
|
|
46
|
+
isApp.mockReturnValue(false);
|
|
47
|
+
});
|
|
48
|
+
it('uses the native share call in the app', () => {
|
|
49
|
+
isApp.mockReturnValue(true);
|
|
50
|
+
const {
|
|
51
|
+
getByRole
|
|
52
|
+
} = render(/*#__PURE__*/React.createElement(SharingContextMenu, {
|
|
53
|
+
link: "https://example.com",
|
|
54
|
+
text: "Check this out"
|
|
55
|
+
}, /*#__PURE__*/React.createElement("button", {
|
|
56
|
+
type: "button"
|
|
57
|
+
}, "Share")));
|
|
58
|
+
fireEvent.click(getByRole('button', {
|
|
59
|
+
name: 'whatsapp'
|
|
60
|
+
}));
|
|
61
|
+
fireEvent.click(getByRole('button', {
|
|
62
|
+
name: 'facebook'
|
|
63
|
+
}));
|
|
64
|
+
fireEvent.click(getByRole('button', {
|
|
65
|
+
name: 'twitter'
|
|
66
|
+
}));
|
|
67
|
+
fireEvent.click(getByRole('button', {
|
|
68
|
+
name: 'mail'
|
|
69
|
+
}));
|
|
70
|
+
expect(invokeCall).toHaveBeenNthCalledWith(1, {
|
|
71
|
+
action: 80,
|
|
72
|
+
value: {
|
|
73
|
+
text: 'Check this out\n\nhttps://example.com',
|
|
74
|
+
sharingApp: 1,
|
|
75
|
+
sharingAndroidApp: 'com.whatsapp'
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
expect(invokeCall).toHaveBeenNthCalledWith(2, {
|
|
79
|
+
action: 80,
|
|
80
|
+
value: {
|
|
81
|
+
text: 'https://example.com',
|
|
82
|
+
sharingApp: 2,
|
|
83
|
+
sharingAndroidApp: 'com.facebook.katana'
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
expect(invokeCall).toHaveBeenNthCalledWith(3, {
|
|
87
|
+
action: 80,
|
|
88
|
+
value: {
|
|
89
|
+
text: 'Check this out\n\nhttps://example.com',
|
|
90
|
+
sharingApp: 5
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
expect(invokeCall).toHaveBeenNthCalledWith(4, {
|
|
94
|
+
action: 80,
|
|
95
|
+
value: {
|
|
96
|
+
text: 'Check this out\n\nhttps://example.com',
|
|
97
|
+
sharingApp: 0
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
expect(shareWithApp).not.toHaveBeenCalled();
|
|
101
|
+
expect(shareWithUrl).not.toHaveBeenCalled();
|
|
102
|
+
});
|
|
103
|
+
it('shares the optional text via WhatsApp, mail, and X only', () => {
|
|
104
|
+
const {
|
|
105
|
+
getByRole
|
|
106
|
+
} = render(/*#__PURE__*/React.createElement(SharingContextMenu, {
|
|
107
|
+
link: "https://example.com",
|
|
108
|
+
text: "Check this out"
|
|
109
|
+
}, /*#__PURE__*/React.createElement("button", {
|
|
110
|
+
type: "button"
|
|
111
|
+
}, "Share")));
|
|
112
|
+
fireEvent.click(getByRole('button', {
|
|
113
|
+
name: 'whatsapp'
|
|
114
|
+
}));
|
|
115
|
+
fireEvent.click(getByRole('button', {
|
|
116
|
+
name: 'mail'
|
|
117
|
+
}));
|
|
118
|
+
fireEvent.click(getByRole('button', {
|
|
119
|
+
name: 'twitter'
|
|
120
|
+
}));
|
|
121
|
+
expect(shareWithUrl).toHaveBeenNthCalledWith(1, 'https://api.whatsapp.com/send?text=Check%20this%20out%0A%0Ahttps%3A%2F%2Fexample.com');
|
|
122
|
+
expect(shareWithUrl).toHaveBeenNthCalledWith(2, 'mailto:?body=Check%20this%20out%0A%0Ahttps%3A%2F%2Fexample.com');
|
|
123
|
+
expect(shareWithUrl).toHaveBeenNthCalledWith(3, 'http://twitter.com/intent/tweet?text=Check%20this%20out&url=https%3A%2F%2Fexample.com&hashtags=chayns');
|
|
124
|
+
expect(shareWithApp).not.toHaveBeenCalled();
|
|
125
|
+
});
|
|
22
126
|
it('keeps copy and calling-code actions enabled by default', () => {
|
|
23
127
|
const {
|
|
24
128
|
container
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SharingContextMenu.test.js","names":["render","React","describe","expect","it","vi","SharingContextMenu","mock","getSite","color","useIsTouch","default","children","items","createElement","map","item","key","join","container","link","type","firstChild","getAttribute","toBe","shouldShowCallingCodeAction","shouldShowCopyAction"],"sources":["../../../../src/components/sharing-context-menu/SharingContextMenu.test.tsx"],"sourcesContent":["import { render } from '@testing-library/react';\nimport React, { ReactNode } from 'react';\nimport { describe, expect, it, vi } from 'vitest';\nimport SharingContextMenu from './SharingContextMenu';\n\nvi.mock('chayns-api', () => ({\n getSite: () => ({ color: '#000000' }),\n}));\n\nvi.mock('../../utils/environment', () => ({\n useIsTouch: () => false,\n}));\n\nvi.mock('../context-menu/ContextMenu', () => ({\n default: ({ children, items }: { children: ReactNode; items: Array<{ key: string }> }) => (\n <div data-item-keys={items.map((item) => item.key).join(',')}>{children}</div>\n ),\n}));\n\ndescribe('SharingContextMenu', () => {\n it('keeps copy and calling-code actions enabled by default', () => {\n const { container } = render(\n <SharingContextMenu link=\"https://example.com\">\n <button type=\"button\">Share</button>\n </SharingContextMenu>,\n );\n\n expect((container.firstChild as HTMLElement).getAttribute('data-item-keys')).toBe(\n 'copy,whatsapp,facebook,twitter,mail,callingCode',\n );\n });\n\n it('can hide copy and calling-code actions for dedicated content actions', () => {\n const { container } = render(\n <SharingContextMenu\n link=\"https://example.com\"\n shouldShowCallingCodeAction={false}\n shouldShowCopyAction={false}\n >\n <button type=\"button\">Share</button>\n </SharingContextMenu>,\n );\n\n expect((container.firstChild as HTMLElement).getAttribute('data-item-keys')).toBe(\n 'whatsapp,facebook,twitter,mail',\n );\n });\n});\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,wBAAwB;AAC/C,OAAOC,KAAK,MAAqB,OAAO;AACxC,SAASC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,EAAEC,EAAE,QAAQ,QAAQ;AACjD,OAAOC,kBAAkB,MAAM,sBAAsB;AAErDD,EAAE,CAACE,IAAI,CAAC,YAAY,EAAE,OAAO;EACzBC,OAAO,EAAEA,CAAA,MAAO;IAAEC,KAAK,EAAE;EAAU,CAAC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E,gCACJ,CAAC;EACL,CAAC,CAAC;AACN,CAAC,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"SharingContextMenu.test.js","names":["fireEvent","render","React","beforeEach","describe","expect","it","vi","SharingContextMenu","invokeCall","isApp","shareWithApp","shareWithUrl","hoisted","fn","mock","getSite","color","copyToClipboard","useIsTouch","default","children","items","createElement","map","item","key","join","type","onClick","clearAllMocks","mockReturnValue","getByRole","link","text","click","name","toHaveBeenNthCalledWith","action","value","sharingApp","sharingAndroidApp","not","toHaveBeenCalled","container","firstChild","getAttribute","toBe","shouldShowCallingCodeAction","shouldShowCopyAction"],"sources":["../../../../src/components/sharing-context-menu/SharingContextMenu.test.tsx"],"sourcesContent":["import { fireEvent, render } from '@testing-library/react';\nimport React, { ReactNode } from 'react';\nimport { beforeEach, describe, expect, it, vi } from 'vitest';\nimport SharingContextMenu from './SharingContextMenu';\n\nconst { invokeCall, isApp, shareWithApp, shareWithUrl } = vi.hoisted(() => ({\n invokeCall: vi.fn(),\n isApp: vi.fn(() => false),\n shareWithApp: vi.fn(),\n shareWithUrl: vi.fn(),\n}));\n\nvi.mock('chayns-api', () => ({\n getSite: () => ({ color: '#000000' }),\n invokeCall,\n isApp,\n}));\n\nvi.mock('../../utils/sharingBar', () => ({\n copyToClipboard: vi.fn(),\n shareWithApp,\n shareWithUrl,\n}));\n\nvi.mock('../../utils/environment', () => ({\n useIsTouch: () => false,\n}));\n\nvi.mock('../context-menu/ContextMenu', () => ({\n default: ({\n children,\n items,\n }: {\n children: ReactNode;\n items: Array<{ key: string; onClick: VoidFunction }>;\n }) => (\n <div data-item-keys={items.map((item) => item.key).join(',')}>\n {items.map((item) => (\n <button key={item.key} type=\"button\" onClick={item.onClick}>\n {item.key}\n </button>\n ))}\n {children}\n </div>\n ),\n}));\n\ndescribe('SharingContextMenu', () => {\n beforeEach(() => {\n vi.clearAllMocks();\n isApp.mockReturnValue(false);\n });\n\n it('uses the native share call in the app', () => {\n isApp.mockReturnValue(true);\n\n const { getByRole } = render(\n <SharingContextMenu link=\"https://example.com\" text=\"Check this out\">\n <button type=\"button\">Share</button>\n </SharingContextMenu>,\n );\n\n fireEvent.click(getByRole('button', { name: 'whatsapp' }));\n fireEvent.click(getByRole('button', { name: 'facebook' }));\n fireEvent.click(getByRole('button', { name: 'twitter' }));\n fireEvent.click(getByRole('button', { name: 'mail' }));\n\n expect(invokeCall).toHaveBeenNthCalledWith(1, {\n action: 80,\n value: {\n text: 'Check this out\\n\\nhttps://example.com',\n sharingApp: 1,\n sharingAndroidApp: 'com.whatsapp',\n },\n });\n expect(invokeCall).toHaveBeenNthCalledWith(2, {\n action: 80,\n value: {\n text: 'https://example.com',\n sharingApp: 2,\n sharingAndroidApp: 'com.facebook.katana',\n },\n });\n expect(invokeCall).toHaveBeenNthCalledWith(3, {\n action: 80,\n value: {\n text: 'Check this out\\n\\nhttps://example.com',\n sharingApp: 5,\n },\n });\n expect(invokeCall).toHaveBeenNthCalledWith(4, {\n action: 80,\n value: {\n text: 'Check this out\\n\\nhttps://example.com',\n sharingApp: 0,\n },\n });\n expect(shareWithApp).not.toHaveBeenCalled();\n expect(shareWithUrl).not.toHaveBeenCalled();\n });\n\n it('shares the optional text via WhatsApp, mail, and X only', () => {\n const { getByRole } = render(\n <SharingContextMenu link=\"https://example.com\" text=\"Check this out\">\n <button type=\"button\">Share</button>\n </SharingContextMenu>,\n );\n\n fireEvent.click(getByRole('button', { name: 'whatsapp' }));\n fireEvent.click(getByRole('button', { name: 'mail' }));\n fireEvent.click(getByRole('button', { name: 'twitter' }));\n\n expect(shareWithUrl).toHaveBeenNthCalledWith(\n 1,\n 'https://api.whatsapp.com/send?text=Check%20this%20out%0A%0Ahttps%3A%2F%2Fexample.com',\n );\n expect(shareWithUrl).toHaveBeenNthCalledWith(\n 2,\n 'mailto:?body=Check%20this%20out%0A%0Ahttps%3A%2F%2Fexample.com',\n );\n expect(shareWithUrl).toHaveBeenNthCalledWith(\n 3,\n 'http://twitter.com/intent/tweet?text=Check%20this%20out&url=https%3A%2F%2Fexample.com&hashtags=chayns',\n );\n expect(shareWithApp).not.toHaveBeenCalled();\n });\n\n it('keeps copy and calling-code actions enabled by default', () => {\n const { container } = render(\n <SharingContextMenu link=\"https://example.com\">\n <button type=\"button\">Share</button>\n </SharingContextMenu>,\n );\n\n expect((container.firstChild as HTMLElement).getAttribute('data-item-keys')).toBe(\n 'copy,whatsapp,facebook,twitter,mail,callingCode',\n );\n });\n\n it('can hide copy and calling-code actions for dedicated content actions', () => {\n const { container } = render(\n <SharingContextMenu\n link=\"https://example.com\"\n shouldShowCallingCodeAction={false}\n shouldShowCopyAction={false}\n >\n <button type=\"button\">Share</button>\n </SharingContextMenu>,\n );\n\n expect((container.firstChild as HTMLElement).getAttribute('data-item-keys')).toBe(\n 'whatsapp,facebook,twitter,mail',\n );\n });\n});\n"],"mappings":"AAAA,SAASA,SAAS,EAAEC,MAAM,QAAQ,wBAAwB;AAC1D,OAAOC,KAAK,MAAqB,OAAO;AACxC,SAASC,UAAU,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,EAAEC,EAAE,QAAQ,QAAQ;AAC7D,OAAOC,kBAAkB,MAAM,sBAAsB;AAErD,MAAM;EAAEC,UAAU;EAAEC,KAAK;EAAEC,YAAY;EAAEC;AAAa,CAAC,GAAGL,EAAE,CAACM,OAAO,CAAC,OAAO;EACxEJ,UAAU,EAAEF,EAAE,CAACO,EAAE,CAAC,CAAC;EACnBJ,KAAK,EAAEH,EAAE,CAACO,EAAE,CAAC,MAAM,KAAK,CAAC;EACzBH,YAAY,EAAEJ,EAAE,CAACO,EAAE,CAAC,CAAC;EACrBF,YAAY,EAAEL,EAAE,CAACO,EAAE,CAAC;AACxB,CAAC,CAAC,CAAC;AAEHP,EAAE,CAACQ,IAAI,CAAC,YAAY,EAAE,OAAO;EACzBC,OAAO,EAAEA,CAAA,MAAO;IAAEC,KAAK,EAAE;EAAU,CAAC,CAAC;EACrCR,UAAU;EACVC;AACJ,C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;MAAQK,IAAI,EAAC;IAAQ,GAAC,OAAa,CACnB,CACxB,CAAC;IAEDvB,MAAM,CAAEuC,SAAS,CAACC,UAAU,CAAiBC,YAAY,CAAC,gBAAgB,CAAC,CAAC,CAACC,IAAI,CAC7E,iDACJ,CAAC;EACL,CAAC,CAAC;EAEFzC,EAAE,CAAC,sEAAsE,EAAE,MAAM;IAC7E,MAAM;MAAEsC;IAAU,CAAC,GAAG3C,MAAM,cACxBC,KAAA,CAAAqB,aAAA,CAACf,kBAAkB;MACfyB,IAAI,EAAC,qBAAqB;MAC1Be,2BAA2B,EAAE,KAAM;MACnCC,oBAAoB,EAAE;IAAM,gBAE5B/C,KAAA,CAAAqB,aAAA;MAAQK,IAAI,EAAC;IAAQ,GAAC,OAAa,CACnB,CACxB,CAAC;IAEDvB,MAAM,CAAEuC,SAAS,CAACC,UAAU,CAAiBC,YAAY,CAAC,gBAAgB,CAAC,CAAC,CAACC,IAAI,CAC7E,gCACJ,CAAC;EACL,CAAC,CAAC;AACN,CAAC,CAAC","ignoreList":[]}
|
|
@@ -13,6 +13,10 @@ export type SharingBarProps = {
|
|
|
13
13
|
* The link that should be shared.
|
|
14
14
|
*/
|
|
15
15
|
link: string;
|
|
16
|
+
/**
|
|
17
|
+
* Optional text that is shared together with the link via WhatsApp, mail, and X.
|
|
18
|
+
*/
|
|
19
|
+
text?: string;
|
|
16
20
|
/**
|
|
17
21
|
* The alignment of the sharing options.
|
|
18
22
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FunctionComponent, PropsWithChildren } from 'react';
|
|
2
2
|
import { SharingContextMenuProps } from '../sharing-context-menu/SharingContextMenu';
|
|
3
3
|
import { ButtonProps } from '../button/Button.types';
|
|
4
|
-
export type SharingButtonProps = PropsWithChildren<Pick<SharingContextMenuProps, 'link' | 'alignment' | 'container'> & Pick<ButtonProps, 'isDisabled' | 'shouldEnableKeyboardHighlighting'>>;
|
|
4
|
+
export type SharingButtonProps = PropsWithChildren<Pick<SharingContextMenuProps, 'link' | 'text' | 'alignment' | 'container'> & Pick<ButtonProps, 'isDisabled' | 'shouldEnableKeyboardHighlighting'>>;
|
|
5
5
|
declare const SharingButton: FunctionComponent<SharingButtonProps>;
|
|
6
6
|
export default SharingButton;
|
|
@@ -5,6 +5,10 @@ export type SharingContextMenuProps = {
|
|
|
5
5
|
* The link that should be shared.
|
|
6
6
|
*/
|
|
7
7
|
link: string;
|
|
8
|
+
/**
|
|
9
|
+
* Optional text that is shared together with the link via WhatsApp, mail, and X.
|
|
10
|
+
*/
|
|
11
|
+
text?: string;
|
|
8
12
|
/**
|
|
9
13
|
* Shows the action that copies the shared link to the clipboard.
|
|
10
14
|
*/
|
|
@@ -23,6 +27,10 @@ declare const SharingContextMenu: React.ForwardRefExoticComponent<{
|
|
|
23
27
|
* The link that should be shared.
|
|
24
28
|
*/
|
|
25
29
|
link: string;
|
|
30
|
+
/**
|
|
31
|
+
* Optional text that is shared together with the link via WhatsApp, mail, and X.
|
|
32
|
+
*/
|
|
33
|
+
text?: string;
|
|
26
34
|
/**
|
|
27
35
|
* Shows the action that copies the shared link to the clipboard.
|
|
28
36
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chayns-components/core",
|
|
3
|
-
"version": "5.6.
|
|
3
|
+
"version": "5.6.5",
|
|
4
4
|
"description": "A set of beautiful React components for developing your own applications with chayns.",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"browserslist": [
|
|
@@ -93,5 +93,5 @@
|
|
|
93
93
|
"publishConfig": {
|
|
94
94
|
"access": "public"
|
|
95
95
|
},
|
|
96
|
-
"gitHead": "
|
|
96
|
+
"gitHead": "00917ae1a54a3fd19be6e89aacb746c6246c8b3d"
|
|
97
97
|
}
|