@twreporter/react-components 8.17.0-rc.1 → 8.17.0-rc.2
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 +8 -0
- package/lib/button/utils/theme.js +3 -3
- package/lib/checkbox/checkbox.stories.js +39 -0
- package/lib/checkbox/index.js +77 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
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.17.0-rc.2](https://github.com/twreporter/twreporter-npm-packages/compare/@twreporter/react-components@8.17.0-rc.1...@twreporter/react-components@8.17.0-rc.2) (2023-04-12)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @twreporter/react-components
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
# [8.17.0-rc.1](https://github.com/twreporter/twreporter-npm-packages/compare/@twreporter/react-components@8.17.0-rc.0...@twreporter/react-components@8.17.0-rc.1) (2023-03-09)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @twreporter/react-components
|
|
@@ -410,19 +410,19 @@ var getActiveTextButtonTheme = function getActiveTextButtonTheme(theme) {
|
|
|
410
410
|
|
|
411
411
|
case _constants.TEXT_BUTTON_THEME.brand:
|
|
412
412
|
return {
|
|
413
|
-
color: _color.colorBrand.
|
|
413
|
+
color: _color.colorBrand.dark,
|
|
414
414
|
hoverColor: _color.colorBrand.dark
|
|
415
415
|
};
|
|
416
416
|
|
|
417
417
|
case _constants.TEXT_BUTTON_THEME.dark:
|
|
418
418
|
return {
|
|
419
|
-
color: _color.
|
|
419
|
+
color: _color.colorBrand.heavy,
|
|
420
420
|
hoverColor: _color.colorBrand.heavy
|
|
421
421
|
};
|
|
422
422
|
|
|
423
423
|
case _constants.TEXT_BUTTON_THEME.light:
|
|
424
424
|
return {
|
|
425
|
-
color: _color.colorGrayscale.
|
|
425
|
+
color: _color.colorGrayscale.gray800,
|
|
426
426
|
hoverColor: _color.colorGrayscale.gray800
|
|
427
427
|
};
|
|
428
428
|
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.checkbox = exports["default"] = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _ = _interopRequireDefault(require("."));
|
|
11
|
+
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
|
+
|
|
14
|
+
var _default = {
|
|
15
|
+
title: 'Checkbox',
|
|
16
|
+
component: _["default"],
|
|
17
|
+
argTypes: {
|
|
18
|
+
value: {
|
|
19
|
+
defaultValue: false,
|
|
20
|
+
options: [true, false]
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
exports["default"] = _default;
|
|
25
|
+
|
|
26
|
+
var Template = function Template(args) {
|
|
27
|
+
return /*#__PURE__*/_react["default"].createElement(_["default"], args);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
var checkbox = Template.bind({});
|
|
31
|
+
exports.checkbox = checkbox;
|
|
32
|
+
checkbox.args = {
|
|
33
|
+
label: '藝術',
|
|
34
|
+
value: false,
|
|
35
|
+
disabled: false,
|
|
36
|
+
onChange: function onChange(e) {
|
|
37
|
+
console.log('callback', e.target.checked);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = exports.Checkbox = 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 _paragraph = require("../text/paragraph");
|
|
15
|
+
|
|
16
|
+
var _color = require("@twreporter/core/lib/constants/color");
|
|
17
|
+
|
|
18
|
+
var _excluded = ["value", "label", "disabled", "onChange"];
|
|
19
|
+
|
|
20
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
21
|
+
|
|
22
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
23
|
+
|
|
24
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
25
|
+
|
|
26
|
+
var Container = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
27
|
+
displayName: "checkbox__Container",
|
|
28
|
+
componentId: "vzoxib-0"
|
|
29
|
+
})(["display:flex;flex-direction:'row';"]);
|
|
30
|
+
|
|
31
|
+
var Input = /*#__PURE__*/_styledComponents["default"].input.withConfig({
|
|
32
|
+
displayName: "checkbox__Input",
|
|
33
|
+
componentId: "vzoxib-1"
|
|
34
|
+
})(["width:16px;height:16px;border:solid 1px;border-radius:2px;accent-color:", ";margin-left:0px;margin-right:8px;&:enabled:not(:checked){border-color:", ";background:rgba(0,0,0,0);-webkit-appearance:none;-moz-appearance:none;appearance:none;}"], _color.colorGrayscale.gray800, _color.colorGrayscale.gray800);
|
|
35
|
+
|
|
36
|
+
var ColorP1 = /*#__PURE__*/(0, _styledComponents["default"])(_paragraph.P1).withConfig({
|
|
37
|
+
displayName: "checkbox__ColorP1",
|
|
38
|
+
componentId: "vzoxib-2"
|
|
39
|
+
})(["color:", ";"], function (props) {
|
|
40
|
+
return props.disabled ? _color.colorGrayscale.gray400 : _color.colorGrayscale.gray800;
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
var Checkbox = function Checkbox(_ref) {
|
|
44
|
+
var _ref$value = _ref.value,
|
|
45
|
+
value = _ref$value === void 0 ? false : _ref$value,
|
|
46
|
+
_ref$label = _ref.label,
|
|
47
|
+
label = _ref$label === void 0 ? '' : _ref$label,
|
|
48
|
+
_ref$disabled = _ref.disabled,
|
|
49
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
50
|
+
_ref$onChange = _ref.onChange,
|
|
51
|
+
onChange = _ref$onChange === void 0 ? function () {} : _ref$onChange,
|
|
52
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
53
|
+
|
|
54
|
+
var handleChange = function handleChange(e) {
|
|
55
|
+
onChange && onChange(e);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
return /*#__PURE__*/_react["default"].createElement(Container, props, /*#__PURE__*/_react["default"].createElement(Input, {
|
|
59
|
+
type: "checkbox",
|
|
60
|
+
checked: value,
|
|
61
|
+
disabled: disabled,
|
|
62
|
+
onChange: handleChange
|
|
63
|
+
}), label && /*#__PURE__*/_react["default"].createElement(ColorP1, {
|
|
64
|
+
text: label,
|
|
65
|
+
disabled: disabled
|
|
66
|
+
}));
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
exports.Checkbox = Checkbox;
|
|
70
|
+
Checkbox.propTypes = {
|
|
71
|
+
value: _propTypes["default"].bool.isRequired,
|
|
72
|
+
label: _propTypes["default"].string,
|
|
73
|
+
disabled: _propTypes["default"].bool,
|
|
74
|
+
onChange: _propTypes["default"].func.isRequired
|
|
75
|
+
};
|
|
76
|
+
var _default = Checkbox;
|
|
77
|
+
exports["default"] = _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twreporter/react-components",
|
|
3
|
-
"version": "8.17.0-rc.
|
|
3
|
+
"version": "8.17.0-rc.2",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"repository": "https://github.com/twreporter/twreporter-npm-packages.git",
|
|
6
6
|
"author": "twreporter <developer@twreporter.org>",
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"babel-loader": "^8.2.4",
|
|
45
45
|
"chromatic": "^6.5.4"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "498b86cff656356a619bc03ba371fde8399a2f99"
|
|
48
48
|
}
|