@atlaskit/ds-explorations 0.0.3 → 0.1.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 (88) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/cjs/components/box.partial.js +215 -83
  3. package/dist/cjs/components/inline.partial.js +120 -0
  4. package/dist/cjs/components/stack.partial.js +112 -0
  5. package/dist/cjs/components/text.partial.js +92 -34
  6. package/dist/cjs/components/types.js +5 -0
  7. package/dist/cjs/constants.js +2 -0
  8. package/dist/cjs/index.js +34 -3
  9. package/dist/cjs/version.json +1 -1
  10. package/dist/es2019/components/box.partial.js +198 -83
  11. package/dist/es2019/components/inline.partial.js +107 -0
  12. package/dist/es2019/components/stack.partial.js +102 -0
  13. package/dist/es2019/components/text.partial.js +80 -34
  14. package/dist/es2019/components/types.js +1 -0
  15. package/dist/es2019/constants.js +2 -0
  16. package/dist/es2019/index.js +4 -1
  17. package/dist/es2019/version.json +1 -1
  18. package/dist/esm/components/box.partial.js +210 -83
  19. package/dist/esm/components/inline.partial.js +106 -0
  20. package/dist/esm/components/stack.partial.js +101 -0
  21. package/dist/esm/components/text.partial.js +89 -33
  22. package/dist/esm/components/types.js +1 -0
  23. package/dist/esm/constants.js +2 -0
  24. package/dist/esm/index.js +4 -1
  25. package/dist/esm/version.json +1 -1
  26. package/dist/types/components/box.partial.d.ts +86 -26
  27. package/dist/types/components/inline.partial.d.ts +52 -0
  28. package/dist/types/components/stack.partial.d.ts +47 -0
  29. package/dist/types/components/text.partial.d.ts +63 -15
  30. package/dist/types/components/types.d.ts +13 -0
  31. package/dist/types/constants.d.ts +2 -0
  32. package/dist/types/index.d.ts +4 -2
  33. package/examples/00-basic.tsx +18 -1
  34. package/examples/01-box.tsx +126 -2
  35. package/examples/02-text.tsx +55 -2
  36. package/examples/03-stack.tsx +125 -0
  37. package/examples/04-inline.tsx +134 -0
  38. package/examples/{03-badge.tsx → 05-badge.tsx} +4 -4
  39. package/examples/{04-section-message.tsx → 06-section-message.tsx} +5 -5
  40. package/examples/{05-comment.tsx → 07-comment.tsx} +10 -8
  41. package/examples/08-lozenge.tsx +29 -0
  42. package/package.json +1 -1
  43. package/report.api.md +457 -4
  44. package/scripts/__tests__/__snapshots__/codegen.test.tsx.snap +80 -47
  45. package/scripts/codegen-styles.tsx +5 -1
  46. package/scripts/color-codegen-template.tsx +33 -11
  47. package/scripts/spacing-codegen-template.tsx +9 -1
  48. package/src/components/__tests__/unit/box.test.tsx +20 -0
  49. package/src/components/__tests__/unit/inline.test.tsx +43 -0
  50. package/src/components/__tests__/unit/stack.test.tsx +31 -0
  51. package/src/components/__tests__/unit/text.test.tsx +17 -0
  52. package/src/components/__tests__/visual-regression/__image_snapshots__/box-snapshot-test-tsx-box-basic-example-should-match-production-example-1-snap.png +3 -0
  53. package/src/components/__tests__/visual-regression/__image_snapshots__/box-snapshot-test-tsx-box-example-with-alignment-should-match-snapshot-1-snap.png +3 -0
  54. package/src/components/__tests__/visual-regression/__image_snapshots__/box-snapshot-test-tsx-box-example-with-background-and-padding-block-should-match-snapshot-1-snap.png +3 -0
  55. package/src/components/__tests__/visual-regression/__image_snapshots__/box-snapshot-test-tsx-box-example-with-background-and-padding-inline-should-match-snapshot-1-snap.png +3 -0
  56. package/src/components/__tests__/visual-regression/__image_snapshots__/box-snapshot-test-tsx-box-example-with-background-and-padding-should-match-snapshot-1-snap.png +3 -0
  57. package/src/components/__tests__/visual-regression/__image_snapshots__/box-snapshot-test-tsx-box-example-with-background-color-should-match-snapshot-1-snap.png +3 -0
  58. package/src/components/__tests__/visual-regression/__image_snapshots__/box-snapshot-test-tsx-box-example-with-border-color-should-match-snapshot-1-snap.png +3 -0
  59. package/src/components/__tests__/visual-regression/__image_snapshots__/box-snapshot-test-tsx-box-example-with-border-should-match-snapshot-1-snap.png +3 -0
  60. package/src/components/__tests__/visual-regression/__image_snapshots__/inline-snapshot-test-tsx-inline-alignment-example-should-match-snapshot-1-snap.png +3 -0
  61. package/src/components/__tests__/visual-regression/__image_snapshots__/inline-snapshot-test-tsx-inline-spacing-example-should-match-snapshot-1-snap.png +3 -0
  62. package/src/components/__tests__/visual-regression/__image_snapshots__/stack-snapshot-test-tsx-stack-alignment-example-should-match-snapshot-1-snap.png +3 -0
  63. package/src/components/__tests__/visual-regression/__image_snapshots__/stack-snapshot-test-tsx-stack-spacing-example-should-match-snapshot-1-snap.png +3 -0
  64. package/src/components/__tests__/visual-regression/__image_snapshots__/text-snapshot-test-tsx-text-example-with-font-sizes-should-match-snapshot-1-snap.png +3 -0
  65. package/src/components/__tests__/visual-regression/__image_snapshots__/text-snapshot-test-tsx-text-example-with-font-weights-should-match-snapshot-1-snap.png +3 -0
  66. package/src/components/__tests__/visual-regression/__image_snapshots__/text-snapshot-test-tsx-text-example-with-line-heights-should-match-snapshot-1-snap.png +3 -0
  67. package/src/components/__tests__/visual-regression/__image_snapshots__/text-snapshot-test-tsx-text-example-with-testing-should-match-snapshot-1-snap.png +3 -0
  68. package/src/components/__tests__/visual-regression/box-snapshot-test.tsx +33 -0
  69. package/src/components/__tests__/visual-regression/inline-snapshot-test.tsx +28 -0
  70. package/src/components/__tests__/visual-regression/stack-snapshot-test.tsx +28 -0
  71. package/src/components/__tests__/visual-regression/text-snapshot-test.tsx +31 -0
  72. package/src/components/box.partial.tsx +253 -116
  73. package/src/components/inline.partial.tsx +117 -0
  74. package/src/components/stack.partial.tsx +101 -0
  75. package/src/components/text.partial.tsx +109 -35
  76. package/src/components/types.tsx +15 -0
  77. package/src/constants.tsx +2 -0
  78. package/src/index.tsx +4 -1
  79. package/dist/cjs/components/inline.js +0 -45
  80. package/dist/cjs/components/stack.js +0 -33
  81. package/dist/es2019/components/inline.js +0 -31
  82. package/dist/es2019/components/stack.js +0 -22
  83. package/dist/esm/components/inline.js +0 -30
  84. package/dist/esm/components/stack.js +0 -21
  85. package/dist/types/components/inline.d.ts +0 -19
  86. package/dist/types/components/stack.d.ts +0 -16
  87. package/src/components/inline.tsx +0 -49
  88. package/src/components/stack.tsx +0 -30
@@ -1,100 +1,146 @@
1
1
  /** @jsx jsx */
2
2
  import { css, jsx } from '@emotion/core';
3
- // These values are pulled from @atlaskit/theme
4
- const fontSize = 14;
5
- const fontSizeExtraSmall = 11;
6
- const fontSizeSmall = 12;
7
3
  const fontFamily = `-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif`;
8
4
  const fontSizeMap = {
9
- extraSmall: css({
10
- fontSize: fontSizeExtraSmall
5
+ '11': css({
6
+ fontSize: '11px'
11
7
  }),
12
- small: css({
13
- fontSize: fontSizeSmall
8
+ '12': css({
9
+ fontSize: '12px'
14
10
  }),
15
- normal: css({
16
- fontSize
11
+ '14': css({
12
+ fontSize: '14px'
17
13
  })
18
14
  };
15
+ // NOTE: can't use numbers as keys or Constellation won't build. Weird one.
19
16
  const fontWeightMap = {
20
- 400: css({
17
+ '400': css({
21
18
  fontWeight: 400
22
19
  }),
23
- 500: css({
20
+ '500': css({
24
21
  fontWeight: 500
25
22
  })
26
23
  };
24
+ const lineHeightMap = {
25
+ '12px': css({
26
+ lineHeight: '12px'
27
+ }),
28
+ '16px': css({
29
+ lineHeight: '16px'
30
+ }),
31
+ '20px': css({
32
+ lineHeight: '20px'
33
+ }),
34
+ '24px': css({
35
+ lineHeight: '24px'
36
+ }),
37
+ '28px': css({
38
+ lineHeight: '28px'
39
+ }),
40
+ '32px': css({
41
+ lineHeight: '32px'
42
+ }),
43
+ '40px': css({
44
+ lineHeight: '40px'
45
+ })
46
+ };
47
+ const textAlignMap = {
48
+ center: css({
49
+ textAlign: 'center'
50
+ }),
51
+ end: css({
52
+ textAlign: 'end'
53
+ }),
54
+ start: css({
55
+ textAlign: 'start'
56
+ })
57
+ };
27
58
  const baseStyles = css({
28
59
  fontFamily
29
60
  });
30
61
  /**
31
62
  * __Text__
32
63
  *
33
- * A text {description}.
64
+ * Text is a primitive component that has the Atlassian Design System's design guidelines baked in.
65
+ * This includes considerations for text attributes such as color, font size, font weight, and line height.
66
+ * It renders a `span` by default.
34
67
  *
35
68
  * @internal
36
69
  */
37
70
 
38
- function Text({
71
+ const Text = ({
39
72
  as: Component = 'span',
40
73
  children,
41
- color,
74
+ color: colorTuple,
42
75
  fontSize,
43
- fontWeight
44
- }) {
76
+ fontWeight,
77
+ lineHeight,
78
+ textAlign,
79
+ href,
80
+ testId,
81
+ UNSAFE_style
82
+ }) => {
83
+ const [color, fallback] = colorTuple || [];
45
84
  return jsx(Component, {
46
- css: [baseStyles, color && textColorMap[color], fontSize && fontSizeMap[fontSize], fontWeight && fontWeightMap[fontWeight]]
85
+ style: { ...UNSAFE_style,
86
+ ...(fallback && {
87
+ '--ds-co-fb': fallback
88
+ })
89
+ },
90
+ css: [baseStyles, color && textColorMap[color], fontSize && fontSizeMap[fontSize], fontWeight && fontWeightMap[fontWeight], lineHeight && lineHeightMap[lineHeight], textAlign && textAlignMap[textAlign]],
91
+ href: href,
92
+ "data-testid": testId
47
93
  }, children);
48
- }
94
+ };
49
95
 
50
96
  export default Text;
51
97
  /**
52
98
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
53
- * @codegen <<SignedSource::85816aeddf2947ff7678c0c551db336c>>
99
+ * @codegen <<SignedSource::85a0a0bc073c7af8fd63101d6c88d59e>>
54
100
  * @codegenId colors
55
101
  * @codegenCommand yarn codegen-styles
56
102
  * @codegenParams ["text"]
57
103
  */
58
104
 
59
105
  const textColorMap = {
60
- default: css({
61
- color: "var(--ds-text, #172B4D)"
106
+ 'color.text': css({
107
+ color: "var(--ds-text, var(--ds-co-fb))"
62
108
  }),
63
109
  subtle: css({
64
- color: "var(--ds-text-subtle, #44546F)"
110
+ color: "var(--ds-text-subtle, var(--ds-co-fb))"
65
111
  }),
66
112
  subtlest: css({
67
- color: "var(--ds-text-subtlest, #626F86)"
113
+ color: "var(--ds-text-subtlest, var(--ds-co-fb))"
68
114
  }),
69
115
  disabled: css({
70
- color: "var(--ds-text-disabled, #091E424F)"
116
+ color: "var(--ds-text-disabled, var(--ds-co-fb))"
71
117
  }),
72
118
  inverse: css({
73
- color: "var(--ds-text-inverse, #FFFFFF)"
119
+ color: "var(--ds-text-inverse, var(--ds-co-fb))"
74
120
  }),
75
121
  brand: css({
76
- color: "var(--ds-text-brand, #0C66E4)"
122
+ color: "var(--ds-text-brand, var(--ds-co-fb))"
77
123
  }),
78
124
  selected: css({
79
- color: "var(--ds-text-selected, #0C66E4)"
125
+ color: "var(--ds-text-selected, var(--ds-co-fb))"
80
126
  }),
81
127
  danger: css({
82
- color: "var(--ds-text-danger, #AE2A19)"
128
+ color: "var(--ds-text-danger, var(--ds-co-fb))"
83
129
  }),
84
130
  warning: css({
85
- color: "var(--ds-text-warning, #974F0C)"
131
+ color: "var(--ds-text-warning, var(--ds-co-fb))"
86
132
  }),
87
133
  'warning.inverse': css({
88
- color: "var(--ds-text-warning-inverse, #172B4D)"
134
+ color: "var(--ds-text-warning-inverse, var(--ds-co-fb))"
89
135
  }),
90
136
  success: css({
91
- color: "var(--ds-text-success, #216E4E)"
137
+ color: "var(--ds-text-success, var(--ds-co-fb))"
92
138
  }),
93
139
  discovery: css({
94
- color: "var(--ds-text-discovery, #5E4DB2)"
140
+ color: "var(--ds-text-discovery, var(--ds-co-fb))"
95
141
  }),
96
142
  information: css({
97
- color: "var(--ds-text-information, #0055CC)"
143
+ color: "var(--ds-text-information, var(--ds-co-fb))"
98
144
  })
99
145
  };
100
146
  /**
@@ -0,0 +1 @@
1
+ export {};
@@ -1,4 +1,5 @@
1
1
  export const SPACING_SCALE = {
2
+ 'sp-0': 0,
2
3
  'sp-25': 2,
3
4
  'sp-50': 4,
4
5
  'sp-75': 6,
@@ -6,6 +7,7 @@ export const SPACING_SCALE = {
6
7
  'sp-200': 16,
7
8
  'sp-300': 24,
8
9
  'sp-400': 32,
10
+ 'sp-500': 40,
9
11
  'sp-600': 48,
10
12
  'sp-800': 64
11
13
  };
@@ -1 +1,4 @@
1
- export default {};
1
+ export { default as UNSAFE_Box } from './components/box.partial';
2
+ export { default as UNSAFE_Text } from './components/text.partial';
3
+ export { default as UNSAFE_Inline } from './components/inline.partial';
4
+ export { default as UNSAFE_Stack } from './components/stack.partial';
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/ds-explorations",
3
- "version": "0.0.3",
3
+ "version": "0.1.0",
4
4
  "sideEffects": false
5
5
  }