@nswds/ui 8.2.1 → 8.3.1
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 +5 -5
- package/dist/components/alert-dialog.d.ts +74 -0
- package/dist/components/alert-dialog.js +190 -0
- package/dist/components/alert-dialog.js.map +1 -0
- package/dist/components/badge.d.ts +1 -1
- package/dist/components/button.d.ts +2 -2
- package/dist/components/callout.d.ts +16 -2
- package/dist/components/callout.js +3 -1
- package/dist/components/callout.js.map +1 -1
- package/dist/components/combobox.js +1 -1
- package/dist/components/combobox.js.map +1 -1
- package/dist/components/dialog.d.ts +54 -0
- package/dist/components/dialog.js +204 -0
- package/dist/components/dialog.js.map +1 -0
- package/dist/components/drawer.js +3 -1
- package/dist/components/drawer.js.map +1 -1
- package/dist/components/dropdown-menu.d.ts +89 -0
- package/dist/components/dropdown-menu.js +313 -0
- package/dist/components/dropdown-menu.js.map +1 -0
- package/dist/components/empty.d.ts +26 -0
- package/dist/components/empty.js +98 -0
- package/dist/components/empty.js.map +1 -0
- package/dist/components/hover-card.js +1 -1
- package/dist/components/hover-card.js.map +1 -1
- package/dist/components/input-group.d.ts +1 -1
- package/dist/components/link.d.ts +1 -1
- package/dist/components/popover.js +1 -1
- package/dist/components/popover.js.map +1 -1
- package/dist/components/select.js +1 -1
- package/dist/components/select.js.map +1 -1
- package/dist/components/sheet.d.ts +8 -1
- package/dist/components/sheet.js +36 -5
- package/dist/components/sheet.js.map +1 -1
- package/dist/components/skeleton.d.ts +33 -0
- package/dist/components/skeleton.js +34 -0
- package/dist/components/skeleton.js.map +1 -0
- package/dist/index.d.ts +10 -3
- package/dist/index.js +5 -0
- package/dist/lib/overlay.d.ts +29 -0
- package/dist/lib/overlay.js +7 -0
- package/dist/lib/overlay.js.map +1 -0
- package/dist/styles.css +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/select.tsx"],"names":["SelectPrimitive"],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AAhB;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"]}
|
|
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,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HAAA;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 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"]}
|
|
@@ -4,7 +4,14 @@ import * as React from 'react';
|
|
|
4
4
|
declare function Sheet({ ...props }: Dialog.Root.Props): React.JSX.Element;
|
|
5
5
|
declare function SheetTrigger({ ...props }: Dialog.Trigger.Props): React.JSX.Element;
|
|
6
6
|
declare function SheetClose({ ...props }: Dialog.Close.Props): React.JSX.Element;
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* On open, keyboard and mouse users land on the close button, which is first
|
|
9
|
+
* in the DOM, rather than on the first control in the content. With
|
|
10
|
+
* `showCloseButton={false}` the sheet itself takes focus, so a long sheet
|
|
11
|
+
* never opens scrolled to a footer action. Pass `initialFocus` to choose a
|
|
12
|
+
* different target, such as a search field the sheet exists to fill in.
|
|
13
|
+
*/
|
|
14
|
+
declare function SheetContent({ className, children, side, showCloseButton, closeLabel, initialFocus, ref, ...props }: Dialog.Popup.Props & {
|
|
8
15
|
side?: 'top' | 'right' | 'bottom' | 'left';
|
|
9
16
|
showCloseButton?: boolean;
|
|
10
17
|
/**
|
package/dist/components/sheet.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
3
|
import { Dialog } from '@base-ui/react/dialog';
|
|
4
|
+
import * as React from 'react';
|
|
4
5
|
import { Button } from '../components/button.js';
|
|
5
6
|
import { IconClose } from '../icons/close.js';
|
|
6
7
|
import { ButtonGroupBoundary } from '../lib/button-group-context.js';
|
|
8
|
+
import { overlayScrim } from '../lib/overlay.js';
|
|
7
9
|
import { cn } from '../lib/utils.js';
|
|
8
10
|
|
|
9
11
|
function Sheet({ ...props }) {
|
|
@@ -24,7 +26,8 @@ function SheetOverlay({ className, ...props }) {
|
|
|
24
26
|
{
|
|
25
27
|
"data-slot": "sheet-overlay",
|
|
26
28
|
className: cn(
|
|
27
|
-
"fixed inset-0 z-50
|
|
29
|
+
"fixed inset-0 z-50 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0",
|
|
30
|
+
overlayScrim,
|
|
28
31
|
className
|
|
29
32
|
),
|
|
30
33
|
...props
|
|
@@ -37,17 +40,45 @@ function SheetContent({
|
|
|
37
40
|
side = "right",
|
|
38
41
|
showCloseButton = true,
|
|
39
42
|
closeLabel = "Close",
|
|
43
|
+
initialFocus,
|
|
44
|
+
ref,
|
|
40
45
|
...props
|
|
41
46
|
}) {
|
|
47
|
+
const popupRef = React.useRef(null);
|
|
48
|
+
const mergedRef = React.useCallback(
|
|
49
|
+
(node) => {
|
|
50
|
+
popupRef.current = node;
|
|
51
|
+
if (typeof ref === "function") {
|
|
52
|
+
const cleanup = ref(node);
|
|
53
|
+
return () => {
|
|
54
|
+
popupRef.current = null;
|
|
55
|
+
if (typeof cleanup === "function") cleanup();
|
|
56
|
+
else ref(null);
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
if (ref) ref.current = node;
|
|
60
|
+
return () => {
|
|
61
|
+
popupRef.current = null;
|
|
62
|
+
if (ref) ref.current = null;
|
|
63
|
+
};
|
|
64
|
+
},
|
|
65
|
+
[ref]
|
|
66
|
+
);
|
|
42
67
|
return /* @__PURE__ */ jsxs(SheetPortal, { children: [
|
|
43
68
|
/* @__PURE__ */ jsx(SheetOverlay, {}),
|
|
44
69
|
/* @__PURE__ */ jsxs(
|
|
45
70
|
Dialog.Popup,
|
|
46
71
|
{
|
|
72
|
+
ref: mergedRef,
|
|
73
|
+
initialFocus: initialFocus ?? (showCloseButton ? void 0 : popupRef),
|
|
47
74
|
"data-slot": "sheet-content",
|
|
48
75
|
"data-side": side,
|
|
49
76
|
className: cn(
|
|
50
|
-
"fixed z-50 flex flex-col bg-popover bg-clip-padding text-
|
|
77
|
+
"fixed z-50 flex max-h-dvh flex-col overflow-y-auto bg-popover bg-clip-padding text-base/relaxed text-popover-foreground transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-e data-[side=left]:data-ending-style:translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-s data-[side=right]:data-ending-style:translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem] data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm rtl:data-[side=left]:data-ending-style:-translate-x-[-2.5rem] rtl:data-[side=left]:data-starting-style:-translate-x-[-2.5rem] rtl:data-[side=right]:data-ending-style:-translate-x-[2.5rem] rtl:data-[side=right]:data-starting-style:-translate-x-[2.5rem]",
|
|
78
|
+
// Keep a long title clear of the absolutely placed close button: it
|
|
79
|
+
// spans 1rem-3.5rem from the end edge, so pe-16 clears it. The header
|
|
80
|
+
// matches at any depth (a form often wraps it), as Dialog's does.
|
|
81
|
+
"[&:has(>[data-slot=sheet-close])_[data-slot=sheet-header]]:pe-16",
|
|
51
82
|
className
|
|
52
83
|
),
|
|
53
84
|
...props,
|
|
@@ -63,7 +94,7 @@ function SheetContent({
|
|
|
63
94
|
color: "grey",
|
|
64
95
|
size: "icon",
|
|
65
96
|
"aria-label": closeLabel,
|
|
66
|
-
className: "absolute end-4 top-4 z-
|
|
97
|
+
className: "absolute end-4 top-4 z-20"
|
|
67
98
|
}
|
|
68
99
|
),
|
|
69
100
|
children: /* @__PURE__ */ jsx(IconClose, {})
|
|
@@ -100,7 +131,7 @@ function SheetTitle({ className, ...props }) {
|
|
|
100
131
|
Dialog.Title,
|
|
101
132
|
{
|
|
102
133
|
"data-slot": "sheet-title",
|
|
103
|
-
className: cn("text-
|
|
134
|
+
className: cn("text-lg font-medium text-foreground", className),
|
|
104
135
|
...props
|
|
105
136
|
}
|
|
106
137
|
);
|
|
@@ -110,7 +141,7 @@ function SheetDescription({ className, ...props }) {
|
|
|
110
141
|
Dialog.Description,
|
|
111
142
|
{
|
|
112
143
|
"data-slot": "sheet-description",
|
|
113
|
-
className: cn("text-
|
|
144
|
+
className: cn("text-base/relaxed text-muted-foreground", className),
|
|
114
145
|
...props
|
|
115
146
|
}
|
|
116
147
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/sheet.tsx"],"names":["SheetPrimitive"],"mappings":";;;;;;;AAUA,SAAS,KAAA,CAAM,EAAE,GAAG,KAAA,EAAM,EAA8B;AACtD,EAAA,2BAAQA,MAAA,CAAe,IAAA,EAAf,EAAoB,WAAA,EAAU,OAAA,EAAS,GAAG,KAAA,EAAO,CAAA;AAC3D;AAEA,SAAS,YAAA,CAAa,EAAE,GAAG,KAAA,EAAM,EAAiC;AAChE,EAAA,2BAAQA,MAAA,CAAe,OAAA,EAAf,EAAuB,WAAA,EAAU,eAAA,EAAiB,GAAG,KAAA,EAAO,CAAA;AACtE;AAEA,SAAS,UAAA,CAAW,EAAE,GAAG,KAAA,EAAM,EAA+B;AAC5D,EAAA,2BAAQA,MAAA,CAAe,KAAA,EAAf,EAAqB,WAAA,EAAU,aAAA,EAAe,GAAG,KAAA,EAAO,CAAA;AAClE;AAEA,SAAS,WAAA,CAAY,EAAE,QAAA,EAAU,GAAG,OAAM,EAAgC;AACxE,EAAA,uBACE,GAAA,CAACA,MAAA,CAAe,MAAA,EAAf,EAAsB,WAAA,EAAU,cAAA,EAAgB,GAAG,KAAA,EAElD,QAAA,kBAAA,GAAA,CAAC,mBAAA,EAAA,EAAqB,QAAA,EAAS,CAAA,EACjC,CAAA;AAEJ;AAEA,SAAS,YAAA,CAAa,EAAE,SAAA,EAAW,GAAG,OAAM,EAAkC;AAC5E,EAAA,uBACE,GAAA;AAAA,IAACA,MAAA,CAAe,QAAA;AAAA,IAAf;AAAA,MACC,WAAA,EAAU,eAAA;AAAA,MACV,SAAA,EAAW,EAAA;AAAA,QACT,oKAAA;AAAA,QACA;AAAA,OACF;AAAA,MACC,GAAG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S,WAAA,CAAY,EAAE,SAAA,EAAW,GAAG,OAAM,EAAgC;AACzE,EAAA,uBACE,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,WAAA,EAAU,cAAA;AAAA,MACV,SAAA,EAAW,EAAA,CAAG,iCAAA,EAAmC,SAAS,CAAA;AAAA,MACzD,GAAG;AAAA;AAAA,GACN;AAEJ;AAEA,SAAS,UAAA,CAAW,EAAE,SAAA,EAAW,GAAG,OAAM,EAA+B;AACvE,EAAA,uBACE,GAAA;AAAA,IAACA,MAAA,CAAe,KAAA;AAAA,IAAf;AAAA,MACC,WAAA,EAAU,aAAA;AAAA,MACV,SAAA,EAAW,EAAA,CAAG,qCAAA,EAAuC,SAAS,CAAA;AAAA,MAC7D,GAAG;AAAA;AAAA,GACN;AAEJ;AAEA,SAAS,gBAAA,CAAiB,EAAE,SAAA,EAAW,GAAG,OAAM,EAAqC;AACnF,EAAA,uBACE,GAAA;AAAA,IAACA,MAAA,CAAe,WAAA;AAAA,IAAf;AAAA,MACC,WAAA,EAAU,mBAAA;AAAA,MACV,SAAA,EAAW,EAAA,CAAG,uCAAA,EAAyC,SAAS,CAAA;AAAA,MAC/D,GAAG;AAAA;AAAA,GACN;AAEJ","file":"sheet.js","sourcesContent":["'use client'\n\nimport { Dialog as SheetPrimitive } from '@base-ui/react/dialog'\nimport * as React from 'react'\n\nimport { Button } from '../components/button.js'\nimport { IconClose } from '../icons/close.js'\nimport { ButtonGroupBoundary } from '../lib/button-group-context.js'\nimport { cn } from '../lib/utils.js'\n\nfunction Sheet({ ...props }: SheetPrimitive.Root.Props) {\n return <SheetPrimitive.Root data-slot='sheet' {...props} />\n}\n\nfunction SheetTrigger({ ...props }: SheetPrimitive.Trigger.Props) {\n return <SheetPrimitive.Trigger data-slot='sheet-trigger' {...props} />\n}\n\nfunction SheetClose({ ...props }: SheetPrimitive.Close.Props) {\n return <SheetPrimitive.Close data-slot='sheet-close' {...props} />\n}\n\nfunction SheetPortal({ children, ...props }: SheetPrimitive.Portal.Props) {\n return (\n <SheetPrimitive.Portal data-slot='sheet-portal' {...props}>\n {/* Stops a ButtonGroup's context at the portal — see ButtonGroupBoundary. */}\n <ButtonGroupBoundary>{children}</ButtonGroupBoundary>\n </SheetPrimitive.Portal>\n )\n}\n\nfunction SheetOverlay({ className, ...props }: SheetPrimitive.Backdrop.Props) {\n return (\n <SheetPrimitive.Backdrop\n data-slot='sheet-overlay'\n className={cn(\n 'fixed inset-0 z-50 bg-black/80 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction SheetContent({\n className,\n children,\n side = 'right',\n showCloseButton = true,\n closeLabel = 'Close',\n ...props\n}: SheetPrimitive.Popup.Props & {\n side?: 'top' | 'right' | 'bottom' | 'left'\n showCloseButton?: boolean\n /**\n * Screen-reader name for the close button. Override to translate it — the\n * button is icon-only, so this string is the only name AT ever hears.\n */\n closeLabel?: string\n}) {\n return (\n <SheetPortal>\n <SheetOverlay />\n <SheetPrimitive.Popup\n data-slot='sheet-content'\n data-side={side}\n className={cn(\n 'fixed z-50 flex flex-col bg-popover bg-clip-padding text-xs/relaxed text-popover-foreground shadow-lg transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-e data-[side=left]:data-ending-style:translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-s data-[side=right]:data-ending-style:translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem] data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm rtl:data-[side=left]:data-ending-style:-translate-x-[-2.5rem] rtl:data-[side=left]:data-starting-style:-translate-x-[-2.5rem] rtl:data-[side=right]:data-ending-style:-translate-x-[2.5rem] rtl:data-[side=right]:data-starting-style:-translate-x-[2.5rem]',\n className,\n )}\n {...props}\n >\n {/* The close button comes FIRST in the DOM (it is absolutely placed, so\n the visual order is unchanged). Base UI focuses the first tabbable\n element on open; after the content, that is a footer button, and a\n long sheet opens scrolled to the bottom with the reader past\n everything above it. Being first also means it would paint UNDER\n any later positioned child in the corner (a Button is `relative`),\n so it carries its own z-index. */}\n {showCloseButton && (\n <SheetPrimitive.Close\n data-slot='sheet-close'\n render={\n <Button\n variant='ghost'\n color='grey'\n size='icon'\n aria-label={closeLabel}\n className='absolute end-4 top-4 z-10'\n />\n }\n >\n <IconClose />\n </SheetPrimitive.Close>\n )}\n {children}\n </SheetPrimitive.Popup>\n </SheetPortal>\n )\n}\n\nfunction SheetHeader({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot='sheet-header'\n className={cn('flex flex-col gap-1.5 p-6', className)}\n {...props}\n />\n )\n}\n\nfunction SheetFooter({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot='sheet-footer'\n className={cn('mt-auto flex flex-col gap-2 p-6', className)}\n {...props}\n />\n )\n}\n\nfunction SheetTitle({ className, ...props }: SheetPrimitive.Title.Props) {\n return (\n <SheetPrimitive.Title\n data-slot='sheet-title'\n className={cn('text-sm font-medium text-foreground', className)}\n {...props}\n />\n )\n}\n\nfunction SheetDescription({ className, ...props }: SheetPrimitive.Description.Props) {\n return (\n <SheetPrimitive.Description\n data-slot='sheet-description'\n className={cn('text-xs/relaxed text-muted-foreground', className)}\n {...props}\n />\n )\n}\n\nexport {\n Sheet,\n SheetClose,\n SheetContent,\n SheetDescription,\n SheetFooter,\n SheetHeader,\n SheetTitle,\n SheetTrigger,\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/components/sheet.tsx"],"names":["SheetPrimitive"],"mappings":";;;;;;;;;AAWA,SAAS,KAAA,CAAM,EAAE,GAAG,KAAA,EAAM,EAA8B;AACtD,EAAA,2BAAQA,MAAA,CAAe,IAAA,EAAf,EAAoB,WAAA,EAAU,OAAA,EAAS,GAAG,KAAA,EAAO,CAAA;AAC3D;AAEA,SAAS,YAAA,CAAa,EAAE,GAAG,KAAA,EAAM,EAAiC;AAChE,EAAA,2BAAQA,MAAA,CAAe,OAAA,EAAf,EAAuB,WAAA,EAAU,eAAA,EAAiB,GAAG,KAAA,EAAO,CAAA;AACtE;AAEA,SAAS,UAAA,CAAW,EAAE,GAAG,KAAA,EAAM,EAA+B;AAC5D,EAAA,2BAAQA,MAAA,CAAe,KAAA,EAAf,EAAqB,WAAA,EAAU,aAAA,EAAe,GAAG,KAAA,EAAO,CAAA;AAClE;AAEA,SAAS,WAAA,CAAY,EAAE,QAAA,EAAU,GAAG,OAAM,EAAgC;AACxE,EAAA,uBACE,GAAA,CAACA,MAAA,CAAe,MAAA,EAAf,EAAsB,WAAA,EAAU,cAAA,EAAgB,GAAG,KAAA,EAElD,QAAA,kBAAA,GAAA,CAAC,mBAAA,EAAA,EAAqB,QAAA,EAAS,CAAA,EACjC,CAAA;AAEJ;AAEA,SAAS,YAAA,CAAa,EAAE,SAAA,EAAW,GAAG,OAAM,EAAkC;AAC5E,EAAA,uBACE,GAAA;AAAA,IAACA,MAAA,CAAe,QAAA;AAAA,IAAf;AAAA,MACC,WAAA,EAAU,eAAA;AAAA,MACV,SAAA,EAAW,EAAA;AAAA,QACT,8GAAA;AAAA,QACA,YAAA;AAAA,QACA;AAAA,OACF;AAAA,MACC,GAAG;AAAA;AAAA,GACN;AAEJ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AAAA,MACV,SAAA,EAAW,EAAA,CAAG,qCAAA,EAAuC,SAAS,CAAA;AAAA,MAC7D,GAAG;AAAA;AAAA,GACN;AAEJ;AAEA,SAAS,gBAAA,CAAiB,EAAE,SAAA,EAAW,GAAG,OAAM,EAAqC;AACnF,EAAA,uBACE,GAAA;AAAA,IAACA,MAAA,CAAe,WAAA;AAAA,IAAf;AAAA,MACC,WAAA,EAAU,mBAAA;AAAA,MACV,SAAA,EAAW,EAAA,CAAG,yCAAA,EAA2C,SAAS,CAAA;AAAA,MACjE,GAAG;AAAA;AAAA,GACN;AAEJ","file":"sheet.js","sourcesContent":["'use client'\n\nimport { Dialog as SheetPrimitive } from '@base-ui/react/dialog'\nimport * as React from 'react'\n\nimport { Button } from '../components/button.js'\nimport { IconClose } from '../icons/close.js'\nimport { ButtonGroupBoundary } from '../lib/button-group-context.js'\nimport { overlayScrim } from '../lib/overlay.js'\nimport { cn } from '../lib/utils.js'\n\nfunction Sheet({ ...props }: SheetPrimitive.Root.Props) {\n return <SheetPrimitive.Root data-slot='sheet' {...props} />\n}\n\nfunction SheetTrigger({ ...props }: SheetPrimitive.Trigger.Props) {\n return <SheetPrimitive.Trigger data-slot='sheet-trigger' {...props} />\n}\n\nfunction SheetClose({ ...props }: SheetPrimitive.Close.Props) {\n return <SheetPrimitive.Close data-slot='sheet-close' {...props} />\n}\n\nfunction SheetPortal({ children, ...props }: SheetPrimitive.Portal.Props) {\n return (\n <SheetPrimitive.Portal data-slot='sheet-portal' {...props}>\n {/* Stops a ButtonGroup's context at the portal — see ButtonGroupBoundary. */}\n <ButtonGroupBoundary>{children}</ButtonGroupBoundary>\n </SheetPrimitive.Portal>\n )\n}\n\nfunction SheetOverlay({ className, ...props }: SheetPrimitive.Backdrop.Props) {\n return (\n <SheetPrimitive.Backdrop\n data-slot='sheet-overlay'\n className={cn(\n 'fixed inset-0 z-50 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0',\n overlayScrim,\n className,\n )}\n {...props}\n />\n )\n}\n\n/**\n * On open, keyboard and mouse users land on the close button, which is first\n * in the DOM, rather than on the first control in the content. With\n * `showCloseButton={false}` the sheet itself takes focus, so a long sheet\n * never opens scrolled to a footer action. Pass `initialFocus` to choose a\n * different target, such as a search field the sheet exists to fill in.\n */\nfunction SheetContent({\n className,\n children,\n side = 'right',\n showCloseButton = true,\n closeLabel = 'Close',\n initialFocus,\n ref,\n ...props\n}: SheetPrimitive.Popup.Props & {\n side?: 'top' | 'right' | 'bottom' | 'left'\n showCloseButton?: boolean\n /**\n * Screen-reader name for the close button. Override to translate it — the\n * button is icon-only, so this string is the only name AT ever hears.\n */\n closeLabel?: string\n}) {\n const popupRef = React.useRef<HTMLDivElement | null>(null)\n // Returns its own cleanup, so React 19 never calls this with null. That\n // cleanup must run the consumer's in turn: React keeps a callback ref's\n // return value as its teardown, and dropping it would skip that teardown.\n const mergedRef = React.useCallback(\n (node: HTMLDivElement | null) => {\n popupRef.current = node\n if (typeof ref === 'function') {\n const cleanup = ref(node)\n return () => {\n popupRef.current = null\n if (typeof cleanup === 'function') cleanup()\n else ref(null)\n }\n }\n if (ref) ref.current = node\n return () => {\n popupRef.current = null\n if (ref) ref.current = null\n }\n },\n [ref],\n )\n\n return (\n <SheetPortal>\n <SheetOverlay />\n <SheetPrimitive.Popup\n ref={mergedRef}\n // Without a close button there is no known-safe first control, and the\n // first tabbable may be a footer action below the fold. The popup\n // itself is the one target Base UI focuses with preventScroll.\n initialFocus={initialFocus ?? (showCloseButton ? undefined : popupRef)}\n data-slot='sheet-content'\n data-side={side}\n className={cn(\n 'fixed z-50 flex max-h-dvh flex-col overflow-y-auto bg-popover bg-clip-padding text-base/relaxed text-popover-foreground transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-e data-[side=left]:data-ending-style:translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-s data-[side=right]:data-ending-style:translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem] data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm rtl:data-[side=left]:data-ending-style:-translate-x-[-2.5rem] rtl:data-[side=left]:data-starting-style:-translate-x-[-2.5rem] rtl:data-[side=right]:data-ending-style:-translate-x-[2.5rem] rtl:data-[side=right]:data-starting-style:-translate-x-[2.5rem]',\n // Keep a long title clear of the absolutely placed close button: it\n // spans 1rem-3.5rem from the end edge, so pe-16 clears it. The header\n // matches at any depth (a form often wraps it), as Dialog's does.\n '[&:has(>[data-slot=sheet-close])_[data-slot=sheet-header]]:pe-16',\n className,\n )}\n {...props}\n >\n {/* The close button comes FIRST in the DOM (it is absolutely placed, so\n the visual order is unchanged). On a keyboard or mouse open, Base UI\n focuses the first tabbable element (on a touch open it focuses the\n popup, and DOM order does not matter); after the content, that is a\n footer button, and a long sheet opens scrolled to the bottom with\n the reader past everything above it. Being first also means it\n would paint UNDER any later positioned child in the corner (a\n Button is `relative`), so it carries z-20: above children up to\n and including the conventional sticky-header z-10. */}\n {showCloseButton && (\n <SheetPrimitive.Close\n data-slot='sheet-close'\n render={\n <Button\n variant='ghost'\n color='grey'\n size='icon'\n aria-label={closeLabel}\n className='absolute end-4 top-4 z-20'\n />\n }\n >\n <IconClose />\n </SheetPrimitive.Close>\n )}\n {children}\n </SheetPrimitive.Popup>\n </SheetPortal>\n )\n}\n\nfunction SheetHeader({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot='sheet-header'\n className={cn('flex flex-col gap-1.5 p-6', className)}\n {...props}\n />\n )\n}\n\nfunction SheetFooter({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot='sheet-footer'\n className={cn('mt-auto flex flex-col gap-2 p-6', className)}\n {...props}\n />\n )\n}\n\nfunction SheetTitle({ className, ...props }: SheetPrimitive.Title.Props) {\n return (\n <SheetPrimitive.Title\n data-slot='sheet-title'\n className={cn('text-lg font-medium text-foreground', className)}\n {...props}\n />\n )\n}\n\nfunction SheetDescription({ className, ...props }: SheetPrimitive.Description.Props) {\n return (\n <SheetPrimitive.Description\n data-slot='sheet-description'\n className={cn('text-base/relaxed text-muted-foreground', className)}\n {...props}\n />\n )\n}\n\nexport {\n Sheet,\n SheetClose,\n SheetContent,\n SheetDescription,\n SheetFooter,\n SheetHeader,\n SheetTitle,\n SheetTrigger,\n}\n"]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
2
|
+
import { VariantProps } from 'class-variance-authority';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The three approved looks (design-shotgun, overlays-20260923), matching the
|
|
7
|
+
* `variant` of Dialog, AlertDialog and DropdownMenu so a loading state can
|
|
8
|
+
* wear the same family as the surface around it:
|
|
9
|
+
*
|
|
10
|
+
* - `default` (Hairline): a filled block, 8px corners.
|
|
11
|
+
* - `band`: a square-cornered band.
|
|
12
|
+
* - `rule`: an outlined block in the strong border colour, no fill.
|
|
13
|
+
*
|
|
14
|
+
* The fills are the ink at 10–12%, not `bg-muted`: in dark mode `--muted` and
|
|
15
|
+
* `--background` resolve to the same token, so a muted block vanishes on the
|
|
16
|
+
* page, while an ink tint reads on the page, a card and a popover alike.
|
|
17
|
+
*/
|
|
18
|
+
declare const skeletonVariants: (props?: ({
|
|
19
|
+
variant?: "default" | "band" | "rule" | null | undefined;
|
|
20
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
21
|
+
/**
|
|
22
|
+
* A placeholder block shown where content is still loading. Size it with
|
|
23
|
+
* utilities (`h-4 w-48`, `size-12 rounded-full`) to echo the shape of what
|
|
24
|
+
* will replace it.
|
|
25
|
+
*
|
|
26
|
+
* It is purely visual, so announce the wait yourself: put `aria-busy="true"`
|
|
27
|
+
* on the region being loaded, and give screen-reader users a text status
|
|
28
|
+
* (a visually hidden "Loading…") rather than relying on these shapes. The
|
|
29
|
+
* pulse only runs under `prefers-reduced-motion: no-preference`.
|
|
30
|
+
*/
|
|
31
|
+
declare function Skeleton({ className, variant, ...props }: React.ComponentProps<'div'> & VariantProps<typeof skeletonVariants>): React.JSX.Element;
|
|
32
|
+
|
|
33
|
+
export { Skeleton, skeletonVariants };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { cva } from 'class-variance-authority';
|
|
3
|
+
import { cn } from '../lib/utils.js';
|
|
4
|
+
|
|
5
|
+
const skeletonVariants = cva("motion-safe:animate-pulse", {
|
|
6
|
+
variants: {
|
|
7
|
+
variant: {
|
|
8
|
+
default: "rounded-md bg-foreground/10",
|
|
9
|
+
band: "rounded-none bg-foreground/12",
|
|
10
|
+
rule: "rounded-sm border border-(--border-strong) bg-transparent"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
defaultVariants: { variant: "default" }
|
|
14
|
+
});
|
|
15
|
+
function Skeleton({
|
|
16
|
+
className,
|
|
17
|
+
variant,
|
|
18
|
+
...props
|
|
19
|
+
}) {
|
|
20
|
+
const look = variant ?? "default";
|
|
21
|
+
return /* @__PURE__ */ jsx(
|
|
22
|
+
"div",
|
|
23
|
+
{
|
|
24
|
+
"data-slot": "skeleton",
|
|
25
|
+
"data-variant": look,
|
|
26
|
+
className: cn(skeletonVariants({ variant: look, className })),
|
|
27
|
+
...props
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export { Skeleton, skeletonVariants };
|
|
33
|
+
//# sourceMappingURL=skeleton.js.map
|
|
34
|
+
//# sourceMappingURL=skeleton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/skeleton.tsx"],"names":[],"mappings":";;;;AAkBA,MAAM,gBAAA,GAAmB,IAAI,2BAAA,EAA6B;AAAA,EACxD,QAAA,EAAU;AAAA,IACR,OAAA,EAAS;AAAA,MACP,OAAA,EAAS,6BAAA;AAAA,MACT,IAAA,EAAM,+BAAA;AAAA,MACN,IAAA,EAAM;AAAA;AACR,GACF;AAAA,EACA,eAAA,EAAiB,EAAE,OAAA,EAAS,SAAA;AAC9B,CAAC;AAYD,SAAS,QAAA,CAAS;AAAA,EAChB,SAAA;AAAA,EACA,OAAA;AAAA,EACA,GAAG;AACL,CAAA,EAAwE;AAGtE,EAAA,MAAM,OAAO,OAAA,IAAW,SAAA;AACxB,EAAA,uBACE,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,WAAA,EAAU,UAAA;AAAA,MACV,cAAA,EAAc,IAAA;AAAA,MACd,SAAA,EAAW,GAAG,gBAAA,CAAiB,EAAE,SAAS,IAAA,EAAM,SAAA,EAAW,CAAC,CAAA;AAAA,MAC3D,GAAG;AAAA;AAAA,GACN;AAEJ","file":"skeleton.js","sourcesContent":["import { cva, type VariantProps } from 'class-variance-authority'\nimport * as React from 'react'\n\nimport { cn } from '../lib/utils.js'\n\n/**\n * The three approved looks (design-shotgun, overlays-20260923), matching the\n * `variant` of Dialog, AlertDialog and DropdownMenu so a loading state can\n * wear the same family as the surface around it:\n *\n * - `default` (Hairline): a filled block, 8px corners.\n * - `band`: a square-cornered band.\n * - `rule`: an outlined block in the strong border colour, no fill.\n *\n * The fills are the ink at 10–12%, not `bg-muted`: in dark mode `--muted` and\n * `--background` resolve to the same token, so a muted block vanishes on the\n * page, while an ink tint reads on the page, a card and a popover alike.\n */\nconst skeletonVariants = cva('motion-safe:animate-pulse', {\n variants: {\n variant: {\n default: 'rounded-md bg-foreground/10',\n band: 'rounded-none bg-foreground/12',\n rule: 'rounded-sm border border-(--border-strong) bg-transparent',\n },\n },\n defaultVariants: { variant: 'default' },\n})\n\n/**\n * A placeholder block shown where content is still loading. Size it with\n * utilities (`h-4 w-48`, `size-12 rounded-full`) to echo the shape of what\n * will replace it.\n *\n * It is purely visual, so announce the wait yourself: put `aria-busy=\"true\"`\n * on the region being loaded, and give screen-reader users a text status\n * (a visually hidden \"Loading…\") rather than relying on these shapes. The\n * pulse only runs under `prefers-reduced-motion: no-preference`.\n */\nfunction Skeleton({\n className,\n variant,\n ...props\n}: React.ComponentProps<'div'> & VariantProps<typeof skeletonVariants>) {\n // Coalesce before cva: it treats `null` as \"no variant\" and skips the\n // default, which would leave the block with no fill at all.\n const look = variant ?? 'default'\n return (\n <div\n data-slot='skeleton'\n data-variant={look}\n className={cn(skeletonVariants({ variant: look, className }))}\n {...props}\n />\n )\n}\n\nexport { Skeleton, skeletonVariants }\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, AccordionVariant } from './components/accordion.js';
|
|
2
|
+
export { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogMedia, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertDialogVariant, alertDialogContentVariants } from './components/alert-dialog.js';
|
|
2
3
|
export { AspectRatio } from './components/aspect-ratio.js';
|
|
3
4
|
export { Avatar, AvatarBadge, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarImage } from './components/avatar.js';
|
|
4
5
|
export { Badge, BadgeButton, BadgeButtonProps, BadgeLink, BadgeLinkProps, BadgeProps, badgeVariants } from './components/badge.js';
|
|
5
6
|
export { Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator } from './components/breadcrumb.js';
|
|
6
7
|
export { ButtonGroup, ButtonGroupProps, ButtonGroupSeparator, ButtonGroupText, ButtonGroupVariant, buttonGroupVariants } from './components/button-group.js';
|
|
7
8
|
export { Button, ButtonLink, ButtonLinkProps, ButtonProps, IconSlot, TouchTarget, buttonColorVariants, buttonVariants } from './components/button.js';
|
|
8
|
-
export { Callout, CalloutProps, CalloutStatus, calloutVariants } from './components/callout.js';
|
|
9
|
+
export { Alert, AlertProps, AlertStatus, Callout, CalloutProps, CalloutStatus, alertVariants, calloutVariants } from './components/callout.js';
|
|
9
10
|
export { Card, CardAction, CardActionProps, CardContent, CardContentProps, CardDescription, CardDescriptionProps, CardFooter, CardFooterProps, CardHeader, CardHeaderProps, CardProps, CardTitle, CardTitleProps } from './components/card.js';
|
|
10
11
|
export { Carousel, CarouselApi, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, useCarousel } from './components/carousel.js';
|
|
11
12
|
export { Checkbox } from './components/checkbox.js';
|
|
@@ -13,8 +14,11 @@ export { Collapsible, CollapsibleContent, CollapsibleTrigger } from './component
|
|
|
13
14
|
export { Combobox, ComboboxChip, ComboboxChips, ComboboxChipsInput, ComboboxCollection, ComboboxContent, ComboboxEmpty, ComboboxGroup, ComboboxInput, ComboboxItem, ComboboxLabel, ComboboxList, ComboboxSeparator, ComboboxTrigger, ComboboxValue, useComboboxAnchor } from './components/combobox.js';
|
|
14
15
|
export { Container, ContainerProps, containerVariants } from './components/container.js';
|
|
15
16
|
export { DescriptionDetails, DescriptionDetailsProps, DescriptionList, DescriptionListProps, DescriptionTerm, DescriptionTermProps, descriptionListVariants } from './components/description-list.js';
|
|
17
|
+
export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DialogVariant, dialogContentVariants } from './components/dialog.js';
|
|
16
18
|
export { DirectionProvider, useDirection } from '@base-ui/react/direction-provider';
|
|
17
19
|
export { Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger } from './components/drawer.js';
|
|
20
|
+
export { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuLinkItem, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, DropdownMenuVariant, dropdownMenuContentVariants } from './components/dropdown-menu.js';
|
|
21
|
+
export { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle, emptyMediaVariants } from './components/empty.js';
|
|
18
22
|
export { ExpandableSearch, ExpandableSearchButtonProps, ExpandableSearchField, ExpandableSearchFieldProps, ExpandableSearchProps, ExpandableSearchVariant, expandableSearchVariants } from './components/expandable-search.js';
|
|
19
23
|
export { Field, FieldContent, FieldContentProps, FieldDescription, FieldDescriptionProps, FieldError, FieldErrorProps, FieldGroup, FieldGroupProps, FieldLabel, FieldLabelProps, FieldLegend, FieldLegendProps, FieldProps, FieldSeparator, FieldSeparatorProps, FieldSet, FieldSetProps, FieldTitle, FieldTitleProps } from './components/field.js';
|
|
20
24
|
export { Footer, FooterAcknowledgement, FooterAcknowledgementProps, FooterColor, FooterLegalLinkItem, FooterLegalLinks, FooterLegalLinksProps, FooterLinkItem, FooterNav, FooterNavColumn, FooterNavColumnProps, FooterNavLink, FooterNavLinkProps, FooterNavProps, FooterProps, FooterSmallPrint, FooterSmallPrintProps, FooterSocialLink, FooterSocialLinkItem, FooterSocialLinkProps, footerColors, footerContainerVariants, footerLogoType, footerVariants } from './components/footer.js';
|
|
@@ -46,6 +50,7 @@ export { Separator, SeparatorProps } from './components/separator.js';
|
|
|
46
50
|
export { Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger } from './components/sheet.js';
|
|
47
51
|
export { SideNav, SideNavItem, SideNavProps, SideNavRowVariantProps, sideNavRowVariants } from './components/side-nav.js';
|
|
48
52
|
export { SiteSearch, SiteSearchGroup, SiteSearchItem, SiteSearchProps } from './components/site-search.js';
|
|
53
|
+
export { Skeleton, skeletonVariants } from './components/skeleton.js';
|
|
49
54
|
export { SkipLink, SkipLinkProps, SkipLinks, SkipLinksProps, skipLinkVariants } from './components/skip-link.js';
|
|
50
55
|
export { Slider } from './components/slider.js';
|
|
51
56
|
export { Toaster } from './components/sonner.js';
|
|
@@ -65,8 +70,9 @@ export { cn } from './lib/utils.js';
|
|
|
65
70
|
export { ButtonGroupBoundary } from './lib/button-group-context.js';
|
|
66
71
|
import 'react';
|
|
67
72
|
import '@base-ui/react/accordion';
|
|
68
|
-
import '@base-ui/react/avatar';
|
|
69
73
|
import 'class-variance-authority/types';
|
|
74
|
+
import '@base-ui/react/alert-dialog';
|
|
75
|
+
import '@base-ui/react/avatar';
|
|
70
76
|
import '@base-ui/react/button';
|
|
71
77
|
import 'class-variance-authority';
|
|
72
78
|
import '@base-ui/react/use-render';
|
|
@@ -74,7 +80,9 @@ import 'embla-carousel-react';
|
|
|
74
80
|
import '@base-ui/react/checkbox';
|
|
75
81
|
import '@base-ui/react/collapsible';
|
|
76
82
|
import '@base-ui/react';
|
|
83
|
+
import '@base-ui/react/dialog';
|
|
77
84
|
import 'vaul';
|
|
85
|
+
import '@base-ui/react/menu';
|
|
78
86
|
import '@base-ui/react/field';
|
|
79
87
|
import '@base-ui/react/preview-card';
|
|
80
88
|
import 'input-otp';
|
|
@@ -86,7 +94,6 @@ import 'react-resizable-panels';
|
|
|
86
94
|
import '@base-ui/react/scroll-area';
|
|
87
95
|
import '@base-ui/react/select';
|
|
88
96
|
import '@base-ui/react/separator';
|
|
89
|
-
import '@base-ui/react/dialog';
|
|
90
97
|
import '@base-ui/react/slider';
|
|
91
98
|
import 'sonner';
|
|
92
99
|
import '@base-ui/react/switch';
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * from './components/accordion.js';
|
|
2
|
+
export * from './components/alert-dialog.js';
|
|
2
3
|
export * from './components/aspect-ratio.js';
|
|
3
4
|
export * from './components/avatar.js';
|
|
4
5
|
export * from './components/badge.js';
|
|
@@ -13,8 +14,11 @@ export * from './components/collapsible.js';
|
|
|
13
14
|
export * from './components/combobox.js';
|
|
14
15
|
export * from './components/container.js';
|
|
15
16
|
export * from './components/description-list.js';
|
|
17
|
+
export * from './components/dialog.js';
|
|
16
18
|
export * from './components/direction.js';
|
|
17
19
|
export * from './components/drawer.js';
|
|
20
|
+
export * from './components/dropdown-menu.js';
|
|
21
|
+
export * from './components/empty.js';
|
|
18
22
|
export * from './components/expandable-search.js';
|
|
19
23
|
export * from './components/field.js';
|
|
20
24
|
export * from './components/footer.js';
|
|
@@ -46,6 +50,7 @@ export * from './components/separator.js';
|
|
|
46
50
|
export * from './components/sheet.js';
|
|
47
51
|
export * from './components/side-nav.js';
|
|
48
52
|
export * from './components/site-search.js';
|
|
53
|
+
export * from './components/skeleton.js';
|
|
49
54
|
export * from './components/skip-link.js';
|
|
50
55
|
export * from './components/slider.js';
|
|
51
56
|
export * from './components/sonner.js';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared overlay treatment (design-shotgun, overlays-20260923), so every
|
|
3
|
+
* overlay in the package dims the page and draws its rules the same way.
|
|
4
|
+
* Class strings, not components: each consumer keeps its own element and
|
|
5
|
+
* merges these in with `cn()`. Tailwind scans this file like any source file.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* The page scrim behind a modal overlay — Dialog, AlertDialog, Sheet, Drawer.
|
|
9
|
+
* Flat `grey-950` at 70%: no blur (glassmorphism is off-brand, DESIGN.md) and
|
|
10
|
+
* no shadow on the popup above it — depth is drawn by the popup's ring.
|
|
11
|
+
*/
|
|
12
|
+
declare const overlayScrim = "bg-grey-950/70";
|
|
13
|
+
/**
|
|
14
|
+
* Sets `--overlay-ink`, the interactive ink the `rule` look paints its cap and
|
|
15
|
+
* rail with: primary-800 light / primary-200 dark (DESIGN.md, The Role-Flip
|
|
16
|
+
* Rule). One declaration, so the dialog cap, the alert cap and the menu rail
|
|
17
|
+
* cannot drift apart.
|
|
18
|
+
*/
|
|
19
|
+
declare const overlayInk = "[--overlay-ink:var(--primary-800)] dark:[--overlay-ink:var(--primary-200)]";
|
|
20
|
+
/**
|
|
21
|
+
* Sets `--overlay-danger` and `--overlay-danger-text`, the fill and text of a
|
|
22
|
+
* danger band — AlertDialog's destructive band, the band-look destructive menu
|
|
23
|
+
* row. Button's own danger pairing, danger-600 with white: 6.6:1 in both modes,
|
|
24
|
+
* where `--destructive` with `--text-inverse` falls to 4.06:1 in dark. One
|
|
25
|
+
* declaration, so the two cannot drift apart (AGENTS.md §3).
|
|
26
|
+
*/
|
|
27
|
+
declare const overlayDanger = "[--overlay-danger:var(--danger-600)] [--overlay-danger-text:var(--white)]";
|
|
28
|
+
|
|
29
|
+
export { overlayDanger, overlayInk, overlayScrim };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
const overlayScrim = "bg-grey-950/70";
|
|
2
|
+
const overlayInk = "[--overlay-ink:var(--primary-800)] dark:[--overlay-ink:var(--primary-200)]";
|
|
3
|
+
const overlayDanger = "[--overlay-danger:var(--danger-600)] [--overlay-danger-text:var(--white)]";
|
|
4
|
+
|
|
5
|
+
export { overlayDanger, overlayInk, overlayScrim };
|
|
6
|
+
//# sourceMappingURL=overlay.js.map
|
|
7
|
+
//# sourceMappingURL=overlay.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/overlay.ts"],"names":[],"mappings":"AAYA,MAAM,YAAA,GAAe;AAQrB,MAAM,UAAA,GAAa;AASnB,MAAM,aAAA,GAAgB","file":"overlay.js","sourcesContent":["/**\n * Shared overlay treatment (design-shotgun, overlays-20260923), so every\n * overlay in the package dims the page and draws its rules the same way.\n * Class strings, not components: each consumer keeps its own element and\n * merges these in with `cn()`. Tailwind scans this file like any source file.\n */\n\n/**\n * The page scrim behind a modal overlay — Dialog, AlertDialog, Sheet, Drawer.\n * Flat `grey-950` at 70%: no blur (glassmorphism is off-brand, DESIGN.md) and\n * no shadow on the popup above it — depth is drawn by the popup's ring.\n */\nconst overlayScrim = 'bg-grey-950/70'\n\n/**\n * Sets `--overlay-ink`, the interactive ink the `rule` look paints its cap and\n * rail with: primary-800 light / primary-200 dark (DESIGN.md, The Role-Flip\n * Rule). One declaration, so the dialog cap, the alert cap and the menu rail\n * cannot drift apart.\n */\nconst overlayInk = '[--overlay-ink:var(--primary-800)] dark:[--overlay-ink:var(--primary-200)]'\n\n/**\n * Sets `--overlay-danger` and `--overlay-danger-text`, the fill and text of a\n * danger band — AlertDialog's destructive band, the band-look destructive menu\n * row. Button's own danger pairing, danger-600 with white: 6.6:1 in both modes,\n * where `--destructive` with `--text-inverse` falls to 4.06:1 in dark. One\n * declaration, so the two cannot drift apart (AGENTS.md §3).\n */\nconst overlayDanger = '[--overlay-danger:var(--danger-600)] [--overlay-danger-text:var(--white)]'\n\nexport { overlayDanger, overlayInk, overlayScrim }\n"]}
|