@grupor5/raya 0.2.6 → 0.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +109 -2
- package/dist/index.d.ts +109 -2
- package/dist/index.js +356 -0
- package/dist/index.mjs +354 -1
- package/dist/molecules/grid/index.d.mts +194 -0
- package/dist/molecules/grid/index.d.ts +194 -0
- package/dist/molecules/grid/index.js +263 -0
- package/dist/molecules/grid/index.mjs +256 -0
- package/dist/tailwind.css +1 -1
- package/dist/tokens/grids.d.mts +3 -3
- package/dist/tokens/grids.d.ts +3 -3
- package/dist/tokens/grids.js +3 -3
- package/dist/tokens/grids.mjs +3 -3
- package/package.json +1 -1
- package/tailwind.config.js +7 -0
package/dist/index.mjs
CHANGED
|
@@ -2585,10 +2585,363 @@ function getPayloadConfigFromPayload(config, payload, key) {
|
|
|
2585
2585
|
}
|
|
2586
2586
|
return configLabelKey in config ? config[configLabelKey] : config[key];
|
|
2587
2587
|
}
|
|
2588
|
+
var getColsClasses = (cols) => {
|
|
2589
|
+
if (typeof cols === "number") {
|
|
2590
|
+
return `grid-cols-${cols}`;
|
|
2591
|
+
}
|
|
2592
|
+
if (typeof cols === "object" && cols !== null) {
|
|
2593
|
+
const classes = [];
|
|
2594
|
+
if (cols.mobile) {
|
|
2595
|
+
classes.push(`grid-cols-${cols.mobile}`);
|
|
2596
|
+
}
|
|
2597
|
+
if (cols.tablet) {
|
|
2598
|
+
classes.push(`md:grid-cols-${cols.tablet}`);
|
|
2599
|
+
}
|
|
2600
|
+
if (cols.desktop) {
|
|
2601
|
+
classes.push(`lg:grid-cols-${cols.desktop}`);
|
|
2602
|
+
}
|
|
2603
|
+
return classes.join(" ");
|
|
2604
|
+
}
|
|
2605
|
+
return "grid-cols-4 md:grid-cols-8 lg:grid-cols-12";
|
|
2606
|
+
};
|
|
2607
|
+
var getGapClasses = (gap) => {
|
|
2608
|
+
if (typeof gap === "string") {
|
|
2609
|
+
const gapMap = {
|
|
2610
|
+
xs: "gap-1",
|
|
2611
|
+
// 4px
|
|
2612
|
+
s: "gap-2",
|
|
2613
|
+
// 8px
|
|
2614
|
+
m: "gap-4",
|
|
2615
|
+
// 16px
|
|
2616
|
+
l: "gap-6",
|
|
2617
|
+
// 24px
|
|
2618
|
+
xl: "gap-8"
|
|
2619
|
+
// 32px
|
|
2620
|
+
};
|
|
2621
|
+
return gapMap[gap] || "gap-4";
|
|
2622
|
+
}
|
|
2623
|
+
if (typeof gap === "object" && gap !== null) {
|
|
2624
|
+
const gapMap = {
|
|
2625
|
+
xs: "1",
|
|
2626
|
+
s: "2",
|
|
2627
|
+
m: "4",
|
|
2628
|
+
l: "6",
|
|
2629
|
+
xl: "8"
|
|
2630
|
+
};
|
|
2631
|
+
const classes = [];
|
|
2632
|
+
if (gap.mobile) {
|
|
2633
|
+
classes.push(`gap-${gapMap[gap.mobile] || "4"}`);
|
|
2634
|
+
}
|
|
2635
|
+
if (gap.tablet) {
|
|
2636
|
+
classes.push(`md:gap-${gapMap[gap.tablet] || "5"}`);
|
|
2637
|
+
}
|
|
2638
|
+
if (gap.desktop) {
|
|
2639
|
+
classes.push(`lg:gap-${gapMap[gap.desktop] || "6"}`);
|
|
2640
|
+
}
|
|
2641
|
+
return classes.join(" ");
|
|
2642
|
+
}
|
|
2643
|
+
return "gap-4 md:gap-5 lg:gap-6";
|
|
2644
|
+
};
|
|
2645
|
+
var getSpanClasses = (span) => {
|
|
2646
|
+
if (typeof span === "number") {
|
|
2647
|
+
return `col-span-${span}`;
|
|
2648
|
+
}
|
|
2649
|
+
if (typeof span === "object" && span !== null) {
|
|
2650
|
+
const classes = [];
|
|
2651
|
+
if (span.mobile) {
|
|
2652
|
+
classes.push(`col-span-${span.mobile}`);
|
|
2653
|
+
}
|
|
2654
|
+
if (span.tablet) {
|
|
2655
|
+
classes.push(`md:col-span-${span.tablet}`);
|
|
2656
|
+
}
|
|
2657
|
+
if (span.desktop) {
|
|
2658
|
+
classes.push(`lg:col-span-${span.desktop}`);
|
|
2659
|
+
}
|
|
2660
|
+
return classes.join(" ");
|
|
2661
|
+
}
|
|
2662
|
+
return "";
|
|
2663
|
+
};
|
|
2664
|
+
var getRowSpanClasses = (rowSpan) => {
|
|
2665
|
+
if (typeof rowSpan === "number") {
|
|
2666
|
+
return `row-span-${rowSpan}`;
|
|
2667
|
+
}
|
|
2668
|
+
if (typeof rowSpan === "object" && rowSpan !== null) {
|
|
2669
|
+
const classes = [];
|
|
2670
|
+
if (rowSpan.mobile) {
|
|
2671
|
+
classes.push(`row-span-${rowSpan.mobile}`);
|
|
2672
|
+
}
|
|
2673
|
+
if (rowSpan.tablet) {
|
|
2674
|
+
classes.push(`md:row-span-${rowSpan.tablet}`);
|
|
2675
|
+
}
|
|
2676
|
+
if (rowSpan.desktop) {
|
|
2677
|
+
classes.push(`lg:row-span-${rowSpan.desktop}`);
|
|
2678
|
+
}
|
|
2679
|
+
return classes.join(" ");
|
|
2680
|
+
}
|
|
2681
|
+
return "";
|
|
2682
|
+
};
|
|
2683
|
+
var getColPositionClasses = (colStart, colEnd) => {
|
|
2684
|
+
const classes = [];
|
|
2685
|
+
if (colStart) {
|
|
2686
|
+
if (typeof colStart === "number") {
|
|
2687
|
+
classes.push(`col-start-${colStart}`);
|
|
2688
|
+
} else if (typeof colStart === "object") {
|
|
2689
|
+
if (colStart.mobile) classes.push(`col-start-${colStart.mobile}`);
|
|
2690
|
+
if (colStart.tablet) classes.push(`md:col-start-${colStart.tablet}`);
|
|
2691
|
+
if (colStart.desktop) classes.push(`lg:col-start-${colStart.desktop}`);
|
|
2692
|
+
}
|
|
2693
|
+
}
|
|
2694
|
+
if (colEnd) {
|
|
2695
|
+
if (typeof colEnd === "number") {
|
|
2696
|
+
classes.push(`col-end-${colEnd}`);
|
|
2697
|
+
} else if (typeof colEnd === "object") {
|
|
2698
|
+
if (colEnd.mobile) classes.push(`col-end-${colEnd.mobile}`);
|
|
2699
|
+
if (colEnd.tablet) classes.push(`md:col-end-${colEnd.tablet}`);
|
|
2700
|
+
if (colEnd.desktop) classes.push(`lg:col-end-${colEnd.desktop}`);
|
|
2701
|
+
}
|
|
2702
|
+
}
|
|
2703
|
+
return classes.join(" ");
|
|
2704
|
+
};
|
|
2705
|
+
var Grid = React17__default.forwardRef(
|
|
2706
|
+
(_a, ref) => {
|
|
2707
|
+
var _b = _a, {
|
|
2708
|
+
container = true,
|
|
2709
|
+
cols,
|
|
2710
|
+
gap,
|
|
2711
|
+
margin = false,
|
|
2712
|
+
className,
|
|
2713
|
+
children,
|
|
2714
|
+
"aria-label": ariaLabel,
|
|
2715
|
+
"data-testid": dataTestId
|
|
2716
|
+
} = _b, props = __objRest(_b, [
|
|
2717
|
+
"container",
|
|
2718
|
+
"cols",
|
|
2719
|
+
"gap",
|
|
2720
|
+
"margin",
|
|
2721
|
+
"className",
|
|
2722
|
+
"children",
|
|
2723
|
+
"aria-label",
|
|
2724
|
+
"data-testid"
|
|
2725
|
+
]);
|
|
2726
|
+
const gridClasses = cn(
|
|
2727
|
+
// Base grid styles
|
|
2728
|
+
container && "grid",
|
|
2729
|
+
// Maximum width containers following design system
|
|
2730
|
+
"max-w-grid-mobile",
|
|
2731
|
+
// Mobile: 412px max-width
|
|
2732
|
+
"md:max-w-grid-tablet",
|
|
2733
|
+
// Tablet: 834px max-width
|
|
2734
|
+
"lg:max-w-grid-desktop",
|
|
2735
|
+
// Desktop: 1440px max-width
|
|
2736
|
+
// Center containers when margin is enabled
|
|
2737
|
+
margin && "mx-auto",
|
|
2738
|
+
// Column configuration
|
|
2739
|
+
getColsClasses(cols),
|
|
2740
|
+
// Gap configuration
|
|
2741
|
+
getGapClasses(gap),
|
|
2742
|
+
// Padding configuration (follows design system)
|
|
2743
|
+
margin && "px-4 md:px-5 lg:px-6",
|
|
2744
|
+
// Custom classes
|
|
2745
|
+
className
|
|
2746
|
+
);
|
|
2747
|
+
return /* @__PURE__ */ jsx(
|
|
2748
|
+
"div",
|
|
2749
|
+
__spreadProps(__spreadValues({
|
|
2750
|
+
ref,
|
|
2751
|
+
className: gridClasses,
|
|
2752
|
+
"aria-label": ariaLabel,
|
|
2753
|
+
"data-testid": dataTestId
|
|
2754
|
+
}, props), {
|
|
2755
|
+
children
|
|
2756
|
+
})
|
|
2757
|
+
);
|
|
2758
|
+
}
|
|
2759
|
+
);
|
|
2760
|
+
Grid.displayName = "Grid";
|
|
2761
|
+
var GridItem = React17__default.forwardRef(
|
|
2762
|
+
(_a, ref) => {
|
|
2763
|
+
var _b = _a, {
|
|
2764
|
+
span,
|
|
2765
|
+
rowSpan,
|
|
2766
|
+
colStart,
|
|
2767
|
+
colEnd,
|
|
2768
|
+
className,
|
|
2769
|
+
children,
|
|
2770
|
+
"data-testid": dataTestId
|
|
2771
|
+
} = _b, props = __objRest(_b, [
|
|
2772
|
+
"span",
|
|
2773
|
+
"rowSpan",
|
|
2774
|
+
"colStart",
|
|
2775
|
+
"colEnd",
|
|
2776
|
+
"className",
|
|
2777
|
+
"children",
|
|
2778
|
+
"data-testid"
|
|
2779
|
+
]);
|
|
2780
|
+
const itemClasses = cn(
|
|
2781
|
+
// Span configuration
|
|
2782
|
+
getSpanClasses(span),
|
|
2783
|
+
// Row span configuration
|
|
2784
|
+
getRowSpanClasses(rowSpan),
|
|
2785
|
+
// Position configuration
|
|
2786
|
+
getColPositionClasses(colStart, colEnd),
|
|
2787
|
+
// Custom classes
|
|
2788
|
+
className
|
|
2789
|
+
);
|
|
2790
|
+
return /* @__PURE__ */ jsx(
|
|
2791
|
+
"div",
|
|
2792
|
+
__spreadProps(__spreadValues({
|
|
2793
|
+
ref,
|
|
2794
|
+
className: itemClasses,
|
|
2795
|
+
"data-testid": dataTestId
|
|
2796
|
+
}, props), {
|
|
2797
|
+
children
|
|
2798
|
+
})
|
|
2799
|
+
);
|
|
2800
|
+
}
|
|
2801
|
+
);
|
|
2802
|
+
GridItem.displayName = "GridItem";
|
|
2588
2803
|
function Modal({ open, onClose, children }) {
|
|
2589
2804
|
if (!open) return null;
|
|
2590
2805
|
return /* @__PURE__ */ jsx("div", { style: { position: "fixed", top: 0, left: 0, right: 0, bottom: 0, background: "rgba(0,0,0,0.5)" }, onClick: onClose, children: /* @__PURE__ */ jsx("div", { style: { margin: "100px auto", background: "#fff", padding: 24, borderRadius: 8, minWidth: 320 }, onClick: (e) => e.stopPropagation(), children }) });
|
|
2591
2806
|
}
|
|
2807
|
+
var NavigationItemComponent = ({ item, isActive, onNavigate, collapsed = false, level = 0 }) => {
|
|
2808
|
+
var _a;
|
|
2809
|
+
const [isExpanded, setIsExpanded] = React17__default.useState(false);
|
|
2810
|
+
const hasChildren = item.children && item.children.length > 0;
|
|
2811
|
+
const handleClick = () => {
|
|
2812
|
+
if (hasChildren && item.isCollapsible) {
|
|
2813
|
+
setIsExpanded(!isExpanded);
|
|
2814
|
+
} else {
|
|
2815
|
+
onNavigate == null ? void 0 : onNavigate(item);
|
|
2816
|
+
}
|
|
2817
|
+
};
|
|
2818
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
2819
|
+
/* @__PURE__ */ jsx(
|
|
2820
|
+
Button,
|
|
2821
|
+
{
|
|
2822
|
+
variant: isActive ? "secondary" : "ghost",
|
|
2823
|
+
size: "sm",
|
|
2824
|
+
onClick: handleClick,
|
|
2825
|
+
className: cn(
|
|
2826
|
+
"w-full justify-start text-left font-normal h-10",
|
|
2827
|
+
level > 0 && "ml-4",
|
|
2828
|
+
isActive && "bg-primary-100 text-primary-900 font-medium"
|
|
2829
|
+
),
|
|
2830
|
+
"data-testid": `nav-item-${item.id}`,
|
|
2831
|
+
children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between w-full", children: [
|
|
2832
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
2833
|
+
item.icon && /* @__PURE__ */ jsx("span", { className: cn("text-gray-500", isActive && "text-primary-600"), children: item.icon }),
|
|
2834
|
+
!collapsed && /* @__PURE__ */ jsx("span", { className: "text-sm", children: item.label })
|
|
2835
|
+
] }),
|
|
2836
|
+
!collapsed && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
2837
|
+
item.badge && /* @__PURE__ */ jsx("span", { className: "bg-red-500 text-white text-xs px-2 py-1 rounded-full min-w-[20px] text-center", children: item.badge }),
|
|
2838
|
+
hasChildren && item.isCollapsible && /* @__PURE__ */ jsx("span", { className: cn(
|
|
2839
|
+
"text-gray-400 transition-transform",
|
|
2840
|
+
isExpanded && "rotate-90"
|
|
2841
|
+
), children: "\u25B6" })
|
|
2842
|
+
] })
|
|
2843
|
+
] })
|
|
2844
|
+
}
|
|
2845
|
+
),
|
|
2846
|
+
hasChildren && isExpanded && !collapsed && /* @__PURE__ */ jsx("div", { className: "space-y-1", children: (_a = item.children) == null ? void 0 : _a.map((child) => /* @__PURE__ */ jsx(
|
|
2847
|
+
NavigationItemComponent,
|
|
2848
|
+
{
|
|
2849
|
+
item: child,
|
|
2850
|
+
isActive: child.path === item.path,
|
|
2851
|
+
onNavigate,
|
|
2852
|
+
collapsed,
|
|
2853
|
+
level: level + 1
|
|
2854
|
+
},
|
|
2855
|
+
child.id
|
|
2856
|
+
)) })
|
|
2857
|
+
] });
|
|
2858
|
+
};
|
|
2859
|
+
var Sidebar = React17__default.forwardRef(
|
|
2860
|
+
(_a, ref) => {
|
|
2861
|
+
var _b = _a, {
|
|
2862
|
+
brand,
|
|
2863
|
+
navigation,
|
|
2864
|
+
currentPath,
|
|
2865
|
+
collapsed = false,
|
|
2866
|
+
onNavigate,
|
|
2867
|
+
onToggleCollapse,
|
|
2868
|
+
className,
|
|
2869
|
+
"data-testid": dataTestId
|
|
2870
|
+
} = _b, props = __objRest(_b, [
|
|
2871
|
+
"brand",
|
|
2872
|
+
"navigation",
|
|
2873
|
+
"currentPath",
|
|
2874
|
+
"collapsed",
|
|
2875
|
+
"onNavigate",
|
|
2876
|
+
"onToggleCollapse",
|
|
2877
|
+
"className",
|
|
2878
|
+
"data-testid"
|
|
2879
|
+
]);
|
|
2880
|
+
return /* @__PURE__ */ jsxs(
|
|
2881
|
+
"div",
|
|
2882
|
+
__spreadProps(__spreadValues({
|
|
2883
|
+
ref,
|
|
2884
|
+
className: cn(
|
|
2885
|
+
"h-full bg-white border-r border-gray-200 flex flex-col",
|
|
2886
|
+
"transition-all duration-300",
|
|
2887
|
+
collapsed ? "w-16" : "w-full",
|
|
2888
|
+
className
|
|
2889
|
+
),
|
|
2890
|
+
"data-testid": dataTestId
|
|
2891
|
+
}, props), {
|
|
2892
|
+
children: [
|
|
2893
|
+
/* @__PURE__ */ jsxs("div", { className: cn(
|
|
2894
|
+
"p-4 border-b border-gray-100",
|
|
2895
|
+
collapsed && "px-2"
|
|
2896
|
+
), children: [
|
|
2897
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
2898
|
+
brand.logo && /* @__PURE__ */ jsx("div", { className: "flex-shrink-0", children: brand.logo }),
|
|
2899
|
+
!collapsed && /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
2900
|
+
/* @__PURE__ */ jsx(Typography, { variant: "subheading-md", className: "text-gray-900 font-bold truncate", children: brand.name }),
|
|
2901
|
+
brand.tagline && /* @__PURE__ */ jsx(Typography, { variant: "body-xs", className: "text-gray-500 truncate", children: brand.tagline })
|
|
2902
|
+
] })
|
|
2903
|
+
] }),
|
|
2904
|
+
onToggleCollapse && /* @__PURE__ */ jsxs(
|
|
2905
|
+
Button,
|
|
2906
|
+
{
|
|
2907
|
+
variant: "ghost",
|
|
2908
|
+
size: "sm",
|
|
2909
|
+
onClick: onToggleCollapse,
|
|
2910
|
+
className: cn(
|
|
2911
|
+
"mt-3 w-full h-8",
|
|
2912
|
+
collapsed && "w-8 mx-auto"
|
|
2913
|
+
),
|
|
2914
|
+
"data-testid": "sidebar-toggle",
|
|
2915
|
+
children: [
|
|
2916
|
+
/* @__PURE__ */ jsx("span", { className: cn(
|
|
2917
|
+
"transition-transform",
|
|
2918
|
+
collapsed && "rotate-180"
|
|
2919
|
+
), children: "\u25C0" }),
|
|
2920
|
+
!collapsed && /* @__PURE__ */ jsx("span", { className: "ml-2 text-xs", children: "Colapsar" })
|
|
2921
|
+
]
|
|
2922
|
+
}
|
|
2923
|
+
)
|
|
2924
|
+
] }),
|
|
2925
|
+
/* @__PURE__ */ jsx("nav", { className: "flex-1 p-4 space-y-2 overflow-y-auto", children: navigation.map((item) => /* @__PURE__ */ jsx(
|
|
2926
|
+
NavigationItemComponent,
|
|
2927
|
+
{
|
|
2928
|
+
item,
|
|
2929
|
+
isActive: currentPath === item.path,
|
|
2930
|
+
onNavigate,
|
|
2931
|
+
collapsed
|
|
2932
|
+
},
|
|
2933
|
+
item.id
|
|
2934
|
+
)) }),
|
|
2935
|
+
/* @__PURE__ */ jsx("div", { className: cn(
|
|
2936
|
+
"p-4 border-t border-gray-100",
|
|
2937
|
+
collapsed && "px-2"
|
|
2938
|
+
), children: !collapsed && /* @__PURE__ */ jsx(Typography, { variant: "body-xs", className: "text-gray-400 text-center", children: "\xA9 2024 Design System" }) })
|
|
2939
|
+
]
|
|
2940
|
+
})
|
|
2941
|
+
);
|
|
2942
|
+
}
|
|
2943
|
+
);
|
|
2944
|
+
Sidebar.displayName = "Sidebar";
|
|
2592
2945
|
function AuthLayout({ children }) {
|
|
2593
2946
|
return /* @__PURE__ */ jsx("div", { style: { minHeight: "100vh", display: "flex", alignItems: "center", justifyContent: "center" }, children: /* @__PURE__ */ jsx("main", { children }) });
|
|
2594
2947
|
}
|
|
@@ -2603,4 +2956,4 @@ function useModal(initialOpen = false) {
|
|
|
2603
2956
|
return { open, openModal, closeModal };
|
|
2604
2957
|
}
|
|
2605
2958
|
|
|
2606
|
-
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertTitle, AuthLayout, Badge, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent, Checkbox, Dropdown, Form, FormField, FormLabel, FormMessage, Input, Label, Modal, Paragraph, ProgressBar, RadioGroup, RadioGroupItem, Step, StepContent, StepDescription, StepLabel, Stepper, Switch, Tabs, TabsContent, TabsList, TabsTrigger, Tag, Textarea, ThemeProvider, Title, Typography, badgeTokens, badgeVariants, classNames, cn, colors, componentStrokes, createStroke, fontFamily, fontSize, fontWeight, generateSpacingCSS, generateStrokesCSS, generateTypographyCSS, getSpacing, getSpacingPx, getStroke, getStrokeColor, letterSpacing, lineHeight, presets, responsiveStrokes, spacing, spacingPx, spacingStyles, stroke, strokeColors, strokeDirections, strokeStyles, strokeTransitions, tagTokens, tailwindSpacing, tailwindStrokes, typography, typographyVariants, typographyVars, useModal, useStepper, useTheme };
|
|
2959
|
+
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertTitle, AuthLayout, Badge, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent, Checkbox, Dropdown, Form, FormField, FormLabel, FormMessage, Grid, GridItem, Input, Label, Modal, Paragraph, ProgressBar, RadioGroup, RadioGroupItem, Sidebar, Step, StepContent, StepDescription, StepLabel, Stepper, Switch, Tabs, TabsContent, TabsList, TabsTrigger, Tag, Textarea, ThemeProvider, Title, Typography, badgeTokens, badgeVariants, classNames, cn, colors, componentStrokes, createStroke, fontFamily, fontSize, fontWeight, generateSpacingCSS, generateStrokesCSS, generateTypographyCSS, getSpacing, getSpacingPx, getStroke, getStrokeColor, letterSpacing, lineHeight, presets, responsiveStrokes, spacing, spacingPx, spacingStyles, stroke, strokeColors, strokeDirections, strokeStyles, strokeTransitions, tagTokens, tailwindSpacing, tailwindStrokes, typography, typographyVariants, typographyVars, useModal, useStepper, useTheme };
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Responsive value type for breakpoint-specific configuration
|
|
5
|
+
*
|
|
6
|
+
* Allows different values for each breakpoint following the Raya Design System:
|
|
7
|
+
* - **mobile**: 0px and up (4-column grid)
|
|
8
|
+
* - **tablet**: 768px and up (8-column grid)
|
|
9
|
+
* - **desktop**: 1024px and up (12-column grid)
|
|
10
|
+
*
|
|
11
|
+
* @template T The type of value for each breakpoint
|
|
12
|
+
* @example
|
|
13
|
+
* ```tsx
|
|
14
|
+
* // Responsive columns
|
|
15
|
+
* const columns: ResponsiveValue<number> = {
|
|
16
|
+
* mobile: 1, // 1 column on mobile
|
|
17
|
+
* tablet: 2, // 2 columns on tablet
|
|
18
|
+
* desktop: 4 // 4 columns on desktop
|
|
19
|
+
* }
|
|
20
|
+
*
|
|
21
|
+
* // Responsive gaps
|
|
22
|
+
* const gaps: ResponsiveValue<string> = {
|
|
23
|
+
* mobile: 's', // Small gap on mobile
|
|
24
|
+
* tablet: 'm', // Medium gap on tablet
|
|
25
|
+
* desktop: 'l' // Large gap on desktop
|
|
26
|
+
* }
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
interface ResponsiveValue<T> {
|
|
30
|
+
/** Value for mobile breakpoint (0px and up) */
|
|
31
|
+
mobile?: T;
|
|
32
|
+
/** Value for tablet breakpoint (768px and up) */
|
|
33
|
+
tablet?: T;
|
|
34
|
+
/** Value for desktop breakpoint (1024px and up) */
|
|
35
|
+
desktop?: T;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Grid container props
|
|
39
|
+
*/
|
|
40
|
+
interface GridProps {
|
|
41
|
+
/**
|
|
42
|
+
* Whether this is a grid container (default: true)
|
|
43
|
+
* @default true
|
|
44
|
+
*/
|
|
45
|
+
container?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Number of columns per breakpoint. Supports single number or responsive values.
|
|
48
|
+
* Default: { mobile: 4, tablet: 8, desktop: 12 }
|
|
49
|
+
* @example { mobile: 1, tablet: 2, desktop: 3 }
|
|
50
|
+
*/
|
|
51
|
+
cols?: ResponsiveValue<1 | 2 | 3 | 4 | 6 | 8 | 12> | 1 | 2 | 3 | 4 | 6 | 8 | 12;
|
|
52
|
+
/**
|
|
53
|
+
* Gap size between grid items using design system tokens.
|
|
54
|
+
* xs=4px, s=8px, m=16px, l=24px, xl=32px
|
|
55
|
+
* @example { mobile: 'm', tablet: 'l', desktop: 'xl' }
|
|
56
|
+
*/
|
|
57
|
+
gap?: ResponsiveValue<'xs' | 's' | 'm' | 'l' | 'xl'> | 'xs' | 's' | 'm' | 'l' | 'xl';
|
|
58
|
+
/**
|
|
59
|
+
* Whether to apply responsive padding and auto-centering following design system
|
|
60
|
+
* Mobile: 16px, Tablet: 20px, Desktop: 24px
|
|
61
|
+
* @default false
|
|
62
|
+
*/
|
|
63
|
+
margin?: boolean;
|
|
64
|
+
/** Custom CSS classes to apply to the grid container */
|
|
65
|
+
className?: string;
|
|
66
|
+
/** Grid items or content to be rendered inside the grid */
|
|
67
|
+
children: React__default.ReactNode;
|
|
68
|
+
/** ARIA label for accessibility and screen readers */
|
|
69
|
+
'aria-label'?: string;
|
|
70
|
+
/** Data test id for testing purposes */
|
|
71
|
+
'data-testid'?: string;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Grid item props for responsive layout control
|
|
75
|
+
*/
|
|
76
|
+
interface GridItemProps {
|
|
77
|
+
/**
|
|
78
|
+
* Number of columns this item should span across breakpoints
|
|
79
|
+
* @example { mobile: 12, tablet: 6, desktop: 4 }
|
|
80
|
+
* @example 6 // Static span across all breakpoints
|
|
81
|
+
*/
|
|
82
|
+
span?: ResponsiveValue<number> | number;
|
|
83
|
+
/**
|
|
84
|
+
* Number of rows this item should span across breakpoints
|
|
85
|
+
* @example { mobile: 1, desktop: 2 }
|
|
86
|
+
* @example 2 // Static row span across all breakpoints
|
|
87
|
+
*/
|
|
88
|
+
rowSpan?: ResponsiveValue<number> | number;
|
|
89
|
+
/**
|
|
90
|
+
* Grid column start position (1-based indexing)
|
|
91
|
+
* @example { mobile: 1, desktop: 2 }
|
|
92
|
+
* @example 3 // Start at column 3
|
|
93
|
+
*/
|
|
94
|
+
colStart?: ResponsiveValue<number> | number;
|
|
95
|
+
/**
|
|
96
|
+
* Grid column end position (1-based indexing)
|
|
97
|
+
* @example { mobile: -1, desktop: 5 }
|
|
98
|
+
* @example 6 // End at column 6
|
|
99
|
+
*/
|
|
100
|
+
colEnd?: ResponsiveValue<number> | number;
|
|
101
|
+
/** Custom CSS classes to apply to the grid item */
|
|
102
|
+
className?: string;
|
|
103
|
+
/** Content to be rendered inside the grid item */
|
|
104
|
+
children: React__default.ReactNode;
|
|
105
|
+
/** Data test id for testing purposes */
|
|
106
|
+
'data-testid'?: string;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* # Grid - MANDATORY Responsive Grid System
|
|
110
|
+
*
|
|
111
|
+
* ## 🚨 CRITICAL: ALL LAYOUTS MUST USE THIS COMPONENT
|
|
112
|
+
*
|
|
113
|
+
* This is the **MANDATORY** grid component for all screens and layouts in the Raya Design System.
|
|
114
|
+
* Manual CSS Grid classes are **FORBIDDEN**. Use this component to ensure consistent spacing,
|
|
115
|
+
* responsive behavior, and design system compliance.
|
|
116
|
+
*
|
|
117
|
+
* ### Features
|
|
118
|
+
* - **Responsive by Default**: Automatically adapts to mobile (4 cols), tablet (8 cols), desktop (12 cols)
|
|
119
|
+
* - **Design System Integration**: Consistent margins, gaps, and breakpoints
|
|
120
|
+
* - **Type Safety**: Full TypeScript support with responsive value types
|
|
121
|
+
* - **Accessibility**: ARIA labels and semantic HTML structure
|
|
122
|
+
*
|
|
123
|
+
* ### Breakpoints & Container Sizes
|
|
124
|
+
* - **Mobile**: 0px-767px (4 columns, max-width: 412px, 16px padding/gaps)
|
|
125
|
+
* - **Tablet**: 768px-1023px (8 columns, max-width: 834px, 20px padding/gaps)
|
|
126
|
+
* - **Desktop**: 1024px+ (12 columns, max-width: 1440px, 24px padding/gaps)
|
|
127
|
+
*
|
|
128
|
+
* @example
|
|
129
|
+
* ```tsx
|
|
130
|
+
* // ✅ CORRECT - Always use Grid component
|
|
131
|
+
* <Grid cols={{ mobile: 1, tablet: 2, desktop: 3 }} gap="l" margin>
|
|
132
|
+
* <Card>Content 1</Card>
|
|
133
|
+
* <Card>Content 2</Card>
|
|
134
|
+
* <Card>Content 3</Card>
|
|
135
|
+
* </Grid>
|
|
136
|
+
*
|
|
137
|
+
* // ✅ CORRECT - Advanced responsive configuration
|
|
138
|
+
* <Grid cols={12} gap="m" margin>
|
|
139
|
+
* <GridItem span={{ mobile: 12, desktop: 8 }}>
|
|
140
|
+
* <MainContent />
|
|
141
|
+
* </GridItem>
|
|
142
|
+
* <GridItem span={{ mobile: 12, desktop: 4 }}>
|
|
143
|
+
* <Sidebar />
|
|
144
|
+
* </GridItem>
|
|
145
|
+
* </Grid>
|
|
146
|
+
* ```
|
|
147
|
+
*
|
|
148
|
+
* @example
|
|
149
|
+
* ```tsx
|
|
150
|
+
* // ❌ FORBIDDEN - Never use manual CSS Grid
|
|
151
|
+
* <div className="grid grid-cols-3 gap-6">
|
|
152
|
+
* <Card>Content</Card>
|
|
153
|
+
* </div>
|
|
154
|
+
* ```
|
|
155
|
+
*/
|
|
156
|
+
declare const Grid: React__default.ForwardRefExoticComponent<GridProps & React__default.RefAttributes<HTMLDivElement>>;
|
|
157
|
+
/**
|
|
158
|
+
* # GridItem - Responsive Grid Item with Advanced Control
|
|
159
|
+
*
|
|
160
|
+
* Provides fine-grained control over individual grid items including
|
|
161
|
+
* column spans, row spans, and positioning. Use within a Grid component
|
|
162
|
+
* for precise layout control across breakpoints.
|
|
163
|
+
*
|
|
164
|
+
* ### Features
|
|
165
|
+
* - **Responsive Spans**: Different column/row spans per breakpoint
|
|
166
|
+
* - **Positioning**: Control exact grid placement with colStart/colEnd
|
|
167
|
+
* - **Flexible Layout**: Combine with Grid for complex layouts
|
|
168
|
+
*
|
|
169
|
+
* @example
|
|
170
|
+
* ```tsx
|
|
171
|
+
* <Grid cols={12} gap="m">
|
|
172
|
+
* <GridItem span={6}>Half width</GridItem>
|
|
173
|
+
* <GridItem span={{ mobile: 12, desktop: 4 }}>Responsive width</GridItem>
|
|
174
|
+
* <GridItem span={3} rowSpan={2}>Tall item spanning 2 rows</GridItem>
|
|
175
|
+
* <GridItem colStart={2} colEnd={5}>Positioned item (cols 2-5)</GridItem>
|
|
176
|
+
* </Grid>
|
|
177
|
+
* ```
|
|
178
|
+
*
|
|
179
|
+
* @example
|
|
180
|
+
* ```tsx
|
|
181
|
+
* // Content + Sidebar layout
|
|
182
|
+
* <Grid cols={12} margin>
|
|
183
|
+
* <GridItem span={{ mobile: 12, desktop: 8 }}>
|
|
184
|
+
* <MainContent />
|
|
185
|
+
* </GridItem>
|
|
186
|
+
* <GridItem span={{ mobile: 12, desktop: 4 }}>
|
|
187
|
+
* <Sidebar />
|
|
188
|
+
* </GridItem>
|
|
189
|
+
* </Grid>
|
|
190
|
+
* ```
|
|
191
|
+
*/
|
|
192
|
+
declare const GridItem: React__default.ForwardRefExoticComponent<GridItemProps & React__default.RefAttributes<HTMLDivElement>>;
|
|
193
|
+
|
|
194
|
+
export { Grid, GridItem, type GridItemProps, type GridProps, type ResponsiveValue };
|