@synerise/ds-card-select 0.6.0 → 0.7.1
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 +19 -0
- package/README.md +21 -12
- package/dist/CardSelect.d.ts +17 -16
- package/dist/CardSelect.js +8 -2
- package/dist/CardSelect.styles.d.ts +13 -10
- package/dist/CardSelect.styles.js +12 -4
- package/dist/CardSelect.types.d.ts +6 -3
- package/dist/CardSelectGroup/CardSelectGroup.d.ts +2 -2
- package/dist/CardSelectGroup/CardSelectGroup.js +21 -7
- package/dist/CardSelectGroup/CardSelectGroup.styles.d.ts +8 -2
- package/dist/CardSelectGroup/CardSelectGroup.styles.js +9 -12
- package/dist/CardSelectGroup/CardSelectGroup.types.d.ts +12 -5
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,25 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [0.7.1](https://github.com/Synerise/synerise-design/compare/@synerise/ds-card-select@0.7.0...@synerise/ds-card-select@0.7.1) (2024-06-21)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @synerise/ds-card-select
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [0.7.0](https://github.com/Synerise/synerise-design/compare/@synerise/ds-card-select@0.6.0...@synerise/ds-card-select@0.7.0) (2024-06-05)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* **card-select:** added items prop for rendering children ([838ae8d](https://github.com/Synerise/synerise-design/commit/838ae8db364a17589a7187f97e0a139c0bb673c5))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
6
25
|
# [0.6.0](https://github.com/Synerise/synerise-design/compare/@synerise/ds-card-select@0.5.44...@synerise/ds-card-select@0.6.0) (2024-05-31)
|
|
7
26
|
|
|
8
27
|
|
package/README.md
CHANGED
|
@@ -50,24 +50,22 @@ yarn add @synerise/ds-card-select
|
|
|
50
50
|
|
|
51
51
|
| Property | Description | Type | Default |
|
|
52
52
|
| -------------------------- | -------------------------------------------------------------------- | ------------------ | ----------------------------------------------- |
|
|
53
|
-
| className | The
|
|
53
|
+
| className | The className of the container | string | - |
|
|
54
54
|
| size | The size of the card | `small` / `medium` | `medium` |
|
|
55
|
-
| raised | Defines
|
|
56
|
-
| icon | Defines the
|
|
57
|
-
| iconSize |
|
|
58
|
-
| title | Defines the title of the card |
|
|
59
|
-
| description | Defines the description of the card (not available for `small` size) |
|
|
60
|
-
| value | Defines if the card is selected by a user | boolean
|
|
61
|
-
| tickVisible | Defines the display of the checkbox | boolean | `true`
|
|
55
|
+
| raised | Defines border style | boolean | - |
|
|
56
|
+
| icon | Defines the icon | ReactNode | - |
|
|
57
|
+
| iconSize | Overwrites the predefined (82px for `medium` size, 48px for `small` size) size of the icon | number | - |
|
|
58
|
+
| title | Defines the title of the card | `ReactNode` | - |
|
|
59
|
+
| description | Defines the description of the card (not available for `small` size) | `ReactNode` | - |
|
|
60
|
+
| value | Defines if the card is selected by a user | boolean | `false` |
|
|
61
|
+
| tickVisible | Defines the display of the checkbox | boolean | `true` |
|
|
62
62
|
| disabled | Defines if the card is disabled (`onChange` still fires) | boolean | - |
|
|
63
63
|
| customTickVisible | Defines if the checkbox is custom | boolean | - |
|
|
64
64
|
| customTickVisibleComponent | Custom checkbox component | ReactNode | - |
|
|
65
65
|
| stretchToFit | Aligns the height of each card | boolean | - |
|
|
66
|
-
| clearTooltip | Defines the title of clear icon tooltip | string | - |
|
|
67
|
-
| thickSize | The size of the thick | `small` / `medium` | `medium` |
|
|
68
66
|
| theme | Palette of colors | string | - |
|
|
69
|
-
| elementsPosition | Defines the position of the elements on the card |
|
|
70
|
-
|
|
67
|
+
| elementsPosition | Defines the position of the elements on the card | `left` / `right` / `center` | `center` |
|
|
68
|
+
|
|
71
69
|
| tagProps | Defines a ribbon-style tag | `TagProps` | - |
|
|
72
70
|
| tagTooltipProps | Defines tooltip for the ribbon tag | `TooltipProps` | - |
|
|
73
71
|
|
|
@@ -79,6 +77,17 @@ accepts a subset of TagProps. See @synerise/ds-tags for API
|
|
|
79
77
|
Omit<TagProps, 'shape' | 'removable' | 'asPill' | 'onRemove' | 'image' | 'texts'>
|
|
80
78
|
```
|
|
81
79
|
|
|
80
|
+
### CardSelectGroup
|
|
81
|
+
|
|
82
|
+
| Property | Description | Type | Default |
|
|
83
|
+
|-----------|-----------------------------------------------------------------------------------------------|------------------------------------------|-----------------------------------------|
|
|
84
|
+
| className | The name of the container | string | - |
|
|
85
|
+
| columns | Defines the number of columns. Defaults to 2, set to null to render all items in a single row | number / null | - |
|
|
86
|
+
| children | Deprecated. Use items prop instead | ReactNode | - |
|
|
87
|
+
| items | Array of CardSelect props to render CardSelect child elements | CardSelectProps & { key: string / numer} | - |
|
|
88
|
+
| width | Defines the size of the gap between items. Deprecated, use size prop | `small` / `large` | 16px for `small`, 24px for `large` size |
|
|
89
|
+
| size | The size of the CardSelect items and gap between them | `small` / `medium` | `medium` |
|
|
90
|
+
|
|
82
91
|
|
|
83
92
|
### Methods
|
|
84
93
|
|
package/dist/CardSelect.d.ts
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
declare const _default: React.ForwardRefExoticComponent<{
|
|
3
|
-
title?: React.ReactNode;
|
|
4
3
|
className?: string | undefined;
|
|
5
|
-
|
|
4
|
+
disabled?: boolean | undefined;
|
|
6
5
|
onClick?: (() => void) | undefined;
|
|
6
|
+
title?: React.ReactNode;
|
|
7
|
+
onChange?: ((value: boolean) => void) | undefined;
|
|
8
|
+
key?: React.Key | undefined;
|
|
7
9
|
stretchToFit?: boolean | undefined;
|
|
8
10
|
error?: boolean | undefined;
|
|
9
11
|
value?: boolean | undefined;
|
|
10
12
|
raised?: boolean | undefined;
|
|
11
|
-
size?: "
|
|
12
|
-
disabled?: boolean | undefined;
|
|
13
|
+
size?: import("./CardSelect.types").CardSelectSizeType | undefined;
|
|
13
14
|
description?: React.ReactNode;
|
|
14
15
|
customTickVisible?: boolean | undefined;
|
|
15
16
|
customTickVisibleComponent?: React.ReactNode;
|
|
@@ -17,30 +18,36 @@ declare const _default: React.ForwardRefExoticComponent<{
|
|
|
17
18
|
icon?: React.ReactNode;
|
|
18
19
|
iconSize?: number | undefined;
|
|
19
20
|
tickSize?: number | undefined;
|
|
20
|
-
elementsPosition?:
|
|
21
|
+
elementsPosition?: import("./CardSelect.types").CardSelectAlignType | undefined;
|
|
21
22
|
tagProps?: {
|
|
22
|
-
|
|
23
|
-
style?: React.CSSProperties | undefined;
|
|
24
|
-
title?: string | undefined;
|
|
23
|
+
id?: string | undefined;
|
|
25
24
|
name?: string | undefined;
|
|
25
|
+
textColor?: string | undefined;
|
|
26
|
+
color?: string | undefined;
|
|
27
|
+
className?: string | undefined;
|
|
28
|
+
disabled?: boolean | undefined;
|
|
29
|
+
onClick?: ((() => void) & React.MouseEventHandler<HTMLDivElement>) | undefined;
|
|
30
|
+
prefixel?: React.ReactNode;
|
|
31
|
+
suffixel?: React.ReactNode;
|
|
26
32
|
defaultChecked?: boolean | undefined;
|
|
27
33
|
defaultValue?: string | number | readonly string[] | undefined;
|
|
28
34
|
suppressContentEditableWarning?: boolean | undefined;
|
|
29
35
|
suppressHydrationWarning?: boolean | undefined;
|
|
30
36
|
accessKey?: string | undefined;
|
|
31
37
|
autoFocus?: boolean | undefined;
|
|
32
|
-
className?: string | undefined;
|
|
33
38
|
contentEditable?: "inherit" | (boolean | "true" | "false") | undefined;
|
|
34
39
|
contextMenu?: string | undefined;
|
|
35
40
|
dir?: string | undefined;
|
|
36
41
|
draggable?: (boolean | "true" | "false") | undefined;
|
|
37
42
|
hidden?: boolean | undefined;
|
|
38
|
-
id?: string | undefined;
|
|
39
43
|
lang?: string | undefined;
|
|
40
44
|
nonce?: string | undefined;
|
|
41
45
|
placeholder?: string | undefined;
|
|
46
|
+
slot?: string | undefined;
|
|
42
47
|
spellCheck?: (boolean | "true" | "false") | undefined;
|
|
48
|
+
style?: React.CSSProperties | undefined;
|
|
43
49
|
tabIndex?: number | undefined;
|
|
50
|
+
title?: string | undefined;
|
|
44
51
|
translate?: "yes" | "no" | undefined;
|
|
45
52
|
radioGroup?: string | undefined;
|
|
46
53
|
role?: React.AriaRole | undefined;
|
|
@@ -58,7 +65,6 @@ declare const _default: React.ForwardRefExoticComponent<{
|
|
|
58
65
|
autoCapitalize?: string | undefined;
|
|
59
66
|
autoCorrect?: string | undefined;
|
|
60
67
|
autoSave?: string | undefined;
|
|
61
|
-
color?: string | undefined;
|
|
62
68
|
itemProp?: string | undefined;
|
|
63
69
|
itemScope?: boolean | undefined;
|
|
64
70
|
itemType?: string | undefined;
|
|
@@ -205,7 +211,6 @@ declare const _default: React.ForwardRefExoticComponent<{
|
|
|
205
211
|
onWaitingCapture?: React.ReactEventHandler<HTMLDivElement> | undefined;
|
|
206
212
|
onAuxClick?: React.MouseEventHandler<HTMLDivElement> | undefined;
|
|
207
213
|
onAuxClickCapture?: React.MouseEventHandler<HTMLDivElement> | undefined;
|
|
208
|
-
onClick?: ((() => void) & React.MouseEventHandler<HTMLDivElement>) | undefined;
|
|
209
214
|
onClickCapture?: React.MouseEventHandler<HTMLDivElement> | undefined;
|
|
210
215
|
onContextMenu?: React.MouseEventHandler<HTMLDivElement> | undefined;
|
|
211
216
|
onContextMenuCapture?: React.MouseEventHandler<HTMLDivElement> | undefined;
|
|
@@ -281,10 +286,6 @@ declare const _default: React.ForwardRefExoticComponent<{
|
|
|
281
286
|
onAnimationIterationCapture?: React.AnimationEventHandler<HTMLDivElement> | undefined;
|
|
282
287
|
onTransitionEnd?: React.TransitionEventHandler<HTMLDivElement> | undefined;
|
|
283
288
|
onTransitionEndCapture?: React.TransitionEventHandler<HTMLDivElement> | undefined;
|
|
284
|
-
disabled?: boolean | undefined;
|
|
285
|
-
textColor?: string | undefined;
|
|
286
|
-
prefixel?: React.ReactNode;
|
|
287
|
-
suffixel?: React.ReactNode;
|
|
288
289
|
} | undefined;
|
|
289
290
|
tagTooltipProps?: import("@synerise/ds-tooltip").TooltipProps | undefined;
|
|
290
291
|
} & {
|
package/dist/CardSelect.js
CHANGED
|
@@ -44,7 +44,10 @@ var CardSelect = function CardSelect(_ref) {
|
|
|
44
44
|
onClick ? onClick() : onChange && onChange(!value);
|
|
45
45
|
setIsPressed(true);
|
|
46
46
|
setTimeout(function () {
|
|
47
|
-
|
|
47
|
+
var _tickIconRef$current;
|
|
48
|
+
|
|
49
|
+
// eslint-disable-next-line no-unused-expressions
|
|
50
|
+
(_tickIconRef$current = tickIconRef.current) == null || _tickIconRef$current.blur();
|
|
48
51
|
});
|
|
49
52
|
};
|
|
50
53
|
|
|
@@ -60,9 +63,12 @@ var CardSelect = function CardSelect(_ref) {
|
|
|
60
63
|
});
|
|
61
64
|
return /*#__PURE__*/React.createElement(S.CardWrapper, {
|
|
62
65
|
size: size,
|
|
66
|
+
className: "ds-card-select-wrapper",
|
|
63
67
|
disabled: disabled,
|
|
64
68
|
stretchToFit: stretchToFit,
|
|
65
|
-
hasTick: tickVisible || customTickVisible
|
|
69
|
+
hasTick: tickVisible || customTickVisible,
|
|
70
|
+
hasIcon: !!icon,
|
|
71
|
+
elementsPosition: elementsPosition
|
|
66
72
|
}, tagElementWithTooltip, /*#__PURE__*/React.createElement(S.Container, {
|
|
67
73
|
error: !!error,
|
|
68
74
|
ref: wrapperRef,
|
|
@@ -1,29 +1,30 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ThemeProps } from '@synerise/ds-core';
|
|
3
|
+
import { CardSelectAlignType, CardSelectSizeType } from './CardSelect.types';
|
|
3
4
|
export declare const RadioShape: import("styled-components").StyledComponent<"div", any, {
|
|
4
|
-
size?:
|
|
5
|
+
size?: CardSelectSizeType | undefined;
|
|
5
6
|
}, never>;
|
|
6
7
|
export declare const Title: import("styled-components").StyledComponent<"div", any, {
|
|
7
8
|
hasIcon: boolean;
|
|
8
|
-
size?:
|
|
9
|
+
size?: CardSelectSizeType | undefined;
|
|
9
10
|
}, never>;
|
|
10
11
|
export declare const Description: import("styled-components").StyledComponent<"div", any, {
|
|
11
12
|
hasTitle?: boolean | undefined;
|
|
12
13
|
hasIcon?: boolean | undefined;
|
|
13
|
-
size?:
|
|
14
|
+
size?: CardSelectSizeType | undefined;
|
|
14
15
|
}, never>;
|
|
15
16
|
export declare const IconWrapper: import("styled-components").StyledComponent<"div", any, {
|
|
16
|
-
size?:
|
|
17
|
+
size?: CardSelectSizeType | undefined;
|
|
17
18
|
}, never>;
|
|
18
19
|
export declare const Aside: import("styled-components").StyledComponent<"div", any, {
|
|
19
|
-
size?:
|
|
20
|
+
size?: CardSelectSizeType | undefined;
|
|
20
21
|
}, never>;
|
|
21
22
|
export declare const Container: import("styled-components").StyledComponent<"div", any, {
|
|
22
23
|
disabled?: boolean | undefined;
|
|
23
24
|
raised?: boolean | undefined;
|
|
24
25
|
value?: boolean | undefined;
|
|
25
|
-
size?:
|
|
26
|
-
elementsPosition:
|
|
26
|
+
size?: CardSelectSizeType | undefined;
|
|
27
|
+
elementsPosition: CardSelectAlignType;
|
|
27
28
|
selected?: boolean | undefined;
|
|
28
29
|
pressed?: boolean | undefined;
|
|
29
30
|
stretchToFit?: boolean | undefined;
|
|
@@ -38,14 +39,16 @@ export declare const TagRibbon: import("styled-components").StyledComponent<{
|
|
|
38
39
|
}, any, {}, never>;
|
|
39
40
|
export declare const Main: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
40
41
|
export declare const TickIcon: import("styled-components").StyledComponent<"div", any, {
|
|
41
|
-
size?:
|
|
42
|
+
size?: CardSelectSizeType | undefined;
|
|
42
43
|
disabled?: boolean | undefined;
|
|
43
44
|
selected?: boolean | undefined;
|
|
44
|
-
elementsPosition:
|
|
45
|
+
elementsPosition: CardSelectAlignType;
|
|
45
46
|
}, never>;
|
|
46
47
|
export declare const CardWrapper: import("styled-components").StyledComponent<"div", any, {
|
|
47
|
-
size?:
|
|
48
|
+
size?: CardSelectSizeType | undefined;
|
|
48
49
|
disabled?: boolean | undefined;
|
|
49
50
|
stretchToFit?: boolean | undefined;
|
|
50
51
|
hasTick?: boolean | undefined;
|
|
52
|
+
hasIcon?: boolean | undefined;
|
|
53
|
+
elementsPosition?: CardSelectAlignType | undefined;
|
|
51
54
|
}, never>;
|
|
@@ -52,7 +52,7 @@ export var RadioShape = styled.div.withConfig({
|
|
|
52
52
|
export var Title = styled.div.withConfig({
|
|
53
53
|
displayName: "CardSelectstyles__Title",
|
|
54
54
|
componentId: "tfmgtj-1"
|
|
55
|
-
})(["text-align:center;color:", ";font-weight:", ";width:100%;font-size:", ";", "
|
|
55
|
+
})(["text-align:center;color:", ";font-weight:", ";width:100%;font-size:", ";", ""], getVar('grey-800'), function (props) {
|
|
56
56
|
return sizeCondition('400', '500', props);
|
|
57
57
|
}, function (props) {
|
|
58
58
|
return sizeCondition('13px', '14px', props);
|
|
@@ -104,11 +104,11 @@ export var Container = styled.div.withConfig({
|
|
|
104
104
|
export var TagRibbonAnchor = styled.div.withConfig({
|
|
105
105
|
displayName: "CardSelectstyles__TagRibbonAnchor",
|
|
106
106
|
componentId: "tfmgtj-6"
|
|
107
|
-
})(["display:flex;
|
|
107
|
+
})(["display:flex;height:0;overflow:visible;"]);
|
|
108
108
|
export var TagRibbon = styled(Tag).withConfig({
|
|
109
109
|
displayName: "CardSelectstyles__TagRibbon",
|
|
110
110
|
componentId: "tfmgtj-7"
|
|
111
|
-
})(["position:relative;z-index:1;top:-12px;
|
|
111
|
+
})(["position:relative;z-index:1;top:-12px;margin:0;"]);
|
|
112
112
|
export var Main = styled.div.withConfig({
|
|
113
113
|
displayName: "CardSelectstyles__Main",
|
|
114
114
|
componentId: "tfmgtj-8"
|
|
@@ -122,7 +122,15 @@ export var TickIcon = styled.div.withConfig({
|
|
|
122
122
|
export var CardWrapper = styled.div.withConfig({
|
|
123
123
|
displayName: "CardSelectstyles__CardWrapper",
|
|
124
124
|
componentId: "tfmgtj-10"
|
|
125
|
-
})(["position:relative;", " ", " ", "{padding-
|
|
125
|
+
})(["position:relative;", " ", " ", "{", "}", "{justify-content:", ";padding-", ":", "px;}", "{", ":16px;}"], is('disabled')(_templateObject19 || (_templateObject19 = _taggedTemplateLiteralLoose(["\n cursor:not-allowed;\n "]))), is('stretchToFit')(_templateObject20 || (_templateObject20 = _taggedTemplateLiteralLoose(["\n height: 100%;\n "]))), Title, function (props) {
|
|
126
|
+
return props.hasTick && !props.hasIcon && css(["padding:0 24px;"]);
|
|
127
|
+
}, TagRibbonAnchor, function (props) {
|
|
128
|
+
return props.elementsPosition === 'right' ? 'flex-start' : 'flex-end';
|
|
129
|
+
}, function (props) {
|
|
130
|
+
return props.elementsPosition === 'left' ? 'right' : 'left';
|
|
131
|
+
}, function (props) {
|
|
126
132
|
var withTickOffset = props.size === 'small' ? TAG_LEFT_OFFSET_TICK_SMALL : TAG_LEFT_OFFSET_TICK_LARGE;
|
|
127
133
|
return props.hasTick ? withTickOffset : TAG_LEFT_OFFSET;
|
|
134
|
+
}, TagRibbon, function (props) {
|
|
135
|
+
return props.elementsPosition === 'left' ? 'left' : 'right';
|
|
128
136
|
});
|
|
@@ -1,16 +1,19 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
1
|
+
import type { Key, ReactNode } from 'react';
|
|
2
2
|
import type { TagProps } from '@synerise/ds-tags';
|
|
3
3
|
import type { TooltipProps } from '@synerise/ds-tooltip';
|
|
4
4
|
type CardSelectTagProps = Omit<TagProps, 'shape' | 'removable' | 'asPill' | 'onRemove' | 'image' | 'texts'>;
|
|
5
|
+
export type CardSelectAlignType = 'left' | 'center' | 'right';
|
|
6
|
+
export type CardSelectSizeType = 'small' | 'medium';
|
|
5
7
|
export type CardSelectProps = {
|
|
6
8
|
icon?: ReactNode;
|
|
9
|
+
key?: Key;
|
|
7
10
|
raised?: boolean;
|
|
8
11
|
description?: ReactNode;
|
|
9
12
|
title?: ReactNode;
|
|
10
13
|
value?: boolean;
|
|
11
14
|
disabled?: boolean;
|
|
12
15
|
tickVisible?: boolean;
|
|
13
|
-
size?:
|
|
16
|
+
size?: CardSelectSizeType;
|
|
14
17
|
className?: string;
|
|
15
18
|
iconSize?: number;
|
|
16
19
|
tickSize?: number;
|
|
@@ -24,7 +27,7 @@ export type CardSelectProps = {
|
|
|
24
27
|
};
|
|
25
28
|
onChange?: (value: boolean) => void;
|
|
26
29
|
onClick?: () => void;
|
|
27
|
-
elementsPosition?:
|
|
30
|
+
elementsPosition?: CardSelectAlignType;
|
|
28
31
|
error?: boolean;
|
|
29
32
|
};
|
|
30
33
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { CardSelectGroupProps } from './CardSelectGroup.types';
|
|
3
|
-
declare const CardSelectGroup: React.
|
|
3
|
+
declare const CardSelectGroup: ({ className, children, items, size, width, columns, }: CardSelectGroupProps) => React.JSX.Element;
|
|
4
4
|
export default CardSelectGroup;
|
|
@@ -1,18 +1,32 @@
|
|
|
1
|
-
|
|
1
|
+
function _extends() { _extends = Object.assign || 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); }
|
|
2
|
+
|
|
3
|
+
import React, { Children } from 'react';
|
|
4
|
+
import CardSelect from '../CardSelect';
|
|
2
5
|
import * as S from './CardSelectGroup.styles';
|
|
6
|
+
var DEFAULT_COLUMNS = 2;
|
|
7
|
+
var DEFAULT_SIZE = 'large';
|
|
3
8
|
|
|
4
9
|
var CardSelectGroup = function CardSelectGroup(_ref) {
|
|
5
10
|
var className = _ref.className,
|
|
6
11
|
children = _ref.children,
|
|
12
|
+
items = _ref.items,
|
|
13
|
+
size = _ref.size,
|
|
7
14
|
_ref$width = _ref.width,
|
|
8
|
-
width = _ref$width === void 0 ?
|
|
15
|
+
width = _ref$width === void 0 ? DEFAULT_SIZE : _ref$width,
|
|
9
16
|
_ref$columns = _ref.columns,
|
|
10
|
-
columns = _ref$columns === void 0 ?
|
|
11
|
-
|
|
17
|
+
columns = _ref$columns === void 0 ? DEFAULT_COLUMNS : _ref$columns;
|
|
18
|
+
var cardsCount = (items == null ? void 0 : items.length) || Children.toArray(children).length;
|
|
19
|
+
return /*#__PURE__*/React.createElement(S.CardSelectGroupWrapper, {
|
|
12
20
|
className: className,
|
|
13
|
-
|
|
14
|
-
columns: columns
|
|
15
|
-
|
|
21
|
+
size: size || width,
|
|
22
|
+
columns: columns,
|
|
23
|
+
itemsCount: cardsCount
|
|
24
|
+
}, items ? items.map(function (item) {
|
|
25
|
+
return /*#__PURE__*/React.createElement(CardSelect, _extends({}, item, {
|
|
26
|
+
key: item.key,
|
|
27
|
+
size: size || item.size
|
|
28
|
+
}));
|
|
29
|
+
}) : children);
|
|
16
30
|
};
|
|
17
31
|
|
|
18
32
|
export default CardSelectGroup;
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
+
export declare const CardSelectGroupWrapper: import("styled-components").StyledComponent<"div", any, {
|
|
2
|
+
itemsCount?: number | undefined;
|
|
3
|
+
size: 'small' | 'medium' | 'large';
|
|
4
|
+
columns: number | null;
|
|
5
|
+
}, never>;
|
|
1
6
|
export declare const CardGroup: import("styled-components").StyledComponent<"div", any, {
|
|
2
|
-
|
|
3
|
-
|
|
7
|
+
itemsCount?: number | undefined;
|
|
8
|
+
size: 'small' | 'medium' | 'large';
|
|
9
|
+
columns: number | null;
|
|
4
10
|
}, never>;
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
import styled from 'styled-components';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
displayName: "CardSelectGroupstyles__CardGroup",
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
export var CardSelectGroupWrapper = styled.div.withConfig({
|
|
3
|
+
displayName: "CardSelectGroupstyles__CardSelectGroupWrapper",
|
|
5
4
|
componentId: "sc-1xnksbf-0"
|
|
6
|
-
})(["
|
|
7
|
-
return props.
|
|
8
|
-
}, function (props) {
|
|
9
|
-
return new Array(props.columns).fill('1fr').join(' ');
|
|
5
|
+
})(["padding:24px;display:grid;grid-template-columns:", ";gap:", ";"], function (props) {
|
|
6
|
+
return new Array(props.columns || props.itemsCount).fill('1fr').join(' ');
|
|
10
7
|
}, function (props) {
|
|
11
|
-
return props.
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
return props.size === 'small' ? '16px' : '24px';
|
|
9
|
+
}); // @deprecated - use CardSelectGroupWrapper instead
|
|
10
|
+
|
|
11
|
+
export var CardGroup = CardSelectGroupWrapper;
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import type { Key, ReactNode } from 'react';
|
|
2
|
+
import { CardSelectProps } from '../CardSelect.types';
|
|
3
|
+
type CardSelectPropsWithKey = Omit<CardSelectProps, 'key'> & {
|
|
4
|
+
key: Key;
|
|
5
|
+
};
|
|
6
|
+
export type CardSelectGroupProps = {
|
|
7
|
+
children?: ReactNode;
|
|
3
8
|
className?: string;
|
|
4
|
-
|
|
9
|
+
columns?: number | null;
|
|
10
|
+
items?: CardSelectPropsWithKey[];
|
|
11
|
+
size?: CardSelectProps['size'];
|
|
5
12
|
width?: 'small' | 'large';
|
|
6
|
-
|
|
7
|
-
}
|
|
13
|
+
};
|
|
14
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-card-select",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"description": "Card-Select UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "Synerise/synerise-design",
|
|
@@ -33,9 +33,9 @@
|
|
|
33
33
|
],
|
|
34
34
|
"types": "dist/index.d.ts",
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@synerise/ds-icon": "^0.62.
|
|
37
|
-
"@synerise/ds-tags": "^0.9.
|
|
38
|
-
"@synerise/ds-tooltip": "^0.14.
|
|
36
|
+
"@synerise/ds-icon": "^0.62.1",
|
|
37
|
+
"@synerise/ds-tags": "^0.9.1",
|
|
38
|
+
"@synerise/ds-tooltip": "^0.14.30",
|
|
39
39
|
"styled-is": "^1.3.0"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@synerise/ds-utils": "^0.27.0"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "ef835e848d4f02cca258130baa6c9f44dfa15dd0"
|
|
51
51
|
}
|