@websolutespa/bom-mixer-hooks 1.7.1 → 1.7.2

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/CHANGELOG.md CHANGED
@@ -1,105 +1,115 @@
1
- # @websolutespa/bom-mixer-hooks
2
-
3
- ## 1.7.1
4
-
5
- ### Patch Changes
6
-
7
- - aa41666: Added: useIntersectionObserver
8
-
9
- ## 1.7.0
10
-
11
- ### Minor Changes
12
-
13
- - 28e86bd: Modified: IPage, Store services & decorators
14
- - Updated dependencies [28e86bd]
15
- - @websolutespa/bom-mixer-models@1.7.0
16
- - @websolutespa/bom-mixer-store@1.7.0
17
- - @websolutespa/bom-core@1.7.0
18
-
19
- ## 1.4.2
20
-
21
- ### Patch Changes
22
-
23
- - Modified: IFeatureType
24
- - Updated dependencies
25
- - @websolutespa/bom-mixer-models@1.5.4
26
- - @websolutespa/bom-mixer-store@1.4.3
27
- - @websolutespa/bom-core@0.6.5
28
-
29
- ## 1.4.1
30
-
31
- ### Patch Changes
32
-
33
- - Added: useCollectionApi, useExtra
34
- - Modified: usePagination, useSearchParamsQs
35
- - Updated dependencies
36
- - @websolutespa/bom-mixer-models@1.5.2
37
- - @websolutespa/bom-core@0.6.2
38
-
39
- ## 1.4.0
40
-
41
- ### Minor Changes
42
-
43
- - Added useLazyModules
44
-
45
- ## 1.3.0
46
-
47
- ### Minor Changes
48
-
49
- - Added: useSearchParamsQs
50
- - Modified: useSearchParamsEncoded, useSearchParams, useScrollTo
51
-
52
- ## 1.2.1
53
-
54
- ### Patch Changes
55
-
56
- - Added: LabelService
57
- - Modified: useLabels, useScrollTo
58
-
59
- ## 1.2.0
60
-
61
- ### Minor Changes
62
-
63
- - Updating: next 13
64
-
65
- ## 1.1.0
66
-
67
- ### Minor Changes
68
-
69
- - Modified: useHttp, useApi
70
-
71
- ## 1.0.0
72
-
73
- ### Minor Changes
74
-
75
- - Added: useScrolled
76
-
77
- ## 0.2.2
78
-
79
- ### Patch Changes
80
-
81
- - Modified: useBreakpoint theme mediaQuery
82
-
83
- ## 0.2.1
84
-
85
- ### Patch Changes
86
-
87
- - Added: source files
88
-
89
- ## 0.2.0
90
-
91
- ### Minor Changes
92
-
93
- - Added: splat routes
94
-
95
- ## 0.1.0
96
-
97
- ### Minor Changes
98
-
99
- - Added: @websolutespa/bom-core
100
-
101
- ## 0.0.2
102
-
103
- ### Patch Changes
104
-
105
- - Added: first release
1
+ # @websolutespa/bom-mixer-hooks
2
+
3
+ ## 1.7.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Updating: dependencies
8
+ - Updated dependencies
9
+ - @websolutespa/bom-mixer-models@1.7.2
10
+ - @websolutespa/bom-mixer-store@1.7.3
11
+ - @websolutespa/bom-core@1.7.3
12
+
13
+ ## 1.7.1
14
+
15
+ ### Patch Changes
16
+
17
+ - aa41666: Added: useIntersectionObserver
18
+
19
+ ## 1.7.0
20
+
21
+ ### Minor Changes
22
+
23
+ - 28e86bd: Modified: IPage, Store services & decorators
24
+ - Updated dependencies [28e86bd]
25
+ - @websolutespa/bom-mixer-models@1.7.0
26
+ - @websolutespa/bom-mixer-store@1.7.0
27
+ - @websolutespa/bom-core@1.7.0
28
+
29
+ ## 1.4.2
30
+
31
+ ### Patch Changes
32
+
33
+ - Modified: IFeatureType
34
+ - Updated dependencies
35
+ - @websolutespa/bom-mixer-models@1.5.4
36
+ - @websolutespa/bom-mixer-store@1.4.3
37
+ - @websolutespa/bom-core@0.6.5
38
+
39
+ ## 1.4.1
40
+
41
+ ### Patch Changes
42
+
43
+ - Added: useCollectionApi, useExtra
44
+ - Modified: usePagination, useSearchParamsQs
45
+ - Updated dependencies
46
+ - @websolutespa/bom-mixer-models@1.5.2
47
+ - @websolutespa/bom-core@0.6.2
48
+
49
+ ## 1.4.0
50
+
51
+ ### Minor Changes
52
+
53
+ - Added useLazyModules
54
+
55
+ ## 1.3.0
56
+
57
+ ### Minor Changes
58
+
59
+ - Added: useSearchParamsQs
60
+ - Modified: useSearchParamsEncoded, useSearchParams, useScrollTo
61
+
62
+ ## 1.2.1
63
+
64
+ ### Patch Changes
65
+
66
+ - Added: LabelService
67
+ - Modified: useLabels, useScrollTo
68
+
69
+ ## 1.2.0
70
+
71
+ ### Minor Changes
72
+
73
+ - Updating: next 13
74
+
75
+ ## 1.1.0
76
+
77
+ ### Minor Changes
78
+
79
+ - Modified: useHttp, useApi
80
+
81
+ ## 1.0.0
82
+
83
+ ### Minor Changes
84
+
85
+ - Added: useScrolled
86
+
87
+ ## 0.2.2
88
+
89
+ ### Patch Changes
90
+
91
+ - Modified: useBreakpoint theme mediaQuery
92
+
93
+ ## 0.2.1
94
+
95
+ ### Patch Changes
96
+
97
+ - Added: source files
98
+
99
+ ## 0.2.0
100
+
101
+ ### Minor Changes
102
+
103
+ - Added: splat routes
104
+
105
+ ## 0.1.0
106
+
107
+ ### Minor Changes
108
+
109
+ - Added: @websolutespa/bom-core
110
+
111
+ ## 0.0.2
112
+
113
+ ### Patch Changes
114
+
115
+ - Added: first release
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as react from 'react';
2
- import react__default, { RefObject, Dispatch, SetStateAction, MutableRefObject, ComponentProps, useEffect } from 'react';
2
+ import react__default, { RefObject, Dispatch, SetStateAction, CSSProperties, MutableRefObject, ComponentProps, useEffect } from 'react';
3
3
  import { ApiRequestOptions } from '@websolutespa/bom-mixer-store';
4
4
  import * as react_jsx_runtime from 'react/jsx-runtime';
5
5
  import * as zustand_middleware from 'zustand/middleware';
@@ -42,7 +42,8 @@ type Breakpoint = {
42
42
  min: number;
43
43
  max: number;
44
44
  };
45
- declare function useBreakpoint(): Breakpoint;
45
+ type MediaQuery = Record<BreakpointType, CSSProperties['width']>;
46
+ declare function useBreakpoint(mediaQuery?: MediaQuery): Breakpoint;
46
47
 
47
48
  type CartProps = {
48
49
  hydrated: boolean;
package/dist/index.js CHANGED
@@ -401,14 +401,15 @@ function useWindowSize() {
401
401
  }
402
402
 
403
403
  // src/useBreakpoint/useBreakpoint.ts
404
- function useBreakpoint() {
404
+ function useBreakpoint(mediaQuery) {
405
405
  const windowSize = useWindowSize();
406
406
  const theme = (0, import_react7.useContext)(import_styled_components.ThemeContext);
407
- if (!theme) {
407
+ if (!theme && !mediaQuery) {
408
408
  throw new Error("useBreakpoint must be used within ThemeProvider");
409
409
  }
410
- const breakpoints = Object.keys(theme.mediaQuery);
411
- const values = Object.values(theme.mediaQuery).map((x) => parseInt(String(x)));
410
+ const queries = mediaQuery || theme.mediaQuery;
411
+ const breakpoints = Object.keys(queries);
412
+ const values = Object.values(queries).map((x) => parseInt(String(x)));
412
413
  const breakpoint = (0, import_react7.useMemo)(() => {
413
414
  const breakpoint2 = values.reduce((p, c, i) => {
414
415
  if (c < windowSize.width) {
package/dist/index.mjs CHANGED
@@ -257,14 +257,15 @@ function useWindowSize() {
257
257
  }
258
258
 
259
259
  // src/useBreakpoint/useBreakpoint.ts
260
- function useBreakpoint() {
260
+ function useBreakpoint(mediaQuery) {
261
261
  const windowSize = useWindowSize();
262
262
  const theme = useContext2(ThemeContext);
263
- if (!theme) {
263
+ if (!theme && !mediaQuery) {
264
264
  throw new Error("useBreakpoint must be used within ThemeProvider");
265
265
  }
266
- const breakpoints = Object.keys(theme.mediaQuery);
267
- const values = Object.values(theme.mediaQuery).map((x) => parseInt(String(x)));
266
+ const queries = mediaQuery || theme.mediaQuery;
267
+ const breakpoints = Object.keys(queries);
268
+ const values = Object.values(queries).map((x) => parseInt(String(x)));
268
269
  const breakpoint = useMemo(() => {
269
270
  const breakpoint2 = values.reduce((p, c, i) => {
270
271
  if (c < windowSize.width) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@websolutespa/bom-mixer-hooks",
3
- "version": "1.7.1",
3
+ "version": "1.7.2",
4
4
  "description": "Mixer Hooks module of the BOM Repository",
5
5
  "keywords": [
6
6
  "bom",
@@ -29,7 +29,7 @@
29
29
  "@websolutespa/bom-mixer-store": "*",
30
30
  "framer-motion": ">= 7.2.1",
31
31
  "iron-session": ">= 6.2.1",
32
- "next": ">= 13.4.19",
32
+ "next": ">= 14.1.4",
33
33
  "react-dom": ">= 18.2.0",
34
34
  "react": ">= 18.2.0",
35
35
  "styled-components": ">= 5.3.11 <6.x.x",
@@ -37,21 +37,21 @@
37
37
  "zustand": ">= 4.4.0"
38
38
  },
39
39
  "devDependencies": {
40
- "@types/react": "^18.2.18",
41
- "@types/react-dom": "^18.2.7",
40
+ "@types/react": "^18.2.75",
41
+ "@types/react-dom": "^18.2.24",
42
42
  "@types/styled-components": "^5.1.26",
43
43
  "@websolutespa/bom-cli": "*",
44
44
  "@websolutespa/test": "*",
45
45
  "@websolutespa/tsconfig": "*",
46
- "eslint": "^8.46.0",
46
+ "eslint": "^9.0.0",
47
47
  "eslint-config-websolute": "*",
48
48
  "npm-run-all": "^4.1.5",
49
49
  "raw-loader": "^4.0.2",
50
50
  "react": "^18.2.0",
51
51
  "styled-components": "^5.3.11",
52
- "ts-node": "^10.9.1",
52
+ "ts-node": "^10.9.2",
53
53
  "tsup": "^6.7.0",
54
- "typescript": "^5.1.6"
54
+ "typescript": "^5.4.5"
55
55
  },
56
56
  "publishConfig": {
57
57
  "access": "public"
@@ -1,4 +1,4 @@
1
- import { useContext, useMemo } from 'react';
1
+ import { CSSProperties, useContext, useMemo } from 'react';
2
2
  import { ThemeContext } from 'styled-components';
3
3
  import { useWindowSize } from '../useWindowSize/useWindowSize';
4
4
 
@@ -10,19 +10,21 @@ type Breakpoint = {
10
10
  max: number;
11
11
  };
12
12
 
13
- export function useBreakpoint(): Breakpoint {
14
- // todo
15
- const windowSize = useWindowSize();
13
+ type MediaQuery = Record<BreakpointType, CSSProperties['width']>;
16
14
 
17
- // const [breakpoint, setBreakpoint] = useState<Breakpoint>({ key: 'xs', min: 0, max: 0 });
15
+ export function useBreakpoint(mediaQuery?: MediaQuery): Breakpoint {
16
+ const windowSize = useWindowSize();
18
17
 
19
18
  const theme = useContext(ThemeContext);
20
- if (!theme) {
19
+
20
+ if (!theme && !mediaQuery) {
21
21
  throw new Error('useBreakpoint must be used within ThemeProvider');
22
22
  }
23
23
 
24
- const breakpoints: BreakpointType[] = Object.keys(theme.mediaQuery) as BreakpointType[];
25
- const values: number[] = Object.values(theme.mediaQuery).map(x => parseInt(String(x)));
24
+ const queries: MediaQuery = mediaQuery || theme.mediaQuery;
25
+
26
+ const breakpoints: BreakpointType[] = Object.keys(queries) as BreakpointType[];
27
+ const values: number[] = Object.values(queries).map(x => parseInt(String(x)));
26
28
 
27
29
  const breakpoint = useMemo(() => {
28
30
  const breakpoint = values.reduce((p, c, i) => {
@@ -1,6 +1,7 @@
1
1
  import { QueryParams, qsSerialize } from '@websolutespa/bom-core';
2
- import { useApiFetch, useLayout } from '@websolutespa/bom-mixer-hooks';
3
2
  import { ApiRequestOptions } from '@websolutespa/bom-mixer-store';
3
+ import { useApiFetch } from '../useApi/useApi';
4
+ import { useLayout } from '../useLayout/useLayout';
4
5
  import { localCollectionDelete, localCollectionGet, localCollectionPatch, localCollectionPost, localCollectionPut } from './local.collection';
5
6
 
6
7
  type CollectionApi = {
@@ -1,6 +1,6 @@
1
- import { createGenericContext } from '@websolutespa/bom-mixer-hooks';
2
1
  import { ILazyModules } from '@websolutespa/bom-mixer-models';
3
2
  import React from 'react';
3
+ import { createGenericContext } from '../useGenericContext/useGenericContext';
4
4
 
5
5
  export type ILazyModulesContext = ILazyModules;
6
6