@atlaskit/primitives 14.3.3 → 14.5.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 +19 -0
- package/constellation/anchor/examples.mdx +1 -0
- package/dist/cjs/compiled/components/anchor.js +1 -1
- package/dist/cjs/compiled/components/box.js +0 -1
- package/dist/cjs/compiled/components/pressable.js +1 -3
- package/dist/cjs/compiled/components/text.js +9 -29
- package/dist/cjs/components/anchor.js +2 -4
- package/dist/cjs/components/bleed.js +1 -3
- package/dist/cjs/components/box.js +1 -4
- package/dist/cjs/components/flex.js +1 -3
- package/dist/cjs/components/grid.js +1 -3
- package/dist/cjs/components/inline.js +0 -1
- package/dist/cjs/components/pressable.js +32 -38
- package/dist/cjs/components/stack.js +0 -1
- package/dist/cjs/components/text.js +8 -26
- package/dist/cjs/xcss/xcss.js +1 -2
- package/dist/es2019/compiled/components/anchor.js +1 -1
- package/dist/es2019/compiled/components/box.js +0 -1
- package/dist/es2019/compiled/components/pressable.js +1 -3
- package/dist/es2019/compiled/components/text.js +9 -29
- package/dist/es2019/components/anchor.js +2 -4
- package/dist/es2019/components/bleed.js +1 -3
- package/dist/es2019/components/box.js +1 -4
- package/dist/es2019/components/flex.js +1 -3
- package/dist/es2019/components/grid.js +1 -3
- package/dist/es2019/components/inline.js +0 -1
- package/dist/es2019/components/pressable.js +32 -38
- package/dist/es2019/components/stack.js +0 -1
- package/dist/es2019/components/text.js +8 -26
- package/dist/es2019/responsive/build-media-query-css.js +1 -1
- package/dist/es2019/xcss/xcss.js +0 -4
- package/dist/esm/compiled/components/anchor.js +1 -1
- package/dist/esm/compiled/components/box.js +0 -1
- package/dist/esm/compiled/components/pressable.js +1 -3
- package/dist/esm/compiled/components/text.js +9 -29
- package/dist/esm/components/anchor.js +2 -4
- package/dist/esm/components/bleed.js +1 -3
- package/dist/esm/components/box.js +1 -4
- package/dist/esm/components/flex.js +1 -3
- package/dist/esm/components/grid.js +1 -3
- package/dist/esm/components/inline.js +0 -1
- package/dist/esm/components/pressable.js +32 -38
- package/dist/esm/components/stack.js +0 -1
- package/dist/esm/components/text.js +8 -26
- package/dist/esm/xcss/xcss.js +0 -4
- package/dist/types/compiled/components/box.d.ts +8 -4
- package/dist/types/components/box.d.ts +5 -1
- package/dist/types-ts4.5/compiled/components/box.d.ts +8 -4
- package/dist/types-ts4.5/components/box.d.ts +5 -1
- package/package.json +13 -19
|
@@ -85,7 +85,7 @@ const Pressable = /*#__PURE__*/forwardRef(({
|
|
|
85
85
|
action: 'clicked',
|
|
86
86
|
componentName: componentName || 'Pressable',
|
|
87
87
|
packageName: "@atlaskit/primitives",
|
|
88
|
-
packageVersion: "14.
|
|
88
|
+
packageVersion: "14.5.0",
|
|
89
89
|
analyticsData: analyticsContext,
|
|
90
90
|
actionSubject: 'button'
|
|
91
91
|
});
|
|
@@ -97,42 +97,36 @@ const Pressable = /*#__PURE__*/forwardRef(({
|
|
|
97
97
|
...safeHtmlAttributes
|
|
98
98
|
} = htmlAttributes;
|
|
99
99
|
const resolvedStyles = parseXcss(xcss);
|
|
100
|
-
return (
|
|
101
|
-
// eslint-disable-next-line @atlaskit/
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
paddingInlineEnd && paddingStylesMap.paddingInlineEnd[paddingInlineEnd],
|
|
132
|
-
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
133
|
-
resolvedStyles.emotion],
|
|
134
|
-
"data-testid": testId
|
|
135
|
-
}), children)
|
|
136
|
-
);
|
|
100
|
+
return jsx("button", _extends({
|
|
101
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
102
|
+
style: style,
|
|
103
|
+
ref: ref
|
|
104
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
105
|
+
,
|
|
106
|
+
className: resolvedStyles.static
|
|
107
|
+
}, safeHtmlAttributes, {
|
|
108
|
+
// eslint-disable-next-line react/button-has-type
|
|
109
|
+
type: type,
|
|
110
|
+
onClick: onClick,
|
|
111
|
+
disabled: isDisabled,
|
|
112
|
+
css: [baseStyles, focusRingStyles, isDisabled ? disabledStyles : enabledStyles,
|
|
113
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
114
|
+
backgroundColor && backgroundColorStylesMap[backgroundColor],
|
|
115
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
116
|
+
padding && paddingStylesMap.padding[padding],
|
|
117
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
118
|
+
paddingBlock && paddingStylesMap.paddingBlock[paddingBlock],
|
|
119
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
120
|
+
paddingBlockStart && paddingStylesMap.paddingBlockStart[paddingBlockStart],
|
|
121
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
122
|
+
paddingBlockEnd && paddingStylesMap.paddingBlockEnd[paddingBlockEnd],
|
|
123
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
124
|
+
paddingInline && paddingStylesMap.paddingInline[paddingInline],
|
|
125
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
126
|
+
paddingInlineStart && paddingStylesMap.paddingInlineStart[paddingInlineStart],
|
|
127
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
128
|
+
paddingInlineEnd && paddingStylesMap.paddingInlineEnd[paddingInlineEnd], resolvedStyles.emotion],
|
|
129
|
+
"data-testid": testId
|
|
130
|
+
}), children);
|
|
137
131
|
});
|
|
138
132
|
export default Pressable;
|
|
@@ -7,7 +7,6 @@ import { forwardRef } from 'react';
|
|
|
7
7
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
8
8
|
import { css, jsx } from '@emotion/react';
|
|
9
9
|
import invariant from 'tiny-invariant';
|
|
10
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
11
10
|
import { HasTextAncestorProvider, useHasTextAncestor } from '../utils/has-text-ancestor-context';
|
|
12
11
|
import { useSurface } from '../utils/surface-provider';
|
|
13
12
|
import { inverseColorMap, textColorStylesMap, textSizeStylesMap, textWeightStylesMap } from '../xcss/style-maps.partial';
|
|
@@ -52,36 +51,19 @@ const wordBreakMap = {
|
|
|
52
51
|
*/
|
|
53
52
|
const useColor = (colorProp, hasTextAncestor) => {
|
|
54
53
|
const surface = useSurface();
|
|
55
|
-
if (fg('platform-typography-improved-color-control')) {
|
|
56
|
-
if (colorProp === 'inherit') {
|
|
57
|
-
return undefined;
|
|
58
|
-
}
|
|
59
|
-
if (colorProp) {
|
|
60
|
-
return colorProp;
|
|
61
|
-
}
|
|
62
|
-
if (hasTextAncestor) {
|
|
63
|
-
return undefined;
|
|
64
|
-
}
|
|
65
|
-
if (inverseColorMap.hasOwnProperty(surface)) {
|
|
66
|
-
return inverseColorMap[surface];
|
|
67
|
-
}
|
|
68
|
-
return 'color.text';
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Where the color of the surface is inverted we always override the color
|
|
73
|
-
* as there is no valid choice that is not covered by the override.
|
|
74
|
-
*/
|
|
75
|
-
if (inverseColorMap.hasOwnProperty(surface)) {
|
|
76
|
-
return inverseColorMap[surface];
|
|
77
|
-
}
|
|
78
54
|
if (colorProp === 'inherit') {
|
|
79
55
|
return undefined;
|
|
80
56
|
}
|
|
81
|
-
if (
|
|
57
|
+
if (colorProp) {
|
|
58
|
+
return colorProp;
|
|
59
|
+
}
|
|
60
|
+
if (hasTextAncestor) {
|
|
82
61
|
return undefined;
|
|
83
62
|
}
|
|
84
|
-
|
|
63
|
+
if (inverseColorMap.hasOwnProperty(surface)) {
|
|
64
|
+
return inverseColorMap[surface];
|
|
65
|
+
}
|
|
66
|
+
return 'color.text';
|
|
85
67
|
};
|
|
86
68
|
|
|
87
69
|
/**
|
|
@@ -69,7 +69,7 @@ export const UNSAFE_buildBelowMediaQueryCSS = input => {
|
|
|
69
69
|
return {
|
|
70
70
|
...acc,
|
|
71
71
|
[breakpoint]: css({
|
|
72
|
-
// eslint-disable-next-line @atlaskit/
|
|
72
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
73
73
|
[UNSAFE_media.below[breakpoint]]: typeof input === 'function' ? input(breakpoint) : input
|
|
74
74
|
})
|
|
75
75
|
};
|
package/dist/es2019/xcss/xcss.js
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
|
|
2
1
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
3
2
|
import { css as cssEmotion } from '@emotion/react';
|
|
4
|
-
|
|
5
|
-
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
6
|
-
|
|
7
3
|
import { allSpaceMap, backgroundColorMap, borderColorMap, borderRadiusMap, borderWidthMap, dimensionMap, fontFamilyMap, fontMap, fontWeightMap, layerMap, opacityMap, positiveSpaceMap, shadowMap, textColorMap } from './style-maps.partial';
|
|
8
4
|
export const tokensMap = {
|
|
9
5
|
backgroundColor: backgroundColorMap,
|
|
@@ -60,7 +60,7 @@ var AnchorNoRef = function AnchorNoRef(_ref, ref) {
|
|
|
60
60
|
action: 'clicked',
|
|
61
61
|
componentName: componentName || 'Anchor',
|
|
62
62
|
packageName: "@atlaskit/primitives",
|
|
63
|
-
packageVersion: "14.
|
|
63
|
+
packageVersion: "14.5.0",
|
|
64
64
|
analyticsData: analyticsContext,
|
|
65
65
|
actionSubject: 'link'
|
|
66
66
|
});
|
|
@@ -336,7 +336,6 @@ var Box = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
336
336
|
,
|
|
337
337
|
ref: ref,
|
|
338
338
|
className: ax(["_19itglyw _vchhusvi _r06hglyw", backgroundColor && backgroundColorMap[backgroundColor], backgroundColor && isSurfaceToken(backgroundColor) && setSurfaceTokenMap[backgroundColor], paddingBlockStart && paddingBlockStartMap[paddingBlockStart], paddingBlockEnd && paddingBlockEndMap[paddingBlockEnd], paddingInlineStart && paddingInlineStartMap[paddingInlineStart], paddingInlineEnd && paddingInlineEndMap[paddingInlineEnd], xcss])
|
|
339
|
-
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
340
339
|
}, safeHtmlAttributes, {
|
|
341
340
|
"data-testid": testId
|
|
342
341
|
}), children);
|
|
@@ -50,7 +50,7 @@ var Pressable = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
50
50
|
action: 'clicked',
|
|
51
51
|
componentName: componentName || 'Pressable',
|
|
52
52
|
packageName: "@atlaskit/primitives",
|
|
53
|
-
packageVersion: "14.
|
|
53
|
+
packageVersion: "14.5.0",
|
|
54
54
|
analyticsData: analyticsContext,
|
|
55
55
|
actionSubject: 'button'
|
|
56
56
|
});
|
|
@@ -66,9 +66,7 @@ var Pressable = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
66
66
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- TODO: Properly type this and allow pass-through if we can determine the type
|
|
67
67
|
,
|
|
68
68
|
style: style
|
|
69
|
-
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
70
69
|
}, safeHtmlAttributes, {
|
|
71
|
-
// eslint-disable-next-line react/button-has-type
|
|
72
70
|
type: type,
|
|
73
71
|
onClick: onClick,
|
|
74
72
|
disabled: isDisabled,
|
|
@@ -4,7 +4,6 @@ import * as React from 'react';
|
|
|
4
4
|
import { ax, ix } from "@compiled/react/runtime";
|
|
5
5
|
import { forwardRef } from 'react';
|
|
6
6
|
import invariant from 'tiny-invariant';
|
|
7
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
7
|
import { HasTextAncestorProvider, useHasTextAncestor } from '../../utils/has-text-ancestor-context';
|
|
9
8
|
import { useSurface } from '../../utils/surface-provider';
|
|
10
9
|
var asAllowlist = ['span', 'p', 'strong', 'em'];
|
|
@@ -13,36 +12,19 @@ var asAllowlist = ['span', 'p', 'strong', 'em'];
|
|
|
13
12
|
*/
|
|
14
13
|
var useColor = function useColor(colorProp, hasTextAncestor) {
|
|
15
14
|
var surface = useSurface();
|
|
16
|
-
if (fg('platform-typography-improved-color-control')) {
|
|
17
|
-
if (colorProp === 'inherit') {
|
|
18
|
-
return undefined;
|
|
19
|
-
}
|
|
20
|
-
if (colorProp) {
|
|
21
|
-
return colorProp;
|
|
22
|
-
}
|
|
23
|
-
if (hasTextAncestor) {
|
|
24
|
-
return undefined;
|
|
25
|
-
}
|
|
26
|
-
if (inverseColorMap.hasOwnProperty(surface)) {
|
|
27
|
-
return inverseColorMap[surface];
|
|
28
|
-
}
|
|
29
|
-
return 'color.text';
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/*
|
|
33
|
-
* Where the color of the surface is inverted we always override the color
|
|
34
|
-
* as there is no valid choice that is not covered by the override.
|
|
35
|
-
*/
|
|
36
|
-
if (surface in inverseColorMap) {
|
|
37
|
-
return inverseColorMap[surface];
|
|
38
|
-
}
|
|
39
15
|
if (colorProp === 'inherit') {
|
|
40
16
|
return undefined;
|
|
41
17
|
}
|
|
42
|
-
if (
|
|
18
|
+
if (colorProp) {
|
|
19
|
+
return colorProp;
|
|
20
|
+
}
|
|
21
|
+
if (hasTextAncestor) {
|
|
43
22
|
return undefined;
|
|
44
23
|
}
|
|
45
|
-
|
|
24
|
+
if (inverseColorMap.hasOwnProperty(surface)) {
|
|
25
|
+
return inverseColorMap[surface];
|
|
26
|
+
}
|
|
27
|
+
return 'color.text';
|
|
46
28
|
};
|
|
47
29
|
var styles = {
|
|
48
30
|
root: "_19pkidpf _2hwxidpf _otyridpf _18u0idpf _1i4qfg65",
|
|
@@ -163,9 +145,7 @@ var Text = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
163
145
|
size = 'medium';
|
|
164
146
|
}
|
|
165
147
|
var component = /*#__PURE__*/React.createElement(Component, {
|
|
166
|
-
id: id
|
|
167
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
168
|
-
,
|
|
148
|
+
id: id,
|
|
169
149
|
className: ax([styles.root, size && fontSizeMap[size], color && textColorMap[color], maxLines && styles.truncation, maxLines === 1 && styles.breakAll, align && styles["textAlign.".concat(align)], weight && fontWeightMap[weight], Component === 'em' && styles['as.em'], Component === 'strong' && styles['as.strong'], xcss]),
|
|
170
150
|
style: {
|
|
171
151
|
WebkitLineClamp: maxLines
|
|
@@ -94,7 +94,7 @@ var AnchorNoRef = function AnchorNoRef(_ref, ref) {
|
|
|
94
94
|
action: 'clicked',
|
|
95
95
|
componentName: componentName || 'Anchor',
|
|
96
96
|
packageName: "@atlaskit/primitives",
|
|
97
|
-
packageVersion: "14.
|
|
97
|
+
packageVersion: "14.5.0",
|
|
98
98
|
analyticsData: analyticsContext,
|
|
99
99
|
actionSubject: 'link'
|
|
100
100
|
});
|
|
@@ -152,9 +152,7 @@ var AnchorNoRef = function AnchorNoRef(_ref, ref) {
|
|
|
152
152
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
153
153
|
paddingInlineStart && paddingStylesMap.paddingInlineStart[paddingInlineStart],
|
|
154
154
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
155
|
-
paddingInlineEnd && paddingStylesMap.paddingInlineEnd[paddingInlineEnd],
|
|
156
|
-
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
157
|
-
resolvedStyles.emotion],
|
|
155
|
+
paddingInlineEnd && paddingStylesMap.paddingInlineEnd[paddingInlineEnd], resolvedStyles.emotion],
|
|
158
156
|
"data-testid": testId,
|
|
159
157
|
"data-is-router-link": testId ? isRouterLink ? 'true' : 'false' : undefined
|
|
160
158
|
}), children, target === '_blank' && (children && !ariaLabel && !ariaLabelledBy || ariaLabelledBy) && jsx(VisuallyHidden, {
|
|
@@ -64,9 +64,7 @@ var Bleed = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
64
64
|
return jsx("div", {
|
|
65
65
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
66
66
|
className: resolvedStyles.static,
|
|
67
|
-
css: [baseStyles, (inline || all) && inlineBleedMap[inline || all], (block || all) && blockBleedMap[block || all],
|
|
68
|
-
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
69
|
-
resolvedStyles.emotion],
|
|
67
|
+
css: [baseStyles, (inline || all) && inlineBleedMap[inline || all], (block || all) && blockBleedMap[block || all], resolvedStyles.emotion],
|
|
70
68
|
"data-testid": testId
|
|
71
69
|
}, children);
|
|
72
70
|
});
|
|
@@ -62,7 +62,6 @@ export var Box = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
62
62
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
63
63
|
,
|
|
64
64
|
className: resolvedStyles.static
|
|
65
|
-
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
66
65
|
}, safeHtmlAttributes, {
|
|
67
66
|
css: [baseStyles,
|
|
68
67
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
@@ -82,9 +81,7 @@ export var Box = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
82
81
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
83
82
|
paddingInlineStart && paddingStylesMap.paddingInlineStart[paddingInlineStart],
|
|
84
83
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
85
|
-
paddingInlineEnd && paddingStylesMap.paddingInlineEnd[paddingInlineEnd],
|
|
86
|
-
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
87
|
-
resolvedStyles.emotion],
|
|
84
|
+
paddingInlineEnd && paddingStylesMap.paddingInlineEnd[paddingInlineEnd], resolvedStyles.emotion],
|
|
88
85
|
"data-testid": testId
|
|
89
86
|
}), children);
|
|
90
87
|
return backgroundColor ? jsx(SurfaceContext.Provider, {
|
|
@@ -115,9 +115,7 @@ var Flex = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
115
115
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
116
116
|
columnGap && spaceStylesMap.columnGap[columnGap],
|
|
117
117
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
118
|
-
rowGap && spaceStylesMap.rowGap[rowGap], alignItems && alignItemsMap[alignItems], direction && flexDirectionMap[direction], justifyContent && justifyContentMap[justifyContent], wrap && flexWrapMap[wrap],
|
|
119
|
-
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
120
|
-
resolvedStyles.emotion],
|
|
118
|
+
rowGap && spaceStylesMap.rowGap[rowGap], alignItems && alignItemsMap[alignItems], direction && flexDirectionMap[direction], justifyContent && justifyContentMap[justifyContent], wrap && flexWrapMap[wrap], resolvedStyles.emotion],
|
|
121
119
|
"data-testid": testId,
|
|
122
120
|
ref: ref
|
|
123
121
|
}, children);
|
|
@@ -179,9 +179,7 @@ var Grid = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
179
179
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
180
180
|
columnGap && spaceStylesMap.columnGap[columnGap],
|
|
181
181
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
182
|
-
rowGap && spaceStylesMap.rowGap[rowGap], alignItems && alignItemsMap[alignItems], alignContent && alignContentMap[alignContent], justifyContent && justifyContentMap[justifyContent], autoFlow && gridAutoFlowMap[autoFlow],
|
|
183
|
-
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
184
|
-
resolvedStyles.emotion],
|
|
182
|
+
rowGap && spaceStylesMap.rowGap[rowGap], alignItems && alignItemsMap[alignItems], alignContent && alignContentMap[alignContent], justifyContent && justifyContentMap[justifyContent], autoFlow && gridAutoFlowMap[autoFlow], resolvedStyles.emotion],
|
|
185
183
|
"data-testid": testId,
|
|
186
184
|
ref: ref
|
|
187
185
|
}, children);
|
|
@@ -89,7 +89,7 @@ var Pressable = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
89
89
|
action: 'clicked',
|
|
90
90
|
componentName: componentName || 'Pressable',
|
|
91
91
|
packageName: "@atlaskit/primitives",
|
|
92
|
-
packageVersion: "14.
|
|
92
|
+
packageVersion: "14.5.0",
|
|
93
93
|
analyticsData: analyticsContext,
|
|
94
94
|
actionSubject: 'button'
|
|
95
95
|
});
|
|
@@ -99,42 +99,36 @@ var Pressable = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
99
99
|
var _spreadClass = htmlAttributes.className,
|
|
100
100
|
safeHtmlAttributes = _objectWithoutProperties(htmlAttributes, _excluded2);
|
|
101
101
|
var resolvedStyles = parseXcss(xcss);
|
|
102
|
-
return (
|
|
103
|
-
// eslint-disable-next-line @atlaskit/
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
paddingInlineEnd && paddingStylesMap.paddingInlineEnd[paddingInlineEnd],
|
|
134
|
-
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
135
|
-
resolvedStyles.emotion],
|
|
136
|
-
"data-testid": testId
|
|
137
|
-
}), children)
|
|
138
|
-
);
|
|
102
|
+
return jsx("button", _extends({
|
|
103
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
104
|
+
style: style,
|
|
105
|
+
ref: ref
|
|
106
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
107
|
+
,
|
|
108
|
+
className: resolvedStyles.static
|
|
109
|
+
}, safeHtmlAttributes, {
|
|
110
|
+
// eslint-disable-next-line react/button-has-type
|
|
111
|
+
type: type,
|
|
112
|
+
onClick: onClick,
|
|
113
|
+
disabled: isDisabled,
|
|
114
|
+
css: [baseStyles, focusRingStyles, isDisabled ? disabledStyles : enabledStyles,
|
|
115
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
116
|
+
backgroundColor && backgroundColorStylesMap[backgroundColor],
|
|
117
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
118
|
+
padding && paddingStylesMap.padding[padding],
|
|
119
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
120
|
+
paddingBlock && paddingStylesMap.paddingBlock[paddingBlock],
|
|
121
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
122
|
+
paddingBlockStart && paddingStylesMap.paddingBlockStart[paddingBlockStart],
|
|
123
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
124
|
+
paddingBlockEnd && paddingStylesMap.paddingBlockEnd[paddingBlockEnd],
|
|
125
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
126
|
+
paddingInline && paddingStylesMap.paddingInline[paddingInline],
|
|
127
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
128
|
+
paddingInlineStart && paddingStylesMap.paddingInlineStart[paddingInlineStart],
|
|
129
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
130
|
+
paddingInlineEnd && paddingStylesMap.paddingInlineEnd[paddingInlineEnd], resolvedStyles.emotion],
|
|
131
|
+
"data-testid": testId
|
|
132
|
+
}), children);
|
|
139
133
|
});
|
|
140
134
|
export default Pressable;
|
|
@@ -7,7 +7,6 @@ import { forwardRef } from 'react';
|
|
|
7
7
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
8
8
|
import { css, jsx } from '@emotion/react';
|
|
9
9
|
import invariant from 'tiny-invariant';
|
|
10
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
11
10
|
import { HasTextAncestorProvider, useHasTextAncestor } from '../utils/has-text-ancestor-context';
|
|
12
11
|
import { useSurface } from '../utils/surface-provider';
|
|
13
12
|
import { inverseColorMap, textColorStylesMap, textSizeStylesMap, textWeightStylesMap } from '../xcss/style-maps.partial';
|
|
@@ -52,36 +51,19 @@ var wordBreakMap = {
|
|
|
52
51
|
*/
|
|
53
52
|
var useColor = function useColor(colorProp, hasTextAncestor) {
|
|
54
53
|
var surface = useSurface();
|
|
55
|
-
if (fg('platform-typography-improved-color-control')) {
|
|
56
|
-
if (colorProp === 'inherit') {
|
|
57
|
-
return undefined;
|
|
58
|
-
}
|
|
59
|
-
if (colorProp) {
|
|
60
|
-
return colorProp;
|
|
61
|
-
}
|
|
62
|
-
if (hasTextAncestor) {
|
|
63
|
-
return undefined;
|
|
64
|
-
}
|
|
65
|
-
if (inverseColorMap.hasOwnProperty(surface)) {
|
|
66
|
-
return inverseColorMap[surface];
|
|
67
|
-
}
|
|
68
|
-
return 'color.text';
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Where the color of the surface is inverted we always override the color
|
|
73
|
-
* as there is no valid choice that is not covered by the override.
|
|
74
|
-
*/
|
|
75
|
-
if (inverseColorMap.hasOwnProperty(surface)) {
|
|
76
|
-
return inverseColorMap[surface];
|
|
77
|
-
}
|
|
78
54
|
if (colorProp === 'inherit') {
|
|
79
55
|
return undefined;
|
|
80
56
|
}
|
|
81
|
-
if (
|
|
57
|
+
if (colorProp) {
|
|
58
|
+
return colorProp;
|
|
59
|
+
}
|
|
60
|
+
if (hasTextAncestor) {
|
|
82
61
|
return undefined;
|
|
83
62
|
}
|
|
84
|
-
|
|
63
|
+
if (inverseColorMap.hasOwnProperty(surface)) {
|
|
64
|
+
return inverseColorMap[surface];
|
|
65
|
+
}
|
|
66
|
+
return 'color.text';
|
|
85
67
|
};
|
|
86
68
|
|
|
87
69
|
/**
|
package/dist/esm/xcss/xcss.js
CHANGED
|
@@ -5,12 +5,8 @@ import _typeof from "@babel/runtime/helpers/typeof";
|
|
|
5
5
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
6
6
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
7
7
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
8
|
-
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
|
|
9
8
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
10
9
|
import { css as cssEmotion } from '@emotion/react';
|
|
11
|
-
|
|
12
|
-
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
13
|
-
|
|
14
10
|
import { allSpaceMap, backgroundColorMap, borderColorMap, borderRadiusMap, borderWidthMap, dimensionMap, fontFamilyMap, fontMap, fontWeightMap, layerMap, opacityMap, positiveSpaceMap, shadowMap, textColorMap } from './style-maps.partial';
|
|
15
11
|
export var tokensMap = {
|
|
16
12
|
backgroundColor: backgroundColorMap,
|
|
@@ -13,7 +13,11 @@ type CustomElementType<P = any> = {
|
|
|
13
13
|
export type BoxProps<T extends CustomElementType> = Omit<ComponentPropsWithoutRef<T>, 'as' | 'className'> & Omit<BasePrimitiveProps, 'xcss' | 'style'> & BaseBoxProps<T>;
|
|
14
14
|
type BaseBoxProps<T extends CustomElementType> = {
|
|
15
15
|
/**
|
|
16
|
-
* The DOM element to render as the Box.
|
|
16
|
+
* The DOM element to render as the Box.
|
|
17
|
+
* - This cannot be any SVG-related element such as `'svg'`, `'animate', `'circle'`, and many more
|
|
18
|
+
* - This cannot be a `'a'` (use the `Anchor` primitive instead)
|
|
19
|
+
* - This cannot be a `'button'` (use the `Anchor` primitive instead)
|
|
20
|
+
* @default 'div'
|
|
17
21
|
*/
|
|
18
22
|
as?: T;
|
|
19
23
|
/**
|
|
@@ -83,12 +87,12 @@ type BaseBoxProps<T extends CustomElementType> = {
|
|
|
83
87
|
* Inline styles to be applied to the Box. Only apply as a last resort, or where
|
|
84
88
|
* styles cannot otherwise be calculated outside of the runtime of the component they're applied.
|
|
85
89
|
*/
|
|
86
|
-
style?: Omit<StyleProp['style'], 'backgroundColor'>;
|
|
90
|
+
style?: Omit<StyleProp['style'], 'background' | 'backgroundColor'>;
|
|
87
91
|
/**
|
|
88
92
|
* Apply a subset of permitted styles powered by Atlassian Design System design tokens.
|
|
89
|
-
*
|
|
93
|
+
* It's preferred you do not use `background` in `xcss` or `cssMap()` and instead use `props.backgroundColor` for surface awareness.
|
|
90
94
|
*/
|
|
91
|
-
xcss?: StrictXCSSProp<Exclude<XCSSAllProperties, 'background'
|
|
95
|
+
xcss?: StrictXCSSProp<Exclude<XCSSAllProperties, 'background'>, XCSSAllPseudos>;
|
|
92
96
|
};
|
|
93
97
|
type BoxComponent = <T extends CustomElementType>(props: BoxProps<T>) => ReactElement | null;
|
|
94
98
|
/**
|
|
@@ -13,7 +13,11 @@ type CustomElementType<P = any> = {
|
|
|
13
13
|
export type BoxProps<T extends CustomElementType> = Omit<ComponentPropsWithoutRef<T>, 'as' | 'className'> & BasePrimitiveProps & StyleProp & BaseBoxProps<T>;
|
|
14
14
|
type BaseBoxProps<T extends CustomElementType> = {
|
|
15
15
|
/**
|
|
16
|
-
* The DOM element to render as the Box.
|
|
16
|
+
* The DOM element to render as the Box.
|
|
17
|
+
* - This cannot be any SVG-related element such as `'svg'`, `'animate', `'circle'`, and many more
|
|
18
|
+
* - This cannot be a `'a'` (use the `Anchor` primitive instead)
|
|
19
|
+
* - This cannot be a `'button'` (use the `Anchor` primitive instead)
|
|
20
|
+
* @default 'div'
|
|
17
21
|
*/
|
|
18
22
|
as?: T;
|
|
19
23
|
/**
|
|
@@ -13,7 +13,11 @@ type CustomElementType<P = any> = {
|
|
|
13
13
|
export type BoxProps<T extends CustomElementType> = Omit<ComponentPropsWithoutRef<T>, 'as' | 'className'> & Omit<BasePrimitiveProps, 'xcss' | 'style'> & BaseBoxProps<T>;
|
|
14
14
|
type BaseBoxProps<T extends CustomElementType> = {
|
|
15
15
|
/**
|
|
16
|
-
* The DOM element to render as the Box.
|
|
16
|
+
* The DOM element to render as the Box.
|
|
17
|
+
* - This cannot be any SVG-related element such as `'svg'`, `'animate', `'circle'`, and many more
|
|
18
|
+
* - This cannot be a `'a'` (use the `Anchor` primitive instead)
|
|
19
|
+
* - This cannot be a `'button'` (use the `Anchor` primitive instead)
|
|
20
|
+
* @default 'div'
|
|
17
21
|
*/
|
|
18
22
|
as?: T;
|
|
19
23
|
/**
|
|
@@ -83,12 +87,12 @@ type BaseBoxProps<T extends CustomElementType> = {
|
|
|
83
87
|
* Inline styles to be applied to the Box. Only apply as a last resort, or where
|
|
84
88
|
* styles cannot otherwise be calculated outside of the runtime of the component they're applied.
|
|
85
89
|
*/
|
|
86
|
-
style?: Omit<StyleProp['style'], 'backgroundColor'>;
|
|
90
|
+
style?: Omit<StyleProp['style'], 'background' | 'backgroundColor'>;
|
|
87
91
|
/**
|
|
88
92
|
* Apply a subset of permitted styles powered by Atlassian Design System design tokens.
|
|
89
|
-
*
|
|
93
|
+
* It's preferred you do not use `background` in `xcss` or `cssMap()` and instead use `props.backgroundColor` for surface awareness.
|
|
90
94
|
*/
|
|
91
|
-
xcss?: StrictXCSSProp<Exclude<XCSSAllProperties, 'background'
|
|
95
|
+
xcss?: StrictXCSSProp<Exclude<XCSSAllProperties, 'background'>, XCSSAllPseudos>;
|
|
92
96
|
};
|
|
93
97
|
type BoxComponent = <T extends CustomElementType>(props: BoxProps<T>) => ReactElement | null;
|
|
94
98
|
/**
|
|
@@ -13,7 +13,11 @@ type CustomElementType<P = any> = {
|
|
|
13
13
|
export type BoxProps<T extends CustomElementType> = Omit<ComponentPropsWithoutRef<T>, 'as' | 'className'> & BasePrimitiveProps & StyleProp & BaseBoxProps<T>;
|
|
14
14
|
type BaseBoxProps<T extends CustomElementType> = {
|
|
15
15
|
/**
|
|
16
|
-
* The DOM element to render as the Box.
|
|
16
|
+
* The DOM element to render as the Box.
|
|
17
|
+
* - This cannot be any SVG-related element such as `'svg'`, `'animate', `'circle'`, and many more
|
|
18
|
+
* - This cannot be a `'a'` (use the `Anchor` primitive instead)
|
|
19
|
+
* - This cannot be a `'button'` (use the `Anchor` primitive instead)
|
|
20
|
+
* @default 'div'
|
|
17
21
|
*/
|
|
18
22
|
as?: T;
|
|
19
23
|
/**
|