@spaced-out/ui-design-system 0.1.112 → 0.1.114

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.
@@ -22,7 +22,7 @@ jobs:
22
22
  - name: Check Permissions
23
23
  id: check-permissions
24
24
  env:
25
- ALLOWED_USERS: superrover, Anant-Raj, ashwini-sensehq, vish-sah, VishalBarnawal, sanskar-s, VivekJangid, sharad-kushwah
25
+ ALLOWED_USERS: superrover, Anant-Raj, ashwini-sensehq, vish-sah, VishalBarnawal, sanskar-s, VivekJangid, sharad-kushwah, Swatantramishra1
26
26
  if: ${{ !contains(env.ALLOWED_USERS, github.actor) }}
27
27
  run: |
28
28
  echo "You don't have correct permissions to do this release"
package/CHANGELOG.md CHANGED
@@ -2,6 +2,26 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [0.1.114](https://github.com/spaced-out/ui-design-system/compare/v0.1.113...v0.1.114) (2024-07-18)
6
+
7
+
8
+ ### Features
9
+
10
+ * tooltip on back button in pageTitle ([#245](https://github.com/spaced-out/ui-design-system/issues/245)) ([2441a31](https://github.com/spaced-out/ui-design-system/commit/2441a310c247d013c5f49fc338e61e093e734984))
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * focus-visible ([#224](https://github.com/spaced-out/ui-design-system/issues/224)) ([0da8db6](https://github.com/spaced-out/ui-design-system/commit/0da8db61a982192e304f60615d1e577f9705a695))
16
+ * text center issue ([#244](https://github.com/spaced-out/ui-design-system/issues/244)) ([7946f04](https://github.com/spaced-out/ui-design-system/commit/7946f043fdece4578118c5138fc7c3ab0efba57d))
17
+
18
+ ### [0.1.113](https://github.com/spaced-out/ui-design-system/compare/v0.1.112...v0.1.113) (2024-07-16)
19
+
20
+
21
+ ### Features
22
+
23
+ * donut progress bar ([#243](https://github.com/spaced-out/ui-design-system/issues/243)) ([5510117](https://github.com/spaced-out/ui-design-system/commit/5510117890fb1dd5a8ba7537cb0079885bcc6a8c))
24
+
5
25
  ### [0.1.112](https://github.com/spaced-out/ui-design-system/compare/v0.1.111...v0.1.112) (2024-07-15)
6
26
 
7
27
 
@@ -9,6 +9,7 @@ var _classify = _interopRequireDefault(require("../../utils/classify"));
9
9
  var _Button = require("../Button");
10
10
  var _Icon = require("../Icon");
11
11
  var _Text = require("../Text");
12
+ var _Tooltip = require("../Tooltip");
12
13
  var _PageTitleModule = _interopRequireDefault(require("./PageTitle.module.css"));
13
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
15
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -216,11 +217,14 @@ const PageTitle = /*#__PURE__*/React.forwardRef((_ref4, ref) => {
216
217
  className: (0, _classify.default)(_PageTitleModule.default.leftSlot, classNames?.leftSlot)
217
218
  }, /*#__PURE__*/React.createElement("div", {
218
219
  className: _PageTitleModule.default.headerWithBackBtn
219
- }, showBackButton && /*#__PURE__*/React.createElement(_Button.Button, {
220
+ }, showBackButton && /*#__PURE__*/React.createElement(_Tooltip.Tooltip, {
221
+ title: "Navigate Back"
222
+ }, /*#__PURE__*/React.createElement(_Button.Button, {
220
223
  onClick: handleBack,
221
224
  type: "tertiary",
222
- iconLeftName: "chevron-left"
223
- }), pageNameKey && PAGE_NAME_LIST[pageNameKey] ? /*#__PURE__*/React.createElement(PageName, null, /*#__PURE__*/React.createElement(_Text.TitleMedium, null, PAGE_NAME_LIST[pageNameKey].title, " "), /*#__PURE__*/React.createElement(_Icon.Icon, {
225
+ iconLeftName: "chevron-left",
226
+ ariaLabel: "Navigate Back Button"
227
+ })), pageNameKey && PAGE_NAME_LIST[pageNameKey] ? /*#__PURE__*/React.createElement(PageName, null, /*#__PURE__*/React.createElement(_Text.TitleMedium, null, PAGE_NAME_LIST[pageNameKey].title, " "), /*#__PURE__*/React.createElement(_Icon.Icon, {
224
228
  type: PAGE_NAME_LIST[pageNameKey].iconType,
225
229
  name: PAGE_NAME_LIST[pageNameKey].iconName,
226
230
  size: "medium",
@@ -6,6 +6,7 @@ import classify from '../../utils/classify';
6
6
  import {Button} from '../Button';
7
7
  import {Icon} from '../Icon';
8
8
  import {TEXT_COLORS, TitleMedium} from '../Text';
9
+ import {Tooltip} from '../Tooltip';
9
10
 
10
11
  import css from './PageTitle.module.css';
11
12
 
@@ -238,11 +239,14 @@ export const PageTitle: React$AbstractComponent<
238
239
  <div className={classify(css.leftSlot, classNames?.leftSlot)}>
239
240
  <div className={css.headerWithBackBtn}>
240
241
  {showBackButton && (
241
- <Button
242
- onClick={handleBack}
243
- type="tertiary"
244
- iconLeftName="chevron-left"
245
- />
242
+ <Tooltip title="Navigate Back">
243
+ <Button
244
+ onClick={handleBack}
245
+ type="tertiary"
246
+ iconLeftName="chevron-left"
247
+ ariaLabel="Navigate Back Button"
248
+ />
249
+ </Tooltip>
246
250
  )}
247
251
  {pageNameKey && PAGE_NAME_LIST[pageNameKey] ? (
248
252
  <PageName>
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ProgressDonut = void 0;
7
+ var React = _interopRequireWildcard(require("react"));
8
+ var COLORS = _interopRequireWildcard(require("../../styles/variables/_color"));
9
+ var _classify = _interopRequireDefault(require("../../utils/classify"));
10
+ var _Text = require("../Text");
11
+ var _ProgressDonutModule = _interopRequireDefault(require("./ProgressDonut.module.css"));
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
14
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
15
+
16
+ const STROKE_WIDTH = 8;
17
+ const MIN_PERCENTAGE = 0;
18
+ const DIVISOR_TWO = 2;
19
+ const MAX_PERCENTAGE = 100;
20
+ const SUCCESS_THRESHOLD = 80;
21
+ const LARGE_DONUT_SIZE = 72;
22
+ const INFO_THRESHOLD = 50;
23
+ const WARNING_THRESHOLD = 30;
24
+ const getProgressDonutColor = percentage => {
25
+ if (percentage >= SUCCESS_THRESHOLD) {
26
+ return COLORS.colorSuccess;
27
+ } else if (percentage >= INFO_THRESHOLD && percentage < SUCCESS_THRESHOLD) {
28
+ return COLORS.colorInformation;
29
+ } else if (percentage >= WARNING_THRESHOLD && percentage < INFO_THRESHOLD) {
30
+ return COLORS.colorWarning;
31
+ } else {
32
+ return COLORS.colorDanger;
33
+ }
34
+ };
35
+ const ProgressDonut = /*#__PURE__*/React.forwardRef((_ref, ref) => {
36
+ let {
37
+ classNames,
38
+ percentage = 0,
39
+ color = ''
40
+ } = _ref;
41
+ const donutPercentage = React.useMemo(() => Math.min(Math.max(percentage, MIN_PERCENTAGE), MAX_PERCENTAGE), [percentage]);
42
+ const donutColor = React.useMemo(() => getProgressDonutColor(donutPercentage), [donutPercentage]);
43
+ const radius = React.useMemo(() => (LARGE_DONUT_SIZE - STROKE_WIDTH) / DIVISOR_TWO, [LARGE_DONUT_SIZE]);
44
+ const circumference = React.useMemo(() => DIVISOR_TWO * Math.PI * radius, [radius]);
45
+ const offset = React.useMemo(() => circumference - donutPercentage / MAX_PERCENTAGE * circumference, [circumference, donutPercentage]);
46
+ return /*#__PURE__*/React.createElement("div", {
47
+ ref: ref,
48
+ "data-testid": "ProgressDonut",
49
+ className: (0, _classify.default)(_ProgressDonutModule.default.wrapper, classNames?.wrapper)
50
+ }, /*#__PURE__*/React.createElement("div", {
51
+ className: _ProgressDonutModule.default.donutChart
52
+ }, /*#__PURE__*/React.createElement("svg", {
53
+ width: LARGE_DONUT_SIZE,
54
+ height: LARGE_DONUT_SIZE,
55
+ viewBox: `0 0 ${LARGE_DONUT_SIZE} ${LARGE_DONUT_SIZE}`,
56
+ className: _ProgressDonutModule.default.donutChartSvg
57
+ }, /*#__PURE__*/React.createElement("circle", {
58
+ className: _ProgressDonutModule.default.donutChartBackground,
59
+ cx: LARGE_DONUT_SIZE / DIVISOR_TWO,
60
+ cy: LARGE_DONUT_SIZE / DIVISOR_TWO,
61
+ r: radius,
62
+ strokeWidth: STROKE_WIDTH
63
+ }), /*#__PURE__*/React.createElement("circle", {
64
+ className: _ProgressDonutModule.default.donutChartForeground,
65
+ cx: LARGE_DONUT_SIZE / DIVISOR_TWO,
66
+ cy: LARGE_DONUT_SIZE / DIVISOR_TWO,
67
+ r: radius,
68
+ strokeWidth: STROKE_WIDTH,
69
+ strokeDasharray: circumference,
70
+ strokeDashoffset: donutPercentage === MIN_PERCENTAGE ? circumference : offset,
71
+ stroke: COLORS[color] || donutColor,
72
+ strokeLinecap: "round"
73
+ })), /*#__PURE__*/React.createElement(_Text.BodyLargeBold, {
74
+ className: _ProgressDonutModule.default.donutChartPercentage
75
+ }, `${donutPercentage}%`)));
76
+ });
77
+ exports.ProgressDonut = ProgressDonut;
@@ -0,0 +1,111 @@
1
+ // @flow strict
2
+
3
+ import * as React from 'react';
4
+
5
+ import * as COLORS from '../../styles/variables/_color';
6
+ import classify from '../../utils/classify';
7
+ import {BodyLargeBold} from '../Text';
8
+
9
+ import css from './ProgressDonut.module.css';
10
+
11
+
12
+ const STROKE_WIDTH = 8;
13
+ const MIN_PERCENTAGE = 0;
14
+ const DIVISOR_TWO = 2;
15
+ const MAX_PERCENTAGE = 100;
16
+ const SUCCESS_THRESHOLD = 80;
17
+ const LARGE_DONUT_SIZE = 72;
18
+ const INFO_THRESHOLD = 50;
19
+ const WARNING_THRESHOLD = 30;
20
+
21
+ type ClassNames = $ReadOnly<{
22
+ wrapper?: string,
23
+ }>;
24
+
25
+ export type ProgressDonutProps = {
26
+ classNames?: ClassNames,
27
+ color?: $Keys<typeof COLORS>,
28
+ percentage: number,
29
+ };
30
+
31
+ const getProgressDonutColor = (percentage: number): string => {
32
+ if (percentage >= SUCCESS_THRESHOLD) {
33
+ return COLORS.colorSuccess;
34
+ } else if (percentage >= INFO_THRESHOLD && percentage < SUCCESS_THRESHOLD) {
35
+ return COLORS.colorInformation;
36
+ } else if (percentage >= WARNING_THRESHOLD && percentage < INFO_THRESHOLD) {
37
+ return COLORS.colorWarning;
38
+ } else {
39
+ return COLORS.colorDanger;
40
+ }
41
+ };
42
+
43
+ export const ProgressDonut: React$AbstractComponent<
44
+ ProgressDonutProps,
45
+ HTMLDivElement,
46
+ > = React.forwardRef<ProgressDonutProps, HTMLDivElement>(
47
+ ({classNames, percentage = 0, color = ''}: ProgressDonutProps, ref) => {
48
+ const donutPercentage = React.useMemo(
49
+ () => Math.min(Math.max(percentage, MIN_PERCENTAGE), MAX_PERCENTAGE),
50
+ [percentage],
51
+ );
52
+ const donutColor = React.useMemo(
53
+ () => getProgressDonutColor(donutPercentage),
54
+ [donutPercentage],
55
+ );
56
+
57
+ const radius = React.useMemo(
58
+ () => (LARGE_DONUT_SIZE - STROKE_WIDTH) / DIVISOR_TWO,
59
+ [LARGE_DONUT_SIZE],
60
+ );
61
+ const circumference = React.useMemo(
62
+ () => DIVISOR_TWO * Math.PI * radius,
63
+ [radius],
64
+ );
65
+ const offset = React.useMemo(
66
+ () => circumference - (donutPercentage / MAX_PERCENTAGE) * circumference,
67
+ [circumference, donutPercentage],
68
+ );
69
+
70
+ return (
71
+ <div
72
+ ref={ref}
73
+ data-testid="ProgressDonut"
74
+ className={classify(css.wrapper, classNames?.wrapper)}
75
+ >
76
+ <div className={css.donutChart}>
77
+ <svg
78
+ width={LARGE_DONUT_SIZE}
79
+ height={LARGE_DONUT_SIZE}
80
+ viewBox={`0 0 ${LARGE_DONUT_SIZE} ${LARGE_DONUT_SIZE}`}
81
+ className={css.donutChartSvg}
82
+ >
83
+ <circle
84
+ className={css.donutChartBackground}
85
+ cx={LARGE_DONUT_SIZE / DIVISOR_TWO}
86
+ cy={LARGE_DONUT_SIZE / DIVISOR_TWO}
87
+ r={radius}
88
+ strokeWidth={STROKE_WIDTH}
89
+ />
90
+ <circle
91
+ className={css.donutChartForeground}
92
+ cx={LARGE_DONUT_SIZE / DIVISOR_TWO}
93
+ cy={LARGE_DONUT_SIZE / DIVISOR_TWO}
94
+ r={radius}
95
+ strokeWidth={STROKE_WIDTH}
96
+ strokeDasharray={circumference}
97
+ strokeDashoffset={
98
+ donutPercentage === MIN_PERCENTAGE ? circumference : offset
99
+ }
100
+ stroke={COLORS[color] || donutColor}
101
+ strokeLinecap="round"
102
+ />
103
+ </svg>
104
+ <BodyLargeBold className={css.donutChartPercentage}>
105
+ {`${donutPercentage}%`}
106
+ </BodyLargeBold>
107
+ </div>
108
+ </div>
109
+ );
110
+ },
111
+ );
@@ -0,0 +1,43 @@
1
+ @value (
2
+ borderRadiusSmall
3
+ ) from '../../styles/variables/_border.css';
4
+ @value (spaceHalfFluid, spaceNegHalfFluid) from '../../styles/variables/_space.css';
5
+ @value (size10, size20, sizeFluid) from
6
+ '../../styles/variables/_size.css';
7
+ @value (
8
+ colorBorderPrimary,
9
+ colorBackgroundSecondary,
10
+ colorBackgroundPrimary
11
+ ) from '../../styles/variables/_color.css';
12
+ @value (motionDurationSlower) from
13
+ '../../styles/variables/_motion.css';
14
+
15
+ .donutChart {
16
+ position: relative;
17
+ display: flex;
18
+ flex-direction: column;
19
+ justify-content: center;
20
+ align-items: center;
21
+ background-color: colorBackgroundPrimary;
22
+ }
23
+
24
+ .donutChartSvg {
25
+ transform: rotate(-90deg);
26
+ }
27
+
28
+ .donutChartBackground,
29
+ .donutChartForeground {
30
+ fill: none;
31
+ }
32
+
33
+ .donutChartBackground {
34
+ stroke: colorBackgroundSecondary;
35
+ }
36
+
37
+ .donutChartForeground {
38
+ transition: stroke-dashoffset motionDurationSlower;
39
+ }
40
+
41
+ .donutChartPercentage {
42
+ position: absolute;
43
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _ProgressDonut = require("./ProgressDonut");
7
+ Object.keys(_ProgressDonut).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _ProgressDonut[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _ProgressDonut[key];
14
+ }
15
+ });
16
+ });
@@ -0,0 +1,3 @@
1
+ // @flow strict
2
+
3
+ export * from './ProgressDonut';
@@ -39,9 +39,6 @@
39
39
 
40
40
  .linkWrapper:focus-visible {
41
41
  outline: none;
42
- }
43
-
44
- .linkWrapper:focus {
45
42
  box-shadow: borderWidthNone borderWidthNone borderWidthNone
46
43
  borderWidthTertiary colorFocusPrimary;
47
44
  }
@@ -432,6 +432,17 @@ Object.keys(_Panel).forEach(function (key) {
432
432
  }
433
433
  });
434
434
  });
435
+ var _ProgressDonut = require("./ProgressDonut");
436
+ Object.keys(_ProgressDonut).forEach(function (key) {
437
+ if (key === "default" || key === "__esModule") return;
438
+ if (key in exports && exports[key] === _ProgressDonut[key]) return;
439
+ Object.defineProperty(exports, key, {
440
+ enumerable: true,
441
+ get: function () {
442
+ return _ProgressDonut[key];
443
+ }
444
+ });
445
+ });
435
446
  var _RadioButton = require("./RadioButton");
436
447
  Object.keys(_RadioButton).forEach(function (key) {
437
448
  if (key === "default" || key === "__esModule") return;
@@ -39,6 +39,7 @@ export * from './OptionButton';
39
39
  export * from './PageTitle';
40
40
  export * from './Pagination';
41
41
  export * from './Panel';
42
+ export * from './ProgressDonut';
42
43
  export * from './RadioButton';
43
44
  export * from './SearchInput';
44
45
  export * from './Shimmer';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spaced-out/ui-design-system",
3
- "version": "0.1.112",
3
+ "version": "0.1.114",
4
4
  "main": "index.js",
5
5
  "description": "Sense UI components library",
6
6
  "author": {