@pushwoosh/dumb-components 1.1.14 → 1.1.15
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/Radio/Radio.js +5 -3
- package/Radio/mappers.d.ts +5 -0
- package/Radio/mappers.js +11 -0
- package/Radio/styles.d.ts +3 -2
- package/Radio/styles.js +30 -10
- package/Radio/types.d.ts +3 -3
- package/package.json +1 -1
- package/Radio/maps.d.ts +0 -3
- package/Radio/maps.js +0 -8
package/Radio/Radio.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
|
+
import { Color } from '@pushwoosh/kit-constants';
|
|
2
3
|
import { NativeLabel, NativeRadio } from './styles';
|
|
3
4
|
let counter = 0;
|
|
4
5
|
export function Radio(props) {
|
|
@@ -7,10 +8,10 @@ export function Radio(props) {
|
|
|
7
8
|
id,
|
|
8
9
|
name,
|
|
9
10
|
value,
|
|
10
|
-
|
|
11
|
+
type = 'normal',
|
|
11
12
|
isChecked,
|
|
12
13
|
isDisabled,
|
|
13
|
-
size = '
|
|
14
|
+
size = 'regular',
|
|
14
15
|
onChange,
|
|
15
16
|
onBlur
|
|
16
17
|
} = props;
|
|
@@ -23,7 +24,7 @@ export function Radio(props) {
|
|
|
23
24
|
});
|
|
24
25
|
return React.createElement(NativeLabel, {
|
|
25
26
|
htmlFor: localId,
|
|
26
|
-
"$color": isDisabled ?
|
|
27
|
+
"$color": isDisabled ? Color.LOCKED : Color.MAIN,
|
|
27
28
|
"$size": size
|
|
28
29
|
}, React.createElement(NativeRadio, {
|
|
29
30
|
type: "radio",
|
|
@@ -33,6 +34,7 @@ export function Radio(props) {
|
|
|
33
34
|
checked: isChecked,
|
|
34
35
|
disabled: isDisabled,
|
|
35
36
|
"$size": size,
|
|
37
|
+
"$type": type,
|
|
36
38
|
onChange: event => onChange === null || onChange === void 0 ? void 0 : onChange(event.currentTarget.value),
|
|
37
39
|
onBlur: onBlur
|
|
38
40
|
}), label && React.createElement("span", null, label));
|
package/Radio/mappers.js
ADDED
package/Radio/styles.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import type { RadioSize,
|
|
1
|
+
import type { RadioSize, RadioType } from './types';
|
|
2
2
|
export declare const NativeRadio: import("styled-components").StyledComponent<"input", any, {
|
|
3
3
|
$size: RadioSize;
|
|
4
|
+
$type: RadioType;
|
|
4
5
|
}, never>;
|
|
5
6
|
export declare const NativeLabel: import("styled-components").StyledComponent<"label", any, {
|
|
6
|
-
$color
|
|
7
|
+
$color: string;
|
|
7
8
|
$size: RadioSize;
|
|
8
9
|
}, never>;
|
package/Radio/styles.js
CHANGED
|
@@ -1,23 +1,43 @@
|
|
|
1
|
+
import { rgba } from 'polished';
|
|
1
2
|
import styled from 'styled-components';
|
|
2
|
-
import { Color,
|
|
3
|
-
import {
|
|
3
|
+
import { Color, FontSize, LineHeight } from '@pushwoosh/kit-constants';
|
|
4
|
+
import { ColorByType } from './mappers';
|
|
4
5
|
export const NativeRadio = styled.input.withConfig({
|
|
5
6
|
displayName: "NativeRadio",
|
|
6
7
|
componentId: "sc-34lgtl-0"
|
|
7
|
-
})(["appearance:none;-webkit-appearance:none;-moz-appearance:none;width:", ";height:", ";border:", ";border-radius:50%;background-color:", ";transition:border 0.1s,background-color 0.1s;cursor:pointer;&:focus{outline:none;}&[type=radio]:
|
|
8
|
+
})(["appearance:none;-webkit-appearance:none;-moz-appearance:none;position:relative;width:", ";height:", ";border:", ";border-radius:50%;background-color:", ";transition:border 0.1s,background-color 0.1s;cursor:pointer;&:focus{outline:none;}&[type=radio]:checked:disabled{cursor:not-allowed;background-color:", ";border:", ";}&[type=radio]:not(:checked):disabled{cursor:not-allowed;border-color:", ";background-color:", ";}&[type=radio]:checked{border:", ";background-color:", ";}&[type=radio]:not(:checked):not(:disabled):hover::before{background:", ";content:\"\";position:absolute;top:", ";left:", ";width:", ";height:", ";border-radius:50%;transition:background 0.2s;}"], ({
|
|
8
9
|
$size
|
|
9
|
-
}) => $size === 'compact' ? '
|
|
10
|
+
}) => $size === 'compact' ? '16px' : '24px', ({
|
|
10
11
|
$size
|
|
11
|
-
}) => $size === 'compact' ? '
|
|
12
|
+
}) => $size === 'compact' ? '16px' : '24px', ({
|
|
13
|
+
$type
|
|
14
|
+
}) => `2px solid ${ColorByType[$type].notChecked}`, Color.CLEAR, Color.FORM, ({
|
|
12
15
|
$size
|
|
13
|
-
}) => `${$size === 'compact' ? '
|
|
16
|
+
}) => `${$size === 'compact' ? '4px' : '7px'} solid ${Color.LOCKED}`, Color.LOCKED, Color.FORM, ({
|
|
17
|
+
$size,
|
|
18
|
+
$type
|
|
19
|
+
}) => `${$size === 'compact' ? '4px' : '7px'} solid ${ColorByType[$type].checked}`, Color.CLEAR, ({
|
|
20
|
+
$type
|
|
21
|
+
}) => rgba(ColorByType[$type].notChecked, 0.3), ({
|
|
14
22
|
$size
|
|
15
|
-
}) =>
|
|
23
|
+
}) => $size === 'compact' ? '3px' : '5px', ({
|
|
24
|
+
$size
|
|
25
|
+
}) => $size === 'compact' ? '3px' : '5px', ({
|
|
26
|
+
$size
|
|
27
|
+
}) => $size === 'compact' ? '6px' : '10px', ({
|
|
28
|
+
$size
|
|
29
|
+
}) => $size === 'compact' ? '6px' : '10px');
|
|
16
30
|
export const NativeLabel = styled.label.withConfig({
|
|
17
31
|
displayName: "NativeLabel",
|
|
18
32
|
componentId: "sc-34lgtl-1"
|
|
19
|
-
})(["display:inline-flex;align-items:center;font-size:", ";line-height:", ";user-select:none;", " & > ", "{&:not(:last-child){margin-right:", ";}}"], ({
|
|
33
|
+
})(["display:inline-flex;align-items:center;font-size:", ";line-height:", ";span{max-width:", ";white-space:normal;overflow-wrap:break-word;}user-select:none;", " &:has(input:disabled){cursor:not-allowed;}&:has(input:not(:disabled)){cursor:pointer;}& > ", "{&:not(:last-child){margin-right:", ";}}"], ({
|
|
20
34
|
$size
|
|
21
|
-
}) => $size === 'compact' ? FontSize.SMALL : FontSize.REGULAR,
|
|
35
|
+
}) => $size === 'compact' ? FontSize.SMALL : FontSize.REGULAR, ({
|
|
36
|
+
$size
|
|
37
|
+
}) => $size === 'compact' ? LineHeight.SMALL : LineHeight.REGULAR, ({
|
|
38
|
+
$size
|
|
39
|
+
}) => $size === 'compact' ? '600px' : '800px', ({
|
|
22
40
|
$color
|
|
23
|
-
}) =>
|
|
41
|
+
}) => `color: ${$color};`, NativeRadio, ({
|
|
42
|
+
$size
|
|
43
|
+
}) => $size === 'compact' ? '6px' : '8px');
|
package/Radio/types.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export type
|
|
2
|
-
export type RadioSize = '
|
|
1
|
+
export type RadioType = 'normal' | 'error';
|
|
2
|
+
export type RadioSize = 'regular' | 'compact';
|
|
3
3
|
export type RadioProps = {
|
|
4
4
|
label?: string;
|
|
5
5
|
id?: string;
|
|
6
6
|
name?: string;
|
|
7
7
|
value?: string;
|
|
8
|
-
|
|
8
|
+
type?: RadioType;
|
|
9
9
|
isChecked?: boolean;
|
|
10
10
|
isDisabled?: boolean;
|
|
11
11
|
size?: RadioSize;
|
package/package.json
CHANGED
package/Radio/maps.d.ts
DELETED