@mtes-mct/monitor-ui 7.2.1 → 7.3.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,18 @@
1
+ # [7.3.0](https://github.com/MTES-MCT/monitor-ui/compare/v7.2.1...v7.3.0) (2023-06-09)
2
+
3
+
4
+ ### Features
5
+
6
+ * **components:** clean naming for export ([83f3b1b](https://github.com/MTES-MCT/monitor-ui/commit/83f3b1bb3eec48b01abdea7444b6c8e2ca0f9c56))
7
+ * **components:** create SideMenu component ([1ba4358](https://github.com/MTES-MCT/monitor-ui/commit/1ba435820145634ce8449612d2f4e7ff63d894da))
8
+
9
+ ## [7.2.1](https://github.com/MTES-MCT/monitor-ui/compare/v7.2.0...v7.2.1) (2023-06-08)
10
+
11
+
12
+ ### Bug Fixes
13
+
14
+ * **elements:** unbold and italicize FieldError ([4ba529e](https://github.com/MTES-MCT/monitor-ui/commit/4ba529e97e1f90a7ea3beff4bf479081687c8e5f))
15
+
1
16
  # [7.2.0](https://github.com/MTES-MCT/monitor-ui/compare/v7.1.0...v7.2.0) (2023-06-05)
2
17
 
3
18
 
@@ -0,0 +1,10 @@
1
+ import { type IconButtonProps } from '../../elements/IconButton';
2
+ import type { IconProps } from '../../types';
3
+ import type { FunctionComponent } from 'react';
4
+ type SideMenuButtonProps = IconButtonProps & {
5
+ Icon: FunctionComponent<IconProps>;
6
+ isActive: boolean;
7
+ title: string;
8
+ };
9
+ export declare function Button({ Icon, isActive, title, ...originalProps }: SideMenuButtonProps): import("react/jsx-runtime").JSX.Element;
10
+ export {};
@@ -0,0 +1,12 @@
1
+ import { Button } from './Button';
2
+ import type { ReactNode } from 'react';
3
+ export type SideMenuProps = {
4
+ children: ReactNode;
5
+ };
6
+ export declare function Menu({ children }: SideMenuProps): import("react/jsx-runtime").JSX.Element;
7
+ export declare namespace Menu {
8
+ var displayName: string;
9
+ }
10
+ export declare const SideMenu: typeof Menu & {
11
+ Button: typeof Button;
12
+ };
package/index.d.ts CHANGED
@@ -14,6 +14,7 @@ export { Dialog } from './components/Dialog';
14
14
  export { Dropdown } from './components/Dropdown';
15
15
  export { NewWindow } from './components/NewWindow';
16
16
  export { NotificationEvent, Notifier } from './components/Notifier';
17
+ export { SideMenu } from './components/SideMenu';
17
18
  export { SingleTag } from './components/SingleTag';
18
19
  export { Button } from './elements/Button';
19
20
  export { Field } from './elements/Field';
@@ -73,6 +74,7 @@ export type { DialogProps } from './components/Dialog';
73
74
  export type { DropdownProps, DropdownItemProps } from './components/Dropdown';
74
75
  export type { NewWindowProps } from './components/NewWindow';
75
76
  export type { NotifierProps } from './components/Notifier';
77
+ export type { SideMenuProps } from './components/SideMenu';
76
78
  export type { SingleTagProps } from './components/SingleTag';
77
79
  export type { ButtonProps } from './elements/Button';
78
80
  export type { FieldProps } from './elements/Field';
package/index.js CHANGED
@@ -2645,7 +2645,7 @@ const ICON_SIZE = {
2645
2645
  [Size.NORMAL]: 20,
2646
2646
  [Size.SMALL]: 12
2647
2647
  };
2648
- function Button({ accent = Accent.PRIMARY, children, className, Icon, isFullWidth = false, onClick, size = Size.NORMAL, type = 'button', withUnpropagatedClick = false, ...nativeProps }) {
2648
+ function Button$1({ accent = Accent.PRIMARY, children, className, Icon, isFullWidth = false, onClick, size = Size.NORMAL, type = 'button', withUnpropagatedClick = false, ...nativeProps }) {
2649
2649
  const handleClick = useCallback((event) => {
2650
2650
  if (withUnpropagatedClick) {
2651
2651
  stopMouseEventPropagation(event);
@@ -2855,6 +2855,55 @@ const TertiaryButton = styled.button `
2855
2855
  }
2856
2856
  `;
2857
2857
 
2858
+ function Button({ Icon, isActive, title, ...originalProps }) {
2859
+ return jsx(MenuButton, { "$isActive": isActive, Icon: Icon, iconSize: 26, role: "menuitem", title: title, ...originalProps });
2860
+ }
2861
+ const MenuButton = styled(IconButton) `
2862
+ animation: none;
2863
+ background: ${p => (p.$isActive ? p.theme.color.blueGray[100] : 'none')};
2864
+ border: 0;
2865
+ border-bottom: solid 0.5px ${p => p.theme.color.slateGray};
2866
+ color: ${p => (p.$isActive ? p.theme.color.white : p.theme.color.gainsboro)};
2867
+ padding: 18px;
2868
+
2869
+ :hover,
2870
+ :focus {
2871
+ background: ${p => (p.$isActive ? p.theme.color.blueGray[100] : 'rgba(255, 255, 255, 0.125)')};
2872
+ border: 0;
2873
+ border: none;
2874
+ color: ${p => p.theme.color.white};
2875
+ }
2876
+
2877
+ :first-child {
2878
+ border-top: solid 0.5px ${p => p.theme.color.slateGray};
2879
+
2880
+ :hover {
2881
+ border: none;
2882
+ }
2883
+ }
2884
+ `;
2885
+
2886
+ function Menu({ children }) {
2887
+ return jsx(Wrapper, { role: "menu", children: children });
2888
+ }
2889
+ const Wrapper = styled.div `
2890
+ background-color: ${p => p.theme.color.charcoal};
2891
+ box-sizing: border-box;
2892
+ display: flex;
2893
+ height: 100vh;
2894
+ flex-direction: column;
2895
+ width: 64px;
2896
+ padding: 64px 0 0;
2897
+
2898
+ * {
2899
+ box-sizing: border-box;
2900
+ }
2901
+ `;
2902
+ Menu.displayName = 'SideMenu';
2903
+ const SideMenu = Object.assign(Menu, {
2904
+ Button
2905
+ });
2906
+
2858
2907
  /**
2859
2908
  * Internal component used to wrap SVG icon components
2860
2909
  */
@@ -26084,7 +26133,7 @@ function MultiZoneEditor({ addButtonLabel, className, defaultValue = [], disable
26084
26133
  setZones(defaultValue);
26085
26134
  }, [defaultValue]);
26086
26135
  useFieldUndefineEffect(disabled, onChange, handleDisable);
26087
- return (jsxs(Fieldset, { className: controlledClassName, disabled: disabled, isLegendHidden: isLabelHidden, legend: label, style: style, children: [jsx(Button, { accent: Accent.SECONDARY, disabled: disabled || isAddButtonDisabled, Icon: Plus, isFullWidth: true, onClick: addZone, children: addButtonLabel }), jsx(Fragment, { children: zones.map((zone, index) => (
26136
+ return (jsxs(Fieldset, { className: controlledClassName, disabled: disabled, isLegendHidden: isLabelHidden, legend: label, style: style, children: [jsx(Button$1, { accent: Accent.SECONDARY, disabled: disabled || isAddButtonDisabled, Icon: Plus, isFullWidth: true, onClick: addZone, children: addButtonLabel }), jsx(Fragment, { children: zones.map((zone, index) => (
26088
26137
  // eslint-disable-next-line react/no-array-index-key
26089
26138
  jsxs(Row, { children: [jsxs(ZoneBox, { "$isLight": isLight, children: [zone[labelPropName], jsxs(Link, { onClick: () => centerZone(zone), children: [jsx(SelectRectangle, {}), jsx("span", { children: "Centrer sur la carte" })] })] }), jsx(IconButton, { accent: Accent.SECONDARY, Icon: Edit, onClick: () => editZone(index, zone) }), jsx(IconButton, { accent: Accent.SECONDARY, "aria-label": "Supprimer cette zone", Icon: Delete, onClick: () => deleteZone(index) })] }, `zone-${index}`))) }), hasError && jsx(FieldError, { children: controlledError })] }));
26090
26139
  }
@@ -35537,5 +35586,5 @@ function logSoftError({ context = {}, isSideWindowError = false, message, origin
35537
35586
  }
35538
35587
  }
35539
35588
 
35540
- export { Accent, Button, Checkbox, CoordinatesFormat, CoordinatesInput, CustomSearch, DatePicker, DateRangePicker, Dialog, Dropdown, Field$2 as Field, FieldError, 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, NotificationEvent, Notifier, 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, logSoftError, stopMouseEventPropagation, useClickOutsideEffect, useFieldControl, useForceUpdate, useKey, useNewWindow, usePrevious };
35589
+ export { Accent, Button$1 as Button, Checkbox, CoordinatesFormat, CoordinatesInput, CustomSearch, DatePicker, DateRangePicker, Dialog, Dropdown, Field$2 as Field, FieldError, 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, NotificationEvent, Notifier, NumberInput, OPENLAYERS_PROJECTION, OnlyFontGlobalStyle, Search, Select, SideMenu, SimpleTable, SingleTag, Size, THEME, Tag, TagBullet, TagGroup, TextInput, Textarea, ThemeProvider, WSG84_PROJECTION, coordinatesAreDistinct, customDayjs, getCoordinates, getLocalizedDayjs, getPseudoRandomString, getUtcizedDayjs, isNumeric, logSoftError, stopMouseEventPropagation, useClickOutsideEffect, useFieldControl, useForceUpdate, useKey, useNewWindow, usePrevious };
35541
35590
  //# sourceMappingURL=index.js.map