@nswds/ui 8.1.0 → 8.2.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 CHANGED
@@ -48,7 +48,26 @@ The bridges must come first because both stylesheets emit an unlayered `:root` b
48
48
 
49
49
  ### Using it with your own Tailwind build
50
50
 
51
- `@import 'tailwindcss'` goes last for a different reason: it leaves you with two independently-sorted sets of utilities in the same `utilities` cascade layer, and a media query adds no specificity. Within one Tailwind build the sorter guarantees `.lg\:justify-start` is emitted after `.justify-center`; across two builds nothing does, so whichever half comes last wins any tie. Ours going first means your utilities win those ties, which is what you want: a class you wrote should beat one you didn't.
51
+ If you run your own Tailwind build, the cleanest setup is a **single build**: import our entry and let your Tailwind compile the library's utilities and yours together.
52
+
53
+ ```css
54
+ @import '@nswds/ui/tailwind.css';
55
+ /* your own @source / @theme additions go here */
56
+ ```
57
+
58
+ Install the peer dependencies this entry compiles against — they're declared as _optional_ peers, so your package manager won't add them for you:
59
+
60
+ ```bash
61
+ npm i -D tailwindcss @nswds/tokens tw-animate-css
62
+ ```
63
+
64
+ `@nswds/ui/tailwind.css` brings Tailwind itself, the full NSW token foundation, and an `@source` pointed at the shipped components. One build means one sort order: every utility is emitted once, and your `lg:` means the same `1200px` ours does. **Don't also `@import 'tailwindcss'`** — this entry already brings it, and importing it twice re-creates the two-build problem described below.
65
+
66
+ This is the path we recommend. It needs no import-order rules and no cascade caveats: with a single sorter there are no ties to break, so the rest of this section applies only if you can't compile in one build.
67
+
68
+ #### Fallback: the precompiled stylesheet plus your own Tailwind
69
+
70
+ If a single build isn't an option (say another tool owns your Tailwind config), import the precompiled `@nswds/ui/styles.css` and put your own `@import 'tailwindcss'` **after** it, as in [Import order](#import-order) above. That leaves you with two independently-sorted sets of utilities in the same `utilities` cascade layer, and a media query adds no specificity. Within one Tailwind build the sorter guarantees `.lg\:justify-start` is emitted after `.justify-center`; across two builds nothing does, so whichever half comes last wins any tie. Ours going first means your utilities win those ties, which is what you want: a class you wrote should beat one you didn't.
52
71
 
53
72
  Reverse it and the same mechanism works against you — our plain `.inline-flex` (Button's base) would outrank your `hidden sm:inline-flex`, showing a button you meant to hide on mobile.
54
73
 
@@ -6,7 +6,7 @@ import { Link } from './link.js';
6
6
 
7
7
  declare const badgeVariants: (props?: ({
8
8
  variant?: "solid" | "soft" | "surface" | "outline" | null | undefined;
9
- color?: "primary/grey" | "light" | "primary/white" | "white" | "grey" | "primary" | "secondary" | "tertiary" | "accent" | null | undefined;
9
+ color?: "primary" | "secondary" | "white" | "accent" | "tertiary" | "grey" | "primary/grey" | "light" | "primary/white" | null | undefined;
10
10
  size?: "default" | "sm" | "lg" | null | undefined;
11
11
  } & class_variance_authority_types.ClassProp) | undefined) => string;
12
12
  type BadgeProps = VariantProps<typeof badgeVariants> & React__default.ComponentPropsWithoutRef<'span'> & {
@@ -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?: "solid" | "soft" | "surface" | "outline" | "link" | "ghost" | null | undefined;
9
- color?: "white" | "grey" | "primary" | "secondary" | "tertiary" | "accent" | "success" | "warning" | "danger" | null | undefined;
8
+ variant?: "link" | "solid" | "soft" | "surface" | "outline" | "ghost" | null | undefined;
9
+ color?: "primary" | "secondary" | "white" | "accent" | "tertiary" | "success" | "warning" | "grey" | "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?: "white" | "grey" | "primary" | "secondary" | "tertiary" | "accent" | "success" | "warning" | "danger" | null | undefined;
30
+ color?: "primary" | "secondary" | "white" | "accent" | "tertiary" | "success" | "warning" | "grey" | "danger" | null | undefined;
31
31
  onTint?: boolean | null | undefined;
32
32
  } & class_variance_authority_types.ClassProp) | undefined) => string;
33
33
  /**
@@ -30,7 +30,7 @@ declare const headerColors: {
30
30
  };
31
31
  type HeaderColor = keyof typeof headerColors;
32
32
  declare const headerVariants: (props?: ({
33
- color?: "light" | "white" | "grey" | "dark" | null | undefined;
33
+ color?: "white" | "grey" | "light" | "dark" | null | undefined;
34
34
  } & class_variance_authority_types.ClassProp) | undefined) => string;
35
35
  declare const headerContainerVariants: (props?: ({
36
36
  container?: "fluid" | "contained" | null | undefined;
@@ -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?: "white" | "primary" | "secondary" | "unstyled" | null | undefined;
6
+ variant?: "primary" | "secondary" | "white" | "unstyled" | null | undefined;
7
7
  } & class_variance_authority_types.ClassProp) | undefined) => string;
8
8
  type LinkComponent = React__default.ElementType;
9
9
  /**
@@ -10,7 +10,7 @@ declare const mastheadColors: {
10
10
  };
11
11
  type MastheadColor = keyof typeof mastheadColors;
12
12
  declare const mastheadVariants: (props?: ({
13
- color?: "light" | "white" | "grey" | "dark" | null | undefined;
13
+ color?: "white" | "grey" | "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;
@@ -32,10 +32,19 @@ function SelectValue({ className, ...props }) {
32
32
  const selectTriggerVariants = cva(
33
33
  // Field foundation shared with Input (input.tsx): the same --input-* semantic
34
34
  // tokens, 16px text, and an outline-based focus ring. No `outline-none` here —
35
- // it sets --tw-outline-style:none on the element and would suppress the
36
- // focus-visible outline below. Dark mode and brand themes restyle via tokens,
37
- // so there are no dark: variants.
38
- "flex w-fit items-center justify-between gap-2 rounded-sm text-base whitespace-nowrap text-(--input-foreground) focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--input-ring) disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-2 aria-invalid:border-(--input-invalid-border) aria-invalid:hover:bg-(--input-invalid-surface-hover) aria-invalid:focus-visible:outline-(--input-invalid-ring) data-placeholder:text-(--input-placeholder) *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 motion-safe:transition-colors [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
35
+ // it sets --tw-outline-style:none on the element and would suppress the focus
36
+ // outline below. Dark mode and brand themes restyle via tokens, so there are
37
+ // no dark: variants.
38
+ //
39
+ // Focus is `focus:`, not the `focus-visible:` Input uses — like Button, and
40
+ // for the same reason (see button.tsx). This trigger is a <button>, and a
41
+ // button focused by MOUSE does not match :focus-visible, so on a pointer click
42
+ // the ring never painted. A native <select> DOES match :focus-visible on click
43
+ // (the browser's form-control heuristic), which is why NativeSelect keeps
44
+ // focus-visible; this custom trigger cannot, so `focus:` rings on click too and
45
+ // the control reads as focused like the rest of the field family. Do not
46
+ // "unify" it back to focus-visible.
47
+ "flex w-fit items-center justify-between gap-2 rounded-sm text-base whitespace-nowrap text-(--input-foreground) focus:outline focus:outline-2 focus:outline-offset-2 focus:outline-(--input-ring) disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-2 aria-invalid:border-(--input-invalid-border) aria-invalid:hover:bg-(--input-invalid-surface-hover) aria-invalid:focus:outline-(--input-invalid-ring) data-placeholder:text-(--input-placeholder) *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 motion-safe:transition-colors [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
39
48
  {
40
49
  variants: {
41
50
  variant: {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/select.tsx"],"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AA,MACV,SAAA,EAAW,EAAA,CAAG,kDAAA,EAAoD,SAAS,CAAA;AAAA,MAC1E,GAAG;AAAA;AAAA,GACN;AAEJ;AAEA,SAAS,oBAAA,CAAqB;AAAA,EAC5B,SAAA;AAAA,EACA,GAAG;AACL,CAAA,EAA+D;AAC7D,EAAA,uBACE,GAAA;AAAA,IAACA,QAAA,CAAgB,aAAA;AAAA,IAAhB;AAAA,MACC,WAAA,EAAU,yBAAA;AAAA,MACV,SAAA,EAAW,EAAA;AAAA,QACT,0HAAA;AAAA,QACA;AAAA,OACF;AAAA,MACC,GAAG,KAAA;AAAA,MAEJ,8BAAC,cAAA,EAAA,EAAe;AAAA;AAAA,GAClB;AAEJ;AAEA,SAAS,sBAAA,CAAuB;AAAA,EAC9B,SAAA;AAAA,EACA,GAAG;AACL,CAAA,EAAiE;AAC/D,EAAA,uBACE,GAAA;AAAA,IAACA,QAAA,CAAgB,eAAA;AAAA,IAAhB;AAAA,MACC,WAAA,EAAU,2BAAA;AAAA,MACV,SAAA,EAAW,EAAA;AAAA,QACT,6HAAA;AAAA,QACA;AAAA,OACF;AAAA,MACC,GAAG,KAAA;AAAA,MAEJ,8BAAC,cAAA,EAAA,EAAe;AAAA;AAAA,GAClB;AAEJ","file":"select.js","sourcesContent":["'use client'\n\nimport { Select as SelectPrimitive } from '@base-ui/react/select'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport * as React from 'react'\n\nimport { IconCheck } from '../icons/check.js'\nimport { IconExpandLess } from '../icons/expand-less.js'\nimport { IconExpandMore } from '../icons/expand-more.js'\nimport { ButtonGroupBoundary } from '../lib/button-group-context.js'\nimport { cn } from '../lib/utils.js'\n\nconst Select = SelectPrimitive.Root\n\nfunction SelectGroup({ className, ...props }: SelectPrimitive.Group.Props) {\n return (\n <SelectPrimitive.Group\n data-slot='select-group'\n className={cn('scroll-my-1 p-1', className)}\n {...props}\n />\n )\n}\n\nfunction SelectValue({ className, ...props }: SelectPrimitive.Value.Props) {\n return (\n <SelectPrimitive.Value\n data-slot='select-value'\n className={cn('flex flex-1 text-start', className)}\n {...props}\n />\n )\n}\n\nconst selectTriggerVariants = cva(\n // Field foundation shared with Input (input.tsx): the same --input-* semantic\n // tokens, 16px text, and an outline-based focus ring. No `outline-none` here —\n // it sets --tw-outline-style:none on the element and would suppress the\n // focus-visible outline below. Dark mode and brand themes restyle via tokens,\n // so there are no dark: variants.\n \"flex w-fit items-center justify-between gap-2 rounded-sm text-base whitespace-nowrap text-(--input-foreground) focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--input-ring) disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-2 aria-invalid:border-(--input-invalid-border) aria-invalid:hover:bg-(--input-invalid-surface-hover) aria-invalid:focus-visible:outline-(--input-invalid-ring) data-placeholder:text-(--input-placeholder) *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 motion-safe:transition-colors [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n {\n variants: {\n variant: {\n // Crisp field — bordered white box; the default, matches Input exactly.\n default:\n 'border border-(--input-border) bg-(--input-surface) hover:bg-(--input-surface-hover)',\n // Filled band — borderless tinted surface that reveals its border on hover.\n filled: 'border border-transparent bg-secondary hover:border-(--input-border)',\n },\n size: {\n default: 'h-12 px-4 py-2',\n sm: 'h-10 px-3 py-1.5',\n },\n },\n defaultVariants: { variant: 'default', size: 'default' },\n },\n)\n\nfunction SelectTrigger({\n className,\n variant,\n size,\n children,\n ...props\n}: SelectPrimitive.Trigger.Props & VariantProps<typeof selectTriggerVariants>) {\n return (\n <SelectPrimitive.Trigger\n data-slot='select-trigger'\n data-size={size ?? 'default'}\n data-variant={variant ?? 'default'}\n className={cn(selectTriggerVariants({ variant, size, className }))}\n {...props}\n >\n {children}\n <SelectPrimitive.Icon\n render={<IconExpandMore className='pointer-events-none size-5 text-primary' />}\n />\n </SelectPrimitive.Trigger>\n )\n}\n\nfunction SelectContent({\n className,\n children,\n side = 'bottom',\n sideOffset = 4,\n align = 'center',\n alignOffset = 0,\n alignItemWithTrigger = true,\n ...props\n}: SelectPrimitive.Popup.Props &\n Pick<\n SelectPrimitive.Positioner.Props,\n 'align' | 'alignOffset' | 'side' | 'sideOffset' | 'alignItemWithTrigger'\n >) {\n return (\n <SelectPrimitive.Portal>\n {/* Stops a ButtonGroup's context at the portal — see ButtonGroupBoundary. */}\n <ButtonGroupBoundary>\n <SelectPrimitive.Positioner\n side={side}\n sideOffset={sideOffset}\n align={align}\n alignOffset={alignOffset}\n alignItemWithTrigger={alignItemWithTrigger}\n className='isolate z-50'\n >\n <SelectPrimitive.Popup\n data-slot='select-content'\n data-align-trigger={alignItemWithTrigger}\n className={cn(\n 'relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-start-2 data-[side=inline-start]:slide-in-from-end-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95',\n className,\n )}\n {...props}\n >\n <SelectScrollUpButton />\n <SelectPrimitive.List>{children}</SelectPrimitive.List>\n <SelectScrollDownButton />\n </SelectPrimitive.Popup>\n </SelectPrimitive.Positioner>\n </ButtonGroupBoundary>\n </SelectPrimitive.Portal>\n )\n}\n\nfunction SelectLabel({ className, ...props }: SelectPrimitive.GroupLabel.Props) {\n return (\n <SelectPrimitive.GroupLabel\n data-slot='select-label'\n className={cn('px-4 py-2 text-base font-semibold text-muted-foreground', className)}\n {...props}\n />\n )\n}\n\nfunction SelectItem({ className, children, ...props }: SelectPrimitive.Item.Props) {\n return (\n <SelectPrimitive.Item\n data-slot='select-item'\n className={cn(\n \"relative flex min-h-11 w-full cursor-default items-center gap-2 rounded-sm py-2 ps-4 pe-9 text-base outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2\",\n className,\n )}\n {...props}\n >\n <SelectPrimitive.ItemText className='flex flex-1 shrink-0 gap-2 whitespace-nowrap'>\n {children}\n </SelectPrimitive.ItemText>\n <SelectPrimitive.ItemIndicator\n render={\n <span className='pointer-events-none absolute end-2 flex items-center justify-center' />\n }\n >\n <IconCheck className='pointer-events-none' />\n </SelectPrimitive.ItemIndicator>\n </SelectPrimitive.Item>\n )\n}\n\nfunction SelectSeparator({ className, ...props }: SelectPrimitive.Separator.Props) {\n return (\n <SelectPrimitive.Separator\n data-slot='select-separator'\n className={cn('pointer-events-none -mx-1 my-1 h-px bg-border/50', className)}\n {...props}\n />\n )\n}\n\nfunction SelectScrollUpButton({\n className,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.ScrollUpArrow>) {\n return (\n <SelectPrimitive.ScrollUpArrow\n data-slot='select-scroll-up-button'\n className={cn(\n \"top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-3.5\",\n className,\n )}\n {...props}\n >\n <IconExpandLess />\n </SelectPrimitive.ScrollUpArrow>\n )\n}\n\nfunction SelectScrollDownButton({\n className,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.ScrollDownArrow>) {\n return (\n <SelectPrimitive.ScrollDownArrow\n data-slot='select-scroll-down-button'\n className={cn(\n \"bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-3.5\",\n className,\n )}\n {...props}\n >\n <IconExpandMore />\n </SelectPrimitive.ScrollDownArrow>\n )\n}\n\nexport {\n Select,\n SelectContent,\n SelectGroup,\n SelectItem,\n SelectLabel,\n SelectScrollDownButton,\n SelectScrollUpButton,\n SelectSeparator,\n SelectTrigger,\n selectTriggerVariants,\n SelectValue,\n}\n"]}
1
+ {"version":3,"sources":["../../src/components/select.tsx"],"names":["SelectPrimitive"],"mappings":";;;;;;;;;AAYA,MAAM,SAASA,QAAA,CAAgB;AAE/B,SAAS,WAAA,CAAY,EAAE,SAAA,EAAW,GAAG,OAAM,EAAgC;AACzE,EAAA,uBACE,GAAA;AAAA,IAACA,QAAA,CAAgB,KAAA;AAAA,IAAhB;AAAA,MACC,WAAA,EAAU,cAAA;AAAA,MACV,SAAA,EAAW,EAAA,CAAG,iBAAA,EAAmB,SAAS,CAAA;AAAA,MACzC,GAAG;AAAA;AAAA,GACN;AAEJ;AAEA,SAAS,WAAA,CAAY,EAAE,SAAA,EAAW,GAAG,OAAM,EAAgC;AACzE,EAAA,uBACE,GAAA;AAAA,IAACA,QAAA,CAAgB,KAAA;AAAA,IAAhB;AAAA,MACC,WAAA,EAAU,cAAA;AAAA,MACV,SAAA,EAAW,EAAA,CAAG,wBAAA,EAA0B,SAAS,CAAA;AAAA,MAChD,GAAG;AAAA;AAAA,GACN;AAEJ;AAEA,MAAM,qBAAA,GAAwB,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAe5B,uuBAAA;AAAA,EACA;AAAA,IACE,QAAA,EAAU;AAAA,MACR,OAAA,EAAS;AAAA;AAAA,QAEP,OAAA,EACE,sFAAA;AAAA;AAAA,QAEF,MAAA,EAAQ;AAAA,OACV;AAAA,MACA,IAAA,EAAM;AAAA,QACJ,OAAA,EAAS,gBAAA;AAAA,QACT,EAAA,EAAI;AAAA;AACN,KACF;AAAA,IACA,eAAA,EAAiB,EAAE,OAAA,EAAS,SA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A,YAGxF,QAAA,kBAAA,GAAA,CAAC,SAAA,EAAA,EAAU,SAAA,EAAU,qBAAA,EAAsB;AAAA;AAAA;AAC7C;AAAA;AAAA,GACF;AAEJ;AAEA,SAAS,eAAA,CAAgB,EAAE,SAAA,EAAW,GAAG,OAAM,EAAoC;AACjF,EAAA,uBACE,GAAA;AAAA,IAACA,QAAA,CAAgB,SAAA;AAAA,IAAhB;AAAA,MACC,WAAA,EAAU,kBAAA;AAAA,MACV,SAAA,EAAW,EAAA,CAAG,kDAAA,EAAoD,SAAS,CAAA;AAAA,MAC1E,GAAG;AAAA;AAAA,GACN;AAEJ;AAEA,SAAS,oBAAA,CAAqB;AAAA,EAC5B,SAAA;AAAA,EACA,GAAG;AACL,CAAA,EAA+D;AAC7D,EAAA,uBACE,GAAA;AAAA,IAACA,QAAA,CAAgB,aAAA;AAAA,IAAhB;AAAA,MACC,WAAA,EAAU,yBAAA;AAAA,MACV,SAAA,EAAW,EAAA;AAAA,QACT,0HAAA;AAAA,QACA;AAAA,OACF;AAAA,MACC,GAAG,KAAA;AAAA,MAEJ,8BAAC,cAAA,EAAA,EAAe;AAAA;AAAA,GAClB;AAEJ;AAEA,SAAS,sBAAA,CAAuB;AAAA,EAC9B,SAAA;AAAA,EACA,GAAG;AACL,CAAA,EAAiE;AAC/D,EAAA,uBACE,GAAA;AAAA,IAACA,QAAA,CAAgB,eAAA;AAAA,IAAhB;AAAA,MACC,WAAA,EAAU,2BAAA;AAAA,MACV,SAAA,EAAW,EAAA;AAAA,QACT,6HAAA;AAAA,QACA;AAAA,OACF;AAAA,MACC,GAAG,KAAA;AAAA,MAEJ,8BAAC,cAAA,EAAA,EAAe;AAAA;AAAA,GAClB;AAEJ","file":"select.js","sourcesContent":["'use client'\n\nimport { Select as SelectPrimitive } from '@base-ui/react/select'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport * as React from 'react'\n\nimport { IconCheck } from '../icons/check.js'\nimport { IconExpandLess } from '../icons/expand-less.js'\nimport { IconExpandMore } from '../icons/expand-more.js'\nimport { ButtonGroupBoundary } from '../lib/button-group-context.js'\nimport { cn } from '../lib/utils.js'\n\nconst Select = SelectPrimitive.Root\n\nfunction SelectGroup({ className, ...props }: SelectPrimitive.Group.Props) {\n return (\n <SelectPrimitive.Group\n data-slot='select-group'\n className={cn('scroll-my-1 p-1', className)}\n {...props}\n />\n )\n}\n\nfunction SelectValue({ className, ...props }: SelectPrimitive.Value.Props) {\n return (\n <SelectPrimitive.Value\n data-slot='select-value'\n className={cn('flex flex-1 text-start', className)}\n {...props}\n />\n )\n}\n\nconst selectTriggerVariants = cva(\n // Field foundation shared with Input (input.tsx): the same --input-* semantic\n // tokens, 16px text, and an outline-based focus ring. No `outline-none` here —\n // it sets --tw-outline-style:none on the element and would suppress the focus\n // outline below. Dark mode and brand themes restyle via tokens, so there are\n // no dark: variants.\n //\n // Focus is `focus:`, not the `focus-visible:` Input uses — like Button, and\n // for the same reason (see button.tsx). This trigger is a <button>, and a\n // button focused by MOUSE does not match :focus-visible, so on a pointer click\n // the ring never painted. A native <select> DOES match :focus-visible on click\n // (the browser's form-control heuristic), which is why NativeSelect keeps\n // focus-visible; this custom trigger cannot, so `focus:` rings on click too and\n // the control reads as focused like the rest of the field family. Do not\n // \"unify\" it back to focus-visible.\n \"flex w-fit items-center justify-between gap-2 rounded-sm text-base whitespace-nowrap text-(--input-foreground) focus:outline focus:outline-2 focus:outline-offset-2 focus:outline-(--input-ring) disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-2 aria-invalid:border-(--input-invalid-border) aria-invalid:hover:bg-(--input-invalid-surface-hover) aria-invalid:focus:outline-(--input-invalid-ring) data-placeholder:text-(--input-placeholder) *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 motion-safe:transition-colors [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n {\n variants: {\n variant: {\n // Crisp field — bordered white box; the default, matches Input exactly.\n default:\n 'border border-(--input-border) bg-(--input-surface) hover:bg-(--input-surface-hover)',\n // Filled band — borderless tinted surface that reveals its border on hover.\n filled: 'border border-transparent bg-secondary hover:border-(--input-border)',\n },\n size: {\n default: 'h-12 px-4 py-2',\n sm: 'h-10 px-3 py-1.5',\n },\n },\n defaultVariants: { variant: 'default', size: 'default' },\n },\n)\n\nfunction SelectTrigger({\n className,\n variant,\n size,\n children,\n ...props\n}: SelectPrimitive.Trigger.Props & VariantProps<typeof selectTriggerVariants>) {\n return (\n <SelectPrimitive.Trigger\n data-slot='select-trigger'\n data-size={size ?? 'default'}\n data-variant={variant ?? 'default'}\n className={cn(selectTriggerVariants({ variant, size, className }))}\n {...props}\n >\n {children}\n <SelectPrimitive.Icon\n render={<IconExpandMore className='pointer-events-none size-5 text-primary' />}\n />\n </SelectPrimitive.Trigger>\n )\n}\n\nfunction SelectContent({\n className,\n children,\n side = 'bottom',\n sideOffset = 4,\n align = 'center',\n alignOffset = 0,\n alignItemWithTrigger = true,\n ...props\n}: SelectPrimitive.Popup.Props &\n Pick<\n SelectPrimitive.Positioner.Props,\n 'align' | 'alignOffset' | 'side' | 'sideOffset' | 'alignItemWithTrigger'\n >) {\n return (\n <SelectPrimitive.Portal>\n {/* Stops a ButtonGroup's context at the portal — see ButtonGroupBoundary. */}\n <ButtonGroupBoundary>\n <SelectPrimitive.Positioner\n side={side}\n sideOffset={sideOffset}\n align={align}\n alignOffset={alignOffset}\n alignItemWithTrigger={alignItemWithTrigger}\n className='isolate z-50'\n >\n <SelectPrimitive.Popup\n data-slot='select-content'\n data-align-trigger={alignItemWithTrigger}\n className={cn(\n 'relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-start-2 data-[side=inline-start]:slide-in-from-end-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95',\n className,\n )}\n {...props}\n >\n <SelectScrollUpButton />\n <SelectPrimitive.List>{children}</SelectPrimitive.List>\n <SelectScrollDownButton />\n </SelectPrimitive.Popup>\n </SelectPrimitive.Positioner>\n </ButtonGroupBoundary>\n </SelectPrimitive.Portal>\n )\n}\n\nfunction SelectLabel({ className, ...props }: SelectPrimitive.GroupLabel.Props) {\n return (\n <SelectPrimitive.GroupLabel\n data-slot='select-label'\n className={cn('px-4 py-2 text-base font-semibold text-muted-foreground', className)}\n {...props}\n />\n )\n}\n\nfunction SelectItem({ className, children, ...props }: SelectPrimitive.Item.Props) {\n return (\n <SelectPrimitive.Item\n data-slot='select-item'\n className={cn(\n \"relative flex min-h-11 w-full cursor-default items-center gap-2 rounded-sm py-2 ps-4 pe-9 text-base outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2\",\n className,\n )}\n {...props}\n >\n <SelectPrimitive.ItemText className='flex flex-1 shrink-0 gap-2 whitespace-nowrap'>\n {children}\n </SelectPrimitive.ItemText>\n <SelectPrimitive.ItemIndicator\n render={\n <span className='pointer-events-none absolute end-2 flex items-center justify-center' />\n }\n >\n <IconCheck className='pointer-events-none' />\n </SelectPrimitive.ItemIndicator>\n </SelectPrimitive.Item>\n )\n}\n\nfunction SelectSeparator({ className, ...props }: SelectPrimitive.Separator.Props) {\n return (\n <SelectPrimitive.Separator\n data-slot='select-separator'\n className={cn('pointer-events-none -mx-1 my-1 h-px bg-border/50', className)}\n {...props}\n />\n )\n}\n\nfunction SelectScrollUpButton({\n className,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.ScrollUpArrow>) {\n return (\n <SelectPrimitive.ScrollUpArrow\n data-slot='select-scroll-up-button'\n className={cn(\n \"top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-3.5\",\n className,\n )}\n {...props}\n >\n <IconExpandLess />\n </SelectPrimitive.ScrollUpArrow>\n )\n}\n\nfunction SelectScrollDownButton({\n className,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.ScrollDownArrow>) {\n return (\n <SelectPrimitive.ScrollDownArrow\n data-slot='select-scroll-down-button'\n className={cn(\n \"bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-3.5\",\n className,\n )}\n {...props}\n >\n <IconExpandMore />\n </SelectPrimitive.ScrollDownArrow>\n )\n}\n\nexport {\n Select,\n SelectContent,\n SelectGroup,\n SelectItem,\n SelectLabel,\n SelectScrollDownButton,\n SelectScrollUpButton,\n SelectSeparator,\n SelectTrigger,\n selectTriggerVariants,\n SelectValue,\n}\n"]}
@@ -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?: "light" | "white" | "grey" | "dark" | null | undefined;
6
+ color?: "white" | "grey" | "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"`. */