@nimbus-ds/menubutton 1.7.0-rc.1 → 1.8.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 ADDED
@@ -0,0 +1,130 @@
1
+ # Changelog
2
+
3
+ MenuButton component is meant to be used inside Menus and navigation, and allows the user to navigate between different sections of an application.
4
+
5
+ ## 2025-08-05 `1.7.0`
6
+
7
+ #### 🎉 New features
8
+
9
+ - Updated MenuButton icon size from 14px to 16px for better visual consistency. ([#115](https://github.com/TiendaNube/nimbus-patterns/pull/115) by [@noecondoleo](https://github.com/noecondoleo) [@FedeTrevi-se](https://github.com/FedeTrevi-se))
10
+
11
+ ## 2025-03-18 `1.6.0`
12
+
13
+ #### 🎉 New features
14
+
15
+ - Adds `use-client` directive to the build output in order to support NextJS applications. ([#104](https://github.com/TiendaNube/nimbus-patterns/pull/104) by [@joacotornello](https://github.com/joacotornello))
16
+
17
+ ### 💡 Others
18
+
19
+ - Rebuild after build process changes to add support for modular imports and Server Components. ([#104](https://github.com/TiendaNube/nimbus-patterns/pull/104) by [@joacotornello](https://github.com/joacotornello))
20
+
21
+ ## 2024-02-07 `1.5.5`
22
+
23
+ ### 🎉 New features
24
+
25
+ - Add `wordBreak="break-all"` property to allow overflowing text to be trimmed at any position. ([#94](https://github.com/TiendaNube/nimbus-patterns/pull/94) by [@juanchigallego](https://github.com/juanchigallego))
26
+
27
+ ## 2024-01-09 `1.5.4`
28
+
29
+ #### 🐛 Bug fixes
30
+
31
+ - Remove visual focus box-shadow from `MenuButton` component because it visually hints the element is on focus even after an action has been performed. ([#93](https://github.com/TiendaNube/nimbus-patterns/pull/93) by [@juanchigallego](https://github.com/juanchigallego))
32
+
33
+ ## 2023-12-18 `1.5.3`
34
+
35
+ ### 🎉 New features
36
+
37
+ - Adjust component padding and size of the icon child. ([#90](https://github.com/TiendaNube/nimbus-patterns/pull/90) by [@juanchigallego](https://github.com/juanchigallego))
38
+ - Adjust padding on `MenuButtonAccordion` subcomponent. ([#90](https://github.com/TiendaNube/nimbus-patterns/pull/90) by [@juanchigallego](https://github.com/juanchigallego))
39
+
40
+ ## 2023-06-15 `1.5.2`
41
+
42
+ #### 💡 Others
43
+
44
+ - Removed module key from `package.json`. ([#62](https://github.com/TiendaNube/nimbus-patterns/pull/62) by [@juniorconquista](https://github.com/juniorconquista))
45
+
46
+ ## 2023-05-23 `1.5.0`
47
+
48
+ #### 📚 3rd party library updates
49
+
50
+ - Updated `@nimbus-ds/components@4.x` to `@nimbus-ds/components@5.x`. ([#56](https://github.com/TiendaNube/nimbus-patterns/pull/56) by [@juniorconquista](https://github.com/juniorconquista))
51
+
52
+ ## 2023-05-08 `1.4.0`
53
+
54
+ ### 🎉 New features
55
+
56
+ - Added `as` property to the `MenuButton.Accordion` component API. ([#50](https://github.com/TiendaNube/nimbus-patterns/pull/50) by [@juniorconquista](https://github.com/juniorconquista))
57
+
58
+ ## 2023-04-24 `1.3.1`
59
+
60
+ #### 🐛 Bug fixes
61
+
62
+ - Renamed `controlled` property to `open` in `MenuButton.Accordion` component API. ([#48](https://github.com/TiendaNube/nimbus-patterns/pull/48) by [@juniorconquista](https://github.com/juniorconquista))
63
+ - Changed the background color of the `MenuButton.Accordion` component when it is open. ([#48](https://github.com/TiendaNube/nimbus-patterns/pull/48) by [@juniorconquista](https://github.com/juniorconquista))
64
+
65
+ ## 2023-04-12 `1.3.0`
66
+
67
+ #### 🎉 New features
68
+
69
+ - Added `MenuButton.Accordion` subcomponent. ([#44](https://github.com/TiendaNube/nimbus-patterns/pull/44) by [@juniorconquista](https://github.com/juniorconquista))
70
+
71
+ ## 2023-04-04 `1.2.0`
72
+
73
+ #### 🎉 New features
74
+
75
+ - Added `as` property to the `MenuButton` component API. ([#32](https://github.com/TiendaNube/nimbus-patterns/pull/32) by [@juniorconquista](https://github.com/juniorconquista))
76
+
77
+ #### 📚 3rd party library updates
78
+
79
+ - Added `@nimbus-ds/typings@1.1.0`. ([#32](https://github.com/TiendaNube/nimbus-patterns/pull/32) by [@juniorconquista](https://github.com/juniorconquista))
80
+ - Updated `@nimbus-ds/components@4.x`. ([#32](https://github.com/TiendaNube/nimbus-patterns/pull/32) by [@juniorconquista](https://github.com/juniorconquista))
81
+ - Updated `@nimbus-ds/components@4.x`. ([#32](https://github.com/TiendaNube/nimbus-patterns/pull/32) by [@juniorconquista](https://github.com/juniorconquista))
82
+ - Removed `@nimbus-ds/styles@7.0.0`. ([#32](https://github.com/TiendaNube/nimbus-patterns/pull/32) by [@juniorconquista](https://github.com/juniorconquista))
83
+
84
+ ## 2023-03-20 `1.1.2`
85
+
86
+ ### 📚 3rd party library updates
87
+
88
+ - Updated `@nimbus-ds/styles@7.0.0`. ([#27](https://github.com/TiendaNube/nimbus-patterns/pull/27) by [@juanchigallego](https://github.com/juanchigallego))
89
+
90
+ ### 💡 Others
91
+
92
+ - Updated props to match current versions of `components` and `styles`. ([#27](https://github.com/TiendaNube/nimbus-patterns/pull/27) by [@juanchigallego](https://github.com/juanchigallego))
93
+
94
+ ## 2023-03-13 `1.1.1`
95
+
96
+ ### 📚 Documentation
97
+
98
+ - Add props documentation. ([#26](https://github.com/TiendaNube/nimbus-patterns/pull/26) by [@juanchigallego](https://github.com/juanchigallego))
99
+
100
+ ## 2023-02-17 `1.1.0`
101
+
102
+ ### 🎉 New features
103
+
104
+ - Removed external dependency from `@tiendanube/icons` package to now use internal `@nimbus-ds/icons` package. ([#15](https://github.com/TiendaNube/nimbus-design-system/pull/#15) by [@juniorconquista](https://github.com/juniorconquista))
105
+
106
+ ### 📚 3rd party library updates
107
+
108
+ - Added `@nimbus-ds/components@2.8.0`. ([#20](https://github.com/TiendaNube/nimbus-patterns/pull/20) by [@juniorconquista](https://github.com/juniorconquista))
109
+ - Added `@nimbus-ds/styles@6.11.0`. ([#20](https://github.com/TiendaNube/nimbus-patterns/pull/20) by [@juniorconquista](https://github.com/juniorconquista))
110
+ - Added `@nimbus-ds/icons@1.0.0`. ([#20](https://github.com/TiendaNube/nimbus-patterns/pull/20) by [@juniorconquista](https://github.com/juniorconquista))
111
+ - Removed `@nimbus-ds/icon@2.0.0`. ([#20](https://github.com/TiendaNube/nimbus-patterns/pull/20) by [@juniorconquista](https://github.com/juniorconquista))
112
+ - Removed `@nimbus-ds/text@5.0.0`. ([#20](https://github.com/TiendaNube/nimbus-patterns/pull/20) by [@juniorconquista](https://github.com/juniorconquista))
113
+ - Removed `@nimbus-ds/box@2.4.0`. ([#20](https://github.com/TiendaNube/nimbus-patterns/pull/20) by [@juniorconquista](https://github.com/juniorconquista))
114
+ - Removed `@tiendanube/icons@0.3.1`. ([#20](https://github.com/TiendaNube/nimbus-patterns/pull/20) by [@juniorconquista](https://github.com/juniorconquista))
115
+
116
+ ## 2023-02-10 `1.0.0`
117
+
118
+ ### 📚 3rd party library updates
119
+
120
+ - Added `@nimbus-ds/icon@2.0.0`. ([#14](https://github.com/TiendaNube/nimbus-patterns/pull/14) by [@juanchigallego](https://github.com/juanchigallego))
121
+ - Added `@nimbus-ds/box@2.4.0`. ([#14](https://github.com/TiendaNube/nimbus-patterns/pull/14) by [@juanchigallego](https://github.com/juanchigallego))
122
+ - Added `@nimbus-ds/text@5.0.0`. ([#14](https://github.com/TiendaNube/nimbus-patterns/pull/14) by [@juanchigallego](https://github.com/juanchigallego))
123
+ - Added `@nimbus-ds/tokens@6.0.1`. ([#14](https://github.com/TiendaNube/nimbus-patterns/pull/14) by [@juanchigallego](https://github.com/juanchigallego))
124
+ - Added `@tiendanube/icons@0.3.2`. ([#14](https://github.com/TiendaNube/nimbus-patterns/pull/14) by [@juanchigallego](https://github.com/juanchigallego))
125
+
126
+ ### 🎉 New features
127
+
128
+ - Added `MenuButton` component. ([#14](https://github.com/TiendaNube/nimbus-patterns/pull/14) by [@juanchigallego](https://github.com/juanchigallego))
129
+ - Added `label`, `onClick`, `startIcon`, `active` and `children` properties to the `MenuButton` component API. ([#14](https://github.com/TiendaNube/nimbus-patterns/pull/14) by [@juanchigallego](https://github.com/juanchigallego))
130
+ - Added story documentation in Storybook. ([#14](https://github.com/TiendaNube/nimbus-patterns/pull/14) by [@juanchigallego](https://github.com/juanchigallego))
package/dist/CHANGELOG.md CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  MenuButton component is meant to be used inside Menus and navigation, and allows the user to navigate between different sections of an application.
4
4
 
5
- ## 2025-01-09 `1.6.1`
5
+ ## 2025-08-05 `1.7.0`
6
6
 
7
- #### 💡 Others
7
+ #### 🎉 New features
8
8
 
9
- - Updated icon size from 14px to 16px for better visual consistency. ([#115](https://github.com/TiendaNube/nimbus-patterns/pull/115) by [@FedeTrevi-se](https://github.com/FedeTrevi-se))
9
+ - Updated MenuButton icon size from 14px to 16px for better visual consistency. ([#115](https://github.com/TiendaNube/nimbus-patterns/pull/115) by [@noecondoleo](https://github.com/noecondoleo) [@FedeTrevi-se](https://github.com/FedeTrevi-se))
10
10
 
11
11
  ## 2025-03-18 `1.6.0`
12
12
 
package/dist/index.d.ts CHANGED
@@ -27,6 +27,12 @@ export interface MenuButtonAccordionProperties {
27
27
  * Sets the state of the button as active/inactive.
28
28
  */
29
29
  active?: boolean;
30
+ /**
31
+ * Whether the MenuButtonAccordion is expanded.
32
+ * If `undefined`, it follows `MenuExpandContext`.
33
+ * If provided, it overrides the context.
34
+ */
35
+ expanded?: boolean;
30
36
  }
31
37
  export type MenuButtonAccordionBaseProps = MenuButtonAccordionProperties & {
32
38
  menuButton: MenuButtonProps;
@@ -39,7 +45,7 @@ export interface MenuButtonProperties {
39
45
  /**
40
46
  * Text label for the button.
41
47
  */
42
- label: string;
48
+ label?: string;
43
49
  /**
44
50
  * Function executed when clicking the button.
45
51
  * @TJS-type () => void;
@@ -59,6 +65,13 @@ export interface MenuButtonProperties {
59
65
  * @TJS-type React.ReactNode
60
66
  */
61
67
  children?: ReactNode;
68
+ /**
69
+ * Controlled override for menu expansion state. This prop does not manage internal state
70
+ * and is not forwarded to the DOM as an attribute. It is used only for layout and visual
71
+ * state determination.
72
+ * If not provided, the expanded state will be determined by the context.
73
+ */
74
+ expanded?: boolean;
62
75
  }
63
76
  export type MenuButtonBaseProps = MenuButtonProperties & Omit<ButtonHTMLAttributes<HTMLButtonElement>, "color">;
64
77
  export declare const MenuButton: PolymorphicForwardRefComponent<"button" | "a", MenuButtonBaseProps> & MenuButtonComponents;
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("@nimbus-ds/components")):"function"==typeof define&&define.amd?define(["react","@nimbus-ds/components"],t):"object"==typeof exports?exports["@nimbus-ds/menubutton"]=t(require("react"),require("@nimbus-ds/components")):e["@nimbus-ds/menubutton"]=t(e.react,e["@nimbus-ds/components"])}(global,((e,t)=>(()=>{"use strict";var r={492:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MenuButton=void 0;const n=r(15).__importStar(r(156)),o=r(280),a=r(612),i=(0,n.forwardRef)((({className:e,style:t,label:r,onClick:a,startIcon:i,children:c,active:u=!1,as:l="button",...f},s)=>{const p=u?"primary-interactive":"neutral-textHigh",d=f.disabled?"neutral-textDisabled":p;return n.default.createElement(o.Box,{...f,ref:s,as:l,type:"button",onClick:a,alignItems:"center",textDecoration:"none",backgroundColor:{xs:u?"primary-surface":"transparent",hover:"primary-surface",active:"primary-surfaceHighlight",disabled:"neutral-surfaceDisabled"},borderRadius:"2",borderWidth:"none",cursor:{xs:"pointer",disabled:"not-allowed"},display:"flex",gap:"2",px:"2",py:{xs:"2",md:"1"},width:"100%",transitionProperty:"all",transitionDuration:"base",transitionTimingFunction:"ease-in-out",maxHeight:{xs:"34px",md:"26px"}},i&&n.default.createElement(o.Icon,{color:d,source:n.default.createElement(i,{size:16})}),n.default.createElement(o.Box,{display:"inline-flex",flex:"1"},n.default.createElement(o.Text,{fontSize:"base",color:d,lineClamp:1,wordBreak:"break-all"},r)),c)}));t.MenuButton=i,i.Accordion=a.MenuButtonAccordion,i.displayName="MenuButton",i.Accordion.displayName="MenuButton.Accordion"},112:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MenuButtonAccordion=void 0;const n=r(15).__importStar(r(156)),o=r(280),a=r(492),i=(0,n.forwardRef)((({className:e,style:t,open:r,active:i,menuButton:c,children:u,as:l,...f},s)=>{const[p,d]=(0,n.useState)(!1),y=(0,n.useMemo)((()=>void 0===r?p:r),[r,p]);return n.default.createElement(o.Box,{...f,ref:s,as:l,backgroundColor:i?"primary-surface":y?"neutral-surface":"transparent",borderRadius:"2",zIndex:y?"100":void 0,textDecoration:"none"},n.default.createElement(a.MenuButton,{...c,onClick:void 0!==r?c.onClick:()=>d((e=>!e)),active:i,"aria-expanded":y}),y&&n.default.createElement(o.Box,{id:"content-1","aria-hidden":!y,height:y?"auto":"0",overflow:"hidden",display:"flex",flexDirection:"column",gap:"0-5",pl:"6",pb:"1",pr:"1"},u))}));t.MenuButtonAccordion=i,i.displayName="MenuButtonAccordion"},414:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MenuButtonAccordion=void 0;const n=r(112);var o=r(112);Object.defineProperty(t,"MenuButtonAccordion",{enumerable:!0,get:function(){return o.MenuButtonAccordion}}),t.default=n.MenuButtonAccordion},612:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});r(15).__exportStar(r(414),t)},15:(e,t,r)=>{r.r(t),r.d(t,{__assign:()=>a,__asyncDelegator:()=>P,__asyncGenerator:()=>j,__asyncValues:()=>S,__await:()=>O,__awaiter:()=>y,__classPrivateFieldGet:()=>A,__classPrivateFieldIn:()=>k,__classPrivateFieldSet:()=>I,__createBinding:()=>v,__decorate:()=>c,__esDecorate:()=>l,__exportStar:()=>m,__extends:()=>o,__generator:()=>b,__importDefault:()=>T,__importStar:()=>E,__makeTemplateObject:()=>M,__metadata:()=>d,__param:()=>u,__propKey:()=>s,__read:()=>_,__rest:()=>i,__runInitializers:()=>f,__setFunctionName:()=>p,__spread:()=>w,__spreadArray:()=>x,__spreadArrays:()=>g,__values:()=>h});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 l(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,l="getter"===u?"get":"setter"===u?"set":"value",f=!t&&e?n.static?e:e.prototype:null,s=t||(f?Object.getOwnPropertyDescriptor(f,n.name):{}),p=!1,d=r.length-1;d>=0;d--){var y={};for(var b in n)y[b]="access"===b?{}:n[b];for(var b in n.access)y.access[b]=n.access[b];y.addInitializer=function(e){if(p)throw new TypeError("Cannot add initializers after decoration has completed");a.push(i(e||null))};var v=(0,r[d])("accessor"===u?{get:s.get,set:s.set}:s[l],y);if("accessor"===u){if(void 0===v)continue;if(null===v||"object"!=typeof v)throw new TypeError("Object expected");(c=i(v.get))&&(s.get=c),(c=i(v.set))&&(s.set=c),(c=i(v.init))&&o.push(c)}else(c=i(v))&&("field"===u?o.push(c):s[l]=c)}f&&Object.defineProperty(f,n.name,s),p=!0}function f(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 s(e){return"symbol"==typeof e?e:"".concat(e)}function p(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 d(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function y(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 b(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 v=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)||v(t,e,r)}function h(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 w(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(_(arguments[t]));return e}function g(){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 x(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 O(e){return this instanceof O?(this.v=e,this):new O(e)}function j(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 O?Promise.resolve(r.value.v).then(u,l):f(a[0][2],r)}catch(e){f(a[0][3],e)}var r}function u(e){c("next",e)}function l(e){c("throw",e)}function f(e,t){e(t),a.shift(),a.length&&c(a[0][0],a[0][1])}}function P(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:O(e[n](t)),done:!1}:o?o(t):t}:o}}function S(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=h(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 M(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var B=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t};function E(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)&&v(t,e,r);return B(t,e),t}function T(e){return e&&e.__esModule?e:{default:e}}function A(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 I(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 k(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)}},280:e=>{e.exports=t},156:t=>{t.exports=e}},n={};function o(e){var t=n[e];if(void 0!==t)return t.exports;var a=n[e]={exports:{}};return r[e](a,a.exports,o),a.exports}o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};return(()=>{var e=a;Object.defineProperty(e,"__esModule",{value:!0}),e.MenuButton=void 0;const t=o(492);var r=o(492);Object.defineProperty(e,"MenuButton",{enumerable:!0,get:function(){return r.MenuButton}}),e.default=t.MenuButton})(),a})()));
2
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("@nimbus-ds/components")):"function"==typeof define&&define.amd?define(["react","@nimbus-ds/components"],t):"object"==typeof exports?exports["@nimbus-ds/menubutton"]=t(require("react"),require("@nimbus-ds/components")):e["@nimbus-ds/menubutton"]=t(e.react,e["@nimbus-ds/components"])}(global,((e,t)=>(()=>{"use strict";var n={390:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.initialMenuContext=void 0,t.initialMenuContext={expanded:!0}},81:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.useMenuExpandContext=t.MenuExpandContext=void 0;const r=n(156),o=n(390),a=(0,r.createContext)(void 0);t.MenuExpandContext=a;t.useMenuExpandContext=(e=!0)=>{const t=(0,r.useContext)(a);if(void 0===t){if(!e)return o.initialMenuContext;throw new Error("Menu subcomponents must be used within MenuExpandContext.Provider")}return t}},843:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.useMenuExpandContext=t.MenuExpandContext=void 0;var r=n(81);Object.defineProperty(t,"MenuExpandContext",{enumerable:!0,get:function(){return r.MenuExpandContext}}),Object.defineProperty(t,"useMenuExpandContext",{enumerable:!0,get:function(){return r.useMenuExpandContext}})},492:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MenuButton=void 0;const r=n(15).__importStar(n(156)),o=n(280),a=n(843),i=n(612),u=(0,r.forwardRef)((({className:e,style:t,label:n,onClick:i,startIcon:u,children:c,active:l=!1,as:f="button",expanded:s,...d},p)=>{const{expanded:y}=(0,a.useMenuExpandContext)(!1),b=s??y,v=l?"primary-interactive":"neutral-textHigh",m=d.disabled?"neutral-textDisabled":v,h=b?{}:{justifyContent:"center",paddingX:"none"};return r.default.createElement(o.Box,{...d,ref:p,as:f,type:"button",onClick:i,alignItems:"center",textDecoration:"none",backgroundColor:{xs:l?"primary-surface":"transparent",hover:"primary-surface",active:"primary-surfaceHighlight",disabled:"neutral-surfaceDisabled"},borderRadius:"2",borderWidth:"none",cursor:{xs:"pointer",disabled:"not-allowed"},display:"flex",gap:"2",px:"2",py:{xs:"2",md:"1"},width:"100%",transitionProperty:"all",transitionDuration:"base",transitionTimingFunction:"ease-in-out",maxHeight:{xs:"34px",md:"26px"},...h},u&&r.default.createElement(o.Icon,{color:m,source:r.default.createElement(u,{size:16})}),b&&r.default.createElement(o.Box,{display:"inline-flex",flex:"1"},r.default.createElement(o.Text,{fontSize:"base",color:m,lineClamp:1,wordBreak:"break-all"},n)),b&&c)}));t.MenuButton=u,u.Accordion=i.MenuButtonAccordion,u.displayName="MenuButton",u.Accordion.displayName="MenuButton.Accordion"},112:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MenuButtonAccordion=void 0;const r=n(15).__importStar(n(156)),o=n(280),a=n(843),i=n(492),u=(0,r.forwardRef)((({className:e,style:t,open:n,active:u,menuButton:c,children:l,as:f,expanded:s,...d},p)=>{const{expanded:y}=(0,a.useMenuExpandContext)(!1),b=s??y,[v,m]=(0,r.useState)(!1),h=(0,r.useMemo)((()=>n??v),[n,v]);return r.default.createElement(o.Box,{...d,ref:p,as:f,backgroundColor:u?"primary-surface":h?"neutral-surface":"transparent",borderRadius:"2",zIndex:h?"100":void 0,textDecoration:"none"},r.default.createElement(i.MenuButton,{...c,onClick:void 0!==n?c.onClick:()=>m((e=>!e)),active:u,"aria-expanded":h&&b}),h&&b&&r.default.createElement(o.Box,{id:"content-1","aria-hidden":!h,height:h?"auto":"0",overflow:"hidden",display:"flex",flexDirection:"column",gap:"0-5",pl:"6",pb:"1",pr:"1"},l))}));t.MenuButtonAccordion=u,u.displayName="MenuButtonAccordion"},414:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MenuButtonAccordion=void 0;const r=n(112);var o=n(112);Object.defineProperty(t,"MenuButtonAccordion",{enumerable:!0,get:function(){return o.MenuButtonAccordion}}),t.default=r.MenuButtonAccordion},612:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});n(15).__exportStar(n(414),t)},15:(e,t,n)=>{n.r(t),n.d(t,{__assign:()=>a,__asyncDelegator:()=>M,__asyncGenerator:()=>j,__asyncValues:()=>P,__await:()=>O,__awaiter:()=>y,__classPrivateFieldGet:()=>T,__classPrivateFieldIn:()=>I,__classPrivateFieldSet:()=>A,__createBinding:()=>v,__decorate:()=>u,__esDecorate:()=>l,__exportStar:()=>m,__extends:()=>o,__generator:()=>b,__importDefault:()=>B,__importStar:()=>S,__makeTemplateObject:()=>E,__metadata:()=>p,__param:()=>c,__propKey:()=>s,__read:()=>_,__rest:()=>i,__runInitializers:()=>f,__setFunctionName:()=>d,__spread:()=>x,__spreadArray:()=>g,__spreadArrays:()=>w,__values:()=>h});var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},r(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 n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var a=function(){return a=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},a.apply(this,arguments)};function i(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}function u(e,t,n,r){var o,a=arguments.length,i=a<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,r);else for(var u=e.length-1;u>=0;u--)(o=e[u])&&(i=(a<3?o(i):a>3?o(t,n,i):o(t,n))||i);return a>3&&i&&Object.defineProperty(t,n,i),i}function c(e,t){return function(n,r){t(n,r,e)}}function l(e,t,n,r,o,a){function i(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var u,c=r.kind,l="getter"===c?"get":"setter"===c?"set":"value",f=!t&&e?r.static?e:e.prototype:null,s=t||(f?Object.getOwnPropertyDescriptor(f,r.name):{}),d=!1,p=n.length-1;p>=0;p--){var y={};for(var b in r)y[b]="access"===b?{}:r[b];for(var b in r.access)y.access[b]=r.access[b];y.addInitializer=function(e){if(d)throw new TypeError("Cannot add initializers after decoration has completed");a.push(i(e||null))};var v=(0,n[p])("accessor"===c?{get:s.get,set:s.set}:s[l],y);if("accessor"===c){if(void 0===v)continue;if(null===v||"object"!=typeof v)throw new TypeError("Object expected");(u=i(v.get))&&(s.get=u),(u=i(v.set))&&(s.set=u),(u=i(v.init))&&o.push(u)}else(u=i(v))&&("field"===c?o.push(u):s[l]=u)}f&&Object.defineProperty(f,r.name,s),d=!0}function f(e,t,n){for(var r=arguments.length>2,o=0;o<t.length;o++)n=r?t[o].call(e,n):t[o].call(e);return r?n:void 0}function s(e){return"symbol"==typeof e?e:"".concat(e)}function d(e,t,n){return"symbol"==typeof t&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:n?"".concat(n," ",t):t})}function p(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function y(e,t,n,r){return new(n||(n=Promise))((function(o,a){function i(e){try{c(r.next(e))}catch(e){a(e)}}function u(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,u)}c((r=r.apply(e,t||[])).next())}))}function b(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(u){return function(c){return function(u){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return i.label++,{value:u[1],done:!1};case 5:i.label++,r=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==u[0]&&2!==u[0])){i=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){i.label=u[1];break}if(6===u[0]&&i.label<o[1]){i.label=o[1],o=u;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(u);break}o[2]&&i.ops.pop(),i.trys.pop();continue}u=t.call(e,i)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,c])}}}var v=Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]};function m(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||v(t,e,n)}function h(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function _(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,a=n.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(r=a.next()).done;)i.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=a.return)&&n.call(a)}finally{if(o)throw o.error}}return i}function x(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(_(arguments[t]));return e}function w(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),o=0;for(t=0;t<n;t++)for(var a=arguments[t],i=0,u=a.length;i<u;i++,o++)r[o]=a[i];return r}function g(e,t,n){if(n||2===arguments.length)for(var r,o=0,a=t.length;o<a;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}function O(e){return this instanceof O?(this.v=e,this):new O(e)}function j(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,o=n.apply(e,t||[]),a=[];return r={},i("next"),i("throw"),i("return"),r[Symbol.asyncIterator]=function(){return this},r;function i(e){o[e]&&(r[e]=function(t){return new Promise((function(n,r){a.push([e,t,n,r])>1||u(e,t)}))})}function u(e,t){try{(n=o[e](t)).value instanceof O?Promise.resolve(n.value.v).then(c,l):f(a[0][2],n)}catch(e){f(a[0][3],e)}var n}function c(e){u("next",e)}function l(e){u("throw",e)}function f(e,t){e(t),a.shift(),a.length&&u(a[0][0],a[0][1])}}function M(e){var t,n;return t={},r("next"),r("throw",(function(e){throw e})),r("return"),t[Symbol.iterator]=function(){return this},t;function r(r,o){t[r]=e[r]?function(t){return(n=!n)?{value:O(e[r](t)),done:!1}:o?o(t):t}:o}}function P(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=h(e),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise((function(r,o){(function(e,t,n,r){Promise.resolve(r).then((function(t){e({value:t,done:n})}),t)})(r,o,(t=e[n](t)).done,t.value)}))}}}function E(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var C=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t};function S(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&v(t,e,n);return C(t,e),t}function B(e){return e&&e.__esModule?e:{default:e}}function T(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)}function A(e,t,n,r,o){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!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"===r?o.call(e,n):o?o.value=n:t.set(e,n),n}function I(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)}},280:e=>{e.exports=t},156:t=>{t.exports=e}},r={};function o(e){var t=r[e];if(void 0!==t)return t.exports;var a=r[e]={exports:{}};return n[e](a,a.exports,o),a.exports}o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};return(()=>{var e=a;Object.defineProperty(e,"__esModule",{value:!0}),e.MenuButton=void 0;const t=o(492);var n=o(492);Object.defineProperty(e,"MenuButton",{enumerable:!0,get:function(){return n.MenuButton}}),e.default=t.MenuButton})(),a})()));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nimbus-ds/menubutton",
3
- "version": "1.7.0-rc.1",
3
+ "version": "1.8.0",
4
4
  "license": "MIT",
5
5
  "source": "src/index.ts",
6
6
  "main": "dist/index.js",
@@ -34,4 +34,4 @@
34
34
  "devDependencies": {
35
35
  "@nimbus-ds/icons": "^1"
36
36
  }
37
- }
37
+ }