tntd 2.8.42 → 2.8.44

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 (60) hide show
  1. package/es/exception/exception.less +1 -0
  2. package/es/handle-icon/index.js +128 -115
  3. package/es/handle-icon/index.js.map +1 -1
  4. package/es/index.js +7 -0
  5. package/es/index.js.map +1 -1
  6. package/es/index.less +1 -0
  7. package/es/scroll-bar/Bar.js +91 -0
  8. package/es/scroll-bar/Bar.js.map +1 -0
  9. package/es/scroll-bar/Context.js +13 -0
  10. package/es/scroll-bar/Context.js.map +1 -0
  11. package/es/scroll-bar/ScrollBar.js +94 -0
  12. package/es/scroll-bar/ScrollBar.js.map +1 -0
  13. package/es/scroll-bar/Thumb.js +125 -0
  14. package/es/scroll-bar/Thumb.js.map +1 -0
  15. package/es/scroll-bar/index.js +10 -0
  16. package/es/scroll-bar/index.js.map +1 -0
  17. package/es/scroll-bar/scrollBar.less +59 -0
  18. package/es/scroll-bar/util.js +39 -0
  19. package/es/scroll-bar/util.js.map +1 -0
  20. package/es/style/core/base.less +2 -0
  21. package/es/style/mixins/index.less +1 -0
  22. package/es/style/mixins/scrollbar.less +54 -0
  23. package/lib/exception/exception.less +1 -0
  24. package/lib/handle-icon/index.d.ts.map +1 -1
  25. package/lib/handle-icon/index.js +159 -115
  26. package/lib/handle-icon/index.js.map +1 -1
  27. package/lib/index.d.ts +1 -0
  28. package/lib/index.d.ts.map +1 -1
  29. package/lib/index.js +7 -0
  30. package/lib/index.js.map +1 -1
  31. package/lib/index.less +1 -0
  32. package/lib/scroll-bar/Bar.d.ts +4 -0
  33. package/lib/scroll-bar/Bar.d.ts.map +1 -0
  34. package/lib/scroll-bar/Bar.js +169 -0
  35. package/lib/scroll-bar/Bar.js.map +1 -0
  36. package/lib/scroll-bar/Context.d.ts +7 -0
  37. package/lib/scroll-bar/Context.d.ts.map +1 -0
  38. package/lib/scroll-bar/Context.js +17 -0
  39. package/lib/scroll-bar/Context.js.map +1 -0
  40. package/lib/scroll-bar/ScrollBar.d.ts +4 -0
  41. package/lib/scroll-bar/ScrollBar.d.ts.map +1 -0
  42. package/lib/scroll-bar/ScrollBar.js +129 -0
  43. package/lib/scroll-bar/ScrollBar.js.map +1 -0
  44. package/lib/scroll-bar/Thumb.d.ts +3 -0
  45. package/lib/scroll-bar/Thumb.d.ts.map +1 -0
  46. package/lib/scroll-bar/Thumb.js +203 -0
  47. package/lib/scroll-bar/Thumb.js.map +1 -0
  48. package/lib/scroll-bar/index.d.ts +3 -0
  49. package/lib/scroll-bar/index.d.ts.map +1 -0
  50. package/lib/scroll-bar/index.js +14 -0
  51. package/lib/scroll-bar/index.js.map +1 -0
  52. package/lib/scroll-bar/scrollBar.less +59 -0
  53. package/lib/scroll-bar/util.d.ts +40 -0
  54. package/lib/scroll-bar/util.d.ts.map +1 -0
  55. package/lib/scroll-bar/util.js +72 -0
  56. package/lib/scroll-bar/util.js.map +1 -0
  57. package/lib/style/core/base.less +2 -0
  58. package/lib/style/mixins/index.less +1 -0
  59. package/lib/style/mixins/scrollbar.less +54 -0
  60. package/package.json +1 -1
@@ -0,0 +1,59 @@
1
+ .tntd-scroll-bar {
2
+ position: relative;
3
+ height: 100%;
4
+ overflow: hidden;
5
+ }
6
+ .tntd-scroll-bar-wrap {
7
+ height: 100%;
8
+ overflow: auto;
9
+ }
10
+ .tntd-scroll-bar-wrap-hidden-default {
11
+ scrollbar-width: none;
12
+ &::-webkit-scrollbar {
13
+ display: none;
14
+ }
15
+ }
16
+ .tntd-scroll-bar-view {
17
+ width: fit-content;
18
+ min-width: 100%;
19
+ }
20
+ .tntd-scroll-bar-bar {
21
+ position: absolute;
22
+ right: 2px;
23
+ bottom: 2px;
24
+ z-index: 1;
25
+ border-radius: 4px;
26
+
27
+ &.vertical {
28
+ top: 2px;
29
+ width: 6px;
30
+
31
+ > div {
32
+ width: 100%;
33
+ }
34
+ }
35
+
36
+ &.horizontal {
37
+ left: 2px;
38
+ height: 6px;
39
+
40
+ > div {
41
+ height: 100%;
42
+ }
43
+ }
44
+ }
45
+ .tntd-scroll-bar-thumb {
46
+ position: relative;
47
+ display: block;
48
+ width: 0;
49
+ height: 0;
50
+ cursor: pointer;
51
+ background-color: #909399;
52
+ border-radius: inherit;
53
+ opacity: 0.3;
54
+ transition: 0.3s background-color;
55
+
56
+ &:hover {
57
+ opacity: 0.5;
58
+ }
59
+ }
@@ -0,0 +1,40 @@
1
+ export const GAP: 4;
2
+ export namespace BAR_MAP {
3
+ namespace vertical {
4
+ const offset: string;
5
+ const scroll: string;
6
+ const scrollSize: string;
7
+ const size: string;
8
+ const key: string;
9
+ const axis: string;
10
+ const client: string;
11
+ const direction: string;
12
+ }
13
+ namespace horizontal {
14
+ const offset_1: string;
15
+ export { offset_1 as offset };
16
+ const scroll_1: string;
17
+ export { scroll_1 as scroll };
18
+ const scrollSize_1: string;
19
+ export { scrollSize_1 as scrollSize };
20
+ const size_1: string;
21
+ export { size_1 as size };
22
+ const key_1: string;
23
+ export { key_1 as key };
24
+ const axis_1: string;
25
+ export { axis_1 as axis };
26
+ const client_1: string;
27
+ export { client_1 as client };
28
+ const direction_1: string;
29
+ export { direction_1 as direction };
30
+ }
31
+ }
32
+ export function renderThumbStyle({ move, size, bar }: {
33
+ move: any;
34
+ size: any;
35
+ bar: any;
36
+ }): {
37
+ [x: number]: any;
38
+ transform: string;
39
+ };
40
+ //# sourceMappingURL=util.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../src/scroll-bar/util.js"],"names":[],"mappings":"AAAA,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBb;;;;;;;EAGL"}
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.renderThumbStyle = exports.GAP = exports.BAR_MAP = void 0;
7
+ function _typeof(o) {
8
+ "@babel/helpers - typeof";
9
+
10
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
11
+ return typeof o;
12
+ } : function (o) {
13
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
14
+ }, _typeof(o);
15
+ }
16
+ function _defineProperty(obj, key, value) {
17
+ key = _toPropertyKey(key);
18
+ if (key in obj) {
19
+ Object.defineProperty(obj, key, {
20
+ value: value,
21
+ enumerable: true,
22
+ configurable: true,
23
+ writable: true
24
+ });
25
+ } else {
26
+ obj[key] = value;
27
+ }
28
+ return obj;
29
+ }
30
+ function _toPropertyKey(t) {
31
+ var i = _toPrimitive(t, "string");
32
+ return "symbol" == _typeof(i) ? i : i + "";
33
+ }
34
+ function _toPrimitive(t, r) {
35
+ if ("object" != _typeof(t) || !t) return t;
36
+ var e = t[Symbol.toPrimitive];
37
+ if (void 0 !== e) {
38
+ var i = e.call(t, r || "default");
39
+ if ("object" != _typeof(i)) return i;
40
+ throw new TypeError("@@toPrimitive must return a primitive value.");
41
+ }
42
+ return ("string" === r ? String : Number)(t);
43
+ }
44
+ var GAP = exports.GAP = 4; // top 2 + bottom 2 of bar instance
45
+ var BAR_MAP = exports.BAR_MAP = {
46
+ vertical: {
47
+ offset: 'offsetHeight',
48
+ scroll: 'scrollTop',
49
+ scrollSize: 'scrollHeight',
50
+ size: 'height',
51
+ key: 'vertical',
52
+ axis: 'Y',
53
+ client: 'clientY',
54
+ direction: 'top'
55
+ },
56
+ horizontal: {
57
+ offset: 'offsetWidth',
58
+ scroll: 'scrollLeft',
59
+ scrollSize: 'scrollWidth',
60
+ size: 'width',
61
+ key: 'horizontal',
62
+ axis: 'X',
63
+ client: 'clientX',
64
+ direction: 'left'
65
+ }
66
+ };
67
+ var renderThumbStyle = exports.renderThumbStyle = function renderThumbStyle(_ref) {
68
+ var move = _ref.move,
69
+ size = _ref.size,
70
+ bar = _ref.bar;
71
+ return _defineProperty(_defineProperty({}, bar.size, size), "transform", "translate".concat(bar.axis, "(").concat(move, "%)"));
72
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/scroll-bar/util.js"],"names":[],"mappings":";;;AAAa,QAAA,GAAG,GAAG,CAAC,CAAA,CAAC,mCAAmC;AAE3C,QAAA,OAAO,GAAG;IACrB,QAAQ,EAAE;QACR,MAAM,EAAE,cAAc;QACtB,MAAM,EAAE,WAAW;QACnB,UAAU,EAAE,cAAc;QAC1B,IAAI,EAAE,QAAQ;QACd,GAAG,EAAE,UAAU;QACf,IAAI,EAAE,GAAG;QACT,MAAM,EAAE,SAAS;QACjB,SAAS,EAAE,KAAK;KACjB;IACD,UAAU,EAAE;QACV,MAAM,EAAE,aAAa;QACrB,MAAM,EAAE,YAAY;QACpB,UAAU,EAAE,aAAa;QACzB,IAAI,EAAE,OAAO;QACb,GAAG,EAAE,YAAY;QACjB,IAAI,EAAE,GAAG;QACT,MAAM,EAAE,SAAS;QACjB,SAAS,EAAE,MAAM;KAClB;CACF,CAAA;AAEM,MAAM,gBAAgB,GAAG,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,CAAC;IACxD,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI;IAChB,SAAS,EAAE,YAAY,GAAG,CAAC,IAAI,IAAI,IAAI,IAAI;CAC5C,CAAC,CAAA;AAHW,QAAA,gBAAgB,oBAG3B","sourcesContent":["export const GAP = 4 // top 2 + bottom 2 of bar instance\n\nexport const BAR_MAP = {\n vertical: {\n offset: 'offsetHeight',\n scroll: 'scrollTop',\n scrollSize: 'scrollHeight',\n size: 'height',\n key: 'vertical',\n axis: 'Y',\n client: 'clientY',\n direction: 'top',\n },\n horizontal: {\n offset: 'offsetWidth',\n scroll: 'scrollLeft',\n scrollSize: 'scrollWidth',\n size: 'width',\n key: 'horizontal',\n axis: 'X',\n client: 'clientX',\n direction: 'left',\n },\n}\n\nexport const renderThumbStyle = ({ move, size, bar }) => ({\n [bar.size]: size,\n transform: `translate${bar.axis}(${move}%)`,\n})\n"]}
@@ -508,3 +508,5 @@ mark {
508
508
  .clearfix {
509
509
  .clearfix();
510
510
  }
511
+
512
+ .scrollbar-base();
@@ -8,3 +8,4 @@
8
8
  @import 'reset';
9
9
  @import 'operation-unit';
10
10
  @import 'typography';
11
+ @import 'scrollbar';
@@ -0,0 +1,54 @@
1
+ @scrollbar-width: 8px; // 滚动条基础宽度(Webkit有效,Firefox仅支持thin/none/auto)
2
+ @scrollbar-radius: 3px; // 滚动条圆角
3
+ @track-color: transparent; // 默认轨道颜色(透明更适配不同背景)
4
+ @thumb-color: #C9D2DD; // 默认滑块颜色(浅灰)
5
+ @thumb-hover: #8B919E; // 悬停滑块颜色(深灰)
6
+
7
+ /* 深色主题变量(通过覆盖变量实现主题切换) */
8
+ // @dark-track: rgba(255, 255, 255, 0.05); // 深色轨道
9
+ // @dark-thumb: rgba(255, 255, 255, 0.2); // 深色滑块
10
+ // @dark-thumb-hover: rgba(255, 255, 255, 0.3); // 深色悬停
11
+
12
+ /* 核心滚动条混合(建议添加到需要滚动的容器类) */
13
+ .scrollbar-base() {
14
+ /* Firefox兼容 */
15
+ // scrollbar-width: none; // 仅支持thin/none/auto,thin对应约6px宽度
16
+ /* 关键:防止滚动条占用容器内空间 */
17
+ // box-sizing: border-box;
18
+
19
+ /* Webkit内核(Chrome/Safari等) */
20
+ &::-webkit-scrollbar {
21
+ width: @scrollbar-width; // 垂直滚动条宽度
22
+ height: @scrollbar-width; // 水平滚动条高度
23
+ }
24
+
25
+ &::-webkit-scrollbar-track {
26
+ background: @track-color;
27
+ border-radius: @scrollbar-radius;
28
+ margin: 2px 0; // 上下留空避免贴边(垂直滚动条) // 若需要水平滚动条留空可添加 margin: 0 2px;
29
+ }
30
+ &::-webkit-scrollbar-track-piece {
31
+ -webkit-border-radius: 0;
32
+ }
33
+
34
+ &::-webkit-scrollbar-thumb {
35
+ height: @scrollbar-width;
36
+ background: @thumb-color;
37
+ border-radius: @scrollbar-radius;
38
+ transition: background 0.2s ease; // 颜色过渡动画
39
+ cursor: pointer;
40
+ }
41
+
42
+ &::-webkit-scrollbar-thumb:hover{
43
+ background: @thumb-hover; // 直接修改背景色更自然
44
+ opacity: 0.8;
45
+ }
46
+
47
+ /* 可选:隐藏滚动条但保留滚动功能(需配合overflow: auto) */
48
+ &.scrollbar-hidden {
49
+ &::-webkit-scrollbar {
50
+ width: 0;
51
+ height: 0;
52
+ }
53
+ }
54
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tntd",
3
- "version": "2.8.42",
3
+ "version": "2.8.44",
4
4
  "license": "MIT",
5
5
  "scripts": {
6
6
  "start": "heft start --storybook",