@embeddable.com/remarkable-ui 2.0.28 → 2.0.30
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 +12 -7
- package/dist/index.js +41 -30
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -286,7 +286,6 @@ declare const getTableTotalPages: (total: number | undefined, pageSize: number)
|
|
|
286
286
|
declare const TablePagination: FC<TablePaginationProps>;
|
|
287
287
|
|
|
288
288
|
declare const getChartColors: () => string[];
|
|
289
|
-
declare const getChartContrastColors: () => string[];
|
|
290
289
|
|
|
291
290
|
declare const getChartjsAxisOptionsPlugins: () => Partial<ChartOptions["plugins"]>;
|
|
292
291
|
declare const getChartjsAxisOptionsScalesTicksDefault: () => Partial<CartesianTickOptions>;
|
|
@@ -324,6 +323,7 @@ type DateRangePickerFieldProps = {
|
|
|
324
323
|
clearable?: boolean;
|
|
325
324
|
onChange: (dateRange: DateRange | undefined) => void;
|
|
326
325
|
submitLabel?: string;
|
|
326
|
+
avoidCollisions?: boolean;
|
|
327
327
|
} & FieldHeaderProps & DateRangePickerProps;
|
|
328
328
|
declare const DateRangePickerField: FC<DateRangePickerFieldProps>;
|
|
329
329
|
|
|
@@ -357,9 +357,11 @@ declare const TextField: React$1.ForwardRefExoticComponent<Omit<React$1.InputHTM
|
|
|
357
357
|
errorMessage?: string;
|
|
358
358
|
} & FieldHeaderProps & React$1.RefAttributes<HTMLInputElement>>;
|
|
359
359
|
|
|
360
|
+
type SelectFieldValue = string | number | boolean | undefined;
|
|
361
|
+
|
|
360
362
|
type SelectListOptionIcon = React.ReactElement<SVGProps<SVGSVGElement>> | React.ReactElement<ImgHTMLAttributes<HTMLImageElement>>;
|
|
361
363
|
type SelectListOptionProps = {
|
|
362
|
-
value?:
|
|
364
|
+
value?: SelectFieldValue;
|
|
363
365
|
isSelected?: boolean;
|
|
364
366
|
label: string;
|
|
365
367
|
rightLabel?: string;
|
|
@@ -383,8 +385,9 @@ type MultiSelectFieldProps = {
|
|
|
383
385
|
options: (SelectListOptionProps | SelectListOptionPropsWithCategory)[];
|
|
384
386
|
placeholder?: string;
|
|
385
387
|
submitLabel?: string;
|
|
386
|
-
values?:
|
|
387
|
-
|
|
388
|
+
values?: SelectFieldValue[];
|
|
389
|
+
avoidCollisions?: boolean;
|
|
390
|
+
onChange: (value: SelectFieldValue[]) => void;
|
|
388
391
|
onSearch?: (search: string) => void;
|
|
389
392
|
error?: boolean;
|
|
390
393
|
errorMessage?: string;
|
|
@@ -394,17 +397,18 @@ declare const MultiSelectField: FC<MultiSelectFieldProps>;
|
|
|
394
397
|
type SingleSelectFieldProps = {
|
|
395
398
|
options: (SelectListOptionProps | SelectListOptionPropsWithCategory)[];
|
|
396
399
|
startIcon?: React.ComponentType<IconProps>;
|
|
397
|
-
value?:
|
|
400
|
+
value?: SelectFieldValue;
|
|
398
401
|
disabled?: boolean;
|
|
399
402
|
placeholder?: string;
|
|
400
403
|
searchable?: boolean;
|
|
401
404
|
clearable?: boolean;
|
|
402
405
|
isLoading?: boolean;
|
|
403
406
|
noOptionsMessage?: string;
|
|
404
|
-
onChange: (value:
|
|
407
|
+
onChange: (value: SelectFieldValue) => void;
|
|
405
408
|
onSearch?: (search: string) => void;
|
|
406
409
|
error?: boolean;
|
|
407
410
|
errorMessage?: string;
|
|
411
|
+
avoidCollisions?: boolean;
|
|
408
412
|
} & FieldHeaderProps;
|
|
409
413
|
declare const SingleSelectField: FC<SingleSelectFieldProps>;
|
|
410
414
|
|
|
@@ -505,6 +509,7 @@ type DropdownProps = {
|
|
|
505
509
|
open?: boolean;
|
|
506
510
|
side?: React.ComponentProps<typeof DropdownMenu.Content>['side'];
|
|
507
511
|
align?: React.ComponentProps<typeof DropdownMenu.Content>['align'];
|
|
512
|
+
avoidCollisions?: boolean;
|
|
508
513
|
onOpenChange?: (open: boolean) => void;
|
|
509
514
|
};
|
|
510
515
|
declare const Dropdown: FC<DropdownProps>;
|
|
@@ -549,4 +554,4 @@ declare const endOfDayUTC: (date: Date) => Date;
|
|
|
549
554
|
|
|
550
555
|
declare const shallowEqual: (object1: any, object2: any) => boolean;
|
|
551
556
|
|
|
552
|
-
export { ActionIcon, BarChart, type BarChartProps, Button, ButtonIcon, Card, CardContent, CardFeedback, CardHeader, type CssSize, DateRangePicker, DateRangePickerField, type DateRangePickerProps, DonutChart, type DonutLabelChartProps, Dropdown, type DropdownProps, FieldFeedback, type FieldFeedbackProps, FieldHeader, type FieldHeaderProps, GhostButton, HeatMap, type HeatMapProps, type HeatMapPropsDimension, type HeatMapPropsMeasure, type HeatMapPropsThreshold, KpiChart, LineChart, type LineChartProps, 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, Typography, chartjsAxisOptionsLayoutPadding, endOfDayUTC, getBarChartData, getBarChartOptions, getChartColors,
|
|
557
|
+
export { ActionIcon, BarChart, type BarChartProps, Button, ButtonIcon, Card, CardContent, CardFeedback, CardHeader, type CssSize, DateRangePicker, DateRangePickerField, type DateRangePickerProps, DonutChart, type DonutLabelChartProps, Dropdown, type DropdownProps, FieldFeedback, type FieldFeedbackProps, FieldHeader, type FieldHeaderProps, GhostButton, HeatMap, type HeatMapProps, type HeatMapPropsDimension, type HeatMapPropsMeasure, type HeatMapPropsThreshold, KpiChart, LineChart, type LineChartProps, 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, Typography, chartjsAxisOptionsLayoutPadding, 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 };
|
package/dist/index.js
CHANGED
|
@@ -76,12 +76,6 @@ var getChartColors = () => [
|
|
|
76
76
|
getStyle("--em-sem-chart-color--9"),
|
|
77
77
|
getStyle("--em-sem-chart-color--10")
|
|
78
78
|
];
|
|
79
|
-
var getChartContrastColors = () => [
|
|
80
|
-
getStyle("--em-sem-chart-color--1"),
|
|
81
|
-
getStyle("--em-sem-chart-color--2"),
|
|
82
|
-
getStyle("--em-sem-chart-color--3"),
|
|
83
|
-
getStyle("--em-sem-chart-color--5")
|
|
84
|
-
];
|
|
85
79
|
|
|
86
80
|
// src/components/charts/bars/bars.utils.ts
|
|
87
81
|
import { mergician as mergician2 } from "mergician";
|
|
@@ -248,11 +242,11 @@ var getChartjsAxisOptionsScalesGridColor = (ctx) => {
|
|
|
248
242
|
|
|
249
243
|
// src/components/charts/bars/bars.utils.ts
|
|
250
244
|
var getBarChartData = (data) => {
|
|
251
|
-
const
|
|
245
|
+
const chartColors = getChartColors();
|
|
252
246
|
return {
|
|
253
247
|
...data,
|
|
254
248
|
datasets: data.datasets?.map((dataset, index) => {
|
|
255
|
-
const colors =
|
|
249
|
+
const colors = chartColors[index % chartColors.length];
|
|
256
250
|
const defaultDataset = {
|
|
257
251
|
...dataset,
|
|
258
252
|
backgroundColor: colors,
|
|
@@ -491,11 +485,11 @@ import { mergician as mergician5 } from "mergician";
|
|
|
491
485
|
// src/components/charts/lines/lines.utils.ts
|
|
492
486
|
import { mergician as mergician4 } from "mergician";
|
|
493
487
|
var getLineChartData = (data) => {
|
|
494
|
-
const
|
|
488
|
+
const chartColors = getChartColors();
|
|
495
489
|
const mergedData = {
|
|
496
490
|
...data,
|
|
497
491
|
datasets: data.datasets?.map((dataset, index) => {
|
|
498
|
-
const colors =
|
|
492
|
+
const colors = chartColors[index % chartColors.length];
|
|
499
493
|
const defaultDataset = {
|
|
500
494
|
backgroundColor: colors,
|
|
501
495
|
borderColor: colors
|
|
@@ -2150,11 +2144,21 @@ var Dropdown = ({
|
|
|
2150
2144
|
open,
|
|
2151
2145
|
side = "bottom",
|
|
2152
2146
|
align = "start",
|
|
2147
|
+
avoidCollisions = true,
|
|
2153
2148
|
onOpenChange
|
|
2154
2149
|
}) => {
|
|
2155
|
-
return /* @__PURE__ */ jsxs11(DropdownMenu.Root, { open, onOpenChange, children: [
|
|
2150
|
+
return /* @__PURE__ */ jsxs11(DropdownMenu.Root, { open, onOpenChange, modal: false, children: [
|
|
2156
2151
|
/* @__PURE__ */ jsx19(DropdownMenu.Trigger, { asChild: true, disabled, children: triggerComponent }),
|
|
2157
|
-
/* @__PURE__ */ jsx19(
|
|
2152
|
+
/* @__PURE__ */ jsx19(
|
|
2153
|
+
DropdownMenu.Content,
|
|
2154
|
+
{
|
|
2155
|
+
side,
|
|
2156
|
+
align,
|
|
2157
|
+
style: { zIndex: 5 },
|
|
2158
|
+
avoidCollisions,
|
|
2159
|
+
children
|
|
2160
|
+
}
|
|
2161
|
+
)
|
|
2158
2162
|
] });
|
|
2159
2163
|
};
|
|
2160
2164
|
|
|
@@ -2329,6 +2333,7 @@ var DateRangePickerField = ({
|
|
|
2329
2333
|
clearable,
|
|
2330
2334
|
numberOfMonths = 1,
|
|
2331
2335
|
submitLabel = "Apply",
|
|
2336
|
+
avoidCollisions,
|
|
2332
2337
|
onChange
|
|
2333
2338
|
}) => {
|
|
2334
2339
|
const [isOpen, setIsOpen] = useState6(false);
|
|
@@ -2360,6 +2365,7 @@ var DateRangePickerField = ({
|
|
|
2360
2365
|
open: isOpen,
|
|
2361
2366
|
onOpenChange: handleOpenChange,
|
|
2362
2367
|
disabled,
|
|
2368
|
+
avoidCollisions,
|
|
2363
2369
|
triggerComponent: /* @__PURE__ */ jsx24(
|
|
2364
2370
|
SelectFieldTrigger,
|
|
2365
2371
|
{
|
|
@@ -2634,6 +2640,7 @@ var MultiSelectField = ({
|
|
|
2634
2640
|
placeholder,
|
|
2635
2641
|
submitLabel = "Apply",
|
|
2636
2642
|
values = [],
|
|
2643
|
+
avoidCollisions,
|
|
2637
2644
|
onChange,
|
|
2638
2645
|
onSearch,
|
|
2639
2646
|
error = false,
|
|
@@ -2670,7 +2677,7 @@ var MultiSelectField = ({
|
|
|
2670
2677
|
const isSubmitDisabled = preValues.every((preValue) => values.includes(preValue)) && values.every((value) => preValues.includes(value));
|
|
2671
2678
|
const handleSelectOption = (e, newValue) => {
|
|
2672
2679
|
e.preventDefault();
|
|
2673
|
-
if (
|
|
2680
|
+
if (newValue == null) return;
|
|
2674
2681
|
if (preValues.includes(newValue)) {
|
|
2675
2682
|
setPreValues(preValues.filter((v) => v !== newValue));
|
|
2676
2683
|
} else {
|
|
@@ -2701,6 +2708,7 @@ var MultiSelectField = ({
|
|
|
2701
2708
|
open: isOpen,
|
|
2702
2709
|
onOpenChange: setIsOpen,
|
|
2703
2710
|
disabled,
|
|
2711
|
+
avoidCollisions,
|
|
2704
2712
|
triggerComponent: /* @__PURE__ */ jsx30(
|
|
2705
2713
|
SelectFieldTrigger,
|
|
2706
2714
|
{
|
|
@@ -2740,7 +2748,7 @@ var MultiSelectField = ({
|
|
|
2740
2748
|
startIcon: preValues.includes(option.value) ? /* @__PURE__ */ jsx30(IconSquareCheckFilled, {}) : /* @__PURE__ */ jsx30(IconSquare, {}),
|
|
2741
2749
|
...option
|
|
2742
2750
|
},
|
|
2743
|
-
option?.value
|
|
2751
|
+
option?.value ? option.value.toString() : option.label
|
|
2744
2752
|
))
|
|
2745
2753
|
] }, category)) : displayOptions.map((option) => /* @__PURE__ */ jsx30(
|
|
2746
2754
|
SelectListOption,
|
|
@@ -2749,7 +2757,7 @@ var MultiSelectField = ({
|
|
|
2749
2757
|
startIcon: preValues.includes(option.value) ? /* @__PURE__ */ jsx30(IconSquareCheckFilled, {}) : /* @__PURE__ */ jsx30(IconSquare, {}),
|
|
2750
2758
|
...option
|
|
2751
2759
|
},
|
|
2752
|
-
option?.value
|
|
2760
|
+
option?.value ? option.value.toString() : option.label
|
|
2753
2761
|
)),
|
|
2754
2762
|
noOptionsMessage && displayOptions.length === 0 && /* @__PURE__ */ jsx30(SelectListOption, { disabled: true, value: "empty", label: noOptionsMessage })
|
|
2755
2763
|
] }),
|
|
@@ -2780,7 +2788,7 @@ import { jsx as jsx31, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
|
2780
2788
|
var SingleSelectField = ({
|
|
2781
2789
|
label,
|
|
2782
2790
|
required,
|
|
2783
|
-
value
|
|
2791
|
+
value,
|
|
2784
2792
|
startIcon,
|
|
2785
2793
|
options,
|
|
2786
2794
|
disabled,
|
|
@@ -2788,6 +2796,7 @@ var SingleSelectField = ({
|
|
|
2788
2796
|
searchable,
|
|
2789
2797
|
clearable,
|
|
2790
2798
|
isLoading,
|
|
2799
|
+
avoidCollisions,
|
|
2791
2800
|
noOptionsMessage = "No options available",
|
|
2792
2801
|
onChange,
|
|
2793
2802
|
onSearch,
|
|
@@ -2796,17 +2805,19 @@ var SingleSelectField = ({
|
|
|
2796
2805
|
}) => {
|
|
2797
2806
|
const [isOpen, setIsOpen] = useState8(false);
|
|
2798
2807
|
const [searchValue, setSearchValue] = useState8("");
|
|
2799
|
-
const [selectedLabel, setSelectedLabel] = useState8(value);
|
|
2808
|
+
const [selectedLabel, setSelectedLabel] = useState8(value?.toString() ?? "");
|
|
2800
2809
|
const searchFieldRef = useRef11(null);
|
|
2801
2810
|
useSelectSearchFocus(isOpen, searchFieldRef);
|
|
2802
2811
|
useEffect9(() => {
|
|
2803
|
-
if (
|
|
2812
|
+
if (value == null) {
|
|
2804
2813
|
setSelectedLabel("");
|
|
2805
2814
|
return;
|
|
2806
2815
|
}
|
|
2807
|
-
const
|
|
2808
|
-
if (
|
|
2809
|
-
setSelectedLabel(
|
|
2816
|
+
const selectedOption = options.find((opt) => opt.value === value);
|
|
2817
|
+
if (selectedOption) {
|
|
2818
|
+
setSelectedLabel(selectedOption.label);
|
|
2819
|
+
} else {
|
|
2820
|
+
setSelectedLabel("");
|
|
2810
2821
|
}
|
|
2811
2822
|
}, [value, options]);
|
|
2812
2823
|
const debouncedSearch = useMemo5(() => onSearch ? debounce(onSearch) : void 0, [onSearch]);
|
|
@@ -2814,13 +2825,13 @@ var SingleSelectField = ({
|
|
|
2814
2825
|
const groupedOptions = useMemo5(() => groupOptionsByCategory(displayOptions), [displayOptions]);
|
|
2815
2826
|
const handleChange = (newValue) => {
|
|
2816
2827
|
setSearchValue("");
|
|
2817
|
-
onChange(newValue
|
|
2828
|
+
onChange(newValue);
|
|
2818
2829
|
onSearch?.("");
|
|
2819
|
-
|
|
2820
|
-
|
|
2830
|
+
const selectedOption = options.find((opt) => opt.value === newValue);
|
|
2831
|
+
if (selectedOption) {
|
|
2832
|
+
setSelectedLabel(selectedOption.label);
|
|
2821
2833
|
} else {
|
|
2822
|
-
|
|
2823
|
-
if (option) setSelectedLabel(option.label);
|
|
2834
|
+
setSelectedLabel("");
|
|
2824
2835
|
}
|
|
2825
2836
|
};
|
|
2826
2837
|
const handleSearch = (newSearch) => {
|
|
@@ -2836,6 +2847,7 @@ var SingleSelectField = ({
|
|
|
2836
2847
|
open: isOpen,
|
|
2837
2848
|
onOpenChange: setIsOpen,
|
|
2838
2849
|
disabled,
|
|
2850
|
+
avoidCollisions,
|
|
2839
2851
|
triggerComponent: /* @__PURE__ */ jsx31(
|
|
2840
2852
|
SelectFieldTrigger,
|
|
2841
2853
|
{
|
|
@@ -2844,7 +2856,7 @@ var SingleSelectField = ({
|
|
|
2844
2856
|
placeholder,
|
|
2845
2857
|
disabled,
|
|
2846
2858
|
valueLabel: selectedLabel,
|
|
2847
|
-
onClear: () => handleChange(
|
|
2859
|
+
onClear: () => handleChange(void 0),
|
|
2848
2860
|
isClearable: clearable,
|
|
2849
2861
|
isLoading,
|
|
2850
2862
|
error: hasError
|
|
@@ -2875,7 +2887,7 @@ var SingleSelectField = ({
|
|
|
2875
2887
|
isSelected: option.value === value,
|
|
2876
2888
|
...option
|
|
2877
2889
|
},
|
|
2878
|
-
option?.value
|
|
2890
|
+
option?.value ? option.value.toString() : option.label
|
|
2879
2891
|
))
|
|
2880
2892
|
] }, category)) : displayOptions.map((option) => /* @__PURE__ */ jsx31(
|
|
2881
2893
|
SelectListOption,
|
|
@@ -2884,7 +2896,7 @@ var SingleSelectField = ({
|
|
|
2884
2896
|
isSelected: option.value === value,
|
|
2885
2897
|
...option
|
|
2886
2898
|
},
|
|
2887
|
-
option?.value
|
|
2899
|
+
option?.value ? option.value.toString() : option.label
|
|
2888
2900
|
)),
|
|
2889
2901
|
options.length === 0 && /* @__PURE__ */ jsx31(SelectListOption, { disabled: true, value: "empty", label: noOptionsMessage })
|
|
2890
2902
|
] })
|
|
@@ -3121,7 +3133,6 @@ export {
|
|
|
3121
3133
|
getBarChartData,
|
|
3122
3134
|
getBarChartOptions,
|
|
3123
3135
|
getChartColors,
|
|
3124
|
-
getChartContrastColors,
|
|
3125
3136
|
getChartjsAxisOptions,
|
|
3126
3137
|
getChartjsAxisOptionsPlugins,
|
|
3127
3138
|
getChartjsAxisOptionsScales,
|