@mtes-mct/monitor-ui 5.9.0 → 5.9.2
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 +14 -0
- package/components/Dialog/index.d.ts +2 -2
- package/elements/Button.d.ts +1 -1
- package/elements/IconButton.d.ts +1 -1
- package/index.js +75 -87
- package/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [5.9.1](https://github.com/MTES-MCT/monitor-ui/compare/v5.9.0...v5.9.1) (2023-05-05)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **components:** add default class name to Dialog ([b74ea15](https://github.com/MTES-MCT/monitor-ui/commit/b74ea15a9ae9d629e99eb2917a2acc3b88936736))
|
|
7
|
+
|
|
8
|
+
# [5.9.0](https://github.com/MTES-MCT/monitor-ui/compare/v5.8.1...v5.9.0) (2023-05-05)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* **components:** add Dialog ([89057d2](https://github.com/MTES-MCT/monitor-ui/commit/89057d25674f76b8298fc432a6bd1f521b25f605))
|
|
14
|
+
|
|
1
15
|
## [5.8.1](https://github.com/MTES-MCT/monitor-ui/compare/v5.8.0...v5.8.1) (2023-05-04)
|
|
2
16
|
|
|
3
17
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { HTMLAttributes } from 'react';
|
|
2
2
|
export type DialogProps = HTMLAttributes<HTMLDivElement> & {
|
|
3
3
|
isAbsolute?: boolean;
|
|
4
4
|
};
|
|
5
|
-
export declare function RawDialog({ children, isAbsolute, ...nativeProps }: DialogProps): JSX.Element;
|
|
5
|
+
export declare function RawDialog({ children, className, isAbsolute, ...nativeProps }: DialogProps): JSX.Element;
|
|
6
6
|
export declare namespace RawDialog {
|
|
7
7
|
var displayName: string;
|
|
8
8
|
}
|
package/elements/Button.d.ts
CHANGED
|
@@ -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,
|
|
11
|
+
export declare function Button({ accent, children, 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>;
|
package/elements/IconButton.d.ts
CHANGED
|
@@ -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,
|
|
12
|
+
export declare function IconButton({ accent, color, Icon, iconSize, size, type, ...nativeProps }: IconButtonProps): JSX.Element;
|
package/index.js
CHANGED
|
@@ -2163,6 +2163,68 @@ function ThemeProvider({ children, theme = {} }) {
|
|
|
2163
2163
|
return jsx(UntypedStyledComponentsThemeProvider, { theme: finalTheme, children: children });
|
|
2164
2164
|
}
|
|
2165
2165
|
|
|
2166
|
+
var classnames = {exports: {}};
|
|
2167
|
+
|
|
2168
|
+
/*!
|
|
2169
|
+
Copyright (c) 2018 Jed Watson.
|
|
2170
|
+
Licensed under the MIT License (MIT), see
|
|
2171
|
+
http://jedwatson.github.io/classnames
|
|
2172
|
+
*/
|
|
2173
|
+
|
|
2174
|
+
(function (module) {
|
|
2175
|
+
/* global define */
|
|
2176
|
+
|
|
2177
|
+
(function () {
|
|
2178
|
+
|
|
2179
|
+
var hasOwn = {}.hasOwnProperty;
|
|
2180
|
+
|
|
2181
|
+
function classNames() {
|
|
2182
|
+
var classes = [];
|
|
2183
|
+
|
|
2184
|
+
for (var i = 0; i < arguments.length; i++) {
|
|
2185
|
+
var arg = arguments[i];
|
|
2186
|
+
if (!arg) continue;
|
|
2187
|
+
|
|
2188
|
+
var argType = typeof arg;
|
|
2189
|
+
|
|
2190
|
+
if (argType === 'string' || argType === 'number') {
|
|
2191
|
+
classes.push(arg);
|
|
2192
|
+
} else if (Array.isArray(arg)) {
|
|
2193
|
+
if (arg.length) {
|
|
2194
|
+
var inner = classNames.apply(null, arg);
|
|
2195
|
+
if (inner) {
|
|
2196
|
+
classes.push(inner);
|
|
2197
|
+
}
|
|
2198
|
+
}
|
|
2199
|
+
} else if (argType === 'object') {
|
|
2200
|
+
if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {
|
|
2201
|
+
classes.push(arg.toString());
|
|
2202
|
+
continue;
|
|
2203
|
+
}
|
|
2204
|
+
|
|
2205
|
+
for (var key in arg) {
|
|
2206
|
+
if (hasOwn.call(arg, key) && arg[key]) {
|
|
2207
|
+
classes.push(key);
|
|
2208
|
+
}
|
|
2209
|
+
}
|
|
2210
|
+
}
|
|
2211
|
+
}
|
|
2212
|
+
|
|
2213
|
+
return classes.join(' ');
|
|
2214
|
+
}
|
|
2215
|
+
|
|
2216
|
+
if (module.exports) {
|
|
2217
|
+
classNames.default = classNames;
|
|
2218
|
+
module.exports = classNames;
|
|
2219
|
+
} else {
|
|
2220
|
+
window.classNames = classNames;
|
|
2221
|
+
}
|
|
2222
|
+
}());
|
|
2223
|
+
} (classnames));
|
|
2224
|
+
|
|
2225
|
+
var classnamesExports = classnames.exports;
|
|
2226
|
+
var classNames = /*@__PURE__*/getDefaultExportFromCjs(classnamesExports);
|
|
2227
|
+
|
|
2166
2228
|
const Action = styled.div `
|
|
2167
2229
|
background-color: ${p => p.theme.color.white};
|
|
2168
2230
|
border-bottom-left-radius: 2px;
|
|
@@ -2218,8 +2280,13 @@ const Title = styled.h4 `
|
|
|
2218
2280
|
text-align: center;
|
|
2219
2281
|
`;
|
|
2220
2282
|
|
|
2221
|
-
function
|
|
2222
|
-
|
|
2283
|
+
function stopMouseEventPropagation(event) {
|
|
2284
|
+
event.stopPropagation();
|
|
2285
|
+
}
|
|
2286
|
+
|
|
2287
|
+
function RawDialog({ children, className, isAbsolute = false, ...nativeProps }) {
|
|
2288
|
+
const controlledClassName = useMemo(() => classNames('Component-Dialog', className), [className]);
|
|
2289
|
+
return (jsxs(Box$g, { "$isAbsolute": isAbsolute, className: controlledClassName, ...nativeProps, onClick: stopMouseEventPropagation, children: [jsx(Overlay, { "$isAbsolute": isAbsolute }), jsx(Window, { "$isAbsolute": isAbsolute, children: children })] }));
|
|
2223
2290
|
}
|
|
2224
2291
|
const Box$g = styled.div `
|
|
2225
2292
|
position: ${p => (p.$isAbsolute ? 'absolute' : 'fixed')};
|
|
@@ -2637,32 +2704,21 @@ function toWindowFeatures(features) {
|
|
|
2637
2704
|
.join(',');
|
|
2638
2705
|
}
|
|
2639
2706
|
|
|
2640
|
-
function stopMouseEventPropagation(event) {
|
|
2641
|
-
event.stopPropagation();
|
|
2642
|
-
}
|
|
2643
|
-
|
|
2644
2707
|
const ICON_SIZE = {
|
|
2645
2708
|
[Size.LARGE]: 20,
|
|
2646
2709
|
[Size.NORMAL]: 20,
|
|
2647
2710
|
[Size.SMALL]: 12
|
|
2648
2711
|
};
|
|
2649
|
-
function Button({ accent = Accent.PRIMARY, children, Icon, isFullWidth = false,
|
|
2712
|
+
function Button({ accent = Accent.PRIMARY, children, Icon, isFullWidth = false, size = Size.NORMAL, type = 'button', ...nativeProps }) {
|
|
2650
2713
|
const commonChildren = useMemo(() => (jsxs(Fragment, { children: [Icon && jsx(Icon, { size: ICON_SIZE[size] }), children && jsx(ButtonLabel, { children: children })] })), [children, Icon, size]);
|
|
2651
|
-
const handleClick = useCallback((event) => {
|
|
2652
|
-
stopMouseEventPropagation(event);
|
|
2653
|
-
if (onClick) {
|
|
2654
|
-
onClick(event);
|
|
2655
|
-
}
|
|
2656
|
-
}, [onClick]);
|
|
2657
2714
|
const commonProps = useMemo(() => ({
|
|
2658
2715
|
as: StyledButton$1,
|
|
2659
2716
|
children: commonChildren,
|
|
2660
2717
|
isFullWidth,
|
|
2661
|
-
onClick: handleClick,
|
|
2662
2718
|
size,
|
|
2663
2719
|
type,
|
|
2664
2720
|
...nativeProps
|
|
2665
|
-
}), [commonChildren, isFullWidth,
|
|
2721
|
+
}), [commonChildren, isFullWidth, nativeProps, size, type]);
|
|
2666
2722
|
switch (accent) {
|
|
2667
2723
|
case Accent.SECONDARY:
|
|
2668
2724
|
return jsx(SecondaryButton, { ...commonProps });
|
|
@@ -2788,7 +2844,7 @@ const ICON_SIZE_IN_PX = {
|
|
|
2788
2844
|
[Size.NORMAL]: 20,
|
|
2789
2845
|
[Size.SMALL]: 14
|
|
2790
2846
|
};
|
|
2791
|
-
function IconButton({ accent = Accent.PRIMARY, color, Icon, iconSize,
|
|
2847
|
+
function IconButton({ accent = Accent.PRIMARY, color, Icon, iconSize, size = Size.NORMAL, type = 'button', ...nativeProps }) {
|
|
2792
2848
|
const children = useMemo(() => jsx(Icon, { color: color, size: iconSize || ICON_SIZE_IN_PX[size] }), [color, Icon, iconSize, size]);
|
|
2793
2849
|
const commonProps = useMemo(() => ({
|
|
2794
2850
|
children,
|
|
@@ -2796,19 +2852,13 @@ function IconButton({ accent = Accent.PRIMARY, color, Icon, iconSize, onClick, s
|
|
|
2796
2852
|
type,
|
|
2797
2853
|
...nativeProps
|
|
2798
2854
|
}), [children, nativeProps, size, type]);
|
|
2799
|
-
const handleClick = useCallback((event) => {
|
|
2800
|
-
stopMouseEventPropagation(event);
|
|
2801
|
-
if (onClick) {
|
|
2802
|
-
onClick(event);
|
|
2803
|
-
}
|
|
2804
|
-
}, [onClick]);
|
|
2805
2855
|
switch (accent) {
|
|
2806
2856
|
case Accent.SECONDARY:
|
|
2807
|
-
return jsx(SecondaryButton, { as: StyledButton,
|
|
2857
|
+
return jsx(SecondaryButton, { as: StyledButton, ...commonProps });
|
|
2808
2858
|
case Accent.TERTIARY:
|
|
2809
|
-
return jsx(TertiaryButton, { as: StyledButton,
|
|
2859
|
+
return jsx(TertiaryButton, { as: StyledButton, ...commonProps });
|
|
2810
2860
|
default:
|
|
2811
|
-
return jsx(PrimaryButton, { as: StyledButton,
|
|
2861
|
+
return jsx(PrimaryButton, { as: StyledButton, ...commonProps });
|
|
2812
2862
|
}
|
|
2813
2863
|
}
|
|
2814
2864
|
const PADDING = {
|
|
@@ -3247,68 +3297,6 @@ const StyledIconButton = styled(IconButton) `
|
|
|
3247
3297
|
}
|
|
3248
3298
|
`;
|
|
3249
3299
|
|
|
3250
|
-
var classnames = {exports: {}};
|
|
3251
|
-
|
|
3252
|
-
/*!
|
|
3253
|
-
Copyright (c) 2018 Jed Watson.
|
|
3254
|
-
Licensed under the MIT License (MIT), see
|
|
3255
|
-
http://jedwatson.github.io/classnames
|
|
3256
|
-
*/
|
|
3257
|
-
|
|
3258
|
-
(function (module) {
|
|
3259
|
-
/* global define */
|
|
3260
|
-
|
|
3261
|
-
(function () {
|
|
3262
|
-
|
|
3263
|
-
var hasOwn = {}.hasOwnProperty;
|
|
3264
|
-
|
|
3265
|
-
function classNames() {
|
|
3266
|
-
var classes = [];
|
|
3267
|
-
|
|
3268
|
-
for (var i = 0; i < arguments.length; i++) {
|
|
3269
|
-
var arg = arguments[i];
|
|
3270
|
-
if (!arg) continue;
|
|
3271
|
-
|
|
3272
|
-
var argType = typeof arg;
|
|
3273
|
-
|
|
3274
|
-
if (argType === 'string' || argType === 'number') {
|
|
3275
|
-
classes.push(arg);
|
|
3276
|
-
} else if (Array.isArray(arg)) {
|
|
3277
|
-
if (arg.length) {
|
|
3278
|
-
var inner = classNames.apply(null, arg);
|
|
3279
|
-
if (inner) {
|
|
3280
|
-
classes.push(inner);
|
|
3281
|
-
}
|
|
3282
|
-
}
|
|
3283
|
-
} else if (argType === 'object') {
|
|
3284
|
-
if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {
|
|
3285
|
-
classes.push(arg.toString());
|
|
3286
|
-
continue;
|
|
3287
|
-
}
|
|
3288
|
-
|
|
3289
|
-
for (var key in arg) {
|
|
3290
|
-
if (hasOwn.call(arg, key) && arg[key]) {
|
|
3291
|
-
classes.push(key);
|
|
3292
|
-
}
|
|
3293
|
-
}
|
|
3294
|
-
}
|
|
3295
|
-
}
|
|
3296
|
-
|
|
3297
|
-
return classes.join(' ');
|
|
3298
|
-
}
|
|
3299
|
-
|
|
3300
|
-
if (module.exports) {
|
|
3301
|
-
classNames.default = classNames;
|
|
3302
|
-
module.exports = classNames;
|
|
3303
|
-
} else {
|
|
3304
|
-
window.classNames = classNames;
|
|
3305
|
-
}
|
|
3306
|
-
}());
|
|
3307
|
-
} (classnames));
|
|
3308
|
-
|
|
3309
|
-
var classnamesExports = classnames.exports;
|
|
3310
|
-
var classNames = /*@__PURE__*/getDefaultExportFromCjs(classnamesExports);
|
|
3311
|
-
|
|
3312
3300
|
const Field$2 = styled.div.attrs(props => ({
|
|
3313
3301
|
className: classNames('Element-Field', props.className)
|
|
3314
3302
|
})) `
|