@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,3 +1,9 @@
1
+ import _defineProperty from '@babel/runtime/helpers/defineProperty';
2
+
3
+ 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; }
4
+
5
+ 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; }
6
+
1
7
  let colors = {
2
8
  white: "#ffffff",
3
9
  waxing: "#F3F3F3",
@@ -68,10 +74,8 @@ let overrideColors = {
68
74
  buntingBlueOverride: colors.buntingBlue,
69
75
  popnYellowOverride: colors.popnYellow
70
76
  };
71
- const lightColors = { ...colors,
72
- ...overrideColors
73
- };
74
- const darkColors = {
77
+ const lightColors = _objectSpread(_objectSpread({}, colors), overrideColors);
78
+ const darkColors = _objectSpread({
75
79
  white: colors.black,
76
80
  waxwing: colors.grey8Dark,
77
81
  grey1: colors.grey1Dark,
@@ -93,9 +97,8 @@ const darkColors = {
93
97
  seafoam: colors.seafoam,
94
98
  seafoamDark: colors.seafoamDark,
95
99
  buntingBlue: colors.buntingBlue,
96
- popnYellow: colors.popnYellow,
97
- ...overrideColors
98
- };
100
+ popnYellow: colors.popnYellow
101
+ }, overrideColors);
99
102
  const lightPalette = {
100
103
  primary: {
101
104
  light: colors.ibisRed,
@@ -356,5 +359,4 @@ const darkPalette = {
356
359
  }
357
360
  };
358
361
 
359
- export default colors;
360
- export { darkColors, darkPalette, lightColors, lightPalette, overrideColors };
362
+ export { darkColors, darkPalette, colors as default, lightColors, lightPalette, overrideColors };
@@ -0,0 +1,122 @@
1
+ import React from 'react';
2
+
3
+ // Remove this import:
4
+
5
+ const extractDominantColor = (imageUrl, callback) => {
6
+ const img = new Image();
7
+ img.crossOrigin = "Anonymous";
8
+ img.src = imageUrl;
9
+
10
+ img.onload = () => {
11
+ const canvas = document.createElement("canvas");
12
+ const ctx = canvas.getContext("2d");
13
+ canvas.width = img.width;
14
+ canvas.height = img.height;
15
+ ctx.drawImage(img, 0, 0);
16
+ const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height);
17
+ const data = imageData.data;
18
+ let r = 0,
19
+ g = 0,
20
+ b = 0;
21
+
22
+ for (let i = 0; i < data.length; i += 4) {
23
+ r += data[i];
24
+ g += data[i + 1];
25
+ b += data[i + 2];
26
+ }
27
+
28
+ const pixelCount = data.length / 4;
29
+ r = Math.floor(r / pixelCount);
30
+ g = Math.floor(g / pixelCount);
31
+ b = Math.floor(b / pixelCount);
32
+ callback(["rgb(".concat(r, ", ").concat(g, ", ").concat(b, ")")]);
33
+ };
34
+ }; // Custom palette extraction for components that need vibrant/darkVibrant colors
35
+
36
+ const useCustomPalette = imageUrl => {
37
+ const [palette, setPalette] = React.useState({
38
+ loading: true,
39
+ data: {
40
+ vibrant: null,
41
+ darkVibrant: null
42
+ },
43
+ error: null
44
+ });
45
+ React.useEffect(() => {
46
+ if (!imageUrl) {
47
+ setPalette({
48
+ loading: false,
49
+ data: {
50
+ vibrant: null,
51
+ darkVibrant: null
52
+ },
53
+ error: null
54
+ });
55
+ return;
56
+ }
57
+
58
+ const img = new Image();
59
+ img.crossOrigin = "Anonymous";
60
+ img.src = imageUrl;
61
+
62
+ img.onload = () => {
63
+ try {
64
+ const canvas = document.createElement("canvas");
65
+ const ctx = canvas.getContext("2d");
66
+ canvas.width = img.width;
67
+ canvas.height = img.height;
68
+ ctx.drawImage(img, 0, 0);
69
+ const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height);
70
+ const data = imageData.data;
71
+ let r = 0,
72
+ g = 0,
73
+ b = 0;
74
+
75
+ for (let i = 0; i < data.length; i += 4) {
76
+ r += data[i];
77
+ g += data[i + 1];
78
+ b += data[i + 2];
79
+ }
80
+
81
+ const pixelCount = data.length / 4;
82
+ r = Math.floor(r / pixelCount);
83
+ g = Math.floor(g / pixelCount);
84
+ b = Math.floor(b / pixelCount);
85
+ const vibrant = "rgb(".concat(Math.min(r + 20, 255), ", ").concat(Math.min(g + 20, 255), ", ").concat(Math.min(b + 20, 255), ")");
86
+ const darkVibrant = "rgb(".concat(Math.floor(r * 0.6), ", ").concat(Math.floor(g * 0.6), ", ").concat(Math.floor(b * 0.6), ")");
87
+ setPalette({
88
+ loading: false,
89
+ data: {
90
+ vibrant,
91
+ darkVibrant
92
+ },
93
+ error: null
94
+ });
95
+ } catch (error) {
96
+ console.error("Palette extraction failed:", error);
97
+ setPalette({
98
+ loading: false,
99
+ data: {
100
+ vibrant: null,
101
+ darkVibrant: null
102
+ },
103
+ error: error.message
104
+ });
105
+ }
106
+ };
107
+
108
+ img.onerror = () => {
109
+ setPalette({
110
+ loading: false,
111
+ data: {
112
+ vibrant: null,
113
+ darkVibrant: null
114
+ },
115
+ error: "Image failed to load"
116
+ });
117
+ };
118
+ }, [imageUrl]);
119
+ return palette;
120
+ };
121
+
122
+ export { extractDominantColor, useCustomPalette };
package/dist/esm/icons.js CHANGED
@@ -156,4 +156,4 @@ const icons = {
156
156
  }
157
157
  };
158
158
 
159
- export default icons;
159
+ export { icons as default };
package/dist/esm/index.js CHANGED
@@ -1,4 +1,29 @@
1
- import { Box as Box$1, Container as Container$1, Grid as Grid$1, Stack as Stack$1, ImageList as ImageList$1, Autocomplete as Autocomplete$1, Button as Button$1, ButtonGroup as ButtonGroup$1, Checkbox as Checkbox$1, Fab, Radio, Rating as Rating$1, Select as Select$1, Slider as Slider$1, Switch as Switch$1, TextField, BottomNavigation as BottomNavigation$1, Breadcrumbs as Breadcrumbs$1, Drawer as Drawer$1, Link as Link$1, Menu as Menu$1, Pagination as Pagination$1, SpeedDial as SpeedDial$1, Stepper as Stepper$1, Tabs as Tabs$1, Tab as Tab$1, Accordion as Accordion$1, AppBar as AppBar$1, Card as Card$1, Paper as Paper$1, Alert as Alert$1, Backdrop as Backdrop$1, Dialog as Dialog$1, LinearProgress as LinearProgress$1, Skeleton as Skeleton$1, Snackbar as Snackbar$1, Avatar as Avatar$1, Badge as Badge$1, Chip as Chip$1, Divider as Divider$1, List as List$1, Table as Table$1, Tooltip as Tooltip$1, Toolbar as Toolbar$1, Typography, Modal as Modal$1, Popover as Popover$1, IconButton as IconButton$1, MenuItem as MenuItem$1, InputAdornment as InputAdornment$1, createTheme as createTheme$1, ThemeProvider as ThemeProvider$1, AlertTitle as AlertTitle$1, SvgIcon as SvgIcon$1, FormControl as FormControl$1, InputLabel as InputLabel$1 } from '@mui/material';
1
+ import { ThemeProvider as ThemeProvider$1 } from './neo-components/ThemeProvider.js';
2
+ import { createTheme as createTheme$1 } from './neo-components/createTheme.js';
3
+ import { CircularProgress as CircularProgress$1 } from './neo-components/CircularProgress.js';
4
+ import { Box as Box$1 } from './neo-components/Box.js';
5
+ import { Stack as Stack$1 } from './neo-components/Stack.js';
6
+ import { Grid as Grid$1 } from './neo-components/Grid.js';
7
+ import { Container as Container$1 } from './neo-components/Container.js';
8
+ import { Typography } from './neo-components/Text.js';
9
+ import { Button as Button$1 } from './neo-components/Button.js';
10
+ import { IconButton as IconButton$1 } from './neo-components/IconButton.js';
11
+ import { Fab, SpeedDial as SpeedDial$1 } from './neo-components/Fab.js';
12
+ import './neo-components/ToggleButton.js';
13
+ import { TextField, InputAdornment as InputAdornment$1 } from './neo-components/Input.js';
14
+ import { Checkbox as Checkbox$1, Radio, Rating as Rating$1, Select as Select$1, Slider as Slider$1, Switch as Switch$1 } from './neo-components/FormControls.js';
15
+ import { Autocomplete as Autocomplete$1 } from './neo-components/Autocomplete.js';
16
+ import { Card as Card$1, Paper as Paper$1 } from './neo-components/Paper.js';
17
+ import { Backdrop as Backdrop$1, Dialog as Dialog$1, Modal as Modal$1 } from './neo-components/Dialog.js';
18
+ import { Drawer as Drawer$1, Menu as Menu$1, Tabs as Tabs$1, Tab as Tab$1, Alert as Alert$1, Snackbar as Snackbar$1, Popover as Popover$1, MenuItem as MenuItem$1, AlertTitle as AlertTitle$1 } from './neo-components/Navigation.js';
19
+ import { BottomNavigation as BottomNavigation$1 } from './neo-components/BottomNavigation.js';
20
+ import { Stepper as Stepper$1 } from './neo-components/Stepper.js';
21
+ import { Link as Link$1, LinearProgress as LinearProgress$1, Skeleton as Skeleton$1, Avatar as Avatar$1, Badge as Badge$1, Chip as Chip$1, Divider as Divider$1, Tooltip as Tooltip$1 } from './neo-components/Misc.js';
22
+ import { AccordionSummary as AccordionSummary$1, AccordionDetails as AccordionDetails$1, AccordionActions as AccordionActions$1, ImageList as ImageList$1, ButtonGroup as ButtonGroup$1, Breadcrumbs as Breadcrumbs$1, Pagination as Pagination$1, Accordion as Accordion$1, AppBar as AppBar$1, List as List$1, Table as Table$1, Toolbar as Toolbar$1, SvgIcon as SvgIcon$1, FormControl as FormControl$1, InputLabel as InputLabel$1 } from './neo-components/Layout.js';
23
+ import '@babel/runtime/helpers/extends';
24
+ import '@babel/runtime/helpers/defineProperty';
25
+ import '@babel/runtime/helpers/objectWithoutProperties';
26
+ import 'react';
2
27
  import { Blerp as Blerp$1 } from './Blerp.js';
3
28
  import { NewBlerp as NewBlerp$1 } from './NewBlerp.js';
4
29
  import { NewBlerpTest as NewBlerpTest$1 } from './NewBlerpTest.js';
@@ -27,7 +52,11 @@ export { default as PremiumBlerpCheckoutModal } from './PurchaseModals/PremiumBl
27
52
  export { default as PremiumCollectionCheckoutModal } from './PurchaseModals/PremiumCollectionCheckoutModal.js';
28
53
  export { default as PremiumSubscriptionCheckoutModal } from './PurchaseModals/PremiumSubscriptionCheckoutModal.js';
29
54
 
55
+ // import {
30
56
  const Theme = BlerpTheme;
57
+ const AccordionSummary = AccordionSummary$1;
58
+ const AccordionDetails = AccordionDetails$1;
59
+ const AccordionActions = AccordionActions$1;
31
60
  const Box = Box$1;
32
61
  const Container = Container$1;
33
62
  const Grid = Grid$1;
@@ -70,6 +99,7 @@ const Chip = Chip$1;
70
99
  const Divider = Divider$1;
71
100
  const List = List$1;
72
101
  const Table = Table$1;
102
+ const CircularProgress = CircularProgress$1;
73
103
  const Tooltip = Tooltip$1;
74
104
  const Toolbar = Toolbar$1;
75
105
  const Text = Typography;
@@ -339,4 +369,4 @@ const Themes = {
339
369
  // };
340
370
  // export default returnLibrary();
341
371
 
342
- export { Accordion, Alert, AlertTitle, AppBar, Autocomplete, Avatar, Backdrop, Badge, Blerp, BlerpAudioContextProvider, BlerpListView, BlerpListViewPremium, BlerpListViewSkeleton, BlerpSkeleton, BottomNavigation, Box, Breadcrumbs, Button, ButtonGroup, Card, Checkbox, Chip, CollectionCard, CollectionListViewPremium, CollectionSkeleton, Container, Dialog, Divider, Drawer, Dropdown, FloatingActionButton, FormControl, Grid, GroupCard, IconButton, ImageList, Input, InputAdornment, InputLabel, LinearProgress, Link, List, Menu, MenuItem, Modal, NewBlerp, NewBlerpTest, NewCollectionModal, NewDropdown, Pagination, Paper, Popover, RadioButton, Rating, Select, Skeleton, Slider, Snackbar, SpeedDial, Stack, Stepper, SvgIcon, Switch, Tab, Table, Tabs, Text, Theme, ThemeProvider, Themes, Toggle, Toolbar, Tooltip, UserCard, UsernameWithPopout, createTheme, darkThemeV1, lightThemeV1, mainTheme };
372
+ export { Accordion, AccordionActions, AccordionDetails, AccordionSummary, Alert, AlertTitle, AppBar, Autocomplete, Avatar, Backdrop, Badge, Blerp, BlerpAudioContextProvider, BlerpListView, BlerpListViewPremium, BlerpListViewSkeleton, BlerpSkeleton, BottomNavigation, Box, Breadcrumbs, Button, ButtonGroup, Card, Checkbox, Chip, CircularProgress, CollectionCard, CollectionListViewPremium, CollectionSkeleton, Container, Dialog, Divider, Drawer, Dropdown, FloatingActionButton, FormControl, Grid, GroupCard, IconButton, ImageList, Input, InputAdornment, InputLabel, LinearProgress, Link, List, Menu, MenuItem, Modal, NewBlerp, NewBlerpTest, NewCollectionModal, NewDropdown, Pagination, Paper, Popover, RadioButton, Rating, Select, Skeleton, Slider, Snackbar, SpeedDial, Stack, Stepper, SvgIcon, Switch, Tab, Table, Tabs, Text, Theme, ThemeProvider, Themes, Toggle, Toolbar, Tooltip, UserCard, UsernameWithPopout, createTheme, darkThemeV1, lightThemeV1, mainTheme };
@@ -0,0 +1,274 @@
1
+ import _extends from '@babel/runtime/helpers/extends';
2
+ import _defineProperty from '@babel/runtime/helpers/defineProperty';
3
+ import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
4
+ import React, { useState, useRef, useEffect } from 'react';
5
+ import { withSx } from './withSx.js';
6
+ import { TextField } from './Input.js';
7
+ import { Paper } from './Paper.js';
8
+
9
+ const _excluded = ["options", "value", "defaultValue", "onChange", "onInputChange", "inputValue", "getOptionLabel", "isOptionEqualToValue", "filterOptions", "renderInput", "renderOption", "renderTags", "multiple", "freeSolo", "disabled", "disableClearable", "loading", "loadingText", "noOptionsText", "open", "onOpen", "onClose", "autoComplete", "autoHighlight", "clearOnBlur", "clearOnEscape", "disableCloseOnSelect", "disableListWrap", "disablePortal", "fullWidth", "groupBy", "includeInputInList", "limitTags", "ListboxComponent", "ListboxProps", "openOnFocus", "PaperComponent", "PopperComponent", "popupIcon", "readOnly", "selectOnFocus", "size", "clearIcon", "forcePopupIcon", "placeholder", "className", "style"];
10
+
11
+ 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; }
12
+
13
+ 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; }
14
+
15
+ const canUseDOM = () => typeof window !== 'undefined' && typeof document !== 'undefined';
16
+ /**
17
+ * Autocomplete - combo box with filtering
18
+ */
19
+
20
+
21
+ const AutocompleteBase = /*#__PURE__*/React.forwardRef((_ref, ref) => {
22
+ let {
23
+ options = [],
24
+ value,
25
+ defaultValue,
26
+ onChange,
27
+ onInputChange,
28
+ inputValue: controlledInputValue,
29
+ getOptionLabel = option => {
30
+ var _ref2, _option$label, _option$toString;
31
+
32
+ return (_ref2 = (_option$label = option === null || option === void 0 ? void 0 : option.label) !== null && _option$label !== void 0 ? _option$label : option === null || option === void 0 ? void 0 : (_option$toString = option.toString) === null || _option$toString === void 0 ? void 0 : _option$toString.call(option)) !== null && _ref2 !== void 0 ? _ref2 : "";
33
+ },
34
+ isOptionEqualToValue = (option, value) => option === value,
35
+ filterOptions,
36
+ renderInput,
37
+ renderOption,
38
+ renderTags,
39
+ multiple = false,
40
+ freeSolo = false,
41
+ disabled = false,
42
+ disableClearable = false,
43
+ loading = false,
44
+ loadingText = "Loading…",
45
+ noOptionsText = "No options",
46
+ open: controlledOpen,
47
+ onOpen,
48
+ onClose,
49
+ autoComplete = false,
50
+ autoHighlight = false,
51
+ clearOnBlur = !freeSolo,
52
+ clearOnEscape = false,
53
+ disableCloseOnSelect = false,
54
+ disableListWrap = false,
55
+ disablePortal = false,
56
+ fullWidth = false,
57
+ groupBy,
58
+ includeInputInList = false,
59
+ limitTags = -1,
60
+ ListboxComponent = "ul",
61
+ ListboxProps,
62
+ openOnFocus = false,
63
+ PaperComponent = Paper,
64
+ PopperComponent,
65
+ popupIcon,
66
+ readOnly = false,
67
+ selectOnFocus = false,
68
+ size = "medium",
69
+ clearIcon,
70
+ forcePopupIcon = "auto",
71
+ placeholder,
72
+ className,
73
+ style
74
+ } = _ref,
75
+ props = _objectWithoutProperties(_ref, _excluded);
76
+
77
+ const [internalOpen, setInternalOpen] = useState(false);
78
+ const [internalInputValue, setInternalInputValue] = useState("");
79
+ const [internalValue, setInternalValue] = useState(multiple ? defaultValue || [] : defaultValue || null);
80
+ const inputRef = useRef(null);
81
+ const listboxRef = useRef(null);
82
+ const open = controlledOpen !== undefined ? controlledOpen : internalOpen;
83
+ const inputValue = controlledInputValue !== undefined ? controlledInputValue : internalInputValue;
84
+ const selectedValue = value !== undefined ? value : internalValue;
85
+
86
+ const handleOpen = () => {
87
+ if (disabled || readOnly) return;
88
+ setInternalOpen(true);
89
+ onOpen === null || onOpen === void 0 ? void 0 : onOpen();
90
+ };
91
+
92
+ const handleClose = () => {
93
+ setInternalOpen(false);
94
+ onClose === null || onClose === void 0 ? void 0 : onClose();
95
+ };
96
+
97
+ const handleInputChange = event => {
98
+ const newValue = event.target.value;
99
+ setInternalInputValue(newValue);
100
+ onInputChange === null || onInputChange === void 0 ? void 0 : onInputChange(event, newValue, "input");
101
+ if (!open) handleOpen();
102
+ };
103
+
104
+ const handleSelect = option => {
105
+ if (multiple) {
106
+ const newValue = Array.isArray(selectedValue) ? selectedValue.some(v => isOptionEqualToValue(option, v)) ? selectedValue.filter(v => !isOptionEqualToValue(option, v)) : [...selectedValue, option] : [option];
107
+ setInternalValue(newValue);
108
+ onChange === null || onChange === void 0 ? void 0 : onChange(null, newValue, "selectOption");
109
+ } else {
110
+ setInternalValue(option);
111
+ setInternalInputValue(getOptionLabel(option));
112
+ onChange === null || onChange === void 0 ? void 0 : onChange(null, option, "selectOption");
113
+ if (!disableCloseOnSelect) handleClose();
114
+ }
115
+ };
116
+
117
+ const handleClear = event => {
118
+ event.stopPropagation();
119
+ setInternalValue(multiple ? [] : null);
120
+ setInternalInputValue("");
121
+ onChange === null || onChange === void 0 ? void 0 : onChange(event, multiple ? [] : null, "clear");
122
+ onInputChange === null || onInputChange === void 0 ? void 0 : onInputChange(event, "", "clear");
123
+ }; // Filter options
124
+
125
+
126
+ const filteredOptions = filterOptions ? filterOptions(options, {
127
+ inputValue,
128
+ getOptionLabel
129
+ }) : options.filter(option => getOptionLabel(option).toLowerCase().includes(inputValue.toLowerCase())); // Group options if groupBy provided
130
+
131
+ const groupedOptions = groupBy ? filteredOptions.reduce((acc, option) => {
132
+ const group = groupBy(option);
133
+ if (!acc[group]) acc[group] = [];
134
+ acc[group].push(option);
135
+ return acc;
136
+ }, {}) : null;
137
+
138
+ const baseStyle = _objectSpread({
139
+ position: "relative",
140
+ display: "inline-flex",
141
+ flexDirection: "column",
142
+ width: fullWidth ? "100%" : undefined
143
+ }, style);
144
+
145
+ const listboxStyle = {
146
+ position: "absolute",
147
+ top: "100%",
148
+ left: 0,
149
+ right: 0,
150
+ zIndex: 1300,
151
+ maxHeight: 300,
152
+ overflow: "auto",
153
+ margin: 0,
154
+ padding: 0,
155
+ listStyle: "none",
156
+ backgroundColor: "#FFFFFF",
157
+ borderRadius: 4,
158
+ boxShadow: "0 2px 4px -1px rgba(0,0,0,0.2), 0 4px 5px 0 rgba(0,0,0,0.14), 0 1px 10px 0 rgba(0,0,0,0.12)"
159
+ };
160
+
161
+ const optionStyle = (isSelected, isHighlighted) => ({
162
+ padding: "8px 16px",
163
+ cursor: "pointer",
164
+ backgroundColor: isSelected ? "#E3F2FD" : isHighlighted ? "#F5F5F5" : "transparent"
165
+ }); // Close on outside click
166
+
167
+
168
+ useEffect(() => {
169
+ if (!canUseDOM()) return;
170
+
171
+ const handleClickOutside = event => {
172
+ if (inputRef.current && !inputRef.current.contains(event.target) && listboxRef.current && !listboxRef.current.contains(event.target)) {
173
+ handleClose();
174
+ }
175
+ };
176
+
177
+ document.addEventListener("mousedown", handleClickOutside);
178
+ return () => document.removeEventListener("mousedown", handleClickOutside);
179
+ }, []);
180
+ const inputProps = {
181
+ ref: inputRef,
182
+ value: inputValue,
183
+ onChange: handleInputChange,
184
+ onFocus: openOnFocus ? handleOpen : undefined,
185
+ disabled,
186
+ readOnly,
187
+ placeholder,
188
+ size
189
+ };
190
+ const showClearButton = !disableClearable && !disabled && !readOnly && (multiple ? (selectedValue === null || selectedValue === void 0 ? void 0 : selectedValue.length) > 0 : selectedValue !== null);
191
+ return /*#__PURE__*/React.createElement("div", _extends({
192
+ ref: ref,
193
+ className: className,
194
+ style: baseStyle
195
+ }, props), renderInput ? renderInput(_objectSpread(_objectSpread({}, inputProps), {}, {
196
+ InputProps: {
197
+ endAdornment: /*#__PURE__*/React.createElement(React.Fragment, null, showClearButton && /*#__PURE__*/React.createElement("button", {
198
+ onClick: handleClear,
199
+ style: {
200
+ background: "none",
201
+ border: "none",
202
+ cursor: "pointer",
203
+ padding: 4
204
+ }
205
+ }, clearIcon || "×"), forcePopupIcon !== false && /*#__PURE__*/React.createElement("button", {
206
+ onClick: () => open ? handleClose() : handleOpen(),
207
+ style: {
208
+ background: "none",
209
+ border: "none",
210
+ cursor: "pointer",
211
+ padding: 4,
212
+ transform: open ? "rotate(180deg)" : "none"
213
+ }
214
+ }, popupIcon || "▼"))
215
+ }
216
+ })) : /*#__PURE__*/React.createElement(TextField, inputProps), open && /*#__PURE__*/React.createElement(PaperComponent, {
217
+ style: listboxStyle
218
+ }, /*#__PURE__*/React.createElement(ListboxComponent, _extends({
219
+ ref: listboxRef
220
+ }, ListboxProps), loading ? /*#__PURE__*/React.createElement("li", {
221
+ style: {
222
+ padding: "8px 16px",
223
+ color: "#757575"
224
+ }
225
+ }, loadingText) : filteredOptions.length === 0 ? /*#__PURE__*/React.createElement("li", {
226
+ style: {
227
+ padding: "8px 16px",
228
+ color: "#757575"
229
+ }
230
+ }, noOptionsText) : groupedOptions ? Object.entries(groupedOptions).map(_ref3 => {
231
+ let [group, groupOptions] = _ref3;
232
+ return /*#__PURE__*/React.createElement("li", {
233
+ key: group
234
+ }, /*#__PURE__*/React.createElement("div", {
235
+ style: {
236
+ padding: "8px 16px",
237
+ fontWeight: 600,
238
+ backgroundColor: "#F5F5F5"
239
+ }
240
+ }, group), /*#__PURE__*/React.createElement("ul", {
241
+ style: {
242
+ listStyle: "none",
243
+ margin: 0,
244
+ padding: 0
245
+ }
246
+ }, groupOptions.map((option, index) => {
247
+ const isSelected = multiple ? selectedValue === null || selectedValue === void 0 ? void 0 : selectedValue.some(v => isOptionEqualToValue(option, v)) : isOptionEqualToValue(option, selectedValue);
248
+ return /*#__PURE__*/React.createElement("li", {
249
+ key: index,
250
+ style: optionStyle(isSelected, false),
251
+ onClick: () => handleSelect(option)
252
+ }, renderOption ? renderOption({
253
+ option
254
+ }, option, {
255
+ selected: isSelected
256
+ }) : getOptionLabel(option));
257
+ })));
258
+ }) : filteredOptions.map((option, index) => {
259
+ const isSelected = multiple ? selectedValue === null || selectedValue === void 0 ? void 0 : selectedValue.some(v => isOptionEqualToValue(option, v)) : isOptionEqualToValue(option, selectedValue);
260
+ return /*#__PURE__*/React.createElement("li", {
261
+ key: index,
262
+ style: optionStyle(isSelected, false),
263
+ onClick: () => handleSelect(option)
264
+ }, renderOption ? renderOption({
265
+ option
266
+ }, option, {
267
+ selected: isSelected
268
+ }) : getOptionLabel(option));
269
+ }))));
270
+ });
271
+ AutocompleteBase.displayName = "Autocomplete";
272
+ const Autocomplete = withSx(AutocompleteBase);
273
+
274
+ export { Autocomplete };
@@ -0,0 +1,109 @@
1
+ import _extends from '@babel/runtime/helpers/extends';
2
+ import _defineProperty from '@babel/runtime/helpers/defineProperty';
3
+ import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
4
+ import React from 'react';
5
+ import { withSx } from './withSx.js';
6
+
7
+ const _excluded = ["children", "value", "onChange", "showLabels", "className", "style"],
8
+ _excluded2 = ["icon", "label", "value", "selected", "showLabel", "onChange", "className", "style"];
9
+
10
+ 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; }
11
+
12
+ 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; }
13
+ /**
14
+ * BottomNavigation - navigation bar at bottom of screen
15
+ */
16
+
17
+ const BottomNavigationBase = /*#__PURE__*/React.forwardRef((_ref, ref) => {
18
+ let {
19
+ children,
20
+ value,
21
+ onChange,
22
+ showLabels = false,
23
+ className,
24
+ style
25
+ } = _ref,
26
+ props = _objectWithoutProperties(_ref, _excluded);
27
+
28
+ const baseStyle = _objectSpread({
29
+ display: "flex",
30
+ justifyContent: "center",
31
+ alignItems: "center",
32
+ height: 56,
33
+ backgroundColor: "#FFFFFF",
34
+ boxShadow: "0 -1px 3px rgba(0,0,0,0.12)"
35
+ }, style);
36
+
37
+ return /*#__PURE__*/React.createElement("div", _extends({
38
+ ref: ref,
39
+ className: className,
40
+ style: baseStyle
41
+ }, props), React.Children.map(children, (child, index) => /*#__PURE__*/React.isValidElement(child) ? /*#__PURE__*/React.cloneElement(child, {
42
+ selected: value === index || value === child.props.value,
43
+ showLabel: showLabels || child.props.showLabel,
44
+ onChange: event => {
45
+ var _child$props$value;
46
+
47
+ return onChange === null || onChange === void 0 ? void 0 : onChange(event, (_child$props$value = child.props.value) !== null && _child$props$value !== void 0 ? _child$props$value : index);
48
+ }
49
+ }) : child));
50
+ });
51
+ BottomNavigationBase.displayName = "BottomNavigation";
52
+ const BottomNavigation = withSx(BottomNavigationBase);
53
+ /**
54
+ * BottomNavigationAction - individual action in BottomNavigation
55
+ */
56
+
57
+ const BottomNavigationActionBase = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
58
+ let {
59
+ icon,
60
+ label,
61
+ value,
62
+ selected = false,
63
+ showLabel = false,
64
+ onChange,
65
+ className,
66
+ style
67
+ } = _ref2,
68
+ props = _objectWithoutProperties(_ref2, _excluded2);
69
+
70
+ const baseStyle = _objectSpread({
71
+ display: "flex",
72
+ flexDirection: "column",
73
+ alignItems: "center",
74
+ justifyContent: "center",
75
+ flex: 1,
76
+ minWidth: 80,
77
+ maxWidth: 168,
78
+ padding: "6px 12px",
79
+ cursor: "pointer",
80
+ backgroundColor: "transparent",
81
+ border: "none",
82
+ color: selected ? "#7C4DFF" : "#757575",
83
+ transition: "color 0.2s"
84
+ }, style);
85
+
86
+ const iconStyle = {
87
+ fontSize: 24,
88
+ marginBottom: showLabel || selected ? 4 : 0
89
+ };
90
+ const labelStyle = {
91
+ fontSize: 12,
92
+ opacity: showLabel || selected ? 1 : 0,
93
+ transition: "opacity 0.2s"
94
+ };
95
+ return /*#__PURE__*/React.createElement("button", _extends({
96
+ ref: ref,
97
+ className: className,
98
+ style: baseStyle,
99
+ onClick: onChange
100
+ }, props), /*#__PURE__*/React.createElement("span", {
101
+ style: iconStyle
102
+ }, icon), (showLabel || selected) && /*#__PURE__*/React.createElement("span", {
103
+ style: labelStyle
104
+ }, label));
105
+ });
106
+ BottomNavigationActionBase.displayName = "BottomNavigationAction";
107
+ withSx(BottomNavigationActionBase);
108
+
109
+ export { BottomNavigation };
@@ -0,0 +1,36 @@
1
+ import _extends from '@babel/runtime/helpers/extends';
2
+ import _defineProperty from '@babel/runtime/helpers/defineProperty';
3
+ import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
4
+ import React from 'react';
5
+ import { withSx } from './withSx.js';
6
+
7
+ const _excluded = ["component", "children", "sx"];
8
+
9
+ 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; }
10
+
11
+ 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; }
12
+ /**
13
+ * Box - The fundamental layout component (replaces MUI Box)
14
+ * A div with sx prop support
15
+ */
16
+
17
+ const BaseBox = /*#__PURE__*/React.forwardRef((_ref, ref) => {
18
+ let {
19
+ component: Component = 'div',
20
+ children,
21
+ sx
22
+ } = _ref,
23
+ props = _objectWithoutProperties(_ref, _excluded);
24
+
25
+ return /*#__PURE__*/React.createElement(Component, _extends({
26
+ ref: ref
27
+ }, props, {
28
+ sx: _objectSpread({
29
+ padding: '16px'
30
+ }, sx)
31
+ }), children);
32
+ });
33
+ BaseBox.displayName = 'BaseBox';
34
+ const Box = withSx(BaseBox);
35
+
36
+ export { Box, Box as default };