@stokr/components-library 2.3.65-beta.6 → 2.3.65-beta.7

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.
@@ -13,7 +13,7 @@ var _colors = _interopRequireDefault(require("../../styles/colors"));
13
13
  var _checkIcon = require("../../static/images/check-icon.svg");
14
14
  var _Select = require("./Select.styles");
15
15
  const _excluded = ["children", "selectProps"],
16
- _excluded2 = ["id", "name", "label", "options", "search", "error", "touched", "value", "disabled", "menuHeight", "placeholder", "showCheckboxes", "showCountBadge", "closeMenuOnSelect", "hideSelectedOptions"];
16
+ _excluded2 = ["id", "name", "label", "options", "search", "error", "touched", "value", "disabled", "menuHeight", "placeholder", "showCheckboxes", "showCountBadge", "closeMenuOnSelect", "hideSelectedOptions", "width", "minMenuWidth", "maxMenuWidth"];
17
17
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
18
18
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
19
19
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
@@ -39,7 +39,7 @@ const Checkbox = _styledComponents.default.div.withConfig({
39
39
  const OptionLabel = _styledComponents.default.span.withConfig({
40
40
  displayName: "MultiSelect__OptionLabel",
41
41
  componentId: "sc-1udb3q8-3"
42
- })(["font-size:14px;color:", ";font-weight:400;letter-spacing:0.6px;"], _colors.default.black);
42
+ })(["font-size:14px;color:", ";font-weight:400;letter-spacing:0.6px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex:1;min-width:0;"], _colors.default.black);
43
43
  const PlaceholderText = _styledComponents.default.span.withConfig({
44
44
  displayName: "MultiSelect__PlaceholderText",
45
45
  componentId: "sc-1udb3q8-4"
@@ -125,7 +125,10 @@ const MultiSelect = props => {
125
125
  showCheckboxes = true,
126
126
  showCountBadge = true,
127
127
  closeMenuOnSelect = false,
128
- hideSelectedOptions = false
128
+ hideSelectedOptions = false,
129
+ width,
130
+ minMenuWidth = 150,
131
+ maxMenuWidth = 300
129
132
  } = props,
130
133
  otherProps = _objectWithoutProperties(props, _excluded2);
131
134
  const hasValue = (value === null || value === void 0 ? void 0 : value.length) > 0;
@@ -164,7 +167,11 @@ const MultiSelect = props => {
164
167
 
165
168
  // Get selected options from value array
166
169
  const selectedOptions = options === null || options === void 0 ? void 0 : options.filter(option => value === null || value === void 0 ? void 0 : value.includes(option.value));
167
- return /*#__PURE__*/_react.default.createElement(_Input.Wrapper, null, label && /*#__PURE__*/_react.default.createElement(_Input.Label, {
170
+ return /*#__PURE__*/_react.default.createElement(_Input.Wrapper, {
171
+ style: {
172
+ width: width || 'auto'
173
+ }
174
+ }, label && /*#__PURE__*/_react.default.createElement(_Input.Label, {
168
175
  isUp: labelUp,
169
176
  active: hasFocus,
170
177
  error: error && touched,
@@ -206,7 +213,10 @@ const MultiSelect = props => {
206
213
  borderRadius: '8px',
207
214
  boxShadow: '0 4px 12px rgba(0, 0, 0, 0.15)',
208
215
  border: "1px solid ".concat(_colors.default.lightGrey),
209
- overflow: 'hidden'
216
+ overflow: 'hidden',
217
+ minWidth: minMenuWidth,
218
+ maxWidth: maxMenuWidth,
219
+ width: 'auto'
210
220
  }),
211
221
  menuList: baseStyle => _objectSpread(_objectSpread({}, baseStyle), {}, {
212
222
  padding: 0
@@ -219,6 +229,9 @@ const MultiSelect = props => {
219
229
  color: _colors.default.black,
220
230
  cursor: 'pointer',
221
231
  fontWeight: state.isSelected ? 600 : 400,
232
+ whiteSpace: 'nowrap',
233
+ overflow: 'hidden',
234
+ textOverflow: 'ellipsis',
222
235
  '&:active': {
223
236
  backgroundColor: _colors.default.grey
224
237
  }
@@ -239,7 +252,15 @@ const MultiSelect = props => {
239
252
  padding: 0
240
253
  }),
241
254
  indicatorsContainer: baseStyle => _objectSpread(_objectSpread({}, baseStyle), {}, {
242
- paddingLeft: '8px'
255
+ padding: 0,
256
+ gap: '4px'
257
+ }),
258
+ dropdownIndicator: baseStyle => _objectSpread(_objectSpread({}, baseStyle), {}, {
259
+ padding: '4px'
260
+ }),
261
+ clearIndicator: baseStyle => _objectSpread(_objectSpread({}, baseStyle), {}, {
262
+ padding: '4px'
263
+ // display: 'none',
243
264
  })
244
265
  },
245
266
  components: {
@@ -272,7 +293,10 @@ MultiSelect.propTypes = {
272
293
  showCheckboxes: _propTypes.default.bool,
273
294
  showCountBadge: _propTypes.default.bool,
274
295
  closeMenuOnSelect: _propTypes.default.bool,
275
- hideSelectedOptions: _propTypes.default.bool
296
+ hideSelectedOptions: _propTypes.default.bool,
297
+ width: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
298
+ minMenuWidth: _propTypes.default.number,
299
+ maxMenuWidth: _propTypes.default.number
276
300
  };
277
301
  MultiSelect.defaultProps = {
278
302
  label: '',
@@ -287,6 +311,9 @@ MultiSelect.defaultProps = {
287
311
  showCheckboxes: true,
288
312
  showCountBadge: true,
289
313
  closeMenuOnSelect: false,
290
- hideSelectedOptions: false
314
+ hideSelectedOptions: false,
315
+ width: undefined,
316
+ minMenuWidth: 150,
317
+ maxMenuWidth: 300
291
318
  };
292
319
  var _default = exports.default = MultiSelect;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = exports.WithoutCheckboxes = exports.WithPreselectedValues = exports.WithManyOptions = exports.MultipleFilters = exports.Disabled = exports.Default = void 0;
6
+ exports.default = exports.WithoutCheckboxes = exports.WithPreselectedValues = exports.WithManyOptions = exports.MultipleFilters = exports.Disabled = exports.Default = exports.CustomWidth = void 0;
7
7
  var _react = _interopRequireWildcard(require("react"));
8
8
  var _MultiSelect = require("./MultiSelect");
9
9
  var _global = _interopRequireDefault(require("../../styles/global"));
@@ -195,4 +195,70 @@ const Disabled = () => /*#__PURE__*/_react.default.createElement(ControlledMulti
195
195
  value: ['initiated'],
196
196
  disabled: true
197
197
  });
198
- exports.Disabled = Disabled;
198
+
199
+ // Custom width - narrow select with wider menu
200
+ exports.Disabled = Disabled;
201
+ const CustomWidth = () => {
202
+ const longOptions = [{
203
+ key: 'opt1',
204
+ value: 'opt1',
205
+ label: 'Very Long Option Name Here'
206
+ }, {
207
+ key: 'opt2',
208
+ value: 'opt2',
209
+ label: 'Another Long Option'
210
+ }, {
211
+ key: 'opt3',
212
+ value: 'opt3',
213
+ label: 'Short'
214
+ }, {
215
+ key: 'opt4',
216
+ value: 'opt4',
217
+ label: 'Medium Length Option'
218
+ }];
219
+ return /*#__PURE__*/_react.default.createElement("div", {
220
+ style: {
221
+ display: 'flex',
222
+ flexDirection: 'column',
223
+ gap: '24px'
224
+ }
225
+ }, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("h4", {
226
+ style: {
227
+ marginBottom: '8px',
228
+ fontSize: '14px'
229
+ }
230
+ }, "Narrow select (80px), menu expands (150-250px)"), /*#__PURE__*/_react.default.createElement(ControlledMultiSelect, {
231
+ id: "narrow",
232
+ name: "narrow",
233
+ placeholder: "Filter",
234
+ options: longOptions,
235
+ width: 80,
236
+ minMenuWidth: 150,
237
+ maxMenuWidth: 250
238
+ })), /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("h4", {
239
+ style: {
240
+ marginBottom: '8px',
241
+ fontSize: '14px'
242
+ }
243
+ }, "Fixed width (200px)"), /*#__PURE__*/_react.default.createElement(ControlledMultiSelect, {
244
+ id: "fixed",
245
+ name: "fixed",
246
+ placeholder: "Status",
247
+ options: statusOptions,
248
+ width: "200px"
249
+ })), /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("h4", {
250
+ style: {
251
+ marginBottom: '8px',
252
+ fontSize: '14px'
253
+ }
254
+ }, "Wide menu (up to 400px) for long text"), /*#__PURE__*/_react.default.createElement(ControlledMultiSelect, {
255
+ id: "wide",
256
+ name: "wide",
257
+ placeholder: "Select",
258
+ options: longOptions,
259
+ width: 120,
260
+ minMenuWidth: 200,
261
+ maxMenuWidth: 400
262
+ })));
263
+ };
264
+ exports.CustomWidth = CustomWidth;
@@ -7,7 +7,7 @@ exports.default = exports.SearchInput = void 0;
7
7
  var _react = _interopRequireDefault(require("react"));
8
8
  var _SearchInput = require("./SearchInput.styles");
9
9
  var _searchIcon = require("../../static/images/search-icon.svg");
10
- const _excluded = ["value", "onChange", "placeholder", "icon", "showIcon", "disabled", "onFocus", "onBlur", "className", "containerStyle", "inputStyle", "iconStyle", "id", "name", "aria-label", "aria-describedby"];
10
+ const _excluded = ["value", "onChange", "placeholder", "icon", "showIcon", "disabled", "variant", "onFocus", "onBlur", "className", "containerStyle", "inputStyle", "iconStyle", "id", "name", "aria-label", "aria-describedby"];
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
13
  function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
@@ -20,6 +20,8 @@ const SearchInput = _ref => {
20
20
  icon,
21
21
  showIcon = true,
22
22
  disabled = false,
23
+ variant = 'filled',
24
+ // 'filled' or 'outlined'
23
25
  onFocus,
24
26
  onBlur,
25
27
  className,
@@ -53,7 +55,8 @@ const SearchInput = _ref => {
53
55
  className: className,
54
56
  style: containerStyle
55
57
  }, /*#__PURE__*/_react.default.createElement(_SearchInput.SearchInputWrapper, {
56
- disabled: disabled
58
+ disabled: disabled,
59
+ variant: variant
57
60
  }, showIcon && /*#__PURE__*/_react.default.createElement(_SearchInput.SearchIconWrapper, {
58
61
  style: iconStyle
59
62
  }, icon || /*#__PURE__*/_react.default.createElement(_searchIcon.ReactComponent, null)), /*#__PURE__*/_react.default.createElement(_SearchInput.SearchInputField, _extends({
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = exports.WithoutIcon = exports.WithInitialValue = exports.WithCustomIcon = exports.LongText = exports.Disabled = exports.DifferentWidths = exports.Default = exports.CustomStyling = exports.CustomPlaceholder = exports.AllStates = exports.AccessibilityExample = void 0;
6
+ exports.default = exports.WithoutIcon = exports.WithInitialValue = exports.WithCustomIcon = exports.Variants = exports.Outlined = exports.LongText = exports.Disabled = exports.DifferentWidths = exports.Default = exports.CustomStyling = exports.CustomPlaceholder = exports.AllStates = exports.AccessibilityExample = void 0;
7
7
  var _react = _interopRequireWildcard(require("react"));
8
8
  var _SearchInput = _interopRequireDefault(require("./SearchInput"));
9
9
  var _ComponentWrapper = require("../ComponentWrapper/ComponentWrapper.styles");
@@ -28,6 +28,14 @@ var _default = exports.default = {
28
28
  description: 'Placeholder text',
29
29
  defaultValue: 'Search'
30
30
  },
31
+ variant: {
32
+ control: {
33
+ type: 'select'
34
+ },
35
+ options: ['filled', 'outlined'],
36
+ description: 'Visual variant of the input',
37
+ defaultValue: 'filled'
38
+ },
31
39
  showIcon: {
32
40
  control: 'boolean',
33
41
  description: 'Show/hide the search icon',
@@ -276,7 +284,61 @@ AccessibilityExample.decorators = [Story => /*#__PURE__*/_react.default.createEl
276
284
  }
277
285
  }, "Use this search to find products by name, category, or description."))];
278
286
 
287
+ // Outlined variant
288
+ const Outlined = () => {
289
+ const [value, setValue] = (0, _react.useState)('');
290
+ return /*#__PURE__*/_react.default.createElement(_ComponentWrapper.ComponentWrapper, null, /*#__PURE__*/_react.default.createElement(_SearchInput.default, {
291
+ value: value,
292
+ onChange: setValue,
293
+ placeholder: "Search",
294
+ variant: "outlined"
295
+ }), /*#__PURE__*/_react.default.createElement("div", {
296
+ style: {
297
+ marginTop: '12px',
298
+ fontSize: '12px',
299
+ color: _colors.default.grey2
300
+ }
301
+ }, "Current value: ", /*#__PURE__*/_react.default.createElement("strong", null, value || '(empty)')));
302
+ };
303
+
304
+ // Both variants side by side
305
+ exports.Outlined = Outlined;
306
+ const Variants = () => {
307
+ const [value1, setValue1] = (0, _react.useState)('');
308
+ const [value2, setValue2] = (0, _react.useState)('');
309
+ return /*#__PURE__*/_react.default.createElement(_ComponentWrapper.ComponentWrapper, null, /*#__PURE__*/_react.default.createElement("div", {
310
+ style: {
311
+ marginBottom: '24px'
312
+ }
313
+ }, /*#__PURE__*/_react.default.createElement("h4", {
314
+ style: {
315
+ marginBottom: '8px',
316
+ fontSize: '14px'
317
+ }
318
+ }, "Filled (default)"), /*#__PURE__*/_react.default.createElement(_SearchInput.default, {
319
+ value: value1,
320
+ onChange: setValue1,
321
+ placeholder: "Search",
322
+ variant: "filled"
323
+ })), /*#__PURE__*/_react.default.createElement("div", {
324
+ style: {
325
+ marginBottom: '24px'
326
+ }
327
+ }, /*#__PURE__*/_react.default.createElement("h4", {
328
+ style: {
329
+ marginBottom: '8px',
330
+ fontSize: '14px'
331
+ }
332
+ }, "Outlined"), /*#__PURE__*/_react.default.createElement(_SearchInput.default, {
333
+ value: value2,
334
+ onChange: setValue2,
335
+ placeholder: "Search",
336
+ variant: "outlined"
337
+ })));
338
+ };
339
+
279
340
  // Custom styling
341
+ exports.Variants = Variants;
280
342
  const CustomStyling = () => {
281
343
  const [value, setValue] = (0, _react.useState)('');
282
344
  return /*#__PURE__*/_react.default.createElement(_ComponentWrapper.ComponentWrapper, null, /*#__PURE__*/_react.default.createElement(_SearchInput.default, {
@@ -14,7 +14,7 @@ const SearchInputContainer = exports.SearchInputContainer = _styledComponents.de
14
14
  const SearchInputWrapper = exports.SearchInputWrapper = _styledComponents.default.div.withConfig({
15
15
  displayName: "SearchInputstyles__SearchInputWrapper",
16
16
  componentId: "sc-dcxztv-1"
17
- })(["position:relative;display:flex;align-items:center;width:100%;background-color:", ";border-radius:8px;padding:0 16px;min-height:40px;transition:background-color 0.2s ease;", " &:focus-within{background-color:", ";box-shadow:0 0 0 2px ", ";}"], _colors.default.grey3, props => props.disabled && "\n opacity: 0.6;\n cursor: not-allowed;\n ", _colors.default.white, _colors.default.lightGrey);
17
+ })(["position:relative;display:flex;align-items:center;width:100%;border-radius:8px;padding:0 16px;min-height:40px;transition:all 0.2s ease;background-color:", ";border:", ";", " &:focus-within{background-color:", ";border-color:", ";box-shadow:", ";}&:hover{border-color:", ";}"], props => props.variant === 'outlined' ? 'transparent' : _colors.default.grey3, props => props.variant === 'outlined' ? "1px solid ".concat(_colors.default.lightGrey) : '1px solid transparent', props => props.disabled && "\n opacity: 0.6;\n cursor: not-allowed;\n ", props => props.variant === 'outlined' ? 'transparent' : _colors.default.white, props => props.variant === 'outlined' ? _colors.default.grey2 : 'transparent', props => props.variant === 'outlined' ? 'none' : "0 0 0 2px ".concat(_colors.default.lightGrey), props => props.variant === 'outlined' ? _colors.default.grey2 : 'transparent');
18
18
  const SearchIconWrapper = exports.SearchIconWrapper = _styledComponents.default.div.withConfig({
19
19
  displayName: "SearchInputstyles__SearchIconWrapper",
20
20
  componentId: "sc-dcxztv-2"
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = void 0;
6
+ exports.default = exports.StepIndicator = void 0;
7
7
  var _react = _interopRequireDefault(require("react"));
8
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
9
9
  var _StepIndicator = require("./StepIndicator.styles");
@@ -40,6 +40,7 @@ const StepIndicator = _ref => {
40
40
  }));
41
41
  }));
42
42
  };
43
+ exports.StepIndicator = StepIndicator;
43
44
  StepIndicator.propTypes = {
44
45
  steps: _propTypes.default.arrayOf(_propTypes.default.shape({
45
46
  id: _propTypes.default.string.isRequired,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stokr/components-library",
3
- "version": "2.3.65-beta.6",
3
+ "version": "2.3.65-beta.7",
4
4
  "description": "STOKR - Components Library",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",