@app-studio/web 0.8.39 → 0.8.41

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.
@@ -5,6 +5,7 @@ export interface AvatarProps {
5
5
  size?: Size;
6
6
  fallback?: string;
7
7
  styles?: AvatarStyles;
8
+ onClick?: Function;
8
9
  }
9
10
  export interface AvatarViewProps extends AvatarProps {
10
11
  imageError: boolean;
@@ -1,3 +1,3 @@
1
1
  import React from 'react';
2
2
  import { AvatarViewProps } from './Avatar.props';
3
- export declare const AvatarView: ({ src, size, fallback, styles, imageError, setImageError, }: AvatarViewProps) => React.JSX.Element;
3
+ export declare const AvatarView: ({ src, size, fallback, styles, imageError, setImageError, onClick, }: AvatarViewProps) => React.JSX.Element;
@@ -1,3 +1,3 @@
1
1
  import React from 'react';
2
2
  import { AvatarProps } from './Avatar/Avatar.props';
3
- export declare const Avatar: ({ src, size, styles, fallback }: AvatarProps) => React.JSX.Element;
3
+ export declare const Avatar: ({ src, size, styles, fallback, onClick, }: AvatarProps) => React.JSX.Element;
@@ -1,3 +1,3 @@
1
1
  import React from 'react';
2
2
  import { ModalLayoutProps } from './Modal.props';
3
- export declare const ModalLayout: ({ modals }: ModalLayoutProps) => React.JSX.Element | null;
3
+ export declare const ModalLayout: ({ modals: availableModals }: ModalLayoutProps) => React.JSX.Element | null;
@@ -1,12 +1,15 @@
1
- export interface ModalState {
2
- modal: string | boolean;
3
- modalProps: any & {
1
+ export interface ModalItem {
2
+ name: string;
3
+ props: any & {
4
4
  isVisible: boolean;
5
5
  };
6
6
  overlayProps: any;
7
- show: (modal: string, modalProps?: any, overlayProps?: any) => void;
8
- hide: () => void;
7
+ }
8
+ export interface ModalState {
9
+ modals: ModalItem[];
10
+ show: (name: string, modalProps?: any, overlayProps?: any) => void;
11
+ hide: (name?: string) => void;
9
12
  }
10
13
  export declare const useModalStore: any;
11
- export declare const showModal: (modal: string, modalProps?: any, overlayProps?: any) => void;
12
- export declare const hideModal: () => void;
14
+ export declare const showModal: (name: string, modalProps?: any, overlayProps?: any) => void;
15
+ export declare const hideModal: (name?: string | undefined) => void;
@@ -1,13 +1,13 @@
1
- import { CSSProperties } from 'react';
1
+ import { ViewProps } from 'app-studio';
2
2
  export declare type TableViewStyles = {
3
- table?: CSSProperties;
4
- thead?: CSSProperties;
5
- tfoot?: CSSProperties;
6
- tbody?: CSSProperties;
7
- tr?: CSSProperties;
8
- td?: CSSProperties;
9
- th?: CSSProperties;
10
- caption?: CSSProperties;
3
+ table?: ViewProps;
4
+ thead?: ViewProps;
5
+ tfoot?: ViewProps;
6
+ tbody?: ViewProps;
7
+ tr?: ViewProps;
8
+ td?: ViewProps;
9
+ th?: ViewProps;
10
+ caption?: ViewProps;
11
11
  };
12
12
  export interface Column {
13
13
  title: string;
@@ -15,5 +15,5 @@ export interface Column {
15
15
  }
16
16
  export interface FooterCell {
17
17
  value: string;
18
- props?: any;
18
+ props?: ViewProps;
19
19
  }
@@ -1809,7 +1809,8 @@ var AvatarView = _ref => {
1809
1809
  fallback = 'IM',
1810
1810
  styles,
1811
1811
  imageError,
1812
- setImageError
1812
+ setImageError,
1813
+ onClick = () => {}
1813
1814
  } = _ref;
1814
1815
  // Determines the size of the avatar by mapping the size prop to the predefined AvatarSizeMap.
1815
1816
  var avatarSize = AvatarSizeMap[size];
@@ -1827,7 +1828,8 @@ var AvatarView = _ref => {
1827
1828
  borderWidth: "1px",
1828
1829
  borderStyle: "solid",
1829
1830
  borderColor: imageError ? 'black' : 'transparent',
1830
- boxShadow: "0px 2px 4px rgba(0, 0, 0, 0.25)"
1831
+ boxShadow: "0px 2px 4px rgba(0, 0, 0, 0.25)",
1832
+ onClick: onClick
1831
1833
  }, styles == null ? void 0 : styles.container), !imageError ? (/*#__PURE__*/React__default.createElement(appStudio.Image, {
1832
1834
  alt: "IM",
1833
1835
  src: src,
@@ -1846,7 +1848,8 @@ var AvatarComponent = _ref => {
1846
1848
  src,
1847
1849
  size,
1848
1850
  styles,
1849
- fallback
1851
+ fallback,
1852
+ onClick
1850
1853
  } = _ref;
1851
1854
  // Uses custom hook useAvatarState to manage the avatar image loading error state.
1852
1855
  var {
@@ -1860,7 +1863,8 @@ var AvatarComponent = _ref => {
1860
1863
  styles: styles,
1861
1864
  fallback: fallback,
1862
1865
  imageError: imageError,
1863
- setImageError: setImageError
1866
+ setImageError: setImageError,
1867
+ onClick: onClick
1864
1868
  });
1865
1869
  // AvatarComponent is a functional component that wraps the AvatarView with added state logic.
1866
1870
  };
@@ -6625,46 +6629,51 @@ var MessageLayout = _ref => {
6625
6629
  };
6626
6630
 
6627
6631
  var useModalStore = /*#__PURE__*/zustand.create(set => ({
6628
- modal: false,
6629
- modalProps: {
6630
- isVisible: false
6631
- },
6632
- overlayProps: {},
6633
- show: function show(modal, modalProps, overlayProps) {
6632
+ modals: [],
6633
+ show: function show(name, modalProps, overlayProps) {
6634
6634
  if (modalProps === void 0) {
6635
6635
  modalProps = {};
6636
6636
  }
6637
6637
  if (overlayProps === void 0) {
6638
6638
  overlayProps = {};
6639
6639
  }
6640
- if (modal) {
6641
- modalProps.isVisible = true;
6642
- }
6643
- set(state => Object.assign({}, state, {
6644
- modal,
6645
- modalProps,
6646
- overlayProps
6640
+ set(state => ({
6641
+ modals: [...state.modals, {
6642
+ name,
6643
+ props: Object.assign({}, modalProps, {
6644
+ isVisible: true
6645
+ }),
6646
+ overlayProps
6647
+ }]
6647
6648
  }));
6648
6649
  },
6649
- hide: () => {
6650
- set(state => Object.assign({}, state, {
6651
- modalProps: Object.assign({}, state.modalProps, {
6652
- isVisible: false
6653
- })
6654
- }));
6650
+ hide: name => {
6651
+ set(state => {
6652
+ if (!name) {
6653
+ // Hide all modals
6654
+ return {
6655
+ modals: []
6656
+ };
6657
+ }
6658
+ // Hide specific modal by name
6659
+ return {
6660
+ modals: state.modals.filter(modal => modal.name !== name)
6661
+ };
6662
+ });
6655
6663
  }
6656
6664
  }));
6657
- var showModal = function showModal(modal, modalProps, overlayProps) {
6665
+ var showModal = function showModal(name, modalProps, overlayProps) {
6658
6666
  if (modalProps === void 0) {
6659
6667
  modalProps = {};
6660
6668
  }
6661
6669
  if (overlayProps === void 0) {
6662
6670
  overlayProps = {};
6663
6671
  }
6664
- useModalStore.getState().show(modal, modalProps, overlayProps);
6672
+ useModalStore.getState().show(name, modalProps, overlayProps);
6665
6673
  };
6666
- var hideModal = () => {
6667
- useModalStore.getState().hide();
6674
+ var hideModal = name => {
6675
+ console.log('hideModal', name);
6676
+ useModalStore.getState().hide(typeof name === 'string' ? name : undefined);
6668
6677
  };
6669
6678
 
6670
6679
  var ContainerShapes = {
@@ -6834,33 +6843,29 @@ var ModalFooter = _ref5 => {
6834
6843
 
6835
6844
  var ModalLayout = _ref => {
6836
6845
  var {
6837
- modals
6846
+ modals: availableModals
6838
6847
  } = _ref;
6839
- var modalStore = useModalStore(_ref2 => {
6840
- var {
6841
- modal,
6842
- modalProps,
6843
- overlayProps
6844
- } = _ref2;
6845
- return {
6846
- modal,
6847
- modalProps,
6848
- overlayProps
6849
- };
6850
- });
6851
- if (typeof modalStore.modal === 'boolean') {
6852
- return null;
6853
- }
6854
- var Modal = modals[modalStore.modal];
6855
- if (!Modal) {
6856
- console.error(modalStore.modal + " modal doesn't exist");
6848
+ var activeModals = useModalStore(state => state.modals);
6849
+ if (activeModals.length === 0) {
6857
6850
  return null;
6858
6851
  }
6859
- return /*#__PURE__*/React__default.createElement(React.Fragment, null, /*#__PURE__*/React__default.createElement(ModalOverlay, Object.assign({
6860
- isOpen: modalStore.modalProps.isVisible,
6861
- onClose: hideModal,
6862
- blur: 10
6863
- }, modalStore.overlayProps), Modal !== undefined && /*#__PURE__*/React__default.createElement(Modal, Object.assign({}, modalStore.modalProps))));
6852
+ return /*#__PURE__*/React__default.createElement(React.Fragment, null, activeModals.map((modal, index) => {
6853
+ var ModalComponent = availableModals[modal.name];
6854
+ if (!ModalComponent) {
6855
+ console.error(modal.name + " modal doesn't exist");
6856
+ return null;
6857
+ }
6858
+ return /*#__PURE__*/React__default.createElement(ModalOverlay, Object.assign({
6859
+ key: index,
6860
+ isOpen: modal.props.isVisible,
6861
+ onClose: () => hideModal(modal.name),
6862
+ blur: 5
6863
+ }, modal.overlayProps, {
6864
+ style: {
6865
+ zIndex: 1000 + index
6866
+ }
6867
+ }), /*#__PURE__*/React__default.createElement(ModalComponent, Object.assign({}, modal.props)));
6868
+ }));
6864
6869
  };
6865
6870
 
6866
6871
  /**