@janbox/storefront-ui 2.0.5 → 2.0.7
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/lib/accordion/accordion-group/accordion-group.d.ts +1 -1
- package/dist/lib/accordion/accordion-group/accordion-group.d.ts.map +1 -1
- package/dist/lib/accordion/accordion-group/accordion-group.js +3 -3
- package/dist/lib/badge/badge.d.ts +2 -4
- package/dist/lib/badge/badge.d.ts.map +1 -1
- package/dist/lib/badge/badge.js +3 -4
- package/dist/lib/badge/types.d.ts +4 -4
- package/dist/lib/badge/types.d.ts.map +1 -1
- package/dist/lib/count-up/count-up.d.ts +1 -1
- package/dist/lib/count-up/count-up.d.ts.map +1 -1
- package/dist/lib/count-up/count-up.js +25 -27
- package/dist/lib/dialog/dialog-close/dialog-close.d.ts +1 -1
- package/dist/lib/dialog/dialog-close/dialog-close.d.ts.map +1 -1
- package/dist/lib/drawer/drawer-close/drawer-close.d.ts +1 -1
- package/dist/lib/drawer/drawer-close/drawer-close.d.ts.map +1 -1
- package/dist/lib/floating/floating/floating.d.ts +2 -53
- package/dist/lib/floating/floating/floating.d.ts.map +1 -1
- package/dist/lib/floating/floating/floating.js +85 -86
- package/dist/lib/floating/floating/types.d.ts +1 -0
- package/dist/lib/floating/floating/types.d.ts.map +1 -1
- package/dist/lib/floating/floating-close/floating-close.d.ts +1 -1
- package/dist/lib/floating/floating-close/floating-close.d.ts.map +1 -1
- package/dist/lib/floating/floating-close/floating-close.js +20 -22
- package/dist/lib/floating/floating-close/types.d.ts.map +1 -1
- package/dist/lib/floating/floating-content/floating-content.d.ts +1 -1
- package/dist/lib/floating/floating-content/floating-content.d.ts.map +1 -1
- package/dist/lib/floating/floating-content/floating-content.js +40 -35
- package/dist/lib/icon-button/icon-button.d.ts +1 -1
- package/dist/lib/icon-button/icon-button.d.ts.map +1 -1
- package/dist/lib/icon-button/icon-button.js +4 -4
- package/dist/lib/image/image.d.ts +1 -1
- package/dist/lib/image/image.d.ts.map +1 -1
- package/dist/lib/image/image.js +3 -3
- package/dist/lib/image/types.d.ts.map +1 -1
- package/dist/lib/input/input.d.ts +1 -1
- package/dist/lib/input/input.d.ts.map +1 -1
- package/dist/lib/input/input.js +3 -3
- package/dist/lib/menu/menu-item/menu-item.d.ts +2 -1
- package/dist/lib/menu/menu-item/menu-item.d.ts.map +1 -1
- package/dist/lib/menu/menu-item/menu-item.js +2 -3
- package/dist/lib/nav-link/nav-link.d.ts +2 -3
- package/dist/lib/nav-link/nav-link.d.ts.map +1 -1
- package/dist/lib/nav-link/nav-link.js +30 -33
- package/dist/lib/nav-link/types.d.ts +2 -0
- package/dist/lib/nav-link/types.d.ts.map +1 -1
- package/dist/lib/pagination/pagination.d.ts +1 -1
- package/dist/lib/pagination/pagination.d.ts.map +1 -1
- package/dist/lib/pagination/pagination.js +3 -3
- package/dist/lib/popover/popover-close/popover-close.d.ts +1 -1
- package/dist/lib/popover/popover-close/popover-close.d.ts.map +1 -1
- package/dist/lib/radio-button/radio-button.d.ts +1 -1
- package/dist/lib/radio-button/radio-button.d.ts.map +1 -1
- package/dist/lib/radio-button/radio-button.js +2 -3
- package/dist/lib/select/select.d.ts.map +1 -1
- package/dist/lib/select/select.js +14 -2
- package/dist/lib/select/types.d.ts +1 -0
- package/dist/lib/select/types.d.ts.map +1 -1
- package/dist/lib/tabs/tab-content/tab-content.d.ts +2 -3
- package/dist/lib/tabs/tab-content/tab-content.d.ts.map +1 -1
- package/dist/lib/tabs/tab-content/tab-content.js +2 -4
- package/dist/lib/tabs/tab-content/types.d.ts +3 -1
- package/dist/lib/tabs/tab-content/types.d.ts.map +1 -1
- package/dist/lib/unordered-list/list-item/list-item.d.ts +1 -1
- package/dist/lib/unordered-list/list-item/list-item.d.ts.map +1 -1
- package/dist/lib/unordered-list/list-item/list-item.js +2 -3
- package/dist/lib/unordered-list/unordered-list/unordered-list.d.ts +1 -1
- package/dist/lib/unordered-list/unordered-list/unordered-list.d.ts.map +1 -1
- package/dist/lib/unordered-list/unordered-list/unordered-list.js +2 -3
- package/package.json +1 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { AccordionGroupProps } from './types';
|
|
2
|
-
export declare const AccordionGroup:
|
|
2
|
+
export declare const AccordionGroup: ({ ref, ..._props }: AccordionGroupProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
3
3
|
//# sourceMappingURL=accordion-group.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accordion-group.d.ts","sourceRoot":"","sources":["../../../../src/lib/accordion/accordion-group/accordion-group.tsx"],"names":[],"mappings":"AAMA,OAAO,EAA4D,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAIxG,eAAO,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"accordion-group.d.ts","sourceRoot":"","sources":["../../../../src/lib/accordion/accordion-group/accordion-group.tsx"],"names":[],"mappings":"AAMA,OAAO,EAA4D,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAIxG,eAAO,MAAM,cAAc,uBAAwB,mBAAmB,qDA2CrE,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx } from "@emotion/react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { useRef, useMemo } from "react";
|
|
3
3
|
import { useMergeRefs } from "@floating-ui/react";
|
|
4
4
|
import { getAccordionGroupProps, AccordionGroupContext } from "./helpers.js";
|
|
5
5
|
import { AccordionGroupDataAttributes } from "./types.js";
|
|
6
6
|
import { createSxInterpolation } from "../../../utils/stylesheet.js";
|
|
7
|
-
const AccordionGroup =
|
|
7
|
+
const AccordionGroup = ({ ref, ..._props }) => {
|
|
8
8
|
const {
|
|
9
9
|
children,
|
|
10
10
|
sx,
|
|
@@ -41,7 +41,7 @@ const AccordionGroup = forwardRef((_props, ref) => {
|
|
|
41
41
|
children
|
|
42
42
|
}
|
|
43
43
|
) });
|
|
44
|
-
}
|
|
44
|
+
};
|
|
45
45
|
export {
|
|
46
46
|
AccordionGroup
|
|
47
47
|
};
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
color?: import('../../types').ColorVariant;
|
|
4
|
-
} & Omit<import('react').HTMLAttributes<HTMLDivElement>, "color"> & import('react').RefAttributes<HTMLDivElement>>;
|
|
1
|
+
import { BadgeProps } from './types';
|
|
2
|
+
export declare const Badge: ({ children, ref, ..._props }: BadgeProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
5
3
|
//# sourceMappingURL=badge.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"badge.d.ts","sourceRoot":"","sources":["../../../src/lib/badge/badge.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"badge.d.ts","sourceRoot":"","sources":["../../../src/lib/badge/badge.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAIrC,eAAO,MAAM,KAAK,iCAAkC,UAAU,qDAmC7D,CAAC"}
|
package/dist/lib/badge/badge.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { jsxs, jsx } from "@emotion/react/jsx-runtime";
|
|
2
|
-
import { forwardRef } from "react";
|
|
3
2
|
import { isNumber } from "lodash-es";
|
|
4
3
|
import { getBadgeProps } from "./helpers.js";
|
|
5
4
|
import { getColorShadesByVariant } from "../../utils/index.js";
|
|
6
|
-
const Badge =
|
|
7
|
-
const {
|
|
5
|
+
const Badge = ({ children, ref, ..._props }) => {
|
|
6
|
+
const { badgeContent, color = "primary", ...rest } = getBadgeProps(_props);
|
|
8
7
|
const { main } = getColorShadesByVariant(color);
|
|
9
8
|
return /* @__PURE__ */ jsxs("div", { css: { position: "relative", display: "inline-block" }, ...rest, ref, children: [
|
|
10
9
|
/* @__PURE__ */ jsx(
|
|
@@ -36,7 +35,7 @@ const Badge = forwardRef((_props, ref) => {
|
|
|
36
35
|
),
|
|
37
36
|
children
|
|
38
37
|
] });
|
|
39
|
-
}
|
|
38
|
+
};
|
|
40
39
|
export {
|
|
41
40
|
Badge
|
|
42
41
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ColorVariant } from '../../types';
|
|
3
|
-
export type BadgeProps = {
|
|
1
|
+
import { JSX } from 'react';
|
|
2
|
+
import { ColorVariant, ShallowMerge } from '../../types';
|
|
3
|
+
export type BadgeProps = ShallowMerge<JSX.IntrinsicElements['div'], {
|
|
4
4
|
badgeContent?: number | string;
|
|
5
5
|
color?: ColorVariant;
|
|
6
|
-
}
|
|
6
|
+
}>;
|
|
7
7
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/badge/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/badge/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAE5B,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAErD,MAAM,MAAM,UAAU,GAAG,YAAY,CACnC,GAAG,CAAC,iBAAiB,CAAC,KAAK,CAAC,EAC5B;IACE,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC/B,KAAK,CAAC,EAAE,YAAY,CAAC;CACtB,CACF,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { CountUpProps } from './types';
|
|
2
|
-
export declare const CountUp:
|
|
2
|
+
export declare const CountUp: ({ from, to, duration, formatNumberOptions, ref, ...props }: CountUpProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
3
3
|
//# sourceMappingURL=count-up.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"count-up.d.ts","sourceRoot":"","sources":["../../../src/lib/count-up/count-up.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAIvC,eAAO,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"count-up.d.ts","sourceRoot":"","sources":["../../../src/lib/count-up/count-up.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAIvC,eAAO,MAAM,OAAO,+DAAwE,YAAY,qDAiCvG,CAAC"}
|
|
@@ -1,36 +1,34 @@
|
|
|
1
1
|
import { jsx } from "@emotion/react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { useRef, useEffect } from "react";
|
|
3
3
|
import { useMergeRefs } from "@floating-ui/react";
|
|
4
4
|
import { useMotionValue, useInView, useTransform, animate, motion } from "motion/react";
|
|
5
5
|
import { useTranslation } from "react-i18next";
|
|
6
6
|
import { formatNumber } from "../../utils/index.js";
|
|
7
7
|
import { getDecimalDigits } from "../../utils/common.js";
|
|
8
|
-
const CountUp =
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
);
|
|
8
|
+
const CountUp = ({ from = 0, to, duration = 2, formatNumberOptions, ref, ...props }) => {
|
|
9
|
+
const rootRef = useRef(null);
|
|
10
|
+
const { i18n } = useTranslation();
|
|
11
|
+
const mergedRef = useMergeRefs([ref, rootRef]);
|
|
12
|
+
const maximumFractionDigits = Math.max(getDecimalDigits(from), getDecimalDigits(to));
|
|
13
|
+
const count = useMotionValue(from);
|
|
14
|
+
const isInView = useInView(rootRef, { once: true });
|
|
15
|
+
const rounded = useTransform(
|
|
16
|
+
count,
|
|
17
|
+
(latest) => formatNumber(latest, {
|
|
18
|
+
lng: i18n.language,
|
|
19
|
+
...formatNumberOptions,
|
|
20
|
+
maximumFractionDigits
|
|
21
|
+
})
|
|
22
|
+
);
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
if (!isInView) return;
|
|
25
|
+
const controls = animate(count, to, { duration });
|
|
26
|
+
return () => {
|
|
27
|
+
controls.stop();
|
|
28
|
+
};
|
|
29
|
+
}, [count, duration, isInView, to]);
|
|
30
|
+
return /* @__PURE__ */ jsx(motion.span, { ...props, ref: mergedRef, children: rounded });
|
|
31
|
+
};
|
|
34
32
|
export {
|
|
35
33
|
CountUp
|
|
36
34
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const DialogClose:
|
|
1
|
+
export declare const DialogClose: ({ event, reason, className, ref, ...props }: import('../../floating').FloatingCloseProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
2
2
|
//# sourceMappingURL=dialog-close.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog-close.d.ts","sourceRoot":"","sources":["../../../../src/lib/dialog/dialog-close/dialog-close.tsx"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"dialog-close.d.ts","sourceRoot":"","sources":["../../../../src/lib/dialog/dialog-close/dialog-close.tsx"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW,gJAAgB,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const DrawerClose:
|
|
1
|
+
export declare const DrawerClose: ({ event, reason, className, ref, ...props }: import('../../floating').FloatingCloseProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
2
2
|
//# sourceMappingURL=drawer-close.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawer-close.d.ts","sourceRoot":"","sources":["../../../../src/lib/drawer/drawer-close/drawer-close.tsx"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"drawer-close.d.ts","sourceRoot":"","sources":["../../../../src/lib/drawer/drawer-close/drawer-close.tsx"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW,gJAAgB,CAAC"}
|
|
@@ -1,54 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const Floating: import(
|
|
3
|
-
placement?: Placement;
|
|
4
|
-
onOpenChange?: import('@floating-ui/react').UseFloatingOptions["onOpenChange"];
|
|
5
|
-
open?: boolean;
|
|
6
|
-
elements?: import('@floating-ui/react').UseFloatingOptions["elements"];
|
|
7
|
-
clickProps?: import('@floating-ui/react').UseClickProps;
|
|
8
|
-
dismissProps?: import('@floating-ui/react').UseDismissProps;
|
|
9
|
-
hoverProps?: import('@floating-ui/react').UseHoverProps;
|
|
10
|
-
focusProps?: import('@floating-ui/react').UseFocusProps;
|
|
11
|
-
offsetOptions?: import('@floating-ui/react').OffsetOptions;
|
|
12
|
-
sizeOptions?: import('@floating-ui/react').SizeOptions;
|
|
13
|
-
autoUpdateOptions?: import('@floating-ui/react').AutoUpdateOptions;
|
|
14
|
-
} & {
|
|
15
|
-
children?: import('react').ReactNode | undefined;
|
|
16
|
-
} & import('react').RefAttributes<{
|
|
17
|
-
placement: Placement;
|
|
18
|
-
strategy: import('@floating-ui/react').Strategy;
|
|
19
|
-
middlewareData: import('@floating-ui/react').MiddlewareData;
|
|
20
|
-
x: number;
|
|
21
|
-
y: number;
|
|
22
|
-
isPositioned: boolean;
|
|
23
|
-
update: () => void;
|
|
24
|
-
floatingStyles: import('react').CSSProperties;
|
|
25
|
-
refs: {
|
|
26
|
-
reference: import('react').MutableRefObject<import('@floating-ui/react-dom').ReferenceType | null>;
|
|
27
|
-
floating: import('react').MutableRefObject<HTMLElement | null>;
|
|
28
|
-
setReference: (node: import('@floating-ui/react-dom').ReferenceType | null) => void;
|
|
29
|
-
setFloating: (node: HTMLElement | null) => void;
|
|
30
|
-
} & import('@floating-ui/react').ExtendedRefs<import('@floating-ui/react').ReferenceType>;
|
|
31
|
-
elements: {
|
|
32
|
-
reference: import('@floating-ui/react-dom').ReferenceType | null;
|
|
33
|
-
floating: HTMLElement | null;
|
|
34
|
-
} & import('@floating-ui/react').ExtendedElements<import('@floating-ui/react').ReferenceType>;
|
|
35
|
-
context: {
|
|
36
|
-
x: number;
|
|
37
|
-
y: number;
|
|
38
|
-
update: () => void;
|
|
39
|
-
placement: Placement;
|
|
40
|
-
strategy: import('@floating-ui/react').Strategy;
|
|
41
|
-
middlewareData: import('@floating-ui/react').MiddlewareData;
|
|
42
|
-
isPositioned: boolean;
|
|
43
|
-
floatingStyles: import('react').CSSProperties;
|
|
44
|
-
open: boolean;
|
|
45
|
-
onOpenChange: (open: boolean, event?: Event, reason?: import('@floating-ui/react').OpenChangeReason) => void;
|
|
46
|
-
events: import('@floating-ui/react').FloatingEvents;
|
|
47
|
-
dataRef: import('react').MutableRefObject<import('@floating-ui/react').ContextData>;
|
|
48
|
-
nodeId: string | undefined;
|
|
49
|
-
floatingId: string | undefined;
|
|
50
|
-
refs: import('@floating-ui/react').ExtendedRefs<import('@floating-ui/react').ReferenceType>;
|
|
51
|
-
elements: import('@floating-ui/react').ExtendedElements<import('@floating-ui/react').ReferenceType>;
|
|
52
|
-
};
|
|
53
|
-
}>>;
|
|
1
|
+
import { FloatingProps } from './types';
|
|
2
|
+
export declare const Floating: ({ ref, ...props }: FloatingProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
54
3
|
//# sourceMappingURL=floating.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"floating.d.ts","sourceRoot":"","sources":["../../../../src/lib/floating/floating/floating.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"floating.d.ts","sourceRoot":"","sources":["../../../../src/lib/floating/floating/floating.tsx"],"names":[],"mappings":"AAoBA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExC,eAAO,MAAM,QAAQ,sBAAuB,aAAa,qDAYxD,CAAC"}
|
|
@@ -1,97 +1,96 @@
|
|
|
1
1
|
import { jsx } from "@emotion/react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { useImperativeHandle, useMemo } from "react";
|
|
3
3
|
import { useFloatingParentNodeId, FloatingTree, useFloating, autoUpdate, offset, flip, size, useClick, useHover, useFocus, useDismiss, useRole, useInteractions } from "@floating-ui/react";
|
|
4
4
|
import { FloatingContext } from "./helpers.js";
|
|
5
|
-
const
|
|
6
|
-
({
|
|
7
|
-
open,
|
|
8
|
-
placement = "bottom",
|
|
9
|
-
onOpenChange,
|
|
10
|
-
dismissProps = {
|
|
11
|
-
enabled: false
|
|
12
|
-
},
|
|
13
|
-
children,
|
|
14
|
-
clickProps = {
|
|
15
|
-
enabled: false
|
|
16
|
-
},
|
|
17
|
-
focusProps = {
|
|
18
|
-
enabled: false
|
|
19
|
-
},
|
|
20
|
-
hoverProps = {
|
|
21
|
-
enabled: false
|
|
22
|
-
},
|
|
23
|
-
elements,
|
|
24
|
-
offsetOptions = 4,
|
|
25
|
-
sizeOptions,
|
|
26
|
-
autoUpdateOptions
|
|
27
|
-
}, ref) => {
|
|
28
|
-
const floating = useFloating({
|
|
29
|
-
open,
|
|
30
|
-
onOpenChange,
|
|
31
|
-
placement,
|
|
32
|
-
middleware: [
|
|
33
|
-
offset(offsetOptions),
|
|
34
|
-
flip(),
|
|
35
|
-
size({
|
|
36
|
-
...sizeOptions,
|
|
37
|
-
apply(args) {
|
|
38
|
-
var _a;
|
|
39
|
-
const { availableHeight, availableWidth, rects, elements: elements2, placement: placement2, x } = args;
|
|
40
|
-
const styles = {};
|
|
41
|
-
if (rects.floating.height > availableHeight) {
|
|
42
|
-
styles.height = `${availableHeight}px`;
|
|
43
|
-
}
|
|
44
|
-
if (rects.floating.width > availableWidth) {
|
|
45
|
-
const maxWidth = Math.min(rects.floating.width, window.innerWidth);
|
|
46
|
-
styles.maxWidth = `${maxWidth}px`;
|
|
47
|
-
const verticalPlacements = [
|
|
48
|
-
"top",
|
|
49
|
-
"top-start",
|
|
50
|
-
"top-end",
|
|
51
|
-
"bottom",
|
|
52
|
-
"bottom-start",
|
|
53
|
-
"bottom-end"
|
|
54
|
-
];
|
|
55
|
-
const isVertical = verticalPlacements.includes(placement2);
|
|
56
|
-
if (isVertical) {
|
|
57
|
-
styles.left = `${-x + (window.innerWidth - rects.floating.width) / 2}px`;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
Object.assign(elements2.floating.style, styles);
|
|
61
|
-
(_a = sizeOptions == null ? void 0 : sizeOptions.apply) == null ? void 0 : _a.call(sizeOptions, args);
|
|
62
|
-
}
|
|
63
|
-
})
|
|
64
|
-
],
|
|
65
|
-
whileElementsMounted: (...args) => {
|
|
66
|
-
return autoUpdate(...args, autoUpdateOptions);
|
|
67
|
-
},
|
|
68
|
-
elements
|
|
69
|
-
});
|
|
70
|
-
useImperativeHandle(ref, () => floating, [floating]);
|
|
71
|
-
const { context } = floating;
|
|
72
|
-
const click = useClick(context, clickProps);
|
|
73
|
-
const hover = useHover(context, hoverProps);
|
|
74
|
-
const focus = useFocus(context, focusProps);
|
|
75
|
-
const dismiss = useDismiss(context, dismissProps);
|
|
76
|
-
const role = useRole(context);
|
|
77
|
-
const interactions = useInteractions([click, dismiss, role, hover, focus]);
|
|
78
|
-
const contextValue = useMemo(
|
|
79
|
-
() => ({
|
|
80
|
-
...floating,
|
|
81
|
-
...interactions
|
|
82
|
-
}),
|
|
83
|
-
[floating, interactions]
|
|
84
|
-
);
|
|
85
|
-
return /* @__PURE__ */ jsx(FloatingContext.Provider, { value: contextValue, children });
|
|
86
|
-
}
|
|
87
|
-
);
|
|
88
|
-
const Floating = forwardRef((props, ref) => {
|
|
5
|
+
const Floating = ({ ref, ...props }) => {
|
|
89
6
|
const parentId = useFloatingParentNodeId();
|
|
90
7
|
if (parentId) {
|
|
91
8
|
return /* @__PURE__ */ jsx(FloatingCore, { ...props, ref });
|
|
92
9
|
}
|
|
93
10
|
return /* @__PURE__ */ jsx(FloatingTree, { children: /* @__PURE__ */ jsx(FloatingCore, { ...props, ref }) });
|
|
94
|
-
}
|
|
11
|
+
};
|
|
12
|
+
const FloatingCore = ({
|
|
13
|
+
open,
|
|
14
|
+
placement = "bottom",
|
|
15
|
+
onOpenChange,
|
|
16
|
+
dismissProps = {
|
|
17
|
+
enabled: false
|
|
18
|
+
},
|
|
19
|
+
children,
|
|
20
|
+
clickProps = {
|
|
21
|
+
enabled: false
|
|
22
|
+
},
|
|
23
|
+
focusProps = {
|
|
24
|
+
enabled: false
|
|
25
|
+
},
|
|
26
|
+
hoverProps = {
|
|
27
|
+
enabled: false
|
|
28
|
+
},
|
|
29
|
+
elements,
|
|
30
|
+
offsetOptions = 4,
|
|
31
|
+
sizeOptions,
|
|
32
|
+
autoUpdateOptions,
|
|
33
|
+
ref
|
|
34
|
+
}) => {
|
|
35
|
+
const floating = useFloating({
|
|
36
|
+
open,
|
|
37
|
+
onOpenChange,
|
|
38
|
+
placement,
|
|
39
|
+
middleware: [
|
|
40
|
+
offset(offsetOptions),
|
|
41
|
+
flip(),
|
|
42
|
+
size({
|
|
43
|
+
...sizeOptions,
|
|
44
|
+
apply(args) {
|
|
45
|
+
var _a;
|
|
46
|
+
const { availableHeight, availableWidth, rects, elements: elements2, placement: placement2, x } = args;
|
|
47
|
+
const styles = {};
|
|
48
|
+
if (rects.floating.height > availableHeight) {
|
|
49
|
+
styles.height = `${availableHeight}px`;
|
|
50
|
+
}
|
|
51
|
+
if (rects.floating.width > availableWidth) {
|
|
52
|
+
const maxWidth = Math.min(rects.floating.width, window.innerWidth);
|
|
53
|
+
styles.maxWidth = `${maxWidth}px`;
|
|
54
|
+
const verticalPlacements = [
|
|
55
|
+
"top",
|
|
56
|
+
"top-start",
|
|
57
|
+
"top-end",
|
|
58
|
+
"bottom",
|
|
59
|
+
"bottom-start",
|
|
60
|
+
"bottom-end"
|
|
61
|
+
];
|
|
62
|
+
const isVertical = verticalPlacements.includes(placement2);
|
|
63
|
+
if (isVertical) {
|
|
64
|
+
styles.left = `${-x + (window.innerWidth - rects.floating.width) / 2}px`;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
Object.assign(elements2.floating.style, styles);
|
|
68
|
+
(_a = sizeOptions == null ? void 0 : sizeOptions.apply) == null ? void 0 : _a.call(sizeOptions, args);
|
|
69
|
+
}
|
|
70
|
+
})
|
|
71
|
+
],
|
|
72
|
+
whileElementsMounted: (...args) => {
|
|
73
|
+
return autoUpdate(...args, autoUpdateOptions);
|
|
74
|
+
},
|
|
75
|
+
elements
|
|
76
|
+
});
|
|
77
|
+
useImperativeHandle(ref, () => floating, [floating]);
|
|
78
|
+
const { context } = floating;
|
|
79
|
+
const click = useClick(context, clickProps);
|
|
80
|
+
const hover = useHover(context, hoverProps);
|
|
81
|
+
const focus = useFocus(context, focusProps);
|
|
82
|
+
const dismiss = useDismiss(context, dismissProps);
|
|
83
|
+
const role = useRole(context);
|
|
84
|
+
const interactions = useInteractions([click, dismiss, role, hover, focus]);
|
|
85
|
+
const contextValue = useMemo(
|
|
86
|
+
() => ({
|
|
87
|
+
...floating,
|
|
88
|
+
...interactions
|
|
89
|
+
}),
|
|
90
|
+
[floating, interactions]
|
|
91
|
+
);
|
|
92
|
+
return /* @__PURE__ */ jsx(FloatingContext.Provider, { value: contextValue, children });
|
|
93
|
+
};
|
|
95
94
|
export {
|
|
96
95
|
Floating
|
|
97
96
|
};
|
|
@@ -12,6 +12,7 @@ export type FloatingProps = PropsWithChildren<{
|
|
|
12
12
|
offsetOptions?: OffsetOptions;
|
|
13
13
|
sizeOptions?: SizeOptions;
|
|
14
14
|
autoUpdateOptions?: AutoUpdateOptions;
|
|
15
|
+
ref?: React.Ref<FloatingRef>;
|
|
15
16
|
}>;
|
|
16
17
|
export type FloatingRef = UseFloatingReturn;
|
|
17
18
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/lib/floating/floating/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,SAAS,EACT,WAAW,EACX,aAAa,EACb,eAAe,EACf,kBAAkB,EAClB,iBAAiB,EACjB,aAAa,EACb,aAAa,EACd,MAAM,oBAAoB,CAAC;AAE5B,MAAM,MAAM,aAAa,GAAG,iBAAiB,CAAC;IAC5C,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,YAAY,CAAC,EAAE,kBAAkB,CAAC,cAAc,CAAC,CAAC;IAClD,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,QAAQ,CAAC,EAAE,kBAAkB,CAAC,UAAU,CAAC,CAAC;IAC1C,UAAU,CAAC,EAAE,aAAa,CAAC;IAC3B,YAAY,CAAC,EAAE,eAAe,CAAC;IAC/B,UAAU,CAAC,EAAE,aAAa,CAAC;IAC3B,UAAU,CAAC,EAAE,aAAa,CAAC;IAC3B,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/lib/floating/floating/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,SAAS,EACT,WAAW,EACX,aAAa,EACb,eAAe,EACf,kBAAkB,EAClB,iBAAiB,EACjB,aAAa,EACb,aAAa,EACd,MAAM,oBAAoB,CAAC;AAE5B,MAAM,MAAM,aAAa,GAAG,iBAAiB,CAAC;IAC5C,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,YAAY,CAAC,EAAE,kBAAkB,CAAC,cAAc,CAAC,CAAC;IAClD,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,QAAQ,CAAC,EAAE,kBAAkB,CAAC,UAAU,CAAC,CAAC;IAC1C,UAAU,CAAC,EAAE,aAAa,CAAC;IAC3B,YAAY,CAAC,EAAE,eAAe,CAAC;IAC/B,UAAU,CAAC,EAAE,aAAa,CAAC;IAC3B,UAAU,CAAC,EAAE,aAAa,CAAC;IAC3B,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IACtC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;CAC9B,CAAC,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG,iBAAiB,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { FloatingCloseProps } from './types';
|
|
2
|
-
export declare const FloatingClose:
|
|
2
|
+
export declare const FloatingClose: ({ event, reason, className, ref, ...props }: FloatingCloseProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
3
3
|
//# sourceMappingURL=floating-close.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"floating-close.d.ts","sourceRoot":"","sources":["../../../../src/lib/floating/floating-close/floating-close.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAM7C,eAAO,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"floating-close.d.ts","sourceRoot":"","sources":["../../../../src/lib/floating/floating-close/floating-close.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAM7C,eAAO,MAAM,aAAa,gDAA2D,kBAAkB,qDAwBtG,CAAC"}
|
|
@@ -1,29 +1,27 @@
|
|
|
1
1
|
import { jsx } from "@emotion/react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { useRef, useEffect } from "react";
|
|
3
3
|
import { useMergeRefs } from "@floating-ui/react";
|
|
4
4
|
import { useFloatingContext } from "../floating/helpers.js";
|
|
5
5
|
import { cn } from "../../../utils/stylesheet.js";
|
|
6
|
-
const FloatingClose =
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
);
|
|
6
|
+
const FloatingClose = ({ event = "click", reason, className, ref, ...props }) => {
|
|
7
|
+
const wrapperRef = useRef(null);
|
|
8
|
+
const {
|
|
9
|
+
context: { onOpenChange }
|
|
10
|
+
} = useFloatingContext();
|
|
11
|
+
const mergedRefs = useMergeRefs([ref, wrapperRef]);
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
const wrapperEl = wrapperRef.current;
|
|
14
|
+
if (!wrapperEl) return;
|
|
15
|
+
const handleEvent = function(event2) {
|
|
16
|
+
onOpenChange == null ? void 0 : onOpenChange(false, event2, reason);
|
|
17
|
+
};
|
|
18
|
+
wrapperEl.addEventListener(event, handleEvent);
|
|
19
|
+
return () => {
|
|
20
|
+
wrapperEl.removeEventListener(event, handleEvent);
|
|
21
|
+
};
|
|
22
|
+
}, [event, onOpenChange, reason]);
|
|
23
|
+
return /* @__PURE__ */ jsx("div", { css: { display: "contents" }, className: cn(className), ...props, ref: mergedRefs });
|
|
24
|
+
};
|
|
27
25
|
export {
|
|
28
26
|
FloatingClose
|
|
29
27
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/lib/floating/floating-close/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAE5B,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/lib/floating/floating-close/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAE5B,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,MAAM,MAAM,kBAAkB,GAAG,YAAY,CAC3C,GAAG,CAAC,iBAAiB,CAAC,KAAK,CAAC,EAC5B;IACE,KAAK,CAAC,EAAE,MAAM,mBAAmB,CAAC;IAClC,MAAM,CAAC,EAAE,gBAAgB,CAAC;CAC3B,CACF,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { FloatingContentProps } from './types';
|
|
2
|
-
export declare const FloatingContent:
|
|
2
|
+
export declare const FloatingContent: ({ style, floatingPortalProps, floatingFocusManagerProps, floatingOverlayProps, sx, ref, ...props }: FloatingContentProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
3
3
|
//# sourceMappingURL=floating-content.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"floating-content.d.ts","sourceRoot":"","sources":["../../../../src/lib/floating/floating-content/floating-content.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"floating-content.d.ts","sourceRoot":"","sources":["../../../../src/lib/floating/floating-content/floating-content.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAQ/C,eAAO,MAAM,eAAe,uGAQzB,oBAAoB,qDAsCtB,CAAC"}
|
|
@@ -1,45 +1,50 @@
|
|
|
1
1
|
import { jsx } from "@emotion/react/jsx-runtime";
|
|
2
|
-
import { forwardRef } from "react";
|
|
3
2
|
import { useMergeRefs, FloatingPortal, FloatingOverlay, FloatingFocusManager } from "@floating-ui/react";
|
|
4
3
|
import { AnimatePresence, motion } from "motion/react";
|
|
5
4
|
import { useFloatingContext } from "../floating/helpers.js";
|
|
6
5
|
import { FLOATING_Z_INDEX } from "../../../theme/index.js";
|
|
7
6
|
import { useIsHydrated } from "../../../hooks/use-is-hydrated/index.js";
|
|
8
7
|
import { createSxInterpolation } from "../../../utils/stylesheet.js";
|
|
9
|
-
const FloatingContent =
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
8
|
+
const FloatingContent = ({
|
|
9
|
+
style,
|
|
10
|
+
floatingPortalProps,
|
|
11
|
+
floatingFocusManagerProps,
|
|
12
|
+
floatingOverlayProps,
|
|
13
|
+
sx,
|
|
14
|
+
ref,
|
|
15
|
+
...props
|
|
16
|
+
}) => {
|
|
17
|
+
const { getFloatingProps, context } = useFloatingContext();
|
|
18
|
+
const mergedRefs = useMergeRefs([context.refs.setFloating, ref]);
|
|
19
|
+
const isHydrated = useIsHydrated();
|
|
20
|
+
return /* @__PURE__ */ jsx(AnimatePresence, { children: context.open && isHydrated && /* @__PURE__ */ jsx(FloatingPortal, { root: document.body, ...floatingPortalProps, children: /* @__PURE__ */ jsx(
|
|
21
|
+
FloatingOverlay,
|
|
22
|
+
{
|
|
23
|
+
...floatingOverlayProps,
|
|
24
|
+
style: {
|
|
25
|
+
display: (floatingOverlayProps == null ? void 0 : floatingOverlayProps.disabled) ?? true ? "contents" : void 0,
|
|
26
|
+
...floatingOverlayProps == null ? void 0 : floatingOverlayProps.style
|
|
27
|
+
},
|
|
28
|
+
children: /* @__PURE__ */ jsx(FloatingFocusManager, { disabled: true, context, ...floatingFocusManagerProps, children: /* @__PURE__ */ jsx(
|
|
29
|
+
motion.div,
|
|
30
|
+
{
|
|
31
|
+
initial: { opacity: 0 },
|
|
32
|
+
animate: { opacity: 1 },
|
|
33
|
+
exit: { opacity: 0 },
|
|
34
|
+
style: {
|
|
35
|
+
...context.elements.reference ? context.floatingStyles : {},
|
|
36
|
+
...style,
|
|
37
|
+
zIndex: FLOATING_Z_INDEX
|
|
38
|
+
},
|
|
39
|
+
css: createSxInterpolation(sx),
|
|
40
|
+
...getFloatingProps(props),
|
|
41
|
+
ref: mergedRefs,
|
|
42
|
+
children: props.children
|
|
43
|
+
}
|
|
44
|
+
) })
|
|
45
|
+
}
|
|
46
|
+
) }) });
|
|
47
|
+
};
|
|
43
48
|
export {
|
|
44
49
|
FloatingContent
|
|
45
50
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { IconButtonProps } from './types';
|
|
2
|
-
export declare const IconButton:
|
|
2
|
+
export declare const IconButton: ({ children, ref, ..._props }: IconButtonProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
3
3
|
//# sourceMappingURL=icon-button.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icon-button.d.ts","sourceRoot":"","sources":["../../../src/lib/icon-button/icon-button.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,eAAe,EAA6B,MAAM,SAAS,CAAC;AAWrE,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"icon-button.d.ts","sourceRoot":"","sources":["../../../src/lib/icon-button/icon-button.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,eAAe,EAA6B,MAAM,SAAS,CAAC;AAWrE,eAAO,MAAM,UAAU,iCAAkC,eAAe,qDA2HvE,CAAC"}
|