@nswds/ui 9.3.1 → 9.3.3
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/dist/components/accordion.d.ts +2 -1
- package/dist/components/alert-dialog.d.ts +2 -1
- package/dist/components/aspect-ratio.d.ts +1 -1
- package/dist/components/aspect-ratio.js +2 -3
- package/dist/components/aspect-ratio.js.map +1 -1
- package/dist/components/badge.d.ts +2 -1
- package/dist/components/button-group.d.ts +2 -1
- package/dist/components/button.d.ts +5 -4
- package/dist/components/callout.d.ts +4 -3
- package/dist/components/card.d.ts +2 -1
- package/dist/components/carousel.d.ts +2 -1
- package/dist/components/container.d.ts +2 -1
- package/dist/components/description-list.d.ts +2 -1
- package/dist/components/dialog.d.ts +2 -1
- package/dist/components/dropdown-menu.d.ts +2 -1
- package/dist/components/expandable-search.d.ts +2 -1
- package/dist/components/field.d.ts +2 -1
- package/dist/components/footer.d.ts +2 -1
- package/dist/components/header.d.ts +3 -2
- package/dist/components/hero.d.ts +3 -2
- package/dist/components/input-group.d.ts +2 -2
- package/dist/components/input.d.ts +2 -1
- package/dist/components/label.d.ts +2 -1
- package/dist/components/labeled-separator.d.ts +2 -1
- package/dist/components/link-card.d.ts +2 -1
- package/dist/components/link.d.ts +3 -2
- package/dist/components/logo.d.ts +2 -1
- package/dist/components/main-nav.d.ts +2 -1
- package/dist/components/masthead.d.ts +3 -2
- package/dist/components/navigation-menu.d.ts +2 -1
- package/dist/components/on-this-page.d.ts +2 -1
- package/dist/components/page-header.d.ts +2 -1
- package/dist/components/push-menu.d.ts +2 -1
- package/dist/components/section.d.ts +3 -2
- package/dist/components/separator.d.ts +2 -1
- package/dist/components/side-nav.d.ts +2 -1
- package/dist/components/site-search.d.ts +2 -1
- package/dist/components/skip-link.d.ts +3 -2
- package/dist/components/spinner.d.ts +2 -1
- package/dist/components/step-indicator.d.ts +2 -1
- package/dist/components/tab-nav.d.ts +2 -1
- package/dist/components/tabs.d.ts +1 -1
- package/dist/components/tabs.js +6 -6
- package/dist/components/tabs.js.map +1 -1
- package/dist/components/tag.d.ts +2 -1
- package/dist/components/textarea.d.ts +2 -1
- package/dist/components/theme-switcher.d.ts +2 -1
- package/dist/components/toggle-group.d.ts +1 -2
- package/dist/components/toggle-group.js +15 -16
- package/dist/components/toggle-group.js.map +1 -1
- package/dist/hooks/use-chrome-height.d.ts +2 -1
- package/dist/lib/button-group-context.d.ts +2 -1
- package/dist/lib/label-colors.d.ts +2 -1
- package/dist/lib/resolve-state-prop.d.ts +18 -0
- package/dist/lib/resolve-state-prop.js +7 -0
- package/dist/lib/resolve-state-prop.js.map +1 -0
- package/package.json +6 -6
|
@@ -9,4 +9,5 @@ declare function AccordionItem({ className, ...props }: Accordion$1.Item.Props):
|
|
|
9
9
|
declare function AccordionTrigger({ className, children, ...props }: Accordion$1.Trigger.Props): React.JSX.Element;
|
|
10
10
|
declare function AccordionContent({ className, children, ...props }: Accordion$1.Panel.Props): React.JSX.Element;
|
|
11
11
|
|
|
12
|
-
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger
|
|
12
|
+
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger };
|
|
13
|
+
export type { AccordionVariant };
|
|
@@ -71,4 +71,5 @@ declare function AlertDialogAction(props: React.ComponentProps<typeof Button>):
|
|
|
71
71
|
*/
|
|
72
72
|
declare function AlertDialogCancel({ variant, size, color, ...props }: Omit<AlertDialog$1.Close.Props, 'color'> & Pick<React.ComponentProps<typeof Button>, 'variant' | 'size' | 'color'>): React.JSX.Element;
|
|
73
73
|
|
|
74
|
-
export { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogMedia, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger,
|
|
74
|
+
export { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogMedia, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, alertDialogContentVariants };
|
|
75
|
+
export type { AlertDialogVariant };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
|
-
declare function AspectRatio({ ratio, className, ...props }: React.ComponentProps<'div'> & {
|
|
3
|
+
declare function AspectRatio({ ratio, className, style, ...props }: React.ComponentProps<'div'> & {
|
|
4
4
|
ratio: number;
|
|
5
5
|
}): React.JSX.Element;
|
|
6
6
|
|
|
@@ -4,15 +4,14 @@ import { cn } from '../lib/utils.js';
|
|
|
4
4
|
function AspectRatio({
|
|
5
5
|
ratio,
|
|
6
6
|
className,
|
|
7
|
+
style,
|
|
7
8
|
...props
|
|
8
9
|
}) {
|
|
9
10
|
return /* @__PURE__ */ jsx(
|
|
10
11
|
"div",
|
|
11
12
|
{
|
|
12
13
|
"data-slot": "aspect-ratio",
|
|
13
|
-
style: {
|
|
14
|
-
"--ratio": ratio
|
|
15
|
-
},
|
|
14
|
+
style: { ...style, "--ratio": ratio },
|
|
16
15
|
className: cn("relative aspect-(--ratio)", className),
|
|
17
16
|
...props
|
|
18
17
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/aspect-ratio.tsx"],"names":[],"mappings":";;;AAIA,SAAS,WAAA,CAAY;AAAA,EACnB,KAAA;AAAA,EACA,SAAA;AAAA,EACA,GAAG;AACL,CAAA,EAAoD;AAClD,EAAA,uBACE,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,WAAA,EAAU,cAAA;AAAA,
|
|
1
|
+
{"version":3,"sources":["../../src/components/aspect-ratio.tsx"],"names":[],"mappings":";;;AAIA,SAAS,WAAA,CAAY;AAAA,EACnB,KAAA;AAAA,EACA,SAAA;AAAA,EACA,KAAA;AAAA,EACA,GAAG;AACL,CAAA,EAAoD;AAClD,EAAA,uBACE,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,WAAA,EAAU,cAAA;AAAA,MAIV,KAAA,EAAO,EAAE,GAAG,KAAA,EAAO,WAAW,KAAA,EAAM;AAAA,MACpC,SAAA,EAAW,EAAA,CAAG,2BAAA,EAA6B,SAAS,CAAA;AAAA,MACnD,GAAG;AAAA;AAAA,GACN;AAEJ","file":"aspect-ratio.js","sourcesContent":["import * as React from 'react'\n\nimport { cn } from '../lib/utils.js'\n\nfunction AspectRatio({\n ratio,\n className,\n style,\n ...props\n}: React.ComponentProps<'div'> & { ratio: number }) {\n return (\n <div\n data-slot='aspect-ratio'\n // Merged rather than replaced, so a consumer's own `style` keeps the\n // `--ratio` the aspect utility reads. `--ratio` goes last so it always\n // matches the `ratio` prop.\n style={{ ...style, '--ratio': ratio } as React.CSSProperties}\n className={cn('relative aspect-(--ratio)', className)}\n {...props}\n />\n )\n}\n\nexport { AspectRatio }\n"]}
|
|
@@ -22,4 +22,5 @@ type BadgeProps = VariantProps<typeof badgeVariants> & React.ComponentPropsWitho
|
|
|
22
22
|
/** Static status or count. Categories and interactive labels belong to Tag. */
|
|
23
23
|
declare function Badge({ variant, color, size, dot, className, children, ...props }: BadgeProps): React.JSX.Element;
|
|
24
24
|
|
|
25
|
-
export { Badge,
|
|
25
|
+
export { Badge, badgeVariants };
|
|
26
|
+
export type { BadgeProps };
|
|
@@ -111,4 +111,5 @@ declare function ButtonGroupText({ className, render, ...props }: useRender.Comp
|
|
|
111
111
|
*/
|
|
112
112
|
declare function ButtonGroupSeparator({ className, orientation, ...props }: React.ComponentProps<typeof Separator>): React.JSX.Element;
|
|
113
113
|
|
|
114
|
-
export { ButtonGroup,
|
|
114
|
+
export { ButtonGroup, ButtonGroupSeparator, ButtonGroupText, buttonGroupVariants };
|
|
115
|
+
export type { ButtonGroupProps, ButtonGroupVariant };
|
|
@@ -5,8 +5,8 @@ import React__default from 'react';
|
|
|
5
5
|
import { Link } from './link.js';
|
|
6
6
|
|
|
7
7
|
declare const buttonCva: (props?: ({
|
|
8
|
-
variant?: "
|
|
9
|
-
color?: "
|
|
8
|
+
variant?: "solid" | "soft" | "surface" | "outline" | "ghost" | "link" | null | undefined;
|
|
9
|
+
color?: "tertiary" | "accent" | "success" | "warning" | "primary" | "grey" | "white" | "secondary" | "danger" | null | undefined;
|
|
10
10
|
size?: "default" | "sm" | "lg" | "icon" | null | undefined;
|
|
11
11
|
iconOnly?: boolean | null | undefined;
|
|
12
12
|
onTint?: boolean | null | undefined;
|
|
@@ -27,7 +27,7 @@ type ButtonVariantProps = NonNullable<Parameters<typeof buttonCva>[0]>;
|
|
|
27
27
|
*/
|
|
28
28
|
declare function buttonVariants({ onTint, ...props }?: ButtonVariantProps): string;
|
|
29
29
|
declare const buttonColorCva: (props?: ({
|
|
30
|
-
color?: "
|
|
30
|
+
color?: "tertiary" | "accent" | "success" | "warning" | "primary" | "grey" | "white" | "secondary" | "danger" | null | undefined;
|
|
31
31
|
onTint?: boolean | null | undefined;
|
|
32
32
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
33
33
|
/**
|
|
@@ -159,4 +159,5 @@ declare function TouchTarget({ children }: {
|
|
|
159
159
|
children: React__default.ReactNode;
|
|
160
160
|
}): React__default.JSX.Element;
|
|
161
161
|
|
|
162
|
-
export { Button, ButtonLink,
|
|
162
|
+
export { Button, ButtonLink, TouchTarget, buttonColorVariants, buttonVariants };
|
|
163
|
+
export type { ButtonLinkProps, ButtonProps, IconSlot };
|
|
@@ -25,7 +25,7 @@ type CalloutStatus = 'info' | 'success' | 'warning' | 'danger';
|
|
|
25
25
|
* drift out of step with the token library.
|
|
26
26
|
*/
|
|
27
27
|
declare const calloutVariants: (props?: ({
|
|
28
|
-
status?: "
|
|
28
|
+
status?: "success" | "warning" | "danger" | "info" | null | undefined;
|
|
29
29
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
30
30
|
type CalloutProps = Omit<React.ComponentPropsWithoutRef<'div'>, 'title'> & VariantProps<typeof calloutVariants> & {
|
|
31
31
|
/** Optional bold lead line above the body copy. */
|
|
@@ -66,9 +66,10 @@ declare function Callout({ className, status, title, icon, children, ref, ...pro
|
|
|
66
66
|
*/
|
|
67
67
|
declare const Alert: typeof Callout;
|
|
68
68
|
declare const alertVariants: (props?: ({
|
|
69
|
-
status?: "
|
|
69
|
+
status?: "success" | "warning" | "danger" | "info" | null | undefined;
|
|
70
70
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
71
71
|
type AlertProps = CalloutProps;
|
|
72
72
|
type AlertStatus = CalloutStatus;
|
|
73
73
|
|
|
74
|
-
export { Alert,
|
|
74
|
+
export { Alert, Callout, alertVariants, calloutVariants };
|
|
75
|
+
export type { AlertProps, AlertStatus, CalloutProps, CalloutStatus };
|
|
@@ -18,4 +18,5 @@ type CardActionProps = React.ComponentProps<typeof CardAction>;
|
|
|
18
18
|
type CardContentProps = React.ComponentProps<typeof CardContent>;
|
|
19
19
|
type CardFooterProps = React.ComponentProps<typeof CardFooter>;
|
|
20
20
|
|
|
21
|
-
export { Card, CardAction,
|
|
21
|
+
export { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle };
|
|
22
|
+
export type { CardActionProps, CardContentProps, CardDescriptionProps, CardFooterProps, CardHeaderProps, CardProps, CardTitleProps };
|
|
@@ -43,4 +43,5 @@ declare function CarouselNext({ className, variant, size, label, children, ...pr
|
|
|
43
43
|
label?: string;
|
|
44
44
|
}): React.JSX.Element;
|
|
45
45
|
|
|
46
|
-
export { Carousel,
|
|
46
|
+
export { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, useCarousel };
|
|
47
|
+
export type { CarouselApi };
|
|
@@ -33,4 +33,5 @@ type ContainerProps = React.ComponentPropsWithoutRef<'div'> & VariantProps<typeo
|
|
|
33
33
|
*/
|
|
34
34
|
declare function Container({ className, size, ref, ...props }: ContainerProps): React.JSX.Element;
|
|
35
35
|
|
|
36
|
-
export { Container,
|
|
36
|
+
export { Container, containerVariants };
|
|
37
|
+
export type { ContainerProps };
|
|
@@ -69,4 +69,5 @@ type DescriptionDetailsProps = React.ComponentPropsWithoutRef<'dd'> & {
|
|
|
69
69
|
*/
|
|
70
70
|
declare function DescriptionDetails({ className, ref, ...props }: DescriptionDetailsProps): React.JSX.Element;
|
|
71
71
|
|
|
72
|
-
export { DescriptionDetails,
|
|
72
|
+
export { DescriptionDetails, DescriptionList, DescriptionTerm, descriptionListVariants };
|
|
73
|
+
export type { DescriptionDetailsProps, DescriptionListProps, DescriptionTermProps };
|
|
@@ -51,4 +51,5 @@ declare function DialogFooter({ className, showCloseButton, closeLabel, children
|
|
|
51
51
|
declare function DialogTitle({ className, ...props }: Dialog$1.Title.Props): React.JSX.Element;
|
|
52
52
|
declare function DialogDescription({ className, ...props }: Dialog$1.Description.Props): React.JSX.Element;
|
|
53
53
|
|
|
54
|
-
export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger,
|
|
54
|
+
export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, dialogContentVariants };
|
|
55
|
+
export type { DialogVariant };
|
|
@@ -86,4 +86,5 @@ declare function DropdownMenuSeparator({ className, ...props }: Menu.Separator.P
|
|
|
86
86
|
/** A trailing hint such as a keyboard shortcut. Decorative — it binds nothing. */
|
|
87
87
|
declare function DropdownMenuShortcut({ className, ...props }: React.ComponentProps<'span'>): React.JSX.Element;
|
|
88
88
|
|
|
89
|
-
export { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuLinkItem, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger,
|
|
89
|
+
export { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuLinkItem, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, dropdownMenuContentVariants };
|
|
90
|
+
export type { DropdownMenuVariant };
|
|
@@ -116,4 +116,5 @@ declare function ExpandableSearch({ className, onAction, defaultValue, onSubmit,
|
|
|
116
116
|
*/
|
|
117
117
|
declare function ExpandableSearchField({ className, id, label, 'aria-label': ariaLabel, autoComplete, enterKeyHint, onChange, buttonLabel, buttonProps, ref, ...props }: ExpandableSearchFieldProps): React__default.JSX.Element;
|
|
118
118
|
|
|
119
|
-
export { ExpandableSearch,
|
|
119
|
+
export { ExpandableSearch, ExpandableSearchField, expandableSearchVariants };
|
|
120
|
+
export type { ExpandableSearchButtonProps, ExpandableSearchFieldProps, ExpandableSearchProps, ExpandableSearchVariant };
|
|
@@ -39,4 +39,5 @@ type FieldDescriptionProps = React.ComponentProps<typeof FieldDescription>;
|
|
|
39
39
|
type FieldSeparatorProps = React.ComponentProps<typeof FieldSeparator>;
|
|
40
40
|
type FieldErrorProps = React.ComponentProps<typeof FieldError>;
|
|
41
41
|
|
|
42
|
-
export { Field, FieldContent,
|
|
42
|
+
export { Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldItem, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle };
|
|
43
|
+
export type { FieldContentProps, FieldDescriptionProps, FieldErrorProps, FieldGroupProps, FieldItemProps, FieldLabelProps, FieldLegendProps, FieldProps, FieldSeparatorProps, FieldSetProps, FieldTitleProps };
|
|
@@ -239,4 +239,5 @@ type FooterProps = Omit<React__default.ComponentPropsWithoutRef<'footer'>, 'colo
|
|
|
239
239
|
*/
|
|
240
240
|
declare function Footer({ className, color, container, containerClassName, legalLinks, socialLinks, department, acknowledgement, smallPrint, topBorder, year, children, ref, ...props }: FooterProps): React__default.JSX.Element;
|
|
241
241
|
|
|
242
|
-
export { Footer, FooterAcknowledgement,
|
|
242
|
+
export { Footer, FooterAcknowledgement, FooterLegalLinks, FooterNav, FooterNavColumn, FooterNavLink, FooterSmallPrint, FooterSocialLink, footerColors, footerContainerVariants, footerLogoType, footerVariants };
|
|
243
|
+
export type { FooterAcknowledgementProps, FooterColor, FooterLegalLinkItem, FooterLegalLinksProps, FooterLinkItem, FooterNavColumnProps, FooterNavLinkProps, FooterNavProps, FooterProps, FooterSmallPrintProps, FooterSocialLinkItem, FooterSocialLinkProps };
|
|
@@ -32,7 +32,7 @@ declare const headerColors: {
|
|
|
32
32
|
};
|
|
33
33
|
type HeaderColor = keyof typeof headerColors;
|
|
34
34
|
declare const headerVariants: (props?: ({
|
|
35
|
-
color?: "
|
|
35
|
+
color?: "grey" | "white" | "light" | "dark" | null | undefined;
|
|
36
36
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
37
37
|
declare const headerContainerVariants: (props?: ({
|
|
38
38
|
container?: "fluid" | "contained" | null | undefined;
|
|
@@ -168,4 +168,5 @@ type HeaderProps = Omit<React__default.ComponentPropsWithoutRef<'header'>, 'colo
|
|
|
168
168
|
*/
|
|
169
169
|
declare function Header({ className, color, container, containerClassName, sticky, border, shadow, children, ref, ...props }: HeaderProps): React__default.JSX.Element;
|
|
170
170
|
|
|
171
|
-
export { Header, HeaderActions,
|
|
171
|
+
export { Header, HeaderActions, HeaderBrand, headerColors, headerContainerVariants, headerVariants };
|
|
172
|
+
export type { HeaderActionsProps, HeaderBrandProps, HeaderColor, HeaderProps };
|
|
@@ -138,7 +138,7 @@ declare function HeroRule({ className, ref, ...props }: HeroRuleProps): React.JS
|
|
|
138
138
|
* plain `<img>` or their framework's image component.
|
|
139
139
|
*/
|
|
140
140
|
declare const heroMediaVariants: (props?: ({
|
|
141
|
-
fit?: "band" | "
|
|
141
|
+
fit?: "band" | "bleed" | "framed" | "rise" | null | undefined;
|
|
142
142
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
143
143
|
type HeroMediaProps = React.ComponentPropsWithoutRef<'div'> & VariantProps<typeof heroMediaVariants> & {
|
|
144
144
|
ref?: React.Ref<HTMLDivElement>;
|
|
@@ -150,4 +150,5 @@ type HeroMediaProps = React.ComponentPropsWithoutRef<'div'> & VariantProps<typeo
|
|
|
150
150
|
*/
|
|
151
151
|
declare function HeroMedia({ className, fit, ref, ...props }: HeroMediaProps): React.JSX.Element;
|
|
152
152
|
|
|
153
|
-
export { Hero, HeroActions,
|
|
153
|
+
export { Hero, HeroActions, HeroContent, HeroDescription, HeroMedia, HeroRule, HeroTitle, heroColors, heroInnerVariants, heroMediaVariants, heroVariants };
|
|
154
|
+
export type { HeroActionsProps, HeroColor, HeroContentProps, HeroDescriptionProps, HeroMediaProps, HeroProps, HeroRuleProps, HeroTitleProps };
|
|
@@ -13,7 +13,7 @@ import './link.js';
|
|
|
13
13
|
*/
|
|
14
14
|
declare function InputGroup({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
|
|
15
15
|
declare const inputGroupAddonVariants: (props?: ({
|
|
16
|
-
align?: "inline-
|
|
16
|
+
align?: "inline-start" | "inline-end" | "block-start" | "block-end" | null | undefined;
|
|
17
17
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
18
18
|
declare function InputGroupAddon({ className, align, ...props }: React.ComponentProps<'div'> & VariantProps<typeof inputGroupAddonVariants>): React.JSX.Element;
|
|
19
19
|
declare const inputGroupButtonVariants: (props?: ({
|
|
@@ -35,7 +35,7 @@ declare function InputGroupButton({ className, type, variant, size, ...props }:
|
|
|
35
35
|
type?: 'button' | 'submit' | 'reset';
|
|
36
36
|
}): React.JSX.Element;
|
|
37
37
|
declare const inputGroupActionVariants: (props?: ({
|
|
38
|
-
variant?: "
|
|
38
|
+
variant?: "solid" | "open" | "subtle" | null | undefined;
|
|
39
39
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
40
40
|
declare function InputGroupAction({ className, type, variant, ...props }: Omit<React.ComponentProps<typeof Button>, 'size' | 'type' | 'variant'> & VariantProps<typeof inputGroupActionVariants> & {
|
|
41
41
|
type?: 'button' | 'submit' | 'reset';
|
|
@@ -17,4 +17,5 @@ declare function LabeledSeparator({ className, children, ref, ...props }: React.
|
|
|
17
17
|
|
|
18
18
|
type LabeledSeparatorProps = React.ComponentProps<typeof LabeledSeparator>;
|
|
19
19
|
|
|
20
|
-
export { LabeledSeparator
|
|
20
|
+
export { LabeledSeparator };
|
|
21
|
+
export type { LabeledSeparatorProps };
|
|
@@ -51,4 +51,5 @@ type LinkCardProps = Omit<React.ComponentPropsWithoutRef<'div'>, 'title'> & {
|
|
|
51
51
|
*/
|
|
52
52
|
declare function LinkCard({ className, href, title, label, description, external, children, ref, ...props }: LinkCardProps): React.JSX.Element;
|
|
53
53
|
|
|
54
|
-
export { LinkCard
|
|
54
|
+
export { LinkCard };
|
|
55
|
+
export type { LinkCardProps };
|
|
@@ -3,7 +3,7 @@ import { VariantProps } from 'class-variance-authority';
|
|
|
3
3
|
import React__default from 'react';
|
|
4
4
|
|
|
5
5
|
declare const linkVariants: (props?: ({
|
|
6
|
-
variant?: "
|
|
6
|
+
variant?: "primary" | "white" | "secondary" | "unstyled" | null | undefined;
|
|
7
7
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
8
8
|
type LinkComponent = React__default.ElementType;
|
|
9
9
|
/**
|
|
@@ -61,4 +61,5 @@ type ExternalLinkProps = LinkProps & {
|
|
|
61
61
|
*/
|
|
62
62
|
declare function ExternalLink({ children, icon, newTabLabel, target, rel, ref, ...props }: ExternalLinkProps): React__default.JSX.Element;
|
|
63
63
|
|
|
64
|
-
export { ExternalLink,
|
|
64
|
+
export { ExternalLink, Link, LinkProvider, linkVariants };
|
|
65
|
+
export type { ExternalLinkProps, LinkComponent, LinkProps, LinkUrlObject };
|
|
@@ -155,4 +155,5 @@ type MainNavProps = Omit<React__default.ComponentPropsWithoutRef<'nav'>, 'childr
|
|
|
155
155
|
*/
|
|
156
156
|
declare function MainNav({ className, containerClassName, color, container, border, navigation, currentHref, sticky, shadow, emptyMessage, 'aria-label': ariaLabel, ref, ...props }: MainNavProps): React__default.JSX.Element;
|
|
157
157
|
|
|
158
|
-
export { MainNav,
|
|
158
|
+
export { MainNav, mainNavColors, mainNavContainerVariants, mainNavPanelVariants, mainNavVariants };
|
|
159
|
+
export type { MainNavColor, MainNavItem, MainNavLinkItem, MainNavProps };
|
|
@@ -10,7 +10,7 @@ declare const mastheadColors: {
|
|
|
10
10
|
};
|
|
11
11
|
type MastheadColor = keyof typeof mastheadColors;
|
|
12
12
|
declare const mastheadVariants: (props?: ({
|
|
13
|
-
color?: "
|
|
13
|
+
color?: "grey" | "white" | "light" | "dark" | null | undefined;
|
|
14
14
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
15
15
|
declare const mastheadContainerVariants: (props?: ({
|
|
16
16
|
container?: "fluid" | "contained" | null | undefined;
|
|
@@ -38,4 +38,5 @@ type MastheadProps = Omit<React__default.ComponentPropsWithoutRef<'div'>, 'color
|
|
|
38
38
|
*/
|
|
39
39
|
declare function Masthead({ className, color, container, containerClassName, children, ref, ...props }: MastheadProps): React__default.JSX.Element;
|
|
40
40
|
|
|
41
|
-
export { Masthead,
|
|
41
|
+
export { Masthead, mastheadContainerVariants, mastheadVariants };
|
|
42
|
+
export type { MastheadColor, MastheadProps };
|
|
@@ -167,4 +167,5 @@ type NavigationMenuLinkProps = Omit<NavigationMenu$1.Link.Props, 'className' | '
|
|
|
167
167
|
*/
|
|
168
168
|
declare function NavigationMenuLink({ className, href, closeOnClick, ...props }: NavigationMenuLinkProps): React.JSX.Element;
|
|
169
169
|
|
|
170
|
-
export { NavigationMenu, NavigationMenuContent,
|
|
170
|
+
export { NavigationMenu, NavigationMenuContent, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, navigationMenuTriggerVariants };
|
|
171
|
+
export type { NavigationMenuContentProps, NavigationMenuItemProps, NavigationMenuLinkProps, NavigationMenuListProps, NavigationMenuProps, NavigationMenuTriggerProps };
|
|
@@ -86,4 +86,5 @@ type OnThisPageProps = Omit<React.ComponentPropsWithoutRef<'nav'>, 'children'> &
|
|
|
86
86
|
*/
|
|
87
87
|
declare function OnThisPage({ className, items, orientation, offset, activeId, onActiveChange, emptyMessage, 'aria-label': ariaLabel, ref, ...props }: OnThisPageProps): React.JSX.Element;
|
|
88
88
|
|
|
89
|
-
export { OnThisPage
|
|
89
|
+
export { OnThisPage };
|
|
90
|
+
export type { OnThisPageItem, OnThisPageProps };
|
|
@@ -135,4 +135,5 @@ type PageHeaderMetaProps = React.ComponentPropsWithoutRef<'div'> & {
|
|
|
135
135
|
*/
|
|
136
136
|
declare function PageHeaderMeta({ className, ref, ...props }: PageHeaderMetaProps): React.JSX.Element;
|
|
137
137
|
|
|
138
|
-
export { PageHeader,
|
|
138
|
+
export { PageHeader, PageHeaderDescription, PageHeaderMeta, PageHeaderRule, PageHeaderTitle, pageHeaderColors, pageHeaderInnerVariants, pageHeaderVariants };
|
|
139
|
+
export type { PageHeaderColor, PageHeaderDescriptionProps, PageHeaderMetaProps, PageHeaderProps, PageHeaderRuleProps, PageHeaderTitleProps };
|
|
@@ -202,4 +202,5 @@ type PushMenuProps = Omit<React__default.ComponentPropsWithoutRef<'nav'>, 'child
|
|
|
202
202
|
*/
|
|
203
203
|
declare function PushMenu({ navigation, currentHref, title, onItemClick, onNavigate, onClose, showBreadcrumbs, durationMs, backLabel, closeLabel, headingLevel, submenuLabel, emptyMessage, escapeGoesBack, className, style, 'aria-label': ariaLabel, ref, ...props }: PushMenuProps): React__default.JSX.Element | null;
|
|
204
204
|
|
|
205
|
-
export { PUSH_MENU_DURATION_MS, PushMenu,
|
|
205
|
+
export { PUSH_MENU_DURATION_MS, PushMenu, generatePushMenuBreadcrumb };
|
|
206
|
+
export type { PushMenuItem, PushMenuLevel, PushMenuProps };
|
|
@@ -15,7 +15,7 @@ import { VariantProps } from 'class-variance-authority';
|
|
|
15
15
|
* unsafe form — see its script header, and AGENTS.md §4 Step 1.
|
|
16
16
|
*/
|
|
17
17
|
declare const sectionVariants: (props?: ({
|
|
18
|
-
spacing?: "default" | "none" | "
|
|
18
|
+
spacing?: "default" | "none" | "tight" | "loose" | null | undefined;
|
|
19
19
|
divider?: boolean | null | undefined;
|
|
20
20
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
21
21
|
type SectionProps = React.ComponentPropsWithoutRef<'section'> & VariantProps<typeof sectionVariants> & {
|
|
@@ -50,4 +50,5 @@ type SectionProps = React.ComponentPropsWithoutRef<'section'> & VariantProps<typ
|
|
|
50
50
|
*/
|
|
51
51
|
declare function Section({ className, spacing, divider, labelledBy, ref, ...props }: SectionProps): React.JSX.Element;
|
|
52
52
|
|
|
53
|
-
export { Section,
|
|
53
|
+
export { Section, sectionVariants };
|
|
54
|
+
export type { SectionProps };
|
|
@@ -12,4 +12,5 @@ type SeparatorProps = Separator$1.Props & {
|
|
|
12
12
|
};
|
|
13
13
|
declare function Separator({ className, orientation, decorative, role, ref, ...props }: SeparatorProps): React.JSX.Element;
|
|
14
14
|
|
|
15
|
-
export { Separator
|
|
15
|
+
export { Separator };
|
|
16
|
+
export type { SeparatorProps };
|
|
@@ -137,4 +137,5 @@ declare function SideNav({ className, sections, currentHref, onNavigate, heading
|
|
|
137
137
|
|
|
138
138
|
type SideNavRowVariantProps = VariantProps<typeof sideNavRowVariants>;
|
|
139
139
|
|
|
140
|
-
export { SideNav,
|
|
140
|
+
export { SideNav, sideNavRowVariants };
|
|
141
|
+
export type { SideNavItem, SideNavProps, SideNavRowVariantProps };
|
|
@@ -112,4 +112,5 @@ type SiteSearchProps = {
|
|
|
112
112
|
*/
|
|
113
113
|
declare function SiteSearch({ groups, onSelect, open: openProp, onOpenChange, defaultOpen, shortcut, label, placeholder, emptyMessage, trigger, children, className, }: SiteSearchProps): React__default.JSX.Element;
|
|
114
114
|
|
|
115
|
-
export { SiteSearch
|
|
115
|
+
export { SiteSearch };
|
|
116
|
+
export type { SiteSearchGroup, SiteSearchItem, SiteSearchProps };
|
|
@@ -3,7 +3,7 @@ import { VariantProps } from 'class-variance-authority';
|
|
|
3
3
|
import React__default from 'react';
|
|
4
4
|
|
|
5
5
|
declare const skipLinkVariants: (props?: ({
|
|
6
|
-
color?: "
|
|
6
|
+
color?: "grey" | "white" | "light" | "dark" | null | undefined;
|
|
7
7
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
8
8
|
type SkipLinkProps = React__default.ComponentPropsWithoutRef<'a'> & VariantProps<typeof skipLinkVariants> & {
|
|
9
9
|
/** Same-page fragment target, e.g. `"#content"`. */
|
|
@@ -48,4 +48,5 @@ type SkipLinksProps = React__default.ComponentPropsWithoutRef<'nav'> & VariantPr
|
|
|
48
48
|
*/
|
|
49
49
|
declare function SkipLinks({ className, color, children, ref, ...props }: SkipLinksProps): React__default.JSX.Element;
|
|
50
50
|
|
|
51
|
-
export { SkipLink,
|
|
51
|
+
export { SkipLink, SkipLinks, skipLinkVariants };
|
|
52
|
+
export type { SkipLinkProps, SkipLinksProps };
|
|
@@ -157,4 +157,5 @@ type StepNavProps = Omit<React__default.ComponentPropsWithoutRef<'nav'>, 'childr
|
|
|
157
157
|
*/
|
|
158
158
|
declare function StepNav({ sections, headingLevel, currentHref, onNavigate, statusLabels, className, 'aria-label': ariaLabel, ref, ...props }: StepNavProps): React__default.JSX.Element;
|
|
159
159
|
|
|
160
|
-
export {
|
|
160
|
+
export { StepIndicator, StepNav, stepStatusStyles };
|
|
161
|
+
export type { Step, StepIndicatorProps, StepNavProps, StepNavSection, StepStatus };
|
|
@@ -183,4 +183,5 @@ type TabNavLinkProps = Omit<LinkProps, 'variant' | 'as'> & {
|
|
|
183
183
|
*/
|
|
184
184
|
declare function TabNavLink({ className, children, current, href, ...props }: TabNavLinkProps): React.JSX.Element;
|
|
185
185
|
|
|
186
|
-
export { TabNav, TabNavLink,
|
|
186
|
+
export { TabNav, TabNavLink, tabNavLinkVariants, tabNavListVariants };
|
|
187
|
+
export type { TabNavLinkProps, TabNavProps };
|
|
@@ -3,7 +3,7 @@ import { Tabs as Tabs$1 } from '@base-ui/react/tabs';
|
|
|
3
3
|
import { VariantProps } from 'class-variance-authority';
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
|
|
6
|
-
declare function Tabs({ className,
|
|
6
|
+
declare function Tabs({ className, ...props }: Tabs$1.Root.Props): React.JSX.Element;
|
|
7
7
|
declare const tabsListVariants: (props?: ({
|
|
8
8
|
variant?: "default" | "line" | "fullwidth" | "bordered" | null | undefined;
|
|
9
9
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
package/dist/components/tabs.js
CHANGED
|
@@ -3,16 +3,16 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
3
3
|
import { Tabs as Tabs$1 } from '@base-ui/react/tabs';
|
|
4
4
|
import { cva } from 'class-variance-authority';
|
|
5
5
|
import * as React from 'react';
|
|
6
|
+
import { resolveStateProp } from '../lib/resolve-state-prop.js';
|
|
6
7
|
import { resolveVariant } from '../lib/resolve-variant.js';
|
|
7
8
|
import { cn } from '../lib/utils.js';
|
|
8
9
|
|
|
9
|
-
function Tabs({ className,
|
|
10
|
+
function Tabs({ className, ...props }) {
|
|
10
11
|
return /* @__PURE__ */ jsx(
|
|
11
12
|
Tabs$1.Root,
|
|
12
13
|
{
|
|
13
14
|
"data-slot": "tabs",
|
|
14
|
-
"data-
|
|
15
|
-
className: cn("group/tabs flex gap-2 data-horizontal:flex-col", className),
|
|
15
|
+
className: (state) => cn("group/tabs flex gap-2 data-horizontal:flex-col", resolveStateProp(className, state)),
|
|
16
16
|
...props
|
|
17
17
|
}
|
|
18
18
|
);
|
|
@@ -62,7 +62,7 @@ function TabsList({
|
|
|
62
62
|
"data-slot": "tabs-list",
|
|
63
63
|
...props,
|
|
64
64
|
"data-variant": look,
|
|
65
|
-
className: cn(tabsListVariants({ variant: look }), className)
|
|
65
|
+
className: (state) => cn(tabsListVariants({ variant: look }), resolveStateProp(className, state))
|
|
66
66
|
}
|
|
67
67
|
) });
|
|
68
68
|
}
|
|
@@ -124,7 +124,7 @@ function TabsTrigger({ className, ...props }) {
|
|
|
124
124
|
Tabs$1.Tab,
|
|
125
125
|
{
|
|
126
126
|
"data-slot": "tabs-trigger",
|
|
127
|
-
className: cn(tabsTriggerVariants({ variant }), className),
|
|
127
|
+
className: (state) => cn(tabsTriggerVariants({ variant }), resolveStateProp(className, state)),
|
|
128
128
|
...props
|
|
129
129
|
}
|
|
130
130
|
);
|
|
@@ -134,7 +134,7 @@ function TabsContent({ className, ...props }) {
|
|
|
134
134
|
Tabs$1.Panel,
|
|
135
135
|
{
|
|
136
136
|
"data-slot": "tabs-content",
|
|
137
|
-
className: cn("flex-1 text-sm/relaxed outline-none", className),
|
|
137
|
+
className: (state) => cn("flex-1 text-sm/relaxed outline-none", resolveStateProp(className, state)),
|
|
138
138
|
...props
|
|
139
139
|
}
|
|
140
140
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/tabs.tsx"],"names":["TabsPrimitive"],"mappings":"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","file":"tabs.js","sourcesContent":["'use client'\n\nimport { Tabs as TabsPrimitive } from '@base-ui/react/tabs'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport * as React from 'react'\n\nimport { resolveVariant } from '../lib/resolve-variant.js'\nimport { cn } from '../lib/utils.js'\n\nfunction Tabs({ className, orientation = 'horizontal', ...props }: TabsPrimitive.Root.Props) {\n return (\n <TabsPrimitive.Root\n data-slot='tabs'\n data-orientation={orientation}\n className={cn('group/tabs flex gap-2 data-horizontal:flex-col', className)}\n {...props}\n />\n )\n}\n\nconst tabsListVariants = cva('group/tabs-list flex items-center text-muted-foreground', {\n variants: {\n variant: {\n // Segmented control — the active tab lifts to a raised surface card.\n default:\n 'w-fit justify-center rounded-md bg-muted p-1 group-data-horizontal/tabs:h-9 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col',\n // Underline — left-aligned tabs on a full-width rule (the active tab\n // draws its own marker over it).\n line: 'w-full justify-start gap-6 border-b border-border group-data-vertical/tabs:w-fit group-data-vertical/tabs:flex-col group-data-vertical/tabs:items-stretch group-data-vertical/tabs:gap-1 group-data-vertical/tabs:border-e group-data-vertical/tabs:border-b-0 group-data-vertical/tabs:border-border',\n // Underline stretched to equal columns — the settings-bar idiom. Each\n // cell carries its own bottom rule so the bar can scroll (rather than clip\n // an unreachable tab) once the labels stop fitting, matching TabNav.\n //\n // Horizontal-only: an equal-column bar has no vertical form — use `line`\n // or `default` for `orientation=\"vertical\"`. The `group-data-vertical`\n // `w-fit` is a guard so a stray vertical usage shrinks the list instead of\n // consuming the row and collapsing the panel.\n fullwidth:\n 'w-full [scrollbar-width:none] overflow-x-auto group-data-vertical/tabs:w-fit [&::-webkit-scrollbar]:hidden',\n // Enclosed control — equal cells split by dividers inside a bordered card.\n // `overflow-x-auto` both clips each cell's underline to the 4px corner (so\n // the active marker follows the curve) and lets the bar scroll on narrow\n // viewports; the trigger pairs it with a negative outline offset so neither\n // hides focus.\n //\n // Horizontal-only, like `fullwidth` — the `w-fit` guard keeps a stray\n // vertical usage from collapsing the panel.\n bordered:\n 'w-full [scrollbar-width:none] overflow-x-auto rounded-sm border border-border bg-background group-data-vertical/tabs:w-fit [&::-webkit-scrollbar]:hidden',\n },\n },\n defaultVariants: {\n variant: 'default',\n },\n})\n\ntype TabsVariant = NonNullable<VariantProps<typeof tabsListVariants>['variant']>\n\n/**\n * Carries the list's `variant` down to each `TabsTrigger` so a trigger can style\n * itself to match without the caller threading a prop onto every tab. The whole\n * treatment lives in `tabsTriggerVariants`, keyed off this. `default` is the\n * fallback for a trigger rendered outside a `TabsList`, matching the list.\n */\nconst TabsListContext = React.createContext<TabsVariant>('default')\n\nfunction TabsList({\n className,\n variant,\n ...props\n}: TabsPrimitive.List.Props & VariantProps<typeof tabsListVariants>) {\n // Resolved once (see `resolveVariant`), so the context, `data-variant` and\n // cva agree for `null` and `''` as well as the default spelling.\n const look = resolveVariant(variant, 'default')\n return (\n <TabsListContext.Provider value={look}>\n <TabsPrimitive.List\n data-slot='tabs-list'\n {...props}\n // After the spread, so a consumer's own `data-variant` cannot desync\n // the attribute from the classes both derive from the resolved value.\n data-variant={look}\n className={cn(tabsListVariants({ variant: look }), className)}\n />\n </TabsListContext.Provider>\n )\n}\n\nconst tabsTriggerVariants = cva(\n [\n 'relative inline-flex items-center justify-center gap-2 text-sm font-medium whitespace-nowrap text-foreground/60 motion-safe:transition-[color,background-color,border-color,box-shadow]',\n 'hover:text-foreground dark:text-muted-foreground dark:hover:text-foreground',\n // House focus: a 2px outline in the ring colour. Each variant sets its own\n // offset — positive (onto the page) for default/line, negative for the\n // scroll variants so the overflow clip can't hide it — so exactly one\n // outline-offset utility lands on any element.\n 'focus-visible:outline-2 focus-visible:outline-ring',\n 'disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50',\n \"[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n 'has-data-[icon=inline-end]:pe-1 has-data-[icon=inline-start]:ps-1',\n ],\n {\n variants: {\n variant: {\n // Pill that lifts to a surface card when active. `h-[calc(100%-1px)]`\n // keeps it inside the list's inset padding.\n default: cn(\n 'h-[calc(100%-1px)] flex-1 rounded-sm border border-transparent px-3 py-1 focus-visible:outline-offset-2',\n 'group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start group-data-vertical/tabs:py-2',\n 'data-active:bg-background data-active:text-foreground data-active:shadow-sm',\n 'dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground dark:data-active:shadow-none',\n ),\n // Content-width tab with a bottom marker. The 2px border is always\n // present (transparent when idle) so activating a tab never reflows the\n // bar, and `-mb-px` merges the marker with the list's 1px rule.\n line: cn(\n '-mb-px shrink-0 border-b-2 border-transparent px-1 pt-2 pb-3 focus-visible:outline-offset-2',\n 'group-data-vertical/tabs:-me-px group-data-vertical/tabs:mb-0 group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start group-data-vertical/tabs:border-e-2 group-data-vertical/tabs:border-b-0 group-data-vertical/tabs:px-3 group-data-vertical/tabs:py-2',\n 'data-active:border-primary data-active:text-primary',\n ),\n // The underline marker stretched to fill an equal column. The rule is\n // the cell's own bottom border (idle grey, active primary) so it scrolls\n // with the bar; the negative outline offset keeps focus inside the clip.\n fullwidth: cn(\n 'flex-1 justify-center border-b-2 border-b-border px-3 py-4 focus-visible:-outline-offset-2',\n 'data-active:border-b-primary data-active:text-primary',\n ),\n // Divided cell inside the bordered card; the active cell darkens to ink\n // and takes a primary underline at its base.\n bordered: cn(\n 'flex-1 justify-center border-e border-b-2 border-border border-b-transparent px-3 py-4 last:border-e-0 focus-visible:-outline-offset-2',\n 'data-active:border-b-primary data-active:text-foreground',\n ),\n },\n },\n defaultVariants: {\n variant: 'default',\n },\n },\n)\n\nfunction TabsTrigger({ className, ...props }: TabsPrimitive.Tab.Props) {\n const variant = React.useContext(TabsListContext)\n\n return (\n <TabsPrimitive.Tab\n data-slot='tabs-trigger'\n className={cn(tabsTriggerVariants({ variant }), className)}\n {...props}\n />\n )\n}\n\nfunction TabsContent({ className, ...props }: TabsPrimitive.Panel.Props) {\n return (\n <TabsPrimitive.Panel\n data-slot='tabs-content'\n className={cn('flex-1 text-sm/relaxed outline-none', className)}\n {...props}\n />\n )\n}\n\nexport { Tabs, TabsContent, TabsList, tabsListVariants, TabsTrigger, tabsTriggerVariants }\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/components/tabs.tsx"],"names":["TabsPrimitive"],"mappings":"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","file":"tabs.js","sourcesContent":["'use client'\n\nimport { Tabs as TabsPrimitive } from '@base-ui/react/tabs'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport * as React from 'react'\n\nimport { resolveStateProp } from '../lib/resolve-state-prop.js'\nimport { resolveVariant } from '../lib/resolve-variant.js'\nimport { cn } from '../lib/utils.js'\n\nfunction Tabs({ className, ...props }: TabsPrimitive.Root.Props) {\n // `orientation` stays in `props` so it reaches Base UI, which derives the\n // tablist's `aria-orientation` and the arrow keys (Left/Right or Up/Down)\n // from it, and stamps the `data-orientation` the variants below key on.\n // Every part resolves `className` against its state first (see\n // `resolveStateProp`), so Base UI's function form survives `cn()`.\n return (\n <TabsPrimitive.Root\n data-slot='tabs'\n className={(state) =>\n cn('group/tabs flex gap-2 data-horizontal:flex-col', resolveStateProp(className, state))\n }\n {...props}\n />\n )\n}\n\nconst tabsListVariants = cva('group/tabs-list flex items-center text-muted-foreground', {\n variants: {\n variant: {\n // Segmented control — the active tab lifts to a raised surface card.\n default:\n 'w-fit justify-center rounded-md bg-muted p-1 group-data-horizontal/tabs:h-9 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col',\n // Underline — left-aligned tabs on a full-width rule (the active tab\n // draws its own marker over it).\n line: 'w-full justify-start gap-6 border-b border-border group-data-vertical/tabs:w-fit group-data-vertical/tabs:flex-col group-data-vertical/tabs:items-stretch group-data-vertical/tabs:gap-1 group-data-vertical/tabs:border-e group-data-vertical/tabs:border-b-0 group-data-vertical/tabs:border-border',\n // Underline stretched to equal columns — the settings-bar idiom. Each\n // cell carries its own bottom rule so the bar can scroll (rather than clip\n // an unreachable tab) once the labels stop fitting, matching TabNav.\n //\n // Horizontal-only: an equal-column bar has no vertical form — use `line`\n // or `default` for `orientation=\"vertical\"`. The `group-data-vertical`\n // `w-fit` is a guard so a stray vertical usage shrinks the list instead of\n // consuming the row and collapsing the panel.\n fullwidth:\n 'w-full [scrollbar-width:none] overflow-x-auto group-data-vertical/tabs:w-fit [&::-webkit-scrollbar]:hidden',\n // Enclosed control — equal cells split by dividers inside a bordered card.\n // `overflow-x-auto` both clips each cell's underline to the 4px corner (so\n // the active marker follows the curve) and lets the bar scroll on narrow\n // viewports; the trigger pairs it with a negative outline offset so neither\n // hides focus.\n //\n // Horizontal-only, like `fullwidth` — the `w-fit` guard keeps a stray\n // vertical usage from collapsing the panel.\n bordered:\n 'w-full [scrollbar-width:none] overflow-x-auto rounded-sm border border-border bg-background group-data-vertical/tabs:w-fit [&::-webkit-scrollbar]:hidden',\n },\n },\n defaultVariants: {\n variant: 'default',\n },\n})\n\ntype TabsVariant = NonNullable<VariantProps<typeof tabsListVariants>['variant']>\n\n/**\n * Carries the list's `variant` down to each `TabsTrigger` so a trigger can style\n * itself to match without the caller threading a prop onto every tab. The whole\n * treatment lives in `tabsTriggerVariants`, keyed off this. `default` is the\n * fallback for a trigger rendered outside a `TabsList`, matching the list.\n */\nconst TabsListContext = React.createContext<TabsVariant>('default')\n\nfunction TabsList({\n className,\n variant,\n ...props\n}: TabsPrimitive.List.Props & VariantProps<typeof tabsListVariants>) {\n // Resolved once (see `resolveVariant`), so the context, `data-variant` and\n // cva agree for `null` and `''` as well as the default spelling.\n const look = resolveVariant(variant, 'default')\n return (\n <TabsListContext.Provider value={look}>\n <TabsPrimitive.List\n data-slot='tabs-list'\n {...props}\n // After the spread, so a consumer's own `data-variant` cannot desync\n // the attribute from the classes both derive from the resolved value.\n data-variant={look}\n className={(state) =>\n cn(tabsListVariants({ variant: look }), resolveStateProp(className, state))\n }\n />\n </TabsListContext.Provider>\n )\n}\n\nconst tabsTriggerVariants = cva(\n [\n 'relative inline-flex items-center justify-center gap-2 text-sm font-medium whitespace-nowrap text-foreground/60 motion-safe:transition-[color,background-color,border-color,box-shadow]',\n 'hover:text-foreground dark:text-muted-foreground dark:hover:text-foreground',\n // House focus: a 2px outline in the ring colour. Each variant sets its own\n // offset — positive (onto the page) for default/line, negative for the\n // scroll variants so the overflow clip can't hide it — so exactly one\n // outline-offset utility lands on any element.\n 'focus-visible:outline-2 focus-visible:outline-ring',\n 'disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50',\n \"[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n 'has-data-[icon=inline-end]:pe-1 has-data-[icon=inline-start]:ps-1',\n ],\n {\n variants: {\n variant: {\n // Pill that lifts to a surface card when active. `h-[calc(100%-1px)]`\n // keeps it inside the list's inset padding.\n default: cn(\n 'h-[calc(100%-1px)] flex-1 rounded-sm border border-transparent px-3 py-1 focus-visible:outline-offset-2',\n 'group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start group-data-vertical/tabs:py-2',\n 'data-active:bg-background data-active:text-foreground data-active:shadow-sm',\n 'dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground dark:data-active:shadow-none',\n ),\n // Content-width tab with a bottom marker. The 2px border is always\n // present (transparent when idle) so activating a tab never reflows the\n // bar, and `-mb-px` merges the marker with the list's 1px rule.\n line: cn(\n '-mb-px shrink-0 border-b-2 border-transparent px-1 pt-2 pb-3 focus-visible:outline-offset-2',\n 'group-data-vertical/tabs:-me-px group-data-vertical/tabs:mb-0 group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start group-data-vertical/tabs:border-e-2 group-data-vertical/tabs:border-b-0 group-data-vertical/tabs:px-3 group-data-vertical/tabs:py-2',\n 'data-active:border-primary data-active:text-primary',\n ),\n // The underline marker stretched to fill an equal column. The rule is\n // the cell's own bottom border (idle grey, active primary) so it scrolls\n // with the bar; the negative outline offset keeps focus inside the clip.\n fullwidth: cn(\n 'flex-1 justify-center border-b-2 border-b-border px-3 py-4 focus-visible:-outline-offset-2',\n 'data-active:border-b-primary data-active:text-primary',\n ),\n // Divided cell inside the bordered card; the active cell darkens to ink\n // and takes a primary underline at its base.\n bordered: cn(\n 'flex-1 justify-center border-e border-b-2 border-border border-b-transparent px-3 py-4 last:border-e-0 focus-visible:-outline-offset-2',\n 'data-active:border-b-primary data-active:text-foreground',\n ),\n },\n },\n defaultVariants: {\n variant: 'default',\n },\n },\n)\n\nfunction TabsTrigger({ className, ...props }: TabsPrimitive.Tab.Props) {\n const variant = React.useContext(TabsListContext)\n\n return (\n <TabsPrimitive.Tab\n data-slot='tabs-trigger'\n className={(state) =>\n cn(tabsTriggerVariants({ variant }), resolveStateProp(className, state))\n }\n {...props}\n />\n )\n}\n\nfunction TabsContent({ className, ...props }: TabsPrimitive.Panel.Props) {\n return (\n <TabsPrimitive.Panel\n data-slot='tabs-content'\n className={(state) =>\n cn('flex-1 text-sm/relaxed outline-none', resolveStateProp(className, state))\n }\n {...props}\n />\n )\n}\n\nexport { Tabs, TabsContent, TabsList, tabsListVariants, TabsTrigger, tabsTriggerVariants }\n"]}
|
package/dist/components/tag.d.ts
CHANGED
|
@@ -44,4 +44,5 @@ type TagRemovableProps = TagProps & {
|
|
|
44
44
|
/** The label stays static; only its separately named remove button is interactive. */
|
|
45
45
|
declare function TagRemovable({ variant, color, size, className, children, removeLabel, onRemove, disabled, ...props }: TagRemovableProps): React.JSX.Element;
|
|
46
46
|
|
|
47
|
-
export { Tag, TagButton,
|
|
47
|
+
export { Tag, TagButton, TagCheckbox, TagLink, TagRemovable, tagVariants };
|
|
48
|
+
export type { TagButtonProps, TagCheckboxProps, TagLinkProps, TagProps, TagRemovableProps };
|
|
@@ -67,4 +67,5 @@ type ThemeSwitcherProps = Omit<ButtonProps, 'children'> & {
|
|
|
67
67
|
*/
|
|
68
68
|
declare function ThemeSwitcher({ theme: themeProp, defaultTheme, onThemeChange, variant, color, size, onClick, 'aria-label': ariaLabel, ...props }: ThemeSwitcherProps): React__default.JSX.Element;
|
|
69
69
|
|
|
70
|
-
export { ThemeSwitcher
|
|
70
|
+
export { ThemeSwitcher };
|
|
71
|
+
export type { ThemeSwitcherProps, ThemeSwitcherTheme };
|
|
@@ -5,9 +5,8 @@ import * as React from 'react';
|
|
|
5
5
|
import { toggleVariants } from './toggle.js';
|
|
6
6
|
import 'class-variance-authority/types';
|
|
7
7
|
|
|
8
|
-
declare function ToggleGroup({ className, variant, size, spacing,
|
|
8
|
+
declare function ToggleGroup({ className, style, variant, size, spacing, children, ...props }: ToggleGroup$1.Props & VariantProps<typeof toggleVariants> & {
|
|
9
9
|
spacing?: number;
|
|
10
|
-
orientation?: 'horizontal' | 'vertical';
|
|
11
10
|
}): React.JSX.Element;
|
|
12
11
|
declare function ToggleGroupItem({ className, children, variant, size, ...props }: Toggle.Props & VariantProps<typeof toggleVariants>): React.JSX.Element;
|
|
13
12
|
|
|
@@ -3,21 +3,21 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
3
3
|
import { Toggle } from '@base-ui/react/toggle';
|
|
4
4
|
import { ToggleGroup as ToggleGroup$1 } from '@base-ui/react/toggle-group';
|
|
5
5
|
import * as React from 'react';
|
|
6
|
+
import { resolveStateProp } from '../lib/resolve-state-prop.js';
|
|
6
7
|
import { cn } from '../lib/utils.js';
|
|
7
8
|
import { toggleVariants } from './toggle.js';
|
|
8
9
|
|
|
9
10
|
const ToggleGroupContext = React.createContext({
|
|
10
11
|
size: "default",
|
|
11
12
|
variant: "default",
|
|
12
|
-
spacing: 2
|
|
13
|
-
orientation: "horizontal"
|
|
13
|
+
spacing: 2
|
|
14
14
|
});
|
|
15
15
|
function ToggleGroup({
|
|
16
16
|
className,
|
|
17
|
+
style,
|
|
17
18
|
variant,
|
|
18
19
|
size,
|
|
19
20
|
spacing = 2,
|
|
20
|
-
orientation = "horizontal",
|
|
21
21
|
children,
|
|
22
22
|
...props
|
|
23
23
|
}) {
|
|
@@ -25,17 +25,16 @@ function ToggleGroup({
|
|
|
25
25
|
ToggleGroup$1,
|
|
26
26
|
{
|
|
27
27
|
"data-slot": "toggle-group",
|
|
28
|
-
"
|
|
29
|
-
|
|
30
|
-
"data-spacing": spacing,
|
|
31
|
-
"data-orientation": orientation,
|
|
32
|
-
style: { "--gap": spacing },
|
|
33
|
-
className: cn(
|
|
28
|
+
style: (state) => ({ ...resolveStateProp(style, state), "--gap": spacing }),
|
|
29
|
+
className: (state) => cn(
|
|
34
30
|
"group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] rounded-sm data-[size=sm]:rounded-sm data-vertical:flex-col data-vertical:items-stretch",
|
|
35
|
-
className
|
|
31
|
+
resolveStateProp(className, state)
|
|
36
32
|
),
|
|
37
33
|
...props,
|
|
38
|
-
|
|
34
|
+
"data-variant": variant,
|
|
35
|
+
"data-size": size,
|
|
36
|
+
"data-spacing": spacing,
|
|
37
|
+
children: /* @__PURE__ */ jsx(ToggleGroupContext.Provider, { value: { variant, size, spacing }, children })
|
|
39
38
|
}
|
|
40
39
|
);
|
|
41
40
|
}
|
|
@@ -51,18 +50,18 @@ function ToggleGroupItem({
|
|
|
51
50
|
Toggle,
|
|
52
51
|
{
|
|
53
52
|
"data-slot": "toggle-group-item",
|
|
54
|
-
|
|
55
|
-
"data-size": context.size || size,
|
|
56
|
-
"data-spacing": context.spacing,
|
|
57
|
-
className: cn(
|
|
53
|
+
className: (state) => cn(
|
|
58
54
|
"shrink-0 group-data-[spacing=0]/toggle-group:rounded-none group-data-[spacing=0]/toggle-group:px-2 focus:z-10 focus-visible:z-10 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-end]:pe-1.5 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-start]:ps-1.5 group-data-horizontal/toggle-group:data-[spacing=0]:first:rounded-s-sm group-data-vertical/toggle-group:data-[spacing=0]:first:rounded-t-sm group-data-horizontal/toggle-group:data-[spacing=0]:last:rounded-e-sm group-data-vertical/toggle-group:data-[spacing=0]:last:rounded-b-sm group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:border-s-0 group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:border-t-0 group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-s group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-t",
|
|
59
55
|
toggleVariants({
|
|
60
56
|
variant: context.variant || variant,
|
|
61
57
|
size: context.size || size
|
|
62
58
|
}),
|
|
63
|
-
className
|
|
59
|
+
resolveStateProp(className, state)
|
|
64
60
|
),
|
|
65
61
|
...props,
|
|
62
|
+
"data-variant": context.variant || variant,
|
|
63
|
+
"data-size": context.size || size,
|
|
64
|
+
"data-spacing": context.spacing,
|
|
66
65
|
children
|
|
67
66
|
}
|
|
68
67
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/toggle-group.tsx"],"names":["ToggleGroupPrimitive","TogglePrimitive"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/components/toggle-group.tsx"],"names":["ToggleGroupPrimitive","TogglePrimitive"],"mappings":";;;;;;;;AAWA,MAAM,kBAAA,GAAqB,MAAM,aAAA,CAI/B;AAAA,EACA,IAAA,EAAM,SAAA;AAAA,EACN,OAAA,EAAS,SAAA;AAAA,EACT,OAAA,EAAS;AACX,CAAC,CAAA;AAED,SAAS,WAAA,CAAY;AAAA,EACnB,SAAA;AAAA,EACA,KAAA;AAAA,EACA,OAAA;AAAA,EACA,IAAA;AAAA,EACA,OAAA,GAAU,CAAA;AAAA,EACV,QAAA;AAAA,EACA,GAAG;AACL,CAAA,EAGK;AAOH,EAAA,uBACE,GAAA;AAAA,IAACA,aAAA;AAAA,IAAA;AAAA,MACC,WAAA,EAAU,cAAA;AAAA,MAIV,KAAA,EAAO,CAAC,KAAA,MACL,EAAE,GAAG,iBAAiB,KAAA,EAAO,KAAK,CAAA,EAAG,OAAA,EAAS,OAAA,EAAQ,CAAA;AAAA,MAEzD,SAAA,EAAW,CAAC,KAAA,KACV,EAAA;AAAA,QACE,yKAAA;AAAA,QACA,gBAAA,CAAiB,WAAW,KAAK;AAAA,OACnC;AAAA,MAED,GAAG,KAAA;AAAA,MAGJ,cAAA,EAAc,OAAA;AAAA,MACd,WAAA,EAAW,IAAA;AAAA,MACX,cAAA,EAAc,OAAA;AAAA,MAEd,QAAA,kBAAA,GAAA,CAAC,kBAAA,CAAmB,QAAA,EAAnB,EAA4B,KAAA,EAAO,EAAE,OAAA,EAAS,IAAA,EAAM,OAAA,EAAQ,EAC1D,QAAA,EACH;AAAA;AAAA,GACF;AAEJ;AAEA,SAAS,eAAA,CAAgB;AAAA,EACvB,SAAA;AAAA,EACA,QAAA;AAAA,EACA,OAAA,GAAU,SAAA;AAAA,EACV,IAAA,GAAO,SAAA;AAAA,EACP,GAAG;AACL,CAAA,EAAgE;AAC9D,EAAA,MAAM,OAAA,GAAU,KAAA,CAAM,UAAA,CAAW,kBAAkB,CAAA;AAEnD,EAAA,uBACE,GAAA;AAAA,IAACC,MAAA;AAAA,IAAA;AAAA,MACC,WAAA,EAAU,mBAAA;AAAA,MACV,SAAA,EAAW,CAAC,KAAA,KACV,EAAA;AAAA,QACE,k4BAAA;AAAA,QACA,cAAA,CAAe;AAAA,UACb,OAAA,EAAS,QAAQ,OAAA,IAAW,OAAA;AAAA,UAC5B,IAAA,EAAM,QAAQ,IAAA,IAAQ;AAAA,SACvB,CAAA;AAAA,QACD,gBAAA,CAAiB,WAAW,KAAK;AAAA,OACnC;AAAA,MAED,GAAG,KAAA;AAAA,MAEJ,cAAA,EAAc,QAAQ,OAAA,IAAW,OAAA;AAAA,MACjC,WAAA,EAAW,QAAQ,IAAA,IAAQ,IAAA;AAAA,MAC3B,gBAAc,OAAA,CAAQ,OAAA;AAAA,MAErB;AAAA;AAAA,GACH;AAEJ","file":"toggle-group.js","sourcesContent":["'use client'\n\nimport { Toggle as TogglePrimitive } from '@base-ui/react/toggle'\nimport { ToggleGroup as ToggleGroupPrimitive } from '@base-ui/react/toggle-group'\nimport { type VariantProps } from 'class-variance-authority'\nimport * as React from 'react'\n\nimport { resolveStateProp } from '../lib/resolve-state-prop.js'\nimport { cn } from '../lib/utils.js'\nimport { toggleVariants } from './toggle.js'\n\nconst ToggleGroupContext = React.createContext<\n VariantProps<typeof toggleVariants> & {\n spacing?: number\n }\n>({\n size: 'default',\n variant: 'default',\n spacing: 2,\n})\n\nfunction ToggleGroup({\n className,\n style,\n variant,\n size,\n spacing = 2,\n children,\n ...props\n}: ToggleGroupPrimitive.Props &\n VariantProps<typeof toggleVariants> & {\n spacing?: number\n }) {\n // `orientation` stays in `props` so it reaches Base UI, whose roving focus\n // follows it (Up/Down in a vertical group, Left/Right in a horizontal one)\n // and which stamps the `data-orientation` the `data-vertical:` classes here\n // and the items' `group-data-*/toggle-group:` classes key on. Both parts\n // resolve `className` and `style` against their state first (see\n // `resolveStateProp`), so Base UI's function form survives being combined.\n return (\n <ToggleGroupPrimitive\n data-slot='toggle-group'\n // Merged rather than replaced, so a consumer's own `style` keeps the\n // `--gap` the gap utility reads. `--gap` goes last so it always matches\n // `data-spacing`.\n style={(state) =>\n ({ ...resolveStateProp(style, state), '--gap': spacing }) as React.CSSProperties\n }\n className={(state) =>\n cn(\n 'group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] rounded-sm data-[size=sm]:rounded-sm data-vertical:flex-col data-vertical:items-stretch',\n resolveStateProp(className, state),\n )\n }\n {...props}\n // After the spread, so a consumer's own `data-*` cannot desync the\n // attributes from the props the classes and the items read.\n data-variant={variant}\n data-size={size}\n data-spacing={spacing}\n >\n <ToggleGroupContext.Provider value={{ variant, size, spacing }}>\n {children}\n </ToggleGroupContext.Provider>\n </ToggleGroupPrimitive>\n )\n}\n\nfunction ToggleGroupItem({\n className,\n children,\n variant = 'default',\n size = 'default',\n ...props\n}: TogglePrimitive.Props & VariantProps<typeof toggleVariants>) {\n const context = React.useContext(ToggleGroupContext)\n\n return (\n <TogglePrimitive\n data-slot='toggle-group-item'\n className={(state) =>\n cn(\n 'shrink-0 group-data-[spacing=0]/toggle-group:rounded-none group-data-[spacing=0]/toggle-group:px-2 focus:z-10 focus-visible:z-10 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-end]:pe-1.5 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-start]:ps-1.5 group-data-horizontal/toggle-group:data-[spacing=0]:first:rounded-s-sm group-data-vertical/toggle-group:data-[spacing=0]:first:rounded-t-sm group-data-horizontal/toggle-group:data-[spacing=0]:last:rounded-e-sm group-data-vertical/toggle-group:data-[spacing=0]:last:rounded-b-sm group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:border-s-0 group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:border-t-0 group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-s group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-t',\n toggleVariants({\n variant: context.variant || variant,\n size: context.size || size,\n }),\n resolveStateProp(className, state),\n )\n }\n {...props}\n // After the spread, for the same reason as the group's.\n data-variant={context.variant || variant}\n data-size={context.size || size}\n data-spacing={context.spacing}\n >\n {children}\n </TogglePrimitive>\n )\n}\n\nexport { ToggleGroup, ToggleGroupItem }\n"]}
|
|
@@ -82,4 +82,5 @@ type UseChromeHeightResult<T extends HTMLElement> = {
|
|
|
82
82
|
*/
|
|
83
83
|
declare function useChromeHeight<T extends HTMLElement = HTMLElement>({ property, }?: UseChromeHeightOptions): UseChromeHeightResult<T>;
|
|
84
84
|
|
|
85
|
-
export {
|
|
85
|
+
export { useChromeHeight };
|
|
86
|
+
export type { UseChromeHeightOptions, UseChromeHeightResult };
|
|
@@ -43,4 +43,5 @@ declare function ButtonGroupBoundary({ children }: {
|
|
|
43
43
|
children: React.ReactNode;
|
|
44
44
|
}): React.JSX.Element;
|
|
45
45
|
|
|
46
|
-
export { ButtonGroupBoundary, ButtonGroupContext
|
|
46
|
+
export { ButtonGroupBoundary, ButtonGroupContext };
|
|
47
|
+
export type { ButtonGroupContextValue, ButtonGroupOrientation };
|
|
@@ -8,4 +8,5 @@ import '../components/link.js';
|
|
|
8
8
|
type LabelColor = NonNullable<VariantProps<typeof buttonColorVariants>['color']>;
|
|
9
9
|
declare function labelColorVariants(color?: LabelColor | 'light' | null, variant?: 'solid' | 'soft' | 'surface' | 'outline' | null): string;
|
|
10
10
|
|
|
11
|
-
export {
|
|
11
|
+
export { labelColorVariants };
|
|
12
|
+
export type { LabelColor };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolves a Base UI `className` or `style` prop against the part's state.
|
|
3
|
+
*
|
|
4
|
+
* Base UI accepts both as a value or as a function of the part's state. A
|
|
5
|
+
* component that adds its own classes or styles has to resolve the function
|
|
6
|
+
* form itself before combining: `cn()` would silently drop a function (clsx
|
|
7
|
+
* ignores them), and spreading one into a style object yields nothing. So the
|
|
8
|
+
* component passes Base UI a function of its own, resolves the consumer's
|
|
9
|
+
* value with this, and combines the two.
|
|
10
|
+
*
|
|
11
|
+
* Not re-exported from the package barrel — an internal helper, shipped to
|
|
12
|
+
* registry consumers as `lib/resolve-state-prop.ts` beside their own
|
|
13
|
+
* `lib/utils.ts`, under a name specific enough not to collide with a module a
|
|
14
|
+
* consumer already owns.
|
|
15
|
+
*/
|
|
16
|
+
declare function resolveStateProp<Value, State>(value: Value | ((state: State) => Value | undefined) | undefined, state: State): Value | undefined;
|
|
17
|
+
|
|
18
|
+
export { resolveStateProp };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/resolve-state-prop.ts"],"names":[],"mappings":"AAeO,SAAS,gBAAA,CACd,OACA,KAAA,EACmB;AACnB,EAAA,OAAO,OAAO,KAAA,KAAU,UAAA,GAAc,KAAA,CAA8C,KAAK,CAAA,GAAI,KAAA;AAC/F","file":"resolve-state-prop.js","sourcesContent":["/**\n * Resolves a Base UI `className` or `style` prop against the part's state.\n *\n * Base UI accepts both as a value or as a function of the part's state. A\n * component that adds its own classes or styles has to resolve the function\n * form itself before combining: `cn()` would silently drop a function (clsx\n * ignores them), and spreading one into a style object yields nothing. So the\n * component passes Base UI a function of its own, resolves the consumer's\n * value with this, and combines the two.\n *\n * Not re-exported from the package barrel — an internal helper, shipped to\n * registry consumers as `lib/resolve-state-prop.ts` beside their own\n * `lib/utils.ts`, under a name specific enough not to collide with a module a\n * consumer already owns.\n */\nexport function resolveStateProp<Value, State>(\n value: Value | ((state: State) => Value | undefined) | undefined,\n state: State,\n): Value | undefined {\n return typeof value === 'function' ? (value as (state: State) => Value | undefined)(state) : value\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nswds/ui",
|
|
3
|
-
"version": "9.3.
|
|
3
|
+
"version": "9.3.3",
|
|
4
4
|
"description": "UI components for NSW Government digital products, providing reusable design elements and patterns for consistent user interfaces.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/digitalnsw/nswds-ui#readme",
|
|
@@ -95,8 +95,9 @@
|
|
|
95
95
|
"devDependencies": {
|
|
96
96
|
"@arethetypeswrong/cli": "^0.18.3",
|
|
97
97
|
"@nswds/tokens": "^5.0.0",
|
|
98
|
-
"@
|
|
99
|
-
"@storybook/
|
|
98
|
+
"@nswds/typescript-config": "^1.0.0",
|
|
99
|
+
"@storybook/addon-docs": "10.6.7",
|
|
100
|
+
"@storybook/react-vite": "10.6.7",
|
|
100
101
|
"@tailwindcss/cli": "^4.3.0",
|
|
101
102
|
"@tailwindcss/postcss": "^4.1.18",
|
|
102
103
|
"@turbo/gen": "^2.8.1",
|
|
@@ -104,15 +105,14 @@
|
|
|
104
105
|
"@types/react": "^19.2.10",
|
|
105
106
|
"@types/react-dom": "^19.2.3",
|
|
106
107
|
"@workspace/eslint-config": "*",
|
|
107
|
-
"@workspace/typescript-config": "*",
|
|
108
108
|
"eslint": "^9.39.2",
|
|
109
109
|
"publint": "^0.3.21",
|
|
110
110
|
"react": "^19.2.4",
|
|
111
111
|
"react-dom": "^19.2.4",
|
|
112
112
|
"shadcn": "^4.8.0",
|
|
113
|
-
"storybook": "10.6.
|
|
113
|
+
"storybook": "10.6.7",
|
|
114
114
|
"tailwindcss": "^4.1.18",
|
|
115
|
-
"tsup": "^
|
|
115
|
+
"tsup": "^9.0.0",
|
|
116
116
|
"tw-animate-css": "^1.4.0",
|
|
117
117
|
"typescript": "^5.9.3"
|
|
118
118
|
},
|