@mtes-mct/monitor-ui 9.0.1 → 9.1.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 +14 -0
- package/index.js +33 -9
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/src/elements/IconButton.d.ts +3 -1
- package/src/libs/CustomSearch.d.ts +12 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [9.1.0](https://github.com/MTES-MCT/monitor-ui/compare/v9.0.1...v9.1.0) (2023-08-25)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **elements:** add isCompact prop to IconButton ([ec25e63](https://github.com/MTES-MCT/monitor-ui/commit/ec25e63a2dc4b5a2ba846c499819ac02c6a91651))
|
|
7
|
+
|
|
8
|
+
## [9.0.1](https://github.com/MTES-MCT/monitor-ui/compare/v9.0.0...v9.0.1) (2023-08-23)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **components:** fix secondary dropdown item size ([1cb5c9c](https://github.com/MTES-MCT/monitor-ui/commit/1cb5c9c95c349581fb4ae1b9ac9bf3cd04718698))
|
|
14
|
+
|
|
1
15
|
# [9.0.0](https://github.com/MTES-MCT/monitor-ui/compare/v8.8.0...v9.0.0) (2023-08-23)
|
|
2
16
|
|
|
3
17
|
|
package/index.js
CHANGED
|
@@ -2957,7 +2957,7 @@ const ICON_SIZE_IN_PX = {
|
|
|
2957
2957
|
[Size.NORMAL]: 20,
|
|
2958
2958
|
[Size.SMALL]: 14
|
|
2959
2959
|
};
|
|
2960
|
-
function IconButton({ accent = Accent.PRIMARY, className, color, Icon, iconSize, onClick, size = Size.NORMAL, type = 'button', withUnpropagatedClick = false, ...nativeProps }) {
|
|
2960
|
+
function IconButton({ accent = Accent.PRIMARY, className, color, Icon, iconSize, isCompact, onClick, size = Size.NORMAL, type = 'button', withUnpropagatedClick = false, ...nativeProps }) {
|
|
2961
2961
|
const handleClick = useCallback((event) => {
|
|
2962
2962
|
if (withUnpropagatedClick) {
|
|
2963
2963
|
stopMouseEventPropagation(event);
|
|
@@ -2970,11 +2970,12 @@ function IconButton({ accent = Accent.PRIMARY, className, color, Icon, iconSize,
|
|
|
2970
2970
|
const commonProps = useMemo(() => ({
|
|
2971
2971
|
children: commonChildren,
|
|
2972
2972
|
className: classnames('Element-IconButton', className),
|
|
2973
|
+
isCompact,
|
|
2973
2974
|
onClick: handleClick,
|
|
2974
2975
|
size,
|
|
2975
2976
|
type,
|
|
2976
2977
|
...nativeProps
|
|
2977
|
-
}), [className, commonChildren, handleClick, nativeProps, size, type]);
|
|
2978
|
+
}), [className, commonChildren, handleClick, isCompact, nativeProps, size, type]);
|
|
2978
2979
|
switch (accent) {
|
|
2979
2980
|
case Accent.SECONDARY:
|
|
2980
2981
|
return jsx(SecondaryButton, { as: StyledButton, ...commonProps });
|
|
@@ -2989,35 +2990,58 @@ const PADDING$1 = {
|
|
|
2989
2990
|
[Size.NORMAL]: '5px',
|
|
2990
2991
|
[Size.SMALL]: '3px'
|
|
2991
2992
|
};
|
|
2993
|
+
// We can't use $-prefixed props here for some reason (maybe because the `as` prop exclude them?).
|
|
2992
2994
|
const StyledButton = styled.button `
|
|
2993
2995
|
align-items: center;
|
|
2994
2996
|
display: flex;
|
|
2995
2997
|
justify-content: center;
|
|
2996
|
-
padding: ${p => PADDING$1[p.size]};
|
|
2998
|
+
padding: ${p => (p.isCompact ? 0 : PADDING$1[p.size])};
|
|
2999
|
+
|
|
3000
|
+
${p => p.isCompact &&
|
|
3001
|
+
css `
|
|
3002
|
+
border: 0;
|
|
3003
|
+
|
|
3004
|
+
:hover,
|
|
3005
|
+
&._hover {
|
|
3006
|
+
border: 0;
|
|
3007
|
+
}
|
|
3008
|
+
border: 0;
|
|
3009
|
+
|
|
3010
|
+
:active,
|
|
3011
|
+
&._active {
|
|
3012
|
+
border: 0;
|
|
3013
|
+
}
|
|
3014
|
+
border: 0;
|
|
3015
|
+
|
|
3016
|
+
:disabled,
|
|
3017
|
+
&._disabled {
|
|
3018
|
+
border: 0;
|
|
3019
|
+
}
|
|
3020
|
+
`}
|
|
2997
3021
|
`;
|
|
2998
3022
|
const TertiaryButton = styled.button `
|
|
2999
3023
|
background-color: transparent;
|
|
3000
|
-
border: 1px solid transparent;
|
|
3024
|
+
border: ${p => (p.isCompact ? 0 : '1px solid transparent')};
|
|
3001
3025
|
color: ${p => p.theme.color.charcoal};
|
|
3002
3026
|
|
|
3003
3027
|
:hover,
|
|
3004
3028
|
&._hover {
|
|
3005
3029
|
background-color: transparent;
|
|
3006
|
-
border: 1px solid transparent;
|
|
3030
|
+
border: ${p => (p.isCompact ? 0 : '1px solid transparent')};
|
|
3007
3031
|
color: ${p => p.theme.color.blueYonder['100']};
|
|
3008
3032
|
}
|
|
3009
3033
|
|
|
3010
3034
|
:active,
|
|
3011
3035
|
&._active {
|
|
3012
3036
|
background-color: transparent;
|
|
3013
|
-
border: 1px solid transparent;
|
|
3037
|
+
border: ${p => (p.isCompact ? 0 : '1px solid transparent')};
|
|
3014
3038
|
color: ${p => p.theme.color.blueGray['100']};
|
|
3015
3039
|
}
|
|
3016
3040
|
|
|
3017
3041
|
:disabled,
|
|
3018
3042
|
&._disabled {
|
|
3019
3043
|
background-color: transparent;
|
|
3020
|
-
border: 1px solid transparent;
|
|
3044
|
+
border: ${p => (p.isCompact ? 0 : '1px solid transparent')};
|
|
3021
3045
|
color: ${p => p.theme.color.lightGray};
|
|
3022
3046
|
}
|
|
3023
3047
|
`;
|
|
@@ -26080,7 +26104,7 @@ class CustomSearch {
|
|
|
26080
26104
|
#isDiacriticSensitive;
|
|
26081
26105
|
/** See {@link CustomSearchOptions.isStrict}. */
|
|
26082
26106
|
#isStrict;
|
|
26083
|
-
constructor(collection, keys, { cacheKey, isCaseSensitive = false, isDiacriticSensitive = false, isStrict = false, threshold = 0.
|
|
26107
|
+
constructor(collection, keys, { cacheKey, isCaseSensitive = false, isDiacriticSensitive = false, isStrict = false, shouldIgnoreLocation = true, threshold = 0.4 } = {}) {
|
|
26084
26108
|
const maybeCache = cacheKey ? FUSE_SEARCH_CACHE[cacheKey] : undefined;
|
|
26085
26109
|
// eslint-disable-next-line no-nested-ternary
|
|
26086
26110
|
const normalizedCollection = maybeCache
|
|
@@ -26090,7 +26114,7 @@ class CustomSearch {
|
|
|
26090
26114
|
: CustomSearch.cleanCollectionDiacritics(collection, keys);
|
|
26091
26115
|
this.#fuse = new Fuse(normalizedCollection,
|
|
26092
26116
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
26093
|
-
{ isCaseSensitive, keys, threshold, useExtendedSearch: isStrict }, maybeCache ? Fuse.parseIndex(maybeCache.fuseSearchIndex) : undefined);
|
|
26117
|
+
{ ignoreLocation: shouldIgnoreLocation, isCaseSensitive, keys, threshold, useExtendedSearch: isStrict }, maybeCache ? Fuse.parseIndex(maybeCache.fuseSearchIndex) : undefined);
|
|
26094
26118
|
this.#isDiacriticSensitive = isDiacriticSensitive;
|
|
26095
26119
|
this.#isStrict = isStrict;
|
|
26096
26120
|
this.#originalCollection = maybeCache ? maybeCache.originalCollection : collection;
|