@spaced-out/ui-design-system 0.3.43 → 0.3.45
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/CHANGELOG.md +9 -0
- package/lib/components/BadgedIcon/BadgedIcon.d.ts +70 -0
- package/lib/components/BadgedIcon/BadgedIcon.js +54 -0
- package/lib/components/BadgedIcon/BadgedIcon.js.flow +73 -0
- package/lib/components/BadgedIcon/BadgedIcon.module.css +88 -0
- package/lib/components/BadgedIcon/index.d.ts +1 -0
- package/lib/components/BadgedIcon/index.js +16 -0
- package/lib/components/BadgedIcon/index.js.flow +3 -0
- package/lib/components/index.d.ts +1 -0
- package/lib/components/index.js +11 -0
- package/lib/components/index.js.flow +1 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,15 @@
|
|
|
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.3.45](https://github.com/spaced-out/ui-design-system/compare/v0.3.44...v0.3.45) (2025-06-16)
|
|
6
|
+
|
|
7
|
+
### [0.3.44](https://github.com/spaced-out/ui-design-system/compare/v0.3.43...v0.3.44) (2025-06-16)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* (GDS-526) ai icon ([#357](https://github.com/spaced-out/ui-design-system/issues/357)) ([4be6e07](https://github.com/spaced-out/ui-design-system/commit/4be6e07a9163906306250c8b35f5f335d3a0ee88))
|
|
13
|
+
|
|
5
14
|
### [0.3.43](https://github.com/spaced-out/ui-design-system/compare/v0.3.42...v0.3.43) (2025-06-16)
|
|
6
15
|
|
|
7
16
|
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import {$ReadOnly} from 'utility-types';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import {TEXT_COLORS} from '../../types/typography';
|
|
4
|
+
import classify from '../../utils/classify';
|
|
5
|
+
import type {IconSize, IconType} from '../Icon';
|
|
6
|
+
import {Icon} from '../Icon';
|
|
7
|
+
import typographyStyle from '../../styles/typography.module.css';
|
|
8
|
+
import css from './BadgedIcon.module.css';
|
|
9
|
+
type ClassNames = $ReadOnly<{
|
|
10
|
+
wrapper?: string;
|
|
11
|
+
icon?: string;
|
|
12
|
+
badgeIcon?: string;
|
|
13
|
+
}>;
|
|
14
|
+
export type BadgedIconProps = {
|
|
15
|
+
type?: IconType;
|
|
16
|
+
name: string;
|
|
17
|
+
size?: IconSize;
|
|
18
|
+
ariaLabel?: string;
|
|
19
|
+
showBadge?: boolean;
|
|
20
|
+
classNames?: ClassNames;
|
|
21
|
+
};
|
|
22
|
+
export const BadgedIcon = ({
|
|
23
|
+
name,
|
|
24
|
+
showBadge = true,
|
|
25
|
+
classNames,
|
|
26
|
+
size = 'medium',
|
|
27
|
+
type = 'solid',
|
|
28
|
+
ariaLabel,
|
|
29
|
+
}: BadgedIconProps): React.ReactNode => (
|
|
30
|
+
<>
|
|
31
|
+
{!!name && (
|
|
32
|
+
<div
|
|
33
|
+
className={classify(css.iconContainer, css[size], classNames?.wrapper)}
|
|
34
|
+
>
|
|
35
|
+
<Icon
|
|
36
|
+
ariaLabel={ariaLabel}
|
|
37
|
+
name={name}
|
|
38
|
+
className={classNames?.icon}
|
|
39
|
+
name={name}
|
|
40
|
+
size={size === 'large' ? 'medium' : size}
|
|
41
|
+
type={type}
|
|
42
|
+
color={TEXT_COLORS.clickable}
|
|
43
|
+
/>
|
|
44
|
+
{showBadge && <BadgeIcon className={classNames?.badgeIcon} />}
|
|
45
|
+
</div>
|
|
46
|
+
)}
|
|
47
|
+
</>
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
const BadgeIcon = ({
|
|
51
|
+
className,
|
|
52
|
+
}: {
|
|
53
|
+
className: string | null | undefined;
|
|
54
|
+
}): React.ReactNode => (
|
|
55
|
+
<svg
|
|
56
|
+
className={classify(
|
|
57
|
+
css.badgeIcon,
|
|
58
|
+
typographyStyle[TEXT_COLORS['clickable']],
|
|
59
|
+
className,
|
|
60
|
+
)}
|
|
61
|
+
viewBox="0 0 12 13"
|
|
62
|
+
fill="none"
|
|
63
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
64
|
+
>
|
|
65
|
+
<path
|
|
66
|
+
d="M6.46573 1.0335L8.10352 4.61465L11.6941 6.24816C11.883 6.3424 12.009 6.53088 12.009 6.71936C12.009 6.90784 11.883 7.09632 11.6941 7.15915L8.10352 8.82407L6.46573 12.4052C6.37124 12.5937 6.18226 12.7194 5.99329 12.7194C5.80431 12.7194 5.61533 12.5937 5.55234 12.4052L3.88305 8.82407L0.292498 7.19056C0.103521 7.09632 0.0090332 6.90784 0.0090332 6.71936C0.0090332 6.53088 0.103521 6.3424 0.292498 6.24816L3.88305 4.61465L5.55234 1.0335C5.61533 0.845015 5.80431 0.71936 5.99329 0.71936C6.18226 0.71936 6.37124 0.845015 6.46573 1.0335Z"
|
|
67
|
+
fill="currentColor"
|
|
68
|
+
/>
|
|
69
|
+
</svg>
|
|
70
|
+
);
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.BadgedIcon = void 0;
|
|
7
|
+
var React = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _typography = require("../../types/typography");
|
|
9
|
+
var _classify = _interopRequireDefault(require("../../utils/classify"));
|
|
10
|
+
var _Icon = require("../Icon");
|
|
11
|
+
var _typographyModule = _interopRequireDefault(require("../../styles/typography.module.css"));
|
|
12
|
+
var _BadgedIconModule = _interopRequireDefault(require("./BadgedIcon.module.css"));
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
+
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); }
|
|
15
|
+
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; }
|
|
16
|
+
|
|
17
|
+
const BadgedIcon = _ref => {
|
|
18
|
+
let {
|
|
19
|
+
name,
|
|
20
|
+
showBadge = true,
|
|
21
|
+
classNames,
|
|
22
|
+
size = 'medium',
|
|
23
|
+
type = 'solid',
|
|
24
|
+
ariaLabel
|
|
25
|
+
} = _ref;
|
|
26
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, !!name && /*#__PURE__*/React.createElement("div", {
|
|
27
|
+
className: (0, _classify.default)(_BadgedIconModule.default.iconContainer, _BadgedIconModule.default[size], classNames?.wrapper)
|
|
28
|
+
}, /*#__PURE__*/React.createElement(_Icon.Icon, {
|
|
29
|
+
ariaLabel: ariaLabel,
|
|
30
|
+
name: name,
|
|
31
|
+
className: classNames?.icon,
|
|
32
|
+
name: name,
|
|
33
|
+
size: size === 'large' ? 'medium' : size,
|
|
34
|
+
type: type,
|
|
35
|
+
color: _typography.TEXT_COLORS.clickable
|
|
36
|
+
}), showBadge && /*#__PURE__*/React.createElement(BadgeIcon, {
|
|
37
|
+
className: classNames?.badgeIcon
|
|
38
|
+
})));
|
|
39
|
+
};
|
|
40
|
+
exports.BadgedIcon = BadgedIcon;
|
|
41
|
+
const BadgeIcon = _ref2 => {
|
|
42
|
+
let {
|
|
43
|
+
className
|
|
44
|
+
} = _ref2;
|
|
45
|
+
return /*#__PURE__*/React.createElement("svg", {
|
|
46
|
+
className: (0, _classify.default)(_BadgedIconModule.default.badgeIcon, _typographyModule.default[_typography.TEXT_COLORS['clickable']], className),
|
|
47
|
+
viewBox: "0 0 12 13",
|
|
48
|
+
fill: "none",
|
|
49
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
50
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
51
|
+
d: "M6.46573 1.0335L8.10352 4.61465L11.6941 6.24816C11.883 6.3424 12.009 6.53088 12.009 6.71936C12.009 6.90784 11.883 7.09632 11.6941 7.15915L8.10352 8.82407L6.46573 12.4052C6.37124 12.5937 6.18226 12.7194 5.99329 12.7194C5.80431 12.7194 5.61533 12.5937 5.55234 12.4052L3.88305 8.82407L0.292498 7.19056C0.103521 7.09632 0.0090332 6.90784 0.0090332 6.71936C0.0090332 6.53088 0.103521 6.3424 0.292498 6.24816L3.88305 4.61465L5.55234 1.0335C5.61533 0.845015 5.80431 0.71936 5.99329 0.71936C6.18226 0.71936 6.37124 0.845015 6.46573 1.0335Z",
|
|
52
|
+
fill: "currentColor"
|
|
53
|
+
}));
|
|
54
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
// @flow strict
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
|
|
5
|
+
import {TEXT_COLORS} from '../../types/typography';
|
|
6
|
+
import classify from '../../utils/classify';
|
|
7
|
+
import type {IconSize, IconType} from '../Icon';
|
|
8
|
+
import {Icon} from '../Icon';
|
|
9
|
+
|
|
10
|
+
import typographyStyle from '../../styles/typography.module.css';
|
|
11
|
+
import css from './BadgedIcon.module.css';
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
type ClassNames = $ReadOnly<{
|
|
15
|
+
wrapper?: string,
|
|
16
|
+
icon?: string,
|
|
17
|
+
badgeIcon?: string,
|
|
18
|
+
}>;
|
|
19
|
+
|
|
20
|
+
export type BadgedIconProps = {
|
|
21
|
+
type?: IconType,
|
|
22
|
+
name: string,
|
|
23
|
+
size?: IconSize,
|
|
24
|
+
ariaLabel?: string,
|
|
25
|
+
showBadge?: boolean,
|
|
26
|
+
classNames?: ClassNames,
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const BadgedIcon = ({
|
|
30
|
+
name,
|
|
31
|
+
showBadge = true,
|
|
32
|
+
classNames,
|
|
33
|
+
size = 'medium',
|
|
34
|
+
type = 'solid',
|
|
35
|
+
ariaLabel,
|
|
36
|
+
}: BadgedIconProps): React.Node => (
|
|
37
|
+
<>
|
|
38
|
+
{!!name && (
|
|
39
|
+
<div
|
|
40
|
+
className={classify(css.iconContainer, css[size], classNames?.wrapper)}
|
|
41
|
+
>
|
|
42
|
+
<Icon
|
|
43
|
+
ariaLabel={ariaLabel}
|
|
44
|
+
name={name}
|
|
45
|
+
className={classNames?.icon}
|
|
46
|
+
name={name}
|
|
47
|
+
size={size === 'large' ? 'medium' : size}
|
|
48
|
+
type={type}
|
|
49
|
+
color={TEXT_COLORS.clickable}
|
|
50
|
+
/>
|
|
51
|
+
{showBadge && <BadgeIcon className={classNames?.badgeIcon} />}
|
|
52
|
+
</div>
|
|
53
|
+
)}
|
|
54
|
+
</>
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
const BadgeIcon = ({className}: {className: ?string}): React.Node => (
|
|
58
|
+
<svg
|
|
59
|
+
className={classify(
|
|
60
|
+
css.badgeIcon,
|
|
61
|
+
typographyStyle[TEXT_COLORS['clickable']],
|
|
62
|
+
className,
|
|
63
|
+
)}
|
|
64
|
+
viewBox="0 0 12 13"
|
|
65
|
+
fill="none"
|
|
66
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
67
|
+
>
|
|
68
|
+
<path
|
|
69
|
+
d="M6.46573 1.0335L8.10352 4.61465L11.6941 6.24816C11.883 6.3424 12.009 6.53088 12.009 6.71936C12.009 6.90784 11.883 7.09632 11.6941 7.15915L8.10352 8.82407L6.46573 12.4052C6.37124 12.5937 6.18226 12.7194 5.99329 12.7194C5.80431 12.7194 5.61533 12.5937 5.55234 12.4052L3.88305 8.82407L0.292498 7.19056C0.103521 7.09632 0.0090332 6.90784 0.0090332 6.71936C0.0090332 6.53088 0.103521 6.3424 0.292498 6.24816L3.88305 4.61465L5.55234 1.0335C5.61533 0.845015 5.80431 0.71936 5.99329 0.71936C6.18226 0.71936 6.37124 0.845015 6.46573 1.0335Z"
|
|
70
|
+
fill="currentColor"
|
|
71
|
+
/>
|
|
72
|
+
</svg>
|
|
73
|
+
);
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
@value (colorBackgroundTertiary) from '../../styles/variables/_color.css';
|
|
2
|
+
|
|
3
|
+
@value (
|
|
4
|
+
size42,
|
|
5
|
+
size34,
|
|
6
|
+
size60,
|
|
7
|
+
size8,
|
|
8
|
+
size12,
|
|
9
|
+
size2,
|
|
10
|
+
size4
|
|
11
|
+
) from '../../styles/variables/_size.css';
|
|
12
|
+
|
|
13
|
+
@value (
|
|
14
|
+
borderRadiusMedium,
|
|
15
|
+
borderRadiusCircle
|
|
16
|
+
) from '../../styles/variables/_border.css';
|
|
17
|
+
|
|
18
|
+
@value (
|
|
19
|
+
motionEaseInEaseOut,
|
|
20
|
+
motionDurationSlow
|
|
21
|
+
) from '../../styles/variables/_motion.css';
|
|
22
|
+
|
|
23
|
+
@value (
|
|
24
|
+
spaceNone,
|
|
25
|
+
spaceMedium,
|
|
26
|
+
spaceXSmall
|
|
27
|
+
) from '../../styles/variables/_space.css';
|
|
28
|
+
|
|
29
|
+
.iconContainer {
|
|
30
|
+
display: flex;
|
|
31
|
+
width: fit-content;
|
|
32
|
+
min-width: size34;
|
|
33
|
+
min-height: size34;
|
|
34
|
+
justify-content: center;
|
|
35
|
+
align-items: center;
|
|
36
|
+
border-radius: borderRadiusMedium;
|
|
37
|
+
position: relative;
|
|
38
|
+
background: linear-gradient(
|
|
39
|
+
91deg,
|
|
40
|
+
rgba(204, 192, 240, 0.5) 0%,
|
|
41
|
+
rgba(178, 209, 250, 0.5) 100%
|
|
42
|
+
),
|
|
43
|
+
colorBackgroundTertiary;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.medium {
|
|
47
|
+
width: size42;
|
|
48
|
+
height: size42;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.small {
|
|
52
|
+
width: size34;
|
|
53
|
+
height: size34;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.large {
|
|
57
|
+
width: size60;
|
|
58
|
+
height: size60;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.iconContainer:hover .badgeIcon {
|
|
62
|
+
transform: rotate(-90deg);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.badgeIcon {
|
|
66
|
+
position: absolute;
|
|
67
|
+
border-radius: borderRadiusCircle;
|
|
68
|
+
top: calc(size2 * -1);
|
|
69
|
+
right: calc(size4 * -1);
|
|
70
|
+
transition: transform motionDurationSlow motionEaseInEaseOut;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.small .badgeIcon {
|
|
74
|
+
width: size8;
|
|
75
|
+
height: size8;
|
|
76
|
+
left: calc(spaceMedium + spaceXSmall);
|
|
77
|
+
top: spaceNone;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.medium .badgeIcon {
|
|
81
|
+
width: size12;
|
|
82
|
+
height: size12;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.large .badgeIcon {
|
|
86
|
+
width: size12;
|
|
87
|
+
height: size12;
|
|
88
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './BadgedIcon';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _BadgedIcon = require("./BadgedIcon");
|
|
7
|
+
Object.keys(_BadgedIcon).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _BadgedIcon[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _BadgedIcon[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
package/lib/components/index.js
CHANGED
|
@@ -36,6 +36,17 @@ Object.keys(_Badge).forEach(function (key) {
|
|
|
36
36
|
}
|
|
37
37
|
});
|
|
38
38
|
});
|
|
39
|
+
var _BadgedIcon = require("./BadgedIcon");
|
|
40
|
+
Object.keys(_BadgedIcon).forEach(function (key) {
|
|
41
|
+
if (key === "default" || key === "__esModule") return;
|
|
42
|
+
if (key in exports && exports[key] === _BadgedIcon[key]) return;
|
|
43
|
+
Object.defineProperty(exports, key, {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function () {
|
|
46
|
+
return _BadgedIcon[key];
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
});
|
|
39
50
|
var _Banner = require("./Banner");
|
|
40
51
|
Object.keys(_Banner).forEach(function (key) {
|
|
41
52
|
if (key === "default" || key === "__esModule") return;
|