@codezee/sixtify-brahma 0.2.192 → 0.2.193

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codezee/sixtify-brahma",
3
- "version": "0.2.192",
3
+ "version": "0.2.193",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/hardikranpariya/sixtify-brahma.git"
@@ -76,7 +76,7 @@ exports.AgGrid = (0, react_1.forwardRef)((props, ref) => {
76
76
  if (datasource) {
77
77
  setTimeout(() => {
78
78
  const displayedCount = api.getDisplayedRowCount();
79
- const renderedNodes = api.getRenderedNodes().length || 0;
79
+ const renderedNodes = api.getRenderedNodes()?.length ?? 0;
80
80
  updateNoRowsOverlay(api, displayedCount === 0 && renderedNodes === 0);
81
81
  }, 50);
82
82
  }
@@ -84,7 +84,7 @@ exports.AgGrid = (0, react_1.forwardRef)((props, ref) => {
84
84
  else {
85
85
  setTimeout(() => {
86
86
  const displayedCount = api.getDisplayedRowCount();
87
- const renderedNodes = api.getRenderedNodes().length || 0;
87
+ const renderedNodes = api.getRenderedNodes()?.length ?? 0;
88
88
  updateNoRowsOverlay(api, displayedCount === 0 && renderedNodes === 0);
89
89
  }, 50);
90
90
  }
@@ -117,13 +117,13 @@ exports.AgGrid = (0, react_1.forwardRef)((props, ref) => {
117
117
  const datasource = api.getGridOption("datasource");
118
118
  if (datasource) {
119
119
  setTimeout(() => {
120
- updateNoRowsOverlay(api, !api.getDisplayedRowCount() && !api.getRenderedNodes().length);
120
+ updateNoRowsOverlay(api, !api.getDisplayedRowCount() && !api.getRenderedNodes()?.length);
121
121
  }, 50);
122
122
  }
123
123
  }
124
124
  else {
125
125
  setTimeout(() => {
126
- updateNoRowsOverlay(api, !api.getDisplayedRowCount() && !api.getRenderedNodes().length);
126
+ updateNoRowsOverlay(api, !api.getDisplayedRowCount() && !api.getRenderedNodes()?.length);
127
127
  }, 50);
128
128
  }
129
129
  }
@@ -136,13 +136,13 @@ exports.AgGrid = (0, react_1.forwardRef)((props, ref) => {
136
136
  const datasource = api.getGridOption("datasource");
137
137
  if (datasource) {
138
138
  setTimeout(() => {
139
- updateNoRowsOverlay(api, !api.getDisplayedRowCount() && !api.getRenderedNodes().length);
139
+ updateNoRowsOverlay(api, !api.getDisplayedRowCount() && !api.getRenderedNodes()?.length);
140
140
  }, 50);
141
141
  }
142
142
  }
143
143
  else {
144
144
  setTimeout(() => {
145
- updateNoRowsOverlay(api, !api.getDisplayedRowCount() && !api.getRenderedNodes().length);
145
+ updateNoRowsOverlay(api, !api.getDisplayedRowCount() && !api.getRenderedNodes()?.length);
146
146
  }, 50);
147
147
  }
148
148
  }
@@ -1,6 +1,6 @@
1
1
  import { type StackOwnProps, type StackProps, type SxProps } from "@mui/material";
2
2
  import { type RadioProps as MuiRadioProps } from "@mui/material/Radio";
3
- import type { ReactNode } from "react";
3
+ import { type ReactNode } from "react";
4
4
  import { type ControllerRenderProps, type FieldValues, type UseControllerProps } from "react-hook-form";
5
5
  import { type NavigationKey } from "../../utils/hooks/useFormFieldFocus";
6
6
  type Options = {
@@ -1 +1 @@
1
- {"version":3,"file":"RadioGroupField.d.ts","sourceRoot":"","sources":["../../../src/FormFields/RadioGroupField/RadioGroupField.tsx"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,OAAO,EACb,MAAM,eAAe,CAAC;AACvB,OAAc,EAAE,KAAK,UAAU,IAAI,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAC9E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAEL,KAAK,qBAAqB,EAC1B,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACxB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAEL,KAAK,aAAa,EACnB,MAAM,qCAAqC,CAAC;AAG7C,KAAK,OAAO,GAAG;IACb,MAAM,EAAE,OAAO,GAAG,MAAM,CAAC;IACzB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC;CACxC,CAAC;AAEF,MAAM,MAAM,oBAAoB,CAAC,CAAC,SAAS,WAAW,IACpD,kBAAkB,CAAC,CAAC,CAAC,GACnB,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,SAAS,CAAC,EAAE,MAAM,qBAAqB,CAAC,CAAC,CAAC,CAAC,GAAG;IACrE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,EAAE,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC;IACvC,EAAE,CAAC,EAAE,OAAO,CAAC;IACb,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,cAAc,CAAC,EAAE,UAAU,CAAC;IAC5B,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,cAAc,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;CAC9C,CAAC;AAEN,wBAAgB,eAAe,CAAC,CAAC,SAAS,WAAW,EAAE,EACrD,IAAI,EACJ,KAAK,EACL,KAAK,EACL,OAAO,EACP,OAAO,EACP,YAAY,EACZ,IAAc,EACd,KAAmB,EACnB,OAAe,EACf,QAAgB,EAChB,SAAiB,EACjB,EAAO,EACP,cAAc,EACd,YAAoB,EACpB,aAAqB,EACrB,cAAc,EACd,GAAG,oBAAoB,EACxB,EAAE,oBAAoB,CAAC,CAAC,CAAC,2CAoHzB"}
1
+ {"version":3,"file":"RadioGroupField.d.ts","sourceRoot":"","sources":["../../../src/FormFields/RadioGroupField/RadioGroupField.tsx"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,aAAa,EAClB,KAAK,UA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EACP,OAAO,EACP,YAAY,EACZ,IAAc,EACd,KAAmB,EACnB,OAAe,EACf,QAAgB,EAChB,SAAiB,EACjB,EAAO,EACP,cAAc,EACd,YAAoB,EACpB,aAAqB,EACrB,cAAc,EACd,GAAG,oBAAoB,EACxB,EAAE,oBAAoB,CAAC,CAAC,CAAC,2CAwIzB"}
@@ -7,12 +7,14 @@ exports.RadioGroupField = RadioGroupField;
7
7
  const jsx_runtime_1 = require("react/jsx-runtime");
8
8
  const material_1 = require("@mui/material");
9
9
  const Radio_1 = __importDefault(require("@mui/material/Radio"));
10
+ const react_1 = require("react");
10
11
  const react_hook_form_1 = require("react-hook-form");
11
12
  const useFormFieldFocus_1 = require("../../utils/hooks/useFormFieldFocus");
12
13
  const Skeleton_1 = require("./Skeleton");
13
14
  function RadioGroupField({ name, rules, label, control, options, defaultValue, size = "small", color = "secondary", loading = false, required = false, direction = "row", sx = {}, containerProps, isHorizontal = false, navigationKey = "tab", customOnChange, ...restRadioButtonProps }) {
14
15
  const { field: { value, onChange, ref, ...restField }, } = (0, react_hook_form_1.useController)({ name, control, defaultValue, rules });
15
16
  const { inputRef, handleKeyDown: handleNavigationKeyDown, maintainFocus, } = (0, useFormFieldFocus_1.useFormFieldFocus)({ navigationKey });
17
+ const fallbackInputRef = (0, react_1.useRef)(null);
16
18
  const handleKeyDown = (event) => {
17
19
  handleNavigationKeyDown(event, undefined, false);
18
20
  };
@@ -23,19 +25,19 @@ function RadioGroupField({ name, rules, label, control, options, defaultValue, s
23
25
  whiteSpace: "normal",
24
26
  overflow: "visible",
25
27
  textOverflow: "unset",
26
- }, required: required, disabled: restRadioButtonProps.disabled, children: label })), (0, jsx_runtime_1.jsx)(material_1.RadioGroup, { name: name, value: value, onKeyDown: handleKeyDown, onChange: (_, event) => {
28
+ }, required: required, disabled: restRadioButtonProps.disabled, children: label })), (0, jsx_runtime_1.jsx)(material_1.RadioGroup, { name: name, value: value, onKeyDown: handleKeyDown, onChange: (event, radioValue) => {
27
29
  let selectedValue;
28
- if (event === "true") {
30
+ if (radioValue === "true") {
29
31
  selectedValue = true;
30
32
  onChange(true);
31
33
  }
32
- else if (event === "false") {
34
+ else if (radioValue === "false") {
33
35
  selectedValue = false;
34
36
  onChange(false);
35
37
  }
36
38
  else {
37
- selectedValue = event;
38
- onChange(event);
39
+ selectedValue = radioValue;
40
+ onChange(radioValue);
39
41
  }
40
42
  if (customOnChange) {
41
43
  const selectedOption = options.find(({ values }) => values === selectedValue);
@@ -43,20 +45,36 @@ function RadioGroupField({ name, rules, label, control, options, defaultValue, s
43
45
  customOnChange(selectedOption);
44
46
  }
45
47
  }
48
+ const targetInput = event.target;
49
+ if (targetInput) {
50
+ inputRef.current = targetInput;
51
+ }
52
+ else if (!inputRef.current && fallbackInputRef.current) {
53
+ inputRef.current = fallbackInputRef.current;
54
+ }
46
55
  maintainFocus();
47
56
  }, children: (0, jsx_runtime_1.jsx)(material_1.Stack, { gap: direction === "column" ? "5px" : "10px", direction: direction, ...containerProps, children: options?.map(({ label, values, disabled }, index) => {
48
57
  return (
49
58
  // eslint-disable-next-line sonarjs/no-array-index-key
50
- (0, jsx_runtime_1.jsx)(material_1.Box, { children: (0, jsx_runtime_1.jsx)(material_1.FormControlLabel, { value: values, control: (0, jsx_runtime_1.jsx)(Radio_1.default, { ...restField, ...restRadioButtonProps, tabIndex: -1, color: color, size: size, inputRef: (el) => {
51
- if (el && !inputRef.current) {
59
+ (0, jsx_runtime_1.jsx)(material_1.Box, { children: (0, jsx_runtime_1.jsx)(material_1.FormControlLabel, { value: values, control: (0, jsx_runtime_1.jsx)(Radio_1.default, { ...restField, ...restRadioButtonProps, color: color, size: size, inputRef: (el) => {
60
+ if (!el) {
61
+ return;
62
+ }
63
+ const shouldUseAsPrimaryRef = value === values ||
64
+ (!inputRef.current && index === 0);
65
+ if (shouldUseAsPrimaryRef) {
52
66
  inputRef.current = el;
53
- if (ref) {
54
- if (typeof ref === "function") {
55
- ref(el);
56
- }
57
- else {
58
- ref.current = el;
59
- }
67
+ fallbackInputRef.current = el;
68
+ }
69
+ else if (!fallbackInputRef.current && index === 0) {
70
+ fallbackInputRef.current = el;
71
+ }
72
+ if (ref) {
73
+ if (typeof ref === "function") {
74
+ ref(el);
75
+ }
76
+ else {
77
+ ref.current = el;
60
78
  }
61
79
  }
62
80
  } }), disabled: disabled, label: label, sx: sx }) }, index));
@@ -82,7 +82,7 @@ function Select({ control, defaultValue, name, required = false, label, multiple
82
82
  gap: 0.5,
83
83
  overflow: "hidden",
84
84
  }, children: [visibleItems.map((option) => ((0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body2", noWrap: true, color: disabledColor, sx: {
85
- "-webkit-text-fill-color": disabledColor,
85
+ WebkitTextFillColor: disabledColor,
86
86
  backgroundColor: slate[800],
87
87
  padding: "2px 5px",
88
88
  borderRadius: "12px",