@atlaskit/ds-explorations 0.0.2 → 0.1.1

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 +27 -0
  2. package/dist/cjs/components/box.partial.js +217 -82
  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 +200 -82
  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 +212 -82
  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 +87 -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 +2 -2
  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
@@ -0,0 +1,112 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _react = require("react");
9
+
10
+ var _core = require("@emotion/core");
11
+
12
+ var _constants = require("../constants");
13
+
14
+ /** @jsx jsx */
15
+ var flexAlignItemsMap = {
16
+ center: (0, _core.css)({
17
+ alignItems: 'center'
18
+ }),
19
+ baseline: (0, _core.css)({
20
+ alignItems: 'baseline'
21
+ }),
22
+ flexStart: (0, _core.css)({
23
+ alignItems: 'flex-start'
24
+ }),
25
+ flexEnd: (0, _core.css)({
26
+ alignItems: 'flex-end'
27
+ })
28
+ };
29
+ var flexJustifyContentMap = {
30
+ center: (0, _core.css)({
31
+ justifyContent: 'center'
32
+ }),
33
+ flexStart: (0, _core.css)({
34
+ justifyContent: 'flex-start'
35
+ }),
36
+ flexEnd: (0, _core.css)({
37
+ justifyContent: 'flex-end'
38
+ })
39
+ };
40
+ var baseStyles = (0, _core.css)({
41
+ display: 'flex',
42
+ boxSizing: 'border-box',
43
+ flexDirection: 'column'
44
+ });
45
+ /**
46
+ * __Stack__
47
+ *
48
+ * Stack is a primitive component based on flexbox that manages the vertical layout of direct children.
49
+ * Renders a `div` by default.
50
+ *
51
+ */
52
+
53
+ var Stack = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
54
+ var gap = _ref.gap,
55
+ alignItems = _ref.alignItems,
56
+ justifyContent = _ref.justifyContent,
57
+ children = _ref.children,
58
+ testId = _ref.testId;
59
+ return (0, _core.jsx)("div", {
60
+ css: [baseStyles, gap && gapMap[gap], alignItems && flexAlignItemsMap[alignItems], justifyContent && flexJustifyContentMap[justifyContent]],
61
+ "data-testid": testId,
62
+ ref: ref
63
+ }, children);
64
+ });
65
+ var _default = Stack;
66
+ /**
67
+ * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
68
+ * @codegen <<SignedSource::ac3192fbc453a94ab5e720d0273556ef>>
69
+ * @codegenId spacing
70
+ * @codegenCommand yarn codegen-styles
71
+ * @codegenParams ["gap"]
72
+ */
73
+
74
+ exports.default = _default;
75
+ var gapMap = {
76
+ 'sp-0': (0, _core.css)({
77
+ gap: _constants.SPACING_SCALE['sp-0']
78
+ }),
79
+ 'sp-25': (0, _core.css)({
80
+ gap: _constants.SPACING_SCALE['sp-25']
81
+ }),
82
+ 'sp-50': (0, _core.css)({
83
+ gap: _constants.SPACING_SCALE['sp-50']
84
+ }),
85
+ 'sp-75': (0, _core.css)({
86
+ gap: _constants.SPACING_SCALE['sp-75']
87
+ }),
88
+ 'sp-100': (0, _core.css)({
89
+ gap: _constants.SPACING_SCALE['sp-100']
90
+ }),
91
+ 'sp-200': (0, _core.css)({
92
+ gap: _constants.SPACING_SCALE['sp-200']
93
+ }),
94
+ 'sp-300': (0, _core.css)({
95
+ gap: _constants.SPACING_SCALE['sp-300']
96
+ }),
97
+ 'sp-400': (0, _core.css)({
98
+ gap: _constants.SPACING_SCALE['sp-400']
99
+ }),
100
+ 'sp-500': (0, _core.css)({
101
+ gap: _constants.SPACING_SCALE['sp-500']
102
+ }),
103
+ 'sp-600': (0, _core.css)({
104
+ gap: _constants.SPACING_SCALE['sp-600']
105
+ }),
106
+ 'sp-800': (0, _core.css)({
107
+ gap: _constants.SPACING_SCALE['sp-800']
108
+ })
109
+ };
110
+ /**
111
+ * @codegenEnd
112
+ */
@@ -1,64 +1,122 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
3
5
  Object.defineProperty(exports, "__esModule", {
4
6
  value: true
5
7
  });
6
8
  exports.default = void 0;
7
9
 
10
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
+
12
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
13
+
8
14
  var _core = require("@emotion/core");
9
15
 
10
- /** @jsx jsx */
11
- // These values are pulled from @atlaskit/theme
12
- var fontSize = 14;
13
- var fontSizeExtraSmall = 11;
14
- var fontSizeSmall = 12;
16
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
17
+
18
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
19
+
15
20
  var fontFamily = "-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif";
16
21
  var fontSizeMap = {
17
- extraSmall: (0, _core.css)({
18
- fontSize: fontSizeExtraSmall
22
+ '11': (0, _core.css)({
23
+ fontSize: '11px'
19
24
  }),
20
- small: (0, _core.css)({
21
- fontSize: fontSizeSmall
25
+ '12': (0, _core.css)({
26
+ fontSize: '12px'
22
27
  }),
23
- normal: (0, _core.css)({
24
- fontSize: fontSize
28
+ '14': (0, _core.css)({
29
+ fontSize: '14px'
25
30
  })
26
31
  };
32
+ // NOTE: can't use numbers as keys or Constellation won't build. Weird one.
27
33
  var fontWeightMap = {
28
- 400: (0, _core.css)({
34
+ '400': (0, _core.css)({
29
35
  fontWeight: 400
30
36
  }),
31
- 500: (0, _core.css)({
37
+ '500': (0, _core.css)({
32
38
  fontWeight: 500
33
39
  })
34
40
  };
41
+ var lineHeightMap = {
42
+ '12px': (0, _core.css)({
43
+ lineHeight: '12px'
44
+ }),
45
+ '16px': (0, _core.css)({
46
+ lineHeight: '16px'
47
+ }),
48
+ '20px': (0, _core.css)({
49
+ lineHeight: '20px'
50
+ }),
51
+ '24px': (0, _core.css)({
52
+ lineHeight: '24px'
53
+ }),
54
+ '28px': (0, _core.css)({
55
+ lineHeight: '28px'
56
+ }),
57
+ '32px': (0, _core.css)({
58
+ lineHeight: '32px'
59
+ }),
60
+ '40px': (0, _core.css)({
61
+ lineHeight: '40px'
62
+ })
63
+ };
64
+ var textAlignMap = {
65
+ center: (0, _core.css)({
66
+ textAlign: 'center'
67
+ }),
68
+ end: (0, _core.css)({
69
+ textAlign: 'end'
70
+ }),
71
+ start: (0, _core.css)({
72
+ textAlign: 'start'
73
+ })
74
+ };
35
75
  var baseStyles = (0, _core.css)({
36
76
  fontFamily: fontFamily
37
77
  });
38
78
  /**
39
79
  * __Text__
40
80
  *
41
- * A text {description}.
81
+ * Text is a primitive component that has the Atlassian Design System's design guidelines baked in.
82
+ * This includes considerations for text attributes such as color, font size, font weight, and line height.
83
+ * It renders a `span` by default.
42
84
  *
43
85
  * @internal
44
86
  */
45
87
 
46
- function Text(_ref) {
88
+ var Text = function Text(_ref) {
47
89
  var _ref$as = _ref.as,
48
90
  Component = _ref$as === void 0 ? 'span' : _ref$as,
49
91
  children = _ref.children,
50
- color = _ref.color,
92
+ colorTuple = _ref.color,
51
93
  fontSize = _ref.fontSize,
52
- fontWeight = _ref.fontWeight;
94
+ fontWeight = _ref.fontWeight,
95
+ lineHeight = _ref.lineHeight,
96
+ textAlign = _ref.textAlign,
97
+ href = _ref.href,
98
+ testId = _ref.testId,
99
+ UNSAFE_style = _ref.UNSAFE_style;
100
+
101
+ var _ref2 = colorTuple || [],
102
+ _ref3 = (0, _slicedToArray2.default)(_ref2, 2),
103
+ color = _ref3[0],
104
+ fallback = _ref3[1];
105
+
53
106
  return (0, _core.jsx)(Component, {
54
- css: [baseStyles, color && textColorMap[color], fontSize && fontSizeMap[fontSize], fontWeight && fontWeightMap[fontWeight]]
107
+ style: _objectSpread(_objectSpread({}, UNSAFE_style), fallback && {
108
+ '--ds-co-fb': fallback
109
+ }),
110
+ css: [baseStyles, color && textColorMap[color], fontSize && fontSizeMap[fontSize], fontWeight && fontWeightMap[fontWeight], lineHeight && lineHeightMap[lineHeight], textAlign && textAlignMap[textAlign]],
111
+ href: href,
112
+ "data-testid": testId
55
113
  }, children);
56
- }
114
+ };
57
115
 
58
116
  var _default = Text;
59
117
  /**
60
118
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
61
- * @codegen <<SignedSource::588616346f4a4bd0abb93bf324335944>>
119
+ * @codegen <<SignedSource::85a0a0bc073c7af8fd63101d6c88d59e>>
62
120
  * @codegenId colors
63
121
  * @codegenCommand yarn codegen-styles
64
122
  * @codegenParams ["text"]
@@ -66,44 +124,44 @@ var _default = Text;
66
124
 
67
125
  exports.default = _default;
68
126
  var textColorMap = {
69
- default: (0, _core.css)({
70
- color: "var(--ds-text, #172B4D)"
127
+ 'color.text': (0, _core.css)({
128
+ color: "var(--ds-text, var(--ds-co-fb))"
71
129
  }),
72
130
  subtle: (0, _core.css)({
73
- color: "var(--ds-text-subtle, #44546F)"
131
+ color: "var(--ds-text-subtle, var(--ds-co-fb))"
74
132
  }),
75
133
  subtlest: (0, _core.css)({
76
- color: "var(--ds-text-subtlest, #626F86)"
134
+ color: "var(--ds-text-subtlest, var(--ds-co-fb))"
77
135
  }),
78
136
  disabled: (0, _core.css)({
79
- color: "var(--ds-text-disabled, #8993A5)"
137
+ color: "var(--ds-text-disabled, var(--ds-co-fb))"
80
138
  }),
81
139
  inverse: (0, _core.css)({
82
- color: "var(--ds-text-inverse, #FFFFFF)"
140
+ color: "var(--ds-text-inverse, var(--ds-co-fb))"
83
141
  }),
84
142
  brand: (0, _core.css)({
85
- color: "var(--ds-text-brand, #0C66E4)"
143
+ color: "var(--ds-text-brand, var(--ds-co-fb))"
86
144
  }),
87
145
  selected: (0, _core.css)({
88
- color: "var(--ds-text-selected, #0C66E4)"
146
+ color: "var(--ds-text-selected, var(--ds-co-fb))"
89
147
  }),
90
148
  danger: (0, _core.css)({
91
- color: "var(--ds-text-danger, #AE2A19)"
149
+ color: "var(--ds-text-danger, var(--ds-co-fb))"
92
150
  }),
93
151
  warning: (0, _core.css)({
94
- color: "var(--ds-text-warning, #974F0C)"
152
+ color: "var(--ds-text-warning, var(--ds-co-fb))"
95
153
  }),
96
154
  'warning.inverse': (0, _core.css)({
97
- color: "var(--ds-text-warning-inverse, #172B4D)"
155
+ color: "var(--ds-text-warning-inverse, var(--ds-co-fb))"
98
156
  }),
99
157
  success: (0, _core.css)({
100
- color: "var(--ds-text-success, #216E4E)"
158
+ color: "var(--ds-text-success, var(--ds-co-fb))"
101
159
  }),
102
160
  discovery: (0, _core.css)({
103
- color: "var(--ds-text-discovery, #5E4DB2)"
161
+ color: "var(--ds-text-discovery, var(--ds-co-fb))"
104
162
  }),
105
163
  information: (0, _core.css)({
106
- color: "var(--ds-text-information, #0055CC)"
164
+ color: "var(--ds-text-information, var(--ds-co-fb))"
107
165
  })
108
166
  };
109
167
  /**
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.SPACING_SCALE = void 0;
7
7
  var SPACING_SCALE = {
8
+ 'sp-0': 0,
8
9
  'sp-25': 2,
9
10
  'sp-50': 4,
10
11
  'sp-75': 6,
@@ -12,6 +13,7 @@ var SPACING_SCALE = {
12
13
  'sp-200': 16,
13
14
  'sp-300': 24,
14
15
  'sp-400': 32,
16
+ 'sp-500': 40,
15
17
  'sp-600': 48,
16
18
  'sp-800': 64
17
19
  };
package/dist/cjs/index.js CHANGED
@@ -1,8 +1,39 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
3
5
  Object.defineProperty(exports, "__esModule", {
4
6
  value: true
5
7
  });
6
- exports.default = void 0;
7
- var _default = {};
8
- exports.default = _default;
8
+ Object.defineProperty(exports, "UNSAFE_Box", {
9
+ enumerable: true,
10
+ get: function get() {
11
+ return _box.default;
12
+ }
13
+ });
14
+ Object.defineProperty(exports, "UNSAFE_Inline", {
15
+ enumerable: true,
16
+ get: function get() {
17
+ return _inline.default;
18
+ }
19
+ });
20
+ Object.defineProperty(exports, "UNSAFE_Stack", {
21
+ enumerable: true,
22
+ get: function get() {
23
+ return _stack.default;
24
+ }
25
+ });
26
+ Object.defineProperty(exports, "UNSAFE_Text", {
27
+ enumerable: true,
28
+ get: function get() {
29
+ return _text.default;
30
+ }
31
+ });
32
+
33
+ var _box = _interopRequireDefault(require("./components/box.partial"));
34
+
35
+ var _text = _interopRequireDefault(require("./components/text.partial"));
36
+
37
+ var _inline = _interopRequireDefault(require("./components/inline.partial"));
38
+
39
+ var _stack = _interopRequireDefault(require("./components/stack.partial"));
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/ds-explorations",
3
- "version": "0.0.2",
3
+ "version": "0.1.1",
4
4
  "sideEffects": false
5
5
  }