@mtes-mct/monitor-ui 5.8.0 → 5.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,26 @@
1
+ ## [5.8.1](https://github.com/MTES-MCT/monitor-ui/compare/v5.8.0...v5.8.1) (2023-05-04)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **fields:** add missing isUndefinedWhenDisabled prop to DatePicker & DateRangePicker ([17ba4f8](https://github.com/MTES-MCT/monitor-ui/commit/17ba4f8a60204c9a297d59c167c0ae2d872070cf))
7
+
8
+ # [5.8.0](https://github.com/MTES-MCT/monitor-ui/compare/v5.7.1...v5.8.0) (2023-05-04)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **components:** retype onChangeFocus callback param in NewWindow ([da16a87](https://github.com/MTES-MCT/monitor-ui/commit/da16a87d9e461de08beb61b0f6875742ea22c19a))
14
+ * **elements:** code review of SimpleTable ([34d7466](https://github.com/MTES-MCT/monitor-ui/commit/34d7466117fd8d08c6921e8f04e17b251ebbc957))
15
+ * **elements:** improve style of SimpleTable ([6bfac8d](https://github.com/MTES-MCT/monitor-ui/commit/6bfac8d58141e7c3911f8f5aed605d3dc5df1abf))
16
+ * **elements:** lint and type of SimpleTable ([9e45fde](https://github.com/MTES-MCT/monitor-ui/commit/9e45fde0e47089a0f053b48e6b702660d942050a))
17
+
18
+
19
+ ### Features
20
+
21
+ * **elements:** add SimpleTable ([6517305](https://github.com/MTES-MCT/monitor-ui/commit/6517305af0b999c7dd2090460ed05d18ee797818))
22
+ * **elements:** export component and move story in elements folder ([ca7c012](https://github.com/MTES-MCT/monitor-ui/commit/ca7c0122eae40a60f1fa405b29541e41d432525b))
23
+
1
24
  ## [5.7.1](https://github.com/MTES-MCT/monitor-ui/compare/v5.7.0...v5.7.1) (2023-05-03)
2
25
 
3
26
 
@@ -0,0 +1 @@
1
+ export declare const Action: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
@@ -0,0 +1 @@
1
+ export declare const Body: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
@@ -0,0 +1 @@
1
+ export declare const Title: import("styled-components").StyledComponent<"h4", import("styled-components").DefaultTheme, {}, never>;
@@ -0,0 +1,16 @@
1
+ import type { HTMLAttributes } from 'react';
2
+ export type DialogProps = HTMLAttributes<HTMLDivElement> & {
3
+ isAbsolute?: boolean;
4
+ };
5
+ export declare function RawDialog({ children, isAbsolute, ...nativeProps }: DialogProps): JSX.Element;
6
+ export declare namespace RawDialog {
7
+ var displayName: string;
8
+ }
9
+ export declare const Box: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
10
+ $isAbsolute: boolean;
11
+ }, never>;
12
+ export declare const Dialog: typeof RawDialog & {
13
+ Action: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
14
+ Body: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
15
+ Title: import("styled-components").StyledComponent<"h4", import("styled-components").DefaultTheme, {}, never>;
16
+ };
@@ -37,6 +37,7 @@ export interface DatePickerProps extends Omit<HTMLAttributes<HTMLFieldSetElement
37
37
  isLabelHidden?: boolean | undefined;
38
38
  isLight?: boolean | undefined;
39
39
  isStringDate?: boolean | undefined;
40
+ isUndefinedWhenDisabled?: boolean | undefined;
40
41
  label: string;
41
42
  /**
42
43
  * Range of minutes used to generate the time picker list.
@@ -16,7 +16,7 @@ export type NumberInputProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'defa
16
16
  onPrevious?: (() => Promisable<void>) | undefined;
17
17
  size: number;
18
18
  };
19
- export declare const NumberInput: import("react").ForwardRefExoticComponent<Omit<InputHTMLAttributes<HTMLInputElement>, "pattern" | "defaultValue" | "onInput" | "type" | "maxLength"> & {
19
+ export declare const NumberInput: import("react").ForwardRefExoticComponent<Omit<InputHTMLAttributes<HTMLInputElement>, "pattern" | "type" | "defaultValue" | "onInput" | "maxLength"> & {
20
20
  isLight: boolean;
21
21
  max: number;
22
22
  min: number;
@@ -40,6 +40,7 @@ export interface DateRangePickerProps extends Omit<HTMLAttributes<HTMLFieldSetEl
40
40
  isLabelHidden?: boolean | undefined;
41
41
  isLight?: boolean | undefined;
42
42
  isStringDate?: boolean | undefined;
43
+ isUndefinedWhenDisabled?: boolean | undefined;
43
44
  label: string;
44
45
  /**
45
46
  * Range of minutes used to generate the time picker list.
package/index.d.ts CHANGED
@@ -10,6 +10,7 @@ export { GlobalStyle } from './GlobalStyle';
10
10
  export { OnlyFontGlobalStyle } from './OnlyFontGlobalStyle';
11
11
  export { THEME } from './theme';
12
12
  export { ThemeProvider } from './ThemeProvider';
13
+ export { Dialog } from './components/Dialog';
13
14
  export { Dropdown } from './components/Dropdown';
14
15
  export { NewWindow } from './components/NewWindow';
15
16
  export { SingleTag } from './components/SingleTag';
@@ -65,6 +66,7 @@ export { isNumeric } from './utils/isNumeric';
65
66
  export { stopMouseEventPropagation } from './utils/stopMouseEventPropagation';
66
67
  export type { PartialTheme, Theme } from './theme';
67
68
  export type { Coordinates, DateAsStringRange, DateRange, Defined, IconProps, Option, OptionValueType, Undefine } from './types';
69
+ export type { DialogProps } from './components/Dialog';
68
70
  export type { DropdownProps, DropdownItemProps } from './components/Dropdown';
69
71
  export type { NewWindowProps } from './components/NewWindow';
70
72
  export type { SingleTagProps } from './components/SingleTag';
package/index.js CHANGED
@@ -2163,6 +2163,106 @@ function ThemeProvider({ children, theme = {} }) {
2163
2163
  return jsx(UntypedStyledComponentsThemeProvider, { theme: finalTheme, children: children });
2164
2164
  }
2165
2165
 
2166
+ const Action = styled.div `
2167
+ background-color: ${p => p.theme.color.white};
2168
+ border-bottom-left-radius: 2px;
2169
+ border-bottom-right-radius: 2px;
2170
+ display: flex;
2171
+ flex-direction: column-reverse;
2172
+ padding: 8px 8px 8px 8px;
2173
+ @media (min-width: 740px) {
2174
+ align-items: center;
2175
+ flex-direction: row;
2176
+ justify-content: center;
2177
+ padding: 48px 8px 48px 8px;
2178
+ }
2179
+
2180
+ > button {
2181
+ margin-bottom: 2px;
2182
+ }
2183
+ @media (min-width: 740px) {
2184
+ > button {
2185
+ margin-bottom: 0;
2186
+ margin-right: 2px;
2187
+ }
2188
+ }
2189
+ `;
2190
+
2191
+ const Body = styled.div `
2192
+ background-color: ${p => p.theme.color.white};
2193
+ border-top-left-radius: 2px;
2194
+ border-top-right-radius: 2px;
2195
+ display: flex;
2196
+ flex-direction: column;
2197
+ padding: 8px 8px 8px 8px;
2198
+ text-align: center;
2199
+ @media (min-width: 740px) {
2200
+ padding: 48px 8px 8px 8px;
2201
+ text-align: center;
2202
+ }
2203
+
2204
+ > p {
2205
+ color: ${p => p.theme.color.slateGray};
2206
+ padding-top: 2px;
2207
+ }
2208
+ `;
2209
+
2210
+ const Title = styled.h4 `
2211
+ font-size: 125%;
2212
+ font-weight: 500;
2213
+ line-height: 48px;
2214
+ padding-bottom: 2px;
2215
+ height: 48px;
2216
+ color: ${p => p.theme.color.white};
2217
+ background-color: ${p => p.theme.color.charcoal};
2218
+ text-align: center;
2219
+ `;
2220
+
2221
+ function RawDialog({ children, isAbsolute = false, ...nativeProps }) {
2222
+ return (jsxs(Box$g, { "$isAbsolute": isAbsolute, ...nativeProps, onClick: e => e.stopPropagation(), children: [jsx(Overlay, { "$isAbsolute": isAbsolute }), jsx(Window, { "$isAbsolute": isAbsolute, children: children })] }));
2223
+ }
2224
+ const Box$g = styled.div `
2225
+ position: ${p => (p.$isAbsolute ? 'absolute' : 'fixed')};
2226
+ top: 0;
2227
+ bottom: 0;
2228
+ right: 0;
2229
+ left: 0;
2230
+ display: flex;
2231
+ justify-content: center;
2232
+ align-items: center;
2233
+ overflow-y: auto;
2234
+ z-index: 9000;
2235
+ `;
2236
+ const Overlay = styled.div `
2237
+ background-color: ${p => p.theme.color.charcoal};
2238
+ bottom: 0;
2239
+ left: 0;
2240
+ opacity: 0.53;
2241
+ position: ${p => (p.$isAbsolute ? 'absolute' : 'fixed')};
2242
+ right: 0;
2243
+ top: 0;
2244
+ z-index: 1;
2245
+ `;
2246
+ const Window = styled.div `
2247
+ border-radius: 2px;
2248
+ bottom: 100px;
2249
+ box-shadow: 4px;
2250
+ max-width: 32rem;
2251
+ position: ${p => (p.$isAbsolute ? 'absolute' : 'fixed')};
2252
+ width: calc(100% - 2 * 8px);
2253
+ z-index: 1;
2254
+ @media (min-width: 740px) {
2255
+ bottom: auto;
2256
+ min-width: 586px;
2257
+ }
2258
+ `;
2259
+ RawDialog.displayName = 'Dialog';
2260
+ const Dialog = Object.assign(RawDialog, {
2261
+ Action,
2262
+ Body,
2263
+ Title
2264
+ });
2265
+
2166
2266
  function Item({ Icon, ...originalProps }) {
2167
2267
  const icon = useMemo(() => (Icon ? jsx(Icon, { size: 20 }) : undefined), [Icon]);
2168
2268
  const hasIcon = useMemo(() => Boolean(Icon), [Icon]);
@@ -22207,7 +22307,7 @@ const InputGroup = styled.div `
22207
22307
  }
22208
22308
  `;
22209
22309
 
22210
- function DatePicker({ baseContainer, className, defaultValue, disabled = false, error, isCompact = false, isEndDate = false, isErrorMessageHidden = false, isHistorical = false, isLabelHidden = false, isLight = false, isStringDate = false, label, minutesRange = 15, onChange, withTime = false, ...nativeProps }) {
22310
+ function DatePicker({ baseContainer, className, defaultValue, disabled = false, error, isCompact = false, isEndDate = false, isErrorMessageHidden = false, isHistorical = false, isLabelHidden = false, isLight = false, isStringDate = false, isUndefinedWhenDisabled = false, label, minutesRange = 15, onChange, withTime = false, ...nativeProps }) {
22211
22311
  /* eslint-disable no-null/no-null */
22212
22312
  const boxRef = useRef(null);
22213
22313
  const dateInputRef = useRef(null);
@@ -22327,7 +22427,7 @@ function DatePicker({ baseContainer, className, defaultValue, disabled = false,
22327
22427
  isCalendarPickerOpenRef.current = true;
22328
22428
  forceUpdate();
22329
22429
  }, [forceUpdate]);
22330
- useFieldUndefineEffect(disabled, onChange, handleDisable);
22430
+ useFieldUndefineEffect(isUndefinedWhenDisabled && disabled, onChange, handleDisable);
22331
22431
  useClickOutsideEffect(boxRef, closeCalendarPicker, baseContainer);
22332
22432
  useEffect(() => {
22333
22433
  if (!hasMountedRef.current) {
@@ -22576,7 +22676,7 @@ var DateRangePosition;
22576
22676
  DateRangePosition["START"] = "START";
22577
22677
  })(DateRangePosition || (DateRangePosition = {}));
22578
22678
 
22579
- function DateRangePicker({ baseContainer, defaultValue, disabled = false, error, isCompact = false, isErrorMessageHidden = false, isHistorical = false, isLabelHidden = false, isLight = false, isStringDate = false, label, minutesRange = 15, onChange, withTime = false, ...nativeProps }) {
22679
+ 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 }) {
22580
22680
  /* eslint-disable no-null/no-null */
22581
22681
  const startDateInputRef = useRef(null);
22582
22682
  const startTimeInputRef = useRef(null);
@@ -22773,7 +22873,7 @@ function DateRangePicker({ baseContainer, defaultValue, disabled = false, error,
22773
22873
  isRangeCalendarPickerOpenRef.current = true;
22774
22874
  forceUpdate();
22775
22875
  }, [forceUpdate]);
22776
- useFieldUndefineEffect(disabled, onChange, handleDisable);
22876
+ useFieldUndefineEffect(isUndefinedWhenDisabled && disabled, onChange, handleDisable);
22777
22877
  useClickOutsideEffect([endDateInputRef, startDateInputRef], closeRangeCalendarPicker, baseContainer);
22778
22878
  useEffect(() => {
22779
22879
  if (!hasMountedRef.current) {
@@ -32448,5 +32548,5 @@ function useNewWindow() {
32448
32548
  return contextValue;
32449
32549
  }
32450
32550
 
32451
- export { Accent, Button, Checkbox, CoordinatesFormat, CoordinatesInput, DatePicker, DateRangePicker, Dropdown, Field$2 as Field, Fieldset, FormikCheckbox, FormikCoordinatesInput, FormikDatePicker, FormikDateRangePicker, FormikEffect, FormikMultiCheckbox, FormikMultiRadio, FormikMultiSelect, FormikNumberInput, FormikSearch, FormikSelect, FormikTextInput, FormikTextarea, GlobalStyle, index as Icon, IconButton, Label, Legend, MultiCheckbox, MultiRadio, MultiSelect, MultiZoneEditor, NewWindow, NewWindowContext, NumberInput, OPENLAYERS_PROJECTION, OnlyFontGlobalStyle, Search, Select, SimpleTable, SingleTag, Size, THEME, Tag, TagBullet, TagGroup, TextInput, Textarea, ThemeProvider, WSG84_PROJECTION, coordinatesAreDistinct, customDayjs, getCoordinates, getLocalizedDayjs, getPseudoRandomString, getUtcizedDayjs, isNumeric, noop, stopMouseEventPropagation, useClickOutsideEffect, useFieldControl, useForceUpdate, useKey, useNewWindow, usePrevious };
32551
+ export { Accent, Button, Checkbox, CoordinatesFormat, CoordinatesInput, DatePicker, DateRangePicker, Dialog, Dropdown, Field$2 as Field, Fieldset, FormikCheckbox, FormikCoordinatesInput, FormikDatePicker, FormikDateRangePicker, FormikEffect, FormikMultiCheckbox, FormikMultiRadio, FormikMultiSelect, FormikNumberInput, FormikSearch, FormikSelect, FormikTextInput, FormikTextarea, GlobalStyle, index as Icon, IconButton, Label, Legend, MultiCheckbox, MultiRadio, MultiSelect, MultiZoneEditor, NewWindow, NewWindowContext, NumberInput, OPENLAYERS_PROJECTION, OnlyFontGlobalStyle, Search, Select, SimpleTable, SingleTag, Size, THEME, Tag, TagBullet, TagGroup, TextInput, Textarea, ThemeProvider, WSG84_PROJECTION, coordinatesAreDistinct, customDayjs, getCoordinates, getLocalizedDayjs, getPseudoRandomString, getUtcizedDayjs, isNumeric, noop, stopMouseEventPropagation, useClickOutsideEffect, useFieldControl, useForceUpdate, useKey, useNewWindow, usePrevious };
32452
32552
  //# sourceMappingURL=index.js.map