@embeddable.com/remarkable-ui 2.0.45 → 3.0.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/dist/index.d.ts +39 -31
- package/dist/index.js +66 -57
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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 = {
|
|
@@ -366,8 +371,8 @@ declare const TextField: React$1.ForwardRefExoticComponent<Omit<React$1.InputHTM
|
|
|
366
371
|
} & FieldHeaderProps & React$1.RefAttributes<HTMLInputElement>>;
|
|
367
372
|
|
|
368
373
|
type SelectListOptionIcon = React.ReactElement<SVGProps<SVGSVGElement>> | React.ReactElement<ImgHTMLAttributes<HTMLImageElement>>;
|
|
369
|
-
type SelectListOptionProps = {
|
|
370
|
-
value?:
|
|
374
|
+
type SelectListOptionProps<T = string> = {
|
|
375
|
+
value?: T;
|
|
371
376
|
isSelected?: boolean;
|
|
372
377
|
label: string;
|
|
373
378
|
rightLabel?: string;
|
|
@@ -376,31 +381,10 @@ type SelectListOptionProps = {
|
|
|
376
381
|
disabled?: boolean;
|
|
377
382
|
onClick?: (event: React.MouseEvent<HTMLDivElement>) => void;
|
|
378
383
|
};
|
|
379
|
-
type SelectListOptionPropsWithCategory = SelectListOptionProps & {
|
|
384
|
+
type SelectListOptionPropsWithCategory<T = string> = SelectListOptionProps<T> & {
|
|
380
385
|
category: string;
|
|
381
386
|
};
|
|
382
|
-
declare const SelectListOption:
|
|
383
|
-
|
|
384
|
-
type MultiSelectFieldProps = {
|
|
385
|
-
startIcon?: React.ComponentType<IconProps>;
|
|
386
|
-
disabled?: boolean;
|
|
387
|
-
disableApplyButton?: boolean;
|
|
388
|
-
isClearable?: boolean;
|
|
389
|
-
isLoading?: boolean;
|
|
390
|
-
isSearchable?: boolean;
|
|
391
|
-
noOptionsMessage?: string;
|
|
392
|
-
options: (SelectListOptionProps | SelectListOptionPropsWithCategory)[];
|
|
393
|
-
placeholder?: string;
|
|
394
|
-
submitLabel?: string;
|
|
395
|
-
values?: string[];
|
|
396
|
-
avoidCollisions?: boolean;
|
|
397
|
-
onChange: (value: string[]) => void;
|
|
398
|
-
onPendingChange?: (values: string[]) => void;
|
|
399
|
-
onSearch?: (search: string) => void;
|
|
400
|
-
error?: boolean;
|
|
401
|
-
errorMessage?: string;
|
|
402
|
-
} & FieldHeaderProps;
|
|
403
|
-
declare const MultiSelectField: FC<MultiSelectFieldProps>;
|
|
387
|
+
declare const SelectListOption: <T>({ value, isSelected, label, rightLabel, startIcon, endIcon, disabled, ...props }: SelectListOptionProps<T>) => react_jsx_runtime.JSX.Element;
|
|
404
388
|
|
|
405
389
|
type DropdownProps = {
|
|
406
390
|
triggerComponent: React.ReactNode;
|
|
@@ -414,24 +398,48 @@ type DropdownProps = {
|
|
|
414
398
|
};
|
|
415
399
|
declare const Dropdown: FC<DropdownProps>;
|
|
416
400
|
|
|
417
|
-
type
|
|
418
|
-
|
|
401
|
+
type SelectOptionValue = string | number | boolean;
|
|
402
|
+
type SingleSelectFieldProps<T extends SelectOptionValue> = {
|
|
403
|
+
options: SelectListOptionProps<T>[];
|
|
419
404
|
startIcon?: React.ComponentType<IconProps>;
|
|
420
|
-
value?:
|
|
405
|
+
value?: T | null;
|
|
421
406
|
disabled?: boolean;
|
|
422
407
|
placeholder?: string;
|
|
423
408
|
searchable?: boolean;
|
|
424
409
|
clearable?: boolean;
|
|
425
410
|
isLoading?: boolean;
|
|
426
411
|
noOptionsMessage?: string;
|
|
427
|
-
onChange: (value:
|
|
412
|
+
onChange: (value: T | null) => void;
|
|
428
413
|
onSearch?: (search: string) => void;
|
|
429
414
|
error?: boolean;
|
|
430
415
|
errorMessage?: string;
|
|
431
416
|
avoidCollisions?: boolean;
|
|
432
417
|
variant?: 'default' | 'ghost';
|
|
418
|
+
triggerComponent?: React.ReactNode;
|
|
433
419
|
} & FieldHeaderProps & Pick<DropdownProps, 'side' | 'align'>;
|
|
434
|
-
declare
|
|
420
|
+
declare function SingleSelectField<T extends SelectOptionValue>({ label, required, value, startIcon, options, disabled, placeholder, searchable, clearable, isLoading, avoidCollisions, noOptionsMessage, onChange, onSearch, error, errorMessage, side, align, variant, triggerComponent, }: SingleSelectFieldProps<T>): react_jsx_runtime.JSX.Element;
|
|
421
|
+
|
|
422
|
+
type MultiSelectFieldProps<T extends SelectOptionValue> = {
|
|
423
|
+
startIcon?: React.ComponentType<IconProps>;
|
|
424
|
+
disabled?: boolean;
|
|
425
|
+
disableApplyButton?: boolean;
|
|
426
|
+
isClearable?: boolean;
|
|
427
|
+
isLoading?: boolean;
|
|
428
|
+
isSearchable?: boolean;
|
|
429
|
+
noOptionsMessage?: string;
|
|
430
|
+
options: (SelectListOptionProps<T> | SelectListOptionPropsWithCategory<T>)[];
|
|
431
|
+
placeholder?: string;
|
|
432
|
+
submitLabel?: string;
|
|
433
|
+
values?: T[];
|
|
434
|
+
avoidCollisions?: boolean;
|
|
435
|
+
onChange: (value: T[]) => void;
|
|
436
|
+
onPendingChange?: (values: T[]) => void;
|
|
437
|
+
onSearch?: (search: string) => void;
|
|
438
|
+
error?: boolean;
|
|
439
|
+
errorMessage?: string;
|
|
440
|
+
triggerComponent?: React.ReactNode;
|
|
441
|
+
} & FieldHeaderProps;
|
|
442
|
+
declare function MultiSelectField<T extends SelectOptionValue>({ startIcon, label, required, disabled, disableApplyButton, isClearable, isLoading, isSearchable, noOptionsMessage, options, placeholder, submitLabel, values, avoidCollisions, onChange, onPendingChange, onSearch, error, errorMessage, triggerComponent, }: MultiSelectFieldProps<T>): react_jsx_runtime.JSX.Element;
|
|
435
443
|
|
|
436
444
|
type SelectFieldContentProps = {
|
|
437
445
|
children: ReactNode;
|
|
@@ -597,4 +605,4 @@ declare const endOfDayUTC: (date: Date) => Date;
|
|
|
597
605
|
|
|
598
606
|
declare const shallowEqual: (object1: any, object2: any) => boolean;
|
|
599
607
|
|
|
600
|
-
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 };
|
|
608
|
+
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, type SelectOptionValue, 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
|
|
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(
|
|
@@ -2715,7 +2727,7 @@ var SelectListOption = ({
|
|
|
2715
2727
|
disabled && styles21.disabled,
|
|
2716
2728
|
isSelected && styles21.selected
|
|
2717
2729
|
),
|
|
2718
|
-
"data-value": value,
|
|
2730
|
+
"data-value": String(value),
|
|
2719
2731
|
...props,
|
|
2720
2732
|
children: [
|
|
2721
2733
|
/* @__PURE__ */ jsxs18("span", { className: styles21.leftContent, children: [
|
|
@@ -2734,7 +2746,7 @@ var SelectListOption = ({
|
|
|
2734
2746
|
// src/components/editors/selects/shared/SelectFieldContent/SelectFieldContent.utils.ts
|
|
2735
2747
|
var groupOptionsByCategory = (options) => {
|
|
2736
2748
|
const result = options.reduce((acc, option) => {
|
|
2737
|
-
if (
|
|
2749
|
+
if (option.category) {
|
|
2738
2750
|
const category = option.category;
|
|
2739
2751
|
if (!acc[category]) {
|
|
2740
2752
|
acc[category] = [];
|
|
@@ -2782,7 +2794,7 @@ function debounce(fn, delay = 300) {
|
|
|
2782
2794
|
|
|
2783
2795
|
// src/components/editors/selects/MultiSelectField/MultiSelectField.tsx
|
|
2784
2796
|
import { jsx as jsx31, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
2785
|
-
|
|
2797
|
+
function MultiSelectField({
|
|
2786
2798
|
startIcon,
|
|
2787
2799
|
label,
|
|
2788
2800
|
required,
|
|
@@ -2801,8 +2813,9 @@ var MultiSelectField = ({
|
|
|
2801
2813
|
onPendingChange,
|
|
2802
2814
|
onSearch,
|
|
2803
2815
|
error = false,
|
|
2804
|
-
errorMessage
|
|
2805
|
-
|
|
2816
|
+
errorMessage,
|
|
2817
|
+
triggerComponent
|
|
2818
|
+
}) {
|
|
2806
2819
|
const [isOpen, setIsOpen] = useState8(false);
|
|
2807
2820
|
const [searchValue, setSearchValue] = useState8("");
|
|
2808
2821
|
const [preValues, setPreValues] = useState8(values);
|
|
@@ -2835,7 +2848,7 @@ var MultiSelectField = ({
|
|
|
2835
2848
|
const isSubmitDisabled = preValues.every((preValue) => values.includes(preValue)) && values.every((value) => preValues.includes(value));
|
|
2836
2849
|
const handleSelectOption = (e, newValue) => {
|
|
2837
2850
|
e.preventDefault();
|
|
2838
|
-
if (
|
|
2851
|
+
if (newValue === void 0) return;
|
|
2839
2852
|
if (preValues.includes(newValue)) {
|
|
2840
2853
|
const next = preValues.filter((v) => v !== newValue);
|
|
2841
2854
|
setPreValues(next);
|
|
@@ -2862,6 +2875,19 @@ var MultiSelectField = ({
|
|
|
2862
2875
|
onPendingChange?.([]);
|
|
2863
2876
|
onChange([]);
|
|
2864
2877
|
};
|
|
2878
|
+
const renderOption = (option) => {
|
|
2879
|
+
const { value: optionValue, category: _category, ...optionRest } = option;
|
|
2880
|
+
return /* @__PURE__ */ jsx31(
|
|
2881
|
+
SelectListOption,
|
|
2882
|
+
{
|
|
2883
|
+
value: optionValue,
|
|
2884
|
+
onClick: (e) => handleSelectOption(e, optionValue),
|
|
2885
|
+
startIcon: optionValue !== void 0 && preValues.includes(optionValue) ? /* @__PURE__ */ jsx31(IconSquareCheckFilled, {}) : /* @__PURE__ */ jsx31(IconSquare, {}),
|
|
2886
|
+
...optionRest
|
|
2887
|
+
},
|
|
2888
|
+
String(optionValue)
|
|
2889
|
+
);
|
|
2890
|
+
};
|
|
2865
2891
|
const hasError = error || !!errorMessage;
|
|
2866
2892
|
return /* @__PURE__ */ jsxs19("div", { children: [
|
|
2867
2893
|
/* @__PURE__ */ jsx31(FieldHeader, { label, required }),
|
|
@@ -2872,7 +2898,7 @@ var MultiSelectField = ({
|
|
|
2872
2898
|
onOpenChange: setIsOpen,
|
|
2873
2899
|
disabled,
|
|
2874
2900
|
avoidCollisions,
|
|
2875
|
-
triggerComponent: /* @__PURE__ */ jsx31(
|
|
2901
|
+
triggerComponent: triggerComponent ?? /* @__PURE__ */ jsx31(
|
|
2876
2902
|
SelectFieldTrigger,
|
|
2877
2903
|
{
|
|
2878
2904
|
startIcon,
|
|
@@ -2904,24 +2930,8 @@ var MultiSelectField = ({
|
|
|
2904
2930
|
/* @__PURE__ */ jsxs19(SelectFieldContentList, { disabled: isLoading, children: [
|
|
2905
2931
|
groupedOptions ? Object.entries(groupedOptions).map(([category, categoryOptions]) => /* @__PURE__ */ jsxs19(Fragment6, { children: [
|
|
2906
2932
|
/* @__PURE__ */ jsx31(SelectFieldCategory, { label: category }),
|
|
2907
|
-
categoryOptions.map(
|
|
2908
|
-
|
|
2909
|
-
{
|
|
2910
|
-
onClick: (e) => handleSelectOption(e, option.value),
|
|
2911
|
-
startIcon: preValues.includes(option.value) ? /* @__PURE__ */ jsx31(IconSquareCheckFilled, {}) : /* @__PURE__ */ jsx31(IconSquare, {}),
|
|
2912
|
-
...option
|
|
2913
|
-
},
|
|
2914
|
-
option?.value ?? option.label
|
|
2915
|
-
))
|
|
2916
|
-
] }, category)) : displayOptions.map((option) => /* @__PURE__ */ jsx31(
|
|
2917
|
-
SelectListOption,
|
|
2918
|
-
{
|
|
2919
|
-
onClick: (e) => handleSelectOption(e, option.value),
|
|
2920
|
-
startIcon: preValues.includes(option.value) ? /* @__PURE__ */ jsx31(IconSquareCheckFilled, {}) : /* @__PURE__ */ jsx31(IconSquare, {}),
|
|
2921
|
-
...option
|
|
2922
|
-
},
|
|
2923
|
-
option?.value ?? option.label
|
|
2924
|
-
)),
|
|
2933
|
+
categoryOptions.map(renderOption)
|
|
2934
|
+
] }, category)) : displayOptions.map(renderOption),
|
|
2925
2935
|
noOptionsMessage && displayOptions.length === 0 && /* @__PURE__ */ jsx31(SelectListOption, { disabled: true, value: "empty", label: noOptionsMessage })
|
|
2926
2936
|
] }),
|
|
2927
2937
|
/* @__PURE__ */ jsx31(
|
|
@@ -2941,17 +2951,17 @@ var MultiSelectField = ({
|
|
|
2941
2951
|
),
|
|
2942
2952
|
errorMessage && /* @__PURE__ */ jsx31(FieldFeedback, { message: errorMessage, variant: "error" })
|
|
2943
2953
|
] });
|
|
2944
|
-
}
|
|
2954
|
+
}
|
|
2945
2955
|
|
|
2946
2956
|
// src/components/editors/selects/SingleSelectField/SingleSelectField.tsx
|
|
2947
2957
|
import { Fragment as Fragment7, useEffect as useEffect9, useMemo as useMemo6, useRef as useRef11, useState as useState9 } from "react";
|
|
2948
2958
|
import { IconSearch as IconSearch2 } from "@tabler/icons-react";
|
|
2949
2959
|
import styles24 from "./selects.module-MRJADSDF.module.css";
|
|
2950
2960
|
import { jsx as jsx32, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
2951
|
-
|
|
2961
|
+
function SingleSelectField({
|
|
2952
2962
|
label,
|
|
2953
2963
|
required,
|
|
2954
|
-
value =
|
|
2964
|
+
value = null,
|
|
2955
2965
|
startIcon,
|
|
2956
2966
|
options,
|
|
2957
2967
|
disabled,
|
|
@@ -2967,15 +2977,16 @@ var SingleSelectField = ({
|
|
|
2967
2977
|
errorMessage,
|
|
2968
2978
|
side,
|
|
2969
2979
|
align,
|
|
2970
|
-
variant
|
|
2971
|
-
|
|
2980
|
+
variant,
|
|
2981
|
+
triggerComponent
|
|
2982
|
+
}) {
|
|
2972
2983
|
const [isOpen, setIsOpen] = useState9(false);
|
|
2973
2984
|
const [searchValue, setSearchValue] = useState9("");
|
|
2974
|
-
const [selectedLabel, setSelectedLabel] = useState9(
|
|
2985
|
+
const [selectedLabel, setSelectedLabel] = useState9("");
|
|
2975
2986
|
const searchFieldRef = useRef11(null);
|
|
2976
2987
|
useSelectSearchFocus(isOpen, searchFieldRef);
|
|
2977
2988
|
useEffect9(() => {
|
|
2978
|
-
if (
|
|
2989
|
+
if (value === null) {
|
|
2979
2990
|
setSelectedLabel("");
|
|
2980
2991
|
return;
|
|
2981
2992
|
}
|
|
@@ -2989,9 +3000,9 @@ var SingleSelectField = ({
|
|
|
2989
3000
|
const groupedOptions = useMemo6(() => groupOptionsByCategory(displayOptions), [displayOptions]);
|
|
2990
3001
|
const handleChange = (newValue) => {
|
|
2991
3002
|
setSearchValue("");
|
|
2992
|
-
onChange(newValue
|
|
3003
|
+
onChange(newValue);
|
|
2993
3004
|
onSearch?.("");
|
|
2994
|
-
if (newValue ===
|
|
3005
|
+
if (newValue === null) {
|
|
2995
3006
|
setSelectedLabel("");
|
|
2996
3007
|
} else {
|
|
2997
3008
|
const option = options.find((opt) => opt.value === newValue);
|
|
@@ -3002,6 +3013,19 @@ var SingleSelectField = ({
|
|
|
3002
3013
|
setSearchValue(newSearch);
|
|
3003
3014
|
debouncedSearch?.(newSearch);
|
|
3004
3015
|
};
|
|
3016
|
+
const renderOption = (option) => {
|
|
3017
|
+
const { value: optionValue, category: _category, ...optionRest } = option;
|
|
3018
|
+
return /* @__PURE__ */ jsx32(
|
|
3019
|
+
SelectListOption,
|
|
3020
|
+
{
|
|
3021
|
+
value: optionValue,
|
|
3022
|
+
onClick: () => handleChange(optionValue ?? null),
|
|
3023
|
+
isSelected: optionValue === value,
|
|
3024
|
+
...optionRest
|
|
3025
|
+
},
|
|
3026
|
+
String(optionValue)
|
|
3027
|
+
);
|
|
3028
|
+
};
|
|
3005
3029
|
const hasError = error || !!errorMessage;
|
|
3006
3030
|
return /* @__PURE__ */ jsxs20("div", { children: [
|
|
3007
3031
|
/* @__PURE__ */ jsx32(FieldHeader, { label, required }),
|
|
@@ -3014,7 +3038,7 @@ var SingleSelectField = ({
|
|
|
3014
3038
|
avoidCollisions,
|
|
3015
3039
|
side,
|
|
3016
3040
|
align,
|
|
3017
|
-
triggerComponent: /* @__PURE__ */ jsx32(
|
|
3041
|
+
triggerComponent: triggerComponent ?? /* @__PURE__ */ jsx32(
|
|
3018
3042
|
SelectFieldTrigger,
|
|
3019
3043
|
{
|
|
3020
3044
|
startIcon,
|
|
@@ -3022,7 +3046,7 @@ var SingleSelectField = ({
|
|
|
3022
3046
|
placeholder,
|
|
3023
3047
|
disabled,
|
|
3024
3048
|
valueLabel: selectedLabel,
|
|
3025
|
-
onClear: () => handleChange(
|
|
3049
|
+
onClear: () => handleChange(null),
|
|
3026
3050
|
isClearable: clearable,
|
|
3027
3051
|
isLoading,
|
|
3028
3052
|
error: hasError,
|
|
@@ -3047,32 +3071,16 @@ var SingleSelectField = ({
|
|
|
3047
3071
|
/* @__PURE__ */ jsxs20(SelectFieldContentList, { disabled: isLoading, children: [
|
|
3048
3072
|
groupedOptions ? Object.entries(groupedOptions).map(([category, categoryOptions]) => /* @__PURE__ */ jsxs20(Fragment7, { children: [
|
|
3049
3073
|
/* @__PURE__ */ jsx32(SelectFieldCategory, { label: category }),
|
|
3050
|
-
categoryOptions.map(
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
onClick: () => handleChange(option?.value),
|
|
3054
|
-
isSelected: option.value === value,
|
|
3055
|
-
...option
|
|
3056
|
-
},
|
|
3057
|
-
option?.value ?? option.label
|
|
3058
|
-
))
|
|
3059
|
-
] }, category)) : displayOptions.map((option) => /* @__PURE__ */ jsx32(
|
|
3060
|
-
SelectListOption,
|
|
3061
|
-
{
|
|
3062
|
-
onClick: () => handleChange(option?.value),
|
|
3063
|
-
isSelected: option.value === value,
|
|
3064
|
-
...option
|
|
3065
|
-
},
|
|
3066
|
-
option?.value ?? option.label
|
|
3067
|
-
)),
|
|
3068
|
-
options.length === 0 && /* @__PURE__ */ jsx32(SelectListOption, { disabled: true, value: "empty", label: noOptionsMessage })
|
|
3074
|
+
categoryOptions.map(renderOption)
|
|
3075
|
+
] }, category)) : displayOptions.map(renderOption),
|
|
3076
|
+
noOptionsMessage && displayOptions.length === 0 && /* @__PURE__ */ jsx32(SelectListOption, { disabled: true, value: "empty", label: noOptionsMessage })
|
|
3069
3077
|
] })
|
|
3070
3078
|
] })
|
|
3071
3079
|
}
|
|
3072
3080
|
),
|
|
3073
3081
|
errorMessage && /* @__PURE__ */ jsx32(FieldFeedback, { message: errorMessage, variant: "error" })
|
|
3074
3082
|
] });
|
|
3075
|
-
}
|
|
3083
|
+
}
|
|
3076
3084
|
|
|
3077
3085
|
// src/components/editors/Switch/Switch.tsx
|
|
3078
3086
|
import clsx18 from "clsx";
|
|
@@ -3558,6 +3566,7 @@ export {
|
|
|
3558
3566
|
getChartjsAxisOptionsScalesTicksMuted,
|
|
3559
3567
|
getChartjsAxisOptionsScalesTitle,
|
|
3560
3568
|
getDonutChartOptions,
|
|
3569
|
+
getKpiDisplayValue,
|
|
3561
3570
|
getLineChartData,
|
|
3562
3571
|
getLineChartOptions,
|
|
3563
3572
|
getPieChartData,
|