@stagewise/ui 0.26.1 → 0.28.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stagewise/ui",
3
- "version": "0.26.1",
3
+ "version": "0.28.0",
4
4
  "description": "Customized shadcn/ui components built on Base UI primitives, for use across stagewise projects.",
5
5
  "type": "module",
6
6
  "license": "MIT AND OFL-1.1",
@@ -5,7 +5,7 @@ import { cva, type VariantProps } from 'class-variance-authority';
5
5
  import { cn } from '../../lib/utils';
6
6
 
7
7
  const badgeVariants = cva(
8
- 'group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap select-none transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!',
8
+ 'group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap select-none transition focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!',
9
9
  {
10
10
  variants: {
11
11
  variant: {
@@ -4,7 +4,7 @@ import { cva, type VariantProps } from 'class-variance-authority';
4
4
  import { cn } from '../../lib/utils';
5
5
 
6
6
  const buttonVariants = cva(
7
- "group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
7
+ "group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
8
8
  {
9
9
  variants: {
10
10
  variant: {
@@ -146,7 +146,7 @@ function ContextMenuSubTrigger({
146
146
  {...props}
147
147
  >
148
148
  {children}
149
- <IconChevronRightOutline18 className="ml-auto size-3" />
149
+ <IconChevronRightOutline18 className="ml-auto size-4" />
150
150
  </ContextMenuPrimitive.SubmenuTrigger>
151
151
  );
152
152
  }
@@ -120,7 +120,7 @@ function DropdownMenuSubTrigger({
120
120
  {...props}
121
121
  >
122
122
  {children}
123
- <IconChevronRightOutline18 className="ml-auto size-3" />
123
+ <IconChevronRightOutline18 className="ml-auto size-4" />
124
124
  </MenuPrimitive.SubmenuTrigger>
125
125
  );
126
126
  }
@@ -53,7 +53,7 @@ function InputOTPSlot({
53
53
  data-slot="input-otp-slot"
54
54
  data-active={isActive}
55
55
  className={cn(
56
- 'relative flex size-10 items-center justify-center border-y border-r border-input text-lg transition-all outline-none first:rounded-l-lg first:border-l last:rounded-r-lg aria-invalid:border-destructive data-[active=true]:z-10 data-[active=true]:border-ring data-[active=true]:ring-3 data-[active=true]:ring-ring/50 data-[active=true]:aria-invalid:border-destructive data-[active=true]:aria-invalid:ring-destructive/20 dark:bg-input/30 dark:data-[active=true]:aria-invalid:ring-destructive/40',
56
+ 'relative flex size-10 items-center justify-center border-y border-r border-input text-lg transition outline-none first:rounded-l-lg first:border-l last:rounded-r-lg aria-invalid:border-destructive data-[active=true]:z-10 data-[active=true]:border-ring data-[active=true]:ring-3 data-[active=true]:ring-ring/50 data-[active=true]:aria-invalid:border-destructive data-[active=true]:aria-invalid:ring-destructive/20 dark:bg-input/30 dark:data-[active=true]:aria-invalid:ring-destructive/40',
57
57
  className,
58
58
  )}
59
59
  {...props}
@@ -72,7 +72,7 @@ function NavigationMenuTrigger({
72
72
  >
73
73
  {children}{' '}
74
74
  <IconChevronDownOutline18
75
- className="relative top-px ml-1 size-3 transition duration-300 group-data-popup-open/navigation-menu-trigger:rotate-180 group-data-open/navigation-menu-trigger:rotate-180"
75
+ className="relative top-px ml-1 size-4 transition duration-300 group-data-popup-open/navigation-menu-trigger:rotate-180 group-data-open/navigation-menu-trigger:rotate-180"
76
76
  aria-hidden="true"
77
77
  />
78
78
  </NavigationMenuPrimitive.Trigger>
@@ -1,16 +1,21 @@
1
1
  'use client';
2
2
 
3
3
  import { Switch as SwitchPrimitive } from '@base-ui/react/switch';
4
+ import { useState } from 'react';
4
5
 
5
6
  import { cn } from '../../lib/utils';
6
7
 
7
8
  function Switch({
8
9
  className,
9
10
  size = 'default',
11
+ onCheckedChange,
10
12
  ...props
11
13
  }: SwitchPrimitive.Root.Props & {
12
14
  size?: 'sm' | 'default';
13
15
  }) {
16
+ // The knob springs only once someone flips it: CSS animations also run when
17
+ // an element first renders, so a switch that loads on would slide over.
18
+ const [flipped, setFlipped] = useState(false);
14
19
  return (
15
20
  <SwitchPrimitive.Root
16
21
  data-slot="switch"
@@ -20,10 +25,18 @@ function Switch({
20
25
  className,
21
26
  )}
22
27
  {...props}
28
+ onCheckedChange={(checked, details) => {
29
+ setFlipped(true);
30
+ onCheckedChange?.(checked, details);
31
+ }}
23
32
  >
24
33
  <SwitchPrimitive.Thumb
25
34
  data-slot="switch-thumb"
26
- className="pointer-events-none block rounded-full bg-background ring-0 group-data-[size=default]/switch:h-4 group-data-[size=sm]/switch:h-3 group-data-[size=default]/switch:w-4 group-data-[size=sm]/switch:w-3 group-data-[size=default]/switch:[--knob-w:1rem] group-data-[size=sm]/switch:[--knob-w:0.75rem] group-data-[size=default]/switch:[--knob-travel:14px] group-data-[size=sm]/switch:[--knob-travel:10px] group-data-[size=default]/switch:[--track-w:30px] group-data-[size=sm]/switch:[--track-w:22px] group-data-[size=default]/switch:data-checked:translate-x-[14px] group-data-[size=sm]/switch:data-checked:translate-x-[10px] dark:data-checked:bg-primary-foreground dark:data-unchecked:bg-foreground group-data-checked/switch:animate-switch-knob-on group-data-unchecked/switch:animate-switch-knob-off"
35
+ className={cn(
36
+ 'pointer-events-none block rounded-full bg-background ring-0 group-data-[size=default]/switch:h-4 group-data-[size=sm]/switch:h-3 group-data-[size=default]/switch:w-4 group-data-[size=sm]/switch:w-3 group-data-[size=default]/switch:[--knob-w:1rem] group-data-[size=sm]/switch:[--knob-w:0.75rem] group-data-[size=default]/switch:[--knob-travel:14px] group-data-[size=sm]/switch:[--knob-travel:10px] group-data-[size=default]/switch:[--track-w:30px] group-data-[size=sm]/switch:[--track-w:22px] group-data-[size=default]/switch:data-checked:translate-x-[14px] group-data-[size=sm]/switch:data-checked:translate-x-[10px] dark:data-checked:bg-primary-foreground dark:data-unchecked:bg-foreground',
37
+ flipped &&
38
+ 'group-data-checked/switch:animate-switch-knob-on group-data-unchecked/switch:animate-switch-knob-off',
39
+ )}
27
40
  />
28
41
  </SwitchPrimitive.Root>
29
42
  );
@@ -71,7 +71,7 @@ function TabsTrigger({ className, ...props }: TabsPrimitive.Tab.Props) {
71
71
  <TabsPrimitive.Tab
72
72
  data-slot="tabs-trigger"
73
73
  className={cn(
74
- "relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:relative focus-visible:z-10 focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 aria-disabled:pointer-events-none aria-disabled:opacity-50 dark:text-muted-foreground dark:hover:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
74
+ "relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:relative focus-visible:z-10 focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 aria-disabled:pointer-events-none aria-disabled:opacity-50 dark:text-muted-foreground dark:hover:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
75
75
  'data-active:text-foreground dark:data-active:text-foreground',
76
76
  className,
77
77
  )}
@@ -4,7 +4,7 @@ import { cva, type VariantProps } from 'class-variance-authority';
4
4
  import { cn } from '../../lib/utils';
5
5
 
6
6
  const toggleVariants = cva(
7
- "group/toggle inline-flex items-center justify-center gap-1 rounded-lg text-sm font-medium whitespace-nowrap transition-all outline-none hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-pressed:bg-muted data-[state=on]:bg-muted dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
7
+ "group/toggle inline-flex items-center justify-center gap-1 rounded-lg text-sm font-medium whitespace-nowrap transition outline-none hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-pressed:bg-muted data-[state=on]:bg-muted dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
8
8
  {
9
9
  variants: {
10
10
  variant: {
@@ -134,7 +134,7 @@ function TraceCollapsibleTrigger({
134
134
  className="size-2.5 motion-reduce:animate-none"
135
135
  />
136
136
  ) : (
137
- <IconChevronRightOutline18 className="size-2.5" />
137
+ <IconChevronRightOutline18 className="size-3.5" />
138
138
  )}
139
139
  </TraceIcon>
140
140
  </CollapsibleTrigger>
@@ -1,21 +1,23 @@
1
1
  import * as React from 'react';
2
2
 
3
3
  const MOBILE_BREAKPOINT = 768;
4
+ const MOBILE_QUERY = `(max-width: ${MOBILE_BREAKPOINT - 1}px)`;
4
5
 
6
+ function subscribe(onChange: () => void) {
7
+ const mql = window.matchMedia(MOBILE_QUERY);
8
+ mql.addEventListener('change', onChange);
9
+ return () => mql.removeEventListener('change', onChange);
10
+ }
11
+
12
+ /**
13
+ * Whether the viewport is phone-sized. Read on the first render, so a dialog
14
+ * or sidebar opens as its mobile variant at once instead of switching after
15
+ * one desktop frame.
16
+ */
5
17
  export function useIsMobile() {
6
- const [isMobile, setIsMobile] = React.useState<boolean | undefined>(
7
- undefined,
18
+ return React.useSyncExternalStore(
19
+ subscribe,
20
+ () => window.matchMedia(MOBILE_QUERY).matches,
21
+ () => false,
8
22
  );
9
-
10
- React.useEffect(() => {
11
- const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
12
- const onChange = () => {
13
- setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
14
- };
15
- mql.addEventListener('change', onChange);
16
- setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
17
- return () => mql.removeEventListener('change', onChange);
18
- }, []);
19
-
20
- return !!isMobile;
21
23
  }
@@ -6,12 +6,12 @@ export const IconFilterOutline18: React.FC<
6
6
  IconProps & { strokeWidth?: number }
7
7
  > = ({ strokeWidth = 1.5, ...props }) => (
8
8
  <Icon size="18px" {...props}>
9
+ {/* Three centered lines, each shorter than the one above. */}
9
10
  <path
10
- d="M2.25 3.25h13.5L10.5 9.5v4.75l-3 1V9.5L2.25 3.25Z"
11
+ d="M2.75 5h12.5M5 9h8M7.25 13h3.5"
11
12
  fill="none"
12
13
  stroke="currentColor"
13
14
  strokeLinecap="round"
14
- strokeLinejoin="round"
15
15
  strokeWidth={strokeWidth}
16
16
  />
17
17
  </Icon>
@@ -74,6 +74,7 @@ export {
74
74
  IconAnthropic,
75
75
  IconAsana,
76
76
  IconIntercom,
77
+ IconJira,
77
78
  IconSentry,
78
79
  IconTwilio,
79
80
  IconZai,
@@ -10,7 +10,7 @@ export const IconChevronDownOutline18: React.FC<
10
10
  return (
11
11
  <Icon size="18px" {...props}>
12
12
  <polyline
13
- points="15.25 6.5 9 12.75 2.75 6.5"
13
+ points="13.5 7.375 9 11.875 4.5 7.375"
14
14
  fill="none"
15
15
  stroke="currentColor"
16
16
  strokeLinecap="round"
@@ -10,7 +10,7 @@ export const IconChevronLeftOutline18: React.FC<
10
10
  return (
11
11
  <Icon size="18px" {...props}>
12
12
  <polyline
13
- points="11.5 15.25 5.25 9 11.5 2.75"
13
+ points="10.625 13.5 6.125 9 10.625 4.5"
14
14
  fill="none"
15
15
  stroke="currentColor"
16
16
  strokeLinecap="round"
@@ -10,7 +10,7 @@ export const IconChevronRightOutline18: React.FC<
10
10
  return (
11
11
  <Icon size="18px" {...props}>
12
12
  <polyline
13
- points="6.5 2.75 12.75 9 6.5 15.25"
13
+ points="7.375 4.5 11.875 9 7.375 13.5"
14
14
  fill="none"
15
15
  stroke="currentColor"
16
16
  strokeLinecap="round"
@@ -11,7 +11,7 @@ export const IconChevronUpOutline18: React.FC<IconChevronUpOutline18Props> = ({
11
11
  return (
12
12
  <Icon size="18px" {...props}>
13
13
  <polyline
14
- points="2.75 11.5 9 5.25 15.25 11.5"
14
+ points="4.5 10.625 9 6.125 13.5 10.625"
15
15
  fill="none"
16
16
  stroke="currentColor"
17
17
  strokeLinecap="round"
@@ -0,0 +1,14 @@
1
+ import type { SVGProps } from 'react';
2
+
3
+ export function IconJira(props: SVGProps<SVGSVGElement>) {
4
+ return (
5
+ <svg
6
+ aria-hidden="true"
7
+ viewBox="0 0 256 256"
8
+ fill="currentColor"
9
+ {...props}
10
+ >
11
+ <path d="M244.658 0H121.707a55.5 55.5 0 0 0 55.502 55.502h22.649V77.37c.02 30.625 24.841 55.447 55.466 55.467V10.666C255.324 4.777 250.55 0 244.658 0M183.822 61.262H60.872c.019 30.625 24.84 55.447 55.466 55.467h22.649v21.938c.039 30.625 24.877 55.43 55.502 55.43V71.93c0-5.891-4.776-10.667-10.667-10.667M122.951 122.489H0c0 30.653 24.85 55.502 55.502 55.502h22.72v21.867c.02 30.597 24.798 55.408 55.396 55.466V133.156c0-5.891-4.776-10.667-10.667-10.667" />
12
+ </svg>
13
+ );
14
+ }
@@ -1,6 +1,7 @@
1
1
  export { IconAnthropic } from './IconAnthropic';
2
2
  export { IconAsana } from './IconAsana';
3
3
  export { IconIntercom } from './IconIntercom';
4
+ export { IconJira } from './IconJira';
4
5
  export { IconSentry } from './IconSentry';
5
6
  export { IconTwilio } from './IconTwilio';
6
7
  export { IconAttio } from './IconAttio';
@@ -54,7 +54,8 @@
54
54
  }
55
55
 
56
56
  body {
57
- @apply bg-background text-foreground;
57
+ /* Grayscale smoothing on macOS, as the system UI draws its text. */
58
+ @apply bg-background text-foreground antialiased;
58
59
  }
59
60
 
60
61
  :root {