travelcircus-styleguide 2.2.5 → 2.3.0
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/dist/components/Button.js +11 -12
- package/dist/components/Checkbox.js +14 -19
- package/dist/components/FlatButton.js +6 -8
- package/dist/components/FlatInput.js +6 -8
- package/dist/components/RoundedButton.js +6 -8
- package/dist/components/RoundedInput.js +5 -7
- package/dist/components/RoundedSelect.js +12 -9
- package/dist/components/RoundedTextarea.js +7 -10
- package/dist/components/Switch.js +9 -6
- package/dist/components/basic/Card.js +9 -6
- package/package.json +3 -3
|
@@ -23,9 +23,6 @@ const ButtonVariant = exports.ButtonVariant = {
|
|
|
23
23
|
PRIMARY_TEXT_ACCENT: 'primaryTextAccent',
|
|
24
24
|
PRIMARY_ACCENT_DEFAULT: 'primaryAccentDefault'
|
|
25
25
|
};
|
|
26
|
-
const defaultProps = {
|
|
27
|
-
variant: ButtonVariant.PRIMARY
|
|
28
|
-
};
|
|
29
26
|
const getCustomStyle = ({
|
|
30
27
|
theme: {
|
|
31
28
|
custom: {
|
|
@@ -48,11 +45,12 @@ const handleCustom = props => props?.theme?.custom ? getCustomStyle(props) : {};
|
|
|
48
45
|
* Button (pure HTML button)
|
|
49
46
|
* ================================================== */
|
|
50
47
|
|
|
51
|
-
const Button = exports.default = exports.Button = (0, _styledComponents.default)(_Button.Button)(
|
|
48
|
+
const Button = exports.default = exports.Button = (0, _styledComponents.default)(_Button.Button).attrs(({
|
|
49
|
+
variant
|
|
50
|
+
}) => ({
|
|
51
|
+
variant: variant || ButtonVariant.PRIMARY
|
|
52
|
+
}))(_button.commonStyle, _button.variants, handleCustom);
|
|
52
53
|
Button.displayName = 'Button';
|
|
53
|
-
Button.defaultProps = {
|
|
54
|
-
...defaultProps
|
|
55
|
-
};
|
|
56
54
|
|
|
57
55
|
/* ================================================== *
|
|
58
56
|
* <a> styled as a Button (HTML anchor)
|
|
@@ -76,11 +74,12 @@ ButtonBlock.displayName = 'ButtonBlock';
|
|
|
76
74
|
* React Router Link component styled as a Button
|
|
77
75
|
* ================================================== */
|
|
78
76
|
|
|
79
|
-
const ButtonRouter = exports.ButtonRouter = (0, _styledComponents.default)(_reactRouterDom.Link)({
|
|
77
|
+
const ButtonRouter = exports.ButtonRouter = (0, _styledComponents.default)(_reactRouterDom.Link).attrs(({
|
|
78
|
+
variant
|
|
79
|
+
}) => ({
|
|
80
|
+
variant: variant || ButtonVariant.PRIMARY
|
|
81
|
+
}))({
|
|
80
82
|
..._Button.style,
|
|
81
83
|
..._button.commonStyle
|
|
82
84
|
}, _button.variants);
|
|
83
|
-
ButtonRouter.displayName = 'ButtonRouter';
|
|
84
|
-
ButtonRouter.defaultProps = {
|
|
85
|
-
...defaultProps
|
|
86
|
-
};
|
|
85
|
+
ButtonRouter.displayName = 'ButtonRouter';
|
|
@@ -10,14 +10,15 @@ var _colors = require("../theme/colors");
|
|
|
10
10
|
var _Icon = _interopRequireDefault(require("./basic/Icon"));
|
|
11
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
12
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
13
|
-
const
|
|
14
|
-
size
|
|
15
|
-
space
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
const StyledCheckboxWrapper = _styledComponents.default.label.attrs(({
|
|
14
|
+
size,
|
|
15
|
+
space,
|
|
16
|
+
themeColor
|
|
17
|
+
}) => ({
|
|
18
|
+
size: size || 24,
|
|
19
|
+
space: space || 3,
|
|
20
|
+
themeColor: themeColor || _colors.Color.BLACK
|
|
21
|
+
}))`
|
|
21
22
|
display: block;
|
|
22
23
|
width: ${({
|
|
23
24
|
size
|
|
@@ -98,18 +99,15 @@ const StyledCheckboxWrapper = _styledComponents.default.label`
|
|
|
98
99
|
}
|
|
99
100
|
}
|
|
100
101
|
`;
|
|
101
|
-
StyledCheckboxWrapper.defaultProps = {
|
|
102
|
-
...DEFAULT_PROPS
|
|
103
|
-
};
|
|
104
102
|
const Checkbox = /*#__PURE__*/_react.default.forwardRef(({
|
|
105
|
-
size,
|
|
106
|
-
space,
|
|
107
|
-
themeColor,
|
|
108
|
-
isLightTheme,
|
|
103
|
+
size = 24,
|
|
104
|
+
space = 3,
|
|
105
|
+
themeColor = _colors.Color.BLACK,
|
|
106
|
+
isLightTheme = false,
|
|
109
107
|
isError,
|
|
110
108
|
borderColor,
|
|
111
109
|
errorBorderColor,
|
|
112
|
-
checkColor,
|
|
110
|
+
checkColor = _colors.Color.WHITE,
|
|
113
111
|
...rest
|
|
114
112
|
}, ref) => /*#__PURE__*/_react.default.createElement(StyledCheckboxWrapper, {
|
|
115
113
|
size: size,
|
|
@@ -127,8 +125,5 @@ const Checkbox = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
127
125
|
name: "netguru_check",
|
|
128
126
|
color: `${checkColor || _colors.Color.WHITE} !important`
|
|
129
127
|
})));
|
|
130
|
-
Checkbox.defaultProps = {
|
|
131
|
-
...DEFAULT_PROPS
|
|
132
|
-
};
|
|
133
128
|
Checkbox.displayName = 'Checkbox';
|
|
134
129
|
var _default = exports.default = Checkbox;
|
|
@@ -67,9 +67,6 @@ const FlatButtonVariant = exports.FlatButtonVariant = {
|
|
|
67
67
|
...variantGroups.tertiary,
|
|
68
68
|
...variantGroups.tertiaryLong
|
|
69
69
|
};
|
|
70
|
-
const defaultProps = {
|
|
71
|
-
variant: FlatButtonVariant.PRIMARY
|
|
72
|
-
};
|
|
73
70
|
const getCustomPrimaryStyle = ({
|
|
74
71
|
color: {
|
|
75
72
|
primary
|
|
@@ -122,8 +119,9 @@ const lineHeight = props => props.lineHeight ? {
|
|
|
122
119
|
lineHeight: `${props.lineHeight} !important`
|
|
123
120
|
} : {};
|
|
124
121
|
const handleCustom = props => props?.theme?.custom ? getCustomStyles(props) : {};
|
|
125
|
-
const FlatButton = exports.default = exports.FlatButton = _styledComponents.default.button(
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
};
|
|
122
|
+
const FlatButton = exports.default = exports.FlatButton = _styledComponents.default.button.attrs(({
|
|
123
|
+
variant
|
|
124
|
+
}) => ({
|
|
125
|
+
variant: variant || FlatButtonVariant.PRIMARY
|
|
126
|
+
}))(_flatButton.commonStyle, _flatButton.variants, whiteSpace, fontSize, fontWeight, lineHeight, handleCustom);
|
|
127
|
+
FlatButton.displayName = 'FlatButton';
|
|
@@ -35,9 +35,6 @@ const FlatInputVariant = exports.FlatInputVariant = {
|
|
|
35
35
|
...variantGroups.error,
|
|
36
36
|
...variantGroups.errorLong
|
|
37
37
|
};
|
|
38
|
-
const defaultProps = {
|
|
39
|
-
variant: FlatInputVariant.DEFAULT
|
|
40
|
-
};
|
|
41
38
|
const getCustomDefaultStyle = ({
|
|
42
39
|
color: {
|
|
43
40
|
primary
|
|
@@ -59,7 +56,11 @@ const getCustomStyles = ({
|
|
|
59
56
|
return '';
|
|
60
57
|
};
|
|
61
58
|
const handleCustom = props => props?.theme?.custom ? getCustomStyles(props) : {};
|
|
62
|
-
const StyledFlatInput = (0, _styledComponents.default)(_Input.Input)(
|
|
59
|
+
const StyledFlatInput = (0, _styledComponents.default)(_Input.Input).attrs(({
|
|
60
|
+
variant
|
|
61
|
+
}) => ({
|
|
62
|
+
variant: variant || FlatInputVariant.DEFAULT
|
|
63
|
+
}))(_flatInput.commonStyle, _flatInput.variants, handleCustom);
|
|
63
64
|
const FlatInput = exports.default = exports.FlatInput = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
64
65
|
const isKeyboardMode = (0, _accessibility.useAccessibilityKeyboardMode)();
|
|
65
66
|
return /*#__PURE__*/_react.default.createElement(StyledFlatInput, _extends({
|
|
@@ -67,7 +68,4 @@ const FlatInput = exports.default = exports.FlatInput = /*#__PURE__*/_react.defa
|
|
|
67
68
|
$isKeyboardMode: isKeyboardMode
|
|
68
69
|
}, props));
|
|
69
70
|
});
|
|
70
|
-
FlatInput.displayName = 'FlatInput';
|
|
71
|
-
FlatInput.defaultProps = {
|
|
72
|
-
...defaultProps
|
|
73
|
-
};
|
|
71
|
+
FlatInput.displayName = 'FlatInput';
|
|
@@ -169,9 +169,6 @@ const RoundedButtonVariant = exports.RoundedButtonVariant = {
|
|
|
169
169
|
...variantGroups.secondaryCtaAdaptive,
|
|
170
170
|
...variantGroups.secondaryCtaLong
|
|
171
171
|
};
|
|
172
|
-
const defaultProps = {
|
|
173
|
-
variant: RoundedButtonVariant.PRIMARY
|
|
174
|
-
};
|
|
175
172
|
const getCustomPrimaryStyle = ({
|
|
176
173
|
color: {
|
|
177
174
|
primary
|
|
@@ -228,8 +225,9 @@ const width = props => props.width ? {
|
|
|
228
225
|
} : {};
|
|
229
226
|
const handleCustom = props => props?.theme?.custom ? getCustomStyles(props) : {};
|
|
230
227
|
const styledProps = (0, _styledSystem.compose)(_styledSystem.space, _styledSystem.layout, _styledSystem.flex, _styledSystem.color, _styledSystem.textAlign, _styledSystem.background, _styledSystem.border, _styledSystem.boxShadow);
|
|
231
|
-
const RoundedButton = exports.default = exports.RoundedButton = _styledComponents.default.button(
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
};
|
|
228
|
+
const RoundedButton = exports.default = exports.RoundedButton = _styledComponents.default.button.attrs(({
|
|
229
|
+
variant
|
|
230
|
+
}) => ({
|
|
231
|
+
variant: variant || RoundedButtonVariant.PRIMARY
|
|
232
|
+
}))(_roundedButton.commonStyle, styledProps, _roundedButton.variants, whiteSpace, fontSize, fontWeight, lineHeight, handleCustom, width);
|
|
233
|
+
RoundedButton.displayName = 'RoundedButton';
|
|
@@ -51,9 +51,6 @@ const RoundedInputVariant = exports.RoundedInputVariant = {
|
|
|
51
51
|
...variantGroups.customError,
|
|
52
52
|
...variantGroups.customErrorLong
|
|
53
53
|
};
|
|
54
|
-
const defaultProps = {
|
|
55
|
-
variant: RoundedInputVariant.DEFAULT
|
|
56
|
-
};
|
|
57
54
|
const inputBackgroundColor = ({
|
|
58
55
|
inputBackgroundColor
|
|
59
56
|
}) => inputBackgroundColor ? {
|
|
@@ -76,7 +73,11 @@ const placeholderTextColor = (0, _styledComponents.css)`
|
|
|
76
73
|
}) => placeholderTextColor ? placeholderTextColor : _colors.default.mediumGrey} !important;
|
|
77
74
|
}
|
|
78
75
|
`;
|
|
79
|
-
const Input = exports.Input = (0, _styledComponents.default)(_Input.Input)(
|
|
76
|
+
const Input = exports.Input = (0, _styledComponents.default)(_Input.Input).attrs(({
|
|
77
|
+
variant
|
|
78
|
+
}) => ({
|
|
79
|
+
variant: variant || RoundedInputVariant.DEFAULT
|
|
80
|
+
}))(_roundedInput.commonStyle, _roundedInput.variants, inputBackgroundColor, inputTextColor, borderColor, placeholderTextColor);
|
|
80
81
|
const RoundedInput = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
81
82
|
const {
|
|
82
83
|
error,
|
|
@@ -104,7 +105,4 @@ const RoundedInput = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
|
104
105
|
}, error)));
|
|
105
106
|
});
|
|
106
107
|
RoundedInput.displayName = 'RoundedInput';
|
|
107
|
-
RoundedInput.defaultProps = {
|
|
108
|
-
...defaultProps
|
|
109
|
-
};
|
|
110
108
|
var _default = exports.default = (0, _hocs.withInputLabel)(RoundedInput);
|
|
@@ -111,6 +111,12 @@ const Select = (0, _styledComponents.default)(_reactSelect.default)`
|
|
|
111
111
|
`;
|
|
112
112
|
const RoundedSelect = /*#__PURE__*/_react.default.forwardRef(({
|
|
113
113
|
options,
|
|
114
|
+
isClearable = false,
|
|
115
|
+
isSearchable = false,
|
|
116
|
+
hasError = false,
|
|
117
|
+
classNamePrefix = 'react-select',
|
|
118
|
+
width = '100%',
|
|
119
|
+
height = '52px',
|
|
114
120
|
...rest
|
|
115
121
|
}, ref) => {
|
|
116
122
|
const getOptions = () => {
|
|
@@ -137,7 +143,12 @@ const RoundedSelect = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
137
143
|
const isKeyboardMode = (0, _accessibility.useAccessibilityKeyboardMode)();
|
|
138
144
|
return /*#__PURE__*/_react.default.createElement(Select, _extends({
|
|
139
145
|
ref: ref,
|
|
140
|
-
|
|
146
|
+
isClearable: isClearable,
|
|
147
|
+
isSearchable: isSearchable,
|
|
148
|
+
hasError: hasError,
|
|
149
|
+
classNamePrefix: classNamePrefix,
|
|
150
|
+
width: width,
|
|
151
|
+
height: height
|
|
141
152
|
}, rest, {
|
|
142
153
|
styles: styles,
|
|
143
154
|
options: getOptions(),
|
|
@@ -145,12 +156,4 @@ const RoundedSelect = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
145
156
|
}));
|
|
146
157
|
});
|
|
147
158
|
RoundedSelect.displayName = 'RoundedSelect';
|
|
148
|
-
RoundedSelect.defaultProps = {
|
|
149
|
-
isClearable: false,
|
|
150
|
-
isSearchable: false,
|
|
151
|
-
hasError: false,
|
|
152
|
-
classNamePrefix: 'react-select',
|
|
153
|
-
width: '100%',
|
|
154
|
-
height: '52px'
|
|
155
|
-
};
|
|
156
159
|
var _default = exports.default = (0, _hocs.withLabel)(RoundedSelect, ['height']);
|
|
@@ -23,9 +23,6 @@ const variantGroups = {
|
|
|
23
23
|
const RoundedTextareaVariant = exports.RoundedTextareaVariant = {
|
|
24
24
|
...variantGroups.default
|
|
25
25
|
};
|
|
26
|
-
const defaultProps = {
|
|
27
|
-
variant: RoundedTextareaVariant.DEFAULT
|
|
28
|
-
};
|
|
29
26
|
const inputBackgroundColor = ({
|
|
30
27
|
inputBackgroundColor
|
|
31
28
|
}) => inputBackgroundColor ? {
|
|
@@ -56,9 +53,12 @@ const accessibility = ({
|
|
|
56
53
|
outline-offset: ${$isKeyboardMode ? '-2px' : 'unset'};
|
|
57
54
|
}
|
|
58
55
|
`;
|
|
59
|
-
const Textarea = exports.Textarea = _styledComponents.default.textarea.attrs({
|
|
60
|
-
|
|
61
|
-
})
|
|
56
|
+
const Textarea = exports.Textarea = _styledComponents.default.textarea.attrs(({
|
|
57
|
+
variant
|
|
58
|
+
}) => ({
|
|
59
|
+
as: 'textarea',
|
|
60
|
+
variant: variant || RoundedTextareaVariant.DEFAULT
|
|
61
|
+
}))(_roundedTextarea.commonStyle, _roundedTextarea.variants, inputBackgroundColor, inputTextColor, borderColor, placeholderTextColor, accessibility);
|
|
62
62
|
const RoundedTextarea = exports.default = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
63
63
|
const {
|
|
64
64
|
required,
|
|
@@ -90,7 +90,4 @@ const RoundedTextarea = exports.default = /*#__PURE__*/_react.default.forwardRef
|
|
|
90
90
|
$isKeyboardMode: isKeyboardMode
|
|
91
91
|
}, props)));
|
|
92
92
|
});
|
|
93
|
-
RoundedTextarea.displayName = 'RoundedTextarea';
|
|
94
|
-
RoundedTextarea.defaultProps = {
|
|
95
|
-
...defaultProps
|
|
96
|
-
};
|
|
93
|
+
RoundedTextarea.displayName = 'RoundedTextarea';
|
|
@@ -10,7 +10,15 @@ var _theme = require("../theme");
|
|
|
10
10
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
11
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
12
12
|
const ANIMATION_DURATION = '.2s';
|
|
13
|
-
const StyledSwitch = _styledComponents.default.label
|
|
13
|
+
const StyledSwitch = _styledComponents.default.label.attrs(({
|
|
14
|
+
height,
|
|
15
|
+
width,
|
|
16
|
+
space
|
|
17
|
+
}) => ({
|
|
18
|
+
height: height || '36px',
|
|
19
|
+
width: width || '64px',
|
|
20
|
+
space: space || '3px'
|
|
21
|
+
}))`
|
|
14
22
|
position: relative;
|
|
15
23
|
display: inline-block;
|
|
16
24
|
width: ${({
|
|
@@ -98,11 +106,6 @@ const StyledSwitch = _styledComponents.default.label`
|
|
|
98
106
|
}
|
|
99
107
|
}
|
|
100
108
|
`;
|
|
101
|
-
StyledSwitch.defaultProps = {
|
|
102
|
-
height: '36px',
|
|
103
|
-
width: '64px',
|
|
104
|
-
space: '3px'
|
|
105
|
-
};
|
|
106
109
|
const Switch = /*#__PURE__*/_react.default.forwardRef(({
|
|
107
110
|
height,
|
|
108
111
|
width,
|
|
@@ -8,11 +8,14 @@ var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
|
8
8
|
var _PositionBox = _interopRequireDefault(require("./PositionBox"));
|
|
9
9
|
var _theme = require("../../theme/theme");
|
|
10
10
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
-
const Card = (0, _styledComponents.default)(_PositionBox.default)
|
|
11
|
+
const Card = (0, _styledComponents.default)(_PositionBox.default).attrs(({
|
|
12
|
+
position,
|
|
13
|
+
borderRadius,
|
|
14
|
+
boxShadow
|
|
15
|
+
}) => ({
|
|
16
|
+
position: position || "relative",
|
|
17
|
+
borderRadius: borderRadius ?? 3,
|
|
18
|
+
boxShadow: boxShadow || _theme.shadows[0]
|
|
19
|
+
}))``;
|
|
12
20
|
Card.displayName = "Card";
|
|
13
|
-
Card.defaultProps = {
|
|
14
|
-
position: "relative",
|
|
15
|
-
borderRadius: 3,
|
|
16
|
-
boxShadow: _theme.shadows[0]
|
|
17
|
-
};
|
|
18
21
|
var _default = exports.default = Card;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "travelcircus-styleguide",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "Components Styleguide for a TravelCircus web services",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"eslint": "^7.18.0",
|
|
41
41
|
"eslint-plugin-react": "^7.22.0",
|
|
42
42
|
"prettier": "^2.2.1",
|
|
43
|
-
"react": "^
|
|
44
|
-
"react-dom": "^
|
|
43
|
+
"react": "^19.2.3",
|
|
44
|
+
"react-dom": "^19.2.3",
|
|
45
45
|
"react-is": "^18.3.1",
|
|
46
46
|
"rimraf": "3.0.2",
|
|
47
47
|
"storybook": "^10.1.10"
|