@nextelco/common-ui 1.5.86 → 1.6.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/bundle.js +1 -1
- package/dist/types/components/atoms/Button/Button.stories.d.ts +425 -41
- package/dist/types/components/atoms/Card/Card2.d.ts +1 -2
- package/dist/types/components/atoms/Card/Card3.d.ts +1 -2
- package/dist/types/components/atoms/Card/Card4.d.ts +1 -2
- package/dist/types/components/atoms/Card/Card5.d.ts +1 -1
- package/dist/types/components/atoms/Card/Card6.d.ts +1 -2
- package/dist/types/components/atoms/Select/Select.d.ts +1 -0
- package/dist/types/components/atoms/Select/Select.stories.d.ts +1 -9
- package/dist/types/components/atoms/Stack/Stack.d.ts +1 -1
- package/dist/types/components/atoms/Stack/Stack.stories.d.ts +1 -11
- package/dist/types/components/layout/Header/Header.d.ts +9 -13
- package/dist/types/components/layout/Header/Header.stories.d.ts +30 -6
- package/dist/types/components/moleculas/Notification/Notification.d.ts +4 -0
- package/dist/types/components/organisms/LazyLoading/LazyLoading.d.ts +77 -0
- package/dist/types/components/organisms/Profile/Profile.d.ts +3 -2
- package/dist/types/components/organisms/Profile/Profile.stories.d.ts +5 -6
- package/dist/types/components/organisms/Selector/Selector.d.ts +0 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/types/ButtonTheme.d.ts +2 -2
- package/package.json +6 -3
- package/dist/types/components/moleculas/Operators/Operators.d.ts +0 -15
- package/dist/types/components/moleculas/Operators/Operators.stories.d.ts +0 -8
@@ -0,0 +1,77 @@
|
|
1
|
+
/**
|
2
|
+
import React, { useEffect } from 'react'
|
3
|
+
import InfiniteScroll from 'react-infinite-scroll-component'
|
4
|
+
import { useApi } from '../../../hooks/useApi'
|
5
|
+
|
6
|
+
interface LazyLoadListProps {
|
7
|
+
items: any[]
|
8
|
+
setItems: (items: any[]) => void
|
9
|
+
page: number
|
10
|
+
limit: number
|
11
|
+
setPage: (page: number) => void
|
12
|
+
hasMore: boolean
|
13
|
+
setHasMore: (hasMore: boolean) => void
|
14
|
+
filters: { [key: string]: string }
|
15
|
+
}
|
16
|
+
|
17
|
+
const LazyLoadList: React.FC<LazyLoadListProps> = ({
|
18
|
+
items,
|
19
|
+
setItems,
|
20
|
+
page,
|
21
|
+
limit,
|
22
|
+
setPage,
|
23
|
+
hasMore,
|
24
|
+
setHasMore,
|
25
|
+
filters,
|
26
|
+
}) => {
|
27
|
+
const { request, errors, loading } = useApi()
|
28
|
+
|
29
|
+
const fetchData = async (pageNum: number) => {
|
30
|
+
const response = await request({
|
31
|
+
method: 'get',
|
32
|
+
url: `/api/items`,
|
33
|
+
params: { page: pageNum, limit, ...filters },
|
34
|
+
})
|
35
|
+
|
36
|
+
if (response) {
|
37
|
+
if (response.length === 0) {
|
38
|
+
setHasMore(false)
|
39
|
+
return
|
40
|
+
}
|
41
|
+
setItems([...items, ...response])
|
42
|
+
}
|
43
|
+
}
|
44
|
+
|
45
|
+
useEffect(() => {
|
46
|
+
fetchData(page)
|
47
|
+
}, [page, filters])
|
48
|
+
|
49
|
+
const loadMore = () => {
|
50
|
+
setPage(page + 1)
|
51
|
+
}
|
52
|
+
|
53
|
+
return (
|
54
|
+
<div>
|
55
|
+
{errors && errors}
|
56
|
+
<InfiniteScroll
|
57
|
+
dataLength={items.length}
|
58
|
+
next={loadMore}
|
59
|
+
hasMore={hasMore}
|
60
|
+
loader={<h4>Loading...</h4>}
|
61
|
+
endMessage={<p>No more items to load</p>}
|
62
|
+
>
|
63
|
+
{items.map((item, index) => (
|
64
|
+
<div
|
65
|
+
key={index}
|
66
|
+
style={{ padding: '20px', borderBottom: '1px solid #ccc' }}
|
67
|
+
>
|
68
|
+
{item.name || `Item ${index}`}{' '}
|
69
|
+
</div>
|
70
|
+
))}
|
71
|
+
</InfiniteScroll>
|
72
|
+
</div>
|
73
|
+
)
|
74
|
+
}
|
75
|
+
|
76
|
+
export default LazyLoadList
|
77
|
+
*/
|
@@ -1,9 +1,10 @@
|
|
1
|
-
import React from 'react';
|
1
|
+
import React, { ReactNode } from 'react';
|
2
2
|
import { LoggedUser } from '../../../types/LoggedUser';
|
3
3
|
import './Profile.scss';
|
4
4
|
type Props = {
|
5
5
|
user: LoggedUser;
|
6
6
|
handleLogout: () => void;
|
7
|
+
notifications?: ReactNode;
|
7
8
|
};
|
8
|
-
declare const Profile: ({ user, handleLogout }: Props) => React.JSX.Element;
|
9
|
+
declare const Profile: ({ user, handleLogout, notifications }: Props) => React.JSX.Element;
|
9
10
|
export default Profile;
|
@@ -1,8 +1,7 @@
|
|
1
1
|
import { Meta, StoryObj } from '@storybook/react';
|
2
2
|
import Profile from './Profile';
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
export
|
7
|
-
|
8
|
-
export declare const ProfileStory: Story;
|
3
|
+
type Story = StoryObj<typeof Profile>;
|
4
|
+
declare const _default: Meta<typeof Profile>;
|
5
|
+
export default _default;
|
6
|
+
export declare const Default: Story;
|
7
|
+
export declare const WithLongName: Story;
|
File without changes
|
package/dist/types/index.d.ts
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
export { default as Label } from './components/atoms/Label/Label';
|
2
2
|
export { default as BreadCrumb } from './components/atoms/BreadCrumb/BreadCrumb';
|
3
3
|
export { default as CustomSwitch } from './components/atoms/Switch/CustomSwitch';
|
4
|
-
export { default as Operators } from './components/moleculas/Operators/Operators';
|
5
4
|
export { default as Field } from './components/atoms/Field/Field';
|
6
5
|
export { default as Card1 } from './components/atoms/Card/Card1';
|
7
6
|
export { default as Card2 } from './components/atoms/Card/Card2';
|
@@ -25,6 +24,7 @@ export { default as Error } from './components/layout/Error/Error';
|
|
25
24
|
export { default as Spinner } from './components/layout/Spinner/Spinner';
|
26
25
|
export { default as LoadingPage } from './pages/Loading/Loading';
|
27
26
|
export { default as ErrorPage } from './pages/Error/ErrorPage';
|
27
|
+
export { default as NotFoundPage } from './pages/NotFound/NotFound';
|
28
28
|
export { useAuth, AuthProvider } from './contexts/authContext';
|
29
29
|
export { ApiProvider } from './contexts/apiContext';
|
30
30
|
export { useApi } from './hooks/useApi';
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@nextelco/common-ui",
|
3
|
-
"version": "1.
|
3
|
+
"version": "1.6.1",
|
4
4
|
"description": "",
|
5
5
|
"main": "dist/bundle.js",
|
6
6
|
"types": "dist/types/index.d.ts",
|
@@ -39,6 +39,7 @@
|
|
39
39
|
"@types/react-dom": "^19.0.3",
|
40
40
|
"@types/storybook__react": "^5.2.1",
|
41
41
|
"css-loader": "^7.1.2",
|
42
|
+
"msw": "^2.7.3",
|
42
43
|
"sass": "^1.84.0",
|
43
44
|
"sass-loader": "^16.0.4",
|
44
45
|
"storybook": "^8.5.3",
|
@@ -56,8 +57,10 @@
|
|
56
57
|
"@fortawesome/react-fontawesome": "^0.2.2",
|
57
58
|
"axios": "^1.8.1",
|
58
59
|
"js-cookie": "^3.0.5",
|
59
|
-
"keycloak-js": "^25.0.
|
60
|
+
"keycloak-js": "^25.0.0",
|
61
|
+
"react-infinite-scroll-component": "^6.1.0",
|
60
62
|
"react-switch": "^7.1.0",
|
61
|
-
"react-tooltip": "^5.28.0"
|
63
|
+
"react-tooltip": "^5.28.0",
|
64
|
+
"tough-cookie": "^5.1.2"
|
62
65
|
}
|
63
66
|
}
|
@@ -1,15 +0,0 @@
|
|
1
|
-
import "./Operators.scss";
|
2
|
-
import React from "react";
|
3
|
-
type Props = {
|
4
|
-
label: string;
|
5
|
-
name: string;
|
6
|
-
type: "cui-choose_operator_title" | "cui-add_operator_title";
|
7
|
-
placeholder?: string;
|
8
|
-
disabled?: boolean;
|
9
|
-
readOnly?: boolean;
|
10
|
-
mode?: "cui-add_logo";
|
11
|
-
selected?: boolean;
|
12
|
-
onSelect?: () => void;
|
13
|
-
};
|
14
|
-
declare const Operators: ({ label, name, type, placeholder, disabled, readOnly, mode, selected, onSelect, }: Props) => React.JSX.Element;
|
15
|
-
export default Operators;
|
@@ -1,8 +0,0 @@
|
|
1
|
-
import { Meta, StoryObj } from "@storybook/react";
|
2
|
-
import Operators from "./Operators";
|
3
|
-
declare const meta: Meta<typeof Operators>;
|
4
|
-
export default meta;
|
5
|
-
type Story = StoryObj<typeof meta>;
|
6
|
-
export declare const Operadora_01: Story;
|
7
|
-
export declare const Operadora_02: Story;
|
8
|
-
export declare const Nova_operadora: Story;
|