@axinom/mosaic-ui 0.42.0-rc.3 → 0.42.0-rc.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/dist/components/Tabs/Tab/CustomTab.d.ts +3 -0
- package/dist/components/Tabs/Tab/CustomTab.d.ts.map +1 -0
- package/dist/components/Tabs/Tab/index.d.ts +2 -0
- package/dist/components/Tabs/Tab/index.d.ts.map +1 -0
- package/dist/components/Tabs/TabList/CustomTabList.d.ts +3 -0
- package/dist/components/Tabs/TabList/CustomTabList.d.ts.map +1 -0
- package/dist/components/Tabs/TabList/ScrollContainer/ScrollContainer.d.ts +3 -0
- package/dist/components/Tabs/TabList/ScrollContainer/ScrollContainer.d.ts.map +1 -0
- package/dist/components/Tabs/TabList/ScrollContainer/index.d.ts +2 -0
- package/dist/components/Tabs/TabList/ScrollContainer/index.d.ts.map +1 -0
- package/dist/components/Tabs/TabList/ScrollContainer/useScroll.d.ts +10 -0
- package/dist/components/Tabs/TabList/ScrollContainer/useScroll.d.ts.map +1 -0
- package/dist/components/Tabs/TabList/index.d.ts +2 -0
- package/dist/components/Tabs/TabList/index.d.ts.map +1 -0
- package/dist/components/Tabs/TabPanel/CustomTabPanel.d.ts +3 -0
- package/dist/components/Tabs/TabPanel/CustomTabPanel.d.ts.map +1 -0
- package/dist/components/Tabs/TabPanel/index.d.ts +2 -0
- package/dist/components/Tabs/TabPanel/index.d.ts.map +1 -0
- package/dist/components/Tabs/index.d.ts +5 -0
- package/dist/components/Tabs/index.d.ts.map +1 -0
- package/dist/index.es.js +4 -4
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/package.json +4 -3
- package/src/components/FormElements/CustomTags/CustomTags.scss +12 -11
- package/src/components/FormStation/FormStation.stories.tsx +172 -0
- package/src/components/Tabs/Tab/CustomTab.scss +42 -0
- package/src/components/Tabs/Tab/CustomTab.tsx +34 -0
- package/src/components/Tabs/Tab/index.ts +1 -0
- package/src/components/Tabs/TabList/CustomTabList.scss +7 -0
- package/src/components/Tabs/TabList/CustomTabList.tsx +15 -0
- package/src/components/Tabs/TabList/ScrollContainer/ScrollContainer.scss +34 -0
- package/src/components/Tabs/TabList/ScrollContainer/ScrollContainer.tsx +39 -0
- package/src/components/Tabs/TabList/ScrollContainer/index.ts +1 -0
- package/src/components/Tabs/TabList/ScrollContainer/useScroll.ts +114 -0
- package/src/components/Tabs/TabList/index.ts +1 -0
- package/src/components/Tabs/TabPanel/CustomTabPanel.scss +10 -0
- package/src/components/Tabs/TabPanel/CustomTabPanel.tsx +26 -0
- package/src/components/Tabs/TabPanel/index.ts +1 -0
- package/src/components/Tabs/Tabs.stories.tsx +108 -0
- package/src/components/Tabs/index.ts +4 -0
- package/src/styles/variables.scss +3 -0
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/* eslint-disable react-hooks/rules-of-hooks */
|
|
2
|
+
import { faker } from '@faker-js/faker';
|
|
3
|
+
import { useArgs } from '@storybook/preview-api';
|
|
4
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
5
|
+
import React, { useMemo } from 'react';
|
|
6
|
+
import { TabsProps } from 'react-tabs';
|
|
7
|
+
import { Tab, TabList, TabPanel, Tabs } from '.';
|
|
8
|
+
import { createGroups } from '../../helpers/storybook';
|
|
9
|
+
|
|
10
|
+
const groups = createGroups({
|
|
11
|
+
Storybook: ['amount'],
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
type TabsStoryComponentProps = React.FC<
|
|
15
|
+
typeof Tabs & {
|
|
16
|
+
amount: number;
|
|
17
|
+
selectedIndex?: number;
|
|
18
|
+
}
|
|
19
|
+
>;
|
|
20
|
+
|
|
21
|
+
const meta: Meta<TabsStoryComponentProps> = {
|
|
22
|
+
title: 'Other Components/Tabs',
|
|
23
|
+
component: Tabs,
|
|
24
|
+
argTypes: {
|
|
25
|
+
...groups,
|
|
26
|
+
amount: {
|
|
27
|
+
...groups.amount,
|
|
28
|
+
description: '<b>[Storybook only]</b> The amount of tabs to render.',
|
|
29
|
+
type: 'number',
|
|
30
|
+
control: { type: 'number', min: 0, max: 30 },
|
|
31
|
+
},
|
|
32
|
+
children: {
|
|
33
|
+
table: {
|
|
34
|
+
disable: true,
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
args: {
|
|
39
|
+
amount: 3,
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const generateItems = (count: number): [JSX.Element[], JSX.Element[]] => {
|
|
44
|
+
const tabs = [];
|
|
45
|
+
const panels = [];
|
|
46
|
+
|
|
47
|
+
for (let i = 0; i < count; i++) {
|
|
48
|
+
const title = faker.random.words(faker.datatype.number({ min: 1, max: 3 }));
|
|
49
|
+
tabs.push(<Tab key={i}>{title}</Tab>);
|
|
50
|
+
panels.push(
|
|
51
|
+
<TabPanel key={i}>
|
|
52
|
+
<h2>{title}</h2>
|
|
53
|
+
<p>{faker.lorem.paragraph(20)}</p>
|
|
54
|
+
</TabPanel>,
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return [tabs, panels];
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export default meta;
|
|
62
|
+
|
|
63
|
+
export const Default: StoryObj<TabsStoryComponentProps> = {
|
|
64
|
+
render: (props) => {
|
|
65
|
+
const [tabs, panels] = generateItems(props.amount);
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
<Tabs>
|
|
69
|
+
<TabList>{tabs}</TabList>
|
|
70
|
+
{panels}
|
|
71
|
+
</Tabs>
|
|
72
|
+
);
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export const Controlled: StoryObj<TabsStoryComponentProps> = {
|
|
77
|
+
argTypes: {
|
|
78
|
+
...meta.argTypes,
|
|
79
|
+
selectedIndex: {
|
|
80
|
+
...groups.amount,
|
|
81
|
+
description: '<b>[Storybook only]</b> Index of the selected Tab.',
|
|
82
|
+
type: 'number',
|
|
83
|
+
control: { type: 'number', min: 0, max: 30 },
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
args: {
|
|
87
|
+
...meta.args,
|
|
88
|
+
selectedIndex: 0,
|
|
89
|
+
},
|
|
90
|
+
render: (props) => {
|
|
91
|
+
const [tabs, panels] = useMemo(
|
|
92
|
+
() => generateItems(props.amount),
|
|
93
|
+
[props.amount],
|
|
94
|
+
);
|
|
95
|
+
const [{ selectedIndex }, updateArgs] = useArgs();
|
|
96
|
+
|
|
97
|
+
const onSelect: TabsProps['onSelect'] = (index) => {
|
|
98
|
+
updateArgs({ selectedIndex: index });
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
return (
|
|
102
|
+
<Tabs selectedIndex={selectedIndex} onSelect={onSelect}>
|
|
103
|
+
<TabList>{tabs}</TabList>
|
|
104
|
+
{panels}
|
|
105
|
+
</Tabs>
|
|
106
|
+
);
|
|
107
|
+
},
|
|
108
|
+
};
|
|
@@ -207,6 +207,9 @@ $radio-checked-fill-color: $blue;
|
|
|
207
207
|
$toggle-button-stroke-color: $blue;
|
|
208
208
|
$toggle-button-off-text-color: $blue;
|
|
209
209
|
$toggle-button-on-bg-color: $blue;
|
|
210
|
+
$live-suggest-border-color: $blue;
|
|
211
|
+
$live-suggest-background-selected-color: rgba($blue, 0.15);
|
|
212
|
+
$live-suggest-text-color: $blue;
|
|
210
213
|
|
|
211
214
|
/* Inline Menu */
|
|
212
215
|
$inline-menu-button-stroke-color: $blue;
|