@twreporter/react-components 8.27.1-rc.0 → 8.27.1-rc.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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,18 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [8.27.1-rc.1](https://github.com/twreporter/twreporter-npm-packages/compare/@twreporter/react-components@8.27.1-rc.0...@twreporter/react-components@8.27.1-rc.1) (2024-04-17)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * add background color control ([dd103fc](https://github.com/twreporter/twreporter-npm-packages/commit/dd103fc332a5c877e0b078cb98682aefd68ad900))
12
+ * update color in colorGrayscale & add color story ([f27d752](https://github.com/twreporter/twreporter-npm-packages/commit/f27d752ae97e15d64e59126dfed07f09471cff4a))
13
+
14
+
15
+
16
+
17
+
6
18
  ## [8.27.1-rc.0](https://github.com/twreporter/twreporter-npm-packages/compare/@twreporter/react-components@8.27.0...@twreporter/react-components@8.27.1-rc.0) (2024-04-17)
7
19
 
8
20
  **Note:** Version bump only for package @twreporter/react-components
@@ -0,0 +1,160 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = exports.colorSet = void 0;
7
+
8
+ var _react = _interopRequireDefault(require("react"));
9
+
10
+ var _propTypes = _interopRequireDefault(require("prop-types"));
11
+
12
+ var _styledComponents = _interopRequireDefault(require("styled-components"));
13
+
14
+ var _color = require("@twreporter/core/lib/constants/color");
15
+
16
+ var _getEnumArg = require("./storybook/utils/get-enum-arg");
17
+
18
+ var _paragraph = require("./text/paragraph");
19
+
20
+ var _map = _interopRequireDefault(require("lodash/map"));
21
+
22
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
23
+
24
+ /* eslint react/display-name:0 */
25
+ // lodash
26
+ var _ = {
27
+ map: _map["default"]
28
+ };
29
+
30
+ var Container = /*#__PURE__*/_styledComponents["default"].div.withConfig({
31
+ displayName: "colorstories__Container",
32
+ componentId: "sc-1icwolq-0"
33
+ })(["display:flex;width:100vw;height:100vh;background-color:", ";"], function (props) {
34
+ return props.background;
35
+ });
36
+
37
+ var Box = /*#__PURE__*/_styledComponents["default"].div.withConfig({
38
+ displayName: "colorstories__Box",
39
+ componentId: "sc-1icwolq-1"
40
+ })(["display:flex;align-items:center;justify-content:center;flex-direction:column;"]);
41
+
42
+ var Color = /*#__PURE__*/_styledComponents["default"].div.withConfig({
43
+ displayName: "colorstories__Color",
44
+ componentId: "sc-1icwolq-2"
45
+ })(["height:", ";width:", ";background-color:", ";"], function (props) {
46
+ return props.height;
47
+ }, function (props) {
48
+ return props.width;
49
+ }, function (props) {
50
+ return props.color;
51
+ });
52
+
53
+ var P2Gray600 = /*#__PURE__*/(0, _styledComponents["default"])(_paragraph.P2).withConfig({
54
+ displayName: "colorstories__P2Gray600",
55
+ componentId: "sc-1icwolq-3"
56
+ })(["color:", ";"], _color.colorGrayscale.gray600);
57
+ var ColorText = /*#__PURE__*/(0, _styledComponents["default"])(_paragraph.P2).withConfig({
58
+ displayName: "colorstories__ColorText",
59
+ componentId: "sc-1icwolq-4"
60
+ })(["", " color:", ";"], function (props) {
61
+ return props.show ? '' : 'display: none;';
62
+ }, _color.colorGrayscale.gray500);
63
+ var ColorSetEnum = {
64
+ BRAND: 'brand',
65
+ GRAYSCALE: 'grayscale',
66
+ OPACITY: 'opacity',
67
+ PHOTO: 'photography',
68
+ PODCAST: 'podcast',
69
+ SUPPORTIVE: 'supportive',
70
+ SEMANTIC: 'semantic',
71
+ PINK_ARTICLE: 'pink_article'
72
+ };
73
+
74
+ var getColorSet = function getColorSet(type) {
75
+ switch (type) {
76
+ case ColorSetEnum.BRAND:
77
+ return _color.colorBrand;
78
+
79
+ case ColorSetEnum.GRAYSCALE:
80
+ return _color.colorGrayscale;
81
+
82
+ case ColorSetEnum.OPACITY:
83
+ return _color.colorOpacity;
84
+
85
+ case ColorSetEnum.PHOTO:
86
+ return _color.colorPhoto;
87
+
88
+ case ColorSetEnum.PODCAST:
89
+ return _color.colorPodcast;
90
+
91
+ case ColorSetEnum.SUPPORTIVE:
92
+ return _color.colorSupportive;
93
+
94
+ case ColorSetEnum.SEMANTIC:
95
+ return _color.COLOR_SEMANTIC;
96
+
97
+ case ColorSetEnum['PINK_ARTICLE']:
98
+ return _color.COLOR_PINK_ARTICLE;
99
+ }
100
+ };
101
+
102
+ var ColorSet = function ColorSet(_ref) {
103
+ var height = _ref.height,
104
+ width = _ref.width,
105
+ type = _ref.type,
106
+ showColorText = _ref.showColorText,
107
+ background = _ref.background;
108
+ var colorSet = getColorSet(type);
109
+
110
+ var colorBoxes = _.map(colorSet, function (color, key) {
111
+ return /*#__PURE__*/_react["default"].createElement(Box, {
112
+ key: "".concat(type, "-").concat(key)
113
+ }, /*#__PURE__*/_react["default"].createElement(P2Gray600, {
114
+ text: key
115
+ }), /*#__PURE__*/_react["default"].createElement(Color, {
116
+ height: height,
117
+ width: width,
118
+ color: color
119
+ }), /*#__PURE__*/_react["default"].createElement(ColorText, {
120
+ text: color,
121
+ show: showColorText
122
+ }));
123
+ });
124
+
125
+ return /*#__PURE__*/_react["default"].createElement(Container, {
126
+ background: background
127
+ }, colorBoxes);
128
+ };
129
+
130
+ ColorSet.propTypes = {
131
+ background: _propTypes["default"].string,
132
+ height: _propTypes["default"].string,
133
+ width: _propTypes["default"].string,
134
+ type: _propTypes["default"].oneOf(Object.values(ColorSetEnum)),
135
+ showColorText: _propTypes["default"].bool
136
+ };
137
+ var _default = {
138
+ title: 'Color',
139
+ component: ColorSet,
140
+ argTypes: {
141
+ type: (0, _getEnumArg.getRadioArg)(ColorSetEnum, ColorSetEnum.GRAYSCALE),
142
+ background: {
143
+ control: {
144
+ type: 'color',
145
+ presetColors: [_color.colorGrayscale.gray100, _color.colorPhoto.dark, _color.colorGrayscale.gray600]
146
+ }
147
+ }
148
+ }
149
+ };
150
+ exports["default"] = _default;
151
+ var colorSet = {
152
+ args: {
153
+ height: '100px',
154
+ width: '100px',
155
+ type: ColorSetEnum.GRAYSCALE,
156
+ showColorText: false,
157
+ background: _color.colorGrayscale.gray100
158
+ }
159
+ };
160
+ exports.colorSet = colorSet;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twreporter/react-components",
3
- "version": "8.27.1-rc.0",
3
+ "version": "8.27.1-rc.1",
4
4
  "main": "lib/index.js",
5
5
  "repository": "https://github.com/twreporter/twreporter-npm-packages.git",
6
6
  "author": "twreporter <developer@twreporter.org>",
@@ -15,8 +15,8 @@
15
15
  "chromatic": "npx chromatic --exit-zero-on-changes"
16
16
  },
17
17
  "dependencies": {
18
- "@twreporter/core": "^1.19.1-rc.0",
19
- "@twreporter/redux": "^7.11.3-rc.0",
18
+ "@twreporter/core": "^1.19.1-rc.1",
19
+ "@twreporter/redux": "^7.11.3-rc.1",
20
20
  "fontfaceobserver-es": "^3.3.3",
21
21
  "hoist-non-react-statics": "^2.3.1",
22
22
  "lodash": "^4.0.0",
@@ -51,5 +51,5 @@
51
51
  "react-dom": "^16.0.0",
52
52
  "storybook": "^7.5.2"
53
53
  },
54
- "gitHead": "2ccfeb87fefdcc4fc6c267c01987f41da353b65a"
54
+ "gitHead": "f0bdcc508dd75523ce1a33da622598462660299e"
55
55
  }