dtable-ui-component 5.0.10 → 5.0.11

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.
@@ -7,15 +7,14 @@
7
7
  background-clip: padding-box;
8
8
  border: 1px solid rgba(0, 40, 100, 0.12);
9
9
  border-radius: 3px;
10
- transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
10
+ padding: 4px;
11
11
  }
12
12
 
13
13
  .radio-group-options {
14
14
  height: 100%;
15
15
  display: flex;
16
16
  align-items: center;
17
- justify-content: center;
18
- padding: 4px;
17
+ position: relative;
19
18
  }
20
19
 
21
20
  .radio-group-options .radio-group-button {
@@ -29,20 +28,42 @@
29
28
  text-overflow: ellipsis;
30
29
  white-space: nowrap;
31
30
  border-radius: 3px;
31
+ z-index: 2;
32
32
  }
33
33
 
34
34
  .radio-group-options .radio-group-button:hover {
35
35
  cursor: pointer;
36
+ }
37
+
38
+ .radio-group-options .radio-group-button:not(.active):hover {
36
39
  background-color: #f0f0f0;
37
40
  }
38
41
 
39
- .radio-group-options .radio-group-button.readOnly {
40
- cursor: default;
41
- opacity: 0.6;
42
+ .radio-group-options .radio-group-button.active {
43
+ color:#fff;
44
+ }
45
+
46
+ .radio-group-options .radio-group-slider {
47
+ display: inline-flex;
48
+ position: absolute;
49
+ height: 100%;
50
+ transition: 150ms cubic-bezier(.4, 0, .2, 1);
51
+ border-radius: 3px;
52
+ z-index: 1;
53
+ }
54
+
55
+ .radio-group-options .radio-group-button:nth-of-type(1).active ~ .radio-group-slider {
56
+ transform:translateX(0%);
57
+ }
58
+
59
+ .radio-group-options .radio-group-button:nth-of-type(2).active ~ .radio-group-slider {
60
+ transform:translateX(100%);
61
+ }
62
+
63
+ .radio-group-options .radio-group-button:nth-of-type(3).active ~ .radio-group-slider {
64
+ transform:translateX(200%);
42
65
  }
43
66
 
44
- .radio-group-options .radio-group-button.btn-primary:hover {
45
- color: #fff;
46
- background-color: #ED7109;
47
- border-color: #ED7109;
67
+ .radio-group-options .radio-group-button:nth-of-type(4).active ~ .radio-group-slider {
68
+ transform:translateX(300%);
48
69
  }
@@ -24,6 +24,13 @@ class DTableRadioGroup extends _react.default.Component {
24
24
  activeOption: props.activeOption
25
25
  };
26
26
  }
27
+ componentDidMount() {
28
+ if (!this.btn) return;
29
+ const {
30
+ width
31
+ } = this.btn.getBoundingClientRect();
32
+ this.slider.style.width = "".concat(width, "px");
33
+ }
27
34
  componentDidUpdate(prevProps) {
28
35
  if (this.props.activeOption !== prevProps.activeOption) {
29
36
  this.setState({
@@ -48,10 +55,14 @@ class DTableRadioGroup extends _react.default.Component {
48
55
  const displayOption = optionsDisplay && optionsDisplay[option] || '';
49
56
  return /*#__PURE__*/_react.default.createElement("div", {
50
57
  key: option,
51
- className: "radio-group-button ".concat(isActive ? 'btn-primary' : ''),
58
+ ref: ref => this.btn = ref,
59
+ className: "radio-group-button ".concat(isActive ? 'active' : ''),
52
60
  "data-option": option,
53
61
  onClick: this.onSelectChanged
54
62
  }, displayOption);
63
+ }), /*#__PURE__*/_react.default.createElement("span", {
64
+ className: "radio-group-slider btn-primary",
65
+ ref: ref => this.slider = ref
55
66
  })));
56
67
  }
57
68
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dtable-ui-component",
3
- "version": "5.0.10",
3
+ "version": "5.0.11",
4
4
  "main": "./lib/index.js",
5
5
  "dependencies": {
6
6
  "@seafile/react-image-lightbox": "2.0.5",