@homecode/ui 4.18.29 → 4.18.30

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.
@@ -20,11 +20,11 @@ const STORE = createStore('router', {
20
20
  un(cb) {
21
21
  spliceWhere(LISTENERS, cb);
22
22
  },
23
- go(path, query, params = {}) {
23
+ go(path = this.path, query = {}, params = {}) {
24
24
  if (path === this.path && !query)
25
25
  return;
26
26
  const { replace } = params;
27
- const pathStr = applyQueryParams(path ?? this.path, query, this.query);
27
+ const pathStr = applyQueryParams(path ?? this.path, query);
28
28
  const action = replace ? 'replaceState' : 'pushState';
29
29
  console.log('Router.go', query, pathStr);
30
30
  history[action]({}, '', pathStr);
@@ -15,17 +15,11 @@ function stringifyQueryParams(params) {
15
15
  .map(([key, value]) => `${key}=${value}`)
16
16
  .join('&');
17
17
  }
18
- function applyQueryParams(path, queryParams, currParams) {
18
+ function applyQueryParams(path, queryParams) {
19
19
  const clearPath = path.replace(/\?.*/, '/');
20
- if (!queryParams) {
21
- if (Object.keys(currParams).length === 0)
22
- return path;
23
- return `${clearPath}?${stringifyQueryParams(currParams)}`;
24
- }
25
- if (typeof queryParams === 'string') {
20
+ if (typeof queryParams === 'string')
26
21
  return queryParams;
27
- }
28
- const query = { ...currParams };
22
+ const query = { ...queryParams };
29
23
  Object.entries(queryParams).forEach(([key, value]) => {
30
24
  if (value === false)
31
25
  delete query[key];
@@ -1,3 +1,2 @@
1
- /// <reference types="react" />
2
1
  declare const _default: () => JSX.Element;
3
2
  export default _default;
@@ -5,6 +5,7 @@ export type RedirectProps = {
5
5
  to: string;
6
6
  };
7
7
  export type RouteProps = {
8
+ className?: string;
8
9
  path: string;
9
10
  component: ComponentType;
10
11
  exact?: boolean;
@@ -1,5 +1,5 @@
1
1
  export declare function parseQueryParams(qs?: string): Record<string, string>;
2
2
  export declare function stringifyQueryParams(params: Record<string, string>): string;
3
- export declare function applyQueryParams(path: any, queryParams: any, currParams: any): any;
3
+ export declare function applyQueryParams(path: any, queryParams: Record<string, any> | string): string;
4
4
  export declare const setSSRQueryParams: (params: any) => void;
5
5
  export declare const queryParams: Record<string, string>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@homecode/ui",
3
- "version": "4.18.29",
3
+ "version": "4.18.30",
4
4
  "description": "React UI components library",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",