@atlaskit/primitives 12.2.7 → 13.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.
Files changed (142) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/compiled/package.json +15 -0
  3. package/dist/cjs/compiled/components/anchor.compiled.css +12 -0
  4. package/dist/cjs/compiled/components/anchor.js +130 -0
  5. package/dist/cjs/compiled/components/bleed.compiled.css +11 -0
  6. package/dist/cjs/compiled/components/bleed.js +49 -0
  7. package/dist/cjs/compiled/components/box.compiled.css +266 -0
  8. package/dist/cjs/compiled/components/box.js +367 -0
  9. package/dist/cjs/compiled/components/flex.compiled.css +46 -0
  10. package/dist/cjs/compiled/components/flex.js +119 -0
  11. package/dist/cjs/compiled/components/grid.compiled.css +54 -0
  12. package/dist/cjs/compiled/components/grid.js +129 -0
  13. package/dist/cjs/compiled/components/inline.compiled.css +8 -0
  14. package/dist/cjs/compiled/components/inline.js +83 -0
  15. package/dist/cjs/compiled/components/internal/surface-provider.js +25 -0
  16. package/dist/cjs/compiled/components/internal/types.js +1 -0
  17. package/dist/cjs/compiled/components/pressable.compiled.css +13 -0
  18. package/dist/cjs/compiled/components/pressable.js +87 -0
  19. package/dist/cjs/compiled/components/stack.compiled.css +3 -0
  20. package/dist/cjs/compiled/components/stack.js +64 -0
  21. package/dist/cjs/compiled/components/text.compiled.css +60 -0
  22. package/dist/cjs/compiled/components/text.js +177 -0
  23. package/dist/cjs/compiled/components/types.js +5 -0
  24. package/dist/cjs/compiled/index.js +83 -0
  25. package/dist/cjs/compiled/responsive/hide.compiled.css +11 -0
  26. package/dist/cjs/compiled/responsive/hide.js +46 -0
  27. package/dist/cjs/compiled/responsive/index.js +33 -0
  28. package/dist/cjs/compiled/responsive/media-helper.js +42 -0
  29. package/dist/cjs/compiled/responsive/show.compiled.css +11 -0
  30. package/dist/cjs/compiled/responsive/show.js +47 -0
  31. package/dist/cjs/compiled/responsive/types.js +5 -0
  32. package/dist/cjs/compiled/responsive/use-media-query.js +77 -0
  33. package/dist/cjs/components/anchor.js +1 -1
  34. package/dist/cjs/components/pressable.js +1 -1
  35. package/dist/cjs/index.js +0 -6
  36. package/dist/es2019/compiled/components/anchor.compiled.css +12 -0
  37. package/dist/es2019/compiled/components/anchor.js +117 -0
  38. package/dist/es2019/compiled/components/bleed.compiled.css +11 -0
  39. package/dist/es2019/compiled/components/bleed.js +43 -0
  40. package/dist/es2019/compiled/components/box.compiled.css +266 -0
  41. package/dist/es2019/compiled/components/box.js +351 -0
  42. package/dist/es2019/compiled/components/flex.compiled.css +46 -0
  43. package/dist/es2019/compiled/components/flex.js +110 -0
  44. package/dist/es2019/compiled/components/grid.compiled.css +54 -0
  45. package/dist/es2019/compiled/components/grid.js +121 -0
  46. package/dist/es2019/compiled/components/inline.compiled.css +8 -0
  47. package/dist/es2019/compiled/components/inline.js +71 -0
  48. package/dist/es2019/compiled/components/internal/surface-provider.js +19 -0
  49. package/dist/es2019/compiled/components/internal/types.js +0 -0
  50. package/dist/es2019/compiled/components/pressable.compiled.css +13 -0
  51. package/dist/es2019/compiled/components/pressable.js +75 -0
  52. package/dist/es2019/compiled/components/stack.compiled.css +3 -0
  53. package/dist/es2019/compiled/components/stack.js +54 -0
  54. package/dist/es2019/compiled/components/text.compiled.css +60 -0
  55. package/dist/es2019/compiled/components/text.js +164 -0
  56. package/dist/es2019/compiled/components/types.js +1 -0
  57. package/dist/es2019/compiled/index.js +13 -0
  58. package/dist/es2019/compiled/responsive/hide.compiled.css +11 -0
  59. package/dist/es2019/compiled/responsive/hide.js +37 -0
  60. package/dist/es2019/compiled/responsive/index.js +4 -0
  61. package/dist/es2019/compiled/responsive/media-helper.js +36 -0
  62. package/dist/es2019/compiled/responsive/show.compiled.css +11 -0
  63. package/dist/es2019/compiled/responsive/show.js +38 -0
  64. package/dist/es2019/compiled/responsive/types.js +1 -0
  65. package/dist/es2019/compiled/responsive/use-media-query.js +71 -0
  66. package/dist/es2019/components/anchor.js +1 -1
  67. package/dist/es2019/components/pressable.js +1 -1
  68. package/dist/es2019/index.js +1 -1
  69. package/dist/esm/compiled/components/anchor.compiled.css +12 -0
  70. package/dist/esm/compiled/components/anchor.js +120 -0
  71. package/dist/esm/compiled/components/bleed.compiled.css +11 -0
  72. package/dist/esm/compiled/components/bleed.js +42 -0
  73. package/dist/esm/compiled/components/box.compiled.css +266 -0
  74. package/dist/esm/compiled/components/box.js +358 -0
  75. package/dist/esm/compiled/components/flex.compiled.css +46 -0
  76. package/dist/esm/compiled/components/flex.js +110 -0
  77. package/dist/esm/compiled/components/grid.compiled.css +54 -0
  78. package/dist/esm/compiled/components/grid.js +120 -0
  79. package/dist/esm/compiled/components/inline.compiled.css +8 -0
  80. package/dist/esm/compiled/components/inline.js +73 -0
  81. package/dist/esm/compiled/components/internal/surface-provider.js +19 -0
  82. package/dist/esm/compiled/components/internal/types.js +0 -0
  83. package/dist/esm/compiled/components/pressable.compiled.css +13 -0
  84. package/dist/esm/compiled/components/pressable.js +77 -0
  85. package/dist/esm/compiled/components/stack.compiled.css +3 -0
  86. package/dist/esm/compiled/components/stack.js +54 -0
  87. package/dist/esm/compiled/components/text.compiled.css +60 -0
  88. package/dist/esm/compiled/components/text.js +167 -0
  89. package/dist/esm/compiled/components/types.js +1 -0
  90. package/dist/esm/compiled/index.js +13 -0
  91. package/dist/esm/compiled/responsive/hide.compiled.css +11 -0
  92. package/dist/esm/compiled/responsive/hide.js +37 -0
  93. package/dist/esm/compiled/responsive/index.js +4 -0
  94. package/dist/esm/compiled/responsive/media-helper.js +36 -0
  95. package/dist/esm/compiled/responsive/show.compiled.css +11 -0
  96. package/dist/esm/compiled/responsive/show.js +38 -0
  97. package/dist/esm/compiled/responsive/types.js +1 -0
  98. package/dist/esm/compiled/responsive/use-media-query.js +71 -0
  99. package/dist/esm/components/anchor.js +1 -1
  100. package/dist/esm/components/pressable.js +1 -1
  101. package/dist/esm/index.js +1 -1
  102. package/dist/types/compiled/components/anchor.d.ts +63 -0
  103. package/dist/types/compiled/components/bleed.d.ts +34 -0
  104. package/dist/types/compiled/components/box.d.ts +105 -0
  105. package/dist/types/compiled/components/flex.d.ts +111 -0
  106. package/dist/types/compiled/components/grid.d.ts +131 -0
  107. package/dist/types/compiled/components/inline.d.ts +116 -0
  108. package/dist/types/compiled/components/internal/surface-provider.d.ts +16 -0
  109. package/dist/types/compiled/components/internal/types.d.ts +5 -0
  110. package/dist/types/compiled/components/pressable.d.ts +49 -0
  111. package/dist/types/compiled/components/stack.d.ts +90 -0
  112. package/dist/types/compiled/components/text.d.ts +91 -0
  113. package/dist/types/compiled/components/types.d.ts +45 -0
  114. package/dist/types/compiled/index.d.ts +12 -0
  115. package/dist/types/compiled/responsive/hide.d.ts +39 -0
  116. package/dist/types/compiled/responsive/index.d.ts +5 -0
  117. package/dist/types/compiled/responsive/media-helper.d.ts +35 -0
  118. package/dist/types/compiled/responsive/show.d.ts +39 -0
  119. package/dist/types/compiled/responsive/types.d.ts +10 -0
  120. package/dist/types/compiled/responsive/use-media-query.d.ts +23 -0
  121. package/dist/types/index.d.ts +1 -1
  122. package/dist/types-ts4.5/compiled/components/anchor.d.ts +63 -0
  123. package/dist/types-ts4.5/compiled/components/bleed.d.ts +34 -0
  124. package/dist/types-ts4.5/compiled/components/box.d.ts +105 -0
  125. package/dist/types-ts4.5/compiled/components/flex.d.ts +111 -0
  126. package/dist/types-ts4.5/compiled/components/grid.d.ts +131 -0
  127. package/dist/types-ts4.5/compiled/components/inline.d.ts +116 -0
  128. package/dist/types-ts4.5/compiled/components/internal/surface-provider.d.ts +16 -0
  129. package/dist/types-ts4.5/compiled/components/internal/types.d.ts +5 -0
  130. package/dist/types-ts4.5/compiled/components/pressable.d.ts +49 -0
  131. package/dist/types-ts4.5/compiled/components/stack.d.ts +90 -0
  132. package/dist/types-ts4.5/compiled/components/text.d.ts +96 -0
  133. package/dist/types-ts4.5/compiled/components/types.d.ts +45 -0
  134. package/dist/types-ts4.5/compiled/index.d.ts +12 -0
  135. package/dist/types-ts4.5/compiled/responsive/hide.d.ts +39 -0
  136. package/dist/types-ts4.5/compiled/responsive/index.d.ts +5 -0
  137. package/dist/types-ts4.5/compiled/responsive/media-helper.d.ts +35 -0
  138. package/dist/types-ts4.5/compiled/responsive/show.d.ts +39 -0
  139. package/dist/types-ts4.5/compiled/responsive/types.d.ts +10 -0
  140. package/dist/types-ts4.5/compiled/responsive/use-media-query.d.ts +23 -0
  141. package/dist/types-ts4.5/index.d.ts +1 -1
  142. package/package.json +4 -2
@@ -0,0 +1,167 @@
1
+ /* text.tsx generated by @compiled/babel-plugin v0.32.2 */
2
+ import "./text.compiled.css";
3
+ import * as React from 'react';
4
+ import { ax, ix } from "@compiled/react/runtime";
5
+ import { createContext, forwardRef, useContext } from 'react';
6
+ import invariant from 'tiny-invariant';
7
+ import { useSurface } from './internal/surface-provider';
8
+ var asAllowlist = ['span', 'p', 'strong', 'em'];
9
+ var HasTextAncestorContext = /*#__PURE__*/createContext(false);
10
+ var useHasTextAncestor = function useHasTextAncestor() {
11
+ return useContext(HasTextAncestorContext);
12
+ };
13
+
14
+ /**
15
+ * Custom hook designed to abstract the parsing of the color props and make it clearer in the future how color is reconciled between themes and tokens.
16
+ */
17
+ var useColor = function useColor(colorProp, hasTextAncestor) {
18
+ var surface = useSurface();
19
+
20
+ /*
21
+ * Where the color of the surface is inverted we always override the color
22
+ * as there is no valid choice that is not covered by the override.
23
+ */
24
+ if (surface in inverseColorMap) {
25
+ return inverseColorMap[surface];
26
+ }
27
+ if (colorProp === 'inherit') {
28
+ return undefined;
29
+ }
30
+ if (!colorProp && hasTextAncestor) {
31
+ return undefined;
32
+ }
33
+ return colorProp || 'color.text';
34
+ };
35
+ var styles = {
36
+ root: "_19pkidpf _2hwxidpf _otyridpf _18u0idpf _1i4qfg65",
37
+ 'as.strong': "_k48p8n31",
38
+ 'as.em': "_zg8l1m30",
39
+ 'textAlign.center': "_y3gn1h6o",
40
+ 'textAlign.end': "_y3gnh9n0",
41
+ 'textAlign.start': "_y3gnv2br",
42
+ truncation: "_1e0ccj1k _1reo15vq _18m915vq _sudp1e54",
43
+ breakAll: "_1nmz9jpi"
44
+ };
45
+ var fontSizeMap = {
46
+ medium: "_11c81oud",
47
+ UNSAFE_small: "_11c8qk37",
48
+ large: "_11c81doa",
49
+ small: "_11c81vlj"
50
+ };
51
+ var fontWeightMap = {
52
+ bold: "_k48pmoej",
53
+ medium: "_k48p1wq8",
54
+ regular: "_k48pi7a9",
55
+ semibold: "_k48p1pd9"
56
+ };
57
+ var textColorMap = {
58
+ 'color.text': "_syaz1fxt",
59
+ 'color.text.accent.lime': "_syaz1tco",
60
+ 'color.text.accent.lime.bolder': "_syaz1ik3",
61
+ 'color.text.accent.red': "_syaz9lu1",
62
+ 'color.text.accent.red.bolder': "_syazhwvp",
63
+ 'color.text.accent.orange': "_syaz1q28",
64
+ 'color.text.accent.orange.bolder': "_syaz1vps",
65
+ 'color.text.accent.yellow': "_syazfb2s",
66
+ 'color.text.accent.yellow.bolder': "_syazekll",
67
+ 'color.text.accent.green': "_syazh55r",
68
+ 'color.text.accent.green.bolder': "_syaz1y78",
69
+ 'color.text.accent.teal': "_syaz17qg",
70
+ 'color.text.accent.teal.bolder': "_syaz12v7",
71
+ 'color.text.accent.blue': "_syazpnps",
72
+ 'color.text.accent.blue.bolder': "_syazsc1o",
73
+ 'color.text.accent.purple': "_syaz10m5",
74
+ 'color.text.accent.purple.bolder': "_syaz2ibx",
75
+ 'color.text.accent.magenta': "_syaz1s8m",
76
+ 'color.text.accent.magenta.bolder': "_syaz1qur",
77
+ 'color.text.accent.gray': "_syaz1dyx",
78
+ 'color.text.accent.gray.bolder': "_syaz1x9z",
79
+ 'color.text.disabled': "_syaz1lh4",
80
+ 'color.text.inverse': "_syaz15cr",
81
+ 'color.text.selected': "_syazaqb7",
82
+ 'color.text.brand': "_syaz1e6v",
83
+ 'color.text.danger': "_syaz1tmw",
84
+ 'color.text.warning': "_syazwx40",
85
+ 'color.text.warning.inverse': "_syazal3n",
86
+ 'color.text.success': "_syazy73q",
87
+ 'color.text.discovery': "_syazzjem",
88
+ 'color.text.information': "_syaze0os",
89
+ 'color.text.subtlest': "_syaz131l",
90
+ 'color.text.subtle': "_syaz1gjq",
91
+ 'color.link': "_syaz14q2",
92
+ 'color.link.pressed': "_syaz16c2",
93
+ 'color.link.visited': "_syazw7te",
94
+ 'color.link.visited.pressed': "_syazg3x0"
95
+ };
96
+ export var inverseColorMap = {
97
+ 'color.background.neutral.bold': 'color.text.inverse',
98
+ 'color.background.neutral.bold.hovered': 'color.text.inverse',
99
+ 'color.background.neutral.bold.pressed': 'color.text.inverse',
100
+ 'color.background.selected.bold': 'color.text.inverse',
101
+ 'color.background.selected.bold.hovered': 'color.text.inverse',
102
+ 'color.background.selected.bold.pressed': 'color.text.inverse',
103
+ 'color.background.brand.bold': 'color.text.inverse',
104
+ 'color.background.brand.bold.hovered': 'color.text.inverse',
105
+ 'color.background.brand.bold.pressed': 'color.text.inverse',
106
+ 'color.background.brand.boldest': 'color.text.inverse',
107
+ 'color.background.brand.boldest.hovered': 'color.text.inverse',
108
+ 'color.background.brand.boldest.pressed': 'color.text.inverse',
109
+ 'color.background.danger.bold': 'color.text.inverse',
110
+ 'color.background.danger.bold.hovered': 'color.text.inverse',
111
+ 'color.background.danger.bold.pressed': 'color.text.inverse',
112
+ 'color.background.warning.bold': 'color.text.warning.inverse',
113
+ 'color.background.warning.bold.hovered': 'color.text.warning.inverse',
114
+ 'color.background.warning.bold.pressed': 'color.text.warning.inverse',
115
+ 'color.background.success.bold': 'color.text.inverse',
116
+ 'color.background.success.bold.hovered': 'color.text.inverse',
117
+ 'color.background.success.bold.pressed': 'color.text.inverse',
118
+ 'color.background.discovery.bold': 'color.text.inverse',
119
+ 'color.background.discovery.bold.hovered': 'color.text.inverse',
120
+ 'color.background.discovery.bold.pressed': 'color.text.inverse',
121
+ 'color.background.information.bold': 'color.text.inverse',
122
+ 'color.background.information.bold.hovered': 'color.text.inverse',
123
+ 'color.background.information.bold.pressed': 'color.text.inverse'
124
+ };
125
+
126
+ /**
127
+ * __Text__
128
+ *
129
+ * Text is a primitive component that has the Atlassian Design System's design guidelines baked in.
130
+ * This includes considerations for text attributes such as color, font size, font weight, and line height.
131
+ * It renders a `span` by default.
132
+ *
133
+ * @internal
134
+ */
135
+ var Text = /*#__PURE__*/forwardRef(function (_ref, ref) {
136
+ var _ref$as = _ref.as,
137
+ Component = _ref$as === void 0 ? 'span' : _ref$as,
138
+ colorProp = _ref.color,
139
+ align = _ref.align,
140
+ testId = _ref.testId,
141
+ id = _ref.id,
142
+ _ref$size = _ref.size,
143
+ size = _ref$size === void 0 ? 'medium' : _ref$size,
144
+ weight = _ref.weight,
145
+ maxLines = _ref.maxLines,
146
+ children = _ref.children;
147
+ invariant(asAllowlist.includes(Component), "@atlaskit/primitives: Text received an invalid \"as\" value of \"".concat(Component, "\""));
148
+ var hasTextAncestor = useHasTextAncestor();
149
+ var color = useColor(colorProp, hasTextAncestor);
150
+ var component = /*#__PURE__*/React.createElement(Component, {
151
+ id: id,
152
+ style: {
153
+ WebkitLineClamp: maxLines
154
+ },
155
+ "data-testid": testId,
156
+ ref: ref,
157
+ className: ax([styles.root, 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']])
158
+ }, children);
159
+ if (hasTextAncestor) {
160
+ // no need to re-apply context if the text is already wrapped
161
+ return component;
162
+ }
163
+ return /*#__PURE__*/React.createElement(HasTextAncestorContext.Provider, {
164
+ value: true
165
+ }, component);
166
+ });
167
+ export default Text;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,13 @@
1
+ export { default as Box } from './components/box';
2
+ export { default as Inline } from './components/inline';
3
+ export { default as Stack } from './components/stack';
4
+ export { default as Flex } from './components/flex';
5
+ export { default as Grid } from './components/grid';
6
+ export { default as Bleed } from './components/bleed';
7
+ export { default as Text } from './components/text';
8
+ export { default as Pressable } from './components/pressable';
9
+ export { default as Anchor } from './components/anchor';
10
+ export { media } from './responsive';
11
+
12
+ // TODO: This is still not figured out from before…
13
+ export { useSurface as UNSAFE_useSurface } from './components/internal/surface-provider';
@@ -0,0 +1,11 @@
1
+
2
+ @media (min-width:30rem){._114bglyw{display:none}}
3
+ @media not all and (min-width:30rem){._1m0aglyw{display:none}}
4
+ @media (min-width:48rem){._181nglyw{display:none}}
5
+ @media not all and (min-width:48rem){._sugaglyw{display:none}}
6
+ @media (min-width:64rem){._dm25glyw{display:none}}
7
+ @media not all and (min-width:64rem){._1mjbglyw{display:none}}
8
+ @media (min-width:90rem){._je3oglyw{display:none}}
9
+ @media not all and (min-width:90rem){._liwcglyw{display:none}}
10
+ @media (min-width:110.5rem){._1uxvglyw{display:none}}
11
+ @media not all and (min-width:110.5rem){._14wzglyw{display:none}}
@@ -0,0 +1,37 @@
1
+ /* hide.tsx generated by @compiled/babel-plugin v0.32.2 */
2
+ import "./hide.compiled.css";
3
+ import * as React from 'react';
4
+ import { ax, ix } from "@compiled/react/runtime";
5
+ var styles = {
6
+ 'above.xs': "_114bglyw",
7
+ 'above.sm': "_181nglyw",
8
+ 'above.md': "_dm25glyw",
9
+ 'above.lg': "_je3oglyw",
10
+ 'above.xl': "_1uxvglyw",
11
+ 'below.xs': "_1m0aglyw",
12
+ 'below.sm': "_sugaglyw",
13
+ 'below.md': "_1mjbglyw",
14
+ 'below.lg': "_liwcglyw",
15
+ 'below.xl': "_14wzglyw"
16
+ };
17
+ /**
18
+ * Hides the content at a given breakpoint. By default, content is shown. The primary use case is for visual presentation.
19
+ * Mix `<Hide above="md">` with `<Show above="md">` to achieve content that shifts at a breakpoint.
20
+ *
21
+ * Please note:
22
+ * - This only uses `display: none` hide, it does not skip rendering of children trees.
23
+ * - As this is rendered at all times, there is little performance savings here (just that this is not painted).
24
+ */
25
+ export var Hide = function Hide(_ref) {
26
+ var above = _ref.above,
27
+ below = _ref.below,
28
+ children = _ref.children,
29
+ _ref$as = _ref.as,
30
+ AsElement = _ref$as === void 0 ? 'div' : _ref$as,
31
+ xcss = _ref.xcss;
32
+ return /*#__PURE__*/React.createElement(AsElement
33
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- TODO: Allow pass-through from `props.xcss`
34
+ , {
35
+ className: ax([above && styles["above.".concat(above)], below && styles["below.".concat(below)], xcss])
36
+ }, children);
37
+ };
@@ -0,0 +1,4 @@
1
+ export { media } from './media-helper';
2
+ export { UNSAFE_useMediaQuery } from './use-media-query';
3
+ export { Show } from './show';
4
+ export { Hide } from './hide';
@@ -0,0 +1,36 @@
1
+ /**
2
+ * This is an object of usable media query helpers using our internal breakpoints configuration.
3
+ *
4
+ * When using Compiled CSS-in-JS, please ensure that only a single declaration can take effect at a time.
5
+ * This means that you should avoid multiple breakpoints taking effect at the same time,
6
+ * eg. ```{ [media.above.xs]: { color: 'red' }, [media.above.sm]: { color: 'green' }}```.
7
+ * Instead, make sure that only one breakpoint can take effect at a time,
8
+ * e.g, ```{ [media.only.xs]: { color: 'red' }, [media.above.sm]: { color: 'green' }}```.
9
+ * For more details, please see <https://compiledcssinjs.com/docs/atomic-css#selector-specificity>.
10
+ */
11
+ export var media = {
12
+ above: {
13
+ // TODO: Should this even exist, we don't want `css({ [media.above.xxs]: { … } })` because that just adds duplicates styles!
14
+ xxs: '@media all',
15
+ xs: '@media (min-width: 30rem)',
16
+ sm: '@media (min-width: 48rem)',
17
+ md: '@media (min-width: 64rem)',
18
+ lg: '@media (min-width: 90rem)',
19
+ xl: '@media (min-width: 110.5rem)'
20
+ },
21
+ only: {
22
+ xxs: '@media (min-width: 0rem) and (max-width: 29.99rem)',
23
+ xs: '@media (min-width: 30rem) and (max-width: 47.99rem)',
24
+ sm: '@media (min-width: 48rem) and (max-width: 63.99rem)',
25
+ md: '@media (min-width: 64rem) and (max-width: 89.99rem)',
26
+ lg: '@media (min-width: 90rem) and (max-width: 110.49rem)',
27
+ xl: '@media (min-width: 110.5rem)'
28
+ },
29
+ below: {
30
+ xs: '@media not all and (min-width: 30rem)',
31
+ sm: '@media not all and (min-width: 48rem)',
32
+ md: '@media not all and (min-width: 64rem)',
33
+ lg: '@media not all and (min-width: 90rem)',
34
+ xl: '@media not all and (min-width: 110.5rem)'
35
+ }
36
+ };
@@ -0,0 +1,11 @@
1
+ ._1e0cglyw{display:none}
2
+ @media (min-width:30rem){._114b19ly{display:revert}}
3
+ @media not all and (min-width:30rem){._1m0a19ly{display:revert}}
4
+ @media (min-width:48rem){._181n19ly{display:revert}}
5
+ @media not all and (min-width:48rem){._suga19ly{display:revert}}
6
+ @media (min-width:64rem){._dm2519ly{display:revert}}
7
+ @media not all and (min-width:64rem){._1mjb19ly{display:revert}}
8
+ @media (min-width:90rem){._je3o19ly{display:revert}}
9
+ @media not all and (min-width:90rem){._liwc19ly{display:revert}}
10
+ @media (min-width:110.5rem){._1uxv19ly{display:revert}}
11
+ @media not all and (min-width:110.5rem){._14wz19ly{display:revert}}
@@ -0,0 +1,38 @@
1
+ /* show.tsx generated by @compiled/babel-plugin v0.32.2 */
2
+ import "./show.compiled.css";
3
+ import * as React from 'react';
4
+ import { ax, ix } from "@compiled/react/runtime";
5
+ var styles = {
6
+ default: "_1e0cglyw",
7
+ 'above.xs': "_114b19ly",
8
+ 'above.sm': "_181n19ly",
9
+ 'above.md': "_dm2519ly",
10
+ 'above.lg': "_je3o19ly",
11
+ 'above.xl': "_1uxv19ly",
12
+ 'below.xs': "_1m0a19ly",
13
+ 'below.sm': "_suga19ly",
14
+ 'below.md': "_1mjb19ly",
15
+ 'below.lg': "_liwc19ly",
16
+ 'below.xl': "_14wz19ly"
17
+ };
18
+ /**
19
+ * Shows the content at a given breakpoint. By default, content is hidden. The primary use case is for visual presentation.
20
+ * Mix `<Show above="md">` with `<Hide above="md">` to achieve content that shifts at a breakpoint.
21
+ *
22
+ * Please note:
23
+ * - This only uses `display: none` and `display: revert` to show/hide, it does not skip rendering of children trees.
24
+ * - As this is rendered at all times, there is little performance savings here (just that this is not painted).
25
+ */
26
+ export var Show = function Show(_ref) {
27
+ var above = _ref.above,
28
+ below = _ref.below,
29
+ children = _ref.children,
30
+ _ref$as = _ref.as,
31
+ AsElement = _ref$as === void 0 ? 'div' : _ref$as,
32
+ xcss = _ref.xcss;
33
+ return /*#__PURE__*/React.createElement(AsElement
34
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- TODO: Allow pass-through from `props.xcss`
35
+ , {
36
+ className: ax([styles.default, above && styles["above.".concat(above)], below && styles["below.".concat(below)], xcss])
37
+ }, children);
38
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,71 @@
1
+ var _window, _window$matchMedia, _window2, _window2$matchMedia, _window3, _window3$matchMedia, _window4, _window4$matchMedia, _window5, _window5$matchMedia, _window6, _window6$matchMedia, _window7, _window7$matchMedia, _window8, _window8$matchMedia, _window9, _window9$matchMedia, _window10, _window10$matchMedia, _window11, _window11$matchMedia;
2
+ import { useEffect, useLayoutEffect, useRef } from 'react';
3
+ import { bind } from 'bind-event-listener';
4
+ import { media } from './media-helper';
5
+ var queries = {
6
+ 'above.xxs': typeof window === 'undefined' ? undefined : (_window = window) === null || _window === void 0 || (_window$matchMedia = _window.matchMedia) === null || _window$matchMedia === void 0 ? void 0 : _window$matchMedia.call(_window, media.above.xxs.replace('@media ', '').trim()),
7
+ 'above.xs': typeof window === 'undefined' ? undefined : (_window2 = window) === null || _window2 === void 0 || (_window2$matchMedia = _window2.matchMedia) === null || _window2$matchMedia === void 0 ? void 0 : _window2$matchMedia.call(_window2, media.above.xs.replace('@media ', '').trim()),
8
+ 'above.sm': typeof window === 'undefined' ? undefined : (_window3 = window) === null || _window3 === void 0 || (_window3$matchMedia = _window3.matchMedia) === null || _window3$matchMedia === void 0 ? void 0 : _window3$matchMedia.call(_window3, media.above.sm.replace('@media ', '').trim()),
9
+ 'above.md': typeof window === 'undefined' ? undefined : (_window4 = window) === null || _window4 === void 0 || (_window4$matchMedia = _window4.matchMedia) === null || _window4$matchMedia === void 0 ? void 0 : _window4$matchMedia.call(_window4, media.above.md.replace('@media ', '').trim()),
10
+ 'above.lg': typeof window === 'undefined' ? undefined : (_window5 = window) === null || _window5 === void 0 || (_window5$matchMedia = _window5.matchMedia) === null || _window5$matchMedia === void 0 ? void 0 : _window5$matchMedia.call(_window5, media.above.lg.replace('@media ', '').trim()),
11
+ 'above.xl': typeof window === 'undefined' ? undefined : (_window6 = window) === null || _window6 === void 0 || (_window6$matchMedia = _window6.matchMedia) === null || _window6$matchMedia === void 0 ? void 0 : _window6$matchMedia.call(_window6, media.above.xl.replace('@media ', '').trim()),
12
+ 'below.xs': typeof window === 'undefined' ? undefined : (_window7 = window) === null || _window7 === void 0 || (_window7$matchMedia = _window7.matchMedia) === null || _window7$matchMedia === void 0 ? void 0 : _window7$matchMedia.call(_window7, media.below.xs.replace('@media ', '').trim()),
13
+ 'below.sm': typeof window === 'undefined' ? undefined : (_window8 = window) === null || _window8 === void 0 || (_window8$matchMedia = _window8.matchMedia) === null || _window8$matchMedia === void 0 ? void 0 : _window8$matchMedia.call(_window8, media.below.sm.replace('@media ', '').trim()),
14
+ 'below.md': typeof window === 'undefined' ? undefined : (_window9 = window) === null || _window9 === void 0 || (_window9$matchMedia = _window9.matchMedia) === null || _window9$matchMedia === void 0 ? void 0 : _window9$matchMedia.call(_window9, media.below.md.replace('@media ', '').trim()),
15
+ 'below.lg': typeof window === 'undefined' ? undefined : (_window10 = window) === null || _window10 === void 0 || (_window10$matchMedia = _window10.matchMedia) === null || _window10$matchMedia === void 0 ? void 0 : _window10$matchMedia.call(_window10, media.below.lg.replace('@media ', '').trim()),
16
+ 'below.xl': typeof window === 'undefined' ? undefined : (_window11 = window) === null || _window11 === void 0 || (_window11$matchMedia = _window11.matchMedia) === null || _window11$matchMedia === void 0 ? void 0 : _window11$matchMedia.call(_window11, media.below.xl.replace('@media ', '').trim())
17
+ };
18
+
19
+ /**
20
+ * A hook which returnes a `window.matchMedia` result to help you build responsively around breakpoints in JavaScript.
21
+ *
22
+ * The returning value **WILL NOT** update or react to change. You can use `mq.matches` to get the latest version and you can use the optional listener argument to react to changes as desired.
23
+ *
24
+ * @important
25
+ * - This will always be `null` in SSR and the event listener should not fire on SSR => clientside hydration.
26
+ * - `above.xxs` will always be truthy, your listener should never fire.
27
+ *
28
+ * @experimental This hook only works on the client-side and is not safe in an SSR environment as `window` is unavailable (and the user's viewport would be unknown)
29
+ *
30
+ * @example
31
+ * const mq = useMediaQuery('below.md', useCallback((event) => console.log('changed', event.matches)), []))
32
+ * const isMobile = mq?.matches;
33
+ *
34
+ * @returns
35
+ * - `MediaQueryList`, primarily used to get if that media query is currently
36
+ * - `null` when `matchMedia` is unavailable, eg. in SSR.
37
+ */
38
+ export var UNSAFE_useMediaQuery = function UNSAFE_useMediaQuery(queryString, listener) {
39
+ var listenerRef = useRef(listener);
40
+ useEffect(function () {
41
+ // Bind the listener if changed so it's called on the next change event; no guarantee on timing.
42
+ listenerRef.current = listener;
43
+ }, [listener]);
44
+
45
+ /**
46
+ * We explicitly only react to boolean changes for binding our listener
47
+ * Changes to the functional reference are ignored.
48
+ */
49
+ var hasListener = !!listener;
50
+
51
+ /**
52
+ * The `matchMedia(…)` return value for our breakpoint query.
53
+ */
54
+ var mq = queries[queryString];
55
+ useLayoutEffect(function () {
56
+ listenerRef.current = listener; // Bind the listener now in case the `useEffect` hasn't fired above yet
57
+ if (!mq || !hasListener || !listenerRef.current) {
58
+ return;
59
+ }
60
+ return bind(mq, {
61
+ type: 'change',
62
+ listener: function listener(event) {
63
+ // We explicitly call the current version of the function
64
+ return listenerRef.current(event);
65
+ }
66
+ });
67
+ },
68
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- explicitly do not trigger the effect on `listener` reference change, only on a boolean representation of it.
69
+ [mq, hasListener]);
70
+ return mq || null;
71
+ };
@@ -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: "12.2.7",
97
+ packageVersion: "13.0.0",
98
98
  analyticsData: analyticsContext,
99
99
  actionSubject: 'link'
100
100
  });
@@ -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: "12.2.7",
92
+ packageVersion: "13.0.0",
93
93
  analyticsData: analyticsContext,
94
94
  actionSubject: 'button'
95
95
  });
package/dist/esm/index.js CHANGED
@@ -13,5 +13,5 @@ export {
13
13
  */
14
14
  default as UNSAFE_ANCHOR, default as Anchor } from './components/anchor';
15
15
  export { media, UNSAFE_media, UNSAFE_BREAKPOINTS_CONFIG } from './responsive';
16
- export { useSurface as UNSAFE_useSurface, SurfaceContext as UNSAFE_SurfaceContext } from './components/internal/surface-provider';
16
+ export { useSurface as UNSAFE_useSurface } from './components/internal/surface-provider';
17
17
  export { inverseColorMap as UNSAFE_inverseColorMap } from './xcss/style-maps.partial';
@@ -0,0 +1,63 @@
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
5
+ import { type ComponentPropsWithoutRef, type ReactNode, type Ref } from 'react';
6
+ import { type UIAnalyticsEvent } from '@atlaskit/analytics-next';
7
+ import { type RouterLinkComponentProps } from '@atlaskit/app-provider';
8
+ import type { BasePrimitiveProps, StyleProp } from './types';
9
+ type BaseAnchorProps = {
10
+ /**
11
+ * Elements to be rendered inside the Anchor.
12
+ */
13
+ children?: ReactNode;
14
+ /**
15
+ * Handler called on click. The second argument provides an Atlaskit UI analytics event that can be fired to a listening channel. See the ['analytics-next' package](https://atlaskit.atlassian.com/packages/analytics/analytics-next) documentation for more information.
16
+ */
17
+ onClick?: (e: React.MouseEvent<HTMLAnchorElement>, analyticsEvent: UIAnalyticsEvent) => void;
18
+ /**
19
+ * An optional name used to identify events for [React UFO (Unified Frontend Observability) press interactions](https://developer.atlassian.com/platform/ufo/react-ufo/react-ufo/getting-started/#quick-start--press-interactions). For more information, see [React UFO integration into Design System components](https://go.atlassian.com/react-ufo-dst-integration).
20
+ */
21
+ interactionName?: string;
22
+ /**
23
+ * An optional component name used to identify this component in Atlaskit analytics events. This can be used if a parent component's name is preferred over the default 'Anchor'.
24
+ */
25
+ componentName?: string;
26
+ /**
27
+ * Additional information to be included in the `context` of Atlaskit analytics events that come from anchor.
28
+ */
29
+ analyticsContext?: Record<string, any>;
30
+ /**
31
+ * Override the default text to signify that a link opens in a new window.
32
+ * This is appended to the `aria-label` attribute when the `target` prop is set to `_blank`.
33
+ */
34
+ opensInNewWindowLabel?: string;
35
+ /**
36
+ * Forwarded ref.
37
+ */
38
+ ref?: Ref<HTMLAnchorElement>;
39
+ };
40
+ export type AnchorProps<RouterLinkConfig extends Record<string, any> = never> = RouterLinkComponentProps<RouterLinkConfig> & Omit<ComponentPropsWithoutRef<'a'>, 'href' | 'onClick' | 'style' | 'className'> & BasePrimitiveProps & StyleProp & BaseAnchorProps;
41
+ /**
42
+ * __Anchor__
43
+ *
44
+ * A primitive for building custom anchor links.
45
+ *
46
+ * - [Examples](https://atlassian.design/components/primitives/anchor/examples)
47
+ * - [Code](https://atlassian.design/components/primitives/anchor/code)
48
+ * - [Usage](https://atlassian.design/components/primitives/anchor/usage)
49
+ */
50
+ declare const AnchorNoRef: <RouterLinkConfig extends Record<string, any> = never>({ href, children, onClick: providedOnClick, interactionName, componentName, analyticsContext, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, style, target, testId, xcss, opensInNewWindowLabel, ...htmlAttributes }: AnchorProps<RouterLinkConfig>, ref?: Ref<HTMLAnchorElement>) => JSX.Element;
51
+ /**
52
+ * __Anchor__
53
+ *
54
+ * Anchor is a primitive for building custom anchor links. It's a wrapper around the HTML `<a>` element that provides a consistent API for handling client-side routing and Atlassian Design System styling.
55
+ *
56
+ * - [Examples](https://atlassian.design/components/primitives/anchor/examples)
57
+ * - [Code](https://atlassian.design/components/primitives/anchor/code)
58
+ * - [Usage](https://atlassian.design/components/primitives/anchor/usage)
59
+ */
60
+ declare const Anchor: <RouterLinkConfig extends Record<string, any> = never>(props: AnchorProps<RouterLinkConfig> & {
61
+ ref?: Ref<HTMLAnchorElement>;
62
+ }) => ReturnType<typeof AnchorNoRef>;
63
+ export default Anchor;
@@ -0,0 +1,34 @@
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
5
+ import React, { type ReactNode } from 'react';
6
+ import type { BasePrimitiveProps, BleedSpaceToken } from './types';
7
+ export type BleedProps = {
8
+ /**
9
+ * Elements to be rendered inside the Flex.
10
+ */
11
+ children: ReactNode;
12
+ /**
13
+ * Bleed along both axis.
14
+ */
15
+ all?: BleedSpaceToken;
16
+ /**
17
+ * Bleed along the inline axis.
18
+ */
19
+ inline?: BleedSpaceToken;
20
+ /**
21
+ * Bleed along the block axis
22
+ */
23
+ block?: BleedSpaceToken;
24
+ } & BasePrimitiveProps;
25
+ /**
26
+ * __Bleed__
27
+ *
28
+ * `Bleed` is a primitive layout component that controls negative whitespace.
29
+ *
30
+ * - [Examples](https://atlassian.design/components/primitives/bleed/examples)
31
+ * - [Code](https://atlassian.design/components/primitives/bleed/code)
32
+ */
33
+ declare const Bleed: React.MemoExoticComponent<({ children, testId, inline, block, all, xcss }: BleedProps) => JSX.Element>;
34
+ export default Bleed;
@@ -0,0 +1,105 @@
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
5
+ import { type ComponentPropsWithoutRef, type ComponentPropsWithRef, type ReactElement, type ReactNode } from 'react';
6
+ import { type StrictXCSSProp, type XCSSAllProperties, type XCSSAllPseudos } from '@atlaskit/css';
7
+ import { type SVGElements } from './internal/types';
8
+ import type { BackgroundColorToken, BasePrimitiveProps, PaddingToken, StyleProp, SurfaceColorToken } from './types';
9
+ type AllowedElements = Exclude<keyof JSX.IntrinsicElements, SVGElements | 'button' | 'a'>;
10
+ type CustomElementType<P = any> = {
11
+ [K in AllowedElements]: P extends JSX.IntrinsicElements[K] ? K : never;
12
+ }[AllowedElements];
13
+ export type BoxProps<T extends CustomElementType> = Omit<ComponentPropsWithoutRef<T>, 'as' | 'className'> & Omit<BasePrimitiveProps, 'xcss' | 'style'> & BaseBoxProps<T>;
14
+ type BaseBoxProps<T extends CustomElementType> = {
15
+ /**
16
+ * The DOM element to render as the Box. Defaults to `div`.
17
+ */
18
+ as?: T;
19
+ /**
20
+ * Elements to be rendered inside the Box.
21
+ */
22
+ children?: ReactNode;
23
+ /**
24
+ * Token representing background color with a built-in fallback value.
25
+ */
26
+ backgroundColor?: SurfaceColorToken | BackgroundColorToken;
27
+ /**
28
+ * Tokens representing CSS shorthand for `paddingBlock` and `paddingInline` together.
29
+ *
30
+ * @see paddingBlock
31
+ * @see paddingInline
32
+ * @private
33
+ * @deprecated – Do not use shorthand props, use `props.xcss` instead as these will be deprecated in the future.
34
+ */
35
+ padding?: PaddingToken;
36
+ /**
37
+ * Tokens representing CSS shorthand `paddingBlock`.
38
+ *
39
+ * @see paddingBlockStart
40
+ * @see paddingBlockEnd
41
+ * @private
42
+ * @deprecated – Do not use shorthand props, use `props.xcss` instead as these will be deprecated in the future.
43
+ */
44
+ paddingBlock?: PaddingToken;
45
+ /**
46
+ * Tokens representing CSS `paddingBlockStart`.
47
+ * @private
48
+ * @deprecated – Do not use shorthand props, use `props.xcss` instead as these will be deprecated in the future.
49
+ */
50
+ paddingBlockStart?: PaddingToken;
51
+ /**
52
+ * Tokens representing CSS `paddingBlockEnd`.
53
+ * @private
54
+ * @deprecated – Do not use shorthand props, use `props.xcss` instead as these will be deprecated in the future.
55
+ */
56
+ paddingBlockEnd?: PaddingToken;
57
+ /**
58
+ * Tokens representing CSS shorthand `paddingInline`.
59
+ * @private
60
+ * @deprecated – Do not use shorthand props, use `props.xcss` instead as these will be deprecated in the future.
61
+ *
62
+ * @see paddingInlineStart
63
+ * @see paddingInlineEnd
64
+ */
65
+ paddingInline?: PaddingToken;
66
+ /**
67
+ * Tokens representing CSS `paddingInlineStart`.
68
+ * @private
69
+ * @deprecated – Do not use shorthand props, use `props.xcss` instead as these will be deprecated in the future.
70
+ */
71
+ paddingInlineStart?: PaddingToken;
72
+ /**
73
+ * Tokens representing CSS `paddingInlineEnd`.
74
+ * @private
75
+ * @deprecated – Do not use shorthand props, use `props.xcss` instead as these will be deprecated in the future.
76
+ */
77
+ paddingInlineEnd?: PaddingToken;
78
+ /**
79
+ * Forwarded ref.
80
+ */
81
+ ref?: ComponentPropsWithRef<T>['ref'];
82
+ /**
83
+ * Inline styles to be applied to the Box. Only apply as a last resort, or where
84
+ * styles cannot otherwise be calculated outside of the runtime of the component they're applied.
85
+ */
86
+ style?: Omit<StyleProp['style'], 'backgroundColor'>;
87
+ /**
88
+ * Apply a subset of permitted styles powered by Atlassian Design System design tokens.
89
+ * Note that `backgroundColor` is not allowed, use the `backgroundColor` prop instead for surface awareness.
90
+ */
91
+ xcss?: StrictXCSSProp<Exclude<XCSSAllProperties, 'background' | 'backgroundColor'>, XCSSAllPseudos>;
92
+ };
93
+ type BoxComponent = <T extends CustomElementType>(props: BoxProps<T>) => ReactElement | null;
94
+ /**
95
+ * __Box__
96
+ *
97
+ * A Box is a primitive component that has the design decisions of the Atlassian Design System baked in.
98
+ * Renders a `div` by default.
99
+ *
100
+ * - [Examples](https://atlassian.design/components/primitives/box/examples)
101
+ * - [Code](https://atlassian.design/components/primitives/box/code)
102
+ * - [Usage](https://atlassian.design/components/primitives/box/usage)
103
+ */
104
+ export declare const Box: BoxComponent;
105
+ export default Box;