travelcircus-styleguide 2.0.7 → 2.0.8

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.
@@ -108,7 +108,7 @@ var borderColor = function borderColor(_ref3) {
108
108
 
109
109
  var placeholderTextColor = (0, _styledComponents.css)(_templateObject(), function (_ref4) {
110
110
  var placeholderTextColor = _ref4.placeholderTextColor;
111
- return placeholderTextColor ? placeholderTextColor : _colors.default.hotelLightGrey;
111
+ return placeholderTextColor ? placeholderTextColor : _colors.default.mediumGrey;
112
112
  });
113
113
  var Input = (0, _styledComponents.default)(_Input.Input)(_roundedInput.commonStyle, _roundedInput.variants, inputBackgroundColor, inputTextColor, borderColor, placeholderTextColor);
114
114
  exports.Input = Input;
@@ -118,7 +118,8 @@ var RoundedInput = /*#__PURE__*/_react.default.forwardRef(function (props, ref)
118
118
  borderColorUnhovered = props.borderColorUnhovered;
119
119
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(Input, _extends({
120
120
  ref: ref,
121
- borderColor: borderColorUnhovered
121
+ borderColor: borderColorUnhovered,
122
+ placeholder: " "
122
123
  }, props)), error && typeof error === 'string' && /*#__PURE__*/_react.default.createElement(_Flex.default, {
123
124
  color: props.errorColor || _colors.default.circusRed,
124
125
  alignItems: "center",
@@ -138,6 +139,6 @@ var RoundedInput = /*#__PURE__*/_react.default.forwardRef(function (props, ref)
138
139
  RoundedInput.displayName = 'RoundedInput';
139
140
  RoundedInput.defaultProps = _objectSpread({}, defaultProps);
140
141
 
141
- var _default = (0, _hocs.withLabel)(RoundedInput);
142
+ var _default = (0, _hocs.withInnerLabel)(RoundedInput);
142
143
 
143
144
  exports.default = _default;
@@ -29,10 +29,10 @@ var style = (0, _styledComponents.css)(_templateObject());
29
29
  exports.style = style;
30
30
 
31
31
  var Input = _styledComponents.default.input.attrs({
32
- as: "input"
32
+ as: 'input'
33
33
  })(style);
34
34
 
35
35
  exports.Input = Input;
36
- Input.displayName = "Input";
36
+ Input.displayName = 'Input';
37
37
  var _default = Input;
38
38
  exports.default = _default;
@@ -9,5 +9,13 @@ Object.defineProperty(exports, "withLabel", {
9
9
  return _withLabel.withLabel;
10
10
  }
11
11
  });
12
+ Object.defineProperty(exports, "withInnerLabel", {
13
+ enumerable: true,
14
+ get: function get() {
15
+ return _withInnerLabel.withInnerLabel;
16
+ }
17
+ });
18
+
19
+ var _withLabel = require("./withLabel");
12
20
 
13
- var _withLabel = require("./withLabel");
21
+ var _withInnerLabel = require("./withInnerLabel");
@@ -0,0 +1,107 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.withInnerLabel = void 0;
7
+
8
+ var _react = _interopRequireDefault(require("react"));
9
+
10
+ var _styledComponents = _interopRequireDefault(require("styled-components"));
11
+
12
+ var _styledSystem = require("styled-system");
13
+
14
+ var _styles = require("../utils/styles");
15
+
16
+ var _colors = _interopRequireDefault(require("../theme/colors"));
17
+
18
+ var _PositionBox = _interopRequireDefault(require("../components/basic/PositionBox"));
19
+
20
+ var _Text = _interopRequireDefault(require("../components/basic/Text"));
21
+
22
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
+
24
+ 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); }
25
+
26
+ function _templateObject2() {
27
+ var data = _taggedTemplateLiteral(["\n position: absolute;\n left: 17px;\n pointer-events: none;\n transform: translate(0, 19px) scale(1);\n transform-origin: top left;\n transition: 200ms cubic-bezier(0, 0, 0.2, 1) 0ms;\n max-width: 90%;\n "]);
28
+
29
+ _templateObject2 = function _templateObject2() {
30
+ return data;
31
+ };
32
+
33
+ return data;
34
+ }
35
+
36
+ function _templateObject() {
37
+ var data = _taggedTemplateLiteral(["\n &:focus-within label {\n transform: translate(0, 3px) scale(0.8);\n top: 0;\n transform-origin: top left;\n }\n input:not(:focus):not(:placeholder-shown) ~ label {\n transform: translate(0, 3px) scale(0.8);\n top: 0;\n transform-origin: top left;\n }\n "]);
38
+
39
+ _templateObject = function _templateObject() {
40
+ return data;
41
+ };
42
+
43
+ return data;
44
+ }
45
+
46
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
47
+
48
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
49
+
50
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
51
+
52
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
53
+
54
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
55
+
56
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
57
+
58
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
59
+
60
+ function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
61
+
62
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
63
+
64
+ var styledProps = (0, _styledSystem.compose)(_styledSystem.space, _styledSystem.layout, _styledSystem.flexbox, _styledSystem.color, _styledSystem.textAlign, _styledSystem.background, _styledSystem.border, _styledSystem.boxShadow);
65
+ var Wrapper = (0, _styledComponents.default)(_PositionBox.default)({
66
+ position: 'relative',
67
+ display: 'flex',
68
+ flexDirection: 'column',
69
+ styledProps: styledProps
70
+ });
71
+ var DEFAULT_PASS_PROPS = [];
72
+
73
+ var withInnerLabel = function withInnerLabel(Component) {
74
+ var passProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_PASS_PROPS;
75
+
76
+ var ComponentWithInnerLabel = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
77
+ var _splitProps = (0, _styles.splitProps)(props, Object.keys(styledProps), passProps),
78
+ _splitProps2 = _slicedToArray(_splitProps, 2),
79
+ wrapperProps = _splitProps2[0],
80
+ _splitProps2$ = _splitProps2[1],
81
+ label = _splitProps2$.label,
82
+ rest = _objectWithoutProperties(_splitProps2$, ["label"]);
83
+
84
+ var id = rest.id,
85
+ disabled = rest.disabled,
86
+ required = rest.required,
87
+ labelTextColor = rest.labelTextColor;
88
+ var InputWrapper = (0, _styledComponents.default)(Wrapper)(_templateObject());
89
+ var Label = (0, _styledComponents.default)(_Text.default)(_templateObject2());
90
+ return /*#__PURE__*/_react.default.createElement(InputWrapper, wrapperProps, /*#__PURE__*/_react.default.createElement(Component, _extends({}, rest, {
91
+ ref: ref
92
+ })), label && /*#__PURE__*/_react.default.createElement(Label, {
93
+ fontSize: "14px",
94
+ lineHeight: "16px",
95
+ zIndex: 1,
96
+ color: disabled ? _colors.default.hotelSmoke : labelTextColor || _colors.default.mediumGrey,
97
+ truncate: true,
98
+ as: "label",
99
+ htmlFor: id
100
+ }, label, required && '*'));
101
+ });
102
+
103
+ ComponentWithInnerLabel.displayName = "".concat(Component.displayName || 'Component', "-WithInnerLabel");
104
+ return ComponentWithInnerLabel;
105
+ };
106
+
107
+ exports.withInnerLabel = withInnerLabel;
@@ -37,26 +37,26 @@ var commonVariants = {
37
37
  color: {
38
38
  default: {
39
39
  backgroundColor: _colors.default.white,
40
- borderColor: _colors.default.hotelSilver,
41
- color: _colors.default.hotelDarkGrey,
40
+ borderColor: _colors.default.oldSilver,
41
+ color: _colors.default.black,
42
42
  ':hover': {
43
- borderColor: "".concat(_colors.default.hotelDarkGrey, " !important")
43
+ borderColor: "".concat(_colors.default.black, " !important")
44
44
  },
45
45
  ':focus': {
46
- borderColor: "".concat(_colors.default.hotelDarkGrey, " !important")
46
+ borderColor: "".concat(_colors.default.black, " !important")
47
47
  }
48
48
  },
49
49
  error: {
50
50
  backgroundColor: "".concat(_colors.default.white, " !important"),
51
51
  borderColor: "".concat(_colors.default.circusRed, " !important"),
52
- color: "".concat(_colors.default.hotelDarkGrey, " !important")
52
+ color: "".concat(_colors.default.black, " !important")
53
53
  },
54
54
  customError: {
55
55
  backgroundColor: "".concat(_colors.default.white, " !important"),
56
- borderColor: "".concat(_colors.default.hotelSilver, " !important"),
56
+ borderColor: "".concat(_colors.default.oldSilver, " !important"),
57
57
  color: "".concat(_colors.default.circusRed, " !important"),
58
58
  ':focus': {
59
- borderColor: "".concat(_colors.default.hotelDarkGrey, " !important")
59
+ borderColor: "".concat(_colors.default.black, " !important")
60
60
  }
61
61
  }
62
62
  },
@@ -75,9 +75,9 @@ var commonVariants = {
75
75
  paddingRight: '17px !important',
76
76
  paddingBottom: '15px !important',
77
77
  paddingLeft: '17px !important',
78
- fontSize: '16px !important',
79
- lineHeight: '1.24 !important',
80
- height: '54px'
78
+ fontSize: '14px !important',
79
+ lineHeight: '21px !important',
80
+ height: '52px'
81
81
  }
82
82
  },
83
83
  length: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "travelcircus-styleguide",
3
- "version": "2.0.7",
3
+ "version": "2.0.8",
4
4
  "description": "Components Styleguide for a TravelCircus web services",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {