@festo-ui/react 8.1.0 → 8.2.0-dev.575

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.
Files changed (42) hide show
  1. package/lib/components/card/CardNotification.d.ts +2 -2
  2. package/lib/components/card/CardNotification.js +3 -3
  3. package/lib/components/mobile-flyout/mobile-flyout-item/MobileFlyoutItem.d.ts +2 -2
  4. package/lib/components/mobile-flyout/mobile-flyout-item/MobileFlyoutItem.js +7 -7
  5. package/lib/forms/color-picker/ColorPicker.d.ts +2 -2
  6. package/lib/forms/color-picker/ColorPicker.js +38 -38
  7. package/lib/forms/date-picker/DatePicker.d.ts +2 -2
  8. package/lib/forms/date-picker/DatePicker.js +14 -13
  9. package/lib/forms/date-range-picker/DateRangePicker.d.ts +2 -2
  10. package/lib/forms/date-range-picker/DateRangePicker.js +17 -16
  11. package/lib/forms/select/internal/SelectButtonContent.js +2 -1
  12. package/lib/forms/time-picker/TimePicker.d.ts +4 -3
  13. package/lib/forms/time-picker/TimePicker.js +19 -18
  14. package/lib/forms/time-picker/time-picker-dropdown/TimePickerDropdown.d.ts +4 -3
  15. package/lib/forms/time-picker/time-picker-dropdown/TimePickerDropdown.js +12 -13
  16. package/node/lib/components/card/CardNotification.js +3 -3
  17. package/node/lib/components/mobile-flyout/mobile-flyout-item/MobileFlyoutItem.js +6 -6
  18. package/node/lib/forms/color-picker/ColorPicker.js +40 -43
  19. package/node/lib/forms/date-picker/DatePicker.js +11 -10
  20. package/node/lib/forms/date-range-picker/DateRangePicker.js +13 -12
  21. package/node/lib/forms/select/internal/SelectButtonContent.js +2 -3
  22. package/node/lib/forms/time-picker/TimePicker.js +16 -17
  23. package/node/lib/forms/time-picker/time-picker-dropdown/TimePickerDropdown.js +17 -20
  24. package/package.json +2 -1
  25. package/lib/components/icons/check-small.d.ts +0 -7
  26. package/lib/components/icons/check-small.js +0 -71
  27. package/lib/components/icons/close-small.d.ts +0 -7
  28. package/lib/components/icons/close-small.js +0 -69
  29. package/lib/components/icons/collapse.d.ts +0 -7
  30. package/lib/components/icons/collapse.js +0 -70
  31. package/lib/components/icons/expand.d.ts +0 -7
  32. package/lib/components/icons/expand.js +0 -70
  33. package/lib/components/icons/right-2.d.ts +0 -7
  34. package/lib/components/icons/right-2.js +0 -67
  35. package/lib/components/icons/warning.d.ts +0 -7
  36. package/lib/components/icons/warning.js +0 -70
  37. package/node/lib/components/icons/check-small.js +0 -77
  38. package/node/lib/components/icons/close-small.js +0 -75
  39. package/node/lib/components/icons/collapse.js +0 -76
  40. package/node/lib/components/icons/expand.js +0 -76
  41. package/node/lib/components/icons/right-2.js +0 -73
  42. package/node/lib/components/icons/warning.js +0 -76
@@ -1,7 +1,7 @@
1
- import { ClassNameProps } from '../../helper/types';
1
+ import type { ClassNameProps } from "../../helper/types";
2
2
  interface CardNotificationProps extends ClassNameProps {
3
3
  title: string;
4
4
  message?: string;
5
5
  }
6
- declare function CardNotification({ className, title, message }: CardNotificationProps): import("react/jsx-runtime").JSX.Element;
6
+ declare function CardNotification({ className, title, message, }: CardNotificationProps): import("react/jsx-runtime").JSX.Element;
7
7
  export default CardNotification;
@@ -1,5 +1,5 @@
1
- import classNames from 'classnames';
2
- import IconWarning from "../icons/warning.js";
1
+ import classNames from "classnames";
2
+ import { IconWarning } from "@festo-ui/react-icons";
3
3
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
4
  function CardNotification(_ref) {
5
5
  let {
@@ -7,7 +7,7 @@ function CardNotification(_ref) {
7
7
  title,
8
8
  message
9
9
  } = _ref;
10
- const classes = classNames('fwe-card-notification', className);
10
+ const classes = classNames("fwe-card-notification", className);
11
11
  return /*#__PURE__*/_jsxs("div", {
12
12
  className: classes,
13
13
  children: [/*#__PURE__*/_jsx(IconWarning, {
@@ -1,5 +1,5 @@
1
- import { PolymorphicRef } from '../../../helper/types';
2
- declare module 'react' {
1
+ import type { PolymorphicRef } from "../../../helper/types";
2
+ declare module "react" {
3
3
  function forwardRef<T, P = {}>(render: (props: P, ref: React.Ref<T>) => React.ReactElement | null): (props: P & React.RefAttributes<T>) => React.ReactElement | null;
4
4
  }
5
5
  interface MobileFlyoutItemBaseProps {
@@ -1,7 +1,7 @@
1
- import cn from 'classnames';
2
- import { forwardRef, useContext } from 'react';
1
+ import cn from "classnames";
2
+ import { forwardRef, useContext } from "react";
3
+ import { IconRight2 } from "@festo-ui/react-icons";
3
4
  import MobileFlyoutContext from "../MobileFlyoutContext.js";
4
- import IconRight2 from "../../icons/right-2.js";
5
5
  import IconWrapper from "../../icon-wrapper/IconWrapper.js";
6
6
  /*
7
7
  * Augment `forwardRef` only for this module so that storybook can infer controls
@@ -20,7 +20,7 @@ const MobileFlyoutItem = /*#__PURE__*/forwardRef((_ref, ref) => {
20
20
  active,
21
21
  ...props
22
22
  } = _ref;
23
- const Component = component || 'a';
23
+ const Component = component || "a";
24
24
  const {
25
25
  setVisible,
26
26
  setOpen
@@ -41,10 +41,10 @@ const MobileFlyoutItem = /*#__PURE__*/forwardRef((_ref, ref) => {
41
41
  children: [/*#__PURE__*/_jsx(IconWrapper, {
42
42
  icon: icon
43
43
  }), /*#__PURE__*/_jsx("div", {
44
- className: cn('fwe-flex-grow-1', {
45
- 'fwe-color-hero': active
44
+ className: cn("fwe-flex-grow-1", {
45
+ "fwe-color-hero": active
46
46
  }, {
47
- 'fwe-ml-xxs': !!icon
47
+ "fwe-ml-xxs": !!icon
48
48
  }),
49
49
  children: children
50
50
  }), pageLink && /*#__PURE__*/_jsx(IconRight2, {})]
@@ -1,5 +1,5 @@
1
- import './ColorPicker.scss';
2
- import { ClassNameProps } from '../../helper/types';
1
+ import "./ColorPicker.scss";
2
+ import type { ClassNameProps } from "../../helper/types";
3
3
  export declare const PREDEFINED_COLORS: string[];
4
4
  interface ColorPickerProps extends ClassNameProps {
5
5
  palette?: string[];
@@ -1,21 +1,21 @@
1
1
  /* eslint-disable jsx-a11y/no-static-element-interactions */
2
2
  /* eslint-disable jsx-a11y/click-events-have-key-events */
3
- import React, { useRef, useCallback, useEffect, useState } from 'react';
4
- import Draggable from 'react-draggable';
5
- import classNames from 'classnames';
3
+
4
+ import { useRef, useCallback, useEffect, useState } from "react";
5
+ import Draggable from "react-draggable";
6
+ import classNames from "classnames";
7
+ import { IconCheckSmall, IconCollapse } from "@festo-ui/react-icons";
6
8
  import ColorHelper from "./ColorHelper.js";
7
9
  import useId from "../../helper/useId.js";
8
- import IconCheckSmall from "../../components/icons/check-small.js";
9
- import IconCollapse from "../../components/icons/collapse.js";
10
10
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
11
- export const PREDEFINED_COLORS = ['#0091dc', '#333333', '#ffffff', '#f0f2f3', '#e2e5e8', '#d3d8dd', '#b6bec6', '#80ca3d', '#ffd600', '#ff9600', '#d50000'];
11
+ export const PREDEFINED_COLORS = ["#0091dc", "#333333", "#ffffff", "#f0f2f3", "#e2e5e8", "#d3d8dd", "#b6bec6", "#80ca3d", "#ffd600", "#ff9600", "#d50000"];
12
12
  function ColorPicker(_ref) {
13
13
  let {
14
14
  palette = PREDEFINED_COLORS,
15
15
  useAlpha = false,
16
16
  alpha = 100,
17
17
  paletteOnly,
18
- color = '#FFFFFF',
18
+ color = "#FFFFFF",
19
19
  onChange,
20
20
  onAlphaChange,
21
21
  className
@@ -34,7 +34,7 @@ function ColorPicker(_ref) {
34
34
  const [greenInput, setGreenInput] = useState(initialRgb?.g || 255);
35
35
  const [blueInput, setBlueInput] = useState(initialRgb?.b || 255);
36
36
  const [hexInputColor, setHexInputColor] = useState(color);
37
- const [inputType, setInputType] = useState('RGB');
37
+ const [inputType, setInputType] = useState("RGB");
38
38
  const [selectOpen, setSelectOpen] = useState(false);
39
39
  const [innerAlpha, setInnerAlpha] = useState(alpha);
40
40
  const [changeColor, setChangeColor] = useState(true);
@@ -124,7 +124,7 @@ function ColorPicker(_ref) {
124
124
  updateAlpha(data.y);
125
125
  }
126
126
  const updateColorRgb = newColor => {
127
- const currentColor = newColor || '#FFFFFF';
127
+ const currentColor = newColor || "#FFFFFF";
128
128
  updateInputs(currentColor);
129
129
  const rgb = ColorHelper.hexToRgb(currentColor);
130
130
  setChangeColor(false);
@@ -151,22 +151,22 @@ function ColorPicker(_ref) {
151
151
  }
152
152
  }
153
153
  function onRgbBlur(channel) {
154
- let currentInput = '';
154
+ let currentInput = "";
155
155
  switch (channel) {
156
- case 'r':
156
+ case "r":
157
157
  currentInput = redInput;
158
158
  break;
159
- case 'g':
159
+ case "g":
160
160
  currentInput = greenInput;
161
161
  break;
162
- case 'b':
162
+ case "b":
163
163
  currentInput = blueInput;
164
164
  break;
165
165
  default:
166
166
  // no other value possible
167
167
  }
168
- if (typeof currentInput !== 'number' || typeof currentInput === 'number' && currentInput > 255 && currentInput < 0) {
169
- const rgb = ColorHelper.hexToRgb(innerColor || '#FFFFFF');
168
+ if (typeof currentInput !== "number" || typeof currentInput === "number" && currentInput > 255 && currentInput < 0) {
169
+ const rgb = ColorHelper.hexToRgb(innerColor || "#FFFFFF");
170
170
  if (rgb) {
171
171
  const newHexColor = ColorHelper.rgbToHex(rgb);
172
172
  updateInputs(newHexColor);
@@ -176,20 +176,20 @@ function ColorPicker(_ref) {
176
176
  function onRgbInput(_value, channel) {
177
177
  const numberValue = Number.parseInt(_value, 10);
178
178
  switch (channel) {
179
- case 'r':
179
+ case "r":
180
180
  setRedInput(_value);
181
181
  break;
182
- case 'g':
182
+ case "g":
183
183
  setGreenInput(_value);
184
184
  break;
185
- case 'b':
185
+ case "b":
186
186
  setBlueInput(_value);
187
187
  break;
188
188
  default:
189
189
  // no other value possible
190
190
  }
191
191
  if (numberValue <= 255 && numberValue >= 0) {
192
- const rgb = ColorHelper.hexToRgb(innerColor || '#FFFFFF');
192
+ const rgb = ColorHelper.hexToRgb(innerColor || "#FFFFFF");
193
193
  if (rgb) {
194
194
  rgb[channel] = numberValue;
195
195
  const newHexColor = ColorHelper.rgbToHex(rgb);
@@ -217,8 +217,8 @@ function ColorPicker(_ref) {
217
217
  }
218
218
  }
219
219
  return /*#__PURE__*/_jsxs("div", {
220
- className: classNames('fwe-color-picker', {
221
- 'fwe-alpha-active': useAlpha
220
+ className: classNames("fwe-color-picker", {
221
+ "fwe-alpha-active": useAlpha
222
222
  }, className),
223
223
  children: [!paletteOnly && /*#__PURE__*/_jsxs("div", {
224
224
  className: "fwe-d-flex",
@@ -381,22 +381,22 @@ function ColorPicker(_ref) {
381
381
  }), selectOpen && /*#__PURE__*/_jsxs("div", {
382
382
  className: "fwe-popover",
383
383
  children: [/*#__PURE__*/_jsxs("div", {
384
- className: classNames('fwe-type-item', {
385
- 'fwe-selected': inputType === 'HEX'
384
+ className: classNames("fwe-type-item", {
385
+ "fwe-selected": inputType === "HEX"
386
386
  }),
387
- onClick: () => onChangeType('HEX'),
387
+ onClick: () => onChangeType("HEX"),
388
388
  children: [/*#__PURE__*/_jsx(IconCheckSmall, {}), " HEX"]
389
389
  }), /*#__PURE__*/_jsxs("div", {
390
- className: classNames('fwe-type-item', {
391
- 'fwe-selected': inputType === 'RGB'
390
+ className: classNames("fwe-type-item", {
391
+ "fwe-selected": inputType === "RGB"
392
392
  }),
393
- onClick: () => onChangeType('RGB'),
393
+ onClick: () => onChangeType("RGB"),
394
394
  children: [/*#__PURE__*/_jsx(IconCheckSmall, {}), " RGB"]
395
395
  })]
396
396
  })]
397
397
  }), /*#__PURE__*/_jsxs("div", {
398
398
  className: "fwe-d-flex",
399
- children: [inputType === 'HEX' && /*#__PURE__*/_jsx("label", {
399
+ children: [inputType === "HEX" && /*#__PURE__*/_jsx("label", {
400
400
  "aria-label": "Hexadecimal Color",
401
401
  className: "fwe-input-text fwe-hex-input",
402
402
  htmlFor: hexId,
@@ -407,7 +407,7 @@ function ColorPicker(_ref) {
407
407
  onChange: onHexInput,
408
408
  id: hexId
409
409
  })
410
- }), inputType === 'RGB' && /*#__PURE__*/_jsxs(_Fragment, {
410
+ }), inputType === "RGB" && /*#__PURE__*/_jsxs(_Fragment, {
411
411
  children: [/*#__PURE__*/_jsx("label", {
412
412
  "aria-label": "RGB Color Red",
413
413
  className: "fwe-input-text fwe-red-input",
@@ -415,8 +415,8 @@ function ColorPicker(_ref) {
415
415
  children: /*#__PURE__*/_jsx("input", {
416
416
  type: "text",
417
417
  value: redInput,
418
- onBlur: () => onRgbBlur('r'),
419
- onChange: e => onRgbInput(e.target.value, 'r'),
418
+ onBlur: () => onRgbBlur("r"),
419
+ onChange: e => onRgbInput(e.target.value, "r"),
420
420
  id: redId
421
421
  })
422
422
  }), /*#__PURE__*/_jsx("label", {
@@ -426,8 +426,8 @@ function ColorPicker(_ref) {
426
426
  children: /*#__PURE__*/_jsx("input", {
427
427
  type: "text",
428
428
  value: greenInput,
429
- onBlur: () => onRgbBlur('g'),
430
- onChange: e => onRgbInput(e.target.value, 'g'),
429
+ onBlur: () => onRgbBlur("g"),
430
+ onChange: e => onRgbInput(e.target.value, "g"),
431
431
  id: greenId
432
432
  })
433
433
  }), /*#__PURE__*/_jsx("label", {
@@ -437,8 +437,8 @@ function ColorPicker(_ref) {
437
437
  children: /*#__PURE__*/_jsx("input", {
438
438
  type: "text",
439
439
  value: blueInput,
440
- onBlur: () => onRgbBlur('b'),
441
- onChange: e => onRgbInput(e.target.value, 'b'),
440
+ onBlur: () => onRgbBlur("b"),
441
+ onChange: e => onRgbInput(e.target.value, "b"),
442
442
  id: blueId
443
443
  })
444
444
  })]
@@ -523,12 +523,12 @@ function ColorPicker(_ref) {
523
523
  })]
524
524
  }), /*#__PURE__*/_jsx(IconCheckSmall, {
525
525
  className: classNames({
526
- 'fwe-color-text': !innerColor
526
+ "fwe-color-text": !innerColor
527
527
  })
528
528
  })]
529
529
  }), palette.map(colorItem => {
530
- const itemClasses = classNames('fwe-color-item', {
531
- 'fwe-white-item': colorItem.toUpperCase() === '#FFFFFF'
530
+ const itemClasses = classNames("fwe-color-item", {
531
+ "fwe-white-item": colorItem.toUpperCase() === "#FFFFFF"
532
532
  });
533
533
  return /*#__PURE__*/_jsx("div", {
534
534
  className: itemClasses,
@@ -1,5 +1,5 @@
1
- import { ClassNamePropsWithChildren } from '../../helper/types';
2
- import './DatePicker.scss';
1
+ import type { ClassNamePropsWithChildren } from "../../helper/types";
2
+ import "./DatePicker.scss";
3
3
  export interface DatePickerOptions {
4
4
  maxDate?: Date;
5
5
  minDate?: Date;
@@ -1,6 +1,7 @@
1
- import { useEffect, useRef, useState } from 'react';
2
- import classNames from 'classnames';
3
- import flatpickr from 'flatpickr';
1
+ import { useEffect, useRef, useState } from "react";
2
+ import classNames from "classnames";
3
+ import flatpickr from "flatpickr";
4
+ import { IconCalendar } from "@festo-ui/react-icons";
4
5
  import useId from "../../helper/useId.js";
5
6
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
6
7
  function DatePicker(_ref) {
@@ -58,7 +59,7 @@ function DatePicker(_ref) {
58
59
  defaultDate: innerDefaultValue,
59
60
  onChange: v => handleChange(v[0]),
60
61
  onClose: handleClose,
61
- position: 'below center',
62
+ position: "below center",
62
63
  formatDate,
63
64
  closeOnSelect: !keepOpenOnDateChange ?? true,
64
65
  clickOpens: false,
@@ -73,12 +74,12 @@ function DatePicker(_ref) {
73
74
  }
74
75
  }, [calendar]);
75
76
  const handleKeyDown = event => {
76
- if (event.key === 'Enter') {
77
+ if (event.key === "Enter") {
77
78
  toggle();
78
79
  }
79
80
  };
80
81
  const handleKeyUp = event => {
81
- if (event.key === ' ') {
82
+ if (event.key === " ") {
82
83
  toggle();
83
84
  }
84
85
  };
@@ -89,12 +90,12 @@ function DatePicker(_ref) {
89
90
  onKeyDown: handleKeyDown,
90
91
  onKeyUp: handleKeyUp,
91
92
  children: /*#__PURE__*/_jsxs("label", {
92
- className: classNames('fwe-input-text fwe-input-text-icon', className),
93
+ className: classNames("fwe-input-text fwe-input-text-icon", className),
93
94
  htmlFor: id,
94
- children: [/*#__PURE__*/_jsx("i", {
95
- className: classNames('fwe-icon fwe-icon-time-calendar', {
96
- 'fwe-color-hero': open && !disabled,
97
- 'fwe-color-control-disabled': disabled
95
+ children: [/*#__PURE__*/_jsx(IconCalendar, {
96
+ className: classNames({
97
+ "fwe-color-hero": open && !disabled,
98
+ "fwe-color-control-disabled": disabled
98
99
  })
99
100
  }), /*#__PURE__*/_jsx("input", {
100
101
  id: id,
@@ -103,8 +104,8 @@ function DatePicker(_ref) {
103
104
  type: "text",
104
105
  readOnly: true,
105
106
  required: required,
106
- className: classNames('fr-date-picker', {
107
- 'fwe-border-hero': open && !disabled
107
+ className: classNames("fr-date-picker", {
108
+ "fwe-border-hero": open && !disabled
108
109
  }),
109
110
  disabled: disabled
110
111
  }), /*#__PURE__*/_jsx("span", {
@@ -1,5 +1,5 @@
1
- import { ClassNamePropsWithChildren } from '../../helper/types';
2
- import './DateRangePicker.scss';
1
+ import type { ClassNamePropsWithChildren } from "../../helper/types";
2
+ import "./DateRangePicker.scss";
3
3
  export interface DatePickerOptions {
4
4
  maxDate?: Date;
5
5
  minDate?: Date;
@@ -1,7 +1,8 @@
1
- import classNames from 'classnames';
2
- import flatpickr from 'flatpickr';
3
- import rangePlugin from 'flatpickr/dist/plugins/rangePlugin.js';
4
- import { useEffect, useRef, useState } from 'react';
1
+ import classNames from "classnames";
2
+ import flatpickr from "flatpickr";
3
+ import rangePlugin from "flatpickr/dist/plugins/rangePlugin.js";
4
+ import { useEffect, useRef, useState } from "react";
5
+ import { IconCalendar } from "@festo-ui/react-icons";
5
6
  import useId from "../../helper/useId.js";
6
7
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
7
8
  function DateRangePicker(_ref) {
@@ -50,7 +51,7 @@ function DateRangePicker(_ref) {
50
51
  input: input2Ref.current
51
52
  })],
52
53
  onChange: v => handleChange(v),
53
- position: 'below center',
54
+ position: "below center",
54
55
  positionElement: containerRef.current,
55
56
  formatDate,
56
57
  closeOnSelect: !options?.keepOpenOnDateChange ?? true,
@@ -67,29 +68,29 @@ function DateRangePicker(_ref) {
67
68
  }
68
69
  }, [calendar]);
69
70
  const handleKeyDown = event => {
70
- if (event.key === 'Enter') {
71
+ if (event.key === "Enter") {
71
72
  toggle();
72
73
  }
73
74
  };
74
75
  const handleKeyUp = event => {
75
- if (event.key === ' ') {
76
+ if (event.key === " ") {
76
77
  toggle();
77
78
  }
78
79
  };
79
80
  return /*#__PURE__*/_jsx("div", {
80
81
  tabIndex: 0,
81
82
  role: "button",
82
- className: classNames('fr-date-range-picker', className),
83
+ className: classNames("fr-date-range-picker", className),
83
84
  onClick: toggle,
84
85
  onKeyDown: handleKeyDown,
85
86
  onKeyUp: handleKeyUp,
86
87
  children: /*#__PURE__*/_jsxs("label", {
87
88
  className: "fwe-input-text fwe-input-text-icon",
88
89
  htmlFor: id,
89
- children: [/*#__PURE__*/_jsx("i", {
90
- className: classNames('fwe-icon fwe-icon-time-calendar', {
91
- 'fwe-color-hero': open && !disabled,
92
- 'fwe-color-control-disabled': disabled
90
+ children: [/*#__PURE__*/_jsx(IconCalendar, {
91
+ className: classNames({
92
+ "fwe-color-hero": open && !disabled,
93
+ "fwe-color-control-disabled": disabled
93
94
  })
94
95
  }), /*#__PURE__*/_jsxs("div", {
95
96
  ref: containerRef,
@@ -101,7 +102,7 @@ function DateRangePicker(_ref) {
101
102
  readOnly: true,
102
103
  required: required,
103
104
  className: classNames({
104
- 'fwe-border-hero': open && !disabled
105
+ "fwe-border-hero": open && !disabled
105
106
  }),
106
107
  disabled: disabled,
107
108
  id: id
@@ -112,13 +113,13 @@ function DateRangePicker(_ref) {
112
113
  readOnly: true,
113
114
  required: required,
114
115
  className: classNames({
115
- 'fwe-border-hero': open && !disabled
116
+ "fwe-border-hero": open && !disabled
116
117
  }),
117
118
  disabled: disabled
118
119
  })]
119
120
  }), /*#__PURE__*/_jsx("span", {
120
- className: classNames('fwe-input-text-label', {
121
- 'fwe-color-text-disabled': disabled
121
+ className: classNames("fwe-input-text-label", {
122
+ "fwe-color-text-disabled": disabled
122
123
  }),
123
124
  children: children
124
125
  }), hint && /*#__PURE__*/_jsx("span", {
@@ -1,6 +1,7 @@
1
1
  /* eslint-disable jsx-a11y/no-static-element-interactions */
2
2
  /* eslint-disable jsx-a11y/click-events-have-key-events */
3
- import IconCloseSmall from "../../../components/icons/close-small.js";
3
+
4
+ import { IconCloseSmall } from "@festo-ui/react-icons";
4
5
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
5
6
  export default function SelectButtonContent(_ref) {
6
7
  let {
@@ -1,6 +1,7 @@
1
- import React, { ComponentPropsWithoutRef } from 'react';
1
+ import type React from "react";
2
+ import { type ComponentPropsWithoutRef } from "react";
2
3
  export interface TimePickerOptions {
3
- timeFormat?: '12' | '24';
4
+ timeFormat?: "12" | "24";
4
5
  showSeconds?: boolean;
5
6
  minuteStepSize?: number;
6
7
  range?: {
@@ -8,7 +9,7 @@ export interface TimePickerOptions {
8
9
  maxValue: Date;
9
10
  };
10
11
  }
11
- export interface TimePickerProps extends Omit<ComponentPropsWithoutRef<'div'>, 'value' | 'defaultValue' | 'onChange'> {
12
+ export interface TimePickerProps extends Omit<ComponentPropsWithoutRef<"div">, "value" | "defaultValue" | "onChange"> {
12
13
  error?: string;
13
14
  hint?: string;
14
15
  required?: boolean;
@@ -1,7 +1,8 @@
1
- import cn from 'classnames';
2
- import React, { forwardRef, useMemo, useRef, useState, useEffect } from 'react';
3
- import ReactDOM from 'react-dom';
4
- import { usePopper } from 'react-popper';
1
+ import cn from "classnames";
2
+ import { forwardRef, useMemo, useRef, useState, useEffect } from "react";
3
+ import ReactDOM from "react-dom";
4
+ import { usePopper } from "react-popper";
5
+ import { IconTime } from "@festo-ui/react-icons";
5
6
  import useForkRef from "../../helper/useForkRef.js";
6
7
  import useId from "../../helper/useId.js";
7
8
  import TimePickerDropdown from "./time-picker-dropdown/TimePickerDropdown.js";
@@ -22,24 +23,24 @@ const TimePicker = /*#__PURE__*/forwardRef((_ref, ref) => {
22
23
  ...props
23
24
  } = _ref;
24
25
  const id = useId(idProps);
25
- const innerFormatDate = formatDate ?? Intl.DateTimeFormat('default', {
26
- hour: 'numeric',
27
- minute: 'numeric',
26
+ const innerFormatDate = formatDate ?? Intl.DateTimeFormat("default", {
27
+ hour: "numeric",
28
+ minute: "numeric",
28
29
  ...(options?.showSeconds && {
29
- second: 'numeric'
30
+ second: "numeric"
30
31
  })
31
32
  }).format;
32
- const timeFormat = options?.timeFormat ?? '24';
33
+ const timeFormat = options?.timeFormat ?? "24";
33
34
  const [referenceElement, setReferenceElement] = useState(null);
34
35
  const [popperElement, setPopperElement] = useState(null);
35
36
  const customModifier = useMemo(() => ({
36
- name: 'offset',
37
+ name: "offset",
37
38
  options: {
38
39
  offset: _ref2 => {
39
40
  let {
40
41
  placement
41
42
  } = _ref2;
42
- if (placement === 'bottom') {
43
+ if (placement === "bottom") {
43
44
  return [0, -12];
44
45
  }
45
46
  return [0, 0];
@@ -88,12 +89,12 @@ const TimePicker = /*#__PURE__*/forwardRef((_ref, ref) => {
88
89
  setOpen(false);
89
90
  }
90
91
  const handleKeyDown = event => {
91
- if (event.key === 'Enter') {
92
+ if (event.key === "Enter") {
92
93
  toggle();
93
94
  }
94
95
  };
95
96
  const handleKeyUp = event => {
96
- if (event.key === ' ') {
97
+ if (event.key === " ") {
97
98
  toggle();
98
99
  }
99
100
  };
@@ -110,10 +111,10 @@ const TimePicker = /*#__PURE__*/forwardRef((_ref, ref) => {
110
111
  children: /*#__PURE__*/_jsxs("label", {
111
112
  htmlFor: id,
112
113
  className: "fr-time-picker fwe-input-text fwe-input-text-icon",
113
- children: [/*#__PURE__*/_jsx("i", {
114
- className: cn('fwe-icon fwe-icon-time-time', {
115
- 'fwe-color-hero': open,
116
- 'fwe-color-control-disabled': disabled
114
+ children: [/*#__PURE__*/_jsx(IconTime, {
115
+ className: cn({
116
+ "fwe-color-hero": open && !disabled,
117
+ "fwe-color-control-disabled": disabled
117
118
  })
118
119
  }), /*#__PURE__*/_jsx("input", {
119
120
  id: id,
@@ -122,7 +123,7 @@ const TimePicker = /*#__PURE__*/forwardRef((_ref, ref) => {
122
123
  readOnly: true,
123
124
  required: required,
124
125
  className: cn({
125
- 'fwe-border-hero': open
126
+ "fwe-border-hero": open
126
127
  }),
127
128
  value: innerFormatDate(innerValue),
128
129
  disabled: disabled
@@ -1,7 +1,8 @@
1
- import './TimePickerDropdown.scss';
2
- import React, { RefObject } from 'react';
1
+ import "./TimePickerDropdown.scss";
2
+ import type React from "react";
3
+ import { type RefObject } from "react";
3
4
  interface TimePickerDropdownProps {
4
- timeFormat: '12' | '24';
5
+ timeFormat: "12" | "24";
5
6
  date: Date;
6
7
  onDateChange: (date: Date) => void;
7
8
  showSeconds?: boolean;
@@ -1,11 +1,10 @@
1
- import cn from 'classnames';
2
- import React, { forwardRef, useEffect, useRef, useState } from 'react';
1
+ import cn from "classnames";
2
+ import { forwardRef, useEffect, useRef, useState } from "react";
3
+ import { IconCollapse, IconExpand } from "@festo-ui/react-icons";
3
4
  import useForkRef from "../../../helper/useForkRef.js";
4
5
  import LinkButton from "../../../components/link-button/LinkButton.js";
5
6
  import TimePickerInput from "./TimePickerInput.js";
6
7
  import useOnClickOutside from "../../../helper/useOnClickOutside.js";
7
- import IconCollapse from "../../../components/icons/collapse.js";
8
- import IconExpand from "../../../components/icons/expand.js";
9
8
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
10
9
  const TimePickerDropdown = /*#__PURE__*/forwardRef((_ref, ref) => {
11
10
  let {
@@ -28,7 +27,7 @@ const TimePickerDropdown = /*#__PURE__*/forwardRef((_ref, ref) => {
28
27
  const [innerDate, setInnerDate] = useState(date);
29
28
  useOnClickOutside(labelRef, () => onClose(innerDate), innerRef);
30
29
  const min = 0;
31
- const hourMax = timeFormat === '12' ? 12 : 23;
30
+ const hourMax = timeFormat === "12" ? 12 : 23;
32
31
  const minutesSecondsMax = 59;
33
32
  let innerMinuteStepSize = 1;
34
33
  if (minuteStepSize) {
@@ -42,8 +41,8 @@ const TimePickerDropdown = /*#__PURE__*/forwardRef((_ref, ref) => {
42
41
  });
43
42
  }, []);
44
43
  function handleKeyPress(e) {
45
- if (e.key === 'Escape' || e.key === 'Enter') {
46
- onClose(e.key === 'Enter' ? innerDate : undefined);
44
+ if (e.key === "Escape" || e.key === "Enter") {
45
+ onClose(e.key === "Enter" ? innerDate : undefined);
47
46
  }
48
47
  }
49
48
  function limitRange(newDate) {
@@ -105,7 +104,7 @@ const TimePickerDropdown = /*#__PURE__*/forwardRef((_ref, ref) => {
105
104
  setInnerDate(newDate);
106
105
  setTmpSeconds(newDate.getSeconds().toString());
107
106
  }
108
- const hours = timeFormat === '12' ? (innerDate.getHours() + 11) % 12 + 1 : innerDate.getHours();
107
+ const hours = timeFormat === "12" ? (innerDate.getHours() + 11) % 12 + 1 : innerDate.getHours();
109
108
  function toggleAmPm() {
110
109
  const newDate = new Date(innerDate);
111
110
  // Get the current hour in 24-hour format
@@ -120,7 +119,7 @@ const TimePickerDropdown = /*#__PURE__*/forwardRef((_ref, ref) => {
120
119
  setInnerDate(newDate);
121
120
  onDateChange(newDate);
122
121
  }
123
- const formatNumberWithLeadingZero = number => (number < 10 ? '0' : '') + number;
122
+ const formatNumberWithLeadingZero = number => (number < 10 ? "0" : "") + number;
124
123
  return (
125
124
  /*#__PURE__*/
126
125
  // should not be an issue with dialog
@@ -129,8 +128,8 @@ const TimePickerDropdown = /*#__PURE__*/forwardRef((_ref, ref) => {
129
128
  role: "dialog",
130
129
  style: style,
131
130
  ref: combinedRef,
132
- className: cn('fr-timepicker fwe-timepicker', {
133
- 'fwe-timepicker-am-pm': timeFormat === '12'
131
+ className: cn("fr-timepicker fwe-timepicker", {
132
+ "fwe-timepicker-am-pm": timeFormat === "12"
134
133
  }),
135
134
  onKeyDown: e => handleKeyPress(e),
136
135
  tabIndex: -1,
@@ -201,11 +200,11 @@ const TimePickerDropdown = /*#__PURE__*/forwardRef((_ref, ref) => {
201
200
  icon: /*#__PURE__*/_jsx(IconCollapse, {})
202
201
  })]
203
202
  })]
204
- }), timeFormat === '12' && /*#__PURE__*/_jsx("button", {
203
+ }), timeFormat === "12" && /*#__PURE__*/_jsx("button", {
205
204
  onClick: toggleAmPm,
206
205
  type: "button",
207
206
  className: "fwe-btn fwe-ml-m",
208
- children: innerDate.getHours() >= 12 ? 'PM' : 'AM'
207
+ children: innerDate.getHours() >= 12 ? "PM" : "AM"
209
208
  })]
210
209
  })
211
210
  );