@mtes-mct/monitor-ui 6.0.0 → 6.0.1

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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,21 @@
1
+ # [6.0.0](https://github.com/MTES-MCT/monitor-ui/compare/v5.9.2...v6.0.0) (2023-05-17)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **fields:** fix search component ([8776915](https://github.com/MTES-MCT/monitor-ui/commit/87769151f5152c05810b6849e267d73f9f4eb8d3))
7
+
8
+
9
+ * fix(fields)!: format options and create test e2e ([69b3070](https://github.com/MTES-MCT/monitor-ui/commit/69b3070409a3f5c3aa9063b12bf990d6cb92fa65))
10
+
11
+
12
+ ### BREAKING CHANGES
13
+
14
+ * - pass option in `onChange` function instead of value
15
+ - rename prop to display search icon
16
+ - replace defaultValue with value
17
+ - add optionValueKey prop
18
+
1
19
  ## [5.9.2](https://github.com/MTES-MCT/monitor-ui/compare/v5.9.1...v5.9.2) (2023-05-10)
2
20
 
3
21
 
@@ -1,4 +1,4 @@
1
- import { HTMLAttributes } from 'react';
1
+ import type { HTMLAttributes } from 'react';
2
2
  export type DialogProps = HTMLAttributes<HTMLDivElement> & {
3
3
  isAbsolute?: boolean;
4
4
  };
@@ -1,6 +1,7 @@
1
+ import { type HTMLAttributes } from 'react';
1
2
  import type { Promisable } from 'type-fest';
2
- export type SingleTagProps = {
3
+ export type SingleTagProps = HTMLAttributes<HTMLDivElement> & {
3
4
  children: string;
4
5
  onDelete: () => Promisable<void>;
5
6
  };
6
- export declare function SingleTag({ children, onDelete }: SingleTagProps): JSX.Element;
7
+ export declare function SingleTag({ children, className, onDelete, ...nativeProps }: SingleTagProps): JSX.Element;
@@ -8,7 +8,7 @@ export type ButtonProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'childre
8
8
  isFullWidth?: boolean | undefined;
9
9
  size?: Size | undefined;
10
10
  };
11
- export declare function Button({ accent, children, Icon, isFullWidth, size, type, ...nativeProps }: ButtonProps): JSX.Element;
11
+ export declare function Button({ accent, children, className, Icon, isFullWidth, size, type, ...nativeProps }: ButtonProps): JSX.Element;
12
12
  export declare const PrimaryButton: import("styled-components").StyledComponent<"button", import("styled-components").DefaultTheme, {}, never>;
13
13
  export declare const SecondaryButton: import("styled-components").StyledComponent<"button", import("styled-components").DefaultTheme, {}, never>;
14
14
  export declare const TertiaryButton: import("styled-components").StyledComponent<"button", import("styled-components").DefaultTheme, {}, never>;
@@ -1,3 +1,3 @@
1
1
  import type { HTMLAttributes } from 'react';
2
2
  export type FieldProps = HTMLAttributes<HTMLDivElement>;
3
- export declare const Field: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
3
+ export declare const Field: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, FieldProps, keyof FieldProps>;
@@ -2,6 +2,6 @@ import type { HTMLAttributes } from 'react';
2
2
  export type FieldErrorProps = HTMLAttributes<HTMLParagraphElement> & {
3
3
  isDisabled?: boolean | undefined;
4
4
  };
5
- export declare const FieldError: import("styled-components").StyledComponent<"p", import("styled-components").DefaultTheme, {
5
+ export declare const FieldError: import("styled-components").StyledComponent<"p", import("styled-components").DefaultTheme, HTMLAttributes<HTMLParagraphElement> & {
6
6
  isDisabled?: boolean | undefined;
7
- }, never>;
7
+ }, keyof HTMLAttributes<HTMLParagraphElement> | "isDisabled">;
@@ -1,4 +1,4 @@
1
- import { FieldsetHTMLAttributes } from 'react';
1
+ import { type FieldsetHTMLAttributes } from 'react';
2
2
  export type FieldsetProps = Omit<FieldsetHTMLAttributes<HTMLFieldSetElement>, 'defaultValue' | 'onChange' | 'value'> & {
3
3
  hasBorder?: boolean | undefined;
4
4
  hasError?: boolean | undefined;
@@ -6,4 +6,4 @@ export type FieldsetProps = Omit<FieldsetHTMLAttributes<HTMLFieldSetElement>, 'd
6
6
  isLight?: boolean | undefined;
7
7
  legend?: string | undefined;
8
8
  };
9
- export declare function Fieldset({ children, hasBorder, hasError, isLegendHidden, isLight, legend, ...nativeProps }: FieldsetProps): JSX.Element;
9
+ export declare function Fieldset({ children, className, hasBorder, hasError, isLegendHidden, isLight, legend, ...nativeProps }: FieldsetProps): JSX.Element;
@@ -1,4 +1,5 @@
1
- export type IconBoxProps = {
1
+ import type { HTMLAttributes } from 'react';
2
+ export type IconBoxProps = HTMLAttributes<HTMLDivElement> & {
2
3
  $color?: string | undefined;
3
4
  /** In pixels */
4
5
  $size?: number | undefined;
@@ -6,4 +7,8 @@ export type IconBoxProps = {
6
7
  /**
7
8
  * Internal component used to wrap SVG icon components
8
9
  */
9
- export declare const IconBox: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, IconBoxProps, never>;
10
+ export declare const IconBox: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, HTMLAttributes<HTMLDivElement> & {
11
+ $color?: string | undefined;
12
+ /** In pixels */
13
+ $size?: number | undefined;
14
+ }, keyof HTMLAttributes<HTMLDivElement> | "$color" | "$size">;
@@ -9,4 +9,4 @@ export type IconButtonProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'chi
9
9
  iconSize?: number | undefined;
10
10
  size?: Size | undefined;
11
11
  };
12
- export declare function IconButton({ accent, color, Icon, iconSize, size, type, ...nativeProps }: IconButtonProps): JSX.Element;
12
+ export declare function IconButton({ accent, className, color, Icon, iconSize, size, type, ...nativeProps }: IconButtonProps): JSX.Element;
@@ -4,8 +4,8 @@ export type LabelProps = LabelHTMLAttributes<HTMLLabelElement> & {
4
4
  hasError?: boolean | undefined;
5
5
  isHidden?: boolean | undefined;
6
6
  };
7
- export declare const Label: import("styled-components").StyledComponent<"label", import("styled-components").DefaultTheme, {
7
+ export declare const Label: import("styled-components").StyledComponent<"label", import("styled-components").DefaultTheme, LabelHTMLAttributes<HTMLLabelElement> & {
8
8
  disabled?: boolean | undefined;
9
9
  hasError?: boolean | undefined;
10
10
  isHidden?: boolean | undefined;
11
- }, never>;
11
+ }, "disabled" | keyof LabelHTMLAttributes<HTMLLabelElement> | "hasError" | "isHidden">;
@@ -4,4 +4,8 @@ export type LegendProps = HTMLAttributes<HTMLLegendElement> & {
4
4
  hasError?: boolean | undefined;
5
5
  isHidden?: boolean | undefined;
6
6
  };
7
- export declare function Legend({ disabled, hasError, isHidden, ...nativeProps }: LegendProps): JSX.Element;
7
+ export declare const Legend: import("styled-components").StyledComponent<"legend", import("styled-components").DefaultTheme, HTMLAttributes<HTMLLegendElement> & {
8
+ disabled?: boolean | undefined;
9
+ hasError?: boolean | undefined;
10
+ isHidden?: boolean | undefined;
11
+ }, "disabled" | keyof HTMLAttributes<HTMLLegendElement> | "hasError" | "isHidden">;
@@ -8,7 +8,7 @@ export type TagProps = HTMLAttributes<HTMLSpanElement> & {
8
8
  bulletColor?: string | undefined;
9
9
  isLight?: boolean | undefined;
10
10
  };
11
- export declare function Tag({ accent, bullet, bulletColor, children, color, Icon, isLight, ...nativeProps }: TagProps): JSX.Element;
11
+ export declare function Tag({ accent, bullet, bulletColor, children, className, color, Icon, isLight, ...nativeProps }: TagProps): JSX.Element;
12
12
  export declare const PrimaryTag: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, {
13
13
  $color?: string | undefined;
14
14
  $isLight: boolean;
@@ -1,3 +1,3 @@
1
1
  import type { HTMLAttributes } from 'react';
2
2
  export type TagGroupProps = HTMLAttributes<HTMLDivElement>;
3
- export declare const TagGroup: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
3
+ export declare const TagGroup: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, TagGroupProps, keyof TagGroupProps>;
@@ -23,4 +23,4 @@ export type SearchProps<OptionValue extends OptionValueType = string> = Omit<Rsu
23
23
  throttleDuration?: number;
24
24
  value?: OptionValue | undefined;
25
25
  };
26
- export declare function Search<OptionValue extends OptionValueType = string>({ baseContainer, error, isErrorMessageHidden, isLabelHidden, isLight, isSearchIconVisible, label, MenuItem, onChange, onQuery, options, optionValueKey, queryMap, queryUrl, throttleDuration, value, ...originalProps }: SearchProps<OptionValue>): JSX.Element;
26
+ export declare function Search<OptionValue extends OptionValueType = string>({ baseContainer, className, error, isErrorMessageHidden, isLabelHidden, isLight, isSearchIconVisible, label, MenuItem, onChange, onQuery, options, optionValueKey, queryMap, queryUrl, throttleDuration, value, ...originalProps }: SearchProps<OptionValue>): JSX.Element;
package/index.js CHANGED
@@ -2051,7 +2051,7 @@ function ThemeProvider({ children, theme = {} }) {
2051
2051
  return jsx(UntypedStyledComponentsThemeProvider, { theme: finalTheme, children: children });
2052
2052
  }
2053
2053
 
2054
- var classnames = {exports: {}};
2054
+ var classnames$1 = {exports: {}};
2055
2055
 
2056
2056
  /*!
2057
2057
  Copyright (c) 2018 Jed Watson.
@@ -2108,10 +2108,10 @@ var classnames = {exports: {}};
2108
2108
  window.classNames = classNames;
2109
2109
  }
2110
2110
  }());
2111
- } (classnames));
2111
+ } (classnames$1));
2112
2112
 
2113
- var classnamesExports = classnames.exports;
2114
- var classNames = /*@__PURE__*/getDefaultExportFromCjs(classnamesExports);
2113
+ var classnamesExports = classnames$1.exports;
2114
+ var classnames = /*@__PURE__*/getDefaultExportFromCjs(classnamesExports);
2115
2115
 
2116
2116
  const Action = styled.div `
2117
2117
  background-color: ${p => p.theme.color.white};
@@ -2173,8 +2173,8 @@ function stopMouseEventPropagation(event) {
2173
2173
  }
2174
2174
 
2175
2175
  function RawDialog({ children, className, isAbsolute = false, ...nativeProps }) {
2176
- const controlledClassName = useMemo(() => classNames('Component-Dialog', className), [className]);
2177
- return (jsxs(Box$g, { "$isAbsolute": isAbsolute, className: controlledClassName, ...nativeProps, onClick: stopMouseEventPropagation, children: [jsx(Overlay, { "$isAbsolute": isAbsolute }), jsx(Window, { "$isAbsolute": isAbsolute, children: children })] }));
2176
+ const controlledClassName = classnames('Component-Dialog', className);
2177
+ return (jsxs(Box$g, { "$isAbsolute": isAbsolute, className: controlledClassName, onClick: stopMouseEventPropagation, ...nativeProps, children: [jsx(Overlay, { "$isAbsolute": isAbsolute }), jsx(Window, { "$isAbsolute": isAbsolute, children: children })] }));
2178
2178
  }
2179
2179
  const Box$g = styled.div `
2180
2180
  position: ${p => (p.$isAbsolute ? 'absolute' : 'fixed')};
@@ -2242,10 +2242,11 @@ const StyledDropdownItem = styled(Dropdown$1.Item) `
2242
2242
  }
2243
2243
  `;
2244
2244
 
2245
- function RawDropdown({ Icon, ...originalProps }) {
2245
+ function RawDropdown({ className, Icon, ...originalProps }) {
2246
+ const controlledClassName = classnames('Component-Dropdow', className);
2246
2247
  const icon = useMemo(() => (Icon ? jsx(Icon, { size: 20 }) : undefined), [Icon]);
2247
2248
  const hasIcon = useMemo(() => Boolean(Icon), [Icon]);
2248
- return jsx(StyledDropdown, { "$hasIcon": hasIcon, icon: icon, ...originalProps });
2249
+ return jsx(StyledDropdown, { "$hasIcon": hasIcon, className: controlledClassName, icon: icon, ...originalProps });
2249
2250
  }
2250
2251
  // TODO We need to split into multiple styled components as done in `<Button />`.
2251
2252
  const StyledDropdown = styled(Dropdown$1) `
@@ -2597,16 +2598,17 @@ const ICON_SIZE = {
2597
2598
  [Size.NORMAL]: 20,
2598
2599
  [Size.SMALL]: 12
2599
2600
  };
2600
- function Button({ accent = Accent.PRIMARY, children, Icon, isFullWidth = false, size = Size.NORMAL, type = 'button', ...nativeProps }) {
2601
+ function Button({ accent = Accent.PRIMARY, children, className, Icon, isFullWidth = false, size = Size.NORMAL, type = 'button', ...nativeProps }) {
2601
2602
  const commonChildren = useMemo(() => (jsxs(Fragment, { children: [Icon && jsx(Icon, { size: ICON_SIZE[size] }), children && jsx(ButtonLabel, { children: children })] })), [children, Icon, size]);
2602
2603
  const commonProps = useMemo(() => ({
2603
2604
  as: StyledButton$1,
2604
2605
  children: commonChildren,
2606
+ className: classnames('Element-Button', className),
2605
2607
  isFullWidth,
2606
2608
  size,
2607
2609
  type,
2608
2610
  ...nativeProps
2609
- }), [commonChildren, isFullWidth, nativeProps, size, type]);
2611
+ }), [className, commonChildren, isFullWidth, nativeProps, size, type]);
2610
2612
  switch (accent) {
2611
2613
  case Accent.SECONDARY:
2612
2614
  return jsx(SecondaryButton, { ...commonProps });
@@ -2732,14 +2734,15 @@ const ICON_SIZE_IN_PX = {
2732
2734
  [Size.NORMAL]: 20,
2733
2735
  [Size.SMALL]: 14
2734
2736
  };
2735
- function IconButton({ accent = Accent.PRIMARY, color, Icon, iconSize, size = Size.NORMAL, type = 'button', ...nativeProps }) {
2737
+ function IconButton({ accent = Accent.PRIMARY, className, color, Icon, iconSize, size = Size.NORMAL, type = 'button', ...nativeProps }) {
2736
2738
  const children = useMemo(() => jsx(Icon, { color: color, size: iconSize || ICON_SIZE_IN_PX[size] }), [color, Icon, iconSize, size]);
2737
2739
  const commonProps = useMemo(() => ({
2738
2740
  children,
2741
+ className: classnames('Element-IconButton', className),
2739
2742
  size,
2740
2743
  type,
2741
2744
  ...nativeProps
2742
- }), [children, nativeProps, size, type]);
2745
+ }), [children, className, nativeProps, size, type]);
2743
2746
  switch (accent) {
2744
2747
  case Accent.SECONDARY:
2745
2748
  return jsx(SecondaryButton, { as: StyledButton, ...commonProps });
@@ -2790,7 +2793,9 @@ const TertiaryButton = styled.button `
2790
2793
  /**
2791
2794
  * Internal component used to wrap SVG icon components
2792
2795
  */
2793
- const IconBox = styled.div `
2796
+ const IconBox = styled.div.attrs(() => ({
2797
+ className: 'Element-IconBox'
2798
+ })) `
2794
2799
  display: inline-block;
2795
2800
  color: ${p => p.$color ?? 'inherit'};
2796
2801
 
@@ -3145,13 +3150,14 @@ var index = /*#__PURE__*/Object.freeze({
3145
3150
  Vms: Vms
3146
3151
  });
3147
3152
 
3148
- function SingleTag({ children, onDelete }) {
3153
+ function SingleTag({ children, className, onDelete, ...nativeProps }) {
3154
+ const controlledClassName = classnames('Component-SingleTag', className);
3149
3155
  const handleDelete = useCallback(() => {
3150
3156
  if (onDelete) {
3151
3157
  onDelete();
3152
3158
  }
3153
3159
  }, [onDelete]);
3154
- return (jsx("div", { children: jsxs(Box$f, { children: [jsx(Text, { children: children }), jsx(StyledIconButton, { accent: Accent.TERTIARY, Icon: Close, iconSize: 10, onClick: handleDelete })] }) }));
3160
+ return (jsxs(Box$f, { className: controlledClassName, ...nativeProps, children: [jsx(Text, { children: children }), jsx(StyledIconButton, { accent: Accent.TERTIARY, Icon: Close, iconSize: 10, onClick: handleDelete })] }));
3155
3161
  }
3156
3162
  const Box$f = styled.div `
3157
3163
  align-items: center;
@@ -3186,14 +3192,16 @@ const StyledIconButton = styled(IconButton) `
3186
3192
  `;
3187
3193
 
3188
3194
  const Field$2 = styled.div.attrs(props => ({
3189
- className: classNames('Element-Field', props.className)
3195
+ className: classnames('Element-Field', props.className)
3190
3196
  })) `
3191
3197
  align-items: flex-start;
3192
3198
  display: flex;
3193
3199
  flex-direction: column;
3194
3200
  `;
3195
3201
 
3196
- const Label = styled.label `
3202
+ const Legend = styled.legend.attrs(props => ({
3203
+ className: classnames('Element-Legend', props.className)
3204
+ })) `
3197
3205
  color: ${p =>
3198
3206
  // eslint-disable-next-line no-nested-ternary
3199
3207
  p.disabled ? p.theme.color.lightGray : p.hasError ? p.theme.color.maximumRed : p.theme.color.slateGray};
@@ -3201,25 +3209,22 @@ p.disabled ? p.theme.color.lightGray : p.hasError ? p.theme.color.maximumRed : p
3201
3209
  font-size: 13px;
3202
3210
  line-height: 1.3846;
3203
3211
  margin-bottom: 4px;
3204
- `;
3205
-
3206
- function Legend({ disabled = false, hasError = false, isHidden = false, ...nativeProps }) {
3207
- return jsx(StyledLabel, { as: "legend", disabled: disabled, hasError: hasError, isHidden: isHidden, ...nativeProps });
3208
- }
3209
- const StyledLabel = styled(Label) `
3210
3212
  padding: 0;
3211
3213
  `;
3212
3214
 
3213
- function Fieldset({ children, hasBorder = false, hasError = false, isLegendHidden = false, isLight = false, legend, ...nativeProps }) {
3215
+ function Fieldset({ children, className, hasBorder = false, hasError = false, isLegendHidden = false, isLight = false, legend, ...nativeProps }) {
3214
3216
  const hasLegend = useMemo(() => Boolean(legend), [legend]);
3215
- return (jsxs(StyledField, { as: "fieldset", ...nativeProps, children: [legend && (jsx(Legend, { disabled: nativeProps.disabled, hasError: hasError, isHidden: isLegendHidden, children: legend })), jsx(Box$e, { "$hasBorder": hasBorder, "$hasLegend": hasLegend, "$isLight": isLight, children: children })] }));
3217
+ return (jsxs(Box$e, { className: classnames('Element-Fieldset', className), ...nativeProps, children: [legend && (jsx(Legend, { disabled: nativeProps.disabled, hasError: hasError, isHidden: isLegendHidden, children: legend })), jsx(InnerBox, { "$hasBorder": hasBorder, "$hasLegend": hasLegend, "$isLight": isLight, children: children })] }));
3216
3218
  }
3217
- const StyledField = styled(Field$2) `
3219
+ const Box$e = styled.fieldset `
3220
+ align-items: flex-start;
3218
3221
  border: 0;
3222
+ display: flex;
3223
+ flex-direction: column;
3219
3224
  margin: 0;
3220
3225
  padding: 0;
3221
3226
  `;
3222
- const Box$e = styled.div `
3227
+ const InnerBox = styled.div `
3223
3228
  background-color: ${p => (p.$isLight ? p.theme.color.white : 'transparent')};
3224
3229
  padding: ${p => (p.$hasBorder || p.$isLight ? '16px' : 0)};
3225
3230
  width: 100%;
@@ -3230,12 +3235,24 @@ const Box$e = styled.div `
3230
3235
  `}
3231
3236
  `;
3232
3237
 
3238
+ const Label = styled.label.attrs(props => ({
3239
+ className: classnames('Element-Label', props.className)
3240
+ })) `
3241
+ color: ${p =>
3242
+ // eslint-disable-next-line no-nested-ternary
3243
+ p.disabled ? p.theme.color.lightGray : p.hasError ? p.theme.color.maximumRed : p.theme.color.slateGray};
3244
+ display: ${p => (p.isHidden ? 'none' : 'block')};
3245
+ font-size: 13px;
3246
+ line-height: 1.3846;
3247
+ margin-bottom: 4px;
3248
+ `;
3249
+
3233
3250
  const Disk = styled.span `
3234
3251
  background-color: ${p => p.$color};
3235
3252
  border-radius: 50%;
3236
3253
  `;
3237
3254
 
3238
- function Tag({ accent, bullet, bulletColor, children, color, Icon, isLight = false, ...nativeProps }) {
3255
+ function Tag({ accent, bullet, bulletColor, children, className, color, Icon, isLight = false, ...nativeProps }) {
3239
3256
  const commonChildren = useMemo(() => {
3240
3257
  const defaultColor = color || THEME.color.gunMetal;
3241
3258
  const controlledBulletColor = bulletColor ||
@@ -3251,8 +3268,9 @@ function Tag({ accent, bullet, bulletColor, children, color, Icon, isLight = fal
3251
3268
  const commonProps = useMemo(() => ({
3252
3269
  $isLight: isLight,
3253
3270
  children: commonChildren,
3271
+ className: classnames('Element-Tag', className),
3254
3272
  ...nativeProps
3255
- }), [commonChildren, isLight, nativeProps]);
3273
+ }), [className, commonChildren, isLight, nativeProps]);
3256
3274
  switch (accent) {
3257
3275
  case Accent.PRIMARY:
3258
3276
  return jsx(PrimaryTag, { ...commonProps });
@@ -3300,7 +3318,9 @@ const TertiaryTag = styled(Box$d) `
3300
3318
  color: ${p => p.theme.color.white};
3301
3319
  `;
3302
3320
 
3303
- const TagGroup = styled.div `
3321
+ const TagGroup = styled.div.attrs(props => ({
3322
+ className: classnames('Element-TagGroup', props.className)
3323
+ })) `
3304
3324
  align-items: center;
3305
3325
  display: flex;
3306
3326
  flex-wrap: wrap;
@@ -3898,7 +3918,9 @@ var ky$1 = ky;
3898
3918
 
3899
3919
  function c(u,e,c){var i=this,a=useRef(null),o=useRef(0),f=useRef(null),l=useRef([]),m=useRef(),v=useRef(),d=useRef(u),p=useRef(!0);useEffect(function(){d.current=u;},[u]);var g=!e&&0!==e&&"undefined"!=typeof window;if("function"!=typeof u)throw new TypeError("Expected a function");e=+e||0;var w=!!(c=c||{}).leading,s=!("trailing"in c)||!!c.trailing,x="maxWait"in c,y=x?Math.max(+c.maxWait||0,e):null;useEffect(function(){return p.current=!0,function(){p.current=!1;}},[]);var h=useMemo(function(){var r=function(r){var n=l.current,t=m.current;return l.current=m.current=null,o.current=r,v.current=d.current.apply(t,n)},n=function(r,n){g&&cancelAnimationFrame(f.current),f.current=g?requestAnimationFrame(r):setTimeout(r,n);},t=function(r){if(!p.current)return !1;var n=r-a.current;return !a.current||n>=e||n<0||x&&r-o.current>=y},u=function(n){return f.current=null,s&&l.current?r(n):(l.current=m.current=null,v.current)},c=function r(){var c=Date.now();if(t(c))return u(c);if(p.current){var i=e-(c-a.current),f=x?Math.min(i,y-(c-o.current)):i;n(r,f);}},h=function(){var u=Date.now(),d=t(u);if(l.current=[].slice.call(arguments),m.current=i,a.current=u,d){if(!f.current&&p.current)return o.current=a.current,n(c,e),w?r(a.current):v.current;if(x)return n(c,e),r(a.current)}return f.current||n(c,e),v.current};return h.cancel=function(){f.current&&(g?cancelAnimationFrame(f.current):clearTimeout(f.current)),o.current=0,l.current=a.current=m.current=f.current=null;},h.isPending=function(){return !!f.current},h.flush=function(){return f.current?u(Date.now()):v.current},h},[w,x,e,y,s,g]);return h}
3900
3920
 
3901
- const FieldError = styled.p `
3921
+ const FieldError = styled.p.attrs(props => ({
3922
+ className: classnames('Element-FieldError', props.className)
3923
+ })) `
3902
3924
  color: ${p => p.theme.color.maximumRed};
3903
3925
  display: ${p => (p.isDisabled ? 'none' : 'block')};
3904
3926
  font-size: 13px;
@@ -21206,7 +21228,7 @@ function normalizeString(text) {
21206
21228
  return cleanText.length > 0 ? cleanText : undefined;
21207
21229
  }
21208
21230
 
21209
- function Search({ baseContainer, error, isErrorMessageHidden = false, isLabelHidden, isLight = false, isSearchIconVisible = true, label, MenuItem, onChange, onQuery, options = [], optionValueKey, queryMap, queryUrl, throttleDuration = 200, value, ...originalProps }) {
21231
+ function Search({ baseContainer, className, error, isErrorMessageHidden = false, isLabelHidden, isLight = false, isSearchIconVisible = true, label, MenuItem, onChange, onQuery, options = [], optionValueKey, queryMap, queryUrl, throttleDuration = 200, value, ...originalProps }) {
21210
21232
  // eslint-disable-next-line no-null/no-null
21211
21233
  const boxRef = useRef(null);
21212
21234
  const queryRef = useRef(undefined);
@@ -21214,6 +21236,7 @@ function Search({ baseContainer, error, isErrorMessageHidden = false, isLabelHid
21214
21236
  const [formattedOptions, setFormattedOptions] = useState(data);
21215
21237
  const [isOpen, setIsOpen] = useState(false);
21216
21238
  const { forceUpdate } = useForceUpdate();
21239
+ const controlledClassName = useMemo(() => classnames('Field-Search', className), [className]);
21217
21240
  const controlledError = useMemo(() => normalizeString(error), [error]);
21218
21241
  const hasError = useMemo(() => Boolean(controlledError), [controlledError]);
21219
21242
  const key = useKey([value, originalProps.disabled, originalProps.name]);
@@ -21265,7 +21288,7 @@ function Search({ baseContainer, error, isErrorMessageHidden = false, isLabelHid
21265
21288
  useEffect(() => {
21266
21289
  forceUpdate();
21267
21290
  }, [forceUpdate]);
21268
- return (jsxs(Field$2, { className: "Field-Search", children: [jsx(Label, { disabled: originalProps.disabled, hasError: hasError, htmlFor: originalProps.name, isHidden: isLabelHidden, children: label }), jsxs(Box$c, { ref: boxRef, isLight: isLight, children: [boxRef.current && (jsx(StyledAutoComplete, { "$isLight": isLight, container: boxRef.current, data: formattedOptions, id: originalProps.name, onChange: handleChange, onSelect: handleSelect, open: isOpen, renderMenuItem: (itemLabel, item) => MenuItem ? jsx(MenuItem, { item: item.value }) : itemLabel, value: inputValue, ...originalProps }, key)), inputValue && (jsxs(Fragment, { children: [jsx(StyledCloseButton, { accent: Accent.TERTIARY, color: THEME.color.slateGray, Icon: Close, isSearchIconVisible: isSearchIconVisible, onClick: clean, size: Size.SMALL }), isSearchIconVisible && jsx(Separator, { children: "|" })] })), isSearchIconVisible && jsx(StyledIconSearch, { color: THEME.color.slateGray, size: 20 })] }), !isErrorMessageHidden && hasError && jsx(FieldError, { children: controlledError })] }));
21291
+ return (jsxs(Field$2, { className: controlledClassName, children: [jsx(Label, { disabled: originalProps.disabled, hasError: hasError, htmlFor: originalProps.name, isHidden: isLabelHidden, children: label }), jsxs(Box$c, { ref: boxRef, isLight: isLight, children: [boxRef.current && (jsx(StyledAutoComplete, { "$isLight": isLight, container: boxRef.current, data: formattedOptions, id: originalProps.name, onChange: handleChange, onSelect: handleSelect, open: isOpen, renderMenuItem: (itemLabel, item) => MenuItem ? jsx(MenuItem, { item: item.value }) : itemLabel, value: inputValue, ...originalProps }, key)), inputValue && (jsxs(Fragment, { children: [jsx(StyledCloseButton, { accent: Accent.TERTIARY, color: THEME.color.slateGray, Icon: Close, isSearchIconVisible: isSearchIconVisible, onClick: clean, size: Size.SMALL }), isSearchIconVisible && jsx(Separator, { children: "|" })] })), isSearchIconVisible && jsx(StyledIconSearch, { color: THEME.color.slateGray, size: 20 })] }), !isErrorMessageHidden && hasError && jsx(FieldError, { children: controlledError })] }));
21269
21292
  }
21270
21293
  const StyledCloseButton = styled(IconButton) `
21271
21294
  cursor: pointer;
@@ -22191,6 +22214,7 @@ function DatePicker({ baseContainer, className, defaultValue, disabled = false,
22191
22214
  const selectedUtcTimeTupleRef = useRef(getUtcTimeTupleFromDayjs(selectedUtcDateAsDayjsRef.current));
22192
22215
  const previousDefaultValue = usePrevious(defaultValue);
22193
22216
  const { forceUpdate } = useForceUpdate();
22217
+ const controlledClassName = useMemo(() => classnames('Field-DatePicker', className), [className]);
22194
22218
  const controlledError = useMemo(() => normalizeString(error), [error]);
22195
22219
  const defaultTimeTuple = useMemo(() => (isEndDate ? ['23', '59'] : ['00', '00']), [isEndDate]);
22196
22220
  const hasError = useMemo(() => Boolean(controlledError), [controlledError]);
@@ -22316,7 +22340,7 @@ function DatePicker({ baseContainer, className, defaultValue, disabled = false,
22316
22340
  selectedUtcTimeTupleRef.current = getUtcTimeTupleFromDayjs(selectedUtcDateAsDayjsRef.current);
22317
22341
  forceUpdate();
22318
22342
  }, [defaultValue, forceUpdate, previousDefaultValue]);
22319
- return (jsxs(Fieldset, { className: classNames('Field-DatePicker', className), disabled: disabled, isLegendHidden: isLabelHidden, legend: label, ...nativeProps, children: [jsxs(Box$7, { ref: boxRef, children: [jsx(Field$1, { children: jsx(DateInput, { ref: dateInputRef, baseContainer: baseContainer || undefined, disabled: disabled, isCompact: isCompact, isEndDate: isEndDate, isForcedFocused: isCalendarPickerOpenRef.current, isLight: isLight, onChange: handleDateInputChange, onClick: openCalendarPicker, onInput: handleDateOrTimeInputInput, onNext: handleDateInputNext, value: selectedUtcDateTupleRef.current }) }), withTime && (jsx(Field$1, { "$isTimeField": true, children: jsx(TimeInput, { ref: timeInputRef, baseContainer: baseContainer || undefined, disabled: disabled, isCompact: isCompact, isLight: isLight, minutesRange: minutesRange, onBack: () => dateInputRef.current?.focus(true), onChange: handleTimeInputFilled, onFocus: closeCalendarPicker, onInput: handleDateOrTimeInputInput, onPrevious: () => dateInputRef.current?.focus(true), value: selectedUtcTimeTupleRef.current }, JSON.stringify(selectedUtcTimeTupleRef.current)) }))] }), !isErrorMessageHidden && hasError && jsx(FieldError, { children: controlledError }), jsx(CalendarPicker, { isHistorical: isHistorical, isOpen: isCalendarPickerOpenRef.current, onChange: handleCalendarPickerChange, value: calendarPickerDefaultValue })] }));
22343
+ return (jsxs(Fieldset, { className: controlledClassName, disabled: disabled, isLegendHidden: isLabelHidden, legend: label, ...nativeProps, children: [jsxs(Box$7, { ref: boxRef, children: [jsx(Field$1, { children: jsx(DateInput, { ref: dateInputRef, baseContainer: baseContainer || undefined, disabled: disabled, isCompact: isCompact, isEndDate: isEndDate, isForcedFocused: isCalendarPickerOpenRef.current, isLight: isLight, onChange: handleDateInputChange, onClick: openCalendarPicker, onInput: handleDateOrTimeInputInput, onNext: handleDateInputNext, value: selectedUtcDateTupleRef.current }) }), withTime && (jsx(Field$1, { "$isTimeField": true, children: jsx(TimeInput, { ref: timeInputRef, baseContainer: baseContainer || undefined, disabled: disabled, isCompact: isCompact, isLight: isLight, minutesRange: minutesRange, onBack: () => dateInputRef.current?.focus(true), onChange: handleTimeInputFilled, onFocus: closeCalendarPicker, onInput: handleDateOrTimeInputInput, onPrevious: () => dateInputRef.current?.focus(true), value: selectedUtcTimeTupleRef.current }, JSON.stringify(selectedUtcTimeTupleRef.current)) }))] }), !isErrorMessageHidden && hasError && jsx(FieldError, { children: controlledError }), jsx(CalendarPicker, { isHistorical: isHistorical, isOpen: isCalendarPickerOpenRef.current, onChange: handleCalendarPickerChange, value: calendarPickerDefaultValue })] }));
22320
22344
  }
22321
22345
  const Box$7 = styled.div `
22322
22346
  * {
@@ -22547,7 +22571,7 @@ var DateRangePosition;
22547
22571
  DateRangePosition["START"] = "START";
22548
22572
  })(DateRangePosition || (DateRangePosition = {}));
22549
22573
 
22550
- function DateRangePicker({ baseContainer, defaultValue, disabled = false, error, isCompact = false, isErrorMessageHidden = false, isHistorical = false, isLabelHidden = false, isLight = false, isStringDate = false, isUndefinedWhenDisabled = false, label, minutesRange = 15, onChange, withTime = false, ...nativeProps }) {
22574
+ function DateRangePicker({ baseContainer, className, defaultValue, disabled = false, error, isCompact = false, isErrorMessageHidden = false, isHistorical = false, isLabelHidden = false, isLight = false, isStringDate = false, isUndefinedWhenDisabled = false, label, minutesRange = 15, onChange, withTime = false, ...nativeProps }) {
22551
22575
  /* eslint-disable no-null/no-null */
22552
22576
  const startDateInputRef = useRef(null);
22553
22577
  const startTimeInputRef = useRef(null);
@@ -22564,6 +22588,7 @@ function DateRangePicker({ baseContainer, defaultValue, disabled = false, error,
22564
22588
  const selectedEndTimeTupleRef = useRef(getUtcTimeTupleFromDayjs(selectedEndDateAsDayjsRef.current));
22565
22589
  const previousDefaultValue = usePrevious(defaultValue);
22566
22590
  const { forceUpdate } = useForceUpdate();
22591
+ const controlledClassName = useMemo(() => classnames('Field-DateRangePicker', className), [className]);
22567
22592
  const controlledError = useMemo(() => normalizeString(error), [error]);
22568
22593
  const hasError = useMemo(() => Boolean(controlledError), [controlledError]);
22569
22594
  const rangeCalendarPickerDefaultValue = useMemo(() => selectedStartDateTupleRef.current && selectedEndDateTupleRef.current
@@ -22770,7 +22795,7 @@ function DateRangePicker({ baseContainer, defaultValue, disabled = false, error,
22770
22795
  selectedEndTimeTupleRef.current = getUtcTimeTupleFromDayjs(selectedEndDateAsDayjsRef.current);
22771
22796
  forceUpdate();
22772
22797
  }, [defaultValue, forceUpdate, previousDefaultValue]);
22773
- return (jsxs(Fieldset, { className: "Field-DateRangePicker", disabled: disabled, isLegendHidden: isLabelHidden, legend: label, ...nativeProps, children: [jsxs(Box$5, { isDisabled: disabled, children: [jsx(Field, { children: jsx(DateInput, { ref: startDateInputRef, baseContainer: baseContainer || undefined, disabled: disabled, isCompact: isCompact, isForcedFocused: isRangeCalendarPickerOpenRef.current, isLight: isLight, isRange: true, isStartDate: true, onChange: (nextDateTuple, isFilled) => handleDateInputChange(DateRangePosition.START, nextDateTuple, isFilled), onClick: openRangeCalendarPicker, onInput: handleDateOrTimeInputInput, onNext: handleStartDateInputNext, value: selectedStartDateTupleRef.current }) }), withTime && (jsx(Field, { isTimeField: true, children: jsx(TimeInput, { ref: startTimeInputRef, baseContainer: baseContainer || undefined, disabled: disabled, isCompact: isCompact, isLight: isLight, isStartDate: true, minutesRange: minutesRange, onBack: () => startDateInputRef.current?.focus(true), onChange: nextTimeTuple => handleTimeInputFilled(DateRangePosition.START, nextTimeTuple), onFocus: closeRangeCalendarPicker, onInput: handleDateOrTimeInputInput, onNext: () => endDateInputRef.current?.focus(), onPrevious: () => startDateInputRef.current?.focus(true), value: selectedStartTimeTupleRef.current }) })), jsx(Field, { isEndDateField: true, children: jsx(DateInput, { ref: endDateInputRef, baseContainer: baseContainer || undefined, disabled: disabled, isCompact: isCompact, isEndDate: true, isForcedFocused: isRangeCalendarPickerOpenRef.current, isLight: isLight, isRange: true, onBack: handleEndDateInputPrevious, onChange: (nextDateTuple, isFilled) => handleDateInputChange(DateRangePosition.END, nextDateTuple, isFilled), onClick: openRangeCalendarPicker, onInput: handleDateOrTimeInputInput, onNext: handleEndDateInputNext, onPrevious: handleEndDateInputPrevious, value: selectedEndDateTupleRef.current }) }), withTime && (jsx(Field, { isTimeField: true, children: jsx(TimeInput, { ref: endTimeInputRef, baseContainer: baseContainer || undefined, disabled: disabled, isCompact: isCompact, isEndDate: true, isLight: isLight, minutesRange: minutesRange, onBack: () => endDateInputRef.current?.focus(true), onChange: nextTimeTuple => handleTimeInputFilled(DateRangePosition.END, nextTimeTuple), onFocus: closeRangeCalendarPicker, onInput: handleDateOrTimeInputInput, onPrevious: () => endDateInputRef.current?.focus(true), value: selectedEndTimeTupleRef.current }) }))] }), !isErrorMessageHidden && hasError && jsx(FieldError, { children: controlledError }), jsx(RangeCalendarPicker, { defaultValue: rangeCalendarPickerDefaultValue, isHistorical: isHistorical, isOpen: isRangeCalendarPickerOpenRef.current, onChange: handleRangeCalendarPickerChange })] }));
22798
+ return (jsxs(Fieldset, { className: controlledClassName, disabled: disabled, isLegendHidden: isLabelHidden, legend: label, ...nativeProps, children: [jsxs(Box$5, { isDisabled: disabled, children: [jsx(Field, { children: jsx(DateInput, { ref: startDateInputRef, baseContainer: baseContainer || undefined, disabled: disabled, isCompact: isCompact, isForcedFocused: isRangeCalendarPickerOpenRef.current, isLight: isLight, isRange: true, isStartDate: true, onChange: (nextDateTuple, isFilled) => handleDateInputChange(DateRangePosition.START, nextDateTuple, isFilled), onClick: openRangeCalendarPicker, onInput: handleDateOrTimeInputInput, onNext: handleStartDateInputNext, value: selectedStartDateTupleRef.current }) }), withTime && (jsx(Field, { isTimeField: true, children: jsx(TimeInput, { ref: startTimeInputRef, baseContainer: baseContainer || undefined, disabled: disabled, isCompact: isCompact, isLight: isLight, isStartDate: true, minutesRange: minutesRange, onBack: () => startDateInputRef.current?.focus(true), onChange: nextTimeTuple => handleTimeInputFilled(DateRangePosition.START, nextTimeTuple), onFocus: closeRangeCalendarPicker, onInput: handleDateOrTimeInputInput, onNext: () => endDateInputRef.current?.focus(), onPrevious: () => startDateInputRef.current?.focus(true), value: selectedStartTimeTupleRef.current }) })), jsx(Field, { isEndDateField: true, children: jsx(DateInput, { ref: endDateInputRef, baseContainer: baseContainer || undefined, disabled: disabled, isCompact: isCompact, isEndDate: true, isForcedFocused: isRangeCalendarPickerOpenRef.current, isLight: isLight, isRange: true, onBack: handleEndDateInputPrevious, onChange: (nextDateTuple, isFilled) => handleDateInputChange(DateRangePosition.END, nextDateTuple, isFilled), onClick: openRangeCalendarPicker, onInput: handleDateOrTimeInputInput, onNext: handleEndDateInputNext, onPrevious: handleEndDateInputPrevious, value: selectedEndDateTupleRef.current }) }), withTime && (jsx(Field, { isTimeField: true, children: jsx(TimeInput, { ref: endTimeInputRef, baseContainer: baseContainer || undefined, disabled: disabled, isCompact: isCompact, isEndDate: true, isLight: isLight, minutesRange: minutesRange, onBack: () => endDateInputRef.current?.focus(true), onChange: nextTimeTuple => handleTimeInputFilled(DateRangePosition.END, nextTimeTuple), onFocus: closeRangeCalendarPicker, onInput: handleDateOrTimeInputInput, onPrevious: () => endDateInputRef.current?.focus(true), value: selectedEndTimeTupleRef.current }) }))] }), !isErrorMessageHidden && hasError && jsx(FieldError, { children: controlledError }), jsx(RangeCalendarPicker, { defaultValue: rangeCalendarPickerDefaultValue, isHistorical: isHistorical, isOpen: isRangeCalendarPickerOpenRef.current, onChange: handleRangeCalendarPickerChange })] }));
22774
22799
  }
22775
22800
  const Box$5 = styled.div `
22776
22801
  * {
@@ -32045,6 +32070,7 @@ const Box$1 = styled.div `
32045
32070
  const noop = () => { };
32046
32071
 
32047
32072
  function CoordinatesInput({ className, coordinatesFormat, defaultValue, error, isLabelHidden = false, isLight = false, label, onChange = noop, ...nativeProps }) {
32073
+ const controlledClassName = classnames('Field-CoordinatesInput', className);
32048
32074
  const controlledError = useMemo(() => normalizeString(error), [error]);
32049
32075
  const hasError = useMemo(() => Boolean(controlledError), [controlledError]);
32050
32076
  const getCoordinatesInput = useCallback(() => {
@@ -32061,7 +32087,7 @@ function CoordinatesInput({ className, coordinatesFormat, defaultValue, error, i
32061
32087
  }, [defaultValue, nativeProps.disabled, onChange, coordinatesFormat]);
32062
32088
  // TODO We must add a `handleDisable()` callback here to effectively empty the inputs when disabling this field.
32063
32089
  useFieldUndefineEffect(nativeProps.disabled, onChange /* , handleDisable */);
32064
- return (jsxs(StyledFieldset, { className: classNames('Field-CoordinatesInput', className), isLegendHidden: isLabelHidden, isLight: isLight, legend: label, ...nativeProps, children: [getCoordinatesInput(), hasError && jsx(FieldError, { children: controlledError })] }));
32090
+ return (jsxs(StyledFieldset, { className: controlledClassName, isLegendHidden: isLabelHidden, isLight: isLight, legend: label, ...nativeProps, children: [getCoordinatesInput(), hasError && jsx(FieldError, { children: controlledError })] }));
32065
32091
  }
32066
32092
  const StyledFieldset = styled(Fieldset) `
32067
32093
  input {