@glasshome/ui 1.21.1 → 1.21.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.
Files changed (145) hide show
  1. package/dist/index.d.ts +1 -1
  2. package/dist/index.js +1 -1
  3. package/dist/lib/use-is-mobile.d.ts +3 -1
  4. package/dist/solid/index.d.ts +9 -9
  5. package/dist/solid/index.js +5431 -5424
  6. package/dist/{utils-CMk7R3zM.js → utils-D5blHO4O.js} +624 -622
  7. package/package.json +128 -126
  8. package/scripts/check-gallery.ts +142 -142
  9. package/scripts/check-pack.ts +13 -13
  10. package/scripts/check-structural-classes.ts +20 -20
  11. package/scripts/check-tokens.ts +27 -27
  12. package/scripts/check-ui-drift.mjs +103 -103
  13. package/src/index.ts +75 -80
  14. package/src/lib/alert-tones.ts +41 -41
  15. package/src/lib/anchor-placement.ts +21 -21
  16. package/src/lib/button-variants.ts +28 -28
  17. package/src/lib/card-classes.ts +9 -9
  18. package/src/lib/carousel-classes.ts +14 -14
  19. package/src/lib/glass-tone.ts +11 -11
  20. package/src/lib/input-classes.ts +6 -6
  21. package/src/lib/layers.ts +4 -4
  22. package/src/lib/logo-lockup.ts +8 -8
  23. package/src/lib/menu-classes.ts +2 -2
  24. package/src/lib/motion-classes.ts +8 -8
  25. package/src/lib/motion-window.ts +24 -24
  26. package/src/lib/overlay-classes.ts +6 -6
  27. package/src/lib/pill-classes.ts +3 -3
  28. package/src/lib/position-bar-classes.ts +1 -1
  29. package/src/lib/spotlight-geometry.ts +67 -67
  30. package/src/lib/thumb-classes.ts +2 -2
  31. package/src/lib/tier-badge.ts +16 -16
  32. package/src/lib/use-is-mobile.ts +17 -14
  33. package/src/lib/utils.ts +1 -1
  34. package/src/solid/accordion.tsx +41 -41
  35. package/src/solid/alert-dialog.tsx +95 -95
  36. package/src/solid/alert.tsx +88 -88
  37. package/src/solid/area-picker.tsx +204 -204
  38. package/src/solid/aspect-ratio.tsx +13 -13
  39. package/src/solid/avatar.tsx +27 -27
  40. package/src/solid/badge.tsx +49 -49
  41. package/src/solid/bottom-sheet/arbitration.ts +22 -22
  42. package/src/solid/bottom-sheet/bottom-sheet.tsx +394 -394
  43. package/src/solid/bottom-sheet/drag-controller.ts +201 -201
  44. package/src/solid/bottom-sheet/focus-trap.ts +51 -47
  45. package/src/solid/bottom-sheet/index.ts +12 -12
  46. package/src/solid/bottom-sheet/keyboard.ts +25 -25
  47. package/src/solid/bottom-sheet/scroll-lock.ts +46 -46
  48. package/src/solid/bottom-sheet/state-machine.ts +28 -28
  49. package/src/solid/bottom-sheet/velocity.ts +29 -29
  50. package/src/solid/breadcrumb.tsx +76 -76
  51. package/src/solid/button-group.tsx +46 -46
  52. package/src/solid/button.tsx +19 -19
  53. package/src/solid/card.tsx +67 -67
  54. package/src/solid/carousel.tsx +246 -246
  55. package/src/solid/charts.tsx +253 -253
  56. package/src/solid/checkbox.tsx +51 -51
  57. package/src/solid/collapsible.tsx +22 -22
  58. package/src/solid/color-disc.tsx +213 -213
  59. package/src/solid/color-slider.tsx +81 -81
  60. package/src/solid/color-wheel.tsx +61 -61
  61. package/src/solid/context-menu.tsx +63 -63
  62. package/src/solid/copy-button.tsx +31 -31
  63. package/src/solid/count-pill.tsx +11 -11
  64. package/src/solid/dashboard-preview.tsx +104 -104
  65. package/src/solid/data-table.tsx +228 -228
  66. package/src/solid/dialog-parts.tsx +127 -127
  67. package/src/solid/dialog.tsx +113 -113
  68. package/src/solid/dock-paging.ts +9 -9
  69. package/src/solid/dock.tsx +339 -339
  70. package/src/solid/docked-panel.tsx +35 -35
  71. package/src/solid/dropdown-menu.tsx +77 -77
  72. package/src/solid/empty.tsx +70 -70
  73. package/src/solid/entity-data.ts +38 -38
  74. package/src/solid/entity-selector.tsx +634 -634
  75. package/src/solid/field.tsx +205 -205
  76. package/src/solid/form.tsx +159 -159
  77. package/src/solid/hero-action.tsx +85 -85
  78. package/src/solid/hover-card.tsx +11 -11
  79. package/src/solid/icon-picker.tsx +401 -401
  80. package/src/solid/icon.tsx +101 -78
  81. package/src/solid/image-picker.tsx +416 -414
  82. package/src/solid/index.ts +265 -304
  83. package/src/solid/input-group.tsx +123 -123
  84. package/src/solid/input-otp.tsx +143 -143
  85. package/src/solid/input.tsx +4 -4
  86. package/src/solid/item.tsx +130 -130
  87. package/src/solid/kbd.tsx +20 -20
  88. package/src/solid/label.tsx +12 -12
  89. package/src/solid/list-reorder.ts +122 -122
  90. package/src/solid/logo.tsx +60 -60
  91. package/src/solid/media-copy.ts +21 -21
  92. package/src/solid/media-store.ts +56 -56
  93. package/src/solid/media-tile.tsx +85 -85
  94. package/src/solid/menu-parts.tsx +164 -164
  95. package/src/solid/number-field.tsx +56 -56
  96. package/src/solid/option-card.tsx +164 -164
  97. package/src/solid/ornament.tsx +43 -43
  98. package/src/solid/overlay.tsx +4 -4
  99. package/src/solid/page-header.tsx +75 -75
  100. package/src/solid/pagination.tsx +80 -80
  101. package/src/solid/password-input.tsx +51 -51
  102. package/src/solid/picker-row.tsx +83 -83
  103. package/src/solid/picker-search.tsx +65 -63
  104. package/src/solid/picker-trigger.tsx +59 -57
  105. package/src/solid/popover.tsx +54 -54
  106. package/src/solid/preview-tile.tsx +67 -67
  107. package/src/solid/progress.tsx +21 -21
  108. package/src/solid/radio-group.tsx +51 -51
  109. package/src/solid/resizable.tsx +128 -128
  110. package/src/solid/responsive-dialog.tsx +134 -134
  111. package/src/solid/schema-form.tsx +743 -743
  112. package/src/solid/scope-indicator.tsx +5 -5
  113. package/src/solid/scroll-area.tsx +16 -16
  114. package/src/solid/section-card.tsx +281 -281
  115. package/src/solid/select.tsx +101 -101
  116. package/src/solid/separator.tsx +25 -25
  117. package/src/solid/settings-row.tsx +122 -122
  118. package/src/solid/sheet.tsx +96 -96
  119. package/src/solid/skeleton.tsx +8 -8
  120. package/src/solid/slider.tsx +132 -132
  121. package/src/solid/sliding-indicator.tsx +280 -265
  122. package/src/solid/sonner.tsx +164 -164
  123. package/src/solid/spinner.tsx +12 -12
  124. package/src/solid/spotlight.tsx +140 -140
  125. package/src/solid/step-indicator.tsx +18 -18
  126. package/src/solid/swatch-picker.tsx +38 -38
  127. package/src/solid/switch.tsx +52 -52
  128. package/src/solid/table.tsx +63 -63
  129. package/src/solid/tabs.tsx +93 -93
  130. package/src/solid/textarea.tsx +8 -8
  131. package/src/solid/toggle-group.tsx +83 -83
  132. package/src/solid/toggle.tsx +33 -33
  133. package/src/solid/tooltip.tsx +16 -16
  134. package/src/solid/widget-card.tsx +90 -90
  135. package/src/solid/widget-identity.tsx +99 -99
  136. package/src/solid/widget-trust-badge.tsx +20 -20
  137. package/src/styles/globals.css +316 -319
  138. package/src/styles/theme.css +448 -448
  139. package/src/tokens/hex.ts +29 -29
  140. package/src/tokens/material.ts +75 -75
  141. package/src/tokens/presets.ts +303 -303
  142. package/src/tokens/readability.ts +32 -32
  143. package/src/tokens/theme-colors.ts +95 -95
  144. package/src/tokens/theme-css.ts +22 -22
  145. package/src/tokens/theme-recipe.ts +106 -106
@@ -7,92 +7,92 @@ import { THUMB_CLASS, THUMB_COLOR_RING, THUMB_RAIL_PAD } from "../lib/thumb-clas
7
7
  import { cn } from "../lib/utils.js";
8
8
 
9
9
  interface ColorSliderProps {
10
- value?: Color;
11
- defaultValue?: Color;
12
- channel: ColorChannel;
13
- onChange?: (value: Color) => void;
14
- onChangeEnd?: (value: Color) => void;
15
- disabled?: boolean;
16
- class?: string;
17
- "aria-label"?: string;
10
+ value?: Color;
11
+ defaultValue?: Color;
12
+ channel: ColorChannel;
13
+ onChange?: (value: Color) => void;
14
+ onChangeEnd?: (value: Color) => void;
15
+ disabled?: boolean;
16
+ class?: string;
17
+ "aria-label"?: string;
18
18
  }
19
19
 
20
20
  const ColorSlider: Component<ColorSliderProps> = (props) => {
21
- const [local] = splitProps(props, [
22
- "value",
23
- "defaultValue",
24
- "channel",
25
- "onChange",
26
- "onChangeEnd",
27
- "disabled",
28
- "class",
29
- "aria-label",
30
- ]);
21
+ const [local] = splitProps(props, [
22
+ "value",
23
+ "defaultValue",
24
+ "channel",
25
+ "onChange",
26
+ "onChangeEnd",
27
+ "disabled",
28
+ "class",
29
+ "aria-label",
30
+ ]);
31
31
 
32
- // Kobalte paints the channel gradient on the (half-thumb padded) track, which
33
- // leaves naked strips at the ends, so we rebuild it on the full-width root.
34
- const gradient = () => {
35
- const color = local.value ?? local.defaultValue;
36
- if (!color) return undefined;
37
- const channel = local.channel;
38
- if (channel === "hue") {
39
- const stops = [0, 60, 120, 180, 240, 300, 360]
40
- .map((h) => color.withChannelValue("hue", h).toString("css"))
41
- .join(", ");
42
- return `linear-gradient(to right, ${stops})`;
43
- }
44
- const { minValue, maxValue } = color.getChannelRange(channel);
45
- const start = color.withChannelValue(channel, minValue).toString("css");
46
- const end = color.withChannelValue(channel, maxValue).toString("css");
47
- if (channel === "lightness") {
48
- const middle = color.withChannelValue(channel, (maxValue - minValue) / 2).toString("css");
49
- return `linear-gradient(to right, ${start}, ${middle}, ${end})`;
50
- }
51
- return `linear-gradient(to right, ${start}, ${end})`;
52
- };
32
+ // Kobalte paints the channel gradient on the (half-thumb padded) track, which
33
+ // leaves naked strips at the ends, so we rebuild it on the full-width root.
34
+ const gradient = () => {
35
+ const color = local.value ?? local.defaultValue;
36
+ if (!color) return undefined;
37
+ const channel = local.channel;
38
+ if (channel === "hue") {
39
+ const stops = [0, 60, 120, 180, 240, 300, 360]
40
+ .map((h) => color.withChannelValue("hue", h).toString("css"))
41
+ .join(", ");
42
+ return `linear-gradient(to right, ${stops})`;
43
+ }
44
+ const { minValue, maxValue } = color.getChannelRange(channel);
45
+ const start = color.withChannelValue(channel, minValue).toString("css");
46
+ const end = color.withChannelValue(channel, maxValue).toString("css");
47
+ if (channel === "lightness") {
48
+ const middle = color.withChannelValue(channel, (maxValue - minValue) / 2).toString("css");
49
+ return `linear-gradient(to right, ${start}, ${middle}, ${end})`;
50
+ }
51
+ return `linear-gradient(to right, ${start}, ${end})`;
52
+ };
53
53
 
54
- return (
55
- <KColorSlider
56
- value={local.value}
57
- defaultValue={local.defaultValue}
58
- channel={local.channel}
59
- onChange={local.onChange}
60
- onChangeEnd={local.onChangeEnd}
61
- disabled={local.disabled}
62
- data-slot="color-slider"
63
- class={cn(
64
- "relative flex w-full touch-none select-none items-center rounded-xl",
65
- THUMB_RAIL_PAD,
66
- local.disabled && "cursor-not-allowed opacity-50",
67
- local.class,
68
- )}
69
- style={{ background: gradient() }}
70
- >
71
- <KColorSlider.Track
72
- data-slot="color-slider-track"
73
- class={cn("relative h-7 w-full", local.disabled ? "cursor-not-allowed" : "cursor-pointer")}
74
- // Kobalte paints the channel gradient as an inline background here, which
75
- // no class can beat; clearing it inline is what keeps the root's
76
- // full-width gradient the only one.
77
- style={{ background: "none" }}
78
- >
79
- <KColorSlider.Thumb
80
- data-slot="color-slider-thumb"
81
- class={cn(
82
- THUMB_CLASS,
83
- FOCUS_RING,
84
- THUMB_COLOR_RING,
85
- "absolute top-0",
86
- local.disabled && "cursor-not-allowed",
87
- )}
88
- aria-label={local["aria-label"] ?? local.channel}
89
- style={{ background: "var(--kb-color-current)" }}
90
- >
91
- <KColorSlider.Input />
92
- </KColorSlider.Thumb>
93
- </KColorSlider.Track>
94
- </KColorSlider>
95
- );
54
+ return (
55
+ <KColorSlider
56
+ value={local.value}
57
+ defaultValue={local.defaultValue}
58
+ channel={local.channel}
59
+ onChange={local.onChange}
60
+ onChangeEnd={local.onChangeEnd}
61
+ disabled={local.disabled}
62
+ data-slot="color-slider"
63
+ class={cn(
64
+ "relative flex w-full touch-none items-center rounded-xl select-none",
65
+ THUMB_RAIL_PAD,
66
+ local.disabled && "cursor-not-allowed opacity-50",
67
+ local.class,
68
+ )}
69
+ style={{ background: gradient() }}
70
+ >
71
+ <KColorSlider.Track
72
+ data-slot="color-slider-track"
73
+ class={cn("relative h-7 w-full", local.disabled ? "cursor-not-allowed" : "cursor-pointer")}
74
+ // Kobalte paints the channel gradient as an inline background here, which
75
+ // no class can beat; clearing it inline is what keeps the root's
76
+ // full-width gradient the only one.
77
+ style={{ background: "none" }}
78
+ >
79
+ <KColorSlider.Thumb
80
+ data-slot="color-slider-thumb"
81
+ class={cn(
82
+ THUMB_CLASS,
83
+ FOCUS_RING,
84
+ THUMB_COLOR_RING,
85
+ "absolute top-0",
86
+ local.disabled && "cursor-not-allowed",
87
+ )}
88
+ aria-label={local["aria-label"] ?? local.channel}
89
+ style={{ background: "var(--kb-color-current)" }}
90
+ >
91
+ <KColorSlider.Input />
92
+ </KColorSlider.Thumb>
93
+ </KColorSlider.Track>
94
+ </KColorSlider>
95
+ );
96
96
  };
97
97
 
98
98
  export { ColorSlider };
@@ -7,71 +7,71 @@ import { THUMB_CLASS, THUMB_COLOR_RING, THUMB_SIZE } from "../lib/thumb-classes.
7
7
  import { cn } from "../lib/utils.js";
8
8
 
9
9
  interface ColorWheelProps {
10
- value?: Color;
11
- defaultValue?: Color;
12
- onChange?: (value: Color) => void;
13
- onChangeEnd?: (value: Color) => void;
14
- /** Wheel diameter in px */
15
- size?: number;
16
- /** Ring thickness, 0-100 relative to the radius */
17
- thickness?: number;
18
- disabled?: boolean;
19
- class?: string;
20
- "aria-label"?: string;
10
+ value?: Color;
11
+ defaultValue?: Color;
12
+ onChange?: (value: Color) => void;
13
+ onChangeEnd?: (value: Color) => void;
14
+ /** Wheel diameter in px */
15
+ size?: number;
16
+ /** Ring thickness, 0-100 relative to the radius */
17
+ thickness?: number;
18
+ disabled?: boolean;
19
+ class?: string;
20
+ "aria-label"?: string;
21
21
  }
22
22
 
23
23
  const ColorWheel: Component<ColorWheelProps> = (props) => {
24
- const [local] = splitProps(props, [
25
- "value",
26
- "defaultValue",
27
- "onChange",
28
- "onChangeEnd",
29
- "size",
30
- "thickness",
31
- "disabled",
32
- "class",
33
- "aria-label",
34
- ]);
35
- const size = () => local.size ?? 200;
36
- // Kobalte reads `thickness` as a percentage of the radius, so a px thumb
37
- // only fits if the ring is sized from the same number the class resolves to.
38
- // Clamped at the top of that range: past it Kobalte's mask radius goes
39
- // negative and the ring renders as a filled disc.
40
- const thickness = () =>
41
- local.thickness ?? Math.min(100, Math.ceil((THUMB_SIZE / (size() / 2)) * 100));
24
+ const [local] = splitProps(props, [
25
+ "value",
26
+ "defaultValue",
27
+ "onChange",
28
+ "onChangeEnd",
29
+ "size",
30
+ "thickness",
31
+ "disabled",
32
+ "class",
33
+ "aria-label",
34
+ ]);
35
+ const size = () => local.size ?? 200;
36
+ // Kobalte reads `thickness` as a percentage of the radius, so a px thumb
37
+ // only fits if the ring is sized from the same number the class resolves to.
38
+ // Clamped at the top of that range: past it Kobalte's mask radius goes
39
+ // negative and the ring renders as a filled disc.
40
+ const thickness = () =>
41
+ local.thickness ?? Math.min(100, Math.ceil((THUMB_SIZE / (size() / 2)) * 100));
42
42
 
43
- return (
44
- <KColorWheel
45
- value={local.value}
46
- defaultValue={local.defaultValue}
47
- onChange={local.onChange}
48
- onChangeEnd={local.onChangeEnd}
49
- thickness={thickness()}
50
- disabled={local.disabled}
51
- data-slot="color-wheel"
52
- class={cn(
53
- "relative touch-none select-none",
54
- local.disabled && "cursor-not-allowed opacity-50",
55
- local.class,
56
- )}
57
- style={{ width: `${size()}px`, height: `${size()}px` }}
58
- >
59
- <KColorWheel.Track
60
- data-slot="color-wheel-track"
61
- class={cn("h-full w-full", local.disabled ? "cursor-not-allowed" : "cursor-pointer")}
62
- >
63
- {/* Always a circle: the thumb rides a circular track, theme corner radius looks broken there. */}
64
- <KColorWheel.Thumb
65
- data-slot="color-wheel-thumb"
66
- class={cn(THUMB_CLASS, FOCUS_RING, THUMB_COLOR_RING, "rounded-full")}
67
- aria-label={local["aria-label"] ?? "Hue"}
68
- style={{ background: "var(--kb-color-current)" }}
69
- >
70
- <KColorWheel.Input />
71
- </KColorWheel.Thumb>
72
- </KColorWheel.Track>
73
- </KColorWheel>
74
- );
43
+ return (
44
+ <KColorWheel
45
+ value={local.value}
46
+ defaultValue={local.defaultValue}
47
+ onChange={local.onChange}
48
+ onChangeEnd={local.onChangeEnd}
49
+ thickness={thickness()}
50
+ disabled={local.disabled}
51
+ data-slot="color-wheel"
52
+ class={cn(
53
+ "relative touch-none select-none",
54
+ local.disabled && "cursor-not-allowed opacity-50",
55
+ local.class,
56
+ )}
57
+ style={{ width: `${size()}px`, height: `${size()}px` }}
58
+ >
59
+ <KColorWheel.Track
60
+ data-slot="color-wheel-track"
61
+ class={cn("h-full w-full", local.disabled ? "cursor-not-allowed" : "cursor-pointer")}
62
+ >
63
+ {/* Always a circle: the thumb rides a circular track, theme corner radius looks broken there. */}
64
+ <KColorWheel.Thumb
65
+ data-slot="color-wheel-thumb"
66
+ class={cn(THUMB_CLASS, FOCUS_RING, THUMB_COLOR_RING, "rounded-full")}
67
+ aria-label={local["aria-label"] ?? "Hue"}
68
+ style={{ background: "var(--kb-color-current)" }}
69
+ >
70
+ <KColorWheel.Input />
71
+ </KColorWheel.Thumb>
72
+ </KColorWheel.Track>
73
+ </KColorWheel>
74
+ );
75
75
  };
76
76
 
77
77
  export { ColorWheel };
@@ -3,15 +3,15 @@ import { type Component, type ComponentProps, type ParentComponent, splitProps }
3
3
  import { OVERLAY_MOTION } from "../lib/motion-classes.js";
4
4
  import { cn } from "../lib/utils.js";
5
5
  import {
6
- MENU_CONTENT_CLASS,
7
- MenuCheckboxItemPart,
8
- MenuContentIndicator,
9
- MenuItemPart,
10
- MenuLabelPart,
11
- MenuRadioItemPart,
12
- MenuSeparatorPart,
13
- MenuSubContentPart,
14
- MenuSubTriggerPart,
6
+ MENU_CONTENT_CLASS,
7
+ MenuCheckboxItemPart,
8
+ MenuContentIndicator,
9
+ MenuItemPart,
10
+ MenuLabelPart,
11
+ MenuRadioItemPart,
12
+ MenuSeparatorPart,
13
+ MenuSubContentPart,
14
+ MenuSubTriggerPart,
15
15
  } from "./menu-parts.js";
16
16
 
17
17
  const ContextMenu = ContextMenuPrimitive;
@@ -20,90 +20,90 @@ const ContextMenuSub = ContextMenuPrimitive.Sub;
20
20
  const ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup;
21
21
 
22
22
  const ContextMenuTrigger: Component<ComponentProps<typeof ContextMenuPrimitive.Trigger>> = (
23
- props,
23
+ props,
24
24
  ) => {
25
- return <ContextMenuPrimitive.Trigger data-slot="context-menu-trigger" {...props} />;
25
+ return <ContextMenuPrimitive.Trigger data-slot="context-menu-trigger" {...props} />;
26
26
  };
27
27
 
28
28
  const ContextMenuSubTrigger: ParentComponent<
29
- ComponentProps<typeof ContextMenuPrimitive.SubTrigger> & { inset?: boolean }
29
+ ComponentProps<typeof ContextMenuPrimitive.SubTrigger> & { inset?: boolean }
30
30
  > = (props) => <MenuSubTriggerPart slotName="context-menu-sub-trigger" {...props} />;
31
31
 
32
32
  const ContextMenuSubContent: Component<ComponentProps<typeof ContextMenuPrimitive.SubContent>> = (
33
- props,
33
+ props,
34
34
  ) => <MenuSubContentPart slotName="context-menu-sub-content" {...props} />;
35
35
 
36
36
  const ContextMenuContent: Component<ComponentProps<typeof ContextMenuPrimitive.Content>> = (
37
- props,
37
+ props,
38
38
  ) => {
39
- const [local, rest] = splitProps(props, ["class", "children"]);
40
- return (
41
- <ContextMenuPrimitive.Portal>
42
- <ContextMenuPrimitive.Content
43
- data-slot="context-menu-content"
44
- class={cn(
45
- MENU_CONTENT_CLASS,
46
- OVERLAY_MOTION,
47
- "overflow-y-auto overflow-x-hidden",
48
- local.class,
49
- )}
50
- {...rest}
51
- >
52
- <MenuContentIndicator>{local.children}</MenuContentIndicator>
53
- </ContextMenuPrimitive.Content>
54
- </ContextMenuPrimitive.Portal>
55
- );
39
+ const [local, rest] = splitProps(props, ["class", "children"]);
40
+ return (
41
+ <ContextMenuPrimitive.Portal>
42
+ <ContextMenuPrimitive.Content
43
+ data-slot="context-menu-content"
44
+ class={cn(
45
+ MENU_CONTENT_CLASS,
46
+ OVERLAY_MOTION,
47
+ "overflow-x-hidden overflow-y-auto",
48
+ local.class,
49
+ )}
50
+ {...rest}
51
+ >
52
+ <MenuContentIndicator>{local.children}</MenuContentIndicator>
53
+ </ContextMenuPrimitive.Content>
54
+ </ContextMenuPrimitive.Portal>
55
+ );
56
56
  };
57
57
 
58
58
  const ContextMenuItem: Component<
59
- ComponentProps<typeof ContextMenuPrimitive.Item> & {
60
- inset?: boolean;
61
- tone?: string;
62
- /** @deprecated pass `tone="var(--destructive)"` instead */
63
- variant?: "default" | "destructive";
64
- }
59
+ ComponentProps<typeof ContextMenuPrimitive.Item> & {
60
+ inset?: boolean;
61
+ tone?: string;
62
+ /** @deprecated pass `tone="var(--destructive)"` instead */
63
+ variant?: "default" | "destructive";
64
+ }
65
65
  > = (props) => <MenuItemPart slotName="context-menu-item" {...props} />;
66
66
 
67
67
  const ContextMenuCheckboxItem: ParentComponent<
68
- ComponentProps<typeof ContextMenuPrimitive.CheckboxItem>
68
+ ComponentProps<typeof ContextMenuPrimitive.CheckboxItem>
69
69
  > = (props) => <MenuCheckboxItemPart slotName="context-menu-checkbox-item" {...props} />;
70
70
 
71
71
  const ContextMenuRadioItem: ParentComponent<
72
- ComponentProps<typeof ContextMenuPrimitive.RadioItem>
72
+ ComponentProps<typeof ContextMenuPrimitive.RadioItem>
73
73
  > = (props) => <MenuRadioItemPart slotName="context-menu-radio-item" {...props} />;
74
74
 
75
75
  const ContextMenuLabel: Component<
76
- ComponentProps<typeof ContextMenuPrimitive.GroupLabel> & { inset?: boolean }
76
+ ComponentProps<typeof ContextMenuPrimitive.GroupLabel> & { inset?: boolean }
77
77
  > = (props) => <MenuLabelPart slotName="context-menu-label" {...props} />;
78
78
 
79
79
  const ContextMenuSeparator: Component<ComponentProps<typeof ContextMenuPrimitive.Separator>> = (
80
- props,
80
+ props,
81
81
  ) => <MenuSeparatorPart slotName="context-menu-separator" {...props} />;
82
82
 
83
83
  const ContextMenuShortcut: Component<ComponentProps<"span">> = (props) => {
84
- const [local, rest] = splitProps(props, ["class"]);
85
- return (
86
- <span
87
- data-slot="context-menu-shortcut"
88
- class={cn("ml-auto text-muted-foreground text-xs tracking-widest", local.class)}
89
- {...rest}
90
- />
91
- );
84
+ const [local, rest] = splitProps(props, ["class"]);
85
+ return (
86
+ <span
87
+ data-slot="context-menu-shortcut"
88
+ class={cn("text-muted-foreground ml-auto text-xs tracking-widest", local.class)}
89
+ {...rest}
90
+ />
91
+ );
92
92
  };
93
93
 
94
94
  export {
95
- ContextMenu,
96
- ContextMenuCheckboxItem,
97
- ContextMenuContent,
98
- ContextMenuGroup,
99
- ContextMenuItem,
100
- ContextMenuLabel,
101
- ContextMenuRadioGroup,
102
- ContextMenuRadioItem,
103
- ContextMenuSeparator,
104
- ContextMenuShortcut,
105
- ContextMenuSub,
106
- ContextMenuSubContent,
107
- ContextMenuSubTrigger,
108
- ContextMenuTrigger,
95
+ ContextMenu,
96
+ ContextMenuCheckboxItem,
97
+ ContextMenuContent,
98
+ ContextMenuGroup,
99
+ ContextMenuItem,
100
+ ContextMenuLabel,
101
+ ContextMenuRadioGroup,
102
+ ContextMenuRadioItem,
103
+ ContextMenuSeparator,
104
+ ContextMenuShortcut,
105
+ ContextMenuSub,
106
+ ContextMenuSubContent,
107
+ ContextMenuSubTrigger,
108
+ ContextMenuTrigger,
109
109
  };
@@ -5,42 +5,42 @@ import { Icon } from "./icon.js";
5
5
  import { toast } from "./sonner.js";
6
6
 
7
7
  interface CopyButtonProps {
8
- text: string;
9
- class?: string;
8
+ text: string;
9
+ class?: string;
10
10
  }
11
11
 
12
12
  const CopyButton: Component<CopyButtonProps> = (props) => {
13
- const [copied, setCopied] = createSignal(false);
13
+ const [copied, setCopied] = createSignal(false);
14
14
 
15
- const handleCopy = async () => {
16
- try {
17
- await navigator.clipboard.writeText(props.text);
18
- setCopied(true);
19
- toast.success("Copied to clipboard");
20
- setTimeout(() => setCopied(false), 2000);
21
- } catch {
22
- toast.error("Failed to copy");
23
- }
24
- };
15
+ const handleCopy = async () => {
16
+ try {
17
+ await navigator.clipboard.writeText(props.text);
18
+ setCopied(true);
19
+ toast.success("Copied to clipboard");
20
+ setTimeout(() => setCopied(false), 2000);
21
+ } catch {
22
+ toast.error("Failed to copy");
23
+ }
24
+ };
25
25
 
26
- return (
27
- <button
28
- type="button"
29
- data-slot="copy-button"
30
- onClick={handleCopy}
31
- class={cn(ICON_BUTTON_CLASS, "size-8", props.class)}
32
- aria-label={copied() ? "Copied!" : "Copy to clipboard"}
33
- >
34
- <Show
35
- when={copied()}
36
- fallback={
37
- <Icon icon="lucide:copy" width={16} height={16} class="h-4 w-4 text-muted-foreground" />
38
- }
39
- >
40
- <Icon icon="lucide:check" width={16} height={16} class="h-4 w-4 text-success" />
41
- </Show>
42
- </button>
43
- );
26
+ return (
27
+ <button
28
+ type="button"
29
+ data-slot="copy-button"
30
+ onClick={handleCopy}
31
+ class={cn(ICON_BUTTON_CLASS, "size-8", props.class)}
32
+ aria-label={copied() ? "Copied!" : "Copy to clipboard"}
33
+ >
34
+ <Show
35
+ when={copied()}
36
+ fallback={
37
+ <Icon icon="lucide:copy" width={16} height={16} class="text-muted-foreground h-4 w-4" />
38
+ }
39
+ >
40
+ <Icon icon="lucide:check" width={16} height={16} class="text-success h-4 w-4" />
41
+ </Show>
42
+ </button>
43
+ );
44
44
  };
45
45
 
46
46
  export { CopyButton };
@@ -10,15 +10,15 @@ import { Badge } from "./badge.js";
10
10
  * pixel per DPR (measured 1/1.5/2/4).
11
11
  */
12
12
  export function CountPill(props: { children: JSX.Element; class?: string }) {
13
- return (
14
- <Badge
15
- tone="var(--muted-foreground)"
16
- class={cn(
17
- "h-[20px] min-w-[20px] justify-center pt-[2px] pr-[6px] pb-0 pl-[7px] font-mono text-[11px] tabular-nums leading-[20px]",
18
- props.class,
19
- )}
20
- >
21
- {props.children}
22
- </Badge>
23
- );
13
+ return (
14
+ <Badge
15
+ tone="var(--muted-foreground)"
16
+ class={cn(
17
+ "h-[20px] min-w-[20px] justify-center pt-[2px] pr-[6px] pb-0 pl-[7px] font-mono text-[11px] leading-[20px] tabular-nums",
18
+ props.class,
19
+ )}
20
+ >
21
+ {props.children}
22
+ </Badge>
23
+ );
24
24
  }