@occmundial/occ-atomic 2.0.0-beta.16 → 2.0.0-beta.17

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,20 @@
1
+ # [2.0.0-beta.17](https://github.com/occmundial/occ-atomic/compare/v2.0.0-beta.16...v2.0.0-beta.17) (2024-05-21)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * Add events to Button ([cbac2b8](https://github.com/occmundial/occ-atomic/commit/cbac2b8a19cc93c76529a2aa4f91a685a5b7f9c7))
7
+
8
+
9
+ ### Features
10
+
11
+ * Update TextField styles ([0d0218e](https://github.com/occmundial/occ-atomic/commit/0d0218ea0df146da1b07482676eb99ad57d186b7))
12
+
13
+
14
+ ### BREAKING CHANGES
15
+
16
+ * Remove the lockHeight and searchField properties
17
+
1
18
  # [2.0.0-beta.16](https://github.com/occmundial/occ-atomic/compare/v2.0.0-beta.15...v2.0.0-beta.16) (2024-05-14)
2
19
 
3
20
 
@@ -154,7 +154,7 @@ describe("Autocomplete", function () {
154
154
  wrapper.setState({
155
155
  focus: true
156
156
  });
157
- wrapper.find('.Droplist-item-0-1-34').at(0).simulate('mousedown');
157
+ wrapper.find('.Droplist-item-0-1-28').at(0).simulate('mousedown');
158
158
  expect(onMouseDown.mock.calls[0][0]).toEqual({
159
159
  id: 1,
160
160
  text: 'Administrador',
@@ -164,7 +164,7 @@ describe("Autocomplete", function () {
164
164
  focus: true,
165
165
  value: 'a'
166
166
  });
167
- wrapper.find('.Droplist-item-0-1-34').at(1).simulate('mousedown');
167
+ wrapper.find('.Droplist-item-0-1-28').at(1).simulate('mousedown');
168
168
  expect(onMouseDown.mock.calls[1][0]).toEqual({
169
169
  id: 2,
170
170
  text: 'Administrador Sr',
@@ -209,7 +209,7 @@ describe("Autocomplete", function () {
209
209
  wrapper.setState({
210
210
  focus: true
211
211
  });
212
- wrapper.find('.Droplist-item-0-1-34').at(0).simulate('mousedown');
212
+ wrapper.find('.Droplist-item-0-1-28').at(0).simulate('mousedown');
213
213
  expect(onMouseDown.mock.calls.length).toBe(1);
214
214
  });
215
215
  it('calls the onFocus function', function () {
@@ -17,6 +17,8 @@ var _Icon = _interopRequireDefault(require("../Icon"));
17
17
 
18
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
19
19
 
20
+ 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); }
21
+
20
22
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
21
23
 
22
24
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
@@ -66,6 +68,9 @@ var Button = /*#__PURE__*/function (_React$Component) {
66
68
  target = _this$props.target,
67
69
  rel = _this$props.rel,
68
70
  onClick = _this$props.onClick,
71
+ onMouseDown = _this$props.onMouseDown,
72
+ onMouseUp = _this$props.onMouseUp,
73
+ onMouseOut = _this$props.onMouseOut,
69
74
  theme = _this$props.theme,
70
75
  size = _this$props.size,
71
76
  block = _this$props.block,
@@ -112,26 +117,33 @@ var Button = /*#__PURE__*/function (_React$Component) {
112
117
  width: iconSize,
113
118
  height: iconSize
114
119
  })) : null;
120
+ var eventProps = !disabled ? {
121
+ onClick: onClick,
122
+ onMouseDown: onMouseDown,
123
+ onMouseUp: onMouseUp,
124
+ onMouseOut: onMouseOut
125
+ } : {};
115
126
 
116
127
  if (href) {
117
- return /*#__PURE__*/_react["default"].createElement("a", {
128
+ return /*#__PURE__*/_react["default"].createElement("a", _extends({
118
129
  className: classNames,
119
130
  href: !disabled ? href : '',
120
131
  target: target,
121
- rel: rel,
122
- onClick: !disabled ? onClick : null,
132
+ rel: rel
133
+ }, eventProps, {
123
134
  id: id,
124
135
  style: style,
125
136
  "data-testid": testId
126
- }, content, loadingLayer);
137
+ }), content, loadingLayer);
127
138
  } else {
128
- return /*#__PURE__*/_react["default"].createElement("button", {
139
+ return /*#__PURE__*/_react["default"].createElement("button", _extends({
129
140
  className: classNames,
130
- onClick: !disabled ? onClick : null,
141
+ disabled: disabled
142
+ }, eventProps, {
131
143
  id: id,
132
144
  style: style,
133
145
  "data-testid": testId
134
- }, content, loadingLayer);
146
+ }), content, loadingLayer);
135
147
  }
136
148
  }
137
149
  }]);
@@ -176,6 +188,15 @@ Button.propTypes = {
176
188
  /** The function to call when the button is clicked. */
177
189
  onClick: _propTypes["default"].func,
178
190
 
191
+ /** The function to call when the mouse is down on the button. */
192
+ onMouseDown: _propTypes["default"].func,
193
+
194
+ /** The function to call when the mouse is up on the button. */
195
+ onMouseUp: _propTypes["default"].func,
196
+
197
+ /** The function to call when the mouse moves out of the button. */
198
+ onMouseOut: _propTypes["default"].func,
199
+
179
200
  /** Optionally, you can set the href property and use it like a link. */
180
201
  href: _propTypes["default"].string,
181
202
 
@@ -3,6 +3,7 @@
3
3
  exports[`FAB matches the snapshot 1`] = `
4
4
  <button
5
5
  className="Button-btn-0-1-28 Button-btn-0-1-1 Button-tertiary-0-1-23 Button-tertiary-0-1-6 fab Button-iconOnly-0-1-38 Button-iconOnly-0-1-18 Button-round-0-1-40 Button-round-0-1-20"
6
+ disabled={false}
6
7
  >
7
8
  <span
8
9
  className="Button-cont-0-1-29 Button-cont-0-1-2"
@@ -15,9 +15,9 @@ var _reactTextMask = _interopRequireDefault(require("react-text-mask"));
15
15
 
16
16
  var _Icon = _interopRequireDefault(require("../Icon"));
17
17
 
18
- var _colors = _interopRequireDefault(require("../subatomic/colors"));
18
+ var _Button = _interopRequireDefault(require("../Button"));
19
19
 
20
- var _iconSizes = _interopRequireDefault(require("../subatomic/iconSizes"));
20
+ var _colors = _interopRequireDefault(require("../tokens/colors.json"));
21
21
 
22
22
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
23
23
 
@@ -222,12 +222,9 @@ var TextField = /*#__PURE__*/function (_React$Component) {
222
222
  type = _this$props7.type,
223
223
  inputClassName = _this$props7.inputClassName,
224
224
  alignRight = _this$props7.alignRight,
225
- hjWhitelist = _this$props7.hjWhitelist,
226
- searchField = _this$props7.searchField;
225
+ hjWhitelist = _this$props7.hjWhitelist;
227
226
  var className = classes.input;
228
- if (searchField) className += " ".concat(classes.searchField);
229
227
  if (iconName) className += " ".concat(classes.hasIcon);
230
- if (searchField && iconName) className += " ".concat(classes.searchFieldHasIcon);
231
228
  if (clear) className += " ".concat(classes.hasClear);
232
229
  if (alignRight) className += " ".concat(classes.alignRight);
233
230
  if (type == 'select') className += " ".concat(classes.select);
@@ -240,65 +237,54 @@ var TextField = /*#__PURE__*/function (_React$Component) {
240
237
  }, {
241
238
  key: "setIconColor",
242
239
  value: function setIconColor() {
243
- var _this$state = this.state,
244
- status = _this$state.status,
245
- value = _this$state.value,
246
- touched = _this$state.touched;
247
- var _this$props8 = this.props,
248
- disabled = _this$props8.disabled,
249
- searchField = _this$props8.searchField,
250
- error = _this$props8.error,
251
- allowError = _this$props8.allowError;
252
- if (disabled) return _colors["default"].grey500;
253
- if (status === 'focus' && searchField) return _colors["default"].prim;
254
- if (error && (allowError || touched)) return _colors["default"].error;
255
- if (status !== 'focus' && searchField && value) return _colors["default"].grey900;
256
- return _colors["default"].grey500;
240
+ var status = this.state.status;
241
+ var disabled = this.props.disabled;
242
+ if (disabled) return _colors["default"].icon["default"].disabled;
243
+ if (status === 'focus') return _colors["default"].icon.brand.bold;
244
+ return _colors["default"].icon["default"]["default"];
257
245
  }
258
246
  }, {
259
247
  key: "render",
260
248
  value: function render() {
261
249
  var _this2 = this;
262
250
 
263
- var _this$state2 = this.state,
264
- status = _this$state2.status,
265
- value = _this$state2.value,
266
- touched = _this$state2.touched,
267
- showPass = _this$state2.showPass,
268
- passIconBeingClicked = _this$state2.passIconBeingClicked;
269
- var _this$props9 = this.props,
270
- classes = _this$props9.classes,
271
- input = _this$props9.input,
272
- meta = _this$props9.meta,
273
- label = _this$props9.label,
274
- placeholder = _this$props9.placeholder,
275
- counter = _this$props9.counter,
276
- maxLength = _this$props9.maxLength,
277
- type = _this$props9.type,
278
- name = _this$props9.name,
279
- options = _this$props9.options,
280
- id = _this$props9.id,
281
- style = _this$props9.style,
282
- disabled = _this$props9.disabled,
283
- autoFocus = _this$props9.autoFocus,
284
- error = _this$props9.error,
285
- assistiveText = _this$props9.assistiveText,
286
- clear = _this$props9.clear,
287
- iconName = _this$props9.iconName,
288
- allowError = _this$props9.allowError,
289
- lockHeight = _this$props9.lockHeight,
290
- required = _this$props9.required,
291
- mask = _this$props9.mask,
292
- guide = _this$props9.guide,
293
- inputMode = _this$props9.inputMode,
294
- disableAutoComplete = _this$props9.disableAutoComplete,
295
- pattern = _this$props9.pattern,
296
- searchField = _this$props9.searchField,
297
- testId = _this$props9.testId;
251
+ var _this$state = this.state,
252
+ status = _this$state.status,
253
+ value = _this$state.value,
254
+ touched = _this$state.touched,
255
+ showPass = _this$state.showPass,
256
+ passIconBeingClicked = _this$state.passIconBeingClicked;
257
+ var _this$props8 = this.props,
258
+ classes = _this$props8.classes,
259
+ input = _this$props8.input,
260
+ meta = _this$props8.meta,
261
+ label = _this$props8.label,
262
+ placeholder = _this$props8.placeholder,
263
+ counter = _this$props8.counter,
264
+ maxLength = _this$props8.maxLength,
265
+ type = _this$props8.type,
266
+ name = _this$props8.name,
267
+ options = _this$props8.options,
268
+ id = _this$props8.id,
269
+ style = _this$props8.style,
270
+ disabled = _this$props8.disabled,
271
+ autoFocus = _this$props8.autoFocus,
272
+ error = _this$props8.error,
273
+ assistiveText = _this$props8.assistiveText,
274
+ clear = _this$props8.clear,
275
+ iconName = _this$props8.iconName,
276
+ allowError = _this$props8.allowError,
277
+ required = _this$props8.required,
278
+ mask = _this$props8.mask,
279
+ guide = _this$props8.guide,
280
+ inputMode = _this$props8.inputMode,
281
+ disableAutoComplete = _this$props8.disableAutoComplete,
282
+ pattern = _this$props8.pattern,
283
+ testId = _this$props8.testId;
298
284
  var realStatus = status;
299
285
  var InputType = type == 'select' ? 'select' : type == 'textarea' ? 'textarea' : 'input';
300
286
  var errorStatus = meta && meta.error && (meta.touched || allowError) || error && (touched || allowError) && !passIconBeingClicked;
301
- if (disabled) realStatus = 'disabled';else if (status != 'focus' && errorStatus) realStatus = 'error';else if (status !== 'focus' && searchField && value) realStatus = 'filled';
287
+ if (disabled) realStatus = 'disabled';else if (status != 'focus' && errorStatus) realStatus = 'error';
302
288
  var element, passIcon;
303
289
  var commonProps = {
304
290
  name: name,
@@ -344,14 +330,13 @@ var TextField = /*#__PURE__*/function (_React$Component) {
344
330
  }, input && input.value ? input.value : value ? value : placeholder));
345
331
  }
346
332
 
347
- passIcon = /*#__PURE__*/_react["default"].createElement("div", {
348
- className: classes.passIcon
349
- }, /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
350
- iconName: "eyeClosed",
351
- width: _iconSizes["default"].small,
352
- height: _iconSizes["default"].small,
353
- colors: [_colors["default"].grey200]
354
- }));
333
+ passIcon = /*#__PURE__*/_react["default"].createElement(_Button["default"], {
334
+ theme: "ghostGrey",
335
+ icon: "eye",
336
+ size: "md",
337
+ disabled: true,
338
+ className: classes.rightButton
339
+ });
355
340
  } else if (type == 'select') {
356
341
  element = /*#__PURE__*/_react["default"].createElement(InputType, commonProps, /*#__PURE__*/_react["default"].createElement("option", {
357
342
  value: "",
@@ -369,7 +354,7 @@ var TextField = /*#__PURE__*/function (_React$Component) {
369
354
  value: option.value,
370
355
  disabled: option.disabled
371
356
  }, testId && {
372
- 'data-testid': "".concat(testId, "__item-").concat(item.value)
357
+ 'data-testid': "".concat(testId, "__item-").concat(option.value)
373
358
  }), option.label);
374
359
  }));
375
360
  } else {
@@ -399,61 +384,55 @@ var TextField = /*#__PURE__*/function (_React$Component) {
399
384
  }, disableAutoComplete && {
400
385
  autoComplete: 'off'
401
386
  }));
402
- passIcon = /*#__PURE__*/_react["default"].createElement("div", {
387
+ passIcon = /*#__PURE__*/_react["default"].createElement(_Button["default"], {
388
+ theme: "ghostGrey",
389
+ icon: showPass ? 'eye' : 'eye-slash',
390
+ size: "md",
391
+ className: classes.rightButton,
403
392
  onMouseDown: this.togglePass,
404
393
  onMouseUp: this.focusInput,
405
- onMouseOut: this.outOfPassIcon,
406
- className: classes.passIcon
407
- }, /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
408
- iconName: showPass ? 'eye' : 'eyeClosed',
409
- width: _iconSizes["default"].small,
410
- height: _iconSizes["default"].small,
411
- colors: showPass ? [_colors["default"].grey900] : [_colors["default"].grey400]
412
- }));
394
+ onMouseOut: this.outOfPassIcon
395
+ });
413
396
  }
414
397
 
415
398
  return /*#__PURE__*/_react["default"].createElement("div", {
416
399
  className: this.setClassName(realStatus),
417
400
  style: style
418
- }, (label || lockHeight) && /*#__PURE__*/_react["default"].createElement("div", {
401
+ }, label && /*#__PURE__*/_react["default"].createElement("div", {
419
402
  className: classes.top
420
403
  }, label && /*#__PURE__*/_react["default"].createElement("label", {
421
- className: "".concat(classes.label, " ").concat(classes.left)
404
+ className: classes.label
422
405
  }, label)), /*#__PURE__*/_react["default"].createElement("div", {
423
406
  className: classes.inputWrap
424
407
  }, iconName && /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
425
408
  iconName: iconName,
426
- width: _iconSizes["default"].small,
427
- height: _iconSizes["default"].small,
409
+ width: 24,
410
+ height: 24,
428
411
  className: classes.icon,
429
412
  colors: [this.setIconColor()]
430
413
  }), type == 'select' && /*#__PURE__*/_react["default"].createElement("div", {
431
414
  className: classes.selectIcon
432
415
  }, /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
433
- iconName: "arrowDown",
434
- width: _iconSizes["default"].small,
435
- height: _iconSizes["default"].small,
436
- colors: disabled ? [_colors["default"].grey200] : [_colors["default"].grey900]
437
- })), type == 'password' && passIcon, value && clear && /*#__PURE__*/_react["default"].createElement("div", _extends({
438
- onClick: this.onClear,
439
- className: classes.clear
416
+ iconName: "chevron-down",
417
+ width: 24,
418
+ height: 24,
419
+ colors: disabled ? [_colors["default"].icon["default"].disabled] : [_colors["default"].icon["default"]["default"]]
420
+ })), element, type == 'password' && passIcon, value && clear && /*#__PURE__*/_react["default"].createElement(_Button["default"], _extends({
421
+ icon: "x",
422
+ theme: "ghostGrey",
423
+ size: "md",
424
+ className: classes.rightButton,
425
+ onClick: this.onClear
440
426
  }, testId && {
441
427
  'data-testid': "".concat(testId, "__container-close-icon")
442
- }), /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
443
- iconName: "close",
444
- width: _iconSizes["default"].small,
445
- height: _iconSizes["default"].small
446
- })), element), (assistiveText || counter && maxLength || lockHeight) && /*#__PURE__*/_react["default"].createElement("div", {
428
+ }))), (assistiveText || counter && maxLength) && /*#__PURE__*/_react["default"].createElement("div", {
447
429
  className: classes.bottom
430
+ }, /*#__PURE__*/_react["default"].createElement("span", {
431
+ className: classes.assistiveTextWrap
448
432
  }, assistiveText && /*#__PURE__*/_react["default"].createElement("label", {
449
- className: "".concat(classes.label, " ").concat(classes.left, " ").concat(realStatus == 'error' ? classes.errorAssistiveText : classes.assistiveText)
450
- }, realStatus == 'error' ? /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
451
- iconName: "warningSolid",
452
- width: _iconSizes["default"].tiny,
453
- height: _iconSizes["default"].tiny,
454
- className: classes.errorIcon
455
- }) : null, ' ', assistiveText), counter && maxLength && /*#__PURE__*/_react["default"].createElement("label", {
456
- className: "".concat(classes.label, " ").concat(classes.right, " ").concat(classes.counter)
433
+ className: "".concat(classes.assistiveText, " ").concat(realStatus == 'error' ? classes.assistiveError : null)
434
+ }, assistiveText)), counter && maxLength && /*#__PURE__*/_react["default"].createElement("label", {
435
+ className: "".concat(classes.counter)
457
436
  }, value.length, " / ", maxLength)));
458
437
  }
459
438
  }]);
@@ -511,9 +490,6 @@ TextField.propTypes = {
511
490
  /** It allows the component to display the error messages even if it hasn't been touched. */
512
491
  allowError: _propTypes["default"].bool,
513
492
 
514
- /** By default the TextField container would be smaller without a label or an assistive text. lockHeight will maintain the same height as if it had both, label and assistive text. */
515
- lockHeight: _propTypes["default"].bool,
516
-
517
493
  /** Use as a default value. */
518
494
  valueProp: _propTypes["default"].node,
519
495
 
@@ -583,9 +559,6 @@ TextField.propTypes = {
583
559
  /** Regular expression to validate the input content. */
584
560
  pattern: _propTypes["default"].string,
585
561
 
586
- /** Size of the TextField. */
587
- searchField: _propTypes["default"].bool,
588
-
589
562
  /** The testId property adds the data attribute data-testid to the main element and should be used for testing only. */
590
563
  testId: _propTypes["default"].string
591
564
  };
@@ -105,13 +105,13 @@ describe("TextField", function () {
105
105
  classes: classes,
106
106
  clear: true
107
107
  }));
108
- expect(wrapper.find('.clear').length).toBe(0);
108
+ expect(wrapper.find('.rightButton').length).toBe(0);
109
109
  wrapper.setState({
110
110
  value: 'Value'
111
111
  });
112
- expect(wrapper.find('.clear').length).toBe(1);
113
- wrapper.find('.clear').simulate('click');
114
- expect(wrapper.find('.clear').length).toBe(0);
112
+ expect(wrapper.find('.rightButton').length).toBe(1);
113
+ wrapper.find('.rightButton').simulate('click');
114
+ expect(wrapper.find('.rightButton').length).toBe(0);
115
115
  expect(wrapper.state('value')).toBe('');
116
116
  });
117
117
  it('shows the TextField with an error', function () {
@@ -121,12 +121,12 @@ describe("TextField", function () {
121
121
  error: true
122
122
  }));
123
123
  expect(wrapper.find('.error').length).toBe(0);
124
- expect(wrapper.find('.errorAssistiveText').length).toBe(0);
124
+ expect(wrapper.find('.assistiveError').length).toBe(0);
125
125
  wrapper.setState({
126
126
  touched: true
127
127
  });
128
128
  expect(wrapper.find('.error').length).toBe(1);
129
- expect(wrapper.find('.errorAssistiveText').length).toBe(1);
129
+ expect(wrapper.find('.assistiveError').length).toBe(1);
130
130
  expect(wrapper.find('.error').at(0).hasClass('container')).toBe(true);
131
131
  });
132
132
  it('sets a default value', function () {
@@ -179,7 +179,7 @@ describe("TextField", function () {
179
179
  onClear: onClear,
180
180
  valueProp: "Value"
181
181
  }));
182
- wrapper.find('.clear').simulate('click');
182
+ wrapper.find('.rightButton').simulate('click');
183
183
  expect(onClear.mock.calls.length).toBe(1);
184
184
  });
185
185
  it('calls the onRef function', function () {
@@ -228,14 +228,6 @@ describe("TextField", function () {
228
228
  });
229
229
  expect(wrapper.state('value')).toBe('123abc');
230
230
  });
231
- it('renders as a SearchField', function () {
232
- var wrapper = (0, _enzyme.shallow)( /*#__PURE__*/_react["default"].createElement(_TextField["default"], {
233
- searchField: true,
234
- classes: classes
235
- }));
236
- var input = wrapper.find('input');
237
- expect(input.hasClass('searchField')).toBe(true);
238
- });
239
231
  });
240
232
  describe("TextFieldJSS", function () {
241
233
  it('matches the snapshot', function () {
@@ -7,108 +7,59 @@ Object {
7
7
  "alignRight": Object {
8
8
  "textAlign": "right",
9
9
  },
10
+ "assistiveError": Object {
11
+ "color": "#8b1313",
12
+ },
10
13
  "assistiveText": Object {
11
- "color": "#aaaaaa",
12
- "fontSize": 12,
13
- "fontWeight": 300,
14
+ "color": "#5A5D7B",
15
+ "font": "400 14px/1.5 'OccText', sans-serif",
14
16
  },
15
- "bottom": Object {
16
- "height": 20,
17
- "marginTop": 4,
17
+ "assistiveTextWrap": Object {
18
+ "display": "flex",
18
19
  },
19
- "clear": Object {
20
- "background": "none",
21
- "border": 0,
22
- "cursor": "pointer",
23
- "height": 24,
24
- "margin": 0,
25
- "outline": 0,
26
- "padding": 3,
27
- "position": "absolute",
28
- "right": 12,
29
- "top": "50%",
30
- "transform": "translateY(-50%)",
31
- "width": 24,
32
- "zIndex": 1,
20
+ "bottom": Object {
21
+ "display": "flex",
22
+ "justifyContent": "space-between",
23
+ "marginTop": "8px",
33
24
  },
34
25
  "container": Object {
35
- "marginBottom": 8,
36
26
  "position": "relative",
37
27
  },
38
28
  "counter": Object {
39
- "color": "#aaaaaa",
29
+ "color": "#5A5D7B",
30
+ "font": "400 14px/1.5 'OccText', sans-serif",
40
31
  },
41
32
  "default": Object {},
42
33
  "disabled": Object {
43
34
  "& $input": Object {
44
- "borderColor": "#dddddd",
45
- "color": "#dddddd",
46
- "paddingTop": 9,
47
- },
48
- "& $label": Object {
49
- "color": "#dddddd",
50
- },
51
- "& $passIcon": Object {
52
- "cursor": "auto",
35
+ "background": "#EDEDF1",
36
+ "color": "#878A9F",
53
37
  },
54
38
  },
55
39
  "error": Object {
56
40
  "& $input": Object {
57
- "background": "rgba(219, 55, 55, 0.04)",
58
- "borderColor": "#db3737",
59
- "color": "#db3737",
60
- },
61
- "& $searchField": Object {
62
- "borderWidth": 2,
63
- "color": "#222222",
64
- "paddingLeft": 7,
65
- },
66
- "& $searchFieldHasIcon": Object {
67
- "paddingLeft": 41,
68
- },
69
- },
70
- "errorAssistiveText": Object {
71
- "color": "#db3737",
72
- },
73
- "errorIcon": Object {
74
- "marginBottom": -2,
75
- },
76
- "filled": Object {
77
- "& $input": Object {
78
- "borderColor": "#222222",
79
- "borderWidth": 2,
80
- "paddingLeft": 7,
81
- },
82
- "& $searchFieldHasIcon": Object {
83
- "paddingLeft": 41,
41
+ "boxShadow": "inset 0 0 0 1px #e82020",
84
42
  },
85
43
  },
86
44
  "focus": Object {
87
45
  "& $input": Object {
88
- "borderColor": "#083cae",
89
- },
90
- "& $searchField": Object {
91
- "borderWidth": 2,
92
- "paddingLeft": 7,
93
- },
94
- "& $searchFieldHasIcon": Object {
95
- "paddingLeft": 41,
46
+ "boxShadow": "inset 0 0 0 2px #0059CD, 0 0 0 8px rgba(0,110,255,0.3) !important",
96
47
  },
97
48
  },
98
49
  "hasClear": Object {
99
- "paddingRight": 42,
50
+ "paddingRight": "48px",
100
51
  },
101
52
  "hasIcon": Object {
102
- "paddingLeft": 42,
53
+ "paddingLeft": "48px",
103
54
  },
104
55
  "hasPass": Object {
105
- "paddingRight": 42,
56
+ "paddingRight": "48px",
106
57
  },
107
58
  "hasRightIcon": Object {
108
- "marginRight": 16,
59
+ "marginRight": "48px",
109
60
  },
110
61
  "icon": Object {
111
- "left": 16,
62
+ "left": "16px",
112
63
  "position": "absolute",
113
64
  "top": "50%",
114
65
  "transform": "translateY(-50%)",
@@ -123,7 +74,10 @@ Object {
123
74
  "margin": 0,
124
75
  },
125
76
  "&::placeholder": Object {
126
- "color": "#aaaaaa",
77
+ "color": "#5A5D7B",
78
+ },
79
+ "&:hover": Object {
80
+ "boxShadow": "inset 0 0 0 1px #6C6F89",
127
81
  },
128
82
  "&[type=number]": Object {
129
83
  "-moz-appearance": "textfield",
@@ -131,25 +85,22 @@ Object {
131
85
  "-webkit-appearance": "none",
132
86
  "alignItems": "center",
133
87
  "appearance": "none",
134
- "background": "#ffffff",
135
- "border": "1px solid #dddddd",
136
- "borderRadius": 4,
137
- "boxShadow": "none",
88
+ "background": "#fff",
89
+ "border": "none",
90
+ "borderRadius": "4px",
91
+ "boxShadow": "inset 0 0 0 1px #D3D4DC",
138
92
  "boxSizing": "border-box",
139
- "caretColor": "#083cae",
140
- "color": "#222222",
93
+ "caretColor": "#083CAE",
94
+ "color": "#080D39",
141
95
  "display": "flex",
142
- "fontFamily": "'OccText', sans-serif",
143
- "fontSize": 16,
144
- "fontWeight": 300,
145
- "height": 40,
146
- "lineHeight": 1.5,
96
+ "font": "400 16px/1.5 'OccText', sans-serif",
97
+ "height": 48,
147
98
  "outline": "none",
148
99
  "padding": Array [
149
- 8,
150
- 16,
100
+ "4px",
101
+ "16px",
151
102
  ],
152
- "transition": "0.3s all",
103
+ "transition": "all cubic-bezier(0.25,0.46,0.45,0.94) 0.2s",
153
104
  "width": "100%",
154
105
  },
155
106
  "inputDisabled": Object {
@@ -161,88 +112,50 @@ Object {
161
112
  "position": "relative",
162
113
  },
163
114
  "label": Object {
164
- "& a": Object {
165
- "color": "#1476fb",
166
- "outline": "none",
167
- "textDecoration": "none",
168
- },
169
- "color": "#222222",
170
- "fontFamily": "'OccText', sans-serif",
171
- "fontSize": 14,
172
- "fontWeight": 300,
173
- "lineHeight": 1.5,
174
- "transition": "0.3s all",
175
- },
176
- "left": Object {
177
- "float": "left",
115
+ "color": "#080D39",
116
+ "font": "400 14px/1.5 'OccText', sans-serif",
178
117
  },
179
- "passIcon": Object {
180
- "background": "none",
181
- "border": 0,
182
- "cursor": "pointer",
183
- "height": 24,
184
- "margin": 0,
185
- "outline": 0,
186
- "padding": 3,
118
+ "rightButton": Object {
187
119
  "position": "absolute",
188
- "right": 12,
189
- "top": 8,
190
- "width": 24,
120
+ "right": "4px",
121
+ "top": "50%",
122
+ "transform": "translateY(-50%)",
191
123
  "zIndex": 1,
192
124
  },
193
- "right": Object {
194
- "float": "right",
195
- },
196
- "searchField": Object {
197
- "background": Array [
198
- "#ffffff",
199
- "!important",
200
- ],
201
- "borderColor": "#777777",
202
- "borderRadius": 24,
203
- "height": 48,
204
- },
205
- "searchFieldHasIcon": Object {},
206
125
  "select": Object {
207
126
  "& optgroup": Object {
208
- "color": "#777777",
209
- "fontSize": 14,
210
- "fontWeight": "normal",
211
- "lineHeight": 1.5,
127
+ "color": "#5A5D7B",
128
+ "font": "400 14px/1.5 'OccText', sans-serif",
212
129
  },
213
130
  "& option": Object {
214
131
  "&:disabled": Object {
215
- "color": "#aaaaaa",
132
+ "color": "#878A9F",
216
133
  },
217
- "color": "#222222",
218
- "fontSize": 16,
219
- "lineHeight": 1.5,
134
+ "color": "#080D39",
135
+ "font": "400 16px/1.5 'OccText', sans-serif",
220
136
  },
221
137
  "&::-ms-expand": Object {
222
138
  "display": "none",
223
139
  },
224
140
  "&:invalid, & option[value=\\"\\"]": Object {
225
- "color": "#aaaaaa",
141
+ "color": "#878A9F",
226
142
  },
227
- "paddingRight": 32,
143
+ "paddingRight": "48px",
228
144
  },
229
145
  "selectIcon": Object {
230
- "background": "none",
231
- "border": 0,
232
- "height": 24,
233
- "margin": 0,
234
- "outline": 0,
235
- "padding": "3px 0",
236
146
  "pointerEvents": "none",
237
147
  "position": "absolute",
238
- "right": 12,
239
- "top": 8,
240
- "width": 18,
241
- "zIndex": 1,
148
+ "right": "16px",
149
+ "top": "50%",
150
+ "transform": "translateY(-50%)",
242
151
  },
243
152
  "textarea": Object {
244
153
  "alignItems": "flex-start",
245
154
  "height": 120,
155
+ "paddingg": Array [
156
+ "12px",
157
+ "16px",
158
+ ],
246
159
  "resize": "none",
247
160
  },
248
161
  "top": Object {
@@ -250,7 +163,8 @@ Object {
250
163
  "clear": "both",
251
164
  "content": "\\"\\"",
252
165
  },
253
- "height": 24,
166
+ "display": "flex",
167
+ "marginBottom": "8px",
254
168
  },
255
169
  }
256
170
  `;
@@ -3,27 +3,45 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports["default"] = void 0;
6
+ exports["default"] = exports.objectToFontValue = void 0;
7
7
 
8
- var _hexRgba = _interopRequireDefault(require("hex-rgba"));
8
+ var _fonts = _interopRequireDefault(require("../subatomic/fonts"));
9
9
 
10
- var _colors = _interopRequireDefault(require("../subatomic/colors"));
10
+ var _colors = _interopRequireDefault(require("../tokens/colors.json"));
11
11
 
12
- var _fonts = _interopRequireDefault(require("../subatomic/fonts"));
12
+ var _fonts2 = _interopRequireDefault(require("../tokens/fonts.json"));
13
+
14
+ var _spacing = _interopRequireDefault(require("../tokens/spacing.json"));
13
15
 
14
- var _spacing = _interopRequireDefault(require("../subatomic/spacing"));
16
+ var _borderRadius = _interopRequireDefault(require("../tokens/borderRadius.json"));
17
+
18
+ var _shadows = _interopRequireDefault(require("../tokens/shadows.json"));
15
19
 
16
20
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
17
21
 
18
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
22
+ var placeholder = _fonts2["default"]['text-field-placeholder'];
23
+ var label = _fonts2["default"]['text-field-label'];
24
+ var assistiveText = _fonts2["default"]['text-field-assistive-text'];
25
+ var TRANSITION = 'all cubic-bezier(0.25,0.46,0.45,0.94) 0.2s';
26
+ var border = {
27
+ DEFAULT: "inset 0 0 0 1px ".concat(_colors["default"]['text-field'].border["default"]),
28
+ HOVER: "inset 0 0 0 1px ".concat(_colors["default"]['text-field'].border.hover),
29
+ FOCUS: "inset 0 0 0 2px ".concat(_colors["default"]['text-field'].border.focus),
30
+ ERROR: "inset 0 0 0 1px ".concat(_colors["default"]['text-field'].border.error)
31
+ };
19
32
 
33
+ var objectToFontValue = function objectToFontValue(font) {
34
+ return "".concat(font.fontWeight, " ").concat(font.fontSize, "/").concat(font.lineHeight, " ").concat(_fonts["default"].body);
35
+ };
36
+
37
+ exports.objectToFontValue = objectToFontValue;
20
38
  var _default = {
21
39
  container: {
22
- position: 'relative',
23
- marginBottom: _spacing["default"].tiny
40
+ position: 'relative'
24
41
  },
25
42
  top: {
26
- height: _spacing["default"].base,
43
+ display: 'flex',
44
+ marginBottom: _spacing["default"]['size-2'],
27
45
  '&:after': {
28
46
  content: '""',
29
47
  clear: 'both'
@@ -32,75 +50,27 @@ var _default = {
32
50
  "default": {},
33
51
  disabled: {
34
52
  '& $input': {
35
- borderColor: _colors["default"].inkLightest,
36
- color: _colors["default"].inkLightest,
37
- paddingTop: 9
38
- },
39
- '& $label': {
40
- color: _colors["default"].inkLightest
41
- },
42
- '& $passIcon': {
43
- cursor: 'auto'
53
+ background: _colors["default"]['text-field'].bg.disabled,
54
+ color: _colors["default"].text.corp.disabled
44
55
  }
45
56
  },
46
57
  focus: {
47
58
  '& $input': {
48
- borderColor: _colors["default"].prim
49
- },
50
- '& $searchField': {
51
- borderWidth: 2,
52
- paddingLeft: _spacing["default"].tiny - 1
53
- },
54
- '& $searchFieldHasIcon': {
55
- paddingLeft: 41
59
+ boxShadow: "".concat(border.FOCUS, ", ").concat(_shadows["default"]['focus-bright-blue'], " !important")
56
60
  }
57
61
  },
58
62
  error: {
59
63
  '& $input': {
60
- borderColor: _colors["default"].error,
61
- color: _colors["default"].errorText,
62
- background: (0, _hexRgba["default"])(_colors["default"].errorText, 4)
63
- },
64
- '& $searchField': {
65
- borderWidth: 2,
66
- color: _colors["default"].ink,
67
- paddingLeft: _spacing["default"].tiny - 1
68
- },
69
- '& $searchFieldHasIcon': {
70
- paddingLeft: 41
71
- }
72
- },
73
- filled: {
74
- '& $input': {
75
- borderColor: _colors["default"].grey900,
76
- borderWidth: 2,
77
- paddingLeft: _spacing["default"].tiny - 1
78
- },
79
- '& $searchFieldHasIcon': {
80
- paddingLeft: 41
64
+ boxShadow: border.ERROR
81
65
  }
82
66
  },
83
67
  label: {
84
- fontWeight: 300,
85
- fontFamily: _fonts["default"].body,
86
- fontSize: 14,
87
- lineHeight: 1.5,
88
- color: _colors["default"].ink,
89
- transition: '0.3s all',
90
- '& a': {
91
- color: _colors["default"].blue,
92
- textDecoration: 'none',
93
- outline: 'none'
94
- }
95
- },
96
- left: {
97
- "float": 'left'
98
- },
99
- right: {
100
- "float": 'right'
68
+ font: objectToFontValue(label),
69
+ color: _colors["default"].text.corp.primary
101
70
  },
102
71
  counter: {
103
- color: _colors["default"].inkLighter
72
+ font: objectToFontValue(assistiveText),
73
+ color: _colors["default"].text.corp.secondary
104
74
  },
105
75
  inputWrap: {
106
76
  boxSizing: 'border-box',
@@ -111,24 +81,21 @@ var _default = {
111
81
  display: 'flex',
112
82
  alignItems: 'center',
113
83
  width: '100%',
114
- height: 40,
115
- color: _colors["default"].ink,
116
- fontFamily: _fonts["default"].body,
117
- fontWeight: 300,
118
- fontSize: 16,
119
- lineHeight: 1.5,
120
- background: _colors["default"].bgWhite,
121
- border: "1px solid ".concat(_colors["default"].grey200),
122
- borderRadius: 4,
123
- padding: [_spacing["default"].tiny, _spacing["default"].small],
124
- boxShadow: 'none',
84
+ height: 48,
85
+ color: _colors["default"].text.corp.primary,
86
+ font: objectToFontValue(placeholder),
87
+ background: _colors["default"]['text-field'].bg["default"],
88
+ border: 'none',
89
+ borderRadius: _borderRadius["default"]['br-xs'],
90
+ padding: [_spacing["default"]['size-1'], _spacing["default"]['size-4']],
91
+ boxShadow: border.DEFAULT,
125
92
  outline: 'none',
126
- transition: '0.3s all',
93
+ transition: TRANSITION,
127
94
  appearance: 'none',
128
95
  '-webkit-appearance': 'none',
129
- caretColor: _colors["default"].prim,
96
+ caretColor: _colors["default"].border.brand["default"],
130
97
  '&::placeholder': {
131
- color: _colors["default"].inkLighter
98
+ color: _colors["default"].text.corp.secondary
132
99
  },
133
100
  '&::-webkit-outer-spin-button': {
134
101
  '-webkit-appearance': 'none',
@@ -140,6 +107,9 @@ var _default = {
140
107
  },
141
108
  '&[type=number]': {
142
109
  '-moz-appearance': 'textfield'
110
+ },
111
+ '&:hover': {
112
+ boxShadow: border.HOVER
143
113
  }
144
114
  },
145
115
  inputDisabled: {
@@ -147,118 +117,80 @@ var _default = {
147
117
  whiteSpace: 'nowrap'
148
118
  },
149
119
  hasRightIcon: {
150
- marginRight: _spacing["default"].small
120
+ marginRight: _spacing["default"]['size-8']
151
121
  },
152
122
  select: {
153
123
  '&::-ms-expand': {
154
124
  display: 'none'
155
125
  },
156
- paddingRight: 32,
126
+ paddingRight: _spacing["default"]['size-8'],
157
127
  '& optgroup': {
158
- fontSize: 14,
159
- fontWeight: 'normal',
160
- lineHeight: 1.5,
161
- color: _colors["default"].inkLight
128
+ font: objectToFontValue(label),
129
+ color: _colors["default"].text.corp.secondary
162
130
  },
163
131
  '& option': {
164
- fontSize: 16,
165
- lineHeight: 1.5,
166
- color: _colors["default"].ink,
132
+ font: objectToFontValue(placeholder),
133
+ color: _colors["default"].text.corp.primary,
167
134
  '&:disabled': {
168
- color: _colors["default"].inkLighter
135
+ color: _colors["default"].text.corp.disabled
169
136
  }
170
137
  },
171
138
  '&:invalid, & option[value=""]': {
172
- color: _colors["default"].inkLighter
139
+ color: _colors["default"].text.corp.disabled
173
140
  }
174
141
  },
175
142
  textarea: {
176
143
  resize: 'none',
144
+ paddingg: [_spacing["default"]['size-3'], _spacing["default"]['size-4']],
177
145
  height: 120,
178
146
  alignItems: 'flex-start'
179
147
  },
180
148
  hasIcon: {
181
- paddingLeft: 42
149
+ paddingLeft: _spacing["default"]['size-8']
182
150
  },
183
151
  hasPass: {
184
- paddingRight: 42
152
+ paddingRight: _spacing["default"]['size-8']
185
153
  },
186
154
  icon: {
187
155
  position: 'absolute',
188
- left: _spacing["default"].small,
156
+ left: _spacing["default"]['size-4'],
189
157
  top: '50%',
190
158
  transform: 'translateY(-50%)'
191
159
  },
192
- passIcon: {
193
- width: 24,
194
- height: 24,
195
- background: 'none',
196
- border: 0,
197
- padding: 3,
198
- margin: 0,
160
+ rightButton: {
199
161
  position: 'absolute',
200
- right: 12,
201
- top: 8,
202
- zIndex: 1,
203
- outline: 0,
204
- cursor: 'pointer'
162
+ right: _spacing["default"]['size-1'],
163
+ top: '50%',
164
+ transform: 'translateY(-50%)',
165
+ zIndex: 1
205
166
  },
206
167
  selectIcon: {
207
- width: 18,
208
- height: 24,
209
- background: 'none',
210
- border: 0,
211
- padding: '3px 0',
212
- margin: 0,
213
168
  position: 'absolute',
214
- right: 12,
215
- top: 8,
216
- zIndex: 1,
217
- outline: 0,
169
+ right: _spacing["default"]['size-4'],
170
+ top: '50%',
171
+ transform: 'translateY(-50%)',
218
172
  pointerEvents: 'none'
219
173
  },
220
174
  hasClear: {
221
- paddingRight: 42
175
+ paddingRight: _spacing["default"]['size-8']
222
176
  },
223
- clear: _defineProperty({
224
- width: 24,
225
- height: 24,
226
- background: 'none',
227
- border: 0,
228
- padding: 0,
229
- margin: 0,
230
- position: 'absolute',
231
- right: 12,
232
- top: '50%',
233
- transform: 'translateY(-50%)',
234
- zIndex: 1,
235
- outline: 0,
236
- cursor: 'pointer'
237
- }, "padding", 3),
238
177
  alignRight: {
239
178
  textAlign: 'right'
240
179
  },
241
- assistiveText: {
242
- color: _colors["default"].inkLighter,
243
- fontSize: 12,
244
- fontWeight: 300
180
+ assistiveTextWrap: {
181
+ display: 'flex'
245
182
  },
246
- errorAssistiveText: {
247
- color: _colors["default"].errorText
183
+ assistiveText: {
184
+ font: objectToFontValue(assistiveText),
185
+ color: _colors["default"].text.corp.secondary
248
186
  },
249
- errorIcon: {
250
- marginBottom: -2
187
+ assistiveError: {
188
+ color: _colors["default"].text.error
251
189
  },
252
190
  bottom: {
253
- height: 20,
254
- marginTop: 4
255
- },
256
- searchField: {
257
- height: _spacing["default"].large,
258
- borderRadius: _spacing["default"].base,
259
- borderColor: _colors["default"].grey600,
260
- background: [_colors["default"].bgWhite, '!important']
261
- },
262
- searchFieldHasIcon: {}
191
+ display: 'flex',
192
+ justifyContent: 'space-between',
193
+ marginTop: _spacing["default"]['size-2']
194
+ }
263
195
  };
264
196
  exports["default"] = _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@occmundial/occ-atomic",
3
- "version": "2.0.0-beta.16",
3
+ "version": "2.0.0-beta.17",
4
4
  "description": "Collection of shareable styled React components for OCC applications.",
5
5
  "homepage": "http://occmundial.github.io/occ-atomic",
6
6
  "main": "build/index.js",