@mtes-mct/monitor-ui 17.2.2 → 18.0.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 CHANGED
@@ -1,3 +1,35 @@
1
+ ## [18.0.0](https://github.com/MTES-MCT/monitor-ui/compare/v17.2.2...v18.0.0) (2024-05-27)
2
+
3
+
4
+ ### ⚠ BREAKING CHANGES
5
+
6
+ * **tables:** - Remove `isChecked` prop in `TableWithSelectableRows.RowCheckbox`, replaced by native `checked` prop.
7
+ - Remove `isIndeterminate` prop in `TableWithSelectableRows.RowCheckbox`, replaced by original Rsuite `indeterminate` prop.
8
+ - Remove `$isHighlighted` prop in `TableWithSelectableRows.Td`, replaced by the same prop on `TableWithSelectableRows.BodyTr`.
9
+ - In order to work properly with `RowCheckbox`, `TableWithSelectableRows` now requires `<Table $withRowCheckbox />`.
10
+ - Following the `SimpleTable` & `TableWithSelectableRows` margins/heights normalization, including a few hacks,
11
+ it may break some UI widths & heights.
12
+ - Please check `TableWithSelectableRows.stories.tsx` to see a full example on how to use/update it.
13
+ - As shown in the story, be careful **NOT** to wrap the checkbox table header cell
14
+ within `<TableWithSelectableRows.SortContainer />` since the flex display breaks its internal positioning.
15
+
16
+ ### Features
17
+
18
+ * **tables:** add $isLoading prop to SimpleTable.Td ([6cc137e](https://github.com/MTES-MCT/monitor-ui/commit/6cc137e187bd0314756bfc973f65bcde19f063ea))
19
+
20
+
21
+ ### Bug Fixes
22
+
23
+ * **tables:** normalize tables checkbox, margins & height ([23afb70](https://github.com/MTES-MCT/monitor-ui/commit/23afb702e79e44788d82b6abeb0e2e6ba4deb4d3))
24
+ * **tables:** set SimpleTable.Td line-height & .CellLoader height to 22px ([176b161](https://github.com/MTES-MCT/monitor-ui/commit/176b161ac85c48913f25e5a483ce8ac30698e65c))
25
+
26
+ ## [17.2.2](https://github.com/MTES-MCT/monitor-ui/compare/v17.2.1...v17.2.2) (2024-05-21)
27
+
28
+
29
+ ### Bug Fixes
30
+
31
+ * **elements:** fix IconButton border ([f55eb2c](https://github.com/MTES-MCT/monitor-ui/commit/f55eb2ca036cd0c1c06b78eaaacfc1983e48ffb3))
32
+
1
33
  ## [17.2.1](https://github.com/MTES-MCT/monitor-ui/compare/v17.2.0...v17.2.1) (2024-05-21)
2
34
 
3
35
 
@@ -1,5 +1,6 @@
1
1
  import { type CSSProperties } from 'react';
2
2
  import type { CheckboxProps as RsuiteCheckboxProps } from 'rsuite';
3
+ import type { ValueType } from 'rsuite/esm/Checkbox';
3
4
  import type { Promisable } from 'type-fest';
4
5
  export type CheckboxProps = Omit<RsuiteCheckboxProps, 'as' | 'checked' | 'defaultChecked' | 'id' | 'onChange'> & {
5
6
  checked?: boolean | undefined;
@@ -25,5 +26,8 @@ export type CheckboxProps = Omit<RsuiteCheckboxProps, 'as' | 'checked' | 'defaul
25
26
  readOnly?: boolean | undefined;
26
27
  style?: CSSProperties | undefined;
27
28
  };
28
- export declare function Checkbox({ checked, className, disabled, error, hasError, isErrorMessageHidden, isLight, isTransparent, isUndefinedWhenDisabled, label, name, onChange, readOnly, style, ...originalProps }: CheckboxProps): import("react/jsx-runtime").JSX.Element;
29
+ export declare function Checkbox({ checked, className, disabled, error, hasError, indeterminate, isErrorMessageHidden, isLight, isTransparent, isUndefinedWhenDisabled, label, name, onChange, readOnly, style, ...originalProps }: CheckboxProps): import("react/jsx-runtime").JSX.Element;
30
+ export declare const StyledRsuiteCheckbox: import("styled-components").StyledComponent<import("rsuite/esm/@types/common").RsRefForwardingComponent<"div", RsuiteCheckboxProps<ValueType>>, import("styled-components").DefaultTheme, import("./shared/types").CommonFieldStyleProps & {
31
+ $isChecked: boolean;
32
+ }, never>;
29
33
  //# sourceMappingURL=Checkbox.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../../src/fields/Checkbox.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAwB,KAAK,aAAa,EAAE,MAAM,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AAe,EACf,SAAS,EACT,QAAgB,EAChB,KAAK,EACL,QAAgB,EAEhB,aAAqB,EACrB,oBAA4B,EAC5B,OAAe,EACf,aAAqB,EACrB,uBAA+B,EAC/B,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,QAAgB,EAChB,KAAK,EACL,GAAG,aAAa,EACjB,EAAE,aAAa,2CA4Cf;AAED,eAAO,MAAM,oBAAoB;;SAmGhC,CAAA"}
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import styled, { createGlobalStyle, ThemeProvider as ThemeProvider$1, css } from 'styled-components';
1
+ import styled, { createGlobalStyle, ThemeProvider as ThemeProvider$1, css, keyframes } from 'styled-components';
2
2
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
3
3
  import * as t from 'react';
4
4
  import t__default, { useMemo, PureComponent, forwardRef, useEffect, useReducer, useState, useRef, isValidElement, cloneElement, useLayoutEffect, useCallback, useImperativeHandle, createContext, useContext } from 'react';
@@ -54380,7 +54380,8 @@ function useFieldUndefineEffect(disabled, onChange, onDisable) {
54380
54380
  return cleanText.length > 0 ? cleanText : undefined;
54381
54381
  }
54382
54382
 
54383
- function Checkbox({ checked = false, className, disabled = false, error, hasError = false, isErrorMessageHidden = false, isLight = false, isTransparent = false, isUndefinedWhenDisabled = false, label, name, onChange, readOnly = false, style, ...originalProps }) {
54383
+ function Checkbox({ checked = false, className, disabled = false, error, hasError = false, // eslint-disable-next-line @typescript-eslint/naming-convention
54384
+ indeterminate = false, isErrorMessageHidden = false, isLight = false, isTransparent = false, isUndefinedWhenDisabled = false, label, name, onChange, readOnly = false, style, ...originalProps }) {
54384
54385
  const controlledClassName = useMemo(()=>classnames('Field-Checkbox', className), [
54385
54386
  className
54386
54387
  ]);
@@ -54410,7 +54411,7 @@ function Checkbox({ checked = false, className, disabled = false, error, hasErro
54410
54411
  children: [
54411
54412
  /*#__PURE__*/ jsx(StyledRsuiteCheckbox, {
54412
54413
  $hasError: hasControlledError,
54413
- $isChecked: checked,
54414
+ $isChecked: checked || indeterminate,
54414
54415
  $isDisabled: disabled,
54415
54416
  $isLight: isLight,
54416
54417
  $isReadOnly: readOnly,
@@ -54418,6 +54419,7 @@ function Checkbox({ checked = false, className, disabled = false, error, hasErro
54418
54419
  checked: checked,
54419
54420
  disabled: disabled,
54420
54421
  id: name,
54422
+ indeterminate: indeterminate,
54421
54423
  name: name,
54422
54424
  onChange: handleChange,
54423
54425
  readOnly: readOnly,
@@ -54436,7 +54438,8 @@ const StyledRsuiteCheckbox = styled(Checkbox$1)`
54436
54438
  user-select: none;
54437
54439
  }
54438
54440
 
54439
- > .rs-checkbox-checker {
54441
+ > .rs-checkbox-checker,
54442
+ &.rs-checkbox-indeterminate > .rs-checkbox-checker {
54440
54443
  min-height: unset;
54441
54444
  padding: 0 0 0 24px;
54442
54445
 
@@ -76261,33 +76264,76 @@ function useReactTable(options) {
76261
76264
  return tableRef.current;
76262
76265
  }
76263
76266
 
76267
+ const cellLoaderAnimation = keyframes`
76268
+ from {
76269
+ left: -100%;
76270
+ }
76271
+
76272
+ to {
76273
+ left: 100%;
76274
+ }
76275
+ `;
76276
+ const CellLoader = styled.div`
76277
+ background: ${(p)=>p.theme.color.gainsboro};
76278
+ height: 22px;
76279
+ overflow: hidden;
76280
+ position: relative;
76281
+
76282
+ &:before {
76283
+ animation: ${cellLoaderAnimation} 1s cubic-bezier(0.4, 0, 0.2, 1) infinite;
76284
+ background: linear-gradient(to right, transparent 0%, ${(p)=>p.theme.color.white} 50%, transparent 100%);
76285
+ content: '';
76286
+ display: block;
76287
+ height: 100%;
76288
+ left: -100%;
76289
+ position: absolute;
76290
+ top: 0;
76291
+ width: 100%;
76292
+ }
76293
+ `;
76294
+
76295
+ const Td$2 = styled.td.attrs((props)=>({
76296
+ children: props.$isLoading ? /*#__PURE__*/ jsx(CellLoader, {}) : props.children
76297
+ }))`
76298
+ border-bottom: 1px solid ${(p)=>p.theme.color.lightGray};
76299
+ border-right: 1px solid ${(p)=>p.theme.color.lightGray};
76300
+ color: ${(p)=>p.theme.color.gunMetal};
76301
+ font-size: 13px;
76302
+ font-weight: 500;
76303
+ line-height: 22px;
76304
+ max-width: 0;
76305
+ overflow: hidden;
76306
+ padding: 9px 10px;
76307
+ text-align: ${(p)=>p.$isCenter ? 'center' : 'left'};
76308
+ text-overflow: ellipsis;
76309
+ white-space: nowrap;
76310
+
76311
+ /**
76312
+ Dirty hack to prevent 'display: inline-flex;' from breaking row height.
76313
+ This may be fixable by internal alignment cleanup in <Tag /> component.
76314
+ */
76315
+ > .Element-Tag {
76316
+ align-self: unset;
76317
+ vertical-align: bottom;
76318
+ }
76319
+ `;
76320
+
76264
76321
  const Table$1 = styled.table.attrs((props)=>({
76265
76322
  className: classnames('Table-SimpleTable', props.className)
76266
76323
  }))`
76267
- width: 100%;
76268
- table-layout: auto;
76269
- overflow: auto;
76270
76324
  border-collapse: separate;
76325
+ overflow: auto;
76326
+ table-layout: auto;
76271
76327
  `;
76272
76328
  const Head$1 = styled.thead`
76273
76329
  position: sticky;
76274
76330
  top: 0;
76275
76331
  z-index: 1;
76276
76332
 
76277
- th:first-child {
76333
+ > th:first-child {
76278
76334
  border-left: 1px solid ${(p)=>p.theme.color.lightGray};
76279
76335
  }
76280
76336
  `;
76281
- const SortContainer$1 = styled.div`
76282
- display: flex;
76283
- justify-content: space-between;
76284
- align-items: center;
76285
- cursor: default;
76286
-
76287
- &.cursor-pointer {
76288
- cursor: pointer;
76289
- }
76290
- `;
76291
76337
  const Th$2 = styled.th`
76292
76338
  background-color: ${(p)=>p.theme.color.gainsboro};
76293
76339
  border-top: 1px solid ${(p)=>p.theme.color.lightGray};
@@ -76296,35 +76342,42 @@ const Th$2 = styled.th`
76296
76342
  color: ${(p)=>p.theme.color.slateGray};
76297
76343
  font-size: 13px;
76298
76344
  font-weight: 500;
76299
- padding: 10px;
76345
+ line-height: 22px;
76346
+ padding: 9px 10px;
76300
76347
  overflow: hidden;
76301
76348
  text-overflow: ellipsis;
76349
+ user-select: none;
76302
76350
  white-space: nowrap;
76351
+
76352
+ ${(p)=>!!p.$width && css`
76353
+ max-width: ${p.$width}px;
76354
+ min-width: ${p.$width}px;
76355
+ width: ${p.$width}px;
76356
+ `}
76357
+ `;
76358
+ const SortContainer$1 = styled.div`
76359
+ align-items: center;
76360
+ cursor: default;
76361
+ display: flex;
76362
+ justify-content: space-between;
76363
+
76364
+ &.cursor-pointer {
76365
+ cursor: pointer;
76366
+ }
76303
76367
  `;
76304
76368
  const BodyTr$1 = styled.tr`
76305
- :hover {
76369
+ &:hover {
76306
76370
  > td {
76307
76371
  background-color: ${(p)=>p.theme.color.blueYonder25};
76308
76372
  }
76309
76373
  }
76310
- td:first-child {
76374
+ > td:first-child {
76311
76375
  border-left: 1px solid ${(p)=>p.theme.color.lightGray};
76312
76376
  }
76313
76377
  `;
76314
- const Td$2 = styled.td`
76315
- font-size: 13px;
76316
- font-weight: 500;
76317
- color: ${(p)=>p.theme.color.gunMetal};
76318
- text-align: ${(p)=>p.$isCenter ? 'center' : 'left'};
76319
- border-bottom: 1px solid ${(p)=>p.theme.color.lightGray};
76320
- border-right: 1px solid ${(p)=>p.theme.color.lightGray};
76321
- overflow: hidden;
76322
- padding: 10px;
76323
- text-overflow: ellipsis;
76324
- white-space: nowrap;
76325
- `;
76326
76378
  const SimpleTable = {
76327
76379
  BodyTr: BodyTr$1,
76380
+ CellLoader,
76328
76381
  Head: Head$1,
76329
76382
  SortContainer: SortContainer$1,
76330
76383
  Table: Table$1,
@@ -76431,60 +76484,135 @@ function DataTable({ columns, data, initialSorting }) {
76431
76484
  });
76432
76485
  }
76433
76486
 
76434
- function RowCheckbox({ className = '', disabled = false, isChecked = false, isIndeterminate = false, onChange = ()=>undefined }) {
76435
- return /*#__PURE__*/ jsx(Checkbox$1, {
76436
- checked: isChecked,
76437
- className: `${className} cursor-pointer`,
76438
- disabled: disabled,
76439
- indeterminate: isIndeterminate,
76440
- // eslint-disable-next-line @typescript-eslint/naming-convention
76441
- onChange: (_, __, event)=>onChange(event),
76487
+ function RowCheckbox({ onChange, ...nativeProps }) {
76488
+ const handleOnChange = useCallback((_value, _checked, event)=>{
76489
+ if (onChange) {
76490
+ onChange(event);
76491
+ }
76492
+ }, [
76493
+ onChange
76494
+ ]);
76495
+ return /*#__PURE__*/ jsx(RestyledRsuiteCheckbox, {
76496
+ $isChecked: nativeProps.checked || nativeProps.indeterminate,
76497
+ $isDisabled: nativeProps.disabled,
76498
+ $isReadOnly: nativeProps.readOnly,
76499
+ ...nativeProps,
76500
+ onChange: handleOnChange,
76442
76501
  onClick: stopMouseEventPropagation
76443
76502
  });
76444
76503
  }
76504
+ const RestyledRsuiteCheckbox = styled(StyledRsuiteCheckbox)`
76505
+ vertical-align: top;
76506
+
76507
+ > .rs-checkbox-checker,
76508
+ &.rs-checkbox-indeterminate > .rs-checkbox-checker {
76509
+ padding: 0;
76510
+
76511
+ > label {
76512
+ > .rs-checkbox-wrapper {
76513
+ bottom: 0;
76514
+ top: 3px;
76515
+
76516
+ &:before {
76517
+ }
76518
+ &:after {
76519
+ bottom: 0;
76520
+ left: 0;
76521
+ right: 0;
76522
+ top: 0;
76523
+ }
76524
+
76525
+ > .rs-checkbox-inner {
76526
+ &:before {
76527
+ }
76528
+
76529
+ /* Checkmark */
76530
+ &:after {
76531
+ }
76532
+ }
76533
+ }
76534
+ }
76535
+ }
76536
+ `;
76445
76537
 
76446
76538
  const Table = styled(SimpleTable.Table)`
76447
76539
  border-collapse: separate;
76448
76540
  border-spacing: 0 5px;
76449
76541
  table-layout: fixed;
76542
+
76543
+ ${(p)=>!!p.$withRowCheckbox && css`
76544
+ > thead > tr > th:first-child {
76545
+ padding: 0 0 0 8px;
76546
+
76547
+ > .rs-checkbox {
76548
+ > .rs-checkbox-checker {
76549
+ > label {
76550
+ > .rs-checkbox-wrapper {
76551
+ left: -8px;
76552
+ }
76553
+ }
76554
+ }
76555
+ }
76556
+ }
76557
+
76558
+ > tbody > tr > td:first-child {
76559
+ padding: 0 0 0 8px;
76560
+ }
76561
+ `}
76450
76562
  `;
76451
76563
  const Head = styled(SimpleTable.Head)`
76452
- th:last-child {
76453
- border-right: 1px solid ${(p)=>p.theme.color.lightGray};
76564
+ > tr {
76565
+ > th {
76566
+ border-bottom: 1px solid ${(p)=>p.theme.color.lightGray};
76567
+ border-right: none;
76568
+ border-top: 1px solid ${(p)=>p.theme.color.lightGray};
76569
+
76570
+ &:first-child {
76571
+ border-left: 1px solid ${(p)=>p.theme.color.lightGray};
76572
+ }
76573
+
76574
+ &:last-child {
76575
+ border-right: 1px solid ${(p)=>p.theme.color.lightGray};
76576
+ }
76577
+ }
76454
76578
  }
76455
76579
  `;
76456
- const SortContainer = styled(SimpleTable.SortContainer)`
76457
- justify-content: start;
76458
- gap: 8px;
76459
- `;
76460
76580
  const Th = styled(SimpleTable.Th)`
76461
76581
  background-color: ${(p)=>p.theme.color.white};
76462
- border-top: 1px solid ${(p)=>p.theme.color.lightGray};
76463
- border-bottom: 1px solid ${(p)=>p.theme.color.lightGray};
76464
- border-right: none;
76465
- padding: 2px 16px;
76466
- width: ${(p)=>p.$width}px;
76582
+ line-height: 22px;
76583
+ padding: 9px 16px;
76584
+ `;
76585
+ const SortContainer = styled(SimpleTable.SortContainer)`
76586
+ gap: 8px;
76587
+ justify-content: start;
76467
76588
  `;
76468
76589
  const BodyTr = styled(SimpleTable.BodyTr)`
76469
- td:first-child {
76470
- border-left: ${(p)=>p.$isHighlighted ? `2px solid ${p.theme.color.blueGray}` : `1px solid ${p.theme.color.lightGray}`};
76471
- }
76472
- td:last-child {
76473
- border-right: ${(p)=>p.$isHighlighted ? `2px solid ${p.theme.color.blueGray}` : `1px solid ${p.theme.color.lightGray}`};
76474
- overflow: visible;
76590
+ > td {
76591
+ border-bottom: 1px solid ${(p)=>p.$isHighlighted ? p.theme.color.blueGray : p.theme.color.lightGray};
76592
+ border-right: none;
76593
+ border-top: 1px solid ${(p)=>p.$isHighlighted ? p.theme.color.blueGray : p.theme.color.lightGray};
76594
+ ${(p)=>!!p.$isHighlighted && `box-shadow: 0 -1px 0 ${p.theme.color.blueGray} inset, 0 1px 0 ${p.theme.color.blueGray} inset;`}
76595
+
76596
+ &:first-child {
76597
+ border-left: 1px solid ${(p)=>p.$isHighlighted ? p.theme.color.blueGray : p.theme.color.lightGray};
76598
+ ${(p)=>!!p.$isHighlighted && `box-shadow: 0 -1px 0 ${p.theme.color.blueGray} inset, 0 1px 0 ${p.theme.color.blueGray} inset, 1px 0 0 ${p.theme.color.blueGray} inset;`}
76599
+ }
76600
+
76601
+ &:last-child {
76602
+ border-right: 1px solid ${(p)=>p.$isHighlighted ? p.theme.color.blueGray : p.theme.color.lightGray};
76603
+ ${(p)=>!!p.$isHighlighted && `box-shadow: 0 -1px 0 ${p.theme.color.blueGray} inset, 0 1px 0 ${p.theme.color.blueGray} inset, -1px 0 0 ${p.theme.color.blueGray} inset;`}
76604
+ overflow: visible;
76605
+ }
76475
76606
  }
76476
76607
  `;
76477
76608
  const Td = styled(SimpleTable.Td)`
76478
76609
  background-color: ${(p)=>p.theme.color.cultured};
76479
- border-top: ${(p)=>p.$isHighlighted ? `2px solid ${p.theme.color.blueGray}` : `1px solid ${p.theme.color.lightGray}`};
76480
- border-bottom: ${(p)=>p.$isHighlighted ? `2px solid ${p.theme.color.blueGray}` : `1px solid ${p.theme.color.lightGray}`};
76481
- border-right: none;
76482
- padding: 4px 16px;
76483
- border-right: ${(p)=>p.$hasRightBorder ? `1px solid ${p.theme.color.lightGray}` : ''};
76484
- width: ${(p)=>p.$width}px;
76610
+ ${(p)=>!!p.$hasRightBorder && `border-right: 1px solid ${p.theme.color.lightGray} !important;`}
76611
+ padding: 9px 16px;
76485
76612
  `;
76486
76613
  const TableWithSelectableRows = {
76487
76614
  BodyTr,
76615
+ CellLoader: SimpleTable.CellLoader,
76488
76616
  Head,
76489
76617
  RowCheckbox,
76490
76618
  SortContainer,
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": "17.2.2",
4
+ "version": "18.0.1",
5
5
  "license": "AGPL-3.0",
6
6
  "type": "module",
7
7
  "engines": {
@@ -0,0 +1,2 @@
1
+ export declare const CellLoader: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
2
+ //# sourceMappingURL=CellLoader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CellLoader.d.ts","sourceRoot":"","sources":["../../../src/tables/SimpleTable/CellLoader.tsx"],"names":[],"mappings":"AAWA,eAAO,MAAM,UAAU,yGAiBtB,CAAA"}
@@ -0,0 +1,6 @@
1
+ import type { TdHTMLAttributes } from 'react';
2
+ export declare const Td: import("styled-components").StyledComponent<"td", import("styled-components").DefaultTheme, TdHTMLAttributes<HTMLTableCellElement> & {
3
+ $isCenter?: boolean | undefined;
4
+ $isLoading?: boolean | undefined;
5
+ }, keyof TdHTMLAttributes<HTMLTableCellElement> | "$isCenter" | "$isLoading">;
6
+ //# sourceMappingURL=Td.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Td.d.ts","sourceRoot":"","sources":["../../../src/tables/SimpleTable/Td.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAA;AAM7C,eAAO,MAAM,EAAE;gBAHD,OAAO,GAAG,SAAS;iBAClB,OAAO,GAAG,SAAS;6EA0BjC,CAAA"}
@@ -1,11 +1,16 @@
1
+ /// <reference types="react" />
1
2
  export declare const SimpleTable: {
2
3
  BodyTr: import("styled-components").StyledComponent<"tr", import("styled-components").DefaultTheme, {}, never>;
4
+ CellLoader: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
3
5
  Head: import("styled-components").StyledComponent<"thead", import("styled-components").DefaultTheme, {}, never>;
4
6
  SortContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
5
7
  Table: import("styled-components").StyledComponent<"table", import("styled-components").DefaultTheme, {}, never>;
6
- Td: import("styled-components").StyledComponent<"td", import("styled-components").DefaultTheme, {
7
- $isCenter?: boolean;
8
+ Td: import("styled-components").StyledComponent<"td", import("styled-components").DefaultTheme, import("react").TdHTMLAttributes<HTMLTableCellElement> & {
9
+ $isCenter?: boolean | undefined;
10
+ $isLoading?: boolean | undefined;
11
+ }, keyof import("react").TdHTMLAttributes<HTMLTableCellElement> | "$isCenter" | "$isLoading">;
12
+ Th: import("styled-components").StyledComponent<"th", import("styled-components").DefaultTheme, {
13
+ $width?: number | undefined;
8
14
  }, never>;
9
- Th: import("styled-components").StyledComponent<"th", import("styled-components").DefaultTheme, {}, never>;
10
15
  };
11
- //# sourceMappingURL=SimpleTable.d.ts.map
16
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tables/SimpleTable/index.tsx"],"names":[],"mappings":";AA0EA,eAAO,MAAM,WAAW;;;;;;;;;;;iBA/Cb,MAAM,GAAG,SAAS;;CAuD5B,CAAA"}
@@ -1,10 +1,7 @@
1
- import { type HTMLProps } from 'react';
2
- export type RowCheckboxProps = {
3
- className?: string;
4
- disabled?: boolean;
5
- isChecked?: boolean;
6
- isIndeterminate?: boolean;
7
- onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
1
+ import { type ChangeEvent, type HTMLProps } from 'react';
2
+ import { type CheckboxProps as RsuiteCheckboxProps } from 'rsuite';
3
+ export type RowCheckboxProps = Omit<RsuiteCheckboxProps, 'onClick' | 'onChange'> & {
4
+ onChange?: ((event: ChangeEvent<HTMLInputElement>) => void) | undefined;
8
5
  };
9
- export declare function RowCheckbox({ className, disabled, isChecked, isIndeterminate, onChange }: RowCheckboxProps & HTMLProps<HTMLInputElement>): import("react/jsx-runtime").JSX.Element;
6
+ export declare function RowCheckbox({ onChange, ...nativeProps }: RowCheckboxProps & HTMLProps<HTMLInputElement>): import("react/jsx-runtime").JSX.Element;
10
7
  //# sourceMappingURL=RowCheckbox.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"RowCheckbox.d.ts","sourceRoot":"","sources":["../../../src/tables/TableWithSelectableRows/RowCheckbox.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAGtC,MAAM,MAAM,gBAAgB,GAAG;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,SAAS,CAAC,EAAE,OAAO,CAAA;IAEnB,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAA;CAChE,CAAA;AACD,wBAAgB,WAAW,CAAC,EAC1B,SAAc,EACd,QAAgB,EAChB,SAAiB,EACjB,eAAuB,EACvB,QAA0B,EAC3B,EAAE,gBAAgB,GAAG,SAAS,CAAC,gBAAgB,CAAC,2CAYhD"}
1
+ {"version":3,"file":"RowCheckbox.d.ts","sourceRoot":"","sources":["../../../src/tables/TableWithSelectableRows/RowCheckbox.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAe,KAAK,WAAW,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AACrE,OAAO,EAAE,KAAK,aAAa,IAAI,mBAAmB,EAAE,MAAM,QAAQ,CAAA;AAKlE,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,mBAAmB,EAAE,SAAS,GAAG,UAAU,CAAC,GAAG;IAEjF,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC,GAAG,SAAS,CAAA;CACxE,CAAA;AACD,wBAAgB,WAAW,CAAC,EAAE,QAAQ,EAAE,GAAG,WAAW,EAAE,EAAE,gBAAgB,GAAG,SAAS,CAAC,gBAAgB,CAAC,2CAoBvG"}
@@ -1,22 +1,24 @@
1
+ /// <reference types="react" />
1
2
  import { RowCheckbox } from './RowCheckbox';
2
- export { RowCheckbox };
3
3
  export declare const TableWithSelectableRows: {
4
4
  BodyTr: import("styled-components").StyledComponent<"tr", import("styled-components").DefaultTheme, {
5
5
  $isHighlighted?: boolean;
6
6
  }, never>;
7
+ CellLoader: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
7
8
  Head: import("styled-components").StyledComponent<"thead", import("styled-components").DefaultTheme, {}, never>;
8
9
  RowCheckbox: typeof RowCheckbox;
9
10
  SortContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
10
- Table: import("styled-components").StyledComponent<"table", import("styled-components").DefaultTheme, {}, never>;
11
- Td: import("styled-components").StyledComponent<"td", import("styled-components").DefaultTheme, {
12
- $isCenter?: boolean;
13
- } & {
14
- $hasRightBorder: boolean;
15
- $isHighlighted?: boolean;
16
- $width: number;
11
+ Table: import("styled-components").StyledComponent<"table", import("styled-components").DefaultTheme, {
12
+ $withRowCheckbox?: boolean;
17
13
  }, never>;
14
+ Td: import("styled-components").StyledComponent<"td", import("styled-components").DefaultTheme, import("react").TdHTMLAttributes<HTMLTableCellElement> & {
15
+ $isCenter?: boolean | undefined;
16
+ $isLoading?: boolean | undefined;
17
+ } & {
18
+ $hasRightBorder?: boolean;
19
+ }, keyof import("react").TdHTMLAttributes<HTMLTableCellElement> | "$isCenter" | "$isLoading">;
18
20
  Th: import("styled-components").StyledComponent<"th", import("styled-components").DefaultTheme, {
19
- $width: number;
21
+ $width?: number | undefined;
20
22
  }, never>;
21
23
  };
22
24
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tables/TableWithSelectableRows/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAG3C,OAAO,EAAE,WAAW,EAAE,CAAA;AAkDtB,eAAO,MAAM,uBAAuB;;yBAxByB,OAAO;;;;;;;;;yBAYf,OAAO;yBAAmB,OAAO;gBAAU,MAAM;;;gBArB1D,MAAM;;CAyCjD,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tables/TableWithSelectableRows/index.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAkG3C,eAAO,MAAM,uBAAuB;;yBAnCjB,OAAO;;;;;;;2BA3DL,OAAO;;;;;;0BAuFR,OAAO;;;;;CAgB1B,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"SimpleTable.d.ts","sourceRoot":"","sources":["../../src/tables/SimpleTable.tsx"],"names":[],"mappings":"AAuEA,eAAO,MAAM,WAAW;;;;;;oBAbW,OAAO;;;CAoBzC,CAAA"}