@ceed/cds 1.5.6-next.1 → 1.5.6-next.3

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.
@@ -1,3 +1 @@
1
- export declare function useControlledState<T>(controlledValue: T | undefined, defaultValue: T, onChange?: (value: T) => void, options?: {
2
- disableStrict?: boolean;
3
- }): [T, (value: T | ((prev: T) => T)) => void, boolean];
1
+ export declare function useControlledState<T>(controlledValue: T | undefined, defaultValue: T, onChange?: (value: T) => void): [T, (value: T | ((prev: T) => T)) => void, boolean];
package/dist/index.cjs CHANGED
@@ -406,7 +406,7 @@ var IconButton_default = IconButton;
406
406
 
407
407
  // src/hooks/use-controlled-state/index.ts
408
408
  var import_react5 = require("react");
409
- function useControlledState(controlledValue, defaultValue, onChange, options) {
409
+ function useControlledState(controlledValue, defaultValue, onChange) {
410
410
  const { current: isControlled } = (0, import_react5.useRef)(controlledValue !== void 0);
411
411
  const [internalValue, setInternalValue] = (0, import_react5.useState)(
412
412
  controlledValue ?? defaultValue
@@ -2350,8 +2350,7 @@ var DatePicker = (0, import_react19.forwardRef)(
2350
2350
  (0, import_react19.useCallback)(
2351
2351
  (value2) => onChange?.({ target: { name: props.name, value: value2 } }),
2352
2352
  [props.name, onChange]
2353
- ),
2354
- { disableStrict: true }
2353
+ )
2355
2354
  );
2356
2355
  const [displayValue, setDisplayValue] = (0, import_react19.useState)(
2357
2356
  () => value ? formatValueString(parseDate(value, format), displayFormat) : ""
@@ -3851,117 +3850,128 @@ function Component(props, apiRef) {
3851
3850
  ref: parentRef,
3852
3851
  ...backgroundProps
3853
3852
  },
3854
- /* @__PURE__ */ import_react25.default.createElement(Table, { ...innerProps }, /* @__PURE__ */ import_react25.default.createElement("thead", null, /* @__PURE__ */ import_react25.default.createElement("tr", null, checkboxSelection && /* @__PURE__ */ import_react25.default.createElement(
3855
- "th",
3856
- {
3857
- style: {
3858
- width: "40px",
3859
- textAlign: "center"
3860
- }
3861
- },
3862
- /* @__PURE__ */ import_react25.default.createElement(
3863
- RenderCheckbox,
3864
- {
3865
- onChange: onAllCheckboxChange,
3866
- checked: isAllSelected,
3867
- indeterminate: (selectionModel || []).length > 0 && !isAllSelected,
3868
- ...checkboxProps
3869
- }
3870
- )
3871
- ), columns.map((c, i) => /* @__PURE__ */ import_react25.default.createElement(
3872
- HeadCell2,
3873
- {
3874
- tableId,
3875
- key: `${c.field.toString()}_${i}`,
3876
- stickyHeader: props.stickyHeader,
3877
- editMode: !!c.isCellEditable,
3878
- onSortChange: handleSortChange,
3879
- ...c
3880
- }
3881
- )))), /* @__PURE__ */ import_react25.default.createElement(
3882
- VirtualizedTableBody,
3853
+ /* @__PURE__ */ import_react25.default.createElement(
3854
+ Table,
3883
3855
  {
3884
- ref: tableBodyRef,
3856
+ ...innerProps,
3885
3857
  style: {
3886
- height: `${totalSize}px`
3858
+ tableLayout: "auto"
3887
3859
  }
3888
3860
  },
3889
- !!loading && /* @__PURE__ */ import_react25.default.createElement(OverlayWrapper, null, /* @__PURE__ */ import_react25.default.createElement(
3890
- "td",
3861
+ /* @__PURE__ */ import_react25.default.createElement("thead", null, /* @__PURE__ */ import_react25.default.createElement("tr", null, checkboxSelection && /* @__PURE__ */ import_react25.default.createElement(
3862
+ "th",
3891
3863
  {
3892
3864
  style: {
3893
- position: "fixed",
3894
- width: "var(--DataTableSheet-width)",
3895
- overflow: "visible"
3865
+ width: "40px",
3866
+ textAlign: "center"
3896
3867
  }
3897
3868
  },
3898
3869
  /* @__PURE__ */ import_react25.default.createElement(
3899
- Box_default,
3870
+ RenderCheckbox,
3900
3871
  {
3901
- sx: {
3902
- position: "absolute",
3903
- top: 0,
3904
- left: 0,
3905
- right: 0
3906
- }
3907
- },
3908
- /* @__PURE__ */ import_react25.default.createElement(LoadingOverlay, null)
3872
+ onChange: onAllCheckboxChange,
3873
+ checked: isAllSelected,
3874
+ indeterminate: (selectionModel || []).length > 0 && !isAllSelected,
3875
+ ...checkboxProps
3876
+ }
3909
3877
  )
3910
- )),
3911
- virtualizedItems.map((virtualizedRow, index) => {
3912
- const rowIndex = virtualizedRow.index;
3913
- const row = dataInPage[rowIndex];
3914
- const rowId = getId(row, rowIndex);
3915
- const striped = stripe && (stripe === "even" && (rowIndex + 1) % 2 === 0 || stripe === "odd" && (rowIndex + 1) % 2 === 1);
3916
- return /* @__PURE__ */ import_react25.default.createElement(
3917
- VirtualizedTableRow,
3878
+ ), columns.map((c, i) => /* @__PURE__ */ import_react25.default.createElement(
3879
+ HeadCell2,
3880
+ {
3881
+ tableId,
3882
+ key: `${c.field.toString()}_${i}`,
3883
+ stickyHeader: props.stickyHeader,
3884
+ editMode: !!c.isCellEditable,
3885
+ onSortChange: handleSortChange,
3886
+ ...c
3887
+ }
3888
+ )))),
3889
+ /* @__PURE__ */ import_react25.default.createElement(
3890
+ VirtualizedTableBody,
3891
+ {
3892
+ ref: tableBodyRef,
3893
+ style: {
3894
+ height: `${totalSize}px`
3895
+ }
3896
+ },
3897
+ !!loading && /* @__PURE__ */ import_react25.default.createElement(OverlayWrapper, null, /* @__PURE__ */ import_react25.default.createElement(
3898
+ "td",
3918
3899
  {
3919
- key: virtualizedRow.key,
3920
- "data-row-id": rowId,
3921
- "data-index": rowIndex,
3922
- role: checkboxSelection && !disableSelectionOnClick ? "checkbox" : void 0,
3923
- tabIndex: focusedRowId === rowId ? 0 : -1,
3924
- onClick: getRowClickHandler(row, rowId),
3925
- onFocus: getRowFocusHandler(rowId),
3926
- "aria-checked": checkboxSelection ? isSelectedRow(rowId) : void 0,
3927
- striped,
3928
3900
  style: {
3929
- height: `${virtualizedRow.size}px`,
3930
- transform: `translateY(${virtualizedRow.start - index * virtualizedRow.size}px)`
3901
+ position: "fixed",
3902
+ width: "var(--DataTableSheet-width)",
3903
+ overflow: "visible"
3931
3904
  }
3932
3905
  },
3933
- checkboxSelection && /* @__PURE__ */ import_react25.default.createElement(
3934
- "th",
3906
+ /* @__PURE__ */ import_react25.default.createElement(
3907
+ Box_default,
3935
3908
  {
3936
- scope: "row",
3909
+ sx: {
3910
+ position: "absolute",
3911
+ top: 0,
3912
+ left: 0,
3913
+ right: 0
3914
+ }
3915
+ },
3916
+ /* @__PURE__ */ import_react25.default.createElement(LoadingOverlay, null)
3917
+ )
3918
+ )),
3919
+ virtualizedItems.map((virtualizedRow, index) => {
3920
+ const rowIndex = virtualizedRow.index;
3921
+ const row = dataInPage[rowIndex];
3922
+ const rowId = getId(row, rowIndex);
3923
+ const striped = stripe && (stripe === "even" && (rowIndex + 1) % 2 === 0 || stripe === "odd" && (rowIndex + 1) % 2 === 1);
3924
+ return /* @__PURE__ */ import_react25.default.createElement(
3925
+ VirtualizedTableRow,
3926
+ {
3927
+ key: virtualizedRow.key,
3928
+ "data-row-id": rowId,
3929
+ "data-index": rowIndex,
3930
+ role: checkboxSelection && !disableSelectionOnClick ? "checkbox" : void 0,
3931
+ tabIndex: focusedRowId === rowId ? 0 : -1,
3932
+ onClick: getRowClickHandler(row, rowId),
3933
+ onFocus: getRowFocusHandler(rowId),
3934
+ "aria-checked": checkboxSelection ? isSelectedRow(rowId) : void 0,
3935
+ striped,
3937
3936
  style: {
3938
- textAlign: "center"
3937
+ height: `${virtualizedRow.size}px`,
3938
+ transform: `translateY(${virtualizedRow.start - index * virtualizedRow.size}px)`
3939
3939
  }
3940
3940
  },
3941
+ checkboxSelection && /* @__PURE__ */ import_react25.default.createElement(
3942
+ "th",
3943
+ {
3944
+ scope: "row",
3945
+ style: {
3946
+ textAlign: "center"
3947
+ }
3948
+ },
3949
+ /* @__PURE__ */ import_react25.default.createElement(
3950
+ RenderCheckbox,
3951
+ {
3952
+ onClick: getCheckboxClickHandler(),
3953
+ onChange: getCheckboxChangeHandler(rowId),
3954
+ checked: isSelectedRow(rowId),
3955
+ ...checkboxProps
3956
+ }
3957
+ )
3958
+ ),
3941
3959
  /* @__PURE__ */ import_react25.default.createElement(
3942
- RenderCheckbox,
3960
+ BodyRow2,
3943
3961
  {
3944
- onClick: getCheckboxClickHandler(),
3945
- onChange: getCheckboxChangeHandler(rowId),
3946
- checked: isSelectedRow(rowId),
3947
- ...checkboxProps
3962
+ tableId,
3963
+ columns,
3964
+ row,
3965
+ rowId,
3966
+ editMode,
3967
+ noWrap: props.noWrap
3948
3968
  }
3949
3969
  )
3950
- ),
3951
- /* @__PURE__ */ import_react25.default.createElement(
3952
- BodyRow2,
3953
- {
3954
- tableId,
3955
- columns,
3956
- row,
3957
- rowId,
3958
- editMode,
3959
- noWrap: props.noWrap
3960
- }
3961
- )
3962
- );
3963
- })
3964
- ), Footer && /* @__PURE__ */ import_react25.default.createElement(Footer, null))
3970
+ );
3971
+ })
3972
+ ),
3973
+ Footer && /* @__PURE__ */ import_react25.default.createElement(Footer, null)
3974
+ )
3965
3975
  ),
3966
3976
  pagination && /* @__PURE__ */ import_react25.default.createElement(
3967
3977
  Pagination_default,
@@ -4128,8 +4138,7 @@ var DateRangePicker = (0, import_react26.forwardRef)(
4128
4138
  (0, import_react26.useCallback)(
4129
4139
  (value2) => onChange?.({ target: { name: props.name, value: value2 } }),
4130
4140
  [props.name, onChange]
4131
- ),
4132
- { disableStrict: true }
4141
+ )
4133
4142
  );
4134
4143
  const [anchorEl, setAnchorEl] = (0, import_react26.useState)(null);
4135
4144
  const open = Boolean(anchorEl);
@@ -4632,8 +4641,7 @@ var MonthPicker = (0, import_react33.forwardRef)(
4632
4641
  (0, import_react33.useCallback)(
4633
4642
  (value2) => onChange?.({ target: { name: props.name, value: value2 } }),
4634
4643
  [props.name, onChange]
4635
- ),
4636
- { disableStrict: true }
4644
+ )
4637
4645
  );
4638
4646
  const getFormattedDisplayValue = (0, import_react33.useCallback)(
4639
4647
  (inputValue) => {
@@ -4926,8 +4934,7 @@ var MonthRangePicker = (0, import_react34.forwardRef)(
4926
4934
  (0, import_react34.useCallback)(
4927
4935
  (value2) => onChange?.({ target: { name: props.name, value: value2 } }),
4928
4936
  [props.name, onChange]
4929
- ),
4930
- { disableStrict: true }
4937
+ )
4931
4938
  );
4932
4939
  const [anchorEl, setAnchorEl] = (0, import_react34.useState)(null);
4933
4940
  const open = Boolean(anchorEl);
package/dist/index.js CHANGED
@@ -325,7 +325,7 @@ var IconButton_default = IconButton;
325
325
 
326
326
  // src/hooks/use-controlled-state/index.ts
327
327
  import { useState, useCallback, useEffect, useRef } from "react";
328
- function useControlledState(controlledValue, defaultValue, onChange, options) {
328
+ function useControlledState(controlledValue, defaultValue, onChange) {
329
329
  const { current: isControlled } = useRef(controlledValue !== void 0);
330
330
  const [internalValue, setInternalValue] = useState(
331
331
  controlledValue ?? defaultValue
@@ -2312,8 +2312,7 @@ var DatePicker = forwardRef6(
2312
2312
  useCallback7(
2313
2313
  (value2) => onChange?.({ target: { name: props.name, value: value2 } }),
2314
2314
  [props.name, onChange]
2315
- ),
2316
- { disableStrict: true }
2315
+ )
2317
2316
  );
2318
2317
  const [displayValue, setDisplayValue] = useState5(
2319
2318
  () => value ? formatValueString(parseDate(value, format), displayFormat) : ""
@@ -3819,117 +3818,128 @@ function Component(props, apiRef) {
3819
3818
  ref: parentRef,
3820
3819
  ...backgroundProps
3821
3820
  },
3822
- /* @__PURE__ */ React23.createElement(Table, { ...innerProps }, /* @__PURE__ */ React23.createElement("thead", null, /* @__PURE__ */ React23.createElement("tr", null, checkboxSelection && /* @__PURE__ */ React23.createElement(
3823
- "th",
3824
- {
3825
- style: {
3826
- width: "40px",
3827
- textAlign: "center"
3828
- }
3829
- },
3830
- /* @__PURE__ */ React23.createElement(
3831
- RenderCheckbox,
3832
- {
3833
- onChange: onAllCheckboxChange,
3834
- checked: isAllSelected,
3835
- indeterminate: (selectionModel || []).length > 0 && !isAllSelected,
3836
- ...checkboxProps
3837
- }
3838
- )
3839
- ), columns.map((c, i) => /* @__PURE__ */ React23.createElement(
3840
- HeadCell2,
3841
- {
3842
- tableId,
3843
- key: `${c.field.toString()}_${i}`,
3844
- stickyHeader: props.stickyHeader,
3845
- editMode: !!c.isCellEditable,
3846
- onSortChange: handleSortChange,
3847
- ...c
3848
- }
3849
- )))), /* @__PURE__ */ React23.createElement(
3850
- VirtualizedTableBody,
3821
+ /* @__PURE__ */ React23.createElement(
3822
+ Table,
3851
3823
  {
3852
- ref: tableBodyRef,
3824
+ ...innerProps,
3853
3825
  style: {
3854
- height: `${totalSize}px`
3826
+ tableLayout: "auto"
3855
3827
  }
3856
3828
  },
3857
- !!loading && /* @__PURE__ */ React23.createElement(OverlayWrapper, null, /* @__PURE__ */ React23.createElement(
3858
- "td",
3829
+ /* @__PURE__ */ React23.createElement("thead", null, /* @__PURE__ */ React23.createElement("tr", null, checkboxSelection && /* @__PURE__ */ React23.createElement(
3830
+ "th",
3859
3831
  {
3860
3832
  style: {
3861
- position: "fixed",
3862
- width: "var(--DataTableSheet-width)",
3863
- overflow: "visible"
3833
+ width: "40px",
3834
+ textAlign: "center"
3864
3835
  }
3865
3836
  },
3866
3837
  /* @__PURE__ */ React23.createElement(
3867
- Box_default,
3838
+ RenderCheckbox,
3868
3839
  {
3869
- sx: {
3870
- position: "absolute",
3871
- top: 0,
3872
- left: 0,
3873
- right: 0
3874
- }
3875
- },
3876
- /* @__PURE__ */ React23.createElement(LoadingOverlay, null)
3840
+ onChange: onAllCheckboxChange,
3841
+ checked: isAllSelected,
3842
+ indeterminate: (selectionModel || []).length > 0 && !isAllSelected,
3843
+ ...checkboxProps
3844
+ }
3877
3845
  )
3878
- )),
3879
- virtualizedItems.map((virtualizedRow, index) => {
3880
- const rowIndex = virtualizedRow.index;
3881
- const row = dataInPage[rowIndex];
3882
- const rowId = getId(row, rowIndex);
3883
- const striped = stripe && (stripe === "even" && (rowIndex + 1) % 2 === 0 || stripe === "odd" && (rowIndex + 1) % 2 === 1);
3884
- return /* @__PURE__ */ React23.createElement(
3885
- VirtualizedTableRow,
3846
+ ), columns.map((c, i) => /* @__PURE__ */ React23.createElement(
3847
+ HeadCell2,
3848
+ {
3849
+ tableId,
3850
+ key: `${c.field.toString()}_${i}`,
3851
+ stickyHeader: props.stickyHeader,
3852
+ editMode: !!c.isCellEditable,
3853
+ onSortChange: handleSortChange,
3854
+ ...c
3855
+ }
3856
+ )))),
3857
+ /* @__PURE__ */ React23.createElement(
3858
+ VirtualizedTableBody,
3859
+ {
3860
+ ref: tableBodyRef,
3861
+ style: {
3862
+ height: `${totalSize}px`
3863
+ }
3864
+ },
3865
+ !!loading && /* @__PURE__ */ React23.createElement(OverlayWrapper, null, /* @__PURE__ */ React23.createElement(
3866
+ "td",
3886
3867
  {
3887
- key: virtualizedRow.key,
3888
- "data-row-id": rowId,
3889
- "data-index": rowIndex,
3890
- role: checkboxSelection && !disableSelectionOnClick ? "checkbox" : void 0,
3891
- tabIndex: focusedRowId === rowId ? 0 : -1,
3892
- onClick: getRowClickHandler(row, rowId),
3893
- onFocus: getRowFocusHandler(rowId),
3894
- "aria-checked": checkboxSelection ? isSelectedRow(rowId) : void 0,
3895
- striped,
3896
3868
  style: {
3897
- height: `${virtualizedRow.size}px`,
3898
- transform: `translateY(${virtualizedRow.start - index * virtualizedRow.size}px)`
3869
+ position: "fixed",
3870
+ width: "var(--DataTableSheet-width)",
3871
+ overflow: "visible"
3899
3872
  }
3900
3873
  },
3901
- checkboxSelection && /* @__PURE__ */ React23.createElement(
3902
- "th",
3874
+ /* @__PURE__ */ React23.createElement(
3875
+ Box_default,
3903
3876
  {
3904
- scope: "row",
3877
+ sx: {
3878
+ position: "absolute",
3879
+ top: 0,
3880
+ left: 0,
3881
+ right: 0
3882
+ }
3883
+ },
3884
+ /* @__PURE__ */ React23.createElement(LoadingOverlay, null)
3885
+ )
3886
+ )),
3887
+ virtualizedItems.map((virtualizedRow, index) => {
3888
+ const rowIndex = virtualizedRow.index;
3889
+ const row = dataInPage[rowIndex];
3890
+ const rowId = getId(row, rowIndex);
3891
+ const striped = stripe && (stripe === "even" && (rowIndex + 1) % 2 === 0 || stripe === "odd" && (rowIndex + 1) % 2 === 1);
3892
+ return /* @__PURE__ */ React23.createElement(
3893
+ VirtualizedTableRow,
3894
+ {
3895
+ key: virtualizedRow.key,
3896
+ "data-row-id": rowId,
3897
+ "data-index": rowIndex,
3898
+ role: checkboxSelection && !disableSelectionOnClick ? "checkbox" : void 0,
3899
+ tabIndex: focusedRowId === rowId ? 0 : -1,
3900
+ onClick: getRowClickHandler(row, rowId),
3901
+ onFocus: getRowFocusHandler(rowId),
3902
+ "aria-checked": checkboxSelection ? isSelectedRow(rowId) : void 0,
3903
+ striped,
3905
3904
  style: {
3906
- textAlign: "center"
3905
+ height: `${virtualizedRow.size}px`,
3906
+ transform: `translateY(${virtualizedRow.start - index * virtualizedRow.size}px)`
3907
3907
  }
3908
3908
  },
3909
+ checkboxSelection && /* @__PURE__ */ React23.createElement(
3910
+ "th",
3911
+ {
3912
+ scope: "row",
3913
+ style: {
3914
+ textAlign: "center"
3915
+ }
3916
+ },
3917
+ /* @__PURE__ */ React23.createElement(
3918
+ RenderCheckbox,
3919
+ {
3920
+ onClick: getCheckboxClickHandler(),
3921
+ onChange: getCheckboxChangeHandler(rowId),
3922
+ checked: isSelectedRow(rowId),
3923
+ ...checkboxProps
3924
+ }
3925
+ )
3926
+ ),
3909
3927
  /* @__PURE__ */ React23.createElement(
3910
- RenderCheckbox,
3928
+ BodyRow2,
3911
3929
  {
3912
- onClick: getCheckboxClickHandler(),
3913
- onChange: getCheckboxChangeHandler(rowId),
3914
- checked: isSelectedRow(rowId),
3915
- ...checkboxProps
3930
+ tableId,
3931
+ columns,
3932
+ row,
3933
+ rowId,
3934
+ editMode,
3935
+ noWrap: props.noWrap
3916
3936
  }
3917
3937
  )
3918
- ),
3919
- /* @__PURE__ */ React23.createElement(
3920
- BodyRow2,
3921
- {
3922
- tableId,
3923
- columns,
3924
- row,
3925
- rowId,
3926
- editMode,
3927
- noWrap: props.noWrap
3928
- }
3929
- )
3930
- );
3931
- })
3932
- ), Footer && /* @__PURE__ */ React23.createElement(Footer, null))
3938
+ );
3939
+ })
3940
+ ),
3941
+ Footer && /* @__PURE__ */ React23.createElement(Footer, null)
3942
+ )
3933
3943
  ),
3934
3944
  pagination && /* @__PURE__ */ React23.createElement(
3935
3945
  Pagination_default,
@@ -4104,8 +4114,7 @@ var DateRangePicker = forwardRef8(
4104
4114
  useCallback10(
4105
4115
  (value2) => onChange?.({ target: { name: props.name, value: value2 } }),
4106
4116
  [props.name, onChange]
4107
- ),
4108
- { disableStrict: true }
4117
+ )
4109
4118
  );
4110
4119
  const [anchorEl, setAnchorEl] = useState7(null);
4111
4120
  const open = Boolean(anchorEl);
@@ -4628,8 +4637,7 @@ var MonthPicker = forwardRef9(
4628
4637
  useCallback11(
4629
4638
  (value2) => onChange?.({ target: { name: props.name, value: value2 } }),
4630
4639
  [props.name, onChange]
4631
- ),
4632
- { disableStrict: true }
4640
+ )
4633
4641
  );
4634
4642
  const getFormattedDisplayValue = useCallback11(
4635
4643
  (inputValue) => {
@@ -4930,8 +4938,7 @@ var MonthRangePicker = forwardRef10(
4930
4938
  useCallback12(
4931
4939
  (value2) => onChange?.({ target: { name: props.name, value: value2 } }),
4932
4940
  [props.name, onChange]
4933
- ),
4934
- { disableStrict: true }
4941
+ )
4935
4942
  );
4936
4943
  const [anchorEl, setAnchorEl] = useState10(null);
4937
4944
  const open = Boolean(anchorEl);