@mtes-mct/monitor-ui 1.12.1 → 1.13.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 +7 -0
- package/{contants.d.ts → constants.d.ts} +0 -0
- package/elements/Button.d.ts +1 -1
- package/elements/IconButton.d.ts +1 -1
- package/elements/Tag/Disk.d.ts +3 -0
- package/elements/Tag/constants.d.ts +3 -0
- package/elements/Tag/index.d.ts +30 -0
- package/index.d.ts +3 -1
- package/index.js +74 -1
- package/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [1.12.1](https://github.com/MTES-MCT/monitor-ui/compare/v1.12.0...v1.12.1) (2022-12-14)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **icons:** use currentColor in new icons ([#119](https://github.com/MTES-MCT/monitor-ui/issues/119)) ([3937553](https://github.com/MTES-MCT/monitor-ui/commit/39375532354d24489ab3aeb024ebe5b2cb61772a))
|
|
7
|
+
|
|
1
8
|
# [1.12.0](https://github.com/MTES-MCT/monitor-ui/compare/v1.11.0...v1.12.0) (2022-12-13)
|
|
2
9
|
|
|
3
10
|
|
|
File without changes
|
package/elements/Button.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Accent, Size } from '../
|
|
1
|
+
import { Accent, Size } from '../constants';
|
|
2
2
|
import type { IconProps } from '../types';
|
|
3
3
|
import type { ButtonHTMLAttributes, FunctionComponent } from 'react';
|
|
4
4
|
export type ButtonProps = ButtonHTMLAttributes<HTMLButtonElement> & {
|
package/elements/IconButton.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Accent, Size } from '../
|
|
1
|
+
import { Accent, Size } from '../constants';
|
|
2
2
|
import type { IconProps } from '../types';
|
|
3
3
|
import type { ButtonHTMLAttributes, FunctionComponent } from 'react';
|
|
4
4
|
export type IconButtonProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children'> & {
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { FunctionComponent, HTMLAttributes } from 'react';
|
|
2
|
+
import { Accent } from '../../constants';
|
|
3
|
+
import { TagBullet } from './constants';
|
|
4
|
+
import type { IconProps } from '../../types';
|
|
5
|
+
export type TagProps = HTMLAttributes<HTMLSpanElement> & {
|
|
6
|
+
Icon?: FunctionComponent<IconProps>;
|
|
7
|
+
accent?: Accent;
|
|
8
|
+
bullet?: TagBullet;
|
|
9
|
+
color?: string;
|
|
10
|
+
isLight?: boolean;
|
|
11
|
+
};
|
|
12
|
+
export declare function Tag({ accent, bullet, children, color, Icon, isLight, ...nativeProps }: TagProps): JSX.Element;
|
|
13
|
+
export declare const PrimaryTag: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, {
|
|
14
|
+
$color?: string | undefined;
|
|
15
|
+
$isLight: boolean;
|
|
16
|
+
} & {
|
|
17
|
+
$isLight: boolean;
|
|
18
|
+
}, never>;
|
|
19
|
+
export declare const SecondaryTag: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, {
|
|
20
|
+
$color?: string | undefined;
|
|
21
|
+
$isLight: boolean;
|
|
22
|
+
} & {
|
|
23
|
+
$isLight: boolean;
|
|
24
|
+
}, never>;
|
|
25
|
+
export declare const TertiaryTag: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, {
|
|
26
|
+
$color?: string | undefined;
|
|
27
|
+
$isLight: boolean;
|
|
28
|
+
} & {
|
|
29
|
+
$isLight: boolean;
|
|
30
|
+
}, never>;
|
package/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { Accent, Size } from './
|
|
1
|
+
export { Accent, Size } from './constants';
|
|
2
2
|
export { GlobalStyle } from './GlobalStyle';
|
|
3
3
|
export { THEME } from './theme';
|
|
4
4
|
export { ThemeProvider } from './ThemeProvider';
|
|
@@ -9,6 +9,7 @@ export { Fieldset } from './elements/Fieldset';
|
|
|
9
9
|
export { IconButton } from './elements/IconButton';
|
|
10
10
|
export { Label } from './elements/Label';
|
|
11
11
|
export { Legend } from './elements/Legend';
|
|
12
|
+
export { Tag } from './elements/Tag';
|
|
12
13
|
export { Checkbox } from './fields/Checkbox';
|
|
13
14
|
export { DateRangePicker } from './fields/DateRangePicker';
|
|
14
15
|
export { DatePicker } from './fields/DatePicker';
|
|
@@ -38,6 +39,7 @@ export type { FieldsetProps } from './elements/Fieldset';
|
|
|
38
39
|
export type { IconButtonProps } from './elements/IconButton';
|
|
39
40
|
export type { LabelProps } from './elements/Label';
|
|
40
41
|
export type { LegendProps } from './elements/Legend';
|
|
42
|
+
export type { TagProps } from './elements/Tag';
|
|
41
43
|
export type { CheckboxProps } from './fields/Checkbox';
|
|
42
44
|
export type { DateRangePickerProps } from './fields/DateRangePicker';
|
|
43
45
|
export type { DatePickerProps } from './fields/DatePicker';
|
package/index.js
CHANGED
|
@@ -1487,6 +1487,79 @@ const StyledLabel = styled(Label) `
|
|
|
1487
1487
|
padding: 0;
|
|
1488
1488
|
`;
|
|
1489
1489
|
|
|
1490
|
+
var TagBullet;
|
|
1491
|
+
(function (TagBullet) {
|
|
1492
|
+
TagBullet["DISK"] = "DISK";
|
|
1493
|
+
})(TagBullet || (TagBullet = {}));
|
|
1494
|
+
|
|
1495
|
+
const Disk = styled.span `
|
|
1496
|
+
background-color: ${p => p.$color};
|
|
1497
|
+
border-radius: 50%;
|
|
1498
|
+
`;
|
|
1499
|
+
|
|
1500
|
+
function Tag$1({ accent, bullet, children, color, Icon, isLight = false, ...nativeProps }) {
|
|
1501
|
+
const commonChildren = useMemo(() => {
|
|
1502
|
+
const defaultColor = color || THEME.color.gunMetal;
|
|
1503
|
+
const bulletColor = accent
|
|
1504
|
+
? {
|
|
1505
|
+
[Accent.PRIMARY]: THEME.color.gunMetal,
|
|
1506
|
+
[Accent.SECONDARY]: THEME.color.gunMetal,
|
|
1507
|
+
[Accent.TERTIARY]: THEME.color.white
|
|
1508
|
+
}[accent]
|
|
1509
|
+
: defaultColor;
|
|
1510
|
+
return (jsxs(Fragment, { children: [Icon && jsx(Icon, { size: 1 }), bullet === TagBullet.DISK && jsx(Disk, { "$color": bulletColor }), children] }));
|
|
1511
|
+
}, [accent, bullet, color, children, Icon]);
|
|
1512
|
+
const commonProps = useMemo(() => ({
|
|
1513
|
+
$isLight: isLight,
|
|
1514
|
+
children: commonChildren,
|
|
1515
|
+
...nativeProps
|
|
1516
|
+
}), [commonChildren, isLight, nativeProps]);
|
|
1517
|
+
switch (accent) {
|
|
1518
|
+
case Accent.PRIMARY:
|
|
1519
|
+
return jsx(PrimaryTag, { ...commonProps });
|
|
1520
|
+
case Accent.SECONDARY:
|
|
1521
|
+
return jsx(SecondaryTag, { ...commonProps });
|
|
1522
|
+
case Accent.TERTIARY:
|
|
1523
|
+
return jsx(TertiaryTag, { ...commonProps });
|
|
1524
|
+
default:
|
|
1525
|
+
return jsx(Box$7, { "$color": color, ...commonProps });
|
|
1526
|
+
}
|
|
1527
|
+
}
|
|
1528
|
+
const Box$7 = styled.span `
|
|
1529
|
+
align-items: center;
|
|
1530
|
+
background-color: ${p => (p.$isLight ? p.theme.color.white : 'transparent')};
|
|
1531
|
+
border-radius: 11px;
|
|
1532
|
+
color: ${p => (p.$color ? p.$color : p.theme.color.gunMetal)};
|
|
1533
|
+
display: inline-flex;
|
|
1534
|
+
font-size: 13px;
|
|
1535
|
+
padding: 1px 8px 3px 8px;
|
|
1536
|
+
|
|
1537
|
+
/* Bullet components are a span */
|
|
1538
|
+
> span {
|
|
1539
|
+
height: 16px;
|
|
1540
|
+
margin-right: 4px;
|
|
1541
|
+
width: 16px;
|
|
1542
|
+
}
|
|
1543
|
+
|
|
1544
|
+
/* SVG Icon components are wrapped within a <div /> */
|
|
1545
|
+
> div {
|
|
1546
|
+
margin-right: 4px;
|
|
1547
|
+
}
|
|
1548
|
+
`;
|
|
1549
|
+
const PrimaryTag = styled(Box$7) `
|
|
1550
|
+
background-color: ${p => (p.$isLight ? p.theme.color.white : p.theme.color.gainsboro)};
|
|
1551
|
+
color: ${p => p.theme.color.gunMetal};
|
|
1552
|
+
`;
|
|
1553
|
+
// TODO Fix this color.
|
|
1554
|
+
const SecondaryTag = styled(Box$7) `
|
|
1555
|
+
background-color: ${p => (p.$isLight ? '#f6d012' : '#f6d012')};
|
|
1556
|
+
color: ${p => p.theme.color.gunMetal};
|
|
1557
|
+
`;
|
|
1558
|
+
const TertiaryTag = styled(Box$7) `
|
|
1559
|
+
background-color: ${p => (p.$isLight ? p.theme.color.charcoal : p.theme.color.charcoal)};
|
|
1560
|
+
color: ${p => p.theme.color.white};
|
|
1561
|
+
`;
|
|
1562
|
+
|
|
1490
1563
|
function Checkbox({ label, onChange, ...originalProps }) {
|
|
1491
1564
|
const key = useMemo(() => `${originalProps.name}-${String(originalProps.defaultChecked)}`, [originalProps.defaultChecked, originalProps.name]);
|
|
1492
1565
|
const handleChange = useCallback((_, isChecked) => {
|
|
@@ -4124,5 +4197,5 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
4124
4197
|
ViewOnMap: ViewOnMap
|
|
4125
4198
|
});
|
|
4126
4199
|
|
|
4127
|
-
export { Accent, Button, Checkbox, DatePicker, DateRangePicker, Dropdown, Field$2 as Field, Fieldset, FormikCheckbox, FormikDatePicker, FormikDateRangePicker, FormikEffect, FormikMultiCheckbox, FormikMultiRadio, FormikMultiSelect, FormikSelect, FormikTextInput, FormikTextarea, GlobalStyle, index as Icon, IconButton, Label, Legend, MultiCheckbox, MultiRadio, MultiSelect, Select, Size, THEME, TextInput, Textarea, ThemeProvider };
|
|
4200
|
+
export { Accent, Button, Checkbox, DatePicker, DateRangePicker, Dropdown, Field$2 as Field, Fieldset, FormikCheckbox, FormikDatePicker, FormikDateRangePicker, FormikEffect, FormikMultiCheckbox, FormikMultiRadio, FormikMultiSelect, FormikSelect, FormikTextInput, FormikTextarea, GlobalStyle, index as Icon, IconButton, Label, Legend, MultiCheckbox, MultiRadio, MultiSelect, Select, Size, THEME, Tag$1 as Tag, TextInput, Textarea, ThemeProvider };
|
|
4128
4201
|
//# sourceMappingURL=index.js.map
|