@keboola/design 5.1.0 → 6.1.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.
package/dist/rjsf.cjs CHANGED
@@ -402,14 +402,13 @@ var helpVariants = classVarianceAuthority.cva(["tw-m-0", "tw-text-xs"], {
402
402
  variants: {
403
403
  state: {
404
404
  default: ["tw-text-muted-foreground"],
405
- error: ["tw-text-destructive"],
406
405
  warning: ["tw-text-warning"]
407
406
  }
408
407
  }
409
408
  });
410
- var HelpBlock = ({ children, className, state = "default", testId }) => {
409
+ var HelpBlock = ({ children, className, state = "default", ...rest }) => {
411
410
  if (!children) return null;
412
- return /* @__PURE__ */ jsxRuntime.jsx("p", { "data-testid": testId, className: helpVariants({ state, className }), children });
411
+ return /* @__PURE__ */ jsxRuntime.jsx("p", { ...rest, className: helpVariants({ state, className }), children });
413
412
  };
414
413
 
415
414
  // src/icons/index.ts
@@ -449,11 +448,12 @@ var variants = classVarianceAuthority.cva(
449
448
  "tw-items-center",
450
449
  "tw-justify-center",
451
450
  "tw-gap-2",
452
- // text
451
+ // text — chrome weight/tracking are brand-overridable tokens
452
+ // (`--font-weight-medium` / `--letter-spacing-chrome`); casing stays `tw-uppercase`.
453
453
  "tw-text-xs",
454
454
  "tw-leading-5",
455
455
  "tw-font-medium",
456
- "tw-tracking-[1px]",
456
+ "tw-tracking-chrome",
457
457
  "tw-uppercase",
458
458
  // border — legacy (non-argo) chrome uses a fixed radius, not the brand token.
459
459
  "tw-rounded",
@@ -828,6 +828,7 @@ var Clipboard = ({
828
828
  ] });
829
829
  };
830
830
  var DEFAULT_ICON = /* @__PURE__ */ jsxRuntime.jsx(icons_exports.Copy, {});
831
+ var DEFAULT_ARIA_LABEL = "Copy";
831
832
  var ClipboardButton = ({
832
833
  // clipboard props
833
834
  text,
@@ -839,20 +840,24 @@ var ClipboardButton = ({
839
840
  variant = "outline",
840
841
  children,
841
842
  ...rest
842
- }) => /* @__PURE__ */ jsxRuntime.jsx(
843
- Clipboard,
844
- {
845
- asChild: true,
846
- tooltip,
847
- tooltipPlacement,
848
- tooltipVariant,
849
- text,
850
- children: /* @__PURE__ */ jsxRuntime.jsxs(Button, { ...rest, variant, disabled: !text, children: [
851
- icon,
852
- children
853
- ] })
854
- }
855
- );
843
+ }) => {
844
+ const defaultAriaLabel = typeof tooltip === "string" && tooltip.trim() ? tooltip : DEFAULT_ARIA_LABEL;
845
+ const ariaLabel = rest["aria-label"] ?? (children == null ? defaultAriaLabel : void 0);
846
+ return /* @__PURE__ */ jsxRuntime.jsx(
847
+ Clipboard,
848
+ {
849
+ asChild: true,
850
+ tooltip,
851
+ tooltipPlacement,
852
+ tooltipVariant,
853
+ text,
854
+ children: /* @__PURE__ */ jsxRuntime.jsxs(Button, { ...rest, "aria-label": ariaLabel, variant, disabled: !text, children: [
855
+ icon,
856
+ children
857
+ ] })
858
+ }
859
+ );
860
+ };
856
861
  var ButtonToolbar = ({ value, children }) => {
857
862
  if (!value && !children) return null;
858
863
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "tw-pointer-events-auto tw-ml-auto tw-mr-4 tw-flex tw-w-fit tw-gap-1 tw-overflow-visible tw-rounded-lg tw-border tw-border-solid tw-border-border !tw-bg-background tw-p-[3px] tw-shadow", children: [
@@ -2550,11 +2555,23 @@ var inputGroupVariants = classVarianceAuthority.cva(
2550
2555
  off: ["has-[:is(input,textarea):focus]:!tw-ring-0"]
2551
2556
  },
2552
2557
  variant: {
2553
- primary: ["tw-bg-white", "has-[:is(input,textarea):disabled]:tw-opacity-40"],
2558
+ primary: [
2559
+ "tw-bg-white",
2560
+ "has-[:is(input,textarea):disabled]:tw-opacity-40",
2561
+ // aria-invalid on the control surfaces the error chrome without a `state` prop — the
2562
+ // accessible path (mirrors the `state="error"` legacy tokens). Higher specificity than
2563
+ // the default focus selector, so it wins without `!important`.
2564
+ "has-[:is(input,textarea)[aria-invalid=true]]:tw-border-error-500",
2565
+ "has-[:is(input,textarea)[aria-invalid=true]:focus]:tw-border-error-500",
2566
+ "has-[:is(input,textarea)[aria-invalid=true]:focus]:tw-ring-error-200"
2567
+ ],
2554
2568
  secondary: [
2555
2569
  "tw-bg-neutral-100",
2556
2570
  "tw-border-neutral-100",
2557
- "has-[:is(input,textarea):disabled]:tw-opacity-40"
2571
+ "has-[:is(input,textarea):disabled]:tw-opacity-40",
2572
+ "has-[:is(input,textarea)[aria-invalid=true]]:tw-border-error-500",
2573
+ "has-[:is(input,textarea)[aria-invalid=true]:focus]:tw-border-error-500",
2574
+ "has-[:is(input,textarea)[aria-invalid=true]:focus]:tw-ring-error-200"
2558
2575
  ],
2559
2576
  argo: [
2560
2577
  // argo follows the brand radius token (overrides the static base)
@@ -2565,7 +2582,12 @@ var inputGroupVariants = classVarianceAuthority.cva(
2565
2582
  "tw-text-foreground",
2566
2583
  "has-[:is(input,textarea):disabled]:tw-opacity-50",
2567
2584
  // higher specificity than has-[:is(input,textarea):focus] — prevents focus border on readonly
2568
- "has-[:is(input,textarea)[readonly]:focus]:tw-border-neutral-150"
2585
+ "has-[:is(input,textarea)[readonly]:focus]:tw-border-neutral-150",
2586
+ // aria-invalid on the control surfaces the error chrome without a `state` prop — the
2587
+ // accessible path (uses the themeable `destructive` status token).
2588
+ "has-[:is(input,textarea)[aria-invalid=true]]:tw-border-destructive",
2589
+ "has-[:is(input,textarea)[aria-invalid=true]:focus]:tw-border-destructive",
2590
+ "has-[:is(input,textarea)[aria-invalid=true]:focus]:tw-ring-destructive/20"
2569
2591
  ]
2570
2592
  },
2571
2593
  sizing: {
@@ -2848,9 +2870,21 @@ var FormGroupColorInput = ({
2848
2870
  const { state } = useFormGroupContext();
2849
2871
  return /* @__PURE__ */ jsxRuntime.jsx(ColorInput, { state, ...props, ref });
2850
2872
  };
2873
+ var toMessage = (entry) => typeof entry === "string" ? entry : entry?.message;
2874
+ var FormGroupError = ({ children, className, errors, ...rest }) => {
2875
+ const content = React26.useMemo(() => {
2876
+ if (children) return children;
2877
+ const messages = (errors ?? []).map(toMessage).filter((message2) => !!message2);
2878
+ if (messages.length === 0) return null;
2879
+ if (messages.length === 1) return messages[0];
2880
+ return /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "tw-m-0 tw-flex tw-list-disc tw-flex-col tw-gap-0 tw-pl-4", children: messages.map((message2, index) => /* @__PURE__ */ jsxRuntime.jsx("li", { children: message2 }, index)) });
2881
+ }, [children, errors]);
2882
+ if (!content) return null;
2883
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { ...rest, role: "alert", className: cn("tw-m-0 tw-text-xs tw-text-destructive", className), children: content });
2884
+ };
2851
2885
  var FormGroupHelp = ({ children, ...rest }) => {
2852
2886
  const formGroupContext = useFormGroupContext();
2853
- return /* @__PURE__ */ jsxRuntime.jsx(HelpBlock, { state: formGroupContext.state, ...rest, children });
2887
+ return /* @__PURE__ */ jsxRuntime.jsx(HelpBlock, { state: formGroupContext.state === "warning" ? "warning" : "default", ...rest, children });
2854
2888
  };
2855
2889
  var toNumberOrNull = (event) => Number.isNaN(event.target.valueAsNumber) ? null : event.target.valueAsNumber;
2856
2890
  var NumberInput = ({
@@ -7733,31 +7767,32 @@ var FormGroupTextInput = ({
7733
7767
  const { state } = useFormGroupContext();
7734
7768
  return /* @__PURE__ */ jsxRuntime.jsx(TextInput, { state, ...props, ref });
7735
7769
  };
7736
- var FormGroup = ({ className, children, state, testId }) => {
7737
- return /* @__PURE__ */ jsxRuntime.jsx(FormGroupProvider, { value: { state }, children: /* @__PURE__ */ jsxRuntime.jsx("div", { "data-testid": testId, className: cn("tw-flex tw-flex-col tw-gap-1", className), children }) });
7770
+ var FormGroup = ({ className, children, state, ...rest }) => {
7771
+ return /* @__PURE__ */ jsxRuntime.jsx(FormGroupProvider, { value: { state }, children: /* @__PURE__ */ jsxRuntime.jsx("div", { ...rest, className: cn("tw-flex tw-flex-col tw-gap-1", className), children }) });
7738
7772
  };
7739
7773
  FormGroup.Help = FormGroupHelp;
7774
+ FormGroup.Error = FormGroupError;
7740
7775
  FormGroup.TextInput = FormGroupTextInput;
7741
7776
  FormGroup.NumberInput = FormGroupNumberInput;
7742
7777
  FormGroup.ColorInput = FormGroupColorInput;
7743
7778
  FormGroup.Textarea = FormGroupTextarea;
7744
- var Optional = ({ className }) => /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn("tw-text-muted-foreground", className), children: "(optional)" });
7745
- var Label = ({ className, children, id, htmlFor, ...rest }) => {
7746
- return /* @__PURE__ */ jsxRuntime.jsx(
7747
- RLabel__namespace.Root,
7748
- {
7749
- ...rest,
7750
- id: id?.toString(),
7751
- htmlFor: htmlFor?.toString(),
7752
- className: cn(
7753
- "tw-m-0 tw-text-foreground tw-font-normal peer-disabled:tw-opacity-50",
7754
- className
7755
- ),
7756
- children
7757
- }
7758
- );
7759
- };
7779
+ var Optional = ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("span", { ...props, "aria-hidden": true, className: cn("tw-ml-0.5", "tw-text-muted-foreground", className), children: "(optional)" });
7780
+ var Required = ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("span", { ...props, "aria-hidden": true, className: cn("tw-ml-0.5", "tw-text-primary", className), children: "*" });
7781
+ var Label = ({ className, children, id, htmlFor, ...rest }) => /* @__PURE__ */ jsxRuntime.jsx(
7782
+ RLabel__namespace.Root,
7783
+ {
7784
+ ...rest,
7785
+ id: id?.toString(),
7786
+ htmlFor: htmlFor?.toString(),
7787
+ className: cn(
7788
+ "tw-m-0 tw-text-foreground tw-font-normal peer-disabled:tw-opacity-50",
7789
+ className
7790
+ ),
7791
+ children
7792
+ }
7793
+ );
7760
7794
  Label.Optional = Optional;
7795
+ Label.Required = Required;
7761
7796
  var Link = ({
7762
7797
  ref,
7763
7798
  children,
@@ -8358,12 +8393,14 @@ var badgeRootVariants = classVarianceAuthority.cva(
8358
8393
  "tw-h-fit",
8359
8394
  "tw-shrink-0",
8360
8395
  "tw-overflow-hidden",
8361
- // text
8396
+ // text — chrome weight/tracking are brand-overridable tokens
8397
+ // (`--font-weight-medium` / `--letter-spacing-chrome`); casing lives on the
8398
+ // `default` variant below via `tw-uppercase`.
8362
8399
  "tw-whitespace-pre-wrap",
8363
8400
  "tw-break-normal",
8364
8401
  "tw-text-xs",
8365
8402
  "tw-font-medium",
8366
- "tw-tracking-[1px]",
8403
+ "tw-tracking-chrome",
8367
8404
  "tw-text-center",
8368
8405
  "tw-underline",
8369
8406
  // content