@g4rcez/components 2.0.42 → 2.1.0
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/components/floating/modal.d.ts.map +1 -1
- package/dist/components/floating/modal.jsx +4 -2
- package/dist/config/context.d.ts +2 -0
- package/dist/config/context.d.ts.map +1 -1
- package/dist/config/context.js +2 -1
- package/dist/hooks/use-components-provider.d.ts +1 -0
- package/dist/hooks/use-components-provider.d.ts.map +1 -1
- package/dist/hooks/use-components-provider.jsx +1 -0
- package/dist/hooks/use-floating-ref.d.ts +2 -0
- package/dist/hooks/use-floating-ref.d.ts.map +1 -0
- package/dist/hooks/use-floating-ref.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2337 -2335
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +12 -12
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modal.d.ts","sourceRoot":"","sources":["../../../src/components/floating/modal.tsx"],"names":[],"mappings":"AACA,OAAO,EASL,KAAK,YAAY,EAClB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAAmB,eAAe,EAA4F,MAAM,cAAc,CAAC;AAE1J,OAAO,KAA+G,MAAM,OAAO,CAAC;AAGpI,OAAO,EAAE,KAAK,EAAO,QAAQ,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"modal.d.ts","sourceRoot":"","sources":["../../../src/components/floating/modal.tsx"],"names":[],"mappings":"AACA,OAAO,EASL,KAAK,YAAY,EAClB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAAmB,eAAe,EAA4F,MAAM,cAAc,CAAC;AAE1J,OAAO,KAA+G,MAAM,OAAO,CAAC;AAGpI,OAAO,EAAE,KAAK,EAAO,QAAQ,EAAE,MAAM,aAAa,CAAC;AAKnD,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,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;;YAE9B,KAAK;UACP,SAAS;cACL,OAAO;aACR,OAAO;cACN,MAAM;aACP,OAAO;eACL,MAAM;cACP,OAAO;eACN,OAAO;mBACH,MAAM;sBACH,MAAM;cACd,cAAc;uBACL,OAAO;qBACT,OAAO;UAClB,QAAQ;kBACA,YAAY,EAAE;aACnB,KAAK,GAAG,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC;;;;eApBqB,MAAM;YAAU,KAAK;;UAClE,OAAO;cACH,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI;;YAE9B,KAAK;UACP,SAAS;cACL,OAAO;aACR,OAAO;cACN,MAAM;aACP,OAAO;eACL,MAAM;cACP,OAAO;eACN,OAAO;mBACH,MAAM;sBACH,MAAM;cACd,cAAc;uBACL,OAAO;qBACT,OAAO;UAClB,QAAQ;kBACA,YAAY,EAAE;aACnB,KAAK,GAAG,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC;;;2CA4UjC,CAAC"}
|
|
@@ -7,6 +7,7 @@ import { Slot } from "../core/slot";
|
|
|
7
7
|
import React, { forwardRef, Fragment, useEffect, useId, useImperativeHandle, useRef } from "react";
|
|
8
8
|
import { useMediaQuery } from "../../hooks/use-media-query";
|
|
9
9
|
import { css, mergeRefs } from "../../lib/dom";
|
|
10
|
+
import { useFloatingRef } from "../../hooks/use-floating-ref";
|
|
10
11
|
const animationDuration = "500ms";
|
|
11
12
|
const drawerLeft = {
|
|
12
13
|
exit: { x: ["0%", "-30%"], opacity: 0, animationDuration },
|
|
@@ -92,6 +93,7 @@ const fetchPosition = (isDesktop, forceType, propsType, propsPosition) => {
|
|
|
92
93
|
};
|
|
93
94
|
const noop = [];
|
|
94
95
|
export const Modal = forwardRef(({ open, title, footer, asChild, trigger, children, onChange, ariaTitle, className, bodyClassName, resizer = true, animated = true, closable = true, forceType = false, layoutId = undefined, overlayClassName = "", type: _type = "dialog", position: propsPosition, overlayClickClose = false, closeOnFocusOut = false, interactions: outInteractions = noop, ...props }, externalRef) => {
|
|
96
|
+
const root = useFloatingRef();
|
|
95
97
|
const innerContent = useRef(null);
|
|
96
98
|
const removeScrollRef = useRef(null);
|
|
97
99
|
const headingId = useId();
|
|
@@ -162,8 +164,8 @@ export const Modal = forwardRef(({ open, title, footer, asChild, trigger, childr
|
|
|
162
164
|
{trigger ? (<Component ref={floating.refs.setReference} {...interactions.getReferenceProps()} layoutId={layoutId} type="button">
|
|
163
165
|
{Trigger}
|
|
164
166
|
</Component>) : null}
|
|
165
|
-
<FloatingPortal preserveTabOrder>
|
|
166
|
-
<AnimatePresence custom presenceAffectsLayout propagate mode="popLayout" initial={false}>
|
|
167
|
+
<FloatingPortal preserveTabOrder root={root}>
|
|
168
|
+
<AnimatePresence root={root} custom presenceAffectsLayout propagate mode="popLayout" initial={false}>
|
|
167
169
|
{open ? (<FloatingOverlay lockScroll className={css("inset-0 flex isolate bg-floating-overlay/70 z-overlay h-[100dvh] !overflow-clip", type === "drawer" ? "" : "items-start justify-center lg:p-10 pt-10", overlayClassName)}>
|
|
168
170
|
<MotionConfig reducedMotion={animated ? "user" : "always"}>
|
|
169
171
|
<FloatingFocusManager guards modal closeOnFocusOut={closeOnFocusOut} context={floating.context}>
|
package/dist/config/context.d.ts
CHANGED
|
@@ -7,11 +7,13 @@ export type ContextProps = Partial<{
|
|
|
7
7
|
map: Partial<Translations>;
|
|
8
8
|
locale: Locales | undefined;
|
|
9
9
|
parser: typeof parsers.hsla;
|
|
10
|
+
rootFloating?: HTMLElement | null;
|
|
10
11
|
}>;
|
|
11
12
|
export declare const Context: import("react").Context<Partial<{
|
|
12
13
|
tweaks: Tweaks;
|
|
13
14
|
map: Translations;
|
|
14
15
|
locale: Locales | undefined;
|
|
15
16
|
parser: typeof parsers.hsla;
|
|
17
|
+
floatingRef?: HTMLElement | null;
|
|
16
18
|
}>>;
|
|
17
19
|
//# sourceMappingURL=context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/config/context.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAuB,KAAK,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAChF,OAAO,EAAiB,KAAK,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE9D,MAAM,MAAM,YAAY,GAAG,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/config/context.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAuB,KAAK,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAChF,OAAO,EAAiB,KAAK,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE9D,MAAM,MAAM,YAAY,GAAG,OAAO,CAAC;IACjC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IACxB,GAAG,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IAC3B,MAAM,EAAE,OAAO,GAAG,SAAS,CAAC;IAC5B,MAAM,EAAE,OAAO,OAAO,CAAC,IAAI,CAAC;IAC5B,YAAY,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;CACnC,CAAC,CAAC;AAEH,eAAO,MAAM,OAAO;;;;;;GAMlB,CAAC"}
|
package/dist/config/context.js
CHANGED
|
@@ -4,8 +4,9 @@ import { parsers } from "../styles/design-tokens";
|
|
|
4
4
|
import { defaultTranslations } from "./default-translations";
|
|
5
5
|
import { defaultTweaks } from "./default-tweaks";
|
|
6
6
|
export const Context = createContext({
|
|
7
|
-
tweaks: defaultTweaks,
|
|
8
7
|
parser: parsers.hsla,
|
|
8
|
+
tweaks: defaultTweaks,
|
|
9
|
+
floatingRef: undefined,
|
|
9
10
|
map: defaultTranslations,
|
|
10
11
|
locale: undefined,
|
|
11
12
|
});
|
|
@@ -9,6 +9,7 @@ export type ContextType = Partial<{
|
|
|
9
9
|
map: Translations;
|
|
10
10
|
locale: Locales | undefined;
|
|
11
11
|
parser: typeof parsers.hsla;
|
|
12
|
+
floatingRef?: HTMLElement | null;
|
|
12
13
|
}>;
|
|
13
14
|
export declare const ComponentsProvider: (props: PropsWithChildren<ContextProps>) => React.JSX.Element;
|
|
14
15
|
//# sourceMappingURL=use-components-provider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-components-provider.d.ts","sourceRoot":"","sources":["../../src/hooks/use-components-provider.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,iBAAiB,EAAW,MAAM,OAAO,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAW,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAuB,YAAY,EAAE,MAAM,gCAAgC,CAAC;AACnF,OAAO,EAAiB,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAEjE,MAAM,MAAM,WAAW,GAAG,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"use-components-provider.d.ts","sourceRoot":"","sources":["../../src/hooks/use-components-provider.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,iBAAiB,EAAW,MAAM,OAAO,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAW,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAuB,YAAY,EAAE,MAAM,gCAAgC,CAAC;AACnF,OAAO,EAAiB,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAEjE,MAAM,MAAM,WAAW,GAAG,OAAO,CAAC;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,YAAY,CAAC;IAClB,MAAM,EAAE,OAAO,GAAG,SAAS,CAAC;IAC5B,MAAM,EAAE,OAAO,OAAO,CAAC,IAAI,CAAC;IAC5B,WAAW,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;CAClC,CAAC,CAAC;AAEH,eAAO,MAAM,kBAAkB,GAAI,OAAO,iBAAiB,CAAC,YAAY,CAAC,sBAYxE,CAAC"}
|
|
@@ -7,6 +7,7 @@ import { defaultTweaks } from "../config/default-tweaks";
|
|
|
7
7
|
export const ComponentsProvider = (props) => {
|
|
8
8
|
const memoMap = useMemo(() => ({
|
|
9
9
|
locale: props.locale,
|
|
10
|
+
floatingRef: props.rootFloating,
|
|
10
11
|
tweaks: { ...defaultTweaks, ...props.tweaks },
|
|
11
12
|
parser: props.parser || parsers.hsla,
|
|
12
13
|
map: { ...defaultTranslations, ...props.map },
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-floating-ref.d.ts","sourceRoot":"","sources":["../../src/hooks/use-floating-ref.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,cAAc,+BAG1B,CAAC"}
|