@ultraviolet/plus 0.15.5 → 0.17.0
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/EstimateCost/EstimateCost.cjs +5 -4
- package/dist/components/EstimateCost/EstimateCost.d.ts +1 -1
- package/dist/components/EstimateCost/EstimateCost.js +5 -4
- package/dist/components/EstimateCost/EstimateCostContent.cjs +20 -13
- package/dist/components/EstimateCost/EstimateCostContent.d.ts +1 -1
- package/dist/components/EstimateCost/EstimateCostContent.js +20 -13
- package/dist/components/EstimateCost/types.d.ts +10 -0
- package/dist/components/Navigation/Navigation.cjs +2 -5
- package/dist/components/Navigation/Navigation.d.ts +7 -28
- package/dist/components/Navigation/Navigation.js +2 -5
- package/dist/components/Navigation/NavigationContent.cjs +20 -14
- package/dist/components/Navigation/NavigationContent.d.ts +2 -10
- package/dist/components/Navigation/NavigationContent.js +20 -14
- package/dist/components/Navigation/NavigationProvider.cjs +13 -6
- package/dist/components/Navigation/NavigationProvider.d.ts +10 -6
- package/dist/components/Navigation/NavigationProvider.js +13 -6
- package/dist/components/Navigation/components/Item.cjs +15 -15
- package/dist/components/Navigation/components/Item.d.ts +1 -1
- package/dist/components/Navigation/components/Item.js +15 -15
- package/dist/components/Navigation/components/PinnedItems.cjs +5 -5
- package/dist/components/Navigation/components/PinnedItems.js +5 -5
- package/dist/components/Navigation/constants.d.ts +0 -18
- package/dist/components/Navigation/types.d.ts +39 -0
- package/package.json +6 -6
|
@@ -29,6 +29,9 @@ const NavigationContext = react.createContext({
|
|
|
29
29
|
registerItem: () => {
|
|
30
30
|
},
|
|
31
31
|
setPinnedItems: () => {
|
|
32
|
+
},
|
|
33
|
+
allowNavigationResize: true,
|
|
34
|
+
setAllowNavigationResize: () => {
|
|
32
35
|
}
|
|
33
36
|
});
|
|
34
37
|
const useNavigation = () => react.useContext(NavigationContext);
|
|
@@ -39,13 +42,15 @@ const NavigationProvider = ({
|
|
|
39
42
|
initialExpanded = true,
|
|
40
43
|
locales = en,
|
|
41
44
|
pinLimit = 7,
|
|
42
|
-
|
|
43
|
-
initialWidth = constants.NAVIGATION_WIDTH
|
|
45
|
+
onExpandChange,
|
|
46
|
+
initialWidth = constants.NAVIGATION_WIDTH,
|
|
47
|
+
initialAllowNavigationResize = true
|
|
44
48
|
}) => {
|
|
45
49
|
const [expanded, setExpanded] = react.useState(initialExpanded);
|
|
46
50
|
const [pinnedItems, setPinnedItems] = react.useState(initialPinned ?? []);
|
|
47
51
|
const [animation, setAnimation] = react.useState(false);
|
|
48
52
|
const [width, setWidth] = react.useState(initialWidth);
|
|
53
|
+
const [allowNavigationResize, setAllowNavigationResize] = react.useState(initialAllowNavigationResize);
|
|
49
54
|
const [items, registerItem] = react.useReducer((oldState, newState) => ({
|
|
50
55
|
...oldState,
|
|
51
56
|
...newState
|
|
@@ -58,7 +63,7 @@ const NavigationProvider = ({
|
|
|
58
63
|
if (toggle !== void 0 && toggle === expanded) {
|
|
59
64
|
return;
|
|
60
65
|
}
|
|
61
|
-
|
|
66
|
+
onExpandChange?.(!expanded);
|
|
62
67
|
if (navigationRef.current) {
|
|
63
68
|
navigationRef.current.style.width = "";
|
|
64
69
|
}
|
|
@@ -67,7 +72,7 @@ const NavigationProvider = ({
|
|
|
67
72
|
setExpanded(toggle !== void 0 ? toggle : !expanded);
|
|
68
73
|
setAnimation(false);
|
|
69
74
|
}, constants.ANIMATION_DURATION);
|
|
70
|
-
}, [expanded,
|
|
75
|
+
}, [expanded, onExpandChange, setAnimation, setExpanded]);
|
|
71
76
|
const pinItem = react.useCallback((item) => {
|
|
72
77
|
const newValue = [...pinnedItems, item];
|
|
73
78
|
setPinnedItems(newValue);
|
|
@@ -102,8 +107,10 @@ const NavigationProvider = ({
|
|
|
102
107
|
reorderItems,
|
|
103
108
|
registerItem,
|
|
104
109
|
items,
|
|
105
|
-
setPinnedItems
|
|
106
|
-
|
|
110
|
+
setPinnedItems,
|
|
111
|
+
allowNavigationResize,
|
|
112
|
+
setAllowNavigationResize
|
|
113
|
+
}), [expanded, toggleExpand, pinnedItems, pinItem, unpinItem, pinnedFeature, locales, pinLimit, animation, width, reorderItems, items, allowNavigationResize]);
|
|
107
114
|
return /* @__PURE__ */ jsxRuntime.jsx(NavigationContext.Provider, { value, children });
|
|
108
115
|
};
|
|
109
116
|
exports.NavigationContext = NavigationContext;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Dispatch, ReactNode, RefObject } from 'react';
|
|
2
|
-
import { type PinUnPinType } from './constants';
|
|
3
2
|
import NavigationLocales from './locales/en';
|
|
3
|
+
import type { PinUnPinType } from './types';
|
|
4
4
|
type Item = {
|
|
5
5
|
label: string;
|
|
6
6
|
active?: boolean;
|
|
@@ -38,6 +38,8 @@ type ContextProps = {
|
|
|
38
38
|
items: Items;
|
|
39
39
|
registerItem: Dispatch<Items>;
|
|
40
40
|
setPinnedItems: (value: string[]) => void;
|
|
41
|
+
allowNavigationResize: boolean;
|
|
42
|
+
setAllowNavigationResize: (value: boolean) => void;
|
|
41
43
|
};
|
|
42
44
|
export declare const NavigationContext: import("react").Context<ContextProps>;
|
|
43
45
|
export declare const useNavigation: () => ContextProps;
|
|
@@ -66,11 +68,13 @@ type NavigationProviderProps = {
|
|
|
66
68
|
initialExpanded?: boolean;
|
|
67
69
|
locales?: typeof NavigationLocales;
|
|
68
70
|
/**
|
|
69
|
-
*
|
|
70
|
-
* of the navigation. This is not triggered when the user resize the navigation
|
|
71
|
-
* and it automatically collapse / expand.
|
|
71
|
+
* You can get the expanded state of the navigation with this function
|
|
72
72
|
*/
|
|
73
|
-
|
|
73
|
+
onExpandChange?: (expanded: boolean) => void;
|
|
74
|
+
/**
|
|
75
|
+
* This boolean will define if the navigation can be resized or not.
|
|
76
|
+
*/
|
|
77
|
+
initialAllowNavigationResize?: boolean;
|
|
74
78
|
};
|
|
75
|
-
export declare const NavigationProvider: ({ children, pinnedFeature, initialPinned, initialExpanded, locales, pinLimit,
|
|
79
|
+
export declare const NavigationProvider: ({ children, pinnedFeature, initialPinned, initialExpanded, locales, pinLimit, onExpandChange, initialWidth, initialAllowNavigationResize, }: NavigationProviderProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
76
80
|
export {};
|
|
@@ -27,6 +27,9 @@ const NavigationContext = createContext({
|
|
|
27
27
|
registerItem: () => {
|
|
28
28
|
},
|
|
29
29
|
setPinnedItems: () => {
|
|
30
|
+
},
|
|
31
|
+
allowNavigationResize: true,
|
|
32
|
+
setAllowNavigationResize: () => {
|
|
30
33
|
}
|
|
31
34
|
});
|
|
32
35
|
const useNavigation = () => useContext(NavigationContext);
|
|
@@ -37,13 +40,15 @@ const NavigationProvider = ({
|
|
|
37
40
|
initialExpanded = true,
|
|
38
41
|
locales = NavigationLocales,
|
|
39
42
|
pinLimit = 7,
|
|
40
|
-
|
|
41
|
-
initialWidth = NAVIGATION_WIDTH
|
|
43
|
+
onExpandChange,
|
|
44
|
+
initialWidth = NAVIGATION_WIDTH,
|
|
45
|
+
initialAllowNavigationResize = true
|
|
42
46
|
}) => {
|
|
43
47
|
const [expanded, setExpanded] = useState(initialExpanded);
|
|
44
48
|
const [pinnedItems, setPinnedItems] = useState(initialPinned ?? []);
|
|
45
49
|
const [animation, setAnimation] = useState(false);
|
|
46
50
|
const [width, setWidth] = useState(initialWidth);
|
|
51
|
+
const [allowNavigationResize, setAllowNavigationResize] = useState(initialAllowNavigationResize);
|
|
47
52
|
const [items, registerItem] = useReducer((oldState, newState) => ({
|
|
48
53
|
...oldState,
|
|
49
54
|
...newState
|
|
@@ -56,7 +61,7 @@ const NavigationProvider = ({
|
|
|
56
61
|
if (toggle !== void 0 && toggle === expanded) {
|
|
57
62
|
return;
|
|
58
63
|
}
|
|
59
|
-
|
|
64
|
+
onExpandChange?.(!expanded);
|
|
60
65
|
if (navigationRef.current) {
|
|
61
66
|
navigationRef.current.style.width = "";
|
|
62
67
|
}
|
|
@@ -65,7 +70,7 @@ const NavigationProvider = ({
|
|
|
65
70
|
setExpanded(toggle !== void 0 ? toggle : !expanded);
|
|
66
71
|
setAnimation(false);
|
|
67
72
|
}, ANIMATION_DURATION);
|
|
68
|
-
}, [expanded,
|
|
73
|
+
}, [expanded, onExpandChange, setAnimation, setExpanded]);
|
|
69
74
|
const pinItem = useCallback((item) => {
|
|
70
75
|
const newValue = [...pinnedItems, item];
|
|
71
76
|
setPinnedItems(newValue);
|
|
@@ -100,8 +105,10 @@ const NavigationProvider = ({
|
|
|
100
105
|
reorderItems,
|
|
101
106
|
registerItem,
|
|
102
107
|
items,
|
|
103
|
-
setPinnedItems
|
|
104
|
-
|
|
108
|
+
setPinnedItems,
|
|
109
|
+
allowNavigationResize,
|
|
110
|
+
setAllowNavigationResize
|
|
111
|
+
}), [expanded, toggleExpand, pinnedItems, pinItem, unpinItem, pinnedFeature, locales, pinLimit, animation, width, reorderItems, items, allowNavigationResize]);
|
|
105
112
|
return /* @__PURE__ */ jsx(NavigationContext.Provider, { value, children });
|
|
106
113
|
};
|
|
107
114
|
export {
|