@stagewise/ui 0.1.0 → 0.3.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.
Files changed (114) hide show
  1. package/README.md +9 -3
  2. package/package.json +9 -15
  3. package/src/components/ui/accordion.tsx +13 -15
  4. package/src/components/ui/alert-dialog.tsx +38 -38
  5. package/src/components/ui/alert.tsx +22 -22
  6. package/src/components/ui/aspect-ratio.tsx +6 -6
  7. package/src/components/ui/avatar.tsx +30 -30
  8. package/src/components/ui/badge.tsx +24 -22
  9. package/src/components/ui/breadcrumb.tsx +34 -37
  10. package/src/components/ui/bubble.tsx +48 -48
  11. package/src/components/ui/button-group.tsx +24 -24
  12. package/src/components/ui/button.tsx +24 -24
  13. package/src/components/ui/calendar.tsx +94 -81
  14. package/src/components/ui/card.tsx +30 -30
  15. package/src/components/ui/carousel.tsx +95 -92
  16. package/src/components/ui/chart.tsx +110 -110
  17. package/src/components/ui/checkbox.tsx +9 -10
  18. package/src/components/ui/collapsible.tsx +5 -5
  19. package/src/components/ui/combobox.tsx +51 -44
  20. package/src/components/ui/command.tsx +173 -190
  21. package/src/components/ui/context-menu.tsx +60 -50
  22. package/src/components/ui/dialog.tsx +33 -34
  23. package/src/components/ui/direction.tsx +1 -1
  24. package/src/components/ui/drawer.tsx +61 -61
  25. package/src/components/ui/dropdown-menu.tsx +54 -50
  26. package/src/components/ui/empty.tsx +30 -30
  27. package/src/components/ui/field.tsx +64 -64
  28. package/src/components/ui/hover-card.tsx +12 -12
  29. package/src/components/ui/input-group.tsx +54 -54
  30. package/src/components/ui/input-otp.tsx +24 -25
  31. package/src/components/ui/input.tsx +8 -8
  32. package/src/components/ui/item.tsx +64 -64
  33. package/src/components/ui/kbd.tsx +8 -8
  34. package/src/components/ui/klex-logo-combo.tsx +69 -0
  35. package/src/components/ui/klex-logo-text.tsx +70 -0
  36. package/src/components/ui/klex-logo.tsx +146 -0
  37. package/src/components/ui/label.tsx +8 -8
  38. package/src/components/ui/marker.tsx +25 -25
  39. package/src/components/ui/menubar.tsx +54 -50
  40. package/src/components/ui/message-scroller.tsx +130 -0
  41. package/src/components/ui/message.tsx +27 -27
  42. package/src/components/ui/native-select.tsx +22 -18
  43. package/src/components/ui/navigation-menu.tsx +37 -34
  44. package/src/components/ui/pagination.tsx +34 -31
  45. package/src/components/ui/popover.tsx +19 -19
  46. package/src/components/ui/progress.tsx +16 -16
  47. package/src/components/ui/questionnaire.tsx +72 -69
  48. package/src/components/ui/radio-group.tsx +9 -9
  49. package/src/components/ui/resizable.tsx +19 -12
  50. package/src/components/ui/scroll-area.tsx +10 -10
  51. package/src/components/ui/select.tsx +39 -34
  52. package/src/components/ui/separator.tsx +7 -7
  53. package/src/components/ui/sheet.tsx +31 -32
  54. package/src/components/ui/sidebar.tsx +244 -232
  55. package/src/components/ui/skeleton.tsx +5 -5
  56. package/src/components/ui/slider.tsx +11 -7
  57. package/src/components/ui/spinner.tsx +15 -6
  58. package/src/components/ui/stagewise-logo-combo.tsx +43 -0
  59. package/src/components/ui/stagewise-logo-text.tsx +30 -0
  60. package/src/components/ui/stagewise-logo.tsx +42 -0
  61. package/src/components/ui/switch.tsx +9 -9
  62. package/src/components/ui/table.tsx +31 -31
  63. package/src/components/ui/tabs.tsx +37 -26
  64. package/src/components/ui/textarea.tsx +7 -7
  65. package/src/components/ui/toast.tsx +70 -70
  66. package/src/components/ui/toggle-group.tsx +26 -26
  67. package/src/components/ui/toggle.tsx +15 -15
  68. package/src/components/ui/tooltip.tsx +13 -13
  69. package/src/hooks/use-mobile.ts +13 -11
  70. package/src/icons/custom/ui-outline-18/IconKlexOutline18.tsx +39 -0
  71. package/src/icons/custom/ui-outline-18/IconLaptop.tsx +35 -0
  72. package/src/icons/custom/ui-outline-18/IconSignOut.tsx +33 -0
  73. package/src/icons/custom/ui-outline-18/index.ts +4 -1
  74. package/src/icons/index.ts +43 -20
  75. package/src/icons/nucleo/social-media/IconMicrosoftEntraId.tsx +56 -0
  76. package/src/icons/nucleo/social-media/index.ts +1 -0
  77. package/src/icons/nucleo/ui-outline-18/IconArrowDownOutline18.tsx +4 -3
  78. package/src/icons/nucleo/ui-outline-18/IconArrowTurnRightOutline18.tsx +32 -0
  79. package/src/icons/nucleo/ui-outline-18/IconArrowUpOutline18.tsx +35 -0
  80. package/src/icons/nucleo/ui-outline-18/IconChartPieOutline18.tsx +4 -3
  81. package/src/icons/nucleo/ui-outline-18/IconChevronMaximizeDiagonal2Outline18.tsx +33 -0
  82. package/src/icons/nucleo/ui-outline-18/IconChevronUpOutline18.tsx +4 -3
  83. package/src/icons/nucleo/ui-outline-18/IconEmptyOutline18.tsx +41 -0
  84. package/src/icons/nucleo/ui-outline-18/IconEyeOffOutline18.tsx +18 -0
  85. package/src/icons/nucleo/ui-outline-18/IconLinkBrokenOutline18.tsx +66 -0
  86. package/src/icons/nucleo/ui-outline-18/IconLock18Outline.tsx +48 -0
  87. package/src/icons/nucleo/ui-outline-18/IconMinusOutline18.tsx +4 -3
  88. package/src/icons/nucleo/ui-outline-18/IconMsgs2Outline18.tsx +32 -0
  89. package/src/icons/nucleo/ui-outline-18/IconPanelLeftOutline18.tsx +4 -3
  90. package/src/icons/nucleo/ui-outline-18/IconSidebarLeft2HideOutline18.tsx +63 -0
  91. package/src/icons/nucleo/ui-outline-18/IconSidebarRight2HideOutline18.tsx +63 -0
  92. package/src/icons/nucleo/ui-outline-18/index.ts +11 -1
  93. package/src/icons/provider/IconAnthropic.tsx +15 -0
  94. package/src/icons/provider/IconAttio.tsx +9 -0
  95. package/src/icons/provider/IconCodex.tsx +18 -0
  96. package/src/icons/provider/IconDiscord.tsx +17 -0
  97. package/src/icons/provider/IconGemini.tsx +152 -0
  98. package/src/icons/provider/IconLinear.tsx +9 -0
  99. package/src/icons/provider/IconOpenAI.tsx +15 -0
  100. package/src/icons/provider/IconOpenRouter.tsx +24 -0
  101. package/src/icons/provider/IconSlack.tsx +24 -0
  102. package/src/icons/provider/IconTelegram.tsx +29 -0
  103. package/src/icons/provider/IconWhatsapp.tsx +14 -0
  104. package/src/icons/provider/LICENSE +21 -0
  105. package/src/icons/provider/index.ts +11 -0
  106. package/src/index.ts +68 -61
  107. package/src/lib/utils.ts +3 -3
  108. package/src/styles/bridge.css +7 -3
  109. package/src/styles/derived-utilities.css +129 -50
  110. package/src/styles/index.css +17 -2
  111. package/src/styles/palette.css +266 -105
  112. package/src/styles/scroll-fade.css +116 -0
  113. package/src/styles/tailwind-tokens.css +3 -0
  114. package/src/styles/theme.css +57 -43
@@ -1,10 +1,10 @@
1
- "use client"
1
+ 'use client';
2
2
 
3
- import * as React from "react"
4
- import { Menu as MenuPrimitive } from "@base-ui/react/menu"
5
- import { Menubar as MenubarPrimitive } from "@base-ui/react/menubar"
3
+ import * as React from 'react';
4
+ import { Menu as MenuPrimitive } from '@base-ui/react/menu';
5
+ import { Menubar as MenubarPrimitive } from '@base-ui/react/menubar';
6
6
 
7
- import { cn } from "../../lib/utils"
7
+ import { cn } from '../../lib/utils';
8
8
  import {
9
9
  DropdownMenu,
10
10
  DropdownMenuContent,
@@ -19,36 +19,36 @@ import {
19
19
  DropdownMenuSubContent,
20
20
  DropdownMenuSubTrigger,
21
21
  DropdownMenuTrigger,
22
- } from "./dropdown-menu"
23
- import { IconCheckOutline18 } from "../../icons"
22
+ } from './dropdown-menu';
23
+ import { IconCheckOutline18 } from '../../icons';
24
24
 
25
25
  function Menubar({ className, ...props }: MenubarPrimitive.Props) {
26
26
  return (
27
27
  <MenubarPrimitive
28
28
  data-slot="menubar"
29
29
  className={cn(
30
- "flex h-8 items-center gap-0.5 rounded-lg border p-[3px]",
31
- className
30
+ 'flex h-8 items-center gap-0.5 rounded-lg border p-[3px]',
31
+ className,
32
32
  )}
33
33
  {...props}
34
34
  />
35
- )
35
+ );
36
36
  }
37
37
 
38
38
  function MenubarMenu({ ...props }: React.ComponentProps<typeof DropdownMenu>) {
39
- return <DropdownMenu data-slot="menubar-menu" {...props} />
39
+ return <DropdownMenu data-slot="menubar-menu" {...props} />;
40
40
  }
41
41
 
42
42
  function MenubarGroup({
43
43
  ...props
44
44
  }: React.ComponentProps<typeof DropdownMenuGroup>) {
45
- return <DropdownMenuGroup data-slot="menubar-group" {...props} />
45
+ return <DropdownMenuGroup data-slot="menubar-group" {...props} />;
46
46
  }
47
47
 
48
48
  function MenubarPortal({
49
49
  ...props
50
50
  }: React.ComponentProps<typeof DropdownMenuPortal>) {
51
- return <DropdownMenuPortal data-slot="menubar-portal" {...props} />
51
+ return <DropdownMenuPortal data-slot="menubar-portal" {...props} />;
52
52
  }
53
53
 
54
54
  function MenubarTrigger({
@@ -59,17 +59,17 @@ function MenubarTrigger({
59
59
  <DropdownMenuTrigger
60
60
  data-slot="menubar-trigger"
61
61
  className={cn(
62
- "flex items-center rounded-sm px-1.5 py-[2px] text-sm font-medium outline-hidden select-none hover:bg-muted aria-expanded:bg-muted",
63
- className
62
+ 'flex items-center rounded-sm px-1.5 py-[2px] text-sm font-medium outline-hidden select-none hover:bg-muted aria-expanded:bg-muted',
63
+ className,
64
64
  )}
65
65
  {...props}
66
66
  />
67
- )
67
+ );
68
68
  }
69
69
 
70
70
  function MenubarContent({
71
71
  className,
72
- align = "start",
72
+ align = 'start',
73
73
  alignOffset = -4,
74
74
  sideOffset = 8,
75
75
  ...props
@@ -80,16 +80,19 @@ function MenubarContent({
80
80
  align={align}
81
81
  alignOffset={alignOffset}
82
82
  sideOffset={sideOffset}
83
- className={cn("min-w-36 rounded-lg p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 relative bg-popover/70 before:pointer-events-none before:absolute before:inset-0 before:-z-1 before:rounded-[inherit] before:backdrop-blur-2xl before:backdrop-saturate-150 **:data-[slot$=-item]:focus:bg-foreground/10 **:data-[slot$=-item]:data-highlighted:bg-foreground/10 **:data-[slot$=-separator]:bg-foreground/5 **:data-[slot$=-trigger]:focus:bg-foreground/10 **:data-[slot$=-trigger]:aria-expanded:bg-foreground/10! **:data-[variant=destructive]:focus:bg-foreground/10! **:data-[variant=destructive]:text-accent-foreground! **:data-[variant=destructive]:**:text-accent-foreground!", className )}
83
+ className={cn(
84
+ 'min-w-36 rounded-lg p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 relative bg-popover **:data-[slot$=-item]:focus:bg-foreground/10 **:data-[slot$=-item]:data-highlighted:bg-foreground/10 **:data-[slot$=-separator]:bg-foreground/5 **:data-[slot$=-trigger]:focus:bg-foreground/10 **:data-[slot$=-trigger]:aria-expanded:bg-foreground/10! **:data-[variant=destructive]:focus:bg-foreground/10! **:data-[variant=destructive]:text-accent-foreground! **:data-[variant=destructive]:**:text-accent-foreground!',
85
+ className,
86
+ )}
84
87
  {...props}
85
88
  />
86
- )
89
+ );
87
90
  }
88
91
 
89
92
  function MenubarItem({
90
93
  className,
91
94
  inset,
92
- variant = "default",
95
+ variant = 'default',
93
96
  ...props
94
97
  }: React.ComponentProps<typeof DropdownMenuItem>) {
95
98
  return (
@@ -99,11 +102,11 @@ function MenubarItem({
99
102
  data-variant={variant}
100
103
  className={cn(
101
104
  "group/menubar-item gap-1.5 rounded-md px-1.5 py-1 text-sm focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:opacity-50 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive!",
102
- className
105
+ className,
103
106
  )}
104
107
  {...props}
105
108
  />
106
- )
109
+ );
107
110
  }
108
111
 
109
112
  function MenubarCheckboxItem({
@@ -113,34 +116,33 @@ function MenubarCheckboxItem({
113
116
  inset,
114
117
  ...props
115
118
  }: MenuPrimitive.CheckboxItem.Props & {
116
- inset?: boolean
119
+ inset?: boolean;
117
120
  }) {
118
121
  return (
119
122
  <MenuPrimitive.CheckboxItem
120
123
  data-slot="menubar-checkbox-item"
121
124
  data-inset={inset}
122
125
  className={cn(
123
- "relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-1.5 pl-7 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",
124
- className
126
+ 'relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-1.5 pl-7 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0',
127
+ className,
125
128
  )}
126
129
  checked={checked}
127
130
  {...props}
128
131
  >
129
132
  <span className="pointer-events-none absolute left-1.5 flex size-4 items-center justify-center [&_svg:not([class*='size-'])]:size-4">
130
133
  <MenuPrimitive.CheckboxItemIndicator>
131
- <IconCheckOutline18
132
- />
134
+ <IconCheckOutline18 />
133
135
  </MenuPrimitive.CheckboxItemIndicator>
134
136
  </span>
135
137
  {children}
136
138
  </MenuPrimitive.CheckboxItem>
137
- )
139
+ );
138
140
  }
139
141
 
140
142
  function MenubarRadioGroup({
141
143
  ...props
142
144
  }: React.ComponentProps<typeof DropdownMenuRadioGroup>) {
143
- return <DropdownMenuRadioGroup data-slot="menubar-radio-group" {...props} />
145
+ return <DropdownMenuRadioGroup data-slot="menubar-radio-group" {...props} />;
144
146
  }
145
147
 
146
148
  function MenubarRadioItem({
@@ -149,7 +151,7 @@ function MenubarRadioItem({
149
151
  inset,
150
152
  ...props
151
153
  }: MenuPrimitive.RadioItem.Props & {
152
- inset?: boolean
154
+ inset?: boolean;
153
155
  }) {
154
156
  return (
155
157
  <MenuPrimitive.RadioItem
@@ -157,19 +159,18 @@ function MenubarRadioItem({
157
159
  data-inset={inset}
158
160
  className={cn(
159
161
  "relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-1.5 pl-7 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
160
- className
162
+ className,
161
163
  )}
162
164
  {...props}
163
165
  >
164
166
  <span className="pointer-events-none absolute left-1.5 flex size-4 items-center justify-center [&_svg:not([class*='size-'])]:size-4">
165
167
  <MenuPrimitive.RadioItemIndicator>
166
- <IconCheckOutline18
167
- />
168
+ <IconCheckOutline18 />
168
169
  </MenuPrimitive.RadioItemIndicator>
169
170
  </span>
170
171
  {children}
171
172
  </MenuPrimitive.RadioItem>
172
- )
173
+ );
173
174
  }
174
175
 
175
176
  function MenubarLabel({
@@ -177,19 +178,19 @@ function MenubarLabel({
177
178
  inset,
178
179
  ...props
179
180
  }: React.ComponentProps<typeof DropdownMenuLabel> & {
180
- inset?: boolean
181
+ inset?: boolean;
181
182
  }) {
182
183
  return (
183
184
  <DropdownMenuLabel
184
185
  data-slot="menubar-label"
185
186
  data-inset={inset}
186
187
  className={cn(
187
- "px-1.5 py-1 text-sm font-medium data-inset:pl-7",
188
- className
188
+ 'px-1.5 py-1 text-sm font-medium data-inset:pl-7',
189
+ className,
189
190
  )}
190
191
  {...props}
191
192
  />
192
- )
193
+ );
193
194
  }
194
195
 
195
196
  function MenubarSeparator({
@@ -199,10 +200,10 @@ function MenubarSeparator({
199
200
  return (
200
201
  <DropdownMenuSeparator
201
202
  data-slot="menubar-separator"
202
- className={cn("-mx-1 my-1 h-px bg-border", className)}
203
+ className={cn('-mx-1 my-1 h-px bg-border', className)}
203
204
  {...props}
204
205
  />
205
- )
206
+ );
206
207
  }
207
208
 
208
209
  function MenubarShortcut({
@@ -213,18 +214,18 @@ function MenubarShortcut({
213
214
  <DropdownMenuShortcut
214
215
  data-slot="menubar-shortcut"
215
216
  className={cn(
216
- "ml-auto text-xs tracking-widest text-muted-foreground group-focus/menubar-item:text-accent-foreground",
217
- className
217
+ 'ml-auto text-xs tracking-widest text-muted-foreground group-focus/menubar-item:text-accent-foreground',
218
+ className,
218
219
  )}
219
220
  {...props}
220
221
  />
221
- )
222
+ );
222
223
  }
223
224
 
224
225
  function MenubarSub({
225
226
  ...props
226
227
  }: React.ComponentProps<typeof DropdownMenuSub>) {
227
- return <DropdownMenuSub data-slot="menubar-sub" {...props} />
228
+ return <DropdownMenuSub data-slot="menubar-sub" {...props} />;
228
229
  }
229
230
 
230
231
  function MenubarSubTrigger({
@@ -232,7 +233,7 @@ function MenubarSubTrigger({
232
233
  inset,
233
234
  ...props
234
235
  }: React.ComponentProps<typeof DropdownMenuSubTrigger> & {
235
- inset?: boolean
236
+ inset?: boolean;
236
237
  }) {
237
238
  return (
238
239
  <DropdownMenuSubTrigger
@@ -240,11 +241,11 @@ function MenubarSubTrigger({
240
241
  data-inset={inset}
241
242
  className={cn(
242
243
  "gap-1.5 rounded-md px-1.5 py-1 text-sm focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-open:bg-accent data-open:text-accent-foreground [&_svg:not([class*='size-'])]:size-4",
243
- className
244
+ className,
244
245
  )}
245
246
  {...props}
246
247
  />
247
- )
248
+ );
248
249
  }
249
250
 
250
251
  function MenubarSubContent({
@@ -254,10 +255,13 @@ function MenubarSubContent({
254
255
  return (
255
256
  <DropdownMenuSubContent
256
257
  data-slot="menubar-sub-content"
257
- className={cn("min-w-32 rounded-lg p-1 text-popover-foreground shadow-lg ring-1 ring-foreground/10 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 relative bg-popover/70 before:pointer-events-none before:absolute before:inset-0 before:-z-1 before:rounded-[inherit] before:backdrop-blur-2xl before:backdrop-saturate-150 **:data-[slot$=-item]:focus:bg-foreground/10 **:data-[slot$=-item]:data-highlighted:bg-foreground/10 **:data-[slot$=-separator]:bg-foreground/5 **:data-[slot$=-trigger]:focus:bg-foreground/10 **:data-[slot$=-trigger]:aria-expanded:bg-foreground/10! **:data-[variant=destructive]:focus:bg-foreground/10! **:data-[variant=destructive]:text-accent-foreground! **:data-[variant=destructive]:**:text-accent-foreground!", className )}
258
+ className={cn(
259
+ 'min-w-32 rounded-lg p-1 text-popover-foreground shadow-lg ring-1 ring-foreground/10 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 relative bg-popover **:data-[slot$=-item]:focus:bg-foreground/10 **:data-[slot$=-item]:data-highlighted:bg-foreground/10 **:data-[slot$=-separator]:bg-foreground/5 **:data-[slot$=-trigger]:focus:bg-foreground/10 **:data-[slot$=-trigger]:aria-expanded:bg-foreground/10! **:data-[variant=destructive]:focus:bg-foreground/10! **:data-[variant=destructive]:text-accent-foreground! **:data-[variant=destructive]:**:text-accent-foreground!',
260
+ className,
261
+ )}
258
262
  {...props}
259
263
  />
260
- )
264
+ );
261
265
  }
262
266
 
263
267
  export {
@@ -277,4 +281,4 @@ export {
277
281
  MenubarSub,
278
282
  MenubarSubTrigger,
279
283
  MenubarSubContent,
280
- }
284
+ };
@@ -0,0 +1,130 @@
1
+ 'use client';
2
+
3
+ import {
4
+ MessageScroller as MessageScrollerPrimitive,
5
+ useMessageScroller,
6
+ useMessageScrollerScrollable,
7
+ useMessageScrollerVisibility,
8
+ } from '@shadcn/react/message-scroller';
9
+ import type * as React from 'react';
10
+
11
+ import { IconArrowDownOutline18 } from '../../icons';
12
+ import { cn } from '../../lib/utils';
13
+ import { Button } from './button';
14
+
15
+ function MessageScrollerProvider(
16
+ props: React.ComponentProps<typeof MessageScrollerPrimitive.Provider>,
17
+ ) {
18
+ return <MessageScrollerPrimitive.Provider {...props} />;
19
+ }
20
+
21
+ function MessageScroller({
22
+ className,
23
+ ...props
24
+ }: React.ComponentProps<typeof MessageScrollerPrimitive.Root>) {
25
+ return (
26
+ <MessageScrollerPrimitive.Root
27
+ data-slot="message-scroller"
28
+ className={cn(
29
+ 'group/message-scroller relative flex size-full min-h-0 flex-col overflow-hidden',
30
+ className,
31
+ )}
32
+ {...props}
33
+ />
34
+ );
35
+ }
36
+
37
+ function MessageScrollerViewport({
38
+ className,
39
+ ...props
40
+ }: React.ComponentProps<typeof MessageScrollerPrimitive.Viewport>) {
41
+ return (
42
+ <MessageScrollerPrimitive.Viewport
43
+ data-slot="message-scroller-viewport"
44
+ className={cn(
45
+ 'size-full min-h-0 min-w-0 scrollbar-thin scrollbar-gutter-stable overflow-y-auto overscroll-contain contain-content data-autoscrolling:scrollbar-none',
46
+ className,
47
+ )}
48
+ {...props}
49
+ />
50
+ );
51
+ }
52
+
53
+ function MessageScrollerContent({
54
+ className,
55
+ ...props
56
+ }: React.ComponentProps<typeof MessageScrollerPrimitive.Content>) {
57
+ return (
58
+ <MessageScrollerPrimitive.Content
59
+ data-slot="message-scroller-content"
60
+ className={cn('flex h-max min-h-full flex-col gap-8', className)}
61
+ {...props}
62
+ />
63
+ );
64
+ }
65
+
66
+ function MessageScrollerItem({
67
+ className,
68
+ scrollAnchor = false,
69
+ ...props
70
+ }: React.ComponentProps<typeof MessageScrollerPrimitive.Item>) {
71
+ return (
72
+ <MessageScrollerPrimitive.Item
73
+ data-slot="message-scroller-item"
74
+ scrollAnchor={scrollAnchor}
75
+ className={cn(
76
+ 'min-w-0 shrink-0 [contain-intrinsic-size:auto_10rem] [content-visibility:auto]',
77
+ className,
78
+ )}
79
+ {...props}
80
+ />
81
+ );
82
+ }
83
+
84
+ function MessageScrollerButton({
85
+ direction = 'end',
86
+ className,
87
+ children,
88
+ render,
89
+ variant = 'secondary',
90
+ size = 'icon-sm',
91
+ ...props
92
+ }: React.ComponentProps<typeof MessageScrollerPrimitive.Button> &
93
+ Pick<React.ComponentProps<typeof Button>, 'variant' | 'size'>) {
94
+ return (
95
+ <MessageScrollerPrimitive.Button
96
+ data-slot="message-scroller-button"
97
+ data-direction={direction}
98
+ data-variant={variant}
99
+ data-size={size}
100
+ direction={direction}
101
+ className={cn(
102
+ 'absolute inset-s-1/2 -translate-x-1/2 border-border bg-background text-foreground transition-[translate,scale,opacity] duration-200 hover:bg-muted hover:text-foreground data-[active=false]:pointer-events-none data-[active=false]:scale-95 data-[active=false]:opacity-0 data-[active=false]:duration-400 data-[active=false]:ease-[cubic-bezier(0.7,0,0.84,0)] data-[active=true]:translate-y-0 data-[active=true]:scale-100 data-[active=true]:opacity-100 data-[active=true]:ease-[cubic-bezier(0.23,1,0.32,1)] data-[direction=end]:bottom-4 data-[direction=end]:data-[active=false]:translate-y-full data-[direction=start]:top-4 data-[direction=start]:data-[active=false]:-translate-y-full rtl:translate-x-1/2 data-[direction=start]:[&_svg]:rotate-180',
103
+ className,
104
+ )}
105
+ render={render ?? <Button variant={variant} size={size} />}
106
+ {...props}
107
+ >
108
+ {children ?? (
109
+ <>
110
+ <IconArrowDownOutline18 />
111
+ <span className="sr-only">
112
+ {direction === 'end' ? 'Scroll to end' : 'Scroll to start'}
113
+ </span>
114
+ </>
115
+ )}
116
+ </MessageScrollerPrimitive.Button>
117
+ );
118
+ }
119
+
120
+ export {
121
+ MessageScroller,
122
+ MessageScrollerButton,
123
+ MessageScrollerContent,
124
+ MessageScrollerItem,
125
+ MessageScrollerProvider,
126
+ MessageScrollerViewport,
127
+ useMessageScroller,
128
+ useMessageScrollerScrollable,
129
+ useMessageScrollerVisibility,
130
+ };
@@ -1,85 +1,85 @@
1
- import * as React from "react"
1
+ import * as React from 'react';
2
2
 
3
- import { cn } from "../../lib/utils"
3
+ import { cn } from '../../lib/utils';
4
4
 
5
- function MessageGroup({ className, ...props }: React.ComponentProps<"div">) {
5
+ function MessageGroup({ className, ...props }: React.ComponentProps<'div'>) {
6
6
  return (
7
7
  <div
8
8
  data-slot="message-group"
9
- className={cn("flex min-w-0 flex-col gap-2", className)}
9
+ className={cn('flex min-w-0 flex-col gap-2', className)}
10
10
  {...props}
11
11
  />
12
- )
12
+ );
13
13
  }
14
14
 
15
15
  function Message({
16
16
  className,
17
- align = "start",
17
+ align = 'start',
18
18
  ...props
19
- }: React.ComponentProps<"div"> & { align?: "start" | "end" }) {
19
+ }: React.ComponentProps<'div'> & { align?: 'start' | 'end' }) {
20
20
  return (
21
21
  <div
22
22
  data-slot="message"
23
23
  data-align={align}
24
24
  className={cn(
25
- "group/message relative flex w-full min-w-0 gap-2 text-sm data-[align=end]:flex-row-reverse",
26
- className
25
+ 'group/message relative flex w-full min-w-0 gap-2 text-sm data-[align=end]:flex-row-reverse',
26
+ className,
27
27
  )}
28
28
  {...props}
29
29
  />
30
- )
30
+ );
31
31
  }
32
32
 
33
- function MessageAvatar({ className, ...props }: React.ComponentProps<"div">) {
33
+ function MessageAvatar({ className, ...props }: React.ComponentProps<'div'>) {
34
34
  return (
35
35
  <div
36
36
  data-slot="message-avatar"
37
37
  className={cn(
38
- "flex w-fit min-w-8 shrink-0 items-center justify-center self-end overflow-hidden rounded-full bg-muted group-has-data-[slot=message-footer]/message:-translate-y-8",
39
- className
38
+ 'flex w-fit min-w-8 shrink-0 items-center justify-center self-end overflow-hidden rounded-full bg-muted group-has-data-[slot=message-footer]/message:-translate-y-8',
39
+ className,
40
40
  )}
41
41
  {...props}
42
42
  />
43
- )
43
+ );
44
44
  }
45
45
 
46
- function MessageContent({ className, ...props }: React.ComponentProps<"div">) {
46
+ function MessageContent({ className, ...props }: React.ComponentProps<'div'>) {
47
47
  return (
48
48
  <div
49
49
  data-slot="message-content"
50
50
  className={cn(
51
- "flex w-full min-w-0 flex-col gap-2.5 wrap-break-word group-data-[align=end]/message:*:data-slot:self-end",
52
- className
51
+ 'flex w-full min-w-0 flex-col gap-2.5 wrap-break-word group-data-[align=end]/message:*:data-slot:self-end',
52
+ className,
53
53
  )}
54
54
  {...props}
55
55
  />
56
- )
56
+ );
57
57
  }
58
58
 
59
- function MessageHeader({ className, ...props }: React.ComponentProps<"div">) {
59
+ function MessageHeader({ className, ...props }: React.ComponentProps<'div'>) {
60
60
  return (
61
61
  <div
62
62
  data-slot="message-header"
63
63
  className={cn(
64
- "flex max-w-full min-w-0 items-center px-3 text-xs font-medium text-muted-foreground group-has-data-[variant=ghost]/message:px-0",
65
- className
64
+ 'flex max-w-full min-w-0 items-center px-3 text-xs font-medium text-muted-foreground group-has-data-[variant=ghost]/message:px-0',
65
+ className,
66
66
  )}
67
67
  {...props}
68
68
  />
69
- )
69
+ );
70
70
  }
71
71
 
72
- function MessageFooter({ className, ...props }: React.ComponentProps<"div">) {
72
+ function MessageFooter({ className, ...props }: React.ComponentProps<'div'>) {
73
73
  return (
74
74
  <div
75
75
  data-slot="message-footer"
76
76
  className={cn(
77
- "flex max-w-full min-w-0 items-center px-3 text-xs font-medium text-muted-foreground group-has-data-[variant=ghost]/message:px-0 group-data-[align=end]/message:justify-end",
78
- className
77
+ 'flex max-w-full min-w-0 items-center px-3 text-xs font-medium text-muted-foreground group-has-data-[variant=ghost]/message:px-0 group-data-[align=end]/message:justify-end',
78
+ className,
79
79
  )}
80
80
  {...props}
81
81
  />
82
- )
82
+ );
83
83
  }
84
84
 
85
85
  export {
@@ -89,4 +89,4 @@ export {
89
89
  MessageContent,
90
90
  MessageFooter,
91
91
  MessageHeader,
92
- }
92
+ };
@@ -1,22 +1,22 @@
1
- import * as React from "react"
1
+ import * as React from 'react';
2
2
 
3
- import { cn } from "../../lib/utils"
4
- import { IconChevronDownOutline18 } from "../../icons"
3
+ import { cn } from '../../lib/utils';
4
+ import { IconChevronDownOutline18 } from '../../icons';
5
5
 
6
- type NativeSelectProps = Omit<React.ComponentProps<"select">, "size"> & {
7
- size?: "sm" | "default"
8
- }
6
+ type NativeSelectProps = Omit<React.ComponentProps<'select'>, 'size'> & {
7
+ size?: 'sm' | 'default';
8
+ };
9
9
 
10
10
  function NativeSelect({
11
11
  className,
12
- size = "default",
12
+ size = 'default',
13
13
  ...props
14
14
  }: NativeSelectProps) {
15
15
  return (
16
16
  <div
17
17
  className={cn(
18
- "group/native-select relative w-fit has-[select:disabled]:opacity-50",
19
- className
18
+ 'group/native-select relative w-fit has-[select:disabled]:opacity-50',
19
+ className,
20
20
  )}
21
21
  data-slot="native-select-wrapper"
22
22
  data-size={size}
@@ -27,35 +27,39 @@ function NativeSelect({
27
27
  className="h-8 w-full min-w-0 appearance-none rounded-lg border border-derived-strong bg-transparent py-1 pr-8 pl-2.5 text-sm transition-colors outline-none select-none selection:bg-primary selection:text-primary-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-[size=sm]:py-0.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40"
28
28
  {...props}
29
29
  />
30
- <IconChevronDownOutline18 className="pointer-events-none absolute top-1/2 right-2.5 size-4 -translate-y-1/2 text-muted-foreground select-none" aria-hidden="true" data-slot="native-select-icon" />
30
+ <IconChevronDownOutline18
31
+ className="pointer-events-none absolute top-1/2 right-2.5 size-4 -translate-y-1/2 text-muted-foreground select-none"
32
+ aria-hidden="true"
33
+ data-slot="native-select-icon"
34
+ />
31
35
  </div>
32
- )
36
+ );
33
37
  }
34
38
 
35
39
  function NativeSelectOption({
36
40
  className,
37
41
  ...props
38
- }: React.ComponentProps<"option">) {
42
+ }: React.ComponentProps<'option'>) {
39
43
  return (
40
44
  <option
41
45
  data-slot="native-select-option"
42
- className={cn("bg-[Canvas] text-[CanvasText]", className)}
46
+ className={cn('bg-[Canvas] text-[CanvasText]', className)}
43
47
  {...props}
44
48
  />
45
- )
49
+ );
46
50
  }
47
51
 
48
52
  function NativeSelectOptGroup({
49
53
  className,
50
54
  ...props
51
- }: React.ComponentProps<"optgroup">) {
55
+ }: React.ComponentProps<'optgroup'>) {
52
56
  return (
53
57
  <optgroup
54
58
  data-slot="native-select-optgroup"
55
- className={cn("bg-[Canvas] text-[CanvasText]", className)}
59
+ className={cn('bg-[Canvas] text-[CanvasText]', className)}
56
60
  {...props}
57
61
  />
58
- )
62
+ );
59
63
  }
60
64
 
61
- export { NativeSelect, NativeSelectOptGroup, NativeSelectOption }
65
+ export { NativeSelect, NativeSelectOptGroup, NativeSelectOption };