@embeddable.com/remarkable-ui 2.0.44 → 2.0.46

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/dist/index.d.ts CHANGED
@@ -84,6 +84,11 @@ type KpiChartProps = {
84
84
  valueFormatter?: (value: number) => string;
85
85
  };
86
86
 
87
+ declare const getKpiDisplayValue: ({ value, displayNullAs, valueFormatter, }: {
88
+ value: number | null | undefined;
89
+ displayNullAs: string | number;
90
+ valueFormatter?: (value: number) => string;
91
+ }) => string | number;
87
92
  declare const KpiChart: FC<KpiChartProps>;
88
93
 
89
94
  type PieChartConfigurationProps = {
@@ -384,6 +389,7 @@ declare const SelectListOption: FC<SelectListOptionProps>;
384
389
  type MultiSelectFieldProps = {
385
390
  startIcon?: React.ComponentType<IconProps>;
386
391
  disabled?: boolean;
392
+ disableApplyButton?: boolean;
387
393
  isClearable?: boolean;
388
394
  isLoading?: boolean;
389
395
  isSearchable?: boolean;
@@ -394,6 +400,7 @@ type MultiSelectFieldProps = {
394
400
  values?: string[];
395
401
  avoidCollisions?: boolean;
396
402
  onChange: (value: string[]) => void;
403
+ onPendingChange?: (values: string[]) => void;
397
404
  onSearch?: (search: string) => void;
398
405
  error?: boolean;
399
406
  errorMessage?: string;
@@ -595,4 +602,4 @@ declare const endOfDayUTC: (date: Date) => Date;
595
602
 
596
603
  declare const shallowEqual: (object1: any, object2: any) => boolean;
597
604
 
598
- export { ActionIcon, BarChart, type BarChartProps, Button, ButtonIcon, Card, CardContent, CardFeedback, CardHeader, type CssSize, DateRangePicker, DateRangePickerField, type DateRangePickerProps, Divider, DonutChart, type DonutLabelChartProps, Dropdown, type DropdownProps, FieldFeedback, type FieldFeedbackProps, FieldHeader, type FieldHeaderProps, GhostButton, GhostButtonIcon, HeatMap, type HeatMapProps, type HeatMapPropsDimension, type HeatMapPropsMeasure, type HeatMapPropsThreshold, KpiChart, LineChart, type LineChartProps, Markdown, MarkdownEditor, MultiSelectField, type MultiSelectFieldProps, NumberField, Overlay, PieChart, type PieChartProps, PivotTable, type PivotTableProps, type PivotTablePropsColumnDimension, type PivotTablePropsMeasure, type PivotTablePropsRowDimension, SelectFieldCategory, SelectFieldContent, SelectFieldContentList, SelectFieldTrigger, SelectListOption, type SelectListOptionProps, type SelectListOptionPropsWithCategory, SingleSelectField, type SingleSelectFieldProps, Skeleton, StylesKeys, Switch, TableBody, TableBodyCellWithCopy, type TableBodyProps, TableHeader, TableHeaderAlign, type TableHeaderCell, type TableHeaderCellStyle, type TableHeaderItem, type TableHeaderItemAlign, type TableHeaderProps, TablePaginated, type TablePaginatedProps, TablePagination, type TablePaginationProps, TableScrollable, type TableScrollableHandle, type TableScrollableProps, type TableSort, TableSortDirection, TextField, Tooltip, Typography, chartjsAxisOptionsLayoutPadding, chartjsAxisOptionsLayoutPaddingLarge, endOfDayUTC, getBarChartData, getBarChartOptions, getChartColors, getChartjsAxisOptions, getChartjsAxisOptionsPlugins, getChartjsAxisOptionsScales, getChartjsAxisOptionsScalesGrid, getChartjsAxisOptionsScalesGridColor, getChartjsAxisOptionsScalesTicksDefault, getChartjsAxisOptionsScalesTicksMuted, getChartjsAxisOptionsScalesTitle, getDonutChartOptions, getLineChartData, getLineChartOptions, getPieChartData, getPieChartOptions, getStyle, getStyleNumber, getTableTotalPages, isSameDate, isSameDateRange, shallowEqual, useDebounce, useResizeObserver, useTableGetRowsPerPage };
605
+ export { ActionIcon, BarChart, type BarChartProps, Button, ButtonIcon, Card, CardContent, CardFeedback, CardHeader, type CssSize, DateRangePicker, DateRangePickerField, type DateRangePickerProps, Divider, DonutChart, type DonutLabelChartProps, Dropdown, type DropdownProps, FieldFeedback, type FieldFeedbackProps, FieldHeader, type FieldHeaderProps, GhostButton, GhostButtonIcon, HeatMap, type HeatMapProps, type HeatMapPropsDimension, type HeatMapPropsMeasure, type HeatMapPropsThreshold, KpiChart, LineChart, type LineChartProps, Markdown, MarkdownEditor, MultiSelectField, type MultiSelectFieldProps, NumberField, Overlay, PieChart, type PieChartProps, PivotTable, type PivotTableProps, type PivotTablePropsColumnDimension, type PivotTablePropsMeasure, type PivotTablePropsRowDimension, SelectFieldCategory, SelectFieldContent, SelectFieldContentList, SelectFieldTrigger, SelectListOption, type SelectListOptionProps, type SelectListOptionPropsWithCategory, SingleSelectField, type SingleSelectFieldProps, Skeleton, StylesKeys, Switch, TableBody, TableBodyCellWithCopy, type TableBodyProps, TableHeader, TableHeaderAlign, type TableHeaderCell, type TableHeaderCellStyle, type TableHeaderItem, type TableHeaderItemAlign, type TableHeaderProps, TablePaginated, type TablePaginatedProps, TablePagination, type TablePaginationProps, TableScrollable, type TableScrollableHandle, type TableScrollableProps, type TableSort, TableSortDirection, TextField, Tooltip, Typography, chartjsAxisOptionsLayoutPadding, chartjsAxisOptionsLayoutPaddingLarge, endOfDayUTC, getBarChartData, getBarChartOptions, getChartColors, getChartjsAxisOptions, getChartjsAxisOptionsPlugins, getChartjsAxisOptionsScales, getChartjsAxisOptionsScalesGrid, getChartjsAxisOptionsScalesGridColor, getChartjsAxisOptionsScalesTicksDefault, getChartjsAxisOptionsScalesTicksMuted, getChartjsAxisOptionsScalesTitle, getDonutChartOptions, getKpiDisplayValue, getLineChartData, getLineChartOptions, getPieChartData, getPieChartOptions, getStyle, getStyleNumber, getTableTotalPages, isSameDate, isSameDateRange, shallowEqual, useDebounce, useResizeObserver, useTableGetRowsPerPage };
package/dist/index.js CHANGED
@@ -683,6 +683,18 @@ var ConditionalWrapper_default = ConditionalWrapper;
683
683
 
684
684
  // src/components/charts/kpis/KpiChart.tsx
685
685
  import { jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
686
+ var getKpiDisplayValue = ({
687
+ value,
688
+ displayNullAs,
689
+ valueFormatter
690
+ }) => {
691
+ if (value == null) {
692
+ if (displayNullAs === "") return "";
693
+ const numericDisplayNullAs = Number(displayNullAs);
694
+ return Number.isNaN(numericDisplayNullAs) ? displayNullAs : valueFormatter?.(numericDisplayNullAs) ?? numericDisplayNullAs;
695
+ }
696
+ return valueFormatter?.(value) ?? value;
697
+ };
686
698
  var KpiChart = ({
687
699
  value,
688
700
  valueFontSize,
@@ -698,7 +710,7 @@ var KpiChart = ({
698
710
  valueFormatter
699
711
  }) => {
700
712
  const hasComparisonValue = comparisonValue !== void 0;
701
- const displayValue = value == null ? displayNullAs : valueFormatter?.(value) ?? value;
713
+ const displayValue = getKpiDisplayValue({ value, displayNullAs, valueFormatter });
702
714
  const autoResizeValueFontSize = !valueFontSize;
703
715
  return /* @__PURE__ */ jsxs2("div", { className: styles5.kpiChartContainer, children: [
704
716
  /* @__PURE__ */ jsx5("div", { className: styles5.kpiChartValueContainer, children: /* @__PURE__ */ jsx5(
@@ -2787,6 +2799,7 @@ var MultiSelectField = ({
2787
2799
  label,
2788
2800
  required,
2789
2801
  disabled,
2802
+ disableApplyButton,
2790
2803
  isClearable,
2791
2804
  isLoading,
2792
2805
  isSearchable,
@@ -2797,6 +2810,7 @@ var MultiSelectField = ({
2797
2810
  values = [],
2798
2811
  avoidCollisions,
2799
2812
  onChange,
2813
+ onPendingChange,
2800
2814
  onSearch,
2801
2815
  error = false,
2802
2816
  errorMessage
@@ -2809,6 +2823,7 @@ var MultiSelectField = ({
2809
2823
  useSelectSearchFocus(isOpen, searchFieldRef);
2810
2824
  useEffect8(() => {
2811
2825
  setPreValues(values);
2826
+ onPendingChange?.(values);
2812
2827
  }, [JSON.stringify(values)]);
2813
2828
  useEffect8(() => {
2814
2829
  if (isLoading) {
@@ -2834,9 +2849,13 @@ var MultiSelectField = ({
2834
2849
  e.preventDefault();
2835
2850
  if (!newValue) return;
2836
2851
  if (preValues.includes(newValue)) {
2837
- setPreValues(preValues.filter((v) => v !== newValue));
2852
+ const next = preValues.filter((v) => v !== newValue);
2853
+ setPreValues(next);
2854
+ onPendingChange?.(next);
2838
2855
  } else {
2839
- setPreValues([...preValues, newValue]);
2856
+ const next = [...preValues, newValue];
2857
+ setPreValues(next);
2858
+ onPendingChange?.(next);
2840
2859
  }
2841
2860
  };
2842
2861
  const handleSearch = (newSearch) => {
@@ -2852,6 +2871,7 @@ var MultiSelectField = ({
2852
2871
  const handleClearAll = () => {
2853
2872
  setSearchValue("");
2854
2873
  onSearch?.("");
2874
+ onPendingChange?.([]);
2855
2875
  onChange([]);
2856
2876
  };
2857
2877
  const hasError = error || !!errorMessage;
@@ -2920,7 +2940,7 @@ var MultiSelectField = ({
2920
2940
  Button,
2921
2941
  {
2922
2942
  className: styles23.submitButton,
2923
- disabled: isSubmitDisabled || isLoading,
2943
+ disabled: isSubmitDisabled || isLoading || disableApplyButton,
2924
2944
  variant: "primary",
2925
2945
  size: "medium",
2926
2946
  onClick: () => handleSave(preValues),
@@ -3550,6 +3570,7 @@ export {
3550
3570
  getChartjsAxisOptionsScalesTicksMuted,
3551
3571
  getChartjsAxisOptionsScalesTitle,
3552
3572
  getDonutChartOptions,
3573
+ getKpiDisplayValue,
3553
3574
  getLineChartData,
3554
3575
  getLineChartOptions,
3555
3576
  getPieChartData,