@mtes-mct/monitor-ui 5.7.0 → 5.8.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 CHANGED
@@ -1,3 +1,17 @@
1
+ ## [5.7.1](https://github.com/MTES-MCT/monitor-ui/compare/v5.7.0...v5.7.1) (2023-05-03)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **components:** type all allowed features in NewWindow ([1883816](https://github.com/MTES-MCT/monitor-ui/commit/18838169cc7a642c0e0d6e12fc833c23f5c69416))
7
+
8
+ # [5.7.0](https://github.com/MTES-MCT/monitor-ui/compare/v5.6.0...v5.7.0) (2023-05-03)
9
+
10
+
11
+ ### Features
12
+
13
+ * **components:** add NewWindow ([86d066f](https://github.com/MTES-MCT/monitor-ui/commit/86d066f34809fe63a79baaced69bad79c958a228))
14
+
1
15
  # [5.6.0](https://github.com/MTES-MCT/monitor-ui/compare/v5.5.0...v5.6.0) (2023-04-28)
2
16
 
3
17
 
@@ -5,15 +5,21 @@ export type NewWindowProps = {
5
5
  children?: ReactNode | undefined;
6
6
  closeOnUnmount?: boolean | undefined;
7
7
  copyStyles?: boolean | undefined;
8
+ /**
9
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/open#windowfeatures
10
+ */
8
11
  features?: Partial<{
9
12
  height: number;
10
13
  left: number;
14
+ noopener: '_blank' | '_parent' | '_self' | '_top';
15
+ noreferrer: string;
16
+ popup: 'yes';
11
17
  top: number;
12
18
  width: number;
13
19
  }> | undefined;
14
20
  name?: string | undefined;
15
21
  onBlock?: ((a: null) => Promisable<void>) | undefined;
16
- onChangeFocus?: ((visibility: 'hidden' | 'visible') => Promisable<void>) | undefined;
22
+ onChangeFocus?: ((isFocused: boolean) => Promisable<void>) | undefined;
17
23
  onOpen?: ((window: Window) => Promisable<void>) | undefined;
18
24
  onUnload?: ((a: null) => Promisable<void>) | undefined;
19
25
  shouldHaveFocus?: boolean | undefined;
@@ -0,0 +1,8 @@
1
+ export declare const SimpleTable: {
2
+ BodyTr: import("styled-components").StyledComponent<"tr", import("styled-components").DefaultTheme, {}, never>;
3
+ Head: import("styled-components").StyledComponent<"thead", import("styled-components").DefaultTheme, {}, never>;
4
+ SortContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
5
+ Table: import("styled-components").StyledComponent<"table", import("styled-components").DefaultTheme, {}, never>;
6
+ Td: import("styled-components").StyledComponent<"td", import("styled-components").DefaultTheme, {}, never>;
7
+ Th: import("styled-components").StyledComponent<"th", import("styled-components").DefaultTheme, {}, never>;
8
+ };
package/index.d.ts CHANGED
@@ -21,6 +21,7 @@ export { Label } from './elements/Label';
21
21
  export { Legend } from './elements/Legend';
22
22
  export { Tag } from './elements/Tag';
23
23
  export { TagGroup } from './elements/TagGroup';
24
+ export { SimpleTable } from './elements/Table/SimpleTable';
24
25
  export { Search } from './fields/Search';
25
26
  export { Checkbox } from './fields/Checkbox';
26
27
  export { DatePicker } from './fields/DatePicker';
package/index.js CHANGED
@@ -2269,10 +2269,10 @@ class NewWindow extends PureComponent {
2269
2269
  this.setState({ mounted: true });
2270
2270
  this.window?.addEventListener('beforeunload', this.beforeUnloadListener, { capture: true });
2271
2271
  this.window?.addEventListener('blur', () => {
2272
- onChangeFocus('hidden');
2272
+ onChangeFocus(false);
2273
2273
  });
2274
2274
  this.window?.addEventListener('focus', () => {
2275
- onChangeFocus('visible');
2275
+ onChangeFocus(true);
2276
2276
  });
2277
2277
  }
2278
2278
  componentDidUpdate(prevProps) {
@@ -3331,6 +3331,80 @@ const TagGroup = styled.div `
3331
3331
  gap: 8px;
3332
3332
  `;
3333
3333
 
3334
+ const Table = styled.table `
3335
+ width: 100%;
3336
+ table-layout: auto;
3337
+ overflow: auto;
3338
+ border-collapse: separate;
3339
+ `;
3340
+ const Head = styled.thead `
3341
+ position: sticky;
3342
+ top: 0;
3343
+ z-index: 1;
3344
+
3345
+ th:first-child {
3346
+ border-left: 1px solid ${p => p.theme.color.lightGray};
3347
+ }
3348
+ `;
3349
+ const SortContainer = styled.div `
3350
+ display: flex;
3351
+ justify-content: space-between;
3352
+ align-items: center;
3353
+ cursor: default;
3354
+
3355
+ &.cursor-pointer {
3356
+ cursor: pointer;
3357
+ }
3358
+ `;
3359
+ const Th = styled.th `
3360
+ background-color: ${p => p.theme.color.gainsboro};
3361
+ border-top: 1px solid ${p => p.theme.color.lightGray};
3362
+ border-bottom: 1px solid ${p => p.theme.color.lightGray};
3363
+ border-right: 1px solid ${p => p.theme.color.lightGray};
3364
+ color: ${p => p.theme.color.slateGray};
3365
+ font-size: 13px;
3366
+ font-weight: 500;
3367
+ padding: 10px;
3368
+ overflow: hidden;
3369
+ text-overflow: ellipsis;
3370
+ white-space: nowrap;
3371
+ `;
3372
+ const BodyTr = styled.tr `
3373
+ :hover {
3374
+ background-color: ${p => p.theme.color.blueYonder[25]};
3375
+ }
3376
+ td:first-child {
3377
+ border-left: 1px solid ${p => p.theme.color.lightGray};
3378
+ }
3379
+
3380
+ td:nth-child(10) {
3381
+ text-align: center;
3382
+ }
3383
+ td:nth-child(11) {
3384
+ text-align: center;
3385
+ }
3386
+ `;
3387
+ const Td = styled.td `
3388
+ font-size: 13px;
3389
+ font-weight: 500;
3390
+ color: ${p => p.theme.color.gunMetal};
3391
+ text-align: left;
3392
+ border-bottom: 1px solid ${p => p.theme.color.lightGray};
3393
+ border-right: 1px solid ${p => p.theme.color.lightGray};
3394
+ overflow: hidden;
3395
+ padding: 10px;
3396
+ text-overflow: ellipsis;
3397
+ white-space: nowrap;
3398
+ `;
3399
+ const SimpleTable = {
3400
+ BodyTr,
3401
+ Head,
3402
+ SortContainer,
3403
+ Table,
3404
+ Td,
3405
+ Th
3406
+ };
3407
+
3334
3408
  // eslint-lint-disable-next-line @typescript-eslint/naming-convention
3335
3409
  class HTTPError extends Error {
3336
3410
  constructor(response, request, options) {
@@ -32374,5 +32448,5 @@ function useNewWindow() {
32374
32448
  return contextValue;
32375
32449
  }
32376
32450
 
32377
- export { Accent, Button, Checkbox, CoordinatesFormat, CoordinatesInput, DatePicker, DateRangePicker, Dropdown, Field$2 as Field, 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, NumberInput, OPENLAYERS_PROJECTION, OnlyFontGlobalStyle, Search, Select, SingleTag, Size, THEME, Tag, TagBullet, TagGroup, TextInput, Textarea, ThemeProvider, WSG84_PROJECTION, coordinatesAreDistinct, customDayjs, getCoordinates, getLocalizedDayjs, getPseudoRandomString, getUtcizedDayjs, isNumeric, noop, stopMouseEventPropagation, useClickOutsideEffect, useFieldControl, useForceUpdate, useKey, useNewWindow, usePrevious };
32451
+ export { Accent, Button, Checkbox, CoordinatesFormat, CoordinatesInput, DatePicker, DateRangePicker, Dropdown, Field$2 as Field, 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, 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, noop, stopMouseEventPropagation, useClickOutsideEffect, useFieldControl, useForceUpdate, useKey, useNewWindow, usePrevious };
32378
32452
  //# sourceMappingURL=index.js.map