@homecode/ui 4.23.4 → 4.24.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/dist/esm/index.js CHANGED
@@ -26,6 +26,8 @@ export { Paranja } from './src/components/Paranja/Paranja.js';
26
26
  export { ANIMATION_DURATION, Popup } from './src/components/Popup/Popup.js';
27
27
  export { Portal } from './src/components/Portal/Portal.js';
28
28
  export { PopupMenu } from './src/components/PopupMenu/PopupMenu.js';
29
+ export { Progress } from './src/components/Progress/Progress.js';
30
+ export { ProgressCircular } from './src/components/ProgressCircular/ProgressCircular.js';
29
31
  export { Router, RouterContext, RouterStore } from './src/components/Router/Router.js';
30
32
  export { RequiredStar } from './src/components/RequiredStar/RequiredStar.js';
31
33
  export { Select, SelectHelpers } from './src/components/Select/Select.js';
@@ -49,6 +49,8 @@ import { Menu } from '../Menu/Menu.js';
49
49
  import '../Notifications/store.js';
50
50
  import '../Notifications/Notifications.styl.js';
51
51
  import '../PopupMenu/PopupMenu.styl.js';
52
+ import '../Progress/Progress.styl.js';
53
+ import '../ProgressCircular/ProgressCircular.styl.js';
52
54
  import '../Router/Router.js';
53
55
  import '../Table/Table.styl.js';
54
56
  import '../Tabs/Tabs.styl.js';
@@ -47,6 +47,8 @@ import '../Menu/Menu.js';
47
47
  import '../Notifications/store.js';
48
48
  import '../Notifications/Notifications.styl.js';
49
49
  import '../PopupMenu/PopupMenu.styl.js';
50
+ import '../Progress/Progress.styl.js';
51
+ import '../ProgressCircular/ProgressCircular.styl.js';
50
52
  import '../Router/Router.js';
51
53
  import '../Table/Table.styl.js';
52
54
  import '../Tabs/Tabs.styl.js';
@@ -47,6 +47,8 @@ import '../Menu/Menu.js';
47
47
  import '../Notifications/store.js';
48
48
  import '../Notifications/Notifications.styl.js';
49
49
  import '../PopupMenu/PopupMenu.styl.js';
50
+ import '../Progress/Progress.styl.js';
51
+ import '../ProgressCircular/ProgressCircular.styl.js';
50
52
  import '../Router/Router.js';
51
53
  import '../Table/Table.styl.js';
52
54
  import '../Tabs/Tabs.styl.js';
@@ -0,0 +1,5 @@
1
+ const calculateProgress = (value) => {
2
+ return Math.min(100, Math.max(0, value));
3
+ };
4
+
5
+ export { calculateProgress };
@@ -0,0 +1,12 @@
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import cn from 'classnames';
3
+ import { calculateProgress } from './Progress.helpers.js';
4
+ import S from './Progress.styl.js';
5
+
6
+ function Progress({ value, showPercentage, size = 'm', alignText = 'center', className, }) {
7
+ const progress = calculateProgress(value);
8
+ const classes = cn(S.root, S[`size-${size}`], S[`align-${alignText}`], value > 0 && S.animated, className);
9
+ return (jsxs("div", { className: classes, children: [jsx("div", { className: S.bar, style: { width: `${progress}%` } }), showPercentage && jsxs("div", { className: S.label, children: [Math.round(progress), "%"] })] }));
10
+ }
11
+
12
+ export { Progress };
@@ -0,0 +1,7 @@
1
+ import styleInject from '../../../node_modules/style-inject/dist/style-inject.es.js';
2
+
3
+ var css_248z = ".Progress_root__gGPO9{background-color:var(--accent-color-alpha-100);border-radius:50px;position:relative;width:100%}.Progress_size-s__Xl7Vl{font-size:14px;height:2px}.Progress_size-m__2vNe8{font-size:16px;height:8px}.Progress_size-l__GYI3y{font-size:18px;height:12px}.Progress_bar__guoEx{background-color:var(--active-color);border-radius:inherit;height:100%}.Progress_animated__rfWjG .Progress_bar__guoEx{transition:width .3s ease}.Progress_hasLabel__1Xx16{margin-top:1em}.Progress_label__rQqsN{bottom:100%;color:var(--accent-color);font-weight:700;margin-bottom:4px;position:absolute}.Progress_align-left__p45c1 .Progress_label__rQqsN{left:var(--indent-s)}.Progress_align-center__HheKi .Progress_label__rQqsN{left:50%;transform:translate(-50%)}.Progress_align-right__lIRT2 .Progress_label__rQqsN{right:var(--indent-s)}";
4
+ var S = {"root":"Progress_root__gGPO9","size-s":"Progress_size-s__Xl7Vl","size-m":"Progress_size-m__2vNe8","size-l":"Progress_size-l__GYI3y","bar":"Progress_bar__guoEx","animated":"Progress_animated__rfWjG","hasLabel":"Progress_hasLabel__1Xx16","label":"Progress_label__rQqsN","align-left":"Progress_align-left__p45c1","align-center":"Progress_align-center__HheKi","align-right":"Progress_align-right__lIRT2"};
5
+ styleInject(css_248z);
6
+
7
+ export { S as default };
@@ -0,0 +1,22 @@
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import cn from 'classnames';
3
+ import { calculateProgress } from '../Progress/Progress.helpers.js';
4
+ import S from './ProgressCircular.styl.js';
5
+
6
+ const SIZE_MAP = {
7
+ s: 20,
8
+ m: 30,
9
+ l: 60,
10
+ xl: 120,
11
+ };
12
+ function ProgressCircular({ value, showPercentage, size = 'm', strokeWidth, className, }) {
13
+ const progress = calculateProgress(value);
14
+ const pixelSize = SIZE_MAP[size];
15
+ const calculatedStrokeWidth = strokeWidth ?? pixelSize / 10;
16
+ const radius = (pixelSize - calculatedStrokeWidth) / 2;
17
+ const circumference = 2 * Math.PI * radius;
18
+ const strokeDashoffset = circumference - (progress / 100) * circumference;
19
+ return (jsxs("svg", { width: pixelSize, height: pixelSize, viewBox: `0 0 ${pixelSize} ${pixelSize}`, className: cn(S.root, value > 0 && S.animated, className), children: [jsx("circle", { className: S.background, cx: pixelSize / 2, cy: pixelSize / 2, r: radius, fill: "none", strokeWidth: calculatedStrokeWidth }), jsx("circle", { cx: pixelSize / 2, cy: pixelSize / 2, r: radius, fill: "none", stroke: "var(--active-color)", strokeWidth: calculatedStrokeWidth, strokeLinecap: "round", strokeDasharray: circumference, strokeDashoffset: strokeDashoffset, transform: `rotate(-90 ${pixelSize / 2} ${pixelSize / 2})`, className: S.progress }), showPercentage && (jsxs("text", { x: "50%", y: "50%", textAnchor: "middle", dominantBaseline: "middle", fontSize: "16", fontWeight: "bold", children: [Math.round(progress), "%"] }))] }));
20
+ }
21
+
22
+ export { ProgressCircular };
@@ -0,0 +1,7 @@
1
+ import styleInject from '../../../node_modules/style-inject/dist/style-inject.es.js';
2
+
3
+ var css_248z = ".ProgressCircular_root__z7xBm .ProgressCircular_background__Rlqcq{stroke:var(--accent-color-alpha-100)}.ProgressCircular_root__z7xBm.ProgressCircular_animated__w3Bpf .ProgressCircular_progress__QVG7n{transition:stroke-dashoffset .3s ease-in-out}.ProgressCircular_root__z7xBm text{fill:var(--accent-color)}";
4
+ var S = {"root":"ProgressCircular_root__z7xBm","background":"ProgressCircular_background__Rlqcq","animated":"ProgressCircular_animated__w3Bpf","progress":"ProgressCircular_progress__QVG7n"};
5
+ styleInject(css_248z);
6
+
7
+ export { S as default };
@@ -1,5 +1,9 @@
1
1
  import * as T from './Icon.types';
2
2
  export declare const icons: {
3
+ arrowRight: () => Promise<any>;
4
+ arrowLeft: () => Promise<any>;
5
+ arrowUp: () => Promise<any>;
6
+ arrowDown: () => Promise<any>;
3
7
  avatar: () => Promise<any>;
4
8
  bookmark: () => Promise<any>;
5
9
  bookmarkAdd: () => Promise<any>;
@@ -18,6 +22,7 @@ export declare const icons: {
18
22
  chevronRight: () => Promise<any>;
19
23
  chevronLeft: () => Promise<any>;
20
24
  clearAll: () => Promise<any>;
25
+ cubes: () => Promise<any>;
21
26
  delete: () => Promise<any>;
22
27
  draft: () => Promise<any>;
23
28
  dragHandlerHorizontal: () => Promise<any>;
@@ -56,8 +61,10 @@ export declare const icons: {
56
61
  plus: () => Promise<any>;
57
62
  redo: () => Promise<any>;
58
63
  undo: () => Promise<any>;
64
+ usage: () => Promise<any>;
59
65
  requiredStar: () => Promise<any>;
60
66
  rewind: () => Promise<any>;
67
+ rocket: () => Promise<any>;
61
68
  route: () => Promise<any>;
62
69
  routeFrom: () => Promise<any>;
63
70
  routeTo: () => Promise<any>;
@@ -66,11 +73,13 @@ export declare const icons: {
66
73
  send: () => Promise<any>;
67
74
  settings: () => Promise<any>;
68
75
  shoppingBag: () => Promise<any>;
76
+ soundWave: () => Promise<any>;
69
77
  sparks: () => Promise<any>;
70
78
  star: () => Promise<any>;
71
79
  syncArrows: () => Promise<any>;
72
80
  table: () => Promise<any>;
73
81
  telegram: () => Promise<any>;
82
+ tool: () => Promise<any>;
74
83
  trafficLight: () => Promise<any>;
75
84
  };
76
85
  export type { IconType } from './Icon.types';
@@ -0,0 +1,2 @@
1
+ import { ProgressProps } from './Progress.types';
2
+ export declare function Progress({ value, showPercentage, size, alignText, className, }: ProgressProps): JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const calculateProgress: (value: number) => number;
@@ -0,0 +1,10 @@
1
+ import { Size } from 'uilib/types';
2
+ export interface CommonProgressProps {
3
+ value: number;
4
+ showPercentage?: boolean;
5
+ size?: Size;
6
+ className?: string;
7
+ }
8
+ export interface ProgressProps extends CommonProgressProps {
9
+ alignText?: 'left' | 'center' | 'right';
10
+ }
@@ -0,0 +1,3 @@
1
+ import { ProgressCircularProps } from './ProgressCircular.types';
2
+ export type { ProgressCircularProps } from './ProgressCircular.types';
3
+ export declare function ProgressCircular({ value, showPercentage, size, strokeWidth, className, }: ProgressCircularProps): JSX.Element;
@@ -0,0 +1,4 @@
1
+ import { CommonProgressProps } from '../Progress/Progress.types';
2
+ export interface ProgressCircularProps extends CommonProgressProps {
3
+ strokeWidth?: number;
4
+ }
@@ -26,6 +26,8 @@ export * from './Paranja/Paranja';
26
26
  export * from './Popup/Popup';
27
27
  export * from './Portal/Portal';
28
28
  export * from './PopupMenu/PopupMenu';
29
+ export * from './Progress/Progress';
30
+ export * from './ProgressCircular/ProgressCircular';
29
31
  export * from './Router/Router';
30
32
  export * from './RequiredStar/RequiredStar';
31
33
  export * from './Select/Select';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@homecode/ui",
3
- "version": "4.23.4",
3
+ "version": "4.24.2",
4
4
  "description": "React UI components library",
5
5
  "scripts": {
6
6
  "test": "jest",