torch-glare 2.1.7 → 2.2.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.
@@ -15,6 +15,7 @@ import { Icon, Input, Group, Trilling } from "./Input";
15
15
  import { useClickOutside } from "../hooks/useClickOutside";
16
16
  import { Badge } from "./Badge";
17
17
  import { Tag, useTagSelection } from "../hooks/useTagSelection";
18
+ import { cva } from "class-variance-authority";
18
19
 
19
20
  interface Props
20
21
  extends Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "variant"> {
@@ -30,6 +31,7 @@ interface Props
30
31
  actionButton?: ReactNode;
31
32
  tags: Tag[];
32
33
  onValueChange?: (tags: Tag[]) => void;
34
+ addLabel?: string
33
35
  }
34
36
 
35
37
  export const BadgeField = forwardRef<HTMLInputElement, Props>(
@@ -47,6 +49,8 @@ export const BadgeField = forwardRef<HTMLInputElement, Props>(
47
49
  actionButton,
48
50
  theme,
49
51
  tags,
52
+ addLabel = "add",
53
+ dir,
50
54
  children,
51
55
  ...props
52
56
  },
@@ -98,6 +102,7 @@ export const BadgeField = forwardRef<HTMLInputElement, Props>(
98
102
  >
99
103
  <PopoverTrigger asChild>
100
104
  <Group
105
+ dir={dir}
101
106
  error={errorMessage !== undefined}
102
107
  onTable={onTable}
103
108
  data-theme={theme}
@@ -167,37 +172,151 @@ export const BadgeField = forwardRef<HTMLInputElement, Props>(
167
172
  </Tooltip>
168
173
 
169
174
  <PopoverContent
175
+ dir={dir}
170
176
  data-theme={theme}
171
177
  ref={popoverContentRef}
172
178
  style={{ width: dropDownListWidth }}
173
179
  variant={variant}
174
180
  onKeyDown={handleKeyDown}
175
- className="p-2 flex flex-wrap gap-1"
181
+ className={cn(menuContentContinerStyles({ variant: "PresentationStyle" }), "p-1 rounded-[17px]")}
182
+
183
+ // Reuse the DropdownMenu surface so the list matches the menu design.
176
184
  >
177
- <>
185
+ <div
186
+ className={cn(menuContentStyles({ variant: "PresentationStyle" }), "p-0")}
187
+
188
+ >
178
189
  {filteredTags.length > 0 ? (
179
190
  filteredTags.map((tag, index) => (
180
- <Badge
191
+ <button
192
+ type="button"
181
193
  key={tag.id}
182
- size={size}
183
- color={tag.variant as any}
184
- label={tag.name}
185
194
  onClick={() => handleSelectTag(tag.id)}
186
- className={`outline-none ${focusedPopoverIndex === index ? "ring-2 ring-blue-500" : ""}`}
195
+ data-highlighted={focusedPopoverIndex === index ? "" : undefined}
187
196
  tabIndex={focusedPopoverIndex === index ? 0 : -1}
188
- />
197
+ className={cn(
198
+ MenuItemStyles({ variant: "Default", size: "M" }),
199
+ "w-full p-1 shrink-0 h-fit"
200
+ )}
201
+ >
202
+ <div className="flex items-center justify-between w-full">
203
+ <Badge size={size} badgeStyle={"solid"} color={tag.variant as any} label={tag.name} />
204
+
205
+ <div className="flex group-hover:opacity-100 opacity-0 px-[4px] py-[2px] items-center rounded-[6px] bg-white-50">
206
+ <svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12" className="rtl:rotate-180" fill="none">
207
+ <path d="M3.91422 5.49995H10V6.49995H3.91422L6.5962 9.1819L5.8891 9.889L2 5.99995L5.8891 2.11084L6.5962 2.81794L3.91422 5.49995Z" fill="black" />
208
+ </svg>
209
+ <p className="text-black-1000 text-right text-[12px] font-[510] leading-[148%]">
210
+ {addLabel}
211
+ </p>
212
+ </div>
213
+ </div>
214
+ </button>
189
215
  ))
190
216
  ) : (
191
- <div className="text-sm text-gray-500 py-1 px-2">
217
+ <div className="px-3 py-2 typography-body-small-regular text-white-alpha-75">
192
218
  {tags.length === 0
193
219
  ? "All tags selected"
194
220
  : "No matching tags found"}
195
221
  </div>
196
- )}
197
- </>
222
+ )} </div>
198
223
  </PopoverContent>
199
- </Popover>
224
+ </Popover >
200
225
  );
201
226
  }
202
227
  );
203
228
  BadgeField.displayName = "BadgeField";
229
+
230
+ // Local copies of the menu surface styles so the dropdown list matches the
231
+ // DropdownMenu/ContextMenu design (self-contained — no shared module).
232
+ const menuContentStyles = cva(
233
+ [
234
+ "rounded-[10px]",
235
+ "min-w-[240px]",
236
+ "outline-none",
237
+ "overflow-scroll",
238
+ "data-[state=open]:animate-in",
239
+ "data-[state=open]:fade-in-0",
240
+ "overflow-x-hidden",
241
+ "scrollbar-hide",
242
+ "flex gap-[1px] flex-col",
243
+ ],
244
+ {
245
+ variants: {
246
+ variant: {
247
+ PresentationStyle: [
248
+ ],
249
+ },
250
+ defaultVariants: {
251
+ variant: "PresentationStyle",
252
+ },
253
+ },
254
+ }
255
+ );
256
+ const menuContentContinerStyles = cva(
257
+ [
258
+ "rounded-[14px]",
259
+ "min-w-[240px]",
260
+ "outline-none",
261
+ "overflow-scroll",
262
+ "data-[state=open]:animate-in",
263
+ "data-[state=open]:fade-in-0",
264
+ "overflow-x-hidden",
265
+ "scrollbar-hide",
266
+ "backdrop-blur-[21px]",
267
+ "flex gap-1 flex-col",
268
+ ],
269
+ {
270
+ variants: {
271
+ variant: {
272
+ PresentationStyle: [
273
+ "bg-[rgba(61,64,69,0.72)]",
274
+ "shadow-[0_0_32px_2px_rgba(0,0,0,0.20),0_0_48px_2px_rgba(0,0,0,0.05)]",
275
+ ],
276
+ },
277
+ defaultVariants: {
278
+ variant: "PresentationStyle",
279
+ },
280
+ },
281
+ }
282
+ );
283
+
284
+ const MenuItemStyles = cva(
285
+ [
286
+ "text-content-presentation-global-primary-light typography-body-medium-regular",
287
+ "outline-none",
288
+ "border",
289
+ "border-transparent",
290
+ "flex",
291
+ "items-center",
292
+ "justify-start",
293
+ "text-overflow",
294
+ "overflow-hidden",
295
+ "transition-all",
296
+ "bg-[rgba(184,192,204,0.36)]",
297
+ "ease-in-out",
298
+ "duration-300",
299
+ "flex",
300
+ "p-1",
301
+ "w-full",
302
+ "items-center ",
303
+ "group",
304
+ ],
305
+ {
306
+ variants: {
307
+ variant: {
308
+ Default: [
309
+ "hover:bg-[rgba(184,192,204,0.50)] ",
310
+ ],
311
+ },
312
+ size: {
313
+ S: ["typography-body-small-regular", "h-[24px]"],
314
+ M: ["typography-body-medium-regular", "h-[32px]"],
315
+ },
316
+ defaultVariants: {
317
+ variant: "Default",
318
+ size: "M",
319
+ },
320
+ },
321
+ }
322
+ );