@geomak/ui 5.5.1 → 5.5.3

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
@@ -10,12 +10,12 @@ var framerMotion = require('framer-motion');
10
10
  var TooltipPrimitive = require('@radix-ui/react-tooltip');
11
11
  var TabsPrimitive = require('@radix-ui/react-tabs');
12
12
  var Accordion = require('@radix-ui/react-accordion');
13
- var ToggleGroup = require('@radix-ui/react-toggle-group');
14
13
  var ContextMenuPrimitive = require('@radix-ui/react-context-menu');
15
14
  var Popover = require('@radix-ui/react-popover');
16
15
  var SwitchPrimitive = require('@radix-ui/react-switch');
17
16
  var CheckboxPrimitive = require('@radix-ui/react-checkbox');
18
17
  var RadioGroupPrimitive = require('@radix-ui/react-radio-group');
18
+ var ToggleGroup = require('@radix-ui/react-toggle-group');
19
19
  var SliderPrimitive = require('@radix-ui/react-slider');
20
20
 
21
21
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
@@ -44,12 +44,12 @@ var Dialog__namespace = /*#__PURE__*/_interopNamespace(Dialog);
44
44
  var TooltipPrimitive__namespace = /*#__PURE__*/_interopNamespace(TooltipPrimitive);
45
45
  var TabsPrimitive__namespace = /*#__PURE__*/_interopNamespace(TabsPrimitive);
46
46
  var Accordion__namespace = /*#__PURE__*/_interopNamespace(Accordion);
47
- var ToggleGroup__namespace = /*#__PURE__*/_interopNamespace(ToggleGroup);
48
47
  var ContextMenuPrimitive__namespace = /*#__PURE__*/_interopNamespace(ContextMenuPrimitive);
49
48
  var Popover__namespace = /*#__PURE__*/_interopNamespace(Popover);
50
49
  var SwitchPrimitive__namespace = /*#__PURE__*/_interopNamespace(SwitchPrimitive);
51
50
  var CheckboxPrimitive__namespace = /*#__PURE__*/_interopNamespace(CheckboxPrimitive);
52
51
  var RadioGroupPrimitive__namespace = /*#__PURE__*/_interopNamespace(RadioGroupPrimitive);
52
+ var ToggleGroup__namespace = /*#__PURE__*/_interopNamespace(ToggleGroup);
53
53
  var SliderPrimitive__namespace = /*#__PURE__*/_interopNamespace(SliderPrimitive);
54
54
 
55
55
  var Moon = ({ color = "gray" }) => /* @__PURE__ */ jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: color, viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: color, className: "w-8 h-8", children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M21.752 15.002A9.718 9.718 0 0118 15.75c-5.385 0-9.75-4.365-9.75-9.75 0-1.33.266-2.597.748-3.752A9.753 9.753 0 003 11.25C3 16.635 7.365 21 12.75 21a9.753 9.753 0 009.002-5.998z" }) });
@@ -1178,38 +1178,6 @@ function Tree({
1178
1178
  item.key
1179
1179
  )) });
1180
1180
  }
1181
- function ToggleButton({ items, onChange, activeKey }) {
1182
- return /* @__PURE__ */ jsxRuntime.jsx(
1183
- ToggleGroup__namespace.Root,
1184
- {
1185
- type: "single",
1186
- value: activeKey,
1187
- onValueChange: (val) => {
1188
- if (val) onChange(val);
1189
- },
1190
- className: "flex items-center",
1191
- children: items.map((item, index) => /* @__PURE__ */ jsxRuntime.jsx(
1192
- ToggleGroup__namespace.Item,
1193
- {
1194
- value: item.key,
1195
- "aria-label": typeof item.label === "string" ? item.label : item.key,
1196
- className: [
1197
- // Semantic tokens handle both light and dark modes via
1198
- // CSS vars — no `dark:` variants needed.
1199
- index === 0 && "rounded-l-lg border-r border-border",
1200
- index === items.length - 1 && "rounded-r-lg border-l border-border",
1201
- "p-2 cursor-pointer transition-colors duration-150 text-foreground-secondary",
1202
- "focus:outline-none focus-visible:ring-2 focus-visible:ring-accent",
1203
- "bg-surface hover:bg-surface-raised",
1204
- "data-[state=on]:bg-accent data-[state=on]:text-accent-fg"
1205
- ].filter(Boolean).join(" "),
1206
- children: item.icon ?? item.label
1207
- },
1208
- item.key
1209
- ))
1210
- }
1211
- );
1212
- }
1213
1181
  var NotificationContext = React8.createContext({
1214
1182
  open: () => void 0,
1215
1183
  close: () => void 0
@@ -1611,6 +1579,10 @@ var TOGGLE_POSITION_CLASS = {
1611
1579
  function ScalableContainer({
1612
1580
  width = "100%",
1613
1581
  height = "auto",
1582
+ expandedWidth = "100%",
1583
+ expandedHeight = "100%",
1584
+ expanded,
1585
+ onExpandedChange,
1614
1586
  children,
1615
1587
  assignClassOnClick,
1616
1588
  expandIcon,
@@ -1618,27 +1590,32 @@ function ScalableContainer({
1618
1590
  togglePosition = "top-right"
1619
1591
  }) {
1620
1592
  const containerRef = React8.useRef(null);
1621
- const [isScaled, setScaled] = React8.useState(false);
1593
+ const [internalScaled, setInternalScaled] = React8.useState(false);
1594
+ const isScaled = expanded ?? internalScaled;
1622
1595
  const reduced = framerMotion.useReducedMotion();
1623
1596
  const onToggle = () => {
1624
1597
  const next = !isScaled;
1625
- setScaled(next);
1626
- requestAnimationFrame(() => containerRef.current?.scrollIntoView({ behavior: "smooth", block: "nearest" }));
1598
+ if (expanded === void 0) setInternalScaled(next);
1599
+ onExpandedChange?.(next);
1600
+ if (next) {
1601
+ window.setTimeout(
1602
+ () => containerRef.current?.scrollIntoView({ behavior: "smooth", block: "nearest" }),
1603
+ reduced ? 0 : 340
1604
+ );
1605
+ }
1627
1606
  };
1628
1607
  const wrapperClass = isScaled ? assignClassOnClick : void 0;
1629
1608
  return /* @__PURE__ */ jsxRuntime.jsxs(
1630
1609
  framerMotion.motion.div,
1631
1610
  {
1632
1611
  ref: containerRef,
1633
- layout: true,
1634
1612
  animate: {
1635
- width: isScaled ? "100%" : width,
1636
- height: isScaled ? "100%" : height
1613
+ width: isScaled ? expandedWidth : width,
1614
+ height: isScaled ? expandedHeight : height
1637
1615
  },
1638
1616
  transition: reduced ? { duration: 0 } : {
1639
1617
  width: { type: "tween", duration: 0.32, ease: [0.16, 1, 0.3, 1] },
1640
- height: { type: "tween", duration: 0.32, ease: [0.16, 1, 0.3, 1] },
1641
- layout: { duration: 0.32, ease: [0.16, 1, 0.3, 1] }
1618
+ height: { type: "tween", duration: 0.32, ease: [0.16, 1, 0.3, 1] }
1642
1619
  },
1643
1620
  className: [
1644
1621
  "relative rounded-lg overflow-hidden",
@@ -2174,10 +2151,10 @@ var FIELD_SIZE = {
2174
2151
  md: { control: "h-control-md", text: "text-sm", padX: "px-3", gap: "gap-2" },
2175
2152
  lg: { control: "h-control-lg", text: "text-sm", padX: "px-3.5", gap: "gap-2.5" }
2176
2153
  };
2177
- var FOCUS_WITHIN = "focus-within:outline-none focus-within:border-accent focus-within:ring-[3px] focus-within:ring-focus-ring";
2178
- var FOCUS_ELEMENT = "focus:outline-none focus:border-accent focus:ring-[3px] focus:ring-focus-ring data-[state=open]:border-accent data-[state=open]:ring-[3px] data-[state=open]:ring-focus-ring";
2179
- var FOCUS_WITHIN_ERROR = "focus-within:border-status-error focus-within:ring-focus-ring-error";
2180
- var FOCUS_ELEMENT_ERROR = "focus:border-status-error focus:ring-focus-ring-error data-[state=open]:border-status-error data-[state=open]:ring-focus-ring-error";
2154
+ var FOCUS_WITHIN = "focus-within:outline-none focus-within:border-accent";
2155
+ var FOCUS_ELEMENT = "focus:outline-none focus:border-accent data-[state=open]:border-accent";
2156
+ var FOCUS_WITHIN_ERROR = "focus-within:border-status-error";
2157
+ var FOCUS_ELEMENT_ERROR = "focus:border-status-error data-[state=open]:border-status-error";
2181
2158
  function fieldShell({
2182
2159
  size = "md",
2183
2160
  hasError = false,
@@ -2388,7 +2365,7 @@ function Dropdown({
2388
2365
  "aria-invalid": hasError || void 0,
2389
2366
  "aria-describedby": hasError ? errorId : void 0,
2390
2367
  style,
2391
- className: `flex items-center justify-between gap-1 cursor-pointer select-none min-h-[36px] px-3 py-1.5 ${fieldShell({ size, hasError, disabled, sized: false })}`,
2368
+ className: `flex items-center justify-between gap-2 cursor-pointer select-none min-h-[36px] px-3 py-1.5 ${!style?.width ? "min-w-[200px]" : ""} ${fieldShell({ size, hasError, disabled, sized: false })}`,
2392
2369
  tabIndex: disabled ? -1 : 0,
2393
2370
  onKeyDown: (e) => {
2394
2371
  if (disabled) return;
@@ -2398,31 +2375,25 @@ function Dropdown({
2398
2375
  }
2399
2376
  },
2400
2377
  children: [
2401
- /* @__PURE__ */ jsxRuntime.jsx(
2402
- "div",
2378
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 min-w-0 flex flex-wrap items-center gap-1.5", children: !value || Array.isArray(value) && value.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-foreground-muted text-sm", children: placeholder }) : Array.isArray(value) ? value.map((val) => /* @__PURE__ */ jsxRuntime.jsx(
2379
+ Tag,
2403
2380
  {
2404
- className: `${!style?.width ? "min-w-[200px]" : ""} flex flex-wrap items-center gap-1.5`,
2405
- children: !value || Array.isArray(value) && value.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-foreground-muted text-sm", children: placeholder }) : Array.isArray(value) ? value.map((val) => /* @__PURE__ */ jsxRuntime.jsx(
2406
- Tag,
2407
- {
2408
- disabled,
2409
- removeLabel: `Remove ${labelFor(val)}`,
2410
- onRemove: () => removeSelected(val),
2411
- children: labelFor(val)
2412
- },
2413
- String(val)
2414
- )) : /* @__PURE__ */ jsxRuntime.jsx(
2415
- Tag,
2416
- {
2417
- disabled,
2418
- removeLabel: `Remove ${labelFor(value)}`,
2419
- onRemove: () => removeSelected(value),
2420
- children: labelFor(value)
2421
- }
2422
- )
2381
+ disabled,
2382
+ removeLabel: `Remove ${labelFor(val)}`,
2383
+ onRemove: () => removeSelected(val),
2384
+ children: labelFor(val)
2385
+ },
2386
+ String(val)
2387
+ )) : /* @__PURE__ */ jsxRuntime.jsx(
2388
+ Tag,
2389
+ {
2390
+ disabled,
2391
+ removeLabel: `Remove ${labelFor(value)}`,
2392
+ onRemove: () => removeSelected(value),
2393
+ children: labelFor(value)
2423
2394
  }
2424
- ),
2425
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: `flex-shrink-0 ml-2 text-foreground-muted transition-transform duration-200 ${open ? "rotate-180" : "rotate-0"}`, "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, className: "h-4 w-4", children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19 9l-7 7-7-7" }) }) })
2395
+ ) }),
2396
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: `flex-shrink-0 text-foreground-muted transition-transform duration-200 ${open ? "rotate-180" : "rotate-0"}`, "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, className: "h-4 w-4", children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19 9l-7 7-7-7" }) }) })
2426
2397
  ]
2427
2398
  }
2428
2399
  ) }),
@@ -3680,7 +3651,8 @@ function RadioGroup({
3680
3651
  onChange,
3681
3652
  name,
3682
3653
  label,
3683
- orientation = "vertical",
3654
+ layout = "vertical",
3655
+ labelPosition = "right",
3684
3656
  size = "md",
3685
3657
  disabled,
3686
3658
  required,
@@ -3689,6 +3661,7 @@ function RadioGroup({
3689
3661
  const errorId = React8.useId();
3690
3662
  const groupId = React8.useId();
3691
3663
  const hasError = errorMessage != null;
3664
+ const labelFirst = labelPosition === "left";
3692
3665
  return /* @__PURE__ */ jsxRuntime.jsx(
3693
3666
  Field,
3694
3667
  {
@@ -3709,44 +3682,51 @@ function RadioGroup({
3709
3682
  required,
3710
3683
  "aria-invalid": hasError || void 0,
3711
3684
  "aria-describedby": hasError ? errorId : void 0,
3712
- orientation,
3713
- className: orientation === "horizontal" ? "flex flex-row flex-wrap gap-5" : "flex flex-col gap-3",
3685
+ orientation: layout,
3686
+ className: layout === "horizontal" ? "flex flex-row flex-wrap gap-5" : "flex flex-col gap-3",
3714
3687
  children: options.map((opt) => {
3715
3688
  const itemId = `${groupId}-${opt.value}`;
3716
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-2.5", children: [
3717
- /* @__PURE__ */ jsxRuntime.jsx(
3718
- RadioGroupPrimitive__namespace.Item,
3719
- {
3720
- id: itemId,
3721
- value: opt.value,
3722
- disabled: opt.disabled,
3723
- className: [
3724
- DOT_SIZE[size],
3725
- "mt-0.5 flex-shrink-0 rounded-full border bg-surface transition-colors duration-150",
3726
- "border-border-strong",
3727
- "hover:border-accent",
3728
- "data-[state=checked]:border-accent",
3729
- "focus:outline-none focus-visible:ring-[3px] focus-visible:ring-focus-ring",
3730
- "disabled:cursor-not-allowed disabled:opacity-50"
3731
- ].join(" "),
3732
- children: /* @__PURE__ */ jsxRuntime.jsx(RadioGroupPrimitive__namespace.Indicator, { className: "flex h-full w-full items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "block h-1/2 w-1/2 rounded-full bg-accent" }) })
3733
- }
3734
- ),
3735
- /* @__PURE__ */ jsxRuntime.jsxs(
3736
- "label",
3737
- {
3738
- htmlFor: itemId,
3739
- className: [
3740
- "select-none",
3741
- opt.disabled ? "cursor-not-allowed opacity-50" : "cursor-pointer"
3742
- ].join(" "),
3743
- children: [
3744
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: `block ${TEXT_SIZE[size]} text-foreground`, children: opt.label }),
3745
- opt.description && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "block text-xs text-foreground-secondary mt-0.5", children: opt.description })
3746
- ]
3747
- }
3748
- )
3749
- ] }, opt.value);
3689
+ const dot = /* @__PURE__ */ jsxRuntime.jsx(
3690
+ RadioGroupPrimitive__namespace.Item,
3691
+ {
3692
+ id: itemId,
3693
+ value: opt.value,
3694
+ disabled: opt.disabled,
3695
+ className: [
3696
+ DOT_SIZE[size],
3697
+ "mt-0.5 flex-shrink-0 rounded-full border bg-surface transition-colors duration-150",
3698
+ "border-border-strong",
3699
+ "hover:border-accent",
3700
+ "data-[state=checked]:border-accent",
3701
+ // Border-only focus, consistent with the fields.
3702
+ "focus:outline-none focus-visible:border-accent",
3703
+ "disabled:cursor-not-allowed disabled:opacity-50"
3704
+ ].join(" "),
3705
+ children: /* @__PURE__ */ jsxRuntime.jsx(RadioGroupPrimitive__namespace.Indicator, { className: "flex h-full w-full items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "block h-1/2 w-1/2 rounded-full bg-accent" }) })
3706
+ }
3707
+ );
3708
+ const labelEl = /* @__PURE__ */ jsxRuntime.jsxs(
3709
+ "label",
3710
+ {
3711
+ htmlFor: itemId,
3712
+ className: [
3713
+ "select-none",
3714
+ opt.disabled ? "cursor-not-allowed opacity-50" : "cursor-pointer",
3715
+ labelFirst ? "text-right" : ""
3716
+ ].filter(Boolean).join(" "),
3717
+ children: [
3718
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: `block ${TEXT_SIZE[size]} text-foreground`, children: opt.label }),
3719
+ opt.description && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "block text-xs text-foreground-secondary mt-0.5", children: opt.description })
3720
+ ]
3721
+ }
3722
+ );
3723
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-start gap-2.5", children: labelFirst ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3724
+ labelEl,
3725
+ dot
3726
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3727
+ dot,
3728
+ labelEl
3729
+ ] }) }, opt.value);
3750
3730
  })
3751
3731
  }
3752
3732
  )
@@ -4477,11 +4457,11 @@ function DatePicker({
4477
4457
  };
4478
4458
  const displayValue = value ? format(value) : "";
4479
4459
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
4480
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `flex ${layout === "vertical" ? "flex-col gap-1" : "flex-row items-center gap-2"}`, children: [
4460
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `flex ${layout === "vertical" ? "flex-col gap-1.5" : "flex-row items-start gap-3"}`, children: [
4481
4461
  label && /* @__PURE__ */ jsxRuntime.jsx(
4482
4462
  "label",
4483
4463
  {
4484
- className: "text-sm font-medium ml-1 max-content select-none text-foreground",
4464
+ className: `text-sm font-medium select-none text-foreground ${layout === "horizontal" ? "mt-2 flex-shrink-0 whitespace-nowrap" : ""}`,
4485
4465
  htmlFor,
4486
4466
  children: label
4487
4467
  }
@@ -5137,10 +5117,11 @@ function OtpInput({
5137
5117
  className: [
5138
5118
  BOX_SIZE[size],
5139
5119
  "text-center font-medium rounded-lg border bg-surface text-foreground",
5140
- "transition-[border-color,box-shadow] duration-150",
5120
+ "transition-[border-color] duration-150",
5141
5121
  hasError ? "border-status-error" : "border-border",
5142
5122
  "hover:border-border-strong",
5143
- "focus:outline-none focus:border-accent focus:ring-[3px] focus:ring-focus-ring",
5123
+ // Border-only focus, consistent with every field (no clip-prone ring).
5124
+ "focus:outline-none focus:border-accent",
5144
5125
  "disabled:bg-surface-raised disabled:text-foreground-muted disabled:cursor-not-allowed"
5145
5126
  ].join(" ")
5146
5127
  }
@@ -5749,7 +5730,6 @@ exports.TextInput = TextInput;
5749
5730
  exports.ThemeProvider = ThemeProvider;
5750
5731
  exports.ThemeSwitch = ThemeSwitch;
5751
5732
  exports.TimePicker = TimePicker;
5752
- exports.ToggleButton = ToggleButton;
5753
5733
  exports.Tooltip = Tooltip;
5754
5734
  exports.TooltipProvider = TooltipProvider;
5755
5735
  exports.TopBar = TopBar;