@keboola/design 17.1.0 → 17.2.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.
@@ -1 +1 @@
1
- export { BLANK_VALUES, Combobox, filterByWords, matchByWords, namedLabel, withBlankValues } from "../../Combobox-RZ0i3w8u.js";
1
+ export { BLANK_VALUES, Combobox, filterByWords, matchByWords, namedLabel, withBlankValues } from "../../Combobox-CakN_1cF.js";
package/dist/rjsf.js CHANGED
@@ -8,7 +8,7 @@ import { useStableCallback } from "./internal/hooks/useStableCallback.js";
8
8
  import { TextInput } from "./TextInput-BAL-zOAN.js";
9
9
  import { RadioGroup } from "./RadioGroup-BIElT-nH.js";
10
10
  import { Checkbox } from "./Checkbox-CfjpwIcg.js";
11
- import { Combobox } from "./Combobox-RZ0i3w8u.js";
11
+ import { Combobox } from "./Combobox-CakN_1cF.js";
12
12
  import { MultiCombobox } from "./internal/blocks/MultiCombobox.js";
13
13
  import { FormGroup } from "./FormGroup-D7ahkK1q.js";
14
14
  import { NumberInput } from "./internal/blocks/NumberInput.js";
@@ -233,15 +233,37 @@ const CodeEditorField = ({ fieldPathId, formData, onChange, disabled, readonly,
233
233
  options: uiOptions ?? {}
234
234
  });
235
235
  };
236
+ // src/blocks/RjsfSchemaEditor/TooltipIcon.tsx
237
+ const TooltipIcon = ({ rawHelp }) => {
238
+ const renderMarkdown = useRenderMarkdown();
239
+ return /* @__PURE__ */ jsx(Tooltip, {
240
+ placement: "top",
241
+ variant: "explanatory",
242
+ tooltip: renderMarkdown(rawHelp),
243
+ triggerAsChild: true,
244
+ children: /* @__PURE__ */ jsx("span", {
245
+ className: "tw:cursor-help tw:text-muted-foreground",
246
+ children: /* @__PURE__ */ jsx(Info, { className: "tw:size-4" })
247
+ })
248
+ });
249
+ };
236
250
  // src/blocks/RjsfSchemaEditor/SchemaDescription.tsx
237
- /** Renders a schema description with sanitized HTML support (links, formatting, etc.). */
238
- const SchemaDescription = ({ description }) => {
251
+ /**
252
+ * Renders a schema description with sanitized HTML support (links, formatting, etc.).
253
+ * - `tooltip` adds a help icon at the end of the text.
254
+ */
255
+ const SchemaDescription = ({ description, tooltip }) => {
239
256
  if (!description) return null;
240
- return /* @__PURE__ */ jsx("p", {
257
+ return /* @__PURE__ */ jsxs("p", {
241
258
  className: "tw:text-xs tw:text-muted-foreground",
242
- dangerouslySetInnerHTML: { __html: DOMPurify.sanitize(description) }
259
+ children: [/* @__PURE__ */ jsx("span", { dangerouslySetInnerHTML: { __html: DOMPurify.sanitize(description) } }), tooltip && /* @__PURE__ */ jsx(InlineTooltipIcon, { rawHelp: tooltip })]
243
260
  });
244
261
  };
262
+ /** Help icon that flows with the text it ends. */
263
+ const InlineTooltipIcon = ({ rawHelp }) => /* @__PURE__ */ jsx("span", {
264
+ className: "tw:ml-1 tw:inline-block tw:align-middle",
265
+ children: /* @__PURE__ */ jsx(TooltipIcon, { rawHelp })
266
+ });
245
267
  // src/blocks/RjsfSchemaEditor/fields/GridObjectField.tsx
246
268
  /**
247
269
  * Custom field that renders an object's properties in a responsive grid layout.
@@ -346,20 +368,6 @@ const InfoField = ({ schema, uiSchema }) => {
346
368
  })
347
369
  });
348
370
  };
349
- // src/blocks/RjsfSchemaEditor/TooltipIcon.tsx
350
- const TooltipIcon = ({ rawHelp }) => {
351
- const renderMarkdown = useRenderMarkdown();
352
- return /* @__PURE__ */ jsx(Tooltip, {
353
- placement: "top",
354
- variant: "explanatory",
355
- tooltip: renderMarkdown(rawHelp),
356
- triggerAsChild: true,
357
- children: /* @__PURE__ */ jsx("span", {
358
- className: "tw:cursor-help tw:text-muted-foreground",
359
- children: /* @__PURE__ */ jsx(Info, { className: "tw:size-4" })
360
- })
361
- });
362
- };
363
371
  // src/blocks/RjsfSchemaEditor/fields/TableArrayField.tsx
364
372
  /** Default value for a freshly added cell/item, honouring the schema default. */
365
373
  const defaultValueFor = (prop) => {
@@ -454,7 +462,7 @@ const TableArrayField = ({ schema, uiSchema = {}, formData, onChange, disabled,
454
462
  className: "tw:px-2 tw:py-1.5 tw:[&>div]:mb-0",
455
463
  children: /* @__PURE__ */ jsx(SchemaField, {
456
464
  name: key,
457
- schema: properties[key],
465
+ schema: properties[key] ?? {},
458
466
  uiSchema: getCellUiSchema(key),
459
467
  formData: item[key],
460
468
  ...SCHEMA_FIELD_STUBS,
@@ -481,28 +489,31 @@ const TableArrayField = ({ schema, uiSchema = {}, formData, onChange, disabled,
481
489
  onClick: handleAddRow,
482
490
  children: ["Add ", itemSchema?.title || "Item"]
483
491
  });
484
- if (schema.title) {
485
- const tooltip = uiSchema["ui:help"];
486
- return /* @__PURE__ */ jsxs(CollapsiblePanel, {
487
- className: "tw:rounded-lg",
488
- headerClassName: "tw:rounded-lg",
489
- header: /* @__PURE__ */ jsxs("span", {
490
- className: "tw:inline-flex tw:items-center tw:gap-1",
491
- children: [schema.title, tooltip && /* @__PURE__ */ jsx(TooltipIcon, { rawHelp: tooltip })]
492
- }),
493
- defaultExpanded: true,
494
- bodyClassName: "tw:flex tw:flex-col tw:gap-4",
495
- children: [
496
- /* @__PURE__ */ jsx(SchemaDescription, { description: schema.description }),
497
- table,
498
- addButton
499
- ]
500
- });
501
- }
492
+ const tooltip = uiSchema["ui:help"];
493
+ const tooltipInDescription = Boolean(tooltip && schema.description && uiSchema["ui:options"]?.tooltipPlacement === "description");
494
+ const description = /* @__PURE__ */ jsx(SchemaDescription, {
495
+ description: schema.description,
496
+ tooltip: tooltipInDescription ? tooltip : void 0
497
+ });
498
+ if (schema.title) return /* @__PURE__ */ jsxs(CollapsiblePanel, {
499
+ className: "tw:rounded-lg",
500
+ headerClassName: "tw:rounded-lg",
501
+ header: /* @__PURE__ */ jsxs("span", {
502
+ className: "tw:inline-flex tw:items-center tw:gap-1",
503
+ children: [schema.title, tooltip && !tooltipInDescription && /* @__PURE__ */ jsx(TooltipIcon, { rawHelp: tooltip })]
504
+ }),
505
+ defaultExpanded: true,
506
+ bodyClassName: "tw:flex tw:flex-col tw:gap-4",
507
+ children: [
508
+ description,
509
+ table,
510
+ addButton
511
+ ]
512
+ });
502
513
  return /* @__PURE__ */ jsxs("div", {
503
514
  className: "tw:flex tw:flex-col tw:gap-4",
504
515
  children: [
505
- /* @__PURE__ */ jsx(SchemaDescription, { description: schema.description }),
516
+ description,
506
517
  table,
507
518
  addButton
508
519
  ]
@@ -742,12 +753,15 @@ const FieldTemplateBody = ({ id, label, rawHelp, rawDescription, rawErrors, chil
742
753
  if (widget === "test-connection" || widget === "sync-action") return /* @__PURE__ */ jsx(Fragment$1, { children });
743
754
  if (schema.type === "object") return /* @__PURE__ */ jsx(Fragment$1, { children });
744
755
  if (schema.type === "array" && !uiSchema?.["ui:widget"]) return /* @__PURE__ */ jsx(Fragment$1, { children });
745
- const documentation = (uiSchema?.["ui:options"])?.documentation;
756
+ const uiOptions = uiSchema?.["ui:options"];
757
+ const documentation = uiOptions?.documentation;
746
758
  const hasErrors = rawErrors && rawErrors.length > 0;
747
759
  const isCheckbox = schema.type === "boolean" && uiSchema?.["ui:widget"] !== "select";
748
760
  const showLabel = displayLabel && label && !isCheckbox;
749
- const hasHelpIcons = Boolean(rawHelp || documentation);
750
- const helpIcons = /* @__PURE__ */ jsxs(Fragment$1, { children: [rawHelp && /* @__PURE__ */ jsx(TooltipIcon, { rawHelp }), documentation && /* @__PURE__ */ jsx(DocumentationLinkIcon, { documentation })] });
761
+ const helpInDescription = Boolean(rawHelp && rawDescription && uiOptions?.tooltipPlacement === "description");
762
+ const labelHelp = helpInDescription ? void 0 : rawHelp;
763
+ const hasHelpIcons = Boolean(labelHelp || documentation);
764
+ const helpIcons = /* @__PURE__ */ jsxs(Fragment$1, { children: [labelHelp && /* @__PURE__ */ jsx(TooltipIcon, { rawHelp: labelHelp }), documentation && /* @__PURE__ */ jsx(DocumentationLinkIcon, { documentation })] });
751
765
  return /* @__PURE__ */ jsxs(FormGroup, {
752
766
  state: hasErrors ? "error" : "default",
753
767
  children: [
@@ -766,7 +780,7 @@ const FieldTemplateBody = ({ id, label, rawHelp, rawDescription, rawErrors, chil
766
780
  className: "tw:flex tw:items-center tw:gap-1",
767
781
  children: [children, helpIcons]
768
782
  }) : children,
769
- rawDescription && /* @__PURE__ */ jsx(FormGroup.Help, { children: /* @__PURE__ */ jsx("span", { dangerouslySetInnerHTML: { __html: DOMPurify.sanitize(rawDescription) } }) }),
783
+ rawDescription && /* @__PURE__ */ jsxs(FormGroup.Help, { children: [/* @__PURE__ */ jsx("span", { dangerouslySetInnerHTML: { __html: DOMPurify.sanitize(rawDescription) } }), helpInDescription && rawHelp && /* @__PURE__ */ jsx(InlineTooltipIcon, { rawHelp })] }),
770
784
  hasErrors && /* @__PURE__ */ jsx(FormGroup.Help, { children: rawErrors.join(". ") })
771
785
  ]
772
786
  });
@@ -1339,7 +1353,13 @@ const generateUiSchema = (schema, readOnly = false, definitions, globalConfig, h
1339
1353
  if (globalValue !== void 0) {
1340
1354
  if (typeof globalValue !== "object" || globalValue === null || Array.isArray(globalValue)) fieldUi["ui:disabled"] = true;
1341
1355
  }
1342
- if (options?.tooltip) fieldUi["ui:help"] = String(options.tooltip);
1356
+ if (options?.tooltip) {
1357
+ fieldUi["ui:help"] = String(options.tooltip);
1358
+ if (options.tooltip_placement === "description") fieldUi["ui:options"] = {
1359
+ ...fieldUi["ui:options"],
1360
+ tooltipPlacement: "description"
1361
+ };
1362
+ }
1343
1363
  if ((options?.documentation)?.link) fieldUi["ui:options"] = {
1344
1364
  ...fieldUi["ui:options"],
1345
1365
  documentation: options?.documentation