@nimbus-ds/menubutton 1.5.3-rc.1 → 1.5.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nimbus-ds/menubutton",
3
- "version": "1.5.3-rc.1",
3
+ "version": "1.5.3",
4
4
  "license": "MIT",
5
5
  "source": "src/index.ts",
6
6
  "main": "dist/index.js",
@@ -33,6 +33,5 @@
33
33
  },
34
34
  "devDependencies": {
35
35
  "@nimbus-ds/icons": "^1"
36
- },
37
- "stableVersion": "1.5.2"
36
+ }
38
37
  }
package/dist/index.d.ts DELETED
@@ -1,71 +0,0 @@
1
- // Generated by dts-bundle-generator v8.0.0
2
-
3
- import { IconProps } from '@nimbus-ds/icons';
4
- import { PolymorphicForwardRefComponent } from '@nimbus-ds/typings';
5
- import { ButtonHTMLAttributes, ComponentPropsWithRef, FC, HTMLAttributes, ReactNode } from 'react';
6
-
7
- export interface MenuButtonAccordionProperties {
8
- /**
9
- * Content of the menu.
10
- * @TJS-type React.ReactNode
11
- */
12
- children: ReactNode;
13
- /**
14
- * It will be the accordion anchor and can contain all the props available in the MenuButton component's API.
15
- * @TJS-type React.ReactNode
16
- */
17
- menuButton: MenuButtonProperties;
18
- /**
19
- * Required ID used to maintain correct component accessibility, it will be passed on to MenuButtonAccordion's children.
20
- */
21
- contentid: string;
22
- /**
23
- * Changes the component usage so that control of open and close is controlled from outside the component.
24
- */
25
- open?: boolean;
26
- /**
27
- * Sets the state of the button as active/inactive.
28
- */
29
- active?: boolean;
30
- }
31
- export type MenuButtonAccordionBaseProps = MenuButtonAccordionProperties & {
32
- menuButton: MenuButtonProps;
33
- } & Omit<HTMLAttributes<HTMLElement>, "color">;
34
- declare const MenuButtonAccordion: PolymorphicForwardRefComponent<"button" | "a", MenuButtonAccordionBaseProps>;
35
- export interface MenuButtonComponents {
36
- Accordion: typeof MenuButtonAccordion;
37
- }
38
- export interface MenuButtonProperties {
39
- /**
40
- * Text label for the button.
41
- */
42
- label: string;
43
- /**
44
- * Function executed when clicking the button.
45
- * @TJS-type () => void;
46
- */
47
- onClick?: () => void;
48
- /**
49
- * Sets an icon element on the left of the button.
50
- * @TJS-type React.FC<IconProps>
51
- */
52
- startIcon?: FC<IconProps>;
53
- /**
54
- * Sets the state of the button as active/inactive.
55
- */
56
- active?: boolean;
57
- /**
58
- * Inner components displayed on the right of the button component.
59
- * @TJS-type React.ReactNode
60
- */
61
- children?: ReactNode;
62
- }
63
- export type MenuButtonBaseProps = MenuButtonProperties & Omit<ButtonHTMLAttributes<HTMLButtonElement>, "color">;
64
- export declare const MenuButton: PolymorphicForwardRefComponent<"button" | "a", MenuButtonBaseProps> & MenuButtonComponents;
65
- export type MenuButtonProps = ComponentPropsWithRef<typeof MenuButton>;
66
-
67
- export {
68
- MenuButton as default,
69
- };
70
-
71
- export {};
package/dist/index.js DELETED
@@ -1 +0,0 @@
1
- !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 d=u?"primary-interactive":"primary-textHigh",p=f.disabled?"neutral-textDisabled":d;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"},boxShadow:{focus:"focusRing"},borderRadius:"2",borderWidth:"none",cursor:{xs:"pointer",disabled:"not-allowed"},display:"flex",gap:"2",padding:"2",width:"100%",transitionProperty:"all",transitionDuration:"base",transitionTimingFunction:"ease-in-out"},i&&n.default.createElement(o.Icon,{color:p,source:n.default.createElement(i,null)}),n.default.createElement(o.Box,{display:"inline-flex",flex:"1"},n.default.createElement(o.Text,{fontSize:"base",color:p},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[d,p]=(0,n.useState)(!1),y=(0,n.useMemo)((()=>void 0===r?d:r),[r,d]);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:()=>p((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",pl:"6",pt:"1",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:()=>x,__asyncValues:()=>S,__await:()=>j,__awaiter:()=>y,__classPrivateFieldGet:()=>A,__classPrivateFieldIn:()=>k,__classPrivateFieldSet:()=>I,__createBinding:()=>v,__decorate:()=>c,__esDecorate:()=>l,__exportStar:()=>h,__extends:()=>o,__generator:()=>b,__importDefault:()=>T,__importStar:()=>E,__makeTemplateObject:()=>M,__metadata:()=>p,__param:()=>u,__propKey:()=>s,__read:()=>_,__rest:()=>i,__runInitializers:()=>f,__setFunctionName:()=>d,__spread:()=>w,__spreadArray:()=>O,__spreadArrays:()=>g,__values:()=>m});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):{}),d=!1,p=r.length-1;p>=0;p--){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(d)throw new TypeError("Cannot add initializers after decoration has completed");a.push(i(e||null))};var v=(0,r[p])("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),d=!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 d(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 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 h(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||v(t,e,r)}function m(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 O(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 j(e){return this instanceof j?(this.v=e,this):new j(e)}function x(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 j?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:j(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=m(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})()));