@app-studio/web 0.8.40 → 0.8.42

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/web.esm.js CHANGED
@@ -2396,7 +2396,7 @@ var ButtonView = _ref => {
2396
2396
  ariaLabel,
2397
2397
  // Initializes default values for the ButtonProps object; useful for defining states like isAuto, isFilled, etc.
2398
2398
  externalHref,
2399
- isAuto,
2399
+ isAuto = false,
2400
2400
  // Determines if button should be active based on isDisabled and isLoading properties.
2401
2401
  isFilled = false,
2402
2402
  // Prepares default properties for the native button element based on isActive state.
@@ -2474,7 +2474,8 @@ var ButtonView = _ref => {
2474
2474
  var buttonSizeStyles = ButtonSizes[size];
2475
2475
  var buttonVariant = ButtonVariants[variant];
2476
2476
  var scaleWidth = {
2477
- minWidth: isAuto ? 'fit-content' : isFilled ? '100%' : buttonSizeStyles.width
2477
+ width: isAuto === true ? 'fit-content' : isFilled ? '100%' : buttonSizeStyles.width,
2478
+ minWidth: isAuto === true ? 'fit-content' : isFilled ? '100%' : buttonSizeStyles.width
2478
2479
  };
2479
2480
  var changePadding = isIconRounded ? IconSizes$1[size] : ButtonSizes[size];
2480
2481
  var content = /*#__PURE__*/React.createElement(Horizontal, {
@@ -6622,46 +6623,51 @@ var MessageLayout = _ref => {
6622
6623
  };
6623
6624
 
6624
6625
  var useModalStore = /*#__PURE__*/create(set => ({
6625
- modal: false,
6626
- modalProps: {
6627
- isVisible: false
6628
- },
6629
- overlayProps: {},
6630
- show: function show(modal, modalProps, overlayProps) {
6626
+ modals: [],
6627
+ show: function show(name, modalProps, overlayProps) {
6631
6628
  if (modalProps === void 0) {
6632
6629
  modalProps = {};
6633
6630
  }
6634
6631
  if (overlayProps === void 0) {
6635
6632
  overlayProps = {};
6636
6633
  }
6637
- if (modal) {
6638
- modalProps.isVisible = true;
6639
- }
6640
- set(state => Object.assign({}, state, {
6641
- modal,
6642
- modalProps,
6643
- overlayProps
6634
+ set(state => ({
6635
+ modals: [...state.modals, {
6636
+ name,
6637
+ props: Object.assign({}, modalProps, {
6638
+ isVisible: true
6639
+ }),
6640
+ overlayProps
6641
+ }]
6644
6642
  }));
6645
6643
  },
6646
- hide: () => {
6647
- set(state => Object.assign({}, state, {
6648
- modalProps: Object.assign({}, state.modalProps, {
6649
- isVisible: false
6650
- })
6651
- }));
6644
+ hide: name => {
6645
+ set(state => {
6646
+ if (!name) {
6647
+ // Hide all modals
6648
+ return {
6649
+ modals: []
6650
+ };
6651
+ }
6652
+ // Hide specific modal by name
6653
+ return {
6654
+ modals: state.modals.filter(modal => modal.name !== name)
6655
+ };
6656
+ });
6652
6657
  }
6653
6658
  }));
6654
- var showModal = function showModal(modal, modalProps, overlayProps) {
6659
+ var showModal = function showModal(name, modalProps, overlayProps) {
6655
6660
  if (modalProps === void 0) {
6656
6661
  modalProps = {};
6657
6662
  }
6658
6663
  if (overlayProps === void 0) {
6659
6664
  overlayProps = {};
6660
6665
  }
6661
- useModalStore.getState().show(modal, modalProps, overlayProps);
6666
+ useModalStore.getState().show(name, modalProps, overlayProps);
6662
6667
  };
6663
- var hideModal = () => {
6664
- useModalStore.getState().hide();
6668
+ var hideModal = name => {
6669
+ console.log('hideModal', name);
6670
+ useModalStore.getState().hide(typeof name === 'string' ? name : undefined);
6665
6671
  };
6666
6672
 
6667
6673
  var ContainerShapes = {
@@ -6831,33 +6837,29 @@ var ModalFooter = _ref5 => {
6831
6837
 
6832
6838
  var ModalLayout = _ref => {
6833
6839
  var {
6834
- modals
6840
+ modals: availableModals
6835
6841
  } = _ref;
6836
- var modalStore = useModalStore(_ref2 => {
6837
- var {
6838
- modal,
6839
- modalProps,
6840
- overlayProps
6841
- } = _ref2;
6842
- return {
6843
- modal,
6844
- modalProps,
6845
- overlayProps
6846
- };
6847
- });
6848
- if (typeof modalStore.modal === 'boolean') {
6849
- return null;
6850
- }
6851
- var Modal = modals[modalStore.modal];
6852
- if (!Modal) {
6853
- console.error(modalStore.modal + " modal doesn't exist");
6842
+ var activeModals = useModalStore(state => state.modals);
6843
+ if (activeModals.length === 0) {
6854
6844
  return null;
6855
6845
  }
6856
- return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(ModalOverlay, Object.assign({
6857
- isOpen: modalStore.modalProps.isVisible,
6858
- onClose: hideModal,
6859
- blur: 10
6860
- }, modalStore.overlayProps), Modal !== undefined && /*#__PURE__*/React.createElement(Modal, Object.assign({}, modalStore.modalProps))));
6846
+ return /*#__PURE__*/React.createElement(Fragment, null, activeModals.map((modal, index) => {
6847
+ var ModalComponent = availableModals[modal.name];
6848
+ if (!ModalComponent) {
6849
+ console.error(modal.name + " modal doesn't exist");
6850
+ return null;
6851
+ }
6852
+ return /*#__PURE__*/React.createElement(ModalOverlay, Object.assign({
6853
+ key: index,
6854
+ isOpen: modal.props.isVisible,
6855
+ onClose: () => hideModal(modal.name),
6856
+ blur: 5
6857
+ }, modal.overlayProps, {
6858
+ style: {
6859
+ zIndex: 1000 + index
6860
+ }
6861
+ }), /*#__PURE__*/React.createElement(ModalComponent, Object.assign({}, modal.props)));
6862
+ }));
6861
6863
  };
6862
6864
 
6863
6865
  /**