@tensor_1/react 2.23.0 → 2.24.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/index.cjs CHANGED
@@ -2932,7 +2932,7 @@ function SegmentedOption({
2932
2932
  }
2933
2933
 
2934
2934
  // src/components/TableControls.tsx
2935
- var import_react33 = require("react");
2935
+ var import_react34 = require("react");
2936
2936
 
2937
2937
  // src/components/EditorIcons.tsx
2938
2938
  var import_jsx_runtime49 = require("react/jsx-runtime");
@@ -2965,7 +2965,8 @@ var PATHS = {
2965
2965
  sourceMode: "M10 12.5 8 15l2 2.5M14 12.5l2 2.5-2 2.5M14 2v4a2 2 0 0 0 2 2h4M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",
2966
2966
  richMode: "M14 2v4a2 2 0 0 0 2 2h4M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7ZM8 13h8M8 17h5",
2967
2967
  clock: "M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20ZM12 6v6l4 2",
2968
- grip: "M9 5h.01M9 12h.01M9 19h.01M15 5h.01M15 12h.01M15 19h.01"
2968
+ grip: "M9 5h.01M9 12h.01M9 19h.01M15 5h.01M15 12h.01M15 19h.01",
2969
+ more: "M5 12h.01M12 12h.01M19 12h.01"
2969
2970
  };
2970
2971
  function EditorIcon({ name, ...props }) {
2971
2972
  return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
@@ -2985,46 +2986,374 @@ function EditorIcon({ name, ...props }) {
2985
2986
  );
2986
2987
  }
2987
2988
 
2988
- // src/components/TableControls.tsx
2989
+ // src/components/Popover.tsx
2990
+ var import_react33 = require("react");
2989
2991
  var import_jsx_runtime50 = require("react/jsx-runtime");
2990
- function ViewMenu({ density, densityLabel, densityOptions, onDensityChange, zebra, freeze, columns, columnsLabel, onColumnVisibilityChange }) {
2991
- const densityLabelId = (0, import_react33.useId)();
2992
- const zebraLabelId = (0, import_react33.useId)();
2993
- const freezeLabelId = (0, import_react33.useId)();
2994
- return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "uix-view-menu", children: [
2995
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "uix-view-menu__group", children: [
2996
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { id: densityLabelId, className: "uix-view-menu__label", children: densityLabel }),
2997
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Segmented, { value: density, onChange: onDensityChange, "aria-labelledby": densityLabelId, children: densityOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(SegmentedOption, { value: option.value, children: option.label }, option.value)) })
2992
+ function Popover({
2993
+ popover = "auto",
2994
+ anchor,
2995
+ placement = "bottom-start",
2996
+ offset = 6,
2997
+ className,
2998
+ children,
2999
+ ...props
3000
+ }) {
3001
+ const ref = (0, import_react33.useRef)(null);
3002
+ const [open, setOpen] = (0, import_react33.useState)(false);
3003
+ const popoverAttr = { popover };
3004
+ const reposition = useAnchoredPosition(anchor ?? null, ref, {
3005
+ open: open && !!anchor,
3006
+ placement,
3007
+ offset
3008
+ });
3009
+ (0, import_react33.useEffect)(() => {
3010
+ const el = ref.current;
3011
+ if (!el || !anchor) return;
3012
+ const sync = () => {
3013
+ const isOpen = el.matches(":popover-open");
3014
+ if (isOpen) reposition();
3015
+ setOpen(isOpen);
3016
+ };
3017
+ el.addEventListener("toggle", sync);
3018
+ return () => el.removeEventListener("toggle", sync);
3019
+ }, [anchor, reposition]);
3020
+ return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { ref, className: cx("uix-popover", className), ...popoverAttr, ...props, children });
3021
+ }
3022
+
3023
+ // src/components/TableControls.tsx
3024
+ var import_jsx_runtime51 = require("react/jsx-runtime");
3025
+ var VIEW_MENU_COLUMN_LABELS = {
3026
+ rowActions: "Column actions: {label}",
3027
+ reorder: "Drag to reorder: {label}",
3028
+ moveUp: "Move up",
3029
+ moveDown: "Move down",
3030
+ hide: "Hide",
3031
+ show: "Show",
3032
+ required: "Always shown",
3033
+ moved: "{label} moved to position {position} of {count}"
3034
+ };
3035
+ var fill = (template, values) => template.replace(/\{(\w+)\}/g, (match, name) => name in values ? String(values[name]) : match);
3036
+ var columnText = (column) => column.textLabel ?? (typeof column.label === "string" ? column.label : column.id);
3037
+ var isPopoverOpen = (el) => {
3038
+ try {
3039
+ return !!el?.matches(":popover-open");
3040
+ } catch {
3041
+ return false;
3042
+ }
3043
+ };
3044
+ function ColumnRowMenu({ label, actions, triggerRef }) {
3045
+ const [open, setOpen] = (0, import_react34.useState)(false);
3046
+ const menuId = (0, import_react34.useId)();
3047
+ const button = (0, import_react34.useRef)(null);
3048
+ const items = (0, import_react34.useRef)([]);
3049
+ const wasOpenAtPress = (0, import_react34.useRef)(false);
3050
+ const enabled = () => items.current.filter((el) => !!el && !el.disabled);
3051
+ const close = (returnFocus) => {
3052
+ const el = document.getElementById(menuId);
3053
+ if (isPopoverOpen(el)) el.hidePopover();
3054
+ setOpen(false);
3055
+ if (returnFocus) button.current?.focus();
3056
+ };
3057
+ (0, import_react34.useEffect)(() => {
3058
+ if (!open) return;
3059
+ const el = document.getElementById(menuId);
3060
+ if (el && typeof el.showPopover === "function" && !isPopoverOpen(el)) {
3061
+ try {
3062
+ el.showPopover();
3063
+ } catch {
3064
+ }
3065
+ }
3066
+ enabled()[0]?.focus();
3067
+ const onToggle = (event) => {
3068
+ if (event.newState === "closed") setOpen(false);
3069
+ };
3070
+ const onKeyDown = (event) => {
3071
+ if (event.key !== "Escape") return;
3072
+ event.preventDefault();
3073
+ event.stopPropagation();
3074
+ close(true);
3075
+ };
3076
+ el?.addEventListener("toggle", onToggle);
3077
+ document.addEventListener("keydown", onKeyDown, true);
3078
+ return () => {
3079
+ el?.removeEventListener("toggle", onToggle);
3080
+ document.removeEventListener("keydown", onKeyDown, true);
3081
+ };
3082
+ }, [open, menuId]);
3083
+ const onMenuKeyDown = (event) => {
3084
+ const list = enabled();
3085
+ const at = list.indexOf(document.activeElement);
3086
+ const focus = (index) => {
3087
+ event.preventDefault();
3088
+ list[(index + list.length) % list.length]?.focus();
3089
+ };
3090
+ if (event.key === "ArrowDown") focus(at + 1);
3091
+ else if (event.key === "ArrowUp") focus(at - 1);
3092
+ else if (event.key === "Home") focus(0);
3093
+ else if (event.key === "End") focus(list.length - 1);
3094
+ else if (event.key === "Tab") close(false);
3095
+ };
3096
+ return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("span", { className: "uix-view-menu__actions", children: [
3097
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
3098
+ "button",
3099
+ {
3100
+ ref: (el) => {
3101
+ button.current = el;
3102
+ triggerRef(el);
3103
+ },
3104
+ type: "button",
3105
+ className: "uix-btn uix-btn--ghost uix-btn--sm uix-btn--icon",
3106
+ "aria-label": label,
3107
+ "aria-haspopup": "menu",
3108
+ "aria-expanded": open,
3109
+ "aria-controls": open ? menuId : void 0,
3110
+ onPointerDown: () => {
3111
+ wasOpenAtPress.current = isPopoverOpen(document.getElementById(menuId));
3112
+ },
3113
+ onClick: () => {
3114
+ const wasOpen = wasOpenAtPress.current;
3115
+ wasOpenAtPress.current = false;
3116
+ if (wasOpen) return;
3117
+ if (open) close(false);
3118
+ else setOpen(true);
3119
+ },
3120
+ children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(EditorIcon, { name: "more" })
3121
+ }
3122
+ ),
3123
+ open && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Popover, { id: menuId, anchor: button, placement: "bottom-end", offset: 4, role: "menu", "aria-label": label, className: "uix-view-menu__row-menu", onKeyDown: onMenuKeyDown, children: actions.map((action, index) => /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
3124
+ "button",
3125
+ {
3126
+ ref: (el) => {
3127
+ items.current[index] = el;
3128
+ },
3129
+ type: "button",
3130
+ role: "menuitem",
3131
+ tabIndex: -1,
3132
+ className: "uix-menu__item",
3133
+ disabled: action.disabled,
3134
+ onClick: () => {
3135
+ close(true);
3136
+ action.onSelect();
3137
+ },
3138
+ children: action.label
3139
+ },
3140
+ action.id
3141
+ )) })
3142
+ ] });
3143
+ }
3144
+ function ViewMenu({
3145
+ density,
3146
+ densityLabel,
3147
+ densityOptions,
3148
+ onDensityChange,
3149
+ displayLabel,
3150
+ zebra,
3151
+ freeze,
3152
+ columns,
3153
+ columnsLabel,
3154
+ onColumnVisibilityChange,
3155
+ onReorder,
3156
+ columnLabels,
3157
+ footer,
3158
+ className
3159
+ }) {
3160
+ const baseId = (0, import_react34.useId)();
3161
+ const densityLabelId = `${baseId}-density`;
3162
+ const zebraLabelId = `${baseId}-zebra`;
3163
+ const freezeLabelId = `${baseId}-freeze`;
3164
+ const columnsLabelId = `${baseId}-columns`;
3165
+ const labels = { ...VIEW_MENU_COLUMN_LABELS, ...columnLabels };
3166
+ const list = columns ?? [];
3167
+ const [draft, setDraft] = (0, import_react34.useState)(null);
3168
+ const [announcement, setAnnouncement] = (0, import_react34.useState)("");
3169
+ const dragStart = (0, import_react34.useRef)(null);
3170
+ const listRef = (0, import_react34.useRef)(null);
3171
+ const triggers = (0, import_react34.useRef)(/* @__PURE__ */ new Map());
3172
+ const refocus = (0, import_react34.useRef)(null);
3173
+ const orderKey = JSON.stringify(list.map((column) => column.id));
3174
+ (0, import_react34.useEffect)(() => setDraft(null), [orderKey]);
3175
+ const order = draft ?? list.map((column) => column.id);
3176
+ const byId = new Map(list.map((column) => [column.id, column]));
3177
+ const ordered = order.map((id) => byId.get(id)).filter((column) => !!column);
3178
+ (0, import_react34.useEffect)(() => {
3179
+ const target = refocus.current;
3180
+ refocus.current = null;
3181
+ if (!target) return;
3182
+ const el = target.part === "actions" ? triggers.current.get(target.id) : Array.from(listRef.current?.children ?? []).find((row) => row.dataset.columnId === target.id)?.querySelector(".uix-view-menu__grip");
3183
+ if (el && document.activeElement !== el) el.focus();
3184
+ });
3185
+ const commit = (next, id) => {
3186
+ setDraft(next);
3187
+ onReorder?.([...next]);
3188
+ const column = byId.get(id);
3189
+ if (column) setAnnouncement(fill(labels.moved, { label: columnText(column), position: next.indexOf(id) + 1, count: next.length }));
3190
+ };
3191
+ const move = (id, delta, part) => {
3192
+ const next = placeId(order, id, order.indexOf(id) + delta);
3193
+ if (next === order) return;
3194
+ refocus.current = { id, part };
3195
+ commit(next, id);
3196
+ };
3197
+ const { dragging, start: startDrag } = useRowDrag(".uix-view-menu__col", {
3198
+ over: (id, index) => {
3199
+ const next = placeId(order, id, index);
3200
+ if (next !== order) setDraft(next);
3201
+ },
3202
+ drop: (id) => {
3203
+ const start = dragStart.current;
3204
+ dragStart.current = null;
3205
+ if (start && !sameOrder(start, order)) commit(order, id);
3206
+ }
3207
+ });
3208
+ const rowActions = (column, index) => [
3209
+ { id: "up", label: labels.moveUp, disabled: index === 0, onSelect: () => move(column.id, -1, "actions") },
3210
+ { id: "down", label: labels.moveDown, disabled: index === ordered.length - 1, onSelect: () => move(column.id, 1, "actions") },
3211
+ ...column.required || column.disabled ? [] : [column.visible ? { id: "hide", label: labels.hide, onSelect: () => onColumnVisibilityChange?.(column.id, false) } : { id: "show", label: labels.show, onSelect: () => onColumnVisibilityChange?.(column.id, true) }]
3212
+ ];
3213
+ const showDensity = !!densityOptions?.length && !!onDensityChange;
3214
+ return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: cx("uix-view-menu", className), "data-dragging": dragging ? "" : void 0, children: [
3215
+ showDensity && /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "uix-view-menu__group", children: [
3216
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { id: densityLabelId, className: "uix-view-menu__label", children: densityLabel }),
3217
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Segmented, { value: density ?? "", onChange: onDensityChange, "aria-labelledby": densityLabelId, children: densityOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(SegmentedOption, { value: option.value, children: option.label }, option.value)) })
2998
3218
  ] }),
2999
- (zebra || freeze) && /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "uix-view-menu__group", children: [
3000
- zebra && /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "uix-view-menu__row", children: [
3001
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { id: zebraLabelId, children: zebra.label }),
3002
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Switch, { checked: zebra.checked, "aria-labelledby": zebraLabelId, onChange: (event) => zebra.onChange(event.currentTarget.checked) })
3219
+ (zebra || freeze) && /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "uix-view-menu__group", children: [
3220
+ displayLabel != null && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "uix-view-menu__label", children: displayLabel }),
3221
+ zebra && /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "uix-view-menu__row", children: [
3222
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { id: zebraLabelId, children: zebra.label }),
3223
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Switch, { checked: zebra.checked, "aria-labelledby": zebraLabelId, onChange: (event) => zebra.onChange(event.currentTarget.checked) })
3003
3224
  ] }),
3004
- freeze && /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "uix-view-menu__row", children: [
3005
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { id: freezeLabelId, children: freeze.label }),
3006
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Switch, { checked: freeze.checked, "aria-labelledby": freezeLabelId, onChange: (event) => freeze.onChange(event.currentTarget.checked) })
3225
+ freeze && /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "uix-view-menu__row", children: [
3226
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { id: freezeLabelId, children: freeze.label }),
3227
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Switch, { checked: freeze.checked, "aria-labelledby": freezeLabelId, onChange: (event) => freeze.onChange(event.currentTarget.checked) })
3007
3228
  ] })
3008
3229
  ] }),
3009
- columns && columns.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "uix-view-menu__group", children: [
3010
- columnsLabel != null && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: "uix-view-menu__label", children: columnsLabel }),
3011
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: "uix-view-menu__cols", children: columns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Checkbox, { label: column.label, checked: column.visible, disabled: column.disabled, onChange: (event) => onColumnVisibilityChange?.(column.id, event.currentTarget.checked) }, column.id)) })
3012
- ] })
3230
+ ordered.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "uix-view-menu__group", children: [
3231
+ columnsLabel != null && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { id: columnsLabelId, className: "uix-view-menu__label", children: columnsLabel }),
3232
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("ul", { ref: listRef, className: "uix-view-menu__cols", "aria-labelledby": columnsLabel != null ? columnsLabelId : void 0, children: ordered.map((column, index) => {
3233
+ const text = columnText(column);
3234
+ return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(
3235
+ "li",
3236
+ {
3237
+ className: "uix-view-menu__col",
3238
+ "data-column-id": column.id,
3239
+ "data-visible": String(column.visible),
3240
+ "data-required": column.required ? "true" : void 0,
3241
+ "data-dragging": dragging === column.id || void 0,
3242
+ children: [
3243
+ onReorder && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
3244
+ "button",
3245
+ {
3246
+ type: "button",
3247
+ className: "uix-view-menu__grip",
3248
+ tabIndex: -1,
3249
+ "aria-label": fill(labels.reorder, { label: text }),
3250
+ onPointerDown: (event) => {
3251
+ if (event.button !== 0) return;
3252
+ event.preventDefault();
3253
+ event.currentTarget.focus({ preventScroll: true });
3254
+ dragStart.current = order;
3255
+ startDrag(event, column.id);
3256
+ },
3257
+ onKeyDown: (event) => {
3258
+ if (event.key !== "ArrowUp" && event.key !== "ArrowDown") return;
3259
+ event.preventDefault();
3260
+ move(column.id, event.key === "ArrowUp" ? -1 : 1, "grip");
3261
+ },
3262
+ children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(EditorIcon, { name: "grip" })
3263
+ }
3264
+ ),
3265
+ column.required ? /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("span", { className: "uix-view-menu__col-toggle", title: labels.required, children: [
3266
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "uix-view-menu__col-box", "aria-hidden": "true" }),
3267
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "uix-view-menu__col-name", children: column.label })
3268
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
3269
+ Checkbox,
3270
+ {
3271
+ className: "uix-view-menu__col-toggle",
3272
+ label: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "uix-view-menu__col-name", children: column.label }),
3273
+ checked: column.visible,
3274
+ disabled: column.disabled,
3275
+ onChange: (event) => onColumnVisibilityChange?.(column.id, event.currentTarget.checked)
3276
+ }
3277
+ ),
3278
+ onReorder && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
3279
+ ColumnRowMenu,
3280
+ {
3281
+ label: fill(labels.rowActions, { label: text }),
3282
+ actions: rowActions(column, index),
3283
+ triggerRef: (el) => {
3284
+ if (el) triggers.current.set(column.id, el);
3285
+ else triggers.current.delete(column.id);
3286
+ }
3287
+ }
3288
+ )
3289
+ ]
3290
+ },
3291
+ column.id
3292
+ );
3293
+ }) })
3294
+ ] }),
3295
+ footer != null && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "uix-view-menu__footer", children: footer }),
3296
+ onReorder && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { role: "status", className: "uix-visually-hidden", children: announcement })
3013
3297
  ] });
3014
3298
  }
3015
3299
  function FilterPopover({ label, type = "text", value, onValueChange, options, applyLabel, clearLabel, onApply, onClear, placeholder }) {
3016
- return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "uix-filter-popover", children: [
3017
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("label", { className: "uix-label", children: [
3018
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { children: label }),
3019
- type === "select" || type === "enum" || type === "boolean" ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("select", { className: "uix-select", value, onChange: (event) => onValueChange(event.currentTarget.value), children: options?.map((option) => /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("option", { value: option.value, children: option.label }, option.value)) }) : /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Input, { type, value, placeholder, onChange: (event) => onValueChange(event.currentTarget.value) })
3300
+ return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "uix-filter-popover", children: [
3301
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("label", { className: "uix-label", children: [
3302
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { children: label }),
3303
+ type === "select" || type === "enum" || type === "boolean" ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("select", { className: "uix-select", value, onChange: (event) => onValueChange(event.currentTarget.value), children: options?.map((option) => /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("option", { value: option.value, children: option.label }, option.value)) }) : /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Input, { type, value, placeholder, onChange: (event) => onValueChange(event.currentTarget.value) })
3020
3304
  ] }),
3021
- /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "uix-filter-popover__actions", children: [
3022
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Button, { type: "button", onClick: onClear, children: clearLabel }),
3023
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Button, { type: "button", variant: "primary", onClick: onApply, children: applyLabel })
3305
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "uix-filter-popover__actions", children: [
3306
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Button, { type: "button", onClick: onClear, children: clearLabel }),
3307
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Button, { type: "button", variant: "primary", onClick: onApply, children: applyLabel })
3024
3308
  ] })
3025
3309
  ] });
3026
3310
  }
3027
3311
  var sameOrder = (a, b) => a.length === b.length && a.every((id, i) => id === b[i]);
3312
+ function dropIndex(rows, dragged, clientY) {
3313
+ let index = 0;
3314
+ for (const row of rows) {
3315
+ if (row === dragged) continue;
3316
+ const box = row.getBoundingClientRect();
3317
+ if (clientY > box.top + box.height / 2) index++;
3318
+ }
3319
+ return index;
3320
+ }
3321
+ function useRowDrag(rowSelector, handlers) {
3322
+ const [dragging, setDragging] = (0, import_react34.useState)(null);
3323
+ const drag = (0, import_react34.useRef)(null);
3324
+ const latest = (0, import_react34.useRef)(handlers);
3325
+ latest.current = handlers;
3326
+ (0, import_react34.useEffect)(() => {
3327
+ if (!dragging) return;
3328
+ const move = (event) => {
3329
+ const current = drag.current;
3330
+ if (!current) return;
3331
+ latest.current.over(current.id, dropIndex(Array.from(current.list.querySelectorAll(`:scope > ${rowSelector}`)), current.row, event.clientY));
3332
+ };
3333
+ const end = () => {
3334
+ const current = drag.current;
3335
+ drag.current = null;
3336
+ setDragging(null);
3337
+ if (current) latest.current.drop(current.id);
3338
+ };
3339
+ window.addEventListener("pointermove", move);
3340
+ window.addEventListener("pointerup", end);
3341
+ window.addEventListener("pointercancel", end);
3342
+ return () => {
3343
+ window.removeEventListener("pointermove", move);
3344
+ window.removeEventListener("pointerup", end);
3345
+ window.removeEventListener("pointercancel", end);
3346
+ };
3347
+ }, [dragging, rowSelector]);
3348
+ const start = (event, id) => {
3349
+ const row = event.currentTarget.closest("li");
3350
+ if (!row?.parentElement) return;
3351
+ event.currentTarget.setPointerCapture?.(event.pointerId);
3352
+ drag.current = { id, list: row.parentElement, row };
3353
+ setDragging(id);
3354
+ };
3355
+ return { dragging, start };
3356
+ }
3028
3357
  function placeId(ids, id, index) {
3029
3358
  const from = ids.indexOf(id);
3030
3359
  const to = Math.max(0, Math.min(index, ids.length - 1));
@@ -3034,13 +3363,13 @@ function placeId(ids, id, index) {
3034
3363
  return next;
3035
3364
  }
3036
3365
  function SavedViewMenu({ items, sections, onSelect, onPinChange, pinLabel, unpinLabel, onReorder, reorderLabel, emptyLabel, actions, footer }) {
3037
- const baseId = (0, import_react33.useId)();
3366
+ const baseId = (0, import_react34.useId)();
3038
3367
  const groups = sections ?? [{ id: void 0, items: items ?? [] }];
3039
- const [draft, setDraft] = (0, import_react33.useState)(null);
3040
- const [dragging, setDragging] = (0, import_react33.useState)(null);
3041
- const dragStart = (0, import_react33.useRef)(null);
3368
+ const [draft, setDraft] = (0, import_react34.useState)(null);
3369
+ const dragStart = (0, import_react34.useRef)(null);
3370
+ const dragGroup = (0, import_react34.useRef)(void 0);
3042
3371
  const orderKey = JSON.stringify(groups.map((group) => [group.id, group.items.map((item) => item.id)]));
3043
- (0, import_react33.useEffect)(() => setDraft(null), [orderKey]);
3372
+ (0, import_react34.useEffect)(() => setDraft(null), [orderKey]);
3044
3373
  const orderOf = (group) => draft && draft.group === group.id ? draft.ids : group.items.map((item) => item.id);
3045
3374
  const move = (group, id, delta) => {
3046
3375
  const current = orderOf(group);
@@ -3049,29 +3378,23 @@ function SavedViewMenu({ items, sections, onSelect, onPinChange, pinLabel, unpin
3049
3378
  setDraft({ group: group.id, ids: next });
3050
3379
  onReorder?.([...next], group.id);
3051
3380
  };
3052
- const dragOver = (event, group, id) => {
3053
- if (dragging !== id) return;
3054
- const rows = Array.from(event.currentTarget.closest("ul")?.querySelectorAll(":scope > .uix-saved-views__row") ?? []);
3055
- let index = rows.length - 1;
3056
- for (let i = 0; i < rows.length; i++) {
3057
- const box = rows[i].getBoundingClientRect();
3058
- if (event.clientY < box.top + box.height / 2) {
3059
- index = i;
3060
- break;
3061
- }
3381
+ const { dragging, start: startDrag } = useRowDrag(".uix-saved-views__row", {
3382
+ over: (id, index) => {
3383
+ const group = groups.find((candidate) => candidate.id === dragGroup.current);
3384
+ if (!group) return;
3385
+ const current = orderOf(group);
3386
+ const next = placeId(current, id, index);
3387
+ if (next !== current) setDraft({ group: group.id, ids: next });
3388
+ },
3389
+ drop: () => {
3390
+ const group = groups.find((candidate) => candidate.id === dragGroup.current);
3391
+ const start = dragStart.current;
3392
+ dragStart.current = null;
3393
+ if (!group) return;
3394
+ const end = orderOf(group);
3395
+ if (start && !sameOrder(start, end)) onReorder?.([...end], group.id);
3062
3396
  }
3063
- const current = orderOf(group);
3064
- const next = placeId(current, id, index);
3065
- if (next !== current) setDraft({ group: group.id, ids: next });
3066
- };
3067
- const drop = (group, id) => {
3068
- if (dragging !== id) return;
3069
- setDragging(null);
3070
- const start = dragStart.current;
3071
- dragStart.current = null;
3072
- const end = orderOf(group);
3073
- if (start && !sameOrder(start, end)) onReorder?.([...end], group.id);
3074
- };
3397
+ });
3075
3398
  const visible = groups.filter((group) => group.items.length > 0);
3076
3399
  const renderRows = (group, groupIndex) => {
3077
3400
  const byId = new Map(group.items.map((item) => [item.id, item]));
@@ -3080,8 +3403,8 @@ function SavedViewMenu({ items, sections, onSelect, onPinChange, pinLabel, unpin
3080
3403
  if (!item) return null;
3081
3404
  const nameId = `${baseId}-${groupIndex}-${index}`;
3082
3405
  const extra = actions?.(item);
3083
- return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("li", { className: "uix-saved-views__row", "data-active": item.active || void 0, "data-dragging": dragging === item.id || void 0, children: [
3084
- onReorder && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
3406
+ return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("li", { className: "uix-saved-views__row", "data-active": item.active || void 0, "data-dragging": dragging === item.id || void 0, children: [
3407
+ onReorder && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
3085
3408
  "button",
3086
3409
  {
3087
3410
  type: "button",
@@ -3091,64 +3414,61 @@ function SavedViewMenu({ items, sections, onSelect, onPinChange, pinLabel, unpin
3091
3414
  onPointerDown: (event) => {
3092
3415
  if (event.button !== 0) return;
3093
3416
  event.preventDefault();
3094
- event.currentTarget.setPointerCapture?.(event.pointerId);
3095
3417
  dragStart.current = orderOf(group);
3096
- setDragging(item.id);
3418
+ dragGroup.current = group.id;
3419
+ startDrag(event, item.id);
3097
3420
  },
3098
- onPointerMove: (event) => dragOver(event, group, item.id),
3099
- onPointerUp: () => drop(group, item.id),
3100
- onPointerCancel: () => drop(group, item.id),
3101
3421
  onKeyDown: (event) => {
3102
3422
  if (event.key !== "ArrowUp" && event.key !== "ArrowDown") return;
3103
3423
  event.preventDefault();
3104
3424
  move(group, item.id, event.key === "ArrowUp" ? -1 : 1);
3105
3425
  },
3106
- children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(EditorIcon, { name: "grip" })
3426
+ children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(EditorIcon, { name: "grip" })
3107
3427
  }
3108
3428
  ),
3109
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("button", { type: "button", id: nameId, className: "uix-menu__item", "data-active": item.active || void 0, "aria-current": item.active || void 0, title: typeof item.label === "string" ? item.label : void 0, onClick: () => onSelect(item.id), children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "uix-saved-views__name", children: item.label }) }),
3110
- onPinChange && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("button", { type: "button", className: "uix-saved-views__pin", "aria-label": item.pinned ? unpinLabel : pinLabel, "data-on": item.pinned || void 0, onClick: () => onPinChange(item.id, !item.pinned), children: "\u2605" }),
3111
- extra != null && extra !== false && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "uix-saved-views__actions", children: extra })
3429
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("button", { type: "button", id: nameId, className: "uix-menu__item", "data-active": item.active || void 0, "aria-current": item.active || void 0, title: typeof item.label === "string" ? item.label : void 0, onClick: () => onSelect(item.id), children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "uix-saved-views__name", children: item.label }) }),
3430
+ onPinChange && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("button", { type: "button", className: "uix-saved-views__pin", "aria-label": item.pinned ? unpinLabel : pinLabel, "data-on": item.pinned || void 0, onClick: () => onPinChange(item.id, !item.pinned), children: "\u2605" }),
3431
+ extra != null && extra !== false && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "uix-saved-views__actions", children: extra })
3112
3432
  ] }, item.id);
3113
3433
  });
3114
3434
  };
3115
- return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("ul", { className: "uix-menu uix-saved-views", "data-dragging": dragging ? "" : void 0, children: [
3116
- visible.length === 0 && emptyLabel != null && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("li", { className: "uix-menu__label", children: emptyLabel }),
3435
+ return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("ul", { className: "uix-menu uix-saved-views", "data-dragging": dragging ? "" : void 0, children: [
3436
+ visible.length === 0 && emptyLabel != null && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("li", { className: "uix-menu__label", children: emptyLabel }),
3117
3437
  sections ? visible.map((group, groupIndex) => {
3118
3438
  const labelId = `${baseId}-section-${groupIndex}`;
3119
- return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("li", { className: "uix-saved-views__section", children: [
3120
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { id: labelId, className: "uix-menu__label uix-saved-views__section-label", children: group.label }),
3121
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("ul", { className: "uix-saved-views__group", "aria-labelledby": labelId, children: renderRows(group, groupIndex) })
3439
+ return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("li", { className: "uix-saved-views__section", children: [
3440
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { id: labelId, className: "uix-menu__label uix-saved-views__section-label", children: group.label }),
3441
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("ul", { className: "uix-saved-views__group", "aria-labelledby": labelId, children: renderRows(group, groupIndex) })
3122
3442
  ] }, group.id);
3123
3443
  }) : visible[0] && renderRows(visible[0], 0),
3124
- footer != null && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("li", { className: "uix-saved-views__footer", children: footer })
3444
+ footer != null && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("li", { className: "uix-saved-views__footer", children: footer })
3125
3445
  ] });
3126
3446
  }
3127
3447
 
3128
3448
  // src/components/Timeline.tsx
3129
- var import_jsx_runtime51 = require("react/jsx-runtime");
3449
+ var import_jsx_runtime52 = require("react/jsx-runtime");
3130
3450
  function Timeline({ children, className, ...props }) {
3131
- return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("ol", { className: cx("uix-timeline", className), ...props, children });
3451
+ return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("ol", { className: cx("uix-timeline", className), ...props, children });
3132
3452
  }
3133
3453
  function TimelineItem({ node, meta, children, className, ...props }) {
3134
- return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("li", { className: cx("uix-timeline__item", className), ...props, children: [
3135
- /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "uix-timeline__rail", "aria-hidden": "true", children: [
3136
- node ?? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "uix-timeline__node" }),
3137
- /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "uix-timeline__line" })
3454
+ return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("li", { className: cx("uix-timeline__item", className), ...props, children: [
3455
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "uix-timeline__rail", "aria-hidden": "true", children: [
3456
+ node ?? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "uix-timeline__node" }),
3457
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "uix-timeline__line" })
3138
3458
  ] }),
3139
- /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "uix-timeline__body", children: [
3140
- meta != null && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "uix-timeline__meta", children: meta }),
3459
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "uix-timeline__body", children: [
3460
+ meta != null && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "uix-timeline__meta", children: meta }),
3141
3461
  children
3142
3462
  ] })
3143
3463
  ] });
3144
3464
  }
3145
3465
 
3146
3466
  // src/components/Pipeline.tsx
3147
- var import_react34 = require("react");
3148
- var import_jsx_runtime52 = require("react/jsx-runtime");
3467
+ var import_react35 = require("react");
3468
+ var import_jsx_runtime53 = require("react/jsx-runtime");
3149
3469
  function Pipeline({ detailed = false, children, className, tabIndex, ...props }) {
3150
- const stages = detailed ? import_react34.Children.map(children, (child) => (0, import_react34.isValidElement)(child) && child.type === PipelineStage ? (0, import_react34.cloneElement)(child, { detailed: child.props.detailed ?? true }) : child) : children;
3151
- return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
3470
+ const stages = detailed ? import_react35.Children.map(children, (child) => (0, import_react35.isValidElement)(child) && child.type === PipelineStage ? (0, import_react35.cloneElement)(child, { detailed: child.props.detailed ?? true }) : child) : children;
3471
+ return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
3152
3472
  "ol",
3153
3473
  {
3154
3474
  className: cx("uix-pipeline", detailed && "uix-pipeline--detailed", className),
@@ -3185,20 +3505,20 @@ function PipelineStage({
3185
3505
  const current = currentProp ?? (state === "active" || state === "current" || state === "running");
3186
3506
  const resolvedStateLabel = stateLabel ?? DEFAULT_STATE_LABELS[state];
3187
3507
  const showDetails = detailed || description != null || meta != null || marker != null;
3188
- return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
3508
+ return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
3189
3509
  "li",
3190
3510
  {
3191
3511
  className: cx("uix-pipeline__stage", className),
3192
3512
  "data-state": state,
3193
3513
  "aria-current": current ? "step" : void 0,
3194
3514
  ...props,
3195
- children: showDetails ? /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_jsx_runtime52.Fragment, { children: [
3196
- /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "uix-pipeline__marker", "aria-hidden": "true", children: marker }),
3197
- /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "uix-pipeline__content", children: [
3198
- /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "uix-pipeline__eyebrow", children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "uix-pipeline__state", children: resolvedStateLabel }) }),
3199
- /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "uix-pipeline__title", children: label }),
3200
- description != null && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "uix-pipeline__description", children: description }),
3201
- meta != null && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "uix-pipeline__meta", children: meta })
3515
+ children: showDetails ? /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(import_jsx_runtime53.Fragment, { children: [
3516
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "uix-pipeline__marker", "aria-hidden": "true", children: marker }),
3517
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "uix-pipeline__content", children: [
3518
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "uix-pipeline__eyebrow", children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "uix-pipeline__state", children: resolvedStateLabel }) }),
3519
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "uix-pipeline__title", children: label }),
3520
+ description != null && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "uix-pipeline__description", children: description }),
3521
+ meta != null && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "uix-pipeline__meta", children: meta })
3202
3522
  ] })
3203
3523
  ] }) : label
3204
3524
  }
@@ -3206,9 +3526,9 @@ function PipelineStage({
3206
3526
  }
3207
3527
 
3208
3528
  // src/components/Flow.tsx
3209
- var import_jsx_runtime53 = require("react/jsx-runtime");
3529
+ var import_jsx_runtime54 = require("react/jsx-runtime");
3210
3530
  function Flow({ variant = "linear", panel = false, children, className, role = "group", ...props }) {
3211
- return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
3531
+ return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
3212
3532
  "div",
3213
3533
  {
3214
3534
  className: cx("uix-flow", `uix-flow--${variant}`, panel && "uix-flow--panel", className),
@@ -3238,64 +3558,30 @@ function FlowNode({
3238
3558
  ...props
3239
3559
  }) {
3240
3560
  const resolvedStateLabel = stateLabel ?? FLOW_STATE_LABELS[state];
3241
- return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: cx("uix-node", `uix-node--${state}`, icon == null && "uix-node--no-icon", wide && "uix-node--wide", className), ...props, children: [
3242
- icon != null && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "uix-node__icon", "aria-hidden": "true", children: icon }),
3243
- /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "uix-node__body", children: [
3244
- eyebrow != null && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "uix-node__eyebrow", children: eyebrow }),
3245
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "uix-node__title", children: title }),
3246
- meta != null && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "uix-node__meta", children: meta }),
3247
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "uix-node__status", children: resolvedStateLabel })
3561
+ return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: cx("uix-node", `uix-node--${state}`, icon == null && "uix-node--no-icon", wide && "uix-node--wide", className), ...props, children: [
3562
+ icon != null && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "uix-node__icon", "aria-hidden": "true", children: icon }),
3563
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "uix-node__body", children: [
3564
+ eyebrow != null && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "uix-node__eyebrow", children: eyebrow }),
3565
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "uix-node__title", children: title }),
3566
+ meta != null && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "uix-node__meta", children: meta }),
3567
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "uix-node__status", children: resolvedStateLabel })
3248
3568
  ] }),
3249
- footer != null && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "uix-node__footer", children: footer })
3569
+ footer != null && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "uix-node__footer", children: footer })
3250
3570
  ] });
3251
3571
  }
3252
3572
 
3253
3573
  // src/components/Prose.tsx
3254
- var import_jsx_runtime54 = require("react/jsx-runtime");
3574
+ var import_jsx_runtime55 = require("react/jsx-runtime");
3255
3575
  function Prose({ children, className, ...props }) {
3256
- return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: cx("uix-prose", className), ...props, children });
3576
+ return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: cx("uix-prose", className), ...props, children });
3257
3577
  }
3258
3578
  function Note({ tone, icon, children, className, ...props }) {
3259
- return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: cx("uix-note", tone && `uix-note--${tone}`, className), ...props, children: [
3260
- icon != null && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "uix-note__icon", children: icon }),
3261
- /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "uix-note__body", children })
3579
+ return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: cx("uix-note", tone && `uix-note--${tone}`, className), ...props, children: [
3580
+ icon != null && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "uix-note__icon", children: icon }),
3581
+ /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "uix-note__body", children })
3262
3582
  ] });
3263
3583
  }
3264
3584
 
3265
- // src/components/Popover.tsx
3266
- var import_react35 = require("react");
3267
- var import_jsx_runtime55 = require("react/jsx-runtime");
3268
- function Popover({
3269
- popover = "auto",
3270
- anchor,
3271
- placement = "bottom-start",
3272
- offset = 6,
3273
- className,
3274
- children,
3275
- ...props
3276
- }) {
3277
- const ref = (0, import_react35.useRef)(null);
3278
- const [open, setOpen] = (0, import_react35.useState)(false);
3279
- const popoverAttr = { popover };
3280
- const reposition = useAnchoredPosition(anchor ?? null, ref, {
3281
- open: open && !!anchor,
3282
- placement,
3283
- offset
3284
- });
3285
- (0, import_react35.useEffect)(() => {
3286
- const el = ref.current;
3287
- if (!el || !anchor) return;
3288
- const sync = () => {
3289
- const isOpen = el.matches(":popover-open");
3290
- if (isOpen) reposition();
3291
- setOpen(isOpen);
3292
- };
3293
- el.addEventListener("toggle", sync);
3294
- return () => el.removeEventListener("toggle", sync);
3295
- }, [anchor, reposition]);
3296
- return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { ref, className: cx("uix-popover", className), ...popoverAttr, ...props, children });
3297
- }
3298
-
3299
3585
  // src/components/CommandPalette.tsx
3300
3586
  var import_react36 = require("react");
3301
3587
  var import_jsx_runtime56 = require("react/jsx-runtime");
@@ -6760,6 +7046,9 @@ var DEFAULT_DIFF_VIEWER_LABELS = {
6760
7046
  acceptIncoming: "Accept incoming",
6761
7047
  keepCurrent: "Keep current",
6762
7048
  markPending: "Mark pending",
7049
+ acceptIncomingFor: "Accept incoming for {path}",
7050
+ keepCurrentFor: "Keep current for {path}",
7051
+ markPendingFor: "Mark pending for {path}",
6763
7052
  resolutionAccept: "accepted",
6764
7053
  resolutionSkip: "kept",
6765
7054
  resolutionPending: "pending",
@@ -6776,10 +7065,12 @@ function DiffViewer({
6776
7065
  resolutions: controlledResolutions,
6777
7066
  onResolutionChange,
6778
7067
  labels: labelOverrides,
7068
+ controlSize = "sm",
6779
7069
  className
6780
7070
  }) {
6781
7071
  const labels = { ...DEFAULT_DIFF_VIEWER_LABELS, ...labelOverrides };
6782
7072
  const resolutionLabel = { accept: labels.resolutionAccept, skip: labels.resolutionSkip, pending: labels.resolutionPending };
7073
+ const buttonSize = controlSize === "md" ? void 0 : `uix-btn--${controlSize}`;
6783
7074
  const id = (0, import_react49.useId)();
6784
7075
  const entries = (0, import_react49.useMemo)(() => providedEntries ?? buildThreeWayDiff(base, current, incoming), [providedEntries, base, current, incoming]);
6785
7076
  const [internalResolutions, setInternalResolutions] = (0, import_react49.useState)({});
@@ -6793,8 +7084,8 @@ function DiffViewer({
6793
7084
  /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("h3", { children: labels.noDifferences }),
6794
7085
  /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("p", { children: labels.noDifferencesDetail })
6795
7086
  ] });
6796
- return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("section", { className: cx("uix-diff-viewer", className), "aria-label": labels.region, children: [
6797
- /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: "uix-diff-viewer__summary", "aria-label": labels.summary, children: [
7087
+ return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("section", { className: cx("uix-diff-viewer", className), "aria-label": labels.region, "data-control-size": controlSize, children: [
7088
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: "uix-diff-viewer__summary", role: "group", "aria-label": labels.summary, children: [
6798
7089
  GROUPS.map((kind) => /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("span", { children: [
6799
7090
  /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("b", { children: summary[kind] }),
6800
7091
  " ",
@@ -6831,10 +7122,10 @@ function DiffViewer({
6831
7122
  /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("strong", { children: labels[version] }),
6832
7123
  /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("pre", { children: renderValue(entry[version], labels.notPresent) })
6833
7124
  ] }, version)) }),
6834
- /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: "uix-diff-viewer__actions", "aria-label": fillLabel(labels.resolve, { path: entry.path }), children: [
6835
- /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("button", { type: "button", className: "uix-btn uix-btn--primary uix-btn--sm", "aria-pressed": resolution === "accept", onClick: () => resolve2(entry.path, "accept"), children: labels.acceptIncoming }),
6836
- /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("button", { type: "button", className: "uix-btn uix-btn--secondary uix-btn--sm", "aria-pressed": resolution === "skip", onClick: () => resolve2(entry.path, "skip"), children: labels.keepCurrent }),
6837
- /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("button", { type: "button", className: "uix-btn uix-btn--ghost uix-btn--sm", "aria-pressed": resolution === "pending", onClick: () => resolve2(entry.path, "pending"), children: labels.markPending })
7125
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: "uix-diff-viewer__actions", role: "group", "aria-label": fillLabel(labels.resolve, { path: entry.path }), children: [
7126
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("button", { type: "button", className: cx("uix-btn uix-btn--primary", buttonSize), "aria-label": fillLabel(labels.acceptIncomingFor, { path: entry.path }), "aria-pressed": resolution === "accept", onClick: () => resolve2(entry.path, "accept"), children: labels.acceptIncoming }),
7127
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("button", { type: "button", className: cx("uix-btn uix-btn--secondary", buttonSize), "aria-label": fillLabel(labels.keepCurrentFor, { path: entry.path }), "aria-pressed": resolution === "skip", onClick: () => resolve2(entry.path, "skip"), children: labels.keepCurrent }),
7128
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("button", { type: "button", className: cx("uix-btn uix-btn--ghost", buttonSize), "aria-label": fillLabel(labels.markPendingFor, { path: entry.path }), "aria-pressed": resolution === "pending", onClick: () => resolve2(entry.path, "pending"), children: labels.markPending })
6838
7129
  ] })
6839
7130
  ] }, entry.path);
6840
7131
  })