@atlaskit/primitives 1.8.0 → 1.9.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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/primitives
2
2
 
3
+ ## 1.9.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#42494](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/42494) [`8cc2926465e`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8cc2926465e) - Removed the ability to use the `style` prop on primitives such as Inline, Stack, and Flex. This prop previously had no effect on these components and is now only allowed on Box.
8
+
3
9
  ## 1.8.0
4
10
 
5
11
  ### Minor Changes
@@ -2,12 +2,12 @@
2
2
  import { ComponentPropsWithoutRef, ComponentPropsWithRef, ReactElement, ReactNode } from 'react';
3
3
  import { BackgroundColor, type Space } from '../xcss/style-maps.partial';
4
4
  import { SVGElements } from './internal/types';
5
- import type { BasePrimitiveProps } from './types';
5
+ import type { BasePrimitiveProps, StyleProp } from './types';
6
6
  type AllowedElements = Exclude<keyof JSX.IntrinsicElements, SVGElements>;
7
7
  type CustomElementType<P = any> = {
8
8
  [K in AllowedElements]: P extends JSX.IntrinsicElements[K] ? K : never;
9
9
  }[AllowedElements];
10
- export type BoxProps<T extends CustomElementType> = Omit<ComponentPropsWithoutRef<T>, 'as' | 'className'> & BasePrimitiveProps & BaseBoxProps<T>;
10
+ export type BoxProps<T extends CustomElementType> = Omit<ComponentPropsWithoutRef<T>, 'as' | 'className'> & BasePrimitiveProps & StyleProp & BaseBoxProps<T>;
11
11
  type BaseBoxProps<T extends CustomElementType> = {
12
12
  /**
13
13
  * The DOM element to render as the Box. Defaults to `div`.
@@ -5,11 +5,6 @@ export type BasePrimitiveProps = {
5
5
  * A unique string that appears as data attribute `data-testid` in the rendered code, serving as a hook for automated tests.
6
6
  */
7
7
  testId?: string;
8
- /**
9
- * Inline styles to be applied to the primitive. Only apply as a last resort, or where
10
- * styles cannot otherwise be calculated outside of the runtime of the component they're applied.
11
- */
12
- style?: CSSProperties;
13
8
  /**
14
9
  * Apply a subset of permitted styles, powered by Atlassian Design System tokens.
15
10
  */
@@ -19,6 +14,13 @@ export type BasePrimitiveProps = {
19
14
  */
20
15
  role?: string;
21
16
  };
17
+ export type StyleProp = {
18
+ /**
19
+ * Inline styles to be applied to the primitive. Only apply as a last resort, or where
20
+ * styles cannot otherwise be calculated outside of the runtime of the component they're applied.
21
+ */
22
+ style?: CSSProperties;
23
+ };
22
24
  export type AlignInline = 'start' | 'center' | 'end' | 'stretch';
23
25
  export type AlignBlock = 'start' | 'center' | 'end' | 'baseline' | 'stretch';
24
26
  export type Spread = 'space-between';
@@ -2,12 +2,12 @@
2
2
  import { ComponentPropsWithoutRef, ComponentPropsWithRef, ReactElement, ReactNode } from 'react';
3
3
  import { BackgroundColor, type Space } from '../xcss/style-maps.partial';
4
4
  import { SVGElements } from './internal/types';
5
- import type { BasePrimitiveProps } from './types';
5
+ import type { BasePrimitiveProps, StyleProp } from './types';
6
6
  type AllowedElements = Exclude<keyof JSX.IntrinsicElements, SVGElements>;
7
7
  type CustomElementType<P = any> = {
8
8
  [K in AllowedElements]: P extends JSX.IntrinsicElements[K] ? K : never;
9
9
  }[AllowedElements];
10
- export type BoxProps<T extends CustomElementType> = Omit<ComponentPropsWithoutRef<T>, 'as' | 'className'> & BasePrimitiveProps & BaseBoxProps<T>;
10
+ export type BoxProps<T extends CustomElementType> = Omit<ComponentPropsWithoutRef<T>, 'as' | 'className'> & BasePrimitiveProps & StyleProp & BaseBoxProps<T>;
11
11
  type BaseBoxProps<T extends CustomElementType> = {
12
12
  /**
13
13
  * The DOM element to render as the Box. Defaults to `div`.
@@ -5,11 +5,6 @@ export type BasePrimitiveProps = {
5
5
  * A unique string that appears as data attribute `data-testid` in the rendered code, serving as a hook for automated tests.
6
6
  */
7
7
  testId?: string;
8
- /**
9
- * Inline styles to be applied to the primitive. Only apply as a last resort, or where
10
- * styles cannot otherwise be calculated outside of the runtime of the component they're applied.
11
- */
12
- style?: CSSProperties;
13
8
  /**
14
9
  * Apply a subset of permitted styles, powered by Atlassian Design System tokens.
15
10
  */
@@ -19,6 +14,13 @@ export type BasePrimitiveProps = {
19
14
  */
20
15
  role?: string;
21
16
  };
17
+ export type StyleProp = {
18
+ /**
19
+ * Inline styles to be applied to the primitive. Only apply as a last resort, or where
20
+ * styles cannot otherwise be calculated outside of the runtime of the component they're applied.
21
+ */
22
+ style?: CSSProperties;
23
+ };
22
24
  export type AlignInline = 'start' | 'center' | 'end' | 'stretch';
23
25
  export type AlignBlock = 'start' | 'center' | 'end' | 'baseline' | 'stretch';
24
26
  export type Spread = 'space-between';
@@ -1,7 +1,7 @@
1
1
  // TODO: Switch from ERT to ts-morph when this is completed and has reasonable adoption: https://product-fabric.atlassian.net/browse/DSP-10364
2
2
  import React, { ElementType, ReactNode } from 'react';
3
3
 
4
- import { BasePrimitiveProps } from '../src/components/types';
4
+ import { BasePrimitiveProps, StyleProp } from '../src/components/types';
5
5
 
6
6
  // eslint-disable-next-line @typescript-eslint/no-namespace
7
7
  namespace Token {
@@ -84,5 +84,6 @@ export default function Box(
84
84
  * Forwarded ref element.
85
85
  */
86
86
  ref?: React.ComponentPropsWithRef<ElementType>['ref'];
87
- } & BasePrimitiveProps,
87
+ } & BasePrimitiveProps &
88
+ StyleProp,
88
89
  ) {}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/primitives",
3
- "version": "1.8.0",
3
+ "version": "1.9.0",
4
4
  "description": "Primitives are token-backed low-level building blocks.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
package/report.api.md CHANGED
@@ -313,7 +313,6 @@ type BaseBoxProps<T extends CustomElementType> = {
313
313
  // @public (undocumented)
314
314
  type BasePrimitiveProps = {
315
315
  testId?: string;
316
- style?: CSSProperties;
317
316
  xcss?: Array<XCSS | false | undefined> | XCSS;
318
317
  role?: string;
319
318
  };
@@ -407,6 +406,7 @@ export type BoxProps<T extends CustomElementType> = Omit<
407
406
  'as' | 'className'
408
407
  > &
409
408
  BasePrimitiveProps &
409
+ StyleProp &
410
410
  BaseBoxProps<T>;
411
411
 
412
412
  // @public
@@ -974,6 +974,11 @@ export type StackProps<T extends ElementType = 'div'> = {
974
974
  ref?: React.ComponentPropsWithRef<T>['ref'];
975
975
  } & BasePrimitiveProps;
976
976
 
977
+ // @public (undocumented)
978
+ type StyleProp = {
979
+ style?: CSSProperties;
980
+ };
981
+
977
982
  // @public (undocumented)
978
983
  type SVGElements =
979
984
  | 'animate'
@@ -297,7 +297,6 @@ type BaseBoxProps<T extends CustomElementType> = {
297
297
  // @public (undocumented)
298
298
  type BasePrimitiveProps = {
299
299
  testId?: string;
300
- style?: CSSProperties;
301
300
  xcss?: Array<XCSS | false | undefined> | XCSS;
302
301
  role?: string;
303
302
  };
@@ -375,7 +374,7 @@ export const Box: BoxComponent;
375
374
  type BoxComponent = <T extends CustomElementType>(props: BoxProps<T>) => ReactElement | null;
376
375
 
377
376
  // @public (undocumented)
378
- export type BoxProps<T extends CustomElementType> = Omit<ComponentPropsWithoutRef<T>, 'as' | 'className'> & BasePrimitiveProps & BaseBoxProps<T>;
377
+ export type BoxProps<T extends CustomElementType> = Omit<ComponentPropsWithoutRef<T>, 'as' | 'className'> & BasePrimitiveProps & StyleProp & BaseBoxProps<T>;
379
378
 
380
379
  // @public
381
380
  export type Breakpoint = 'lg' | 'md' | 'sm' | 'xl' | 'xs' | 'xxs';
@@ -687,6 +686,11 @@ export type StackProps<T extends ElementType = 'div'> = {
687
686
  ref?: React.ComponentPropsWithRef<T>['ref'];
688
687
  } & BasePrimitiveProps;
689
688
 
689
+ // @public (undocumented)
690
+ type StyleProp = {
691
+ style?: CSSProperties;
692
+ };
693
+
690
694
  // @public (undocumented)
691
695
  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';
692
696