@puzzle-ui/ui 0.4.0 → 0.5.1
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/README.md +61 -77
- package/dist/components/actions/button/button.css +5 -2
- package/dist/components/actions/button-group/button-group.css +16 -17
- package/dist/components/data-display/badge/badge.css +15 -2
- package/dist/components/data-display/badge/index.cjs +13 -2
- package/dist/components/data-display/badge/index.cjs.map +1 -1
- package/dist/components/data-display/badge/index.d.cts +7 -2
- package/dist/components/data-display/badge/index.d.ts +7 -2
- package/dist/components/data-display/badge/index.js +13 -2
- package/dist/components/data-display/badge/index.js.map +1 -1
- package/dist/components/data-display/rating/index.cjs +84 -0
- package/dist/components/data-display/rating/index.cjs.map +1 -0
- package/dist/components/data-display/rating/index.d.cts +3 -0
- package/dist/components/data-display/rating/index.d.ts +3 -0
- package/dist/components/data-display/rating/index.js +84 -0
- package/dist/components/data-display/rating/index.js.map +1 -0
- package/dist/components/data-display/rating/rating.css +72 -0
- package/dist/components/data-display/rating/rating.types.d.cts +15 -0
- package/dist/components/data-display/rating/rating.types.d.ts +15 -0
- package/dist/components/data-display/rating/rating.utils.cjs +27 -0
- package/dist/components/data-display/rating/rating.utils.cjs.map +1 -0
- package/dist/components/data-display/rating/rating.utils.js +25 -0
- package/dist/components/data-display/rating/rating.utils.js.map +1 -0
- package/dist/components/forms/checkbox/checkbox.css +2 -10
- package/dist/components/forms/input-group/input-group.d.cts +4 -2
- package/dist/components/forms/input-group/input-group.d.ts +4 -2
- package/dist/components/forms/radio-group/index.d.cts +2 -1
- package/dist/components/forms/radio-group/index.d.ts +2 -1
- package/dist/components/forms/stepper/index.d.cts +4 -2
- package/dist/components/forms/stepper/index.d.ts +4 -2
- package/dist/components/forms/time-picker/index.cjs +108 -0
- package/dist/components/forms/time-picker/index.cjs.map +1 -0
- package/dist/components/forms/time-picker/index.d.cts +3 -0
- package/dist/components/forms/time-picker/index.d.ts +3 -0
- package/dist/components/forms/time-picker/index.js +108 -0
- package/dist/components/forms/time-picker/index.js.map +1 -0
- package/dist/components/forms/time-picker/time-picker.css +166 -0
- package/dist/components/forms/time-picker/time-picker.types.d.cts +34 -0
- package/dist/components/forms/time-picker/time-picker.types.d.ts +34 -0
- package/dist/components/forms/time-picker/time-picker.utils.cjs +25 -0
- package/dist/components/forms/time-picker/time-picker.utils.cjs.map +1 -0
- package/dist/components/forms/time-picker/time-picker.utils.js +24 -0
- package/dist/components/forms/time-picker/time-picker.utils.js.map +1 -0
- package/dist/components/forms/token-input/index.cjs +189 -0
- package/dist/components/forms/token-input/index.cjs.map +1 -0
- package/dist/components/forms/token-input/index.d.cts +3 -0
- package/dist/components/forms/token-input/index.d.ts +3 -0
- package/dist/components/forms/token-input/index.js +189 -0
- package/dist/components/forms/token-input/index.js.map +1 -0
- package/dist/components/forms/token-input/token-input.css +145 -0
- package/dist/components/forms/token-input/token-input.types.d.cts +48 -0
- package/dist/components/forms/token-input/token-input.types.d.ts +48 -0
- package/dist/components/forms/token-input/token-input.utils.cjs +30 -0
- package/dist/components/forms/token-input/token-input.utils.cjs.map +1 -0
- package/dist/components/forms/token-input/token-input.utils.js +24 -0
- package/dist/components/forms/token-input/token-input.utils.js.map +1 -0
- package/dist/components/layout/aspect-ratio/aspect-ratio.css +14 -0
- package/dist/components/layout/aspect-ratio/aspect-ratio.utils.cjs +11 -0
- package/dist/components/layout/aspect-ratio/aspect-ratio.utils.cjs.map +1 -0
- package/dist/components/layout/aspect-ratio/aspect-ratio.utils.js +11 -0
- package/dist/components/layout/aspect-ratio/aspect-ratio.utils.js.map +1 -0
- package/dist/components/layout/aspect-ratio/index.cjs +16 -0
- package/dist/components/layout/aspect-ratio/index.cjs.map +1 -0
- package/dist/components/layout/aspect-ratio/index.d.cts +11 -0
- package/dist/components/layout/aspect-ratio/index.d.ts +11 -0
- package/dist/components/layout/aspect-ratio/index.js +16 -0
- package/dist/components/layout/aspect-ratio/index.js.map +1 -0
- package/dist/components/layout/container/container.css +1 -0
- package/dist/components/layout/page-layout/page-layout.css +1 -0
- package/dist/components/layout/scroll-area/index.cjs +27 -0
- package/dist/components/layout/scroll-area/index.cjs.map +1 -0
- package/dist/components/layout/scroll-area/index.d.cts +15 -0
- package/dist/components/layout/scroll-area/index.d.ts +15 -0
- package/dist/components/layout/scroll-area/index.js +27 -0
- package/dist/components/layout/scroll-area/index.js.map +1 -0
- package/dist/components/layout/scroll-area/scroll-area.css +25 -0
- package/dist/components/layout/scroll-area/scroll-area.utils.cjs +8 -0
- package/dist/components/layout/scroll-area/scroll-area.utils.cjs.map +1 -0
- package/dist/components/layout/scroll-area/scroll-area.utils.d.cts +2 -0
- package/dist/components/layout/scroll-area/scroll-area.utils.d.ts +2 -0
- package/dist/components/layout/scroll-area/scroll-area.utils.js +8 -0
- package/dist/components/layout/scroll-area/scroll-area.utils.js.map +1 -0
- package/dist/components/layout/section/index.cjs +10 -4
- package/dist/components/layout/section/index.cjs.map +1 -1
- package/dist/components/layout/section/index.d.cts +1 -1
- package/dist/components/layout/section/index.d.ts +1 -1
- package/dist/components/layout/section/index.js +11 -5
- package/dist/components/layout/section/index.js.map +1 -1
- package/dist/components/layout/section/section.css +9 -3
- package/dist/components/layout/section/types.d.cts +5 -5
- package/dist/components/layout/section/types.d.ts +5 -5
- package/dist/components/layout/separator/index.cjs +18 -0
- package/dist/components/layout/separator/index.cjs.map +1 -0
- package/dist/components/layout/separator/index.d.cts +17 -0
- package/dist/components/layout/separator/index.d.ts +17 -0
- package/dist/components/layout/separator/index.js +18 -0
- package/dist/components/layout/separator/index.js.map +1 -0
- package/dist/components/layout/separator/separator.css +15 -0
- package/dist/components/layout/separator/separator.utils.cjs +11 -0
- package/dist/components/layout/separator/separator.utils.cjs.map +1 -0
- package/dist/components/layout/separator/separator.utils.d.cts +2 -0
- package/dist/components/layout/separator/separator.utils.d.ts +2 -0
- package/dist/components/layout/separator/separator.utils.js +11 -0
- package/dist/components/layout/separator/separator.utils.js.map +1 -0
- package/dist/components/layout/stack/index.cjs +18 -2
- package/dist/components/layout/stack/index.cjs.map +1 -1
- package/dist/components/layout/stack/index.d.cts +8 -6
- package/dist/components/layout/stack/index.d.ts +8 -6
- package/dist/components/layout/stack/index.js +18 -2
- package/dist/components/layout/stack/index.js.map +1 -1
- package/dist/components/layout/stack/stack.css +118 -138
- package/dist/components/navigation/carousel/index.cjs +4 -1
- package/dist/components/navigation/carousel/index.cjs.map +1 -1
- package/dist/components/navigation/carousel/index.js +4 -1
- package/dist/components/navigation/carousel/index.js.map +1 -1
- package/dist/components/navigation/tabs/index.d.cts +3 -2
- package/dist/components/navigation/tabs/index.d.ts +3 -2
- package/dist/components/navigation/tree-view/index.cjs +1 -1
- package/dist/components/navigation/tree-view/index.cjs.map +1 -1
- package/dist/components/navigation/tree-view/index.d.cts +5 -1
- package/dist/components/navigation/tree-view/index.d.ts +5 -1
- package/dist/components/navigation/tree-view/index.js +1 -1
- package/dist/components/navigation/tree-view/index.js.map +1 -1
- package/dist/components/navigation/tree-view/tree-view.css +5 -3
- package/dist/components/overlays/context-menu/context-menu.css +151 -0
- package/dist/components/overlays/context-menu/context-menu.types.d.cts +69 -0
- package/dist/components/overlays/context-menu/context-menu.types.d.ts +69 -0
- package/dist/components/overlays/context-menu/context-menu.utils.cjs +46 -0
- package/dist/components/overlays/context-menu/context-menu.utils.cjs.map +1 -0
- package/dist/components/overlays/context-menu/context-menu.utils.js +40 -0
- package/dist/components/overlays/context-menu/context-menu.utils.js.map +1 -0
- package/dist/components/overlays/context-menu/index.cjs +830 -0
- package/dist/components/overlays/context-menu/index.cjs.map +1 -0
- package/dist/components/overlays/context-menu/index.d.cts +42 -0
- package/dist/components/overlays/context-menu/index.d.ts +42 -0
- package/dist/components/overlays/context-menu/index.js +818 -0
- package/dist/components/overlays/context-menu/index.js.map +1 -0
- package/dist/components/typography/heading.cjs +6 -2
- package/dist/components/typography/heading.cjs.map +1 -1
- package/dist/components/typography/heading.d.cts +3 -2
- package/dist/components/typography/heading.d.ts +3 -2
- package/dist/components/typography/heading.js +6 -2
- package/dist/components/typography/heading.js.map +1 -1
- package/dist/components/typography/text.cjs +6 -2
- package/dist/components/typography/text.cjs.map +1 -1
- package/dist/components/typography/text.d.cts +3 -2
- package/dist/components/typography/text.d.ts +3 -2
- package/dist/components/typography/text.js +6 -2
- package/dist/components/typography/text.js.map +1 -1
- package/dist/components/utilities/preview/index.cjs +88 -20
- package/dist/components/utilities/preview/index.cjs.map +1 -1
- package/dist/components/utilities/preview/index.d.cts +6 -2
- package/dist/components/utilities/preview/index.d.ts +6 -2
- package/dist/components/utilities/preview/index.js +88 -20
- package/dist/components/utilities/preview/index.js.map +1 -1
- package/dist/components/utilities/preview/preview.css +26 -11
- package/dist/components/utilities/transition/index.d.cts +1 -1
- package/dist/components/utilities/transition/index.d.ts +1 -1
- package/dist/index.cjs +123 -97
- package/dist/index.d.cts +15 -2
- package/dist/index.d.ts +15 -2
- package/dist/index.js +8 -1
- package/package.json +11 -6
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/components/layout/aspect-ratio/index.tsx"],"sourcesContent":["import type {\n ComponentPropsWithRef,\n CSSProperties,\n ElementType,\n ReactNode,\n} from \"react\";\nimport { cn } from \"@puzzle-ui/core\";\nimport { getAspectRatioStyle } from \"./aspect-ratio.utils\";\nimport \"./aspect-ratio.css\";\n\ntype AspectRatioOwnProps<C extends ElementType> = {\n as?: C;\n ratio?: number;\n className?: string;\n style?: CSSProperties;\n children?: ReactNode;\n};\n\ntype AspectRatioProps<C extends ElementType = \"div\"> = AspectRatioOwnProps<C> &\n Omit<ComponentPropsWithRef<C>, keyof AspectRatioOwnProps<C> | \"as\">;\n\nconst AspectRatio = <C extends ElementType = \"div\">({\n as,\n ratio = 1,\n className,\n style,\n children,\n ...rest\n}: AspectRatioProps<C>) => {\n const Component = (as ?? \"div\") as ElementType;\n\n return (\n <Component\n className={cn(\"puzzle-aspect-ratio\", className)}\n style={getAspectRatioStyle(ratio, style)}\n {...rest}\n >\n {children}\n </Component>\n );\n};\n\nexport { AspectRatio, type AspectRatioProps };\n"],"mappings":";;;;;AAqBA,MAAM,eAA8C,EAClD,IACA,QAAQ,GACR,WACA,OACA,UACA,GAAG,WACsB;CAGzB,OACE,oBAHiB,MAAM,OAGvB;EACE,WAAW,GAAG,uBAAuB,SAAS;EAC9C,OAAO,oBAAoB,OAAO,KAAK;EACvC,GAAI;EAEH;CACQ,CAAA;AAEf"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const require_scroll_area_utils = require("./scroll-area.utils.cjs");
|
|
2
|
+
;/* empty css */
|
|
3
|
+
let _puzzle_ui_core = require("@puzzle-ui/core");
|
|
4
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
5
|
+
// src/components/layout/scroll-area/index.tsx
|
|
6
|
+
const ScrollArea = ({ orientation = "vertical", children, className, role, tabIndex, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ref, ...props }) => {
|
|
7
|
+
const overflow = require_scroll_area_utils.getScrollAreaOverflow(orientation);
|
|
8
|
+
const accessibleName = ariaLabel || ariaLabelledBy;
|
|
9
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
10
|
+
...props,
|
|
11
|
+
ref,
|
|
12
|
+
role: role ?? (accessibleName ? "region" : void 0),
|
|
13
|
+
tabIndex: tabIndex ?? 0,
|
|
14
|
+
className: (0, _puzzle_ui_core.cn)("puzzle-scroll-area", className),
|
|
15
|
+
"data-orientation": orientation,
|
|
16
|
+
style: {
|
|
17
|
+
...overflow,
|
|
18
|
+
...props.style
|
|
19
|
+
},
|
|
20
|
+
"aria-label": ariaLabel,
|
|
21
|
+
"aria-labelledby": ariaLabelledBy,
|
|
22
|
+
children
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
exports.ScrollArea = ScrollArea;
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["getScrollAreaOverflow","cn"],"sources":["../../../../src/components/layout/scroll-area/index.tsx"],"sourcesContent":["import { cn } from \"@puzzle-ui/core\";\nimport type { ComponentPropsWithRef, ReactNode } from \"react\";\nimport { getScrollAreaOverflow } from \"./scroll-area.utils\";\nimport type { ScrollAreaOrientation } from \"./scroll-area.utils\";\nimport \"./scroll-area.css\";\n\ntype ScrollAreaProps = Omit<ComponentPropsWithRef<\"div\">, \"children\"> & {\n /**\n * Content rendered inside the scrollable viewport.\n */\n children?: ReactNode;\n\n /**\n * The axis or axes that can scroll.\n * @default \"vertical\"\n */\n orientation?: ScrollAreaOrientation;\n};\n\nconst ScrollArea = ({\n orientation = \"vertical\",\n children,\n className,\n role,\n tabIndex,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n ref,\n ...props\n}: ScrollAreaProps) => {\n const overflow = getScrollAreaOverflow(orientation);\n const accessibleName = ariaLabel || ariaLabelledBy;\n\n return (\n <div\n {...props}\n ref={ref}\n role={role ?? (accessibleName ? \"region\" : undefined)}\n tabIndex={tabIndex ?? 0}\n className={cn(\"puzzle-scroll-area\", className)}\n data-orientation={orientation}\n style={{ ...overflow, ...props.style }}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n >\n {children}\n </div>\n );\n};\n\nexport { ScrollArea, type ScrollAreaProps, type ScrollAreaOrientation };\n"],"mappings":";;;;;AAmBA,MAAM,cAAc,EAClB,cAAc,YACd,UACA,WACA,MACA,UACA,cAAc,WACd,mBAAmB,gBACnB,KACA,GAAG,YACkB;CACrB,MAAM,WAAWA,0BAAAA,sBAAsB,WAAW;CAClD,MAAM,iBAAiB,aAAa;CAEpC,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;EACE,GAAI;EACC;EACL,MAAM,SAAS,iBAAiB,WAAW,KAAA;EAC3C,UAAU,YAAY;EACtB,YAAA,GAAWC,gBAAAA,GAAAA,CAAG,sBAAsB,SAAS;EAC7C,oBAAkB;EAClB,OAAO;GAAE,GAAG;GAAU,GAAG,MAAM;EAAM;EACrC,cAAY;EACZ,mBAAiB;EAEhB;CACE,CAAA;AAET"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ScrollAreaOrientation } from "./scroll-area.utils.cjs";
|
|
2
|
+
import { ComponentPropsWithRef, ReactNode } from "react";
|
|
3
|
+
type ScrollAreaProps = Omit<ComponentPropsWithRef<"div">, "children"> & {
|
|
4
|
+
/**
|
|
5
|
+
* Content rendered inside the scrollable viewport.
|
|
6
|
+
*/
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* The axis or axes that can scroll.
|
|
10
|
+
* @default "vertical"
|
|
11
|
+
*/
|
|
12
|
+
orientation?: ScrollAreaOrientation;
|
|
13
|
+
};
|
|
14
|
+
declare const ScrollArea: ({ orientation, children, className, role, tabIndex, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ref, ...props }: ScrollAreaProps) => import("react").JSX.Element;
|
|
15
|
+
export { ScrollArea, type ScrollAreaOrientation, type ScrollAreaProps };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ScrollAreaOrientation } from "./scroll-area.utils.js";
|
|
2
|
+
import { ComponentPropsWithRef, ReactNode } from "react";
|
|
3
|
+
type ScrollAreaProps = Omit<ComponentPropsWithRef<"div">, "children"> & {
|
|
4
|
+
/**
|
|
5
|
+
* Content rendered inside the scrollable viewport.
|
|
6
|
+
*/
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* The axis or axes that can scroll.
|
|
10
|
+
* @default "vertical"
|
|
11
|
+
*/
|
|
12
|
+
orientation?: ScrollAreaOrientation;
|
|
13
|
+
};
|
|
14
|
+
declare const ScrollArea: ({ orientation, children, className, role, tabIndex, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ref, ...props }: ScrollAreaProps) => import("react").JSX.Element;
|
|
15
|
+
export { ScrollArea, type ScrollAreaOrientation, type ScrollAreaProps };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { getScrollAreaOverflow } from "./scroll-area.utils.js";
|
|
2
|
+
import "./scroll-area.css";
|
|
3
|
+
import { cn } from "@puzzle-ui/core";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
// src/components/layout/scroll-area/index.tsx
|
|
6
|
+
const ScrollArea = ({ orientation = "vertical", children, className, role, tabIndex, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ref, ...props }) => {
|
|
7
|
+
const overflow = getScrollAreaOverflow(orientation);
|
|
8
|
+
const accessibleName = ariaLabel || ariaLabelledBy;
|
|
9
|
+
return /* @__PURE__ */ jsx("div", {
|
|
10
|
+
...props,
|
|
11
|
+
ref,
|
|
12
|
+
role: role ?? (accessibleName ? "region" : void 0),
|
|
13
|
+
tabIndex: tabIndex ?? 0,
|
|
14
|
+
className: cn("puzzle-scroll-area", className),
|
|
15
|
+
"data-orientation": orientation,
|
|
16
|
+
style: {
|
|
17
|
+
...overflow,
|
|
18
|
+
...props.style
|
|
19
|
+
},
|
|
20
|
+
"aria-label": ariaLabel,
|
|
21
|
+
"aria-labelledby": ariaLabelledBy,
|
|
22
|
+
children
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
export { ScrollArea };
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/components/layout/scroll-area/index.tsx"],"sourcesContent":["import { cn } from \"@puzzle-ui/core\";\nimport type { ComponentPropsWithRef, ReactNode } from \"react\";\nimport { getScrollAreaOverflow } from \"./scroll-area.utils\";\nimport type { ScrollAreaOrientation } from \"./scroll-area.utils\";\nimport \"./scroll-area.css\";\n\ntype ScrollAreaProps = Omit<ComponentPropsWithRef<\"div\">, \"children\"> & {\n /**\n * Content rendered inside the scrollable viewport.\n */\n children?: ReactNode;\n\n /**\n * The axis or axes that can scroll.\n * @default \"vertical\"\n */\n orientation?: ScrollAreaOrientation;\n};\n\nconst ScrollArea = ({\n orientation = \"vertical\",\n children,\n className,\n role,\n tabIndex,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n ref,\n ...props\n}: ScrollAreaProps) => {\n const overflow = getScrollAreaOverflow(orientation);\n const accessibleName = ariaLabel || ariaLabelledBy;\n\n return (\n <div\n {...props}\n ref={ref}\n role={role ?? (accessibleName ? \"region\" : undefined)}\n tabIndex={tabIndex ?? 0}\n className={cn(\"puzzle-scroll-area\", className)}\n data-orientation={orientation}\n style={{ ...overflow, ...props.style }}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n >\n {children}\n </div>\n );\n};\n\nexport { ScrollArea, type ScrollAreaProps, type ScrollAreaOrientation };\n"],"mappings":";;;;;AAmBA,MAAM,cAAc,EAClB,cAAc,YACd,UACA,WACA,MACA,UACA,cAAc,WACd,mBAAmB,gBACnB,KACA,GAAG,YACkB;CACrB,MAAM,WAAW,sBAAsB,WAAW;CAClD,MAAM,iBAAiB,aAAa;CAEpC,OACE,oBAAC,OAAD;EACE,GAAI;EACC;EACL,MAAM,SAAS,iBAAiB,WAAW,KAAA;EAC3C,UAAU,YAAY;EACtB,WAAW,GAAG,sBAAsB,SAAS;EAC7C,oBAAkB;EAClB,OAAO;GAAE,GAAG;GAAU,GAAG,MAAM;EAAM;EACrC,cAAY;EACZ,mBAAiB;EAEhB;CACE,CAAA;AAET"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
.puzzle-scroll-area {
|
|
2
|
+
overscroll-behavior: contain;
|
|
3
|
+
-webkit-overflow-scrolling: touch;
|
|
4
|
+
scrollbar-width: thin;
|
|
5
|
+
scrollbar-color: var(--puzzle-color-border) transparent;
|
|
6
|
+
min-width: 0;
|
|
7
|
+
min-height: 0;
|
|
8
|
+
display: block;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.puzzle-scroll-area::-webkit-scrollbar {
|
|
12
|
+
width: .5rem;
|
|
13
|
+
height: .5rem;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.puzzle-scroll-area::-webkit-scrollbar-track {
|
|
17
|
+
background: none;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.puzzle-scroll-area::-webkit-scrollbar-thumb {
|
|
21
|
+
background-color: var(--puzzle-color-border);
|
|
22
|
+
background-clip: content-box;
|
|
23
|
+
border: 2px solid #0000;
|
|
24
|
+
border-radius: 999px;
|
|
25
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// src/components/layout/scroll-area/scroll-area.utils.ts
|
|
2
|
+
const getScrollAreaOverflow = (orientation) => ({
|
|
3
|
+
overflowX: orientation === "horizontal" || orientation === "both" ? "auto" : "hidden",
|
|
4
|
+
overflowY: orientation === "vertical" || orientation === "both" ? "auto" : "hidden"
|
|
5
|
+
});
|
|
6
|
+
exports.getScrollAreaOverflow = getScrollAreaOverflow;
|
|
7
|
+
|
|
8
|
+
//# sourceMappingURL=scroll-area.utils.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scroll-area.utils.cjs","names":[],"sources":["../../../../src/components/layout/scroll-area/scroll-area.utils.ts"],"sourcesContent":["type ScrollAreaOrientation = \"vertical\" | \"horizontal\" | \"both\";\n\ntype ScrollAreaOverflow = {\n overflowX: \"auto\" | \"hidden\";\n overflowY: \"auto\" | \"hidden\";\n};\n\nconst getScrollAreaOverflow = (\n orientation: ScrollAreaOrientation,\n): ScrollAreaOverflow => ({\n overflowX:\n orientation === \"horizontal\" || orientation === \"both\" ? \"auto\" : \"hidden\",\n overflowY:\n orientation === \"vertical\" || orientation === \"both\" ? \"auto\" : \"hidden\",\n});\n\nexport {\n getScrollAreaOverflow,\n type ScrollAreaOrientation,\n type ScrollAreaOverflow,\n};\n"],"mappings":";AAOA,MAAM,yBACJ,iBACwB;CACxB,WACE,gBAAgB,gBAAgB,gBAAgB,SAAS,SAAS;CACpE,WACE,gBAAgB,cAAc,gBAAgB,SAAS,SAAS;AACpE"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// src/components/layout/scroll-area/scroll-area.utils.ts
|
|
2
|
+
const getScrollAreaOverflow = (orientation) => ({
|
|
3
|
+
overflowX: orientation === "horizontal" || orientation === "both" ? "auto" : "hidden",
|
|
4
|
+
overflowY: orientation === "vertical" || orientation === "both" ? "auto" : "hidden"
|
|
5
|
+
});
|
|
6
|
+
export { getScrollAreaOverflow };
|
|
7
|
+
|
|
8
|
+
//# sourceMappingURL=scroll-area.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scroll-area.utils.js","names":[],"sources":["../../../../src/components/layout/scroll-area/scroll-area.utils.ts"],"sourcesContent":["type ScrollAreaOrientation = \"vertical\" | \"horizontal\" | \"both\";\n\ntype ScrollAreaOverflow = {\n overflowX: \"auto\" | \"hidden\";\n overflowY: \"auto\" | \"hidden\";\n};\n\nconst getScrollAreaOverflow = (\n orientation: ScrollAreaOrientation,\n): ScrollAreaOverflow => ({\n overflowX:\n orientation === \"horizontal\" || orientation === \"both\" ? \"auto\" : \"hidden\",\n overflowY:\n orientation === \"vertical\" || orientation === \"both\" ? \"auto\" : \"hidden\",\n});\n\nexport {\n getScrollAreaOverflow,\n type ScrollAreaOrientation,\n type ScrollAreaOverflow,\n};\n"],"mappings":";AAOA,MAAM,yBACJ,iBACwB;CACxB,WACE,gBAAgB,gBAAgB,gBAAgB,SAAS,SAAS;CACpE,WACE,gBAAgB,cAAc,gBAAgB,SAAS,SAAS;AACpE"}
|
|
@@ -1,13 +1,19 @@
|
|
|
1
|
+
const require_container_utils = require("../container/container.utils.cjs");
|
|
1
2
|
;/* empty css */
|
|
2
3
|
;/* empty css */
|
|
3
4
|
let _puzzle_ui_core = require("@puzzle-ui/core");
|
|
4
5
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
5
6
|
// src/components/layout/section/index.tsx
|
|
6
|
-
const Section = ({ children, className, theme = "default", fullWidth = false, noPadding = false, compactTop = false, compactBottom = false, divider = false }) => {
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
const Section = ({ children, className, theme = "default", fullWidth = false, noPadding = false, compactTop = false, compactBottom = false, divider = false, as: Component = "section" }) => {
|
|
8
|
+
const constrainContent = theme !== "default" && !fullWidth;
|
|
9
|
+
const content = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [children, divider && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("hr", { className: "puzzle-section--divider" })] });
|
|
10
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Component, {
|
|
11
|
+
className: (0, _puzzle_ui_core.cn)("puzzle-section", !fullWidth && !constrainContent && ["puzzle-container", require_container_utils.getContainerPresetClass("container")], compactTop && "puzzle-section--compact-top", compactBottom && "puzzle-section--compact-bottom", noPadding && "puzzle-section--no-padding", className),
|
|
9
12
|
"data-theme": theme,
|
|
10
|
-
children:
|
|
13
|
+
children: constrainContent ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
14
|
+
className: (0, _puzzle_ui_core.cn)("puzzle-section__content", "puzzle-container", require_container_utils.getContainerPresetClass("container")),
|
|
15
|
+
children: content
|
|
16
|
+
}) : content
|
|
11
17
|
});
|
|
12
18
|
};
|
|
13
19
|
exports.Section = Section;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["cn"],"sources":["../../../../src/components/layout/section/index.tsx"],"sourcesContent":["import { cn } from \"@puzzle-ui/core\";\nimport type { SectionProps } from \"./types\";\n\nimport \"./section.css\";\nimport \"../container/container.css\";\n\nexport const Section = ({\n children,\n className,\n theme = \"default\",\n fullWidth = false,\n noPadding = false,\n compactTop = false,\n compactBottom = false,\n divider = false,\n}: SectionProps) => {\n
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["cn","getContainerPresetClass"],"sources":["../../../../src/components/layout/section/index.tsx"],"sourcesContent":["import { cn } from \"@puzzle-ui/core\";\nimport type { SectionProps } from \"./types\";\nimport { getContainerPresetClass } from \"../container/container.utils\";\n\nimport \"./section.css\";\nimport \"../container/container.css\";\n\nexport const Section = ({\n children,\n className,\n theme = \"default\",\n fullWidth = false,\n noPadding = false,\n compactTop = false,\n compactBottom = false,\n divider = false,\n as: Component = \"section\",\n}: SectionProps) => {\n const constrainContent = theme !== \"default\" && !fullWidth;\n const content = (\n <>\n {children}\n {divider && <hr className=\"puzzle-section--divider\" />}\n </>\n );\n\n return (\n <Component\n className={cn(\n \"puzzle-section\",\n !fullWidth && !constrainContent && [\n \"puzzle-container\",\n getContainerPresetClass(\"container\"),\n ],\n compactTop && \"puzzle-section--compact-top\",\n compactBottom && \"puzzle-section--compact-bottom\",\n noPadding && \"puzzle-section--no-padding\",\n className,\n )}\n data-theme={theme}\n >\n {constrainContent ? (\n <div\n className={cn(\n \"puzzle-section__content\",\n \"puzzle-container\",\n getContainerPresetClass(\"container\"),\n )}\n >\n {content}\n </div>\n ) : content}\n </Component>\n );\n};\n"],"mappings":";;;;;;AAOA,MAAa,WAAW,EACtB,UACA,WACA,QAAQ,WACR,YAAY,OACZ,YAAY,OACZ,aAAa,OACb,gBAAgB,OAChB,UAAU,OACV,IAAI,YAAY,gBACE;CAClB,MAAM,mBAAmB,UAAU,aAAa,CAAC;CACjD,MAAM,UACJ,iBAAA,GAAA,kBAAA,KAAA,CAAA,kBAAA,UAAA,EAAA,UAAA,CACG,UACA,WAAW,iBAAA,GAAA,kBAAA,IAAA,CAAC,MAAD,EAAI,WAAU,0BAA2B,CAAA,CACrD,EAAA,CAAA;CAGJ,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,WAAD;EACE,YAAA,GAAWA,gBAAAA,GAAAA,CACT,kBACA,CAAC,aAAa,CAAC,oBAAoB,CACjC,oBACAC,wBAAAA,wBAAwB,WAAW,CACrC,GACA,cAAc,+BACd,iBAAiB,kCACjB,aAAa,8BACb,SACF;EACA,cAAY;EAEX,UAAA,mBACC,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;GACE,YAAA,GAAWD,gBAAAA,GAAAA,CACT,2BACA,oBACAC,wBAAAA,wBAAwB,WAAW,CACrC;GAEC,UAAA;EACE,CAAA,IACH;CACK,CAAA;AAEf"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { SectionProps } from "./types.cjs";
|
|
2
|
-
export declare const Section: ({ children, className, theme, fullWidth, noPadding, compactTop, compactBottom, divider }: SectionProps) => import("react").JSX.Element;
|
|
2
|
+
export declare const Section: ({ children, className, theme, fullWidth, noPadding, compactTop, compactBottom, divider, as: Component }: SectionProps) => import("react").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { SectionProps } from "./types.js";
|
|
2
|
-
export declare const Section: ({ children, className, theme, fullWidth, noPadding, compactTop, compactBottom, divider }: SectionProps) => import("react").JSX.Element;
|
|
2
|
+
export declare const Section: ({ children, className, theme, fullWidth, noPadding, compactTop, compactBottom, divider, as: Component }: SectionProps) => import("react").JSX.Element;
|
|
@@ -1,13 +1,19 @@
|
|
|
1
|
+
import { getContainerPresetClass } from "../container/container.utils.js";
|
|
1
2
|
import "./section.css";
|
|
2
3
|
import "../container/container.css";
|
|
3
4
|
import { cn } from "@puzzle-ui/core";
|
|
4
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
5
6
|
// src/components/layout/section/index.tsx
|
|
6
|
-
const Section = ({ children, className, theme = "default", fullWidth = false, noPadding = false, compactTop = false, compactBottom = false, divider = false }) => {
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
const Section = ({ children, className, theme = "default", fullWidth = false, noPadding = false, compactTop = false, compactBottom = false, divider = false, as: Component = "section" }) => {
|
|
8
|
+
const constrainContent = theme !== "default" && !fullWidth;
|
|
9
|
+
const content = /* @__PURE__ */ jsxs(Fragment, { children: [children, divider && /* @__PURE__ */ jsx("hr", { className: "puzzle-section--divider" })] });
|
|
10
|
+
return /* @__PURE__ */ jsx(Component, {
|
|
11
|
+
className: cn("puzzle-section", !fullWidth && !constrainContent && ["puzzle-container", getContainerPresetClass("container")], compactTop && "puzzle-section--compact-top", compactBottom && "puzzle-section--compact-bottom", noPadding && "puzzle-section--no-padding", className),
|
|
9
12
|
"data-theme": theme,
|
|
10
|
-
children:
|
|
13
|
+
children: constrainContent ? /* @__PURE__ */ jsx("div", {
|
|
14
|
+
className: cn("puzzle-section__content", "puzzle-container", getContainerPresetClass("container")),
|
|
15
|
+
children: content
|
|
16
|
+
}) : content
|
|
11
17
|
});
|
|
12
18
|
};
|
|
13
19
|
export { Section };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/components/layout/section/index.tsx"],"sourcesContent":["import { cn } from \"@puzzle-ui/core\";\nimport type { SectionProps } from \"./types\";\n\nimport \"./section.css\";\nimport \"../container/container.css\";\n\nexport const Section = ({\n children,\n className,\n theme = \"default\",\n fullWidth = false,\n noPadding = false,\n compactTop = false,\n compactBottom = false,\n divider = false,\n}: SectionProps) => {\n
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/components/layout/section/index.tsx"],"sourcesContent":["import { cn } from \"@puzzle-ui/core\";\nimport type { SectionProps } from \"./types\";\nimport { getContainerPresetClass } from \"../container/container.utils\";\n\nimport \"./section.css\";\nimport \"../container/container.css\";\n\nexport const Section = ({\n children,\n className,\n theme = \"default\",\n fullWidth = false,\n noPadding = false,\n compactTop = false,\n compactBottom = false,\n divider = false,\n as: Component = \"section\",\n}: SectionProps) => {\n const constrainContent = theme !== \"default\" && !fullWidth;\n const content = (\n <>\n {children}\n {divider && <hr className=\"puzzle-section--divider\" />}\n </>\n );\n\n return (\n <Component\n className={cn(\n \"puzzle-section\",\n !fullWidth && !constrainContent && [\n \"puzzle-container\",\n getContainerPresetClass(\"container\"),\n ],\n compactTop && \"puzzle-section--compact-top\",\n compactBottom && \"puzzle-section--compact-bottom\",\n noPadding && \"puzzle-section--no-padding\",\n className,\n )}\n data-theme={theme}\n >\n {constrainContent ? (\n <div\n className={cn(\n \"puzzle-section__content\",\n \"puzzle-container\",\n getContainerPresetClass(\"container\"),\n )}\n >\n {content}\n </div>\n ) : content}\n </Component>\n );\n};\n"],"mappings":";;;;;;AAOA,MAAa,WAAW,EACtB,UACA,WACA,QAAQ,WACR,YAAY,OACZ,YAAY,OACZ,aAAa,OACb,gBAAgB,OAChB,UAAU,OACV,IAAI,YAAY,gBACE;CAClB,MAAM,mBAAmB,UAAU,aAAa,CAAC;CACjD,MAAM,UACJ,qBAAA,UAAA,EAAA,UAAA,CACG,UACA,WAAW,oBAAC,MAAD,EAAI,WAAU,0BAA2B,CAAA,CACrD,EAAA,CAAA;CAGJ,OACE,oBAAC,WAAD;EACE,WAAW,GACT,kBACA,CAAC,aAAa,CAAC,oBAAoB,CACjC,oBACA,wBAAwB,WAAW,CACrC,GACA,cAAc,+BACd,iBAAiB,kCACjB,aAAa,8BACb,SACF;EACA,cAAY;EAEX,UAAA,mBACC,oBAAC,OAAD;GACE,WAAW,GACT,2BACA,oBACA,wBAAwB,WAAW,CACrC;GAEC,UAAA;EACE,CAAA,IACH;CACK,CAAA;AAEf"}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
.puzzle-section {
|
|
8
|
-
--section-padding-y: var(--puzzle-container-gutter, clamp(
|
|
8
|
+
--section-padding-y: var(--puzzle-container-gutter, clamp(2rem, 6vw, 6rem));
|
|
9
9
|
--section-gap: var(--puzzle-space-4, 1rem);
|
|
10
10
|
gap: var(--section-gap);
|
|
11
11
|
box-sizing: border-box;
|
|
@@ -18,6 +18,12 @@
|
|
|
18
18
|
display: flex;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
.puzzle-section__content {
|
|
22
|
+
gap: var(--section-gap);
|
|
23
|
+
flex-direction: column;
|
|
24
|
+
display: flex;
|
|
25
|
+
}
|
|
26
|
+
|
|
21
27
|
.puzzle-section--divider {
|
|
22
28
|
border: none;
|
|
23
29
|
border-top: var(--puzzle-border-width, 1px) solid var(--puzzle-color-border);
|
|
@@ -36,12 +42,12 @@
|
|
|
36
42
|
padding-block: 0;
|
|
37
43
|
}
|
|
38
44
|
|
|
39
|
-
.puzzle-section[data-theme="
|
|
45
|
+
.puzzle-section[data-theme="default"] {
|
|
40
46
|
--section-background: var(--puzzle-color-background);
|
|
41
47
|
--section-color: var(--puzzle-color-text);
|
|
42
48
|
}
|
|
43
49
|
|
|
44
|
-
.puzzle-section[data-theme="
|
|
50
|
+
.puzzle-section[data-theme="default"] .puzzle-section--divider {
|
|
45
51
|
border-top-color: var(--puzzle-color-border);
|
|
46
52
|
}
|
|
47
53
|
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ComponentPropsWithRef, ElementType } from "react";
|
|
2
2
|
export type SectionTheme = "default" | "light" | "dark" | "primary" | "secondary" | "accent";
|
|
3
|
-
export type
|
|
4
|
-
|
|
5
|
-
className?: string;
|
|
3
|
+
export type SectionOwnProps<C extends ElementType = "section"> = {
|
|
4
|
+
as?: C;
|
|
6
5
|
theme?: SectionTheme;
|
|
7
6
|
fullWidth?: boolean;
|
|
8
7
|
noPadding?: boolean;
|
|
@@ -10,4 +9,5 @@ export type SectionProps = {
|
|
|
10
9
|
compactTop?: boolean;
|
|
11
10
|
compactBottom?: boolean;
|
|
12
11
|
divider?: boolean;
|
|
13
|
-
};
|
|
12
|
+
};
|
|
13
|
+
export type SectionProps<C extends ElementType = "section"> = Omit<ComponentPropsWithRef<C>, keyof SectionOwnProps<C> | "as"> & SectionOwnProps<C>;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ComponentPropsWithRef, ElementType } from "react";
|
|
2
2
|
export type SectionTheme = "default" | "light" | "dark" | "primary" | "secondary" | "accent";
|
|
3
|
-
export type
|
|
4
|
-
|
|
5
|
-
className?: string;
|
|
3
|
+
export type SectionOwnProps<C extends ElementType = "section"> = {
|
|
4
|
+
as?: C;
|
|
6
5
|
theme?: SectionTheme;
|
|
7
6
|
fullWidth?: boolean;
|
|
8
7
|
noPadding?: boolean;
|
|
@@ -10,4 +9,5 @@ export type SectionProps = {
|
|
|
10
9
|
compactTop?: boolean;
|
|
11
10
|
compactBottom?: boolean;
|
|
12
11
|
divider?: boolean;
|
|
13
|
-
};
|
|
12
|
+
};
|
|
13
|
+
export type SectionProps<C extends ElementType = "section"> = Omit<ComponentPropsWithRef<C>, keyof SectionOwnProps<C> | "as"> & SectionOwnProps<C>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const require_separator_utils = require("./separator.utils.cjs");
|
|
2
|
+
;/* empty css */
|
|
3
|
+
let _puzzle_ui_core = require("@puzzle-ui/core");
|
|
4
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
5
|
+
// src/components/layout/separator/index.tsx
|
|
6
|
+
const Separator = ({ orientation = "horizontal", decorative = true, className, ref, ...props }) => {
|
|
7
|
+
const semantics = require_separator_utils.getSeparatorSemantics(orientation, decorative);
|
|
8
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
9
|
+
...props,
|
|
10
|
+
...semantics,
|
|
11
|
+
ref,
|
|
12
|
+
className: (0, _puzzle_ui_core.cn)("puzzle-separator", className),
|
|
13
|
+
"data-orientation": orientation
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
exports.Separator = Separator;
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["getSeparatorSemantics","cn"],"sources":["../../../../src/components/layout/separator/index.tsx"],"sourcesContent":["import { cn } from \"@puzzle-ui/core\";\nimport type { ComponentPropsWithRef } from \"react\";\nimport { getSeparatorSemantics } from \"./separator.utils\";\nimport type { SeparatorOrientation } from \"./separator.utils\";\nimport \"./separator.css\";\n\ntype SeparatorProps = Omit<\n ComponentPropsWithRef<\"div\">,\n \"children\" | \"role\" | \"aria-orientation\"\n> & {\n /**\n * The orientation of the separator.\n * @default \"horizontal\"\n */\n orientation?: SeparatorOrientation;\n\n /**\n * Whether the separator is purely decorative.\n * Decorative separators are hidden from assistive technology.\n * @default true\n */\n decorative?: boolean;\n};\n\nconst Separator = ({\n orientation = \"horizontal\",\n decorative = true,\n className,\n ref,\n ...props\n}: SeparatorProps) => {\n const semantics = getSeparatorSemantics(orientation, decorative);\n\n return (\n <div\n {...props}\n {...semantics}\n ref={ref}\n className={cn(\"puzzle-separator\", className)}\n data-orientation={orientation}\n />\n );\n};\n\nexport { Separator, type SeparatorProps, type SeparatorOrientation };\n"],"mappings":";;;;;AAwBA,MAAM,aAAa,EACjB,cAAc,cACd,aAAa,MACb,WACA,KACA,GAAG,YACiB;CACpB,MAAM,YAAYA,wBAAAA,sBAAsB,aAAa,UAAU;CAE/D,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;EACE,GAAI;EACJ,GAAI;EACC;EACL,YAAA,GAAWC,gBAAAA,GAAAA,CAAG,oBAAoB,SAAS;EAC3C,oBAAkB;CACnB,CAAA;AAEL"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { SeparatorOrientation } from "./separator.utils.cjs";
|
|
2
|
+
import { ComponentPropsWithRef } from "react";
|
|
3
|
+
type SeparatorProps = Omit<ComponentPropsWithRef<"div">, "children" | "role" | "aria-orientation"> & {
|
|
4
|
+
/**
|
|
5
|
+
* The orientation of the separator.
|
|
6
|
+
* @default "horizontal"
|
|
7
|
+
*/
|
|
8
|
+
orientation?: SeparatorOrientation;
|
|
9
|
+
/**
|
|
10
|
+
* Whether the separator is purely decorative.
|
|
11
|
+
* Decorative separators are hidden from assistive technology.
|
|
12
|
+
* @default true
|
|
13
|
+
*/
|
|
14
|
+
decorative?: boolean;
|
|
15
|
+
};
|
|
16
|
+
declare const Separator: ({ orientation, decorative, className, ref, ...props }: SeparatorProps) => import("react").JSX.Element;
|
|
17
|
+
export { Separator, type SeparatorOrientation, type SeparatorProps };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { SeparatorOrientation } from "./separator.utils.js";
|
|
2
|
+
import { ComponentPropsWithRef } from "react";
|
|
3
|
+
type SeparatorProps = Omit<ComponentPropsWithRef<"div">, "children" | "role" | "aria-orientation"> & {
|
|
4
|
+
/**
|
|
5
|
+
* The orientation of the separator.
|
|
6
|
+
* @default "horizontal"
|
|
7
|
+
*/
|
|
8
|
+
orientation?: SeparatorOrientation;
|
|
9
|
+
/**
|
|
10
|
+
* Whether the separator is purely decorative.
|
|
11
|
+
* Decorative separators are hidden from assistive technology.
|
|
12
|
+
* @default true
|
|
13
|
+
*/
|
|
14
|
+
decorative?: boolean;
|
|
15
|
+
};
|
|
16
|
+
declare const Separator: ({ orientation, decorative, className, ref, ...props }: SeparatorProps) => import("react").JSX.Element;
|
|
17
|
+
export { Separator, type SeparatorOrientation, type SeparatorProps };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { getSeparatorSemantics } from "./separator.utils.js";
|
|
2
|
+
import "./separator.css";
|
|
3
|
+
import { cn } from "@puzzle-ui/core";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
// src/components/layout/separator/index.tsx
|
|
6
|
+
const Separator = ({ orientation = "horizontal", decorative = true, className, ref, ...props }) => {
|
|
7
|
+
const semantics = getSeparatorSemantics(orientation, decorative);
|
|
8
|
+
return /* @__PURE__ */ jsx("div", {
|
|
9
|
+
...props,
|
|
10
|
+
...semantics,
|
|
11
|
+
ref,
|
|
12
|
+
className: cn("puzzle-separator", className),
|
|
13
|
+
"data-orientation": orientation
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
export { Separator };
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/components/layout/separator/index.tsx"],"sourcesContent":["import { cn } from \"@puzzle-ui/core\";\nimport type { ComponentPropsWithRef } from \"react\";\nimport { getSeparatorSemantics } from \"./separator.utils\";\nimport type { SeparatorOrientation } from \"./separator.utils\";\nimport \"./separator.css\";\n\ntype SeparatorProps = Omit<\n ComponentPropsWithRef<\"div\">,\n \"children\" | \"role\" | \"aria-orientation\"\n> & {\n /**\n * The orientation of the separator.\n * @default \"horizontal\"\n */\n orientation?: SeparatorOrientation;\n\n /**\n * Whether the separator is purely decorative.\n * Decorative separators are hidden from assistive technology.\n * @default true\n */\n decorative?: boolean;\n};\n\nconst Separator = ({\n orientation = \"horizontal\",\n decorative = true,\n className,\n ref,\n ...props\n}: SeparatorProps) => {\n const semantics = getSeparatorSemantics(orientation, decorative);\n\n return (\n <div\n {...props}\n {...semantics}\n ref={ref}\n className={cn(\"puzzle-separator\", className)}\n data-orientation={orientation}\n />\n );\n};\n\nexport { Separator, type SeparatorProps, type SeparatorOrientation };\n"],"mappings":";;;;;AAwBA,MAAM,aAAa,EACjB,cAAc,cACd,aAAa,MACb,WACA,KACA,GAAG,YACiB;CACpB,MAAM,YAAY,sBAAsB,aAAa,UAAU;CAE/D,OACE,oBAAC,OAAD;EACE,GAAI;EACJ,GAAI;EACC;EACL,WAAW,GAAG,oBAAoB,SAAS;EAC3C,oBAAkB;CACnB,CAAA;AAEL"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
.puzzle-separator {
|
|
2
|
+
background-color: var(--puzzle-color-border);
|
|
3
|
+
flex-shrink: 0;
|
|
4
|
+
display: block;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.puzzle-separator[data-orientation="horizontal"] {
|
|
8
|
+
width: 100%;
|
|
9
|
+
height: var(--puzzle-border-width, 1px);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.puzzle-separator[data-orientation="vertical"] {
|
|
13
|
+
width: var(--puzzle-border-width, 1px);
|
|
14
|
+
height: 100%;
|
|
15
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// src/components/layout/separator/separator.utils.ts
|
|
2
|
+
const getSeparatorSemantics = (orientation, decorative) => {
|
|
3
|
+
if (decorative) return { role: "none" };
|
|
4
|
+
return {
|
|
5
|
+
role: "separator",
|
|
6
|
+
...orientation === "vertical" ? { "aria-orientation": "vertical" } : {}
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
exports.getSeparatorSemantics = getSeparatorSemantics;
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=separator.utils.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"separator.utils.cjs","names":[],"sources":["../../../../src/components/layout/separator/separator.utils.ts"],"sourcesContent":["type SeparatorOrientation = \"horizontal\" | \"vertical\";\n\ntype SeparatorSemantics =\n | {\n role: \"none\";\n \"aria-orientation\"?: undefined;\n }\n | {\n role: \"separator\";\n \"aria-orientation\"?: \"vertical\";\n };\n\nconst getSeparatorSemantics = (\n orientation: SeparatorOrientation,\n decorative: boolean,\n): SeparatorSemantics => {\n if (decorative) {\n return {\n role: \"none\",\n };\n }\n\n return {\n role: \"separator\",\n ...(orientation === \"vertical\"\n ? { \"aria-orientation\": \"vertical\" as const }\n : {}),\n };\n};\n\nexport {\n getSeparatorSemantics,\n type SeparatorOrientation,\n type SeparatorSemantics,\n};\n"],"mappings":";AAYA,MAAM,yBACJ,aACA,eACuB;CACvB,IAAI,YACF,OAAO,EACL,MAAM,OACR;CAGF,OAAO;EACL,MAAM;EACN,GAAI,gBAAgB,aAChB,EAAE,oBAAoB,WAAoB,IAC1C,CAAC;CACP;AACF"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// src/components/layout/separator/separator.utils.ts
|
|
2
|
+
const getSeparatorSemantics = (orientation, decorative) => {
|
|
3
|
+
if (decorative) return { role: "none" };
|
|
4
|
+
return {
|
|
5
|
+
role: "separator",
|
|
6
|
+
...orientation === "vertical" ? { "aria-orientation": "vertical" } : {}
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
export { getSeparatorSemantics };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=separator.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"separator.utils.js","names":[],"sources":["../../../../src/components/layout/separator/separator.utils.ts"],"sourcesContent":["type SeparatorOrientation = \"horizontal\" | \"vertical\";\n\ntype SeparatorSemantics =\n | {\n role: \"none\";\n \"aria-orientation\"?: undefined;\n }\n | {\n role: \"separator\";\n \"aria-orientation\"?: \"vertical\";\n };\n\nconst getSeparatorSemantics = (\n orientation: SeparatorOrientation,\n decorative: boolean,\n): SeparatorSemantics => {\n if (decorative) {\n return {\n role: \"none\",\n };\n }\n\n return {\n role: \"separator\",\n ...(orientation === \"vertical\"\n ? { \"aria-orientation\": \"vertical\" as const }\n : {}),\n };\n};\n\nexport {\n getSeparatorSemantics,\n type SeparatorOrientation,\n type SeparatorSemantics,\n};\n"],"mappings":";AAYA,MAAM,yBACJ,aACA,eACuB;CACvB,IAAI,YACF,OAAO,EACL,MAAM,OACR;CAGF,OAAO;EACL,MAAM;EACN,GAAI,gBAAgB,aAChB,EAAE,oBAAoB,WAAoB,IAC1C,CAAC;CACP;AACF"}
|
|
@@ -3,7 +3,7 @@ let _puzzle_ui_core = require("@puzzle-ui/core");
|
|
|
3
3
|
let react = require("react");
|
|
4
4
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
5
5
|
// src/components/layout/stack/index.tsx
|
|
6
|
-
const Stack = ({ as: Component = "div", direction = "col", alignH, alignV, wrap = "
|
|
6
|
+
const Stack = ({ as: Component = "div", direction = "col", alignH, alignV, wrap = "wrap", gap = "md", divider, reverse = false, children, className, ...props }) => {
|
|
7
7
|
const directions = typeof direction === "string" ? { mobile: direction } : {
|
|
8
8
|
...direction,
|
|
9
9
|
mobile: direction.mobile ?? "col"
|
|
@@ -13,7 +13,23 @@ const Stack = ({ as: Component = "div", direction = "col", alignH, alignV, wrap
|
|
|
13
13
|
return value ? [`direction-${breakpoint}-${value}`] : [];
|
|
14
14
|
});
|
|
15
15
|
const hasAlignment = alignH !== void 0 || alignV !== void 0;
|
|
16
|
-
const
|
|
16
|
+
const responsiveAlignH = typeof alignH === "string" ? { mobile: alignH } : {
|
|
17
|
+
...alignH,
|
|
18
|
+
mobile: alignH?.mobile ?? "start"
|
|
19
|
+
};
|
|
20
|
+
const responsiveAlignV = typeof alignV === "string" ? { mobile: alignV } : {
|
|
21
|
+
...alignV,
|
|
22
|
+
mobile: alignV?.mobile ?? "start"
|
|
23
|
+
};
|
|
24
|
+
const responsiveAlignHClasses = _puzzle_ui_core.BREAKPOINTS.flatMap((breakpoint) => {
|
|
25
|
+
const value = responsiveAlignH[breakpoint];
|
|
26
|
+
return value ? [`align-h-${breakpoint}-${value}`] : [];
|
|
27
|
+
});
|
|
28
|
+
const responsiveAlignVClasses = _puzzle_ui_core.BREAKPOINTS.flatMap((breakpoint) => {
|
|
29
|
+
const value = responsiveAlignV[breakpoint];
|
|
30
|
+
return value ? [`align-v-${breakpoint}-${value}`] : [];
|
|
31
|
+
});
|
|
32
|
+
const classes = (0, _puzzle_ui_core.cn)("puzzle-stack", ...directionClasses, reverse && "reverse", wrap, `gap-${gap}`, ...responsiveAlignHClasses, ...responsiveAlignVClasses, hasAlignment && "has-alignment", className);
|
|
17
33
|
const childrenWithDividers = divider ? react.Children.toArray(children).flatMap((child, index, arr) => {
|
|
18
34
|
if (index === arr.length - 1) return [child];
|
|
19
35
|
const dividerKey = `stack-divider-${(0, react.isValidElement)(child) ? child.key : index}`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["BREAKPOINTS","cn","Children","isValidElement","cloneElement","createElement","Fragment"],"sources":["../../../../src/components/layout/stack/index.tsx"],"sourcesContent":["import { BREAKPOINTS, cn } from \"@puzzle-ui/core\";\nimport {\n Children,\n cloneElement,\n createElement,\n Fragment,\n isValidElement,\n type ComponentPropsWithRef,\n type ElementType,\n type ReactNode,\n} from \"react\";\nimport type { ResponsiveValue } from \"@puzzle-ui/core\";\nimport \"./stack.css\";\n\ntype StackDirection = \"row\" | \"col\";\ntype ResponsiveDirection = ResponsiveValue<StackDirection>;\n\ntype StackMainAlignment =\n | \"start\"\n | \"center\"\n | \"end\"\n | \"stretch\"\n | \"around\"\n | \"between\"\n | \"evenly\";\n\ntype StackCrossAlignment = \"start\" | \"center\" | \"end\" | \"stretch\";\n\ntype StackRowProps = {\n direction: \"row\";\n alignH?:
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["BREAKPOINTS","cn","Children","isValidElement","cloneElement","createElement","Fragment"],"sources":["../../../../src/components/layout/stack/index.tsx"],"sourcesContent":["import { BREAKPOINTS, cn } from \"@puzzle-ui/core\";\nimport {\n Children,\n cloneElement,\n createElement,\n Fragment,\n isValidElement,\n type ComponentPropsWithRef,\n type ElementType,\n type ReactNode,\n} from \"react\";\nimport type { ResponsiveConfig, ResponsiveValue } from \"@puzzle-ui/core\";\nimport \"./stack.css\";\n\ntype StackDirection = \"row\" | \"col\";\ntype ResponsiveDirection = ResponsiveValue<StackDirection>;\n\ntype StackMainAlignment =\n | \"start\"\n | \"center\"\n | \"end\"\n | \"stretch\"\n | \"around\"\n | \"between\"\n | \"evenly\";\n\ntype StackCrossAlignment = \"start\" | \"center\" | \"end\" | \"stretch\";\n\ntype ResponsiveMainAlignment = ResponsiveValue<StackMainAlignment>;\ntype ResponsiveCrossAlignment = ResponsiveValue<StackCrossAlignment>;\n\ntype StackRowProps = {\n direction: \"row\";\n alignH?: ResponsiveMainAlignment;\n alignV?: ResponsiveCrossAlignment;\n};\n\ntype StackColProps = {\n direction?: \"col\";\n alignH?: ResponsiveCrossAlignment;\n alignV?: ResponsiveMainAlignment;\n};\n\ntype StackResponsiveProps = {\n direction: ResponsiveDirection;\n alignH?: ResponsiveMainAlignment;\n alignV?: ResponsiveMainAlignment;\n};\n\ntype StackOwnProps<C extends ElementType> = {\n as?: C;\n wrap?: \"wrap\" | \"nowrap\" | \"wrap-reverse\";\n gap?: \"0\" | \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\";\n divider?: ReactNode;\n reverse?: boolean;\n} & (StackRowProps | StackColProps | StackResponsiveProps);\n\ntype StackProps<C extends ElementType = \"div\"> = StackOwnProps<C> &\n Omit<ComponentPropsWithRef<C>, keyof StackOwnProps<C> | \"as\">;\n\nconst Stack = ({\n as: Component = \"div\",\n direction = \"col\",\n alignH,\n alignV,\n wrap = \"wrap\",\n gap = \"md\",\n divider,\n reverse = false,\n children,\n className,\n ...props\n}: StackProps<ElementType>) => {\n const directions: ResponsiveConfig<StackDirection> =\n typeof direction === \"string\"\n ? { mobile: direction }\n : {\n ...direction,\n mobile: direction.mobile ?? \"col\",\n };\n\n const directionClasses = BREAKPOINTS.flatMap((breakpoint) => {\n const value = directions[breakpoint];\n\n return value ? [`direction-${breakpoint}-${value}`] : [];\n });\n\n const hasAlignment = alignH !== undefined || alignV !== undefined;\n\n const responsiveAlignH: ResponsiveConfig<StackMainAlignment> =\n typeof alignH === \"string\"\n ? { mobile: alignH }\n : { ...alignH, mobile: alignH?.mobile ?? \"start\" };\n const responsiveAlignV: ResponsiveConfig<StackMainAlignment> =\n typeof alignV === \"string\"\n ? { mobile: alignV }\n : { ...alignV, mobile: alignV?.mobile ?? \"start\" };\n const responsiveAlignHClasses = BREAKPOINTS.flatMap((breakpoint) => {\n const value = responsiveAlignH[breakpoint];\n\n return value ? [`align-h-${breakpoint}-${value}`] : [];\n });\n\n const responsiveAlignVClasses = BREAKPOINTS.flatMap((breakpoint) => {\n const value = responsiveAlignV[breakpoint];\n\n return value ? [`align-v-${breakpoint}-${value}`] : [];\n });\n\n const classes = cn(\n \"puzzle-stack\",\n ...directionClasses,\n reverse && \"reverse\",\n wrap,\n `gap-${gap}`,\n ...responsiveAlignHClasses,\n ...responsiveAlignVClasses,\n hasAlignment && \"has-alignment\",\n className,\n );\n\n const childrenWithDividers = divider\n ? Children.toArray(children).flatMap((child, index, arr) => {\n if (index === arr.length - 1) {\n return [child];\n }\n\n // Children keep the keys assigned by Children.toArray; only dividers get new ones.\n const dividerKey = `stack-divider-${isValidElement(child) ? child.key : index}`;\n const clonedDivider = isValidElement(divider)\n ? cloneElement(divider, { key: dividerKey })\n : createElement(Fragment, { key: dividerKey }, divider);\n\n return [child, clonedDivider];\n })\n : children;\n\n return (\n <Component className={classes} {...props}>\n {childrenWithDividers}\n </Component>\n );\n};\n\nexport {\n Stack,\n type StackProps,\n type ResponsiveDirection,\n type StackMainAlignment,\n type StackCrossAlignment,\n};\n"],"mappings":";;;;;AA4DA,MAAM,SAAS,EACb,IAAI,YAAY,OAChB,YAAY,OACZ,QACA,QACA,OAAO,QACP,MAAM,MACN,SACA,UAAU,OACV,UACA,WACA,GAAG,YAC0B;CAC7B,MAAM,aACJ,OAAO,cAAc,WACjB,EAAE,QAAQ,UAAU,IACpB;EACE,GAAG;EACH,QAAQ,UAAU,UAAU;CAC9B;CAEN,MAAM,mBAAmBA,gBAAAA,YAAY,SAAS,eAAe;EAC3D,MAAM,QAAQ,WAAW;EAEzB,OAAO,QAAQ,CAAC,aAAa,WAAW,GAAG,OAAO,IAAI,CAAC;CACzD,CAAC;CAED,MAAM,eAAe,WAAW,KAAA,KAAa,WAAW,KAAA;CAExD,MAAM,mBACJ,OAAO,WAAW,WACd,EAAE,QAAQ,OAAO,IACjB;EAAE,GAAG;EAAQ,QAAQ,QAAQ,UAAU;CAAQ;CACrD,MAAM,mBACJ,OAAO,WAAW,WACd,EAAE,QAAQ,OAAO,IACjB;EAAE,GAAG;EAAQ,QAAQ,QAAQ,UAAU;CAAQ;CACrD,MAAM,0BAA0BA,gBAAAA,YAAY,SAAS,eAAe;EAClE,MAAM,QAAQ,iBAAiB;EAE/B,OAAO,QAAQ,CAAC,WAAW,WAAW,GAAG,OAAO,IAAI,CAAC;CACvD,CAAC;CAED,MAAM,0BAA0BA,gBAAAA,YAAY,SAAS,eAAe;EAClE,MAAM,QAAQ,iBAAiB;EAE/B,OAAO,QAAQ,CAAC,WAAW,WAAW,GAAG,OAAO,IAAI,CAAC;CACvD,CAAC;CAED,MAAM,WAAA,GAAUC,gBAAAA,GAAAA,CACd,gBACA,GAAG,kBACH,WAAW,WACX,MACA,OAAO,OACP,GAAG,yBACH,GAAG,yBACH,gBAAgB,iBAChB,SACF;CAEA,MAAM,uBAAuB,UACzBC,MAAAA,SAAS,QAAQ,QAAQ,CAAC,CAAC,SAAS,OAAO,OAAO,QAAQ;EACxD,IAAI,UAAU,IAAI,SAAS,GACzB,OAAO,CAAC,KAAK;EAIf,MAAM,aAAa,kBAAA,GAAiBC,MAAAA,eAAAA,CAAe,KAAK,IAAI,MAAM,MAAM;EAKxE,OAAO,CAAC,QAAA,GAJcA,MAAAA,eAAAA,CAAe,OAAO,KAAA,GACxCC,MAAAA,aAAAA,CAAa,SAAS,EAAE,KAAK,WAAW,CAAC,KAAA,GACzCC,MAAAA,cAAAA,CAAcC,MAAAA,UAAU,EAAE,KAAK,WAAW,GAAG,OAAO,CAE5B;CAC9B,CAAC,IACD;CAEJ,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,WAAD;EAAW,WAAW;EAAS,GAAI;EAChC,UAAA;CACQ,CAAA;AAEf"}
|
|
@@ -4,20 +4,22 @@ type StackDirection = "row" | "col";
|
|
|
4
4
|
type ResponsiveDirection = ResponsiveValue<StackDirection>;
|
|
5
5
|
type StackMainAlignment = "start" | "center" | "end" | "stretch" | "around" | "between" | "evenly";
|
|
6
6
|
type StackCrossAlignment = "start" | "center" | "end" | "stretch";
|
|
7
|
+
type ResponsiveMainAlignment = ResponsiveValue<StackMainAlignment>;
|
|
8
|
+
type ResponsiveCrossAlignment = ResponsiveValue<StackCrossAlignment>;
|
|
7
9
|
type StackRowProps = {
|
|
8
10
|
direction: "row";
|
|
9
|
-
alignH?:
|
|
10
|
-
alignV?:
|
|
11
|
+
alignH?: ResponsiveMainAlignment;
|
|
12
|
+
alignV?: ResponsiveCrossAlignment;
|
|
11
13
|
};
|
|
12
14
|
type StackColProps = {
|
|
13
15
|
direction?: "col";
|
|
14
|
-
alignH?:
|
|
15
|
-
alignV?:
|
|
16
|
+
alignH?: ResponsiveCrossAlignment;
|
|
17
|
+
alignV?: ResponsiveMainAlignment;
|
|
16
18
|
};
|
|
17
19
|
type StackResponsiveProps = {
|
|
18
20
|
direction: ResponsiveDirection;
|
|
19
|
-
alignH?:
|
|
20
|
-
alignV?:
|
|
21
|
+
alignH?: ResponsiveMainAlignment;
|
|
22
|
+
alignV?: ResponsiveMainAlignment;
|
|
21
23
|
};
|
|
22
24
|
type StackOwnProps<C extends ElementType> = {
|
|
23
25
|
as?: C;
|