@blerp/design 1.3.17 → 1.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. package/dist/cjs/Blerp/BlerpImageRow.js +176 -57
  2. package/dist/cjs/Blerp/BlerpSavePopup.js +44 -40
  3. package/dist/cjs/Blerp/BlerpTitleRow.js +36 -19
  4. package/dist/cjs/Blerp/BlerpTopRow.js +110 -44
  5. package/dist/cjs/Blerp.js +9 -16
  6. package/dist/cjs/BlerpAudioContextProvider.js +2 -2
  7. package/dist/cjs/BlerpListView.js +318 -168
  8. package/dist/cjs/BlerpListViewPremium.js +155 -130
  9. package/dist/cjs/BlerpListViewSkeleton.js +60 -13
  10. package/dist/cjs/BlerpSkeleton.js +32 -9
  11. package/dist/cjs/CollectionCard.js +139 -60
  12. package/dist/cjs/CollectionListViewPremium.js +368 -297
  13. package/dist/cjs/CollectionSkeleton.js +74 -13
  14. package/dist/cjs/Dropdown.js +272 -172
  15. package/dist/cjs/EllipsisLoader.js +66 -21
  16. package/dist/cjs/GroupCard.js +64 -57
  17. package/dist/cjs/Icons/Icons.js +288 -426
  18. package/dist/cjs/ImageEditor.js +247 -0
  19. package/dist/cjs/ImageUpload.js +226 -0
  20. package/dist/cjs/NewBlerp.js +354 -160
  21. package/dist/cjs/NewBlerpTest.js +10 -792
  22. package/dist/cjs/NewCollectionModal.js +294 -310
  23. package/dist/cjs/PremiumCollectionCard.js +191 -454
  24. package/dist/cjs/PurchaseModals/CheckoutModal.js +1 -1
  25. package/dist/cjs/PurchaseModals/PremiumBlerpCheckoutModal.js +1 -1
  26. package/dist/cjs/PurchaseModals/PremiumCollectionCheckoutModal.js +1 -1
  27. package/dist/cjs/PurchaseModals/PremiumSubscriptionCheckoutModal.js +1 -1
  28. package/dist/cjs/ReactionButtons.js +26 -13
  29. package/dist/cjs/SnackbarContextProvider.js +200 -116
  30. package/dist/cjs/Theme.js +217 -90
  31. package/dist/cjs/Toggle.js +86 -32
  32. package/dist/cjs/UserCard.js +13 -32
  33. package/dist/cjs/UserPage/LibraryControls.js +180 -93
  34. package/dist/cjs/UserPage/UserLibraryHeader.js +23 -14
  35. package/dist/cjs/UserPage/UserProfileHeader.js +120 -105
  36. package/dist/cjs/UsernameWithPopout.js +12 -8
  37. package/dist/cjs/colors.js +15 -8
  38. package/dist/cjs/helpers.js +131 -0
  39. package/dist/cjs/index.js +92 -58
  40. package/dist/cjs/neo-components/Autocomplete.js +285 -0
  41. package/dist/cjs/neo-components/BottomNavigation.js +120 -0
  42. package/dist/cjs/neo-components/Box.js +48 -0
  43. package/dist/cjs/neo-components/Button.js +206 -0
  44. package/dist/cjs/neo-components/CircularProgress.js +92 -0
  45. package/dist/cjs/neo-components/Container.js +75 -0
  46. package/dist/cjs/neo-components/Dialog.js +441 -0
  47. package/dist/cjs/neo-components/Fab.js +237 -0
  48. package/dist/cjs/neo-components/FormControls.js +1057 -0
  49. package/dist/cjs/neo-components/Grid.js +256 -0
  50. package/dist/cjs/neo-components/IconButton.js +111 -0
  51. package/dist/cjs/neo-components/Input.js +495 -0
  52. package/dist/cjs/neo-components/Layout.js +1214 -0
  53. package/dist/cjs/neo-components/Misc.js +868 -0
  54. package/dist/cjs/neo-components/Navigation.js +1616 -0
  55. package/dist/cjs/neo-components/Paper.js +256 -0
  56. package/dist/cjs/neo-components/Stack.js +194 -0
  57. package/dist/cjs/neo-components/Stepper.js +291 -0
  58. package/dist/cjs/neo-components/Text.js +290 -0
  59. package/dist/cjs/neo-components/ThemeProvider.js +731 -0
  60. package/dist/cjs/neo-components/ToggleButton.js +223 -0
  61. package/dist/cjs/neo-components/createTheme.js +306 -0
  62. package/dist/cjs/neo-components/withSx.js +171 -0
  63. package/dist/cjs/neo-utils/sxToStyle.js +508 -0
  64. package/dist/esm/Blerp/BlerpImageRow.js +166 -46
  65. package/dist/esm/Blerp/BlerpSavePopup.js +35 -27
  66. package/dist/esm/Blerp/BlerpTitleRow.js +32 -13
  67. package/dist/esm/Blerp/BlerpTopRow.js +85 -16
  68. package/dist/esm/Blerp.js +4 -12
  69. package/dist/esm/BlerpAudioContextProvider.js +1 -2
  70. package/dist/esm/BlerpListView.js +313 -160
  71. package/dist/esm/BlerpListViewPremium.js +135 -109
  72. package/dist/esm/BlerpListViewSkeleton.js +60 -11
  73. package/dist/esm/BlerpSkeleton.js +32 -7
  74. package/dist/esm/CollectionCard.js +118 -38
  75. package/dist/esm/CollectionListViewPremium.js +367 -294
  76. package/dist/esm/CollectionSkeleton.js +73 -11
  77. package/dist/esm/Dropdown.js +260 -161
  78. package/dist/esm/EllipsisLoader.js +63 -18
  79. package/dist/esm/GroupCard.js +54 -46
  80. package/dist/esm/Icons/Icons.js +226 -367
  81. package/dist/esm/ImageEditor.js +240 -0
  82. package/dist/esm/ImageUpload.js +217 -0
  83. package/dist/esm/NewBlerp.js +282 -79
  84. package/dist/esm/NewBlerpTest.js +11 -781
  85. package/dist/esm/NewCollectionModal.js +289 -304
  86. package/dist/esm/PremiumCollectionCard.js +192 -451
  87. package/dist/esm/PurchaseModals/CheckoutModal.js +1 -1
  88. package/dist/esm/PurchaseModals/PremiumBlerpCheckoutModal.js +1 -1
  89. package/dist/esm/PurchaseModals/PremiumCollectionCheckoutModal.js +1 -1
  90. package/dist/esm/PurchaseModals/PremiumSubscriptionCheckoutModal.js +1 -1
  91. package/dist/esm/ReactionButtons.js +23 -8
  92. package/dist/esm/SnackbarContextProvider.js +196 -110
  93. package/dist/esm/Theme.js +187 -66
  94. package/dist/esm/Toggle.js +84 -29
  95. package/dist/esm/UserCard.js +1 -20
  96. package/dist/esm/UserPage/LibraryControls.js +159 -65
  97. package/dist/esm/UserPage/UserLibraryHeader.js +18 -10
  98. package/dist/esm/UserPage/UserProfileHeader.js +100 -79
  99. package/dist/esm/UsernameWithPopout.js +7 -4
  100. package/dist/esm/colors.js +11 -9
  101. package/dist/esm/helpers.js +122 -0
  102. package/dist/esm/icons.js +1 -1
  103. package/dist/esm/index.js +32 -2
  104. package/dist/esm/neo-components/Autocomplete.js +274 -0
  105. package/dist/esm/neo-components/BottomNavigation.js +109 -0
  106. package/dist/esm/neo-components/Box.js +36 -0
  107. package/dist/esm/neo-components/Button.js +194 -0
  108. package/dist/esm/neo-components/CircularProgress.js +81 -0
  109. package/dist/esm/neo-components/Container.js +63 -0
  110. package/dist/esm/neo-components/Dialog.js +423 -0
  111. package/dist/esm/neo-components/Fab.js +225 -0
  112. package/dist/esm/neo-components/FormControls.js +1041 -0
  113. package/dist/esm/neo-components/Grid.js +244 -0
  114. package/dist/esm/neo-components/IconButton.js +99 -0
  115. package/dist/esm/neo-components/Input.js +480 -0
  116. package/dist/esm/neo-components/Layout.js +1180 -0
  117. package/dist/esm/neo-components/Misc.js +850 -0
  118. package/dist/esm/neo-components/Navigation.js +1594 -0
  119. package/dist/esm/neo-components/Paper.js +243 -0
  120. package/dist/esm/neo-components/Stack.js +182 -0
  121. package/dist/esm/neo-components/Stepper.js +278 -0
  122. package/dist/esm/neo-components/Text.js +277 -0
  123. package/dist/esm/neo-components/ThemeProvider.js +718 -0
  124. package/dist/esm/neo-components/ToggleButton.js +214 -0
  125. package/dist/esm/neo-components/createTheme.js +297 -0
  126. package/dist/esm/neo-components/withSx.js +160 -0
  127. package/dist/esm/neo-utils/sxToStyle.js +502 -0
  128. package/package.json +19 -15
@@ -1,17 +1,79 @@
1
- import _taggedTemplateLiteral from '@babel/runtime/helpers/taggedTemplateLiteral';
1
+ import _defineProperty from '@babel/runtime/helpers/defineProperty';
2
2
  import React from 'react';
3
- import styled from 'styled-components';
3
+ import { Box } from './index.js';
4
+ import { useBlerpTheme } from './Theme.js';
4
5
 
5
- var _templateObject, _templateObject2;
6
- const FeaturedCollectionSkeleton = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n height: 200px;\n width: 200px;\n animation: pulse 3s ease-in-out infinite;\n @keyframes pulse {\n 0% {\n opacity: 0.7;\n }\n 50% {\n opacity: 1;\n }\n 100% {\n opacity: 0.7;\n }\n }\n"])));
7
- const FeaturedCollectionSquare = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: absolute;\n height: 100%;\n width: 100%;\n border-radius: 8px;\n\n ", ";\n"])), props => props.depth === "1" ? "z-index: 5; background: ".concat(props.theme.colors.grey4, "; ") : props.depth === "2" ? "z-index: 4; \n background: ".concat(props.theme.colors.grey6, "; \n transform: skewX(-5deg); \n left: 8px; \n height: 94%; \n bottom: 0") : props.depth === "3" ? "background: ".concat(props.theme.colors.grey7, ";\n transform: skewX(-10deg); \n left: 15px; \n height: 87%; \n bottom: 0") : "background: ".concat(props.theme.colors.ibisRed));
6
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
7
+
8
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
8
9
  const CollectionSkeleton = () => {
9
- return /*#__PURE__*/React.createElement(FeaturedCollectionSkeleton, null, /*#__PURE__*/React.createElement(FeaturedCollectionSquare, {
10
- depth: "1"
11
- }), /*#__PURE__*/React.createElement(FeaturedCollectionSquare, {
12
- depth: "2"
13
- }), /*#__PURE__*/React.createElement(FeaturedCollectionSquare, {
14
- depth: "3"
10
+ const theme = useBlerpTheme();
11
+
12
+ const getSquareStyles = depth => {
13
+ const baseStyles = {
14
+ position: "absolute",
15
+ height: "100%",
16
+ width: "100%",
17
+ borderRadius: "8px"
18
+ };
19
+
20
+ switch (depth) {
21
+ case "1":
22
+ return _objectSpread(_objectSpread({}, baseStyles), {}, {
23
+ zIndex: 5,
24
+ background: theme.colors.grey4
25
+ });
26
+
27
+ case "2":
28
+ return _objectSpread(_objectSpread({}, baseStyles), {}, {
29
+ zIndex: 4,
30
+ background: theme.colors.grey6,
31
+ transform: "skewX(-5deg)",
32
+ left: "8px",
33
+ height: "94%",
34
+ bottom: 0
35
+ });
36
+
37
+ case "3":
38
+ return _objectSpread(_objectSpread({}, baseStyles), {}, {
39
+ background: theme.colors.grey7,
40
+ transform: "skewX(-10deg)",
41
+ left: "15px",
42
+ height: "87%",
43
+ bottom: 0
44
+ });
45
+
46
+ default:
47
+ return _objectSpread(_objectSpread({}, baseStyles), {}, {
48
+ background: theme.colors.ibisRed
49
+ });
50
+ }
51
+ };
52
+
53
+ return /*#__PURE__*/React.createElement(Box, {
54
+ sx: {
55
+ position: "relative",
56
+ height: "200px",
57
+ width: "200px",
58
+ animation: "pulse 3s ease-in-out infinite",
59
+ "@keyframes pulse": {
60
+ "0%": {
61
+ opacity: 0.7
62
+ },
63
+ "50%": {
64
+ opacity: 1
65
+ },
66
+ "100%": {
67
+ opacity: 0.7
68
+ }
69
+ }
70
+ }
71
+ }, /*#__PURE__*/React.createElement(Box, {
72
+ sx: getSquareStyles("1")
73
+ }), /*#__PURE__*/React.createElement(Box, {
74
+ sx: getSquareStyles("2")
75
+ }), /*#__PURE__*/React.createElement(Box, {
76
+ sx: getSquareStyles("3")
15
77
  }));
16
78
  };
17
79
 
@@ -1,18 +1,92 @@
1
- import React, { useState } from 'react';
1
+ import _defineProperty from '@babel/runtime/helpers/defineProperty';
2
+ import React, { useState, useRef, useEffect, useCallback } from 'react';
2
3
  import { Button, Text, Stack, Menu, MenuItem } from './index.js';
3
- import KeyboardArrowDownRoundedIcon from '@mui/icons-material/KeyboardArrowDownRounded';
4
4
 
5
- // box-shadow: 0px 0px 20px #0000001a;
6
- // div:focus {
7
- // border: none !important;
8
- // box-shadow: 0px 0px 20px #0000001a;
9
- // }
10
- // & .MuiPaper-root {
11
- // background-color: ${(props) => props.theme.colors.grey3};
12
- // }
13
- // `;
5
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
14
6
 
15
- const NewDropdown = _ref => {
7
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
8
+
9
+ const ChevronIcon = _ref => {
10
+ let {
11
+ isOpen,
12
+ color = "currentColor",
13
+ size = 20
14
+ } = _ref;
15
+ return /*#__PURE__*/React.createElement("svg", {
16
+ width: size,
17
+ height: size,
18
+ viewBox: "0 0 24 24",
19
+ fill: "none",
20
+ xmlns: "http://www.w3.org/2000/svg",
21
+ style: {
22
+ color,
23
+ transform: isOpen ? "rotate(180deg)" : "rotate(0deg)",
24
+ transition: "transform 0.2s cubic-bezier(0.4, 0, 0.2, 1)",
25
+ flexShrink: 0
26
+ }
27
+ }, /*#__PURE__*/React.createElement("path", {
28
+ d: "M6 9l6 6 6-6",
29
+ stroke: "currentColor",
30
+ strokeWidth: "1.5",
31
+ strokeLinecap: "round",
32
+ strokeLinejoin: "round"
33
+ }));
34
+ }; // Shared menu styling - refined and consistent
35
+ // Shared menu styling - refined and consistent
36
+
37
+
38
+ const getMenuPaperStyles = function (anchorWidth) {
39
+ let customStyles = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
40
+ return {
41
+ sx: _objectSpread({
42
+ "& ul": {
43
+ padding: "4px"
44
+ },
45
+ minWidth: Math.max(anchorWidth || 180, 180),
46
+ width: "auto",
47
+ maxWidth: "320px",
48
+ maxHeight: "400px",
49
+ backgroundColor: "#FAFAFA",
50
+ border: "1px solid rgba(0, 0, 0, 0.08)",
51
+ borderRadius: "8px",
52
+ boxShadow: "0 4px 24px rgba(0, 0, 0, 0.12), 0 1px 4px rgba(0, 0, 0, 0.08)",
53
+ marginTop: "4px",
54
+ overflowY: "auto",
55
+ overflowX: "hidden"
56
+ }, customStyles)
57
+ };
58
+ }; // Shared menu item styling
59
+
60
+
61
+ const getMenuItemStyles = isSelected => ({
62
+ borderRadius: "4px",
63
+ padding: "10px 12px",
64
+ margin: "2px 0",
65
+ minHeight: "40px",
66
+ transition: "all 0.15s ease",
67
+ backgroundColor: isSelected ? "rgba(220, 53, 69, 0.08)" : "transparent",
68
+ "&.Mui-selected": {
69
+ backgroundColor: "rgba(220, 53, 69, 0.1)"
70
+ },
71
+ // ":hover": {
72
+ // backgroundColor: "rgba(220, 53, 69, 0.95)",
73
+ // },
74
+ ":hover p, :hover .dropdown-item-text": {
75
+ color: "#FFFFFF"
76
+ },
77
+ "&.Mui-selected:hover": {
78
+ backgroundColor: "rgba(220, 53, 69, 0.95)"
79
+ },
80
+ // "&.Mui-selected p, &.Mui-selected .dropdown-item-text": {
81
+ // color: "#DC3545",
82
+ // fontWeight: 500,
83
+ // },
84
+ "& p": {
85
+ transition: "color 0.15s ease"
86
+ }
87
+ });
88
+
89
+ const NewDropdown = _ref2 => {
16
90
  let {
17
91
  buttonTitle,
18
92
  buttonLabel,
@@ -23,78 +97,101 @@ const NewDropdown = _ref => {
23
97
  startIcon,
24
98
  endIcon,
25
99
  options
26
- } = _ref;
100
+ } = _ref2;
27
101
  const [anchorEl, setAnchorEl] = useState(null);
28
- const open = Boolean(anchorEl);
102
+ const [buttonWidth, setButtonWidth] = useState(0);
103
+ const buttonRef = useRef(null);
104
+ const open = Boolean(anchorEl); // Measure button width on mount and resize
29
105
 
30
- const handleClick = event => {
31
- // console.log(options);
32
- setAnchorEl(event.currentTarget);
33
- };
106
+ useEffect(() => {
107
+ const updateWidth = () => {
108
+ if (buttonRef.current) {
109
+ setButtonWidth(buttonRef.current.getBoundingClientRect().width);
110
+ }
111
+ };
34
112
 
35
- const handleClose = () => {
113
+ updateWidth();
114
+ window.addEventListener("resize", updateWidth);
115
+ return () => window.removeEventListener("resize", updateWidth);
116
+ }, []);
117
+ const handleClick = useCallback(event => {
118
+ setAnchorEl(event.currentTarget);
119
+ setButtonWidth(event.currentTarget.getBoundingClientRect().width);
120
+ }, []);
121
+ const handleClose = useCallback(() => {
36
122
  setAnchorEl(null);
37
- };
38
-
123
+ }, []);
124
+ const handleOptionSelect = useCallback(option => {
125
+ handleOptionClicked(option);
126
+ handleClose();
127
+ }, [handleOptionClicked, handleClose]);
39
128
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
40
- onClick: e => handleClick(e),
41
- variant: "contained",
129
+ ref: buttonRef,
130
+ onClick: handleClick,
131
+ variant: buttonVariant || "contained",
42
132
  color: "waxwing",
43
- icon: true,
44
133
  disableElevation: true,
45
- sx: {
46
- borderRadius: "4px",
134
+ "aria-haspopup": "listbox",
135
+ "aria-expanded": open,
136
+ sx: _objectSpread({
137
+ borderRadius: "8px",
47
138
  color: "notBlack.main",
48
- padding: "14px",
139
+ padding: "12px 16px",
49
140
  position: "relative",
50
- ...buttonStyle
51
- }
141
+ minWidth: "140px",
142
+ border: open ? "1px solid rgba(220, 53, 69, 0.5)" : "1px solid rgba(0, 0, 0, 0.12)",
143
+ transition: "all 0.2s ease",
144
+ "&:hover": {
145
+ borderColor: "rgba(220, 53, 69, 0.3)",
146
+ backgroundColor: "rgba(250, 250, 250, 1)"
147
+ }
148
+ }, buttonStyle)
52
149
  }, buttonLabel && /*#__PURE__*/React.createElement(Text, {
53
150
  noWrap: true,
54
- fontSize: "0.75em",
55
- color: "grey4.main",
56
- fontWeight: "400",
151
+ fontSize: "11px",
152
+ color: "whiteOverride.main",
153
+ fontWeight: "500",
57
154
  sx: {
58
155
  position: "absolute",
59
- top: "-9px",
60
- left: "10px",
61
- padding: "0 5px",
62
- backgroundColor: "inherit"
156
+ top: "-8px",
157
+ left: "12px",
158
+ padding: "0 6px",
159
+ backgroundColor: "inherit",
160
+ letterSpacing: "0.02em",
161
+ textTransform: "uppercase"
63
162
  }
64
163
  }, buttonLabel), /*#__PURE__*/React.createElement(Stack, {
65
164
  direction: "row",
66
165
  justifyContent: "space-between",
67
166
  alignItems: "center",
68
- width: "100%"
167
+ width: "100%",
168
+ gap: 1
69
169
  }, /*#__PURE__*/React.createElement(Stack, {
70
170
  direction: "row",
71
171
  alignItems: "center",
172
+ gap: 1,
72
173
  overflow: "hidden",
73
- width: "".concat(anchorEl === null || anchorEl === void 0 ? void 0 : anchorEl.getBoundingClientRect().width, "px")
74
- }, startIcon, /*#__PURE__*/React.createElement(Stack, {
75
- alignItems: "flex-start"
76
- }, /*#__PURE__*/React.createElement(Text, {
174
+ flex: 1
175
+ }, startIcon, /*#__PURE__*/React.createElement(Text, {
77
176
  noWrap: true,
78
- fontSize: "1rem",
79
- color: "grey5.main",
80
- marginRight: "16px"
81
- }, buttonTitle))), endIcon ? endIcon : /*#__PURE__*/React.createElement(KeyboardArrowDownRoundedIcon, {
177
+ fontSize: "14px",
178
+ color: "darkscale2.main",
82
179
  sx: {
83
- color: "grey5.main"
84
- },
85
- fontSize: "medium"
180
+ fontWeight: 500
181
+ }
182
+ }, buttonTitle)), endIcon || /*#__PURE__*/React.createElement(ChevronIcon, {
183
+ isOpen: open,
184
+ color: "rgba(255, 255, 255, 0.54)"
86
185
  }))), /*#__PURE__*/React.createElement(Menu, {
87
- id: "demo-customized-menu",
186
+ id: "new-dropdown-menu",
88
187
  MenuListProps: {
89
- "aria-labelledby": "demo-customized-button"
188
+ "aria-labelledby": "dropdown-button",
189
+ role: "listbox"
90
190
  },
91
191
  anchorEl: anchorEl,
92
192
  open: open,
93
193
  onClose: handleClose,
94
194
  elevation: 0,
95
- sx: {
96
- top: "10px"
97
- },
98
195
  anchorOrigin: {
99
196
  vertical: "bottom",
100
197
  horizontal: "left"
@@ -103,47 +200,35 @@ const NewDropdown = _ref => {
103
200
  vertical: "top",
104
201
  horizontal: "left"
105
202
  },
106
- PaperProps: {
107
- sx: {
108
- "& ul": {
109
- padding: "0"
110
- },
111
- width: anchorEl === null || anchorEl === void 0 ? void 0 : anchorEl.getBoundingClientRect().width,
112
- backgroundColor: "waxwing.main",
113
- boxShadow: "0px 0px 20px #0000001a;",
114
- ...paperStyle
115
- }
116
- }
117
- }, options === null || options === void 0 ? void 0 : options.map(option => /*#__PURE__*/React.createElement(MenuItem, {
118
- key: "dropdown-".concat(option.name),
203
+ TransitionProps: {
204
+ timeout: 200
205
+ },
206
+ PaperProps: getMenuPaperStyles(buttonWidth, paperStyle)
207
+ }, options === null || options === void 0 ? void 0 : options.map((option, index) => /*#__PURE__*/React.createElement(MenuItem, {
208
+ key: option.id || option.name || "dropdown-".concat(index),
119
209
  selected: buttonTitle === option.name,
210
+ role: "option",
211
+ "aria-selected": buttonTitle === option.name,
212
+ sx: getMenuItemStyles(buttonTitle === option.name),
213
+ onClick: () => handleOptionSelect(option)
214
+ }, option.startImageIcon && /*#__PURE__*/React.createElement(Stack, {
215
+ mr: 1,
216
+ alignItems: "center",
217
+ justifyContent: "center"
218
+ }, option.startImageIcon), /*#__PURE__*/React.createElement(Text, {
219
+ noWrap: true,
220
+ className: "dropdown-item-text",
120
221
  sx: {
121
- borderRadius: "4px",
122
- "&.Mui-selected": {
123
- backgroundColor: "ibisRed.main"
124
- },
125
- ":hover": {
126
- backgroundColor: "ibisRed.main"
127
- },
128
- ":hover p": {
129
- color: "white.override"
130
- },
131
- "&.Mui-selected:hover": {
132
- backgroundColor: "ibisRed.main"
133
- },
134
- "&.Mui-selected p": {
135
- color: "white.override"
136
- }
137
- },
138
- onClick: () => {
139
- handleOptionClicked(option);
140
- handleClose();
222
+ fontSize: "14px",
223
+ flex: 1
141
224
  }
142
- }, option.startImageIcon ? option.startImageIcon : /*#__PURE__*/React.createElement(React.Fragment, null), /*#__PURE__*/React.createElement(Text, {
143
- noWrap: true
144
- }, option.name), option.endImageIcon ? option.endImageIcon : /*#__PURE__*/React.createElement(React.Fragment, null)))));
225
+ }, option.name), option.endImageIcon && /*#__PURE__*/React.createElement(Stack, {
226
+ ml: 1,
227
+ alignItems: "center",
228
+ justifyContent: "center"
229
+ }, option.endImageIcon)))));
145
230
  };
146
- const Dropdown = _ref2 => {
231
+ const Dropdown = _ref3 => {
147
232
  let {
148
233
  buttonTitle,
149
234
  buttonLabel,
@@ -154,72 +239,99 @@ const Dropdown = _ref2 => {
154
239
  startIcon,
155
240
  endIcon,
156
241
  options
157
- } = _ref2;
242
+ } = _ref3;
158
243
  const [anchorEl, setAnchorEl] = useState(null);
159
- const open = Boolean(anchorEl);
244
+ const [buttonWidth, setButtonWidth] = useState(0);
245
+ const buttonRef = useRef(null);
246
+ const open = Boolean(anchorEl); // Measure button width properly
160
247
 
161
- const handleClick = event => {
162
- // console.log(options);
163
- setAnchorEl(event.currentTarget);
164
- };
248
+ useEffect(() => {
249
+ const updateWidth = () => {
250
+ if (buttonRef.current) {
251
+ setButtonWidth(buttonRef.current.getBoundingClientRect().width);
252
+ }
253
+ };
165
254
 
166
- const handleClose = () => {
255
+ updateWidth();
256
+ window.addEventListener("resize", updateWidth);
257
+ return () => window.removeEventListener("resize", updateWidth);
258
+ }, []);
259
+ const handleClick = useCallback(event => {
260
+ setAnchorEl(event.currentTarget);
261
+ setButtonWidth(event.currentTarget.getBoundingClientRect().width);
262
+ }, []);
263
+ const handleClose = useCallback(() => {
167
264
  setAnchorEl(null);
168
- };
169
-
265
+ }, []);
266
+ const handleOptionSelect = useCallback(option => {
267
+ handleOptionClicked(option);
268
+ handleClose();
269
+ }, [handleOptionClicked, handleClose]);
170
270
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
171
- onClick: e => handleClick(e),
172
- variant: "contained",
271
+ ref: buttonRef,
272
+ onClick: handleClick,
273
+ variant: buttonVariant || "contained",
173
274
  color: "waxwing",
174
- icon: true,
175
275
  disableElevation: true,
176
- sx: {
177
- borderRadius: "4px",
276
+ "aria-haspopup": "listbox",
277
+ "aria-expanded": open,
278
+ sx: _objectSpread({
279
+ borderRadius: "8px",
178
280
  color: "notBlack.main",
179
- paddingRight: "4px",
180
- paddingLeft: "4px",
181
- ...buttonStyle
182
- }
281
+ padding: "8px 12px",
282
+ minWidth: "120px",
283
+ border: open ? "1px solid rgba(220, 53, 69, 0.5)" : "1px solid rgba(0, 0, 0, 0.08)",
284
+ transition: "all 0.2s ease",
285
+ "&:hover": {
286
+ borderColor: "rgba(220, 53, 69, 0.25)",
287
+ backgroundColor: "rgba(250, 250, 250, 1)"
288
+ }
289
+ }, buttonStyle)
183
290
  }, /*#__PURE__*/React.createElement(Stack, {
184
291
  direction: "row",
185
292
  justifyContent: "space-between",
186
293
  alignItems: "center",
187
- width: "100%"
294
+ width: "100%",
295
+ gap: 1
188
296
  }, /*#__PURE__*/React.createElement(Stack, {
189
297
  direction: "row",
190
298
  alignItems: "center",
299
+ gap: 1.5,
191
300
  overflow: "hidden",
192
- width: "".concat(anchorEl === null || anchorEl === void 0 ? void 0 : anchorEl.getBoundingClientRect().width, "px")
301
+ flex: 1
193
302
  }, startIcon, /*#__PURE__*/React.createElement(Stack, {
194
303
  alignItems: "flex-start",
195
- marginLeft: "12px"
304
+ overflow: "hidden"
196
305
  }, buttonLabel && /*#__PURE__*/React.createElement(Text, {
197
306
  noWrap: true,
198
- fontSize: "8px",
307
+ fontSize: "10px",
199
308
  color: "grey4.main",
200
- fontWeight: "light"
309
+ fontWeight: "500",
310
+ sx: {
311
+ letterSpacing: "0.04em",
312
+ textTransform: "uppercase",
313
+ marginBottom: "-2px"
314
+ }
201
315
  }, buttonLabel), /*#__PURE__*/React.createElement(Text, {
202
316
  noWrap: true,
203
317
  fontSize: "14px",
204
318
  color: "grey5.main",
205
- marginRight: "16px"
206
- }, buttonTitle))), endIcon ? endIcon : /*#__PURE__*/React.createElement(KeyboardArrowDownRoundedIcon, {
207
319
  sx: {
208
- color: "grey5.main"
209
- },
210
- fontSize: "medium"
320
+ fontWeight: 500
321
+ }
322
+ }, buttonTitle))), endIcon || /*#__PURE__*/React.createElement(ChevronIcon, {
323
+ isOpen: open,
324
+ color: "rgba(0, 0, 0, 0.54)"
211
325
  }))), /*#__PURE__*/React.createElement(Menu, {
212
- id: "demo-customized-menu",
326
+ id: "dropdown-menu",
213
327
  MenuListProps: {
214
- "aria-labelledby": "demo-customized-button"
328
+ "aria-labelledby": "dropdown-button",
329
+ role: "listbox"
215
330
  },
216
331
  anchorEl: anchorEl,
217
332
  open: open,
218
333
  onClose: handleClose,
219
334
  elevation: 0,
220
- sx: {
221
- top: "10px"
222
- },
223
335
  anchorOrigin: {
224
336
  vertical: "bottom",
225
337
  horizontal: "left"
@@ -228,46 +340,33 @@ const Dropdown = _ref2 => {
228
340
  vertical: "top",
229
341
  horizontal: "left"
230
342
  },
231
- PaperProps: {
232
- sx: {
233
- "& ul": {
234
- padding: "0"
235
- },
236
- width: anchorEl === null || anchorEl === void 0 ? void 0 : anchorEl.getBoundingClientRect().width,
237
- backgroundColor: "waxwing.main",
238
- boxShadow: "0px 0px 20px #0000001a;",
239
- ...paperStyle
240
- }
241
- }
242
- }, options === null || options === void 0 ? void 0 : options.map(option => /*#__PURE__*/React.createElement(MenuItem, {
243
- key: "dropdown-".concat(option.name),
343
+ TransitionProps: {
344
+ timeout: 200
345
+ },
346
+ PaperProps: getMenuPaperStyles(buttonWidth, paperStyle)
347
+ }, options === null || options === void 0 ? void 0 : options.map((option, index) => /*#__PURE__*/React.createElement(MenuItem, {
348
+ key: option.id || option.name || "dropdown-".concat(index),
244
349
  selected: buttonTitle === option.name,
350
+ role: "option",
351
+ "aria-selected": buttonTitle === option.name,
352
+ sx: getMenuItemStyles(buttonTitle === option.name),
353
+ onClick: () => handleOptionSelect(option)
354
+ }, option.startImageIcon && /*#__PURE__*/React.createElement(Stack, {
355
+ mr: 1,
356
+ alignItems: "center",
357
+ justifyContent: "center"
358
+ }, option.startImageIcon), /*#__PURE__*/React.createElement(Text, {
359
+ noWrap: true,
360
+ className: "dropdown-item-text",
245
361
  sx: {
246
- borderRadius: "4px",
247
- "&.Mui-selected": {
248
- backgroundColor: "ibisRed.main"
249
- },
250
- ":hover": {
251
- backgroundColor: "ibisRed.main"
252
- },
253
- ":hover p": {
254
- color: "white.override"
255
- },
256
- "&.Mui-selected:hover": {
257
- backgroundColor: "ibisRed.main"
258
- },
259
- "&.Mui-selected p": {
260
- color: "white.override"
261
- }
262
- },
263
- onClick: () => {
264
- handleOptionClicked(option);
265
- handleClose();
362
+ fontSize: "14px",
363
+ flex: 1
266
364
  }
267
- }, option.startImageIcon ? option.startImageIcon : /*#__PURE__*/React.createElement(React.Fragment, null), /*#__PURE__*/React.createElement(Text, {
268
- noWrap: true
269
- }, option.name), option.endImageIcon ? option.endImageIcon : /*#__PURE__*/React.createElement(React.Fragment, null)))));
365
+ }, option.name), option.endImageIcon && /*#__PURE__*/React.createElement(Stack, {
366
+ ml: 1,
367
+ alignItems: "center",
368
+ justifyContent: "center"
369
+ }, option.endImageIcon)))));
270
370
  };
271
371
 
272
- export default Dropdown;
273
- export { Dropdown, NewDropdown };
372
+ export { Dropdown, NewDropdown, Dropdown as default };