@geomak/ui 5.7.1 → 5.7.2

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/index.cjs CHANGED
@@ -2200,6 +2200,7 @@ function FieldLabel({
2200
2200
  required,
2201
2201
  helperText,
2202
2202
  horizontal = false,
2203
+ align = "start",
2203
2204
  style,
2204
2205
  width,
2205
2206
  className = ""
@@ -2211,7 +2212,10 @@ function FieldLabel({
2211
2212
  style: { width: horizontal ? width : void 0, ...style },
2212
2213
  className: [
2213
2214
  "flex items-center gap-1",
2214
- horizontal ? "mt-2 flex-shrink-0 whitespace-nowrap" : "",
2215
+ horizontal ? "flex-shrink-0 whitespace-nowrap" : "",
2216
+ // Only the 'start' alignment needs the top nudge; 'center' relies
2217
+ // on the row's items-center to line up with a short control.
2218
+ horizontal && align === "start" ? "mt-2" : "",
2215
2219
  className
2216
2220
  ].filter(Boolean).join(" "),
2217
2221
  children: [
@@ -2232,6 +2236,7 @@ function Field({
2232
2236
  layout = "vertical",
2233
2237
  required,
2234
2238
  helperText,
2239
+ labelAlign = "start",
2235
2240
  labelStyle,
2236
2241
  labelWidth,
2237
2242
  className = "",
@@ -2244,7 +2249,7 @@ function Field({
2244
2249
  {
2245
2250
  className: [
2246
2251
  "flex",
2247
- horizontal ? "flex-row items-start gap-3" : "flex-col gap-1.5",
2252
+ horizontal ? `flex-row gap-3 ${labelAlign === "center" ? "items-center" : "items-start"}` : "flex-col gap-1.5",
2248
2253
  className
2249
2254
  ].filter(Boolean).join(" "),
2250
2255
  children: [
@@ -2256,6 +2261,7 @@ function Field({
2256
2261
  required,
2257
2262
  helperText,
2258
2263
  horizontal,
2264
+ align: labelAlign,
2259
2265
  style: labelStyle,
2260
2266
  width: labelWidth
2261
2267
  }
@@ -3714,14 +3720,15 @@ function Checkbox({
3714
3720
  // legacy alias
3715
3721
  onChange,
3716
3722
  label,
3723
+ description,
3717
3724
  name,
3718
3725
  htmlFor,
3719
3726
  errorMessage,
3727
+ helperText,
3720
3728
  disabled = false,
3729
+ required,
3721
3730
  layout = "horizontal",
3722
- labelPosition = "right",
3723
- helperText,
3724
- required
3731
+ labelPosition = "right"
3725
3732
  }) {
3726
3733
  const isChecked = checked ?? value ?? false;
3727
3734
  const labelFirst = labelPosition === "left";
@@ -3734,11 +3741,12 @@ function Checkbox({
3734
3741
  name,
3735
3742
  checked: isChecked,
3736
3743
  disabled,
3744
+ required,
3737
3745
  onCheckedChange: (c) => onChange?.({ target: { checked: !!c, id: htmlFor, name } }),
3738
3746
  className: [
3739
- "relative flex h-[18px] w-[18px] flex-shrink-0 items-center justify-center",
3747
+ "relative mt-0.5 flex h-[18px] w-[18px] flex-shrink-0 items-center justify-center",
3740
3748
  "rounded-sm border transition-colors duration-150",
3741
- "border-border-strong bg-surface",
3749
+ hasError ? "border-status-error" : "border-border-strong",
3742
3750
  "data-[state=checked]:bg-accent data-[state=checked]:border-accent",
3743
3751
  // Focus halo matches the field tokens for a consistent look.
3744
3752
  "focus:outline-none focus-visible:ring-[3px] focus-visible:ring-focus-ring",
@@ -3750,33 +3758,60 @@ function Checkbox({
3750
3758
  children: /* @__PURE__ */ jsxRuntime.jsx(CheckboxPrimitive__namespace.Indicator, { className: "flex items-center justify-center data-[state=checked]:animate-check-pop", children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "11", height: "9", viewBox: "0 0 11 9", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M1 4.5L4 7.5L10 1", stroke: "white", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round" }) }) })
3751
3759
  }
3752
3760
  );
3753
- const labelEl = label && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-sm text-foreground-secondary select-none leading-snug", children: [
3754
- label,
3755
- required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-status-error ml-0.5", "aria-hidden": "true", children: "*" })
3756
- ] });
3761
+ const labelText = label != null && /* @__PURE__ */ jsxRuntime.jsxs(
3762
+ "label",
3763
+ {
3764
+ htmlFor,
3765
+ className: ["block select-none text-sm text-foreground leading-snug", disabled ? "cursor-not-allowed opacity-50" : "cursor-pointer"].join(" "),
3766
+ children: [
3767
+ label,
3768
+ required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-status-error ml-0.5", "aria-hidden": "true", children: "*" })
3769
+ ]
3770
+ }
3771
+ );
3772
+ const descriptionEl = description != null && /* @__PURE__ */ jsxRuntime.jsx(
3773
+ "label",
3774
+ {
3775
+ htmlFor,
3776
+ className: `block text-xs text-foreground-secondary mt-0.5 ${disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer"}`,
3777
+ children: description
3778
+ }
3779
+ );
3780
+ let content;
3781
+ if (layout === "vertical") {
3782
+ content = /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex flex-col items-start gap-1.5", children: [
3783
+ labelFirst ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3784
+ labelText,
3785
+ box
3786
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3787
+ box,
3788
+ labelText
3789
+ ] }),
3790
+ descriptionEl
3791
+ ] });
3792
+ } else if (labelFirst) {
3793
+ content = /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex flex-col", children: [
3794
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-start gap-2.5", children: [
3795
+ labelText,
3796
+ box
3797
+ ] }),
3798
+ descriptionEl
3799
+ ] });
3800
+ } else {
3801
+ content = /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-start gap-2.5", children: [
3802
+ box,
3803
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex flex-col", children: [
3804
+ labelText,
3805
+ descriptionEl
3806
+ ] })
3807
+ ] });
3808
+ }
3757
3809
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
3758
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1", children: [
3759
- /* @__PURE__ */ jsxRuntime.jsx(
3760
- "label",
3761
- {
3762
- htmlFor,
3763
- className: [
3764
- "inline-flex",
3765
- layout === "vertical" ? "flex-col items-start gap-1.5" : "flex-row items-center gap-2.5",
3766
- disabled ? "cursor-not-allowed opacity-50" : "cursor-pointer"
3767
- ].join(" "),
3768
- children: labelFirst ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3769
- labelEl,
3770
- box
3771
- ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3772
- box,
3773
- labelEl
3774
- ] })
3775
- }
3776
- ),
3810
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-1", children: [
3811
+ content,
3777
3812
  helperText != null && /* @__PURE__ */ jsxRuntime.jsx(FieldHelpIcon, { text: helperText })
3778
3813
  ] }),
3779
- errorMessage && /* @__PURE__ */ jsxRuntime.jsx("span", { id: errorId, className: "text-xs text-status-error mt-0.5", children: errorMessage })
3814
+ hasError && /* @__PURE__ */ jsxRuntime.jsx("span", { id: errorId, className: "text-xs text-status-error mt-0.5", children: errorMessage })
3780
3815
  ] });
3781
3816
  }
3782
3817
  var DOT_SIZE = {
@@ -3928,6 +3963,7 @@ function Switch({
3928
3963
  layout,
3929
3964
  required,
3930
3965
  helperText,
3966
+ labelAlign: "center",
3931
3967
  children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2.5", children: [
3932
3968
  offLabel != null && /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: id, className: stateLabel(!isOn), children: offLabel }),
3933
3969
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -4217,19 +4253,17 @@ function TreeSelect({
4217
4253
  setOpen(false);
4218
4254
  }
4219
4255
  };
4220
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
4221
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `flex ${layout === "vertical" ? "flex-col gap-1" : "flex-row items-center gap-2"}`, children: [
4222
- /* @__PURE__ */ jsxRuntime.jsx(
4223
- FieldLabel,
4224
- {
4225
- label,
4226
- htmlFor,
4227
- required,
4228
- helperText,
4229
- horizontal: layout === "horizontal"
4230
- }
4231
- ),
4232
- /* @__PURE__ */ jsxRuntime.jsxs(Popover__namespace.Root, { open: open && !disabled, onOpenChange: (o) => !disabled && setOpen(o), children: [
4256
+ return /* @__PURE__ */ jsxRuntime.jsx(
4257
+ Field,
4258
+ {
4259
+ label,
4260
+ htmlFor,
4261
+ errorId,
4262
+ errorMessage,
4263
+ layout,
4264
+ required,
4265
+ helperText,
4266
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsxs(Popover__namespace.Root, { open: open && !disabled, onOpenChange: (o) => !disabled && setOpen(o), children: [
4233
4267
  /* @__PURE__ */ jsxRuntime.jsx(Popover__namespace.Trigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
4234
4268
  "button",
4235
4269
  {
@@ -4293,10 +4327,9 @@ function TreeSelect({
4293
4327
  )
4294
4328
  }
4295
4329
  ) })
4296
- ] })
4297
- ] }),
4298
- hasError && /* @__PURE__ */ jsxRuntime.jsx("div", { id: errorId, className: "text-xs text-status-error ml-1", children: errorMessage })
4299
- ] });
4330
+ ] }) })
4331
+ }
4332
+ );
4300
4333
  }
4301
4334
  function TreeNodeRow({
4302
4335
  node,