@brightlocal/ui-components 2.17.1 → 2.19.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 +83 -1
- package/component-meta.json +23 -7
- package/dist/alert-dialog.cjs +1 -1
- package/dist/alert-dialog.d.ts +23 -2
- package/dist/alert-dialog.d.ts.map +1 -1
- package/dist/alert-dialog.js +21 -19
- package/dist/blocks/input-list.cjs +2 -2
- package/dist/blocks/input-list.d.ts.map +1 -1
- package/dist/blocks/input-list.js +64 -63
- package/dist/blocks/sidebar.cjs +1 -1
- package/dist/blocks/sidebar.d.ts +2 -0
- package/dist/blocks/sidebar.d.ts.map +1 -1
- package/dist/blocks/sidebar.js +426 -403
- package/dist/card.cjs +1 -1
- package/dist/card.d.ts +22 -2
- package/dist/card.d.ts.map +1 -1
- package/dist/card.js +93 -72
- package/dist/chip.cjs +1 -1
- package/dist/chip.d.ts.map +1 -1
- package/dist/chip.js +1 -7
- package/dist/dialog.cjs +1 -1
- package/dist/dialog.d.ts +23 -3
- package/dist/dialog.d.ts.map +1 -1
- package/dist/dialog.js +44 -42
- package/dist/dropdown-menu.cjs +1 -1
- package/dist/dropdown-menu.d.ts +10 -0
- package/dist/dropdown-menu.d.ts.map +1 -1
- package/dist/dropdown-menu.js +30 -29
- package/dist/field.cjs +1 -1
- package/dist/field.d.ts +5 -1
- package/dist/field.d.ts.map +1 -1
- package/dist/field.js +9 -7
- package/dist/global-layout.cjs +1 -1
- package/dist/global-layout.d.ts.map +1 -1
- package/dist/global-layout.js +44 -42
- package/dist/hooks/use-prefers-reduced-motion.cjs +1 -1
- package/dist/hooks/use-prefers-reduced-motion.d.ts +25 -2
- package/dist/hooks/use-prefers-reduced-motion.d.ts.map +1 -1
- package/dist/hooks/use-prefers-reduced-motion.js +17 -11
- package/dist/index.cjs +1 -1
- package/dist/index.js +38 -37
- package/dist/link.cjs +1 -1
- package/dist/link.d.ts +13 -2
- package/dist/link.d.ts.map +1 -1
- package/dist/link.js +110 -53
- package/dist/logo.cjs +1 -1
- package/dist/logo.d.ts.map +1 -1
- package/dist/logo.js +44 -37
- package/dist/map.cjs +1 -1
- package/dist/map.d.ts.map +1 -1
- package/dist/map.js +1 -1
- package/dist/progress.cjs +1 -1
- package/dist/progress.d.ts.map +1 -1
- package/dist/progress.js +26 -25
- package/dist/sheet.cjs +1 -1
- package/dist/sheet.d.ts +17 -2
- package/dist/sheet.d.ts.map +1 -1
- package/dist/sheet.js +29 -27
- package/dist/stepper.cjs +1 -1
- package/dist/stepper.d.ts +15 -13
- package/dist/stepper.d.ts.map +1 -1
- package/dist/stepper.js +84 -85
- package/package.json +3 -3
- package/src/blocks/input-list.tsx +8 -1
- package/src/blocks/sidebar.tsx +47 -7
- package/src/components/alert-dialog.tsx +38 -4
- package/src/components/card.tsx +56 -9
- package/src/components/chip.tsx +1 -4
- package/src/components/dialog.tsx +39 -6
- package/src/components/dropdown-menu.tsx +7 -1
- package/src/components/field.tsx +6 -0
- package/src/components/global-layout.tsx +3 -1
- package/src/components/link.tsx +103 -27
- package/src/components/logo.tsx +19 -25
- package/src/components/map.tsx +1 -2
- package/src/components/progress.tsx +12 -6
- package/src/components/sheet.tsx +30 -5
- package/src/components/stepper.tsx +93 -80
- package/src/hooks/use-prefers-reduced-motion.ts +35 -5
package/src/blocks/sidebar.tsx
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import * as React from "react";
|
|
4
|
+
import { createPortal } from "react-dom";
|
|
4
5
|
import { Slot } from "@radix-ui/react-slot";
|
|
5
6
|
import { cva, type VariantProps } from "class-variance-authority";
|
|
6
7
|
import {
|
|
@@ -189,6 +190,8 @@ type SidebarContext = {
|
|
|
189
190
|
setOpenMobile: (open: boolean) => void;
|
|
190
191
|
isMobile: boolean;
|
|
191
192
|
toggleSidebar: () => void;
|
|
193
|
+
footerPortalEl: HTMLDivElement | null;
|
|
194
|
+
setFooterPortalEl: (el: HTMLDivElement | null) => void;
|
|
192
195
|
};
|
|
193
196
|
|
|
194
197
|
const SidebarContext = React.createContext<SidebarContext | null>(null);
|
|
@@ -253,6 +256,8 @@ const SidebarProvider = React.forwardRef<HTMLDivElement, SidebarProviderProps>(
|
|
|
253
256
|
) => {
|
|
254
257
|
const isMobile = useIsBelowBreakpoint("lg");
|
|
255
258
|
const [openMobile, setOpenMobile] = React.useState(false);
|
|
259
|
+
const [footerPortalEl, setFooterPortalEl] =
|
|
260
|
+
React.useState<HTMLDivElement | null>(null);
|
|
256
261
|
|
|
257
262
|
// Internal state for uncontrolled usage
|
|
258
263
|
const [_open, _setOpen] = React.useState(defaultOpen);
|
|
@@ -307,8 +312,19 @@ const SidebarProvider = React.forwardRef<HTMLDivElement, SidebarProviderProps>(
|
|
|
307
312
|
openMobile,
|
|
308
313
|
setOpenMobile,
|
|
309
314
|
toggleSidebar,
|
|
315
|
+
footerPortalEl,
|
|
316
|
+
setFooterPortalEl,
|
|
310
317
|
}),
|
|
311
|
-
[
|
|
318
|
+
[
|
|
319
|
+
state,
|
|
320
|
+
open,
|
|
321
|
+
setOpen,
|
|
322
|
+
isMobile,
|
|
323
|
+
openMobile,
|
|
324
|
+
setOpenMobile,
|
|
325
|
+
toggleSidebar,
|
|
326
|
+
footerPortalEl,
|
|
327
|
+
]
|
|
312
328
|
);
|
|
313
329
|
|
|
314
330
|
return (
|
|
@@ -669,7 +685,7 @@ const SidebarHeader = React.forwardRef<HTMLElement, SidebarHeaderProps>(
|
|
|
669
685
|
<header
|
|
670
686
|
ref={ref}
|
|
671
687
|
className={cn(
|
|
672
|
-
"pr-section-xs flex flex-col gap-2 pt-2 pb-9 pl-8",
|
|
688
|
+
"pr-section-xs flex shrink-0 flex-col gap-2 pt-2 pb-9 pl-8",
|
|
673
689
|
className
|
|
674
690
|
)}
|
|
675
691
|
data-hook={dataHook}
|
|
@@ -691,15 +707,23 @@ interface SidebarFooterProps extends React.ComponentProps<"footer"> {
|
|
|
691
707
|
|
|
692
708
|
const SidebarFooter = React.forwardRef<HTMLElement, SidebarFooterProps>(
|
|
693
709
|
({ className, dataHook, ...props }, ref) => {
|
|
694
|
-
|
|
710
|
+
const { footerPortalEl } = useSidebar();
|
|
711
|
+
|
|
712
|
+
const footer = (
|
|
695
713
|
<footer
|
|
696
714
|
ref={ref}
|
|
697
|
-
className={cn("flex flex-col gap-
|
|
715
|
+
className={cn("flex shrink-0 flex-col gap-1 p-1", className)}
|
|
698
716
|
data-hook={dataHook}
|
|
699
717
|
data-slot="sidebar-footer"
|
|
700
718
|
{...props}
|
|
701
719
|
/>
|
|
702
720
|
);
|
|
721
|
+
|
|
722
|
+
if (footerPortalEl) {
|
|
723
|
+
return createPortal(footer, footerPortalEl);
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
return footer;
|
|
703
727
|
}
|
|
704
728
|
);
|
|
705
729
|
SidebarFooter.displayName = "SidebarFooter";
|
|
@@ -741,13 +765,16 @@ interface SidebarContentProps extends Omit<React.ComponentProps<"div">, "dir"> {
|
|
|
741
765
|
|
|
742
766
|
const SidebarContent = React.forwardRef<HTMLDivElement, SidebarContentProps>(
|
|
743
767
|
({ className, dataHook, ariaLabel = "Sidebar", children, ...props }, ref) => {
|
|
744
|
-
const { isMobile } = useSidebar();
|
|
768
|
+
const { isMobile, setFooterPortalEl } = useSidebar();
|
|
769
|
+
const viewportRef = React.useRef<HTMLElement | null>(null);
|
|
770
|
+
const [hasOverflow, setHasOverflow] = React.useState(false);
|
|
745
771
|
|
|
746
772
|
const scrollAreaRef = React.useCallback(
|
|
747
773
|
(node: HTMLDivElement | null) => {
|
|
748
774
|
const viewport = node?.querySelector<HTMLElement>(
|
|
749
775
|
'[data-slot="scroll-area-viewport"]'
|
|
750
776
|
);
|
|
777
|
+
viewportRef.current = viewport ?? null;
|
|
751
778
|
if (viewport) viewport.tabIndex = -1;
|
|
752
779
|
if (typeof ref === "function") ref(node);
|
|
753
780
|
else if (ref) ref.current = node;
|
|
@@ -755,11 +782,23 @@ const SidebarContent = React.forwardRef<HTMLDivElement, SidebarContentProps>(
|
|
|
755
782
|
[ref]
|
|
756
783
|
);
|
|
757
784
|
|
|
785
|
+
React.useEffect(() => {
|
|
786
|
+
const vp = viewportRef.current;
|
|
787
|
+
if (!vp) return;
|
|
788
|
+
|
|
789
|
+
const check = () => setHasOverflow(vp.scrollHeight > vp.clientHeight);
|
|
790
|
+
const ro = new ResizeObserver(check);
|
|
791
|
+
ro.observe(vp);
|
|
792
|
+
if (vp.firstElementChild) ro.observe(vp.firstElementChild);
|
|
793
|
+
|
|
794
|
+
return () => ro.disconnect();
|
|
795
|
+
}, []);
|
|
796
|
+
|
|
758
797
|
return (
|
|
759
798
|
<ScrollArea
|
|
760
799
|
ref={scrollAreaRef}
|
|
761
800
|
className={cn(
|
|
762
|
-
"min-h-0 flex-1 group-data-[collapsible=icon]:overflow-hidden [&_[data-slot=scroll-area-viewport]>div]:
|
|
801
|
+
"min-h-0 flex-1 group-data-[collapsible=icon]:overflow-hidden **:data-[slot=scroll-area-scrollbar]:w-1.5 **:data-[slot=scroll-area-scrollbar]:border-l-0 **:data-[slot=scroll-area-scrollbar]:p-0 [&_[data-slot=scroll-area-viewport]>div]:flex! [&_[data-slot=scroll-area-viewport]>div]:min-h-full [&_[data-slot=scroll-area-viewport]>div]:flex-col",
|
|
763
802
|
className
|
|
764
803
|
)}
|
|
765
804
|
dataHook={dataHook ?? "sidebar-content-scroll"}
|
|
@@ -768,11 +807,12 @@ const SidebarContent = React.forwardRef<HTMLDivElement, SidebarContentProps>(
|
|
|
768
807
|
>
|
|
769
808
|
<nav
|
|
770
809
|
aria-label={ariaLabel}
|
|
771
|
-
className="flex flex-col gap-2"
|
|
810
|
+
className={cn("flex flex-col gap-2", hasOverflow && "pr-2")}
|
|
772
811
|
data-slot="sidebar-content"
|
|
773
812
|
>
|
|
774
813
|
{children}
|
|
775
814
|
</nav>
|
|
815
|
+
<div ref={setFooterPortalEl} className="mt-auto" />
|
|
776
816
|
</ScrollArea>
|
|
777
817
|
);
|
|
778
818
|
}
|
|
@@ -131,13 +131,27 @@ const AlertDialogFooter = React.forwardRef<
|
|
|
131
131
|
|
|
132
132
|
AlertDialogFooter.displayName = "AlertDialogFooter";
|
|
133
133
|
|
|
134
|
+
/**
|
|
135
|
+
* Props for the AlertDialogTitle component
|
|
136
|
+
*/
|
|
137
|
+
interface AlertDialogTitleProps extends React.ComponentProps<
|
|
138
|
+
typeof AlertDialogPrimitive.Title
|
|
139
|
+
> {
|
|
140
|
+
/**
|
|
141
|
+
* Data hook for automated testing
|
|
142
|
+
* @example "alert-dialog-title"
|
|
143
|
+
*/
|
|
144
|
+
dataHook?: string;
|
|
145
|
+
}
|
|
146
|
+
|
|
134
147
|
const AlertDialogTitle = React.forwardRef<
|
|
135
148
|
React.ComponentRef<typeof AlertDialogPrimitive.Title>,
|
|
136
|
-
|
|
137
|
-
>(({ className, ...props }, ref) => (
|
|
149
|
+
AlertDialogTitleProps
|
|
150
|
+
>(({ className, dataHook, ...props }, ref) => (
|
|
138
151
|
<AlertDialogPrimitive.Title
|
|
139
152
|
ref={ref}
|
|
140
153
|
className={cn("text-lg font-semibold", className)}
|
|
154
|
+
data-hook={dataHook}
|
|
141
155
|
data-slot="alert-dialog-title"
|
|
142
156
|
{...props}
|
|
143
157
|
/>
|
|
@@ -145,13 +159,27 @@ const AlertDialogTitle = React.forwardRef<
|
|
|
145
159
|
|
|
146
160
|
AlertDialogTitle.displayName = "AlertDialogTitle";
|
|
147
161
|
|
|
162
|
+
/**
|
|
163
|
+
* Props for the AlertDialogDescription component
|
|
164
|
+
*/
|
|
165
|
+
interface AlertDialogDescriptionProps extends React.ComponentProps<
|
|
166
|
+
typeof AlertDialogPrimitive.Description
|
|
167
|
+
> {
|
|
168
|
+
/**
|
|
169
|
+
* Data hook for automated testing
|
|
170
|
+
* @example "alert-dialog-description"
|
|
171
|
+
*/
|
|
172
|
+
dataHook?: string;
|
|
173
|
+
}
|
|
174
|
+
|
|
148
175
|
const AlertDialogDescription = React.forwardRef<
|
|
149
176
|
React.ComponentRef<typeof AlertDialogPrimitive.Description>,
|
|
150
|
-
|
|
151
|
-
>(({ className, ...props }, ref) => (
|
|
177
|
+
AlertDialogDescriptionProps
|
|
178
|
+
>(({ className, dataHook, ...props }, ref) => (
|
|
152
179
|
<AlertDialogPrimitive.Description
|
|
153
180
|
ref={ref}
|
|
154
181
|
className={cn("text-muted-foreground text-sm", className)}
|
|
182
|
+
data-hook={dataHook}
|
|
155
183
|
data-slot="alert-dialog-description"
|
|
156
184
|
{...props}
|
|
157
185
|
/>
|
|
@@ -200,3 +228,9 @@ export {
|
|
|
200
228
|
AlertDialogAction,
|
|
201
229
|
AlertDialogCancel,
|
|
202
230
|
};
|
|
231
|
+
|
|
232
|
+
export type {
|
|
233
|
+
AlertDialogDescriptionProps,
|
|
234
|
+
AlertDialogProps,
|
|
235
|
+
AlertDialogTitleProps,
|
|
236
|
+
};
|
package/src/components/card.tsx
CHANGED
|
@@ -172,22 +172,61 @@ type CardSubComponentProps = React.ComponentProps<"div"> & {
|
|
|
172
172
|
* Content to render inside the component
|
|
173
173
|
*/
|
|
174
174
|
children?: React.ReactNode;
|
|
175
|
+
/**
|
|
176
|
+
* Data hook for automated testing
|
|
177
|
+
* @example "card-header", "card-title"
|
|
178
|
+
*/
|
|
179
|
+
dataHook?: string;
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Alignment variant for CardHeader layout.
|
|
184
|
+
*/
|
|
185
|
+
type CardHeaderAlign = "left" | "center" | "right";
|
|
186
|
+
|
|
187
|
+
const cardHeaderVariants = cva(
|
|
188
|
+
"@container/card-header grid auto-rows-min grid-rows-[auto_auto] gap-1.5 has-data-[slot=card-action]:grid-cols-[1fr_auto]",
|
|
189
|
+
{
|
|
190
|
+
variants: {
|
|
191
|
+
align: {
|
|
192
|
+
left: "items-start",
|
|
193
|
+
center: "justify-items-center text-center",
|
|
194
|
+
right: "items-start text-right",
|
|
195
|
+
},
|
|
196
|
+
},
|
|
197
|
+
defaultVariants: {
|
|
198
|
+
align: "left",
|
|
199
|
+
},
|
|
200
|
+
}
|
|
201
|
+
);
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Props for the CardHeader component.
|
|
205
|
+
*/
|
|
206
|
+
type CardHeaderProps = CardSubComponentProps & {
|
|
207
|
+
/**
|
|
208
|
+
* Content alignment within the header.
|
|
209
|
+
* Use `"center"` for status screens with an illustration above heading and description.
|
|
210
|
+
* @default "left"
|
|
211
|
+
*/
|
|
212
|
+
align?: CardHeaderAlign;
|
|
175
213
|
};
|
|
176
214
|
|
|
177
215
|
/**
|
|
178
216
|
* Header section of the Card containing title and description.
|
|
179
217
|
*/
|
|
180
|
-
const CardHeader = React.forwardRef<HTMLDivElement,
|
|
181
|
-
({ className, ...props }, ref) => {
|
|
218
|
+
const CardHeader = React.forwardRef<HTMLDivElement, CardHeaderProps>(
|
|
219
|
+
({ className, align = "left", dataHook, ...props }, ref) => {
|
|
182
220
|
const { flush, density } = React.useContext(CardContext);
|
|
183
221
|
return (
|
|
184
222
|
<div
|
|
185
223
|
ref={ref}
|
|
186
224
|
className={cn(
|
|
187
|
-
|
|
225
|
+
cardHeaderVariants({ align }),
|
|
188
226
|
subPadding(flush, density),
|
|
189
227
|
className
|
|
190
228
|
)}
|
|
229
|
+
data-hook={dataHook}
|
|
191
230
|
data-slot="card-header"
|
|
192
231
|
{...props}
|
|
193
232
|
/>
|
|
@@ -228,10 +267,11 @@ type CardTitleProps = CardSubComponentProps & {
|
|
|
228
267
|
* Title element within the Card header.
|
|
229
268
|
*/
|
|
230
269
|
const CardTitle = React.forwardRef<HTMLDivElement, CardTitleProps>(
|
|
231
|
-
({ className, size = "default", ...props }, ref) => (
|
|
270
|
+
({ className, size = "default", dataHook, ...props }, ref) => (
|
|
232
271
|
<div
|
|
233
272
|
ref={ref}
|
|
234
273
|
className={cn(cardTitleVariants({ size }), className)}
|
|
274
|
+
data-hook={dataHook}
|
|
235
275
|
data-slot="card-title"
|
|
236
276
|
{...props}
|
|
237
277
|
/>
|
|
@@ -243,13 +283,14 @@ CardTitle.displayName = "CardTitle";
|
|
|
243
283
|
* Description text within the Card header.
|
|
244
284
|
*/
|
|
245
285
|
const CardDescription = React.forwardRef<HTMLDivElement, CardSubComponentProps>(
|
|
246
|
-
({ className, ...props }, ref) => (
|
|
286
|
+
({ className, dataHook, ...props }, ref) => (
|
|
247
287
|
<div
|
|
248
288
|
ref={ref}
|
|
249
289
|
className={cn(
|
|
250
290
|
"text-muted-foreground text-sm leading-normal font-normal",
|
|
251
291
|
className
|
|
252
292
|
)}
|
|
293
|
+
data-hook={dataHook}
|
|
253
294
|
data-slot="card-description"
|
|
254
295
|
{...props}
|
|
255
296
|
/>
|
|
@@ -261,13 +302,14 @@ CardDescription.displayName = "CardDescription";
|
|
|
261
302
|
* Action area within the Card header for buttons or controls.
|
|
262
303
|
*/
|
|
263
304
|
const CardAction = React.forwardRef<HTMLDivElement, CardSubComponentProps>(
|
|
264
|
-
({ className, ...props }, ref) => (
|
|
305
|
+
({ className, dataHook, ...props }, ref) => (
|
|
265
306
|
<div
|
|
266
307
|
ref={ref}
|
|
267
308
|
className={cn(
|
|
268
309
|
"col-start-2 row-span-2 row-start-1 self-start justify-self-end",
|
|
269
310
|
className
|
|
270
311
|
)}
|
|
312
|
+
data-hook={dataHook}
|
|
271
313
|
data-slot="card-action"
|
|
272
314
|
{...props}
|
|
273
315
|
/>
|
|
@@ -279,12 +321,13 @@ CardAction.displayName = "CardAction";
|
|
|
279
321
|
* Media container for images, videos, or other visual content within the Card.
|
|
280
322
|
*/
|
|
281
323
|
const CardMedia = React.forwardRef<HTMLDivElement, CardSubComponentProps>(
|
|
282
|
-
({ className, children, ...props }, ref) => {
|
|
324
|
+
({ className, children, dataHook, ...props }, ref) => {
|
|
283
325
|
const { flush, density } = React.useContext(CardContext);
|
|
284
326
|
return (
|
|
285
327
|
<div
|
|
286
328
|
ref={ref}
|
|
287
329
|
className={cn(subPadding(flush, density), className)}
|
|
330
|
+
data-hook={dataHook}
|
|
288
331
|
data-slot="card-media"
|
|
289
332
|
{...props}
|
|
290
333
|
>
|
|
@@ -301,12 +344,13 @@ CardMedia.displayName = "CardMedia";
|
|
|
301
344
|
* Main content area of the Card.
|
|
302
345
|
*/
|
|
303
346
|
const CardContent = React.forwardRef<HTMLDivElement, CardSubComponentProps>(
|
|
304
|
-
({ className, ...props }, ref) => {
|
|
347
|
+
({ className, dataHook, ...props }, ref) => {
|
|
305
348
|
const { flush, density } = React.useContext(CardContext);
|
|
306
349
|
return (
|
|
307
350
|
<div
|
|
308
351
|
ref={ref}
|
|
309
352
|
className={cn(subPadding(flush, density), className)}
|
|
353
|
+
data-hook={dataHook}
|
|
310
354
|
data-slot="card-content"
|
|
311
355
|
{...props}
|
|
312
356
|
/>
|
|
@@ -319,7 +363,7 @@ CardContent.displayName = "CardContent";
|
|
|
319
363
|
* Footer section of the Card for actions or metadata.
|
|
320
364
|
*/
|
|
321
365
|
const CardFooter = React.forwardRef<HTMLDivElement, CardSubComponentProps>(
|
|
322
|
-
({ className, ...props }, ref) => {
|
|
366
|
+
({ className, dataHook, ...props }, ref) => {
|
|
323
367
|
const { flush, density } = React.useContext(CardContext);
|
|
324
368
|
return (
|
|
325
369
|
<div
|
|
@@ -329,6 +373,7 @@ const CardFooter = React.forwardRef<HTMLDivElement, CardSubComponentProps>(
|
|
|
329
373
|
subPadding(flush, density),
|
|
330
374
|
className
|
|
331
375
|
)}
|
|
376
|
+
data-hook={dataHook}
|
|
332
377
|
data-slot="card-footer"
|
|
333
378
|
{...props}
|
|
334
379
|
/>
|
|
@@ -351,6 +396,8 @@ export {
|
|
|
351
396
|
export type {
|
|
352
397
|
CardProps,
|
|
353
398
|
CardSubComponentProps,
|
|
399
|
+
CardHeaderProps,
|
|
400
|
+
CardHeaderAlign,
|
|
354
401
|
CardTitleProps,
|
|
355
402
|
CardTitleSize,
|
|
356
403
|
CardVariant,
|
package/src/components/chip.tsx
CHANGED
|
@@ -232,10 +232,7 @@ const Chip = React.forwardRef<HTMLDivElement, ChipProps>(
|
|
|
232
232
|
data-slot="chip-loading"
|
|
233
233
|
role="status"
|
|
234
234
|
>
|
|
235
|
-
<LoaderCircle
|
|
236
|
-
className="animate-spin motion-reduce:animate-none"
|
|
237
|
-
size={iconSize}
|
|
238
|
-
/>
|
|
235
|
+
<LoaderCircle className="animate-spin" size={iconSize} />
|
|
239
236
|
</span>
|
|
240
237
|
) : (
|
|
241
238
|
<button
|
|
@@ -35,8 +35,8 @@ const DialogTrigger = React.forwardRef<
|
|
|
35
35
|
>(({ dataHook, ...props }, ref) => (
|
|
36
36
|
<DialogPrimitive.Trigger
|
|
37
37
|
ref={ref}
|
|
38
|
-
data-hook={dataHook}
|
|
39
38
|
data-slot="dialog-trigger"
|
|
39
|
+
{...(dataHook != null && { "data-hook": dataHook })}
|
|
40
40
|
{...props}
|
|
41
41
|
/>
|
|
42
42
|
));
|
|
@@ -191,34 +191,62 @@ const DialogFooter = React.forwardRef<
|
|
|
191
191
|
));
|
|
192
192
|
DialogFooter.displayName = "DialogFooter";
|
|
193
193
|
|
|
194
|
+
/**
|
|
195
|
+
* Props for the DialogTitle component
|
|
196
|
+
*/
|
|
197
|
+
interface DialogTitleProps extends React.ComponentProps<
|
|
198
|
+
typeof DialogPrimitive.Title
|
|
199
|
+
> {
|
|
200
|
+
/**
|
|
201
|
+
* Data hook for automated testing
|
|
202
|
+
* @example "dialog-title"
|
|
203
|
+
*/
|
|
204
|
+
dataHook?: string;
|
|
205
|
+
}
|
|
206
|
+
|
|
194
207
|
/**
|
|
195
208
|
* DialogTitle - The title of the dialog
|
|
196
209
|
* @description Renders an accessible title for the dialog
|
|
197
210
|
*/
|
|
198
211
|
const DialogTitle = React.forwardRef<
|
|
199
212
|
React.ComponentRef<typeof DialogPrimitive.Title>,
|
|
200
|
-
|
|
201
|
-
>(({ className, ...props }, ref) => (
|
|
213
|
+
DialogTitleProps
|
|
214
|
+
>(({ className, dataHook, ...props }, ref) => (
|
|
202
215
|
<DialogPrimitive.Title
|
|
203
216
|
ref={ref}
|
|
204
217
|
className={cn("text-lg leading-none font-semibold", className)}
|
|
218
|
+
data-hook={dataHook}
|
|
205
219
|
data-slot="dialog-title"
|
|
206
220
|
{...props}
|
|
207
221
|
/>
|
|
208
222
|
));
|
|
209
223
|
DialogTitle.displayName = "DialogTitle";
|
|
210
224
|
|
|
225
|
+
/**
|
|
226
|
+
* Props for the DialogDescription component
|
|
227
|
+
*/
|
|
228
|
+
interface DialogDescriptionProps extends React.ComponentProps<
|
|
229
|
+
typeof DialogPrimitive.Description
|
|
230
|
+
> {
|
|
231
|
+
/**
|
|
232
|
+
* Data hook for automated testing
|
|
233
|
+
* @example "dialog-description"
|
|
234
|
+
*/
|
|
235
|
+
dataHook?: string;
|
|
236
|
+
}
|
|
237
|
+
|
|
211
238
|
/**
|
|
212
239
|
* DialogDescription - The description of the dialog
|
|
213
240
|
* @description Renders an accessible description for the dialog
|
|
214
241
|
*/
|
|
215
242
|
const DialogDescription = React.forwardRef<
|
|
216
243
|
React.ComponentRef<typeof DialogPrimitive.Description>,
|
|
217
|
-
|
|
218
|
-
>(({ className, ...props }, ref) => (
|
|
244
|
+
DialogDescriptionProps
|
|
245
|
+
>(({ className, dataHook, ...props }, ref) => (
|
|
219
246
|
<DialogPrimitive.Description
|
|
220
247
|
ref={ref}
|
|
221
248
|
className={cn("text-muted-foreground text-sm", className)}
|
|
249
|
+
data-hook={dataHook}
|
|
222
250
|
data-slot="dialog-description"
|
|
223
251
|
{...props}
|
|
224
252
|
/>
|
|
@@ -238,4 +266,9 @@ export {
|
|
|
238
266
|
DialogTrigger,
|
|
239
267
|
};
|
|
240
268
|
|
|
241
|
-
export type {
|
|
269
|
+
export type {
|
|
270
|
+
DialogContentProps,
|
|
271
|
+
DialogDescriptionProps,
|
|
272
|
+
DialogTitleProps,
|
|
273
|
+
DialogTriggerProps,
|
|
274
|
+
};
|
|
@@ -364,6 +364,11 @@ DropdownMenuRadioItem.displayName = "DropdownMenuRadioItem";
|
|
|
364
364
|
type DropdownMenuLabelProps = React.ComponentPropsWithoutRef<
|
|
365
365
|
typeof DropdownMenuPrimitive.Label
|
|
366
366
|
> & {
|
|
367
|
+
/**
|
|
368
|
+
* Data hook for automated testing
|
|
369
|
+
* @example "dropdown-menu-label"
|
|
370
|
+
*/
|
|
371
|
+
dataHook?: string;
|
|
367
372
|
/**
|
|
368
373
|
* Indent the label (for hierarchical menus)
|
|
369
374
|
*/
|
|
@@ -376,7 +381,7 @@ type DropdownMenuLabelProps = React.ComponentPropsWithoutRef<
|
|
|
376
381
|
const DropdownMenuLabel = React.forwardRef<
|
|
377
382
|
React.ComponentRef<typeof DropdownMenuPrimitive.Label>,
|
|
378
383
|
DropdownMenuLabelProps
|
|
379
|
-
>(({ className, inset, ...props }, ref) => {
|
|
384
|
+
>(({ className, inset, dataHook, ...props }, ref) => {
|
|
380
385
|
return (
|
|
381
386
|
<DropdownMenuPrimitive.Label
|
|
382
387
|
ref={ref}
|
|
@@ -387,6 +392,7 @@ const DropdownMenuLabel = React.forwardRef<
|
|
|
387
392
|
],
|
|
388
393
|
className
|
|
389
394
|
)}
|
|
395
|
+
data-hook={dataHook}
|
|
390
396
|
data-inset={inset}
|
|
391
397
|
data-slot="dropdown-menu-label"
|
|
392
398
|
{...props}
|
package/src/components/field.tsx
CHANGED
|
@@ -127,6 +127,10 @@ const fieldVariants = cva(
|
|
|
127
127
|
*/
|
|
128
128
|
interface FieldProps
|
|
129
129
|
extends React.ComponentProps<"div">, VariantProps<typeof fieldVariants> {
|
|
130
|
+
/**
|
|
131
|
+
* Data hook for automated testing
|
|
132
|
+
*/
|
|
133
|
+
dataHook?: string;
|
|
130
134
|
/**
|
|
131
135
|
* Controls the grid column sizing for horizontal orientation.
|
|
132
136
|
* - `"start"` (default): `auto 1fr` — control left, content right
|
|
@@ -140,6 +144,7 @@ function Field({
|
|
|
140
144
|
orientation = "vertical",
|
|
141
145
|
variant = "default",
|
|
142
146
|
align = "start",
|
|
147
|
+
dataHook,
|
|
143
148
|
...props
|
|
144
149
|
}: FieldProps) {
|
|
145
150
|
return (
|
|
@@ -151,6 +156,7 @@ function Field({
|
|
|
151
156
|
"grid-cols-[1fr_auto]",
|
|
152
157
|
className
|
|
153
158
|
)}
|
|
159
|
+
data-hook={dataHook}
|
|
154
160
|
data-orientation={orientation}
|
|
155
161
|
data-slot="field"
|
|
156
162
|
data-variant={variant}
|
|
@@ -101,11 +101,13 @@ const GlobalLayoutSidebar = React.forwardRef<
|
|
|
101
101
|
)}
|
|
102
102
|
data-hook={dataHook}
|
|
103
103
|
data-slot="sidebar-container"
|
|
104
|
+
{...props}
|
|
104
105
|
style={{
|
|
105
106
|
width: widthStyle,
|
|
106
107
|
top: "var(--ds-section-padding-y-sm)",
|
|
108
|
+
height: "calc(100dvh - 2 * var(--ds-section-padding-y-sm))",
|
|
109
|
+
...props.style,
|
|
107
110
|
}}
|
|
108
|
-
{...props}
|
|
109
111
|
>
|
|
110
112
|
{children}
|
|
111
113
|
</aside>
|