@geneui/components 3.0.0-next-d9fa1ce-06112024 → 3.0.0-next-f0c40b8-25112024
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/HelperText.js +4 -4
- package/ProgressBar.js +67 -0
- package/components/atoms/Label/Label.d.ts +1 -1
- package/components/molecules/ProgressBar/ProgressBar.d.ts +52 -0
- package/components/molecules/ProgressBar/index.d.ts +1 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/package.json +1 -1
package/HelperText.js
CHANGED
|
@@ -46,14 +46,14 @@ var SvgWarningFill = function SvgWarningFill(_ref) {
|
|
|
46
46
|
var css_248z = ".helperText{display:inline-flex;gap:var(--guit-ref-spacing-3xsmall);max-width:100%}.helperText_size_medium .helperText__text{font-family:var(--guit-sem-font-label-medium-default-semibold-font-family);font-size:var(--guit-sem-font-label-medium-default-semibold-font-size);font-weight:var(--guit-sem-font-label-medium-default-medium-font-weight);line-height:var(--guit-sem-font-label-medium-default-semibold-line-height)}.helperText_size_small .helperText__text{font-family:var(--guit-sem-font-label-small-default-medium-font-family);font-size:var(--guit-sem-font-label-small-default-medium-font-size);font-weight:var(--guit-sem-font-label-small-default-medium-font-weight);line-height:var(--guit-sem-font-label-small-default-medium-line-height)}.helperText_type_rest{color:var(--guit-sem-color-foreground-neutral-2)}.helperText_type_danger{color:var(--guit-sem-color-foreground-error)}.helperText_type_warning{color:var(--guit-sem-color-foreground-neutral-2)}.helperText_type_warning .helperText__icon{color:var(--guit-sem-color-foreground-warning)}.helperText_disabled,.helperText_disabled .helperText__icon{color:var(--guit-sem-color-foreground-disabled)}.helperText__icon{flex:0 0 auto}";
|
|
47
47
|
styleInject(css_248z);
|
|
48
48
|
|
|
49
|
+
const iconSize = {
|
|
50
|
+
small: 16,
|
|
51
|
+
medium: 20
|
|
52
|
+
};
|
|
49
53
|
/**
|
|
50
54
|
* The Helper Text provides users with additional information or guidance related to a specific input field in a form. This text helps users understand the expected format, requirements, or purpose of the input, thereby improving form completion accuracy and user confidence.
|
|
51
55
|
*/
|
|
52
56
|
const HelperText = ({ size = "medium", type = "rest", text, Icon, isDisabled, isLoading, className }) => {
|
|
53
|
-
const iconSize = {
|
|
54
|
-
small: 16,
|
|
55
|
-
medium: 20
|
|
56
|
-
};
|
|
57
57
|
const iconMap = {
|
|
58
58
|
danger: React__default.createElement(SvgErrorAlertFill, { size: iconSize[size] }),
|
|
59
59
|
warning: React__default.createElement(SvgWarningFill, { size: iconSize[size] }),
|
package/ProgressBar.js
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import React__default, { useState, useMemo, useEffect } from 'react';
|
|
2
|
+
import { c as classNames } from './index-ce02421b.js';
|
|
3
|
+
import HelperText from './HelperText.js';
|
|
4
|
+
import Label from './Label.js';
|
|
5
|
+
import { s as styleInject } from './style-inject.es-746bb8ed.js';
|
|
6
|
+
import './ArrowLeft-b88e2ba8.js';
|
|
7
|
+
import './Tooltip.js';
|
|
8
|
+
import 'react-dom';
|
|
9
|
+
import './GeneUIProvider.js';
|
|
10
|
+
import './useEllipsisDetection-46d712b6.js';
|
|
11
|
+
import './Info.js';
|
|
12
|
+
|
|
13
|
+
var css_248z = ".progressBar{display:flex;flex-direction:column;gap:var(--guit-ref-spacing-3xsmall);min-width:24rem;width:100%}.progressBar_type_determinate .progressBar__loadingBar,.progressBar_type_indeterminate .progressBar__fill{display:none}.progressBar_type_indeterminate .progressBar__loadingBar{animation-duration:1.6s;animation-iteration-count:infinite;animation-timing-function:var(--guit-ref-motion-easing-standard);will-change:transform}[dir=ltr] .progressBar_type_indeterminate .progressBar__loadingBar{animation-name:progress-bar-loading-from-left}[dir=rtl] .progressBar_type_indeterminate .progressBar__loadingBar{animation-name:progress-bar-loading-from-right}.progressBar_size_large .progressBar__status,.progressBar_size_medium .progressBar__status{font-family:var(--guit-sem-font-label-medium-default-semibold-font-family);font-size:var(--guit-sem-font-label-medium-default-semibold-font-size);font-weight:var(--guit-sem-font-label-medium-default-medium-font-weight);line-height:var(--guit-sem-font-label-medium-default-semibold-line-height)}.progressBar_size_large .progressBar__track{border-radius:var(--guit-ref-radius-xsmall);height:var(--guit-sem-dimension-height-xsmall)}.progressBar_size_medium .progressBar__track{border-radius:var(--guit-ref-radius-2xsmall);height:var(--guit-sem-dimension-height-2xsmall)}.progressBar_size_small .progressBar__track{border-radius:var(--guit-ref-radius-3xsmall);height:var(--guit-sem-dimension-height-3xsmall)}.progressBar_size_small .progressBar__status{font-family:var(--guit-sem-font-label-small-default-medium-font-family);font-size:var(--guit-sem-font-label-small-default-medium-font-size);font-weight:var(--guit-sem-font-label-small-default-medium-font-weight);line-height:var(--guit-sem-font-label-small-default-medium-line-height)}.progressBar_color_default .progressBar__fill,.progressBar_color_default .progressBar__loadingBar{background-color:var(--guit-sem-color-background-brand-2)}.progressBar_color_success .progressBar__fill,.progressBar_color_success .progressBar__loadingBar{background-color:var(--guit-sem-color-background-success-2)}.progressBar_color_error .progressBar__fill,.progressBar_color_error .progressBar__loadingBar{background-color:var(--guit-sem-color-background-error-2)}.progressBar__track{background-color:var(--guit-sem-color-background-neutral-2);overflow:hidden;width:100%}.progressBar__fill,.progressBar__loadingBar{border-radius:inherit;height:100%}.progressBar__loadingBar{width:50%}.progressBar__info{align-items:flex-start;display:flex;gap:var(--guit-ref-spacing-xsmall);justify-content:space-between;width:100%}.progressBar__helperText{word-break:break-word}.progressBar__status{color:var(--guit-sem-color-foreground-neutral-2);display:inline-flex;flex:0 0 auto;gap:.4rem;margin-inline-start:auto}.progressBar__uploadingText{display:inline-block}@keyframes progress-bar-loading-from-left{0%{transform:translate3d(-100%,0,0)}to{transform:translate3d(200%,0,0)}}@keyframes progress-bar-loading-from-right{0%{transform:translate3d(100%,0,0)}to{transform:translate3d(-200%,0,0)}}";
|
|
14
|
+
styleInject(css_248z);
|
|
15
|
+
|
|
16
|
+
const helperTextTypeMap = {
|
|
17
|
+
default: "rest",
|
|
18
|
+
success: "rest",
|
|
19
|
+
error: "danger"
|
|
20
|
+
};
|
|
21
|
+
const helperTextAndLabelSizeMap = {
|
|
22
|
+
large: "medium",
|
|
23
|
+
medium: "medium",
|
|
24
|
+
small: "small"
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* A progress bar offers visual feedback on the status and duration of a process, such as a download, file transfer, or installation, helping users understand how much longer they need to wait.
|
|
28
|
+
*/
|
|
29
|
+
const ProgressBar = ({ className, size = "medium", type = "determinate", error, helperText, percent, uploadingText, infoText, label }) => {
|
|
30
|
+
const [status, setStatus] = useState("default");
|
|
31
|
+
const isDeterminate = type === "determinate";
|
|
32
|
+
const isTypeDefault = status === "default";
|
|
33
|
+
const isPercentLowerThanMax = percent !== undefined && percent < 100;
|
|
34
|
+
const processedPercent = useMemo(() => {
|
|
35
|
+
let result = percent || 0;
|
|
36
|
+
if (result < 0 && !error)
|
|
37
|
+
result = 0;
|
|
38
|
+
if (result >= 100 || error)
|
|
39
|
+
result = 100;
|
|
40
|
+
return `${result}%`;
|
|
41
|
+
}, [percent, error]);
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
if (error && status !== "error") {
|
|
44
|
+
setStatus("error");
|
|
45
|
+
}
|
|
46
|
+
else if (percent !== undefined && !error) {
|
|
47
|
+
if (percent >= 100 && status !== "success" && isDeterminate) {
|
|
48
|
+
setStatus("success");
|
|
49
|
+
}
|
|
50
|
+
else if ((!isTypeDefault && isPercentLowerThanMax && isDeterminate) || !isDeterminate) {
|
|
51
|
+
setStatus("default");
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}, [error, isTypeDefault, status, percent, isDeterminate]);
|
|
55
|
+
return (React__default.createElement("div", { className: classNames(`progressBar progressBar_type_${error ? "determinate" : type} progressBar_size_${size} progressBar_color_${status}`, className) },
|
|
56
|
+
React__default.createElement(Label, { labelText: label, size: helperTextAndLabelSizeMap[size], infoText: infoText }),
|
|
57
|
+
React__default.createElement("div", { className: "progressBar__track" },
|
|
58
|
+
(isDeterminate || error) && React__default.createElement("div", { className: "progressBar__fill", style: { width: processedPercent } }),
|
|
59
|
+
React__default.createElement("div", { className: "progressBar__loadingBar" })),
|
|
60
|
+
React__default.createElement("div", { className: "progressBar__info" },
|
|
61
|
+
helperText && (React__default.createElement(HelperText, { text: helperText, size: helperTextAndLabelSizeMap[size], type: helperTextTypeMap[status], className: "progressBar__helperText" })),
|
|
62
|
+
isDeterminate && isTypeDefault && isPercentLowerThanMax && (React__default.createElement("p", { className: "progressBar__status" },
|
|
63
|
+
React__default.createElement("span", { className: "progressBar__uploadingText" }, uploadingText),
|
|
64
|
+
React__default.createElement("span", { className: "progressBar__percent" }, processedPercent))))));
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export { ProgressBar as default };
|
|
@@ -10,7 +10,7 @@ interface ILabelProps {
|
|
|
10
10
|
* The text content of the `label`.
|
|
11
11
|
* This is the main text displayed within the `label`.
|
|
12
12
|
*/
|
|
13
|
-
labelText
|
|
13
|
+
labelText?: string;
|
|
14
14
|
/**
|
|
15
15
|
* Indicates whether the label represents a required field.
|
|
16
16
|
* When set to `true`, a visual indicator (asterisk) will be added to denote that the field is required.
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
import "./ProgressBar.scss";
|
|
3
|
+
interface IProgressBarProps {
|
|
4
|
+
/**
|
|
5
|
+
* Specifies the progress percentage displayed by the progress bar.<br>
|
|
6
|
+
* Valid values are between `0` and `100`. Values less than `0` will fallback to `0`,
|
|
7
|
+
* and values greater than `100` will fallback to `100`.<br>
|
|
8
|
+
* In case of value is `100` or greater the style of the component will be changed to success.
|
|
9
|
+
*/
|
|
10
|
+
percent?: number;
|
|
11
|
+
/**
|
|
12
|
+
* Text displayed alongside the progress percentage.
|
|
13
|
+
*/
|
|
14
|
+
uploadingText?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Defines the size of the progress bar.<br>
|
|
17
|
+
* Possible values: `large | medium | small`
|
|
18
|
+
*/
|
|
19
|
+
size?: "large" | "medium" | "small";
|
|
20
|
+
/**
|
|
21
|
+
* Sets the behavior of the bar for measurable or ongoing processes.<br>
|
|
22
|
+
* Possible values: `determinate | indeterminate`
|
|
23
|
+
*/
|
|
24
|
+
type?: "determinate" | "indeterminate";
|
|
25
|
+
/**
|
|
26
|
+
* Indicates an error state for the progress bar.<br>
|
|
27
|
+
* When `true`, the progress bar appears in the error style.
|
|
28
|
+
*/
|
|
29
|
+
error?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Adds supplementary information below the progress bar.
|
|
32
|
+
*/
|
|
33
|
+
helperText?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Additional descriptive text shown with info icon and tooltip alongside of the label component.
|
|
36
|
+
*/
|
|
37
|
+
infoText?: string;
|
|
38
|
+
/**
|
|
39
|
+
* The main label text describing the progress bar's purpose.
|
|
40
|
+
*/
|
|
41
|
+
label?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Additional class for the parent element.
|
|
44
|
+
* This prop should be used to set placement properties for the element relative to its parent using BEM conventions.
|
|
45
|
+
*/
|
|
46
|
+
className?: string;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* A progress bar offers visual feedback on the status and duration of a process, such as a download, file transfer, or installation, helping users understand how much longer they need to wait.
|
|
50
|
+
*/
|
|
51
|
+
declare const ProgressBar: FC<IProgressBarProps>;
|
|
52
|
+
export { IProgressBarProps, ProgressBar as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { IProgressBarProps, default } from "./ProgressBar";
|
package/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export { default as Divider, IDividerProps } from "./components/atoms/Divider";
|
|
|
7
7
|
export { default as Info, IInfoProps } from "./components/atoms/Info";
|
|
8
8
|
export { default as Button, IButtonProps } from "./components/atoms/Button";
|
|
9
9
|
export { default as Tooltip } from "./components/molecules/Tooltip";
|
|
10
|
+
export { default as ProgressBar } from "./components/molecules/ProgressBar";
|
|
10
11
|
export { default as GeneUIProvider, GeneUIDesignSystemContext, IGeneUIDesignSystemContext, IGeneUIProviderProps } from "./components/providers/GeneUIProvider";
|
|
11
12
|
export { default as useDebounce } from "./hooks/useDebounceCallback";
|
|
12
13
|
export { default as useEllipsisDetection } from "./hooks/useEllipsisDetection";
|
package/index.js
CHANGED
|
@@ -7,6 +7,7 @@ export { default as Divider } from './Divider.js';
|
|
|
7
7
|
export { default as Info } from './Info.js';
|
|
8
8
|
export { default as Button } from './Button.js';
|
|
9
9
|
export { default as Tooltip } from './Tooltip.js';
|
|
10
|
+
export { default as ProgressBar } from './ProgressBar.js';
|
|
10
11
|
export { GeneUIDesignSystemContext, default as GeneUIProvider } from './GeneUIProvider.js';
|
|
11
12
|
export { u as useDebounce, a as useEllipsisDetection } from './useEllipsisDetection-46d712b6.js';
|
|
12
13
|
import 'react';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geneui/components",
|
|
3
3
|
"description": "The Gene UI components library designed for BI tools",
|
|
4
|
-
"version": "3.0.0-next-
|
|
4
|
+
"version": "3.0.0-next-f0c40b8-25112024",
|
|
5
5
|
"author": "SoftConstruct",
|
|
6
6
|
"homepage": "https://github.com/softconstruct/gene-ui-components#readme",
|
|
7
7
|
"repository": {
|