@adea-ai/ui 0.152.2 → 0.152.4
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/composites/about-dialog/about-dialog.js.map +1 -1
- package/dist/components/composites/accent-picker/accent-picker.js.map +1 -1
- package/dist/components/composites/accent-picker/custom-color-popover.js.map +1 -1
- package/dist/components/composites/account-menu/account-menu.js.map +1 -1
- package/dist/components/composites/action-button/action-button.js.map +1 -1
- package/dist/components/composites/appearance-editor/accent-swatch-groups.js.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-choices.js.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-editor.js.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-rows.js.map +1 -1
- package/dist/components/composites/appearance-editor/font-settings-group.js.map +1 -1
- package/dist/components/composites/appearance-editor/theme-preview.js.map +1 -1
- package/dist/components/composites/catalog-browser/catalog-browser-group.js.map +1 -1
- package/dist/components/composites/catalog-browser/catalog-browser.js.map +1 -1
- package/dist/components/composites/catalog-browser/catalog-detail.js.map +1 -1
- package/dist/components/composites/chain-of-thought/chain-of-thought.js.map +1 -1
- package/dist/components/composites/chat/chat.js.map +1 -1
- package/dist/components/composites/checkpoint/checkpoint.js.map +1 -1
- package/dist/components/composites/confirmation/confirmation.js.map +1 -1
- package/dist/components/composites/context/context.js.map +1 -1
- package/dist/components/composites/file-tree/file-tree.js.map +1 -1
- package/dist/components/composites/help-center/help-center.js.map +1 -1
- package/dist/components/composites/icon-picker/icon-picker.js.map +1 -1
- package/dist/components/composites/inline-citation/inline-citation.js.map +1 -1
- package/dist/components/composites/list-row/list-row-control.js.map +1 -1
- package/dist/components/composites/list-row/list-row.js.map +1 -1
- package/dist/components/composites/message-scroller/message-scroller.js.map +1 -1
- package/dist/components/composites/model-selector/model-selector.js +3 -0
- package/dist/components/composites/model-selector/model-selector.js.map +1 -1
- package/dist/components/composites/plan/plan.js.map +1 -1
- package/dist/components/composites/queue/queue.js.map +1 -1
- package/dist/components/composites/reasoning/reasoning.js.map +1 -1
- package/dist/components/composites/scene-controls/scene-controls.js.map +1 -1
- package/dist/components/composites/settings/settings-layout.js.map +1 -1
- package/dist/components/composites/settings/settings-navigation.js.map +1 -1
- package/dist/components/composites/settings/settings.js.map +1 -1
- package/dist/components/composites/sources/sources.js.map +1 -1
- package/dist/components/composites/stack-trace/stack-trace.js.map +1 -1
- package/dist/components/composites/stat/stat.js.map +1 -1
- package/dist/components/composites/subagent/subagent.js.map +1 -1
- package/dist/components/composites/suggestion/suggestion.js.map +1 -1
- package/dist/components/composites/task/task.js.map +1 -1
- package/dist/components/composites/terminal/terminal.js.map +1 -1
- package/dist/components/composites/test-results/test-results.js.map +1 -1
- package/dist/components/composites/tool/tool.js.map +1 -1
- package/dist/components/composites/tree/tree.js.map +1 -1
- package/dist/components/composites/update-dialog/channel-control.js.map +1 -1
- package/dist/components/composites/update-dialog/update-dialog.js.map +1 -1
- package/dist/components/composites/workspace-mark/workspace-mark.js.map +1 -1
- package/dist/components/composites/workspace-switcher/workspace-reorder-dialog.js.map +1 -1
- package/dist/components/composites/workspace-switcher/workspace-switcher.js.map +1 -1
- package/dist/components/conversation/atomic/chat-composer.js.map +1 -1
- package/dist/components/conversation/busy-send-button.js.map +1 -1
- package/dist/components/conversation/chat-composer.js.map +1 -1
- package/dist/components/conversation/composer-menu.js.map +1 -1
- package/dist/components/conversation/conversation-avatar.js.map +1 -1
- package/dist/components/conversation/conversation-pane.js.map +1 -1
- package/dist/components/conversation/conversation-surface.js.map +1 -1
- package/dist/components/conversation/internal/chat-composer-shell.js.map +1 -1
- package/dist/components/conversation/message-composer.js.map +1 -1
- package/dist/components/conversation/message-row.js.map +1 -1
- package/dist/components/conversation/paste-token-editor.js.map +1 -1
- package/dist/components/conversation/thread-panel.js.map +1 -1
- package/dist/components/conversation/transcript-composition.js.map +1 -1
- package/dist/components/layout/app-shell/app-shell.js.map +1 -1
- package/dist/components/layout/app-shell/skip-link.js.map +1 -1
- package/dist/components/layout/contextual-sidebar/contextual-sidebar.js.map +1 -1
- package/dist/components/layout/contextual-sidebar/mobile-contextual-sidebar.js.map +1 -1
- package/dist/components/layout/floating-preview/floating-preview.js.map +1 -1
- package/dist/components/layout/orbit-layout/orbit-layout.js.map +1 -1
- package/dist/components/layout/page/page.js.map +1 -1
- package/dist/components/layout/panel/panel.js.map +1 -1
- package/dist/components/layout/pixel-pane/pixel-pane.js.map +1 -1
- package/dist/components/layout/pixel-resize-handle/pixel-resize-handle.js.map +1 -1
- package/dist/components/layout/shell-rail/shell-rail.js.map +1 -1
- package/dist/components/layout/shell-top-bar/shell-top-bar.js.map +1 -1
- package/dist/components/layout/side-rail/side-rail.js.map +1 -1
- package/dist/components/layout/sidebar-nav/sidebar-nav-resize-handle.js.map +1 -1
- package/dist/components/layout/sidebar-nav/sidebar-nav.js.map +1 -1
- package/dist/components/layout/split-layout/resize-controller-core-retry.js.map +1 -1
- package/dist/components/layout/split-layout/resize-controller-core.js.map +1 -1
- package/dist/components/layout/split-layout/split-layout.js.map +1 -1
- package/dist/components/layout/status-bar/status-bar.js.map +1 -1
- package/dist/components/layout/top-bar/top-bar.js.map +1 -1
- package/dist/components/layout/virtual-window/virtual-window.js.map +1 -1
- package/dist/components/motion/presence.js.map +1 -1
- package/dist/components/theme/appearance-panel.js.map +1 -1
- package/dist/components/theme/theme-mode-toggle.js.map +1 -1
- package/dist/components/theme/theme-picker.js.map +1 -1
- package/dist/components/theme/theme-provider.js.map +1 -1
- package/dist/components/theme/theme-toggle.js.map +1 -1
- package/dist/components/ui/accordion/accordion.js.map +1 -1
- package/dist/components/ui/alert/alert.js.map +1 -1
- package/dist/components/ui/alert-dialog/alert-dialog.js.map +1 -1
- package/dist/components/ui/annotation-surface/annotation-surface.js.map +1 -1
- package/dist/components/ui/aspect-ratio/aspect-ratio.js.map +1 -1
- package/dist/components/ui/attachment/attachment.js.map +1 -1
- package/dist/components/ui/avatar/avatar.js.map +1 -1
- package/dist/components/ui/badge/badge.js.map +1 -1
- package/dist/components/ui/board/board.js.map +1 -1
- package/dist/components/ui/breadcrumb/breadcrumb.js.map +1 -1
- package/dist/components/ui/bubble/bubble.js.map +1 -1
- package/dist/components/ui/button/button.js.map +1 -1
- package/dist/components/ui/button-group/button-group.js.map +1 -1
- package/dist/components/ui/calendar/calendar.js.map +1 -1
- package/dist/components/ui/callout/callout.js.map +1 -1
- package/dist/components/ui/card/card.js.map +1 -1
- package/dist/components/ui/carousel/carousel.js.map +1 -1
- package/dist/components/ui/chart/chart.js.map +1 -1
- package/dist/components/ui/checkbox/checkbox.js.map +1 -1
- package/dist/components/ui/code-block/code-block.js.map +1 -1
- package/dist/components/ui/collapsible/collapsible.js.map +1 -1
- package/dist/components/ui/combobox/combobox.js.map +1 -1
- package/dist/components/ui/combobox/value-combobox.js.map +1 -1
- package/dist/components/ui/command/command.js.map +1 -1
- package/dist/components/ui/context-menu/context-menu.js.map +1 -1
- package/dist/components/ui/detail-panel/detail-panel.js.map +1 -1
- package/dist/components/ui/dialog/dialog-layer.js.map +1 -1
- package/dist/components/ui/dialog/dialog.js.map +1 -1
- package/dist/components/ui/diff-block/diff-block.js.map +1 -1
- package/dist/components/ui/drawer/drawer.js.map +1 -1
- package/dist/components/ui/dropdown-menu/dropdown-menu.js.map +1 -1
- package/dist/components/ui/dropdown-menu/menu-parts.js.map +1 -1
- package/dist/components/ui/empty/empty-state.js.map +1 -1
- package/dist/components/ui/empty/empty.js.map +1 -1
- package/dist/components/ui/entity-icon/entity-icon.js.map +1 -1
- package/dist/components/ui/field/field.js.map +1 -1
- package/dist/components/ui/field/number-field.js.map +1 -1
- package/dist/components/ui/hover-card/hover-card.js.map +1 -1
- package/dist/components/ui/input/input-control.js.map +1 -1
- package/dist/components/ui/input/input.js.map +1 -1
- package/dist/components/ui/input-group/input-group.js.map +1 -1
- package/dist/components/ui/input-group/secret-input-group.js.map +1 -1
- package/dist/components/ui/input-otp/input-otp.js.map +1 -1
- package/dist/components/ui/item/item.js.map +1 -1
- package/dist/components/ui/kbd/kbd.js.map +1 -1
- package/dist/components/ui/label/label.js.map +1 -1
- package/dist/components/ui/marker/marker.js.map +1 -1
- package/dist/components/ui/menubar/menubar.js.map +1 -1
- package/dist/components/ui/message/message.js.map +1 -1
- package/dist/components/ui/modal-dialog/modal-dialog.js.map +1 -1
- package/dist/components/ui/native-select/native-select.js.map +1 -1
- package/dist/components/ui/navigation-menu/navigation-menu.js.map +1 -1
- package/dist/components/ui/pagination/pagination.js.map +1 -1
- package/dist/components/ui/popover/popover.js.map +1 -1
- package/dist/components/ui/progress/progress.js.map +1 -1
- package/dist/components/ui/questionnaire/questionnaire.js.map +1 -1
- package/dist/components/ui/radio-group/radio-group.js.map +1 -1
- package/dist/components/ui/resizable/resizable.js.map +1 -1
- package/dist/components/ui/scroll-area/scroll-area.js.map +1 -1
- package/dist/components/ui/select/select.js.map +1 -1
- package/dist/components/ui/separator/separator.js.map +1 -1
- package/dist/components/ui/sheet/sheet.js.map +1 -1
- package/dist/components/ui/skeleton/skeleton.js.map +1 -1
- package/dist/components/ui/slider/slider.js.map +1 -1
- package/dist/components/ui/spinner/spinner.js.map +1 -1
- package/dist/components/ui/status-chip/status-chip.js.map +1 -1
- package/dist/components/ui/switch/switch.js.map +1 -1
- package/dist/components/ui/table/table.js.map +1 -1
- package/dist/components/ui/tabs/tabs.js.map +1 -1
- package/dist/components/ui/text-link/text-link.js.map +1 -1
- package/dist/components/ui/textarea/textarea.js.map +1 -1
- package/dist/components/ui/toast/toast.js.map +1 -1
- package/dist/components/ui/toggle/toggle.js.map +1 -1
- package/dist/components/ui/toggle-group/toggle-group.js.map +1 -1
- package/dist/components/ui/tooltip/tooltip.js.map +1 -1
- package/dist/components/ui/trace/trace.js.map +1 -1
- package/dist/components/ui/typography/typography.js.map +1 -1
- package/dist/r/about-dialog.json +1 -1
- package/dist/r/accordion.json +1 -1
- package/dist/r/account-menu.json +1 -1
- package/dist/r/alert.json +1 -1
- package/dist/r/appearance-editor.json +1 -1
- package/dist/r/attachment.json +1 -1
- package/dist/r/breadcrumb.json +1 -1
- package/dist/r/calendar.json +1 -1
- package/dist/r/carousel.json +1 -1
- package/dist/r/catalog-browser.json +1 -1
- package/dist/r/chain-of-thought.json +1 -1
- package/dist/r/chat.json +1 -1
- package/dist/r/checkbox.json +1 -1
- package/dist/r/checkpoint.json +1 -1
- package/dist/r/code-block.json +1 -1
- package/dist/r/combobox.json +1 -1
- package/dist/r/command.json +1 -1
- package/dist/r/confirmation.json +1 -1
- package/dist/r/context.json +1 -1
- package/dist/r/conversation.json +1 -1
- package/dist/r/detail-panel.json +1 -1
- package/dist/r/dialog.json +1 -1
- package/dist/r/dropdown-menu.json +1 -1
- package/dist/r/empty.json +1 -1
- package/dist/r/file-tree.json +1 -1
- package/dist/r/floating-preview.json +1 -1
- package/dist/r/help-center.json +1 -1
- package/dist/r/icon-picker.json +1 -1
- package/dist/r/inline-citation.json +1 -1
- package/dist/r/lib.json +1 -1
- package/dist/r/message-scroller.json +1 -1
- package/dist/r/model-selector.json +1 -1
- package/dist/r/native-select.json +1 -1
- package/dist/r/navigation-menu.json +1 -1
- package/dist/r/pagination.json +1 -1
- package/dist/r/pixel-resize-handle.json +1 -1
- package/dist/r/plan.json +1 -1
- package/dist/r/questionnaire.json +1 -1
- package/dist/r/queue.json +1 -1
- package/dist/r/radio-group.json +1 -1
- package/dist/r/reasoning.json +1 -1
- package/dist/r/registry.json +65 -65
- package/dist/r/resizable.json +1 -1
- package/dist/r/scene-controls.json +1 -1
- package/dist/r/select.json +1 -1
- package/dist/r/settings.json +1 -1
- package/dist/r/sheet.json +1 -1
- package/dist/r/shell-rail.json +1 -1
- package/dist/r/sidebar-nav.json +1 -1
- package/dist/r/sources.json +1 -1
- package/dist/r/spinner.json +1 -1
- package/dist/r/split-layout.json +1 -1
- package/dist/r/src/components/composites/model-selector/model-selector.tsx +4 -1
- package/dist/r/stack-trace.json +1 -1
- package/dist/r/stat.json +1 -1
- package/dist/r/subagent.json +1 -1
- package/dist/r/task.json +1 -1
- package/dist/r/terminal.json +1 -1
- package/dist/r/test-results.json +1 -1
- package/dist/r/theming.json +1 -1
- package/dist/r/toast.json +1 -1
- package/dist/r/tool.json +1 -1
- package/dist/r/top-bar.json +1 -1
- package/dist/r/trace.json +1 -1
- package/dist/r/tree.json +1 -1
- package/dist/r/update-dialog.json +1 -1
- package/dist/r/workspace-switcher.json +1 -1
- package/package.json +11 -11
- package/registry.json +65 -65
- package/src/components/composites/model-selector/model-selector.tsx +4 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"board.js","names":["ComponentProps","createEffect","createMemo","createSignal","For","Index","onCleanup","Show","splitProps","JSX","cva","VariantProps","cn","badgeVariants","headingVariants","textVariants","BoardTone","BoardColumn","Readonly","id","label","count","meta","Element","tone","collapsible","disabled","BoardMove","itemId","from","to","BoardProps","columns","items","T","item","itemColumn","canDrop","onMove","move","children","state","dragging","emptyColumn","column","collapseEmpty","class","cardDragState","idle","const","toneDot","Record","neutral","BoardColumnDot","props","_$createComponent","when","_el$","_tmpl$","_$effect","_$className","BoardColumnCount","undefined","_el$2","_tmpl$2","_$insert","variant","size","Board","local","setDragging","overColumn","setOverColumn","announcement","setAnnouncement","cardElements","Map","HTMLElement","pendingFocus","setPendingFocus","columnId","source","cancelOnPointer","pending","document","ownerDocument","cancelOnFocus","event","FocusEvent","contains","target","Node","addEventListener","removeEventListener","moved","find","get","isConnected","focus","prepareFocus","always","card","activeElement","byColumn","grouped","set","push","accepts","Boolean","drop","accepted","moveByKeyboard","direction","index","findIndex","ordered","slice","toReversed","_el$3","_tmpl$3","_el$4","firstChild","each","collapsed","length","over","_el$5","_tmpl$8","preventDefault","currentTarget","relatedTarget","current","fallback","_el$1","_tmpl$9","_el$10","leading","_el$6","_tmpl$5","_el$7","_el$8","_tmpl$4","_el$9","_tmpl$7","isDragging","_el$11","_tmpl$0","$$keydown","ctrlKey","metaKey","key","dataTransfer","setData","effectAllowed","_$use","element","delete","_$setAttribute","_el$0","_tmpl$6","_p$","_v$3","_v$4","_v$5","e","t","a","_v$","_v$2","boardCardTitleVariants","variants","sm","md","defaultVariants","BoardCardTitleProps","BoardCardTitle","_el$12","_tmpl$1","BoardCardBody","_el$13","_tmpl$10","BoardCardTrigger","rest","_el$14","_tmpl$11","_$spread","_$mergeProps","type","_$delegateEvents","_$createComponent","_$className","_$setAttribute","_$mergeProps","_$delegateEvents"],"sources":["../../../../src/components/ui/board/board.tsx"],"sourcesContent":["import {\n type ComponentProps,\n createEffect,\n createMemo,\n createSignal,\n For,\n Index,\n onCleanup,\n Show,\n splitProps,\n type JSX,\n} from 'solid-js'\nimport { cva, type VariantProps } from '#lib/variants'\nimport { cn } from '#lib/utils'\nimport { badgeVariants } from '../badge'\nimport { headingVariants, textVariants } from '../typography'\n\n/**\n * Board.\n *\n * Columns of cards, with drag between them — the shape a task tracker, a CRM\n * pipeline, a support queue and a release plan all share. It is generic in the\n * one place that matters: the *column ids are the caller's*, and so is the rule\n * that decides which moves are legal. The component knows nothing about tasks.\n *\n * The transitions are a predicate rather than a derived table because the legal\n * moves in a real product are not \"any column to any column\". A task that is\n * `completed` may be archived but not re-queued; a lead may become a customer but\n * not a stranger again. A board that let you drop anything anywhere would encode\n * a state machine in the UI that the server rejects — so `canDrop` is required,\n * and a column that cannot receive the dragged card renders as unavailable rather\n * than silently accepting a drop that will fail.\n *\n * Three input methods, because a drag-only board is unusable by keyboard:\n * dragging with the pointer, `Ctrl`/`Cmd` + arrow keys to move a focused card\n * between columns, and whatever the caller wires into `actions`. The card is\n * focusable and its move is announced through a live region, so the board is\n * operable without a mouse.\n *\n * The card is rendered by the caller through `children`, given the item and a set\n * of drag props. That is deliberate: a card's contents are domain — a title, a\n * priority tag, an assignee — and a board that rendered them itself could only\n * ever serve one product.\n *\n * `collapseEmpty` folds a column with no cards to a strip one line of text wide,\n * its label turned on its side. A board of seven lanes where three are empty\n * otherwise spends half its width on nothing, and the lanes with work in them\n * are the ones that need the room. A folded lane is still a full-height drop\n * target and still accepts a keyboard move, so nothing about operating the\n * board changes; it does not unfold under a drag, because a lane that grows\n * under the pointer moves every lane after it and the drop lands somewhere else.\n *\n * Give the board a height (`class=\"h-full\"`) and each lane scrolls on its own;\n * leave it unconstrained and lanes grow with their cards and the page scrolls.\n */\n\n/**\n * A lane's identifying colour, drawn as a dot before its label. The chart hues,\n * in the order the token set gives them, because a lane colour tells lanes apart\n * like a series does; it carries no status. `neutral` is for a lane that should\n * not draw the eye — a backlog, an archive.\n */\nexport type BoardTone =\n | 'neutral'\n | 'chart-1'\n | 'chart-2'\n | 'chart-3'\n | 'chart-4'\n | 'chart-5'\n | 'chart-6'\n\nexport type BoardColumn = Readonly<{\n id: string\n label: string\n /** The number of cards, shown as an accent count beside the label. */\n count?: number\n /** A limit or any other note, shown after the count. */\n meta?: JSX.Element\n /** The lane's dot colour. Omitted, the header has no dot. */\n tone?: BoardTone\n /**\n * `false` keeps this lane open when it is empty under `collapseEmpty` — the\n * inbox lane new cards arrive in, which should always show where they land.\n */\n collapsible?: boolean\n /** Dim the column and refuse drops — a lane that is closed or read-only. */\n disabled?: boolean\n}>\n\nexport type BoardMove = Readonly<{\n itemId: string\n from: string\n to: string\n}>\n\nexport type BoardProps<T> = {\n columns: readonly BoardColumn[]\n items: readonly T[]\n itemId: (item: T) => string\n itemColumn: (item: T) => string\n /** Whether `item` may move from `from` to `to`. Required: see the note above. */\n canDrop: (item: T, from: string, to: string) => boolean\n onMove: (move: BoardMove) => void\n /** The card body. `dragging` is true while this card is the one being dragged. */\n children: (item: T, state: { dragging: boolean }) => JSX.Element\n emptyColumn?: (column: BoardColumn) => JSX.Element\n /** The board's accessible name. Defaults to \"Board\". */\n label?: string\n /** Fold columns with no cards to a narrow strip with a sideways label. */\n collapseEmpty?: boolean\n class?: string\n}\n\nconst cardDragState = {\n idle: '',\n dragging: 'opacity-40',\n} as const\n\nconst toneDot: Record<BoardTone, string> = {\n neutral: 'bg-muted-foreground',\n 'chart-1': 'bg-chart-1',\n 'chart-2': 'bg-chart-2',\n 'chart-3': 'bg-chart-3',\n 'chart-4': 'bg-chart-4',\n 'chart-5': 'bg-chart-5',\n 'chart-6': 'bg-chart-6',\n}\n\nfunction BoardColumnDot(props: { tone?: BoardTone }) {\n return (\n <Show when={props.tone}>\n {(tone) => (\n <span aria-hidden=\"true\" class={cn('size-2 shrink-0 rounded-full', toneDot[tone()])} />\n )}\n </Show>\n )\n}\n\nfunction BoardColumnCount(props: { count?: number }) {\n return (\n <Show when={props.count !== undefined}>\n {/* The Badge's classes, not the component: Board stays free of Kobalte. */}\n <span\n class={cn(badgeVariants({ variant: 'subtle', size: 'sm' }), 'tabular-nums')}\n data-slot=\"board-column-count\"\n >\n {props.count}\n </span>\n </Show>\n )\n}\n\nexport function Board<T>(props: BoardProps<T>) {\n const [local] = splitProps(props, [\n 'columns',\n 'items',\n 'itemId',\n 'itemColumn',\n 'canDrop',\n 'onMove',\n 'children',\n 'emptyColumn',\n 'label',\n 'collapseEmpty',\n 'class',\n ])\n\n // The dragged item, not its id: `canDrop` takes the item itself, and the\n // pointer may leave the card before it is dropped.\n const [dragging, setDragging] = createSignal<T | null>(null)\n const [overColumn, setOverColumn] = createSignal<string | null>(null)\n const [announcement, setAnnouncement] = createSignal('')\n const cardElements = new Map<string, HTMLElement>()\n const [pendingFocus, setPendingFocus] = createSignal<{\n itemId: string\n columnId: string\n source: HTMLElement\n } | null>(null)\n const cancelOnPointer = () => setPendingFocus(null)\n\n // A controlled move can settle after a server response. Restore only the\n // focus that belonged to the moved card; another focus action cancels it.\n createEffect(() => {\n const pending = pendingFocus()\n if (!pending) return\n const document = pending.source.ownerDocument\n const cancelOnFocus = (event: FocusEvent) => {\n if (!pending.source.contains(event.target as Node)) setPendingFocus(null)\n }\n document.addEventListener('focusin', cancelOnFocus)\n document.addEventListener('pointerdown', cancelOnPointer)\n onCleanup(() => {\n document.removeEventListener('focusin', cancelOnFocus)\n document.removeEventListener('pointerdown', cancelOnPointer)\n })\n })\n\n createEffect(() => {\n const pending = pendingFocus()\n if (!pending) return\n const moved = local.items.find((item) => local.itemId(item) === pending.itemId)\n if (!moved || local.itemColumn(moved) !== pending.columnId) return\n const target = cardElements.get(pending.itemId)\n setPendingFocus(null)\n if (target?.isConnected) target.focus()\n })\n\n /**\n * `always` is for a pointer drop: dragging a card is a direct act on it, so it\n * ends focused wherever focus was. Chromium also blurs a focused control\n * inside a draggable once the native drag starts, so \"was focus in the card\"\n * cannot be read at drop time.\n */\n const prepareFocus = (item: T, columnId: string, source?: HTMLElement, always = false) => {\n const card = source ?? cardElements.get(local.itemId(item))\n if (card && (always || card.contains(card.ownerDocument.activeElement))) {\n setPendingFocus({ itemId: local.itemId(item), columnId, source: card })\n }\n }\n\n const byColumn = createMemo(() => {\n const grouped = new Map<string, T[]>()\n for (const column of local.columns) grouped.set(column.id, [])\n for (const item of local.items) grouped.get(local.itemColumn(item))?.push(item)\n return grouped\n })\n\n const accepts = (column: BoardColumn) => {\n const item = dragging()\n return Boolean(\n item && !column.disabled && local.canDrop(item, local.itemColumn(item), column.id)\n )\n }\n\n const drop = (column: BoardColumn) => {\n const item = dragging()\n const from = item ? local.itemColumn(item) : null\n const accepted = accepts(column)\n setDragging(null)\n setOverColumn(null)\n if (!item || !from || from === column.id || !accepted) return\n prepareFocus(item, column.id, undefined, true)\n local.onMove({ itemId: local.itemId(item), from, to: column.id })\n }\n\n /**\n * Keyboard move. `Ctrl`/`Cmd` plus an arrow is the convention for \"reorder this\n * thing within its container\" that does not collide with scrolling or with the\n * text caret, and it is the same chord a browser tab or a spreadsheet uses.\n */\n const moveByKeyboard = (item: T, direction: -1 | 1, source: HTMLElement) => {\n const from = local.itemColumn(item)\n const index = local.columns.findIndex((column) => column.id === from)\n if (index < 0) return\n const ordered =\n direction === 1 ? local.columns.slice(index + 1) : local.columns.slice(0, index).toReversed()\n const target = ordered.find(\n (column) => !column.disabled && local.canDrop(item, from, column.id)\n )\n if (!target) {\n setAnnouncement(`No column after ${from} accepts this item`)\n return\n }\n prepareFocus(item, target.id, source)\n local.onMove({ itemId: local.itemId(item), from, to: target.id })\n setAnnouncement(`Moved to ${target.label}`)\n }\n\n return (\n /*\n `role=\"region\"` + `tabindex=\"0\"` because the board scrolls horizontally and a\n keyboard user has to be able to scroll it — axe's `scrollable-region-focusable`.\n It is not enough that the cards are focusable: a board with empty columns, or\n with more columns than fit, has nothing focusable to scroll from.\n */\n <div\n class={cn('flex min-h-0 gap-3 overflow-x-auto pb-2', local.class)}\n role=\"region\"\n aria-label={local.label ?? 'Board'}\n tabindex=\"0\"\n >\n {/*\n Index, not For: callers derive columns (a count, a tone) and hand over\n fresh objects whenever a card moves. Keyed by identity, every lane would\n remount on each move and take the moved card's restored focus with it.\n */}\n <Index each={local.columns}>\n {(column) => {\n const items = () => byColumn().get(column().id) ?? []\n const collapsed = () =>\n Boolean(local.collapseEmpty) && column().collapsible !== false && items().length === 0\n const over = () => overColumn() === column().id\n return (\n <section\n class={cn(\n 'flex shrink-0 flex-col rounded-lg border border-border bg-muted/40 transition-colors',\n {\n 'w-72': !collapsed(),\n 'w-10 items-center': collapsed(),\n 'border-dashed border-ring': accepts(column()) && !over(),\n 'border-ring bg-primary-subtle': accepts(column()) && over(),\n 'border-dashed opacity-60': over() && !accepts(column()),\n 'opacity-50': column().disabled,\n }\n )}\n aria-label={column().label}\n data-collapsed={collapsed() ? '' : undefined}\n onDragOver={(event) => {\n setOverColumn(column().id)\n if (accepts(column())) event.preventDefault()\n }}\n onDragLeave={(event) => {\n // Leaving for a child is not leaving the lane.\n if (event.currentTarget.contains(event.relatedTarget as Node | null)) return\n setOverColumn((current) => (current === column().id ? null : current))\n }}\n onDrop={(event) => {\n event.preventDefault()\n drop(column())\n }}\n >\n <Show\n when={!collapsed()}\n fallback={\n <header class=\"flex flex-col items-center gap-2 py-3\">\n <BoardColumnDot tone={column().tone} />\n <BoardColumnCount count={column().count} />\n <h3\n class={cn(\n headingVariants({ size: 'subsection', leading: 'none', tone: 'muted' }),\n 'text-vertical'\n )}\n >\n {column().label}\n </h3>\n </header>\n }\n >\n <header class=\"flex h-10 shrink-0 items-center gap-2 px-3\">\n <BoardColumnDot tone={column().tone} />\n <h3\n class={cn(\n headingVariants({ size: 'subsection', leading: 'none', tone: 'foreground' }),\n 'truncate'\n )}\n >\n {column().label}\n </h3>\n <BoardColumnCount count={column().count} />\n <Show when={column().meta}>\n <span class=\"ms-auto text-2xs text-muted-foreground\">{column().meta}</span>\n </Show>\n </header>\n <div class=\"flex min-h-16 flex-1 flex-col gap-2 overflow-y-auto px-2 pb-2\">\n <For each={items()}>\n {(item) => {\n const isDragging = () => {\n const current = dragging()\n return Boolean(current && local.itemId(current) === local.itemId(item))\n }\n return (\n <article\n ref={(element) => {\n const id = local.itemId(item)\n cardElements.set(id, element)\n onCleanup(() => {\n if (cardElements.get(id) === element) cardElements.delete(id)\n })\n }}\n class={cn(\n 'relative shrink-0 cursor-grab rounded-md border border-border bg-card text-sm shadow-xs outline-none transition-colors hover:bg-surface-hover focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle active:cursor-grabbing',\n cardDragState[isDragging() ? 'dragging' : 'idle']\n )}\n // A board card is a control that can be moved, so it is\n // focusable and carries the chord it responds to.\n tabindex=\"0\"\n aria-roledescription=\"Draggable card\"\n draggable={true}\n onDragStart={(event) => {\n event.dataTransfer?.setData('text/plain', local.itemId(item))\n if (event.dataTransfer) event.dataTransfer.effectAllowed = 'move'\n setDragging(() => item)\n }}\n onDragEnd={() => {\n setDragging(null)\n setOverColumn(null)\n }}\n onKeyDown={(event) => {\n if (!(event.ctrlKey || event.metaKey)) return\n if (event.key !== 'ArrowLeft' && event.key !== 'ArrowRight') return\n event.preventDefault()\n moveByKeyboard(\n item,\n event.key === 'ArrowRight' ? 1 : -1,\n event.currentTarget\n )\n }}\n >\n {local.children(item, { dragging: isDragging() })}\n </article>\n )\n }}\n </For>\n <Show when={items().length === 0}>\n <p class=\"rounded-md border border-dashed border-border px-2 py-4 text-center text-2xs text-muted-foreground\">\n {local.emptyColumn?.(column()) ?? 'Nothing here'}\n </p>\n </Show>\n </div>\n </Show>\n </section>\n )\n }}\n </Index>\n {/*\n The keyboard move's result, announced. A drag speaks for itself — the card\n visibly moves — while a keyboard move happens with the focus elsewhere.\n */}\n <div class=\"visually-hidden\" role=\"status\" aria-live=\"polite\">\n {announcement()}\n </div>\n </div>\n )\n}\n\nexport const boardCardTitleVariants = cva('truncate font-medium text-foreground', {\n variants: { size: { sm: 'text-xs', md: 'text-sm' } },\n defaultVariants: { size: 'md' },\n})\n\nexport type BoardCardTitleProps = { class?: string; children: JSX.Element } & VariantProps<\n typeof boardCardTitleVariants\n>\n\n/** The card's title line, at the size a board card uses. */\nexport function BoardCardTitle(props: BoardCardTitleProps) {\n return (\n <h4 class={cn(boardCardTitleVariants({ size: props.size }), props.class)}>{props.children}</h4>\n )\n}\n\n/** A card's padding, so every card in an application is the same shape. */\nexport function BoardCardBody(props: { class?: string; children: JSX.Element }) {\n return <div class={cn('grid gap-1.5 p-2.5', props.class)}>{props.children}</div>\n}\n\n/**\n * The card's open action: its title, as a real button whose hit area stretches\n * over the whole card. A card is one target to a pointer — clicking anywhere on\n * it opens it — while assistive technology still meets a named button rather\n * than a clickable `article`. Other controls on the card sit above the stretched\n * area by being positioned (`class=\"relative\"`), so they keep their own click.\n */\nexport function BoardCardTrigger(props: ComponentProps<'button'>) {\n const [local, rest] = splitProps(props, ['class', 'type'])\n return (\n <button\n type={local.type ?? 'button'}\n data-slot=\"board-card-trigger\"\n class={cn(\n textVariants({ variant: 'label', tone: 'foreground' }),\n 'min-w-0 flex-1 truncate rounded-sm text-start outline-none',\n 'after:absolute after:inset-0 after:rounded-md',\n 'focus-visible:ring-3 focus-visible:ring-primary-subtle',\n local.class\n )}\n {...rest}\n />\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAiHA,IAAM+C,gBAAgB;CACpBC,MAAM;CACNN,UAAU;AACZ;AAEA,IAAMQ,UAA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AAAG,WAAA;GAAA,IAEIC,OAAI;IAAA,OAAEtH,MAAMsH,QAAQ;GAAQ;GAAA,KAAA,WAAA;IAAA,OAErB/K,GACLG,aAAa;KAAEmD,SAAS;KAAS1C,MAAM;IAAa,CAAC,GACrD,8DACA,iDACA,0DACA6C,MAAMvB,KACR;GAAC;EAAA,GACGwI,IAAI,GAAA,OAAA,KAAA;EAAA,OAAAC;CAAA,EAAA,CAAA;AAGd;AAACK,eAAA,CAAA,SAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"board.js","names":["createEffect","createMemo","createSignal","For","Index","onCleanup","Show","splitProps","cva","cn","badgeVariants","headingVariants","textVariants","id","label","count","meta","tone","collapsible","disabled","itemId","from","to","columns","items","item","itemColumn","canDrop","onMove","children","dragging","emptyColumn","column","collapseEmpty","class","cardDragState","idle","toneDot","neutral","BoardColumnDot","props","_$createComponent","when","_el$","_tmpl$","_$effect","_$className","BoardColumnCount","undefined","_el$2","_tmpl$2","_$insert","variant","size","Board","local","setDragging","overColumn","setOverColumn","announcement","setAnnouncement","cardElements","Map","pendingFocus","setPendingFocus","columnId","source","cancelOnPointer","pending","document","ownerDocument","cancelOnFocus","event","contains","target","addEventListener","removeEventListener","moved","find","get","isConnected","focus","prepareFocus","always","card","activeElement","byColumn","grouped","set","push","accepts","Boolean","drop","accepted","moveByKeyboard","direction","index","findIndex","ordered","slice","toReversed","_el$3","_tmpl$3","_el$4","firstChild","each","collapsed","length","over","_el$5","_tmpl$8","preventDefault","currentTarget","relatedTarget","current","fallback","_el$1","_tmpl$9","_el$10","leading","_el$6","_tmpl$5","_el$7","_el$8","_tmpl$4","_el$9","_tmpl$7","isDragging","_el$11","_tmpl$0","$$keydown","ctrlKey","metaKey","key","dataTransfer","setData","effectAllowed","_$use","element","delete","_$setAttribute","_el$0","_tmpl$6","_p$","_v$3","_v$4","_v$5","e","t","a","_v$","_v$2","boardCardTitleVariants","variants","sm","md","defaultVariants","BoardCardTitle","_el$12","_tmpl$1","BoardCardBody","_el$13","_tmpl$10","BoardCardTrigger","rest","_el$14","_tmpl$11","_$spread","_$mergeProps","type","_$delegateEvents"],"sources":["../../../../src/components/ui/board/board.tsx"],"sourcesContent":["import {\n type ComponentProps,\n createEffect,\n createMemo,\n createSignal,\n For,\n Index,\n onCleanup,\n Show,\n splitProps,\n type JSX,\n} from 'solid-js'\nimport { cva, type VariantProps } from '#lib/variants'\nimport { cn } from '#lib/utils'\nimport { badgeVariants } from '../badge'\nimport { headingVariants, textVariants } from '../typography'\n\n/**\n * Board.\n *\n * Columns of cards, with drag between them — the shape a task tracker, a CRM\n * pipeline, a support queue and a release plan all share. It is generic in the\n * one place that matters: the *column ids are the caller's*, and so is the rule\n * that decides which moves are legal. The component knows nothing about tasks.\n *\n * The transitions are a predicate rather than a derived table because the legal\n * moves in a real product are not \"any column to any column\". A task that is\n * `completed` may be archived but not re-queued; a lead may become a customer but\n * not a stranger again. A board that let you drop anything anywhere would encode\n * a state machine in the UI that the server rejects — so `canDrop` is required,\n * and a column that cannot receive the dragged card renders as unavailable rather\n * than silently accepting a drop that will fail.\n *\n * Three input methods, because a drag-only board is unusable by keyboard:\n * dragging with the pointer, `Ctrl`/`Cmd` + arrow keys to move a focused card\n * between columns, and whatever the caller wires into `actions`. The card is\n * focusable and its move is announced through a live region, so the board is\n * operable without a mouse.\n *\n * The card is rendered by the caller through `children`, given the item and a set\n * of drag props. That is deliberate: a card's contents are domain — a title, a\n * priority tag, an assignee — and a board that rendered them itself could only\n * ever serve one product.\n *\n * `collapseEmpty` folds a column with no cards to a strip one line of text wide,\n * its label turned on its side. A board of seven lanes where three are empty\n * otherwise spends half its width on nothing, and the lanes with work in them\n * are the ones that need the room. A folded lane is still a full-height drop\n * target and still accepts a keyboard move, so nothing about operating the\n * board changes; it does not unfold under a drag, because a lane that grows\n * under the pointer moves every lane after it and the drop lands somewhere else.\n *\n * Give the board a height (`class=\"h-full\"`) and each lane scrolls on its own;\n * leave it unconstrained and lanes grow with their cards and the page scrolls.\n */\n\n/**\n * A lane's identifying colour, drawn as a dot before its label. The chart hues,\n * in the order the token set gives them, because a lane colour tells lanes apart\n * like a series does; it carries no status. `neutral` is for a lane that should\n * not draw the eye — a backlog, an archive.\n */\nexport type BoardTone =\n | 'neutral'\n | 'chart-1'\n | 'chart-2'\n | 'chart-3'\n | 'chart-4'\n | 'chart-5'\n | 'chart-6'\n\nexport type BoardColumn = Readonly<{\n id: string\n label: string\n /** The number of cards, shown as an accent count beside the label. */\n count?: number\n /** A limit or any other note, shown after the count. */\n meta?: JSX.Element\n /** The lane's dot colour. Omitted, the header has no dot. */\n tone?: BoardTone\n /**\n * `false` keeps this lane open when it is empty under `collapseEmpty` — the\n * inbox lane new cards arrive in, which should always show where they land.\n */\n collapsible?: boolean\n /** Dim the column and refuse drops — a lane that is closed or read-only. */\n disabled?: boolean\n}>\n\nexport type BoardMove = Readonly<{\n itemId: string\n from: string\n to: string\n}>\n\nexport type BoardProps<T> = {\n columns: readonly BoardColumn[]\n items: readonly T[]\n itemId: (item: T) => string\n itemColumn: (item: T) => string\n /** Whether `item` may move from `from` to `to`. Required: see the note above. */\n canDrop: (item: T, from: string, to: string) => boolean\n onMove: (move: BoardMove) => void\n /** The card body. `dragging` is true while this card is the one being dragged. */\n children: (item: T, state: { dragging: boolean }) => JSX.Element\n emptyColumn?: (column: BoardColumn) => JSX.Element\n /** The board's accessible name. Defaults to \"Board\". */\n label?: string\n /** Fold columns with no cards to a narrow strip with a sideways label. */\n collapseEmpty?: boolean\n class?: string\n}\n\nconst cardDragState = {\n idle: '',\n dragging: 'opacity-40',\n} as const\n\nconst toneDot: Record<BoardTone, string> = {\n neutral: 'bg-muted-foreground',\n 'chart-1': 'bg-chart-1',\n 'chart-2': 'bg-chart-2',\n 'chart-3': 'bg-chart-3',\n 'chart-4': 'bg-chart-4',\n 'chart-5': 'bg-chart-5',\n 'chart-6': 'bg-chart-6',\n}\n\nfunction BoardColumnDot(props: { tone?: BoardTone }) {\n return (\n <Show when={props.tone}>\n {(tone) => (\n <span aria-hidden=\"true\" class={cn('size-2 shrink-0 rounded-full', toneDot[tone()])} />\n )}\n </Show>\n )\n}\n\nfunction BoardColumnCount(props: { count?: number }) {\n return (\n <Show when={props.count !== undefined}>\n {/* The Badge's classes, not the component: Board stays free of Kobalte. */}\n <span\n class={cn(badgeVariants({ variant: 'subtle', size: 'sm' }), 'tabular-nums')}\n data-slot=\"board-column-count\"\n >\n {props.count}\n </span>\n </Show>\n )\n}\n\nexport function Board<T>(props: BoardProps<T>) {\n const [local] = splitProps(props, [\n 'columns',\n 'items',\n 'itemId',\n 'itemColumn',\n 'canDrop',\n 'onMove',\n 'children',\n 'emptyColumn',\n 'label',\n 'collapseEmpty',\n 'class',\n ])\n\n // The dragged item, not its id: `canDrop` takes the item itself, and the\n // pointer may leave the card before it is dropped.\n const [dragging, setDragging] = createSignal<T | null>(null)\n const [overColumn, setOverColumn] = createSignal<string | null>(null)\n const [announcement, setAnnouncement] = createSignal('')\n const cardElements = new Map<string, HTMLElement>()\n const [pendingFocus, setPendingFocus] = createSignal<{\n itemId: string\n columnId: string\n source: HTMLElement\n } | null>(null)\n const cancelOnPointer = () => setPendingFocus(null)\n\n // A controlled move can settle after a server response. Restore only the\n // focus that belonged to the moved card; another focus action cancels it.\n createEffect(() => {\n const pending = pendingFocus()\n if (!pending) return\n const document = pending.source.ownerDocument\n const cancelOnFocus = (event: FocusEvent) => {\n if (!pending.source.contains(event.target as Node)) setPendingFocus(null)\n }\n document.addEventListener('focusin', cancelOnFocus)\n document.addEventListener('pointerdown', cancelOnPointer)\n onCleanup(() => {\n document.removeEventListener('focusin', cancelOnFocus)\n document.removeEventListener('pointerdown', cancelOnPointer)\n })\n })\n\n createEffect(() => {\n const pending = pendingFocus()\n if (!pending) return\n const moved = local.items.find((item) => local.itemId(item) === pending.itemId)\n if (!moved || local.itemColumn(moved) !== pending.columnId) return\n const target = cardElements.get(pending.itemId)\n setPendingFocus(null)\n if (target?.isConnected) target.focus()\n })\n\n /**\n * `always` is for a pointer drop: dragging a card is a direct act on it, so it\n * ends focused wherever focus was. Chromium also blurs a focused control\n * inside a draggable once the native drag starts, so \"was focus in the card\"\n * cannot be read at drop time.\n */\n const prepareFocus = (item: T, columnId: string, source?: HTMLElement, always = false) => {\n const card = source ?? cardElements.get(local.itemId(item))\n if (card && (always || card.contains(card.ownerDocument.activeElement))) {\n setPendingFocus({ itemId: local.itemId(item), columnId, source: card })\n }\n }\n\n const byColumn = createMemo(() => {\n const grouped = new Map<string, T[]>()\n for (const column of local.columns) grouped.set(column.id, [])\n for (const item of local.items) grouped.get(local.itemColumn(item))?.push(item)\n return grouped\n })\n\n const accepts = (column: BoardColumn) => {\n const item = dragging()\n return Boolean(\n item && !column.disabled && local.canDrop(item, local.itemColumn(item), column.id)\n )\n }\n\n const drop = (column: BoardColumn) => {\n const item = dragging()\n const from = item ? local.itemColumn(item) : null\n const accepted = accepts(column)\n setDragging(null)\n setOverColumn(null)\n if (!item || !from || from === column.id || !accepted) return\n prepareFocus(item, column.id, undefined, true)\n local.onMove({ itemId: local.itemId(item), from, to: column.id })\n }\n\n /**\n * Keyboard move. `Ctrl`/`Cmd` plus an arrow is the convention for \"reorder this\n * thing within its container\" that does not collide with scrolling or with the\n * text caret, and it is the same chord a browser tab or a spreadsheet uses.\n */\n const moveByKeyboard = (item: T, direction: -1 | 1, source: HTMLElement) => {\n const from = local.itemColumn(item)\n const index = local.columns.findIndex((column) => column.id === from)\n if (index < 0) return\n const ordered =\n direction === 1 ? local.columns.slice(index + 1) : local.columns.slice(0, index).toReversed()\n const target = ordered.find(\n (column) => !column.disabled && local.canDrop(item, from, column.id)\n )\n if (!target) {\n setAnnouncement(`No column after ${from} accepts this item`)\n return\n }\n prepareFocus(item, target.id, source)\n local.onMove({ itemId: local.itemId(item), from, to: target.id })\n setAnnouncement(`Moved to ${target.label}`)\n }\n\n return (\n /*\n `role=\"region\"` + `tabindex=\"0\"` because the board scrolls horizontally and a\n keyboard user has to be able to scroll it — axe's `scrollable-region-focusable`.\n It is not enough that the cards are focusable: a board with empty columns, or\n with more columns than fit, has nothing focusable to scroll from.\n */\n <div\n class={cn('flex min-h-0 gap-3 overflow-x-auto pb-2', local.class)}\n role=\"region\"\n aria-label={local.label ?? 'Board'}\n tabindex=\"0\"\n >\n {/*\n Index, not For: callers derive columns (a count, a tone) and hand over\n fresh objects whenever a card moves. Keyed by identity, every lane would\n remount on each move and take the moved card's restored focus with it.\n */}\n <Index each={local.columns}>\n {(column) => {\n const items = () => byColumn().get(column().id) ?? []\n const collapsed = () =>\n Boolean(local.collapseEmpty) && column().collapsible !== false && items().length === 0\n const over = () => overColumn() === column().id\n return (\n <section\n class={cn(\n 'flex shrink-0 flex-col rounded-lg border border-border bg-muted/40 transition-colors',\n {\n 'w-72': !collapsed(),\n 'w-10 items-center': collapsed(),\n 'border-dashed border-ring': accepts(column()) && !over(),\n 'border-ring bg-primary-subtle': accepts(column()) && over(),\n 'border-dashed opacity-60': over() && !accepts(column()),\n 'opacity-50': column().disabled,\n }\n )}\n aria-label={column().label}\n data-collapsed={collapsed() ? '' : undefined}\n onDragOver={(event) => {\n setOverColumn(column().id)\n if (accepts(column())) event.preventDefault()\n }}\n onDragLeave={(event) => {\n // Leaving for a child is not leaving the lane.\n if (event.currentTarget.contains(event.relatedTarget as Node | null)) return\n setOverColumn((current) => (current === column().id ? null : current))\n }}\n onDrop={(event) => {\n event.preventDefault()\n drop(column())\n }}\n >\n <Show\n when={!collapsed()}\n fallback={\n <header class=\"flex flex-col items-center gap-2 py-3\">\n <BoardColumnDot tone={column().tone} />\n <BoardColumnCount count={column().count} />\n <h3\n class={cn(\n headingVariants({ size: 'subsection', leading: 'none', tone: 'muted' }),\n 'text-vertical'\n )}\n >\n {column().label}\n </h3>\n </header>\n }\n >\n <header class=\"flex h-10 shrink-0 items-center gap-2 px-3\">\n <BoardColumnDot tone={column().tone} />\n <h3\n class={cn(\n headingVariants({ size: 'subsection', leading: 'none', tone: 'foreground' }),\n 'truncate'\n )}\n >\n {column().label}\n </h3>\n <BoardColumnCount count={column().count} />\n <Show when={column().meta}>\n <span class=\"ms-auto text-2xs text-muted-foreground\">{column().meta}</span>\n </Show>\n </header>\n <div class=\"flex min-h-16 flex-1 flex-col gap-2 overflow-y-auto px-2 pb-2\">\n <For each={items()}>\n {(item) => {\n const isDragging = () => {\n const current = dragging()\n return Boolean(current && local.itemId(current) === local.itemId(item))\n }\n return (\n <article\n ref={(element) => {\n const id = local.itemId(item)\n cardElements.set(id, element)\n onCleanup(() => {\n if (cardElements.get(id) === element) cardElements.delete(id)\n })\n }}\n class={cn(\n 'relative shrink-0 cursor-grab rounded-md border border-border bg-card text-sm shadow-xs outline-none transition-colors hover:bg-surface-hover focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle active:cursor-grabbing',\n cardDragState[isDragging() ? 'dragging' : 'idle']\n )}\n // A board card is a control that can be moved, so it is\n // focusable and carries the chord it responds to.\n tabindex=\"0\"\n aria-roledescription=\"Draggable card\"\n draggable={true}\n onDragStart={(event) => {\n event.dataTransfer?.setData('text/plain', local.itemId(item))\n if (event.dataTransfer) event.dataTransfer.effectAllowed = 'move'\n setDragging(() => item)\n }}\n onDragEnd={() => {\n setDragging(null)\n setOverColumn(null)\n }}\n onKeyDown={(event) => {\n if (!(event.ctrlKey || event.metaKey)) return\n if (event.key !== 'ArrowLeft' && event.key !== 'ArrowRight') return\n event.preventDefault()\n moveByKeyboard(\n item,\n event.key === 'ArrowRight' ? 1 : -1,\n event.currentTarget\n )\n }}\n >\n {local.children(item, { dragging: isDragging() })}\n </article>\n )\n }}\n </For>\n <Show when={items().length === 0}>\n <p class=\"rounded-md border border-dashed border-border px-2 py-4 text-center text-2xs text-muted-foreground\">\n {local.emptyColumn?.(column()) ?? 'Nothing here'}\n </p>\n </Show>\n </div>\n </Show>\n </section>\n )\n }}\n </Index>\n {/*\n The keyboard move's result, announced. A drag speaks for itself — the card\n visibly moves — while a keyboard move happens with the focus elsewhere.\n */}\n <div class=\"visually-hidden\" role=\"status\" aria-live=\"polite\">\n {announcement()}\n </div>\n </div>\n )\n}\n\nexport const boardCardTitleVariants = cva('truncate font-medium text-foreground', {\n variants: { size: { sm: 'text-xs', md: 'text-sm' } },\n defaultVariants: { size: 'md' },\n})\n\nexport type BoardCardTitleProps = { class?: string; children: JSX.Element } & VariantProps<\n typeof boardCardTitleVariants\n>\n\n/** The card's title line, at the size a board card uses. */\nexport function BoardCardTitle(props: BoardCardTitleProps) {\n return (\n <h4 class={cn(boardCardTitleVariants({ size: props.size }), props.class)}>{props.children}</h4>\n )\n}\n\n/** A card's padding, so every card in an application is the same shape. */\nexport function BoardCardBody(props: { class?: string; children: JSX.Element }) {\n return <div class={cn('grid gap-1.5 p-2.5', props.class)}>{props.children}</div>\n}\n\n/**\n * The card's open action: its title, as a real button whose hit area stretches\n * over the whole card. A card is one target to a pointer — clicking anywhere on\n * it opens it — while assistive technology still meets a named button rather\n * than a clickable `article`. Other controls on the card sit above the stretched\n * area by being positioned (`class=\"relative\"`), so they keep their own click.\n */\nexport function BoardCardTrigger(props: ComponentProps<'button'>) {\n const [local, rest] = splitProps(props, ['class', 'type'])\n return (\n <button\n type={local.type ?? 'button'}\n data-slot=\"board-card-trigger\"\n class={cn(\n textVariants({ variant: 'label', tone: 'foreground' }),\n 'min-w-0 flex-1 truncate rounded-sm text-start outline-none',\n 'after:absolute after:inset-0 after:rounded-md',\n 'focus-visible:ring-3 focus-visible:ring-primary-subtle',\n local.class\n )}\n {...rest}\n />\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAiHA,IAAMmC,gBAAgB;CACpBC,MAAM;CACNN,UAAU;AACZ;AAEA,IAAMO,UAAqC;CACzCC,SAAS;CACT,WAAW;CACX,WAAW;CACX,WAAW;CACX,WAAW;CACX,WAAW;CACX,WAAW;AACb;AAEA,SAASC,eAAeC,OAA6B;CACnD,OAAAC,gBACGnC,MAAI;EAAA,IAACoC,OAAI;GAAA,OAAEF,MAAMvB;EAA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AA;EAAA,OAAAC;CAAA,EAAA,CAAA;AAGd;AAACK,eAAA,CAAA,SAAA,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"breadcrumb.js","names":["ChevronRight","MoreHorizontal","
|
|
1
|
+
{"version":3,"file":"breadcrumb.js","names":["ChevronRight","MoreHorizontal","Show","splitProps","cn","Breadcrumb","props","local","rest","_el$","_tmpl$","_$spread","_$mergeProps","class","BreadcrumbList","_el$2","_tmpl$2","BreadcrumbItem","_el$3","_tmpl$3","current","BreadcrumbLink","_$createComponent","when","fallback","BreadcrumbPage","children","_el$4","_tmpl$4","_el$5","_tmpl$5","BreadcrumbSeparator","_el$6","_tmpl$6","_$insert","BreadcrumbEllipsis","_el$7","_tmpl$7","_el$8","firstChild"],"sources":["../../../../src/components/ui/breadcrumb/breadcrumb.tsx"],"sourcesContent":["import { ChevronRight, MoreHorizontal } from 'lucide-solid'\nimport type { ComponentProps } from 'solid-js'\nimport { Show, splitProps } from 'solid-js'\nimport { cn } from '#lib/utils'\n\n/**\n * Breadcrumb.\n *\n * The path to the current view, in a real `<nav>` wrapping an ordered list so\n * the structure is announced rather than read as loose text. The final crumb is\n * the current page and is marked `aria-current=\"page\"` instead of being a link\n * to itself.\n *\n * A long path collapses from the middle: the root says where the user started\n * and the last crumbs say what they are looking at, so those are the parts that\n * have to survive.\n */\nexport function Breadcrumb(props: ComponentProps<'nav'>) {\n const [local, rest] = splitProps(props, ['class', 'aria-label'])\n\n return (\n <nav\n data-slot=\"breadcrumb\"\n aria-label={local['aria-label'] ?? 'Breadcrumb'}\n class={cn('text-muted-foreground', local.class)}\n {...rest}\n />\n )\n}\n\nexport function BreadcrumbList(props: ComponentProps<'ol'>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <ol\n data-slot=\"breadcrumb-list\"\n class={cn('flex flex-wrap items-center gap-1.5 text-sm break-words', local.class)}\n {...rest}\n />\n )\n}\n\nexport function BreadcrumbItem(props: ComponentProps<'li'>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <li\n data-slot=\"breadcrumb-item\"\n class={cn('inline-flex items-center gap-1.5', local.class)}\n {...rest}\n />\n )\n}\n\nexport type BreadcrumbLinkProps = ComponentProps<'a'> & {\n /** Render as the current page rather than as a link. */\n current?: boolean\n}\n\nexport function BreadcrumbLink(props: BreadcrumbLinkProps) {\n const [local, rest] = splitProps(props, ['class', 'current'])\n\n return (\n <Show\n when={!local.current}\n fallback={<BreadcrumbPage class={local.class} {...(rest as ComponentProps<'span'>)} />}\n >\n <a\n data-slot=\"breadcrumb-link\"\n class={cn(\n 'rounded-sm transition-colors ease-out outline-none hover:text-foreground',\n 'focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle',\n local.class\n )}\n {...rest}\n />\n </Show>\n )\n}\n\n/**\n * The current page: the last crumb, as text rather than a link to itself, and\n * marked `aria-current=\"page\"`. The same element `BreadcrumbLink current`\n * renders, for a trail whose last crumb is never a link.\n */\nexport function BreadcrumbPage(props: ComponentProps<'span'>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <span\n data-slot=\"breadcrumb-page\"\n aria-current=\"page\"\n class={cn('font-medium text-foreground', local.class)}\n {...rest}\n />\n )\n}\n\nexport function BreadcrumbSeparator(props: ComponentProps<'li'>) {\n const [local, rest] = splitProps(props, ['class', 'children'])\n\n return (\n <li\n data-slot=\"breadcrumb-separator\"\n role=\"presentation\"\n aria-hidden=\"true\"\n class={cn('[&_svg]:size-3.5', local.class)}\n {...rest}\n >\n {local.children ?? <ChevronRight />}\n </li>\n )\n}\n\nexport function BreadcrumbEllipsis(props: ComponentProps<'span'>) {\n const [local, rest] = splitProps(props, ['class'])\n\n return (\n <span\n data-slot=\"breadcrumb-ellipsis\"\n role=\"presentation\"\n aria-hidden=\"true\"\n class={cn('flex size-6 items-center justify-center', local.class)}\n {...rest}\n >\n <MoreHorizontal class=\"size-4\" />\n <span class=\"visually-hidden\">More</span>\n </span>\n )\n}\n"],"mappings":";;;;;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MAAMM,KAAK;EAAC,EAAA,GAC7DL,IAAI,GAAA,OAAA,IAAA;EAAA0B,OAAAE,OAAAd,gBAEPrB,gBAAc,EAAA,SAAA,SAAA,CAAA,GAAAqC,KAAA;EAAA,OAAAF;CAAA,EAAA,CAAA;AAIrB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bubble.js","names":["splitProps","
|
|
1
|
+
{"version":3,"file":"bubble.js","names":["splitProps","cn","cva","bubbleVariants","variants","tone","user","neutral","quiet","state","sent","pending","queued","failed","defaultVariants","children","status","statusAction","Bubble","props","local","rest","_el$","_tmpl$","_el$2","firstChild","_$spread","_$mergeProps","class","_$insert","_c$","_$memo","undefined","_el$3","_tmpl$2","_$effect","_p$","_v$","_v$2","e","_$setAttribute","t","_$className"],"sources":["../../../../src/components/ui/bubble/bubble.tsx"],"sourcesContent":["import { splitProps, type ComponentProps, type JSX } from 'solid-js'\nimport { cn } from '#lib/utils'\nimport { cva, type VariantProps } from '#lib/variants'\n\n/**\n * Bubble.\n *\n * The container for what *the person* sends. The assistant's reply is not a\n * bubble: it is the page, set in the reading column with no surface behind it,\n * because a reply that is a card among cards turns every long answer into a box\n * to scroll inside. A bubble marks the one voice that is quoting itself back — a\n * short, bounded message — so the eye can find where each turn begins.\n *\n * `state` is the delivery truth, not decoration: `pending` while the send is in\n * flight, `queued` for a follow-up the runtime has not taken yet (dashed, so it\n * reads as not yet part of the conversation), `failed` when it did not go. Each\n * state has a word in `status`, because the border alone is not a signal.\n *\n * Text is rendered as text. `whitespace-pre-wrap` keeps the sender's line breaks\n * and `overflow-wrap: anywhere` stops a pasted token or URL from widening the\n * column; nothing here interprets markup.\n */\nexport const bubbleVariants = cva(\n 'relative w-fit max-w-full min-w-0 rounded-2xl px-3.5 py-2 font-content text-content break-words whitespace-pre-wrap [overflow-wrap:anywhere]',\n {\n variants: {\n tone: {\n user: 'bg-primary-subtle text-foreground',\n neutral: 'bg-muted text-foreground',\n quiet: 'border border-border bg-transparent text-foreground',\n },\n state: {\n sent: '',\n pending: 'opacity-70',\n queued: 'border border-dashed border-border bg-transparent',\n failed: 'border border-destructive',\n },\n },\n defaultVariants: { tone: 'user', state: 'sent' },\n }\n)\n\nexport type BubbleProps = Omit<ComponentProps<'div'>, 'children'> &\n VariantProps<typeof bubbleVariants> & {\n children?: JSX.Element\n /** What the state means in words: \"Sending…\", \"Queued\", \"Not sent\". */\n status?: JSX.Element\n /** Shown beside the status, e.g. a Retry button for a failed send. */\n statusAction?: JSX.Element\n }\n\nexport function Bubble(props: BubbleProps) {\n const [local, rest] = splitProps(props, [\n 'class',\n 'tone',\n 'state',\n 'children',\n 'status',\n 'statusAction',\n ])\n return (\n <div class=\"flex max-w-full min-w-0 flex-col items-end gap-1\" data-slot=\"bubble-root\">\n <div\n data-slot=\"bubble\"\n data-state={local.state ?? 'sent'}\n class={cn(bubbleVariants({ tone: local.tone, state: local.state }), local.class)}\n {...rest}\n >\n {local.children}\n </div>\n {local.status !== undefined || local.statusAction !== undefined ? (\n <div\n data-slot=\"bubble-status\"\n role={local.state === 'failed' ? 'alert' : 'status'}\n class={cn('flex items-center gap-2 text-xs', {\n 'text-destructive': local.state === 'failed',\n 'text-muted-foreground': local.state !== 'failed',\n })}\n >\n {local.status}\n {local.statusAction}\n </div>\n ) : null}\n </div>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAsBA,IAAaG,iBAAiBD,IAC5B,gJACA;CACEE,UAAU;EACRC,MAAM;GACJC,MAAM;GACNC,SAAS;GACTC,OAAO;EACT;EACAC,OAAO;GACLC,MAAM;GACNC,SAAS;GACTC,QAAQ;GACRC,QAAQ;EACV;CACF;CACAC,iBAAiB;EAAET,MAAM;EAAQI,OAAO;CAAO;AACjD,CACF;AAWA,SAAgBS,OAAOC,OAAoB;CACzC,MAAM,CAACC,OAAOC,QAAQrB,WAAWmB,OAAO;EACtC;EACA;EACA;EACA;EACA;EACA;CAAc,CACf;CACD,cAAA;EAAA,IAAAG,OAAAC,OAAA,GAAAC,QAAAF,KAAAG;EAAAC,OAAAF,OAAAG,WAAA;GAAA,KAAA,gBAAA;IAAA,OAIkBP,MAAMX,SAAS;GAAM;GAAA,KAAA,WAAA;IAAA,OAC1BR,GAAGE,eAAe;KAAEE,MAAMe,MAAMf;KAAMI,OAAOW,MAAMX;IAAM,CAAC,GAAGW,MAAMQ,KAAK;GAAC;EAAA,GAC5EP,IAAI,GAAA,OAAA,IAAA;EAAAQ,OAAAL,aAEPJ,MAAML,QAAQ;EAAAc,OAAAP,aAAA;GAAA,IAAAQ,MAAAC,WAAA,CAAA,EAEhBX,MAAMJ,WAAWgB,KAAAA,KAAaZ,MAAMH,iBAAiBe,KAAAA,EAAS;GAAA,aAA9DF,IAAA,WAAA;IAAA,IAAAG,QAAAC,QAAA;IAAAL,OAAAI,aASIb,MAAMJ,QAAM,IAAA;IAAAa,OAAAI,aACZb,MAAMH,cAAY,IAAA;IAAAkB,QAAAC,QAAA;KAAA,IAAAC,MAPbjB,MAAMX,UAAU,WAAW,UAAU,UAAQ6B,OAC5CrC,GAAG,mCAAmC;MAC3C,oBAAoBmB,MAAMX,UAAU;MACpC,yBAAyBW,MAAMX,UAAU;KAC3C,CAAC;KAAC4B,QAAAD,IAAAG,KAAAC,aAAAP,OAAA,QAAAG,IAAAG,IAAAF,GAAA;KAAAC,SAAAF,IAAAK,KAAAC,UAAAT,OAAAG,IAAAK,IAAAH,IAAA;KAAA,OAAAF;IAAA,GAAA;KAAAG,GAAAP,KAAAA;KAAAS,GAAAT,KAAAA;IAAA,CAAA;IAAA,OAAAC;GAAA,EAAA,CAAA,IAKF;EAAI,EAAA,CAAA,GAAA,IAAA;EAAA,OAAAX;CAAA,EAAA,CAAA;AAGd"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.js","names":["Polymorphic","
|
|
1
|
+
{"version":3,"file":"button.js","names":["Polymorphic","splitProps","cva","controlInteractive","controlSize","cn","buttonVariants","variants","variant","default","secondary","destructive","outline","ghost","toolbar","subtle","success","link","size","xs","sm","md","lg","xl","touchTarget","comfortable","defaultVariants","class","Button","props","local","rest","_$createComponent","_$mergeProps","as","type"],"sources":["../../../../src/components/ui/button/button.tsx"],"sourcesContent":["import { Polymorphic, type PolymorphicProps } from '@kobalte/core/polymorphic'\nimport { type ComponentProps, splitProps, type ValidComponent } from 'solid-js'\nimport { cva, controlInteractive, controlSize, type VariantProps } from '#lib/variants'\nimport { cn } from '#lib/utils'\n\n/**\n * Button.\n *\n * One appearance ladder shared by every pressable thing in the system: a\n * button, a toolbar control, a dialog action, and a menu row all draw from the\n * same tokens, so a row of them cannot drift apart.\n *\n * The variants answer \"what is this for\", never \"what colour is it\". A caller\n * that wants a red button writes `variant=\"destructive\"`; the red lives here.\n * That is also what lets the design-system linter tell a caller which variant\n * to use instead of only which class was wrong.\n *\n * Polymorphic: pass `as=\"a\"` (or any component) and the button becomes it\n * while keeping the same styling contract. This replaces the React-era\n * `asChild` primitive, which has no Solid equivalent that preserves props.\n */\nexport const buttonVariants = cva(\n `${controlInteractive} inline-flex shrink-0 items-center justify-center rounded-md font-medium whitespace-nowrap select-none [&_svg]:pointer-events-none [&_svg]:shrink-0`,\n {\n variants: {\n variant: {\n /** The one primary action in a view. */\n default: 'bg-primary text-primary-foreground hover:bg-primary-hover',\n secondary: 'bg-secondary text-secondary-foreground hover:bg-surface-hover',\n /** For the action that destroys something. Never the default. */\n destructive:\n 'bg-destructive-action text-destructive-action-foreground hover:bg-destructive-action/90 focus-visible:ring-destructive-subtle',\n /** A bordered button for a surface that already has a fill. */\n outline:\n 'border border-border bg-transparent text-foreground hover:bg-surface-hover hover:border-input',\n /** No chrome until hover. The default for toolbar and row actions. */\n ghost: 'text-foreground hover:bg-surface-hover',\n /**\n * A ghost that opens something: a sheet, menu or popover trigger in a\n * toolbar. While its surface is open it holds the accent's own tint —\n * the same treatment that drives the side rail's active destination —\n * so the open control never reads identical to its closed neighbours\n * and the app's pressed chrome reads as one accent chroma. The\n * compound hover keeps the tint when an open control is pointed at.\n */\n toolbar:\n 'text-foreground hover:bg-surface-hover data-[expanded]:bg-primary-subtle data-[expanded]:text-primary data-[expanded]:hover:bg-primary-subtle',\n /** A tinted primary, for a secondary action inside a primary flow. */\n subtle: 'bg-primary-subtle text-primary hover:bg-primary-subtle/80',\n success: 'bg-success text-success-foreground hover:bg-success/90',\n link: 'text-primary underline-offset-4 hover:underline',\n },\n size: {\n '2xs': `${controlSize['2xs']} [&_svg]:size-3`,\n xs: `${controlSize.xs} [&_svg]:size-3.5`,\n sm: `${controlSize.sm} [&_svg]:size-3.5`,\n md: `${controlSize.md} [&_svg]:size-4`,\n lg: `${controlSize.lg} [&_svg]:size-4`,\n xl: `${controlSize.xl} [&_svg]:size-5`,\n '2xl': `${controlSize['2xl']} [&_svg]:size-6`,\n /* Square, for an icon with no label. The accessible name then has to\n come from `aria-label` or a visually hidden label — an icon-only\n button with neither is the accessibility finding the Storybook lane\n catches on every story. */\n 'icon-2xs': 'size-control-2xs p-0 [&_svg]:size-3',\n 'icon-xs': 'size-control-xs p-0 [&_svg]:size-3.5',\n 'icon-sm': 'size-control-sm p-0 [&_svg]:size-3.5',\n 'icon-md': 'size-control-md p-0 [&_svg]:size-4',\n 'icon-lg': 'size-control-lg p-0 [&_svg]:size-4',\n 'icon-xl': 'size-control-xl p-0 [&_svg]:size-5',\n 'icon-2xl': 'size-control-2xl p-0 [&_svg]:size-6',\n },\n /** Opt in to a stable touch target on devices with any coarse pointer. */\n touchTarget: {\n comfortable: 'touch-target-comfortable',\n },\n },\n defaultVariants: {\n variant: 'default',\n size: 'md',\n },\n }\n)\n\ntype ButtonVariantProps = VariantProps<typeof buttonVariants>\n\nexport type ButtonProps<T extends ValidComponent = 'button'> = PolymorphicProps<\n T,\n ButtonVariantProps & {\n class?: string\n }\n>\n\nexport function Button<T extends ValidComponent = 'button'>(props: ButtonProps<T>) {\n const [local, rest] = splitProps(props as ButtonProps, [\n 'variant',\n 'size',\n 'touchTarget',\n 'class',\n ])\n\n return (\n <Polymorphic\n as=\"button\"\n type=\"button\"\n data-slot=\"button\"\n class={cn(\n buttonVariants({\n variant: local.variant,\n size: local.size,\n touchTarget: local.touchTarget,\n }),\n local.class\n )}\n {...(rest as ComponentProps<'button'>)}\n />\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAqBA,IAAaM,iBAAiBJ,IAC5B,GAAGC,mBAAkB,sJACrB;CACEI,UAAU;EACRC,SAAS;;GAEPC,SAAS;GACTC,WAAW;;GAEXC,aACE;;GAEFC,SACE;;GAEFC,OAAO;;;;;;;;;GASPC,SACE;;GAEFC,QAAQ;GACRC,SAAS;GACTC,MAAM;EACR;EACAC,MAAM;GACJ,OAAO,GAAGd,YAAY,OAAM;GAC5Be,IAAI,GAAGf,YAAYe,GAAE;GACrBC,IAAI,GAAGhB,YAAYgB,GAAE;GACrBC,IAAI,GAAGjB,YAAYiB,GAAE;GACrBC,IAAI,GAAGlB,YAAYkB,GAAE;GACrBC,IAAI,GAAGnB,YAAYmB,GAAE;GACrB,OAAO,GAAGnB,YAAY,OAAM;GAK5B,YAAY;GACZ,WAAW;GACX,WAAW;GACX,WAAW;GACX,WAAW;GACX,WAAW;GACX,YAAY;EACd;;EAEAoB,aAAa,EACXC,aAAa,2BACf;CACF;CACAC,iBAAiB;EACflB,SAAS;EACTU,MAAM;CACR;AACF,CACF;AAWA,SAAgBU,OAA4CC,OAAuB;CACjF,MAAM,CAACC,OAAOC,QAAQ9B,WAAW4B,OAAsB;EACrD;EACA;EACA;EACA;CAAO,CACR;CAED,OAAAG,gBACGhC,aAAWiC,WAAA;EACVC,IAAE;EACFC,MAAI;EAAA,aAAA;EAAA,KAAA,WAAA;GAAA,OAEG9B,GACLC,eAAe;IACbE,SAASsB,MAAMtB;IACfU,MAAMY,MAAMZ;IACZM,aAAaM,MAAMN;GACrB,CAAC,GACDM,MAAMH,KACR;EAAC;CAAA,GACII,IAAgC,CAAA;AAG3C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button-group.js","names":["
|
|
1
|
+
{"version":3,"file":"button-group.js","names":["splitProps","cn","Separator","label","orientation","ButtonGroup","props","local","rest","horizontal","_el$","_tmpl$","_$spread","_$mergeProps","class","_$insert","children","ButtonGroupSeparator","_$createComponent","ButtonGroupText","_el$2","_tmpl$2"],"sources":["../../../../src/components/ui/button-group/button-group.tsx"],"sourcesContent":["import type { ComponentProps } from 'solid-js'\nimport { splitProps } from 'solid-js'\nimport { cn } from '#lib/utils'\nimport { Separator } from '../separator'\n\n/**\n * ButtonGroup.\n *\n * Several controls acting as one. The point is the *join*: the items share a\n * border, collapse the seam between them, and round only at the ends, so a row of\n * buttons reads as a single object with segments rather than as buttons that happen\n * to be adjacent.\n *\n * The joining lives on the group, through child selectors, so an item never has to\n * know whether it sits at an end — which is also where the border collapse belongs.\n * A caller composing a group out of `Button`, `Select` and `InputGroup` therefore\n * gets the same treatment without those components knowing about it.\n *\n * The group is a `role=\"group\"` with a label, because a screen reader announcing\n * four unrelated buttons where the sighted user sees one control is the failure\n * this prevents.\n */\nexport type ButtonGroupProps = ComponentProps<'div'> & {\n /** The group's accessible name. Required: a group with no name is announced as loose buttons. */\n label: string\n orientation?: 'horizontal' | 'vertical'\n}\n\nexport function ButtonGroup(props: ButtonGroupProps) {\n const [local, rest] = splitProps(props, ['class', 'label', 'orientation', 'children'])\n\n const horizontal = () => local.orientation !== 'vertical'\n\n return (\n <div\n data-slot=\"button-group\"\n role=\"group\"\n aria-label={local.label}\n class={cn(\n 'flex w-fit items-stretch',\n horizontal() ? 'flex-row' : 'flex-col',\n /* Ends keep their outer radius; everything between them is squared, and the\n seam is collapsed by pulling each item back over its neighbour's border. */\n horizontal()\n ? '[&>*:first-child]:rounded-e-none [&>*:last-child]:rounded-s-none [&>*:not(:first-child):not(:last-child)]:rounded-none [&>*:not(:first-child)]:-ms-px'\n : '[&>*:first-child]:rounded-b-none [&>*:last-child]:rounded-t-none [&>*:not(:first-child):not(:last-child)]:rounded-none [&>*:not(:first-child)]:-mt-px',\n local.class\n )}\n {...rest}\n >\n {local.children}\n </div>\n )\n}\n\n/**\n * A separator inside a group. `orientation` follows the group: a vertical rule in a\n * horizontal group, and the reverse.\n */\nexport function ButtonGroupSeparator(\n props: ComponentProps<typeof Separator> & { orientation?: 'horizontal' | 'vertical' }\n) {\n const [local, rest] = splitProps(props, ['class', 'orientation'])\n\n return (\n <Separator\n orientation={local.orientation ?? 'vertical'}\n class={cn('self-stretch', local.class)}\n {...rest}\n />\n )\n}\n\n/**\n * Static text in a group — a unit, a label, a readout that is not a control. It\n * takes the group's border and height so it sits in the row as a peer, but it is\n * not focusable and does not pretend to be.\n */\nexport function ButtonGroupText(props: ComponentProps<'div'>) {\n const [local, rest] = splitProps(props, ['class'])\n\n return (\n <div\n data-slot=\"button-group-text\"\n class={cn(\n 'bg-muted text-muted-foreground flex items-center gap-2 rounded-md border border-border px-control-sm text-sm',\n local.class\n )}\n {...rest}\n />\n )\n}\n"],"mappings":";;;;;;;AA4BA,SAAgBK,YAAYC,OAAyB;CACnD,MAAM,CAACC,OAAOC,QAAQR,WAAWM,OAAO;EAAC;EAAS;EAAS;EAAe;CAAU,CAAC;CAErF,MAAMG,mBAAmBF,MAAMH,gBAAgB;CAE/C,cAAA;EAAA,IAAAM,OAAAC,OAAA;EAAAC,OAAAF,MAAAG,WAAA;GAAA,KAAA,gBAAA;IAAA,OAIgBN,MAAMJ;GAAK;GAAA,KAAA,WAAA;IAAA,OAChBF,GACL,4BACAQ,WAAW,IAAI,aAAa,YAG5BA,WAAW,IACP,0JACA,yJACJF,MAAMO,KACR;GAAC;EAAA,GACGN,IAAI,GAAA,OAAA,IAAA;EAAAO,OAAAL,YAEPH,MAAMS,QAAQ;EAAA,OAAAN;CAAA,EAAA,CAAA;AAGrB;;;;;AAMA,SAAgBO,qBACdX,OACA;CACA,MAAM,CAACC,OAAOC,QAAQR,WAAWM,OAAO,CAAC,SAAS,aAAa,CAAC;CAEhE,OAAAY,gBACGhB,WAASW,WAAA;EAAA,IACRT,cAAW;GAAA,OAAEG,MAAMH,eAAe;EAAU;EAAA,KAAA,WAAA;GAAA,OACrCH,GAAG,gBAAgBM,MAAMO,KAAK;EAAC;CAAA,GAClCN,IAAI,CAAA;AAGd;;;;;;AAOA,SAAgBW,gBAAgBb,OAA8B;CAC5D,MAAM,CAACC,OAAOC,QAAQR,WAAWM,OAAO,CAAC,OAAO,CAAC;CAEjD,cAAA;EAAA,IAAAc,QAAAC,QAAA;EAAAT,OAAAQ,OAAAP,WAAA,EAAA,KAAA,WAAA;GAAA,OAGWZ,GACL,gHACAM,MAAMO,KACR;EAAC,EAAA,GACGN,IAAI,GAAA,OAAA,KAAA;EAAA,OAAAY;CAAA,EAAA,CAAA;AAGd"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calendar.js","names":["createMemo","For","Show","splitProps","ComponentProps","JSX","Calendar","RootProps","CorvuCalendarProps","RootSingleProps","CalendarMode","ChevronLeft","ChevronRight","cn","Button","CalendarExtras","weekdayLabels","previousLabel","nextLabel","formatMonth","month","Date","class","DistributiveOmit","PropertyKey","T","Omit","K","CalendarProps","EXTRAS","const","MONTH_FORMAT","Intl","DateTimeFormatOptions","year","defaultWeekdays","format","DateTimeFormat","undefined","weekday","Array","from","length","_","index","CalendarGrid","props","context","useContext","_$createComponent","each","months","children","weekdays","dayFormatter","day","monthLabel","date","_el$","_tmpl$3","_el$2","firstChild","_$insert","Nav","action","as","variant","size","aria-label","Label","Table","_el$3","_tmpl$","_el$4","label","HeadCell","scope","_el$5","_tmpl$2","weeks","week","_el$6","_tmpl$4","Cell","CellTrigger","_el$7","_tmpl$5","getDate","_el$8","_tmpl$6","CalendarSurface","mode","M","local","rest","_el$9","_tmpl$7","_$mergeProps","Extract","_$effect","_$className","DatePickerProps","footer","Element","DatePicker","_el$0","when","_el$1","_tmpl$8","value","onValueChange","_el$10","_tmpl$9","CalendarRoot","CalendarElementProps","_$createComponent","_$mergeProps","_$className"],"sources":["../../../../src/components/ui/calendar/calendar.tsx"],"sourcesContent":["import { createMemo, For, Show, splitProps, type ComponentProps, type JSX } from 'solid-js'\nimport Calendar, {\n type RootProps as CorvuCalendarProps,\n type RootSingleProps,\n} from '@corvu/calendar'\n\n/** The three modes corvu's calendar is a union over. */\nexport type CalendarMode = 'single' | 'multiple' | 'range'\nimport { ChevronLeft, ChevronRight } from 'lucide-solid'\nimport { cn } from '#lib/utils'\nimport { Button } from '../button'\n\n/**\n * Calendar.\n *\n * A month grid, over `@corvu/calendar`. The primitive owns the hard part — the\n * roving `tabindex` that makes a grid of days one tab stop rather than 42, the\n * arrow-key navigation, the `aria-selected`/`aria-disabled` bookkeeping, and the\n * `data-*` attributes that carry the states.\n *\n * What this component owns is the *presentation* of those states, and it is worth\n * saying why they are styled from `data-*` rather than from props: a day is today,\n * selected, in range, at a range end, and disabled independently, and a range\n * start that is also today has to read as both. Boolean props cannot express that\n * without a combinatorial explosion; the data attributes can.\n *\n * `mode` is the primitive's discriminated union — `single`, `multiple`, `range` —\n * so `value` and `onValueChange` change type with it. That is why this forwards\n * the props rather than normalising them: a normalised `Date[]` would lose what a\n * range needs to know which end moved.\n *\n * Three things the primitive leaves open, and this closes:\n *\n * 1. **The month caption is a heading**, wired to the grid's `aria-labelledby`, so\n * the grid has a name and a screen reader user can hear which month they are in.\n * 2. **The nav buttons have accessible names.** A bare chevron is not a name.\n * 3. **Today is a ring, not a fill.** A fill would be indistinguishable from\n * selected, and today is often also selected.\n *\n * The sub-components come off the default export as statics (`Calendar.Cell`,\n * `Calendar.CellTrigger`, …) — corvu's shape, and the reason this file does not\n * import seven names.\n */\n\n/**\n * The props this wrapper adds on top of the primitive's own. They are separate so\n * `splitProps` has a fixed list to pull out, and so the mode-specific props stay\n * the primitive's to define.\n */\ntype CalendarExtras = {\n /** Weekday header labels, Sunday first. Defaults to the locale's short names. */\n weekdayLabels?: readonly string[]\n /** Accessible names for the month navigation. Override for a non-English app. */\n previousLabel?: string\n nextLabel?: string\n /** Format a month for the caption. Defaults to `Intl.DateTimeFormat`. */\n formatMonth?: (month: Date) => string\n class?: string\n}\n\n/**\n * `Omit` distributes over a union, which would collapse the three modes into one\n * shape and lose the discriminant. This keeps them apart. `children` is dropped\n * because the surface supplies the grid itself — the caller's job is the value,\n * not the layout.\n */\ntype DistributiveOmit<T, K extends PropertyKey> = T extends unknown ? Omit<T, K> : never\n\n/** The props of any of the three modes. `mode` decides the shape of `value`. */\nexport type CalendarProps = DistributiveOmit<CorvuCalendarProps, 'children'> & CalendarExtras\n\nconst EXTRAS = ['weekdayLabels', 'previousLabel', 'nextLabel', 'formatMonth', 'class'] as const\n\nconst MONTH_FORMAT: Intl.DateTimeFormatOptions = { month: 'long', year: 'numeric' }\n\n/** The locale's short weekday names, Sunday first — which is the order corvu's `weeks` use. */\nfunction defaultWeekdays(): string[] {\n const format = new Intl.DateTimeFormat(undefined, { weekday: 'short' })\n // 2024-01-07 is a Sunday, so index 0 is Sunday without arithmetic.\n return Array.from({ length: 7 }, (_, index) => format.format(new Date(2024, 0, 7 + index)))\n}\n\n/**\n * The grid, inside the root's context. A separate component because\n * `Calendar.useContext` is only available to a descendant, and reading `months()`\n * in the same component that provides it renders one month behind.\n */\nfunction CalendarGrid(props: {\n weekdayLabels?: readonly string[]\n previousLabel: string\n nextLabel: string\n formatMonth?: (month: Date) => string\n}) {\n const context = Calendar.useContext()\n return (\n <For each={context.months()}>\n {(month, index) => {\n const weekdays = createMemo(() => props.weekdayLabels ?? defaultWeekdays())\n // Recreate per month so navigation picks up changed locale and time-zone defaults.\n const dayFormatter = new Intl.DateTimeFormat(undefined, {\n day: 'numeric',\n month: 'long',\n year: 'numeric',\n })\n const monthLabel = (date: Date) =>\n props.formatMonth\n ? props.formatMonth(date)\n : new Intl.DateTimeFormat(undefined, MONTH_FORMAT).format(date)\n return (\n <div class=\"flex flex-col gap-2\">\n <div class=\"flex items-center justify-between gap-2\">\n <Calendar.Nav\n action=\"prev-month\"\n as={Button}\n variant=\"ghost\"\n size=\"icon-sm\"\n aria-label={props.previousLabel}\n >\n <ChevronLeft aria-hidden=\"true\" />\n </Calendar.Nav>\n <Calendar.Label index={index()} class=\"text-sm font-semibold text-foreground\">\n {monthLabel(month.month)}\n </Calendar.Label>\n <Calendar.Nav\n action=\"next-month\"\n as={Button}\n variant=\"ghost\"\n size=\"icon-sm\"\n aria-label={props.nextLabel}\n >\n <ChevronRight aria-hidden=\"true\" />\n </Calendar.Nav>\n </div>\n <Calendar.Table class=\"w-full border-collapse\">\n <thead>\n <tr>\n <For each={weekdays()}>\n {(label) => (\n <Calendar.HeadCell\n as=\"th\"\n scope=\"col\"\n class=\"pb-1 text-2xs font-medium text-muted-foreground\"\n >\n {label}\n </Calendar.HeadCell>\n )}\n </For>\n </tr>\n </thead>\n <tbody>\n <For each={month.weeks}>\n {(week) => (\n <tr>\n <For each={week}>\n {(day) => (\n <Calendar.Cell as=\"td\" class=\"p-0.5 text-center\">\n <Calendar.CellTrigger\n as=\"button\"\n day={day}\n month={month.month}\n class={cn(\n 'w-full rounded-md text-xs text-foreground transition-colors',\n 'min-h-control-xs',\n 'hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none',\n // Styled from data states, so a day can be a range\n // end and today at once without a prop per pair.\n 'data-selected:bg-primary data-selected:text-primary-foreground',\n // corvu marks every day of a range selected, so the\n // span between the ends steps back to the subtle\n // fill and the ends take the solid one again.\n 'data-in-range:bg-primary-subtle data-in-range:text-foreground',\n 'data-range-start:bg-primary data-range-start:text-primary-foreground',\n 'data-range-end:bg-primary data-range-end:text-primary-foreground',\n 'data-range-start:rounded-r-none data-range-end:rounded-l-none',\n 'data-today:ring-1 data-today:ring-ring',\n 'data-disabled:text-muted-foreground data-disabled:line-through',\n 'data-disabled:hover:bg-transparent'\n )}\n >\n {/*\n The trigger renders no children of its own, so the\n day number is the caller's — without it every cell\n is an unnamed button (`button-name`).\n\n The number is what a sighted reader needs and the\n full date is what a screen reader user needs: \"25\"\n alone is meaningless out of context. So the number\n is hidden from the accessibility tree and the date\n supplies the name.\n */}\n <span aria-hidden=\"true\">{day.getDate()}</span>\n <span class=\"visually-hidden\">{dayFormatter.format(day)}</span>\n </Calendar.CellTrigger>\n </Calendar.Cell>\n )}\n </For>\n </tr>\n )}\n </For>\n </tbody>\n </Calendar.Table>\n </div>\n )\n }}\n </For>\n )\n}\n\n/**\n * Generic over the mode on purpose. `splitProps` cannot carry a discriminant\n * through destructuring — the rest object widens to `mode: 'single' | 'multiple' |\n * 'range'`, which is assignable to no single member of the primitive's union. A\n * type parameter keeps `mode` a literal, so `Extract` resolves the right member\n * and the forwarding stays checked rather than cast.\n */\nexport function CalendarSurface<M extends CalendarMode>(props: CalendarProps & { mode: M }) {\n const [local, rest] = splitProps(props as CalendarProps, [...EXTRAS])\n\n return (\n <div class={cn('w-fit rounded-lg border border-border bg-card p-3', local.class)}>\n <Calendar {...(rest as Extract<CorvuCalendarProps, { mode: M }>)}>\n <CalendarGrid\n weekdayLabels={local.weekdayLabels}\n previousLabel={local.previousLabel ?? 'Previous month'}\n nextLabel={local.nextLabel ?? 'Next month'}\n formatMonth={local.formatMonth}\n />\n </Calendar>\n </div>\n )\n}\n\n/**\n * Built from the primitive's *single* props rather than from `CalendarProps` with\n * `mode` omitted. Omitting a discriminant leaves the other members of the union\n * behind — `value` stays `Date | Date[] | {from,to}` — and the picker would then\n * have to cast to prove what its own name already says.\n */\nexport type DatePickerProps = Omit<RootSingleProps, 'mode' | 'children'> &\n CalendarExtras & {\n /** A labelled heading above the grid. */\n label?: string\n /** A footer slot: the confirm and cancel row a picker usually has. */\n footer?: JSX.Element\n }\n\n/**\n * A single-day picker: the calendar with a name and a footer. Split from\n * `CalendarSurface` because a bare calendar is a control inside a form the caller\n * already owns, while a picker is a thing the caller drops in — and the two want\n * different surroundings.\n */\nexport function DatePicker(props: DatePickerProps) {\n const [local, rest] = splitProps(props, ['value', 'onValueChange', 'label', 'footer', 'class'])\n\n return (\n <div class={cn('grid w-fit gap-2', local.class)}>\n <Show when={local.label}>\n <p class=\"text-xs font-semibold text-foreground\">{local.label}</p>\n </Show>\n <CalendarSurface\n {...rest}\n mode=\"single\"\n value={local.value}\n onValueChange={local.onValueChange}\n />\n <Show when={local.footer}>\n <div class=\"flex justify-end gap-2\">{local.footer}</div>\n </Show>\n </div>\n )\n}\n\n/** Re-exported so a caller can type a value it holds. */\nexport type { CalendarProps as CorvuCalendarProps }\nexport { Calendar as CalendarRoot }\nexport type CalendarElementProps = ComponentProps<'div'>\n"],"mappings":";;;;;;;;;;;;;;;;AAuEA,IAAM6B,SAAS;CAAC;CAAiB;CAAiB;CAAa;CAAe;AAAO;AAErF,IAAME,eAA2C;CAAEX,OAAO;CAAQc,MAAM;AAAU;;AAGlF,SAASC,kBAA4B;CACnC,MAAMC,SAAS,IAAIJ,KAAKK,eAAeC,KAAAA,GAAW,EAAEC,SAAS,QAAQ,CAAC;CAEtE,OAAOC,MAAMC,KAAK,EAAEC,QAAQ,EAAE,IAAIC,GAAGC,UAAUR,OAAOA,OAAO,IAAIf,KAAK,MAAM,GAAG,IAAIuB,KAAK,CAAC,CAAC;AAC5F;;;;;;AAOA,SAASC,aAAaC,OAKnB;CACD,MAAMC,UAAUzC,SAAS0C,WAAW;CACpC,OAAAC,gBACGhD,KAAG;EAAA,IAACiD,OAAI;GAAA,OAAEH,QAAQI,OAAO;EAAC;EAAAC,WACvBhC,OAAOwB,UAAU;GACjB,MAAMS,WAAWrD,iBAAiB8C,MAAM9B,iBAAiBmB,gBAAgB,CAAC;GAE1E,MAAMmB,eAAe,IAAItB,KAAKK,eAAeC,KAAAA,GAAW;IACtDiB,KAAK;IACLnC,OAAO;IACPc,MAAM;GACR,CAAC;GACD,MAAMsB,cAAcC,SAClBX,MAAM3B,cACF2B,MAAM3B,YAAYsC,IAAI,IACtB,IAAIzB,KAAKK,eAAeC,KAAAA,GAAWP,YAAY,CAAC,CAACK,OAAOqB,IAAI;GAClE,cAAA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EAAA,CAAA;AAenD"}
|
|
1
|
+
{"version":3,"file":"calendar.js","names":["createMemo","For","Show","splitProps","Calendar","ChevronLeft","ChevronRight","cn","Button","weekdayLabels","previousLabel","nextLabel","formatMonth","month","Date","class","EXTRAS","MONTH_FORMAT","Intl","year","defaultWeekdays","format","DateTimeFormat","undefined","weekday","Array","from","length","_","index","CalendarGrid","props","context","useContext","_$createComponent","each","months","children","weekdays","dayFormatter","day","monthLabel","date","_el$","_tmpl$3","_el$2","firstChild","_$insert","Nav","action","as","variant","size","Label","Table","_el$3","_tmpl$","_el$4","label","HeadCell","scope","_el$5","_tmpl$2","weeks","week","_el$6","_tmpl$4","Cell","CellTrigger","_el$7","_tmpl$5","getDate","_el$8","_tmpl$6","CalendarSurface","mode","local","rest","_el$9","_tmpl$7","_$mergeProps","_$effect","_$className","footer","DatePicker","_el$0","when","_el$1","_tmpl$8","value","onValueChange","_el$10","_tmpl$9"],"sources":["../../../../src/components/ui/calendar/calendar.tsx"],"sourcesContent":["import { createMemo, For, Show, splitProps, type ComponentProps, type JSX } from 'solid-js'\nimport Calendar, {\n type RootProps as CorvuCalendarProps,\n type RootSingleProps,\n} from '@corvu/calendar'\n\n/** The three modes corvu's calendar is a union over. */\nexport type CalendarMode = 'single' | 'multiple' | 'range'\nimport { ChevronLeft, ChevronRight } from 'lucide-solid'\nimport { cn } from '#lib/utils'\nimport { Button } from '../button'\n\n/**\n * Calendar.\n *\n * A month grid, over `@corvu/calendar`. The primitive owns the hard part — the\n * roving `tabindex` that makes a grid of days one tab stop rather than 42, the\n * arrow-key navigation, the `aria-selected`/`aria-disabled` bookkeeping, and the\n * `data-*` attributes that carry the states.\n *\n * What this component owns is the *presentation* of those states, and it is worth\n * saying why they are styled from `data-*` rather than from props: a day is today,\n * selected, in range, at a range end, and disabled independently, and a range\n * start that is also today has to read as both. Boolean props cannot express that\n * without a combinatorial explosion; the data attributes can.\n *\n * `mode` is the primitive's discriminated union — `single`, `multiple`, `range` —\n * so `value` and `onValueChange` change type with it. That is why this forwards\n * the props rather than normalising them: a normalised `Date[]` would lose what a\n * range needs to know which end moved.\n *\n * Three things the primitive leaves open, and this closes:\n *\n * 1. **The month caption is a heading**, wired to the grid's `aria-labelledby`, so\n * the grid has a name and a screen reader user can hear which month they are in.\n * 2. **The nav buttons have accessible names.** A bare chevron is not a name.\n * 3. **Today is a ring, not a fill.** A fill would be indistinguishable from\n * selected, and today is often also selected.\n *\n * The sub-components come off the default export as statics (`Calendar.Cell`,\n * `Calendar.CellTrigger`, …) — corvu's shape, and the reason this file does not\n * import seven names.\n */\n\n/**\n * The props this wrapper adds on top of the primitive's own. They are separate so\n * `splitProps` has a fixed list to pull out, and so the mode-specific props stay\n * the primitive's to define.\n */\ntype CalendarExtras = {\n /** Weekday header labels, Sunday first. Defaults to the locale's short names. */\n weekdayLabels?: readonly string[]\n /** Accessible names for the month navigation. Override for a non-English app. */\n previousLabel?: string\n nextLabel?: string\n /** Format a month for the caption. Defaults to `Intl.DateTimeFormat`. */\n formatMonth?: (month: Date) => string\n class?: string\n}\n\n/**\n * `Omit` distributes over a union, which would collapse the three modes into one\n * shape and lose the discriminant. This keeps them apart. `children` is dropped\n * because the surface supplies the grid itself — the caller's job is the value,\n * not the layout.\n */\ntype DistributiveOmit<T, K extends PropertyKey> = T extends unknown ? Omit<T, K> : never\n\n/** The props of any of the three modes. `mode` decides the shape of `value`. */\nexport type CalendarProps = DistributiveOmit<CorvuCalendarProps, 'children'> & CalendarExtras\n\nconst EXTRAS = ['weekdayLabels', 'previousLabel', 'nextLabel', 'formatMonth', 'class'] as const\n\nconst MONTH_FORMAT: Intl.DateTimeFormatOptions = { month: 'long', year: 'numeric' }\n\n/** The locale's short weekday names, Sunday first — which is the order corvu's `weeks` use. */\nfunction defaultWeekdays(): string[] {\n const format = new Intl.DateTimeFormat(undefined, { weekday: 'short' })\n // 2024-01-07 is a Sunday, so index 0 is Sunday without arithmetic.\n return Array.from({ length: 7 }, (_, index) => format.format(new Date(2024, 0, 7 + index)))\n}\n\n/**\n * The grid, inside the root's context. A separate component because\n * `Calendar.useContext` is only available to a descendant, and reading `months()`\n * in the same component that provides it renders one month behind.\n */\nfunction CalendarGrid(props: {\n weekdayLabels?: readonly string[]\n previousLabel: string\n nextLabel: string\n formatMonth?: (month: Date) => string\n}) {\n const context = Calendar.useContext()\n return (\n <For each={context.months()}>\n {(month, index) => {\n const weekdays = createMemo(() => props.weekdayLabels ?? defaultWeekdays())\n // Recreate per month so navigation picks up changed locale and time-zone defaults.\n const dayFormatter = new Intl.DateTimeFormat(undefined, {\n day: 'numeric',\n month: 'long',\n year: 'numeric',\n })\n const monthLabel = (date: Date) =>\n props.formatMonth\n ? props.formatMonth(date)\n : new Intl.DateTimeFormat(undefined, MONTH_FORMAT).format(date)\n return (\n <div class=\"flex flex-col gap-2\">\n <div class=\"flex items-center justify-between gap-2\">\n <Calendar.Nav\n action=\"prev-month\"\n as={Button}\n variant=\"ghost\"\n size=\"icon-sm\"\n aria-label={props.previousLabel}\n >\n <ChevronLeft aria-hidden=\"true\" />\n </Calendar.Nav>\n <Calendar.Label index={index()} class=\"text-sm font-semibold text-foreground\">\n {monthLabel(month.month)}\n </Calendar.Label>\n <Calendar.Nav\n action=\"next-month\"\n as={Button}\n variant=\"ghost\"\n size=\"icon-sm\"\n aria-label={props.nextLabel}\n >\n <ChevronRight aria-hidden=\"true\" />\n </Calendar.Nav>\n </div>\n <Calendar.Table class=\"w-full border-collapse\">\n <thead>\n <tr>\n <For each={weekdays()}>\n {(label) => (\n <Calendar.HeadCell\n as=\"th\"\n scope=\"col\"\n class=\"pb-1 text-2xs font-medium text-muted-foreground\"\n >\n {label}\n </Calendar.HeadCell>\n )}\n </For>\n </tr>\n </thead>\n <tbody>\n <For each={month.weeks}>\n {(week) => (\n <tr>\n <For each={week}>\n {(day) => (\n <Calendar.Cell as=\"td\" class=\"p-0.5 text-center\">\n <Calendar.CellTrigger\n as=\"button\"\n day={day}\n month={month.month}\n class={cn(\n 'w-full rounded-md text-xs text-foreground transition-colors',\n 'min-h-control-xs',\n 'hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none',\n // Styled from data states, so a day can be a range\n // end and today at once without a prop per pair.\n 'data-selected:bg-primary data-selected:text-primary-foreground',\n // corvu marks every day of a range selected, so the\n // span between the ends steps back to the subtle\n // fill and the ends take the solid one again.\n 'data-in-range:bg-primary-subtle data-in-range:text-foreground',\n 'data-range-start:bg-primary data-range-start:text-primary-foreground',\n 'data-range-end:bg-primary data-range-end:text-primary-foreground',\n 'data-range-start:rounded-r-none data-range-end:rounded-l-none',\n 'data-today:ring-1 data-today:ring-ring',\n 'data-disabled:text-muted-foreground data-disabled:line-through',\n 'data-disabled:hover:bg-transparent'\n )}\n >\n {/*\n The trigger renders no children of its own, so the\n day number is the caller's — without it every cell\n is an unnamed button (`button-name`).\n\n The number is what a sighted reader needs and the\n full date is what a screen reader user needs: \"25\"\n alone is meaningless out of context. So the number\n is hidden from the accessibility tree and the date\n supplies the name.\n */}\n <span aria-hidden=\"true\">{day.getDate()}</span>\n <span class=\"visually-hidden\">{dayFormatter.format(day)}</span>\n </Calendar.CellTrigger>\n </Calendar.Cell>\n )}\n </For>\n </tr>\n )}\n </For>\n </tbody>\n </Calendar.Table>\n </div>\n )\n }}\n </For>\n )\n}\n\n/**\n * Generic over the mode on purpose. `splitProps` cannot carry a discriminant\n * through destructuring — the rest object widens to `mode: 'single' | 'multiple' |\n * 'range'`, which is assignable to no single member of the primitive's union. A\n * type parameter keeps `mode` a literal, so `Extract` resolves the right member\n * and the forwarding stays checked rather than cast.\n */\nexport function CalendarSurface<M extends CalendarMode>(props: CalendarProps & { mode: M }) {\n const [local, rest] = splitProps(props as CalendarProps, [...EXTRAS])\n\n return (\n <div class={cn('w-fit rounded-lg border border-border bg-card p-3', local.class)}>\n <Calendar {...(rest as Extract<CorvuCalendarProps, { mode: M }>)}>\n <CalendarGrid\n weekdayLabels={local.weekdayLabels}\n previousLabel={local.previousLabel ?? 'Previous month'}\n nextLabel={local.nextLabel ?? 'Next month'}\n formatMonth={local.formatMonth}\n />\n </Calendar>\n </div>\n )\n}\n\n/**\n * Built from the primitive's *single* props rather than from `CalendarProps` with\n * `mode` omitted. Omitting a discriminant leaves the other members of the union\n * behind — `value` stays `Date | Date[] | {from,to}` — and the picker would then\n * have to cast to prove what its own name already says.\n */\nexport type DatePickerProps = Omit<RootSingleProps, 'mode' | 'children'> &\n CalendarExtras & {\n /** A labelled heading above the grid. */\n label?: string\n /** A footer slot: the confirm and cancel row a picker usually has. */\n footer?: JSX.Element\n }\n\n/**\n * A single-day picker: the calendar with a name and a footer. Split from\n * `CalendarSurface` because a bare calendar is a control inside a form the caller\n * already owns, while a picker is a thing the caller drops in — and the two want\n * different surroundings.\n */\nexport function DatePicker(props: DatePickerProps) {\n const [local, rest] = splitProps(props, ['value', 'onValueChange', 'label', 'footer', 'class'])\n\n return (\n <div class={cn('grid w-fit gap-2', local.class)}>\n <Show when={local.label}>\n <p class=\"text-xs font-semibold text-foreground\">{local.label}</p>\n </Show>\n <CalendarSurface\n {...rest}\n mode=\"single\"\n value={local.value}\n onValueChange={local.onValueChange}\n />\n <Show when={local.footer}>\n <div class=\"flex justify-end gap-2\">{local.footer}</div>\n </Show>\n </div>\n )\n}\n\n/** Re-exported so a caller can type a value it holds. */\nexport type { CalendarProps as CorvuCalendarProps }\nexport { Calendar as CalendarRoot }\nexport type CalendarElementProps = ComponentProps<'div'>\n"],"mappings":";;;;;;;;;;;;;;;;AAuEA,IAAMgB,SAAS;CAAC;CAAiB;CAAiB;CAAa;CAAe;AAAO;AAErF,IAAMC,eAA2C;CAAEJ,OAAO;CAAQM,MAAM;AAAU;;AAGlF,SAASC,kBAA4B;CACnC,MAAMC,SAAS,IAAIH,KAAKI,eAAeC,KAAAA,GAAW,EAAEC,SAAS,QAAQ,CAAC;CAEtE,OAAOC,MAAMC,KAAK,EAAEC,QAAQ,EAAE,IAAIC,GAAGC,UAAUR,OAAOA,OAAO,IA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B,KAAK;IAAA,OAAA6B;GAAA;EAAA,CAAA,GAAA,IAAA;EAAAxC,OAAAsC,OAAAnD,gBAE9DwC,iBAAeM,WACVH,MAAI;GACRF,MAAI;GAAA,IACJc,QAAK;IAAA,OAAEb,MAAMa;GAAK;GAAA,IAClBC,gBAAa;IAAA,OAAEd,MAAMc;GAAa;EAAA,CAAA,CAAA,GAAA,IAAA;EAAA3C,OAAAsC,OAAAnD,gBAEnChC,MAAI;GAAA,IAACoF,OAAI;IAAA,OAAEV,MAAMO;GAAM;GAAA,IAAA9C,WAAA;IAAA,IAAAsD,SAAAC,QAAA;IAAA7C,OAAA4C,cACef,MAAMO,MAAM;IAAA,OAAAQ;GAAA;EAAA,CAAA,GAAA,IAAA;EAAAV,aAAAC,UAAAG,OAXzC9E,GAAG,oBAAoBqE,MAAM7D,KAAK,CAAC,CAAA;EAAA,OAAAsE;CAAA,EAAA,CAAA;AAenD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"callout.js","names":["
|
|
1
|
+
{"version":3,"file":"callout.js","names":["children","createMemo","splitProps","cva","cn","calloutVariants","variants","variant","default","destructive","success","warning","info","size","sm","md","lg","defaultVariants","isRendered","node","trim","isCalloutTitle","getAttribute","Callout","props","local","rest","resolved","titleOnly","nodes","toArray","filter","length","_el$","_tmpl$","_$spread","_$mergeProps","undefined","class","_$insert","CalloutTitle","_el$2","_tmpl$2"],"sources":["../../../../src/components/ui/callout/callout.tsx"],"sourcesContent":["import type { ComponentProps } from 'solid-js'\nimport { children, createMemo, splitProps } from 'solid-js'\nimport { cva, type VariantProps } from '#lib/variants'\nimport { cn } from '#lib/utils'\n\n/**\n * Callout.\n *\n * A quiet aside that belongs to the content around it: the summary at the top of\n * an answer, a note in documentation, a remembered fact beside the reply that\n * used it. It is a card-coloured block with one rule on its start edge, and\n * nothing about it interrupts the reader.\n *\n * That is the difference from `Alert`. An `Alert` is a message about the state of\n * the surface it sits in — a failed sync, a validation summary — so it is always\n * `role=\"alert\"`, a live announcement, with a tone glyph and a tinted status\n * surface. A callout is static page content: a plain `div` with `role=\"note\"`, no\n * live region, no icon, and no tint. A caller whose note really is a status\n * message uses `Alert`; one whose note needs a different landmark role passes\n * `role`. Reach for `Card` when the block is a self-contained object with its own\n * header, content and footer; a callout has no parts beyond an optional\n * `CalloutTitle`.\n *\n * The rule is the only thing that varies by `variant`: `default` is the accent\n * (`--primary`), and the four status hues use the same tokens `Alert` does. The\n * rule is a logical `border-s-*`, so it moves to the right in RTL. The corners\n * stay square because a rounded box would curve the rule into a crescent.\n *\n * `size` is the padding rung and the rule's weight together, so a caller never\n * sets `p-*` or a border width to make one denser. The rungs are Cortana's three\n * answer-view callouts, expressed in the Tailwind spacing scale:\n *\n * - `lg`: 22px / 24px padding, 3px rule — Cortana's `.answer-copy`.\n * - `md`: 18px / 20px padding, 3px rule — Cortana's `.answer-memory`.\n * - `sm`: 12px / 14px padding, 2px rule — Cortana's `.answer-note`.\n *\n * Type size and colour are inherited rather than set (only the card foreground is\n * applied), so a callout in a dense panel and one in an article both read at the\n * size of the text around them.\n *\n * Text that has no break opportunity (a 200-character token, a URL, a file path)\n * wraps with `overflow-wrap: anywhere` rather than overflowing the box. `anywhere`\n * and not `break-word`, because only `anywhere` lowers the box's min-content width:\n * a callout that is a flex or grid item (auto minimum size) then shrinks to its\n * track instead of stretching it. The callout's own padding, rule and width are\n * untouched, so none of its sizing differs from Cortana's.\n *\n * The block is deliberately not a flex or grid container: its children are inline\n * text, links and code, and a flex root would turn each of those into a separate\n * item and break the line.\n */\nexport const calloutVariants = cva(\n 'bg-card text-card-foreground block rounded-none wrap-anywhere',\n {\n variants: {\n variant: {\n default: 'border-s-primary',\n destructive: 'border-s-destructive',\n success: 'border-s-success',\n warning: 'border-s-warning',\n info: 'border-s-info',\n },\n size: {\n /** 12px block / 14px inline padding, 2px rule: a short inline note. */\n sm: 'border-s-2 px-3.5 py-3',\n /** 18px block / 20px inline padding, 3px rule: a supporting aside. */\n md: 'border-s-3 px-5 py-4.5',\n /** 22px block / 24px inline padding, 3px rule: the lead summary of a view. */\n lg: 'border-s-3 px-6 py-5.5',\n },\n },\n defaultVariants: { variant: 'default', size: 'md' },\n }\n)\n\nexport type CalloutProps = ComponentProps<'div'> & VariantProps<typeof calloutVariants>\n\nconst isRendered = (node: unknown) =>\n node != null && typeof node !== 'boolean' && (typeof node !== 'string' || node.trim() !== '')\n\nconst isCalloutTitle = (node: unknown) =>\n typeof node === 'object' &&\n node !== null &&\n 'getAttribute' in node &&\n typeof node.getAttribute === 'function' &&\n node.getAttribute('data-slot') === 'callout-title'\n\nexport function Callout(props: CalloutProps) {\n const [local, rest] = splitProps(props, ['class', 'variant', 'size', 'children'])\n const resolved = children(() => local.children)\n // CSS cannot see text nodes, so the callout looks at what it renders and marks a\n // title with nothing after it. The title reads the mark to drop its bottom margin.\n const titleOnly = createMemo(() => {\n const nodes = resolved.toArray().filter(isRendered)\n return nodes.length === 1 && isCalloutTitle(nodes[0])\n })\n return (\n <div\n data-slot=\"callout\"\n data-title-only={titleOnly() ? '' : undefined}\n role=\"note\"\n class={cn(calloutVariants({ variant: local.variant, size: local.size }), local.class)}\n {...rest}\n >\n {resolved()}\n </div>\n )\n}\n\n/**\n * An optional heading line for the callout. It is a styled `div`, not a heading\n * element: a callout sits inside someone else's outline, and a fixed heading\n * level would break it. Pass `role=\"heading\"` with `aria-level` where the\n * content does belong in the outline.\n *\n * The title carries a 4px (`mb-1`) margin below it, whatever follows: a\n * paragraph, a list, or bare text. CSS cannot see text nodes, so a selector such\n * as `:last-child` or `:only-child` cannot tell `<Title/>text` (needs the gap)\n * from `<Title/>` (needs none), and `not-last:mb-1` silently dropped the gap for\n * bare text, the most common body. So the gap stays the default and the one case\n * that does not want it is detected by `Callout`, which sees its rendered\n * children: a callout whose only child is a title carries `data-title-only`, and\n * the title drops its margin so the block ends at its own padding. A caller never\n * passes `mb-0` for this. Anything else after the title, text included, keeps the\n * gap.\n */\nexport function CalloutTitle(props: ComponentProps<'div'>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <div\n data-slot=\"callout-title\"\n class={cn('mb-1 font-medium tracking-tight in-data-title-only:mb-0', local.class)}\n {...rest}\n />\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmDA,IAAaK,kBAAkBF,IAC7B,iEACA;CACEG,UAAU;EACRC,SAAS;GACPC,SAAS;GACTC,aAAa;GACbC,SAAS;GACTC,SAAS;GACTC,MAAM;EACR;EACAC,MAAM;;GAEJC,IAAI;;GAEJC,IAAI;;GAEJC,IAAI;EACN;CACF;CACAC,iBAAiB;EAAEV,SAAS;EAAWM,MAAM;CAAK;AACpD,CACF;AAIA,IAAMK,cAAcC,SAClBA,QAAQ,QAAQ,OAAOA,SAAS,cAAc,OAAOA,SAAS,YAAYA,KAAKC,KAAK,MAAM;AAE5F,IAAMC,kBAAkBF,SACtB,OAAOA,SAAS,YAChBA,SAAS,QACT,kBAAkBA,QAClB,OAAOA,KAAKG,iBAAiB,cAC7BH,KAAKG,aAAa,WAAW,MAAM;AAErC,SAAgBC,QAAQC,OAAqB;CAC3C,MAAM,CAACC,OAAOC,QAAQxB,WAAWsB,OAAO;EAAC;EAAS;EAAW;EAAQ;CAAU,CAAC;CAChF,MAAMG,WAAW3B,eAAeyB,MAAMzB,QAAQ;CAG9C,MAAM4B,YAAY3B,iBAAiB;EACjC,MAAM4B,QAAQF,SAASG,QAAQ,CAAC,CAACC,OAAOb,UAAU;EAClD,OAAOW,MAAMG,WAAW,KAAKX,eAAeQ,MAAM,EAAE;CACtD,CAAC;CACD,cAAA;EAAA,IAAAI,OAAAC,OAAA;EAAAC,OAAAF,MAAAG,WAAA;GAAA,KAAA,qBAAA;IAAA,OAGqBR,UAAU,IAAI,KAAKS,KAAAA;GAAS;GAAA,KAAA,WAAA;IAAA,OAEtCjC,GAAGC,gBAAgB;KAAEE,SAASkB,MAAMlB;KAASM,MAAMY,MAAMZ;IAAK,CAAC,GAAGY,MAAMa,KAAK;GAAC;EAAA,GACjFZ,IAAI,GAAA,OAAA,IAAA;EAAAa,OAAAN,MAEPN,QAAQ;EAAA,OAAAM;CAAA,EAAA,CAAA;AAGf;;;;;;;;;;;;;;;;;;AAmBA,SAAgBO,aAAahB,OAA8B;CACzD,MAAM,CAACC,OAAOC,QAAQxB,WAAWsB,OAAO,CAAC,OAAO,CAAC;CACjD,cAAA;EAAA,IAAAiB,QAAAC,QAAA;EAAAP,OAAAM,OAAAL,WAAA,EAAA,KAAA,WAAA;GAAA,OAGWhC,GAAG,2DAA2DqB,MAAMa,KAAK;EAAC,EAAA,GAC7EZ,IAAI,GAAA,OAAA,KAAA;EAAA,OAAAe;CAAA,EAAA,CAAA;AAGd"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"card.js","names":["
|
|
1
|
+
{"version":3,"file":"card.js","names":["splitProps","cva","cn","headingVariants","cardVariants","variants","size","default","sm","flush","defaultVariants","Card","props","local","rest","_el$","_tmpl$","_$spread","_$mergeProps","class","CardHeader","_el$2","_tmpl$2","CardTitle","_el$3","_tmpl$3","leading","CardDescription","_el$4","_tmpl$4","CardAction","_el$5","_tmpl$5","CardContent","_el$6","_tmpl$6","CardFooter","_el$7","_tmpl$7"],"sources":["../../../../src/components/ui/card/card.tsx"],"sourcesContent":["import type { ComponentProps } from 'solid-js'\nimport { splitProps } from 'solid-js'\nimport { cva, type VariantProps } from '#lib/variants'\nimport { cn } from '#lib/utils'\nimport { headingVariants } from '../typography'\n\n/**\n * Card.\n *\n * A surface that sits on the canvas. Every card carries its own edge — a\n * border — because in the light theme `--card` is one faint step off a white\n * `--background`, and a borderless card there all but disappears. Making the border\n * structural rather than optional is what stops one app's cards from reading\n * as floating panels and another's as nothing at all.\n *\n * The parts are separate components rather than a template because a card's\n * header, content and footer have different padding on purpose: the header and\n * footer are tight, the content breathes.\n *\n * `size` is the card's padding rung, so a caller never sets `p-*` or `gap-*` on\n * a card to make it denser. `sm` tightens the card and its header, content and\n * footer together (the parts' inline padding follows the card, so they stay\n * aligned with each other); `flush` removes the block padding and gap for a\n * card whose body is a list of rows or a scroll area that runs edge to edge.\n */\nexport const cardVariants = cva(\n 'bg-card text-card-foreground flex flex-col rounded-xl border border-border shadow-xs',\n {\n variants: {\n size: {\n /** 16px block padding and gap; the parts carry 16px inline padding. */\n default: 'gap-4 py-4',\n /** 12px everywhere: a dense settings or status card. */\n sm: 'gap-3 py-3 *:data-[slot=card-content]:px-3 *:data-[slot=card-footer]:px-3 *:data-[slot=card-header]:px-3',\n /** No block padding or gap: the card hosts a row list or a scroller. */\n flush: 'gap-0 py-0',\n },\n },\n defaultVariants: { size: 'default' },\n }\n)\n\nexport type CardProps = ComponentProps<'div'> & VariantProps<typeof cardVariants>\n\nexport function Card(props: CardProps) {\n const [local, rest] = splitProps(props, ['class', 'size'])\n return (\n <div data-slot=\"card\" class={cn(cardVariants({ size: local.size }), local.class)} {...rest} />\n )\n}\n\n/**\n * The header is a grid so that `CardAction` has tracks to be placed in: the\n * action is a direct child that takes a second column spanning the title and\n * description rows. A flex column gives `col-start-2` nothing to land on and\n * the action would simply stack under the copy. The extra column exists only\n * for a direct-child action: a wrapper around it is then the header's single\n * grid item, so it keeps the full width. A header without an action lays out as\n * it always did (one full-width column, 4px between its children).\n */\nexport function CardHeader(props: ComponentProps<'div'>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <div\n data-slot=\"card-header\"\n class={cn(\n 'grid grid-cols-1 auto-rows-min gap-x-4 gap-y-1 px-4 has-[>[data-slot=card-action]]:grid-cols-[minmax(0,1fr)_auto]',\n local.class\n )}\n {...rest}\n />\n )\n}\n\nexport function CardTitle(props: ComponentProps<'div'>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <div\n data-slot=\"card-title\"\n class={cn(headingVariants({ size: 'card', leading: 'none' }), local.class)}\n {...rest}\n />\n )\n}\n\nexport function CardDescription(props: ComponentProps<'div'>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <div\n data-slot=\"card-description\"\n class={cn('text-muted-foreground text-sm', local.class)}\n {...rest}\n />\n )\n}\n\nexport function CardAction(props: ComponentProps<'div'>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <div\n data-slot=\"card-action\"\n class={cn('col-start-2 row-span-2 row-start-1 self-start justify-self-end', local.class)}\n {...rest}\n />\n )\n}\n\nexport function CardContent(props: ComponentProps<'div'>) {\n const [local, rest] = splitProps(props, ['class'])\n return <div data-slot=\"card-content\" class={cn('px-4', local.class)} {...rest} />\n}\n\nexport function CardFooter(props: ComponentProps<'div'>) {\n const [local, rest] = splitProps(props, ['class'])\n return <div data-slot=\"card-footer\" class={cn('flex items-center px-4', local.class)} {...rest} />\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,IAAaI,eAAeH,IAC1B,wFACA;CACEI,UAAU,EACRC,MAAM;;EAEJC,SAAS;;EAETC,IAAI;;EAEJC,OAAO;CACT,EACF;CACAC,iBAAiB,EAAEJ,MAAM,UAAU;AACrC,CACF;AAIA,SAAgBK,KAAKC,OAAkB;CACrC,MAAM,CAACC,OAAOC,QAAQd,WAAWY,OAAO,CAAC,SAAS,MAAM,CAAC;CACzD,cAAA;EAAA,IAAAG,OAAAC,OAAA;EAAAC,OAAAF,MAAAG,WAAA,EAAA,KAAA,WAAA;GAAA,OAC+BhB,GAAGE,aAAa,EAAEE,MAAMO,MAAMP,KAAK,CAAC,GAAGO,MAAMM,KAAK;EAAC,EAAA,GAAML,IAAI,GAAA,OAAA,KAAA;EAAA,OAAAC;CAAA,EAAA,CAAA;AAE9F;;;;;;;;;;AAWA,SAAgBK,WAAWR,OAA8B;CACvD,MAAM,CAACC,OAAOC,QAAQd,WAAWY,OAAO,CAAC,OAAO,CAAC;CACjD,cAAA;EAAA,IAAAS,QAAAC,QAAA;EAAAL,OAAAI,OAAAH,WAAA,EAAA,KAAA,WAAA;GAAA,OAGWhB,GACL,qHACAW,M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GAAA,OAA4ChB,GAAG,QAAQW,MAAMM,KAAK;EAAC,EAAA,GAAML,IAAI,GAAA,OAAA,KAAA;EAAA,OAAAoB;CAAA,EAAA,CAAA;AAC/E;AAEA,SAAgBE,WAAWxB,OAA8B;CACvD,MAAM,CAACC,OAAOC,QAAQd,WAAWY,OAAO,CAAC,OAAO,CAAC;CACjD,cAAA;EAAA,IAAAyB,QAAAC,QAAA;EAAArB,OAAAoB,OAAAnB,WAAA,EAAA,KAAA,WAAA;GAAA,OAA2ChB,GAAG,0BAA0BW,MAAMM,KAAK;EAAC,EAAA,GAAML,IAAI,GAAA,OAAA,KAAA;EAAA,OAAAuB;CAAA,EAAA,CAAA;AAChG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"carousel.js","names":["createEffect","createSignal","For","onCleanup","Show","splitProps","JSX","createEmblaCarousel","EmblaCarouselType","ChevronLeft","ChevronRight","cn","Button","CarouselApi","CarouselProps","children","Element","orientation","slidesToShow","align","loop","controls","dots","previousLabel","nextLabel","dotLabel","index","onApi","api","class","Carousel","props","local","rest","emblaRef","embla","axis","slidesToScroll","containScroll","selected","setSelected","count","setCount","canPrev","setCanPrev","canNext","setCanNext","sync","selectedScrollSnap","canScrollPrev","canScrollNext","scrollSnapList","length","on","off","_el$","_tmpl$3","_el$2","firstChild","_el$3","_$spread","_$mergeProps","_$use","_$insert","_$createComponent","when","_el$4","_tmpl$2","variant","size","disabled","aria-label","onClick","scrollPrev","_el$5","_tmpl$","each","Array","from","_","_el$6","_tmpl$4","$$click","scrollTo","_$effect","_p$","_v$3","_v$4","_v$5","undefined","e","_$className","t","_$setAttribute","a","scrollNext","_v$","_v$2","CarouselSlide","_el$7","_tmpl$5","_v$6","_v$7","_$setStyleProperty","_$delegateEvents","_$mergeProps","_$createComponent","_$className","_$setAttribute","_$setStyleProperty","_$delegateEvents"],"sources":["../../../../src/components/ui/carousel/carousel.tsx"],"sourcesContent":["import { createEffect, createSignal, For, onCleanup, Show, splitProps, type JSX } from 'solid-js'\nimport createEmblaCarousel from 'embla-carousel-solid'\nimport type { EmblaCarouselType } from 'embla-carousel'\nimport { ChevronLeft, ChevronRight } from 'lucide-solid'\nimport { cn } from '#lib/utils'\nimport { Button } from '../button'\n\n/**\n * Carousel.\n *\n * A horizontal scroller with snap points, over embla. The primitive owns the\n * physics — momentum, snapping, drag — and this owns the two things a carousel\n * always needs and embla deliberately leaves to the caller: a keyboard path and a\n * way to tell how far along you are.\n *\n * **It is a scroll container, not a slide show.** `slidesToScroll` defaults to 1\n * and the track is keyboard-focusable, so arrow keys move between slides and a\n * slide that contains a link stays reachable. A carousel that hijacks the arrow\n * keys or hides its off-screen slides from the tab order is the standard\n * accessibility failure of this component, and both are avoided here by not\n * disabling anything: the slides stay in the DOM and in the tab order, and the\n * container scrolls.\n *\n * `orientation=\"vertical\"` exists because embla supports it and a vertical\n * carousel is what a short list of cards becomes on a phone. It is a prop rather\n * than a second component because every part — the track, the previous/next\n * buttons, the dots — has the same relationship to the axis.\n *\n * The dot indicators are buttons, not spans: a carousel with twelve slides and a\n * \"go to slide 7\" affordance is the only way to reach the seventh without\n * dragging through six. Each is labelled, because a row of unlabelled dots is a\n * row of identical controls to a screen reader.\n */\n\nexport type CarouselApi = EmblaCarouselType\n\nexport type CarouselProps = {\n /** The slides. Each is wrapped in its own element so embla can measure it. */\n children: JSX.Element\n /** The axis. Vertical is what a card list becomes on a narrow screen. */\n orientation?: 'horizontal' | 'vertical'\n /** How many slides are visible at once. */\n slidesToShow?: number\n /** Align the active slide to the start, centre, or end of the viewport. */\n align?: 'start' | 'center' | 'end'\n /** Whether dragging past the ends loops. Off by default: a loop hides the ends. */\n loop?: boolean\n /** Show the previous/next controls. */\n controls?: boolean\n /** Show the dot indicators. Off by default — a single-slide carousel needs none. */\n dots?: boolean\n /** Accessible names. Override for a non-English application. */\n previousLabel?: string\n nextLabel?: string\n /** The label for a dot, given a zero-based index. */\n dotLabel?: (index: number) => string\n /** Receives the embla API, for a caller that needs to drive it. */\n onApi?: (api: CarouselApi) => void\n class?: string\n}\n\nexport function Carousel(props: CarouselProps) {\n const [local, rest] = splitProps(props, [\n 'children',\n 'orientation',\n 'slidesToShow',\n 'align',\n 'loop',\n 'controls',\n 'dots',\n 'previousLabel',\n 'nextLabel',\n 'dotLabel',\n 'onApi',\n 'class',\n ])\n\n const orientation = () => local.orientation ?? 'horizontal'\n\n // The first element of the tuple is the ref setter, the second the accessor —\n // so `ref={emblaRef}` is the whole wiring.\n const [emblaRef, embla] = createEmblaCarousel(() => ({\n axis: orientation() === 'vertical' ? 'y' : 'x',\n loop: local.loop ?? false,\n align: local.align ?? 'start',\n slidesToScroll: 1,\n containScroll: 'trimSnaps',\n }))\n\n const [selected, setSelected] = createSignal(0)\n const [count, setCount] = createSignal(0)\n const [canPrev, setCanPrev] = createSignal(false)\n const [canNext, setCanNext] = createSignal(false)\n\n /**\n * The scroll event, not the select event alone: `select` fires on a settle, so a\n * drag in progress would leave the dots behind the thumb. `scroll` covers both.\n */\n createEffect(() => {\n const api = embla()\n if (!api) return\n local.onApi?.(api)\n\n const sync = () => {\n setSelected(api.selectedScrollSnap())\n setCanPrev(api.canScrollPrev())\n setCanNext(api.canScrollNext())\n }\n sync()\n setCount(api.scrollSnapList().length)\n\n api.on('select', sync)\n api.on('scroll', sync)\n api.on('reInit', sync)\n onCleanup(() => {\n api.off('select', sync)\n api.off('scroll', sync)\n api.off('reInit', sync)\n })\n })\n\n return (\n <div\n class={cn('group/carousel relative grid gap-2', local.class)}\n role=\"group\"\n aria-roledescription=\"carousel\"\n {...rest}\n >\n <div\n ref={emblaRef}\n // A scroll container has to be reachable by keyboard — the same\n // requirement the code block's scroller meets.\n tabindex=\"0\"\n class={cn(\n 'scroll-fade overflow-hidden rounded-lg focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none'\n )}\n aria-label=\"Carousel\"\n >\n <div class={cn('flex', orientation() === 'vertical' ? 'flex-col' : 'flex-row')}>\n {local.children}\n </div>\n </div>\n\n <Show when={local.controls ?? true}>\n <div class=\"flex items-center justify-center gap-1\">\n <Button\n variant=\"ghost\"\n size=\"icon-sm\"\n disabled={!canPrev()}\n aria-label={local.previousLabel ?? 'Previous slide'}\n onClick={() => embla()?.scrollPrev()}\n >\n <ChevronLeft aria-hidden=\"true\" class=\"rotate-0\" />\n </Button>\n <Show when={local.dots}>\n <div class=\"flex items-center gap-1 px-1\">\n <For each={Array.from({ length: count() })}>\n {(_, index) => (\n <button\n type=\"button\"\n class={cn(\n 'size-1.5 rounded-full bg-muted-foreground/40 transition-colors hover:bg-muted-foreground',\n selected() === index() && 'bg-primary'\n )}\n aria-label={local.dotLabel?.(index()) ?? `Go to slide ${index() + 1}`}\n aria-current={selected() === index() ? 'true' : undefined}\n onClick={() => embla()?.scrollTo(index())}\n />\n )}\n </For>\n </div>\n </Show>\n <Button\n variant=\"ghost\"\n size=\"icon-sm\"\n disabled={!canNext()}\n aria-label={local.nextLabel ?? 'Next slide'}\n onClick={() => embla()?.scrollNext()}\n >\n <ChevronRight aria-hidden=\"true\" />\n </Button>\n </div>\n </Show>\n </div>\n )\n}\n\n/**\n * One slide. `basis` is what makes `slidesToShow` work: embla measures the slide\n * elements, so a slide that is not sized to a fraction of the viewport would show\n * one per screen regardless of the setting.\n */\nexport function CarouselSlide(props: {\n children: JSX.Element\n /** How many slides share the viewport at this slide's widest breakpoint. */\n slidesToShow?: number\n class?: string\n}) {\n return (\n <div\n class={cn('min-w-0 shrink-0 grow-0', props.class)}\n style={{ 'flex-basis': `${100 / (props.slidesToShow ?? 1)}%` }}\n role=\"group\"\n aria-roledescription=\"slide\"\n >\n {props.children}\n </div>\n )\n}\n"],"mappings":";;;;;;;;;;;;AA6DA,SAAgB8B,SAASC,OAAsB;CAC7C,MAAM,CAACC,OAAOC,QAAQ5B,WAAW0B,OAAO;EACtC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CAAO,CACR;CAED,MAAMd,oBAAoBe,MAAMf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,OAAAd,IAAAK,IAAAW,IAAA;GAAAC,SAAAjB,IAAAO,KAAAW,iBAAAJ,OAAA,cAAAd,IAAAO,IAAAU,IAAA;GAAA,OAAAjB;EAAA,GAAA;GAAAK,GAAAD,KAAAA;GAAAG,GAAAH,KAAAA;EAAA,CAAA;EAAA,OAAAU;CAAA,EAAA,CAAA;AAOlE;AAACK,eAAA,CAAA,OAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"carousel.js","names":["createEffect","createSignal","For","onCleanup","Show","splitProps","createEmblaCarousel","ChevronLeft","ChevronRight","cn","Button","children","orientation","slidesToShow","align","loop","controls","dots","previousLabel","nextLabel","dotLabel","index","onApi","api","class","Carousel","props","local","rest","emblaRef","embla","axis","slidesToScroll","containScroll","selected","setSelected","count","setCount","canPrev","setCanPrev","canNext","setCanNext","sync","selectedScrollSnap","canScrollPrev","canScrollNext","scrollSnapList","length","on","off","_el$","_tmpl$3","_el$2","firstChild","_el$3","_$spread","_$mergeProps","_$use","_$insert","_$createComponent","when","_el$4","_tmpl$2","variant","size","disabled","onClick","scrollPrev","_el$5","_tmpl$","each","Array","from","_","_el$6","_tmpl$4","$$click","scrollTo","_$effect","_p$","_v$3","_v$4","_v$5","undefined","e","_$className","t","_$setAttribute","a","scrollNext","_v$","_v$2","CarouselSlide","_el$7","_tmpl$5","_v$6","_v$7","_$setStyleProperty","_$delegateEvents"],"sources":["../../../../src/components/ui/carousel/carousel.tsx"],"sourcesContent":["import { createEffect, createSignal, For, onCleanup, Show, splitProps, type JSX } from 'solid-js'\nimport createEmblaCarousel from 'embla-carousel-solid'\nimport type { EmblaCarouselType } from 'embla-carousel'\nimport { ChevronLeft, ChevronRight } from 'lucide-solid'\nimport { cn } from '#lib/utils'\nimport { Button } from '../button'\n\n/**\n * Carousel.\n *\n * A horizontal scroller with snap points, over embla. The primitive owns the\n * physics — momentum, snapping, drag — and this owns the two things a carousel\n * always needs and embla deliberately leaves to the caller: a keyboard path and a\n * way to tell how far along you are.\n *\n * **It is a scroll container, not a slide show.** `slidesToScroll` defaults to 1\n * and the track is keyboard-focusable, so arrow keys move between slides and a\n * slide that contains a link stays reachable. A carousel that hijacks the arrow\n * keys or hides its off-screen slides from the tab order is the standard\n * accessibility failure of this component, and both are avoided here by not\n * disabling anything: the slides stay in the DOM and in the tab order, and the\n * container scrolls.\n *\n * `orientation=\"vertical\"` exists because embla supports it and a vertical\n * carousel is what a short list of cards becomes on a phone. It is a prop rather\n * than a second component because every part — the track, the previous/next\n * buttons, the dots — has the same relationship to the axis.\n *\n * The dot indicators are buttons, not spans: a carousel with twelve slides and a\n * \"go to slide 7\" affordance is the only way to reach the seventh without\n * dragging through six. Each is labelled, because a row of unlabelled dots is a\n * row of identical controls to a screen reader.\n */\n\nexport type CarouselApi = EmblaCarouselType\n\nexport type CarouselProps = {\n /** The slides. Each is wrapped in its own element so embla can measure it. */\n children: JSX.Element\n /** The axis. Vertical is what a card list becomes on a narrow screen. */\n orientation?: 'horizontal' | 'vertical'\n /** How many slides are visible at once. */\n slidesToShow?: number\n /** Align the active slide to the start, centre, or end of the viewport. */\n align?: 'start' | 'center' | 'end'\n /** Whether dragging past the ends loops. Off by default: a loop hides the ends. */\n loop?: boolean\n /** Show the previous/next controls. */\n controls?: boolean\n /** Show the dot indicators. Off by default — a single-slide carousel needs none. */\n dots?: boolean\n /** Accessible names. Override for a non-English application. */\n previousLabel?: string\n nextLabel?: string\n /** The label for a dot, given a zero-based index. */\n dotLabel?: (index: number) => string\n /** Receives the embla API, for a caller that needs to drive it. */\n onApi?: (api: CarouselApi) => void\n class?: string\n}\n\nexport function Carousel(props: CarouselProps) {\n const [local, rest] = splitProps(props, [\n 'children',\n 'orientation',\n 'slidesToShow',\n 'align',\n 'loop',\n 'controls',\n 'dots',\n 'previousLabel',\n 'nextLabel',\n 'dotLabel',\n 'onApi',\n 'class',\n ])\n\n const orientation = () => local.orientation ?? 'horizontal'\n\n // The first element of the tuple is the ref setter, the second the accessor —\n // so `ref={emblaRef}` is the whole wiring.\n const [emblaRef, embla] = createEmblaCarousel(() => ({\n axis: orientation() === 'vertical' ? 'y' : 'x',\n loop: local.loop ?? false,\n align: local.align ?? 'start',\n slidesToScroll: 1,\n containScroll: 'trimSnaps',\n }))\n\n const [selected, setSelected] = createSignal(0)\n const [count, setCount] = createSignal(0)\n const [canPrev, setCanPrev] = createSignal(false)\n const [canNext, setCanNext] = createSignal(false)\n\n /**\n * The scroll event, not the select event alone: `select` fires on a settle, so a\n * drag in progress would leave the dots behind the thumb. `scroll` covers both.\n */\n createEffect(() => {\n const api = embla()\n if (!api) return\n local.onApi?.(api)\n\n const sync = () => {\n setSelected(api.selectedScrollSnap())\n setCanPrev(api.canScrollPrev())\n setCanNext(api.canScrollNext())\n }\n sync()\n setCount(api.scrollSnapList().length)\n\n api.on('select', sync)\n api.on('scroll', sync)\n api.on('reInit', sync)\n onCleanup(() => {\n api.off('select', sync)\n api.off('scroll', sync)\n api.off('reInit', sync)\n })\n })\n\n return (\n <div\n class={cn('group/carousel relative grid gap-2', local.class)}\n role=\"group\"\n aria-roledescription=\"carousel\"\n {...rest}\n >\n <div\n ref={emblaRef}\n // A scroll container has to be reachable by keyboard — the same\n // requirement the code block's scroller meets.\n tabindex=\"0\"\n class={cn(\n 'scroll-fade overflow-hidden rounded-lg focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none'\n )}\n aria-label=\"Carousel\"\n >\n <div class={cn('flex', orientation() === 'vertical' ? 'flex-col' : 'flex-row')}>\n {local.children}\n </div>\n </div>\n\n <Show when={local.controls ?? true}>\n <div class=\"flex items-center justify-center gap-1\">\n <Button\n variant=\"ghost\"\n size=\"icon-sm\"\n disabled={!canPrev()}\n aria-label={local.previousLabel ?? 'Previous slide'}\n onClick={() => embla()?.scrollPrev()}\n >\n <ChevronLeft aria-hidden=\"true\" class=\"rotate-0\" />\n </Button>\n <Show when={local.dots}>\n <div class=\"flex items-center gap-1 px-1\">\n <For each={Array.from({ length: count() })}>\n {(_, index) => (\n <button\n type=\"button\"\n class={cn(\n 'size-1.5 rounded-full bg-muted-foreground/40 transition-colors hover:bg-muted-foreground',\n selected() === index() && 'bg-primary'\n )}\n aria-label={local.dotLabel?.(index()) ?? `Go to slide ${index() + 1}`}\n aria-current={selected() === index() ? 'true' : undefined}\n onClick={() => embla()?.scrollTo(index())}\n />\n )}\n </For>\n </div>\n </Show>\n <Button\n variant=\"ghost\"\n size=\"icon-sm\"\n disabled={!canNext()}\n aria-label={local.nextLabel ?? 'Next slide'}\n onClick={() => embla()?.scrollNext()}\n >\n <ChevronRight aria-hidden=\"true\" />\n </Button>\n </div>\n </Show>\n </div>\n )\n}\n\n/**\n * One slide. `basis` is what makes `slidesToShow` work: embla measures the slide\n * elements, so a slide that is not sized to a fraction of the viewport would show\n * one per screen regardless of the setting.\n */\nexport function CarouselSlide(props: {\n children: JSX.Element\n /** How many slides share the viewport at this slide's widest breakpoint. */\n slidesToShow?: number\n class?: string\n}) {\n return (\n <div\n class={cn('min-w-0 shrink-0 grow-0', props.class)}\n style={{ 'flex-basis': `${100 / (props.slidesToShow ?? 1)}%` }}\n role=\"group\"\n aria-roledescription=\"slide\"\n >\n {props.children}\n </div>\n )\n}\n"],"mappings":";;;;;;;;;;;;AA6DA,SAAgByB,SAASC,OAAsB;CAC7C,MAAM,CAACC,OAAOC,QAAQvB,WAAWqB,OAAO;EACtC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CAAO,CACR;CAED,MAAMd,oBAAoBe,MAAMf,eAAe;CAI/C,MAAM,CAACiB,UAAUC,SAASxB,2BAA2B;EACnDyB,MAAMnB,YAAY,MAAM,aAAa,MAAM;EAC3CG,MAAMY,MAAMZ,QAAQ;EACpBD,OAAOa,MAAMb,SAAS;EACtBkB,gBAAgB;EAChBC,eAAe;CACjB,EAAE;CAEF,MAAM,CAACC,UAAUC,eAAelC,aAAa,CAAC;CAC9C,MAAM,CAACmC,OAAOC,YAAYpC,aAAa,CAAC;CACxC,MAAM,CA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