@mtes-mct/monitor-ui 23.0.0 → 23.1.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 +19 -0
- package/fields/NumberInput.d.ts +2 -1
- package/fields/NumberInput.d.ts.map +1 -1
- package/index.js +73 -21
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
## [23.0.0](https://github.com/MTES-MCT/monitor-ui/compare/v22.1.0...v23.0.0) (2024-09-12)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### ⚠ BREAKING CHANGES
|
|
5
|
+
|
|
6
|
+
* **elements:** - `disabled` is renamed `$isDisabled` in `Legend` props.
|
|
7
|
+
- `hasError` is renamed `$hasError` in `Legend` props.
|
|
8
|
+
- `isHidden` is renamed `$isHidden` in `Legend` props.
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
|
|
12
|
+
* **elements:** prefix styled component props in Legend ([ef4284a](https://github.com/MTES-MCT/monitor-ui/commit/ef4284a50dee68cdb6c65308d2ae42da2798efdf))
|
|
13
|
+
* **fields:** prefix styled components props in DateRangePicker ([3572267](https://github.com/MTES-MCT/monitor-ui/commit/3572267c6e285d87f7c9efd006bf7c0daf592a5e))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Buid System & Dependencies
|
|
17
|
+
|
|
18
|
+
* **deps:** bump express from 4.19.2 to 4.21.0 ([46d1134](https://github.com/MTES-MCT/monitor-ui/commit/46d113401e48191f59f9c8e309761ba2e44ccbb0))
|
|
19
|
+
|
|
1
20
|
## [22.1.0](https://github.com/MTES-MCT/monitor-ui/compare/v22.0.1...v22.1.0) (2024-09-12)
|
|
2
21
|
|
|
3
22
|
|
package/fields/NumberInput.d.ts
CHANGED
|
@@ -14,7 +14,8 @@ export type NumberInputProps = Omit<InputProps, 'as' | 'defaultValue' | 'id' | '
|
|
|
14
14
|
name: string;
|
|
15
15
|
onChange?: (nextValue: number | undefined) => Promisable<void>;
|
|
16
16
|
readOnly?: boolean | undefined;
|
|
17
|
+
unit?: string | undefined;
|
|
17
18
|
value?: number | undefined;
|
|
18
19
|
};
|
|
19
|
-
export declare function NumberInput({ areArrowsHidden, className, disabled, error, isErrorMessageHidden, isLabelHidden, isLight, isRequired, isTransparent, isUndefinedWhenDisabled, label, name, onBlur, onChange, onFocus, readOnly, style, value, ...originalProps }: NumberInputProps): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export declare function NumberInput({ areArrowsHidden, className, disabled, error, isErrorMessageHidden, isLabelHidden, isLight, isRequired, isTransparent, isUndefinedWhenDisabled, label, name, onBlur, onChange, onFocus, readOnly, style, unit, value, ...originalProps }: NumberInputProps): import("react/jsx-runtime").JSX.Element;
|
|
20
21
|
//# sourceMappingURL=NumberInput.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NumberInput.d.ts","sourceRoot":"","sources":["../../src/fields/NumberInput.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAS,KAAK,UAAU,EAAE,MAAM,QAAQ,CAAA;AAiB/C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAE3C,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,UAAU,EAAE,IAAI,GAAG,cAAc,GAAG,IAAI,GAAG,UAAU,GAAG,MAAM,GAAG,OAAO,CAAC,GAAG;IAC9G,eAAe,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IACrC,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IAC9B,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B,oBAAoB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IAC1C,aAAa,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IACnC,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IAC7B,UAAU,CAAC,EAAE,OAAO,GAAG,SAAS,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AG,SAAS,CAAA;IACnC,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IAC7B,UAAU,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IAChC,aAAa,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IACnC,uBAAuB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IAC7C,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,KAAK,UAAU,CAAC,IAAI,CAAC,CAAA;IAC9D,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IAC9B,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACzB,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAC3B,CAAA;AACD,wBAAgB,WAAW,CAAC,EAC1B,eAAuB,EACvB,SAAS,EACT,QAAgB,EAChB,KAAK,EACL,oBAA4B,EAC5B,aAAqB,EACrB,OAAe,EACf,UAAkB,EAClB,aAAqB,EACrB,uBAA+B,EAC/B,KAAK,EACL,IAAI,EACJ,MAAM,EACN,QAAQ,EACR,OAAO,EACP,QAAgB,EAChB,KAAK,EACL,IAAI,EACJ,KAAK,EACL,GAAG,aAAa,EACjB,EAAE,gBAAgB,2CA6FlB"}
|
package/index.js
CHANGED
|
@@ -68598,7 +68598,7 @@ const Link = styled.a`
|
|
|
68598
68598
|
}
|
|
68599
68599
|
`;
|
|
68600
68600
|
|
|
68601
|
-
function NumberInput({ areArrowsHidden = false, className, disabled = false, error, isErrorMessageHidden = false, isLabelHidden = false, isLight = false, isRequired = false, isTransparent = false, isUndefinedWhenDisabled = false, label, name, onBlur, onChange, onFocus, readOnly = false, style, value, ...originalProps }) {
|
|
68601
|
+
function NumberInput({ areArrowsHidden = false, className, disabled = false, error, isErrorMessageHidden = false, isLabelHidden = false, isLight = false, isRequired = false, isTransparent = false, isUndefinedWhenDisabled = false, label, name, onBlur, onChange, onFocus, readOnly = false, style, unit, value, ...originalProps }) {
|
|
68602
68602
|
// eslint-disable-next-line no-null/no-null
|
|
68603
68603
|
const inputRef = useRef(null);
|
|
68604
68604
|
const controlledClassname = useMemo(()=>classnames('Field-NumberInput', className), [
|
|
@@ -68645,6 +68645,24 @@ function NumberInput({ areArrowsHidden = false, className, disabled = false, err
|
|
|
68645
68645
|
preventWheelEvent
|
|
68646
68646
|
]);
|
|
68647
68647
|
useFieldUndefineEffect(isUndefinedWhenDisabled && !!disabled, onChange);
|
|
68648
|
+
const commonInputProps = {
|
|
68649
|
+
$areArrowsHidden: areArrowsHidden,
|
|
68650
|
+
$hasError: hasError,
|
|
68651
|
+
$isDisabled: disabled,
|
|
68652
|
+
$isLight: isLight,
|
|
68653
|
+
$isReadOnly: readOnly,
|
|
68654
|
+
$isTransparent: isTransparent,
|
|
68655
|
+
disabled,
|
|
68656
|
+
id: name,
|
|
68657
|
+
onBlur: handleBlur,
|
|
68658
|
+
onChange: handleChange,
|
|
68659
|
+
onFocus: handleFocus,
|
|
68660
|
+
readOnly,
|
|
68661
|
+
ref: inputRef,
|
|
68662
|
+
type: 'number',
|
|
68663
|
+
value: value ?? '',
|
|
68664
|
+
...originalProps
|
|
68665
|
+
};
|
|
68648
68666
|
return /*#__PURE__*/ jsxs(Field$2, {
|
|
68649
68667
|
className: controlledClassname,
|
|
68650
68668
|
style: style,
|
|
@@ -68656,23 +68674,21 @@ function NumberInput({ areArrowsHidden = false, className, disabled = false, err
|
|
|
68656
68674
|
htmlFor: name,
|
|
68657
68675
|
children: label
|
|
68658
68676
|
}),
|
|
68659
|
-
/*#__PURE__*/ jsx(
|
|
68660
|
-
|
|
68661
|
-
|
|
68677
|
+
!unit && /*#__PURE__*/ jsx(InputWithoutUnit, {
|
|
68678
|
+
...commonInputProps
|
|
68679
|
+
}, key),
|
|
68680
|
+
!!unit && /*#__PURE__*/ jsxs(InputBoxWithUnit, {
|
|
68662
68681
|
$hasError: hasError,
|
|
68663
68682
|
$isDisabled: disabled,
|
|
68664
68683
|
$isLight: isLight,
|
|
68665
68684
|
$isReadOnly: readOnly,
|
|
68666
68685
|
$isTransparent: isTransparent,
|
|
68667
|
-
|
|
68668
|
-
|
|
68669
|
-
|
|
68670
|
-
|
|
68671
|
-
|
|
68672
|
-
|
|
68673
|
-
type: "number",
|
|
68674
|
-
value: value ?? '',
|
|
68675
|
-
...originalProps
|
|
68686
|
+
children: [
|
|
68687
|
+
/*#__PURE__*/ jsx(InputWithUnit, {
|
|
68688
|
+
...commonInputProps
|
|
68689
|
+
}),
|
|
68690
|
+
unit
|
|
68691
|
+
]
|
|
68676
68692
|
}, key),
|
|
68677
68693
|
!isErrorMessageHidden && hasError && /*#__PURE__*/ jsx(FieldError, {
|
|
68678
68694
|
children: controlledError
|
|
@@ -68680,9 +68696,7 @@ function NumberInput({ areArrowsHidden = false, className, disabled = false, err
|
|
|
68680
68696
|
]
|
|
68681
68697
|
});
|
|
68682
68698
|
}
|
|
68683
|
-
const
|
|
68684
|
-
background-color: ${getFieldBackgroundColorFactory()};
|
|
68685
|
-
border: solid 1px ${getFieldBorderColorFactoryForState('default')};
|
|
68699
|
+
const BaseInput = styled(Input)`
|
|
68686
68700
|
border-radius: 0;
|
|
68687
68701
|
color: ${(p)=>p.theme.color.gunMetal};
|
|
68688
68702
|
${(p)=>p.$isReadOnly && `cursor: default;`}
|
|
@@ -68707,9 +68721,6 @@ const StyledInput = styled(Input)`
|
|
|
68707
68721
|
}
|
|
68708
68722
|
|
|
68709
68723
|
&:hover {
|
|
68710
|
-
background-color: ${getFieldBackgroundColorFactory()};
|
|
68711
|
-
border: solid 1px ${getFieldBorderColorFactoryForState('hover')} !important;
|
|
68712
|
-
|
|
68713
68724
|
&::placeholder {
|
|
68714
68725
|
color: ${getFieldPlaceholderColorFactoryForState('hover')};
|
|
68715
68726
|
}
|
|
@@ -68717,8 +68728,6 @@ const StyledInput = styled(Input)`
|
|
|
68717
68728
|
|
|
68718
68729
|
&:active,
|
|
68719
68730
|
&:focus {
|
|
68720
|
-
background-color: ${getFieldBackgroundColorFactory()};
|
|
68721
|
-
border: solid 1px ${getFieldBorderColorFactoryForState('focus')} !important;
|
|
68722
68731
|
outline: 0;
|
|
68723
68732
|
|
|
68724
68733
|
&::placeholder {
|
|
@@ -68726,6 +68735,49 @@ const StyledInput = styled(Input)`
|
|
|
68726
68735
|
}
|
|
68727
68736
|
}
|
|
68728
68737
|
`;
|
|
68738
|
+
const InputWithoutUnit = styled(BaseInput)`
|
|
68739
|
+
background-color: ${getFieldBackgroundColorFactory()};
|
|
68740
|
+
border: solid 1px ${getFieldBorderColorFactoryForState('default')};
|
|
68741
|
+
|
|
68742
|
+
&:hover {
|
|
68743
|
+
background-color: ${getFieldBackgroundColorFactory()};
|
|
68744
|
+
border: solid 1px ${getFieldBorderColorFactoryForState('hover')} !important;
|
|
68745
|
+
}
|
|
68746
|
+
|
|
68747
|
+
&:active,
|
|
68748
|
+
&:focus {
|
|
68749
|
+
background-color: ${getFieldBackgroundColorFactory()};
|
|
68750
|
+
border: solid 1px ${getFieldBorderColorFactoryForState('focus')} !important;
|
|
68751
|
+
}
|
|
68752
|
+
`;
|
|
68753
|
+
const InputBoxWithUnit = styled.div`
|
|
68754
|
+
align-items: center;
|
|
68755
|
+
background-color: ${getFieldBackgroundColorFactory()};
|
|
68756
|
+
border: solid 1px ${getFieldBorderColorFactoryForState('default')};
|
|
68757
|
+
color: ${(p)=>p.theme.color.slateGray};
|
|
68758
|
+
display: flex;
|
|
68759
|
+
font-size: 13px;
|
|
68760
|
+
line-height: 19px;
|
|
68761
|
+
padding-right: 8px;
|
|
68762
|
+
user-select: none;
|
|
68763
|
+
width: 100%;
|
|
68764
|
+
|
|
68765
|
+
&:hover {
|
|
68766
|
+
background-color: ${getFieldBackgroundColorFactory()};
|
|
68767
|
+
border: solid 1px ${getFieldBorderColorFactoryForState('hover')} !important;
|
|
68768
|
+
}
|
|
68769
|
+
|
|
68770
|
+
&:active,
|
|
68771
|
+
&:focus {
|
|
68772
|
+
background-color: ${getFieldBackgroundColorFactory()};
|
|
68773
|
+
border: solid 1px ${getFieldBorderColorFactoryForState('focus')} !important;
|
|
68774
|
+
}
|
|
68775
|
+
`;
|
|
68776
|
+
const InputWithUnit = styled(BaseInput)`
|
|
68777
|
+
background-color: transparent;
|
|
68778
|
+
border: none;
|
|
68779
|
+
flex-grow: 1;
|
|
68780
|
+
`;
|
|
68729
68781
|
|
|
68730
68782
|
const PADDING = {
|
|
68731
68783
|
[Size.LARGE]: '8px 16px 10px',
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mtes-mct/monitor-ui",
|
|
3
3
|
"description": "Common React components, hooks, utilities and CSS stylesheets for MonitorFish, MonitorEnv and RapportNav.",
|
|
4
|
-
"version": "23.
|
|
4
|
+
"version": "23.1.0",
|
|
5
5
|
"license": "AGPL-3.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"engines": {
|