@axinom/mosaic-ui 0.42.0 → 0.43.0-rc.1
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/FormStation/FormGrid/FormGrid.d.ts +7 -0
- package/dist/components/FormStation/FormGrid/FormGrid.d.ts.map +1 -0
- package/dist/components/FormStation/FormGrid/index.d.ts +2 -0
- package/dist/components/FormStation/FormGrid/index.d.ts.map +1 -0
- package/dist/components/FormStation/FormStation.d.ts +3 -12
- package/dist/components/FormStation/FormStation.d.ts.map +1 -1
- package/dist/components/FormStation/FormStation.models.d.ts +16 -2
- package/dist/components/FormStation/FormStation.models.d.ts.map +1 -1
- package/dist/components/FormStation/FormStationActions/FormStationActions.d.ts +21 -0
- package/dist/components/FormStation/FormStationActions/FormStationActions.d.ts.map +1 -0
- package/dist/components/FormStation/FormStationActions/index.d.ts +2 -0
- package/dist/components/FormStation/FormStationActions/index.d.ts.map +1 -0
- package/dist/components/FormStation/FormStationContentWrapper/FormStationContentWrapper.d.ts +11 -0
- package/dist/components/FormStation/FormStationContentWrapper/FormStationContentWrapper.d.ts.map +1 -0
- package/dist/components/FormStation/FormStationContentWrapper/index.d.ts +2 -0
- package/dist/components/FormStation/FormStationContentWrapper/index.d.ts.map +1 -0
- package/dist/components/FormStation/FormStationHeader/FormStationHeader.d.ts +11 -0
- package/dist/components/FormStation/FormStationHeader/FormStationHeader.d.ts.map +1 -0
- package/dist/components/FormStation/FormStationHeader/index.d.ts +2 -0
- package/dist/components/FormStation/FormStationHeader/index.d.ts.map +1 -0
- package/dist/components/FormStation/helpers/useDataProvider.d.ts +14 -0
- package/dist/components/FormStation/helpers/useDataProvider.d.ts.map +1 -0
- package/dist/components/FormStation/{useValidationError.d.ts → helpers/useValidationError.d.ts} +1 -1
- package/dist/components/FormStation/helpers/useValidationError.d.ts.map +1 -0
- package/dist/components/FormStation/index.d.ts +2 -1
- package/dist/components/FormStation/index.d.ts.map +1 -1
- 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/FormStation/FormGrid/FormGrid.scss +10 -0
- package/src/components/FormStation/FormGrid/FormGrid.tsx +25 -0
- package/src/components/FormStation/FormGrid/index.ts +1 -0
- package/src/components/FormStation/FormStation.models.ts +28 -2
- package/src/components/FormStation/FormStation.scss +1 -117
- package/src/components/FormStation/FormStation.stories.tsx +166 -1
- package/src/components/FormStation/FormStation.tsx +39 -388
- package/src/components/FormStation/FormStationActions/FormStationActions.tsx +130 -0
- package/src/components/FormStation/FormStationActions/index.ts +1 -0
- package/src/components/FormStation/FormStationContentWrapper/FormStationContentWrapper.scss +66 -0
- package/src/components/FormStation/FormStationContentWrapper/FormStationContentWrapper.tsx +76 -0
- package/src/components/FormStation/FormStationContentWrapper/index.ts +1 -0
- package/src/components/FormStation/FormStationHeader/FormStationHeader.tsx +88 -0
- package/src/components/FormStation/FormStationHeader/index.ts +1 -0
- package/src/components/FormStation/helpers/useDataProvider.ts +124 -0
- package/src/components/FormStation/{useValidationError.tsx → helpers/useValidationError.tsx} +2 -1
- package/src/components/FormStation/index.ts +2 -5
- package/src/components/List/ListRow/Renderers/ExternalLinkRenderer/ExternalLinkRenderer.tsx +1 -1
- 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/dist/components/FormStation/StationErrorStateType.d.ts +0 -5
- package/dist/components/FormStation/StationErrorStateType.d.ts.map +0 -1
- package/dist/components/FormStation/useValidationError.d.ts.map +0 -1
- package/src/components/FormStation/StationErrorStateType.tsx +0 -5
|
@@ -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
|
+
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"StationErrorStateType.d.ts","sourceRoot":"","sources":["../../../src/components/FormStation/StationErrorStateType.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,MAAM,WAAW,qBAAsB,SAAQ,YAAY;IACzD,IAAI,CAAC,EAAE,MAAM,CAAC;CACf"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useValidationError.d.ts","sourceRoot":"","sources":["../../../src/components/FormStation/useValidationError.tsx"],"names":[],"mappings":"AACA,OAAO,KAA2C,MAAM,OAAO,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAehE;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAChC,YAAY,EAAE,qBAAqB,GAAG,SAAS,EAC/C,eAAe,EAAE,KAAK,CAAC,QAAQ,CAC7B,KAAK,CAAC,cAAc,CAAC,qBAAqB,GAAG,SAAS,CAAC,CACxD,GACA;IACD,kBAAkB,EAAE,MAAM,IAAI,CAAC;IAC/B,iBAAiB,EAAE,GAAG,CAAC,OAAO,CAAC;CAChC,CAyBA"}
|