kelt-ui-kit-react 1.8.9 → 1.9.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.
@@ -5,6 +5,7 @@ export interface SelectProps {
5
5
  label?: string;
6
6
  title?: string;
7
7
  disabled?: boolean;
8
+ style?: React.CSSProperties;
8
9
  name?: string;
9
10
  defaultValue?: string | string[];
10
11
  multiple?: boolean;
@@ -16,4 +17,4 @@ export interface SelectProps {
16
17
  onChange?: (value: string) => void;
17
18
  placeholder?: string;
18
19
  }
19
- export declare const Select: ({ id, label, options, className, disabled, multiple, required, defaultValue, name, onChange, onChangeMultiple, value, placeholder, }: SelectProps) => JSX.Element;
20
+ export declare const Select: ({ id, label, options, className, disabled, style, multiple, required, defaultValue, name, onChange, onChangeMultiple, value, placeholder, }: SelectProps) => JSX.Element;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "kelt-ui-kit-react",
3
3
  "type": "module",
4
- "version": "1.8.9",
4
+ "version": "1.9.1",
5
5
  "private": false,
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -59,13 +59,20 @@ export function DataTable<T>(props: DataTableProps<T>) {
59
59
  );
60
60
 
61
61
  const isInteractiveClick = useCallback((target: EventTarget | null) => {
62
- if (!(target instanceof HTMLElement)) {
62
+ const element =
63
+ target instanceof Element
64
+ ? target
65
+ : target instanceof Node
66
+ ? target.parentElement
67
+ : null;
68
+
69
+ if (!element) {
63
70
  return false;
64
71
  }
65
72
 
66
73
  return Boolean(
67
- target.closest(
68
- "input,button,a,select,textarea,label,[role='button'],[role='checkbox'],[data-stop-row-click='true']",
74
+ element.closest(
75
+ "input,button,a,select,textarea,label,option,[role='button'],[role='checkbox'],[role='option'],[contenteditable='true'],[data-stop-row-click='true']",
69
76
  ),
70
77
  );
71
78
  }, []);
@@ -36,21 +36,34 @@ export const DataTableRow = ({ column, idx, row }: DataTableRowProps) => {
36
36
  )
37
37
  ) : column.editable ? (
38
38
  column.type === "select" ? (
39
- <Select
40
- options={column.options ?? []}
41
- value={value}
42
- onChange={(e) => {
43
- if (column.onEdit) {
44
- column.onEdit(e, row);
45
- }
46
- }}
47
- />
39
+ <div onClick={(e) => e.stopPropagation()}>
40
+ <Select
41
+ style={{
42
+ minWidth: column.minWidth,
43
+ maxWidth: column.maxWidth,
44
+ width: column.width,
45
+ }}
46
+ options={column.options ?? []}
47
+ value={value}
48
+ onChange={(e) => {
49
+ if (column.onEdit) {
50
+ column.onEdit(e, row);
51
+ }
52
+ }}
53
+ />
54
+ </div>
48
55
  ) : (
49
56
  <input
50
57
  type={column.type}
51
58
  value={value}
52
59
  step="0.01"
53
- style={{ textAlign: column.align || "left" }}
60
+ style={{
61
+ textAlign: column.align || "left",
62
+ minWidth: column.minWidth,
63
+ maxWidth: column.maxWidth,
64
+ width: column.width,
65
+ }}
66
+ onClick={(e) => e.stopPropagation()}
54
67
  onChange={(e) => {
55
68
  if (column.onEdit) {
56
69
  column.onEdit(e.target.value, row);
@@ -8,6 +8,7 @@ export interface SelectProps {
8
8
  label?: string;
9
9
  title?: string;
10
10
  disabled?: boolean;
11
+ style?: React.CSSProperties;
11
12
  name?: string;
12
13
  defaultValue?: string | string[];
13
14
  multiple?: boolean;
@@ -26,6 +27,7 @@ export const Select = ({
26
27
  options,
27
28
  className,
28
29
  disabled,
30
+ style,
29
31
  multiple = false,
30
32
  required = false,
31
33
  defaultValue,
@@ -42,7 +44,7 @@ export const Select = ({
42
44
  if (multiple) {
43
45
  selectedValue = Array.from(
44
46
  event.target.selectedOptions,
45
- (opt) => opt.value
47
+ (opt) => opt.value,
46
48
  );
47
49
  if (onChangeMultiple) {
48
50
  onChangeMultiple(selectedValue as string[]);
@@ -70,6 +72,7 @@ export const Select = ({
70
72
  defaultValue=""
71
73
  required={required}
72
74
  name={name}
75
+ style={style}
73
76
  disabled={disabled}
74
77
  id={`select-${id}`}
75
78
  className="select-container-select"