@royaltics/ui 1.3.21 → 1.5.6
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/README.http_query.md +332 -0
- package/dist/components/DynamicTable.js +1 -1
- package/dist/components/DynamicTable.js.map +1 -1
- package/dist/components/PaginateNest.stories.d.ts +18 -0
- package/dist/components/PaginateNest.stories.d.ts.map +1 -0
- package/dist/components/PaginateNest.stories.js +40 -0
- package/dist/components/PaginateNest.stories.js.map +1 -0
- package/dist/components/PaginateNext.d.ts +13 -0
- package/dist/components/PaginateNext.d.ts.map +1 -0
- package/dist/components/PaginateNext.js +44 -0
- package/dist/components/PaginateNext.js.map +1 -0
- package/dist/components/PhotoCard.js +2 -2
- package/dist/components/PhotoCard.js.map +1 -1
- package/dist/core/http/query-manager.d.ts +83 -0
- package/dist/core/http/query-manager.d.ts.map +1 -0
- package/dist/core/http/query-manager.js +350 -0
- package/dist/core/http/query-manager.js.map +1 -0
- package/dist/forms/InputAutocomplete.js.map +1 -1
- package/dist/hooks/useHttpState.d.ts +44 -22
- package/dist/hooks/useHttpState.d.ts.map +1 -1
- package/dist/hooks/useHttpState.js +350 -88
- package/dist/hooks/useHttpState.js.map +1 -1
- package/dist/providers/http-provider.d.ts +9 -1
- package/dist/providers/http-provider.d.ts.map +1 -1
- package/dist/providers/http-provider.js +17 -16
- package/dist/providers/http-provider.js.map +1 -1
- package/package.json +14 -6
|
@@ -1,33 +1,34 @@
|
|
|
1
|
-
|
|
1
|
+
// http-provider.tsx
|
|
2
|
+
import React, { createContext, useContext, useMemo, useState } from 'react';
|
|
3
|
+
import QueryManager from '../core/http/query-manager.js';
|
|
2
4
|
const HttpContext = createContext(undefined);
|
|
3
|
-
export const HttpProvider = ({ children, baseUrl = '', debug = false, initialHeaders = {}, skipRejected = false, onNotAuth, }) => {
|
|
5
|
+
export const HttpProvider = ({ children, baseUrl = '', debug = false, initialHeaders = {}, skipRejected = false, onNotAuth, queryConfig, }) => {
|
|
6
|
+
const [headers, setHeaders] = React.useState(initialHeaders);
|
|
4
7
|
const [online, setOnline] = useState(true);
|
|
5
|
-
const
|
|
6
|
-
const handleSetHeaders = useCallback((newHeaders) => {
|
|
7
|
-
|
|
8
|
-
setHeaders(newHeaders);
|
|
9
|
-
}
|
|
10
|
-
else {
|
|
11
|
-
setHeaders(newHeaders);
|
|
12
|
-
}
|
|
8
|
+
const queryManager = useMemo(() => new QueryManager(queryConfig), []);
|
|
9
|
+
const handleSetHeaders = React.useCallback((newHeaders) => {
|
|
10
|
+
setHeaders(typeof newHeaders === 'function' ? newHeaders : newHeaders);
|
|
13
11
|
}, []);
|
|
14
12
|
const value = useMemo(() => ({
|
|
15
13
|
baseUrl,
|
|
16
14
|
debug,
|
|
17
|
-
online,
|
|
18
15
|
headers,
|
|
19
|
-
|
|
16
|
+
online,
|
|
20
17
|
setOnline,
|
|
18
|
+
skipRejected,
|
|
19
|
+
queryManager,
|
|
21
20
|
setHeaders: handleSetHeaders,
|
|
22
21
|
onNotAuth,
|
|
23
|
-
}), [baseUrl, debug, online,
|
|
22
|
+
}), [baseUrl, debug, headers, online, setOnline, skipRejected, queryManager, handleSetHeaders, onNotAuth]);
|
|
23
|
+
React.useEffect(() => {
|
|
24
|
+
return () => queryManager.destroy();
|
|
25
|
+
}, [queryManager]);
|
|
24
26
|
return (React.createElement(HttpContext.Provider, { value: value }, children));
|
|
25
27
|
};
|
|
26
28
|
export const useHttpContext = () => {
|
|
27
29
|
const context = useContext(HttpContext);
|
|
28
|
-
if (!context)
|
|
29
|
-
throw new Error('useHttpContext must be used within
|
|
30
|
-
}
|
|
30
|
+
if (!context)
|
|
31
|
+
throw new Error('useHttpContext must be used within HttpProvider');
|
|
31
32
|
return context;
|
|
32
33
|
};
|
|
33
34
|
//# sourceMappingURL=http-provider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-provider.js","sourceRoot":"","sources":["../../src/providers/http-provider.tsx"],"names":[],"mappings":"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,CAAC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,EAAE,gBAAgB,EAAE,SAAS,CAAC,CAAC,CAAC;IAE3G,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACpB,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;IACrC,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;IAEnB,OAAO,CACN,oBAAC,WAAW,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,IAChC,QAAQ,CACa,CACvB,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,GAAqB,EAAE;IACpD,MAAM,OAAO,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC;IACxC,IAAI,CAAC,OAAO;QAAE,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;IACjF,OAAO,OAAO,CAAC;AAChB,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@royaltics/ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.6",
|
|
4
4
|
"private": false,
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -63,7 +63,10 @@
|
|
|
63
63
|
"build:esm": "tsc --module ESNext --outDir dist/esm",
|
|
64
64
|
"prepublishOnly": "del /f /q dist && npm run build",
|
|
65
65
|
"storybook": "storybook dev -p 6006",
|
|
66
|
-
"build-storybook": "storybook build"
|
|
66
|
+
"build-storybook": "storybook build",
|
|
67
|
+
"test": "vitest",
|
|
68
|
+
"test:ui": "vitest --ui",
|
|
69
|
+
"test:coverage": "vitest --coverage"
|
|
67
70
|
},
|
|
68
71
|
"peerDependencies": {
|
|
69
72
|
"react": "^18 || ^19",
|
|
@@ -77,11 +80,16 @@
|
|
|
77
80
|
"@storybook/addon-postcss": "^2.0.0",
|
|
78
81
|
"@storybook/addon-themes": "^9.0.16",
|
|
79
82
|
"@storybook/react-vite": "9.0.16",
|
|
80
|
-
"@
|
|
83
|
+
"@testing-library/jest-dom": "^6.9.1",
|
|
84
|
+
"@testing-library/react": "^16.3.0",
|
|
85
|
+
"@testing-library/react-hooks": "^8.0.1",
|
|
81
86
|
"@types/node": "^24.0.12",
|
|
82
87
|
"@types/react": "^18.0.0",
|
|
83
88
|
"@types/react-dom": "^18.0.0",
|
|
84
89
|
"@types/youtube": "^0.1.0",
|
|
90
|
+
"@vitejs/plugin-react": "^5.1.0",
|
|
91
|
+
"@vitest/coverage-v8": "^4.0.3",
|
|
92
|
+
"jsdom": "^27.0.1",
|
|
85
93
|
"postcss": "^8.5.6",
|
|
86
94
|
"react": "^19.1.0",
|
|
87
95
|
"react-dom": "19.1.0",
|
|
@@ -90,18 +98,18 @@
|
|
|
90
98
|
"tailwindcss": "^4.1.11",
|
|
91
99
|
"tsc-alias": "^1.8.16",
|
|
92
100
|
"tsup": "^8.5.0",
|
|
93
|
-
"typescript": "^5.8.3"
|
|
101
|
+
"typescript": "^5.8.3",
|
|
102
|
+
"vitest": "^4.0.3"
|
|
94
103
|
},
|
|
95
104
|
"dependencies": {
|
|
96
105
|
"@heroicons/react": "^2.2.0",
|
|
97
106
|
"@tailwindcss/postcss": "^4.1.11",
|
|
98
107
|
"classnames": "^2.5.1",
|
|
99
108
|
"clsx": "^2.1.1",
|
|
100
|
-
"lodash.isequal": "^4.5.0",
|
|
101
109
|
"memoize": "^10.1.0",
|
|
102
110
|
"memoize-one": "^6.0.0",
|
|
103
111
|
"query-string": "^9.1.1",
|
|
104
112
|
"react-toastify": "^11.0.3",
|
|
105
113
|
"uuid": "^11.1.0"
|
|
106
114
|
}
|
|
107
|
-
}
|
|
115
|
+
}
|