myshell-react-lib 0.1.0 → 0.1.1

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/dist/index.cjs CHANGED
@@ -670,6 +670,9 @@ __export(index_exports, {
670
670
  Link: function() {
671
671
  return Link;
672
672
  },
673
+ Masonry: function() {
674
+ return Masonry;
675
+ },
673
676
  Menubar: function() {
674
677
  return Menubar;
675
678
  },
@@ -862,6 +865,9 @@ __export(index_exports, {
862
865
  SliderSingle: function() {
863
866
  return SliderSingle;
864
867
  },
868
+ Spinner: function() {
869
+ return Spinner;
870
+ },
865
871
  SubHeading: function() {
866
872
  return SubHeading;
867
873
  },
@@ -4076,6 +4082,90 @@ var import_lodash_es = require("lodash-es");
4076
4082
  var import_react10 = require("react");
4077
4083
  var import_jsx_runtime32 = require("react/jsx-runtime");
4078
4084
  var import_react11 = require("react");
4085
+ var Masonry = function(param) {
4086
+ var _param_breakpointCols = param.breakpointCols, breakpointCols = _param_breakpointCols === void 0 ? {
4087
+ default: 0,
4088
+ 3280: 5,
4089
+ 1919: 4,
4090
+ 1439: 3,
4091
+ 1199: 2
4092
+ } : _param_breakpointCols, _param_className = param.className, className = _param_className === void 0 ? "" : _param_className, _param_columnClassName = param.columnClassName, columnClassName = _param_columnClassName === void 0 ? "" : _param_columnClassName, children = param.children, _param_columnAttrs = param.columnAttrs, columnAttrs = _param_columnAttrs === void 0 ? {} : _param_columnAttrs, heights = param.heights;
4093
+ var _ref = _sliced_to_array((0, import_react10.useState)(typeof breakpointCols === "number" ? breakpointCols : breakpointCols.default), 2), columnCount = _ref[0], setColumnCount = _ref[1];
4094
+ var reCalculateColumnCount = function() {
4095
+ var _window;
4096
+ var windowWidth = ((_window = window) === null || _window === void 0 ? void 0 : _window.innerWidth) || Infinity;
4097
+ var newColumnCount = columnCount;
4098
+ if ((typeof breakpointCols === "undefined" ? "undefined" : _type_of(breakpointCols)) === "object") {
4099
+ var matchedBreakpoint = Infinity;
4100
+ for(var breakpoint in breakpointCols){
4101
+ var optBreakpoint = parseInt(breakpoint);
4102
+ var isCurrentBreakpoint = optBreakpoint > 0 && windowWidth <= optBreakpoint;
4103
+ if (isCurrentBreakpoint && optBreakpoint < matchedBreakpoint) {
4104
+ matchedBreakpoint = optBreakpoint;
4105
+ newColumnCount = breakpointCols[breakpoint];
4106
+ }
4107
+ }
4108
+ newColumnCount = Math.max(1, newColumnCount || 1);
4109
+ }
4110
+ if (columnCount !== newColumnCount) {
4111
+ setColumnCount(newColumnCount);
4112
+ }
4113
+ };
4114
+ (0, import_react10.useEffect)(function() {
4115
+ var handleResize = function() {
4116
+ reCalculateColumnCount();
4117
+ };
4118
+ window.addEventListener("resize", handleResize);
4119
+ handleResize();
4120
+ return function() {
4121
+ window.removeEventListener("resize", handleResize);
4122
+ };
4123
+ }, [
4124
+ breakpointCols,
4125
+ columnCount
4126
+ ]);
4127
+ var itemsInColumns = function() {
4128
+ var columns = new Array(columnCount);
4129
+ var totals = new Array(columnCount).fill(0);
4130
+ var items = import_react10.Children.toArray(children);
4131
+ if (heights) {
4132
+ for(var i = 0; i < items.length; i++){
4133
+ var columnIndex = (0, import_lodash_es.indexOf)(totals, (0, import_lodash_es.min)(totals));
4134
+ if (!columns[columnIndex]) {
4135
+ columns[columnIndex] = [];
4136
+ }
4137
+ columns[columnIndex].push(items[i]);
4138
+ totals[columnIndex] += heights[i];
4139
+ }
4140
+ } else {
4141
+ for(var i1 = 0; i1 < items.length; i1++){
4142
+ var columnIndex1 = i1 % columnCount;
4143
+ if (!columns[columnIndex1]) {
4144
+ columns[columnIndex1] = [];
4145
+ }
4146
+ columns[columnIndex1].push(items[i1]);
4147
+ }
4148
+ }
4149
+ return columns;
4150
+ };
4151
+ var renderColumns = function() {
4152
+ var childrenInColumns = itemsInColumns();
4153
+ var columnWidth = "".concat(100 / childrenInColumns.length, "%");
4154
+ return childrenInColumns.map(function(items, i) {
4155
+ return /* @__PURE__ */ (0, import_react11.createElement)("div", _object_spread_props(_object_spread({}, columnAttrs), {
4156
+ style: _object_spread_props(_object_spread({}, columnAttrs.style), {
4157
+ width: columnWidth
4158
+ }),
4159
+ className: cn("space-y-2 bg-clip-padding pl-2 md:space-y-5 md:pl-5", columnClassName),
4160
+ key: i
4161
+ }), items);
4162
+ });
4163
+ };
4164
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", _object_spread_props(_object_spread({}, columnAttrs), {
4165
+ className: cn("mr-4 flex w-auto md:mr-6", className || "my-masonry-grid"),
4166
+ children: columnCount > 0 && renderColumns()
4167
+ }));
4168
+ };
4079
4169
  // src/components/menubar.tsx
4080
4170
  var React23 = __toESM(require("react"), 1);
4081
4171
  var MenubarPrimitive = __toESM(require("@radix-ui/react-menubar"), 1);
@@ -9540,6 +9630,7 @@ var Message = /*#__PURE__*/ function() {
9540
9630
  Input: Input,
9541
9631
  Label: Label,
9542
9632
  Link: Link,
9633
+ Masonry: Masonry,
9543
9634
  Menubar: Menubar,
9544
9635
  MenubarCheckboxItem: MenubarCheckboxItem,
9545
9636
  MenubarContent: MenubarContent,
@@ -9604,6 +9695,7 @@ var Message = /*#__PURE__*/ function() {
9604
9695
  Skeleton: Skeleton,
9605
9696
  Slider: Slider,
9606
9697
  SliderSingle: SliderSingle,
9698
+ Spinner: Spinner,
9607
9699
  SubHeading: SubHeading,
9608
9700
  SubTitle: SubTitle,
9609
9701
  Swiper: Swiper,