@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.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",
@@ -793,6 +793,7 @@ var Clipboard = ({
793
793
  ] });
794
794
  };
795
795
  var DEFAULT_ICON = /* @__PURE__ */ jsx(icons_exports.Copy, {});
796
+ var DEFAULT_ARIA_LABEL = "Copy";
796
797
  var ClipboardButton = ({
797
798
  // clipboard props
798
799
  text,
@@ -804,20 +805,24 @@ var ClipboardButton = ({
804
805
  variant = "outline",
805
806
  children,
806
807
  ...rest
807
- }) => /* @__PURE__ */ jsx(
808
- Clipboard,
809
- {
810
- asChild: true,
811
- tooltip,
812
- tooltipPlacement,
813
- tooltipVariant,
814
- text,
815
- children: /* @__PURE__ */ jsxs(Button, { ...rest, variant, disabled: !text, children: [
816
- icon,
817
- children
818
- ] })
819
- }
820
- );
808
+ }) => {
809
+ const defaultAriaLabel = typeof tooltip === "string" && tooltip.trim() ? tooltip : DEFAULT_ARIA_LABEL;
810
+ const ariaLabel = rest["aria-label"] ?? (children == null ? defaultAriaLabel : void 0);
811
+ return /* @__PURE__ */ jsx(
812
+ Clipboard,
813
+ {
814
+ asChild: true,
815
+ tooltip,
816
+ tooltipPlacement,
817
+ tooltipVariant,
818
+ text,
819
+ children: /* @__PURE__ */ jsxs(Button, { ...rest, "aria-label": ariaLabel, variant, disabled: !text, children: [
820
+ icon,
821
+ children
822
+ ] })
823
+ }
824
+ );
825
+ };
821
826
  var ButtonToolbar = ({ value, children }) => {
822
827
  if (!value && !children) return null;
823
828
  return /* @__PURE__ */ 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: [
@@ -2515,11 +2520,23 @@ var inputGroupVariants = cva(
2515
2520
  off: ["has-[:is(input,textarea):focus]:!tw-ring-0"]
2516
2521
  },
2517
2522
  variant: {
2518
- primary: ["tw-bg-white", "has-[:is(input,textarea):disabled]:tw-opacity-40"],
2523
+ primary: [
2524
+ "tw-bg-white",
2525
+ "has-[:is(input,textarea):disabled]:tw-opacity-40",
2526
+ // aria-invalid on the control surfaces the error chrome without a `state` prop — the
2527
+ // accessible path (mirrors the `state="error"` legacy tokens). Higher specificity than
2528
+ // the default focus selector, so it wins without `!important`.
2529
+ "has-[:is(input,textarea)[aria-invalid=true]]:tw-border-error-500",
2530
+ "has-[:is(input,textarea)[aria-invalid=true]:focus]:tw-border-error-500",
2531
+ "has-[:is(input,textarea)[aria-invalid=true]:focus]:tw-ring-error-200"
2532
+ ],
2519
2533
  secondary: [
2520
2534
  "tw-bg-neutral-100",
2521
2535
  "tw-border-neutral-100",
2522
- "has-[:is(input,textarea):disabled]:tw-opacity-40"
2536
+ "has-[:is(input,textarea):disabled]:tw-opacity-40",
2537
+ "has-[:is(input,textarea)[aria-invalid=true]]:tw-border-error-500",
2538
+ "has-[:is(input,textarea)[aria-invalid=true]:focus]:tw-border-error-500",
2539
+ "has-[:is(input,textarea)[aria-invalid=true]:focus]:tw-ring-error-200"
2523
2540
  ],
2524
2541
  argo: [
2525
2542
  // argo follows the brand radius token (overrides the static base)
@@ -2530,7 +2547,12 @@ var inputGroupVariants = cva(
2530
2547
  "tw-text-foreground",
2531
2548
  "has-[:is(input,textarea):disabled]:tw-opacity-50",
2532
2549
  // higher specificity than has-[:is(input,textarea):focus] — prevents focus border on readonly
2533
- "has-[:is(input,textarea)[readonly]:focus]:tw-border-neutral-150"
2550
+ "has-[:is(input,textarea)[readonly]:focus]:tw-border-neutral-150",
2551
+ // aria-invalid on the control surfaces the error chrome without a `state` prop — the
2552
+ // accessible path (uses the themeable `destructive` status token).
2553
+ "has-[:is(input,textarea)[aria-invalid=true]]:tw-border-destructive",
2554
+ "has-[:is(input,textarea)[aria-invalid=true]:focus]:tw-border-destructive",
2555
+ "has-[:is(input,textarea)[aria-invalid=true]:focus]:tw-ring-destructive/20"
2534
2556
  ]
2535
2557
  },
2536
2558
  sizing: {
@@ -2813,9 +2835,21 @@ var FormGroupColorInput = ({
2813
2835
  const { state } = useFormGroupContext();
2814
2836
  return /* @__PURE__ */ jsx(ColorInput, { state, ...props, ref });
2815
2837
  };
2838
+ var toMessage = (entry) => typeof entry === "string" ? entry : entry?.message;
2839
+ var FormGroupError = ({ children, className, errors, ...rest }) => {
2840
+ const content = useMemo(() => {
2841
+ if (children) return children;
2842
+ const messages = (errors ?? []).map(toMessage).filter((message2) => !!message2);
2843
+ if (messages.length === 0) return null;
2844
+ if (messages.length === 1) return messages[0];
2845
+ 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)) });
2846
+ }, [children, errors]);
2847
+ if (!content) return null;
2848
+ return /* @__PURE__ */ jsx("div", { ...rest, role: "alert", className: cn("tw-m-0 tw-text-xs tw-text-destructive", className), children: content });
2849
+ };
2816
2850
  var FormGroupHelp = ({ children, ...rest }) => {
2817
2851
  const formGroupContext = useFormGroupContext();
2818
- return /* @__PURE__ */ jsx(HelpBlock, { state: formGroupContext.state, ...rest, children });
2852
+ return /* @__PURE__ */ jsx(HelpBlock, { state: formGroupContext.state === "warning" ? "warning" : "default", ...rest, children });
2819
2853
  };
2820
2854
  var toNumberOrNull = (event) => Number.isNaN(event.target.valueAsNumber) ? null : event.target.valueAsNumber;
2821
2855
  var NumberInput = ({
@@ -7698,31 +7732,32 @@ var FormGroupTextInput = ({
7698
7732
  const { state } = useFormGroupContext();
7699
7733
  return /* @__PURE__ */ jsx(TextInput, { state, ...props, ref });
7700
7734
  };
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 }) });
7735
+ var FormGroup = ({ className, children, state, ...rest }) => {
7736
+ return /* @__PURE__ */ jsx(FormGroupProvider, { value: { state }, children: /* @__PURE__ */ jsx("div", { ...rest, className: cn("tw-flex tw-flex-col tw-gap-1", className), children }) });
7703
7737
  };
7704
7738
  FormGroup.Help = FormGroupHelp;
7739
+ FormGroup.Error = FormGroupError;
7705
7740
  FormGroup.TextInput = FormGroupTextInput;
7706
7741
  FormGroup.NumberInput = FormGroupNumberInput;
7707
7742
  FormGroup.ColorInput = FormGroupColorInput;
7708
7743
  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
- };
7744
+ var Optional = ({ className, ...props }) => /* @__PURE__ */ jsx("span", { ...props, "aria-hidden": true, className: cn("tw-ml-0.5", "tw-text-muted-foreground", className), children: "(optional)" });
7745
+ var Required = ({ className, ...props }) => /* @__PURE__ */ jsx("span", { ...props, "aria-hidden": true, className: cn("tw-ml-0.5", "tw-text-primary", className), children: "*" });
7746
+ var Label = ({ className, children, id, htmlFor, ...rest }) => /* @__PURE__ */ jsx(
7747
+ RLabel.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
+ );
7725
7759
  Label.Optional = Optional;
7760
+ Label.Required = Required;
7726
7761
  var Link = ({
7727
7762
  ref,
7728
7763
  children,
@@ -8323,12 +8358,14 @@ var badgeRootVariants = cva(
8323
8358
  "tw-h-fit",
8324
8359
  "tw-shrink-0",
8325
8360
  "tw-overflow-hidden",
8326
- // text
8361
+ // text — chrome weight/tracking are brand-overridable tokens
8362
+ // (`--font-weight-medium` / `--letter-spacing-chrome`); casing lives on the
8363
+ // `default` variant below via `tw-uppercase`.
8327
8364
  "tw-whitespace-pre-wrap",
8328
8365
  "tw-break-normal",
8329
8366
  "tw-text-xs",
8330
8367
  "tw-font-medium",
8331
- "tw-tracking-[1px]",
8368
+ "tw-tracking-chrome",
8332
8369
  "tw-text-center",
8333
8370
  "tw-underline",
8334
8371
  // content