@atlaskit/primitives 4.1.1 → 5.0.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,17 @@
1
1
  # @atlaskit/primitives
2
2
 
3
+ ## 5.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - [#81744](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/81744) [`30e3d8c81030`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/30e3d8c81030) - Replaced `Text`'s `variant` prop with a `size` prop. The `size` prop takes three values: `"small"`, `"medium"` (default), and `"large"`.
8
+
9
+ Migration guide:
10
+
11
+ - `variant="body.small"` -> `size="small"`
12
+ - `variant="body"` -> `size="medium"` (Note: Since medium is the default, the size prop can be omitted here)
13
+ - `variant="body.large"` -> `size="large"`
14
+
3
15
  ## 4.1.1
4
16
 
5
17
  ### Patch Changes
@@ -10,6 +10,7 @@ import GridTemplate from '../../examples/constellation/grid/template';
10
10
  import GridTemplateArea from '../../examples/constellation/grid/template-area';
11
11
  import GridTemplateRow from '../../examples/constellation/grid/template-row';
12
12
  import GridAutoFlow from '../../examples/constellation/grid/auto-flow';
13
+ import ResponsiveGrid from '../../examples/constellation/grid/responsive';
13
14
 
14
15
  import { CodeDocsHeader } from '@af/design-system-docs-ui';
15
16
 
@@ -61,7 +62,12 @@ Grid-prefixed properties in CSS do not have this prefix in the component API. `g
61
62
 
62
63
  <Example Component={GridAutoFlow} packageName="@atlaskit/primitives/grid" />
63
64
 
65
+ ## Responsive grid
66
+
67
+ Here, we construct a grid layout that adapts from a single column to a four-column layout depending on the viewport size.
68
+
69
+ <Example Component={ResponsiveGrid} packageName="@atlaskit/primitives/grid" />
70
+
64
71
  You may also be looking for:
65
72
 
66
- - [responsive layout grid](/components/grid)
67
73
  - [legacy page grid](/components/page/grid)
@@ -76,7 +76,7 @@ var Anchor = function Anchor(_ref, ref) {
76
76
  action: 'clicked',
77
77
  componentName: componentName || 'Anchor',
78
78
  packageName: "@atlaskit/primitives",
79
- packageVersion: "4.1.1",
79
+ packageVersion: "5.0.0",
80
80
  analyticsData: analyticsContext,
81
81
  actionSubject: 'link'
82
82
  });
@@ -80,7 +80,7 @@ var UNSAFE_PRESSABLE = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref)
80
80
  action: 'clicked',
81
81
  componentName: componentName || 'Pressable',
82
82
  packageName: "@atlaskit/primitives",
83
- packageVersion: "4.1.1",
83
+ packageVersion: "5.0.0",
84
84
  analyticsData: analyticsContext,
85
85
  actionSubject: 'button'
86
86
  });
@@ -47,11 +47,6 @@ var wordBreakMap = {
47
47
  wordBreak: 'break-all'
48
48
  })
49
49
  };
50
- var tempVariantSizeMap = {
51
- body: 'medium',
52
- 'body.small': 'small',
53
- 'body.large': 'large'
54
- };
55
50
  var HasTextAncestorContext = /*#__PURE__*/(0, _react.createContext)(false);
56
51
  var useHasTextAncestor = function useHasTextAncestor() {
57
52
  return (0, _react.useContext)(HasTextAncestorContext);
@@ -99,15 +94,13 @@ var Text = function Text(_ref) {
99
94
  id = props.id,
100
95
  _props$size = props.size,
101
96
  size = _props$size === void 0 ? 'medium' : _props$size,
102
- variant = props.variant,
103
97
  weight = props.weight,
104
98
  maxLines = props.maxLines;
105
99
  (0, _tinyInvariant.default)(asAllowlist.includes(Component), "@atlaskit/primitives: Text received an invalid \"as\" value of \"".concat(Component, "\""));
106
- var localSize = variant && tempVariantSizeMap[variant] || size;
107
100
  var hasTextAncestor = useHasTextAncestor();
108
101
  var color = useColor(colorProp, hasTextAncestor);
109
102
  var component = (0, _react2.jsx)(Component, {
110
- css: [resetStyles, _styleMaps.fontStylesMap[localSize], color && _styleMaps.textColorStylesMap[color], maxLines && truncationStyles, maxLines === 1 && wordBreakMap.breakAll, textAlign && textAlignMap[textAlign], weight && _styleMaps.fontWeightStylesMap[weight], Component === 'em' && emStyles, Component === 'strong' && strongStyles],
103
+ css: [resetStyles, _styleMaps.fontStylesMap[size], color && _styleMaps.textColorStylesMap[color], maxLines && truncationStyles, maxLines === 1 && wordBreakMap.breakAll, textAlign && textAlignMap[textAlign], weight && _styleMaps.fontWeightStylesMap[weight], Component === 'em' && emStyles, Component === 'strong' && strongStyles],
111
104
  style: {
112
105
  WebkitLineClamp: maxLines
113
106
  },
@@ -62,7 +62,7 @@ const Anchor = ({
62
62
  action: 'clicked',
63
63
  componentName: componentName || 'Anchor',
64
64
  packageName: "@atlaskit/primitives",
65
- packageVersion: "4.1.1",
65
+ packageVersion: "5.0.0",
66
66
  analyticsData: analyticsContext,
67
67
  actionSubject: 'link'
68
68
  });
@@ -66,7 +66,7 @@ const UNSAFE_PRESSABLE = /*#__PURE__*/forwardRef(({
66
66
  action: 'clicked',
67
67
  componentName: componentName || 'Pressable',
68
68
  packageName: "@atlaskit/primitives",
69
- packageVersion: "4.1.1",
69
+ packageVersion: "5.0.0",
70
70
  analyticsData: analyticsContext,
71
71
  actionSubject: 'button'
72
72
  });
@@ -38,11 +38,6 @@ const wordBreakMap = {
38
38
  wordBreak: 'break-all'
39
39
  })
40
40
  };
41
- const tempVariantSizeMap = {
42
- body: 'medium',
43
- 'body.small': 'small',
44
- 'body.large': 'large'
45
- };
46
41
  const HasTextAncestorContext = /*#__PURE__*/createContext(false);
47
42
  const useHasTextAncestor = () => useContext(HasTextAncestorContext);
48
43
 
@@ -88,16 +83,14 @@ const Text = ({
88
83
  testId,
89
84
  id,
90
85
  size = 'medium',
91
- variant,
92
86
  weight,
93
87
  maxLines
94
88
  } = props;
95
89
  invariant(asAllowlist.includes(Component), `@atlaskit/primitives: Text received an invalid "as" value of "${Component}"`);
96
- const localSize = variant && tempVariantSizeMap[variant] || size;
97
90
  const hasTextAncestor = useHasTextAncestor();
98
91
  const color = useColor(colorProp, hasTextAncestor);
99
92
  const component = jsx(Component, {
100
- css: [resetStyles, fontStylesMap[localSize], color && textColorStylesMap[color], maxLines && truncationStyles, maxLines === 1 && wordBreakMap.breakAll, textAlign && textAlignMap[textAlign], weight && fontWeightStylesMap[weight], Component === 'em' && emStyles, Component === 'strong' && strongStyles],
93
+ css: [resetStyles, fontStylesMap[size], color && textColorStylesMap[color], maxLines && truncationStyles, maxLines === 1 && wordBreakMap.breakAll, textAlign && textAlignMap[textAlign], weight && fontWeightStylesMap[weight], Component === 'em' && emStyles, Component === 'strong' && strongStyles],
101
94
  style: {
102
95
  WebkitLineClamp: maxLines
103
96
  },
@@ -66,7 +66,7 @@ var Anchor = function Anchor(_ref, ref) {
66
66
  action: 'clicked',
67
67
  componentName: componentName || 'Anchor',
68
68
  packageName: "@atlaskit/primitives",
69
- packageVersion: "4.1.1",
69
+ packageVersion: "5.0.0",
70
70
  analyticsData: analyticsContext,
71
71
  actionSubject: 'link'
72
72
  });
@@ -70,7 +70,7 @@ var UNSAFE_PRESSABLE = /*#__PURE__*/forwardRef(function (_ref, ref) {
70
70
  action: 'clicked',
71
71
  componentName: componentName || 'Pressable',
72
72
  packageName: "@atlaskit/primitives",
73
- packageVersion: "4.1.1",
73
+ packageVersion: "5.0.0",
74
74
  analyticsData: analyticsContext,
75
75
  actionSubject: 'button'
76
76
  });
@@ -40,11 +40,6 @@ var wordBreakMap = {
40
40
  wordBreak: 'break-all'
41
41
  })
42
42
  };
43
- var tempVariantSizeMap = {
44
- body: 'medium',
45
- 'body.small': 'small',
46
- 'body.large': 'large'
47
- };
48
43
  var HasTextAncestorContext = /*#__PURE__*/createContext(false);
49
44
  var useHasTextAncestor = function useHasTextAncestor() {
50
45
  return useContext(HasTextAncestorContext);
@@ -92,15 +87,13 @@ var Text = function Text(_ref) {
92
87
  id = props.id,
93
88
  _props$size = props.size,
94
89
  size = _props$size === void 0 ? 'medium' : _props$size,
95
- variant = props.variant,
96
90
  weight = props.weight,
97
91
  maxLines = props.maxLines;
98
92
  invariant(asAllowlist.includes(Component), "@atlaskit/primitives: Text received an invalid \"as\" value of \"".concat(Component, "\""));
99
- var localSize = variant && tempVariantSizeMap[variant] || size;
100
93
  var hasTextAncestor = useHasTextAncestor();
101
94
  var color = useColor(colorProp, hasTextAncestor);
102
95
  var component = jsx(Component, {
103
- css: [resetStyles, fontStylesMap[localSize], color && textColorStylesMap[color], maxLines && truncationStyles, maxLines === 1 && wordBreakMap.breakAll, textAlign && textAlignMap[textAlign], weight && fontWeightStylesMap[weight], Component === 'em' && emStyles, Component === 'strong' && strongStyles],
96
+ css: [resetStyles, fontStylesMap[size], color && textColorStylesMap[color], maxLines && truncationStyles, maxLines === 1 && wordBreakMap.breakAll, textAlign && textAlignMap[textAlign], weight && fontWeightStylesMap[weight], Component === 'em' && emStyles, Component === 'strong' && strongStyles],
104
97
  style: {
105
98
  WebkitLineClamp: maxLines
106
99
  },
@@ -33,10 +33,6 @@ type TextPropsBase = {
33
33
  * The [HTML `text-align` attribute](https://developer.mozilla.org/en-US/docs/Web/CSS/text-align).
34
34
  */
35
35
  textAlign?: TextAlign;
36
- /**
37
- * @deprecated. Use size instead.
38
- */
39
- variant?: 'body' | 'body.small' | 'body.large';
40
36
  /**
41
37
  * Text size.
42
38
  */
@@ -38,10 +38,6 @@ type TextPropsBase = {
38
38
  * The [HTML `text-align` attribute](https://developer.mozilla.org/en-US/docs/Web/CSS/text-align).
39
39
  */
40
40
  textAlign?: TextAlign;
41
- /**
42
- * @deprecated. Use size instead.
43
- */
44
- variant?: 'body' | 'body.small' | 'body.large';
45
41
  /**
46
42
  * Text size.
47
43
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/primitives",
3
- "version": "4.1.1",
3
+ "version": "5.0.0",
4
4
  "description": "Primitives are token-backed low-level building blocks.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"