@mw-kit/mw-ui 1.10.4 → 1.10.6

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.
@@ -1,3 +1,4 @@
1
+ import type { FloatingPortalProps } from '@floating-ui/react';
1
2
  export type PopupProps<T extends React.ElementType = 'div'> = {
2
3
  content: React.FunctionComponent;
3
4
  position: PopupPosition;
@@ -14,5 +15,9 @@ export type PopupProps<T extends React.ElementType = 'div'> = {
14
15
  setOpen?: (open: boolean) => void;
15
16
  fallbackPlacements?: PopupPosition[];
16
17
  zIndex?: number;
18
+ portalRoot?: FloatingPortalProps['root'];
19
+ style?: React.CSSProperties | undefined;
20
+ dependencies?: React.DependencyList;
21
+ pinned?: boolean;
17
22
  };
18
23
  export type PopupPosition = 'top' | 'top-start' | 'top-end' | 'right' | 'right-start' | 'right-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'left-start' | 'left-end';
@@ -15,6 +15,7 @@ export { default as MwLoader } from './Loader';
15
15
  export { default as MwMenu } from './Menu';
16
16
  export { default as MwModal } from './Modal';
17
17
  export { default as MwPlaceholder } from './Placeholder';
18
+ export { default as MwPopup } from './Popup';
18
19
  export { default as MwProgressBar } from './ProgressBar';
19
20
  export { default as MwScrollContainer } from './ScrollContainer';
20
21
  export { default as MwSelect } from './Select';
package/dist/index.d.mts CHANGED
@@ -4,8 +4,8 @@ import * as react from 'react';
4
4
  import react__default, { TextareaHTMLAttributes } from 'react';
5
5
  import * as react_jsx_runtime from 'react/jsx-runtime';
6
6
  import * as _fortawesome_fontawesome_common_types from '@fortawesome/fontawesome-common-types';
7
- import * as styled_components_dist_types from 'styled-components/dist/types';
8
7
  import { FloatingPortalProps } from '@floating-ui/react';
8
+ import * as styled_components_dist_types from 'styled-components/dist/types';
9
9
  import { ReactVirtualizerOptions } from '@tanstack/react-virtual';
10
10
  import { Property } from 'csstype';
11
11
  import SignatureCanvas, { SignatureCanvasProps } from 'react-signature-canvas';
@@ -281,6 +281,10 @@ type PopupProps<T extends React.ElementType = 'div'> = {
281
281
  setOpen?: (open: boolean) => void;
282
282
  fallbackPlacements?: PopupPosition[];
283
283
  zIndex?: number;
284
+ portalRoot?: FloatingPortalProps['root'];
285
+ style?: React.CSSProperties | undefined;
286
+ dependencies?: React.DependencyList;
287
+ pinned?: boolean;
284
288
  };
285
289
  type PopupPosition = 'top' | 'top-start' | 'top-end' | 'right' | 'right-start' | 'right-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'left-start' | 'left-end';
286
290
 
@@ -3989,6 +3993,10 @@ interface PlaceholderProps {
3989
3993
 
3990
3994
  declare const Placeholder: (props: PlaceholderProps) => react_jsx_runtime.JSX.Element;
3991
3995
 
3996
+ declare const Popup: <T extends react__default.ElementType = "div">(props: PopupProps<T> & {
3997
+ enabled?: boolean;
3998
+ }) => JSX.Element;
3999
+
3992
4000
  interface ProgressBarProps {
3993
4001
  type: 'default' | 'info' | 'danger' | 'success' | 'warning';
3994
4002
  value: number | null;
@@ -4066,4 +4074,4 @@ declare const ThemeProvider: (props: React.PropsWithChildren<{
4066
4074
  assetBaseUrl: string;
4067
4075
  }>) => react_jsx_runtime.JSX.Element;
4068
4076
 
4069
- export { Inflector, AbsoluteContainer as MwAbsoluteContainer, AppliedFilters as MwAppliedFilters, Button as MwButton, Calendar as MwCalendar, Card as MwCard, EllipsisContainer as MwEllipsisContainer, Filters as MwFilters, Form as MwForm, Grid as MwGrid, Icon as MwIcon, Indicator as MwIndicator, Input as MwInput, Link as MwLink, Loader as MwLoader, Menu as MwMenu, Modal as MwModal, Placeholder as MwPlaceholder, ProgressBar as MwProgressBar, ScrollContainer as MwScrollContainer, _default as MwSelect, SignatureInput as MwSignature, Tabs as MwTabs, TextArea as MwTextArea, Toast as MwToast, Transition as MwTransition, Zoom as MwZoom, ThemeProvider, theme, useTransition as useMwTransition };
4077
+ export { Inflector, AbsoluteContainer as MwAbsoluteContainer, AppliedFilters as MwAppliedFilters, Button as MwButton, Calendar as MwCalendar, Card as MwCard, EllipsisContainer as MwEllipsisContainer, Filters as MwFilters, Form as MwForm, Grid as MwGrid, Icon as MwIcon, Indicator as MwIndicator, Input as MwInput, Link as MwLink, Loader as MwLoader, Menu as MwMenu, Modal as MwModal, Placeholder as MwPlaceholder, Popup as MwPopup, ProgressBar as MwProgressBar, ScrollContainer as MwScrollContainer, _default as MwSelect, SignatureInput as MwSignature, Tabs as MwTabs, TextArea as MwTextArea, Toast as MwToast, Transition as MwTransition, Zoom as MwZoom, ThemeProvider, theme, useTransition as useMwTransition };
package/dist/index.js CHANGED
@@ -48,6 +48,7 @@ __export(index_exports, {
48
48
  MwMenu: () => Menu_default2,
49
49
  MwModal: () => Modal_default,
50
50
  MwPlaceholder: () => Placeholder_default,
51
+ MwPopup: () => Popup_default,
51
52
  MwProgressBar: () => ProgressBar_default,
52
53
  MwScrollContainer: () => ScrollContainer_default,
53
54
  MwSelect: () => Select_default3,
@@ -10005,6 +10006,7 @@ var mergeRefs = (...refs) => {
10005
10006
  });
10006
10007
  };
10007
10008
  };
10009
+ var defaultDependencies = [];
10008
10010
  var PopupComponent = (props) => {
10009
10011
  const {
10010
10012
  content: Content5,
@@ -10016,35 +10018,38 @@ var PopupComponent = (props) => {
10016
10018
  shift: shiftValue = 8,
10017
10019
  background = "dark",
10018
10020
  closeOnClip = false,
10019
- zIndex = 1e3
10021
+ zIndex = 1e3,
10022
+ pinned = false,
10023
+ dependencies = defaultDependencies
10020
10024
  } = props;
10021
10025
  const arrowStyle = props.arrow || (background === "dark" ? "pointed" : "flattened");
10022
10026
  const withArrow = arrowStyle !== "none";
10023
10027
  const [open, setOpen] = open_default(props);
10024
10028
  const arrowRef = (0, import_react11.useRef)(null);
10025
10029
  const fallbackPlacements = fallbackPlacements_default(props);
10030
+ const closeOnClipMiddleware = (0, import_react11.useMemo)(
10031
+ () => ({
10032
+ name: "closeOnClip",
10033
+ fn(state) {
10034
+ if (state.middlewareData.hide?.referenceHidden) {
10035
+ setOpen(false);
10036
+ }
10037
+ return {};
10038
+ }
10039
+ }),
10040
+ dependencies
10041
+ );
10026
10042
  const floating = (0, import_react12.useFloating)({
10027
10043
  open,
10028
10044
  onOpenChange: setOpen,
10029
10045
  placement,
10030
10046
  whileElementsMounted: import_react12.autoUpdate,
10031
10047
  middleware: [
10032
- (0, import_react12.offset)(offsetValue),
10033
- (0, import_react12.flip)({ fallbackPlacements, padding: shiftValue }),
10034
- (0, import_react12.shift)({ padding: shiftValue }),
10035
- ...withArrow ? [(0, import_react12.arrow)({ element: arrowRef })] : [],
10036
- ...closeOnClip ? [
10037
- (0, import_react12.hide)(),
10038
- {
10039
- name: "closeOnClip",
10040
- fn(state) {
10041
- if (state.middlewareData.hide?.referenceHidden) {
10042
- setOpen(false);
10043
- }
10044
- return {};
10045
- }
10046
- }
10047
- ] : []
10048
+ (0, import_react12.offset)(offsetValue, dependencies),
10049
+ ...pinned ? [] : [(0, import_react12.flip)({ fallbackPlacements, padding: shiftValue }, dependencies)],
10050
+ (0, import_react12.shift)({ padding: shiftValue }, dependencies),
10051
+ ...withArrow ? [(0, import_react12.arrow)({ element: arrowRef }, dependencies)] : [],
10052
+ ...closeOnClip ? [(0, import_react12.hide)(void 0, dependencies), closeOnClipMiddleware] : []
10048
10053
  ]
10049
10054
  });
10050
10055
  const hover = (0, import_react12.useHover)(floating.context, {
@@ -10069,11 +10074,15 @@ var PopupComponent = (props) => {
10069
10074
  }, [floating.refs.setReference, interactions, triggerProps]);
10070
10075
  return /* @__PURE__ */ (0, import_jsx_runtime294.jsxs)(import_react11.default.Fragment, { children: [
10071
10076
  renderTrigger(referenceProps),
10072
- open ? /* @__PURE__ */ (0, import_jsx_runtime294.jsx)(import_react12.FloatingPortal, { children: /* @__PURE__ */ (0, import_jsx_runtime294.jsxs)(
10077
+ open ? /* @__PURE__ */ (0, import_jsx_runtime294.jsx)(import_react12.FloatingPortal, { root: props.portalRoot, children: /* @__PURE__ */ (0, import_jsx_runtime294.jsxs)(
10073
10078
  TooltipSurface,
10074
10079
  {
10075
10080
  ref: floating.refs.setFloating,
10076
- style: { ...floating.floatingStyles, zIndex },
10081
+ style: {
10082
+ ...floating.floatingStyles,
10083
+ ...props.style || {},
10084
+ zIndex
10085
+ },
10077
10086
  $placement: floating.placement,
10078
10087
  $background: background,
10079
10088
  ...interactions.getFloatingProps(),
@@ -21623,6 +21632,7 @@ var Zoom_default = Zoom;
21623
21632
  MwMenu,
21624
21633
  MwModal,
21625
21634
  MwPlaceholder,
21635
+ MwPopup,
21626
21636
  MwProgressBar,
21627
21637
  MwScrollContainer,
21628
21638
  MwSelect,
package/dist/index.mjs CHANGED
@@ -9958,6 +9958,7 @@ var mergeRefs = (...refs) => {
9958
9958
  });
9959
9959
  };
9960
9960
  };
9961
+ var defaultDependencies = [];
9961
9962
  var PopupComponent = (props) => {
9962
9963
  const {
9963
9964
  content: Content5,
@@ -9969,35 +9970,38 @@ var PopupComponent = (props) => {
9969
9970
  shift: shiftValue = 8,
9970
9971
  background = "dark",
9971
9972
  closeOnClip = false,
9972
- zIndex = 1e3
9973
+ zIndex = 1e3,
9974
+ pinned = false,
9975
+ dependencies = defaultDependencies
9973
9976
  } = props;
9974
9977
  const arrowStyle = props.arrow || (background === "dark" ? "pointed" : "flattened");
9975
9978
  const withArrow = arrowStyle !== "none";
9976
9979
  const [open, setOpen] = open_default(props);
9977
9980
  const arrowRef = useRef(null);
9978
9981
  const fallbackPlacements = fallbackPlacements_default(props);
9982
+ const closeOnClipMiddleware = useMemo4(
9983
+ () => ({
9984
+ name: "closeOnClip",
9985
+ fn(state) {
9986
+ if (state.middlewareData.hide?.referenceHidden) {
9987
+ setOpen(false);
9988
+ }
9989
+ return {};
9990
+ }
9991
+ }),
9992
+ dependencies
9993
+ );
9979
9994
  const floating = useFloating({
9980
9995
  open,
9981
9996
  onOpenChange: setOpen,
9982
9997
  placement,
9983
9998
  whileElementsMounted: autoUpdate,
9984
9999
  middleware: [
9985
- offset(offsetValue),
9986
- flip({ fallbackPlacements, padding: shiftValue }),
9987
- shift({ padding: shiftValue }),
9988
- ...withArrow ? [arrow({ element: arrowRef })] : [],
9989
- ...closeOnClip ? [
9990
- hide(),
9991
- {
9992
- name: "closeOnClip",
9993
- fn(state) {
9994
- if (state.middlewareData.hide?.referenceHidden) {
9995
- setOpen(false);
9996
- }
9997
- return {};
9998
- }
9999
- }
10000
- ] : []
10000
+ offset(offsetValue, dependencies),
10001
+ ...pinned ? [] : [flip({ fallbackPlacements, padding: shiftValue }, dependencies)],
10002
+ shift({ padding: shiftValue }, dependencies),
10003
+ ...withArrow ? [arrow({ element: arrowRef }, dependencies)] : [],
10004
+ ...closeOnClip ? [hide(void 0, dependencies), closeOnClipMiddleware] : []
10001
10005
  ]
10002
10006
  });
10003
10007
  const hover = useHover(floating.context, {
@@ -10022,11 +10026,15 @@ var PopupComponent = (props) => {
10022
10026
  }, [floating.refs.setReference, interactions, triggerProps]);
10023
10027
  return /* @__PURE__ */ jsxs143(React291.Fragment, { children: [
10024
10028
  renderTrigger(referenceProps),
10025
- open ? /* @__PURE__ */ jsx294(FloatingPortal, { children: /* @__PURE__ */ jsxs143(
10029
+ open ? /* @__PURE__ */ jsx294(FloatingPortal, { root: props.portalRoot, children: /* @__PURE__ */ jsxs143(
10026
10030
  TooltipSurface,
10027
10031
  {
10028
10032
  ref: floating.refs.setFloating,
10029
- style: { ...floating.floatingStyles, zIndex },
10033
+ style: {
10034
+ ...floating.floatingStyles,
10035
+ ...props.style || {},
10036
+ zIndex
10037
+ },
10030
10038
  $placement: floating.placement,
10031
10039
  $background: background,
10032
10040
  ...interactions.getFloatingProps(),
@@ -21583,6 +21591,7 @@ export {
21583
21591
  Menu_default2 as MwMenu,
21584
21592
  Modal_default as MwModal,
21585
21593
  Placeholder_default as MwPlaceholder,
21594
+ Popup_default as MwPopup,
21586
21595
  ProgressBar_default as MwProgressBar,
21587
21596
  ScrollContainer_default as MwScrollContainer,
21588
21597
  Select_default3 as MwSelect,
@@ -26,4 +26,5 @@ export type { AppliedFilter } from './components/Filters/interfaces';
26
26
  export type { Transition } from './components/Transition/interfaces';
27
27
  export type { TabComponent, TabComponents, TabProps, TabProvider, } from './components/Tabs/interfaces';
28
28
  export type * from './components/Select/types';
29
+ export type * from './components/Popup/types';
29
30
  export type * from './functions/inflections';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mw-kit/mw-ui",
3
- "version": "1.10.4",
3
+ "version": "1.10.6",
4
4
  "description": "Made with create-react-library",
5
5
  "author": "fmgusmao",
6
6
  "license": "MIT",