@refraktor/core 0.0.2 → 0.0.3
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/.turbo/turbo-build.log +1 -1
- package/build/components/breadcrumbs/breadcrumbs.d.ts +4 -0
- package/build/components/breadcrumbs/breadcrumbs.d.ts.map +1 -0
- package/build/components/breadcrumbs/breadcrumbs.js +64 -0
- package/build/components/breadcrumbs/breadcrumbs.styles.d.ts +12 -0
- package/build/components/breadcrumbs/breadcrumbs.styles.d.ts.map +1 -0
- package/build/components/breadcrumbs/breadcrumbs.styles.js +43 -0
- package/build/components/breadcrumbs/breadcrumbs.test.d.ts +2 -0
- package/build/components/breadcrumbs/breadcrumbs.test.d.ts.map +1 -0
- package/build/components/breadcrumbs/breadcrumbs.test.js +72 -0
- package/build/components/breadcrumbs/breadcrumbs.types.d.ts +56 -0
- package/build/components/breadcrumbs/breadcrumbs.types.d.ts.map +1 -0
- package/build/components/breadcrumbs/breadcrumbs.types.js +1 -0
- package/build/components/breadcrumbs/breadcrumbs.utils.d.ts +10 -0
- package/build/components/breadcrumbs/breadcrumbs.utils.d.ts.map +1 -0
- package/build/components/breadcrumbs/breadcrumbs.utils.js +36 -0
- package/build/components/breadcrumbs/index.d.ts +3 -0
- package/build/components/breadcrumbs/index.d.ts.map +1 -0
- package/build/components/breadcrumbs/index.js +1 -0
- package/build/components/drawer/drawer-close/drawer-close.d.ts +4 -0
- package/build/components/drawer/drawer-close/drawer-close.d.ts.map +1 -0
- package/build/components/drawer/drawer-close/drawer-close.js +19 -0
- package/build/components/drawer/drawer-close/index.d.ts +2 -0
- package/build/components/drawer/drawer-close/index.d.ts.map +1 -0
- package/build/components/drawer/drawer-close/index.js +1 -0
- package/build/components/drawer/drawer-content/drawer-content.d.ts +4 -0
- package/build/components/drawer/drawer-content/drawer-content.d.ts.map +1 -0
- package/build/components/drawer/drawer-content/drawer-content.js +41 -0
- package/build/components/drawer/drawer-content/index.d.ts +2 -0
- package/build/components/drawer/drawer-content/index.d.ts.map +1 -0
- package/build/components/drawer/drawer-content/index.js +1 -0
- package/build/components/drawer/drawer-header/drawer-header.d.ts +4 -0
- package/build/components/drawer/drawer-header/drawer-header.d.ts.map +1 -0
- package/build/components/drawer/drawer-header/drawer-header.js +13 -0
- package/build/components/drawer/drawer-header/index.d.ts +2 -0
- package/build/components/drawer/drawer-header/index.d.ts.map +1 -0
- package/build/components/drawer/drawer-header/index.js +1 -0
- package/build/components/drawer/drawer-overlay/drawer-overlay.d.ts +4 -0
- package/build/components/drawer/drawer-overlay/drawer-overlay.d.ts.map +1 -0
- package/build/components/drawer/drawer-overlay/drawer-overlay.js +31 -0
- package/build/components/drawer/drawer-overlay/index.d.ts +2 -0
- package/build/components/drawer/drawer-overlay/index.d.ts.map +1 -0
- package/build/components/drawer/drawer-overlay/index.js +1 -0
- package/build/components/drawer/drawer-root/drawer-root.d.ts +4 -0
- package/build/components/drawer/drawer-root/drawer-root.d.ts.map +1 -0
- package/build/components/drawer/drawer-root/drawer-root.js +50 -0
- package/build/components/drawer/drawer-root/index.d.ts +2 -0
- package/build/components/drawer/drawer-root/index.d.ts.map +1 -0
- package/build/components/drawer/drawer-root/index.js +1 -0
- package/build/components/drawer/drawer.context.d.ts +23 -0
- package/build/components/drawer/drawer.context.d.ts.map +1 -0
- package/build/components/drawer/drawer.context.js +2 -0
- package/build/components/drawer/drawer.d.ts +4 -0
- package/build/components/drawer/drawer.d.ts.map +1 -0
- package/build/components/drawer/drawer.js +19 -0
- package/build/components/drawer/drawer.styles.d.ts +6 -0
- package/build/components/drawer/drawer.styles.d.ts.map +1 -0
- package/build/components/drawer/drawer.styles.js +21 -0
- package/build/components/drawer/drawer.test.d.ts +2 -0
- package/build/components/drawer/drawer.test.d.ts.map +1 -0
- package/build/components/drawer/drawer.test.js +70 -0
- package/build/components/drawer/drawer.types.d.ts +116 -0
- package/build/components/drawer/drawer.types.d.ts.map +1 -0
- package/build/components/drawer/drawer.types.js +1 -0
- package/build/components/drawer/index.d.ts +8 -0
- package/build/components/drawer/index.d.ts.map +1 -0
- package/build/components/drawer/index.js +6 -0
- package/build/components/drawer/use-drawer.d.ts +17 -0
- package/build/components/drawer/use-drawer.d.ts.map +1 -0
- package/build/components/drawer/use-drawer.js +61 -0
- package/build/components/index.d.ts +4 -0
- package/build/components/index.d.ts.map +1 -1
- package/build/components/index.js +4 -0
- package/build/components/modal/modal-overlay/modal-overlay.d.ts.map +1 -1
- package/build/components/modal/modal-overlay/modal-overlay.js +10 -2
- package/build/components/modal/modal.test.js +16 -0
- package/build/components/modal/modal.types.d.ts +4 -0
- package/build/components/modal/modal.types.d.ts.map +1 -1
- package/build/components/segmented-control/index.d.ts +3 -0
- package/build/components/segmented-control/index.d.ts.map +1 -0
- package/build/components/segmented-control/index.js +1 -0
- package/build/components/segmented-control/segmented-control.d.ts +4 -0
- package/build/components/segmented-control/segmented-control.d.ts.map +1 -0
- package/build/components/segmented-control/segmented-control.js +113 -0
- package/build/components/segmented-control/segmented-control.styles.d.ts +9 -0
- package/build/components/segmented-control/segmented-control.styles.d.ts.map +1 -0
- package/build/components/segmented-control/segmented-control.styles.js +28 -0
- package/build/components/segmented-control/segmented-control.test.d.ts +2 -0
- package/build/components/segmented-control/segmented-control.test.d.ts.map +1 -0
- package/build/components/segmented-control/segmented-control.test.js +81 -0
- package/build/components/segmented-control/segmented-control.types.d.ts +49 -0
- package/build/components/segmented-control/segmented-control.types.d.ts.map +1 -0
- package/build/components/segmented-control/segmented-control.types.js +1 -0
- package/build/components/select/select-item/select-item.js +1 -1
- package/build/components/split-pane/index.d.ts +3 -0
- package/build/components/split-pane/index.d.ts.map +1 -0
- package/build/components/split-pane/index.js +1 -0
- package/build/components/split-pane/split-pane.d.ts +4 -0
- package/build/components/split-pane/split-pane.d.ts.map +1 -0
- package/build/components/split-pane/split-pane.js +201 -0
- package/build/components/split-pane/split-pane.styles.d.ts +3 -0
- package/build/components/split-pane/split-pane.styles.d.ts.map +1 -0
- package/build/components/split-pane/split-pane.styles.js +8 -0
- package/build/components/split-pane/split-pane.test.d.ts +2 -0
- package/build/components/split-pane/split-pane.test.d.ts.map +1 -0
- package/build/components/split-pane/split-pane.test.js +105 -0
- package/build/components/split-pane/split-pane.types.d.ts +51 -0
- package/build/components/split-pane/split-pane.types.d.ts.map +1 -0
- package/build/components/split-pane/split-pane.types.js +1 -0
- package/build/components/table/index.d.ts +9 -0
- package/build/components/table/index.d.ts.map +1 -0
- package/build/components/table/index.js +7 -0
- package/build/components/table/table-body/index.d.ts +2 -0
- package/build/components/table/table-body/index.d.ts.map +1 -0
- package/build/components/table/table-body/index.js +1 -0
- package/build/components/table/table-body/table-body.d.ts +4 -0
- package/build/components/table/table-body/table-body.d.ts.map +1 -0
- package/build/components/table/table-body/table-body.js +17 -0
- package/build/components/table/table-caption/index.d.ts +2 -0
- package/build/components/table/table-caption/index.d.ts.map +1 -0
- package/build/components/table/table-caption/index.js +1 -0
- package/build/components/table/table-caption/table-caption.d.ts +4 -0
- package/build/components/table/table-caption/table-caption.d.ts.map +1 -0
- package/build/components/table/table-caption/table-caption.js +13 -0
- package/build/components/table/table-cell/index.d.ts +2 -0
- package/build/components/table/table-cell/index.d.ts.map +1 -0
- package/build/components/table/table-cell/index.js +1 -0
- package/build/components/table/table-cell/table-cell.d.ts +4 -0
- package/build/components/table/table-cell/table-cell.d.ts.map +1 -0
- package/build/components/table/table-cell/table-cell.js +13 -0
- package/build/components/table/table-head/index.d.ts +2 -0
- package/build/components/table/table-head/index.d.ts.map +1 -0
- package/build/components/table/table-head/index.js +1 -0
- package/build/components/table/table-head/table-head.d.ts +4 -0
- package/build/components/table/table-head/table-head.d.ts.map +1 -0
- package/build/components/table/table-head/table-head.js +11 -0
- package/build/components/table/table-header-cell/index.d.ts +2 -0
- package/build/components/table/table-header-cell/index.d.ts.map +1 -0
- package/build/components/table/table-header-cell/index.js +1 -0
- package/build/components/table/table-header-cell/table-header-cell.d.ts +4 -0
- package/build/components/table/table-header-cell/table-header-cell.d.ts.map +1 -0
- package/build/components/table/table-header-cell/table-header-cell.js +13 -0
- package/build/components/table/table-row/index.d.ts +2 -0
- package/build/components/table/table-row/index.d.ts.map +1 -0
- package/build/components/table/table-row/index.js +1 -0
- package/build/components/table/table-row/table-row.d.ts +4 -0
- package/build/components/table/table-row/table-row.d.ts.map +1 -0
- package/build/components/table/table-row/table-row.js +11 -0
- package/build/components/table/table.context.d.ts +16 -0
- package/build/components/table/table.context.d.ts.map +1 -0
- package/build/components/table/table.context.js +2 -0
- package/build/components/table/table.d.ts +4 -0
- package/build/components/table/table.d.ts.map +1 -0
- package/build/components/table/table.js +46 -0
- package/build/components/table/table.styles.d.ts +16 -0
- package/build/components/table/table.styles.d.ts.map +1 -0
- package/build/components/table/table.styles.js +39 -0
- package/build/components/table/table.test.d.ts +2 -0
- package/build/components/table/table.test.d.ts.map +1 -0
- package/build/components/table/table.test.js +59 -0
- package/build/components/table/table.types.d.ts +113 -0
- package/build/components/table/table.types.d.ts.map +1 -0
- package/build/components/table/table.types.js +1 -0
- package/build/style.css +1 -1
- package/package.json +2 -2
- package/src/components/breadcrumbs/breadcrumbs.styles.ts +55 -0
- package/src/components/breadcrumbs/breadcrumbs.test.tsx +136 -0
- package/src/components/breadcrumbs/breadcrumbs.tsx +199 -0
- package/src/components/breadcrumbs/breadcrumbs.types.ts +78 -0
- package/src/components/breadcrumbs/breadcrumbs.utils.ts +70 -0
- package/src/components/breadcrumbs/index.ts +6 -0
- package/src/components/drawer/drawer-close/drawer-close.tsx +43 -0
- package/src/components/drawer/drawer-close/index.ts +1 -0
- package/src/components/drawer/drawer-content/drawer-content.tsx +98 -0
- package/src/components/drawer/drawer-content/index.ts +1 -0
- package/src/components/drawer/drawer-header/drawer-header.tsx +40 -0
- package/src/components/drawer/drawer-header/index.ts +1 -0
- package/src/components/drawer/drawer-overlay/drawer-overlay.tsx +86 -0
- package/src/components/drawer/drawer-overlay/index.ts +1 -0
- package/src/components/drawer/drawer-root/drawer-root.tsx +94 -0
- package/src/components/drawer/drawer-root/index.ts +1 -0
- package/src/components/drawer/drawer.context.ts +25 -0
- package/src/components/drawer/drawer.styles.ts +32 -0
- package/src/components/drawer/drawer.test.tsx +166 -0
- package/src/components/drawer/drawer.tsx +30 -0
- package/src/components/drawer/drawer.types.ts +158 -0
- package/src/components/drawer/index.ts +16 -0
- package/src/components/drawer/use-drawer.ts +101 -0
- package/src/components/index.ts +10 -6
- package/src/components/modal/modal-overlay/modal-overlay.tsx +43 -21
- package/src/components/modal/modal.test.tsx +47 -11
- package/src/components/modal/modal.types.ts +6 -0
- package/src/components/segmented-control/index.ts +6 -0
- package/src/components/segmented-control/segmented-control.styles.ts +37 -0
- package/src/components/segmented-control/segmented-control.test.tsx +152 -0
- package/src/components/segmented-control/segmented-control.tsx +245 -0
- package/src/components/segmented-control/segmented-control.types.ts +75 -0
- package/src/components/select/select-item/select-item.tsx +1 -1
- package/src/components/table/index.ts +24 -0
- package/src/components/table/table-body/index.ts +1 -0
- package/src/components/table/table-body/table-body.tsx +37 -0
- package/src/components/table/table-caption/index.ts +1 -0
- package/src/components/table/table-caption/table-caption.tsx +32 -0
- package/src/components/table/table-cell/index.ts +1 -0
- package/src/components/table/table-cell/table-cell.tsx +33 -0
- package/src/components/table/table-head/index.ts +1 -0
- package/src/components/table/table-head/table-head.tsx +29 -0
- package/src/components/table/table-header-cell/index.ts +1 -0
- package/src/components/table/table-header-cell/table-header-cell.tsx +33 -0
- package/src/components/table/table-row/index.ts +1 -0
- package/src/components/table/table-row/table-row.tsx +30 -0
- package/src/components/table/table.context.ts +18 -0
- package/src/components/table/table.styles.ts +62 -0
- package/src/components/table/table.test.tsx +145 -0
- package/src/components/table/table.tsx +91 -0
- package/src/components/table/table.types.ts +145 -0
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { RefraktorRadius, RefraktorSize } from "../../theme";
|
|
2
|
+
import { TransitionProps } from "../transition";
|
|
3
|
+
import { DrawerClassNames, DrawerPosition } from "./drawer.types";
|
|
4
|
+
import { UseDrawerReturn } from "./use-drawer";
|
|
5
|
+
export interface DrawerContextValue {
|
|
6
|
+
drawer: UseDrawerReturn;
|
|
7
|
+
closeOnClickOutside: boolean;
|
|
8
|
+
lockScroll: boolean;
|
|
9
|
+
withinPortal: boolean;
|
|
10
|
+
radius: RefraktorRadius;
|
|
11
|
+
position: DrawerPosition;
|
|
12
|
+
size: RefraktorSize;
|
|
13
|
+
transitionProps?: Omit<TransitionProps, "children" | "mounted">;
|
|
14
|
+
headerId: string;
|
|
15
|
+
contentRef: React.MutableRefObject<HTMLDivElement | null>;
|
|
16
|
+
classNames?: DrawerClassNames;
|
|
17
|
+
getStyles: (part: keyof DrawerClassNames) => string | undefined;
|
|
18
|
+
}
|
|
19
|
+
export declare const DrawerProvider: ({ children, value }: {
|
|
20
|
+
children: React.ReactNode;
|
|
21
|
+
value: DrawerContextValue;
|
|
22
|
+
}) => import("react/jsx-runtime").JSX.Element, useDrawerContext: () => DrawerContextValue;
|
|
23
|
+
//# sourceMappingURL=drawer.context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drawer.context.d.ts","sourceRoot":"","sources":["../../../src/components/drawer/drawer.context.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,MAAM,WAAW,kBAAkB;IAC/B,MAAM,EAAE,eAAe,CAAC;IACxB,mBAAmB,EAAE,OAAO,CAAC;IAC7B,UAAU,EAAE,OAAO,CAAC;IACpB,YAAY,EAAE,OAAO,CAAC;IACtB,MAAM,EAAE,eAAe,CAAC;IACxB,QAAQ,EAAE,cAAc,CAAC;IACzB,IAAI,EAAE,aAAa,CAAC;IACpB,eAAe,CAAC,EAAE,IAAI,CAAC,eAAe,EAAE,UAAU,GAAG,SAAS,CAAC,CAAC;IAChE,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,KAAK,CAAC,gBAAgB,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAC1D,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAC9B,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,gBAAgB,KAAK,MAAM,GAAG,SAAS,CAAC;CACnE;AAED,eAAO,MAAO,cAAc;;;+CAAE,gBAAgB,0BAGzC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drawer.d.ts","sourceRoot":"","sources":["../../../src/components/drawer/drawer.tsx"],"names":[],"mappings":"AAUA,OAAO,EAEH,oBAAoB,EAEvB,MAAM,gBAAgB,CAAC;AAExB,QAAA,MAAM,MAAM,0DAEV,CAAC;AAWH,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createClassNamesConfig, createComponentConfig, factory } from "../../utils";
|
|
3
|
+
import { DrawerClose } from "./drawer-close";
|
|
4
|
+
import { DrawerContent } from "./drawer-content";
|
|
5
|
+
import { DrawerHeader } from "./drawer-header";
|
|
6
|
+
import { DrawerOverlay } from "./drawer-overlay";
|
|
7
|
+
import { DrawerRoot } from "./drawer-root";
|
|
8
|
+
const Drawer = factory((props, ref) => {
|
|
9
|
+
return _jsx(DrawerRoot, { ...props, ref: ref });
|
|
10
|
+
});
|
|
11
|
+
Drawer.displayName = "@refraktor/core/Drawer";
|
|
12
|
+
Drawer.configure = createComponentConfig();
|
|
13
|
+
Drawer.classNames = createClassNamesConfig();
|
|
14
|
+
Drawer.Root = DrawerRoot;
|
|
15
|
+
Drawer.Overlay = DrawerOverlay;
|
|
16
|
+
Drawer.Content = DrawerContent;
|
|
17
|
+
Drawer.Header = DrawerHeader;
|
|
18
|
+
Drawer.Close = DrawerClose;
|
|
19
|
+
export default Drawer;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { CSSProperties } from "react";
|
|
2
|
+
import { RefraktorSize } from "../../theme";
|
|
3
|
+
import { DrawerPosition } from "./drawer.types";
|
|
4
|
+
export declare const getSize: (size?: RefraktorSize) => string;
|
|
5
|
+
export declare function getSizeStyles(position: DrawerPosition, size?: RefraktorSize): CSSProperties;
|
|
6
|
+
//# sourceMappingURL=drawer.styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drawer.styles.d.ts","sourceRoot":"","sources":["../../../src/components/drawer/drawer.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAUhD,eAAO,MAAM,OAAO,GAAI,OAAM,aAAoB,WAAgB,CAAC;AAEnE,wBAAgB,aAAa,CACzB,QAAQ,EAAE,cAAc,EACxB,IAAI,GAAE,aAAoB,GAC3B,aAAa,CAcf"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const sizes = {
|
|
2
|
+
xs: "16rem",
|
|
3
|
+
sm: "20rem",
|
|
4
|
+
md: "24rem",
|
|
5
|
+
lg: "30rem",
|
|
6
|
+
xl: "36rem"
|
|
7
|
+
};
|
|
8
|
+
export const getSize = (size = "md") => sizes[size];
|
|
9
|
+
export function getSizeStyles(position, size = "md") {
|
|
10
|
+
const resolvedSize = getSize(size);
|
|
11
|
+
if (position === "left" || position === "right") {
|
|
12
|
+
return {
|
|
13
|
+
width: resolvedSize,
|
|
14
|
+
maxWidth: "100vw"
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
return {
|
|
18
|
+
height: resolvedSize,
|
|
19
|
+
maxHeight: "100vh"
|
|
20
|
+
};
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drawer.test.d.ts","sourceRoot":"","sources":["../../../src/components/drawer/drawer.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { describe, expect, it, vi } from "vitest";
|
|
3
|
+
import { render, screen, userEvent, waitFor } from "../../vitest";
|
|
4
|
+
import Drawer from "./drawer";
|
|
5
|
+
import { DrawerContent } from "./drawer-content";
|
|
6
|
+
import { DrawerOverlay } from "./drawer-overlay";
|
|
7
|
+
import { DrawerRoot } from "./drawer-root";
|
|
8
|
+
describe("@refraktor/core/Drawer", () => {
|
|
9
|
+
const transitionProps = {
|
|
10
|
+
duration: 0,
|
|
11
|
+
immediate: true
|
|
12
|
+
};
|
|
13
|
+
it("renders with compound subcomponents and closes with header close button", async () => {
|
|
14
|
+
const user = userEvent.setup();
|
|
15
|
+
await render(_jsxs(Drawer, { defaultOpened: true, transitionProps: transitionProps, children: [_jsx(Drawer.Overlay, {}), _jsxs(Drawer.Content, { children: [_jsx(Drawer.Header, { text: "Edit profile" }), _jsx("p", { children: "Drawer body" })] })] }));
|
|
16
|
+
expect(await screen.findByRole("dialog", { name: "Edit profile" })).toBeInTheDocument();
|
|
17
|
+
await user.click(screen.getByRole("button", { name: "Close" }));
|
|
18
|
+
await waitFor(() => {
|
|
19
|
+
expect(screen.queryByRole("dialog")).not.toBeInTheDocument();
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
it("calls onOpenedChange when clicking overlay in controlled mode", async () => {
|
|
23
|
+
const user = userEvent.setup();
|
|
24
|
+
const onOpenedChange = vi.fn();
|
|
25
|
+
await render(_jsxs(Drawer, { opened: true, onOpenedChange: onOpenedChange, transitionProps: transitionProps, children: [_jsx(Drawer.Overlay, { "data-testid": "overlay" }), _jsx(Drawer.Content, { children: "Controlled drawer" })] }));
|
|
26
|
+
await user.click(await screen.findByTestId("overlay"));
|
|
27
|
+
expect(onOpenedChange).toHaveBeenCalledWith(false);
|
|
28
|
+
});
|
|
29
|
+
it("closes on Escape key", async () => {
|
|
30
|
+
const user = userEvent.setup();
|
|
31
|
+
await render(_jsx(Drawer, { defaultOpened: true, transitionProps: transitionProps, children: _jsx(Drawer.Content, { children: "Keyboard close" }) }));
|
|
32
|
+
await screen.findByRole("dialog");
|
|
33
|
+
await user.keyboard("{Escape}");
|
|
34
|
+
await waitFor(() => {
|
|
35
|
+
expect(screen.queryByRole("dialog")).not.toBeInTheDocument();
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
it("supports standalone subcomponents with DrawerRoot", async () => {
|
|
39
|
+
await render(_jsxs(DrawerRoot, { defaultOpened: true, transitionProps: transitionProps, children: [_jsx(DrawerOverlay, {}), _jsx(DrawerContent, { children: "Standalone composition" })] }));
|
|
40
|
+
expect(await screen.findByRole("dialog")).toBeInTheDocument();
|
|
41
|
+
});
|
|
42
|
+
it("applies custom overlay background opacity and blur", async () => {
|
|
43
|
+
await render(_jsxs(Drawer, { defaultOpened: true, transitionProps: transitionProps, children: [_jsx(Drawer.Overlay, { "data-testid": "overlay", backgroundOpacity: 0.4, blur: 6 }), _jsx(Drawer.Content, { children: "Styled overlay" })] }));
|
|
44
|
+
const overlay = await screen.findByTestId("overlay");
|
|
45
|
+
expect(overlay).toHaveStyle({
|
|
46
|
+
backgroundColor: "rgba(0, 0, 0, 0.4)",
|
|
47
|
+
backdropFilter: "blur(6px)"
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
it("locks and unlocks body scroll when enabled", async () => {
|
|
51
|
+
const user = userEvent.setup();
|
|
52
|
+
await render(_jsx(Drawer, { defaultOpened: true, lockScroll: true, transitionProps: transitionProps, children: _jsxs(Drawer.Content, { children: ["Scroll locked", _jsx(Drawer.Close, {})] }) }));
|
|
53
|
+
await waitFor(() => {
|
|
54
|
+
expect(document.body).toHaveAttribute("data-scroll-locked");
|
|
55
|
+
});
|
|
56
|
+
await user.click(screen.getByRole("button", { name: "Close" }));
|
|
57
|
+
await waitFor(() => {
|
|
58
|
+
expect(document.body).not.toHaveAttribute("data-scroll-locked");
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
it("supports different positions and predefined sizes", async () => {
|
|
62
|
+
await render(_jsxs(_Fragment, { children: [_jsx(Drawer, { defaultOpened: true, position: "left", size: "sm", transitionProps: transitionProps, children: _jsx(Drawer.Content, { "data-testid": "left-content", children: "Left" }) }), _jsx(Drawer, { defaultOpened: true, position: "bottom", size: "xl", transitionProps: transitionProps, children: _jsx(Drawer.Content, { "data-testid": "bottom-content", children: "Bottom" }) })] }));
|
|
63
|
+
const leftContent = await screen.findByTestId("left-content");
|
|
64
|
+
const bottomContent = await screen.findByTestId("bottom-content");
|
|
65
|
+
expect(leftContent).toHaveAttribute("data-position", "left");
|
|
66
|
+
expect(leftContent).toHaveStyle({ width: "20rem" });
|
|
67
|
+
expect(bottomContent).toHaveAttribute("data-position", "bottom");
|
|
68
|
+
expect(bottomContent).toHaveStyle({ height: "36rem" });
|
|
69
|
+
});
|
|
70
|
+
});
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { ComponentPropsWithoutRef, MouseEvent, ReactNode } from "react";
|
|
2
|
+
import { createClassNamesConfig, createComponentConfig, FactoryPayload } from "../../utils";
|
|
3
|
+
import { RefraktorRadius, RefraktorSize } from "../../theme";
|
|
4
|
+
import { TransitionProps } from "../transition";
|
|
5
|
+
import { DrawerRoot } from "./drawer-root";
|
|
6
|
+
import { DrawerOverlay } from "./drawer-overlay";
|
|
7
|
+
import { DrawerContent } from "./drawer-content";
|
|
8
|
+
import { DrawerHeader } from "./drawer-header";
|
|
9
|
+
import { DrawerClose } from "./drawer-close";
|
|
10
|
+
export type DrawerPosition = "left" | "right" | "top" | "bottom";
|
|
11
|
+
export type DrawerClassNames = {
|
|
12
|
+
root?: string;
|
|
13
|
+
overlay?: string;
|
|
14
|
+
content?: string;
|
|
15
|
+
header?: string;
|
|
16
|
+
close?: string;
|
|
17
|
+
};
|
|
18
|
+
export interface DrawerProps extends ComponentPropsWithoutRef<"div"> {
|
|
19
|
+
/** Children containing drawer subcomponents */
|
|
20
|
+
children: ReactNode;
|
|
21
|
+
/** State of the drawer (controlled) */
|
|
22
|
+
opened?: boolean;
|
|
23
|
+
/** Initial state of the drawer (uncontrolled) */
|
|
24
|
+
defaultOpened?: boolean;
|
|
25
|
+
/** Callback called when drawer state changes */
|
|
26
|
+
onOpenedChange?: (opened: boolean) => void;
|
|
27
|
+
/** Whether to close drawer on overlay/outside click @default `true` */
|
|
28
|
+
closeOnClickOutside?: boolean;
|
|
29
|
+
/** Whether to close drawer on Escape key @default `true` */
|
|
30
|
+
closeOnEscape?: boolean;
|
|
31
|
+
/** Whether to lock body scroll while opened @default `true` */
|
|
32
|
+
lockScroll?: boolean;
|
|
33
|
+
/** Whether to render overlay/content inside portal @default `true` */
|
|
34
|
+
withinPortal?: boolean;
|
|
35
|
+
/** Radius for drawer content @default `none` */
|
|
36
|
+
radius?: RefraktorRadius;
|
|
37
|
+
/** Side where drawer appears @default `right` */
|
|
38
|
+
position?: DrawerPosition;
|
|
39
|
+
/** Drawer size scale (width for left/right, height for top/bottom) @default `md` */
|
|
40
|
+
size?: RefraktorSize;
|
|
41
|
+
/** Transition props for overlay/content, uses Transition internally */
|
|
42
|
+
transitionProps?: Omit<TransitionProps, "children" | "mounted">;
|
|
43
|
+
/** Used for editing root class name */
|
|
44
|
+
className?: string;
|
|
45
|
+
/** Used for styling different parts of the component */
|
|
46
|
+
classNames?: DrawerClassNames;
|
|
47
|
+
}
|
|
48
|
+
export type DrawerRootProps = DrawerProps;
|
|
49
|
+
export interface DrawerOverlayProps extends ComponentPropsWithoutRef<"div"> {
|
|
50
|
+
/** Whether clicking the overlay closes drawer @default `true` */
|
|
51
|
+
closeOnClick?: boolean;
|
|
52
|
+
/** Overlay background opacity @default `0.5` */
|
|
53
|
+
backgroundOpacity?: number;
|
|
54
|
+
/** Backdrop blur amount in px (or any CSS length) @default `0` */
|
|
55
|
+
blur?: number | string;
|
|
56
|
+
/** Used for editing root class name */
|
|
57
|
+
className?: string;
|
|
58
|
+
}
|
|
59
|
+
export interface DrawerContentProps extends ComponentPropsWithoutRef<"div"> {
|
|
60
|
+
/** Drawer body content */
|
|
61
|
+
children: ReactNode;
|
|
62
|
+
/** Used for editing root class name */
|
|
63
|
+
className?: string;
|
|
64
|
+
}
|
|
65
|
+
export interface DrawerHeaderProps extends ComponentPropsWithoutRef<"div"> {
|
|
66
|
+
/** Header content */
|
|
67
|
+
children?: ReactNode;
|
|
68
|
+
/** Shorthand header text */
|
|
69
|
+
text?: ReactNode;
|
|
70
|
+
/** Whether to show close button inside header @default `true` */
|
|
71
|
+
withClose?: boolean;
|
|
72
|
+
/** Used for editing root class name */
|
|
73
|
+
className?: string;
|
|
74
|
+
}
|
|
75
|
+
export interface DrawerCloseProps extends Omit<ComponentPropsWithoutRef<"button">, "onClick"> {
|
|
76
|
+
/** Optional close content (defaults to `x`) */
|
|
77
|
+
children?: ReactNode;
|
|
78
|
+
/** Click callback fired before closing */
|
|
79
|
+
onClick?: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
80
|
+
/** Used for editing root class name */
|
|
81
|
+
className?: string;
|
|
82
|
+
}
|
|
83
|
+
export interface DrawerFactoryPayload extends FactoryPayload {
|
|
84
|
+
props: DrawerProps;
|
|
85
|
+
ref: HTMLDivElement;
|
|
86
|
+
compound: {
|
|
87
|
+
configure: ReturnType<typeof createComponentConfig<DrawerProps>>;
|
|
88
|
+
classNames: ReturnType<typeof createClassNamesConfig<DrawerClassNames>>;
|
|
89
|
+
Root: typeof DrawerRoot;
|
|
90
|
+
Overlay: typeof DrawerOverlay;
|
|
91
|
+
Content: typeof DrawerContent;
|
|
92
|
+
Header: typeof DrawerHeader;
|
|
93
|
+
Close: typeof DrawerClose;
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
export interface DrawerRootFactoryPayload extends FactoryPayload {
|
|
97
|
+
props: DrawerRootProps;
|
|
98
|
+
ref: HTMLDivElement;
|
|
99
|
+
}
|
|
100
|
+
export interface DrawerOverlayFactoryPayload extends FactoryPayload {
|
|
101
|
+
props: DrawerOverlayProps;
|
|
102
|
+
ref: HTMLDivElement;
|
|
103
|
+
}
|
|
104
|
+
export interface DrawerContentFactoryPayload extends FactoryPayload {
|
|
105
|
+
props: DrawerContentProps;
|
|
106
|
+
ref: HTMLDivElement;
|
|
107
|
+
}
|
|
108
|
+
export interface DrawerHeaderFactoryPayload extends FactoryPayload {
|
|
109
|
+
props: DrawerHeaderProps;
|
|
110
|
+
ref: HTMLDivElement;
|
|
111
|
+
}
|
|
112
|
+
export interface DrawerCloseFactoryPayload extends FactoryPayload {
|
|
113
|
+
props: DrawerCloseProps;
|
|
114
|
+
ref: HTMLButtonElement;
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=drawer.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drawer.types.d.ts","sourceRoot":"","sources":["../../../src/components/drawer/drawer.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACxE,OAAO,EACH,sBAAsB,EACtB,qBAAqB,EACrB,cAAc,EACjB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,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ACjE,UAAU,EAAE,UAAU,CAAC,OAAO,sBAAsB,CAAC,gBAAgB,CAAC,CAAC,CAAC;QACxE,IAAI,EAAE,OAAO,UAAU,CAAC;QACxB,OAAO,EAAE,OAAO,aAAa,CAAC;QAC9B,OAAO,EAAE,OAAO,aAAa,CAAC;QAC9B,MAAM,EAAE,OAAO,YAAY,CAAC;QAC5B,KAAK,EAAE,OAAO,WAAW,CAAC;KAC7B,CAAC;CACL;AAED,MAAM,WAAW,wBAAyB,SAAQ,cAAc;IAC5D,KAAK,EAAE,eAAe,CAAC;IACvB,GAAG,EAAE,cAAc,CAAC;CACvB;AAED,MAAM,WAAW,2BAA4B,SAAQ,cAAc;IAC/D,KAAK,EAAE,kBAAkB,CAAC;IAC1B,GAAG,EAAE,cAAc,CAAC;CACvB;AAED,MAAM,WAAW,2BAA4B,SAAQ,cAAc;IAC/D,KAAK,EAAE,kBAAkB,CAAC;IAC1B,GAAG,EAAE,cAAc,CAAC;CACvB;AAED,MAAM,WAAW,0BAA2B,SAAQ,cAAc;IAC9D,KAAK,EAAE,iBAAiB,CAAC;IACzB,GAAG,EAAE,cAAc,CAAC;CACvB;AAED,MAAM,WAAW,yBAA0B,SAAQ,cAAc;IAC7D,KAAK,EAAE,gBAAgB,CAAC;IACxB,GAAG,EAAE,iBAAiB,CAAC;CAC1B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { default as Drawer } from "./drawer";
|
|
2
|
+
export { DrawerRoot } from "./drawer-root";
|
|
3
|
+
export { DrawerOverlay } from "./drawer-overlay";
|
|
4
|
+
export { DrawerContent } from "./drawer-content";
|
|
5
|
+
export { DrawerHeader } from "./drawer-header";
|
|
6
|
+
export { DrawerClose } from "./drawer-close";
|
|
7
|
+
export type { DrawerProps, DrawerRootProps, DrawerOverlayProps, DrawerContentProps, DrawerHeaderProps, DrawerCloseProps, DrawerClassNames, DrawerPosition } from "./drawer.types";
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/drawer/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,YAAY,EACR,WAAW,EACX,eAAe,EACf,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACjB,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { default as Drawer } from "./drawer";
|
|
2
|
+
export { DrawerRoot } from "./drawer-root";
|
|
3
|
+
export { DrawerOverlay } from "./drawer-overlay";
|
|
4
|
+
export { DrawerContent } from "./drawer-content";
|
|
5
|
+
export { DrawerHeader } from "./drawer-header";
|
|
6
|
+
export { DrawerClose } from "./drawer-close";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
interface UseDrawerProps {
|
|
2
|
+
opened?: boolean;
|
|
3
|
+
defaultOpened?: boolean;
|
|
4
|
+
onOpenedChange?: (opened: boolean) => void;
|
|
5
|
+
closeOnClickOutside?: boolean;
|
|
6
|
+
closeOnEscape?: boolean;
|
|
7
|
+
contentRef: React.MutableRefObject<HTMLElement | null>;
|
|
8
|
+
}
|
|
9
|
+
export interface UseDrawerReturn {
|
|
10
|
+
opened: boolean;
|
|
11
|
+
open: () => void;
|
|
12
|
+
close: () => void;
|
|
13
|
+
toggle: () => void;
|
|
14
|
+
}
|
|
15
|
+
export declare function useDrawer(options: UseDrawerProps): UseDrawerReturn;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=use-drawer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-drawer.d.ts","sourceRoot":"","sources":["../../../src/components/drawer/use-drawer.ts"],"names":[],"mappings":"AAGA,UAAU,cAAc;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IAC3C,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,UAAU,EAAE,KAAK,CAAC,gBAAgB,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;CAC1D;AAED,MAAM,WAAW,eAAe;IAC5B,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,MAAM,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,wBAAgB,SAAS,CAAC,OAAO,EAAE,cAAc,GAAG,eAAe,CAiFlE"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { useUncontrolled } from "@refraktor/utils";
|
|
2
|
+
import { useCallback, useEffect } from "react";
|
|
3
|
+
export function useDrawer(options) {
|
|
4
|
+
const { opened, defaultOpened, onOpenedChange, closeOnClickOutside = true, closeOnEscape = true, contentRef } = options;
|
|
5
|
+
const [isOpen, setIsOpen] = useUncontrolled({
|
|
6
|
+
value: opened,
|
|
7
|
+
defaultValue: defaultOpened,
|
|
8
|
+
finalValue: false,
|
|
9
|
+
onChange: onOpenedChange
|
|
10
|
+
});
|
|
11
|
+
const open = useCallback(() => {
|
|
12
|
+
setIsOpen(true);
|
|
13
|
+
}, [setIsOpen]);
|
|
14
|
+
const close = useCallback(() => {
|
|
15
|
+
setIsOpen(false);
|
|
16
|
+
}, [setIsOpen]);
|
|
17
|
+
const toggle = useCallback(() => {
|
|
18
|
+
setIsOpen(!isOpen);
|
|
19
|
+
}, [isOpen, setIsOpen]);
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
if (!isOpen || !closeOnEscape) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const handleKeyDown = (event) => {
|
|
25
|
+
if (event.key === "Escape") {
|
|
26
|
+
setIsOpen(false);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
30
|
+
return () => {
|
|
31
|
+
document.removeEventListener("keydown", handleKeyDown);
|
|
32
|
+
};
|
|
33
|
+
}, [closeOnEscape, isOpen, setIsOpen]);
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
if (!isOpen || !closeOnClickOutside) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const handlePointerDown = (event) => {
|
|
39
|
+
const target = event.target;
|
|
40
|
+
if (!(target instanceof Node)) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
if (contentRef.current?.contains(target)) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
setIsOpen(false);
|
|
47
|
+
};
|
|
48
|
+
document.addEventListener("mousedown", handlePointerDown);
|
|
49
|
+
document.addEventListener("touchstart", handlePointerDown);
|
|
50
|
+
return () => {
|
|
51
|
+
document.removeEventListener("mousedown", handlePointerDown);
|
|
52
|
+
document.removeEventListener("touchstart", handlePointerDown);
|
|
53
|
+
};
|
|
54
|
+
}, [closeOnClickOutside, contentRef, isOpen, setIsOpen]);
|
|
55
|
+
return {
|
|
56
|
+
opened: isOpen,
|
|
57
|
+
open,
|
|
58
|
+
close,
|
|
59
|
+
toggle
|
|
60
|
+
};
|
|
61
|
+
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
export * from "./accordion";
|
|
2
2
|
export * from "./avatar";
|
|
3
3
|
export * from "./badge";
|
|
4
|
+
export * from "./breadcrumbs";
|
|
4
5
|
export * from "./button";
|
|
5
6
|
export * from "./checkbox";
|
|
6
7
|
export * from "./color-swatch";
|
|
8
|
+
export * from "./drawer";
|
|
7
9
|
export * from "./input";
|
|
8
10
|
export * from "./loader";
|
|
9
11
|
export * from "./modal";
|
|
@@ -16,8 +18,10 @@ export * from "./progress";
|
|
|
16
18
|
export * from "./progress-circle";
|
|
17
19
|
export * from "./radio";
|
|
18
20
|
export * from "./select";
|
|
21
|
+
export * from "./segmented-control";
|
|
19
22
|
export * from "./slider";
|
|
20
23
|
export * from "./switch";
|
|
24
|
+
export * from "./table";
|
|
21
25
|
export * from "./tabs";
|
|
22
26
|
export * from "./timeline";
|
|
23
27
|
export * from "./textarea";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,qBAAqB,CAAC;AACpC,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
export * from "./accordion";
|
|
2
2
|
export * from "./avatar";
|
|
3
3
|
export * from "./badge";
|
|
4
|
+
export * from "./breadcrumbs";
|
|
4
5
|
export * from "./button";
|
|
5
6
|
export * from "./checkbox";
|
|
6
7
|
export * from "./color-swatch";
|
|
8
|
+
export * from "./drawer";
|
|
7
9
|
export * from "./input";
|
|
8
10
|
export * from "./loader";
|
|
9
11
|
export * from "./modal";
|
|
@@ -16,8 +18,10 @@ export * from "./progress";
|
|
|
16
18
|
export * from "./progress-circle";
|
|
17
19
|
export * from "./radio";
|
|
18
20
|
export * from "./select";
|
|
21
|
+
export * from "./segmented-control";
|
|
19
22
|
export * from "./slider";
|
|
20
23
|
export * from "./switch";
|
|
24
|
+
export * from "./table";
|
|
21
25
|
export * from "./tabs";
|
|
22
26
|
export * from "./timeline";
|
|
23
27
|
export * from "./textarea";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modal-overlay.d.ts","sourceRoot":"","sources":["../../../../src/components/modal/modal-overlay/modal-overlay.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,0BAA0B,EAAE,MAAM,gBAAgB,CAAC;AAE5D,QAAA,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"modal-overlay.d.ts","sourceRoot":"","sources":["../../../../src/components/modal/modal-overlay/modal-overlay.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,0BAA0B,EAAE,MAAM,gBAAgB,CAAC;AAE5D,QAAA,MAAM,YAAY,mEA0EjB,CAAC;AAIF,eAAe,YAAY,CAAC"}
|
|
@@ -4,9 +4,13 @@ import { factory } from "../../../utils";
|
|
|
4
4
|
import { Portal } from "../../portal";
|
|
5
5
|
import { Transition } from "../../transition";
|
|
6
6
|
import { useModalContext } from "../modal.context";
|
|
7
|
-
const ModalOverlay = factory(({ closeOnClick = true, className, onMouseDown, ...props }, ref) => {
|
|
7
|
+
const ModalOverlay = factory(({ closeOnClick = true, backgroundOpacity = 0.5, blur = 0, className, onMouseDown, style, ...props }, ref) => {
|
|
8
8
|
const { cx } = useTheme();
|
|
9
9
|
const { modal, closeOnClickOutside, withinPortal, transitionProps, getStyles } = useModalContext();
|
|
10
|
+
const blurValue = typeof blur === "number" ? `${blur}px` : blur;
|
|
11
|
+
const backdropFilterValue = blurValue !== "0" && blurValue !== "0px"
|
|
12
|
+
? `blur(${blurValue})`
|
|
13
|
+
: undefined;
|
|
10
14
|
const handleMouseDown = (event) => {
|
|
11
15
|
onMouseDown?.(event);
|
|
12
16
|
if (event.defaultPrevented ||
|
|
@@ -16,7 +20,11 @@ const ModalOverlay = factory(({ closeOnClick = true, className, onMouseDown, ...
|
|
|
16
20
|
}
|
|
17
21
|
modal.close();
|
|
18
22
|
};
|
|
19
|
-
const overlayContent = (_jsx(Transition, { transition: "fade", duration: 150, mounted: modal.opened, ...transitionProps, children: _jsx("div", { ref: ref, "aria-hidden": "true", className: cx("fixed inset-0 z-40
|
|
23
|
+
const overlayContent = (_jsx(Transition, { transition: "fade", duration: 150, mounted: modal.opened, ...transitionProps, children: _jsx("div", { ref: ref, "aria-hidden": "true", className: cx("fixed inset-0 z-40", getStyles("overlay"), className), style: {
|
|
24
|
+
backgroundColor: `rgba(0, 0, 0, ${backgroundOpacity})`,
|
|
25
|
+
backdropFilter: backdropFilterValue,
|
|
26
|
+
...style
|
|
27
|
+
}, onMouseDown: handleMouseDown, ...props }) }));
|
|
20
28
|
return withinPortal ? (_jsx(Portal, { children: overlayContent })) : (overlayContent);
|
|
21
29
|
});
|
|
22
30
|
ModalOverlay.displayName = "@refraktor/core/Modal.Overlay";
|
|
@@ -39,6 +39,22 @@ describe("@refraktor/core/Modal", () => {
|
|
|
39
39
|
await render(_jsxs(ModalRoot, { defaultOpened: true, transitionProps: transitionProps, children: [_jsx(ModalOverlay, {}), _jsx(ModalContent, { children: "Standalone composition" })] }));
|
|
40
40
|
expect(await screen.findByRole("dialog")).toBeInTheDocument();
|
|
41
41
|
});
|
|
42
|
+
it("applies custom overlay background opacity and blur", async () => {
|
|
43
|
+
await render(_jsxs(Modal, { defaultOpened: true, transitionProps: transitionProps, children: [_jsx(Modal.Overlay, { "data-testid": "overlay", backgroundOpacity: 0.4, blur: 6 }), _jsx(Modal.Content, { children: "Styled overlay" })] }));
|
|
44
|
+
const overlay = await screen.findByTestId("overlay");
|
|
45
|
+
expect(overlay).toHaveStyle({
|
|
46
|
+
backgroundColor: "rgba(0, 0, 0, 0.4)",
|
|
47
|
+
backdropFilter: "blur(6px)"
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
it("does not set backdrop blur for zero blur", async () => {
|
|
51
|
+
await render(_jsxs(Modal, { defaultOpened: true, transitionProps: transitionProps, children: [_jsx(Modal.Overlay, { "data-testid": "overlay", blur: 0 }), _jsx(Modal.Content, { children: "No blur" })] }));
|
|
52
|
+
const overlay = await screen.findByTestId("overlay");
|
|
53
|
+
expect(overlay).toHaveStyle({
|
|
54
|
+
backgroundColor: "rgba(0, 0, 0, 0.5)"
|
|
55
|
+
});
|
|
56
|
+
expect(overlay.style.backdropFilter).toBe("");
|
|
57
|
+
});
|
|
42
58
|
it("locks and unlocks body scroll when enabled", async () => {
|
|
43
59
|
const user = userEvent.setup();
|
|
44
60
|
await render(_jsx(Modal, { defaultOpened: true, lockScroll: true, transitionProps: transitionProps, children: _jsxs(Modal.Content, { children: ["Scroll locked", _jsx(Modal.Close, {})] }) }));
|
|
@@ -44,6 +44,10 @@ export type ModalRootProps = ModalProps;
|
|
|
44
44
|
export interface ModalOverlayProps extends ComponentPropsWithoutRef<"div"> {
|
|
45
45
|
/** Whether clicking the overlay closes modal @default `true` */
|
|
46
46
|
closeOnClick?: boolean;
|
|
47
|
+
/** Overlay background opacity @default `0.5` */
|
|
48
|
+
backgroundOpacity?: number;
|
|
49
|
+
/** Backdrop blur amount in px (or any CSS length) @default `0` */
|
|
50
|
+
blur?: number | string;
|
|
47
51
|
/** Used for editing root class name */
|
|
48
52
|
className?: string;
|
|
49
53
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modal.types.d.ts","sourceRoot":"","sources":["../../../src/components/modal/modal.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACxE,OAAO,EACH,sBAAsB,EACtB,qBAAqB,EACrB,cAAc,EACjB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CA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UAAU,CAAC;KAC5B,CAAC;CACL;AAED,MAAM,WAAW,uBAAwB,SAAQ,cAAc;IAC3D,KAAK,EAAE,cAAc,CAAC;IACtB,GAAG,EAAE,cAAc,CAAC;CACvB;AAED,MAAM,WAAW,0BAA2B,SAAQ,cAAc;IAC9D,KAAK,EAAE,iBAAiB,CAAC;IACzB,GAAG,EAAE,cAAc,CAAC;CACvB;AAED,MAAM,WAAW,0BAA2B,SAAQ,cAAc;IAC9D,KAAK,EAAE,iBAAiB,CAAC;IACzB,GAAG,EAAE,cAAc,CAAC;CACvB;AAED,MAAM,WAAW,yBAA0B,SAAQ,cAAc;IAC7D,KAAK,EAAE,gBAAgB,CAAC;IACxB,GAAG,EAAE,cAAc,CAAC;CACvB;AAED,MAAM,WAAW,wBAAyB,SAAQ,cAAc;IAC5D,KAAK,EAAE,eAAe,CAAC;IACvB,GAAG,EAAE,iBAAiB,CAAC;CAC1B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/segmented-control/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAClE,YAAY,EACR,qBAAqB,EACrB,0BAA0B,EAC1B,oBAAoB,EACvB,MAAM,2BAA2B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as SegmentedControl } from "./segmented-control";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"segmented-control.d.ts","sourceRoot":"","sources":["../../../src/components/segmented-control/segmented-control.tsx"],"names":[],"mappings":"AAWA,OAAO,EAEH,8BAA8B,EAEjC,MAAM,2BAA2B,CAAC;AASnC,QAAA,MAAM,gBAAgB,oEAqNrB,CAAC;AAOF,eAAe,gBAAgB,CAAC"}
|