torch-glare 2.5.4 → 2.5.5

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.
Files changed (34) hide show
  1. package/apps/lib/components/BadgeField.tsx +70 -66
  2. package/apps/lib/components/Card.tsx +2 -1
  3. package/apps/lib/components/ContextMenu.tsx +65 -22
  4. package/apps/lib/components/DataViews/context.ts +2 -2
  5. package/apps/lib/components/DataViews/data-views.tsx +3 -3
  6. package/apps/lib/components/DataViews/filters/filters.tsx +0 -2
  7. package/apps/lib/components/DataViews/views/table-view.tsx +184 -176
  8. package/apps/lib/components/DropdownMenu.tsx +65 -22
  9. package/apps/lib/components/FormBuilder/fields/FieldShell.tsx +19 -5
  10. package/apps/lib/components/FormBuilder/types.ts +16 -0
  11. package/apps/lib/components/FormRenderer/form-renderer.tsx +16 -5
  12. package/apps/lib/components/HeaderBar.tsx +51 -53
  13. package/apps/lib/components/InputField.tsx +46 -47
  14. package/apps/lib/components/Popover.tsx +23 -9
  15. package/apps/lib/components/SearchableSelect.tsx +10 -6
  16. package/apps/lib/components/SearchableTree.tsx +23 -6
  17. package/apps/lib/components/SearchableTreeDialog.tsx +11 -1
  18. package/apps/lib/components/Select.tsx +56 -48
  19. package/apps/lib/components/SlideDatePicker.tsx +5 -7
  20. package/apps/lib/components/TabSwitch.tsx +18 -12
  21. package/apps/lib/layouts/FieldSection.tsx +28 -2
  22. package/apps/lib/registry.json +1 -2
  23. package/docs/components/badge-field.md +4 -4
  24. package/docs/components/context-menu.md +3 -1
  25. package/docs/components/data-views/examples/filters.md +0 -1
  26. package/docs/components/data-views/index.md +1 -17
  27. package/docs/components/dropdown-menu.md +3 -0
  28. package/docs/components/form-builder.md +27 -1
  29. package/docs/components/header-bar.md +3 -2
  30. package/docs/components/input-field.md +3 -3
  31. package/docs/components/select.md +1 -1
  32. package/docs/migration/changelog.md +13 -0
  33. package/package.json +1 -1
  34. package/apps/lib/components/DataViews/filters/summary.tsx +0 -65
@@ -9,7 +9,7 @@ import {
9
9
  FocusEvent,
10
10
  } from "react";
11
11
  import { cn } from "../utils/cn";
12
- import { Tooltip, ToolTipSide } from "./Tooltip";
12
+ import { ToolTipSide } from "./Tooltip";
13
13
  import { Popover, PopoverContent, PopoverTrigger } from "./Popover";
14
14
  import { Themes } from "../utils/types";
15
15
  import { Icon, Input, Group, Trilling } from "./Input";
@@ -22,8 +22,13 @@ interface Props extends Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "va
22
22
  size?: "XS" | "S" | "M"; // this is used to change the size style of the component
23
23
  variant?: "SystemStyle" | "PresentationStyle";
24
24
  icon?: ReactNode; // to add left side icon if you pass it
25
- errorMessage?: string; // to show tooltip component when error_message not null
25
+ /** Marks the field invalid: any non-undefined value turns on the negative border. */
26
+ errorMessage?: string;
26
27
  onTable?: boolean; // to change the border style of the component when it is on table
28
+ /**
29
+ * @deprecated Ignored. The error tooltip was removed — an invalid field is shown by its negative
30
+ * border alone. Kept so existing call sites keep compiling; it will go in a future major.
31
+ */
27
32
  toolTipSide?: ToolTipSide;
28
33
  label?: string;
29
34
  required?: boolean;
@@ -45,6 +50,7 @@ export const BadgeField = forwardRef<HTMLInputElement, Props>(
45
50
  errorMessage,
46
51
  onTable,
47
52
  variant = "PresentationStyle",
53
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars -- deprecated no-op, destructured to keep it out of the {...props} spread
48
54
  toolTipSide,
49
55
  className,
50
56
  actionButton,
@@ -102,75 +108,73 @@ export const BadgeField = forwardRef<HTMLInputElement, Props>(
102
108
 
103
109
  return (
104
110
  <Popover open={isPopoverOpen}>
105
- <Tooltip toolTipSide={toolTipSide} open={errorMessage !== undefined} text={errorMessage}>
106
- <PopoverTrigger asChild>
107
- <Group
108
- dir={dir}
109
- error={errorMessage !== undefined}
110
- onTable={onTable}
111
- data-theme={theme}
112
- variant={variant}
113
- tabIndex={isPopoverOpen ? 0 : -1}
114
- onKeyDown={handleKeyDown}
115
- size={size === "XS" ? "S" : size}
116
- ref={inputGroupRef}
117
- onFocus={(e: FocusEvent<HTMLDivElement>) => {
118
- setDropDownListWidth(e.currentTarget.offsetWidth);
111
+ <PopoverTrigger asChild>
112
+ <Group
113
+ dir={dir}
114
+ error={errorMessage !== undefined}
115
+ onTable={onTable}
116
+ data-theme={theme}
117
+ variant={variant}
118
+ tabIndex={isPopoverOpen ? 0 : -1}
119
+ onKeyDown={handleKeyDown}
120
+ size={size === "XS" ? "S" : size}
121
+ ref={inputGroupRef}
122
+ onFocus={(e: FocusEvent<HTMLDivElement>) => {
123
+ setDropDownListWidth(e.currentTarget.offsetWidth);
124
+ }}
125
+ className={cn(
126
+ "flex gap-1 flex-row w-full relative p-1 flex-nowrap overflow-hidden justify-end items-center",
127
+ {
128
+ "flex-wrap justify-start": isPopoverOpen,
129
+ "h-fit": isPopoverOpen,
130
+ },
131
+ className,
132
+ )}
133
+ >
134
+ {icon && <Icon>{icon}</Icon>}
135
+
136
+ {selectedTagsStack.map((tag, index) => (
137
+ <Badge
138
+ key={tag.id}
139
+ size={size}
140
+ color={tag.variant as VariantProps<typeof badgeStyles>["color"]}
141
+ label={tag.name}
142
+ isClosable={true}
143
+ onClose={() => handleUnselectTag(tag.id)}
144
+ className={focusedTagIndex === index ? "ring-2 ring-blue-500" : ""}
145
+ tabIndex={focusedTagIndex === index ? 0 : -1}
146
+ />
147
+ ))}
148
+
149
+ <Input
150
+ {...props}
151
+ value={searchTags}
152
+ onChange={(e) => {
153
+ filterTagsBySearch(e.target.value);
119
154
  }}
155
+ onFocus={(e) => {
156
+ props.onFocus?.(e);
157
+ setFocusedTagIndex(null);
158
+ setIsPopoverOpen(true);
159
+ }}
160
+ ref={inputRef}
120
161
  className={cn(
121
- "flex gap-1 flex-row w-full relative p-1 flex-nowrap overflow-hidden justify-end items-center",
162
+ "min-w-[100px] w-full", // Added w-full to Input
122
163
  {
123
- "flex-wrap justify-start": isPopoverOpen,
124
- "h-fit": isPopoverOpen,
164
+ "!h-[18px]": size === "XS",
165
+ "!h-[22px]": size === "S",
166
+ "!h-[24px]": size === "M",
125
167
  },
126
- className,
127
- )}
128
- >
129
- {icon && <Icon>{icon}</Icon>}
130
-
131
- {selectedTagsStack.map((tag, index) => (
132
- <Badge
133
- key={tag.id}
134
- size={size}
135
- color={tag.variant as VariantProps<typeof badgeStyles>["color"]}
136
- label={tag.name}
137
- isClosable={true}
138
- onClose={() => handleUnselectTag(tag.id)}
139
- className={focusedTagIndex === index ? "ring-2 ring-blue-500" : ""}
140
- tabIndex={focusedTagIndex === index ? 0 : -1}
141
- />
142
- ))}
143
-
144
- <Input
145
- {...props}
146
- value={searchTags}
147
- onChange={(e) => {
148
- filterTagsBySearch(e.target.value);
149
- }}
150
- onFocus={(e) => {
151
- props.onFocus?.(e);
152
- setFocusedTagIndex(null);
153
- setIsPopoverOpen(true);
154
- }}
155
- ref={inputRef}
156
- className={cn(
157
- "min-w-[100px] w-full", // Added w-full to Input
158
- {
159
- "!h-[18px]": size === "XS",
160
- "!h-[22px]": size === "S",
161
- "!h-[24px]": size === "M",
162
- },
163
- )}
164
- />
165
- {actionButton && (
166
- <Trilling className="py-0">
167
- {/* Keep the ActionButton right aligned */}
168
- {actionButton}
169
- </Trilling>
170
168
  )}
171
- </Group>
172
- </PopoverTrigger>
173
- </Tooltip>
169
+ />
170
+ {actionButton && (
171
+ <Trilling className="py-0">
172
+ {/* Keep the ActionButton right aligned */}
173
+ {actionButton}
174
+ </Trilling>
175
+ )}
176
+ </Group>
177
+ </PopoverTrigger>
174
178
 
175
179
  <PopoverContent
176
180
  dir={dir}
@@ -6,7 +6,8 @@ import { cva, type VariantProps } from "class-variance-authority";
6
6
  export const cardStyles = cva(
7
7
  [
8
8
  "flex flex-col justify-start",
9
- "gap-2 rounded-[12px] border",
9
+ // `radius/xl` is 12px — the same value this literal had, now taken from the shared scale.
10
+ "gap-2 rounded-radius-xl border",
10
11
  "transition-all ease-in-out duration-200",
11
12
  "p-[16px]",
12
13
  "border-border-presentation-global-primary",
@@ -139,16 +139,27 @@ const ContextMenuContent = React.forwardRef<
139
139
  data-theme={theme}
140
140
  ref={ref}
141
141
  collisionPadding={collisionPadding}
142
- // Cap at maxHeight, but never exceed the space Radix has after collision
143
- // handling. The menu scrolls (overflow on the surface) past this height.
142
+ // Cap at maxHeight, but never exceed the space Radix has after collision handling. The
143
+ // `100vh` fallback is load-bearing: an undefined var invalidates the whole `min()`, so
144
+ // `max-height` would resolve to `none` and the panel — which no longer scrolls itself —
145
+ // would grow unbounded with its rows clipped and unreachable.
144
146
  style={{
145
- maxHeight: `min(${maxHeight}px, var(--radix-context-menu-content-available-height))`,
147
+ maxHeight: `min(${maxHeight}px, var(--radix-context-menu-content-available-height, 100vh))`,
146
148
  ...style,
147
149
  }}
148
150
  className={cn(menuContentStyles({ variant }), className)}
149
151
  {...props}
150
152
  >
151
- {autoGroup ? autoGroupChildren(children) : children}
153
+ {/* Dedicated scroll viewport, matching Select's: the cap lives on the panel above, this
154
+ fills what is left and scrolls. `min-h-0` is what makes it work — a flex item will not
155
+ shrink below its content, so without it the list grows past the panel and the panel's
156
+ `overflow-hidden` just clips the rows with no scrollbar.
157
+
158
+ `gap-1` is re-declared here because `autoGroupChildren` emits several siblings (a group,
159
+ a label, a separator…) and this is now the element they are siblings within. */}
160
+ <div className="flex flex-col gap-1 flex-1 min-h-0 overflow-y-auto overflow-x-hidden rounded-[10px] scrollbar-hide">
161
+ {autoGroup ? autoGroupChildren(children) : children}
162
+ </div>
152
163
  </ContextMenuPrimitive.Content>
153
164
  </ContextMenuPrimitive.Portal>
154
165
  ),
@@ -180,18 +191,45 @@ const ContextMenuSubContent = React.forwardRef<
180
191
  React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubContent> & {
181
192
  variant?: "PresentationStyle";
182
193
  autoGroup?: boolean;
194
+ maxHeight?: number;
183
195
  }
184
- >(({ className, variant = "PresentationStyle", autoGroup = true, children, ...props }, ref) => (
185
- <ContextMenuPrimitive.Portal>
186
- <ContextMenuPrimitive.SubContent
187
- ref={ref}
188
- className={cn(menuContentStyles({ variant }), className)}
189
- {...props}
190
- >
191
- {autoGroup ? autoGroupChildren(children) : children}
192
- </ContextMenuPrimitive.SubContent>
193
- </ContextMenuPrimitive.Portal>
194
- ));
196
+ >(
197
+ (
198
+ {
199
+ className,
200
+ variant = "PresentationStyle",
201
+ autoGroup = true,
202
+ collisionPadding = 8,
203
+ maxHeight = 320,
204
+ // Destructured out of `{...props}` so the spread below cannot clobber the cap. Radix
205
+ // re-publishes the namespaced available-height var on SubContent, so the same expression
206
+ // Content uses works here unchanged.
207
+ style,
208
+ children,
209
+ ...props
210
+ },
211
+ ref,
212
+ ) => (
213
+ <ContextMenuPrimitive.Portal>
214
+ <ContextMenuPrimitive.SubContent
215
+ ref={ref}
216
+ collisionPadding={collisionPadding}
217
+ style={{
218
+ maxHeight: `min(${maxHeight}px, var(--radix-context-menu-content-available-height, 100vh))`,
219
+ ...style,
220
+ }}
221
+ className={cn(menuContentStyles({ variant }), className)}
222
+ {...props}
223
+ >
224
+ {/* Same panel-clips / viewport-scrolls split as Content. A submenu is a peer surface, so it
225
+ shares the 320px default rather than getting a smaller one of its own. */}
226
+ <div className="flex flex-col gap-1 flex-1 min-h-0 overflow-y-auto overflow-x-hidden rounded-[10px] scrollbar-hide">
227
+ {autoGroup ? autoGroupChildren(children) : children}
228
+ </div>
229
+ </ContextMenuPrimitive.SubContent>
230
+ </ContextMenuPrimitive.Portal>
231
+ ),
232
+ );
195
233
  ContextMenuSubContent.displayName = ContextMenuPrimitive.SubContent.displayName;
196
234
 
197
235
  const ContextMenuItem = React.forwardRef<
@@ -487,16 +525,19 @@ const menuContentStyles = cva(
487
525
  "rounded-[14px]",
488
526
  "min-w-[240px]",
489
527
  "outline-none",
490
- "overflow-y-auto",
491
- "overflow-x-hidden",
528
+ // The panel clips; the inner viewport below owns scrolling. Height is capped inline on the
529
+ // Content element from `min(maxHeight, available-height)` — no `max-h-*` class here on
530
+ // purpose, so the inline value governs.
531
+ "overflow-hidden",
492
532
  // Only animate the OPEN (enter) state. An exit animation on [data-state=closed]
493
533
  // holds the old DOM node during close, which breaks close/reposition on a
494
534
  // second right-click (Radix issue #2572).
495
535
  "data-[state=open]:animate-in",
496
536
  "data-[state=open]:fade-in-0",
497
- "scrollbar-hide",
498
537
  "backdrop-blur-[21px]",
499
- "flex gap-1 flex-col",
538
+ // No `gap` here: the panel has exactly one child (the scroll viewport), so a gap between
539
+ // siblings has nothing to act on. The 4px between groups/labels lives on that viewport.
540
+ "flex flex-col",
500
541
  ],
501
542
  {
502
543
  variants: {
@@ -506,9 +547,11 @@ const menuContentStyles = cva(
506
547
  "shadow-[0_0_32px_2px_rgba(0,0,0,0.20),0_0_48px_2px_rgba(0,0,0,0.05)]",
507
548
  ],
508
549
  },
509
- defaultVariants: {
510
- variant: "PresentationStyle",
511
- },
550
+ },
551
+ // Was nested inside `variants`, where cva reads it as a variant group named
552
+ // "defaultVariants" and no default is ever applied. `menuGroupStyles` below has it right.
553
+ defaultVariants: {
554
+ variant: "PresentationStyle",
512
555
  },
513
556
  },
514
557
  );
@@ -129,8 +129,8 @@ export interface FiltersContextValue {
129
129
  setFilters: (filters: FilterState) => void;
130
130
  /**
131
131
  * What each filter control is, read off the `FormBuilder` children of `DataViews.Filters` —
132
- * never derived from the rows. The root collects them as well, so `Filters.Summary` can label a
133
- * chip even when it is rendered outside `Filters`.
132
+ * never derived from the rows. The root collects them as well, so a consumer such as
133
+ * `Filters.Presets` can resolve a field by path even when it is rendered outside `Filters`.
134
134
  */
135
135
  filterFields: readonly FilterFieldDescriptor[];
136
136
  }
@@ -264,9 +264,9 @@ function DataViewsRoot({
264
264
  [isPanelOpen, setPanelOpen],
265
265
  );
266
266
 
267
- // The descriptors as well as the value: `Filters.Summary` needs labels for its chips, and it is
268
- // routinely rendered outside `Filters` — above the table, in a toolbar — where it cannot reach
269
- // the context `Filters` provides to its own children.
267
+ // The descriptors as well as the value: a consumer such as `Filters.Presets` resolves a field by
268
+ // path, and may be rendered outside `Filters` — above the table, in a toolbar — where it cannot
269
+ // reach the context `Filters` provides to its own children.
270
270
  const filterFields = useMemo(() => collectFilterFields(children), [children]);
271
271
 
272
272
  const setFilters = useCallback(
@@ -10,7 +10,6 @@ import { FiltersContext, useDataViewsFilters } from "../context";
10
10
  import { collectFilterFields, renderFields } from "./children";
11
11
  import { Custom } from "./custom";
12
12
  import { Presets } from "./presets";
13
- import { Summary } from "./summary";
14
13
  import { Sync } from "./sync";
15
14
  import { toFormValues } from "./values";
16
15
  import type { FiltersProps } from "../types";
@@ -155,5 +154,4 @@ function FiltersRoot({
155
154
  export const Filters = Object.assign(FiltersRoot, {
156
155
  Presets,
157
156
  Custom,
158
- Summary,
159
157
  });