kui-complex 0.0.122 → 0.0.124

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/index.d.ts CHANGED
@@ -30,6 +30,7 @@ type ButtonsPanelProps = {
30
30
  onChange?: (value: number) => void
31
31
  startComponent?: ReactNode
32
32
  endComponent?: ReactNode
33
+ navigate?: (path: string) => void
33
34
  }
34
35
 
35
36
  /** @jsxImportSource @emotion/react */
package/index.js CHANGED
@@ -160,12 +160,17 @@ var inactiveStyles = css(templateObject_2$p || (templateObject_2$p = __makeTempl
160
160
  var templateObject_1$F, templateObject_2$p;
161
161
 
162
162
  var ButtonsPanel = forwardRef(function (_a, ref) {
163
- var tabs = _a.tabs, tabPanels = _a.tabPanels, paths = _a.paths, activeTab = _a.activeTab, isSticky = _a.isSticky, onChange = _a.onChange, startComponent = _a.startComponent, endComponent = _a.endComponent, otherProps = __rest(_a, ["tabs", "tabPanels", "paths", "activeTab", "isSticky", "onChange", "startComponent", "endComponent"]);
163
+ var tabs = _a.tabs, tabPanels = _a.tabPanels, paths = _a.paths, activeTab = _a.activeTab, isSticky = _a.isSticky, onChange = _a.onChange, startComponent = _a.startComponent, endComponent = _a.endComponent, navigate = _a.navigate, otherProps = __rest(_a, ["tabs", "tabPanels", "paths", "activeTab", "isSticky", "onChange", "startComponent", "endComponent", "navigate"]);
164
164
  var _b = React.useState(Number(activeTab)), value = _b[0], setValue = _b[1];
165
165
  var handleChange = function (newValue) {
166
166
  setValue(newValue);
167
- if (paths && paths.length)
168
- updateQueryParams(paths[newValue]);
167
+ if (paths === null || paths === void 0 ? void 0 : paths.length) {
168
+ var path = paths[newValue];
169
+ if (navigate)
170
+ navigate(path);
171
+ else
172
+ updateQueryParams(path);
173
+ }
169
174
  if (onChange)
170
175
  onChange(newValue);
171
176
  };
@@ -1469,7 +1474,7 @@ var templateObject_1$2, templateObject_2$2, templateObject_3$1, templateObject_4
1469
1474
  var limitTitle = 100;
1470
1475
  var InputFile = forwardRef(function (props, ref) {
1471
1476
  var _a;
1472
- var form = props.form, name = props.name, label = props.label, disabled = props.disabled, withEdit = props.withEdit, fileName = props.fileName, onChange = props.onChange, otherProps = __rest(props, ["form", "name", "label", "disabled", "withEdit", "fileName", "onChange"]);
1477
+ var form = props.form, name = props.name, parentName = props.parentName, label = props.label, disabled = props.disabled, withEdit = props.withEdit, fileName = props.fileName, onChange = props.onChange, otherProps = __rest(props, ["form", "name", "parentName", "label", "disabled", "withEdit", "fileName", "onChange"]);
1473
1478
  var _b = useState(false), mounted = _b[0], setMounted = _b[1];
1474
1479
  var _c = useState(), file = _c[0], setFile = _c[1];
1475
1480
  var _d = useState(""), defaultFileURL = _d[0], setDefaultFileURL = _d[1];
@@ -1478,6 +1483,10 @@ var InputFile = forwardRef(function (props, ref) {
1478
1483
  control: form.control,
1479
1484
  name: name,
1480
1485
  }), field = _e.field, fieldState = _e.fieldState;
1486
+ var parentField = useController({
1487
+ control: form.control,
1488
+ name: parentName,
1489
+ }).field;
1481
1490
  var fileExtension = file === null || file === void 0 ? void 0 : file.name.split(".").pop();
1482
1491
  var formattedFile = file && "url" in file
1483
1492
  ? file
@@ -1537,7 +1546,14 @@ var InputFile = forwardRef(function (props, ref) {
1537
1546
  }
1538
1547
  setFile(undefined);
1539
1548
  setDefaultFileURL("");
1540
- field.onChange({ target: { value: null, name: name }, type: "change" });
1549
+ if (parentName) {
1550
+ parentField.onChange({
1551
+ target: { value: null, name: parentName },
1552
+ type: "change",
1553
+ });
1554
+ }
1555
+ else
1556
+ field.onChange({ target: { value: null, name: name }, type: "change" });
1541
1557
  if (onChange)
1542
1558
  onChange(null);
1543
1559
  };