@atlaskit/primitives 1.2.3 → 1.3.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,7 +10,6 @@ import type * as CSS_2 from 'csstype';
10
10
  import type { CSSProperties } from 'react';
11
11
  import type { CSSPropertiesWithMultiValues } from '@emotion/serialize';
12
12
  import { ElementType } from 'react';
13
- import { FC } from 'react';
14
13
  import { ForwardRefExoticComponent } from 'react';
15
14
  import { jsx } from '@emotion/react';
16
15
  import { MemoExoticComponent } from 'react';
@@ -66,6 +65,9 @@ const alignItemsMap_2: {
66
65
  // @public (undocumented)
67
66
  type AllMedia = '@media (prefers-color-scheme: dark)' | '@media (prefers-color-scheme: light)' | '@media (prefers-reduced-motion: reduce)' | '@media screen and (forced-colors: active), screen and (-ms-high-contrast: active)' | MediaQuery;
68
67
 
68
+ // @public (undocumented)
69
+ type AllowedElements = Exclude<keyof JSX.IntrinsicElements, SVGElements>;
70
+
69
71
  // @public (undocumented)
70
72
  type AtRulesWithoutMedia = Exclude<CSS_2.AtRules, '@media'>;
71
73
 
@@ -81,45 +83,125 @@ export type BackgroundColor = keyof typeof backgroundColorMap;
81
83
  // @public (undocumented)
82
84
  const backgroundColorMap: {
83
85
  readonly 'color.background.accent.lime.subtlest': "var(--ds-background-accent-lime-subtlest)";
86
+ readonly 'color.background.accent.lime.subtlest.hovered': "var(--ds-background-accent-lime-subtlest-hovered)";
87
+ readonly 'color.background.accent.lime.subtlest.pressed': "var(--ds-background-accent-lime-subtlest-pressed)";
84
88
  readonly 'color.background.accent.lime.subtler': "var(--ds-background-accent-lime-subtler)";
89
+ readonly 'color.background.accent.lime.subtler.hovered': "var(--ds-background-accent-lime-subtler-hovered)";
90
+ readonly 'color.background.accent.lime.subtler.pressed': "var(--ds-background-accent-lime-subtler-pressed)";
85
91
  readonly 'color.background.accent.lime.subtle': "var(--ds-background-accent-lime-subtle)";
92
+ readonly 'color.background.accent.lime.subtle.hovered': "var(--ds-background-accent-lime-subtle-hovered)";
93
+ readonly 'color.background.accent.lime.subtle.pressed': "var(--ds-background-accent-lime-subtle-pressed)";
86
94
  readonly 'color.background.accent.lime.bolder': "var(--ds-background-accent-lime-bolder)";
95
+ readonly 'color.background.accent.lime.bolder.hovered': "var(--ds-background-accent-lime-bolder-hovered)";
96
+ readonly 'color.background.accent.lime.bolder.pressed': "var(--ds-background-accent-lime-bolder-pressed)";
87
97
  readonly 'color.background.accent.red.subtlest': "var(--ds-background-accent-red-subtlest)";
98
+ readonly 'color.background.accent.red.subtlest.hovered': "var(--ds-background-accent-red-subtlest-hovered)";
99
+ readonly 'color.background.accent.red.subtlest.pressed': "var(--ds-background-accent-red-subtlest-pressed)";
88
100
  readonly 'color.background.accent.red.subtler': "var(--ds-background-accent-red-subtler)";
101
+ readonly 'color.background.accent.red.subtler.hovered': "var(--ds-background-accent-red-subtler-hovered)";
102
+ readonly 'color.background.accent.red.subtler.pressed': "var(--ds-background-accent-red-subtler-pressed)";
89
103
  readonly 'color.background.accent.red.subtle': "var(--ds-background-accent-red-subtle)";
104
+ readonly 'color.background.accent.red.subtle.hovered': "var(--ds-background-accent-red-subtle-hovered)";
105
+ readonly 'color.background.accent.red.subtle.pressed': "var(--ds-background-accent-red-subtle-pressed)";
90
106
  readonly 'color.background.accent.red.bolder': "var(--ds-background-accent-red-bolder)";
107
+ readonly 'color.background.accent.red.bolder.hovered': "var(--ds-background-accent-red-bolder-hovered)";
108
+ readonly 'color.background.accent.red.bolder.pressed': "var(--ds-background-accent-red-bolder-pressed)";
91
109
  readonly 'color.background.accent.orange.subtlest': "var(--ds-background-accent-orange-subtlest)";
110
+ readonly 'color.background.accent.orange.subtlest.hovered': "var(--ds-background-accent-orange-subtlest-hovered)";
111
+ readonly 'color.background.accent.orange.subtlest.pressed': "var(--ds-background-accent-orange-subtlest-pressed)";
92
112
  readonly 'color.background.accent.orange.subtler': "var(--ds-background-accent-orange-subtler)";
113
+ readonly 'color.background.accent.orange.subtler.hovered': "var(--ds-background-accent-orange-subtler-hovered)";
114
+ readonly 'color.background.accent.orange.subtler.pressed': "var(--ds-background-accent-orange-subtler-pressed)";
93
115
  readonly 'color.background.accent.orange.subtle': "var(--ds-background-accent-orange-subtle)";
116
+ readonly 'color.background.accent.orange.subtle.hovered': "var(--ds-background-accent-orange-subtle-hovered)";
117
+ readonly 'color.background.accent.orange.subtle.pressed': "var(--ds-background-accent-orange-subtle-pressed)";
94
118
  readonly 'color.background.accent.orange.bolder': "var(--ds-background-accent-orange-bolder)";
119
+ readonly 'color.background.accent.orange.bolder.hovered': "var(--ds-background-accent-orange-bolder-hovered)";
120
+ readonly 'color.background.accent.orange.bolder.pressed': "var(--ds-background-accent-orange-bolder-pressed)";
95
121
  readonly 'color.background.accent.yellow.subtlest': "var(--ds-background-accent-yellow-subtlest)";
122
+ readonly 'color.background.accent.yellow.subtlest.hovered': "var(--ds-background-accent-yellow-subtlest-hovered)";
123
+ readonly 'color.background.accent.yellow.subtlest.pressed': "var(--ds-background-accent-yellow-subtlest-pressed)";
96
124
  readonly 'color.background.accent.yellow.subtler': "var(--ds-background-accent-yellow-subtler)";
125
+ readonly 'color.background.accent.yellow.subtler.hovered': "var(--ds-background-accent-yellow-subtler-hovered)";
126
+ readonly 'color.background.accent.yellow.subtler.pressed': "var(--ds-background-accent-yellow-subtler-pressed)";
97
127
  readonly 'color.background.accent.yellow.subtle': "var(--ds-background-accent-yellow-subtle)";
128
+ readonly 'color.background.accent.yellow.subtle.hovered': "var(--ds-background-accent-yellow-subtle-hovered)";
129
+ readonly 'color.background.accent.yellow.subtle.pressed': "var(--ds-background-accent-yellow-subtle-pressed)";
98
130
  readonly 'color.background.accent.yellow.bolder': "var(--ds-background-accent-yellow-bolder)";
131
+ readonly 'color.background.accent.yellow.bolder.hovered': "var(--ds-background-accent-yellow-bolder-hovered)";
132
+ readonly 'color.background.accent.yellow.bolder.pressed': "var(--ds-background-accent-yellow-bolder-pressed)";
99
133
  readonly 'color.background.accent.green.subtlest': "var(--ds-background-accent-green-subtlest)";
134
+ readonly 'color.background.accent.green.subtlest.hovered': "var(--ds-background-accent-green-subtlest-hovered)";
135
+ readonly 'color.background.accent.green.subtlest.pressed': "var(--ds-background-accent-green-subtlest-pressed)";
100
136
  readonly 'color.background.accent.green.subtler': "var(--ds-background-accent-green-subtler)";
137
+ readonly 'color.background.accent.green.subtler.hovered': "var(--ds-background-accent-green-subtler-hovered)";
138
+ readonly 'color.background.accent.green.subtler.pressed': "var(--ds-background-accent-green-subtler-pressed)";
101
139
  readonly 'color.background.accent.green.subtle': "var(--ds-background-accent-green-subtle)";
140
+ readonly 'color.background.accent.green.subtle.hovered': "var(--ds-background-accent-green-subtle-hovered)";
141
+ readonly 'color.background.accent.green.subtle.pressed': "var(--ds-background-accent-green-subtle-pressed)";
102
142
  readonly 'color.background.accent.green.bolder': "var(--ds-background-accent-green-bolder)";
143
+ readonly 'color.background.accent.green.bolder.hovered': "var(--ds-background-accent-green-bolder-hovered)";
144
+ readonly 'color.background.accent.green.bolder.pressed': "var(--ds-background-accent-green-bolder-pressed)";
103
145
  readonly 'color.background.accent.teal.subtlest': "var(--ds-background-accent-teal-subtlest)";
146
+ readonly 'color.background.accent.teal.subtlest.hovered': "var(--ds-background-accent-teal-subtlest-hovered)";
147
+ readonly 'color.background.accent.teal.subtlest.pressed': "var(--ds-background-accent-teal-subtlest-pressed)";
104
148
  readonly 'color.background.accent.teal.subtler': "var(--ds-background-accent-teal-subtler)";
149
+ readonly 'color.background.accent.teal.subtler.hovered': "var(--ds-background-accent-teal-subtler-hovered)";
150
+ readonly 'color.background.accent.teal.subtler.pressed': "var(--ds-background-accent-teal-subtler-pressed)";
105
151
  readonly 'color.background.accent.teal.subtle': "var(--ds-background-accent-teal-subtle)";
152
+ readonly 'color.background.accent.teal.subtle.hovered': "var(--ds-background-accent-teal-subtle-hovered)";
153
+ readonly 'color.background.accent.teal.subtle.pressed': "var(--ds-background-accent-teal-subtle-pressed)";
106
154
  readonly 'color.background.accent.teal.bolder': "var(--ds-background-accent-teal-bolder)";
155
+ readonly 'color.background.accent.teal.bolder.hovered': "var(--ds-background-accent-teal-bolder-hovered)";
156
+ readonly 'color.background.accent.teal.bolder.pressed': "var(--ds-background-accent-teal-bolder-pressed)";
107
157
  readonly 'color.background.accent.blue.subtlest': "var(--ds-background-accent-blue-subtlest)";
158
+ readonly 'color.background.accent.blue.subtlest.hovered': "var(--ds-background-accent-blue-subtlest-hovered)";
159
+ readonly 'color.background.accent.blue.subtlest.pressed': "var(--ds-background-accent-blue-subtlest-pressed)";
108
160
  readonly 'color.background.accent.blue.subtler': "var(--ds-background-accent-blue-subtler)";
161
+ readonly 'color.background.accent.blue.subtler.hovered': "var(--ds-background-accent-blue-subtler-hovered)";
162
+ readonly 'color.background.accent.blue.subtler.pressed': "var(--ds-background-accent-blue-subtler-pressed)";
109
163
  readonly 'color.background.accent.blue.subtle': "var(--ds-background-accent-blue-subtle)";
164
+ readonly 'color.background.accent.blue.subtle.hovered': "var(--ds-background-accent-blue-subtle-hovered)";
165
+ readonly 'color.background.accent.blue.subtle.pressed': "var(--ds-background-accent-blue-subtle-pressed)";
110
166
  readonly 'color.background.accent.blue.bolder': "var(--ds-background-accent-blue-bolder)";
167
+ readonly 'color.background.accent.blue.bolder.hovered': "var(--ds-background-accent-blue-bolder-hovered)";
168
+ readonly 'color.background.accent.blue.bolder.pressed': "var(--ds-background-accent-blue-bolder-pressed)";
111
169
  readonly 'color.background.accent.purple.subtlest': "var(--ds-background-accent-purple-subtlest)";
170
+ readonly 'color.background.accent.purple.subtlest.hovered': "var(--ds-background-accent-purple-subtlest-hovered)";
171
+ readonly 'color.background.accent.purple.subtlest.pressed': "var(--ds-background-accent-purple-subtlest-pressed)";
112
172
  readonly 'color.background.accent.purple.subtler': "var(--ds-background-accent-purple-subtler)";
173
+ readonly 'color.background.accent.purple.subtler.hovered': "var(--ds-background-accent-purple-subtler-hovered)";
174
+ readonly 'color.background.accent.purple.subtler.pressed': "var(--ds-background-accent-purple-subtler-pressed)";
113
175
  readonly 'color.background.accent.purple.subtle': "var(--ds-background-accent-purple-subtle)";
176
+ readonly 'color.background.accent.purple.subtle.hovered': "var(--ds-background-accent-purple-subtle-hovered)";
177
+ readonly 'color.background.accent.purple.subtle.pressed': "var(--ds-background-accent-purple-subtle-pressed)";
114
178
  readonly 'color.background.accent.purple.bolder': "var(--ds-background-accent-purple-bolder)";
179
+ readonly 'color.background.accent.purple.bolder.hovered': "var(--ds-background-accent-purple-bolder-hovered)";
180
+ readonly 'color.background.accent.purple.bolder.pressed': "var(--ds-background-accent-purple-bolder-pressed)";
115
181
  readonly 'color.background.accent.magenta.subtlest': "var(--ds-background-accent-magenta-subtlest)";
182
+ readonly 'color.background.accent.magenta.subtlest.hovered': "var(--ds-background-accent-magenta-subtlest-hovered)";
183
+ readonly 'color.background.accent.magenta.subtlest.pressed': "var(--ds-background-accent-magenta-subtlest-pressed)";
116
184
  readonly 'color.background.accent.magenta.subtler': "var(--ds-background-accent-magenta-subtler)";
185
+ readonly 'color.background.accent.magenta.subtler.hovered': "var(--ds-background-accent-magenta-subtler-hovered)";
186
+ readonly 'color.background.accent.magenta.subtler.pressed': "var(--ds-background-accent-magenta-subtler-pressed)";
117
187
  readonly 'color.background.accent.magenta.subtle': "var(--ds-background-accent-magenta-subtle)";
188
+ readonly 'color.background.accent.magenta.subtle.hovered': "var(--ds-background-accent-magenta-subtle-hovered)";
189
+ readonly 'color.background.accent.magenta.subtle.pressed': "var(--ds-background-accent-magenta-subtle-pressed)";
118
190
  readonly 'color.background.accent.magenta.bolder': "var(--ds-background-accent-magenta-bolder)";
191
+ readonly 'color.background.accent.magenta.bolder.hovered': "var(--ds-background-accent-magenta-bolder-hovered)";
192
+ readonly 'color.background.accent.magenta.bolder.pressed': "var(--ds-background-accent-magenta-bolder-pressed)";
119
193
  readonly 'color.background.accent.gray.subtlest': "var(--ds-background-accent-gray-subtlest)";
194
+ readonly 'color.background.accent.gray.subtlest.hovered': "var(--ds-background-accent-gray-subtlest-hovered)";
195
+ readonly 'color.background.accent.gray.subtlest.pressed': "var(--ds-background-accent-gray-subtlest-pressed)";
120
196
  readonly 'color.background.accent.gray.subtler': "var(--ds-background-accent-gray-subtler)";
197
+ readonly 'color.background.accent.gray.subtler.hovered': "var(--ds-background-accent-gray-subtler-hovered)";
198
+ readonly 'color.background.accent.gray.subtler.pressed': "var(--ds-background-accent-gray-subtler-pressed)";
121
199
  readonly 'color.background.accent.gray.subtle': "var(--ds-background-accent-gray-subtle)";
200
+ readonly 'color.background.accent.gray.subtle.hovered': "var(--ds-background-accent-gray-subtle-hovered)";
201
+ readonly 'color.background.accent.gray.subtle.pressed': "var(--ds-background-accent-gray-subtle-pressed)";
122
202
  readonly 'color.background.accent.gray.bolder': "var(--ds-background-accent-gray-bolder)";
203
+ readonly 'color.background.accent.gray.bolder.hovered': "var(--ds-background-accent-gray-bolder-hovered)";
204
+ readonly 'color.background.accent.gray.bolder.pressed': "var(--ds-background-accent-gray-bolder-pressed)";
123
205
  readonly 'color.background.disabled': "var(--ds-background-disabled)";
124
206
  readonly 'color.background.input': "var(--ds-background-input)";
125
207
  readonly 'color.background.input.hovered': "var(--ds-background-input-hovered)";
@@ -197,7 +279,7 @@ const backgroundColorMap: {
197
279
  };
198
280
 
199
281
  // @public (undocumented)
200
- type BaseBoxPropsFoundation<T extends ElementType> = {
282
+ type BaseBoxProps<T extends CustomElementType> = {
201
283
  as?: T;
202
284
  children?: ReactNode;
203
285
  backgroundColor?: BackgroundColor;
@@ -289,10 +371,10 @@ const borderWidthMap: {
289
371
  export const Box: BoxComponent;
290
372
 
291
373
  // @public (undocumented)
292
- type BoxComponent<T extends ElementType = 'div'> = (<T extends ElementType>(props: BoxProps<T>) => ReactElement | null) & FC<BoxProps<T>>;
374
+ type BoxComponent = <T extends CustomElementType>(props: BoxProps<T>) => ReactElement | null;
293
375
 
294
376
  // @public (undocumented)
295
- export type BoxProps<T extends ElementType> = Omit<ComponentPropsWithoutRef<T>, 'as' | 'className'> & BasePrimitiveProps & BaseBoxPropsFoundation<T>;
377
+ export type BoxProps<T extends CustomElementType> = Omit<ComponentPropsWithoutRef<T>, 'as' | 'className'> & BasePrimitiveProps & BaseBoxProps<T>;
296
378
 
297
379
  // @public
298
380
  export type Breakpoint = 'lg' | 'md' | 'sm' | 'xl' | 'xs' | 'xxs';
@@ -312,6 +394,11 @@ type CSSPseudos = {
312
394
  [Pseudo in CSS_2.Pseudos]?: Omit<SafeCSSObject, AllMedia | CSS_2.Pseudos>;
313
395
  };
314
396
 
397
+ // @public (undocumented)
398
+ type CustomElementType<P = any> = {
399
+ [K in AllowedElements]: P extends JSX.IntrinsicElements[K] ? K : never;
400
+ }[AllowedElements];
401
+
315
402
  // @public (undocumented)
316
403
  export type Dimension = keyof typeof dimensionMap;
317
404
 
@@ -586,6 +673,9 @@ export type StackProps<T extends ElementType = 'div'> = {
586
673
  ref?: React.ComponentPropsWithRef<T>['ref'];
587
674
  } & BasePrimitiveProps;
588
675
 
676
+ // @public (undocumented)
677
+ type SVGElements = 'animate' | 'animateMotion' | 'animateTransform' | 'circle' | 'clipPath' | 'defs' | 'desc' | 'ellipse' | 'feBlend' | 'feColorMatrix' | 'feComponentTransfer' | 'feComposite' | 'feConvolveMatrix' | 'feDiffuseLighting' | 'feDisplacementMap' | 'feDistantLight' | 'feDropShadow' | 'feFlood' | 'feFuncA' | 'feFuncB' | 'feFuncG' | 'feFuncR' | 'feGaussianBlur' | 'feImage' | 'feMerge' | 'feMergeNode' | 'feMorphology' | 'feOffset' | 'fePointLight' | 'feSpecularLighting' | 'feSpotLight' | 'feTile' | 'feTurbulence' | 'filter' | 'foreignObject' | 'g' | 'image' | 'line' | 'linearGradient' | 'marker' | 'mask' | 'metadata' | 'mpath' | 'path' | 'pattern' | 'polygon' | 'polyline' | 'radialGradient' | 'rect' | 'stop' | 'svg' | 'switch' | 'symbol' | 'text' | 'textPath' | 'tspan' | 'use' | 'view';
678
+
589
679
  // @public (undocumented)
590
680
  export type TextColor = keyof typeof textColorMap;
591
681
 
@@ -1,61 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = exports.BaseBox = void 0;
8
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
- var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
10
- var _react = require("react");
11
- var _react2 = require("@emotion/react");
12
- var _styleMaps = require("../../xcss/style-maps.partial");
13
- var _excluded = ["as", "className", "children", "backgroundColor", "padding", "paddingBlock", "paddingBlockStart", "paddingBlockEnd", "paddingInline", "paddingInlineStart", "paddingInlineEnd", "style", "testId"];
14
- /* eslint-disable @repo/internal/styles/no-exported-styles */
15
- /** @jsx jsx */
16
- // Without this type annotation on Box we don't get autocomplete for props due to forwardRef types
17
-
18
- /**
19
- * __Box__
20
- *
21
- * Box is a primitive component that has the design decisions of the Atlassian Design System baked in.
22
- * Renders a `div` by default.
23
- *
24
- * @internal
25
- */
26
- var BaseBox = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
27
- var as = _ref.as,
28
- className = _ref.className,
29
- children = _ref.children,
30
- backgroundColor = _ref.backgroundColor,
31
- padding = _ref.padding,
32
- paddingBlock = _ref.paddingBlock,
33
- paddingBlockStart = _ref.paddingBlockStart,
34
- paddingBlockEnd = _ref.paddingBlockEnd,
35
- paddingInline = _ref.paddingInline,
36
- paddingInlineStart = _ref.paddingInlineStart,
37
- paddingInlineEnd = _ref.paddingInlineEnd,
38
- style = _ref.style,
39
- testId = _ref.testId,
40
- htmlAttributes = (0, _objectWithoutProperties2.default)(_ref, _excluded);
41
- var Component = as || 'div';
42
- var node = (0, _react2.jsx)(Component, (0, _extends2.default)({
43
- style: style,
44
- ref: ref
45
- // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
46
- }, htmlAttributes, {
47
- className: className,
48
- css: [baseStyles, backgroundColor && _styleMaps.backgroundColorStylesMap[backgroundColor], padding && _styleMaps.paddingStylesMap.padding[padding], paddingBlock && _styleMaps.paddingStylesMap.paddingBlock[paddingBlock], paddingBlockStart && _styleMaps.paddingStylesMap.paddingBlockStart[paddingBlockStart], paddingBlockEnd && _styleMaps.paddingStylesMap.paddingBlockEnd[paddingBlockEnd], paddingInline && _styleMaps.paddingStylesMap.paddingInline[paddingInline], paddingInlineStart && _styleMaps.paddingStylesMap.paddingInlineStart[paddingInlineStart], paddingInlineEnd && _styleMaps.paddingStylesMap.paddingInlineEnd[paddingInlineEnd]],
49
- "data-testid": testId
50
- }), children);
51
- return node;
52
- });
53
- exports.BaseBox = BaseBox;
54
- BaseBox.displayName = 'BaseBox';
55
- var _default = BaseBox;
56
- exports.default = _default;
57
- var baseStyles = (0, _react2.css)({
58
- boxSizing: 'border-box',
59
- appearance: 'none',
60
- border: 'none'
61
- });
@@ -1,52 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
- /* eslint-disable @repo/internal/styles/no-exported-styles */
3
- /** @jsx jsx */
4
- import { forwardRef } from 'react';
5
- import { css, jsx } from '@emotion/react';
6
- import { backgroundColorStylesMap, paddingStylesMap } from '../../xcss/style-maps.partial';
7
-
8
- // Without this type annotation on Box we don't get autocomplete for props due to forwardRef types
9
-
10
- /**
11
- * __Box__
12
- *
13
- * Box is a primitive component that has the design decisions of the Atlassian Design System baked in.
14
- * Renders a `div` by default.
15
- *
16
- * @internal
17
- */
18
- export const BaseBox = /*#__PURE__*/forwardRef(({
19
- as,
20
- className,
21
- children,
22
- backgroundColor,
23
- padding,
24
- paddingBlock,
25
- paddingBlockStart,
26
- paddingBlockEnd,
27
- paddingInline,
28
- paddingInlineStart,
29
- paddingInlineEnd,
30
- style,
31
- testId,
32
- ...htmlAttributes
33
- }, ref) => {
34
- const Component = as || 'div';
35
- const node = jsx(Component, _extends({
36
- style: style,
37
- ref: ref
38
- // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
39
- }, htmlAttributes, {
40
- className: className,
41
- css: [baseStyles, backgroundColor && backgroundColorStylesMap[backgroundColor], padding && paddingStylesMap.padding[padding], paddingBlock && paddingStylesMap.paddingBlock[paddingBlock], paddingBlockStart && paddingStylesMap.paddingBlockStart[paddingBlockStart], paddingBlockEnd && paddingStylesMap.paddingBlockEnd[paddingBlockEnd], paddingInline && paddingStylesMap.paddingInline[paddingInline], paddingInlineStart && paddingStylesMap.paddingInlineStart[paddingInlineStart], paddingInlineEnd && paddingStylesMap.paddingInlineEnd[paddingInlineEnd]],
42
- "data-testid": testId
43
- }), children);
44
- return node;
45
- });
46
- BaseBox.displayName = 'BaseBox';
47
- export default BaseBox;
48
- const baseStyles = css({
49
- boxSizing: 'border-box',
50
- appearance: 'none',
51
- border: 'none'
52
- });
@@ -1,53 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
- import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["as", "className", "children", "backgroundColor", "padding", "paddingBlock", "paddingBlockStart", "paddingBlockEnd", "paddingInline", "paddingInlineStart", "paddingInlineEnd", "style", "testId"];
4
- /* eslint-disable @repo/internal/styles/no-exported-styles */
5
- /** @jsx jsx */
6
- import { forwardRef } from 'react';
7
- import { css, jsx } from '@emotion/react';
8
- import { backgroundColorStylesMap, paddingStylesMap } from '../../xcss/style-maps.partial';
9
-
10
- // Without this type annotation on Box we don't get autocomplete for props due to forwardRef types
11
-
12
- /**
13
- * __Box__
14
- *
15
- * Box is a primitive component that has the design decisions of the Atlassian Design System baked in.
16
- * Renders a `div` by default.
17
- *
18
- * @internal
19
- */
20
- export var BaseBox = /*#__PURE__*/forwardRef(function (_ref, ref) {
21
- var as = _ref.as,
22
- className = _ref.className,
23
- children = _ref.children,
24
- backgroundColor = _ref.backgroundColor,
25
- padding = _ref.padding,
26
- paddingBlock = _ref.paddingBlock,
27
- paddingBlockStart = _ref.paddingBlockStart,
28
- paddingBlockEnd = _ref.paddingBlockEnd,
29
- paddingInline = _ref.paddingInline,
30
- paddingInlineStart = _ref.paddingInlineStart,
31
- paddingInlineEnd = _ref.paddingInlineEnd,
32
- style = _ref.style,
33
- testId = _ref.testId,
34
- htmlAttributes = _objectWithoutProperties(_ref, _excluded);
35
- var Component = as || 'div';
36
- var node = jsx(Component, _extends({
37
- style: style,
38
- ref: ref
39
- // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
40
- }, htmlAttributes, {
41
- className: className,
42
- css: [baseStyles, backgroundColor && backgroundColorStylesMap[backgroundColor], padding && paddingStylesMap.padding[padding], paddingBlock && paddingStylesMap.paddingBlock[paddingBlock], paddingBlockStart && paddingStylesMap.paddingBlockStart[paddingBlockStart], paddingBlockEnd && paddingStylesMap.paddingBlockEnd[paddingBlockEnd], paddingInline && paddingStylesMap.paddingInline[paddingInline], paddingInlineStart && paddingStylesMap.paddingInlineStart[paddingInlineStart], paddingInlineEnd && paddingStylesMap.paddingInlineEnd[paddingInlineEnd]],
43
- "data-testid": testId
44
- }), children);
45
- return node;
46
- });
47
- BaseBox.displayName = 'BaseBox';
48
- export default BaseBox;
49
- var baseStyles = css({
50
- boxSizing: 'border-box',
51
- appearance: 'none',
52
- border: 'none'
53
- });
@@ -1,85 +0,0 @@
1
- /** @jsx jsx */
2
- import { ComponentPropsWithoutRef, ComponentPropsWithRef, ElementType, FC, ReactElement, ReactNode } from 'react';
3
- import { BackgroundColor, type Space } from '../../xcss/style-maps.partial';
4
- import type { BasePrimitiveProps } from '../types';
5
- export type BaseBoxProps<T extends ElementType> = Omit<ComponentPropsWithoutRef<T>, 'as' | 'className'> & BasePrimitiveProps & BaseBoxPropsFoundation<T> & ClassName;
6
- type ClassName = {
7
- /**
8
- * The HTML className attribute.
9
- *
10
- * Before using this prop please ensure:
11
- * - The styles cannot otherwise be achieved through `Box` directly.
12
- * - The use case needs custom styles that cannot be designed or implemented differently
13
- *
14
- * Ensure you're using the `@atlaskit/eslint-plugin-design-system` with this prop to prevent unbounded usage.
15
- *
16
- * @see `@atlaskit/eslint-plugin-design-system`
17
- */
18
- className?: string;
19
- };
20
- export type BaseBoxPropsFoundation<T extends ElementType> = {
21
- /**
22
- * The DOM element to render as the Box. Defaults to `div`.
23
- */
24
- as?: T;
25
- /**
26
- * Elements to be rendered inside the Box.
27
- */
28
- children?: ReactNode;
29
- /**
30
- * Token representing background color with a built-in fallback value.
31
- */
32
- backgroundColor?: BackgroundColor;
33
- /**
34
- * Tokens representing CSS shorthand for `paddingBlock` and `paddingInline` together.
35
- *
36
- * @see paddingBlock
37
- * @see paddingInline
38
- */
39
- padding?: Space;
40
- /**
41
- * Tokens representing CSS shorthand `paddingBlock`.
42
- *
43
- * @see paddingBlockStart
44
- * @see paddingBlockEnd
45
- */
46
- paddingBlock?: Space;
47
- /**
48
- * Tokens representing CSS `paddingBlockStart`.
49
- */
50
- paddingBlockStart?: Space;
51
- /**
52
- * Tokens representing CSS `paddingBlockEnd`.
53
- */
54
- paddingBlockEnd?: Space;
55
- /**
56
- * Tokens representing CSS shorthand `paddingInline`.
57
- *
58
- * @see paddingInlineStart
59
- * @see paddingInlineEnd
60
- */
61
- paddingInline?: Space;
62
- /**
63
- * Tokens representing CSS `paddingInlineStart`.
64
- */
65
- paddingInlineStart?: Space;
66
- /**
67
- * Tokens representing CSS `paddingInlineEnd`.
68
- */
69
- paddingInlineEnd?: Space;
70
- /**
71
- * Forwarded ref element
72
- */
73
- ref?: ComponentPropsWithRef<T>['ref'];
74
- };
75
- export type BaseBoxComponent<T extends ElementType = 'div'> = (<T extends ElementType>(props: BaseBoxProps<T>) => ReactElement | null) & FC<BaseBoxProps<T>>;
76
- /**
77
- * __Box__
78
- *
79
- * Box is a primitive component that has the design decisions of the Atlassian Design System baked in.
80
- * Renders a `div` by default.
81
- *
82
- * @internal
83
- */
84
- export declare const BaseBox: BaseBoxComponent;
85
- export default BaseBox;
@@ -1,85 +0,0 @@
1
- /** @jsx jsx */
2
- import { ComponentPropsWithoutRef, ComponentPropsWithRef, ElementType, FC, ReactElement, ReactNode } from 'react';
3
- import { BackgroundColor, type Space } from '../../xcss/style-maps.partial';
4
- import type { BasePrimitiveProps } from '../types';
5
- export type BaseBoxProps<T extends ElementType> = Omit<ComponentPropsWithoutRef<T>, 'as' | 'className'> & BasePrimitiveProps & BaseBoxPropsFoundation<T> & ClassName;
6
- type ClassName = {
7
- /**
8
- * The HTML className attribute.
9
- *
10
- * Before using this prop please ensure:
11
- * - The styles cannot otherwise be achieved through `Box` directly.
12
- * - The use case needs custom styles that cannot be designed or implemented differently
13
- *
14
- * Ensure you're using the `@atlaskit/eslint-plugin-design-system` with this prop to prevent unbounded usage.
15
- *
16
- * @see `@atlaskit/eslint-plugin-design-system`
17
- */
18
- className?: string;
19
- };
20
- export type BaseBoxPropsFoundation<T extends ElementType> = {
21
- /**
22
- * The DOM element to render as the Box. Defaults to `div`.
23
- */
24
- as?: T;
25
- /**
26
- * Elements to be rendered inside the Box.
27
- */
28
- children?: ReactNode;
29
- /**
30
- * Token representing background color with a built-in fallback value.
31
- */
32
- backgroundColor?: BackgroundColor;
33
- /**
34
- * Tokens representing CSS shorthand for `paddingBlock` and `paddingInline` together.
35
- *
36
- * @see paddingBlock
37
- * @see paddingInline
38
- */
39
- padding?: Space;
40
- /**
41
- * Tokens representing CSS shorthand `paddingBlock`.
42
- *
43
- * @see paddingBlockStart
44
- * @see paddingBlockEnd
45
- */
46
- paddingBlock?: Space;
47
- /**
48
- * Tokens representing CSS `paddingBlockStart`.
49
- */
50
- paddingBlockStart?: Space;
51
- /**
52
- * Tokens representing CSS `paddingBlockEnd`.
53
- */
54
- paddingBlockEnd?: Space;
55
- /**
56
- * Tokens representing CSS shorthand `paddingInline`.
57
- *
58
- * @see paddingInlineStart
59
- * @see paddingInlineEnd
60
- */
61
- paddingInline?: Space;
62
- /**
63
- * Tokens representing CSS `paddingInlineStart`.
64
- */
65
- paddingInlineStart?: Space;
66
- /**
67
- * Tokens representing CSS `paddingInlineEnd`.
68
- */
69
- paddingInlineEnd?: Space;
70
- /**
71
- * Forwarded ref element
72
- */
73
- ref?: ComponentPropsWithRef<T>['ref'];
74
- };
75
- export type BaseBoxComponent<T extends ElementType = 'div'> = (<T extends ElementType>(props: BaseBoxProps<T>) => ReactElement | null) & FC<BaseBoxProps<T>>;
76
- /**
77
- * __Box__
78
- *
79
- * Box is a primitive component that has the design decisions of the Atlassian Design System baked in.
80
- * Renders a `div` by default.
81
- *
82
- * @internal
83
- */
84
- export declare const BaseBox: BaseBoxComponent;
85
- export default BaseBox;