@keboola/design 5.1.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.
@@ -619,11 +619,12 @@ var init_styles = __esm({
619
619
  "tw-items-center",
620
620
  "tw-justify-center",
621
621
  "tw-gap-2",
622
- // text
622
+ // text — chrome weight/tracking are brand-overridable tokens
623
+ // (`--font-weight-medium` / `--letter-spacing-chrome`); casing stays `tw-uppercase`.
623
624
  "tw-text-xs",
624
625
  "tw-leading-5",
625
626
  "tw-font-medium",
626
- "tw-tracking-[1px]",
627
+ "tw-tracking-chrome",
627
628
  "tw-uppercase",
628
629
  // border — legacy (non-argo) chrome uses a fixed radius, not the brand token.
629
630
  "tw-rounded",
@@ -3455,11 +3456,23 @@ var inputGroupVariants = classVarianceAuthority.cva(
3455
3456
  off: ["has-[:is(input,textarea):focus]:!tw-ring-0"]
3456
3457
  },
3457
3458
  variant: {
3458
- primary: ["tw-bg-white", "has-[:is(input,textarea):disabled]:tw-opacity-40"],
3459
+ primary: [
3460
+ "tw-bg-white",
3461
+ "has-[:is(input,textarea):disabled]:tw-opacity-40",
3462
+ // aria-invalid on the control surfaces the error chrome without a `state` prop — the
3463
+ // accessible path (mirrors the `state="error"` legacy tokens). Higher specificity than
3464
+ // the default focus selector, so it wins without `!important`.
3465
+ "has-[:is(input,textarea)[aria-invalid=true]]:tw-border-error-500",
3466
+ "has-[:is(input,textarea)[aria-invalid=true]:focus]:tw-border-error-500",
3467
+ "has-[:is(input,textarea)[aria-invalid=true]:focus]:tw-ring-error-200"
3468
+ ],
3459
3469
  secondary: [
3460
3470
  "tw-bg-neutral-100",
3461
3471
  "tw-border-neutral-100",
3462
- "has-[:is(input,textarea):disabled]:tw-opacity-40"
3472
+ "has-[:is(input,textarea):disabled]:tw-opacity-40",
3473
+ "has-[:is(input,textarea)[aria-invalid=true]]:tw-border-error-500",
3474
+ "has-[:is(input,textarea)[aria-invalid=true]:focus]:tw-border-error-500",
3475
+ "has-[:is(input,textarea)[aria-invalid=true]:focus]:tw-ring-error-200"
3463
3476
  ],
3464
3477
  argo: [
3465
3478
  // argo follows the brand radius token (overrides the static base)
@@ -3470,7 +3483,12 @@ var inputGroupVariants = classVarianceAuthority.cva(
3470
3483
  "tw-text-foreground",
3471
3484
  "has-[:is(input,textarea):disabled]:tw-opacity-50",
3472
3485
  // higher specificity than has-[:is(input,textarea):focus] — prevents focus border on readonly
3473
- "has-[:is(input,textarea)[readonly]:focus]:tw-border-neutral-150"
3486
+ "has-[:is(input,textarea)[readonly]:focus]:tw-border-neutral-150",
3487
+ // aria-invalid on the control surfaces the error chrome without a `state` prop — the
3488
+ // accessible path (uses the themeable `destructive` status token).
3489
+ "has-[:is(input,textarea)[aria-invalid=true]]:tw-border-destructive",
3490
+ "has-[:is(input,textarea)[aria-invalid=true]:focus]:tw-border-destructive",
3491
+ "has-[:is(input,textarea)[aria-invalid=true]:focus]:tw-ring-destructive/20"
3474
3492
  ]
3475
3493
  },
3476
3494
  sizing: {
@@ -3758,6 +3776,21 @@ var FormGroupColorInput = ({
3758
3776
  const { state } = useFormGroupContext();
3759
3777
  return /* @__PURE__ */ jsxRuntime.jsx(ColorInput, { state, ...props, ref });
3760
3778
  };
3779
+
3780
+ // src/components/FormGroup/FormGroupError.tsx
3781
+ init_utils2();
3782
+ var toMessage = (entry) => typeof entry === "string" ? entry : entry?.message;
3783
+ var FormGroupError = ({ children, className, errors, ...rest }) => {
3784
+ const content = react.useMemo(() => {
3785
+ if (children) return children;
3786
+ const messages = (errors ?? []).map(toMessage).filter((message) => !!message);
3787
+ if (messages.length === 0) return null;
3788
+ if (messages.length === 1) return messages[0];
3789
+ 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((message, index) => /* @__PURE__ */ jsxRuntime.jsx("li", { children: message }, index)) });
3790
+ }, [children, errors]);
3791
+ if (!content) return null;
3792
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { ...rest, role: "alert", className: cn("tw-m-0 tw-text-xs tw-text-destructive", className), children: content });
3793
+ };
3761
3794
  var helpVariants = classVarianceAuthority.cva(["tw-m-0", "tw-text-xs"], {
3762
3795
  defaultVariants: {
3763
3796
  state: "default"
@@ -3765,18 +3798,17 @@ var helpVariants = classVarianceAuthority.cva(["tw-m-0", "tw-text-xs"], {
3765
3798
  variants: {
3766
3799
  state: {
3767
3800
  default: ["tw-text-muted-foreground"],
3768
- error: ["tw-text-destructive"],
3769
3801
  warning: ["tw-text-warning"]
3770
3802
  }
3771
3803
  }
3772
3804
  });
3773
- var HelpBlock = ({ children, className, state = "default", testId }) => {
3805
+ var HelpBlock = ({ children, className, state = "default", ...rest }) => {
3774
3806
  if (!children) return null;
3775
- return /* @__PURE__ */ jsxRuntime.jsx("p", { "data-testid": testId, className: helpVariants({ state, className }), children });
3807
+ return /* @__PURE__ */ jsxRuntime.jsx("p", { ...rest, className: helpVariants({ state, className }), children });
3776
3808
  };
3777
3809
  var FormGroupHelp = ({ children, ...rest }) => {
3778
3810
  const formGroupContext = useFormGroupContext();
3779
- return /* @__PURE__ */ jsxRuntime.jsx(HelpBlock, { state: formGroupContext.state, ...rest, children });
3811
+ return /* @__PURE__ */ jsxRuntime.jsx(HelpBlock, { state: formGroupContext.state === "warning" ? "warning" : "default", ...rest, children });
3780
3812
  };
3781
3813
  var toNumberOrNull = (event) => Number.isNaN(event.target.valueAsNumber) ? null : event.target.valueAsNumber;
3782
3814
  var NumberInput = ({
@@ -4031,10 +4063,11 @@ var FormGroupTextInput = ({
4031
4063
  const { state } = useFormGroupContext();
4032
4064
  return /* @__PURE__ */ jsxRuntime.jsx(TextInput, { state, ...props, ref });
4033
4065
  };
4034
- var FormGroup = ({ className, children, state, testId }) => {
4035
- 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 }) });
4066
+ var FormGroup = ({ className, children, state, ...rest }) => {
4067
+ 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 }) });
4036
4068
  };
4037
4069
  FormGroup.Help = FormGroupHelp;
4070
+ FormGroup.Error = FormGroupError;
4038
4071
  FormGroup.TextInput = FormGroupTextInput;
4039
4072
  FormGroup.NumberInput = FormGroupNumberInput;
4040
4073
  FormGroup.ColorInput = FormGroupColorInput;
@@ -4042,23 +4075,23 @@ FormGroup.Textarea = FormGroupTextarea;
4042
4075
 
4043
4076
  // src/components/Label/Label.tsx
4044
4077
  init_utils2();
4045
- var Optional = ({ className }) => /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn("tw-text-muted-foreground", className), children: "(optional)" });
4046
- var Label2 = ({ className, children, id, htmlFor, ...rest }) => {
4047
- return /* @__PURE__ */ jsxRuntime.jsx(
4048
- RLabel__namespace.Root,
4049
- {
4050
- ...rest,
4051
- id: id?.toString(),
4052
- htmlFor: htmlFor?.toString(),
4053
- className: cn(
4054
- "tw-m-0 tw-text-foreground tw-font-normal peer-disabled:tw-opacity-50",
4055
- className
4056
- ),
4057
- children
4058
- }
4059
- );
4060
- };
4078
+ 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)" });
4079
+ var Required = ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("span", { ...props, "aria-hidden": true, className: cn("tw-ml-0.5", "tw-text-primary", className), children: "*" });
4080
+ var Label2 = ({ className, children, id, htmlFor, ...rest }) => /* @__PURE__ */ jsxRuntime.jsx(
4081
+ RLabel__namespace.Root,
4082
+ {
4083
+ ...rest,
4084
+ id: id?.toString(),
4085
+ htmlFor: htmlFor?.toString(),
4086
+ className: cn(
4087
+ "tw-m-0 tw-text-foreground tw-font-normal peer-disabled:tw-opacity-50",
4088
+ className
4089
+ ),
4090
+ children
4091
+ }
4092
+ );
4061
4093
  Label2.Optional = Optional;
4094
+ Label2.Required = Required;
4062
4095
 
4063
4096
  // src/components/MarkdownEditor/plugins/toolbar/ToolbarButton.tsx
4064
4097
  init_utils2();