New Huajishe Check ChaoXing

This commit is contained in:
e2hang
2025-10-01 10:01:52 +08:00
parent 240b884eac
commit 80be8ae3cf
1094 changed files with 61709 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
:: BASE_DOC ::
## API
### Progress Props
name | type | default | description | required
-- | -- | -- | -- | --
style | Object | - | CSS(Cascading Style Sheets) | N
custom-style | Object | - | CSS(Cascading Style Sheets)used to set style on virtual component | N
color | String / Object / Array | '' | Typescript`string \| Array<string> \| Record<string, string>` | N
label | String / Boolean / Slot | true | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
percentage | Number | 0 | \- | N
status | String | - | options: success/error/warning/active。Typescript`ProgressStatus` `type ProgressStatus = 'success' \| 'error' \| 'warning' \| 'active'`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/progress/type.ts) | N
stroke-width | String / Number | - | \- | N
theme | String | line | options: line/plump/circle。Typescript`ProgressTheme` `type ProgressTheme = 'line' \| 'plump' \| 'circle'`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/progress/type.ts) | N
track-color | String | '' | \- | N
### Progress External Classes
className | Description
-- | --
t-class | \-
t-class-bar | \-
t-class-label | \-
### CSS Variables
The component provides the following CSS variables, which can be used to customize styles.
Name | Default Value | Description
-- | -- | --
--td-progress-circle-inner-bg-color | @font-white-1 | -
--td-progress-circle-width | 224rpx | -
--td-progress-circle-from | 0deg | -
--td-progress-inner-bg-color | @brand-color | -
--td-progress-line-stroke-width | 12rpx | -
--td-progress-stroke-circle-width | 12rpx | -
--td-progress-stroke-plump-width | 40rpx | -
--td-progress-track-bg-color | @bg-color-component | -
--td-progress-circle-label-font-size | 40rpx | -
--td-progress-circle-label-line-height | 56rpx | -
--td-progress-circle-label-font-weight | 700 | -

View File

@@ -0,0 +1,105 @@
---
title: Progress 进度条
description: 用于展示任务当前的进度。
spline: message
isComponent: true
---
<span class="coverages-badge" style="margin-right: 10px"><img src="https://img.shields.io/badge/coverages%3A%20lines-100%25-blue" /></span><span class="coverages-badge" style="margin-right: 10px"><img src="https://img.shields.io/badge/coverages%3A%20functions-100%25-blue" /></span><span class="coverages-badge" style="margin-right: 10px"><img src="https://img.shields.io/badge/coverages%3A%20statements-100%25-blue" /></span><span class="coverages-badge" style="margin-right: 10px"><img src="https://img.shields.io/badge/coverages%3A%20branches-88%25-blue" /></span>
<div style="background: #ecf2fe; display: flex; align-items: center; line-height: 20px; padding: 14px 24px; border-radius: 3px; color: #555a65">
<svg fill="none" viewBox="0 0 16 16" width="16px" height="16px" style="margin-right: 5px">
<path fill="#0052d9" d="M8 15A7 7 0 108 1a7 7 0 000 14zM7.4 4h1.2v1.2H7.4V4zm.1 2.5h1V12h-1V6.5z" fillOpacity="0.9"></path>
</svg>
该组件于 0.7.3 版本上线,请留意版本。
</div>
## 引入
### 引入组件
`app.json``page.json` 中引入组件:
```json
"usingComponents": {
"t-progress": "tdesign-miniprogram/progress/progress"
}
```
## 代码演示
<a href="https://developers.weixin.qq.com/s/qua7YimQ7tSx" title="在开发者工具中预览效果" target="_blank" rel="noopener noreferrer"> 在开发者工具中预览效果 </a>
<blockquote style="background-color: #d9e1ff; font-size: 15px; line-height: 26px;margin: 16px 0 0;padding: 16px; border-radius: 6px; color: #0052d9" >
<p>Tips: 请确保开发者工具为打开状态。导入开发者工具后依次执行npm i > 构建npm包 > 勾选 "将JS编译成ES5"</p>
</blockquote>
### 01 组件类型
基础进度条
{{ base }}
过渡样式
{{ transition }}
自定义颜色/圆角
{{ custom }}
### 02 组件状态
线性进度条
{{ line }}
百分比内显进度条
{{ plump }}
环形进度条
{{ circle }}
## API
### Progress Props
名称 | 类型 | 默认值 | 描述 | 必传
-- | -- | -- | -- | --
style | Object | - | 样式 | N
custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
color | String / Object / Array | '' | 进度条颜色。示例:'#ED7B2F' 或 'orange' 或 `['#f00', '#0ff', '#f0f']``{ '0%': '#f00', '100%': '#0ff' }``{ from: '#000', to: '#000' }` 等。TS 类型:`string \| Array<string> \| Record<string, string>` | N
label | String / Boolean / Slot | true | 进度百分比,可自定义。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
percentage | Number | 0 | 进度条百分比 | N
status | String | - | 进度条状态。可选项success/error/warning/active。TS 类型:`ProgressStatus` `type ProgressStatus = 'success' \| 'error' \| 'warning' \| 'active'`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/progress/type.ts) | N
stroke-width | String / Number | - | 进度条线宽,默认单位 `px` | N
theme | String | line | 进度条风格。值为 line标签label显示在进度条右侧值为 plump标签label显示在进度条里面值为 circle标签label显示在进度条正中间。可选项line/plump/circle。TS 类型:`ProgressTheme` `type ProgressTheme = 'line' \| 'plump' \| 'circle'`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/progress/type.ts) | N
track-color | String | '' | 进度条未完成部分颜色 | N
### Progress External Classes
类名 | 描述
-- | --
t-class | 根节点样式类
t-class-bar | 进度文字样式类
t-class-label | 标签样式类
### CSS Variables
组件提供了下列 CSS 变量,可用于自定义样式。
名称 | 默认值 | 描述
-- | -- | --
--td-progress-circle-inner-bg-color | @font-white-1 | -
--td-progress-circle-width | 224rpx | -
--td-progress-circle-from | 0deg | -
--td-progress-inner-bg-color | @brand-color | -
--td-progress-line-stroke-width | 12rpx | -
--td-progress-stroke-circle-width | 12rpx | -
--td-progress-stroke-plump-width | 40rpx | -
--td-progress-track-bg-color | @bg-color-component | -
--td-progress-circle-label-font-size | 40rpx | -
--td-progress-circle-label-line-height | 56rpx | -
--td-progress-circle-label-font-weight | 700 | -

View File

@@ -0,0 +1,24 @@
import { SuperComponent } from '../common/src/index';
export default class Progress extends SuperComponent {
externalClasses: string[];
options: {
multipleSlots: boolean;
};
properties: import("./type").TdProgressProps;
data: {
prefix: string;
classPrefix: string;
colorBar: string;
heightBar: string;
computedStatus: string;
computedProgress: number;
isIOS: boolean;
};
attached(): void;
observers: {
percentage(percentage: any): void;
color(color: any): void;
strokeWidth(strokeWidth: any): string;
trackColor(trackColor: any): void;
};
}

View File

@@ -0,0 +1,71 @@
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
import { SuperComponent, wxComponent } from '../common/src/index';
import config from '../common/config';
import props from './props';
import { getBackgroundColor } from './utils';
import { unitConvert, deviceInfo } from '../common/utils';
const { prefix } = config;
const name = `${prefix}-progress`;
let Progress = class Progress extends SuperComponent {
constructor() {
super(...arguments);
this.externalClasses = [`${prefix}-class`, `${prefix}-class-bar`, `${prefix}-class-label`];
this.options = {
multipleSlots: true,
};
this.properties = props;
this.data = {
prefix,
classPrefix: name,
colorBar: '',
heightBar: '',
computedStatus: '',
computedProgress: 0,
isIOS: false,
};
this.observers = {
percentage(percentage) {
percentage = Math.max(0, Math.min(percentage, 100));
this.setData({
computedStatus: percentage === 100 ? 'success' : '',
computedProgress: percentage,
});
},
color(color) {
this.setData({
colorBar: getBackgroundColor(color),
colorCircle: typeof color === 'object' ? '' : color,
});
},
strokeWidth(strokeWidth) {
if (!strokeWidth) {
return '';
}
this.setData({
heightBar: unitConvert(strokeWidth),
});
},
trackColor(trackColor) {
this.setData({
bgColorBar: trackColor,
});
},
};
}
attached() {
var _a;
const isIOS = !!(((_a = deviceInfo === null || deviceInfo === void 0 ? void 0 : deviceInfo.system) === null || _a === void 0 ? void 0 : _a.toLowerCase().search('ios')) + 1);
this.setData({
isIOS,
});
}
};
Progress = __decorate([
wxComponent()
], Progress);
export default Progress;

View File

@@ -0,0 +1,7 @@
{
"component": true,
"styleIsolation": "apply-shared",
"usingComponents": {
"t-icon": "../icon/icon"
}
}

View File

@@ -0,0 +1,97 @@
<import src="../common/template/icon.wxml" />
<wxs src="../common/utils.wxs" module="_" />
<wxs src="./progress.wxs" module="_this" />
<view style="{{_._style([style, customStyle])}}" class="{{classPrefix}} class">
<view
wx:if="{{theme === _this.PRO_THEME.LINE}}"
class="{{classPrefix }}--thin {{classPrefix}}--status--{{status || computedStatus}} {{prefix}}-class"
>
<view
aria-role="progressbar"
aria-valuemin="0"
aria-valuemax="100"
aria-valuenow="{{computedProgress}}"
aria-label="{{ ariaLabel || (isIOS ? _this.getIOSAriaLabel(status) : _this.getAndroidAriaLabel(status)) }}"
aria-live="polite"
class="{{classPrefix }}__bar"
style="height: {{heightBar}}px;border-radius: {{heightBar}}px;background-color: {{bgColorBar}}"
>
<view
class="{{classPrefix }}__inner {{prefix}}-class-bar"
style="background: {{colorBar}}; width: {{computedProgress + '%'}}"
></view>
</view>
<!-- aria-hidden=true 禁用掉额外的聚焦 -->
<view wx:if="{{label}}" class="{{classPrefix}}__info {{prefix}}-class-label" aria-hidden="{{ true }}">
<template
wx:if="{{_.includes(_this.STATUS, status)}}"
is="icon"
data="{{tClass: classPrefix + '__icon', size:'44rpx', name: _this.LINE_STATUS_ICON[status]}}"
></template>
<text wx:else>{{ _.isString(label)? label: computedProgress + '%' }}</text>
</view>
<slot name="label" />
</view>
<view
aria-role="progressbar"
aria-valuemin="0"
aria-valuemax="100"
aria-valuenow="{{computedProgress}}"
aria-label="{{ ariaLabel || (isIOS ? _this.getIOSAriaLabel(status) : _this.getAndroidAriaLabel(status)) }}"
aria-live="polite"
wx:if="{{theme === _this.PRO_THEME.PLUMP}}"
class="{{classPrefix}}__bar {{classPrefix}}--plump {{computedProgress > 10 ? classPrefix + '--over-ten': classPrefix + '--under-ten'}} {{classPrefix}}--status--{{status || computedStatus}} {{prefix}}-class"
style="height: {{heightBar}}px;border-radius: {{heightBar}}px;background-color: {{bgColorBar}}"
>
<view
class="{{classPrefix}}__inner {{prefix}}-class-bar"
style="background: {{colorBar}}; width: {{computedProgress}}%"
>
<view wx:if="{{label && computedProgress > 10}}" class="{{classPrefix }}__info {{prefix}}-class-label">
<text>{{ _.isString(label)? label: computedProgress + '%' }}</text>
</view>
<slot wx:if="{{computedProgress > 10}}" name="label" />
</view>
<view
wx:if="{{label && computedProgress <= 10}}"
class="{{ classPrefix }}__info {{prefix}}-class-label"
aria-hidden="{{ true }}"
>
<text>{{ _.isString(label)? label: computedProgress + '%' }}</text>
</view>
<slot wx:if="{{computedProgress <= 10}}" name="label" />
</view>
<view
wx:if="{{theme === _this.PRO_THEME.CIRCLE}}"
class="{{classPrefix}}--status--{{status || computedStatus}} {{prefix}}-class"
>
<view
aria-role="progressbar"
aria-valuemin="0"
aria-valuemax="100"
aria-valuenow="{{computedProgress}}"
aria-label="{{ ariaLabel || (isIOS ? _this.getIOSAriaLabel(status) : _this.getAndroidAriaLabel(status)) }}"
aria-live="polite"
class="{{classPrefix}}__canvas--circle"
style="background-image: conic-gradient(from var(--td-progress-circle-from), {{colorCircle || _this.STATUS_COLOR[status] || 'var(--td-progress-inner-bg-color)'}} {{computedProgress}}%, {{bgColorBar || 'var(--td-progress-track-bg-color)'}} 0%);"
>
<view
class="{{classPrefix}}__canvas--inner {{prefix}}-class-bar"
style="{{heightBar? '--td-progress-stroke-circle-width:' + heightBar + 'px' : ''}}"
>
<view wx:if="{{label}}" class="{{classPrefix}}__info {{prefix}}-class-label" aria-hidden="{{ true }}">
<template
wx:if="{{_.includes(_this.STATUS, status)}}"
is="icon"
data="{{tClass: classPrefix + '__icon', size:'96rpx', name: _this.CIRCLE_STATUS_ICON[status]}}"
></template>
<text wx:else>{{ _.isString(label)? label: computedProgress + '%' }}</text>
</view>
<slot name="label" />
</view>
</view>
</view>
</view>

View File

@@ -0,0 +1,63 @@
var STATUS = ['success', 'error', 'warning'];
var STATUS_TEXT = ['success', 'error', 'warning', 'active'];
var PRO_THEME = {
LINE: 'line',
PLUMP: 'plump',
CIRCLE: 'circle',
};
var STATUS_COLOR = {
success: '#00a870',
error: '#e34d59',
warning: '#ed7b2f',
};
var LINE_STATUS_ICON = {
success: 'check-circle-filled',
error: 'error-circle-filled',
warning: 'error-circle-filled',
};
var CIRCLE_STATUS_ICON = {
success: 'check',
error: 'close',
warning: 'error',
};
/**
*
* 1. getIOSAriaLabel getAndroidAriaLabel 两个函数的初衷是处理progress异常情况的文案识别。
* 2. iOS可以识别%,而安卓不会识别%,如 80 iOS可以识别成 80% 而安卓只会80因此android部分做了一个% 拼接,后续看是否有更好的方案去解决。
* 3. 安卓 talkback 版本为 8.1.0.278818032 ,只会读一次 80 最新版本talkback 会读 80.0, 80。目前也是一个痛点啰嗦了
*
*/
var getIOSAriaLabel = function (status) {
if (status === 'error') {
return '进度失败';
}
if (status === 'warning') {
return '进度异常';
}
return '';
};
var getAndroidAriaLabel = function (status) {
if (status === 'error') {
return '%' + ',进度失败';
}
if (status === 'warning') {
return '%' + ',进度异常';
}
return '%';
};
module.exports = {
STATUS: STATUS,
STATUS_TEXT: STATUS_TEXT,
PRO_THEME: PRO_THEME,
STATUS_COLOR: STATUS_COLOR,
LINE_STATUS_ICON: LINE_STATUS_ICON,
CIRCLE_STATUS_ICON: CIRCLE_STATUS_ICON,
getAndroidAriaLabel: getAndroidAriaLabel,
getIOSAriaLabel: getIOSAriaLabel,
};

View File

@@ -0,0 +1,162 @@
.t-float-left {
float: left;
}
.t-float-right {
float: right;
}
@keyframes tdesign-fade-out {
from {
opacity: 1;
}
to {
opacity: 0;
}
}
.hotspot-expanded.relative {
position: relative;
}
.hotspot-expanded::after {
content: '';
display: block;
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
transform: scale(1.5);
}
.t-progress {
--td-progress-inner-bg-color: var(--td-brand-color, var(--td-primary-color-7, #0052d9));
--td-progress-track-bg-color: var(--td-bg-color-component, var(--td-gray-color-3, #e7e7e7));
--td-progress-circle-from: 0deg;
}
.t-progress__inner {
position: relative;
height: 100%;
background: var(--td-progress-inner-bg-color, var(--td-brand-color, var(--td-primary-color-7, #0052d9)));
border-radius: var(--td-radius-round, 999px);
transition: all var(--td-anim-duration-base, 0.2s) var(--td-anim-time-fn-easing, cubic-bezier(0.38, 0, 0.24, 1));
}
.t-progress__bar {
width: 100%;
height: var(--td-progress-line-stroke-width, 12rpx);
overflow: hidden;
background: var(--td-progress-track-bg-color, var(--td-bg-color-component, var(--td-gray-color-3, #e7e7e7)));
border-radius: var(--td-radius-round, 999px);
}
.t-progress__info {
padding-left: var(--td-spacer, 16rpx);
box-sizing: border-box;
color: var(--td-progress-info-dark-color, var(--td-text-color-primary, var(--td-font-gray-1, rgba(0, 0, 0, 0.9))));
white-space: nowrap;
display: inline-flex;
}
.t-progress--thin {
display: flex;
justify-content: space-between;
align-items: center;
}
.t-progress--thin .t-progress__icon {
font-size: calc(var(--td-font-size-base, 28rpx) + 2px);
}
.t-progress--plump {
height: var(--td-progress-stroke-plump-width, 40rpx);
border-radius: calc(var(--td-progress-stroke-plump-width, 40rpx) / 2);
display: flex;
align-items: center;
}
.t-progress--plump .t-progress__info {
font-size: var(--td-font-size-s, 24rpx);
}
.t-progress--over-ten .t-progress__info {
position: absolute;
top: 50%;
right: var(--td-spacer, 16rpx);
color: var(--td-progress-info-light-color, var(--td-text-color-anti, var(--td-font-white-1, #ffffff)));
transform: translateY(-50%);
}
.t-progress--under-ten .t-progress__info,
.t-progress--under-ten .t-progress__inner {
display: inline-block;
}
.t-progress--under-ten .t-progress__info {
vertical-align: top;
}
.t-progress__canvas--circle {
position: relative;
width: var(--td-progress-circle-width, 224rpx);
height: var(--td-progress-circle-width, 224rpx);
border-radius: var(--td-radius-circle, 50%);
}
.t-progress__canvas--circle .t-progress__canvas--inner {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
width: calc(100% - var(--td-progress-stroke-circle-width, 12rpx)*2);
height: calc(100% - var(--td-progress-stroke-circle-width, 12rpx)*2);
border-radius: var(--td-radius-circle, 50%);
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
background-color: var(--td-progress-circle-inner-bg-color, var(--td-text-color-anti, var(--td-font-white-1, #ffffff)));
}
.t-progress__canvas--circle .t-progress__info {
margin: 0;
font-size: var(--td-progress-circle-label-font-size, 40rpx);
font-weight: var(--td-progress-circle-label-font-weight, 700);
line-height: var(--td-progress-circle-label-line-height, 56rpx);
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
}
.t-progress__canvas--circle .t-progress__icon {
font-size: 96rpx;
}
.t-progress--status--active .t-progress__inner::before {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 1;
content: '';
animation: progress-active-animation 2s cubic-bezier(0.23, 0.99, 0.86, 0.2) infinite;
background: var(--td-progress-inner-bg-color-active, var(--td-bg-color-container, var(--td-font-white-1, #ffffff)));
opacity: 0.2;
}
.t-progress--status--success .t-progress__inner {
background: var(--td-progress-inner-bg-color-success, var(--td-success-color, var(--td-success-color-5, #2ba471)));
}
.t-progress--status--success .t-progress__icon {
color: var(--td-success-color, var(--td-success-color-5, #2ba471));
}
.t-progress--status--warning .t-progress__inner {
background: var(--td-progress-inner-bg-color-warning, var(--td-warning-color, var(--td-warning-color-5, #e37318)));
}
.t-progress--status--warning .t-progress__icon {
color: var(--td-warning-color, var(--td-warning-color-5, #e37318));
}
.t-progress--status--error .t-progress__inner {
background: var(--td-progress-inner-bg-color-error, var(--td-error-color, var(--td-error-color-6, #d54941)));
}
.t-progress--status--error .t-progress__icon {
color: var(--td-error-color, var(--td-error-color-6, #d54941));
}
@keyframes progress-active-animation {
0% {
width: 0;
opacity: 0.1;
}
35% {
width: 50%;
opacity: 0.4;
}
100% {
width: 100%;
opacity: 0;
}
}

View File

@@ -0,0 +1,3 @@
import { TdProgressProps } from './type';
declare const props: TdProgressProps;
export default props;

View File

@@ -0,0 +1,33 @@
const props = {
color: {
type: null,
value: '',
},
label: {
type: null,
value: true,
},
percentage: {
type: Number,
value: 0,
},
status: {
type: String,
},
strokeWidth: {
type: null,
},
style: {
type: String,
value: '',
},
theme: {
type: String,
value: 'line',
},
trackColor: {
type: String,
value: '',
},
};
export default props;

View File

@@ -0,0 +1,36 @@
export interface TdProgressProps {
color?: {
type: null;
value?: string | Array<string> | Record<string, string>;
};
label?: {
type: null;
value?: string | boolean;
};
percentage?: {
type: NumberConstructor;
value?: number;
};
status?: {
type: StringConstructor;
value?: ProgressStatus;
};
strokeWidth?: {
type: null;
value?: string | number;
};
style?: {
type: StringConstructor;
value?: string;
};
theme?: {
type: StringConstructor;
value?: ProgressTheme;
};
trackColor?: {
type: StringConstructor;
value?: string;
};
}
export declare type ProgressStatus = 'success' | 'error' | 'warning' | 'active';
export declare type ProgressTheme = 'line' | 'plump' | 'circle';

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,11 @@
export declare type Gradients = {
[percent: string]: string;
};
export declare type FromTo = {
from: string;
to: string;
};
export declare type LinearGradient = {
direction?: string;
} & (Gradients | FromTo);
export declare function getBackgroundColor(color: string | string[] | LinearGradient): string;

View File

@@ -0,0 +1,30 @@
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
export function getBackgroundColor(color) {
if (typeof color === 'string') {
return color;
}
if (Array.isArray(color)) {
if (color[0] && color[0][0] === '#') {
color.unshift('90deg');
}
return `linear-gradient( ${color.join(',')} )`;
}
const { from, to, direction = 'to right' } = color, rest = __rest(color, ["from", "to", "direction"]);
let keys = Object.keys(rest);
if (keys.length) {
keys = keys.sort((a, b) => parseFloat(a.substr(0, a.length - 1)) - parseFloat(b.substr(0, b.length - 1)));
const tempArr = keys.map((key) => `${rest[key]} ${key}`);
return `linear-gradient(${direction}, ${tempArr.join(',')})`;
}
return `linear-gradient(${direction}, ${from}, ${to})`;
}