@dreamtree-org/twreact-ui 1.0.98 → 1.0.100

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.esm.js CHANGED
@@ -16517,7 +16517,7 @@ var Breadcrumbs = function Breadcrumbs(_ref) {
16517
16517
  }));
16518
16518
  };
16519
16519
 
16520
- var _excluded$8 = ["isOpen", "onClose", "title", "children", "size", "dismissible", "showCloseButton", "footer", "className"],
16520
+ var _excluded$8 = ["isOpen", "onClose", "title", "children", "size", "dismissible", "showCloseButton", "footer", "className", "onOpen"],
16521
16521
  _excluded2$1 = ["children", "className"],
16522
16522
  _excluded3$1 = ["children", "className"],
16523
16523
  _excluded4$1 = ["children", "className"];
@@ -16534,6 +16534,7 @@ var Dialog = function Dialog(_ref) {
16534
16534
  showCloseButton = _ref$showCloseButton === void 0 ? true : _ref$showCloseButton,
16535
16535
  footer = _ref.footer,
16536
16536
  className = _ref.className,
16537
+ onOpen = _ref.onOpen,
16537
16538
  props = _objectWithoutProperties$1(_ref, _excluded$8);
16538
16539
  var dialogRef = useRef(null);
16539
16540
  useEffect(function () {
@@ -16541,6 +16542,9 @@ var Dialog = function Dialog(_ref) {
16541
16542
  var _dialogRef$current;
16542
16543
  document.body.style.overflow = 'hidden';
16543
16544
  (_dialogRef$current = dialogRef.current) === null || _dialogRef$current === void 0 || _dialogRef$current.focus();
16545
+ onOpen === null || onOpen === void 0 || onOpen({
16546
+ dialogRef: dialogRef.current
16547
+ });
16544
16548
  } else {
16545
16549
  document.body.style.overflow = 'unset';
16546
16550
  }
@@ -17366,6 +17370,97 @@ var FileUpload = function FileUpload(_ref) {
17366
17370
  })));
17367
17371
  };
17368
17372
 
17373
+ var Condition = function Condition(_ref) {
17374
+ var condition = _ref.condition,
17375
+ children = _ref.children,
17376
+ _ref$fallback = _ref.fallback,
17377
+ fallback = _ref$fallback === void 0 ? null : _ref$fallback;
17378
+ return condition ? children : fallback;
17379
+ };
17380
+
17381
+ function Carousel(props) {
17382
+ var children = props.children,
17383
+ _props$autoPlay = props.autoPlay,
17384
+ autoPlay = _props$autoPlay === void 0 ? false : _props$autoPlay,
17385
+ _props$interval = props.interval,
17386
+ interval = _props$interval === void 0 ? 5000 : _props$interval,
17387
+ _props$showDots = props.showDots,
17388
+ showDots = _props$showDots === void 0 ? true : _props$showDots,
17389
+ className = props.className,
17390
+ itemClassName = props.itemClassName;
17391
+ var _React$useState = React__default.useState(0),
17392
+ _React$useState2 = _slicedToArray(_React$useState, 2),
17393
+ currentIndex = _React$useState2[0],
17394
+ setCurrentIndex = _React$useState2[1];
17395
+ var _React$useState3 = React__default.useState(false),
17396
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
17397
+ isPaused = _React$useState4[0],
17398
+ setIsPaused = _React$useState4[1];
17399
+ var timerRef = React__default.useRef(null);
17400
+ var next = React__default.useCallback(function () {
17401
+ setCurrentIndex(function (prevIndex) {
17402
+ return (prevIndex + 1) % React__default.Children.count(children);
17403
+ });
17404
+ }, [children]);
17405
+ var prev = React__default.useCallback(function () {
17406
+ var count = React__default.Children.count(children);
17407
+ setCurrentIndex(function (prevIndex) {
17408
+ return (prevIndex - 1 + count) % count;
17409
+ });
17410
+ }, [children]);
17411
+ React__default.useEffect(function () {
17412
+ if (autoPlay && !isPaused) {
17413
+ timerRef.current = setInterval(next, interval);
17414
+ }
17415
+ return function () {
17416
+ if (timerRef.current) clearInterval(timerRef.current);
17417
+ };
17418
+ }, [autoPlay, isPaused, next, interval]);
17419
+ var childrenArray = React__default.Children.toArray(children);
17420
+ return /*#__PURE__*/React__default.createElement("div", {
17421
+ className: cn$1("relative group overflow-hidden rounded-xl bg-card border border-border/50 shadow-sm", className),
17422
+ onMouseEnter: function onMouseEnter() {
17423
+ return setIsPaused(true);
17424
+ },
17425
+ onMouseLeave: function onMouseLeave() {
17426
+ return setIsPaused(false);
17427
+ }
17428
+ }, /*#__PURE__*/React__default.createElement("div", {
17429
+ className: "flex transition-transform duration-500 ease-out",
17430
+ style: {
17431
+ transform: "translateX(-".concat(currentIndex * 100, "%)")
17432
+ }
17433
+ }, childrenArray.map(function (child, index) {
17434
+ return /*#__PURE__*/React__default.createElement("div", {
17435
+ key: index,
17436
+ className: cn$1("w-full flex-shrink-0 min-w-full", itemClassName)
17437
+ }, child);
17438
+ })), /*#__PURE__*/React__default.createElement("button", {
17439
+ onClick: prev,
17440
+ className: "absolute left-4 top-1/2 -translate-y-1/2 z-10 p-2 rounded-full bg-background/80 backdrop-blur-md border border-border/50 text-foreground opacity-0 group-hover:opacity-100 transition-all hover:bg-background shadow-lg focus:outline-none focus:ring-2 focus:ring-primary",
17441
+ "aria-label": "Previous slide"
17442
+ }, /*#__PURE__*/React__default.createElement(ChevronLeft, {
17443
+ className: "w-5 h-5 text-white"
17444
+ })), /*#__PURE__*/React__default.createElement("button", {
17445
+ onClick: next,
17446
+ className: "absolute right-4 top-1/2 -translate-y-1/2 z-10 p-2 rounded-full bg-background/80 backdrop-blur-md border border-border/50 text-foreground opacity-0 group-hover:opacity-100 transition-all hover:bg-background shadow-lg focus:outline-none focus:ring-2 focus:ring-primary",
17447
+ "aria-label": "Next slide"
17448
+ }, /*#__PURE__*/React__default.createElement(ChevronRight, {
17449
+ className: "w-5 h-5 text-white"
17450
+ })), showDots && /*#__PURE__*/React__default.createElement("div", {
17451
+ className: "absolute bottom-4 left-1/2 -translate-x-1/2 flex gap-2 z-10"
17452
+ }, childrenArray.map(function (_, index) {
17453
+ return /*#__PURE__*/React__default.createElement("button", {
17454
+ key: index,
17455
+ onClick: function onClick() {
17456
+ return setCurrentIndex(index);
17457
+ },
17458
+ className: cn$1("w-2 h-2 rounded-full transition-all duration-300", currentIndex === index ? "bg-primary w-6" : "bg-muted-foreground/30 hover:bg-muted-foreground/50"),
17459
+ "aria-label": "Go to slide ".concat(index + 1)
17460
+ });
17461
+ })));
17462
+ }
17463
+
17369
17464
  var ThemeContext = /*#__PURE__*/createContext();
17370
17465
  var useTheme = function useTheme() {
17371
17466
  var context = useContext(ThemeContext);
@@ -20899,7 +20994,10 @@ var TrackingPromise = /*#__PURE__*/function () {
20899
20994
  var helperInstance = new Helpers();
20900
20995
 
20901
20996
  // src/store/cartSlice.js
20902
- var storeInstance = {};
20997
+ var storeInstance = {
20998
+ actions: {}
20999
+ };
21000
+ var promiseMap = new Map();
20903
21001
  function getStore() {
20904
21002
  var initialState = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
20905
21003
  var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
@@ -20909,8 +21007,22 @@ function getStore() {
20909
21007
  reducers: {
20910
21008
  setStore: function setStore(state, _ref) {
20911
21009
  var payload = _ref.payload;
20912
- context.changes.push(payload);
20913
- var newState = helperInstance.setNested(state, payload.name, payload.value);
21010
+ // Extract only serializable data
21011
+ var name = payload.name,
21012
+ value = payload.value,
21013
+ uniqueId = payload.uniqueId;
21014
+
21015
+ // Store change event for listener middleware (without promise)
21016
+ // Note: We no longer store resolve/reject functions here - they're in promiseMap
21017
+ if (context.changes) {
21018
+ var changeEvent = {
21019
+ name: name,
21020
+ value: value,
21021
+ uniqueId: uniqueId
21022
+ };
21023
+ context.changes.push(changeEvent);
21024
+ }
21025
+ var newState = helperInstance.setNested(state, name, value);
20914
21026
  return newState;
20915
21027
  }
20916
21028
  }
@@ -20966,20 +21078,36 @@ var useMixins = function useMixins(name) {
20966
21078
  };
20967
21079
  var setStore = function setStore(name, value) {
20968
21080
  var timestamp = Date.now();
20969
- var changeEvent = {
21081
+ var uniqueId = timestamp;
21082
+
21083
+ // Create promise - the TrackingPromise has resolve/reject methods we can call
21084
+ var promise = new TrackingPromise(function () {
21085
+ // Callback is called but we don't need to store resolve/reject here
21086
+ // We'll use promise.resolve() and promise.reject() methods directly
21087
+ });
21088
+
21089
+ // Store promise in module-level map (not in action payload)
21090
+ promiseMap.set(uniqueId, promise);
21091
+
21092
+ // Create a completely clean, serializable payload object
21093
+ // Only include primitive/serializable values - no promises, no functions
21094
+ var cleanPayload = {
20970
21095
  name: name,
20971
21096
  value: value,
20972
- uniqueId: timestamp,
20973
- promise: null,
20974
- resolve: null,
20975
- reject: null
21097
+ uniqueId: uniqueId
20976
21098
  };
20977
- var promise = new TrackingPromise(function (resolve, reject) {
20978
- changeEvent.resolve = resolve;
20979
- changeEvent.reject = reject;
20980
- });
20981
- changeEvent.promise = promise;
20982
- dispatch(storeInstance.actions.setStore(changeEvent));
21099
+
21100
+ // Dispatch using action creator if available, otherwise use action type directly
21101
+ // This handles the case where the store hasn't been initialized yet
21102
+ if (storeInstance.actions.setStore) {
21103
+ dispatch(storeInstance.actions.setStore(cleanPayload));
21104
+ } else {
21105
+ // Fallback: create action manually using the action type
21106
+ dispatch({
21107
+ type: 'store/setStore',
21108
+ payload: cleanPayload
21109
+ });
21110
+ }
20983
21111
  return promise;
20984
21112
  };
20985
21113
  var getStore = function getStore(name) {
@@ -26246,8 +26374,8 @@ function setupStore() {
26246
26374
  middleware: function middleware(getDefault) {
26247
26375
  return getDefault({
26248
26376
  serializableCheck: {
26249
- // Ignore redux-persist action types
26250
- ignoredActions: [FLUSH, REHYDRATE, PAUSE, PERSIST, PURGE, REGISTER]
26377
+ // Ignore redux-persist action types and setStore action
26378
+ ignoredActions: [FLUSH, REHYDRATE, PAUSE, PERSIST, PURGE, REGISTER, 'store/setStore']
26251
26379
  }
26252
26380
  }).concat(listenerMiddleware.middleware);
26253
26381
  },
@@ -26258,21 +26386,39 @@ function setupStore() {
26258
26386
  matcher: isAnyOf(actions.setStore),
26259
26387
  effect: function () {
26260
26388
  var _effect = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(action, api) {
26261
- var state, changeEvent;
26389
+ var state, stateSlice, changeEvent, uniqueId, value, promise;
26262
26390
  return _regeneratorRuntime.wrap(function (_context) {
26263
26391
  while (1) switch (_context.prev = _context.next) {
26264
26392
  case 0:
26265
- state = api.getState(); // already the **next** state
26266
- state.storeSlice;
26267
- changeEvent = action.payload; // do things after state is reduced
26268
- context.changes.forEach(function (change) {
26269
- if (change.uniqueId === changeEvent.uniqueId) {
26270
- change.resolve(changeEvent.value);
26393
+ try {
26394
+ state = api.getState(); // already the **next** state
26395
+ stateSlice = state.storeSlice;
26396
+ changeEvent = action.payload; // do things after state is reduced
26397
+ uniqueId = changeEvent.uniqueId, value = changeEvent.value; // Resolve promise from module-level map if it exists
26398
+ if (promiseMap && promiseMap.has(uniqueId)) {
26399
+ promise = promiseMap.get(uniqueId);
26400
+ if (promise && typeof promise.resolve === 'function') {
26401
+ promise.resolve(value);
26402
+ }
26403
+ // Clean up fulfilled promises
26404
+ if (promise && promise.isFulfilled()) {
26405
+ promiseMap["delete"](uniqueId);
26406
+ }
26271
26407
  }
26272
- });
26273
- context.changes = context.changes.filter(function (change) {
26274
- return !change.promise.isFulfilled();
26275
- });
26408
+
26409
+ // Clean up changes array - remove fulfilled promises
26410
+ context.changes = context.changes.filter(function (change) {
26411
+ // Check if promise still exists in promiseMap
26412
+ if (promiseMap && promiseMap.has(change.uniqueId)) {
26413
+ var _promise = promiseMap.get(change.uniqueId);
26414
+ return _promise && !_promise.isFulfilled();
26415
+ }
26416
+ return false;
26417
+ });
26418
+ } catch (error) {
26419
+ console.error('Error in setStore listener middleware:', error);
26420
+ // Don't throw - let the action complete even if promise resolution fails
26421
+ }
26276
26422
  case 1:
26277
26423
  case "end":
26278
26424
  return _context.stop();
@@ -26309,4 +26455,4 @@ var StoreProvider = function StoreProvider(_ref) {
26309
26455
  }, children));
26310
26456
  };
26311
26457
 
26312
- export { Accordion, Alert, Avatar, Badge, Breadcrumbs, Button, Card, Checkbox, ColorPicker, DatePicker, DateRangePicker, Dialog, EmitterClass as Emitter, FileUpload, FootNav, Form, Helpers, Input, Loader, LocationPicker, Navbar, Pagination, PriceRangePicker, ProgressBar, Radio, Rate, RoundedTag, Select, Sidebar, Skeleton, Stepper, StoreProvider, Switch, Table, Tabs, ThemeProvider, ThreeDotPopoverSimple as ThreeDotPopover, Toast, ToastContainer, Tooltip, cn$1 as cn, useApi, useMixins, useTheme, useToast };
26458
+ export { Accordion, Alert, Avatar, Badge, Breadcrumbs, Button, Card, Carousel, Checkbox, ColorPicker, Condition, DatePicker, DateRangePicker, Dialog, EmitterClass as Emitter, FileUpload, FootNav, Form, Helpers, Input, Loader, LocationPicker, Navbar, Pagination, PriceRangePicker, ProgressBar, Radio, Rate, RoundedTag, Select, Sidebar, Skeleton, Stepper, StoreProvider, Switch, Table, Tabs, ThemeProvider, ThreeDotPopoverSimple as ThreeDotPopover, Toast, ToastContainer, Tooltip, cn$1 as cn, useApi, useMixins, useTheme, useToast };
package/dist/index.js CHANGED
@@ -16537,7 +16537,7 @@ var Breadcrumbs = function Breadcrumbs(_ref) {
16537
16537
  }));
16538
16538
  };
16539
16539
 
16540
- var _excluded$8 = ["isOpen", "onClose", "title", "children", "size", "dismissible", "showCloseButton", "footer", "className"],
16540
+ var _excluded$8 = ["isOpen", "onClose", "title", "children", "size", "dismissible", "showCloseButton", "footer", "className", "onOpen"],
16541
16541
  _excluded2$1 = ["children", "className"],
16542
16542
  _excluded3$1 = ["children", "className"],
16543
16543
  _excluded4$1 = ["children", "className"];
@@ -16554,6 +16554,7 @@ var Dialog = function Dialog(_ref) {
16554
16554
  showCloseButton = _ref$showCloseButton === void 0 ? true : _ref$showCloseButton,
16555
16555
  footer = _ref.footer,
16556
16556
  className = _ref.className,
16557
+ onOpen = _ref.onOpen,
16557
16558
  props = _objectWithoutProperties$1(_ref, _excluded$8);
16558
16559
  var dialogRef = React.useRef(null);
16559
16560
  React.useEffect(function () {
@@ -16561,6 +16562,9 @@ var Dialog = function Dialog(_ref) {
16561
16562
  var _dialogRef$current;
16562
16563
  document.body.style.overflow = 'hidden';
16563
16564
  (_dialogRef$current = dialogRef.current) === null || _dialogRef$current === void 0 || _dialogRef$current.focus();
16565
+ onOpen === null || onOpen === void 0 || onOpen({
16566
+ dialogRef: dialogRef.current
16567
+ });
16564
16568
  } else {
16565
16569
  document.body.style.overflow = 'unset';
16566
16570
  }
@@ -17386,6 +17390,97 @@ var FileUpload = function FileUpload(_ref) {
17386
17390
  })));
17387
17391
  };
17388
17392
 
17393
+ var Condition = function Condition(_ref) {
17394
+ var condition = _ref.condition,
17395
+ children = _ref.children,
17396
+ _ref$fallback = _ref.fallback,
17397
+ fallback = _ref$fallback === void 0 ? null : _ref$fallback;
17398
+ return condition ? children : fallback;
17399
+ };
17400
+
17401
+ function Carousel(props) {
17402
+ var children = props.children,
17403
+ _props$autoPlay = props.autoPlay,
17404
+ autoPlay = _props$autoPlay === void 0 ? false : _props$autoPlay,
17405
+ _props$interval = props.interval,
17406
+ interval = _props$interval === void 0 ? 5000 : _props$interval,
17407
+ _props$showDots = props.showDots,
17408
+ showDots = _props$showDots === void 0 ? true : _props$showDots,
17409
+ className = props.className,
17410
+ itemClassName = props.itemClassName;
17411
+ var _React$useState = React.useState(0),
17412
+ _React$useState2 = _slicedToArray(_React$useState, 2),
17413
+ currentIndex = _React$useState2[0],
17414
+ setCurrentIndex = _React$useState2[1];
17415
+ var _React$useState3 = React.useState(false),
17416
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
17417
+ isPaused = _React$useState4[0],
17418
+ setIsPaused = _React$useState4[1];
17419
+ var timerRef = React.useRef(null);
17420
+ var next = React.useCallback(function () {
17421
+ setCurrentIndex(function (prevIndex) {
17422
+ return (prevIndex + 1) % React.Children.count(children);
17423
+ });
17424
+ }, [children]);
17425
+ var prev = React.useCallback(function () {
17426
+ var count = React.Children.count(children);
17427
+ setCurrentIndex(function (prevIndex) {
17428
+ return (prevIndex - 1 + count) % count;
17429
+ });
17430
+ }, [children]);
17431
+ React.useEffect(function () {
17432
+ if (autoPlay && !isPaused) {
17433
+ timerRef.current = setInterval(next, interval);
17434
+ }
17435
+ return function () {
17436
+ if (timerRef.current) clearInterval(timerRef.current);
17437
+ };
17438
+ }, [autoPlay, isPaused, next, interval]);
17439
+ var childrenArray = React.Children.toArray(children);
17440
+ return /*#__PURE__*/React.createElement("div", {
17441
+ className: cn$1("relative group overflow-hidden rounded-xl bg-card border border-border/50 shadow-sm", className),
17442
+ onMouseEnter: function onMouseEnter() {
17443
+ return setIsPaused(true);
17444
+ },
17445
+ onMouseLeave: function onMouseLeave() {
17446
+ return setIsPaused(false);
17447
+ }
17448
+ }, /*#__PURE__*/React.createElement("div", {
17449
+ className: "flex transition-transform duration-500 ease-out",
17450
+ style: {
17451
+ transform: "translateX(-".concat(currentIndex * 100, "%)")
17452
+ }
17453
+ }, childrenArray.map(function (child, index) {
17454
+ return /*#__PURE__*/React.createElement("div", {
17455
+ key: index,
17456
+ className: cn$1("w-full flex-shrink-0 min-w-full", itemClassName)
17457
+ }, child);
17458
+ })), /*#__PURE__*/React.createElement("button", {
17459
+ onClick: prev,
17460
+ className: "absolute left-4 top-1/2 -translate-y-1/2 z-10 p-2 rounded-full bg-background/80 backdrop-blur-md border border-border/50 text-foreground opacity-0 group-hover:opacity-100 transition-all hover:bg-background shadow-lg focus:outline-none focus:ring-2 focus:ring-primary",
17461
+ "aria-label": "Previous slide"
17462
+ }, /*#__PURE__*/React.createElement(ChevronLeft, {
17463
+ className: "w-5 h-5 text-white"
17464
+ })), /*#__PURE__*/React.createElement("button", {
17465
+ onClick: next,
17466
+ className: "absolute right-4 top-1/2 -translate-y-1/2 z-10 p-2 rounded-full bg-background/80 backdrop-blur-md border border-border/50 text-foreground opacity-0 group-hover:opacity-100 transition-all hover:bg-background shadow-lg focus:outline-none focus:ring-2 focus:ring-primary",
17467
+ "aria-label": "Next slide"
17468
+ }, /*#__PURE__*/React.createElement(ChevronRight, {
17469
+ className: "w-5 h-5 text-white"
17470
+ })), showDots && /*#__PURE__*/React.createElement("div", {
17471
+ className: "absolute bottom-4 left-1/2 -translate-x-1/2 flex gap-2 z-10"
17472
+ }, childrenArray.map(function (_, index) {
17473
+ return /*#__PURE__*/React.createElement("button", {
17474
+ key: index,
17475
+ onClick: function onClick() {
17476
+ return setCurrentIndex(index);
17477
+ },
17478
+ className: cn$1("w-2 h-2 rounded-full transition-all duration-300", currentIndex === index ? "bg-primary w-6" : "bg-muted-foreground/30 hover:bg-muted-foreground/50"),
17479
+ "aria-label": "Go to slide ".concat(index + 1)
17480
+ });
17481
+ })));
17482
+ }
17483
+
17389
17484
  var ThemeContext = /*#__PURE__*/React.createContext();
17390
17485
  var useTheme = function useTheme() {
17391
17486
  var context = React.useContext(ThemeContext);
@@ -20919,7 +21014,10 @@ var TrackingPromise = /*#__PURE__*/function () {
20919
21014
  var helperInstance = new Helpers();
20920
21015
 
20921
21016
  // src/store/cartSlice.js
20922
- var storeInstance = {};
21017
+ var storeInstance = {
21018
+ actions: {}
21019
+ };
21020
+ var promiseMap = new Map();
20923
21021
  function getStore() {
20924
21022
  var initialState = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
20925
21023
  var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
@@ -20929,8 +21027,22 @@ function getStore() {
20929
21027
  reducers: {
20930
21028
  setStore: function setStore(state, _ref) {
20931
21029
  var payload = _ref.payload;
20932
- context.changes.push(payload);
20933
- var newState = helperInstance.setNested(state, payload.name, payload.value);
21030
+ // Extract only serializable data
21031
+ var name = payload.name,
21032
+ value = payload.value,
21033
+ uniqueId = payload.uniqueId;
21034
+
21035
+ // Store change event for listener middleware (without promise)
21036
+ // Note: We no longer store resolve/reject functions here - they're in promiseMap
21037
+ if (context.changes) {
21038
+ var changeEvent = {
21039
+ name: name,
21040
+ value: value,
21041
+ uniqueId: uniqueId
21042
+ };
21043
+ context.changes.push(changeEvent);
21044
+ }
21045
+ var newState = helperInstance.setNested(state, name, value);
20934
21046
  return newState;
20935
21047
  }
20936
21048
  }
@@ -20986,20 +21098,36 @@ var useMixins = function useMixins(name) {
20986
21098
  };
20987
21099
  var setStore = function setStore(name, value) {
20988
21100
  var timestamp = Date.now();
20989
- var changeEvent = {
21101
+ var uniqueId = timestamp;
21102
+
21103
+ // Create promise - the TrackingPromise has resolve/reject methods we can call
21104
+ var promise = new TrackingPromise(function () {
21105
+ // Callback is called but we don't need to store resolve/reject here
21106
+ // We'll use promise.resolve() and promise.reject() methods directly
21107
+ });
21108
+
21109
+ // Store promise in module-level map (not in action payload)
21110
+ promiseMap.set(uniqueId, promise);
21111
+
21112
+ // Create a completely clean, serializable payload object
21113
+ // Only include primitive/serializable values - no promises, no functions
21114
+ var cleanPayload = {
20990
21115
  name: name,
20991
21116
  value: value,
20992
- uniqueId: timestamp,
20993
- promise: null,
20994
- resolve: null,
20995
- reject: null
21117
+ uniqueId: uniqueId
20996
21118
  };
20997
- var promise = new TrackingPromise(function (resolve, reject) {
20998
- changeEvent.resolve = resolve;
20999
- changeEvent.reject = reject;
21000
- });
21001
- changeEvent.promise = promise;
21002
- dispatch(storeInstance.actions.setStore(changeEvent));
21119
+
21120
+ // Dispatch using action creator if available, otherwise use action type directly
21121
+ // This handles the case where the store hasn't been initialized yet
21122
+ if (storeInstance.actions.setStore) {
21123
+ dispatch(storeInstance.actions.setStore(cleanPayload));
21124
+ } else {
21125
+ // Fallback: create action manually using the action type
21126
+ dispatch({
21127
+ type: 'store/setStore',
21128
+ payload: cleanPayload
21129
+ });
21130
+ }
21003
21131
  return promise;
21004
21132
  };
21005
21133
  var getStore = function getStore(name) {
@@ -26266,8 +26394,8 @@ function setupStore() {
26266
26394
  middleware: function middleware(getDefault) {
26267
26395
  return getDefault({
26268
26396
  serializableCheck: {
26269
- // Ignore redux-persist action types
26270
- ignoredActions: [FLUSH, REHYDRATE, PAUSE, PERSIST, PURGE, REGISTER]
26397
+ // Ignore redux-persist action types and setStore action
26398
+ ignoredActions: [FLUSH, REHYDRATE, PAUSE, PERSIST, PURGE, REGISTER, 'store/setStore']
26271
26399
  }
26272
26400
  }).concat(listenerMiddleware.middleware);
26273
26401
  },
@@ -26278,21 +26406,39 @@ function setupStore() {
26278
26406
  matcher: isAnyOf(actions.setStore),
26279
26407
  effect: function () {
26280
26408
  var _effect = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(action, api) {
26281
- var state, changeEvent;
26409
+ var state, stateSlice, changeEvent, uniqueId, value, promise;
26282
26410
  return _regeneratorRuntime.wrap(function (_context) {
26283
26411
  while (1) switch (_context.prev = _context.next) {
26284
26412
  case 0:
26285
- state = api.getState(); // already the **next** state
26286
- state.storeSlice;
26287
- changeEvent = action.payload; // do things after state is reduced
26288
- context.changes.forEach(function (change) {
26289
- if (change.uniqueId === changeEvent.uniqueId) {
26290
- change.resolve(changeEvent.value);
26413
+ try {
26414
+ state = api.getState(); // already the **next** state
26415
+ stateSlice = state.storeSlice;
26416
+ changeEvent = action.payload; // do things after state is reduced
26417
+ uniqueId = changeEvent.uniqueId, value = changeEvent.value; // Resolve promise from module-level map if it exists
26418
+ if (promiseMap && promiseMap.has(uniqueId)) {
26419
+ promise = promiseMap.get(uniqueId);
26420
+ if (promise && typeof promise.resolve === 'function') {
26421
+ promise.resolve(value);
26422
+ }
26423
+ // Clean up fulfilled promises
26424
+ if (promise && promise.isFulfilled()) {
26425
+ promiseMap["delete"](uniqueId);
26426
+ }
26291
26427
  }
26292
- });
26293
- context.changes = context.changes.filter(function (change) {
26294
- return !change.promise.isFulfilled();
26295
- });
26428
+
26429
+ // Clean up changes array - remove fulfilled promises
26430
+ context.changes = context.changes.filter(function (change) {
26431
+ // Check if promise still exists in promiseMap
26432
+ if (promiseMap && promiseMap.has(change.uniqueId)) {
26433
+ var _promise = promiseMap.get(change.uniqueId);
26434
+ return _promise && !_promise.isFulfilled();
26435
+ }
26436
+ return false;
26437
+ });
26438
+ } catch (error) {
26439
+ console.error('Error in setStore listener middleware:', error);
26440
+ // Don't throw - let the action complete even if promise resolution fails
26441
+ }
26296
26442
  case 1:
26297
26443
  case "end":
26298
26444
  return _context.stop();
@@ -26336,8 +26482,10 @@ exports.Badge = Badge;
26336
26482
  exports.Breadcrumbs = Breadcrumbs;
26337
26483
  exports.Button = Button;
26338
26484
  exports.Card = Card;
26485
+ exports.Carousel = Carousel;
26339
26486
  exports.Checkbox = Checkbox;
26340
26487
  exports.ColorPicker = ColorPicker;
26488
+ exports.Condition = Condition;
26341
26489
  exports.DatePicker = DatePicker;
26342
26490
  exports.DateRangePicker = DateRangePicker;
26343
26491
  exports.Dialog = Dialog;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dreamtree-org/twreact-ui",
3
- "version": "1.0.98",
3
+ "version": "1.0.100",
4
4
  "description": "A comprehensive React + Tailwind components library for building modern web apps",
5
5
  "author": {
6
6
  "name": "Partha Preetham Krishna",