@purpurds/tabs 5.11.0 → 5.11.2
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/LICENSE.txt +1 -1
- package/dist/tab-content.d.ts +1 -1
- package/dist/tab-content.d.ts.map +1 -1
- package/dist/tabs.cjs.js +1 -1
- package/dist/tabs.cjs.js.map +1 -1
- package/dist/tabs.es.js +10 -19
- package/dist/tabs.es.js.map +1 -1
- package/package.json +13 -13
- package/src/tab-content.test.tsx +2 -2
- package/src/tabs.stories.tsx +30 -5
- package/readme.mdx +0 -56
- package/src/tab-content.stories.tsx +0 -43
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@purpurds/tabs",
|
|
3
|
-
"version": "5.11.
|
|
3
|
+
"version": "5.11.2",
|
|
4
4
|
"license": "AGPL-3.0-only",
|
|
5
5
|
"main": "./dist/tabs.cjs.js",
|
|
6
6
|
"types": "./dist/tabs.d.ts",
|
|
@@ -16,31 +16,31 @@
|
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"classnames": "~2.5.0",
|
|
18
18
|
"@radix-ui/react-tabs": "~1.0.4",
|
|
19
|
-
"@purpurds/tokens": "5.11.
|
|
20
|
-
"@purpurds/paragraph": "5.11.
|
|
21
|
-
"@purpurds/icon": "5.11.
|
|
19
|
+
"@purpurds/tokens": "5.11.2",
|
|
20
|
+
"@purpurds/paragraph": "5.11.2",
|
|
21
|
+
"@purpurds/icon": "5.11.2"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@rushstack/eslint-patch": "~1.10.0",
|
|
25
|
-
"@storybook/
|
|
26
|
-
"
|
|
25
|
+
"@storybook/react": "^8.2.6",
|
|
26
|
+
"storybook": "^8.2.6",
|
|
27
27
|
"@telia/base-rig": "~8.2.0",
|
|
28
28
|
"@telia/react-rig": "~3.2.0",
|
|
29
29
|
"@testing-library/dom": "~9.3.3",
|
|
30
30
|
"@testing-library/jest-dom": "~6.4.0",
|
|
31
31
|
"@testing-library/react": "~14.3.0",
|
|
32
32
|
"@types/node": "20.12.12",
|
|
33
|
-
"@types/react-dom": "
|
|
34
|
-
"@types/react": "
|
|
33
|
+
"@types/react-dom": "^18.3.0",
|
|
34
|
+
"@types/react": "^18.3.3",
|
|
35
35
|
"eslint-plugin-testing-library": "~6.2.0",
|
|
36
|
-
"eslint": "
|
|
36
|
+
"eslint": "^8.57.0",
|
|
37
37
|
"jsdom": "~22.1.0",
|
|
38
38
|
"lint-staged": "~10.5.3",
|
|
39
39
|
"prettier": "~2.8.8",
|
|
40
|
-
"react-dom": "
|
|
41
|
-
"react": "
|
|
42
|
-
"typescript": "
|
|
43
|
-
"vite": "
|
|
40
|
+
"react-dom": "^18.3.1",
|
|
41
|
+
"react": "^18.3.1",
|
|
42
|
+
"typescript": "^5.5.4",
|
|
43
|
+
"vite": "5.3.4",
|
|
44
44
|
"vitest": "~1.5.0",
|
|
45
45
|
"@purpurds/component-rig": "1.0.0"
|
|
46
46
|
},
|
package/src/tab-content.test.tsx
CHANGED
|
@@ -3,9 +3,9 @@ import * as matchers from "@testing-library/jest-dom/matchers";
|
|
|
3
3
|
import { cleanup, render, screen } from "@testing-library/react";
|
|
4
4
|
import { afterEach, describe, expect, it } from "vitest";
|
|
5
5
|
|
|
6
|
-
import { Tabs } from "./tabs";
|
|
7
|
-
import { TabContent } from "./tab-content";
|
|
8
6
|
import "./__mocks__/intersectionObserverMock";
|
|
7
|
+
import { TabContent } from "./tab-content";
|
|
8
|
+
import { Tabs } from "./tabs";
|
|
9
9
|
|
|
10
10
|
const rootClassName = "purpur-tab-content";
|
|
11
11
|
|
package/src/tabs.stories.tsx
CHANGED
|
@@ -4,9 +4,12 @@ import type { Meta, StoryObj } from "@storybook/react";
|
|
|
4
4
|
import { Tabs } from "./tabs";
|
|
5
5
|
import { tabsVariants } from "./tabs.utils";
|
|
6
6
|
|
|
7
|
-
const meta
|
|
7
|
+
const meta = {
|
|
8
8
|
title: "Components/Tabs",
|
|
9
9
|
component: Tabs,
|
|
10
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
11
|
+
//@ts-ignore
|
|
12
|
+
subcomponents: { "Tabs.Content": Tabs.Content },
|
|
10
13
|
parameters: {
|
|
11
14
|
design: [
|
|
12
15
|
{
|
|
@@ -17,11 +20,33 @@ const meta: Meta<typeof Tabs> = {
|
|
|
17
20
|
],
|
|
18
21
|
},
|
|
19
22
|
argTypes: {
|
|
20
|
-
variant: {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
+
variant: {
|
|
24
|
+
control: "select",
|
|
25
|
+
options: tabsVariants,
|
|
26
|
+
table: { type: { summary: tabsVariants.map((x) => `"${x}"`).join(" | ") } },
|
|
27
|
+
},
|
|
28
|
+
children: {
|
|
29
|
+
table: {
|
|
30
|
+
type: {
|
|
31
|
+
summary: "ReactElement<typeof TabContent>[] | ReactElement<typeof TabContent>",
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
fullWidth: {
|
|
36
|
+
table: { type: { summary: "boolean" } },
|
|
37
|
+
},
|
|
38
|
+
negative: {
|
|
39
|
+
table: { type: { summary: "boolean" } },
|
|
40
|
+
},
|
|
41
|
+
["data-testid"]: { table: { type: { summary: "string" } }, control: { type: "text" } },
|
|
42
|
+
className: {
|
|
43
|
+
table: {
|
|
44
|
+
type: { summary: "string" },
|
|
45
|
+
},
|
|
46
|
+
control: { type: "text" },
|
|
47
|
+
},
|
|
23
48
|
},
|
|
24
|
-
}
|
|
49
|
+
} satisfies Meta<typeof Tabs>;
|
|
25
50
|
|
|
26
51
|
export default meta;
|
|
27
52
|
|
package/readme.mdx
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { Meta, Stories, ArgTypes, Primary, Subtitle } from "@storybook/blocks";
|
|
2
|
-
|
|
3
|
-
import * as TabsStories from "./src/tabs.stories";
|
|
4
|
-
import * as TabContentStories from "./src/tab-content.stories";
|
|
5
|
-
import packageInfo from "./package.json";
|
|
6
|
-
|
|
7
|
-
<Meta name="Docs" title="Components/Tabs" of={TabsStories} />
|
|
8
|
-
|
|
9
|
-
# Tabs
|
|
10
|
-
|
|
11
|
-
<Subtitle>Version {packageInfo.version}</Subtitle>
|
|
12
|
-
|
|
13
|
-
### Showcase
|
|
14
|
-
|
|
15
|
-
<Primary />
|
|
16
|
-
|
|
17
|
-
### Properties
|
|
18
|
-
|
|
19
|
-
#### Tabs
|
|
20
|
-
|
|
21
|
-
<ArgTypes />
|
|
22
|
-
|
|
23
|
-
#### Tabs.Content
|
|
24
|
-
|
|
25
|
-
<ArgTypes of={TabContentStories} />
|
|
26
|
-
|
|
27
|
-
### Installation
|
|
28
|
-
|
|
29
|
-
#### Via NPM
|
|
30
|
-
|
|
31
|
-
Add the dependency to your consumer app like `"@purpurds/purpur": "^x.y.z"`
|
|
32
|
-
|
|
33
|
-
In MyApp.tsx
|
|
34
|
-
|
|
35
|
-
```tsx
|
|
36
|
-
import "@purpurds/purpur/styles";
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
In MyComponent.tsx
|
|
40
|
-
|
|
41
|
-
```tsx
|
|
42
|
-
import { Tabs } from "@purpurds/purpur";
|
|
43
|
-
|
|
44
|
-
export const MyComponent = () => {
|
|
45
|
-
return (
|
|
46
|
-
<Tabs variant="contained">
|
|
47
|
-
<Tabs.Content tabId="tab-1" name="Tab name 1">
|
|
48
|
-
<div>Some content</div>
|
|
49
|
-
</Tabs.Content>
|
|
50
|
-
<Tabs.Content tabId="tab-2" name="Tab name 2">
|
|
51
|
-
<div>Some content</div>
|
|
52
|
-
</Tabs.Content>
|
|
53
|
-
</Tabs>
|
|
54
|
-
);
|
|
55
|
-
};
|
|
56
|
-
```
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { Root } from "@radix-ui/react-tabs";
|
|
3
|
-
import type { Meta, StoryObj } from "@storybook/react";
|
|
4
|
-
|
|
5
|
-
import { Tabs } from "./tabs";
|
|
6
|
-
|
|
7
|
-
const meta: Meta<typeof Tabs.Content> = {
|
|
8
|
-
title: "Components/Tabs",
|
|
9
|
-
component: Tabs.Content,
|
|
10
|
-
parameters: {
|
|
11
|
-
design: [
|
|
12
|
-
{
|
|
13
|
-
name: "Tabs",
|
|
14
|
-
type: "figma",
|
|
15
|
-
url: "https://www.figma.com/file/XEaIIFskrrxIBHMZDkIuIg/Purpur-DS---Component-library-%26-guidelines?type=design&node-id=2942-430&mode=design&t=zoKkl2HAtk3UuKoP-0",
|
|
16
|
-
},
|
|
17
|
-
],
|
|
18
|
-
storyHead: {
|
|
19
|
-
title: "Tabs.Content",
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
argTypes: {
|
|
23
|
-
["data-testid"]: { control: { type: "text" } },
|
|
24
|
-
className: { control: { type: "text" } },
|
|
25
|
-
},
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export default meta;
|
|
29
|
-
|
|
30
|
-
type Story = StoryObj<typeof Tabs.Content>;
|
|
31
|
-
|
|
32
|
-
export const TabContent: Story = {
|
|
33
|
-
args: {
|
|
34
|
-
tabId: "tab-1",
|
|
35
|
-
name: "Tab name-1",
|
|
36
|
-
children: <div>Some content</div>,
|
|
37
|
-
},
|
|
38
|
-
render: ({ children, ...args }) => (
|
|
39
|
-
<Root defaultValue={args.tabId}>
|
|
40
|
-
<Tabs.Content {...args}>{children}</Tabs.Content>
|
|
41
|
-
</Root>
|
|
42
|
-
),
|
|
43
|
-
};
|