@autoguru/overdrive 4.44.2 → 4.44.3
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/components/Box/Box.d.ts +5 -13
- package/dist/components/Box/Box.d.ts.map +1 -1
- package/dist/components/Box/Box.js +10 -228
- package/dist/components/Box/index.d.ts +2 -3
- package/dist/components/Box/index.d.ts.map +1 -1
- package/dist/components/Box/index.js +2 -2
- package/dist/components/Box/{newBox/NewBox.d.ts → polymorphicBox/PolymorphicBox.d.ts} +3 -3
- package/dist/components/Box/polymorphicBox/PolymorphicBox.d.ts.map +1 -0
- package/dist/components/Box/{newBox/NewBox.js → polymorphicBox/PolymorphicBox.js} +4 -4
- package/dist/components/Box/{newBox/useBox.d.ts → polymorphicBox/usePolymorphicBox.d.ts} +5 -5
- package/dist/components/Box/polymorphicBox/usePolymorphicBox.d.ts.map +1 -0
- package/dist/components/Box/{newBox/useBox.js → polymorphicBox/usePolymorphicBox.js} +2 -3
- package/dist/components/Box/useBox/useBox.d.ts +389 -0
- package/dist/components/Box/useBox/useBox.d.ts.map +1 -0
- package/dist/components/Box/useBox/useBox.js +255 -0
- package/dist/components/EditableText/EditableText.d.ts.map +1 -1
- package/dist/components/EditableText/EditableText.js +10 -5
- package/dist/components/Flex/Flex.css.d.ts +2 -0
- package/dist/components/Flex/Flex.css.d.ts.map +1 -0
- package/dist/components/Flex/Flex.css.js +10 -0
- package/dist/components/Flex/FlexInline.d.ts +42 -0
- package/dist/components/Flex/FlexInline.d.ts.map +1 -0
- package/dist/components/Flex/FlexInline.js +94 -0
- package/dist/components/Flex/FlexStack.d.ts +49 -0
- package/dist/components/Flex/FlexStack.d.ts.map +1 -0
- package/dist/components/Flex/FlexStack.js +87 -0
- package/dist/components/Flex/flex.d.ts +131 -0
- package/dist/components/Flex/flex.d.ts.map +1 -0
- package/dist/components/Flex/flex.js +86 -0
- package/dist/components/Flex/index.d.ts +4 -0
- package/dist/components/Flex/index.d.ts.map +1 -0
- package/dist/components/Flex/index.js +5 -0
- package/dist/components/OptionList/OptionList.d.ts +1 -1
- package/dist/types/index.d.ts +13 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +18 -27
- package/readme.md +10 -10
- package/dist/components/Box/newBox/NewBox.d.ts.map +0 -1
- package/dist/components/Box/newBox/useBox.d.ts.map +0 -1
|
@@ -1,16 +1,5 @@
|
|
|
1
|
-
import type { AllHTMLAttributes, ElementType, PropsWithChildren } from 'react';
|
|
2
1
|
import React from 'react';
|
|
3
|
-
import { type
|
|
4
|
-
import { OdComponent, TestId } from '../../types';
|
|
5
|
-
/**
|
|
6
|
-
* Use CommonBoxProps to help consistently define additional utility props of a component
|
|
7
|
-
*/
|
|
8
|
-
export interface CommonBoxProps extends OdComponent, PropsWithChildren, TestId {
|
|
9
|
-
}
|
|
10
|
-
export interface BoxProps extends Omit<AllHTMLAttributes<HTMLElement>, 'as' | 'className' | 'color' | 'height' | 'is' | 'size' | 'width'>, CommonBoxProps, ElementStylesProps {
|
|
11
|
-
/** Pass in the HTML element or JSX component that should be rendered for the box */
|
|
12
|
-
as?: ElementType;
|
|
13
|
-
}
|
|
2
|
+
import { type UseBoxProps as BoxProps } from './useBox/useBox';
|
|
14
3
|
/**
|
|
15
4
|
* The Box component provides powerful responsive style props to a given tag, defaulting to a `<div>` element.
|
|
16
5
|
* Style props are generated from the design tokens, are fully type-safe, and reuse utility classes.
|
|
@@ -29,5 +18,8 @@ export interface BoxProps extends Omit<AllHTMLAttributes<HTMLElement>, 'as' | 'c
|
|
|
29
18
|
* @example
|
|
30
19
|
* <Box as={<MyCustomThing />} borderColor="info" borderWidth="1" />
|
|
31
20
|
*/
|
|
32
|
-
export declare const Box: React.ForwardRefExoticComponent<BoxProps &
|
|
21
|
+
export declare const Box: React.ForwardRefExoticComponent<BoxProps & {
|
|
22
|
+
children?: React.ReactNode | undefined;
|
|
23
|
+
} & React.RefAttributes<HTMLElement>>;
|
|
24
|
+
export { type UseBoxProps as BoxProps } from './useBox/useBox';
|
|
33
25
|
//# sourceMappingURL=Box.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Box.d.ts","sourceRoot":"","sources":["../../../lib/components/Box/Box.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Box.d.ts","sourceRoot":"","sources":["../../../lib/components/Box/Box.tsx"],"names":[],"mappings":"AACA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAE1C,OAAO,EAAU,KAAK,WAAW,IAAI,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEvE;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,GAAG;;qCAUf,CAAC;AAIF,OAAO,EAAE,KAAK,WAAW,IAAI,QAAQ,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -2,16 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
4
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
5
|
-
const _excluded = ["
|
|
5
|
+
const _excluded = ["children"];
|
|
6
6
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
7
7
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
8
8
|
import React, { forwardRef } from 'react';
|
|
9
|
-
import {
|
|
10
|
-
import { dataAttrs } from "../../utils/dataAttrs.js";
|
|
11
|
-
/**
|
|
12
|
-
* Use CommonBoxProps to help consistently define additional utility props of a component
|
|
13
|
-
*/
|
|
14
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
+
import { useBox } from "./useBox/useBox.js";
|
|
15
10
|
/**
|
|
16
11
|
* The Box component provides powerful responsive style props to a given tag, defaulting to a `<div>` element.
|
|
17
12
|
* Style props are generated from the design tokens, are fully type-safe, and reuse utility classes.
|
|
@@ -30,230 +25,17 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
30
25
|
* @example
|
|
31
26
|
* <Box as={<MyCustomThing />} borderColor="info" borderWidth="1" />
|
|
32
27
|
*/
|
|
28
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
33
29
|
export const Box = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
34
30
|
let {
|
|
35
|
-
|
|
36
|
-
children,
|
|
37
|
-
className,
|
|
38
|
-
odComponent,
|
|
39
|
-
testId,
|
|
40
|
-
// style props
|
|
41
|
-
display,
|
|
42
|
-
height,
|
|
43
|
-
maxWidth,
|
|
44
|
-
minWidth,
|
|
45
|
-
overflow,
|
|
46
|
-
overflowX,
|
|
47
|
-
overflowY,
|
|
48
|
-
pointerEvents,
|
|
49
|
-
position,
|
|
50
|
-
size,
|
|
51
|
-
userSelect,
|
|
52
|
-
useVar,
|
|
53
|
-
width,
|
|
54
|
-
bg,
|
|
55
|
-
backgroundColor,
|
|
56
|
-
backgroundColour,
|
|
57
|
-
boxShadow,
|
|
58
|
-
color,
|
|
59
|
-
// modern semantic colour tokens
|
|
60
|
-
colour,
|
|
61
|
-
// legacy colours
|
|
62
|
-
fg,
|
|
63
|
-
opacity,
|
|
64
|
-
fontSize,
|
|
65
|
-
fontWeight,
|
|
66
|
-
lineHeight,
|
|
67
|
-
text,
|
|
68
|
-
textAlign,
|
|
69
|
-
textWrap,
|
|
70
|
-
borderRadius,
|
|
71
|
-
borderColor,
|
|
72
|
-
borderStyle,
|
|
73
|
-
borderWidth,
|
|
74
|
-
borderWidthX,
|
|
75
|
-
borderWidthY,
|
|
76
|
-
borderBottomColor,
|
|
77
|
-
borderBottomStyle,
|
|
78
|
-
borderBottomWidth,
|
|
79
|
-
borderLeftColor,
|
|
80
|
-
borderLeftStyle,
|
|
81
|
-
borderLeftWidth,
|
|
82
|
-
borderRightColor,
|
|
83
|
-
borderRightStyle,
|
|
84
|
-
borderRightWidth,
|
|
85
|
-
borderTopColor,
|
|
86
|
-
borderTopStyle,
|
|
87
|
-
borderTopWidth,
|
|
88
|
-
borderWidthTop,
|
|
89
|
-
borderWidthRight,
|
|
90
|
-
borderWidthBottom,
|
|
91
|
-
borderWidthLeft,
|
|
92
|
-
borderColour,
|
|
93
|
-
borderColourX,
|
|
94
|
-
borderColourY,
|
|
95
|
-
borderBottomColour,
|
|
96
|
-
borderLeftColour,
|
|
97
|
-
borderRightColour,
|
|
98
|
-
borderTopColour,
|
|
99
|
-
alignContent,
|
|
100
|
-
alignItems,
|
|
101
|
-
alignSelf,
|
|
102
|
-
columnGap,
|
|
103
|
-
flexDirection,
|
|
104
|
-
flexGrow,
|
|
105
|
-
flexShrink,
|
|
106
|
-
flexWrap,
|
|
107
|
-
gap,
|
|
108
|
-
gridAutoColumns,
|
|
109
|
-
gridAutoFlow,
|
|
110
|
-
gridAutoRows,
|
|
111
|
-
gridColumns,
|
|
112
|
-
justifyContent,
|
|
113
|
-
placeItems,
|
|
114
|
-
rowGap,
|
|
115
|
-
order,
|
|
116
|
-
m,
|
|
117
|
-
mb,
|
|
118
|
-
ml,
|
|
119
|
-
mr,
|
|
120
|
-
mt,
|
|
121
|
-
mx,
|
|
122
|
-
my,
|
|
123
|
-
margin,
|
|
124
|
-
marginX,
|
|
125
|
-
marginY,
|
|
126
|
-
marginBottom,
|
|
127
|
-
marginLeft,
|
|
128
|
-
marginRight,
|
|
129
|
-
marginTop,
|
|
130
|
-
p,
|
|
131
|
-
pb,
|
|
132
|
-
pl,
|
|
133
|
-
pr,
|
|
134
|
-
pt,
|
|
135
|
-
px,
|
|
136
|
-
py,
|
|
137
|
-
padding,
|
|
138
|
-
paddingX,
|
|
139
|
-
paddingY,
|
|
140
|
-
paddingBottom,
|
|
141
|
-
paddingLeft,
|
|
142
|
-
paddingRight,
|
|
143
|
-
paddingTop
|
|
31
|
+
children
|
|
144
32
|
} = _ref,
|
|
145
|
-
|
|
146
|
-
const
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
height,
|
|
152
|
-
maxWidth,
|
|
153
|
-
minWidth,
|
|
154
|
-
overflow,
|
|
155
|
-
overflowX,
|
|
156
|
-
overflowY,
|
|
157
|
-
pointerEvents,
|
|
158
|
-
position,
|
|
159
|
-
size,
|
|
160
|
-
userSelect,
|
|
161
|
-
useVar,
|
|
162
|
-
width,
|
|
163
|
-
bg,
|
|
164
|
-
backgroundColor,
|
|
165
|
-
backgroundColour,
|
|
166
|
-
boxShadow,
|
|
167
|
-
color,
|
|
168
|
-
colour,
|
|
169
|
-
fg,
|
|
170
|
-
opacity,
|
|
171
|
-
fontSize,
|
|
172
|
-
fontWeight,
|
|
173
|
-
lineHeight,
|
|
174
|
-
text,
|
|
175
|
-
textAlign,
|
|
176
|
-
textWrap,
|
|
177
|
-
borderRadius,
|
|
178
|
-
borderColor,
|
|
179
|
-
borderStyle,
|
|
180
|
-
borderWidth,
|
|
181
|
-
borderWidthX,
|
|
182
|
-
borderWidthY,
|
|
183
|
-
borderBottomColor,
|
|
184
|
-
borderBottomStyle,
|
|
185
|
-
borderBottomWidth,
|
|
186
|
-
borderLeftColor,
|
|
187
|
-
borderLeftStyle,
|
|
188
|
-
borderLeftWidth,
|
|
189
|
-
borderRightColor,
|
|
190
|
-
borderRightStyle,
|
|
191
|
-
borderRightWidth,
|
|
192
|
-
borderTopColor,
|
|
193
|
-
borderTopStyle,
|
|
194
|
-
borderTopWidth,
|
|
195
|
-
borderWidthTop,
|
|
196
|
-
borderWidthRight,
|
|
197
|
-
borderWidthBottom,
|
|
198
|
-
borderWidthLeft,
|
|
199
|
-
borderColour,
|
|
200
|
-
borderColourX,
|
|
201
|
-
borderColourY,
|
|
202
|
-
borderBottomColour,
|
|
203
|
-
borderLeftColour,
|
|
204
|
-
borderRightColour,
|
|
205
|
-
borderTopColour,
|
|
206
|
-
alignContent,
|
|
207
|
-
alignItems,
|
|
208
|
-
alignSelf,
|
|
209
|
-
columnGap,
|
|
210
|
-
flexDirection,
|
|
211
|
-
flexGrow,
|
|
212
|
-
flexShrink,
|
|
213
|
-
flexWrap,
|
|
214
|
-
gap,
|
|
215
|
-
gridAutoColumns,
|
|
216
|
-
gridAutoFlow,
|
|
217
|
-
gridAutoRows,
|
|
218
|
-
gridColumns,
|
|
219
|
-
justifyContent,
|
|
220
|
-
placeItems,
|
|
221
|
-
rowGap,
|
|
222
|
-
order,
|
|
223
|
-
m,
|
|
224
|
-
mb,
|
|
225
|
-
ml,
|
|
226
|
-
mr,
|
|
227
|
-
mt,
|
|
228
|
-
mx,
|
|
229
|
-
my,
|
|
230
|
-
margin,
|
|
231
|
-
marginX,
|
|
232
|
-
marginY,
|
|
233
|
-
marginBottom,
|
|
234
|
-
marginLeft,
|
|
235
|
-
marginRight,
|
|
236
|
-
marginTop,
|
|
237
|
-
p,
|
|
238
|
-
pb,
|
|
239
|
-
pl,
|
|
240
|
-
pr,
|
|
241
|
-
pt,
|
|
242
|
-
px,
|
|
243
|
-
py,
|
|
244
|
-
padding,
|
|
245
|
-
paddingX,
|
|
246
|
-
paddingY,
|
|
247
|
-
paddingBottom,
|
|
248
|
-
paddingLeft,
|
|
249
|
-
paddingRight,
|
|
250
|
-
paddingTop
|
|
251
|
-
});
|
|
252
|
-
return /*#__PURE__*/_jsx(Component, _objectSpread(_objectSpread(_objectSpread({}, allOtherProps), dataAttrs({
|
|
253
|
-
'od-component': odComponent === null || odComponent === void 0 ? void 0 : odComponent.toLocaleLowerCase(),
|
|
254
|
-
testid: testId
|
|
255
|
-
})), {}, {
|
|
256
|
-
className: allClasses,
|
|
33
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
34
|
+
const {
|
|
35
|
+
Component,
|
|
36
|
+
componentProps
|
|
37
|
+
} = useBox(props);
|
|
38
|
+
return /*#__PURE__*/_jsx(Component, _objectSpread(_objectSpread({}, componentProps), {}, {
|
|
257
39
|
ref: ref,
|
|
258
40
|
children: children
|
|
259
41
|
}));
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export type { ElementStylesProps as BoxStyleProps } from '../../styles/elementStyles';
|
|
1
|
+
export * from './Box';
|
|
2
|
+
export * from './useBox/useBox';
|
|
4
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/components/Box/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/components/Box/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,iBAAiB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { type ElementType } from 'react';
|
|
2
|
-
import { type UseBoxProps } from './
|
|
2
|
+
import { type UseBoxProps } from './usePolymorphicBox';
|
|
3
3
|
/**
|
|
4
4
|
* A polymorphic Box component that provides a flexible container with styling capabilities, defaulting to a `<div>` element.
|
|
5
5
|
* Use the `as` prop to control the rendered HTML tag. The box component exposes design system tokens relative to each style
|
|
@@ -23,8 +23,8 @@ import { type UseBoxProps } from './useBox';
|
|
|
23
23
|
* @example
|
|
24
24
|
* <Box asComponent={<MyCustomThing />} borderColor="info" borderWidth="1" />
|
|
25
25
|
*/
|
|
26
|
-
export declare const
|
|
26
|
+
export declare const PolymorphicBox: {
|
|
27
27
|
<E extends ElementType = "div">({ children, ...props }: UseBoxProps<E>): React.JSX.Element;
|
|
28
28
|
displayName: string;
|
|
29
29
|
};
|
|
30
|
-
//# sourceMappingURL=
|
|
30
|
+
//# sourceMappingURL=PolymorphicBox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PolymorphicBox.d.ts","sourceRoot":"","sources":["../../../../lib/components/Box/polymorphicBox/PolymorphicBox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAgB,KAAK,WAAW,EAAE,MAAM,OAAO,CAAC;AAE9D,OAAO,EAAqB,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAE1E;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,cAAc;KAAI,CAAC,SAAS,WAAW,kCAGjD,WAAW,CAAC,CAAC,CAAC;;CAUhB,CAAC"}
|
|
@@ -6,7 +6,7 @@ const _excluded = ["children"];
|
|
|
6
6
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
7
7
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
8
8
|
import React, { cloneElement } from 'react';
|
|
9
|
-
import {
|
|
9
|
+
import { usePolymorphicBox } from "./usePolymorphicBox.js";
|
|
10
10
|
/**
|
|
11
11
|
* A polymorphic Box component that provides a flexible container with styling capabilities, defaulting to a `<div>` element.
|
|
12
12
|
* Use the `as` prop to control the rendered HTML tag. The box component exposes design system tokens relative to each style
|
|
@@ -31,7 +31,7 @@ import { useBox } from "./useBox.js";
|
|
|
31
31
|
* <Box asComponent={<MyCustomThing />} borderColor="info" borderWidth="1" />
|
|
32
32
|
*/
|
|
33
33
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
34
|
-
export const
|
|
34
|
+
export const PolymorphicBox = _ref => {
|
|
35
35
|
let {
|
|
36
36
|
children
|
|
37
37
|
} = _ref,
|
|
@@ -40,7 +40,7 @@ export const NewBox = _ref => {
|
|
|
40
40
|
Component,
|
|
41
41
|
componentProps,
|
|
42
42
|
reactElement
|
|
43
|
-
} =
|
|
43
|
+
} = usePolymorphicBox(props);
|
|
44
44
|
if (reactElement) {
|
|
45
45
|
return /*#__PURE__*/cloneElement(reactElement, componentProps, children);
|
|
46
46
|
}
|
|
@@ -48,4 +48,4 @@ export const NewBox = _ref => {
|
|
|
48
48
|
children: children
|
|
49
49
|
}));
|
|
50
50
|
};
|
|
51
|
-
|
|
51
|
+
PolymorphicBox.displayName = 'PolymorphicBox';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type ComponentPropsWithRef, type ComponentPropsWithoutRef, type ElementType, type PropsWithChildren, type ReactElement } from 'react';
|
|
2
2
|
import { type ElementStylesProps } from '../../../styles/elementStyles';
|
|
3
3
|
import type { Sprinkles } from '../../../styles/sprinkles.css';
|
|
4
|
-
import type {
|
|
4
|
+
import type { ConsistentComponentProps } from '../../../types';
|
|
5
5
|
export type BoxStylesProps<E extends ElementType = 'div'> = AsPolyProp<E> & Pick<ElementStylesProps, 'className'> & Sprinkles;
|
|
6
6
|
export type BoxStylesReturn<P extends object> = [string, P];
|
|
7
7
|
/** Extract the ref type for a polymorphic component based on the provided element type */
|
|
@@ -23,12 +23,12 @@ export type PropsToOmit<C extends ElementType, P> = keyof (AsPolyProp<C> & P);
|
|
|
23
23
|
*/
|
|
24
24
|
export type PolymorphicComponentProps<C extends ElementType, Props = object> = PropsWithChildren<Props & AsPolyProp<C> & RefPolyProp<C>> & Omit<ComponentPropsWithoutRef<C>, PropsToOmit<C, Props>>;
|
|
25
25
|
/** Polymorphic box props that merge sprinkles style props and the HTML element props */
|
|
26
|
-
export type UseBoxProps<E extends ElementType = 'div'> = PolymorphicComponentProps<E,
|
|
26
|
+
export type UseBoxProps<E extends ElementType = 'div'> = PolymorphicComponentProps<E, ConsistentComponentProps & Sprinkles>;
|
|
27
27
|
/**
|
|
28
28
|
* Define custom props similar to Box with polymorphic, common and style props.
|
|
29
29
|
* Component props will take take precedent over style props and can overwrite them
|
|
30
30
|
*/
|
|
31
|
-
export type BoxLikeProps<E extends ElementType, P = object> = PolymorphicComponentProps<E, Omit<Sprinkles, keyof P> &
|
|
31
|
+
export type BoxLikeProps<E extends ElementType, P = object> = PolymorphicComponentProps<E, Omit<Sprinkles, keyof P> & ConsistentComponentProps & P>;
|
|
32
32
|
/**
|
|
33
33
|
* The Overdrive component primitive to expose a flexible HTML element as a fully typesafe React component
|
|
34
34
|
* that provides intrinsic props as well as style props from vanilla-extract sprinkles.
|
|
@@ -39,10 +39,10 @@ export type BoxLikeProps<E extends ElementType, P = object> = PolymorphicCompone
|
|
|
39
39
|
* if JSX was passed in the `as` prop and `cloneElement` will need to be used. `SemanticChild` is only defined
|
|
40
40
|
* depending on the HTML tag.
|
|
41
41
|
*/
|
|
42
|
-
export declare const
|
|
42
|
+
export declare const usePolymorphicBox: <E extends ElementType = "div">({ as: _as, className: _className, odComponent, testId, ...props }: UseBoxProps<E>) => {
|
|
43
43
|
Component: ElementType;
|
|
44
44
|
componentProps: ComponentPropsWithRef<E>;
|
|
45
45
|
reactElement: ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | undefined;
|
|
46
46
|
SemanticChild: ElementType | undefined;
|
|
47
47
|
};
|
|
48
|
-
//# sourceMappingURL=
|
|
48
|
+
//# sourceMappingURL=usePolymorphicBox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePolymorphicBox.d.ts","sourceRoot":"","sources":["../../../../lib/components/Box/polymorphicBox/usePolymorphicBox.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,EAC7B,KAAK,WAAW,EAEhB,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,MAAM,OAAO,CAAC;AAGf,OAAO,EAEN,KAAK,kBAAkB,EACvB,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAU/D,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,WAAW,GAAG,KAAK,IAAI,UAAU,CAAC,CAAC,CAAC,GACxE,IAAI,CAAC,kBAAkB,EAAE,WAAW,CAAC,GACrC,SAAS,CAAC;AAEX,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;AAE5D,0FAA0F;AAC1F,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,WAAW,IAC/C,qBAAqB,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;AAEjC,gGAAgG;AAChG,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,WAAW,IAAI;IAC/C,EAAE,CAAC,EAAE,CAAC,GAAG,YAAY,CAAC;CAGtB,CAAC;AAEF,uFAAuF;AACvF,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,WAAW,IAAI;IAChD,GAAG,CAAC,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC;CACxB,CAAC;AAEF,2EAA2E;AAC3E,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,WAAW,EAAE,CAAC,IAAI,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;AAE9E;;;;GAIG;AACH,MAAM,MAAM,yBAAyB,CACpC,CAAC,SAAS,WAAW,EACrB,KAAK,GAAG,MAAM,IACX,iBAAiB,CAAC,KAAK,GAAG,UAAU,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,GAC5D,IAAI,CAAC,wBAAwB,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;AAE1D,wFAAwF;AACxF,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,WAAW,GAAG,KAAK,IACpD,yBAAyB,CAAC,CAAC,EAAE,wBAAwB,GAAG,SAAS,CAAC,CAAC;AAEpE;;;GAGG;AACH,MAAM,MAAM,YAAY,CACvB,CAAC,SAAS,WAAW,EACrB,CAAC,GAAG,MAAM,IACP,yBAAyB,CAC5B,CAAC,EACD,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,GAAG,wBAAwB,GAAG,CAAC,CACvD,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,iBAAiB,GAAI,CAAC,SAAS,WAAW,GAAG,KAAK,EAAE,mEAM9D,WAAW,CAAC,CAAC,CAAC;;;;;CAmChB,CAAC"}
|
|
@@ -9,8 +9,7 @@ import { isValidElement } from 'react';
|
|
|
9
9
|
import { useDeepCompareMemo } from "../../../hooks/index.js";
|
|
10
10
|
import { elementStyles } from "../../../styles/elementStyles.js";
|
|
11
11
|
import { dataAttrs } from "../../../utils/dataAttrs.js";
|
|
12
|
-
import { filterPropsWithStyles } from "../../../utils/sprinkles.js";
|
|
13
|
-
// defaults
|
|
12
|
+
import { filterPropsWithStyles } from "../../../utils/sprinkles.js"; // defaults
|
|
14
13
|
const DEFAULT_TAG = 'div';
|
|
15
14
|
const LIST_ITEM_TAG = 'li';
|
|
16
15
|
const LIST_TAGS = ['ul', 'ol'];
|
|
@@ -47,7 +46,7 @@ const OD_COMPONENT_ATTR = 'od-component';
|
|
|
47
46
|
* if JSX was passed in the `as` prop and `cloneElement` will need to be used. `SemanticChild` is only defined
|
|
48
47
|
* depending on the HTML tag.
|
|
49
48
|
*/
|
|
50
|
-
export const
|
|
49
|
+
export const usePolymorphicBox = _ref => {
|
|
51
50
|
let {
|
|
52
51
|
as: _as,
|
|
53
52
|
className: _className,
|