colibri-ui 0.8.83 → 0.8.86

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 (249) hide show
  1. package/Accordion/Accordion.module.css +4 -0
  2. package/Accordion/index.js +15 -23
  3. package/Autocomplete/Autocomplete.js +101 -132
  4. package/Avatar/Avatar.module.css +6 -0
  5. package/Avatar/index.js +102 -89
  6. package/Badge/Badge.module.css +2 -1
  7. package/Badge/Control/index.js +5 -3
  8. package/Badge/index.js +16 -16
  9. package/Button/index.js +23 -20
  10. package/Button/tokens.js +2 -2
  11. package/Calendar/Calendar.js +171 -269
  12. package/Card/Card.js +26 -32
  13. package/Checkbox/index.js +46 -43
  14. package/Chip/Chip.module.css +2 -1
  15. package/Chip/index.js +15 -15
  16. package/ClickOutside/index.js +10 -13
  17. package/CodeField/CodeField.js +113 -170
  18. package/Counter/Counter.module.css +2 -1
  19. package/Counter/index.js +21 -20
  20. package/Datepicker/components/DatePicker/index.js +81 -102
  21. package/Datepicker/index.js +17 -16
  22. package/DotsLoader/index.js +23 -15
  23. package/Drawer/Drawer.js +75 -97
  24. package/Drawer/Drawer.module.css +2 -1
  25. package/Dropdown/index.js +55 -68
  26. package/Dropzone/Dropzone.js +78 -168
  27. package/Dropzone/Dropzone.module.css +2 -1
  28. package/Editable/Editable.js +44 -57
  29. package/Grid/Item/index.js +11 -13
  30. package/Grid/index.js +15 -21
  31. package/Icons/ArrowNext.js +7 -8
  32. package/Icons/Cart.js +7 -8
  33. package/Icons/Check.js +7 -8
  34. package/Icons/Chevron.js +7 -8
  35. package/Icons/Close.js +6 -6
  36. package/Icons/Copy.js +7 -8
  37. package/Icons/Cross.js +6 -6
  38. package/Icons/CrossFill.js +7 -8
  39. package/Icons/Edit.js +7 -8
  40. package/Icons/Exit.js +7 -8
  41. package/Icons/EyeClosed.js +7 -8
  42. package/Icons/EyeOpen.js +7 -8
  43. package/Icons/Help.js +6 -6
  44. package/Icons/Info.js +7 -8
  45. package/Icons/Minus.js +7 -8
  46. package/Icons/More.js +7 -8
  47. package/Icons/Plus.js +7 -8
  48. package/Icons/Setting.js +7 -8
  49. package/Icons/Shield.js +7 -8
  50. package/Icons/Trash.js +7 -8
  51. package/Icons/User.js +7 -8
  52. package/Image/Image.module.css +4 -0
  53. package/Image/index.d.ts +1 -1
  54. package/Image/index.js +44 -37
  55. package/Input/index.d.ts +1 -1
  56. package/Input/index.js +38 -25
  57. package/Input/index.props.d.ts +1 -1
  58. package/InputRadio/index.js +32 -24
  59. package/List/List.js +81 -76
  60. package/Menu/Menu.module.css +2 -1
  61. package/Menu/components/MenuItem/index.js +17 -14
  62. package/Menu/index.js +22 -23
  63. package/Modal/components/Body/index.js +9 -8
  64. package/Modal/components/Close/Close.module.css +4 -0
  65. package/Modal/components/Close/index.js +13 -14
  66. package/Modal/components/Content/index.js +5 -6
  67. package/Modal/components/Footer/index.js +5 -3
  68. package/Modal/components/Header/index.js +13 -12
  69. package/Modal/components/Title/index.js +10 -9
  70. package/Modal/context.js +3 -3
  71. package/Modal/index.js +46 -68
  72. package/MultiSelect/components/MenuOverlay/index.js +48 -61
  73. package/MultiSelect/components/MenuOverlayItem/index.js +13 -14
  74. package/MultiSelect/index.js +72 -100
  75. package/MultiSelect/index.module.css +2 -1
  76. package/MultiSelect/utils/index.js +8 -18
  77. package/NumberInput/NumberInput.js +80 -112
  78. package/Portal/index.js +6 -10
  79. package/Progress/Progress.js +45 -58
  80. package/RadioGroup/Radio.js +29 -32
  81. package/RadioGroup/index.js +43 -46
  82. package/Rating/Rating.js +50 -63
  83. package/Select/components/MenuOverlay/index.js +16 -25
  84. package/Select/components/MenuOverlayItem/index.js +13 -11
  85. package/Select/index.js +39 -48
  86. package/Select/index.module.css +2 -1
  87. package/Separator/index.js +5 -6
  88. package/Sheet/Sheet.js +89 -121
  89. package/Sheet/Sheet.module.css +4 -2
  90. package/Skeleton/index.js +25 -30
  91. package/Slider/Slider.js +83 -119
  92. package/Status/index.js +17 -18
  93. package/Switch/Switch.module.css +2 -1
  94. package/Switch/index.js +22 -15
  95. package/TabsMenu/Tab/Tab.js +14 -10
  96. package/TabsMenu/Tab/Tab.module.css +2 -1
  97. package/TabsMenu/index.js +25 -26
  98. package/TabsPanels/Panel/index.js +6 -4
  99. package/TabsPanels/index.js +13 -10
  100. package/TextArea/index.d.ts +1 -1
  101. package/TextArea/index.js +31 -19
  102. package/Theme/breakpoints.js +5 -11
  103. package/Theme/colors/theme_buenos_aires.js +14 -14
  104. package/Theme/colors/theme_jaipur.js +14 -14
  105. package/Theme/global.css +0 -1
  106. package/Theme/index.js +1 -1
  107. package/TimeSelect/Label/index.js +11 -13
  108. package/TimeSelect/helpers.js +23 -42
  109. package/TimeSelect/index.js +32 -38
  110. package/Tooltip/index.js +36 -42
  111. package/Typography/index.js +17 -13
  112. package/Typography/index.props.d.ts +3 -0
  113. package/base/BaseInput/index.js +10 -8
  114. package/base/FormField/index.d.ts +1 -1
  115. package/base/FormField/index.js +27 -22
  116. package/base/FormField/index.props.d.ts +4 -0
  117. package/base/InputRoot/index.js +27 -27
  118. package/esm/Accordion/Accordion.module.css +4 -0
  119. package/esm/Accordion/index.js +15 -21
  120. package/esm/Autocomplete/Autocomplete.js +101 -130
  121. package/esm/Avatar/Avatar.module.css +6 -0
  122. package/esm/Avatar/index.js +102 -88
  123. package/esm/Badge/Badge.module.css +2 -1
  124. package/esm/Badge/Control/index.js +5 -3
  125. package/esm/Badge/index.js +16 -15
  126. package/esm/Button/index.js +23 -19
  127. package/esm/Button/tokens.js +2 -2
  128. package/esm/Calendar/Calendar.js +171 -267
  129. package/esm/Card/Card.js +26 -32
  130. package/esm/Checkbox/index.js +46 -42
  131. package/esm/Chip/Chip.module.css +2 -1
  132. package/esm/Chip/index.js +15 -14
  133. package/esm/ClickOutside/index.js +10 -13
  134. package/esm/CodeField/CodeField.js +113 -169
  135. package/esm/Counter/Counter.module.css +2 -1
  136. package/esm/Counter/index.js +21 -19
  137. package/esm/Datepicker/components/DatePicker/index.js +81 -101
  138. package/esm/Datepicker/index.js +17 -16
  139. package/esm/DotsLoader/index.js +23 -14
  140. package/esm/Drawer/Drawer.js +75 -96
  141. package/esm/Drawer/Drawer.module.css +2 -1
  142. package/esm/Dropdown/index.js +55 -66
  143. package/esm/Dropzone/Dropzone.js +78 -165
  144. package/esm/Dropzone/Dropzone.module.css +2 -1
  145. package/esm/Editable/Editable.js +44 -56
  146. package/esm/Grid/Item/index.js +11 -12
  147. package/esm/Grid/index.js +15 -21
  148. package/esm/Icons/ArrowNext.js +7 -8
  149. package/esm/Icons/Cart.js +7 -8
  150. package/esm/Icons/Check.js +7 -8
  151. package/esm/Icons/Chevron.js +7 -8
  152. package/esm/Icons/Close.js +6 -6
  153. package/esm/Icons/Copy.js +7 -8
  154. package/esm/Icons/Cross.js +6 -6
  155. package/esm/Icons/CrossFill.js +7 -8
  156. package/esm/Icons/Edit.js +7 -8
  157. package/esm/Icons/Exit.js +7 -8
  158. package/esm/Icons/EyeClosed.js +7 -8
  159. package/esm/Icons/EyeOpen.js +7 -8
  160. package/esm/Icons/Help.js +6 -6
  161. package/esm/Icons/Info.js +7 -8
  162. package/esm/Icons/Minus.js +7 -8
  163. package/esm/Icons/More.js +7 -8
  164. package/esm/Icons/Plus.js +7 -8
  165. package/esm/Icons/Setting.js +7 -8
  166. package/esm/Icons/Shield.js +7 -8
  167. package/esm/Icons/Trash.js +7 -8
  168. package/esm/Icons/User.js +7 -8
  169. package/esm/Image/Image.module.css +4 -0
  170. package/esm/Image/index.d.ts +1 -1
  171. package/esm/Image/index.js +44 -36
  172. package/esm/Input/index.d.ts +1 -1
  173. package/esm/Input/index.js +39 -26
  174. package/esm/Input/index.props.d.ts +1 -1
  175. package/esm/InputRadio/index.js +32 -23
  176. package/esm/List/List.js +81 -75
  177. package/esm/Menu/Menu.module.css +2 -1
  178. package/esm/Menu/components/MenuItem/index.js +17 -13
  179. package/esm/Menu/index.js +22 -23
  180. package/esm/Modal/components/Body/index.js +9 -7
  181. package/esm/Modal/components/Close/Close.module.css +4 -0
  182. package/esm/Modal/components/Close/index.js +13 -14
  183. package/esm/Modal/components/Content/index.js +5 -6
  184. package/esm/Modal/components/Footer/index.js +5 -3
  185. package/esm/Modal/components/Header/index.js +13 -11
  186. package/esm/Modal/components/Title/index.js +10 -9
  187. package/esm/Modal/context.js +3 -3
  188. package/esm/Modal/index.js +50 -70
  189. package/esm/MultiSelect/components/MenuOverlay/index.js +48 -60
  190. package/esm/MultiSelect/components/MenuOverlayItem/index.js +13 -14
  191. package/esm/MultiSelect/index.js +72 -97
  192. package/esm/MultiSelect/index.module.css +2 -1
  193. package/esm/MultiSelect/utils/index.js +8 -14
  194. package/esm/NumberInput/NumberInput.js +80 -111
  195. package/esm/Portal/index.js +6 -9
  196. package/esm/Progress/Progress.js +45 -58
  197. package/esm/RadioGroup/Radio.js +29 -32
  198. package/esm/RadioGroup/index.js +43 -45
  199. package/esm/Rating/Rating.js +50 -63
  200. package/esm/Select/components/MenuOverlay/index.js +16 -24
  201. package/esm/Select/components/MenuOverlayItem/index.js +13 -11
  202. package/esm/Select/index.js +39 -46
  203. package/esm/Select/index.module.css +2 -1
  204. package/esm/Separator/index.js +5 -6
  205. package/esm/Sheet/Sheet.js +89 -119
  206. package/esm/Sheet/Sheet.module.css +4 -2
  207. package/esm/Skeleton/index.js +25 -30
  208. package/esm/Slider/Slider.js +83 -119
  209. package/esm/Status/index.js +17 -17
  210. package/esm/Switch/Switch.module.css +2 -1
  211. package/esm/Switch/index.js +22 -14
  212. package/esm/TabsMenu/Tab/Tab.js +14 -9
  213. package/esm/TabsMenu/Tab/Tab.module.css +2 -1
  214. package/esm/TabsMenu/index.js +25 -26
  215. package/esm/TabsPanels/Panel/index.js +6 -4
  216. package/esm/TabsPanels/index.js +13 -10
  217. package/esm/TextArea/index.d.ts +1 -1
  218. package/esm/TextArea/index.js +32 -20
  219. package/esm/Theme/breakpoints.js +5 -11
  220. package/esm/Theme/colors/theme_buenos_aires.js +14 -14
  221. package/esm/Theme/colors/theme_jaipur.js +14 -14
  222. package/esm/Theme/global.css +0 -1
  223. package/esm/Theme/index.js +1 -1
  224. package/esm/TimeSelect/Label/index.js +11 -13
  225. package/esm/TimeSelect/helpers.js +22 -37
  226. package/esm/TimeSelect/index.js +32 -38
  227. package/esm/Tooltip/index.js +36 -41
  228. package/esm/Typography/index.js +17 -12
  229. package/esm/Typography/index.props.d.ts +3 -0
  230. package/esm/base/BaseInput/index.js +10 -8
  231. package/esm/base/FormField/index.d.ts +1 -1
  232. package/esm/base/FormField/index.js +27 -21
  233. package/esm/base/FormField/index.props.d.ts +4 -0
  234. package/esm/base/InputRoot/index.js +27 -26
  235. package/esm/helpers/date/index.js +4 -8
  236. package/esm/hooks/useMediaSizes/index.js +9 -15
  237. package/esm/hooks/useModalStack/index.js +6 -9
  238. package/esm/hooks/useOnClickOutside/index.js +6 -6
  239. package/esm/hooks/useScrollLock/index.js +10 -9
  240. package/esm/hooks/useTrapFocus/index.js +8 -10
  241. package/esm/lib/keyboard.js +2 -4
  242. package/helpers/date/index.js +21 -32
  243. package/hooks/useMediaSizes/index.js +9 -15
  244. package/hooks/useModalStack/index.js +6 -9
  245. package/hooks/useOnClickOutside/index.js +6 -6
  246. package/hooks/useScrollLock/index.js +10 -9
  247. package/hooks/useTrapFocus/index.js +8 -10
  248. package/lib/keyboard.js +2 -4
  249. package/package.json +5 -1
@@ -1,25 +1,30 @@
1
- import _defineProperty from '@babel/runtime/helpers/defineProperty';
2
1
  import { __rest } from 'tslib';
3
2
  import React from 'react';
4
3
  import clsx from 'clsx';
5
4
  import styles from './Typography.module.css';
6
5
 
7
- var Typography = function Typography(_a) {
8
- var _a$tag = _a.tag,
9
- Component = _a$tag === void 0 ? "span" : _a$tag,
10
- children = _a.children,
11
- variant = _a.variant,
12
- size = _a.size,
13
- style = _a.style,
14
- fontWeight = _a.fontWeight,
15
- lines = _a.lines,
16
- className = _a.className,
6
+ const Typography = _a => {
7
+ var {
8
+ tag: Component = "span",
9
+ children,
10
+ variant,
11
+ size,
12
+ style,
13
+ fontWeight,
14
+ lines,
15
+ className
16
+ } = _a,
17
17
  props = __rest(_a, ["tag", "children", "variant", "size", "style", "fontWeight", "lines", "className"]);
18
18
  return /*#__PURE__*/React.createElement(Component, Object.assign({}, props, {
19
19
  style: lines ? Object.assign(Object.assign({}, style), {
20
20
  "--typography-lines": lines
21
21
  }) : Object.assign({}, style),
22
- className: clsx(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, styles["size_".concat(size)], Boolean(size)), styles["font-weight_".concat(fontWeight)], Boolean(fontWeight)), styles["variant_".concat(variant)], Boolean(variant)), styles.clamp, Boolean(lines)), className)
22
+ className: clsx({
23
+ [styles[`size_${size}`]]: Boolean(size),
24
+ [styles[`font-weight_${fontWeight}`]]: Boolean(fontWeight),
25
+ [styles[`variant_${variant}`]]: Boolean(variant),
26
+ [styles.clamp]: Boolean(lines)
27
+ }, className)
23
28
  }), children);
24
29
  };
25
30
 
@@ -5,6 +5,9 @@ export type TypographySize = "xs" | "s" | "m" | "l" | "text-xs" | "text-sm" | "t
5
5
  export type TypographyTag = "span" | "label" | "legend" | "p" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "s";
6
6
  export type TypographyProps = {
7
7
  className?: string;
8
+ /** Associates the text with a form control when `tag` is `label`. */
9
+ htmlFor?: string;
10
+ id?: string;
8
11
  tag?: TypographyTag;
9
12
  variant?: TypographyVariant;
10
13
  size?: TypographySize;
@@ -3,15 +3,17 @@ import React from 'react';
3
3
  import clsx from 'clsx';
4
4
  import styles from './BaseInput.module.css';
5
5
 
6
- var BaseInput = function BaseInput(_a) {
7
- var className = _a.className,
8
- onFocus = _a.onFocus,
9
- onChange = _a.onChange,
10
- onBlur = _a.onBlur,
11
- onKeyDown = _a.onKeyDown,
12
- ref = _a.ref,
6
+ const BaseInput = _a => {
7
+ var {
8
+ className,
9
+ onFocus,
10
+ onChange,
11
+ onBlur,
12
+ onKeyDown,
13
+ ref
14
+ } = _a,
13
15
  props = __rest(_a, ["className", "onFocus", "onChange", "onBlur", "onKeyDown", "ref"]);
14
- var onChangeHandler = function onChangeHandler(e) {
16
+ const onChangeHandler = e => {
15
17
  if (onChange) onChange(e, e.target.value);
16
18
  };
17
19
  return /*#__PURE__*/React.createElement("input", Object.assign({
@@ -1,3 +1,3 @@
1
1
  import React from "react";
2
2
  import type { FormFieldProps } from "./index.props";
3
- export declare const FormField: ({ label, hint, children, hasError, required, className, ref, }: FormFieldProps) => React.JSX.Element;
3
+ export declare const FormField: ({ label, hint, children, hasError, hintId, htmlFor, required, className, ref, }: FormFieldProps) => React.JSX.Element;
@@ -1,28 +1,34 @@
1
- import _defineProperty from '@babel/runtime/helpers/defineProperty';
2
1
  import React from 'react';
3
2
  import clsx from 'clsx';
4
3
  import { Typography } from '../../Typography/index.js';
5
4
  import styles from './FormField.module.css';
6
5
 
7
- var FormField = function FormField(_ref) {
8
- var label = _ref.label,
9
- hint = _ref.hint,
10
- children = _ref.children,
11
- hasError = _ref.hasError,
12
- required = _ref.required,
13
- className = _ref.className,
14
- ref = _ref.ref;
15
- return /*#__PURE__*/React.createElement("div", {
16
- className: clsx(styles.container, className),
17
- ref: ref
18
- }, label && (/*#__PURE__*/React.createElement(Typography, {
19
- className: clsx(styles.label, _defineProperty({}, styles.label_required, Boolean(required))),
20
- tag: "label"
21
- }, label)), children, hint && (/*#__PURE__*/React.createElement(Typography, {
22
- className: clsx(_defineProperty({}, styles.hint_error, hasError)),
23
- variant: hasError ? "alert" : "secondary",
24
- tag: "span"
25
- }, hint)));
26
- };
6
+ const FormField = ({
7
+ label,
8
+ hint,
9
+ children,
10
+ hasError,
11
+ hintId,
12
+ htmlFor,
13
+ required,
14
+ className,
15
+ ref
16
+ }) => (/*#__PURE__*/React.createElement("div", {
17
+ className: clsx(styles.container, className),
18
+ ref: ref
19
+ }, label && (/*#__PURE__*/React.createElement(Typography, {
20
+ className: clsx(styles.label, {
21
+ [styles.label_required]: Boolean(required)
22
+ }),
23
+ tag: "label",
24
+ htmlFor: htmlFor
25
+ }, label)), children, hint && (/*#__PURE__*/React.createElement(Typography, {
26
+ id: hintId,
27
+ className: clsx({
28
+ [styles.hint_error]: hasError
29
+ }),
30
+ variant: hasError ? "alert" : "secondary",
31
+ tag: "span"
32
+ }, hint))));
27
33
 
28
34
  export { FormField };
@@ -4,6 +4,10 @@ export type FormFieldProps = PropsWithChildren<{
4
4
  className?: string;
5
5
  hasError?: boolean;
6
6
  hint?: ReactNode;
7
+ /** Id of the hint, referenced by the control's `aria-describedby`. */
8
+ hintId?: string;
9
+ /** Id of the control the label belongs to. */
10
+ htmlFor?: string;
7
11
  label?: ReactNode;
8
12
  ref?: React.Ref<HTMLDivElement>;
9
13
  required?: boolean;
@@ -1,32 +1,33 @@
1
- import _defineProperty from '@babel/runtime/helpers/defineProperty';
2
1
  import React from 'react';
3
2
  import clsx from 'clsx';
4
3
  import styles from './InputRoot.module.css';
5
4
 
6
- var InputRoot = function InputRoot(_ref) {
7
- var active = _ref.active,
8
- className = _ref.className,
9
- startIcon = _ref.startIcon,
10
- endIcon = _ref.endIcon,
11
- children = _ref.children,
12
- _ref$variant = _ref.variant,
13
- variant = _ref$variant === void 0 ? "primary" : _ref$variant,
14
- disabled = _ref.disabled,
15
- hasError = _ref.hasError,
16
- style = _ref.style,
17
- size = _ref.size,
18
- ref = _ref.ref;
19
- return /*#__PURE__*/React.createElement("div", {
20
- ref: ref,
21
- style: style,
22
- className: clsx(styles.root, styles["variant_".concat(variant)], size && styles["size_".concat(size)], _defineProperty(_defineProperty(_defineProperty({}, styles["variant_".concat(variant, "_active")], active), styles["variant_".concat(variant, "_disabled")], disabled), styles["variant_".concat(variant, "_error")], hasError), className)
23
- }, startIcon && /*#__PURE__*/React.createElement("div", {
24
- className: styles["base-icon"]
25
- }, startIcon), children, endIcon && /*#__PURE__*/React.createElement("div", {
26
- className: styles["base-icon"]
27
- }, endIcon), disabled && /*#__PURE__*/React.createElement("div", {
28
- className: styles["base-disable-wrapper"]
29
- }));
30
- };
5
+ const InputRoot = ({
6
+ active,
7
+ className,
8
+ startIcon,
9
+ endIcon,
10
+ children,
11
+ variant = "primary",
12
+ disabled,
13
+ hasError,
14
+ style,
15
+ size,
16
+ ref
17
+ }) => (/*#__PURE__*/React.createElement("div", {
18
+ ref: ref,
19
+ style: style,
20
+ className: clsx(styles.root, styles[`variant_${variant}`], size && styles[`size_${size}`], {
21
+ [styles[`variant_${variant}_active`]]: active,
22
+ [styles[`variant_${variant}_disabled`]]: disabled,
23
+ [styles[`variant_${variant}_error`]]: hasError
24
+ }, className)
25
+ }, startIcon && /*#__PURE__*/React.createElement("div", {
26
+ className: styles["base-icon"]
27
+ }, startIcon), children, endIcon && /*#__PURE__*/React.createElement("div", {
28
+ className: styles["base-icon"]
29
+ }, endIcon), disabled && /*#__PURE__*/React.createElement("div", {
30
+ className: styles["base-disable-wrapper"]
31
+ })));
31
32
 
32
33
  export { InputRoot };
@@ -2,20 +2,16 @@ import { parseISO, isValid, format } from 'date-fns';
2
2
  import 'date-fns/locale';
3
3
 
4
4
  // Helper to parse date strings with fallback
5
- var parse = function parse(dateInput) {
5
+ const parse = dateInput => {
6
6
  if (!dateInput) {
7
7
  return new Date();
8
8
  }
9
- var date = typeof dateInput === "string" ? parseISO(dateInput) : dateInput;
9
+ const date = typeof dateInput === "string" ? parseISO(dateInput) : dateInput;
10
10
  return isValid(date) ? date : new Date(dateInput);
11
11
  };
12
12
  // Convert date to ISO format (YYYY-MM-DD)
13
- var toISODate = function toISODate(date) {
14
- return format(date, "yyyy-MM-dd");
15
- };
13
+ const toISODate = date => format(date, "yyyy-MM-dd");
16
14
  // Convert date to DMY format (dd.MM.yyyy)
17
- var toDMYDate = function toDMYDate(dateISO) {
18
- return dateISO ? format(new Date(dateISO), "dd.MM.yyyy") : "";
19
- };
15
+ const toDMYDate = dateISO => dateISO ? format(new Date(dateISO), "dd.MM.yyyy") : "";
20
16
 
21
17
  export { parse, toDMYDate, toISODate };
@@ -1,28 +1,22 @@
1
1
  import { useCallback, useSyncExternalStore } from 'react';
2
2
  import { media } from '../../Theme/breakpoints.js';
3
3
 
4
- var getServerSnapshot = function getServerSnapshot() {
5
- return false;
6
- };
7
- var getMediaQueryList = function getMediaQueryList(query) {
8
- return typeof window !== "undefined" && typeof window.matchMedia === "function" ? window.matchMedia(query) : null;
9
- };
4
+ const getServerSnapshot = () => false;
5
+ const getMediaQueryList = query => typeof window !== "undefined" && typeof window.matchMedia === "function" ? window.matchMedia(query) : null;
10
6
  /**
11
7
  * Returns whether the media query matches.
12
8
  * Returns `false` on the server and during hydration, the real value right after.
13
9
  */
14
- var useMediaSizes = function useMediaSizes(queryInput) {
10
+ const useMediaSizes = queryInput => {
15
11
  // A function input is a new function every render: memoize on the query string.
16
- var query = (typeof queryInput === "function" ? queryInput(media) : queryInput).replace(/^\s*@media\s*/, "");
17
- var subscribe = useCallback(function (onChange) {
18
- var queryList = getMediaQueryList(query);
19
- if (!queryList) return function () {};
12
+ const query = (typeof queryInput === "function" ? queryInput(media) : queryInput).replace(/^\s*@media\s*/, "");
13
+ const subscribe = useCallback(onChange => {
14
+ const queryList = getMediaQueryList(query);
15
+ if (!queryList) return () => {};
20
16
  queryList.addEventListener("change", onChange);
21
- return function () {
22
- return queryList.removeEventListener("change", onChange);
23
- };
17
+ return () => queryList.removeEventListener("change", onChange);
24
18
  }, [query]);
25
- var getSnapshot = useCallback(function () {
19
+ const getSnapshot = useCallback(() => {
26
20
  var _a, _b;
27
21
  return (_b = (_a = getMediaQueryList(query)) === null || _a === void 0 ? void 0 : _a.matches) !== null && _b !== void 0 ? _b : false;
28
22
  }, [query]);
@@ -1,24 +1,21 @@
1
1
  import { useEffect, useCallback } from 'react';
2
2
 
3
- var stack = [];
3
+ const stack = [];
4
4
  /**
5
5
  * Tracks open modals so only the topmost one reacts to Escape and Tab.
6
6
  * An inactive entry is not registered and counts as topmost only while no
7
7
  * modal is open.
8
8
  */
9
- var useModalStack = function useModalStack(id) {
10
- var active = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
11
- useEffect(function () {
9
+ const useModalStack = (id, active = true) => {
10
+ useEffect(() => {
12
11
  if (!active) return;
13
12
  stack.push(id);
14
- return function () {
15
- var index = stack.lastIndexOf(id);
13
+ return () => {
14
+ const index = stack.lastIndexOf(id);
16
15
  if (index !== -1) stack.splice(index, 1);
17
16
  };
18
17
  }, [id, active]);
19
- return useCallback(function () {
20
- return stack.length ? stack[stack.length - 1] === id : !active;
21
- }, [id, active]);
18
+ return useCallback(() => stack.length ? stack[stack.length - 1] === id : !active, [id, active]);
22
19
  };
23
20
 
24
21
  export { useModalStack };
@@ -1,16 +1,16 @@
1
1
  import { useEffect } from 'react';
2
2
 
3
- var element = {
3
+ let element = {
4
4
  current: undefined
5
5
  };
6
6
  function useOnClickOutside(ref, handler) {
7
- useEffect(function () {
8
- var previous = element;
7
+ useEffect(() => {
8
+ const previous = element;
9
9
  element = ref;
10
- var listener = function listener(event) {
10
+ const listener = event => {
11
11
  // Ensure this hook belongs to the current element.
12
12
  if ((ref === null || ref === void 0 ? void 0 : ref.current) !== (element === null || element === void 0 ? void 0 : element.current)) return;
13
- var el = element.current;
13
+ const el = element.current;
14
14
  if (!el) return;
15
15
  // Ignore clicks inside the element.
16
16
  if (el.contains(event.target)) return;
@@ -18,7 +18,7 @@ function useOnClickOutside(ref, handler) {
18
18
  };
19
19
  document.addEventListener("mousedown", listener, false);
20
20
  document.addEventListener("touchstart", listener, false);
21
- return function () {
21
+ return () => {
22
22
  document.removeEventListener("mousedown", listener, false);
23
23
  document.removeEventListener("touchstart", listener, false);
24
24
  element = previous;
@@ -1,18 +1,19 @@
1
1
  import { useEffect } from 'react';
2
2
 
3
- var useScrollLock = function useScrollLock() {
4
- useEffect(function () {
5
- var body = document.querySelector("body");
3
+ const useScrollLock = () => {
4
+ useEffect(() => {
5
+ const body = document.querySelector("body");
6
6
  if (!body) return undefined;
7
- var _body$style = body.style,
8
- overflow = _body$style.overflow,
9
- width = _body$style.width;
10
- var scrollBarWidth = window.innerWidth - document.documentElement.clientWidth;
7
+ const {
8
+ overflow,
9
+ width
10
+ } = body.style;
11
+ const scrollBarWidth = window.innerWidth - document.documentElement.clientWidth;
11
12
  body.style.overflow = "hidden";
12
13
  if (scrollBarWidth > 0) {
13
- body.style.width = "calc(100% - ".concat(scrollBarWidth, "px)");
14
+ body.style.width = `calc(100% - ${scrollBarWidth}px)`;
14
15
  }
15
- return function () {
16
+ return () => {
16
17
  body.style.overflow = overflow;
17
18
  body.style.width = width;
18
19
  };
@@ -1,18 +1,16 @@
1
1
  import { useEffect } from 'react';
2
2
 
3
- var getFocusableModalElements = function getFocusableModalElements(element) {
4
- return element.querySelectorAll('a[href], button, textarea, input[type="text"], input[type="password"], input[type="radio"], input[type="checkbox"], select');
5
- };
3
+ const getFocusableModalElements = element => element.querySelectorAll('a[href], button, textarea, input[type="text"], input[type="password"], input[type="radio"], input[type="checkbox"], select');
6
4
  function useTrapFocus(refObject, isActive) {
7
- useEffect(function () {
8
- var handler = function handler(event) {
5
+ useEffect(() => {
6
+ const handler = event => {
9
7
  if (!refObject.current || event.code !== "Tab") return;
10
8
  if (isActive && !isActive()) return;
11
- var focusable = Array.from(getFocusableModalElements(refObject.current));
12
- var firstElement = focusable[0];
13
- var lastElement = focusable[focusable.length - 1];
9
+ const focusable = Array.from(getFocusableModalElements(refObject.current));
10
+ const firstElement = focusable[0];
11
+ const lastElement = focusable[focusable.length - 1];
14
12
  if (!lastElement || !firstElement) return;
15
- var focusOutside = document.activeElement ? !focusable.includes(document.activeElement) : true;
13
+ const focusOutside = document.activeElement ? !focusable.includes(document.activeElement) : true;
16
14
  if (event.shiftKey && (document.activeElement === firstElement || focusOutside)) {
17
15
  lastElement.focus();
18
16
  event.preventDefault();
@@ -22,7 +20,7 @@ function useTrapFocus(refObject, isActive) {
22
20
  }
23
21
  };
24
22
  document.addEventListener("keydown", handler);
25
- return function () {
23
+ return () => {
26
24
  document.removeEventListener("keydown", handler);
27
25
  };
28
26
  }, [refObject, isActive]);
@@ -1,4 +1,4 @@
1
- var Keys = {
1
+ const Keys = {
2
2
  BACKSPACE: "Backspace",
3
3
  TAB: "Tab",
4
4
  ENTER: "Enter",
@@ -17,9 +17,7 @@ var Keys = {
17
17
  DELETE: "Delete"
18
18
  };
19
19
  function isKey(eventKey, keys) {
20
- return keys.some(function (value) {
21
- return Keys[value] === eventKey || value === eventKey;
22
- });
20
+ return keys.some(value => Keys[value] === eventKey || value === eventKey);
23
21
  }
24
22
 
25
23
  export { Keys, isKey };
@@ -4,69 +4,58 @@ var dateFns = require('date-fns');
4
4
  var locale = require('date-fns/locale');
5
5
 
6
6
  // Helper to parse date strings with fallback
7
- var parse = function parse(dateInput) {
7
+ const parse = dateInput => {
8
8
  if (!dateInput) {
9
9
  return new Date();
10
10
  }
11
- var date = typeof dateInput === "string" ? dateFns.parseISO(dateInput) : dateInput;
11
+ const date = typeof dateInput === "string" ? dateFns.parseISO(dateInput) : dateInput;
12
12
  return dateFns.isValid(date) ? date : new Date(dateInput);
13
13
  };
14
14
  // Get full month name with the first letter capitalized
15
- var getUpperMonthName = function getUpperMonthName(date) {
16
- var parsedDate = parse(date);
15
+ const getUpperMonthName = date => {
16
+ const parsedDate = parse(date);
17
17
  return dateFns.format(parsedDate, "LLLL", {
18
18
  locale: locale.enGB
19
19
  });
20
20
  };
21
21
  // Get short weekday name by index (e.g., Mo, Tu, etc.)
22
- var getShortWeekDayNameByIndex = function getShortWeekDayNameByIndex(index) {
23
- var firstDayOfWeek = dateFns.startOfWeek(new Date());
22
+ const getShortWeekDayNameByIndex = index => {
23
+ const firstDayOfWeek = dateFns.startOfWeek(new Date());
24
24
  return dateFns.format(dateFns.addDays(firstDayOfWeek, index), "EEEEEE", {
25
25
  locale: locale.enGB
26
26
  });
27
27
  };
28
28
  // Get formatted date string with month and day
29
- var getDateMonth = function getDateMonth(date) {
30
- var parsedDate = parse(date);
29
+ const getDateMonth = date => {
30
+ const parsedDate = parse(date);
31
31
  return dateFns.format(parsedDate, "MMMM d", {
32
32
  locale: locale.enGB
33
33
  });
34
34
  };
35
35
  // Shift the date by a number of days
36
- var shiftDate = function shiftDate(date, days) {
37
- return dateFns.addDays(date, days);
38
- };
36
+ const shiftDate = (date, days) => dateFns.addDays(date, days);
39
37
  // Check if two dates are in the same month and year
40
- var isSameMonthAndYear = function isSameMonthAndYear(date, otherDate) {
41
- return date.getFullYear() === otherDate.getFullYear() && date.getMonth() === otherDate.getMonth();
42
- };
38
+ const isSameMonthAndYear = (date, otherDate) => date.getFullYear() === otherDate.getFullYear() && date.getMonth() === otherDate.getMonth();
43
39
  // Convert date to ISO format (YYYY-MM-DD)
44
- var toISODate = function toISODate(date) {
45
- return dateFns.format(date, "yyyy-MM-dd");
46
- };
40
+ const toISODate = date => dateFns.format(date, "yyyy-MM-dd");
47
41
  // Convert date to DMY format (dd.MM.yyyy)
48
- var toDMYDate = function toDMYDate(dateISO) {
49
- return dateISO ? dateFns.format(new Date(dateISO), "dd.MM.yyyy") : "";
50
- };
42
+ const toDMYDate = dateISO => dateISO ? dateFns.format(new Date(dateISO), "dd.MM.yyyy") : "";
51
43
  // Get the period dates as a formatted string
52
- var getPeriodDates = function getPeriodDates(startDate) {
53
- var period = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
54
- var start = parse(startDate);
44
+ const getPeriodDates = (startDate, period = 1) => {
45
+ const start = parse(startDate);
55
46
  if (period === 1) {
56
47
  return getDateMonth(start);
57
48
  }
58
- var end = shiftDate(start, period - 1);
59
- var startDateFormat = isSameMonthAndYear(start, end) ? dateFns.format(start, "d") : getDateMonth(start);
60
- return "".concat(startDateFormat, " \u2013 ").concat(getDateMonth(end));
49
+ const end = shiftDate(start, period - 1);
50
+ const startDateFormat = isSameMonthAndYear(start, end) ? dateFns.format(start, "d") : getDateMonth(start);
51
+ return `${startDateFormat} – ${getDateMonth(end)}`;
61
52
  };
62
53
  // Clear time from a date
63
- var clearTime = function clearTime(date) {
64
- return new Date(date.setHours(0, 0, 0, 0));
65
- };
54
+ const clearTime = date => new Date(date.setHours(0, 0, 0, 0));
66
55
  // Get the difference in days between two dates
67
- var getDaysDiff = function getDaysDiff(dateStart, dateEnd) {
68
- var start = clearTime(dateStart).getTime();
69
- var end = clearTime(dateEnd).getTime();
56
+ const getDaysDiff = (dateStart, dateEnd) => {
57
+ const start = clearTime(dateStart).getTime();
58
+ const end = clearTime(dateEnd).getTime();
70
59
  return Math.round((end - start) / (1000 * 60 * 60 * 24)); // Convert milliseconds to days
71
60
  };
72
61
 
@@ -3,28 +3,22 @@
3
3
  var React = require('react');
4
4
  var breakpoints = require('../../Theme/breakpoints.js');
5
5
 
6
- var getServerSnapshot = function getServerSnapshot() {
7
- return false;
8
- };
9
- var getMediaQueryList = function getMediaQueryList(query) {
10
- return typeof window !== "undefined" && typeof window.matchMedia === "function" ? window.matchMedia(query) : null;
11
- };
6
+ const getServerSnapshot = () => false;
7
+ const getMediaQueryList = query => typeof window !== "undefined" && typeof window.matchMedia === "function" ? window.matchMedia(query) : null;
12
8
  /**
13
9
  * Returns whether the media query matches.
14
10
  * Returns `false` on the server and during hydration, the real value right after.
15
11
  */
16
- var useMediaSizes = function useMediaSizes(queryInput) {
12
+ const useMediaSizes = queryInput => {
17
13
  // A function input is a new function every render: memoize on the query string.
18
- var query = (typeof queryInput === "function" ? queryInput(breakpoints.media) : queryInput).replace(/^\s*@media\s*/, "");
19
- var subscribe = React.useCallback(function (onChange) {
20
- var queryList = getMediaQueryList(query);
21
- if (!queryList) return function () {};
14
+ const query = (typeof queryInput === "function" ? queryInput(breakpoints.media) : queryInput).replace(/^\s*@media\s*/, "");
15
+ const subscribe = React.useCallback(onChange => {
16
+ const queryList = getMediaQueryList(query);
17
+ if (!queryList) return () => {};
22
18
  queryList.addEventListener("change", onChange);
23
- return function () {
24
- return queryList.removeEventListener("change", onChange);
25
- };
19
+ return () => queryList.removeEventListener("change", onChange);
26
20
  }, [query]);
27
- var getSnapshot = React.useCallback(function () {
21
+ const getSnapshot = React.useCallback(() => {
28
22
  var _a, _b;
29
23
  return (_b = (_a = getMediaQueryList(query)) === null || _a === void 0 ? void 0 : _a.matches) !== null && _b !== void 0 ? _b : false;
30
24
  }, [query]);
@@ -2,25 +2,22 @@
2
2
 
3
3
  var React = require('react');
4
4
 
5
- var stack = [];
5
+ const stack = [];
6
6
  /**
7
7
  * Tracks open modals so only the topmost one reacts to Escape and Tab.
8
8
  * An inactive entry is not registered and counts as topmost only while no
9
9
  * modal is open.
10
10
  */
11
- var useModalStack = function useModalStack(id) {
12
- var active = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
13
- React.useEffect(function () {
11
+ const useModalStack = (id, active = true) => {
12
+ React.useEffect(() => {
14
13
  if (!active) return;
15
14
  stack.push(id);
16
- return function () {
17
- var index = stack.lastIndexOf(id);
15
+ return () => {
16
+ const index = stack.lastIndexOf(id);
18
17
  if (index !== -1) stack.splice(index, 1);
19
18
  };
20
19
  }, [id, active]);
21
- return React.useCallback(function () {
22
- return stack.length ? stack[stack.length - 1] === id : !active;
23
- }, [id, active]);
20
+ return React.useCallback(() => stack.length ? stack[stack.length - 1] === id : !active, [id, active]);
24
21
  };
25
22
 
26
23
  exports.useModalStack = useModalStack;
@@ -2,17 +2,17 @@
2
2
 
3
3
  var React = require('react');
4
4
 
5
- var element = {
5
+ let element = {
6
6
  current: undefined
7
7
  };
8
8
  function useOnClickOutside(ref, handler) {
9
- React.useEffect(function () {
10
- var previous = element;
9
+ React.useEffect(() => {
10
+ const previous = element;
11
11
  element = ref;
12
- var listener = function listener(event) {
12
+ const listener = event => {
13
13
  // Ensure this hook belongs to the current element.
14
14
  if ((ref === null || ref === void 0 ? void 0 : ref.current) !== (element === null || element === void 0 ? void 0 : element.current)) return;
15
- var el = element.current;
15
+ const el = element.current;
16
16
  if (!el) return;
17
17
  // Ignore clicks inside the element.
18
18
  if (el.contains(event.target)) return;
@@ -20,7 +20,7 @@ function useOnClickOutside(ref, handler) {
20
20
  };
21
21
  document.addEventListener("mousedown", listener, false);
22
22
  document.addEventListener("touchstart", listener, false);
23
- return function () {
23
+ return () => {
24
24
  document.removeEventListener("mousedown", listener, false);
25
25
  document.removeEventListener("touchstart", listener, false);
26
26
  element = previous;