@nimbus-ds/sidebar 3.4.0-rc.2 → 3.4.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/CHANGELOG.md CHANGED
@@ -2,6 +2,16 @@
2
2
 
3
3
  The Sidebar component is a large floating container that goes into the page from the corners. It allows us to present actions, forms or sections with a lot of information about the context of the page.
4
4
 
5
+ ## 2025-03-18 `3.4.0`
6
+
7
+ #### 🎉 New features
8
+
9
+ - Adds `use-client` directive to the build output in order to support NextJS applications. ([#276](https://github.com/TiendaNube/nimbus-design-system/pull/276) by [@joacotornello](https://github.com/joacotornello))
10
+
11
+ ### 💡 Others
12
+
13
+ - Rebuild after build process changes to add support for modular imports and Server Components. ([#276](https://github.com/TiendaNube/nimbus-design-system/pull/276) by [@joacotornello](https://github.com/joacotornello))
14
+
5
15
  ## 2024-04-22 `3.3.1`
6
16
 
7
17
  #### 🐛 Bug fixes
@@ -0,0 +1,134 @@
1
+ # Changelog
2
+
3
+ The Sidebar component is a large floating container that goes into the page from the corners. It allows us to present actions, forms or sections with a lot of information about the context of the page.
4
+
5
+ ## 2025-03-18 `3.4.0`
6
+
7
+ #### 🎉 New features
8
+
9
+ - Adds `use-client` directive to the build output in order to support NextJS applications. ([#276](https://github.com/TiendaNube/nimbus-design-system/pull/276) by [@joacotornello](https://github.com/joacotornello))
10
+
11
+ ### 💡 Others
12
+
13
+ - Rebuild after build process changes to add support for modular imports and Server Components. ([#276](https://github.com/TiendaNube/nimbus-design-system/pull/276) by [@joacotornello](https://github.com/joacotornello))
14
+
15
+ ## 2024-04-22 `3.3.1`
16
+
17
+ #### 🐛 Bug fixes
18
+
19
+ - Added `lockScroll` to prevent scroll outside of the body of `Sidebar` component. ([#110](https://github.com/TiendaNube/nimbus-design-system/pull/240) by [@nachozullo](https://github.com/nachozullo))
20
+
21
+ ## 2024-04-15 `3.3.0`
22
+
23
+ #### 🐛 Bug fixes
24
+
25
+ - Added `RemoveScroll` component from `react-remove-scroll` library to prevent scroll resetting on the body of the `Sidebar` component. ([#233](https://github.com/TiendaNube/nimbus-design-system/pull/233) by [@juanchigallego](https://github.com/juanchigallego))
26
+
27
+ #### 📚 3rd party library updates
28
+
29
+ - Added `react-remove-scroll@2.5.7`. ([#233](https://github.com/TiendaNube/nimbus-design-system/pull/233) by [@juanchigallego](https://github.com/juanchigallego))
30
+
31
+ ## 2023-12-22 `3.2.1`
32
+
33
+ #### 🎉 New features
34
+
35
+ - Changed default title size to `h2` on `SidebarHeader` subcomponent. ([#215](https://github.com/TiendaNube/nimbus-design-system/pull/215) by [@juanchigallego](https://github.com/juanchigallego))
36
+
37
+ ## 2023-10-13 `3.2.0`
38
+
39
+ #### 📚 3rd party library updates
40
+
41
+ - Updated `@floating-ui/react@0.26.0`. ([#195](https://github.com/TiendaNube/nimbus-design-system/pull/195) by [@juanchigallego](https://github.com/juanchigallego))
42
+
43
+ ## 2023-07-11 `3.1.0`
44
+
45
+ #### 📚 3rd party library updates
46
+
47
+ - Updated `@floating-ui/react@0.24.6`. ([#179](https://github.com/TiendaNube/nimbus-design-system/pull/179) by [@juanchigallego](https://github.com/juanchigallego))
48
+
49
+ ## 2023-05-18 `3.0.0`
50
+
51
+ #### 🛠 Breaking changes
52
+
53
+ - Changed the dynamic sending option of the `zIndex` property to use `zIndex` in the component API. ([#162](https://github.com/TiendaNube/nimbus-design-system/pull/162) by [@juniorconquista](https://github.com/juniorconquista))
54
+
55
+ ## 2023-05-22 `2.2.1`
56
+
57
+ ### 📚 3rd party library updates
58
+
59
+ - Removed `@floating-ui/react-dom-interactions`. ([#157](https://github.com/TiendaNube/nimbus-design-system/pull/157) by [@juanchigallego](https://github.com/juanchigallego))
60
+ - Added `@floating-ui/react`. ([#157](https://github.com/TiendaNube/nimbus-design-system/pull/157) by [@juanchigallego](https://github.com/juanchigallego))
61
+
62
+ ## 2023-03-13 `2.2.0`
63
+
64
+ ### 💡 Others
65
+
66
+ - Refactored use of `color tokens` in internal components by removing `.` per `-`. ([#110](https://github.com/TiendaNube/nimbus-design-system/pull/110) by [@juniorconquista](https://github.com/juniorconquista))
67
+ - Refactored style classes to have more semantic names. ([#110](https://github.com/TiendaNube/nimbus-design-system/pull/110) by [@juniorconquista](https://github.com/juniorconquista))
68
+
69
+ ## 2023-02-24 `2.1.1`
70
+
71
+ ### 💡 Others
72
+
73
+ - Adjust `fontSize` and `lineHeight` properties in `Text` component on stories documentation. ([#106](https://github.com/TiendaNube/nimbus-design-system/pull/106) by [@juanchigallego](https://github.com/juanchigallego))
74
+
75
+ ## 2023-02-23 `2.1.0`
76
+
77
+ ### 🎉 New features
78
+
79
+ - Added server side-rendering support to component. ([#105](https://github.com/TiendaNube/nimbus-design-system/pull/105) by [@juniorconquista](https://github.com/juniorconquista))
80
+
81
+ ## 2022-12-22 `2.0.0`
82
+
83
+ ### 💡 Others
84
+
85
+ - Removed direct dependency on `nimbus-ds/styles` package from component build. ([#69](https://github.com/TiendaNube/nimbus-design-system/pull/69) by [@juniorconquista](https://github.com/juniorconquista))
86
+
87
+ ## 2022-12-07 `1.3.0`
88
+
89
+ ### 🎉 New features
90
+
91
+ - Changed build build to consume inner package `@nimbus-ds/webpack`. ([#63](https://github.com/TiendaNube/nimbus-design-system/pull/63) by [@juniorconquista](https://github.com/juniorconquista))
92
+
93
+ ### 📚 3rd party library updates
94
+
95
+ - Removed `terser-webpack-plugin@5.3.5`. ([#63](https://github.com/TiendaNube/nimbus-design-system/pull/63) by [@juniorconquista](https://github.com/juniorconquista))
96
+ - Removed `ts-loader@9.3.1`. ([#63](https://github.com/TiendaNube/nimbus-design-system/pull/63) by [@juniorconquista](https://github.com/juniorconquista))
97
+ - Removed `webpack-cli@4.10.0`. ([#63](https://github.com/TiendaNube/nimbus-design-system/pull/63) by [@juniorconquista](https://github.com/juniorconquista))
98
+ - Removed `webpack@5.74.0`. ([#63](https://github.com/TiendaNube/nimbus-design-system/pull/63) by [@juniorconquista](https://github.com/juniorconquista))
99
+ - Removed `typescript@4.7.4`. ([#63](https://github.com/TiendaNube/nimbus-design-system/pull/63) by [@juniorconquista](https://github.com/juniorconquista))
100
+
101
+ ## 2022-12-01 `1.2.0`
102
+
103
+ ### 🎉 New features
104
+
105
+ - Added `zIndex` property to the component. ([#61](https://github.com/TiendaNube/nimbus-design-system/pull/61) by [@juniorconquista](https://github.com/juniorconquista))
106
+
107
+ ## 2022-11-24 `1.1.0`
108
+
109
+ ### 🎉 New features
110
+
111
+ - Added `maxWidth` property to the Component. ([#58](https://github.com/TiendaNube/nimbus-design-system/pull/58) by [@juniorconquista](https://github.com/juniorconquista))
112
+ - Added `padding` properties to the Component `Sidebar.Header`. ([#58](https://github.com/TiendaNube/nimbus-design-system/pull/58) by [@juniorconquista](https://github.com/juniorconquista))
113
+ - Added `padding` properties to the Component `Sidebar.Footer`. ([#58](https://github.com/TiendaNube/nimbus-design-system/pull/58) by [@juniorconquista](https://github.com/juniorconquista))
114
+
115
+ ## 2022-11-16 `1.0.0`
116
+
117
+ ### 📚 3rd party library updates
118
+
119
+ - Added `terser-webpack-plugin@5.3.5`. ([#56](https://github.com/TiendaNube/nimbus-design-system/pull/56) by [@juanchigallego](https://github.com/juanchigallego))
120
+ - Added `ts-loader@9.3.1`. ([#56](https://github.com/TiendaNube/nimbus-design-system/pull/56) by [@juanchigallego](https://github.com/juanchigallego))
121
+ - Added `typescript@4.7.4`. ([#56](https://github.com/TiendaNube/nimbus-design-system/pull/56) by [@juanchigallego](https://github.com/juanchigallego))
122
+ - Added `webpack@5.74.0`. ([#56](https://github.com/TiendaNube/nimbus-design-system/pull/56) by [@juanchigallego](https://github.com/juanchigallego))
123
+ - Added `webpack-cli@4.10.0`. ([#56](https://github.com/TiendaNube/nimbus-design-system/pull/56) by [@juanchigallego](https://github.com/juanchigallego))
124
+
125
+ ### 🎉 New features
126
+
127
+ - Added `position`, `padding`, `children`, `onRemove` and `open` properties to the Component. ([#56](https://github.com/TiendaNube/nimbus-design-system/pull/56) by [@juniorconquista](https://github.com/juniorconquista))
128
+ - Added stories on Component. ([#56](https://github.com/TiendaNube/nimbus-design-system/pull/56) by [@juniorconquista](https://github.com/juniorconquista))
129
+ - Created new `Sidebar.Header` subcomponent. ([#56](https://github.com/TiendaNube/nimbus-design-system/pull/56) by [@juniorconquista](https://github.com/juniorconquista))
130
+ - Added `children` and `title` properties to the Component `Sidebar.Header`. ([#56](https://github.com/TiendaNube/nimbus-design-system/pull/56) by [@juniorconquista](https://github.com/juniorconquista))
131
+ - Created new `Sidebar.Body` subcomponent. ([#56](https://github.com/TiendaNube/nimbus-design-system/pull/56) by [@juniorconquista](https://github.com/juniorconquista))
132
+ - Added `children` and `padding` properties to the Component `Sidebar.Body`. ([#56](https://github.com/TiendaNube/nimbus-design-system/pull/56) by [@juniorconquista](https://github.com/juniorconquista))
133
+ - Created new `Sidebar.Footer` subcomponent. ([#56](https://github.com/TiendaNube/nimbus-design-system/pull/56) by [@juniorconquista](https://github.com/juniorconquista))
134
+ - Added `children` properties to the Component `Sidebar.Footer`. ([#56](https://github.com/TiendaNube/nimbus-design-system/pull/56) by [@juniorconquista](https://github.com/juniorconquista))
package/dist/README.md ADDED
@@ -0,0 +1,42 @@
1
+ # `@nimbus-ds/sidebar`
2
+
3
+ [![@nimbus-ds/sidebar](https://img.shields.io/npm/v/@nimbus-ds/sidebar?label=%40nimbus-ds%2Fsidebar)](https://www.npmjs.com/package/@nimbus-ds/sidebar)
4
+
5
+ The Sidebar component is a large floating container that goes into the page from the corners. It allows us to present actions, forms or sections with a lot of information about the context of the page.
6
+
7
+ ## Installation
8
+
9
+ ```sh
10
+ $ yarn add @nimbus-ds/sidebar
11
+ # or
12
+ $ npm install @nimbus-ds/sidebar
13
+ ```
14
+
15
+ ### Component Anatomy
16
+
17
+ The component consists of a full-screen translucent background and a floating container that occupies the full height of the screen and a fixed width, with shadow and optional padding.
18
+
19
+ On desktop it has a fixed width and occupies the entire top, on mobile it occupies the entire screen.
20
+
21
+ ## Guidelines
22
+
23
+ We use the Sidebar to present actions, dialogs or forms that open over the context of the page, when they are too long to use in a Modal, but the information is relevant enough not to navigate to another page.
24
+
25
+ Despite being a floating component, it partially blocks the background view, but should be used sparingly.
26
+
27
+ ### Recommendations for use
28
+
29
+ - Create a menu for an app
30
+ - Display a list of filters with many options
31
+ - Present an interactive list with many entries and a search engine
32
+
33
+ ### Related components
34
+
35
+ - Modal - It is a floating element that allows us to present actions or brief confirmation messages to the user.
36
+ - Popover - It is a floating element that can be used to present information or actions in a non-intrusive way.
37
+
38
+ ## Usage
39
+
40
+ View docs [here](https://nimbus.nuvemshop.com.br/documentation/atomic-components/sidebar).
41
+
42
+ <img alt="Nimbus" style="margin-bottom: 30px;" src="https://tiendanube.github.io/design-system-nimbus/static/media/nimbus-logo.ab60bd79.png" height="30" />
package/dist/index.js CHANGED
@@ -1 +1,2 @@
1
+ "use client";
1
2
  !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("@floating-ui/react"),require("@nimbus-ds/styles"),require("@nimbus-ds/title")):"function"==typeof define&&define.amd?define(["react","@floating-ui/react","@nimbus-ds/styles","@nimbus-ds/title"],t):"object"==typeof exports?exports["@nimbus-ds/sidebar"]=t(require("react"),require("@floating-ui/react"),require("@nimbus-ds/styles"),require("@nimbus-ds/title")):e["@nimbus-ds/sidebar"]=t(e.react,e["@floating-ui/react"],e["@nimbus-ds/styles"],e["@nimbus-ds/title"])}(global,((e,t,r,n)=>(()=>{"use strict";var o={822:(e,t,r)=>{r.r(t),r.d(t,{RemoveScroll:()=>z});var n=r(769),o=r(155),a="right-scroll-bar-position",i="width-before-scroll-bar";function c(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e}var u=new WeakMap;function s(e,t){var r,n,a,i=(r=t||null,n=function(t){return e.forEach((function(e){return c(e,t)}))},(a=(0,o.useState)((function(){return{value:r,callback:n,facade:{get current(){return a.value},set current(e){var t=a.value;t!==e&&(a.value=e,a.callback(e,t))}}}}))[0]).callback=n,a.facade);return o.useLayoutEffect((function(){var t=u.get(i);if(t){var r=new Set(t),n=new Set(e),o=i.current;r.forEach((function(e){n.has(e)||c(e,null)})),n.forEach((function(e){r.has(e)||c(e,o)}))}u.set(i,e)}),[e]),i}function l(e){return e}function d(e,t){void 0===t&&(t=l);var r=[],n=!1;return{read:function(){if(n)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:e},useMedium:function(e){var o=t(e,n);return r.push(o),function(){r=r.filter((function(e){return e!==o}))}},assignSyncMedium:function(e){for(n=!0;r.length;){var t=r;r=[],t.forEach(e)}r={push:function(t){return e(t)},filter:function(){return r}}},assignMedium:function(e){n=!0;var t=[];if(r.length){var o=r;r=[],o.forEach(e),t=r}var a=function(){var r=t;t=[],r.forEach(e)},i=function(){return Promise.resolve().then(a)};i(),r={push:function(e){t.push(e),i()},filter:function(e){return t=t.filter(e),r}}}}}var f=function(e){void 0===e&&(e={});var t=d(null);return t.options=(0,n.__assign)({async:!0,ssr:!1},e),t}(),p=function(){},v=o.forwardRef((function(e,t){var r=o.useRef(null),a=o.useState({onScrollCapture:p,onWheelCapture:p,onTouchMoveCapture:p}),i=a[0],c=a[1],u=e.forwardProps,l=e.children,d=e.className,v=e.removeScrollBar,y=e.enabled,h=e.shards,m=e.sideCar,b=e.noIsolation,_=e.inert,g=e.allowPinchZoom,w=e.as,S=void 0===w?"div":w,E=e.gapMode,P=(0,n.__rest)(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),j=m,O=s([r,t]),x=(0,n.__assign)((0,n.__assign)({},P),i);return o.createElement(o.Fragment,null,y&&o.createElement(j,{sideCar:f,removeScrollBar:v,shards:h,noIsolation:b,inert:_,setCallbacks:c,allowPinchZoom:!!g,lockRef:r,gapMode:E}),u?o.cloneElement(o.Children.only(l),(0,n.__assign)((0,n.__assign)({},x),{ref:O})):o.createElement(S,(0,n.__assign)({},x,{className:d,ref:O}),l))}));v.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},v.classNames={fullWidth:i,zeroRight:a};var y,h=function(e){var t=e.sideCar,r=(0,n.__rest)(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var a=t.read();if(!a)throw new Error("Sidecar medium not found");return o.createElement(a,(0,n.__assign)({},r))};h.isSideCarExport=!0;function m(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=y||r.nc;return t&&e.setAttribute("nonce",t),e}var b=function(){var e=0,t=null;return{add:function(r){var n,o;0==e&&(t=m())&&(o=r,(n=t).styleSheet?n.styleSheet.cssText=o:n.appendChild(document.createTextNode(o)),function(e){(document.head||document.getElementsByTagName("head")[0]).appendChild(e)}(t)),e++},remove:function(){! --e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},_=function(){var e,t=(e=b(),function(t,r){o.useEffect((function(){return e.add(t),function(){e.remove()}}),[t&&r])});return function(e){var r=e.styles,n=e.dynamic;return t(r,n),null}},g={left:0,top:0,right:0,gap:0},w=function(e){return parseInt(e||"",10)||0},S=function(e){if(void 0===e&&(e="margin"),"undefined"==typeof window)return g;var t=function(e){var t=window.getComputedStyle(document.body),r=t["padding"===e?"paddingLeft":"marginLeft"],n=t["padding"===e?"paddingTop":"marginTop"],o=t["padding"===e?"paddingRight":"marginRight"];return[w(r),w(n),w(o)]}(e),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,n-r+t[2]-t[0])}},E=_(),P="data-scroll-locked",j=function(e,t,r,n){var o=e.left,c=e.top,u=e.right,s=e.gap;return void 0===r&&(r="margin"),"\n .".concat("with-scroll-bars-hidden"," {\n overflow: hidden ").concat(n,";\n padding-right: ").concat(s,"px ").concat(n,";\n }\n body[").concat(P,"] {\n overflow: hidden ").concat(n,";\n overscroll-behavior: contain;\n ").concat([t&&"position: relative ".concat(n,";"),"margin"===r&&"\n padding-left: ".concat(o,"px;\n padding-top: ").concat(c,"px;\n padding-right: ").concat(u,"px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(s,"px ").concat(n,";\n "),"padding"===r&&"padding-right: ".concat(s,"px ").concat(n,";")].filter(Boolean).join(""),"\n }\n \n .").concat(a," {\n right: ").concat(s,"px ").concat(n,";\n }\n \n .").concat(i," {\n margin-right: ").concat(s,"px ").concat(n,";\n }\n \n .").concat(a," .").concat(a," {\n right: 0 ").concat(n,";\n }\n \n .").concat(i," .").concat(i," {\n margin-right: 0 ").concat(n,";\n }\n \n body[").concat(P,"] {\n ").concat("--removed-body-scroll-bar-size",": ").concat(s,"px;\n }\n")},O=function(){var e=parseInt(document.body.getAttribute(P)||"0",10);return isFinite(e)?e:0},x=function(e){var t=e.noRelative,r=e.noImportant,n=e.gapMode,a=void 0===n?"margin":n;o.useEffect((function(){return document.body.setAttribute(P,(O()+1).toString()),function(){var e=O()-1;e<=0?document.body.removeAttribute(P):document.body.setAttribute(P,e.toString())}}),[]);var i=o.useMemo((function(){return S(a)}),[a]);return o.createElement(E,{styles:j(i,!t,a,r?"":"!important")})},T=!1;if("undefined"!=typeof window)try{var k=Object.defineProperty({},"passive",{get:function(){return T=!0,!0}});window.addEventListener("test",k,k),window.removeEventListener("test",k,k)}catch(e){T=!1}var C=!!T&&{passive:!1},M=function(e,t){var r=window.getComputedStyle(e);return"hidden"!==r[t]&&!(r.overflowY===r.overflowX&&!function(e){return"TEXTAREA"===e.tagName}(e)&&"visible"===r[t])},R=function(e,t){var r=t.ownerDocument,n=t;do{if("undefined"!=typeof ShadowRoot&&n instanceof ShadowRoot&&(n=n.host),N(e,n)){var o=F(e,n);if(o[1]>o[2])return!0}n=n.parentNode}while(n&&n!==r.body);return!1},N=function(e,t){return"v"===e?function(e){return M(e,"overflowY")}(t):function(e){return M(e,"overflowX")}(t)},F=function(e,t){return"v"===e?[(r=t).scrollTop,r.scrollHeight,r.clientHeight]:function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]}(t);var r},B=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},D=function(e){return[e.deltaX,e.deltaY]},I=function(e){return e&&"current"in e?e.current:e},A=function(e){return"\n .block-interactivity-".concat(e," {pointer-events: none;}\n .allow-interactivity-").concat(e," {pointer-events: all;}\n")},L=0,H=[];function W(e){for(var t=null;null!==e;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const q=(X=function(e){var t=o.useRef([]),r=o.useRef([0,0]),a=o.useRef(),i=o.useState(L++)[0],c=o.useState(_)[0],u=o.useRef(e);o.useEffect((function(){u.current=e}),[e]),o.useEffect((function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var t=(0,n.__spreadArray)([e.lockRef.current],(e.shards||[]).map(I),!0).filter(Boolean);return t.forEach((function(e){return e.classList.add("allow-interactivity-".concat(i))})),function(){document.body.classList.remove("block-interactivity-".concat(i)),t.forEach((function(e){return e.classList.remove("allow-interactivity-".concat(i))}))}}}),[e.inert,e.lockRef.current,e.shards]);var s=o.useCallback((function(e,t){if("touches"in e&&2===e.touches.length)return!u.current.allowPinchZoom;var n,o=B(e),i=r.current,c="deltaX"in e?e.deltaX:i[0]-o[0],s="deltaY"in e?e.deltaY:i[1]-o[1],l=e.target,d=Math.abs(c)>Math.abs(s)?"h":"v";if("touches"in e&&"h"===d&&"range"===l.type)return!1;var f=R(d,l);if(!f)return!0;if(f?n=d:(n="v"===d?"h":"v",f=R(d,l)),!f)return!1;if(!a.current&&"changedTouches"in e&&(c||s)&&(a.current=n),!n)return!0;var p=a.current||n;return function(e,t,r,n,o){var a=function(e,t){return"h"===e&&"rtl"===t?-1:1}(e,window.getComputedStyle(t).direction),i=a*n,c=r.target,u=t.contains(c),s=!1,l=i>0,d=0,f=0;do{var p=F(e,c),v=p[0],y=p[1]-p[2]-a*v;(v||y)&&N(e,c)&&(d+=y,f+=v),c=c instanceof ShadowRoot?c.host:c.parentNode}while(!u&&c!==document.body||u&&(t.contains(c)||t===c));return(l&&(o&&Math.abs(d)<1||!o&&i>d)||!l&&(o&&Math.abs(f)<1||!o&&-i>f))&&(s=!0),s}(p,t,e,"h"===p?c:s,!0)}),[]),l=o.useCallback((function(e){var r=e;if(H.length&&H[H.length-1]===c){var n="deltaY"in r?D(r):B(r),o=t.current.filter((function(e){return e.name===r.type&&(e.target===r.target||r.target===e.shadowParent)&&(t=e.delta,o=n,t[0]===o[0]&&t[1]===o[1]);var t,o}))[0];if(o&&o.should)r.cancelable&&r.preventDefault();else if(!o){var a=(u.current.shards||[]).map(I).filter(Boolean).filter((function(e){return e.contains(r.target)}));(a.length>0?s(r,a[0]):!u.current.noIsolation)&&r.cancelable&&r.preventDefault()}}}),[]),d=o.useCallback((function(e,r,n,o){var a={name:e,delta:r,target:n,should:o,shadowParent:W(n)};t.current.push(a),setTimeout((function(){t.current=t.current.filter((function(e){return e!==a}))}),1)}),[]),f=o.useCallback((function(e){r.current=B(e),a.current=void 0}),[]),p=o.useCallback((function(t){d(t.type,D(t),t.target,s(t,e.lockRef.current))}),[]),v=o.useCallback((function(t){d(t.type,B(t),t.target,s(t,e.lockRef.current))}),[]);o.useEffect((function(){return H.push(c),e.setCallbacks({onScrollCapture:p,onWheelCapture:p,onTouchMoveCapture:v}),document.addEventListener("wheel",l,C),document.addEventListener("touchmove",l,C),document.addEventListener("touchstart",f,C),function(){H=H.filter((function(e){return e!==c})),document.removeEventListener("wheel",l,C),document.removeEventListener("touchmove",l,C),document.removeEventListener("touchstart",f,C)}}),[]);var y=e.removeScrollBar,h=e.inert;return o.createElement(o.Fragment,null,h?o.createElement(c,{styles:A(i)}):null,y?o.createElement(x,{gapMode:e.gapMode}):null)},f.useMedium(X),h);var X,Y=o.forwardRef((function(e,t){return o.createElement(v,(0,n.__assign)({},e,{ref:t,sideCar:q}))}));Y.classNames=v.classNames;const z=Y},288:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Sidebar=void 0;const n=r(769).__importDefault(r(155)),o=r(822),a=r(955),i=r(367),c=r(337),u=({className:e,style:t,position:r="right",maxWidth:c="375px",open:u=!1,needRemoveScroll:s=!1,children:l,onRemove:d,...f})=>{const{className:p,style:v,otherProps:y}=i.sidebar.sprinkle({...f,maxWidth:c}),{refThemeProvider:h}=(0,i.useTheme)(),{context:m}=(0,a.useFloating)({open:u,onOpenChange:d}),b=(0,a.useDismiss)(m,{outsidePressEvent:"mousedown"}),{getFloatingProps:_}=(0,a.useInteractions)([b]);return u?n.default.createElement(a.FloatingPortal,{id:"nimbus-sidebar",root:h?.current},n.default.createElement(a.FloatingOverlay,{className:i.sidebar.classnames.overlay,"data-testid":"overlay-sidebar-button",lockScroll:!s},n.default.createElement(a.FloatingFocusManager,{context:m},n.default.createElement("div",{...y,ref:m.refs.setFloating,role:f.role||"presentation",style:v,..._(),className:[i.sidebar.classnames.container,i.sidebar.classnames.position[r],p,u&&i.sidebar.classnames.isVisible].join(" ")},s?n.default.createElement(o.RemoveScroll,null,l):l)))):null};t.Sidebar=u,u.Body=c.SidebarBody,u.Footer=c.SidebarFooter,u.Header=c.SidebarHeader,u.displayName="Sidebar",u.Body.displayName="Sidebar.Body",u.Footer.displayName="Sidebar.Footer",u.Header.displayName="Sidebar.Header"},982:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SidebarBody=void 0;const n=r(769).__importDefault(r(155)),o=r(367);t.SidebarBody=({className:e,style:t,children:r,...a})=>{const{className:i,style:c,otherProps:u}=o.sidebar.sprinkle(a);return n.default.createElement("div",{...u,style:c,className:[o.sidebar.classnames.container__body,i].join(" ")},r)}},598:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SidebarBody=void 0;const n=r(982);var o=r(982);Object.defineProperty(t,"SidebarBody",{enumerable:!0,get:function(){return o.SidebarBody}}),t.default=n.SidebarBody},894:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SidebarFooter=void 0;const n=r(769).__importDefault(r(155)),o=r(367);t.SidebarFooter=({className:e,style:t,children:r,...a})=>{const{className:i,style:c,otherProps:u}=o.sidebar.sprinkle(a);return n.default.createElement("div",{...u,style:c,className:[i,o.sidebar.classnames.container__footer].join(" ")},r)}},25:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SidebarFooter=void 0;const n=r(894);var o=r(894);Object.defineProperty(t,"SidebarFooter",{enumerable:!0,get:function(){return o.SidebarFooter}}),t.default=n.SidebarFooter},342:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SidebarHeader=void 0;const n=r(769).__importDefault(r(155)),o=r(593),a=r(367);t.SidebarHeader=({className:e,style:t,title:r,children:i,...c})=>{const{className:u,style:s,otherProps:l}=a.sidebar.sprinkle(c);return n.default.createElement("div",{...l,style:s,className:[u,a.sidebar.classnames.container__header].join(" ")},r&&n.default.createElement(o.Title,{as:"h2","data-testid":"header-title"},r),i)}},331:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SidebarHeader=void 0;const n=r(342);var o=r(342);Object.defineProperty(t,"SidebarHeader",{enumerable:!0,get:function(){return o.SidebarHeader}}),t.default=n.SidebarHeader},337:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=r(769);n.__exportStar(r(598),t),n.__exportStar(r(25),t),n.__exportStar(r(331),t)},955:e=>{e.exports=t},367:e=>{e.exports=r},593:e=>{e.exports=n},155:t=>{t.exports=e},769:(e,t,r)=>{r.r(t),r.d(t,{__addDisposableResource:()=>F,__assign:()=>a,__asyncDelegator:()=>j,__asyncGenerator:()=>P,__asyncValues:()=>O,__await:()=>E,__awaiter:()=>v,__classPrivateFieldGet:()=>M,__classPrivateFieldIn:()=>N,__classPrivateFieldSet:()=>R,__createBinding:()=>h,__decorate:()=>c,__disposeResources:()=>D,__esDecorate:()=>s,__exportStar:()=>m,__extends:()=>o,__generator:()=>y,__importDefault:()=>C,__importStar:()=>k,__makeTemplateObject:()=>x,__metadata:()=>p,__param:()=>u,__propKey:()=>d,__read:()=>_,__rest:()=>i,__runInitializers:()=>l,__setFunctionName:()=>f,__spread:()=>g,__spreadArray:()=>S,__spreadArrays:()=>w,__values:()=>b,default:()=>I});var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)};function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var a=function(){return a=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},a.apply(this,arguments)};function i(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r}function c(e,t,r,n){var o,a=arguments.length,i=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,n);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(i=(a<3?o(i):a>3?o(t,r,i):o(t,r))||i);return a>3&&i&&Object.defineProperty(t,r,i),i}function u(e,t){return function(r,n){t(r,n,e)}}function s(e,t,r,n,o,a){function i(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var c,u=n.kind,s="getter"===u?"get":"setter"===u?"set":"value",l=!t&&e?n.static?e:e.prototype:null,d=t||(l?Object.getOwnPropertyDescriptor(l,n.name):{}),f=!1,p=r.length-1;p>=0;p--){var v={};for(var y in n)v[y]="access"===y?{}:n[y];for(var y in n.access)v.access[y]=n.access[y];v.addInitializer=function(e){if(f)throw new TypeError("Cannot add initializers after decoration has completed");a.push(i(e||null))};var h=(0,r[p])("accessor"===u?{get:d.get,set:d.set}:d[s],v);if("accessor"===u){if(void 0===h)continue;if(null===h||"object"!=typeof h)throw new TypeError("Object expected");(c=i(h.get))&&(d.get=c),(c=i(h.set))&&(d.set=c),(c=i(h.init))&&o.unshift(c)}else(c=i(h))&&("field"===u?o.unshift(c):d[s]=c)}l&&Object.defineProperty(l,n.name,d),f=!0}function l(e,t,r){for(var n=arguments.length>2,o=0;o<t.length;o++)r=n?t[o].call(e,r):t[o].call(e);return n?r:void 0}function d(e){return"symbol"==typeof e?e:"".concat(e)}function f(e,t,r){return"symbol"==typeof t&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:r?"".concat(r," ",t):t})}function p(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function v(e,t,r,n){return new(r||(r=Promise))((function(o,a){function i(e){try{u(n.next(e))}catch(e){a(e)}}function c(e){try{u(n.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,c)}u((n=n.apply(e,t||[])).next())}))}function y(e,t){var r,n,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function c(c){return function(u){return function(c){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(i=0)),i;)try{if(r=1,n&&(o=2&c[0]?n.return:c[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;switch(n=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,n=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=t.call(e,i)}catch(e){c=[6,e],n=0}finally{r=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,u])}}}var h=Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]};function m(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||h(t,e,r)}function b(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function _(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,a=r.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)i.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(o)throw o.error}}return i}function g(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(_(arguments[t]));return e}function w(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;var n=Array(e),o=0;for(t=0;t<r;t++)for(var a=arguments[t],i=0,c=a.length;i<c;i++,o++)n[o]=a[i];return n}function S(e,t,r){if(r||2===arguments.length)for(var n,o=0,a=t.length;o<a;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))}function E(e){return this instanceof E?(this.v=e,this):new E(e)}function P(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,o=r.apply(e,t||[]),a=[];return n={},i("next"),i("throw"),i("return"),n[Symbol.asyncIterator]=function(){return this},n;function i(e){o[e]&&(n[e]=function(t){return new Promise((function(r,n){a.push([e,t,r,n])>1||c(e,t)}))})}function c(e,t){try{(r=o[e](t)).value instanceof E?Promise.resolve(r.value.v).then(u,s):l(a[0][2],r)}catch(e){l(a[0][3],e)}var r}function u(e){c("next",e)}function s(e){c("throw",e)}function l(e,t){e(t),a.shift(),a.length&&c(a[0][0],a[0][1])}}function j(e){var t,r;return t={},n("next"),n("throw",(function(e){throw e})),n("return"),t[Symbol.iterator]=function(){return this},t;function n(n,o){t[n]=e[n]?function(t){return(r=!r)?{value:E(e[n](t)),done:!1}:o?o(t):t}:o}}function O(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=b(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise((function(n,o){(function(e,t,r,n){Promise.resolve(n).then((function(t){e({value:t,done:r})}),t)})(n,o,(t=e[r](t)).done,t.value)}))}}}function x(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var T=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t};function k(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&h(t,e,r);return T(t,e),t}function C(e){return e&&e.__esModule?e:{default:e}}function M(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}function R(e,t,r,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?o.call(e,r):o?o.value=r:t.set(e,r),r}function N(e,t){if(null===t||"object"!=typeof t&&"function"!=typeof t)throw new TypeError("Cannot use 'in' operator on non-object");return"function"==typeof e?t===e:e.has(t)}function F(e,t,r){if(null!=t){if("object"!=typeof t&&"function"!=typeof t)throw new TypeError("Object expected.");var n;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");n=t[Symbol.asyncDispose]}if(void 0===n){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");n=t[Symbol.dispose]}if("function"!=typeof n)throw new TypeError("Object not disposable.");e.stack.push({value:t,dispose:n,async:r})}else r&&e.stack.push({async:!0});return t}var B="function"==typeof SuppressedError?SuppressedError:function(e,t,r){var n=new Error(r);return n.name="SuppressedError",n.error=e,n.suppressed=t,n};function D(e){function t(t){e.error=e.hasError?new B(t,e.error,"An error was suppressed during disposal."):t,e.hasError=!0}return function r(){for(;e.stack.length;){var n=e.stack.pop();try{var o=n.dispose&&n.dispose.call(n.value);if(n.async)return Promise.resolve(o).then(r,(function(e){return t(e),r()}))}catch(e){t(e)}}if(e.hasError)throw e.error}()}const I={__extends:o,__assign:a,__rest:i,__decorate:c,__param:u,__metadata:p,__awaiter:v,__generator:y,__createBinding:h,__exportStar:m,__values:b,__read:_,__spread:g,__spreadArrays:w,__spreadArray:S,__await:E,__asyncGenerator:P,__asyncDelegator:j,__asyncValues:O,__makeTemplateObject:x,__importStar:k,__importDefault:C,__classPrivateFieldGet:M,__classPrivateFieldSet:R,__classPrivateFieldIn:N,__addDisposableResource:F,__disposeResources:D}}},a={};function i(e){var t=a[e];if(void 0!==t)return t.exports;var r=a[e]={exports:{}};return o[e](r,r.exports,i),r.exports}i.d=(e,t)=>{for(var r in t)i.o(t,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.nc=void 0;var c={};return(()=>{var e=c;Object.defineProperty(e,"__esModule",{value:!0}),e.Sidebar=void 0;const t=i(288);var r=i(288);Object.defineProperty(e,"Sidebar",{enumerable:!0,get:function(){return r.Sidebar}}),e.default=t.Sidebar})(),c})()));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nimbus-ds/sidebar",
3
- "version": "3.4.0-rc.2",
3
+ "version": "3.4.0",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "files": [
@@ -15,7 +15,7 @@
15
15
  },
16
16
  "dependencies": {
17
17
  "@floating-ui/react": "^0.26.0",
18
- "@nimbus-ds/title": "^3.2.0-rc.2",
18
+ "@nimbus-ds/title": "^3.1.3",
19
19
  "react-remove-scroll": "2.5.7"
20
20
  },
21
21
  "peerDependencies": {
@@ -31,10 +31,9 @@
31
31
  "url": "https://github.com/TiendaNube/nimbus-design-system/issues"
32
32
  },
33
33
  "devDependencies": {
34
- "@nimbus-ds/box": "^4.2.0-rc.2",
35
- "@nimbus-ds/button": "^2.6.0-rc.2",
36
- "@nimbus-ds/text": "^6.4.0-rc.2",
37
- "@nimbus-ds/webpack": "^1.4.0"
38
- },
39
- "stableVersion": "3.3.1"
34
+ "@nimbus-ds/box": "^4.1.1",
35
+ "@nimbus-ds/button": "^2.6.0",
36
+ "@nimbus-ds/text": "^6.3.1",
37
+ "@nimbus-ds/webpack": "^1.5.0"
38
+ }
40
39
  }