@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.
- package/README.md +1 -1
- package/dist/cjs/components/index.d.ts +1 -0
- package/dist/cjs/components/layout/box/Box.d.ts +23 -0
- package/dist/cjs/components/layout/box/Box.props.d.ts +139 -0
- package/dist/cjs/components/layout/box/Box.styles.d.ts +7 -0
- package/dist/cjs/components/layout/box/index.d.ts +2 -0
- package/dist/cjs/components/layout/card/Card.props.d.ts +15 -1
- package/dist/cjs/index.js +102 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/components/index.d.ts +1 -0
- package/dist/esm/components/layout/box/Box.d.ts +23 -0
- package/dist/esm/components/layout/box/Box.props.d.ts +139 -0
- package/dist/esm/components/layout/box/Box.styles.d.ts +7 -0
- package/dist/esm/components/layout/box/index.d.ts +2 -0
- package/dist/esm/components/layout/card/Card.props.d.ts +15 -1
- package/dist/esm/index.js +102 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.ts +141 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -209,7 +209,7 @@ The `defaultTheme` includes these token categories:
|
|
|
209
209
|
## 🧩 Available Components
|
|
210
210
|
|
|
211
211
|
**Buttons:** Button, IconButton
|
|
212
|
-
**Layout:** Card, Stack, Grid, Page, PageSection, Separator
|
|
212
|
+
**Layout:** Box, Card, Stack, Grid, Page, PageSection, Separator
|
|
213
213
|
**Typography:** Text
|
|
214
214
|
**Forms:** Input, TextArea, Select, DatePicker, Form
|
|
215
215
|
**Data Display:** Status, Avatar, AvatarGroup, Icon
|
|
@@ -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
|
+
};
|
|
@@ -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/cjs/index.js
CHANGED
|
@@ -1935,6 +1935,105 @@ const DatePicker = ({ value, onChange, label, mandatory = false, placeholder, di
|
|
|
1935
1935
|
DatePicker.displayName = 'DatePicker';
|
|
1936
1936
|
var DatePicker_default = React.memo(DatePicker);
|
|
1937
1937
|
|
|
1938
|
+
/**
|
|
1939
|
+
* Box styles using createStyles from @aurora-ds/theme
|
|
1940
|
+
*/
|
|
1941
|
+
const BOX_STYLES = theme.createStyles((theme) => ({
|
|
1942
|
+
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, }) => ({
|
|
1943
|
+
display,
|
|
1944
|
+
width,
|
|
1945
|
+
height,
|
|
1946
|
+
minWidth,
|
|
1947
|
+
minHeight,
|
|
1948
|
+
maxWidth,
|
|
1949
|
+
maxHeight,
|
|
1950
|
+
padding: padding ? theme.spacing[padding] : undefined,
|
|
1951
|
+
margin: margin ? theme.spacing[margin] : undefined,
|
|
1952
|
+
backgroundColor: backgroundColor ? theme.colors[backgroundColor] : undefined,
|
|
1953
|
+
borderRadius: radius ? theme.radius[radius] : undefined,
|
|
1954
|
+
position,
|
|
1955
|
+
top,
|
|
1956
|
+
right,
|
|
1957
|
+
bottom,
|
|
1958
|
+
left,
|
|
1959
|
+
overflow,
|
|
1960
|
+
overflowX,
|
|
1961
|
+
overflowY,
|
|
1962
|
+
border: borderColor ? `${borderWidth || '1px'} solid ${theme.colors[borderColor]}` : undefined,
|
|
1963
|
+
flexDirection,
|
|
1964
|
+
alignItems,
|
|
1965
|
+
justifyContent,
|
|
1966
|
+
gap: gap ? theme.spacing[gap] : undefined,
|
|
1967
|
+
flexWrap,
|
|
1968
|
+
flexGrow,
|
|
1969
|
+
flexShrink,
|
|
1970
|
+
flexBasis,
|
|
1971
|
+
zIndex,
|
|
1972
|
+
opacity,
|
|
1973
|
+
cursor,
|
|
1974
|
+
boxShadow: shadow ? theme.shadows[shadow] : undefined,
|
|
1975
|
+
boxSizing: 'border-box',
|
|
1976
|
+
}),
|
|
1977
|
+
}));
|
|
1978
|
+
|
|
1979
|
+
/**
|
|
1980
|
+
* Box component
|
|
1981
|
+
*
|
|
1982
|
+
* A versatile container component that acts as a flexible div with extensive styling props.
|
|
1983
|
+
* Perfect for layout composition, spacing control, and creating custom containers.
|
|
1984
|
+
*
|
|
1985
|
+
* **Common use cases:**
|
|
1986
|
+
* - Layout containers with specific dimensions
|
|
1987
|
+
* - Spacing and positioning elements
|
|
1988
|
+
* - Creating flexible layouts with flexbox
|
|
1989
|
+
* - Wrapping content with background colors or borders
|
|
1990
|
+
*
|
|
1991
|
+
* @example
|
|
1992
|
+
* ```tsx
|
|
1993
|
+
* <Box width="300px" height="200px" padding="md" backgroundColor="surface">
|
|
1994
|
+
* Content here
|
|
1995
|
+
* </Box>
|
|
1996
|
+
* ```
|
|
1997
|
+
*/
|
|
1998
|
+
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, }) => {
|
|
1999
|
+
return (jsxRuntime.jsx("div", { id: id, className: BOX_STYLES.root({
|
|
2000
|
+
width,
|
|
2001
|
+
height,
|
|
2002
|
+
minWidth,
|
|
2003
|
+
minHeight,
|
|
2004
|
+
maxWidth,
|
|
2005
|
+
maxHeight,
|
|
2006
|
+
padding,
|
|
2007
|
+
margin,
|
|
2008
|
+
backgroundColor,
|
|
2009
|
+
radius,
|
|
2010
|
+
display,
|
|
2011
|
+
position,
|
|
2012
|
+
top,
|
|
2013
|
+
right,
|
|
2014
|
+
bottom,
|
|
2015
|
+
left,
|
|
2016
|
+
overflow,
|
|
2017
|
+
overflowX,
|
|
2018
|
+
overflowY,
|
|
2019
|
+
borderColor,
|
|
2020
|
+
borderWidth,
|
|
2021
|
+
flexDirection,
|
|
2022
|
+
alignItems,
|
|
2023
|
+
justifyContent,
|
|
2024
|
+
gap,
|
|
2025
|
+
flexWrap,
|
|
2026
|
+
flexGrow,
|
|
2027
|
+
flexShrink,
|
|
2028
|
+
flexBasis,
|
|
2029
|
+
zIndex,
|
|
2030
|
+
opacity,
|
|
2031
|
+
cursor,
|
|
2032
|
+
shadow,
|
|
2033
|
+
}), "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 }));
|
|
2034
|
+
};
|
|
2035
|
+
Box.displayName = 'Box';
|
|
2036
|
+
|
|
1938
2037
|
/**
|
|
1939
2038
|
* Card styles using createStyles from @aurora-ds/theme
|
|
1940
2039
|
*/
|
|
@@ -1966,7 +2065,7 @@ const CARD_STYLES = theme.createStyles((theme) => ({
|
|
|
1966
2065
|
* - `column`: Vertical layout (default)
|
|
1967
2066
|
* - `row`: Horizontal layout
|
|
1968
2067
|
*/
|
|
1969
|
-
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, }) => {
|
|
2068
|
+
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, }) => {
|
|
1970
2069
|
return (jsxRuntime.jsx("div", { className: CARD_STYLES.root({
|
|
1971
2070
|
direction,
|
|
1972
2071
|
padding,
|
|
@@ -1979,7 +2078,7 @@ const Card = ({ children, direction = 'column', padding = 'md', width, height, g
|
|
|
1979
2078
|
justify,
|
|
1980
2079
|
backgroundColor,
|
|
1981
2080
|
borderColor
|
|
1982
|
-
}), "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, role: role, tabIndex: tabIndex, children: children }));
|
|
2081
|
+
}), "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 }));
|
|
1983
2082
|
};
|
|
1984
2083
|
Card.displayName = 'Card';
|
|
1985
2084
|
|
|
@@ -3283,6 +3382,7 @@ exports.Alert = Alert;
|
|
|
3283
3382
|
exports.AlertProvider = AlertProvider;
|
|
3284
3383
|
exports.Avatar = Avatar;
|
|
3285
3384
|
exports.AvatarGroup = AvatarGroup;
|
|
3385
|
+
exports.Box = Box;
|
|
3286
3386
|
exports.Breadcrumb = Breadcrumb;
|
|
3287
3387
|
exports.BreadcrumbEllipsis = BreadcrumbEllipsis;
|
|
3288
3388
|
exports.BreadcrumbLink = BreadcrumbLink;
|