@atlaskit/primitives 1.4.2 → 1.4.4
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 +12 -0
- package/README.md +12 -5
- package/constellation/responsive/usage.mdx +1 -1
- package/dist/cjs/components/inline.js +1 -1
- package/dist/cjs/components/internal/surface-provider.js +27 -0
- package/dist/cjs/components/text.js +131 -0
- package/dist/cjs/xcss/style-maps.partial.js +90 -3
- package/dist/es2019/components/inline.js +1 -1
- package/dist/es2019/components/internal/surface-provider.js +19 -0
- package/dist/es2019/components/text.js +127 -0
- package/dist/es2019/xcss/style-maps.partial.js +72 -1
- package/dist/esm/components/inline.js +1 -1
- package/dist/esm/components/internal/surface-provider.js +19 -0
- package/dist/esm/components/text.js +128 -0
- package/dist/esm/xcss/style-maps.partial.js +72 -1
- package/dist/types/components/internal/surface-provider.d.ts +15 -0
- package/dist/types/components/text.d.ts +57 -0
- package/dist/types/xcss/style-maps.partial.d.ts +94 -0
- package/dist/types-ts4.5/components/internal/surface-provider.d.ts +15 -0
- package/dist/types-ts4.5/components/text.d.ts +63 -0
- package/dist/types-ts4.5/xcss/style-maps.partial.d.ts +94 -0
- package/package.json +5 -4
- package/scripts/codegen-styles.tsx +12 -0
- package/scripts/typography-codegen-template.tsx +107 -0
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
var _excluded = ["children"];
|
|
4
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
|
+
/** @jsx jsx */
|
|
7
|
+
import { createContext, Fragment, useContext } from 'react';
|
|
8
|
+
import { css, jsx } from '@emotion/react';
|
|
9
|
+
import invariant from 'tiny-invariant';
|
|
10
|
+
import { bodyTextStylesMap
|
|
11
|
+
|
|
12
|
+
// textColorStylesMap,
|
|
13
|
+
, uiTextStylesMap } from '../xcss/style-maps.partial';
|
|
14
|
+
|
|
15
|
+
// import surfaceColorMap from '../internal/color-map';
|
|
16
|
+
|
|
17
|
+
// import { useSurface } from './internal/surface-provider';
|
|
18
|
+
var asAllowlist = ['span', 'p', 'strong', 'em', 'label'];
|
|
19
|
+
var variantStyles = _objectSpread(_objectSpread({}, bodyTextStylesMap), uiTextStylesMap);
|
|
20
|
+
var textAlignMap = {
|
|
21
|
+
center: css({
|
|
22
|
+
textAlign: 'center'
|
|
23
|
+
}),
|
|
24
|
+
end: css({
|
|
25
|
+
textAlign: 'end'
|
|
26
|
+
}),
|
|
27
|
+
start: css({
|
|
28
|
+
textAlign: 'start'
|
|
29
|
+
})
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
// p tag has padding on top in css-reset. dont know if we want to add it here
|
|
33
|
+
var baseStyles = css({
|
|
34
|
+
margin: "var(--ds-space-0, 0px)",
|
|
35
|
+
padding: "var(--ds-space-0, 0px)"
|
|
36
|
+
});
|
|
37
|
+
var truncateStyles = css({
|
|
38
|
+
overflow: 'hidden',
|
|
39
|
+
textOverflow: 'ellipsis',
|
|
40
|
+
whiteSpace: 'nowrap'
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
// TODO
|
|
44
|
+
// const asElementStyles: Record<AsElement, SerializedStyles> = {
|
|
45
|
+
// abbr: css({
|
|
46
|
+
// borderBottom: `1px ${token('color.border', '#ccc')} dotted`,
|
|
47
|
+
// cursor: 'help',
|
|
48
|
+
// }),
|
|
49
|
+
// };
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* 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.
|
|
53
|
+
*/
|
|
54
|
+
// const useColor = (colorProp: TextColor): NonNullable<TextColor> => {
|
|
55
|
+
// const surface = useSurface();
|
|
56
|
+
// const inverseTextColor =
|
|
57
|
+
// surfaceColorMap[surface as keyof typeof surfaceColorMap];
|
|
58
|
+
|
|
59
|
+
// /**
|
|
60
|
+
// * Where the color of the surface is inverted we override the user choice
|
|
61
|
+
// * as there is no valid choice that is not covered by the override.
|
|
62
|
+
// */
|
|
63
|
+
// const color = inverseTextColor ?? colorProp;
|
|
64
|
+
|
|
65
|
+
// return color;
|
|
66
|
+
// };
|
|
67
|
+
|
|
68
|
+
var HasTextAncestorContext = /*#__PURE__*/createContext(false);
|
|
69
|
+
var useHasTextAncestor = function useHasTextAncestor() {
|
|
70
|
+
return useContext(HasTextAncestorContext);
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* __Text__
|
|
75
|
+
*
|
|
76
|
+
* Text is a primitive component that has the Atlassian Design System's design guidelines baked in.
|
|
77
|
+
* This includes considerations for text attributes such as color, font size, font weight, and line height.
|
|
78
|
+
* It renders a `span` by default.
|
|
79
|
+
*
|
|
80
|
+
* @internal
|
|
81
|
+
*/
|
|
82
|
+
var Text = function Text(_ref) {
|
|
83
|
+
var children = _ref.children,
|
|
84
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
85
|
+
var asElement = props.as,
|
|
86
|
+
_props$shouldTruncate = props.shouldTruncate,
|
|
87
|
+
shouldTruncate = _props$shouldTruncate === void 0 ? false : _props$shouldTruncate,
|
|
88
|
+
textAlign = props.textAlign,
|
|
89
|
+
testId = props.testId,
|
|
90
|
+
id = props.id,
|
|
91
|
+
variant = props.variant;
|
|
92
|
+
var Component = asElement;
|
|
93
|
+
if (!Component) {
|
|
94
|
+
if (variant.includes('body')) {
|
|
95
|
+
Component = 'p';
|
|
96
|
+
} else {
|
|
97
|
+
// ui text and default => span
|
|
98
|
+
Component = 'span';
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
invariant(asAllowlist.includes(Component), "@atlaskit/ds-explorations: Text received an invalid \"as\" value of \"".concat(Component, "\""));
|
|
102
|
+
// const color = useColor(colorProp!);
|
|
103
|
+
var isWrapped = useHasTextAncestor();
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* If the text is already wrapped and applies no props we can just
|
|
107
|
+
* render the children directly as a fragment.
|
|
108
|
+
*/
|
|
109
|
+
if (isWrapped && Object.keys(props).length === 0) {
|
|
110
|
+
return jsx(Fragment, null, children);
|
|
111
|
+
}
|
|
112
|
+
var component = jsx(Component
|
|
113
|
+
// style={UNSAFE_style}
|
|
114
|
+
, {
|
|
115
|
+
css: [baseStyles, variant && variantStyles[variant],
|
|
116
|
+
// color && textColorMap[color],
|
|
117
|
+
// colorProp && textColorMap[colorProp],
|
|
118
|
+
shouldTruncate && truncateStyles, textAlign && textAlignMap[textAlign]],
|
|
119
|
+
"data-testid": testId,
|
|
120
|
+
id: id
|
|
121
|
+
}, children);
|
|
122
|
+
return isWrapped ?
|
|
123
|
+
// no need to re-apply context if the text is already wrapped
|
|
124
|
+
component : jsx(HasTextAncestorContext.Provider, {
|
|
125
|
+
value: true
|
|
126
|
+
}, component);
|
|
127
|
+
};
|
|
128
|
+
export default Text;
|
|
@@ -393,6 +393,69 @@ export var borderRadiusMap = {
|
|
|
393
393
|
'border.radius.400': "var(--ds-border-radius-400, 16px)",
|
|
394
394
|
'border.radius.circle': "var(--ds-border-radius-circle, 32032px)"
|
|
395
395
|
};
|
|
396
|
+
/**
|
|
397
|
+
* @codegenEnd
|
|
398
|
+
*/
|
|
399
|
+
/**
|
|
400
|
+
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
401
|
+
* @codegen <<SignedSource::752c1b8bdc7db62e519dd729222d57ad>>
|
|
402
|
+
* @codegenId typography
|
|
403
|
+
* @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
|
|
404
|
+
* @codegenParams ["fontSize", "fontWeight", "fontFamily", "lineHeight", "body", "heading", "ui"]
|
|
405
|
+
* @codegenDependency ../../scripts/codegen-file-templates/dimensions.tsx <<SignedSource::0cd422575c3f2a3784eeef767abe71f4>>
|
|
406
|
+
* @codegenDependency ../../scripts/codegen-file-templates/layer.tsx <<SignedSource::79d24a1e558f12d671c06a7609f90dc1>>
|
|
407
|
+
*/
|
|
408
|
+
export var fontSizeMap = {
|
|
409
|
+
'font.size.050': "var(--ds-font-size-050, 11px)",
|
|
410
|
+
'font.size.075': "var(--ds-font-size-075, 12px)",
|
|
411
|
+
'font.size.100': "var(--ds-font-size-100, 14px)",
|
|
412
|
+
'font.size.200': "var(--ds-font-size-200, 16px)",
|
|
413
|
+
'font.size.300': "var(--ds-font-size-300, 20px)",
|
|
414
|
+
'font.size.400': "var(--ds-font-size-400, 24px)",
|
|
415
|
+
'font.size.500': "var(--ds-font-size-500, 29px)",
|
|
416
|
+
'font.size.600': "var(--ds-font-size-600, 35px)"
|
|
417
|
+
};
|
|
418
|
+
export var fontWeightMap = {
|
|
419
|
+
'font.weight.bold': "var(--ds-font-weight-bold, 700)",
|
|
420
|
+
'font.weight.medium': "var(--ds-font-weight-medium, 500)",
|
|
421
|
+
'font.weight.regular': "var(--ds-font-weight-regular, 400)",
|
|
422
|
+
'font.weight.semibold': "var(--ds-font-weight-semibold, 600)"
|
|
423
|
+
};
|
|
424
|
+
export var fontFamilyMap = {
|
|
425
|
+
'font.family.body': "var(--ds-font-family-body, ui-sans-serif, \"Segoe UI\", system-ui, Ubuntu, \"Helvetica Neue\", sans-serif)",
|
|
426
|
+
'font.family.brand': "var(--ds-font-family-brand, Charlie Sans)",
|
|
427
|
+
'font.family.code': "var(--ds-font-family-code, ui-monospace, Menlo, \"Segoe UI Mono\", \"Ubuntu Mono\", monospace)",
|
|
428
|
+
'font.family.heading': "var(--ds-font-family-heading, ui-sans-serif, \"Segoe UI\", system-ui, Ubuntu, \"Helvetica Neue\", sans-serif)",
|
|
429
|
+
'font.family.monospace': "var(--ds-font-family-monospace, ui-monospace, Menlo, \"Segoe UI Mono\", \"Ubuntu Mono\", monospace)",
|
|
430
|
+
'font.family.sans': "var(--ds-font-family-sans, -apple-system, BlinkMacSystemFont, \"Segoe UI\", \"Roboto\", \"Oxygen\", \"Ubuntu\", \"Fira Sans\", \"Droid Sans\", \"Helvetica Neue\", sans-serif)"
|
|
431
|
+
};
|
|
432
|
+
export var lineHeightMap = {
|
|
433
|
+
'font.lineHeight.1': "var(--ds-font-lineHeight-1, 1)",
|
|
434
|
+
'font.lineHeight.100': "var(--ds-font-lineHeight-100, 16px)",
|
|
435
|
+
'font.lineHeight.200': "var(--ds-font-lineHeight-200, 20px)",
|
|
436
|
+
'font.lineHeight.300': "var(--ds-font-lineHeight-300, 24px)",
|
|
437
|
+
'font.lineHeight.400': "var(--ds-font-lineHeight-400, 28px)",
|
|
438
|
+
'font.lineHeight.500': "var(--ds-font-lineHeight-500, 32px)",
|
|
439
|
+
'font.lineHeight.600': "var(--ds-font-lineHeight-600, 40px)"
|
|
440
|
+
};
|
|
441
|
+
export var bodyTextMap = {
|
|
442
|
+
body: "var(--ds-font-body, normal 400 14px/20px var(--ds-font-family-body))",
|
|
443
|
+
'body.lg': "var(--ds-font-body-lg, normal 400 16px/24px var(--ds-font-family-body))",
|
|
444
|
+
'body.sm': "var(--ds-font-body-sm, normal 400 11px/20px var(--ds-font-family-body))"
|
|
445
|
+
};
|
|
446
|
+
export var headingTextMap = {
|
|
447
|
+
'heading.lg': "var(--ds-font-heading-lg, normal 500 24px/28px var(--ds-font-family-heading))",
|
|
448
|
+
'heading.md': "var(--ds-font-heading-md, normal 500 20px/24px var(--ds-font-family-heading))",
|
|
449
|
+
'heading.sm': "var(--ds-font-heading-sm, normal 600 16px/20px var(--ds-font-family-heading))",
|
|
450
|
+
'heading.xl': "var(--ds-font-heading-xl, normal 600 29px/32px var(--ds-font-family-heading))",
|
|
451
|
+
'heading.xs': "var(--ds-font-heading-xs, normal 600 14px/16px var(--ds-font-family-heading))",
|
|
452
|
+
'heading.xxl': "var(--ds-font-heading-xxl, normal 500 35px/40px var(--ds-font-family-heading))",
|
|
453
|
+
'heading.xxs': "var(--ds-font-heading-xxs, normal 600 12px/16px var(--ds-font-family-heading))"
|
|
454
|
+
};
|
|
455
|
+
export var uiTextMap = {
|
|
456
|
+
ui: "var(--ds-font-ui, normal 400 14px/1 var(--ds-font-family-body))",
|
|
457
|
+
'ui.sm': "var(--ds-font-ui-sm, normal 400 11px/1 var(--ds-font-family-body))"
|
|
458
|
+
};
|
|
396
459
|
|
|
397
460
|
/**
|
|
398
461
|
* @codegenEnd
|
|
@@ -418,4 +481,12 @@ export var spaceStylesMap = spacingProperties.reduce(function (styleMap, spacing
|
|
|
418
481
|
styleMap[spacingProperty] = getSerializedStylesMap(spacingProperty, spaceMap);
|
|
419
482
|
return styleMap;
|
|
420
483
|
}, {});
|
|
421
|
-
export var backgroundColorStylesMap = getSerializedStylesMap('backgroundColor', backgroundColorMap);
|
|
484
|
+
export var backgroundColorStylesMap = getSerializedStylesMap('backgroundColor', backgroundColorMap);
|
|
485
|
+
export var textColorStylesMap = getSerializedStylesMap('color', textColorMap);
|
|
486
|
+
export var fontSizeStylesMap = getSerializedStylesMap('fontSize', fontSizeMap);
|
|
487
|
+
export var fontWeightStylesMap = getSerializedStylesMap('fontWeight', fontWeightMap);
|
|
488
|
+
export var fontFamilyStylesMap = getSerializedStylesMap('fontFamily', fontFamilyMap);
|
|
489
|
+
export var lineHeightStylesMap = getSerializedStylesMap('lineHeight', lineHeightMap);
|
|
490
|
+
export var headingTextStylesMap = getSerializedStylesMap('font', headingTextMap);
|
|
491
|
+
export var bodyTextStylesMap = getSerializedStylesMap('font', bodyTextMap);
|
|
492
|
+
export var uiTextStylesMap = getSerializedStylesMap('font', uiTextMap);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
/**
|
|
3
|
+
* __Surface context__
|
|
4
|
+
*
|
|
5
|
+
* A surface context provides context information on the current background (if set).
|
|
6
|
+
*/
|
|
7
|
+
export declare const SurfaceContext: import("react").Context<"color.background.accent.lime.subtlest" | "color.background.accent.lime.subtlest.hovered" | "color.background.accent.lime.subtlest.pressed" | "color.background.accent.lime.subtler" | "color.background.accent.lime.subtler.hovered" | "color.background.accent.lime.subtler.pressed" | "color.background.accent.lime.subtle" | "color.background.accent.lime.subtle.hovered" | "color.background.accent.lime.subtle.pressed" | "color.background.accent.lime.bolder" | "color.background.accent.lime.bolder.hovered" | "color.background.accent.lime.bolder.pressed" | "color.background.accent.red.subtlest" | "color.background.accent.red.subtlest.hovered" | "color.background.accent.red.subtlest.pressed" | "color.background.accent.red.subtler" | "color.background.accent.red.subtler.hovered" | "color.background.accent.red.subtler.pressed" | "color.background.accent.red.subtle" | "color.background.accent.red.subtle.hovered" | "color.background.accent.red.subtle.pressed" | "color.background.accent.red.bolder" | "color.background.accent.red.bolder.hovered" | "color.background.accent.red.bolder.pressed" | "color.background.accent.orange.subtlest" | "color.background.accent.orange.subtlest.hovered" | "color.background.accent.orange.subtlest.pressed" | "color.background.accent.orange.subtler" | "color.background.accent.orange.subtler.hovered" | "color.background.accent.orange.subtler.pressed" | "color.background.accent.orange.subtle" | "color.background.accent.orange.subtle.hovered" | "color.background.accent.orange.subtle.pressed" | "color.background.accent.orange.bolder" | "color.background.accent.orange.bolder.hovered" | "color.background.accent.orange.bolder.pressed" | "color.background.accent.yellow.subtlest" | "color.background.accent.yellow.subtlest.hovered" | "color.background.accent.yellow.subtlest.pressed" | "color.background.accent.yellow.subtler" | "color.background.accent.yellow.subtler.hovered" | "color.background.accent.yellow.subtler.pressed" | "color.background.accent.yellow.subtle" | "color.background.accent.yellow.subtle.hovered" | "color.background.accent.yellow.subtle.pressed" | "color.background.accent.yellow.bolder" | "color.background.accent.yellow.bolder.hovered" | "color.background.accent.yellow.bolder.pressed" | "color.background.accent.green.subtlest" | "color.background.accent.green.subtlest.hovered" | "color.background.accent.green.subtlest.pressed" | "color.background.accent.green.subtler" | "color.background.accent.green.subtler.hovered" | "color.background.accent.green.subtler.pressed" | "color.background.accent.green.subtle" | "color.background.accent.green.subtle.hovered" | "color.background.accent.green.subtle.pressed" | "color.background.accent.green.bolder" | "color.background.accent.green.bolder.hovered" | "color.background.accent.green.bolder.pressed" | "color.background.accent.teal.subtlest" | "color.background.accent.teal.subtlest.hovered" | "color.background.accent.teal.subtlest.pressed" | "color.background.accent.teal.subtler" | "color.background.accent.teal.subtler.hovered" | "color.background.accent.teal.subtler.pressed" | "color.background.accent.teal.subtle" | "color.background.accent.teal.subtle.hovered" | "color.background.accent.teal.subtle.pressed" | "color.background.accent.teal.bolder" | "color.background.accent.teal.bolder.hovered" | "color.background.accent.teal.bolder.pressed" | "color.background.accent.blue.subtlest" | "color.background.accent.blue.subtlest.hovered" | "color.background.accent.blue.subtlest.pressed" | "color.background.accent.blue.subtler" | "color.background.accent.blue.subtler.hovered" | "color.background.accent.blue.subtler.pressed" | "color.background.accent.blue.subtle" | "color.background.accent.blue.subtle.hovered" | "color.background.accent.blue.subtle.pressed" | "color.background.accent.blue.bolder" | "color.background.accent.blue.bolder.hovered" | "color.background.accent.blue.bolder.pressed" | "color.background.accent.purple.subtlest" | "color.background.accent.purple.subtlest.hovered" | "color.background.accent.purple.subtlest.pressed" | "color.background.accent.purple.subtler" | "color.background.accent.purple.subtler.hovered" | "color.background.accent.purple.subtler.pressed" | "color.background.accent.purple.subtle" | "color.background.accent.purple.subtle.hovered" | "color.background.accent.purple.subtle.pressed" | "color.background.accent.purple.bolder" | "color.background.accent.purple.bolder.hovered" | "color.background.accent.purple.bolder.pressed" | "color.background.accent.magenta.subtlest" | "color.background.accent.magenta.subtlest.hovered" | "color.background.accent.magenta.subtlest.pressed" | "color.background.accent.magenta.subtler" | "color.background.accent.magenta.subtler.hovered" | "color.background.accent.magenta.subtler.pressed" | "color.background.accent.magenta.subtle" | "color.background.accent.magenta.subtle.hovered" | "color.background.accent.magenta.subtle.pressed" | "color.background.accent.magenta.bolder" | "color.background.accent.magenta.bolder.hovered" | "color.background.accent.magenta.bolder.pressed" | "color.background.accent.gray.subtlest" | "color.background.accent.gray.subtlest.hovered" | "color.background.accent.gray.subtlest.pressed" | "color.background.accent.gray.subtler" | "color.background.accent.gray.subtler.hovered" | "color.background.accent.gray.subtler.pressed" | "color.background.accent.gray.subtle" | "color.background.accent.gray.subtle.hovered" | "color.background.accent.gray.subtle.pressed" | "color.background.accent.gray.bolder" | "color.background.accent.gray.bolder.hovered" | "color.background.accent.gray.bolder.pressed" | "color.background.disabled" | "color.background.input" | "color.background.input.hovered" | "color.background.input.pressed" | "color.background.inverse.subtle" | "color.background.inverse.subtle.hovered" | "color.background.inverse.subtle.pressed" | "color.background.neutral" | "color.background.neutral.hovered" | "color.background.neutral.pressed" | "color.background.neutral.subtle" | "color.background.neutral.subtle.hovered" | "color.background.neutral.subtle.pressed" | "color.background.neutral.bold" | "color.background.neutral.bold.hovered" | "color.background.neutral.bold.pressed" | "color.background.selected" | "color.background.selected.hovered" | "color.background.selected.pressed" | "color.background.selected.bold" | "color.background.selected.bold.hovered" | "color.background.selected.bold.pressed" | "color.background.brand.subtlest" | "color.background.brand.subtlest.hovered" | "color.background.brand.subtlest.pressed" | "color.background.brand.bold" | "color.background.brand.bold.hovered" | "color.background.brand.bold.pressed" | "color.background.brand.boldest" | "color.background.brand.boldest.hovered" | "color.background.brand.boldest.pressed" | "color.background.danger" | "color.background.danger.hovered" | "color.background.danger.pressed" | "color.background.danger.bold" | "color.background.danger.bold.hovered" | "color.background.danger.bold.pressed" | "color.background.warning" | "color.background.warning.hovered" | "color.background.warning.pressed" | "color.background.warning.bold" | "color.background.warning.bold.hovered" | "color.background.warning.bold.pressed" | "color.background.success" | "color.background.success.hovered" | "color.background.success.pressed" | "color.background.success.bold" | "color.background.success.bold.hovered" | "color.background.success.bold.pressed" | "color.background.discovery" | "color.background.discovery.hovered" | "color.background.discovery.pressed" | "color.background.discovery.bold" | "color.background.discovery.bold.hovered" | "color.background.discovery.bold.pressed" | "color.background.information" | "color.background.information.hovered" | "color.background.information.pressed" | "color.background.information.bold" | "color.background.information.bold.hovered" | "color.background.information.bold.pressed" | "color.blanket" | "color.blanket.selected" | "color.blanket.danger" | "elevation.surface" | "elevation.surface.hovered" | "elevation.surface.pressed" | "elevation.surface.overlay" | "elevation.surface.overlay.hovered" | "elevation.surface.overlay.pressed" | "elevation.surface.raised" | "elevation.surface.raised.hovered" | "elevation.surface.raised.pressed" | "elevation.surface.sunken">;
|
|
8
|
+
/**
|
|
9
|
+
* __useSurface__
|
|
10
|
+
*
|
|
11
|
+
* Return the current surface. If no parent sets a surface color it falls back to the default surface.
|
|
12
|
+
*
|
|
13
|
+
* @see SurfaceContext
|
|
14
|
+
*/
|
|
15
|
+
export declare const useSurface: () => "color.background.accent.lime.subtlest" | "color.background.accent.lime.subtlest.hovered" | "color.background.accent.lime.subtlest.pressed" | "color.background.accent.lime.subtler" | "color.background.accent.lime.subtler.hovered" | "color.background.accent.lime.subtler.pressed" | "color.background.accent.lime.subtle" | "color.background.accent.lime.subtle.hovered" | "color.background.accent.lime.subtle.pressed" | "color.background.accent.lime.bolder" | "color.background.accent.lime.bolder.hovered" | "color.background.accent.lime.bolder.pressed" | "color.background.accent.red.subtlest" | "color.background.accent.red.subtlest.hovered" | "color.background.accent.red.subtlest.pressed" | "color.background.accent.red.subtler" | "color.background.accent.red.subtler.hovered" | "color.background.accent.red.subtler.pressed" | "color.background.accent.red.subtle" | "color.background.accent.red.subtle.hovered" | "color.background.accent.red.subtle.pressed" | "color.background.accent.red.bolder" | "color.background.accent.red.bolder.hovered" | "color.background.accent.red.bolder.pressed" | "color.background.accent.orange.subtlest" | "color.background.accent.orange.subtlest.hovered" | "color.background.accent.orange.subtlest.pressed" | "color.background.accent.orange.subtler" | "color.background.accent.orange.subtler.hovered" | "color.background.accent.orange.subtler.pressed" | "color.background.accent.orange.subtle" | "color.background.accent.orange.subtle.hovered" | "color.background.accent.orange.subtle.pressed" | "color.background.accent.orange.bolder" | "color.background.accent.orange.bolder.hovered" | "color.background.accent.orange.bolder.pressed" | "color.background.accent.yellow.subtlest" | "color.background.accent.yellow.subtlest.hovered" | "color.background.accent.yellow.subtlest.pressed" | "color.background.accent.yellow.subtler" | "color.background.accent.yellow.subtler.hovered" | "color.background.accent.yellow.subtler.pressed" | "color.background.accent.yellow.subtle" | "color.background.accent.yellow.subtle.hovered" | "color.background.accent.yellow.subtle.pressed" | "color.background.accent.yellow.bolder" | "color.background.accent.yellow.bolder.hovered" | "color.background.accent.yellow.bolder.pressed" | "color.background.accent.green.subtlest" | "color.background.accent.green.subtlest.hovered" | "color.background.accent.green.subtlest.pressed" | "color.background.accent.green.subtler" | "color.background.accent.green.subtler.hovered" | "color.background.accent.green.subtler.pressed" | "color.background.accent.green.subtle" | "color.background.accent.green.subtle.hovered" | "color.background.accent.green.subtle.pressed" | "color.background.accent.green.bolder" | "color.background.accent.green.bolder.hovered" | "color.background.accent.green.bolder.pressed" | "color.background.accent.teal.subtlest" | "color.background.accent.teal.subtlest.hovered" | "color.background.accent.teal.subtlest.pressed" | "color.background.accent.teal.subtler" | "color.background.accent.teal.subtler.hovered" | "color.background.accent.teal.subtler.pressed" | "color.background.accent.teal.subtle" | "color.background.accent.teal.subtle.hovered" | "color.background.accent.teal.subtle.pressed" | "color.background.accent.teal.bolder" | "color.background.accent.teal.bolder.hovered" | "color.background.accent.teal.bolder.pressed" | "color.background.accent.blue.subtlest" | "color.background.accent.blue.subtlest.hovered" | "color.background.accent.blue.subtlest.pressed" | "color.background.accent.blue.subtler" | "color.background.accent.blue.subtler.hovered" | "color.background.accent.blue.subtler.pressed" | "color.background.accent.blue.subtle" | "color.background.accent.blue.subtle.hovered" | "color.background.accent.blue.subtle.pressed" | "color.background.accent.blue.bolder" | "color.background.accent.blue.bolder.hovered" | "color.background.accent.blue.bolder.pressed" | "color.background.accent.purple.subtlest" | "color.background.accent.purple.subtlest.hovered" | "color.background.accent.purple.subtlest.pressed" | "color.background.accent.purple.subtler" | "color.background.accent.purple.subtler.hovered" | "color.background.accent.purple.subtler.pressed" | "color.background.accent.purple.subtle" | "color.background.accent.purple.subtle.hovered" | "color.background.accent.purple.subtle.pressed" | "color.background.accent.purple.bolder" | "color.background.accent.purple.bolder.hovered" | "color.background.accent.purple.bolder.pressed" | "color.background.accent.magenta.subtlest" | "color.background.accent.magenta.subtlest.hovered" | "color.background.accent.magenta.subtlest.pressed" | "color.background.accent.magenta.subtler" | "color.background.accent.magenta.subtler.hovered" | "color.background.accent.magenta.subtler.pressed" | "color.background.accent.magenta.subtle" | "color.background.accent.magenta.subtle.hovered" | "color.background.accent.magenta.subtle.pressed" | "color.background.accent.magenta.bolder" | "color.background.accent.magenta.bolder.hovered" | "color.background.accent.magenta.bolder.pressed" | "color.background.accent.gray.subtlest" | "color.background.accent.gray.subtlest.hovered" | "color.background.accent.gray.subtlest.pressed" | "color.background.accent.gray.subtler" | "color.background.accent.gray.subtler.hovered" | "color.background.accent.gray.subtler.pressed" | "color.background.accent.gray.subtle" | "color.background.accent.gray.subtle.hovered" | "color.background.accent.gray.subtle.pressed" | "color.background.accent.gray.bolder" | "color.background.accent.gray.bolder.hovered" | "color.background.accent.gray.bolder.pressed" | "color.background.disabled" | "color.background.input" | "color.background.input.hovered" | "color.background.input.pressed" | "color.background.inverse.subtle" | "color.background.inverse.subtle.hovered" | "color.background.inverse.subtle.pressed" | "color.background.neutral" | "color.background.neutral.hovered" | "color.background.neutral.pressed" | "color.background.neutral.subtle" | "color.background.neutral.subtle.hovered" | "color.background.neutral.subtle.pressed" | "color.background.neutral.bold" | "color.background.neutral.bold.hovered" | "color.background.neutral.bold.pressed" | "color.background.selected" | "color.background.selected.hovered" | "color.background.selected.pressed" | "color.background.selected.bold" | "color.background.selected.bold.hovered" | "color.background.selected.bold.pressed" | "color.background.brand.subtlest" | "color.background.brand.subtlest.hovered" | "color.background.brand.subtlest.pressed" | "color.background.brand.bold" | "color.background.brand.bold.hovered" | "color.background.brand.bold.pressed" | "color.background.brand.boldest" | "color.background.brand.boldest.hovered" | "color.background.brand.boldest.pressed" | "color.background.danger" | "color.background.danger.hovered" | "color.background.danger.pressed" | "color.background.danger.bold" | "color.background.danger.bold.hovered" | "color.background.danger.bold.pressed" | "color.background.warning" | "color.background.warning.hovered" | "color.background.warning.pressed" | "color.background.warning.bold" | "color.background.warning.bold.hovered" | "color.background.warning.bold.pressed" | "color.background.success" | "color.background.success.hovered" | "color.background.success.pressed" | "color.background.success.bold" | "color.background.success.bold.hovered" | "color.background.success.bold.pressed" | "color.background.discovery" | "color.background.discovery.hovered" | "color.background.discovery.pressed" | "color.background.discovery.bold" | "color.background.discovery.bold.hovered" | "color.background.discovery.bold.pressed" | "color.background.information" | "color.background.information.hovered" | "color.background.information.pressed" | "color.background.information.bold" | "color.background.information.bold.hovered" | "color.background.information.bold.pressed" | "color.blanket" | "color.blanket.selected" | "color.blanket.danger" | "elevation.surface" | "elevation.surface.hovered" | "elevation.surface.pressed" | "elevation.surface.overlay" | "elevation.surface.overlay.hovered" | "elevation.surface.overlay.pressed" | "elevation.surface.raised" | "elevation.surface.raised.hovered" | "elevation.surface.raised.pressed" | "elevation.surface.sunken";
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { FC, ReactNode } from 'react';
|
|
3
|
+
import { BodyText, TextColor, UiText } from '../xcss/style-maps.partial';
|
|
4
|
+
import type { BasePrimitiveProps } from './types';
|
|
5
|
+
declare const asAllowlist: readonly ["span", "p", "strong", "em", "label"];
|
|
6
|
+
type AsElement = (typeof asAllowlist)[number];
|
|
7
|
+
type Variant = BodyText | UiText;
|
|
8
|
+
export interface TextProps extends BasePrimitiveProps {
|
|
9
|
+
/**
|
|
10
|
+
* HTML tag to be rendered. Defaults to `span`.
|
|
11
|
+
*/
|
|
12
|
+
as?: AsElement;
|
|
13
|
+
/**
|
|
14
|
+
* Elements rendered within the Text element
|
|
15
|
+
*/
|
|
16
|
+
children: ReactNode;
|
|
17
|
+
/**
|
|
18
|
+
* Text variant
|
|
19
|
+
*/
|
|
20
|
+
variant: Variant;
|
|
21
|
+
/**
|
|
22
|
+
* Text color
|
|
23
|
+
* Pending colour exploration
|
|
24
|
+
*/
|
|
25
|
+
color?: TextColor;
|
|
26
|
+
/**
|
|
27
|
+
* The HTML id attribute https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id
|
|
28
|
+
*/
|
|
29
|
+
id?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Truncates text with an ellipsis when text overflows its parent container
|
|
32
|
+
* (i.e. `width` has been set on parent that is shorter than text length).
|
|
33
|
+
* Pending truncation exploration -- remove for now?
|
|
34
|
+
*/
|
|
35
|
+
shouldTruncate?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Text align https://developer.mozilla.org/en-US/docs/Web/CSS/text-align
|
|
38
|
+
*/
|
|
39
|
+
textAlign?: TextAlign;
|
|
40
|
+
}
|
|
41
|
+
type TextAlign = keyof typeof textAlignMap;
|
|
42
|
+
declare const textAlignMap: {
|
|
43
|
+
center: import("@emotion/react").SerializedStyles;
|
|
44
|
+
end: import("@emotion/react").SerializedStyles;
|
|
45
|
+
start: import("@emotion/react").SerializedStyles;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* __Text__
|
|
49
|
+
*
|
|
50
|
+
* Text is a primitive component that has the Atlassian Design System's design guidelines baked in.
|
|
51
|
+
* This includes considerations for text attributes such as color, font size, font weight, and line height.
|
|
52
|
+
* It renders a `span` by default.
|
|
53
|
+
*
|
|
54
|
+
* @internal
|
|
55
|
+
*/
|
|
56
|
+
declare const Text: FC<TextProps>;
|
|
57
|
+
export default Text;
|
|
@@ -402,6 +402,76 @@ export declare const borderRadiusMap: {
|
|
|
402
402
|
readonly 'border.radius.circle': "var(--ds-border-radius-circle)";
|
|
403
403
|
};
|
|
404
404
|
export type BorderRadius = keyof typeof borderRadiusMap;
|
|
405
|
+
/**
|
|
406
|
+
* @codegenEnd
|
|
407
|
+
*/
|
|
408
|
+
/**
|
|
409
|
+
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
410
|
+
* @codegen <<SignedSource::752c1b8bdc7db62e519dd729222d57ad>>
|
|
411
|
+
* @codegenId typography
|
|
412
|
+
* @codegenCommand yarn workspace @atlaskit/primitives codegen-styles
|
|
413
|
+
* @codegenParams ["fontSize", "fontWeight", "fontFamily", "lineHeight", "body", "heading", "ui"]
|
|
414
|
+
* @codegenDependency ../../scripts/codegen-file-templates/dimensions.tsx <<SignedSource::0cd422575c3f2a3784eeef767abe71f4>>
|
|
415
|
+
* @codegenDependency ../../scripts/codegen-file-templates/layer.tsx <<SignedSource::79d24a1e558f12d671c06a7609f90dc1>>
|
|
416
|
+
*/
|
|
417
|
+
export declare const fontSizeMap: {
|
|
418
|
+
'font.size.050': "var(--ds-font-size-050)";
|
|
419
|
+
'font.size.075': "var(--ds-font-size-075)";
|
|
420
|
+
'font.size.100': "var(--ds-font-size-100)";
|
|
421
|
+
'font.size.200': "var(--ds-font-size-200)";
|
|
422
|
+
'font.size.300': "var(--ds-font-size-300)";
|
|
423
|
+
'font.size.400': "var(--ds-font-size-400)";
|
|
424
|
+
'font.size.500': "var(--ds-font-size-500)";
|
|
425
|
+
'font.size.600': "var(--ds-font-size-600)";
|
|
426
|
+
};
|
|
427
|
+
export type FontSize = keyof typeof fontSizeMap;
|
|
428
|
+
export declare const fontWeightMap: {
|
|
429
|
+
'font.weight.bold': "var(--ds-font-weight-bold)";
|
|
430
|
+
'font.weight.medium': "var(--ds-font-weight-medium)";
|
|
431
|
+
'font.weight.regular': "var(--ds-font-weight-regular)";
|
|
432
|
+
'font.weight.semibold': "var(--ds-font-weight-semibold)";
|
|
433
|
+
};
|
|
434
|
+
export type FontWeight = keyof typeof fontWeightMap;
|
|
435
|
+
export declare const fontFamilyMap: {
|
|
436
|
+
'font.family.body': "var(--ds-font-family-body)";
|
|
437
|
+
'font.family.brand': "var(--ds-font-family-brand)";
|
|
438
|
+
'font.family.code': "var(--ds-font-family-code)";
|
|
439
|
+
'font.family.heading': "var(--ds-font-family-heading)";
|
|
440
|
+
'font.family.monospace': "var(--ds-font-family-monospace)";
|
|
441
|
+
'font.family.sans': "var(--ds-font-family-sans)";
|
|
442
|
+
};
|
|
443
|
+
export type FontFamily = keyof typeof fontFamilyMap;
|
|
444
|
+
export declare const lineHeightMap: {
|
|
445
|
+
'font.lineHeight.1': "var(--ds-font-lineHeight-1)";
|
|
446
|
+
'font.lineHeight.100': "var(--ds-font-lineHeight-100)";
|
|
447
|
+
'font.lineHeight.200': "var(--ds-font-lineHeight-200)";
|
|
448
|
+
'font.lineHeight.300': "var(--ds-font-lineHeight-300)";
|
|
449
|
+
'font.lineHeight.400': "var(--ds-font-lineHeight-400)";
|
|
450
|
+
'font.lineHeight.500': "var(--ds-font-lineHeight-500)";
|
|
451
|
+
'font.lineHeight.600': "var(--ds-font-lineHeight-600)";
|
|
452
|
+
};
|
|
453
|
+
export type LineHeight = keyof typeof lineHeightMap;
|
|
454
|
+
export declare const bodyTextMap: {
|
|
455
|
+
body: "var(--ds-font-body)";
|
|
456
|
+
'body.lg': "var(--ds-font-body-lg)";
|
|
457
|
+
'body.sm': "var(--ds-font-body-sm)";
|
|
458
|
+
};
|
|
459
|
+
export type BodyText = keyof typeof bodyTextMap;
|
|
460
|
+
export declare const headingTextMap: {
|
|
461
|
+
'heading.lg': "var(--ds-font-heading-lg)";
|
|
462
|
+
'heading.md': "var(--ds-font-heading-md)";
|
|
463
|
+
'heading.sm': "var(--ds-font-heading-sm)";
|
|
464
|
+
'heading.xl': "var(--ds-font-heading-xl)";
|
|
465
|
+
'heading.xs': "var(--ds-font-heading-xs)";
|
|
466
|
+
'heading.xxl': "var(--ds-font-heading-xxl)";
|
|
467
|
+
'heading.xxs': "var(--ds-font-heading-xxs)";
|
|
468
|
+
};
|
|
469
|
+
export type HeadingText = keyof typeof headingTextMap;
|
|
470
|
+
export declare const uiTextMap: {
|
|
471
|
+
ui: "var(--ds-font-ui)";
|
|
472
|
+
'ui.sm': "var(--ds-font-ui-sm)";
|
|
473
|
+
};
|
|
474
|
+
export type UiText = keyof typeof uiTextMap;
|
|
405
475
|
/**
|
|
406
476
|
* @codegenEnd
|
|
407
477
|
*/
|
|
@@ -471,9 +541,33 @@ declare const spacingProperties: readonly ["padding", "paddingBlock", "paddingBl
|
|
|
471
541
|
type SpacingProperty = (typeof spacingProperties)[number];
|
|
472
542
|
type SpacingToken = keyof typeof spaceMap;
|
|
473
543
|
type BackgroundColorToken = keyof typeof backgroundColorMap;
|
|
544
|
+
type TextColorToken = keyof typeof textColorMap;
|
|
545
|
+
type FontSizeToken = keyof typeof fontSizeMap;
|
|
546
|
+
type FontWeightToken = keyof typeof fontWeightMap;
|
|
547
|
+
type FontFamilyToken = keyof typeof fontFamilyMap;
|
|
548
|
+
type LineHeightToken = keyof typeof lineHeightMap;
|
|
549
|
+
type HeadingTextToken = keyof typeof headingTextMap;
|
|
550
|
+
type BodyTextToken = keyof typeof bodyTextMap;
|
|
551
|
+
type UITextToken = keyof typeof uiTextMap;
|
|
474
552
|
type SpacingStyleMap = Record<SpacingProperty, Record<SpacingToken, SerializedStyles>>;
|
|
475
553
|
type BackgroundColorStyleMap = Record<BackgroundColorToken, SerializedStyles>;
|
|
554
|
+
type TextColorStyleMap = Record<TextColorToken, SerializedStyles>;
|
|
555
|
+
type FontSizeStyleMap = Record<FontSizeToken, SerializedStyles>;
|
|
556
|
+
type FontWeightStyleMap = Record<FontWeightToken, SerializedStyles>;
|
|
557
|
+
type FontFamilyStyleMap = Record<FontFamilyToken, SerializedStyles>;
|
|
558
|
+
type LineHeightStyleMap = Record<LineHeightToken, SerializedStyles>;
|
|
559
|
+
type HeadingTextStyleMap = Record<HeadingTextToken, SerializedStyles>;
|
|
560
|
+
type BodyTextStyleMap = Record<BodyTextToken, SerializedStyles>;
|
|
561
|
+
type UITextStyleMap = Record<UITextToken, SerializedStyles>;
|
|
476
562
|
export declare const paddingStylesMap: SpacingStyleMap;
|
|
477
563
|
export declare const spaceStylesMap: SpacingStyleMap;
|
|
478
564
|
export declare const backgroundColorStylesMap: BackgroundColorStyleMap;
|
|
565
|
+
export declare const textColorStylesMap: TextColorStyleMap;
|
|
566
|
+
export declare const fontSizeStylesMap: FontSizeStyleMap;
|
|
567
|
+
export declare const fontWeightStylesMap: FontWeightStyleMap;
|
|
568
|
+
export declare const fontFamilyStylesMap: FontFamilyStyleMap;
|
|
569
|
+
export declare const lineHeightStylesMap: LineHeightStyleMap;
|
|
570
|
+
export declare const headingTextStylesMap: HeadingTextStyleMap;
|
|
571
|
+
export declare const bodyTextStylesMap: BodyTextStyleMap;
|
|
572
|
+
export declare const uiTextStylesMap: UITextStyleMap;
|
|
479
573
|
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
/**
|
|
3
|
+
* __Surface context__
|
|
4
|
+
*
|
|
5
|
+
* A surface context provides context information on the current background (if set).
|
|
6
|
+
*/
|
|
7
|
+
export declare const SurfaceContext: import("react").Context<"color.background.accent.lime.subtlest" | "color.background.accent.lime.subtlest.hovered" | "color.background.accent.lime.subtlest.pressed" | "color.background.accent.lime.subtler" | "color.background.accent.lime.subtler.hovered" | "color.background.accent.lime.subtler.pressed" | "color.background.accent.lime.subtle" | "color.background.accent.lime.subtle.hovered" | "color.background.accent.lime.subtle.pressed" | "color.background.accent.lime.bolder" | "color.background.accent.lime.bolder.hovered" | "color.background.accent.lime.bolder.pressed" | "color.background.accent.red.subtlest" | "color.background.accent.red.subtlest.hovered" | "color.background.accent.red.subtlest.pressed" | "color.background.accent.red.subtler" | "color.background.accent.red.subtler.hovered" | "color.background.accent.red.subtler.pressed" | "color.background.accent.red.subtle" | "color.background.accent.red.subtle.hovered" | "color.background.accent.red.subtle.pressed" | "color.background.accent.red.bolder" | "color.background.accent.red.bolder.hovered" | "color.background.accent.red.bolder.pressed" | "color.background.accent.orange.subtlest" | "color.background.accent.orange.subtlest.hovered" | "color.background.accent.orange.subtlest.pressed" | "color.background.accent.orange.subtler" | "color.background.accent.orange.subtler.hovered" | "color.background.accent.orange.subtler.pressed" | "color.background.accent.orange.subtle" | "color.background.accent.orange.subtle.hovered" | "color.background.accent.orange.subtle.pressed" | "color.background.accent.orange.bolder" | "color.background.accent.orange.bolder.hovered" | "color.background.accent.orange.bolder.pressed" | "color.background.accent.yellow.subtlest" | "color.background.accent.yellow.subtlest.hovered" | "color.background.accent.yellow.subtlest.pressed" | "color.background.accent.yellow.subtler" | "color.background.accent.yellow.subtler.hovered" | "color.background.accent.yellow.subtler.pressed" | "color.background.accent.yellow.subtle" | "color.background.accent.yellow.subtle.hovered" | "color.background.accent.yellow.subtle.pressed" | "color.background.accent.yellow.bolder" | "color.background.accent.yellow.bolder.hovered" | "color.background.accent.yellow.bolder.pressed" | "color.background.accent.green.subtlest" | "color.background.accent.green.subtlest.hovered" | "color.background.accent.green.subtlest.pressed" | "color.background.accent.green.subtler" | "color.background.accent.green.subtler.hovered" | "color.background.accent.green.subtler.pressed" | "color.background.accent.green.subtle" | "color.background.accent.green.subtle.hovered" | "color.background.accent.green.subtle.pressed" | "color.background.accent.green.bolder" | "color.background.accent.green.bolder.hovered" | "color.background.accent.green.bolder.pressed" | "color.background.accent.teal.subtlest" | "color.background.accent.teal.subtlest.hovered" | "color.background.accent.teal.subtlest.pressed" | "color.background.accent.teal.subtler" | "color.background.accent.teal.subtler.hovered" | "color.background.accent.teal.subtler.pressed" | "color.background.accent.teal.subtle" | "color.background.accent.teal.subtle.hovered" | "color.background.accent.teal.subtle.pressed" | "color.background.accent.teal.bolder" | "color.background.accent.teal.bolder.hovered" | "color.background.accent.teal.bolder.pressed" | "color.background.accent.blue.subtlest" | "color.background.accent.blue.subtlest.hovered" | "color.background.accent.blue.subtlest.pressed" | "color.background.accent.blue.subtler" | "color.background.accent.blue.subtler.hovered" | "color.background.accent.blue.subtler.pressed" | "color.background.accent.blue.subtle" | "color.background.accent.blue.subtle.hovered" | "color.background.accent.blue.subtle.pressed" | "color.background.accent.blue.bolder" | "color.background.accent.blue.bolder.hovered" | "color.background.accent.blue.bolder.pressed" | "color.background.accent.purple.subtlest" | "color.background.accent.purple.subtlest.hovered" | "color.background.accent.purple.subtlest.pressed" | "color.background.accent.purple.subtler" | "color.background.accent.purple.subtler.hovered" | "color.background.accent.purple.subtler.pressed" | "color.background.accent.purple.subtle" | "color.background.accent.purple.subtle.hovered" | "color.background.accent.purple.subtle.pressed" | "color.background.accent.purple.bolder" | "color.background.accent.purple.bolder.hovered" | "color.background.accent.purple.bolder.pressed" | "color.background.accent.magenta.subtlest" | "color.background.accent.magenta.subtlest.hovered" | "color.background.accent.magenta.subtlest.pressed" | "color.background.accent.magenta.subtler" | "color.background.accent.magenta.subtler.hovered" | "color.background.accent.magenta.subtler.pressed" | "color.background.accent.magenta.subtle" | "color.background.accent.magenta.subtle.hovered" | "color.background.accent.magenta.subtle.pressed" | "color.background.accent.magenta.bolder" | "color.background.accent.magenta.bolder.hovered" | "color.background.accent.magenta.bolder.pressed" | "color.background.accent.gray.subtlest" | "color.background.accent.gray.subtlest.hovered" | "color.background.accent.gray.subtlest.pressed" | "color.background.accent.gray.subtler" | "color.background.accent.gray.subtler.hovered" | "color.background.accent.gray.subtler.pressed" | "color.background.accent.gray.subtle" | "color.background.accent.gray.subtle.hovered" | "color.background.accent.gray.subtle.pressed" | "color.background.accent.gray.bolder" | "color.background.accent.gray.bolder.hovered" | "color.background.accent.gray.bolder.pressed" | "color.background.disabled" | "color.background.input" | "color.background.input.hovered" | "color.background.input.pressed" | "color.background.inverse.subtle" | "color.background.inverse.subtle.hovered" | "color.background.inverse.subtle.pressed" | "color.background.neutral" | "color.background.neutral.hovered" | "color.background.neutral.pressed" | "color.background.neutral.subtle" | "color.background.neutral.subtle.hovered" | "color.background.neutral.subtle.pressed" | "color.background.neutral.bold" | "color.background.neutral.bold.hovered" | "color.background.neutral.bold.pressed" | "color.background.selected" | "color.background.selected.hovered" | "color.background.selected.pressed" | "color.background.selected.bold" | "color.background.selected.bold.hovered" | "color.background.selected.bold.pressed" | "color.background.brand.subtlest" | "color.background.brand.subtlest.hovered" | "color.background.brand.subtlest.pressed" | "color.background.brand.bold" | "color.background.brand.bold.hovered" | "color.background.brand.bold.pressed" | "color.background.brand.boldest" | "color.background.brand.boldest.hovered" | "color.background.brand.boldest.pressed" | "color.background.danger" | "color.background.danger.hovered" | "color.background.danger.pressed" | "color.background.danger.bold" | "color.background.danger.bold.hovered" | "color.background.danger.bold.pressed" | "color.background.warning" | "color.background.warning.hovered" | "color.background.warning.pressed" | "color.background.warning.bold" | "color.background.warning.bold.hovered" | "color.background.warning.bold.pressed" | "color.background.success" | "color.background.success.hovered" | "color.background.success.pressed" | "color.background.success.bold" | "color.background.success.bold.hovered" | "color.background.success.bold.pressed" | "color.background.discovery" | "color.background.discovery.hovered" | "color.background.discovery.pressed" | "color.background.discovery.bold" | "color.background.discovery.bold.hovered" | "color.background.discovery.bold.pressed" | "color.background.information" | "color.background.information.hovered" | "color.background.information.pressed" | "color.background.information.bold" | "color.background.information.bold.hovered" | "color.background.information.bold.pressed" | "color.blanket" | "color.blanket.selected" | "color.blanket.danger" | "elevation.surface" | "elevation.surface.hovered" | "elevation.surface.pressed" | "elevation.surface.overlay" | "elevation.surface.overlay.hovered" | "elevation.surface.overlay.pressed" | "elevation.surface.raised" | "elevation.surface.raised.hovered" | "elevation.surface.raised.pressed" | "elevation.surface.sunken">;
|
|
8
|
+
/**
|
|
9
|
+
* __useSurface__
|
|
10
|
+
*
|
|
11
|
+
* Return the current surface. If no parent sets a surface color it falls back to the default surface.
|
|
12
|
+
*
|
|
13
|
+
* @see SurfaceContext
|
|
14
|
+
*/
|
|
15
|
+
export declare const useSurface: () => "color.background.accent.lime.subtlest" | "color.background.accent.lime.subtlest.hovered" | "color.background.accent.lime.subtlest.pressed" | "color.background.accent.lime.subtler" | "color.background.accent.lime.subtler.hovered" | "color.background.accent.lime.subtler.pressed" | "color.background.accent.lime.subtle" | "color.background.accent.lime.subtle.hovered" | "color.background.accent.lime.subtle.pressed" | "color.background.accent.lime.bolder" | "color.background.accent.lime.bolder.hovered" | "color.background.accent.lime.bolder.pressed" | "color.background.accent.red.subtlest" | "color.background.accent.red.subtlest.hovered" | "color.background.accent.red.subtlest.pressed" | "color.background.accent.red.subtler" | "color.background.accent.red.subtler.hovered" | "color.background.accent.red.subtler.pressed" | "color.background.accent.red.subtle" | "color.background.accent.red.subtle.hovered" | "color.background.accent.red.subtle.pressed" | "color.background.accent.red.bolder" | "color.background.accent.red.bolder.hovered" | "color.background.accent.red.bolder.pressed" | "color.background.accent.orange.subtlest" | "color.background.accent.orange.subtlest.hovered" | "color.background.accent.orange.subtlest.pressed" | "color.background.accent.orange.subtler" | "color.background.accent.orange.subtler.hovered" | "color.background.accent.orange.subtler.pressed" | "color.background.accent.orange.subtle" | "color.background.accent.orange.subtle.hovered" | "color.background.accent.orange.subtle.pressed" | "color.background.accent.orange.bolder" | "color.background.accent.orange.bolder.hovered" | "color.background.accent.orange.bolder.pressed" | "color.background.accent.yellow.subtlest" | "color.background.accent.yellow.subtlest.hovered" | "color.background.accent.yellow.subtlest.pressed" | "color.background.accent.yellow.subtler" | "color.background.accent.yellow.subtler.hovered" | "color.background.accent.yellow.subtler.pressed" | "color.background.accent.yellow.subtle" | "color.background.accent.yellow.subtle.hovered" | "color.background.accent.yellow.subtle.pressed" | "color.background.accent.yellow.bolder" | "color.background.accent.yellow.bolder.hovered" | "color.background.accent.yellow.bolder.pressed" | "color.background.accent.green.subtlest" | "color.background.accent.green.subtlest.hovered" | "color.background.accent.green.subtlest.pressed" | "color.background.accent.green.subtler" | "color.background.accent.green.subtler.hovered" | "color.background.accent.green.subtler.pressed" | "color.background.accent.green.subtle" | "color.background.accent.green.subtle.hovered" | "color.background.accent.green.subtle.pressed" | "color.background.accent.green.bolder" | "color.background.accent.green.bolder.hovered" | "color.background.accent.green.bolder.pressed" | "color.background.accent.teal.subtlest" | "color.background.accent.teal.subtlest.hovered" | "color.background.accent.teal.subtlest.pressed" | "color.background.accent.teal.subtler" | "color.background.accent.teal.subtler.hovered" | "color.background.accent.teal.subtler.pressed" | "color.background.accent.teal.subtle" | "color.background.accent.teal.subtle.hovered" | "color.background.accent.teal.subtle.pressed" | "color.background.accent.teal.bolder" | "color.background.accent.teal.bolder.hovered" | "color.background.accent.teal.bolder.pressed" | "color.background.accent.blue.subtlest" | "color.background.accent.blue.subtlest.hovered" | "color.background.accent.blue.subtlest.pressed" | "color.background.accent.blue.subtler" | "color.background.accent.blue.subtler.hovered" | "color.background.accent.blue.subtler.pressed" | "color.background.accent.blue.subtle" | "color.background.accent.blue.subtle.hovered" | "color.background.accent.blue.subtle.pressed" | "color.background.accent.blue.bolder" | "color.background.accent.blue.bolder.hovered" | "color.background.accent.blue.bolder.pressed" | "color.background.accent.purple.subtlest" | "color.background.accent.purple.subtlest.hovered" | "color.background.accent.purple.subtlest.pressed" | "color.background.accent.purple.subtler" | "color.background.accent.purple.subtler.hovered" | "color.background.accent.purple.subtler.pressed" | "color.background.accent.purple.subtle" | "color.background.accent.purple.subtle.hovered" | "color.background.accent.purple.subtle.pressed" | "color.background.accent.purple.bolder" | "color.background.accent.purple.bolder.hovered" | "color.background.accent.purple.bolder.pressed" | "color.background.accent.magenta.subtlest" | "color.background.accent.magenta.subtlest.hovered" | "color.background.accent.magenta.subtlest.pressed" | "color.background.accent.magenta.subtler" | "color.background.accent.magenta.subtler.hovered" | "color.background.accent.magenta.subtler.pressed" | "color.background.accent.magenta.subtle" | "color.background.accent.magenta.subtle.hovered" | "color.background.accent.magenta.subtle.pressed" | "color.background.accent.magenta.bolder" | "color.background.accent.magenta.bolder.hovered" | "color.background.accent.magenta.bolder.pressed" | "color.background.accent.gray.subtlest" | "color.background.accent.gray.subtlest.hovered" | "color.background.accent.gray.subtlest.pressed" | "color.background.accent.gray.subtler" | "color.background.accent.gray.subtler.hovered" | "color.background.accent.gray.subtler.pressed" | "color.background.accent.gray.subtle" | "color.background.accent.gray.subtle.hovered" | "color.background.accent.gray.subtle.pressed" | "color.background.accent.gray.bolder" | "color.background.accent.gray.bolder.hovered" | "color.background.accent.gray.bolder.pressed" | "color.background.disabled" | "color.background.input" | "color.background.input.hovered" | "color.background.input.pressed" | "color.background.inverse.subtle" | "color.background.inverse.subtle.hovered" | "color.background.inverse.subtle.pressed" | "color.background.neutral" | "color.background.neutral.hovered" | "color.background.neutral.pressed" | "color.background.neutral.subtle" | "color.background.neutral.subtle.hovered" | "color.background.neutral.subtle.pressed" | "color.background.neutral.bold" | "color.background.neutral.bold.hovered" | "color.background.neutral.bold.pressed" | "color.background.selected" | "color.background.selected.hovered" | "color.background.selected.pressed" | "color.background.selected.bold" | "color.background.selected.bold.hovered" | "color.background.selected.bold.pressed" | "color.background.brand.subtlest" | "color.background.brand.subtlest.hovered" | "color.background.brand.subtlest.pressed" | "color.background.brand.bold" | "color.background.brand.bold.hovered" | "color.background.brand.bold.pressed" | "color.background.brand.boldest" | "color.background.brand.boldest.hovered" | "color.background.brand.boldest.pressed" | "color.background.danger" | "color.background.danger.hovered" | "color.background.danger.pressed" | "color.background.danger.bold" | "color.background.danger.bold.hovered" | "color.background.danger.bold.pressed" | "color.background.warning" | "color.background.warning.hovered" | "color.background.warning.pressed" | "color.background.warning.bold" | "color.background.warning.bold.hovered" | "color.background.warning.bold.pressed" | "color.background.success" | "color.background.success.hovered" | "color.background.success.pressed" | "color.background.success.bold" | "color.background.success.bold.hovered" | "color.background.success.bold.pressed" | "color.background.discovery" | "color.background.discovery.hovered" | "color.background.discovery.pressed" | "color.background.discovery.bold" | "color.background.discovery.bold.hovered" | "color.background.discovery.bold.pressed" | "color.background.information" | "color.background.information.hovered" | "color.background.information.pressed" | "color.background.information.bold" | "color.background.information.bold.hovered" | "color.background.information.bold.pressed" | "color.blanket" | "color.blanket.selected" | "color.blanket.danger" | "elevation.surface" | "elevation.surface.hovered" | "elevation.surface.pressed" | "elevation.surface.overlay" | "elevation.surface.overlay.hovered" | "elevation.surface.overlay.pressed" | "elevation.surface.raised" | "elevation.surface.raised.hovered" | "elevation.surface.raised.pressed" | "elevation.surface.sunken";
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { FC, ReactNode } from 'react';
|
|
3
|
+
import { BodyText, TextColor, UiText } from '../xcss/style-maps.partial';
|
|
4
|
+
import type { BasePrimitiveProps } from './types';
|
|
5
|
+
declare const asAllowlist: readonly [
|
|
6
|
+
"span",
|
|
7
|
+
"p",
|
|
8
|
+
"strong",
|
|
9
|
+
"em",
|
|
10
|
+
"label"
|
|
11
|
+
];
|
|
12
|
+
type AsElement = (typeof asAllowlist)[number];
|
|
13
|
+
type Variant = BodyText | UiText;
|
|
14
|
+
export interface TextProps extends BasePrimitiveProps {
|
|
15
|
+
/**
|
|
16
|
+
* HTML tag to be rendered. Defaults to `span`.
|
|
17
|
+
*/
|
|
18
|
+
as?: AsElement;
|
|
19
|
+
/**
|
|
20
|
+
* Elements rendered within the Text element
|
|
21
|
+
*/
|
|
22
|
+
children: ReactNode;
|
|
23
|
+
/**
|
|
24
|
+
* Text variant
|
|
25
|
+
*/
|
|
26
|
+
variant: Variant;
|
|
27
|
+
/**
|
|
28
|
+
* Text color
|
|
29
|
+
* Pending colour exploration
|
|
30
|
+
*/
|
|
31
|
+
color?: TextColor;
|
|
32
|
+
/**
|
|
33
|
+
* The HTML id attribute https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id
|
|
34
|
+
*/
|
|
35
|
+
id?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Truncates text with an ellipsis when text overflows its parent container
|
|
38
|
+
* (i.e. `width` has been set on parent that is shorter than text length).
|
|
39
|
+
* Pending truncation exploration -- remove for now?
|
|
40
|
+
*/
|
|
41
|
+
shouldTruncate?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Text align https://developer.mozilla.org/en-US/docs/Web/CSS/text-align
|
|
44
|
+
*/
|
|
45
|
+
textAlign?: TextAlign;
|
|
46
|
+
}
|
|
47
|
+
type TextAlign = keyof typeof textAlignMap;
|
|
48
|
+
declare const textAlignMap: {
|
|
49
|
+
center: import("@emotion/react").SerializedStyles;
|
|
50
|
+
end: import("@emotion/react").SerializedStyles;
|
|
51
|
+
start: import("@emotion/react").SerializedStyles;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* __Text__
|
|
55
|
+
*
|
|
56
|
+
* Text is a primitive component that has the Atlassian Design System's design guidelines baked in.
|
|
57
|
+
* This includes considerations for text attributes such as color, font size, font weight, and line height.
|
|
58
|
+
* It renders a `span` by default.
|
|
59
|
+
*
|
|
60
|
+
* @internal
|
|
61
|
+
*/
|
|
62
|
+
declare const Text: FC<TextProps>;
|
|
63
|
+
export default Text;
|