@epilot/spark-ui 0.31.0 → 0.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/button-B_RNHEc7.d.ts +52 -0
- package/dist/button-DBcEcIMk.d.cts +52 -0
- package/dist/cn-DzRH6EW_.d.cts +4 -0
- package/dist/cn-DzRH6EW_.d.ts +4 -0
- package/dist/components/accordion.cjs +1 -1
- package/dist/components/accordion.js +1 -1
- package/dist/components/alert-dialog.d.cts +1 -1
- package/dist/components/alert-dialog.d.ts +1 -1
- package/dist/components/attachment.cjs +1 -1
- package/dist/components/attachment.d.cts +2 -2
- package/dist/components/attachment.d.ts +2 -2
- package/dist/components/attachment.js +1 -1
- package/dist/components/autocomplete.cjs +8 -6
- package/dist/components/autocomplete.cjs.map +1 -1
- package/dist/components/autocomplete.d.cts +4 -10
- package/dist/components/autocomplete.d.ts +4 -10
- package/dist/components/autocomplete.js +8 -6
- package/dist/components/autocomplete.js.map +1 -1
- package/dist/components/badge.cjs +1 -1
- package/dist/components/badge.js +1 -1
- package/dist/components/banner.cjs +1 -1
- package/dist/components/banner.js +1 -1
- package/dist/components/bar-chart.cjs +1 -1
- package/dist/components/bar-chart.js +2 -2
- package/dist/components/box.cjs +1 -1
- package/dist/components/box.cjs.map +1 -1
- package/dist/components/box.js +2 -2
- package/dist/components/box.js.map +1 -1
- package/dist/components/breadcrumbs.cjs +1 -1
- package/dist/components/breadcrumbs.js +1 -1
- package/dist/components/bubble.cjs +1 -1
- package/dist/components/bubble.d.cts +1 -1
- package/dist/components/bubble.d.ts +1 -1
- package/dist/components/bubble.js +1 -1
- package/dist/components/button-group.cjs +1 -1
- package/dist/components/button-group.js +1 -1
- package/dist/components/button.cjs +27 -10
- package/dist/components/button.cjs.map +1 -1
- package/dist/components/button.d.cts +3 -28
- package/dist/components/button.d.ts +3 -28
- package/dist/components/button.js +27 -11
- package/dist/components/button.js.map +1 -1
- package/dist/components/calendar.cjs +32 -4
- package/dist/components/calendar.cjs.map +1 -1
- package/dist/components/calendar.d.cts +2 -2
- package/dist/components/calendar.d.ts +2 -2
- package/dist/components/calendar.js +34 -6
- package/dist/components/calendar.js.map +1 -1
- package/dist/components/callout.cjs +1 -1
- package/dist/components/callout.d.cts +1 -1
- package/dist/components/callout.d.ts +1 -1
- package/dist/components/callout.js +1 -1
- package/dist/components/card.cjs +5 -4
- package/dist/components/card.cjs.map +1 -1
- package/dist/components/card.d.cts +9 -8
- package/dist/components/card.d.ts +9 -8
- package/dist/components/card.js +6 -5
- package/dist/components/card.js.map +1 -1
- package/dist/components/checkbox-card.cjs +177 -0
- package/dist/components/checkbox-card.cjs.map +1 -0
- package/dist/components/checkbox-card.d.cts +47 -0
- package/dist/components/checkbox-card.d.ts +47 -0
- package/dist/components/checkbox-card.js +170 -0
- package/dist/components/checkbox-card.js.map +1 -0
- package/dist/components/checkbox.cjs +5 -18
- package/dist/components/checkbox.cjs.map +1 -1
- package/dist/components/checkbox.js +6 -19
- package/dist/components/checkbox.js.map +1 -1
- package/dist/components/combobox.cjs +3 -2
- package/dist/components/combobox.cjs.map +1 -1
- package/dist/components/combobox.js +3 -2
- package/dist/components/combobox.js.map +1 -1
- package/dist/components/drawer.cjs +1 -1
- package/dist/components/drawer.js +1 -1
- package/dist/components/dropzone.cjs +224 -0
- package/dist/components/dropzone.cjs.map +1 -0
- package/dist/components/dropzone.d.cts +66 -0
- package/dist/components/dropzone.d.ts +66 -0
- package/dist/components/dropzone.js +215 -0
- package/dist/components/dropzone.js.map +1 -0
- package/dist/components/empty-state.cjs +1 -1
- package/dist/components/empty-state.d.cts +1 -1
- package/dist/components/empty-state.d.ts +1 -1
- package/dist/components/empty-state.js +1 -1
- package/dist/components/entity-card.cjs +1 -1
- package/dist/components/entity-card.js +1 -1
- package/dist/components/field.cjs +68 -10
- package/dist/components/field.cjs.map +1 -1
- package/dist/components/field.d.cts +16 -3
- package/dist/components/field.d.ts +16 -3
- package/dist/components/field.js +67 -10
- package/dist/components/field.js.map +1 -1
- package/dist/components/hero-metric.cjs +1 -1
- package/dist/components/hero-metric.js +1 -1
- package/dist/components/image-carousel.cjs +183 -0
- package/dist/components/image-carousel.cjs.map +1 -0
- package/dist/components/image-carousel.d.cts +54 -0
- package/dist/components/image-carousel.d.ts +54 -0
- package/dist/components/image-carousel.js +174 -0
- package/dist/components/image-carousel.js.map +1 -0
- package/dist/components/info-block.cjs +1 -1
- package/dist/components/info-block.d.cts +1 -1
- package/dist/components/info-block.d.ts +1 -1
- package/dist/components/info-block.js +1 -1
- package/dist/components/input-date-time.cjs +16 -202
- package/dist/components/input-date-time.cjs.map +1 -1
- package/dist/components/input-date-time.d.cts +14 -31
- package/dist/components/input-date-time.d.ts +14 -31
- package/dist/components/input-date-time.js +15 -202
- package/dist/components/input-date-time.js.map +1 -1
- package/dist/components/input-date.cjs +14 -146
- package/dist/components/input-date.cjs.map +1 -1
- package/dist/components/input-date.d.cts +11 -19
- package/dist/components/input-date.d.ts +11 -19
- package/dist/components/input-date.js +13 -146
- package/dist/components/input-date.js.map +1 -1
- package/dist/components/input-group.cjs +5 -4
- package/dist/components/input-group.cjs.map +1 -1
- package/dist/components/input-group.d.cts +2 -30
- package/dist/components/input-group.d.ts +2 -30
- package/dist/components/input-group.js +4 -3
- package/dist/components/input-group.js.map +1 -1
- package/dist/components/input-otp.cjs +4 -4
- package/dist/components/input-otp.cjs.map +1 -1
- package/dist/components/input-otp.js +4 -4
- package/dist/components/input-otp.js.map +1 -1
- package/dist/components/input.cjs +5 -3
- package/dist/components/input.cjs.map +1 -1
- package/dist/components/input.d.cts +2 -12
- package/dist/components/input.d.ts +2 -12
- package/dist/components/input.js +5 -3
- package/dist/components/input.js.map +1 -1
- package/dist/components/line-chart.cjs +3 -3
- package/dist/components/line-chart.js +4 -4
- package/dist/components/link.cjs +31 -0
- package/dist/components/link.cjs.map +1 -0
- package/dist/components/link.d.cts +16 -0
- package/dist/components/link.d.ts +16 -0
- package/dist/components/link.js +28 -0
- package/dist/components/link.js.map +1 -0
- package/dist/components/list.cjs +1 -1
- package/dist/components/list.js +1 -1
- package/dist/components/marker.cjs +1 -1
- package/dist/components/marker.d.cts +1 -1
- package/dist/components/marker.d.ts +1 -1
- package/dist/components/marker.js +1 -1
- package/dist/components/message-scroller.d.cts +1 -1
- package/dist/components/message-scroller.d.ts +1 -1
- package/dist/components/message-scroller.js +1 -1
- package/dist/components/page-header.cjs +1 -1
- package/dist/components/page-header.d.cts +1 -1
- package/dist/components/page-header.d.ts +1 -1
- package/dist/components/page-header.js +1 -1
- package/dist/components/pagination.cjs +124 -0
- package/dist/components/pagination.cjs.map +1 -0
- package/dist/components/pagination.d.cts +42 -0
- package/dist/components/pagination.d.ts +42 -0
- package/dist/components/pagination.js +115 -0
- package/dist/components/pagination.js.map +1 -0
- package/dist/components/period-tabs.d.cts +1 -1
- package/dist/components/period-tabs.d.ts +1 -1
- package/dist/components/pill.cjs +42 -23
- package/dist/components/pill.cjs.map +1 -1
- package/dist/components/pill.d.cts +13 -3
- package/dist/components/pill.d.ts +13 -3
- package/dist/components/pill.js +42 -24
- package/dist/components/pill.js.map +1 -1
- package/dist/components/popover.cjs +1 -1
- package/dist/components/popover.d.cts +2 -29
- package/dist/components/popover.d.ts +2 -29
- package/dist/components/popover.js +1 -1
- package/dist/components/power-history-chart.cjs +3 -3
- package/dist/components/power-history-chart.js +4 -4
- package/dist/components/power-network.js +1 -1
- package/dist/components/progress.cjs +126 -13
- package/dist/components/progress.cjs.map +1 -1
- package/dist/components/progress.d.cts +19 -10
- package/dist/components/progress.d.ts +19 -10
- package/dist/components/progress.js +126 -15
- package/dist/components/progress.js.map +1 -1
- package/dist/components/radio-card-group.cjs +137 -70
- package/dist/components/radio-card-group.cjs.map +1 -1
- package/dist/components/radio-card-group.d.cts +37 -15
- package/dist/components/radio-card-group.d.ts +37 -15
- package/dist/components/radio-card-group.js +135 -71
- package/dist/components/radio-card-group.js.map +1 -1
- package/dist/components/select.cjs +11 -4
- package/dist/components/select.cjs.map +1 -1
- package/dist/components/select.d.cts +1 -0
- package/dist/components/select.d.ts +1 -0
- package/dist/components/select.js +11 -4
- package/dist/components/select.js.map +1 -1
- package/dist/components/separator.cjs +1 -1
- package/dist/components/separator.js +1 -1
- package/dist/components/skeleton.cjs +1 -1
- package/dist/components/skeleton.js +1 -1
- package/dist/components/solar-forecast-chart.js +1 -1
- package/dist/components/spark-home.js +1 -1
- package/dist/components/step-indicator.cjs +128 -0
- package/dist/components/step-indicator.cjs.map +1 -0
- package/dist/components/step-indicator.d.cts +25 -0
- package/dist/components/step-indicator.d.ts +25 -0
- package/dist/components/step-indicator.js +124 -0
- package/dist/components/step-indicator.js.map +1 -0
- package/dist/components/stepper.cjs +2 -1
- package/dist/components/stepper.cjs.map +1 -1
- package/dist/components/stepper.d.cts +1 -2
- package/dist/components/stepper.d.ts +1 -2
- package/dist/components/stepper.js +2 -1
- package/dist/components/stepper.js.map +1 -1
- package/dist/components/tabs.cjs +2 -2
- package/dist/components/tabs.cjs.map +1 -1
- package/dist/components/tabs.js +1 -1
- package/dist/components/tabs.js.map +1 -1
- package/dist/components/textarea.cjs +9 -3
- package/dist/components/textarea.cjs.map +1 -1
- package/dist/components/textarea.js +9 -3
- package/dist/components/textarea.js.map +1 -1
- package/dist/components/theme.cjs +1 -1
- package/dist/components/theme.js +2 -2
- package/dist/components/time-picker.cjs +3 -38
- package/dist/components/time-picker.cjs.map +1 -1
- package/dist/components/time-picker.js +1 -36
- package/dist/components/time-picker.js.map +1 -1
- package/dist/components/toggle.d.cts +1 -1
- package/dist/components/toggle.d.ts +1 -1
- package/dist/components/tooltip.cjs +2 -1
- package/dist/components/tooltip.cjs.map +1 -1
- package/dist/components/tooltip.d.cts +3 -2
- package/dist/components/tooltip.d.ts +3 -2
- package/dist/components/tooltip.js +2 -1
- package/dist/components/tooltip.js.map +1 -1
- package/dist/hooks/use-isomorphic-layout-effect.cjs +9 -0
- package/dist/hooks/use-isomorphic-layout-effect.cjs.map +1 -0
- package/dist/hooks/use-isomorphic-layout-effect.d.cts +9 -0
- package/dist/hooks/use-isomorphic-layout-effect.d.ts +9 -0
- package/dist/hooks/use-isomorphic-layout-effect.js +8 -0
- package/dist/hooks/use-isomorphic-layout-effect.js.map +1 -0
- package/dist/input-BZFPU-j4.d.cts +14 -0
- package/dist/input-group-5lh67qyY.d.cts +32 -0
- package/dist/input-group-Bc9_sPPN.d.ts +32 -0
- package/dist/input-zB3zmz9J.d.ts +14 -0
- package/dist/lib/accent-theme.cjs +46 -22
- package/dist/lib/accent-theme.cjs.map +1 -1
- package/dist/lib/accent-theme.js +26 -1
- package/dist/lib/accent-theme.js.map +1 -1
- package/dist/lib/calendar-field.cjs +11 -0
- package/dist/lib/calendar-field.cjs.map +1 -0
- package/dist/lib/calendar-field.d.cts +18 -0
- package/dist/lib/calendar-field.d.ts +18 -0
- package/dist/lib/calendar-field.js +8 -0
- package/dist/lib/calendar-field.js.map +1 -0
- package/dist/lib/calendar-lists.cjs +86 -97
- package/dist/lib/calendar-lists.cjs.map +1 -1
- package/dist/lib/calendar-lists.d.cts +30 -2
- package/dist/lib/calendar-lists.d.ts +30 -2
- package/dist/lib/calendar-lists.js +85 -97
- package/dist/lib/calendar-lists.js.map +1 -1
- package/dist/lib/card-control.cjs +18 -0
- package/dist/lib/card-control.cjs.map +1 -0
- package/dist/lib/card-control.d.cts +10 -0
- package/dist/lib/card-control.d.ts +10 -0
- package/dist/lib/card-control.js +17 -0
- package/dist/lib/card-control.js.map +1 -0
- package/dist/lib/checkbox-box.cjs +30 -0
- package/dist/lib/checkbox-box.cjs.map +1 -0
- package/dist/lib/checkbox-box.d.cts +13 -0
- package/dist/lib/checkbox-box.d.ts +13 -0
- package/dist/lib/checkbox-box.js +27 -0
- package/dist/lib/checkbox-box.js.map +1 -0
- package/dist/lib/container-chrome.cjs +8 -1
- package/dist/lib/container-chrome.cjs.map +1 -1
- package/dist/lib/container-chrome.d.cts +4 -2
- package/dist/lib/container-chrome.d.ts +4 -2
- package/dist/lib/container-chrome.js +8 -2
- package/dist/lib/container-chrome.js.map +1 -1
- package/dist/lib/date-field-input.cjs +121 -0
- package/dist/lib/date-field-input.cjs.map +1 -0
- package/dist/lib/date-field-input.d.cts +14 -0
- package/dist/lib/date-field-input.d.ts +14 -0
- package/dist/lib/date-field-input.js +118 -0
- package/dist/lib/date-field-input.js.map +1 -0
- package/dist/lib/date-field-time-list.cjs +81 -0
- package/dist/lib/date-field-time-list.cjs.map +1 -0
- package/dist/lib/date-field-time-list.d.cts +18 -0
- package/dist/lib/date-field-time-list.d.ts +18 -0
- package/dist/lib/date-field-time-list.js +77 -0
- package/dist/lib/date-field-time-list.js.map +1 -0
- package/dist/lib/date-field.cjs +183 -0
- package/dist/lib/date-field.cjs.map +1 -0
- package/dist/lib/date-field.d.cts +76 -0
- package/dist/lib/date-field.d.ts +76 -0
- package/dist/lib/date-field.js +177 -0
- package/dist/lib/date-field.js.map +1 -0
- package/dist/lib/date-time-mask.cjs +148 -102
- package/dist/lib/date-time-mask.cjs.map +1 -1
- package/dist/lib/date-time-mask.d.cts +21 -3
- package/dist/lib/date-time-mask.d.ts +21 -3
- package/dist/lib/date-time-mask.js +142 -103
- package/dist/lib/date-time-mask.js.map +1 -1
- package/dist/lib/generate-radix-colors.cjs +64 -5
- package/dist/lib/generate-radix-colors.cjs.map +1 -1
- package/dist/lib/generate-radix-colors.js +61 -1
- package/dist/lib/generate-radix-colors.js.map +1 -1
- package/dist/lib/input-box-variants.cjs +3 -3
- package/dist/lib/input-box-variants.cjs.map +1 -1
- package/dist/lib/input-box-variants.d.cts +1 -1
- package/dist/lib/input-box-variants.d.ts +1 -1
- package/dist/lib/input-box-variants.js +3 -3
- package/dist/lib/input-box-variants.js.map +1 -1
- package/dist/lib/mask-hint.cjs +15 -0
- package/dist/lib/mask-hint.cjs.map +1 -0
- package/dist/lib/mask-hint.d.cts +10 -0
- package/dist/lib/mask-hint.d.ts +10 -0
- package/dist/lib/mask-hint.js +14 -0
- package/dist/lib/mask-hint.js.map +1 -0
- package/dist/lib/option-list.cjs +71 -0
- package/dist/lib/option-list.cjs.map +1 -0
- package/dist/lib/option-list.d.cts +4 -0
- package/dist/lib/option-list.d.ts +4 -0
- package/dist/lib/option-list.js +67 -0
- package/dist/lib/option-list.js.map +1 -0
- package/dist/lib/time-grid.cjs +34 -0
- package/dist/lib/time-grid.cjs.map +1 -0
- package/dist/lib/time-grid.d.cts +9 -0
- package/dist/lib/time-grid.d.ts +9 -0
- package/dist/lib/time-grid.js +31 -0
- package/dist/lib/time-grid.js.map +1 -0
- package/dist/lib/toggle-group-context.d.cts +1 -1
- package/dist/lib/toggle-group-context.d.ts +1 -1
- package/dist/option-list-CxhR_DGq.d.cts +34 -0
- package/dist/option-list-CxhR_DGq.d.ts +34 -0
- package/dist/popover-DmcqNOkO.d.cts +31 -0
- package/dist/popover-DmcqNOkO.d.ts +31 -0
- package/dist/styles/spark-default.css +21 -0
- package/dist/styles/theme.css +2 -1
- package/dist/utils/cn.d.cts +1 -1
- package/dist/utils/cn.d.ts +1 -1
- package/package.json +3 -3
- package/dist/calendar-lists-CTby2kR5.d.cts +0 -27
- package/dist/calendar-lists-DoloqsCN.d.ts +0 -27
- package/dist/lib/calendar-day-button.cjs +0 -23
- package/dist/lib/calendar-day-button.cjs.map +0 -1
- package/dist/lib/calendar-day-button.d.cts +0 -14
- package/dist/lib/calendar-day-button.d.ts +0 -14
- package/dist/lib/calendar-day-button.js +0 -20
- package/dist/lib/calendar-day-button.js.map +0 -1
- package/dist/lib/input-date-parts.cjs +0 -155
- package/dist/lib/input-date-parts.cjs.map +0 -1
- package/dist/lib/input-date-parts.d.cts +0 -53
- package/dist/lib/input-date-parts.d.ts +0 -53
- package/dist/lib/input-date-parts.js +0 -148
- package/dist/lib/input-date-parts.js.map +0 -1
- package/dist/lib/scroll-within.cjs +0 -27
- package/dist/lib/scroll-within.cjs.map +0 -1
- package/dist/lib/scroll-within.d.cts +0 -14
- package/dist/lib/scroll-within.d.ts +0 -14
- package/dist/lib/scroll-within.js +0 -25
- package/dist/lib/scroll-within.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calendar.cjs","names":["ChevronRight","ChevronLeft","DayPicker","buttonVariants","
|
|
1
|
+
{"version":3,"file":"calendar.cjs","names":["ChevronRight","ChevronLeft","React","CalendarFieldContext","DayPicker","buttonVariants","ListMonth","ListMonthCaption","ListMonthGrid","CalendarListsProvider"],"sources":["../../src/components/calendar.tsx"],"sourcesContent":["'use client'\n\nimport { type DayButtonProps, DayPicker } from '@daypicker/react'\nimport { ChevronLeft, ChevronRight } from '@epilot/spark-icons'\nimport * as React from 'react'\nimport { CalendarFieldContext } from '../lib/calendar-field'\nimport {\n type CalendarListLabels,\n CalendarListsProvider,\n ListMonth,\n ListMonthCaption,\n ListMonthGrid,\n} from '../lib/calendar-lists'\nimport { cn } from '../utils/cn'\nimport { buttonVariants } from './button'\n\ntype DayPickerProps = React.ComponentProps<typeof DayPicker>\n\n// keeps the union on `mode`, which a plain Omit would flatten\ntype DistributiveOmit<T, K extends PropertyKey> = T extends unknown\n ? Omit<T, K>\n : never\n\ntype CalendarProps = DistributiveOmit<DayPickerProps, 'captionLayout'> & {\n /** `lists`: month and year each step with arrows and open a list in place of the days. */\n captionLayout?: DayPickerProps['captionLayout'] | 'lists'\n /** Names the year arrows of `captionLayout=\"lists\"`. */\n listLabels?: CalendarListLabels\n showTodayDot?: boolean\n}\n\nconst LIST_LABELS: CalendarListLabels = {\n nextYear: 'Next year',\n previousYear: 'Previous year',\n}\n\nfunction CalendarChevron({\n orientation,\n}: {\n orientation?: 'up' | 'down' | 'left' | 'right'\n}) {\n const Glyph = orientation === 'right' ? ChevronRight : ChevronLeft\n return (\n <Glyph\n className={cn(\n '[--spark-icon-size:20px]',\n orientation === 'up' && 'rotate-90',\n orientation === 'down' && '-rotate-90',\n )}\n />\n )\n}\n\nfunction DayButton({ day: _, modifiers, ...props }: DayButtonProps) {\n const ref = React.useRef<HTMLButtonElement>(null)\n React.useEffect(() => {\n if (modifiers.focused) ref.current?.focus({ preventScroll: true })\n }, [modifiers.focused])\n return <button ref={ref} {...props} />\n}\n\nfunction useFieldProps(props: Omit<CalendarProps, 'captionLayout'>) {\n const field = React.useContext(CalendarFieldContext)\n if (!field) return props as DayPickerProps\n return {\n autoFocus: true,\n defaultMonth: field.defaultMonth,\n endMonth: field.endMonth,\n startMonth: field.startMonth,\n ...props,\n disabled: [...field.disabled, props.disabled ?? []].flat(),\n mode: 'single',\n onSelect: field.onSelect,\n selected: field.selected,\n } as DayPickerProps\n}\n\n// Pass `locale` (from '@daypicker/react/locale') for localized month/weekday\n// names — the library ships no language default.\nfunction Calendar({\n captionLayout,\n className,\n classNames,\n components,\n fixedWeeks = true,\n hideNavigation,\n listLabels = LIST_LABELS,\n showOutsideDays = true,\n showTodayDot = true,\n ...ownProps\n}: CalendarProps) {\n const props = useFieldProps(ownProps)\n const lists = captionLayout === 'lists'\n const picker = (\n <DayPicker\n className={cn('p-3', className)}\n classNames={{\n months: 'relative',\n month: 'flex flex-col gap-2',\n month_caption: 'flex h-10 items-center justify-center',\n caption_label: 'text-sm font-bold text-gray',\n button_previous: cn(\n buttonVariants({ size: 'icon', variant: 'tertiary' }),\n 'absolute top-0 left-0 z-10 text-gray-light hover:text-gray focus-visible:focus-outline [[data-high-contrast]_&]:text-gray-a12',\n ),\n button_next: cn(\n buttonVariants({ size: 'icon', variant: 'tertiary' }),\n 'absolute top-0 right-0 z-10 text-gray-light hover:text-gray focus-visible:focus-outline [[data-high-contrast]_&]:text-gray-a12',\n ),\n month_grid: 'w-full border-collapse',\n weekdays: 'flex w-full justify-between',\n weekday:\n 'mt-0.5 flex h-10 w-10 items-center justify-center rounded-full text-sm font-bold text-gray',\n week: 'mt-1 flex w-full justify-between',\n day: cn(\n 'relative mx-0.5 flex h-10 w-10 items-center justify-center rounded-full p-0 text-center text-sm focus-within:relative focus-within:z-20',\n props.mode === 'range'\n ? '[&:has(>.range-end)]:rounded-r-full [&:has(>.range-start)]:rounded-l-full first:[&:has([aria-selected])]:rounded-l-full last:[&:has([aria-selected])]:rounded-r-full'\n : '[&:has([aria-selected])]:rounded-full',\n ),\n day_button: cn(\n buttonVariants({ size: 'icon', variant: 'tertiary' }),\n // hover:…:bg-(--spark-style-bg-hover) outranks tertiary's hover:bg-gray-a3 —\n // selected days darken like a solid button instead of washing out gray\n 'size-10 shrink-0 rounded-full p-0 font-normal text-gray focus-visible:focus-outline in-aria-selected:rounded-full in-aria-selected:bg-(--spark-style-bg,var(--color-primary)) in-aria-selected:text-(--spark-style-fg,var(--color-primary-foreground)) hover:in-aria-selected:bg-(--spark-style-bg-hover,var(--color-primary-hover)) [[data-high-contrast]_[data-outside]:not([data-disabled])_&]:text-gray-a12 [[data-outside]:not([data-disabled])_&]:text-gray-light',\n ),\n range_start: 'range-start',\n range_end: 'range-end',\n selected: 'rounded-full',\n today: cn(\n 'relative bg-base-gray-soft text-gray',\n showTodayDot &&\n 'after:absolute after:right-0 after:-bottom-1 after:left-0 after:m-auto after:inline-flex after:h-1 after:w-1 after:rounded-full after:bg-(--spark-style-bg,var(--color-primary)) after:content-[\"\"]',\n ),\n outside:\n 'outside aria-selected:bg-base-gray-soft aria-selected:text-gray-light',\n disabled: 'text-gray-light opacity-50',\n range_middle: 'aria-selected:bg-base-gray-soft aria-selected:text-gray',\n hidden: 'invisible',\n ...classNames,\n }}\n captionLayout={lists ? 'label' : captionLayout}\n components={{\n Chevron: CalendarChevron,\n DayButton,\n ...(lists && {\n Month: ListMonth,\n MonthCaption: ListMonthCaption,\n MonthGrid: ListMonthGrid,\n }),\n ...components,\n }}\n fixedWeeks={fixedWeeks}\n hideNavigation={lists || hideNavigation}\n showOutsideDays={showOutsideDays}\n {...props}\n />\n )\n return lists ? (\n <CalendarListsProvider labels={listLabels}>{picker}</CalendarListsProvider>\n ) : (\n picker\n )\n}\n\nexport { Calendar }\nexport type { CalendarProps }\n"],"mappings":";;;;;;;;;;;;;;AA+B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AA,eAAe;IAAE,MAAM;IAAQ,SAAS;GAAW,CAAC,GACpD,+HACF;GACA,cAAA,GAAA,GAAA,IACEA,0BAAAA,eAAe;IAAE,MAAM;IAAQ,SAAS;GAAW,CAAC,GACpD,gIACF;GACA,YAAY;GACZ,UAAU;GACV,SACE;GACF,MAAM;GACN,MAAA,GAAA,GAAA,IACE,2IACA,MAAM,SAAS,UACX,yKACA,uCACN;GACA,aAAA,GAAA,GAAA,IACEA,0BAAAA,eAAe;IAAE,MAAM;IAAQ,SAAS;GAAW,CAAC,GAGpD,ycACF;GACA,aAAa;GACb,WAAW;GACX,UAAU;GACV,QAAA,GAAA,GAAA,IACE,wCACA,gBACE,uMACJ;GACA,SACE;GACF,UAAU;GACV,cAAc;GACd,QAAQ;GACR,GAAG;EACL;EACA,eAAe,QAAQ,UAAU;EACjC,YAAY;GACV,SAAS;GACT;GACA,GAAI,SAAS;IACX,OAAOC,2BAAAA;IACP,cAAcC,2BAAAA;IACd,WAAWC,2BAAAA;GACb;GACA,GAAG;EACL;EACY;EACZ,gBAAgB,SAAS;EACR;EACjB,GAAI;CACL,CAAA;CAEH,OAAO,QACL,iBAAA,GAAA,kBAAA,KAACC,2BAAAA,uBAAD;EAAuB,QAAQ;YAAa;CAA8B,CAAA,IAE1E;AAEJ"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { CalendarListLabels } from "../lib/calendar-lists.cjs";
|
|
4
4
|
import * as React$1 from "react";
|
|
5
5
|
import { DayPicker } from "@daypicker/react";
|
|
6
6
|
|
|
@@ -22,7 +22,7 @@ declare function Calendar({
|
|
|
22
22
|
listLabels,
|
|
23
23
|
showOutsideDays,
|
|
24
24
|
showTodayDot,
|
|
25
|
-
...
|
|
25
|
+
...ownProps
|
|
26
26
|
}: CalendarProps): import("react/jsx-runtime").JSX.Element;
|
|
27
27
|
//#endregion
|
|
28
28
|
export { Calendar, type CalendarProps };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { CalendarListLabels } from "../lib/calendar-lists.js";
|
|
4
4
|
import * as React$1 from "react";
|
|
5
5
|
import { DayPicker } from "@daypicker/react";
|
|
6
6
|
|
|
@@ -22,7 +22,7 @@ declare function Calendar({
|
|
|
22
22
|
listLabels,
|
|
23
23
|
showOutsideDays,
|
|
24
24
|
showTodayDot,
|
|
25
|
-
...
|
|
25
|
+
...ownProps
|
|
26
26
|
}: CalendarProps): import("react/jsx-runtime").JSX.Element;
|
|
27
27
|
//#endregion
|
|
28
28
|
export { Calendar, type CalendarProps };
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
"use client";
|
|
2
3
|
import { cn } from "../utils/cn.js";
|
|
4
|
+
import { CalendarFieldContext } from "../lib/calendar-field.js";
|
|
3
5
|
import { buttonVariants } from "./button.js";
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import "react";
|
|
6
|
+
import { CalendarListsProvider, ListMonth as Month, ListMonthCaption as MonthCaption, ListMonthGrid as MonthGrid$1 } from "../lib/calendar-lists.js";
|
|
7
|
+
import * as React$1 from "react";
|
|
8
|
+
import { DayPicker } from "@daypicker/react";
|
|
7
9
|
import { ChevronLeft, ChevronRight } from "@epilot/spark-icons";
|
|
8
10
|
import { jsx } from "react/jsx-runtime";
|
|
9
|
-
import { DayPicker } from "@daypicker/react";
|
|
10
11
|
//#region src/components/calendar.tsx
|
|
11
12
|
const LIST_LABELS = {
|
|
12
13
|
nextYear: "Next year",
|
|
@@ -15,7 +16,33 @@ const LIST_LABELS = {
|
|
|
15
16
|
function CalendarChevron({ orientation }) {
|
|
16
17
|
return /* @__PURE__ */ jsx(orientation === "right" ? ChevronRight : ChevronLeft, { className: cn("[--spark-icon-size:20px]", orientation === "up" && "rotate-90", orientation === "down" && "-rotate-90") });
|
|
17
18
|
}
|
|
18
|
-
function
|
|
19
|
+
function DayButton({ day: _, modifiers, ...props }) {
|
|
20
|
+
const ref = React$1.useRef(null);
|
|
21
|
+
React$1.useEffect(() => {
|
|
22
|
+
if (modifiers.focused) ref.current?.focus({ preventScroll: true });
|
|
23
|
+
}, [modifiers.focused]);
|
|
24
|
+
return /* @__PURE__ */ jsx("button", {
|
|
25
|
+
ref,
|
|
26
|
+
...props
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
function useFieldProps(props) {
|
|
30
|
+
const field = React$1.useContext(CalendarFieldContext);
|
|
31
|
+
if (!field) return props;
|
|
32
|
+
return {
|
|
33
|
+
autoFocus: true,
|
|
34
|
+
defaultMonth: field.defaultMonth,
|
|
35
|
+
endMonth: field.endMonth,
|
|
36
|
+
startMonth: field.startMonth,
|
|
37
|
+
...props,
|
|
38
|
+
disabled: [...field.disabled, props.disabled ?? []].flat(),
|
|
39
|
+
mode: "single",
|
|
40
|
+
onSelect: field.onSelect,
|
|
41
|
+
selected: field.selected
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
function Calendar({ captionLayout, className, classNames, components, fixedWeeks = true, hideNavigation, listLabels = LIST_LABELS, showOutsideDays = true, showTodayDot = true, ...ownProps }) {
|
|
45
|
+
const props = useFieldProps(ownProps);
|
|
19
46
|
const lists = captionLayout === "lists";
|
|
20
47
|
const picker = /* @__PURE__ */ jsx(DayPicker, {
|
|
21
48
|
className: cn("p-3", className),
|
|
@@ -54,8 +81,9 @@ function Calendar({ captionLayout, className, classNames, components, fixedWeeks
|
|
|
54
81
|
captionLayout: lists ? "label" : captionLayout,
|
|
55
82
|
components: {
|
|
56
83
|
Chevron: CalendarChevron,
|
|
84
|
+
DayButton,
|
|
57
85
|
...lists && {
|
|
58
|
-
|
|
86
|
+
Month,
|
|
59
87
|
MonthCaption,
|
|
60
88
|
MonthGrid: MonthGrid$1
|
|
61
89
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calendar.js","names":["ListMonthCaption","ListMonthGrid"],"sources":["../../src/components/calendar.tsx"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"calendar.js","names":["React","ListMonth","ListMonthCaption","ListMonthGrid"],"sources":["../../src/components/calendar.tsx"],"sourcesContent":["'use client'\n\nimport { type DayButtonProps, DayPicker } from '@daypicker/react'\nimport { ChevronLeft, ChevronRight } from '@epilot/spark-icons'\nimport * as React from 'react'\nimport { CalendarFieldContext } from '../lib/calendar-field'\nimport {\n type CalendarListLabels,\n CalendarListsProvider,\n ListMonth,\n ListMonthCaption,\n ListMonthGrid,\n} from '../lib/calendar-lists'\nimport { cn } from '../utils/cn'\nimport { buttonVariants } from './button'\n\ntype DayPickerProps = React.ComponentProps<typeof DayPicker>\n\n// keeps the union on `mode`, which a plain Omit would flatten\ntype DistributiveOmit<T, K extends PropertyKey> = T extends unknown\n ? Omit<T, K>\n : never\n\ntype CalendarProps = DistributiveOmit<DayPickerProps, 'captionLayout'> & {\n /** `lists`: month and year each step with arrows and open a list in place of the days. */\n captionLayout?: DayPickerProps['captionLayout'] | 'lists'\n /** Names the year arrows of `captionLayout=\"lists\"`. */\n listLabels?: CalendarListLabels\n showTodayDot?: boolean\n}\n\nconst LIST_LABELS: CalendarListLabels = {\n nextYear: 'Next year',\n previousYear: 'Previous year',\n}\n\nfunction CalendarChevron({\n orientation,\n}: {\n orientation?: 'up' | 'down' | 'left' | 'right'\n}) {\n const Glyph = orientation === 'right' ? ChevronRight : ChevronLeft\n return (\n <Glyph\n className={cn(\n '[--spark-icon-size:20px]',\n orientation === 'up' && 'rotate-90',\n orientation === 'down' && '-rotate-90',\n )}\n />\n )\n}\n\nfunction DayButton({ day: _, modifiers, ...props }: DayButtonProps) {\n const ref = React.useRef<HTMLButtonElement>(null)\n React.useEffect(() => {\n if (modifiers.focused) ref.current?.focus({ preventScroll: true })\n }, [modifiers.focused])\n return <button ref={ref} {...props} />\n}\n\nfunction useFieldProps(props: Omit<CalendarProps, 'captionLayout'>) {\n const field = React.useContext(CalendarFieldContext)\n if (!field) return props as DayPickerProps\n return {\n autoFocus: true,\n defaultMonth: field.defaultMonth,\n endMonth: field.endMonth,\n startMonth: field.startMonth,\n ...props,\n disabled: [...field.disabled, props.disabled ?? []].flat(),\n mode: 'single',\n onSelect: field.onSelect,\n selected: field.selected,\n } as DayPickerProps\n}\n\n// Pass `locale` (from '@daypicker/react/locale') for localized month/weekday\n// names — the library ships no language default.\nfunction Calendar({\n captionLayout,\n className,\n classNames,\n components,\n fixedWeeks = true,\n hideNavigation,\n listLabels = LIST_LABELS,\n showOutsideDays = true,\n showTodayDot = true,\n ...ownProps\n}: CalendarProps) {\n const props = useFieldProps(ownProps)\n const lists = captionLayout === 'lists'\n const picker = (\n <DayPicker\n className={cn('p-3', className)}\n classNames={{\n months: 'relative',\n month: 'flex flex-col gap-2',\n month_caption: 'flex h-10 items-center justify-center',\n caption_label: 'text-sm font-bold text-gray',\n button_previous: cn(\n buttonVariants({ size: 'icon', variant: 'tertiary' }),\n 'absolute top-0 left-0 z-10 text-gray-light hover:text-gray focus-visible:focus-outline [[data-high-contrast]_&]:text-gray-a12',\n ),\n button_next: cn(\n buttonVariants({ size: 'icon', variant: 'tertiary' }),\n 'absolute top-0 right-0 z-10 text-gray-light hover:text-gray focus-visible:focus-outline [[data-high-contrast]_&]:text-gray-a12',\n ),\n month_grid: 'w-full border-collapse',\n weekdays: 'flex w-full justify-between',\n weekday:\n 'mt-0.5 flex h-10 w-10 items-center justify-center rounded-full text-sm font-bold text-gray',\n week: 'mt-1 flex w-full justify-between',\n day: cn(\n 'relative mx-0.5 flex h-10 w-10 items-center justify-center rounded-full p-0 text-center text-sm focus-within:relative focus-within:z-20',\n props.mode === 'range'\n ? '[&:has(>.range-end)]:rounded-r-full [&:has(>.range-start)]:rounded-l-full first:[&:has([aria-selected])]:rounded-l-full last:[&:has([aria-selected])]:rounded-r-full'\n : '[&:has([aria-selected])]:rounded-full',\n ),\n day_button: cn(\n buttonVariants({ size: 'icon', variant: 'tertiary' }),\n // hover:…:bg-(--spark-style-bg-hover) outranks tertiary's hover:bg-gray-a3 —\n // selected days darken like a solid button instead of washing out gray\n 'size-10 shrink-0 rounded-full p-0 font-normal text-gray focus-visible:focus-outline in-aria-selected:rounded-full in-aria-selected:bg-(--spark-style-bg,var(--color-primary)) in-aria-selected:text-(--spark-style-fg,var(--color-primary-foreground)) hover:in-aria-selected:bg-(--spark-style-bg-hover,var(--color-primary-hover)) [[data-high-contrast]_[data-outside]:not([data-disabled])_&]:text-gray-a12 [[data-outside]:not([data-disabled])_&]:text-gray-light',\n ),\n range_start: 'range-start',\n range_end: 'range-end',\n selected: 'rounded-full',\n today: cn(\n 'relative bg-base-gray-soft text-gray',\n showTodayDot &&\n 'after:absolute after:right-0 after:-bottom-1 after:left-0 after:m-auto after:inline-flex after:h-1 after:w-1 after:rounded-full after:bg-(--spark-style-bg,var(--color-primary)) after:content-[\"\"]',\n ),\n outside:\n 'outside aria-selected:bg-base-gray-soft aria-selected:text-gray-light',\n disabled: 'text-gray-light opacity-50',\n range_middle: 'aria-selected:bg-base-gray-soft aria-selected:text-gray',\n hidden: 'invisible',\n ...classNames,\n }}\n captionLayout={lists ? 'label' : captionLayout}\n components={{\n Chevron: CalendarChevron,\n DayButton,\n ...(lists && {\n Month: ListMonth,\n MonthCaption: ListMonthCaption,\n MonthGrid: ListMonthGrid,\n }),\n ...components,\n }}\n fixedWeeks={fixedWeeks}\n hideNavigation={lists || hideNavigation}\n showOutsideDays={showOutsideDays}\n {...props}\n />\n )\n return lists ? (\n <CalendarListsProvider labels={listLabels}>{picker}</CalendarListsProvider>\n ) : (\n picker\n )\n}\n\nexport { Calendar }\nexport type { CalendarProps }\n"],"mappings":";;;;;;;;;;;AA+BA,MAAM,cAAkC;CACtC,UAAU;CACV,cAAc;AAChB;AAEA,SAAS,gBAAgB,EACvB,eAGC;CAED,OACE,oBAFY,gBAAgB,UAAU,eAAe,aAErD,EACE,WAAW,GACT,4BACA,gBAAgB,QAAQ,aACxB,gBAAgB,U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AAW;GACX,UAAU;GACV,OAAO,GACL,wCACA,gBACE,uMACJ;GACA,SACE;GACF,UAAU;GACV,cAAc;GACd,QAAQ;GACR,GAAG;EACL;EACA,eAAe,QAAQ,UAAU;EACjC,YAAY;GACV,SAAS;GACT;GACA,GAAI,SAAS;IACJC;IACOC;IACd,WAAWC;GACb;GACA,GAAG;EACL;EACY;EACZ,gBAAgB,SAAS;EACR;EACjB,GAAI;CACL,CAAA;CAEH,OAAO,QACL,oBAAC,uBAAD;EAAuB,QAAQ;YAAa;CAA8B,CAAA,IAE1E;AAEJ"}
|
|
@@ -5,8 +5,8 @@ const require_components_button = require("./button.cjs");
|
|
|
5
5
|
let react = require("react");
|
|
6
6
|
react = require_chunk.__toESM(react);
|
|
7
7
|
let _epilot_spark_icons = require("@epilot/spark-icons");
|
|
8
|
-
let react_jsx_runtime = require("react/jsx-runtime");
|
|
9
8
|
let class_variance_authority = require("class-variance-authority");
|
|
9
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
10
10
|
let cn = require("cn");
|
|
11
11
|
//#region src/components/callout.tsx
|
|
12
12
|
const calloutVariants = (0, class_variance_authority.cva)("group/callout flex w-full items-start gap-2 rounded-lg px-4 py-3 text-sm transition-colors duration-150 ease-out motion-reduce:transition-none", {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import { ButtonProps } from "
|
|
3
|
+
import { r as ButtonProps } from "../button-DBcEcIMk.cjs";
|
|
4
4
|
import * as React$1 from "react";
|
|
5
5
|
import { VariantProps } from "class-variance-authority";
|
|
6
6
|
import { SparkIcon } from "@epilot/spark-icons";
|
|
@@ -3,8 +3,8 @@ import { cn } from "../utils/cn.js";
|
|
|
3
3
|
import { Button } from "./button.js";
|
|
4
4
|
import * as React$1 from "react";
|
|
5
5
|
import { Cancel, CheckCircle, Info, Warning } from "@epilot/spark-icons";
|
|
6
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
6
|
import { cva } from "class-variance-authority";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
8
|
//#region src/components/callout.tsx
|
|
9
9
|
const calloutVariants = cva("group/callout flex w-full items-start gap-2 rounded-lg px-4 py-3 text-sm transition-colors duration-150 ease-out motion-reduce:transition-none", {
|
|
10
10
|
variants: { variant: {
|
package/dist/components/card.cjs
CHANGED
|
@@ -4,9 +4,9 @@ const require_chunk = require("../chunk-DY84GLCh.cjs");
|
|
|
4
4
|
const require_lib_container_chrome = require("../lib/container-chrome.cjs");
|
|
5
5
|
let react = require("react");
|
|
6
6
|
react = require_chunk.__toESM(react);
|
|
7
|
-
let react_jsx_runtime = require("react/jsx-runtime");
|
|
8
7
|
let class_variance_authority = require("class-variance-authority");
|
|
9
8
|
let _base_ui_react_use_render = require("@base-ui/react/use-render");
|
|
9
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
10
10
|
let cn = require("cn");
|
|
11
11
|
//#region src/components/card.tsx
|
|
12
12
|
const cardVariants = (0, class_variance_authority.cva)("relative flex w-full flex-col gap-1 py-3", {
|
|
@@ -20,8 +20,9 @@ const cardVariants = (0, class_variance_authority.cva)("relative flex w-full fle
|
|
|
20
20
|
} },
|
|
21
21
|
defaultVariants: { variant: "ambient" }
|
|
22
22
|
});
|
|
23
|
-
const Card = react.forwardRef(({ className, variant, color, radius = "lg", elevated, render, ...props }, ref) => {
|
|
23
|
+
const Card = react.forwardRef(({ className, variant: variantProp, color, radius = "lg", elevated, render, ...props }, ref) => {
|
|
24
24
|
const interactive = render != null;
|
|
25
|
+
const variant = variantProp ?? (color === "success" || color === "warning" ? "soft" : void 0);
|
|
25
26
|
const resolved = variant ?? "ambient";
|
|
26
27
|
return (0, _base_ui_react_use_render.useRender)({
|
|
27
28
|
defaultTagName: "div",
|
|
@@ -30,8 +31,8 @@ const Card = react.forwardRef(({ className, variant, color, radius = "lg", eleva
|
|
|
30
31
|
"data-slot": "card",
|
|
31
32
|
"data-variant": variant,
|
|
32
33
|
"data-card-color": color,
|
|
33
|
-
"data-elevated": elevated ? "" : void 0,
|
|
34
|
-
className: (0, cn.cn)(cardVariants({ variant }), require_lib_container_chrome.radiusClasses[radius],
|
|
34
|
+
"data-elevated": elevated === "high" ? "high" : elevated ? "" : void 0,
|
|
35
|
+
className: (0, cn.cn)(cardVariants({ variant }), require_lib_container_chrome.radiusClasses[radius], require_lib_container_chrome.containerElevatedClasses(elevated), interactive && require_lib_container_chrome.containerInteractiveClasses(resolved, !!elevated), className),
|
|
35
36
|
ref,
|
|
36
37
|
...props
|
|
37
38
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"card.cjs","names":["containerChrome","containerPaddingX","React","radiusClasses","containerInteractiveClasses"],"sources":["../../src/components/card.tsx"],"sourcesContent":["import { useRender } from '@base-ui/react/use-render'\nimport { cva } from 'class-variance-authority'\nimport * as React from 'react'\nimport {\n containerChrome,\n
|
|
1
|
+
{"version":3,"file":"card.cjs","names":["containerChrome","containerPaddingX","React","radiusClasses","containerElevatedClasses","containerInteractiveClasses"],"sources":["../../src/components/card.tsx"],"sourcesContent":["import { useRender } from '@base-ui/react/use-render'\nimport { cva } from 'class-variance-authority'\nimport * as React from 'react'\nimport {\n containerChrome,\n containerElevatedClasses,\n containerInteractiveClasses,\n containerPaddingX,\n radiusClasses,\n type ContainerElevation,\n type ContainerRadius,\n} from '../lib/container-chrome'\nimport type { SparkCardColor, SparkCardVariant } from '../lib/theme-types'\nimport { cn } from '../utils/cn'\n\ntype CardRadius = ContainerRadius\n\n/** `success` and `warning` tint the chrome for a feedback card, such as a saving or a missing estimate. */\ntype CardColor = SparkCardColor | 'success' | 'warning'\n\nconst cardVariants = cva('relative flex w-full flex-col gap-1 py-3', {\n variants: {\n variant: {\n ambient: cn(containerChrome.ambient, containerPaddingX.ambient),\n soft: cn(containerChrome.soft, containerPaddingX.soft),\n surface: cn(containerChrome.surface, containerPaddingX.surface),\n outline: cn(containerChrome.outline, containerPaddingX.outline),\n ghost: cn(containerChrome.ghost, containerPaddingX.ghost),\n solid: cn(containerChrome.solid, containerPaddingX.solid),\n },\n },\n defaultVariants: {\n variant: 'ambient',\n },\n})\n\ninterface CardProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * Container chrome scoped to this card — NOT the ambient `data-style` knob\n * (that drives controls and would cascade into the card's content). Unset →\n * follows the app-level `[data-card-variant]` knob (default soft-neutral).\n */\n variant?: SparkCardVariant\n /** Chrome palette: `neutral` (default), brand `accent`, or the feedback `success` and `warning`. */\n color?: CardColor\n /** Corner radius, as a named step. Unset → `lg`, today's fixed behaviour. */\n radius?: CardRadius\n /**\n * An opaque `--spark-elevated` fill plus a shadow, so no variant bleeds a photo backdrop through.\n * `'high'` uses the stronger `--spark-card-shadow-high` (default `--spark-shadow-2`).\n */\n elevated?: ContainerElevation\n /**\n * Base UI polymorphism. Pass `<a href/>` or `<button/>` to make the whole\n * card interactive (hover tint, focus outline, disabled styles). Omit → static.\n */\n render?: useRender.RenderProp\n}\n\nconst Card = React.forwardRef<HTMLDivElement, CardProps>(\n (\n {\n className,\n variant: variantProp,\n color,\n radius = 'lg',\n elevated,\n render,\n ...props\n },\n ref,\n ) => {\n const interactive = render != null\n // the ambient chrome only re-tints under a Theme card knob; a feedback colour must always show\n const variant =\n variantProp ??\n (color === 'success' || color === 'warning' ? 'soft' : undefined)\n const resolved = variant ?? 'ambient'\n return useRender({\n defaultTagName: 'div',\n render,\n props: {\n 'data-slot': 'card',\n 'data-variant': variant,\n 'data-card-color': color,\n 'data-elevated':\n elevated === 'high' ? 'high' : elevated ? '' : undefined,\n className: cn(\n cardVariants({ variant }),\n radiusClasses[radius],\n containerElevatedClasses(elevated),\n interactive && containerInteractiveClasses(resolved, !!elevated),\n className,\n ),\n ref,\n ...props,\n },\n })\n },\n)\n\nCard.displayName = 'Card'\n\nconst CardHeader = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n className={cn('flex items-center gap-4', className)}\n ref={ref}\n {...props}\n />\n))\n\nCardHeader.displayName = 'CardHeader'\n\nconst CardIcon = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n className={cn(\n 'flex shrink-0 items-center justify-center text-(--spark-card-icon,var(--spark-a11))',\n className,\n )}\n ref={ref}\n {...props}\n />\n))\n\nCardIcon.displayName = 'CardIcon'\n\ninterface CardTitleProps extends React.HTMLAttributes<HTMLHeadingElement> {\n /** Base UI polymorphism. Pass `<h2/>` etc. to change the heading level. Omit → `<h3>`. */\n render?: useRender.RenderProp\n}\n\nconst CardTitle = React.forwardRef<HTMLHeadingElement, CardTitleProps>(\n ({ className, render, ...props }, ref) =>\n useRender({\n defaultTagName: 'h3',\n render,\n props: {\n className: cn(\n 'text-base leading-5 font-medium text-(--spark-card-fg,var(--neutral-a12))',\n className,\n ),\n ref,\n ...props,\n },\n }),\n)\n\nCardTitle.displayName = 'CardTitle'\n\nconst CardDescription = React.forwardRef<\n HTMLParagraphElement,\n React.HTMLAttributes<HTMLParagraphElement>\n>(({ className, ...props }, ref) => (\n <p\n className={cn(\n 'text-sm leading-5 text-(--spark-card-fg-muted,var(--neutral-a11))',\n className,\n )}\n ref={ref}\n {...props}\n />\n))\n\nCardDescription.displayName = 'CardDescription'\n\nconst CardContent = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div className={cn('', className)} ref={ref} {...props} />\n))\n\nCardContent.displayName = 'CardContent'\n\nconst CardFooter = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n className={cn(\n 'flex items-center justify-end gap-2 pt-2 text-(--spark-card-fg,var(--neutral-a12))',\n className,\n )}\n ref={ref}\n {...props}\n />\n))\n\nCardFooter.displayName = 'CardFooter'\n\nconst CardSkeleton = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n className={cn(\n 'relative flex w-full items-center gap-4 rounded-lg bg-spark-a3 p-4 opacity-80',\n className,\n )}\n ref={ref}\n {...props}\n >\n <div className=\"size-10 shrink-0 animate-pulse rounded-full bg-base-gray-soft motion-reduce:animate-none\" />\n <div className=\"flex flex-1 flex-col gap-y-2\">\n <div className=\"h-5 w-1/3 max-w-32 animate-pulse rounded-md bg-base-gray-soft motion-reduce:animate-none\" />\n <div className=\"h-4 w-1/2 max-w-48 animate-pulse rounded-md bg-base-gray-soft motion-reduce:animate-none\" />\n </div>\n </div>\n))\n\nCardSkeleton.displayName = 'CardSkeleton'\n\nexport {\n Card,\n CardContent,\n CardDescription,\n CardFooter,\n CardHeader,\n CardIcon,\n CardSkeleton,\n CardTitle,\n}\nexport type { CardColor, CardProps, CardRadius }\n"],"mappings":";;;;;;;;;;;AAoBA,MAAM,gBAAA,GAAA,yBAAA,KAAmB,4CAA4C;CACnE,UAAU,EACR,SAAS;EACP,UAAA,GAAA,GAAA,IAAYA,6BAAAA,gBAAgB,SAASC,6BAAAA,kBAAkB,OAAO;EAC9D,OAAA,GAAA,GAAA,IAASD,6BAAAA,gBAAgB,MAAMC,6BAAAA,kBAAkB,IAAI;EACrD,UAAA,GAAA,GAAA,IAAYD,6BAAAA,gBAAgB,SAASC,6BAAAA,kBAAkB,OAAO;EAC9D,UAAA,GAAA,GAAA,IAAYD,6BAAAA,gBAAgB,SAASC,6BAAAA,kBAAkB,OAAO;EAC9D,QAAA,GAAA,GAAA,IAAUD,6BAAAA,gBAAgB,OAAOC,6BAAAA,kBAAkB,KAAK;EACxD,QAAA,GAAA,GAAA,IAAUD,6BAAAA,gBAAgB,OAAOC,6BAAAA,kBAAkB,KAAK;CAC1D,EACF;CACA,iBAAiB,EACf,SAAS,UACX;AACF,CAAC;AAyBD,MAAM,OAAOC,MAAM,YAEf,EACE,WACA,SAAS,aACT,OACA,SAAS,MACT,UACA,QACA,GA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K;CACL,GAAI;AACL,CAAA,CACF;AAED,gBAAgB,cAAc;AAE9B,MAAM,cAAcA,MAAM,YAGvB,EAAE,WAAW,GAAG,SAAS,QAC1B,iBAAA,GAAA,kBAAA,KAAC,OAAD;CAAK,YAAA,GAAA,GAAA,IAAc,IAAI,SAAS;CAAQ;CAAK,GAAI;AAAQ,CAAA,CAC1D;AAED,YAAY,cAAc;AAE1B,MAAM,aAAaA,MAAM,YAGtB,EAAE,WAAW,GAAG,SAAS,QAC1B,iBAAA,GAAA,kBAAA,KAAC,OAAD;CACE,YAAA,GAAA,GAAA,IACE,sFACA,SACF;CACK;CACL,GAAI;AACL,CAAA,CACF;AAED,WAAW,cAAc;AAEzB,MAAM,eAAeA,MAAM,YAGxB,EAAE,WAAW,GAAG,SAAS,QAC1B,iBAAA,GAAA,kBAAA,MAAC,OAAD;CACE,YAAA,GAAA,GAAA,IACE,iFACA,SACF;CACK;CACL,GAAI;WANN,CAQE,iBAAA,GAAA,kBAAA,KAAC,OAAD,EAAK,WAAU,2FAA4F,CAAA,GAC3G,iBAAA,GAAA,kBAAA,MAAC,OAAD;EAAK,WAAU;YAAf,CACE,iBAAA,GAAA,kBAAA,KAAC,OAAD,EAAK,WAAU,2FAA4F,CAAA,GAC3G,iBAAA,GAAA,kBAAA,KAAC,OAAD,EAAK,WAAU,2FAA4F,CAAA,CACxG;GACF;EACN;AAED,aAAa,cAAc"}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { c as SparkCardColor, l as SparkCardVariant } from "../theme-types-CHl-L2F-.cjs";
|
|
4
|
-
import { ContainerRadius } from "../lib/container-chrome.cjs";
|
|
4
|
+
import { ContainerElevation, ContainerRadius } from "../lib/container-chrome.cjs";
|
|
5
5
|
import * as React$1 from "react";
|
|
6
6
|
import { useRender } from "@base-ui/react/use-render";
|
|
7
7
|
|
|
8
8
|
//#region src/components/card.d.ts
|
|
9
9
|
type CardRadius = ContainerRadius;
|
|
10
|
+
/** `success` and `warning` tint the chrome for a feedback card, such as a saving or a missing estimate. */
|
|
11
|
+
type CardColor = SparkCardColor | 'success' | 'warning';
|
|
10
12
|
interface CardProps extends React$1.HTMLAttributes<HTMLDivElement> {
|
|
11
13
|
/**
|
|
12
14
|
* Container chrome scoped to this card — NOT the ambient `data-style` knob
|
|
@@ -14,16 +16,15 @@ interface CardProps extends React$1.HTMLAttributes<HTMLDivElement> {
|
|
|
14
16
|
* follows the app-level `[data-card-variant]` knob (default soft-neutral).
|
|
15
17
|
*/
|
|
16
18
|
variant?: SparkCardVariant;
|
|
17
|
-
/** Chrome palette
|
|
18
|
-
color?:
|
|
19
|
+
/** Chrome palette: `neutral` (default), brand `accent`, or the feedback `success` and `warning`. */
|
|
20
|
+
color?: CardColor;
|
|
19
21
|
/** Corner radius, as a named step. Unset → `lg`, today's fixed behaviour. */
|
|
20
22
|
radius?: CardRadius;
|
|
21
23
|
/**
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* combination — including a translucent one like `soft` — can bleed it through.
|
|
24
|
+
* An opaque `--spark-elevated` fill plus a shadow, so no variant bleeds a photo backdrop through.
|
|
25
|
+
* `'high'` uses the stronger `--spark-card-shadow-high` (default `--spark-shadow-2`).
|
|
25
26
|
*/
|
|
26
|
-
elevated?:
|
|
27
|
+
elevated?: ContainerElevation;
|
|
27
28
|
/**
|
|
28
29
|
* Base UI polymorphism. Pass `<a href/>` or `<button/>` to make the whole
|
|
29
30
|
* card interactive (hover tint, focus outline, disabled styles). Omit → static.
|
|
@@ -43,5 +44,5 @@ declare const CardContent: React$1.ForwardRefExoticComponent<React$1.HTMLAttribu
|
|
|
43
44
|
declare const CardFooter: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLDivElement> & React$1.RefAttributes<HTMLDivElement>>;
|
|
44
45
|
declare const CardSkeleton: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLDivElement> & React$1.RefAttributes<HTMLDivElement>>;
|
|
45
46
|
//#endregion
|
|
46
|
-
export { Card, CardContent, CardDescription, CardFooter, CardHeader, CardIcon, type CardProps, type CardRadius, CardSkeleton, CardTitle };
|
|
47
|
+
export { Card, type CardColor, CardContent, CardDescription, CardFooter, CardHeader, CardIcon, type CardProps, type CardRadius, CardSkeleton, CardTitle };
|
|
47
48
|
//# sourceMappingURL=card.d.cts.map
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { c as SparkCardColor, l as SparkCardVariant } from "../theme-types-CHl-L2F-.js";
|
|
4
|
-
import { ContainerRadius } from "../lib/container-chrome.js";
|
|
4
|
+
import { ContainerElevation, ContainerRadius } from "../lib/container-chrome.js";
|
|
5
5
|
import * as React$1 from "react";
|
|
6
6
|
import { useRender } from "@base-ui/react/use-render";
|
|
7
7
|
|
|
8
8
|
//#region src/components/card.d.ts
|
|
9
9
|
type CardRadius = ContainerRadius;
|
|
10
|
+
/** `success` and `warning` tint the chrome for a feedback card, such as a saving or a missing estimate. */
|
|
11
|
+
type CardColor = SparkCardColor | 'success' | 'warning';
|
|
10
12
|
interface CardProps extends React$1.HTMLAttributes<HTMLDivElement> {
|
|
11
13
|
/**
|
|
12
14
|
* Container chrome scoped to this card — NOT the ambient `data-style` knob
|
|
@@ -14,16 +16,15 @@ interface CardProps extends React$1.HTMLAttributes<HTMLDivElement> {
|
|
|
14
16
|
* follows the app-level `[data-card-variant]` knob (default soft-neutral).
|
|
15
17
|
*/
|
|
16
18
|
variant?: SparkCardVariant;
|
|
17
|
-
/** Chrome palette
|
|
18
|
-
color?:
|
|
19
|
+
/** Chrome palette: `neutral` (default), brand `accent`, or the feedback `success` and `warning`. */
|
|
20
|
+
color?: CardColor;
|
|
19
21
|
/** Corner radius, as a named step. Unset → `lg`, today's fixed behaviour. */
|
|
20
22
|
radius?: CardRadius;
|
|
21
23
|
/**
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* combination — including a translucent one like `soft` — can bleed it through.
|
|
24
|
+
* An opaque `--spark-elevated` fill plus a shadow, so no variant bleeds a photo backdrop through.
|
|
25
|
+
* `'high'` uses the stronger `--spark-card-shadow-high` (default `--spark-shadow-2`).
|
|
25
26
|
*/
|
|
26
|
-
elevated?:
|
|
27
|
+
elevated?: ContainerElevation;
|
|
27
28
|
/**
|
|
28
29
|
* Base UI polymorphism. Pass `<a href/>` or `<button/>` to make the whole
|
|
29
30
|
* card interactive (hover tint, focus outline, disabled styles). Omit → static.
|
|
@@ -43,5 +44,5 @@ declare const CardContent: React$1.ForwardRefExoticComponent<React$1.HTMLAttribu
|
|
|
43
44
|
declare const CardFooter: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLDivElement> & React$1.RefAttributes<HTMLDivElement>>;
|
|
44
45
|
declare const CardSkeleton: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLDivElement> & React$1.RefAttributes<HTMLDivElement>>;
|
|
45
46
|
//#endregion
|
|
46
|
-
export { Card, CardContent, CardDescription, CardFooter, CardHeader, CardIcon, type CardProps, type CardRadius, CardSkeleton, CardTitle };
|
|
47
|
+
export { Card, type CardColor, CardContent, CardDescription, CardFooter, CardHeader, CardIcon, type CardProps, type CardRadius, CardSkeleton, CardTitle };
|
|
47
48
|
//# sourceMappingURL=card.d.ts.map
|
package/dist/components/card.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn } from "../utils/cn.js";
|
|
3
|
-
import { containerChrome, containerInteractiveClasses, containerPaddingX, radiusClasses } from "../lib/container-chrome.js";
|
|
3
|
+
import { containerChrome, containerElevatedClasses, containerInteractiveClasses, containerPaddingX, radiusClasses } from "../lib/container-chrome.js";
|
|
4
4
|
import * as React$1 from "react";
|
|
5
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
5
|
import { cva } from "class-variance-authority";
|
|
7
6
|
import { useRender } from "@base-ui/react/use-render";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
8
|
//#region src/components/card.tsx
|
|
9
9
|
const cardVariants = cva("relative flex w-full flex-col gap-1 py-3", {
|
|
10
10
|
variants: { variant: {
|
|
@@ -17,8 +17,9 @@ const cardVariants = cva("relative flex w-full flex-col gap-1 py-3", {
|
|
|
17
17
|
} },
|
|
18
18
|
defaultVariants: { variant: "ambient" }
|
|
19
19
|
});
|
|
20
|
-
const Card = React$1.forwardRef(({ className, variant, color, radius = "lg", elevated, render, ...props }, ref) => {
|
|
20
|
+
const Card = React$1.forwardRef(({ className, variant: variantProp, color, radius = "lg", elevated, render, ...props }, ref) => {
|
|
21
21
|
const interactive = render != null;
|
|
22
|
+
const variant = variantProp ?? (color === "success" || color === "warning" ? "soft" : void 0);
|
|
22
23
|
const resolved = variant ?? "ambient";
|
|
23
24
|
return useRender({
|
|
24
25
|
defaultTagName: "div",
|
|
@@ -27,8 +28,8 @@ const Card = React$1.forwardRef(({ className, variant, color, radius = "lg", ele
|
|
|
27
28
|
"data-slot": "card",
|
|
28
29
|
"data-variant": variant,
|
|
29
30
|
"data-card-color": color,
|
|
30
|
-
"data-elevated": elevated ? "" : void 0,
|
|
31
|
-
className: cn(cardVariants({ variant }), radiusClasses[radius],
|
|
31
|
+
"data-elevated": elevated === "high" ? "high" : elevated ? "" : void 0,
|
|
32
|
+
className: cn(cardVariants({ variant }), radiusClasses[radius], containerElevatedClasses(elevated), interactive && containerInteractiveClasses(resolved, !!elevated), className),
|
|
32
33
|
ref,
|
|
33
34
|
...props
|
|
34
35
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"card.js","names":["React"],"sources":["../../src/components/card.tsx"],"sourcesContent":["import { useRender } from '@base-ui/react/use-render'\nimport { cva } from 'class-variance-authority'\nimport * as React from 'react'\nimport {\n containerChrome,\n
|
|
1
|
+
{"version":3,"file":"card.js","names":["React"],"sources":["../../src/components/card.tsx"],"sourcesContent":["import { useRender } from '@base-ui/react/use-render'\nimport { cva } from 'class-variance-authority'\nimport * as React from 'react'\nimport {\n containerChrome,\n containerElevatedClasses,\n containerInteractiveClasses,\n containerPaddingX,\n radiusClasses,\n type ContainerElevation,\n type ContainerRadius,\n} from '../lib/container-chrome'\nimport type { SparkCardColor, SparkCardVariant } from '../lib/theme-types'\nimport { cn } from '../utils/cn'\n\ntype CardRadius = ContainerRadius\n\n/** `success` and `warning` tint the chrome for a feedback card, such as a saving or a missing estimate. */\ntype CardColor = SparkCardColor | 'success' | 'warning'\n\nconst cardVariants = cva('relative flex w-full flex-col gap-1 py-3', {\n variants: {\n variant: {\n ambient: cn(containerChrome.ambient, containerPaddingX.ambient),\n soft: cn(containerChrome.soft, containerPaddingX.soft),\n surface: cn(containerChrome.surface, containerPaddingX.surface),\n outline: cn(containerChrome.outline, containerPaddingX.outline),\n ghost: cn(containerChrome.ghost, containerPaddingX.ghost),\n solid: cn(containerChrome.solid, containerPaddingX.solid),\n },\n },\n defaultVariants: {\n variant: 'ambient',\n },\n})\n\ninterface CardProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * Container chrome scoped to this card — NOT the ambient `data-style` knob\n * (that drives controls and would cascade into the card's content). Unset →\n * follows the app-level `[data-card-variant]` knob (default soft-neutral).\n */\n variant?: SparkCardVariant\n /** Chrome palette: `neutral` (default), brand `accent`, or the feedback `success` and `warning`. */\n color?: CardColor\n /** Corner radius, as a named step. Unset → `lg`, today's fixed behaviour. */\n radius?: CardRadius\n /**\n * An opaque `--spark-elevated` fill plus a shadow, so no variant bleeds a photo backdrop through.\n * `'high'` uses the stronger `--spark-card-shadow-high` (default `--spark-shadow-2`).\n */\n elevated?: ContainerElevation\n /**\n * Base UI polymorphism. Pass `<a href/>` or `<button/>` to make the whole\n * card interactive (hover tint, focus outline, disabled styles). Omit → static.\n */\n render?: useRender.RenderProp\n}\n\nconst Card = React.forwardRef<HTMLDivElement, CardProps>(\n (\n {\n className,\n variant: variantProp,\n color,\n radius = 'lg',\n elevated,\n render,\n ...props\n },\n ref,\n ) => {\n const interactive = render != null\n // the ambient chrome only re-tints under a Theme card knob; a feedback colour must always show\n const variant =\n variantProp ??\n (color === 'success' || color === 'warning' ? 'soft' : undefined)\n const resolved = variant ?? 'ambient'\n return useRender({\n defaultTagName: 'div',\n render,\n props: {\n 'data-slot': 'card',\n 'data-variant': variant,\n 'data-card-color': color,\n 'data-elevated':\n elevated === 'high' ? 'high' : elevated ? '' : undefined,\n className: cn(\n cardVariants({ variant }),\n radiusClasses[radius],\n containerElevatedClasses(elevated),\n interactive && containerInteractiveClasses(resolved, !!elevated),\n className,\n ),\n ref,\n ...props,\n },\n })\n },\n)\n\nCard.displayName = 'Card'\n\nconst CardHeader = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n className={cn('flex items-center gap-4', className)}\n ref={ref}\n {...props}\n />\n))\n\nCardHeader.displayName = 'CardHeader'\n\nconst CardIcon = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n className={cn(\n 'flex shrink-0 items-center justify-center text-(--spark-card-icon,var(--spark-a11))',\n className,\n )}\n ref={ref}\n {...props}\n />\n))\n\nCardIcon.displayName = 'CardIcon'\n\ninterface CardTitleProps extends React.HTMLAttributes<HTMLHeadingElement> {\n /** Base UI polymorphism. Pass `<h2/>` etc. to change the heading level. Omit → `<h3>`. */\n render?: useRender.RenderProp\n}\n\nconst CardTitle = React.forwardRef<HTMLHeadingElement, CardTitleProps>(\n ({ className, render, ...props }, ref) =>\n useRender({\n defaultTagName: 'h3',\n render,\n props: {\n className: cn(\n 'text-base leading-5 font-medium text-(--spark-card-fg,var(--neutral-a12))',\n className,\n ),\n ref,\n ...props,\n },\n }),\n)\n\nCardTitle.displayName = 'CardTitle'\n\nconst CardDescription = React.forwardRef<\n HTMLParagraphElement,\n React.HTMLAttributes<HTMLParagraphElement>\n>(({ className, ...props }, ref) => (\n <p\n className={cn(\n 'text-sm leading-5 text-(--spark-card-fg-muted,var(--neutral-a11))',\n className,\n )}\n ref={ref}\n {...props}\n />\n))\n\nCardDescription.displayName = 'CardDescription'\n\nconst CardContent = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div className={cn('', className)} ref={ref} {...props} />\n))\n\nCardContent.displayName = 'CardContent'\n\nconst CardFooter = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n className={cn(\n 'flex items-center justify-end gap-2 pt-2 text-(--spark-card-fg,var(--neutral-a12))',\n className,\n )}\n ref={ref}\n {...props}\n />\n))\n\nCardFooter.displayName = 'CardFooter'\n\nconst CardSkeleton = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n className={cn(\n 'relative flex w-full items-center gap-4 rounded-lg bg-spark-a3 p-4 opacity-80',\n className,\n )}\n ref={ref}\n {...props}\n >\n <div className=\"size-10 shrink-0 animate-pulse rounded-full bg-base-gray-soft motion-reduce:animate-none\" />\n <div className=\"flex flex-1 flex-col gap-y-2\">\n <div className=\"h-5 w-1/3 max-w-32 animate-pulse rounded-md bg-base-gray-soft motion-reduce:animate-none\" />\n <div className=\"h-4 w-1/2 max-w-48 animate-pulse rounded-md bg-base-gray-soft motion-reduce:animate-none\" />\n </div>\n </div>\n))\n\nCardSkeleton.displayName = 'CardSkeleton'\n\nexport {\n Card,\n CardContent,\n CardDescription,\n CardFooter,\n CardHeader,\n CardIcon,\n CardSkeleton,\n CardTitle,\n}\nexport type { CardColor, CardProps, CardRadius }\n"],"mappings":";;;;;;;;AAoBA,MAAM,eAAe,IAAI,4CAA4C;CACnE,UAAU,EACR,SAAS;EACP,SAAS,GAAG,gBAAgB,SAAS,kBAAkB,OAAO;EAC9D,MAAM,GAAG,gBAAgB,MAAM,kBAAkB,IAAI;EACrD,SAAS,GAAG,gBAAgB,SAAS,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