@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.
- package/README.md +9 -3
- package/package.json +9 -15
- package/src/components/ui/accordion.tsx +13 -15
- package/src/components/ui/alert-dialog.tsx +38 -38
- package/src/components/ui/alert.tsx +22 -22
- package/src/components/ui/aspect-ratio.tsx +6 -6
- package/src/components/ui/avatar.tsx +30 -30
- package/src/components/ui/badge.tsx +24 -22
- package/src/components/ui/breadcrumb.tsx +34 -37
- package/src/components/ui/bubble.tsx +48 -48
- package/src/components/ui/button-group.tsx +24 -24
- package/src/components/ui/button.tsx +24 -24
- package/src/components/ui/calendar.tsx +94 -81
- package/src/components/ui/card.tsx +30 -30
- package/src/components/ui/carousel.tsx +95 -92
- package/src/components/ui/chart.tsx +110 -110
- package/src/components/ui/checkbox.tsx +9 -10
- package/src/components/ui/collapsible.tsx +5 -5
- package/src/components/ui/combobox.tsx +51 -44
- package/src/components/ui/command.tsx +173 -190
- package/src/components/ui/context-menu.tsx +60 -50
- package/src/components/ui/dialog.tsx +33 -34
- package/src/components/ui/direction.tsx +1 -1
- package/src/components/ui/drawer.tsx +61 -61
- package/src/components/ui/dropdown-menu.tsx +54 -50
- package/src/components/ui/empty.tsx +30 -30
- package/src/components/ui/field.tsx +64 -64
- package/src/components/ui/hover-card.tsx +12 -12
- package/src/components/ui/input-group.tsx +54 -54
- package/src/components/ui/input-otp.tsx +24 -25
- package/src/components/ui/input.tsx +8 -8
- package/src/components/ui/item.tsx +64 -64
- package/src/components/ui/kbd.tsx +8 -8
- package/src/components/ui/klex-logo-combo.tsx +69 -0
- package/src/components/ui/klex-logo-text.tsx +70 -0
- package/src/components/ui/klex-logo.tsx +146 -0
- package/src/components/ui/label.tsx +8 -8
- package/src/components/ui/marker.tsx +25 -25
- package/src/components/ui/menubar.tsx +54 -50
- package/src/components/ui/message-scroller.tsx +130 -0
- package/src/components/ui/message.tsx +27 -27
- package/src/components/ui/native-select.tsx +22 -18
- package/src/components/ui/navigation-menu.tsx +37 -34
- package/src/components/ui/pagination.tsx +34 -31
- package/src/components/ui/popover.tsx +19 -19
- package/src/components/ui/progress.tsx +16 -16
- package/src/components/ui/questionnaire.tsx +72 -69
- package/src/components/ui/radio-group.tsx +9 -9
- package/src/components/ui/resizable.tsx +19 -12
- package/src/components/ui/scroll-area.tsx +10 -10
- package/src/components/ui/select.tsx +39 -34
- package/src/components/ui/separator.tsx +7 -7
- package/src/components/ui/sheet.tsx +31 -32
- package/src/components/ui/sidebar.tsx +244 -232
- package/src/components/ui/skeleton.tsx +5 -5
- package/src/components/ui/slider.tsx +11 -7
- package/src/components/ui/spinner.tsx +15 -6
- package/src/components/ui/stagewise-logo-combo.tsx +43 -0
- package/src/components/ui/stagewise-logo-text.tsx +30 -0
- package/src/components/ui/stagewise-logo.tsx +42 -0
- package/src/components/ui/switch.tsx +9 -9
- package/src/components/ui/table.tsx +31 -31
- package/src/components/ui/tabs.tsx +37 -26
- package/src/components/ui/textarea.tsx +7 -7
- package/src/components/ui/toast.tsx +70 -70
- package/src/components/ui/toggle-group.tsx +26 -26
- package/src/components/ui/toggle.tsx +15 -15
- package/src/components/ui/tooltip.tsx +13 -13
- package/src/hooks/use-mobile.ts +13 -11
- package/src/icons/custom/ui-outline-18/IconKlexOutline18.tsx +39 -0
- package/src/icons/custom/ui-outline-18/IconLaptop.tsx +35 -0
- package/src/icons/custom/ui-outline-18/IconSignOut.tsx +33 -0
- package/src/icons/custom/ui-outline-18/index.ts +4 -1
- package/src/icons/index.ts +43 -20
- package/src/icons/nucleo/social-media/IconMicrosoftEntraId.tsx +56 -0
- package/src/icons/nucleo/social-media/index.ts +1 -0
- package/src/icons/nucleo/ui-outline-18/IconArrowDownOutline18.tsx +4 -3
- package/src/icons/nucleo/ui-outline-18/IconArrowTurnRightOutline18.tsx +32 -0
- package/src/icons/nucleo/ui-outline-18/IconArrowUpOutline18.tsx +35 -0
- package/src/icons/nucleo/ui-outline-18/IconChartPieOutline18.tsx +4 -3
- package/src/icons/nucleo/ui-outline-18/IconChevronMaximizeDiagonal2Outline18.tsx +33 -0
- package/src/icons/nucleo/ui-outline-18/IconChevronUpOutline18.tsx +4 -3
- package/src/icons/nucleo/ui-outline-18/IconEmptyOutline18.tsx +41 -0
- package/src/icons/nucleo/ui-outline-18/IconEyeOffOutline18.tsx +18 -0
- package/src/icons/nucleo/ui-outline-18/IconLinkBrokenOutline18.tsx +66 -0
- package/src/icons/nucleo/ui-outline-18/IconLock18Outline.tsx +48 -0
- package/src/icons/nucleo/ui-outline-18/IconMinusOutline18.tsx +4 -3
- package/src/icons/nucleo/ui-outline-18/IconMsgs2Outline18.tsx +32 -0
- package/src/icons/nucleo/ui-outline-18/IconPanelLeftOutline18.tsx +4 -3
- package/src/icons/nucleo/ui-outline-18/IconSidebarLeft2HideOutline18.tsx +63 -0
- package/src/icons/nucleo/ui-outline-18/IconSidebarRight2HideOutline18.tsx +63 -0
- package/src/icons/nucleo/ui-outline-18/index.ts +11 -1
- package/src/icons/provider/IconAnthropic.tsx +15 -0
- package/src/icons/provider/IconAttio.tsx +9 -0
- package/src/icons/provider/IconCodex.tsx +18 -0
- package/src/icons/provider/IconDiscord.tsx +17 -0
- package/src/icons/provider/IconGemini.tsx +152 -0
- package/src/icons/provider/IconLinear.tsx +9 -0
- package/src/icons/provider/IconOpenAI.tsx +15 -0
- package/src/icons/provider/IconOpenRouter.tsx +24 -0
- package/src/icons/provider/IconSlack.tsx +24 -0
- package/src/icons/provider/IconTelegram.tsx +29 -0
- package/src/icons/provider/IconWhatsapp.tsx +14 -0
- package/src/icons/provider/LICENSE +21 -0
- package/src/icons/provider/index.ts +11 -0
- package/src/index.ts +68 -61
- package/src/lib/utils.ts +3 -3
- package/src/styles/bridge.css +7 -3
- package/src/styles/derived-utilities.css +129 -50
- package/src/styles/index.css +17 -2
- package/src/styles/palette.css +266 -105
- package/src/styles/scroll-fade.css +116 -0
- package/src/styles/tailwind-tokens.css +3 -0
- package/src/styles/theme.css +57 -43
|
@@ -1,106 +1,109 @@
|
|
|
1
|
-
import * as React from
|
|
1
|
+
import * as React from 'react';
|
|
2
2
|
import useEmblaCarousel, {
|
|
3
3
|
type UseEmblaCarouselType,
|
|
4
|
-
} from
|
|
4
|
+
} from 'embla-carousel-react';
|
|
5
5
|
|
|
6
|
-
import { cn } from
|
|
7
|
-
import { Button } from
|
|
8
|
-
import {
|
|
6
|
+
import { cn } from '../../lib/utils';
|
|
7
|
+
import { Button } from './button';
|
|
8
|
+
import {
|
|
9
|
+
IconChevronLeftOutline18,
|
|
10
|
+
IconChevronRightOutline18,
|
|
11
|
+
} from '../../icons';
|
|
9
12
|
|
|
10
|
-
type CarouselApi = UseEmblaCarouselType[1]
|
|
11
|
-
type UseCarouselParameters = Parameters<typeof useEmblaCarousel
|
|
12
|
-
type CarouselOptions = UseCarouselParameters[0]
|
|
13
|
-
type CarouselPlugin = UseCarouselParameters[1]
|
|
13
|
+
type CarouselApi = UseEmblaCarouselType[1];
|
|
14
|
+
type UseCarouselParameters = Parameters<typeof useEmblaCarousel>;
|
|
15
|
+
type CarouselOptions = UseCarouselParameters[0];
|
|
16
|
+
type CarouselPlugin = UseCarouselParameters[1];
|
|
14
17
|
|
|
15
18
|
type CarouselProps = {
|
|
16
|
-
opts?: CarouselOptions
|
|
17
|
-
plugins?: CarouselPlugin
|
|
18
|
-
orientation?:
|
|
19
|
-
setApi?: (api: CarouselApi) => void
|
|
20
|
-
}
|
|
19
|
+
opts?: CarouselOptions;
|
|
20
|
+
plugins?: CarouselPlugin;
|
|
21
|
+
orientation?: 'horizontal' | 'vertical';
|
|
22
|
+
setApi?: (api: CarouselApi) => void;
|
|
23
|
+
};
|
|
21
24
|
|
|
22
25
|
type CarouselContextProps = {
|
|
23
|
-
carouselRef: ReturnType<typeof useEmblaCarousel>[0]
|
|
24
|
-
api: ReturnType<typeof useEmblaCarousel>[1]
|
|
25
|
-
scrollPrev: () => void
|
|
26
|
-
scrollNext: () => void
|
|
27
|
-
canScrollPrev: boolean
|
|
28
|
-
canScrollNext: boolean
|
|
29
|
-
} & CarouselProps
|
|
26
|
+
carouselRef: ReturnType<typeof useEmblaCarousel>[0];
|
|
27
|
+
api: ReturnType<typeof useEmblaCarousel>[1];
|
|
28
|
+
scrollPrev: () => void;
|
|
29
|
+
scrollNext: () => void;
|
|
30
|
+
canScrollPrev: boolean;
|
|
31
|
+
canScrollNext: boolean;
|
|
32
|
+
} & CarouselProps;
|
|
30
33
|
|
|
31
|
-
const CarouselContext = React.createContext<CarouselContextProps | null>(null)
|
|
34
|
+
const CarouselContext = React.createContext<CarouselContextProps | null>(null);
|
|
32
35
|
|
|
33
36
|
function useCarousel() {
|
|
34
|
-
const context = React.useContext(CarouselContext)
|
|
37
|
+
const context = React.useContext(CarouselContext);
|
|
35
38
|
|
|
36
39
|
if (!context) {
|
|
37
|
-
throw new Error(
|
|
40
|
+
throw new Error('useCarousel must be used within a <Carousel />');
|
|
38
41
|
}
|
|
39
42
|
|
|
40
|
-
return context
|
|
43
|
+
return context;
|
|
41
44
|
}
|
|
42
45
|
|
|
43
46
|
function Carousel({
|
|
44
|
-
orientation =
|
|
47
|
+
orientation = 'horizontal',
|
|
45
48
|
opts,
|
|
46
49
|
setApi,
|
|
47
50
|
plugins,
|
|
48
51
|
className,
|
|
49
52
|
children,
|
|
50
53
|
...props
|
|
51
|
-
}: React.ComponentProps<
|
|
54
|
+
}: React.ComponentProps<'div'> & CarouselProps) {
|
|
52
55
|
const [carouselRef, api] = useEmblaCarousel(
|
|
53
56
|
{
|
|
54
57
|
...opts,
|
|
55
|
-
axis: orientation ===
|
|
58
|
+
axis: orientation === 'horizontal' ? 'x' : 'y',
|
|
56
59
|
},
|
|
57
|
-
plugins
|
|
58
|
-
)
|
|
59
|
-
const [canScrollPrev, setCanScrollPrev] = React.useState(false)
|
|
60
|
-
const [canScrollNext, setCanScrollNext] = React.useState(false)
|
|
60
|
+
plugins,
|
|
61
|
+
);
|
|
62
|
+
const [canScrollPrev, setCanScrollPrev] = React.useState(false);
|
|
63
|
+
const [canScrollNext, setCanScrollNext] = React.useState(false);
|
|
61
64
|
|
|
62
65
|
const onSelect = React.useCallback((api: CarouselApi) => {
|
|
63
|
-
if (!api) return
|
|
64
|
-
setCanScrollPrev(api.canScrollPrev())
|
|
65
|
-
setCanScrollNext(api.canScrollNext())
|
|
66
|
-
}, [])
|
|
66
|
+
if (!api) return;
|
|
67
|
+
setCanScrollPrev(api.canScrollPrev());
|
|
68
|
+
setCanScrollNext(api.canScrollNext());
|
|
69
|
+
}, []);
|
|
67
70
|
|
|
68
71
|
const scrollPrev = React.useCallback(() => {
|
|
69
|
-
api?.scrollPrev()
|
|
70
|
-
}, [api])
|
|
72
|
+
api?.scrollPrev();
|
|
73
|
+
}, [api]);
|
|
71
74
|
|
|
72
75
|
const scrollNext = React.useCallback(() => {
|
|
73
|
-
api?.scrollNext()
|
|
74
|
-
}, [api])
|
|
76
|
+
api?.scrollNext();
|
|
77
|
+
}, [api]);
|
|
75
78
|
|
|
76
79
|
const handleKeyDown = React.useCallback(
|
|
77
80
|
(event: React.KeyboardEvent<HTMLDivElement>) => {
|
|
78
|
-
if (event.key ===
|
|
79
|
-
event.preventDefault()
|
|
80
|
-
scrollPrev()
|
|
81
|
-
} else if (event.key ===
|
|
82
|
-
event.preventDefault()
|
|
83
|
-
scrollNext()
|
|
81
|
+
if (event.key === 'ArrowLeft') {
|
|
82
|
+
event.preventDefault();
|
|
83
|
+
scrollPrev();
|
|
84
|
+
} else if (event.key === 'ArrowRight') {
|
|
85
|
+
event.preventDefault();
|
|
86
|
+
scrollNext();
|
|
84
87
|
}
|
|
85
88
|
},
|
|
86
|
-
[scrollPrev, scrollNext]
|
|
87
|
-
)
|
|
89
|
+
[scrollPrev, scrollNext],
|
|
90
|
+
);
|
|
88
91
|
|
|
89
92
|
React.useEffect(() => {
|
|
90
|
-
if (!api || !setApi) return
|
|
91
|
-
setApi(api)
|
|
92
|
-
}, [api, setApi])
|
|
93
|
+
if (!api || !setApi) return;
|
|
94
|
+
setApi(api);
|
|
95
|
+
}, [api, setApi]);
|
|
93
96
|
|
|
94
97
|
React.useEffect(() => {
|
|
95
|
-
if (!api) return
|
|
96
|
-
onSelect(api)
|
|
97
|
-
api.on(
|
|
98
|
-
api.on(
|
|
98
|
+
if (!api) return;
|
|
99
|
+
onSelect(api);
|
|
100
|
+
api.on('reInit', onSelect);
|
|
101
|
+
api.on('select', onSelect);
|
|
99
102
|
|
|
100
103
|
return () => {
|
|
101
|
-
api?.off(
|
|
102
|
-
}
|
|
103
|
-
}, [api, onSelect])
|
|
104
|
+
api?.off('select', onSelect);
|
|
105
|
+
};
|
|
106
|
+
}, [api, onSelect]);
|
|
104
107
|
|
|
105
108
|
return (
|
|
106
109
|
<CarouselContext.Provider
|
|
@@ -109,7 +112,7 @@ function Carousel({
|
|
|
109
112
|
api: api,
|
|
110
113
|
opts,
|
|
111
114
|
orientation:
|
|
112
|
-
orientation || (opts?.axis ===
|
|
115
|
+
orientation || (opts?.axis === 'y' ? 'vertical' : 'horizontal'),
|
|
113
116
|
scrollPrev,
|
|
114
117
|
scrollNext,
|
|
115
118
|
canScrollPrev,
|
|
@@ -118,7 +121,7 @@ function Carousel({
|
|
|
118
121
|
>
|
|
119
122
|
<div
|
|
120
123
|
onKeyDownCapture={handleKeyDown}
|
|
121
|
-
className={cn(
|
|
124
|
+
className={cn('relative', className)}
|
|
122
125
|
role="region"
|
|
123
126
|
aria-roledescription="carousel"
|
|
124
127
|
data-slot="carousel"
|
|
@@ -127,11 +130,11 @@ function Carousel({
|
|
|
127
130
|
{children}
|
|
128
131
|
</div>
|
|
129
132
|
</CarouselContext.Provider>
|
|
130
|
-
)
|
|
133
|
+
);
|
|
131
134
|
}
|
|
132
135
|
|
|
133
|
-
function CarouselContent({ className, ...props }: React.ComponentProps<
|
|
134
|
-
const { carouselRef, orientation } = useCarousel()
|
|
136
|
+
function CarouselContent({ className, ...props }: React.ComponentProps<'div'>) {
|
|
137
|
+
const { carouselRef, orientation } = useCarousel();
|
|
135
138
|
|
|
136
139
|
return (
|
|
137
140
|
<div
|
|
@@ -141,18 +144,18 @@ function CarouselContent({ className, ...props }: React.ComponentProps<"div">) {
|
|
|
141
144
|
>
|
|
142
145
|
<div
|
|
143
146
|
className={cn(
|
|
144
|
-
|
|
145
|
-
orientation ===
|
|
146
|
-
className
|
|
147
|
+
'flex',
|
|
148
|
+
orientation === 'horizontal' ? '-ml-4' : '-mt-4 flex-col',
|
|
149
|
+
className,
|
|
147
150
|
)}
|
|
148
151
|
{...props}
|
|
149
152
|
/>
|
|
150
153
|
</div>
|
|
151
|
-
)
|
|
154
|
+
);
|
|
152
155
|
}
|
|
153
156
|
|
|
154
|
-
function CarouselItem({ className, ...props }: React.ComponentProps<
|
|
155
|
-
const { orientation } = useCarousel()
|
|
157
|
+
function CarouselItem({ className, ...props }: React.ComponentProps<'div'>) {
|
|
158
|
+
const { orientation } = useCarousel();
|
|
156
159
|
|
|
157
160
|
return (
|
|
158
161
|
<div
|
|
@@ -160,22 +163,22 @@ function CarouselItem({ className, ...props }: React.ComponentProps<"div">) {
|
|
|
160
163
|
aria-roledescription="slide"
|
|
161
164
|
data-slot="carousel-item"
|
|
162
165
|
className={cn(
|
|
163
|
-
|
|
164
|
-
orientation ===
|
|
165
|
-
className
|
|
166
|
+
'min-w-0 shrink-0 grow-0 basis-full',
|
|
167
|
+
orientation === 'horizontal' ? 'pl-4' : 'pt-4',
|
|
168
|
+
className,
|
|
166
169
|
)}
|
|
167
170
|
{...props}
|
|
168
171
|
/>
|
|
169
|
-
)
|
|
172
|
+
);
|
|
170
173
|
}
|
|
171
174
|
|
|
172
175
|
function CarouselPrevious({
|
|
173
176
|
className,
|
|
174
|
-
variant =
|
|
175
|
-
size =
|
|
177
|
+
variant = 'outline',
|
|
178
|
+
size = 'icon-sm',
|
|
176
179
|
...props
|
|
177
180
|
}: React.ComponentProps<typeof Button>) {
|
|
178
|
-
const { orientation, scrollPrev, canScrollPrev } = useCarousel()
|
|
181
|
+
const { orientation, scrollPrev, canScrollPrev } = useCarousel();
|
|
179
182
|
|
|
180
183
|
return (
|
|
181
184
|
<Button
|
|
@@ -183,11 +186,11 @@ function CarouselPrevious({
|
|
|
183
186
|
variant={variant}
|
|
184
187
|
size={size}
|
|
185
188
|
className={cn(
|
|
186
|
-
|
|
187
|
-
orientation ===
|
|
188
|
-
?
|
|
189
|
-
:
|
|
190
|
-
className
|
|
189
|
+
'absolute touch-manipulation rounded-full',
|
|
190
|
+
orientation === 'horizontal'
|
|
191
|
+
? 'inset-y-0 -left-12 my-auto'
|
|
192
|
+
: '-top-12 left-1/2 -translate-x-1/2 rotate-90',
|
|
193
|
+
className,
|
|
191
194
|
)}
|
|
192
195
|
disabled={!canScrollPrev}
|
|
193
196
|
onClick={scrollPrev}
|
|
@@ -196,16 +199,16 @@ function CarouselPrevious({
|
|
|
196
199
|
<IconChevronLeftOutline18 />
|
|
197
200
|
<span className="sr-only">Previous slide</span>
|
|
198
201
|
</Button>
|
|
199
|
-
)
|
|
202
|
+
);
|
|
200
203
|
}
|
|
201
204
|
|
|
202
205
|
function CarouselNext({
|
|
203
206
|
className,
|
|
204
|
-
variant =
|
|
205
|
-
size =
|
|
207
|
+
variant = 'outline',
|
|
208
|
+
size = 'icon-sm',
|
|
206
209
|
...props
|
|
207
210
|
}: React.ComponentProps<typeof Button>) {
|
|
208
|
-
const { orientation, scrollNext, canScrollNext } = useCarousel()
|
|
211
|
+
const { orientation, scrollNext, canScrollNext } = useCarousel();
|
|
209
212
|
|
|
210
213
|
return (
|
|
211
214
|
<Button
|
|
@@ -213,11 +216,11 @@ function CarouselNext({
|
|
|
213
216
|
variant={variant}
|
|
214
217
|
size={size}
|
|
215
218
|
className={cn(
|
|
216
|
-
|
|
217
|
-
orientation ===
|
|
218
|
-
?
|
|
219
|
-
:
|
|
220
|
-
className
|
|
219
|
+
'absolute touch-manipulation rounded-full',
|
|
220
|
+
orientation === 'horizontal'
|
|
221
|
+
? 'inset-y-0 -right-12 my-auto'
|
|
222
|
+
: '-bottom-12 left-1/2 -translate-x-1/2 rotate-90',
|
|
223
|
+
className,
|
|
221
224
|
)}
|
|
222
225
|
disabled={!canScrollNext}
|
|
223
226
|
onClick={scrollNext}
|
|
@@ -226,7 +229,7 @@ function CarouselNext({
|
|
|
226
229
|
<IconChevronRightOutline18 />
|
|
227
230
|
<span className="sr-only">Next slide</span>
|
|
228
231
|
</Button>
|
|
229
|
-
)
|
|
232
|
+
);
|
|
230
233
|
}
|
|
231
234
|
|
|
232
235
|
export {
|
|
@@ -237,4 +240,4 @@ export {
|
|
|
237
240
|
CarouselPrevious,
|
|
238
241
|
CarouselNext,
|
|
239
242
|
useCarousel,
|
|
240
|
-
}
|
|
243
|
+
};
|