@desynova-digital/components 8.19.50 → 8.19.52

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.
@@ -241,7 +241,7 @@ var Button = function Button(_ref) {
241
241
  };
242
242
 
243
243
  Button.Element = _styledComponents2.default.button(_templateObject2, function (props) {
244
- return getAttributes(props).width ? getAttributes(props).width : "auto";
244
+ return getAttributes(props).width ? getAttributes(props).width + "px" : "auto";
245
245
  }, function (props) {
246
246
  return props.width ? props.width + "px" : props.stretchWidth ? '100%' : "auto";
247
247
  }, function (props) {
@@ -130,6 +130,11 @@ var InputText = function InputText(_ref) {
130
130
  };
131
131
  var returnPadding = function returnPadding(props) {
132
132
  var digitCount = props.maxLength.toString().length;
133
+
134
+ if (props.type === 'password') {
135
+ return "7px 23px 2px 0px";
136
+ }
137
+
133
138
  switch (digitCount) {
134
139
  case 0:
135
140
  return "7px 0px 2px 0px";
@@ -10,7 +10,7 @@ var _createClass = function () { function defineProperties(target, props) { for
10
10
 
11
11
  var _templateObject = _taggedTemplateLiteral(['\n height: 100%;\n'], ['\n height: 100%;\n']),
12
12
  _templateObject2 = _taggedTemplateLiteral(['\n width: 100%;\n font-family: SFUIText-Medium;\n font-size: 14px;\n padding: 20px 15px;\n line-height: 19px;\n text-transform: uppercase;\n color: ', ';\n cursor: ', ';\n pointer-events: ', ';\n border-bottom: 1px solid ', ';\n text-align: center;\n &:hover {\n color: ', ';\n ', ';\n }\n'], ['\n width: 100%;\n font-family: SFUIText-Medium;\n font-size: 14px;\n padding: 20px 15px;\n line-height: 19px;\n text-transform: uppercase;\n color: ', ';\n cursor: ', ';\n pointer-events: ', ';\n border-bottom: 1px solid ', ';\n text-align: center;\n &:hover {\n color: ', ';\n ', ';\n }\n']),
13
- _templateObject3 = _taggedTemplateLiteral(['\n display: flex;\n justify-content: stretch;\n align-items: center;\n background: ', ';\n\n &.tab-list{\n align-items: stretch;\n }\n\n /* Add this style in your CSS */\n .nested-tab-list.vertical {\n flex-direction: column; /* Display nested tabs vertically */\n align-items: flex-start; /* Align nested tabs to the start */\n }\n\n /* Adjust existing styles for better spacing */\n .nested-tab-list-item {\n margin-right: 8px; /* Add some margin between nested tabs */\n }\n /* Add this style in your CSS */\n . \n'], ['\n display: flex;\n justify-content: stretch;\n align-items: center;\n background: ', ';\n\n &.tab-list{\n align-items: stretch;\n }\n\n /* Add this style in your CSS */\n .nested-tab-list.vertical {\n flex-direction: column; /* Display nested tabs vertically */\n align-items: flex-start; /* Align nested tabs to the start */\n }\n\n /* Adjust existing styles for better spacing */\n .nested-tab-list-item {\n margin-right: 8px; /* Add some margin between nested tabs */\n }\n /* Add this style in your CSS */\n . \n']),
13
+ _templateObject3 = _taggedTemplateLiteral(['\n display: flex;\n justify-content: stretch;\n align-items: center;\n background: ', ';\n\n &.tab-list{\n align-items: stretch;\n }\n'], ['\n display: flex;\n justify-content: stretch;\n align-items: center;\n background: ', ';\n\n &.tab-list{\n align-items: stretch;\n }\n']),
14
14
  _templateObject4 = _taggedTemplateLiteral(['\n background:', ';\n display: flex;\n justify-content: stretch;\n align-items: center;\n'], ['\n background:', ';\n display: flex;\n justify-content: stretch;\n align-items: center;\n']);
15
15
 
16
16
  var _react = require('react');
@@ -81,13 +81,7 @@ var Tabs = function (_React$Component) {
81
81
  return child ? _react2.default.cloneElement(child, { theme: props.theme }) : null;
82
82
  });
83
83
  }
84
-
85
- // Initialize separate state for selected indices of main tabs and nested tabs
86
- _this.state = {
87
- selectedMainTabIndex: _this.getSelectedTabFromChildProps(_this.tabs),
88
- selectedNestedTabIndex: null,
89
- hoveredTabIndex: null
90
- };
84
+ _this.state = { selectedIndex: _this.getSelectedTabFromChildProps(_this.tabs) };
91
85
  return _this;
92
86
  }
93
87
 
@@ -99,8 +93,8 @@ var Tabs = function (_React$Component) {
99
93
  if (!cosmosKey) return;
100
94
 
101
95
  var storedIndex = tabStore[cosmosKey];
102
- if (storedIndex && storedIndex !== this.state.selectedMainTabIndex) {
103
- this.setState({ selectedMainTabIndex: tabStore[cosmosKey] });
96
+ if (storedIndex && storedIndex !== this.state.selectedIndex) {
97
+ this.setState({ selectedIndex: tabStore[cosmosKey] });
104
98
  }
105
99
  }
106
100
  }, {
@@ -137,7 +131,7 @@ var Tabs = function (_React$Component) {
137
131
  tabStore[cosmosKey] = nextIndex;
138
132
  }
139
133
 
140
- this.setState({ selectedIndex: nextIndex, selectedNestedTabIndex: null });
134
+ this.setState({ selectedIndex: nextIndex });
141
135
  }
142
136
  }
143
137
  }
@@ -150,87 +144,10 @@ var Tabs = function (_React$Component) {
150
144
 
151
145
  return selectedIndex;
152
146
  }
153
- }, {
154
- key: 'handleTabMouseEnter',
155
- value: function handleTabMouseEnter(index) {
156
- this.setState({ hoveredTabIndex: index });
157
- }
158
- }, {
159
- key: 'handleTabMouseLeave',
160
- value: function handleTabMouseLeave() {
161
- this.setState({ hoveredTabIndex: null });
162
- }
163
-
164
- // changeMainTab(nextIndex) {
165
- // // Deselect nested tab when changing the main tab
166
- // this.setState({ selectedMainTabIndex: nextIndex, selectedNestedTabIndex: null });
167
- // if (this.props.onSelect) {
168
- // this.props.onSelect(nextIndex);
169
- // } else {
170
- // const { cosmosKey } = this.props;
171
- // if (cosmosKey) {
172
- // tabStore[cosmosKey] = nextIndex;
173
- // }
174
- // }
175
- // }
176
-
177
- }, {
178
- key: 'changeNestedTab',
179
- value: function changeNestedTab(nextIndex) {
180
- // Deselect main tab when changing the nested tab
181
- this.setState({ selectedNestedTabIndex: nextIndex, selectedIndex: null });
182
- if (this.props.onSelect) {
183
- this.props.onSelect(nextIndex);
184
- }
185
- }
186
- }, {
187
- key: 'renderNestedTabs',
188
- value: function renderNestedTabs(tab, index) {
189
- var _this2 = this;
190
-
191
- if (!tab.props.children || !Array.isArray(tab.props.children)) {
192
- return null;
193
- }
194
-
195
- var isVisible = this.state.hoveredTabIndex === index;
196
-
197
- return _react2.default.createElement(
198
- 'div',
199
- {
200
- className: 'nested-tab-container',
201
- style: { display: isVisible ? 'block' : 'none' },
202
- onMouseEnter: function onMouseEnter() {
203
- return _this2.handleTabMouseEnter(index);
204
- },
205
- onMouseLeave: function onMouseLeave() {
206
- return _this2.handleTabMouseLeave();
207
- }
208
- },
209
- _react2.default.createElement(
210
- TabLinkGroup,
211
- { theme: this.props.theme, className: 'nested-tab-list vertical' },
212
- tab.props.children.map(function (nestedTab, nestedIndex) {
213
- return _react2.default.createElement(
214
- TabLink,
215
- {
216
- key: nestedTab.props.label,
217
- selected: _this2.state.selectedNestedTabIndex === nestedIndex,
218
- theme: _this2.props.theme,
219
- className: _this2.state.selectedNestedTabIndex === nestedIndex ? 'nested-tab-list-item active' : 'nested-tab-list-item',
220
- onClick: function onClick() {
221
- return _this2.changeNestedTab(nestedIndex);
222
- }
223
- },
224
- nestedTab.props.label
225
- );
226
- })
227
- )
228
- );
229
- }
230
147
  }, {
231
148
  key: 'render',
232
149
  value: function render() {
233
- var _this3 = this;
150
+ var _this2 = this;
234
151
 
235
152
  var selectedIndex = this.getSelectedTabFromPropsOrState();
236
153
 
@@ -244,27 +161,17 @@ var Tabs = function (_React$Component) {
244
161
  return val1.props.index - val2.props.index;
245
162
  }).map(function (tab, index) {
246
163
  return _react2.default.createElement(
247
- 'div',
248
- { key: tab.props.label, className: 'tab-container' },
249
- _react2.default.createElement(
250
- TabLink,
251
- {
252
- onClick: function onClick() {
253
- return _this3.changeTab(index);
254
- },
255
- selected: selectedIndex === index,
256
- theme: _this3.props.theme,
257
- className: selectedIndex === index ? 'tab-list-item active' : 'tab-list-item',
258
- onMouseEnter: function onMouseEnter() {
259
- return _this3.handleTabMouseEnter(index);
260
- },
261
- onMouseLeave: function onMouseLeave() {
262
- return _this3.handleTabMouseLeave();
263
- }
164
+ TabLink,
165
+ {
166
+ onClick: function onClick() {
167
+ return _this2.changeTab(index);
264
168
  },
265
- tab.props.label
266
- ),
267
- _this3.renderNestedTabs(tab, index)
169
+ key: tab.props.label,
170
+ selected: selectedIndex === index,
171
+ theme: _this2.props.theme,
172
+ className: selectedIndex === index ? 'tab-list-item active' : 'tab-list-item'
173
+ },
174
+ tab.props.label
268
175
  );
269
176
  })
270
177
  ),
@@ -110,44 +110,4 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
110
110
  )
111
111
  )
112
112
  );
113
- });
114
-
115
- (0, _react3.storiesOf)('Tabs').add('dark - default selected with nested tabs', function () {
116
- return _react2.default.createElement(
117
- _storyHelpers.Example,
118
- { title: 'default', background: 'dark' },
119
- _react2.default.createElement(
120
- _components.Tabs,
121
- { theme: 'dark' },
122
- _react2.default.createElement(
123
- _components.Tabs.Tab,
124
- { label: 'Tab 1' },
125
- 'This is tab 1'
126
- ),
127
- _react2.default.createElement(
128
- _components.Tabs.Tab,
129
- { label: 'Tab 2' },
130
- 'You can render anything you want here'
131
- ),
132
- _react2.default.createElement(
133
- _components.Tabs.Tab,
134
- { label: 'Tab 3 with Nested Tabs' },
135
- _react2.default.createElement(
136
- _components.Tabs.Tab,
137
- { label: 'Nested Tab 1' },
138
- 'This is nested tab 1'
139
- ),
140
- _react2.default.createElement(
141
- _components.Tabs.Tab,
142
- { label: 'Nested Tab 2' },
143
- 'This is nested tab 2'
144
- )
145
- ),
146
- _react2.default.createElement(
147
- _components.Tabs.Tab,
148
- { selected: true, label: 'Tab 4' },
149
- 'Look, the fourth tab is selected by default!'
150
- )
151
- )
152
- );
153
113
  });
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@desynova-digital/components",
3
- "version": "8.19.50",
3
+ "version": "8.19.52",
4
4
  "description": "Components for Desynova Digital",
5
5
  "main": "index.js",
6
6
  "author": "desynova-digital",
7
7
  "license": "MIT",
8
8
  "repository": "desynova-digital",
9
9
  "dependencies": {
10
- "@desynova-digital/tokens": "8.19.50",
10
+ "@desynova-digital/tokens": "8.19.52",
11
11
  "prop-types": "^15.7.2",
12
12
  "styled-components": "^4.3.2"
13
13
  },