@keboola/design 5.0.0 → 6.0.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.js CHANGED
@@ -367,14 +367,13 @@ var helpVariants = cva(["tw-m-0", "tw-text-xs"], {
367
367
  variants: {
368
368
  state: {
369
369
  default: ["tw-text-muted-foreground"],
370
- error: ["tw-text-destructive"],
371
370
  warning: ["tw-text-warning"]
372
371
  }
373
372
  }
374
373
  });
375
- var HelpBlock = ({ children, className, state = "default", testId }) => {
374
+ var HelpBlock = ({ children, className, state = "default", ...rest }) => {
376
375
  if (!children) return null;
377
- return /* @__PURE__ */ jsx("p", { "data-testid": testId, className: helpVariants({ state, className }), children });
376
+ return /* @__PURE__ */ jsx("p", { ...rest, className: helpVariants({ state, className }), children });
378
377
  };
379
378
 
380
379
  // src/icons/index.ts
@@ -414,11 +413,12 @@ var variants = cva(
414
413
  "tw-items-center",
415
414
  "tw-justify-center",
416
415
  "tw-gap-2",
417
- // text
416
+ // text — chrome weight/tracking are brand-overridable tokens
417
+ // (`--font-weight-medium` / `--letter-spacing-chrome`); casing stays `tw-uppercase`.
418
418
  "tw-text-xs",
419
419
  "tw-leading-5",
420
420
  "tw-font-medium",
421
- "tw-tracking-[1px]",
421
+ "tw-tracking-chrome",
422
422
  "tw-uppercase",
423
423
  // border — legacy (non-argo) chrome uses a fixed radius, not the brand token.
424
424
  "tw-rounded",
@@ -2515,11 +2515,23 @@ var inputGroupVariants = cva(
2515
2515
  off: ["has-[:is(input,textarea):focus]:!tw-ring-0"]
2516
2516
  },
2517
2517
  variant: {
2518
- primary: ["tw-bg-white", "has-[:is(input,textarea):disabled]:tw-opacity-40"],
2518
+ primary: [
2519
+ "tw-bg-white",
2520
+ "has-[:is(input,textarea):disabled]:tw-opacity-40",
2521
+ // aria-invalid on the control surfaces the error chrome without a `state` prop — the
2522
+ // accessible path (mirrors the `state="error"` legacy tokens). Higher specificity than
2523
+ // the default focus selector, so it wins without `!important`.
2524
+ "has-[:is(input,textarea)[aria-invalid=true]]:tw-border-error-500",
2525
+ "has-[:is(input,textarea)[aria-invalid=true]:focus]:tw-border-error-500",
2526
+ "has-[:is(input,textarea)[aria-invalid=true]:focus]:tw-ring-error-200"
2527
+ ],
2519
2528
  secondary: [
2520
2529
  "tw-bg-neutral-100",
2521
2530
  "tw-border-neutral-100",
2522
- "has-[:is(input,textarea):disabled]:tw-opacity-40"
2531
+ "has-[:is(input,textarea):disabled]:tw-opacity-40",
2532
+ "has-[:is(input,textarea)[aria-invalid=true]]:tw-border-error-500",
2533
+ "has-[:is(input,textarea)[aria-invalid=true]:focus]:tw-border-error-500",
2534
+ "has-[:is(input,textarea)[aria-invalid=true]:focus]:tw-ring-error-200"
2523
2535
  ],
2524
2536
  argo: [
2525
2537
  // argo follows the brand radius token (overrides the static base)
@@ -2530,7 +2542,12 @@ var inputGroupVariants = cva(
2530
2542
  "tw-text-foreground",
2531
2543
  "has-[:is(input,textarea):disabled]:tw-opacity-50",
2532
2544
  // higher specificity than has-[:is(input,textarea):focus] — prevents focus border on readonly
2533
- "has-[:is(input,textarea)[readonly]:focus]:tw-border-neutral-150"
2545
+ "has-[:is(input,textarea)[readonly]:focus]:tw-border-neutral-150",
2546
+ // aria-invalid on the control surfaces the error chrome without a `state` prop — the
2547
+ // accessible path (uses the themeable `destructive` status token).
2548
+ "has-[:is(input,textarea)[aria-invalid=true]]:tw-border-destructive",
2549
+ "has-[:is(input,textarea)[aria-invalid=true]:focus]:tw-border-destructive",
2550
+ "has-[:is(input,textarea)[aria-invalid=true]:focus]:tw-ring-destructive/20"
2534
2551
  ]
2535
2552
  },
2536
2553
  sizing: {
@@ -2813,9 +2830,21 @@ var FormGroupColorInput = ({
2813
2830
  const { state } = useFormGroupContext();
2814
2831
  return /* @__PURE__ */ jsx(ColorInput, { state, ...props, ref });
2815
2832
  };
2833
+ var toMessage = (entry) => typeof entry === "string" ? entry : entry?.message;
2834
+ var FormGroupError = ({ children, className, errors, ...rest }) => {
2835
+ const content = useMemo(() => {
2836
+ if (children) return children;
2837
+ const messages = (errors ?? []).map(toMessage).filter((message2) => !!message2);
2838
+ if (messages.length === 0) return null;
2839
+ if (messages.length === 1) return messages[0];
2840
+ return /* @__PURE__ */ 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__ */ jsx("li", { children: message2 }, index)) });
2841
+ }, [children, errors]);
2842
+ if (!content) return null;
2843
+ return /* @__PURE__ */ jsx("div", { ...rest, role: "alert", className: cn("tw-m-0 tw-text-xs tw-text-destructive", className), children: content });
2844
+ };
2816
2845
  var FormGroupHelp = ({ children, ...rest }) => {
2817
2846
  const formGroupContext = useFormGroupContext();
2818
- return /* @__PURE__ */ jsx(HelpBlock, { state: formGroupContext.state, ...rest, children });
2847
+ return /* @__PURE__ */ jsx(HelpBlock, { state: formGroupContext.state === "warning" ? "warning" : "default", ...rest, children });
2819
2848
  };
2820
2849
  var toNumberOrNull = (event) => Number.isNaN(event.target.valueAsNumber) ? null : event.target.valueAsNumber;
2821
2850
  var NumberInput = ({
@@ -7698,31 +7727,32 @@ var FormGroupTextInput = ({
7698
7727
  const { state } = useFormGroupContext();
7699
7728
  return /* @__PURE__ */ jsx(TextInput, { state, ...props, ref });
7700
7729
  };
7701
- var FormGroup = ({ className, children, state, testId }) => {
7702
- return /* @__PURE__ */ jsx(FormGroupProvider, { value: { state }, children: /* @__PURE__ */ jsx("div", { "data-testid": testId, className: cn("tw-flex tw-flex-col tw-gap-1", className), children }) });
7730
+ var FormGroup = ({ className, children, state, ...rest }) => {
7731
+ return /* @__PURE__ */ jsx(FormGroupProvider, { value: { state }, children: /* @__PURE__ */ jsx("div", { ...rest, className: cn("tw-flex tw-flex-col tw-gap-1", className), children }) });
7703
7732
  };
7704
7733
  FormGroup.Help = FormGroupHelp;
7734
+ FormGroup.Error = FormGroupError;
7705
7735
  FormGroup.TextInput = FormGroupTextInput;
7706
7736
  FormGroup.NumberInput = FormGroupNumberInput;
7707
7737
  FormGroup.ColorInput = FormGroupColorInput;
7708
7738
  FormGroup.Textarea = FormGroupTextarea;
7709
- var Optional = ({ className }) => /* @__PURE__ */ jsx("span", { className: cn("tw-text-muted-foreground", className), children: "(optional)" });
7710
- var Label = ({ className, children, id, htmlFor, ...rest }) => {
7711
- return /* @__PURE__ */ jsx(
7712
- RLabel.Root,
7713
- {
7714
- ...rest,
7715
- id: id?.toString(),
7716
- htmlFor: htmlFor?.toString(),
7717
- className: cn(
7718
- "tw-m-0 tw-text-foreground tw-font-normal peer-disabled:tw-opacity-50",
7719
- className
7720
- ),
7721
- children
7722
- }
7723
- );
7724
- };
7739
+ var Optional = ({ className, ...props }) => /* @__PURE__ */ jsx("span", { ...props, "aria-hidden": true, className: cn("tw-ml-0.5", "tw-text-muted-foreground", className), children: "(optional)" });
7740
+ var Required = ({ className, ...props }) => /* @__PURE__ */ jsx("span", { ...props, "aria-hidden": true, className: cn("tw-ml-0.5", "tw-text-primary", className), children: "*" });
7741
+ var Label = ({ className, children, id, htmlFor, ...rest }) => /* @__PURE__ */ jsx(
7742
+ RLabel.Root,
7743
+ {
7744
+ ...rest,
7745
+ id: id?.toString(),
7746
+ htmlFor: htmlFor?.toString(),
7747
+ className: cn(
7748
+ "tw-m-0 tw-text-foreground tw-font-normal peer-disabled:tw-opacity-50",
7749
+ className
7750
+ ),
7751
+ children
7752
+ }
7753
+ );
7725
7754
  Label.Optional = Optional;
7755
+ Label.Required = Required;
7726
7756
  var Link = ({
7727
7757
  ref,
7728
7758
  children,
@@ -8323,12 +8353,14 @@ var badgeRootVariants = cva(
8323
8353
  "tw-h-fit",
8324
8354
  "tw-shrink-0",
8325
8355
  "tw-overflow-hidden",
8326
- // text
8356
+ // text — chrome weight/tracking are brand-overridable tokens
8357
+ // (`--font-weight-medium` / `--letter-spacing-chrome`); casing lives on the
8358
+ // `default` variant below via `tw-uppercase`.
8327
8359
  "tw-whitespace-pre-wrap",
8328
8360
  "tw-break-normal",
8329
8361
  "tw-text-xs",
8330
8362
  "tw-font-medium",
8331
- "tw-tracking-[1px]",
8363
+ "tw-tracking-chrome",
8332
8364
  "tw-text-center",
8333
8365
  "tw-underline",
8334
8366
  // content