@aurora-ds/components 0.21.1 → 0.22.0
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 +125 -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/index.js +100 -0
- 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 +125 -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/index.js +100 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.ts +112 -2
- 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,125 @@
|
|
|
1
|
+
import { CSSProperties, 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
|
+
};
|
|
91
|
+
export type BoxStyleParams = {
|
|
92
|
+
width?: CSSProperties['width'];
|
|
93
|
+
height?: CSSProperties['height'];
|
|
94
|
+
minWidth?: CSSProperties['minWidth'];
|
|
95
|
+
minHeight?: CSSProperties['minHeight'];
|
|
96
|
+
maxWidth?: CSSProperties['maxWidth'];
|
|
97
|
+
maxHeight?: CSSProperties['maxHeight'];
|
|
98
|
+
padding?: keyof ThemeContract['spacing'];
|
|
99
|
+
margin?: keyof ThemeContract['spacing'];
|
|
100
|
+
backgroundColor?: keyof ThemeContract['colors'];
|
|
101
|
+
radius?: keyof ThemeContract['radius'];
|
|
102
|
+
display?: CSSProperties['display'];
|
|
103
|
+
position?: CSSProperties['position'];
|
|
104
|
+
top?: CSSProperties['top'];
|
|
105
|
+
right?: CSSProperties['right'];
|
|
106
|
+
bottom?: CSSProperties['bottom'];
|
|
107
|
+
left?: CSSProperties['left'];
|
|
108
|
+
overflow?: CSSProperties['overflow'];
|
|
109
|
+
overflowX?: CSSProperties['overflowX'];
|
|
110
|
+
overflowY?: CSSProperties['overflowY'];
|
|
111
|
+
borderColor?: keyof ThemeContract['colors'];
|
|
112
|
+
borderWidth?: string;
|
|
113
|
+
flexDirection?: CSSProperties['flexDirection'];
|
|
114
|
+
alignItems?: CSSProperties['alignItems'];
|
|
115
|
+
justifyContent?: CSSProperties['justifyContent'];
|
|
116
|
+
gap?: keyof ThemeContract['spacing'];
|
|
117
|
+
flexWrap?: CSSProperties['flexWrap'];
|
|
118
|
+
flexGrow?: CSSProperties['flexGrow'];
|
|
119
|
+
flexShrink?: CSSProperties['flexShrink'];
|
|
120
|
+
flexBasis?: CSSProperties['flexBasis'];
|
|
121
|
+
zIndex?: CSSProperties['zIndex'];
|
|
122
|
+
opacity?: CSSProperties['opacity'];
|
|
123
|
+
cursor?: CSSProperties['cursor'];
|
|
124
|
+
shadow?: keyof ThemeContract['shadows'];
|
|
125
|
+
};
|
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, }) => {
|
|
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, children: children }));
|
|
2034
|
+
};
|
|
2035
|
+
Box.displayName = 'Box';
|
|
2036
|
+
|
|
1938
2037
|
/**
|
|
1939
2038
|
* Card styles using createStyles from @aurora-ds/theme
|
|
1940
2039
|
*/
|
|
@@ -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;
|