@entur/form 5.4.19 → 6.0.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.
@@ -61,7 +61,7 @@ function _objectWithoutPropertiesLoose(source, excluded) {
61
61
  return target;
62
62
  }
63
63
 
64
- var _excluded$f = ["children", "hideIcon", "variant", "className"];
64
+ var _excluded$e = ["children", "hideIcon", "variant", "className"];
65
65
  var AlertIcon = function AlertIcon(_ref) {
66
66
  var variant = _ref.variant;
67
67
  var iconClass = "eds-feedback-text__icon eds-feedback-text__icon--" + variant;
@@ -90,7 +90,7 @@ var FeedbackText = function FeedbackText(_ref2) {
90
90
  hideIcon = _ref2$hideIcon === void 0 ? false : _ref2$hideIcon,
91
91
  variant = _ref2.variant,
92
92
  className = _ref2.className,
93
- rest = _objectWithoutPropertiesLoose(_ref2, _excluded$f);
93
+ rest = _objectWithoutPropertiesLoose(_ref2, _excluded$e);
94
94
  return React__default["default"].createElement(typography.SubLabel, _extends({
95
95
  className: classNames__default["default"]('eds-feedback-text', {
96
96
  'eds-feedback-text--info': variant === 'info'
@@ -124,14 +124,14 @@ var useInputGroupContext = function useInputGroupContext() {
124
124
  return React__namespace.useContext(InputGroupContext);
125
125
  };
126
126
 
127
- var _excluded$e = ["label", "required", "labelId", "staticAnimation"];
127
+ var _excluded$d = ["label", "required", "labelId", "staticAnimation"];
128
128
  var InputGroupLabel = function InputGroupLabel(_ref) {
129
129
  var label = _ref.label,
130
130
  required = _ref.required,
131
131
  labelId = _ref.labelId,
132
132
  _ref$staticAnimation = _ref.staticAnimation,
133
133
  staticAnimation = _ref$staticAnimation === void 0 ? false : _ref$staticAnimation,
134
- rest = _objectWithoutPropertiesLoose(_ref, _excluded$e);
134
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$d);
135
135
  var _useInputGroupContext = useInputGroupContext(),
136
136
  isFilled = _useInputGroupContext.isFilled;
137
137
  var filler = staticAnimation || isFilled;
@@ -161,7 +161,7 @@ var useVariant = function useVariant() {
161
161
  return context;
162
162
  };
163
163
 
164
- var _excluded$d = ["children", "className", "dark", "disabled", "readOnly", "variant", "prepend", "append", "size", "isFilled", "label", "required", "labelTooltip", "feedback", "labelId", "labelProps", "style", "disableLabelAnimation", "ariaAlertOnFeedback"];
164
+ var _excluded$c = ["children", "className", "dark", "disabled", "readOnly", "variant", "prepend", "append", "size", "isFilled", "label", "required", "labelTooltip", "feedback", "labelId", "labelProps", "style", "disableLabelAnimation", "ariaAlertOnFeedback"];
165
165
  var BaseFormControl = /*#__PURE__*/React__default["default"].forwardRef(function (_ref, ref) {
166
166
  var children = _ref.children,
167
167
  className = _ref.className,
@@ -188,7 +188,7 @@ var BaseFormControl = /*#__PURE__*/React__default["default"].forwardRef(function
188
188
  disableLabelAnimation = _ref$disableLabelAnim === void 0 ? false : _ref$disableLabelAnim,
189
189
  _ref$ariaAlertOnFeedb = _ref.ariaAlertOnFeedback,
190
190
  ariaAlertOnFeedback = _ref$ariaAlertOnFeedb === void 0 ? false : _ref$ariaAlertOnFeedb,
191
- rest = _objectWithoutPropertiesLoose(_ref, _excluded$d);
191
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$c);
192
192
  var contextVariant = useVariant();
193
193
  var currentVariant = variant || contextVariant;
194
194
  return React__default["default"].createElement(InputGroupContextProvider, null, React__default["default"].createElement("div", _extends({
@@ -224,7 +224,7 @@ var BaseFormControl = /*#__PURE__*/React__default["default"].forwardRef(function
224
224
  }, feedback));
225
225
  });
226
226
 
227
- var _excluded$c = ["checked", "className", "children", "style", "disabled", "reduceClickArea"];
227
+ var _excluded$b = ["checked", "className", "children", "style", "disabled", "reduceClickArea"];
228
228
  var Checkbox = /*#__PURE__*/React__default["default"].forwardRef(function (_ref, ref) {
229
229
  var checked = _ref.checked,
230
230
  className = _ref.className,
@@ -233,7 +233,7 @@ var Checkbox = /*#__PURE__*/React__default["default"].forwardRef(function (_ref,
233
233
  _ref$disabled = _ref.disabled,
234
234
  disabled = _ref$disabled === void 0 ? false : _ref$disabled,
235
235
  reduceClickArea = _ref.reduceClickArea,
236
- rest = _objectWithoutPropertiesLoose(_ref, _excluded$c);
236
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$b);
237
237
  // Trick to allow using a ref locally, while still allowing for ref forwarding
238
238
  // Read more at https://reactjs.org/docs/hooks-reference.html#useimperativehandle
239
239
  var innerRef = React__default["default"].useRef(null);
@@ -293,12 +293,12 @@ var CheckboxIcon = function CheckboxIcon(_ref2) {
293
293
  }));
294
294
  };
295
295
 
296
- var _excluded$b = ["children", "className", "label"];
296
+ var _excluded$a = ["children", "className", "label"];
297
297
  var Fieldset = function Fieldset(_ref) {
298
298
  var children = _ref.children,
299
299
  className = _ref.className,
300
300
  label = _ref.label,
301
- rest = _objectWithoutPropertiesLoose(_ref, _excluded$b);
301
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$a);
302
302
  return React__default["default"].createElement("fieldset", _extends({
303
303
  className: classNames__default["default"]('eds-fieldset', className)
304
304
  }, rest), label && React__default["default"].createElement(typography.Label, {
@@ -317,13 +317,13 @@ var useRadioGroupContext = function useRadioGroupContext() {
317
317
  return context;
318
318
  };
319
319
 
320
- var _excluded$a = ["className", "children", "value", "disabled"];
320
+ var _excluded$9 = ["className", "children", "value", "disabled"];
321
321
  var Radio = /*#__PURE__*/React__default["default"].forwardRef(function (_ref, ref) {
322
322
  var className = _ref.className,
323
323
  children = _ref.children,
324
324
  value = _ref.value,
325
325
  disabled = _ref.disabled,
326
- rest = _objectWithoutPropertiesLoose(_ref, _excluded$a);
326
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$9);
327
327
  var classList = classNames__default["default"](className, 'eds-form-component--radio__radio', {
328
328
  'eds-form-component--radio__radio--disabled': disabled
329
329
  });
@@ -352,14 +352,14 @@ var Radio = /*#__PURE__*/React__default["default"].forwardRef(function (_ref, re
352
352
  }, children));
353
353
  });
354
354
 
355
- var _excluded$9 = ["name", "value", "children", "onChange", "label"];
355
+ var _excluded$8 = ["name", "value", "children", "onChange", "label"];
356
356
  var RadioGroup = function RadioGroup(_ref) {
357
357
  var name = _ref.name,
358
358
  value = _ref.value,
359
359
  children = _ref.children,
360
360
  onChange = _ref.onChange,
361
361
  label = _ref.label,
362
- rest = _objectWithoutPropertiesLoose(_ref, _excluded$9);
362
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$8);
363
363
  var contextValue = React__default["default"].useMemo(function () {
364
364
  return {
365
365
  name: name,
@@ -374,7 +374,7 @@ var RadioGroup = function RadioGroup(_ref) {
374
374
  }, rest), children) : children);
375
375
  };
376
376
 
377
- var _excluded$8 = ["className", "children", "value", "title", "secondaryLabel", "size", "hideCheckbox", "style", "id", "disabled"];
377
+ var _excluded$7 = ["className", "children", "value", "title", "secondaryLabel", "size", "hideCheckbox", "style", "id", "disabled"];
378
378
  var RadioPanel = /*#__PURE__*/React__default["default"].forwardRef(function (_ref, ref) {
379
379
  var className = _ref.className,
380
380
  children = _ref.children,
@@ -389,7 +389,7 @@ var RadioPanel = /*#__PURE__*/React__default["default"].forwardRef(function (_re
389
389
  id = _ref.id,
390
390
  _ref$disabled = _ref.disabled,
391
391
  disabled = _ref$disabled === void 0 ? false : _ref$disabled,
392
- rest = _objectWithoutPropertiesLoose(_ref, _excluded$8);
392
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$7);
393
393
  var classList = classNames__default["default"](className, 'eds-radio-panel__container', "eds-radio-panel--" + size, {
394
394
  'eds-radio-panel--disabled': disabled
395
395
  });
@@ -439,7 +439,7 @@ var RadioPanelCheck = function RadioPanelCheck() {
439
439
  }));
440
440
  };
441
441
 
442
- var _excluded$7 = ["className", "children", "labelPlacement", "icon", "hideIcon", "color", "contrastColor", "size"];
442
+ var _excluded$6 = ["className", "children", "labelPlacement", "icon", "hideIcon", "color", "contrastColor", "size"];
443
443
  var Switch = /*#__PURE__*/React__default["default"].forwardRef(function (_ref, ref) {
444
444
  var className = _ref.className,
445
445
  children = _ref.children,
@@ -453,7 +453,7 @@ var Switch = /*#__PURE__*/React__default["default"].forwardRef(function (_ref, r
453
453
  contrastColor = _ref.contrastColor,
454
454
  _ref$size = _ref.size,
455
455
  size = _ref$size === void 0 ? 'medium' : _ref$size,
456
- rest = _objectWithoutPropertiesLoose(_ref, _excluded$7);
456
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$6);
457
457
  var chosenContrastColor = contrastColor && contrastColor || color;
458
458
  var displayedIcon = function displayedIcon() {
459
459
  if (icon) return icon;
@@ -478,95 +478,6 @@ var Switch = /*#__PURE__*/React__default["default"].forwardRef(function (_ref, r
478
478
  }, children));
479
479
  });
480
480
 
481
- var _excluded$6 = ["className", "children", "labelPlacement", "transport", "size"];
482
- var TravelSwitch = function TravelSwitch(_ref) {
483
- var className = _ref.className,
484
- children = _ref.children,
485
- _ref$labelPlacement = _ref.labelPlacement,
486
- labelPlacement = _ref$labelPlacement === void 0 ? 'right' : _ref$labelPlacement,
487
- transport = _ref.transport,
488
- size = _ref.size,
489
- rest = _objectWithoutPropertiesLoose(_ref, _excluded$6);
490
- var _modeCalc = modeCalc(transport),
491
- color = _modeCalc.color,
492
- contrast = _modeCalc.contrast,
493
- Icon = _modeCalc.Icon;
494
- return React__default["default"].createElement(Switch, _extends({
495
- className: className,
496
- labelPlacement: labelPlacement,
497
- color: color,
498
- contrastColor: contrast,
499
- icon: React__default["default"].createElement(Icon, null),
500
- size: size
501
- }, rest), children);
502
- };
503
- function modeCalc(mode) {
504
- switch (mode) {
505
- case 'bus':
506
- return {
507
- Icon: icons.BusIcon,
508
- color: tokens.colors.transport["default"].bus,
509
- contrast: tokens.colors.transport.contrast.bus
510
- };
511
- case 'metro':
512
- return {
513
- Icon: icons.SubwayIcon,
514
- color: tokens.colors.transport["default"].metro,
515
- contrast: tokens.colors.transport.contrast.metro
516
- };
517
- case 'air':
518
- return {
519
- Icon: icons.PlaneIcon,
520
- color: tokens.colors.transport["default"].plane,
521
- contrast: tokens.colors.transport.contrast.plane
522
- };
523
- case 'tram':
524
- return {
525
- Icon: icons.TramIcon,
526
- color: tokens.colors.transport["default"].tram,
527
- contrast: tokens.colors.transport.contrast.tram
528
- };
529
- case 'rail':
530
- return {
531
- Icon: icons.TrainIcon,
532
- color: tokens.colors.transport["default"].train,
533
- contrast: tokens.colors.transport.contrast.train
534
- };
535
- case 'water':
536
- return {
537
- Icon: icons.FerryIcon,
538
- color: tokens.colors.transport["default"].ferry,
539
- contrast: tokens.colors.transport.contrast.ferry
540
- };
541
- case 'bike':
542
- return {
543
- Icon: icons.BicycleIcon,
544
- color: tokens.colors.transport["default"].mobility,
545
- contrast: tokens.colors.transport.contrast.mobility
546
- };
547
- case 'scooter':
548
- return {
549
- Icon: icons.ScooterIcon,
550
- color: tokens.colors.transport["default"].mobility,
551
- contrast: tokens.colors.transport.contrast.mobility
552
- };
553
- case 'airportLinkBus':
554
- return {
555
- Icon: icons.BusIcon,
556
- color: tokens.colors.transport["default"].plane,
557
- contrast: tokens.colors.transport.contrast.plane
558
- };
559
- case 'airportLinkRail':
560
- return {
561
- Icon: icons.TrainIcon,
562
- color: tokens.colors.transport["default"].plane,
563
- contrast: tokens.colors.transport.contrast.plane
564
- };
565
- default:
566
- throw Error('Please select a transport for the TravelSwitch.');
567
- }
568
- }
569
-
570
481
  // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types -- disabled during Yarn upgrade
571
482
  function hasValue(value) {
572
483
  return value != null && !(Array.isArray(value) && value.length === 0);
@@ -938,7 +849,6 @@ exports.SegmentedControl = SegmentedControl;
938
849
  exports.Switch = Switch;
939
850
  exports.TextArea = TextArea;
940
851
  exports.TextField = TextField;
941
- exports.TravelSwitch = TravelSwitch;
942
852
  exports.VariantProvider = VariantProvider;
943
853
  exports.hasValue = hasValue;
944
854
  exports.isFilled = isFilled;