@spaced-out/ui-design-system 0.0.25 → 0.0.27
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
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
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.0.27](https://github.com/spaced-out/ui-design-system/compare/v0.0.26...v0.0.27) (2023-02-16)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* add clickable card to index.js ([#66](https://github.com/spaced-out/ui-design-system/issues/66)) ([542cd14](https://github.com/spaced-out/ui-design-system/commit/542cd14cd21393fbb37f6c4223f7e6c36b4ccd16))
|
|
11
|
+
|
|
12
|
+
### [0.0.26](https://github.com/spaced-out/ui-design-system/compare/v0.0.25...v0.0.26) (2023-02-16)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* clickable card ([3dcebb1](https://github.com/spaced-out/ui-design-system/commit/3dcebb1fbf0af5bded4e1816a7b89f33b4cd8748))
|
|
18
|
+
|
|
5
19
|
### [0.0.25](https://github.com/spaced-out/ui-design-system/compare/v0.0.24...v0.0.25) (2023-02-15)
|
|
6
20
|
|
|
7
21
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.PADDING_SIZES = exports.Card = void 0;
|
|
6
|
+
exports.PADDING_SIZES = exports.ClickableCard = exports.Card = void 0;
|
|
7
7
|
var React = _interopRequireWildcard(require("react"));
|
|
8
8
|
var SPACES = _interopRequireWildcard(require("../../styles/variables/_space"));
|
|
9
9
|
var _classify = _interopRequireDefault(require("../../utils/classify"));
|
|
@@ -12,7 +12,7 @@ var _CardModule = _interopRequireDefault(require("./Card.module.css"));
|
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
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
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
|
-
|
|
15
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
16
16
|
const PADDING_SIZES = Object.freeze({
|
|
17
17
|
small: 'small',
|
|
18
18
|
medium: 'medium',
|
|
@@ -30,9 +30,10 @@ const Card = _ref => {
|
|
|
30
30
|
paddingTop = 'medium',
|
|
31
31
|
paddingRight = 'medium',
|
|
32
32
|
paddingBottom = 'medium',
|
|
33
|
-
paddingLeft = 'medium'
|
|
33
|
+
paddingLeft = 'medium',
|
|
34
|
+
...props
|
|
34
35
|
} = _ref;
|
|
35
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
36
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, props, {
|
|
36
37
|
"data-testid": "Card",
|
|
37
38
|
className: (0, _classify.default)(_CardModule.default.cardWrapper, classNames?.wrapper),
|
|
38
39
|
style: {
|
|
@@ -41,6 +42,19 @@ const Card = _ref => {
|
|
|
41
42
|
paddingBottom: getPaddingValue(paddingBottom),
|
|
42
43
|
paddingLeft: getPaddingValue(paddingLeft)
|
|
43
44
|
}
|
|
44
|
-
}, children);
|
|
45
|
+
}), children);
|
|
46
|
+
};
|
|
47
|
+
exports.Card = Card;
|
|
48
|
+
const ClickableCard = _ref2 => {
|
|
49
|
+
let {
|
|
50
|
+
classNames,
|
|
51
|
+
...props
|
|
52
|
+
} = _ref2;
|
|
53
|
+
return /*#__PURE__*/React.createElement(Card, _extends({}, props, {
|
|
54
|
+
classNames: {
|
|
55
|
+
wrapper: (0, _classify.default)(_CardModule.default.clickableCard, classNames?.wrapper)
|
|
56
|
+
},
|
|
57
|
+
tabindex: "0"
|
|
58
|
+
}));
|
|
45
59
|
};
|
|
46
|
-
exports.
|
|
60
|
+
exports.ClickableCard = ClickableCard;
|
|
@@ -26,6 +26,13 @@ export type CardProps = {
|
|
|
26
26
|
paddingRight?: PaddingSizeType,
|
|
27
27
|
paddingBottom?: PaddingSizeType,
|
|
28
28
|
paddingLeft?: PaddingSizeType,
|
|
29
|
+
...
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export type ClickableCardProps = {
|
|
33
|
+
...CardProps,
|
|
34
|
+
onClick?: ?(SyntheticEvent<HTMLElement>) => mixed,
|
|
35
|
+
...
|
|
29
36
|
};
|
|
30
37
|
|
|
31
38
|
const getPaddingValue = (size: PaddingSizeType): string => {
|
|
@@ -40,8 +47,10 @@ export const Card = ({
|
|
|
40
47
|
paddingRight = 'medium',
|
|
41
48
|
paddingBottom = 'medium',
|
|
42
49
|
paddingLeft = 'medium',
|
|
50
|
+
...props
|
|
43
51
|
}: CardProps): React.Node => (
|
|
44
52
|
<div
|
|
53
|
+
{...props}
|
|
45
54
|
data-testid="Card"
|
|
46
55
|
className={classify(css.cardWrapper, classNames?.wrapper)}
|
|
47
56
|
style={{
|
|
@@ -54,3 +63,14 @@ export const Card = ({
|
|
|
54
63
|
{children}
|
|
55
64
|
</div>
|
|
56
65
|
);
|
|
66
|
+
|
|
67
|
+
export const ClickableCard = ({
|
|
68
|
+
classNames,
|
|
69
|
+
...props
|
|
70
|
+
}: ClickableCardProps): React.Node => (
|
|
71
|
+
<Card
|
|
72
|
+
{...props}
|
|
73
|
+
classNames={{wrapper: classify(css.clickableCard, classNames?.wrapper)}}
|
|
74
|
+
tabindex="0"
|
|
75
|
+
/>
|
|
76
|
+
);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
@value (colorBackgroundTertiary) from '../../styles/variables/_color.css';
|
|
2
|
-
@value (borderRadiusMedium) from '../../styles/variables/_border.css';
|
|
1
|
+
@value (colorBackgroundTertiary, colorFillPrimary, colorBorderSecondary, colorFocusPrimary) from '../../styles/variables/_color.css';
|
|
2
|
+
@value (borderRadiusMedium, borderWidthNone, borderWidthTertiary) from '../../styles/variables/_border.css';
|
|
3
3
|
|
|
4
4
|
.cardWrapper {
|
|
5
5
|
display: flex;
|
|
@@ -7,3 +7,18 @@
|
|
|
7
7
|
background-color: colorBackgroundTertiary;
|
|
8
8
|
border-radius: borderRadiusMedium;
|
|
9
9
|
}
|
|
10
|
+
|
|
11
|
+
.clickableCard {
|
|
12
|
+
cursor: pointer;
|
|
13
|
+
outline: none;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.clickableCard:hover {
|
|
17
|
+
border-color: colorBorderSecondary;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.clickableCard:focus-within {
|
|
21
|
+
border-color: colorFillPrimary;
|
|
22
|
+
box-shadow: borderWidthNone borderWidthNone borderWidthNone
|
|
23
|
+
borderWidthTertiary colorFocusPrimary;
|
|
24
|
+
}
|