@aurora-ds/components 0.21.1 → 0.22.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.
@@ -10,6 +10,7 @@ export * from '@components/forms/input';
10
10
  export * from '@components/forms/textarea';
11
11
  export * from '@components/forms/select';
12
12
  export * from '@components/forms/date-picker';
13
+ export * from '@components/layout/box';
13
14
  export * from '@components/layout/stack';
14
15
  export * from '@components/layout/card';
15
16
  export * from '@components/layout/grid';
@@ -0,0 +1,23 @@
1
+ import { FC } from 'react';
2
+ import { BoxProps } from '@components/layout/box/Box.props';
3
+ /**
4
+ * Box component
5
+ *
6
+ * A versatile container component that acts as a flexible div with extensive styling props.
7
+ * Perfect for layout composition, spacing control, and creating custom containers.
8
+ *
9
+ * **Common use cases:**
10
+ * - Layout containers with specific dimensions
11
+ * - Spacing and positioning elements
12
+ * - Creating flexible layouts with flexbox
13
+ * - Wrapping content with background colors or borders
14
+ *
15
+ * @example
16
+ * ```tsx
17
+ * <Box width="300px" height="200px" padding="md" backgroundColor="surface">
18
+ * Content here
19
+ * </Box>
20
+ * ```
21
+ */
22
+ declare const Box: FC<BoxProps>;
23
+ export default Box;
@@ -0,0 +1,139 @@
1
+ import { CSSProperties, DragEvent, ReactNode } from 'react';
2
+ import { ThemeContract } from '@/interfaces';
3
+ export type BoxProps = {
4
+ /** Box children elements */
5
+ children?: ReactNode;
6
+ /** Width of the box */
7
+ width?: CSSProperties['width'];
8
+ /** Height of the box */
9
+ height?: CSSProperties['height'];
10
+ /** Minimum width */
11
+ minWidth?: CSSProperties['minWidth'];
12
+ /** Minimum height */
13
+ minHeight?: CSSProperties['minHeight'];
14
+ /** Maximum width */
15
+ maxWidth?: CSSProperties['maxWidth'];
16
+ /** Maximum height */
17
+ maxHeight?: CSSProperties['maxHeight'];
18
+ /** Padding inside the box (theme spacing key) */
19
+ padding?: keyof ThemeContract['spacing'];
20
+ /** Margin around the box (theme spacing key) */
21
+ margin?: keyof ThemeContract['spacing'];
22
+ /** Background color of the box */
23
+ backgroundColor?: keyof ThemeContract['colors'];
24
+ /** Border radius of the box */
25
+ radius?: keyof ThemeContract['radius'];
26
+ /** Display type */
27
+ display?: CSSProperties['display'];
28
+ /** Position type */
29
+ position?: CSSProperties['position'];
30
+ /** Top position */
31
+ top?: CSSProperties['top'];
32
+ /** Right position */
33
+ right?: CSSProperties['right'];
34
+ /** Bottom position */
35
+ bottom?: CSSProperties['bottom'];
36
+ /** Left position */
37
+ left?: CSSProperties['left'];
38
+ /** Overflow behavior */
39
+ overflow?: CSSProperties['overflow'];
40
+ /** Overflow X behavior */
41
+ overflowX?: CSSProperties['overflowX'];
42
+ /** Overflow Y behavior */
43
+ overflowY?: CSSProperties['overflowY'];
44
+ /** Border color */
45
+ borderColor?: keyof ThemeContract['colors'];
46
+ /** Border width */
47
+ borderWidth?: string;
48
+ /** Flex direction (when display is flex) */
49
+ flexDirection?: CSSProperties['flexDirection'];
50
+ /** Align items (when display is flex) */
51
+ alignItems?: CSSProperties['alignItems'];
52
+ /** Justify content (when display is flex) */
53
+ justifyContent?: CSSProperties['justifyContent'];
54
+ /** Gap between children (theme spacing key) */
55
+ gap?: keyof ThemeContract['spacing'];
56
+ /** Flex wrap */
57
+ flexWrap?: CSSProperties['flexWrap'];
58
+ /** Flex grow */
59
+ flexGrow?: CSSProperties['flexGrow'];
60
+ /** Flex shrink */
61
+ flexShrink?: CSSProperties['flexShrink'];
62
+ /** Flex basis */
63
+ flexBasis?: CSSProperties['flexBasis'];
64
+ /** Z-index */
65
+ zIndex?: CSSProperties['zIndex'];
66
+ /** Opacity */
67
+ opacity?: CSSProperties['opacity'];
68
+ /** Cursor */
69
+ cursor?: CSSProperties['cursor'];
70
+ /** Box shadow */
71
+ shadow?: keyof ThemeContract['shadows'];
72
+ /** Accessibility label for screen readers */
73
+ ariaLabel?: string;
74
+ /** ID of element that labels this box */
75
+ ariaLabelledBy?: string;
76
+ /** ID of element that describes this box */
77
+ ariaDescribedBy?: string;
78
+ /** ARIA role */
79
+ role?: string;
80
+ /** Tab index for keyboard navigation */
81
+ tabIndex?: number;
82
+ /** HTML id attribute */
83
+ id?: string;
84
+ /** onClick handler */
85
+ onClick?: () => void;
86
+ /** onMouseEnter handler */
87
+ onMouseEnter?: () => void;
88
+ /** onMouseLeave handler */
89
+ onMouseLeave?: () => void;
90
+ /** Drag over event handler */
91
+ onDragOver?: (event: DragEvent<HTMLDivElement>) => void;
92
+ /** Drag leave event handler */
93
+ onDragLeave?: (event: DragEvent<HTMLDivElement>) => void;
94
+ /** Drop event handler */
95
+ onDrop?: (event: DragEvent<HTMLDivElement>) => void;
96
+ /** Drag start event handler */
97
+ onDragStart?: (event: DragEvent<HTMLDivElement>) => void;
98
+ /** Drag end event handler */
99
+ onDragEnd?: (event: DragEvent<HTMLDivElement>) => void;
100
+ /** Drag enter event handler */
101
+ onDragEnter?: (event: DragEvent<HTMLDivElement>) => void;
102
+ /** Whether the element is draggable */
103
+ draggable?: boolean;
104
+ };
105
+ export type BoxStyleParams = {
106
+ width?: CSSProperties['width'];
107
+ height?: CSSProperties['height'];
108
+ minWidth?: CSSProperties['minWidth'];
109
+ minHeight?: CSSProperties['minHeight'];
110
+ maxWidth?: CSSProperties['maxWidth'];
111
+ maxHeight?: CSSProperties['maxHeight'];
112
+ padding?: keyof ThemeContract['spacing'];
113
+ margin?: keyof ThemeContract['spacing'];
114
+ backgroundColor?: keyof ThemeContract['colors'];
115
+ radius?: keyof ThemeContract['radius'];
116
+ display?: CSSProperties['display'];
117
+ position?: CSSProperties['position'];
118
+ top?: CSSProperties['top'];
119
+ right?: CSSProperties['right'];
120
+ bottom?: CSSProperties['bottom'];
121
+ left?: CSSProperties['left'];
122
+ overflow?: CSSProperties['overflow'];
123
+ overflowX?: CSSProperties['overflowX'];
124
+ overflowY?: CSSProperties['overflowY'];
125
+ borderColor?: keyof ThemeContract['colors'];
126
+ borderWidth?: string;
127
+ flexDirection?: CSSProperties['flexDirection'];
128
+ alignItems?: CSSProperties['alignItems'];
129
+ justifyContent?: CSSProperties['justifyContent'];
130
+ gap?: keyof ThemeContract['spacing'];
131
+ flexWrap?: CSSProperties['flexWrap'];
132
+ flexGrow?: CSSProperties['flexGrow'];
133
+ flexShrink?: CSSProperties['flexShrink'];
134
+ flexBasis?: CSSProperties['flexBasis'];
135
+ zIndex?: CSSProperties['zIndex'];
136
+ opacity?: CSSProperties['opacity'];
137
+ cursor?: CSSProperties['cursor'];
138
+ shadow?: keyof ThemeContract['shadows'];
139
+ };
@@ -0,0 +1,7 @@
1
+ import { BoxStyleParams } from '@components/layout/box/Box.props';
2
+ /**
3
+ * Box styles using createStyles from @aurora-ds/theme
4
+ */
5
+ export declare const BOX_STYLES: {
6
+ root: (args_0: BoxStyleParams) => string;
7
+ };
@@ -0,0 +1,2 @@
1
+ export { default as Box } from '@components/layout/box/Box';
2
+ export type { BoxProps } from '@components/layout/box/Box.props';
@@ -1,4 +1,4 @@
1
- import { CSSProperties, ReactNode } from 'react';
1
+ import { CSSProperties, DragEvent, ReactNode } from 'react';
2
2
  import { ThemeContract } from '@/interfaces';
3
3
  export type CardProps = {
4
4
  /** Card children elements */
@@ -35,6 +35,20 @@ export type CardProps = {
35
35
  role?: string;
36
36
  /** Tab index for keyboard navigation */
37
37
  tabIndex?: number;
38
+ /** Drag over event handler */
39
+ onDragOver?: (event: DragEvent<HTMLDivElement>) => void;
40
+ /** Drag leave event handler */
41
+ onDragLeave?: (event: DragEvent<HTMLDivElement>) => void;
42
+ /** Drop event handler */
43
+ onDrop?: (event: DragEvent<HTMLDivElement>) => void;
44
+ /** Drag start event handler */
45
+ onDragStart?: (event: DragEvent<HTMLDivElement>) => void;
46
+ /** Drag end event handler */
47
+ onDragEnd?: (event: DragEvent<HTMLDivElement>) => void;
48
+ /** Drag enter event handler */
49
+ onDragEnter?: (event: DragEvent<HTMLDivElement>) => void;
50
+ /** Whether the element is draggable */
51
+ draggable?: boolean;
38
52
  };
39
53
  export type CardStyleParams = {
40
54
  direction: CSSProperties['flexDirection'];
package/dist/esm/index.js CHANGED
@@ -1933,6 +1933,105 @@ const DatePicker = ({ value, onChange, label, mandatory = false, placeholder, di
1933
1933
  DatePicker.displayName = 'DatePicker';
1934
1934
  var DatePicker_default = memo(DatePicker);
1935
1935
 
1936
+ /**
1937
+ * Box styles using createStyles from @aurora-ds/theme
1938
+ */
1939
+ const BOX_STYLES = createStyles((theme) => ({
1940
+ root: ({ width, height, minWidth, minHeight, maxWidth, maxHeight, padding, margin, backgroundColor, radius, display, position, top, right, bottom, left, overflow, overflowX, overflowY, borderColor, borderWidth, flexDirection, alignItems, justifyContent, gap, flexWrap, flexGrow, flexShrink, flexBasis, zIndex, opacity, cursor, shadow, }) => ({
1941
+ display,
1942
+ width,
1943
+ height,
1944
+ minWidth,
1945
+ minHeight,
1946
+ maxWidth,
1947
+ maxHeight,
1948
+ padding: padding ? theme.spacing[padding] : undefined,
1949
+ margin: margin ? theme.spacing[margin] : undefined,
1950
+ backgroundColor: backgroundColor ? theme.colors[backgroundColor] : undefined,
1951
+ borderRadius: radius ? theme.radius[radius] : undefined,
1952
+ position,
1953
+ top,
1954
+ right,
1955
+ bottom,
1956
+ left,
1957
+ overflow,
1958
+ overflowX,
1959
+ overflowY,
1960
+ border: borderColor ? `${borderWidth || '1px'} solid ${theme.colors[borderColor]}` : undefined,
1961
+ flexDirection,
1962
+ alignItems,
1963
+ justifyContent,
1964
+ gap: gap ? theme.spacing[gap] : undefined,
1965
+ flexWrap,
1966
+ flexGrow,
1967
+ flexShrink,
1968
+ flexBasis,
1969
+ zIndex,
1970
+ opacity,
1971
+ cursor,
1972
+ boxShadow: shadow ? theme.shadows[shadow] : undefined,
1973
+ boxSizing: 'border-box',
1974
+ }),
1975
+ }));
1976
+
1977
+ /**
1978
+ * Box component
1979
+ *
1980
+ * A versatile container component that acts as a flexible div with extensive styling props.
1981
+ * Perfect for layout composition, spacing control, and creating custom containers.
1982
+ *
1983
+ * **Common use cases:**
1984
+ * - Layout containers with specific dimensions
1985
+ * - Spacing and positioning elements
1986
+ * - Creating flexible layouts with flexbox
1987
+ * - Wrapping content with background colors or borders
1988
+ *
1989
+ * @example
1990
+ * ```tsx
1991
+ * <Box width="300px" height="200px" padding="md" backgroundColor="surface">
1992
+ * Content here
1993
+ * </Box>
1994
+ * ```
1995
+ */
1996
+ const Box = ({ children, width, height, minWidth, minHeight, maxWidth, maxHeight, padding, margin, backgroundColor, radius, display = 'block', position, top, right, bottom, left, overflow, overflowX, overflowY, borderColor, borderWidth, flexDirection, alignItems, justifyContent, gap, flexWrap, flexGrow, flexShrink, flexBasis, zIndex, opacity, cursor, shadow, ariaLabel, ariaLabelledBy, ariaDescribedBy, role, tabIndex, id, onClick, onMouseEnter, onMouseLeave, onDragOver, onDragLeave, onDrop, onDragStart, onDragEnd, onDragEnter, draggable, }) => {
1997
+ return (jsx("div", { id: id, className: BOX_STYLES.root({
1998
+ width,
1999
+ height,
2000
+ minWidth,
2001
+ minHeight,
2002
+ maxWidth,
2003
+ maxHeight,
2004
+ padding,
2005
+ margin,
2006
+ backgroundColor,
2007
+ radius,
2008
+ display,
2009
+ position,
2010
+ top,
2011
+ right,
2012
+ bottom,
2013
+ left,
2014
+ overflow,
2015
+ overflowX,
2016
+ overflowY,
2017
+ borderColor,
2018
+ borderWidth,
2019
+ flexDirection,
2020
+ alignItems,
2021
+ justifyContent,
2022
+ gap,
2023
+ flexWrap,
2024
+ flexGrow,
2025
+ flexShrink,
2026
+ flexBasis,
2027
+ zIndex,
2028
+ opacity,
2029
+ cursor,
2030
+ shadow,
2031
+ }), "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, role: role, tabIndex: tabIndex, onClick: onClick, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, onDragOver: onDragOver, onDragLeave: onDragLeave, onDrop: onDrop, onDragStart: onDragStart, onDragEnd: onDragEnd, onDragEnter: onDragEnter, draggable: draggable, children: children }));
2032
+ };
2033
+ Box.displayName = 'Box';
2034
+
1936
2035
  /**
1937
2036
  * Card styles using createStyles from @aurora-ds/theme
1938
2037
  */
@@ -1964,7 +2063,7 @@ const CARD_STYLES = createStyles((theme) => ({
1964
2063
  * - `column`: Vertical layout (default)
1965
2064
  * - `row`: Horizontal layout
1966
2065
  */
1967
- const Card = ({ children, direction = 'column', padding = 'md', width, height, gap, radius = 'md', shadow = 'none', align, justify, backgroundColor = 'surface', borderColor = 'border', ariaLabel, ariaLabelledBy, ariaDescribedBy, role, tabIndex, }) => {
2066
+ const Card = ({ children, direction = 'column', padding = 'md', width, height, gap, radius = 'md', shadow = 'none', align, justify, backgroundColor = 'surface', borderColor = 'border', ariaLabel, ariaLabelledBy, ariaDescribedBy, role, tabIndex, onDragOver, onDragLeave, onDrop, onDragStart, onDragEnd, onDragEnter, draggable, }) => {
1968
2067
  return (jsx("div", { className: CARD_STYLES.root({
1969
2068
  direction,
1970
2069
  padding,
@@ -1977,7 +2076,7 @@ const Card = ({ children, direction = 'column', padding = 'md', width, height, g
1977
2076
  justify,
1978
2077
  backgroundColor,
1979
2078
  borderColor
1980
- }), "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, role: role, tabIndex: tabIndex, children: children }));
2079
+ }), "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, role: role, tabIndex: tabIndex, onDragOver: onDragOver, onDragLeave: onDragLeave, onDrop: onDrop, onDragStart: onDragStart, onDragEnd: onDragEnd, onDragEnter: onDragEnter, draggable: draggable, children: children }));
1981
2080
  };
1982
2081
  Card.displayName = 'Card';
1983
2082
 
@@ -3276,5 +3375,5 @@ const defaultTheme = {
3276
3375
  breakpoints: themeBreakpoints,
3277
3376
  };
3278
3377
 
3279
- export { Accordion, Alert, AlertProvider, Avatar, AvatarGroup, Breadcrumb, BreadcrumbEllipsis, BreadcrumbLink, BreadcrumbPage, BreadcrumbSeparator, Button, Card, DatePicker_default as DatePicker, DrawerItem, Form, Grid, Icon, IconButton, Input_default as Input, Menu, MenuGroup, MenuItem, Modal, Page, PageSection, Pagination, Select, Separator, Skeleton, Stack, Status, TabItem, Tabs, Text, TextArea_default as TextArea, defaultTheme, useAlert, useAnchorPosition, useClickOutside, useTransitionRender };
3378
+ export { Accordion, Alert, AlertProvider, Avatar, AvatarGroup, Box, Breadcrumb, BreadcrumbEllipsis, BreadcrumbLink, BreadcrumbPage, BreadcrumbSeparator, Button, Card, DatePicker_default as DatePicker, DrawerItem, Form, Grid, Icon, IconButton, Input_default as Input, Menu, MenuGroup, MenuItem, Modal, Page, PageSection, Pagination, Select, Separator, Skeleton, Stack, Status, TabItem, Tabs, Text, TextArea_default as TextArea, defaultTheme, useAlert, useAnchorPosition, useClickOutside, useTransitionRender };
3280
3379
  //# sourceMappingURL=index.js.map