@fanvue/ui 2.21.0 → 3.0.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/cjs/components/Accordion/AccordionContent.cjs +1 -1
- package/dist/cjs/components/Accordion/AccordionContent.cjs.map +1 -1
- package/dist/cjs/components/Accordion/AccordionTrigger.cjs +2 -2
- package/dist/cjs/components/Accordion/AccordionTrigger.cjs.map +1 -1
- package/dist/cjs/components/Alert/Alert.cjs +2 -2
- package/dist/cjs/components/Alert/Alert.cjs.map +1 -1
- package/dist/cjs/components/AudioUpload/AudioUpload.cjs +6 -6
- package/dist/cjs/components/AudioUpload/AudioUpload.cjs.map +1 -1
- package/dist/cjs/components/Autocomplete/Autocomplete.cjs +6 -6
- package/dist/cjs/components/Autocomplete/Autocomplete.cjs.map +1 -1
- package/dist/cjs/components/Autocomplete/AutocompleteDropdownContent.cjs +4 -4
- package/dist/cjs/components/Autocomplete/AutocompleteDropdownContent.cjs.map +1 -1
- package/dist/cjs/components/Autocomplete/AutocompleteOptionItem.cjs +1 -1
- package/dist/cjs/components/Autocomplete/AutocompleteOptionItem.cjs.map +1 -1
- package/dist/cjs/components/Autocomplete/AutocompleteTag.cjs +1 -1
- package/dist/cjs/components/Autocomplete/AutocompleteTag.cjs.map +1 -1
- package/dist/cjs/components/Badge/Badge.cjs +12 -12
- package/dist/cjs/components/Badge/Badge.cjs.map +1 -1
- package/dist/cjs/components/Banner/Banner.cjs +11 -11
- package/dist/cjs/components/Banner/Banner.cjs.map +1 -1
- package/dist/cjs/components/BottomNavigation/BottomNavigation.cjs +2 -2
- package/dist/cjs/components/BottomNavigation/BottomNavigation.cjs.map +1 -1
- package/dist/cjs/components/BottomNavigation/BottomNavigationAction.cjs +2 -2
- package/dist/cjs/components/BottomNavigation/BottomNavigationAction.cjs.map +1 -1
- package/dist/cjs/components/Breadcrumb/Breadcrumb.cjs +2 -2
- package/dist/cjs/components/Breadcrumb/Breadcrumb.cjs.map +1 -1
- package/dist/cjs/components/Button/Button.cjs +9 -9
- package/dist/cjs/components/Button/Button.cjs.map +1 -1
- package/dist/cjs/components/Card/Card.cjs +2 -2
- package/dist/cjs/components/Card/Card.cjs.map +1 -1
- package/dist/cjs/components/Chart/ChartCard.cjs +4 -4
- package/dist/cjs/components/Chart/ChartCard.cjs.map +1 -1
- package/dist/cjs/components/Chart/ChartPieLegend.cjs +2 -2
- package/dist/cjs/components/Chart/ChartPieLegend.cjs.map +1 -1
- package/dist/cjs/components/Chart/ChartSeriesToggle.cjs +1 -1
- package/dist/cjs/components/Chart/ChartSeriesToggle.cjs.map +1 -1
- package/dist/cjs/components/ChatInput/ChatInput.cjs +4 -4
- package/dist/cjs/components/ChatInput/ChatInput.cjs.map +1 -1
- package/dist/cjs/components/Checkbox/Checkbox.cjs +3 -3
- package/dist/cjs/components/Checkbox/Checkbox.cjs.map +1 -1
- package/dist/cjs/components/Chip/Chip.cjs +3 -3
- package/dist/cjs/components/Chip/Chip.cjs.map +1 -1
- package/dist/cjs/components/Count/Count.cjs +7 -7
- package/dist/cjs/components/Count/Count.cjs.map +1 -1
- package/dist/cjs/components/CreatorCard/CreatorCard.cjs +4 -4
- package/dist/cjs/components/CreatorCard/CreatorCard.cjs.map +1 -1
- package/dist/cjs/components/CreatorCover/CreatorCover.cjs +5 -5
- package/dist/cjs/components/CreatorCover/CreatorCover.cjs.map +1 -1
- package/dist/cjs/components/CreatorTile/CreatorTile.cjs +2 -2
- package/dist/cjs/components/CreatorTile/CreatorTile.cjs.map +1 -1
- package/dist/cjs/components/DatePicker/DatePicker.cjs +5 -5
- package/dist/cjs/components/DatePicker/DatePicker.cjs.map +1 -1
- package/dist/cjs/components/Dialog/Dialog.cjs +4 -4
- package/dist/cjs/components/Dialog/Dialog.cjs.map +1 -1
- package/dist/cjs/components/Divider/Divider.cjs +1 -1
- package/dist/cjs/components/Divider/Divider.cjs.map +1 -1
- package/dist/cjs/components/Drawer/Drawer.cjs +3 -3
- package/dist/cjs/components/Drawer/Drawer.cjs.map +1 -1
- package/dist/cjs/components/DropdownMenu/DropdownMenu.cjs +13 -13
- package/dist/cjs/components/DropdownMenu/DropdownMenu.cjs.map +1 -1
- package/dist/cjs/components/EmptyState/EmptyState.cjs +6 -6
- package/dist/cjs/components/EmptyState/EmptyState.cjs.map +1 -1
- package/dist/cjs/components/IconButton/IconButton.cjs +6 -6
- package/dist/cjs/components/IconButton/IconButton.cjs.map +1 -1
- package/dist/cjs/components/InfoBox/InfoBox.cjs +4 -4
- package/dist/cjs/components/InfoBox/InfoBox.cjs.map +1 -1
- package/dist/cjs/components/InlineEdit/InlineEdit.cjs +1 -1
- package/dist/cjs/components/InlineEdit/InlineEdit.cjs.map +1 -1
- package/dist/cjs/components/Logo/Logo.cjs +2 -2
- package/dist/cjs/components/Logo/Logo.cjs.map +1 -1
- package/dist/cjs/components/MobileStepper/MobileStepper.cjs +1 -1
- package/dist/cjs/components/MobileStepper/MobileStepper.cjs.map +1 -1
- package/dist/cjs/components/Pagination/Pagination.cjs +1 -1
- package/dist/cjs/components/Pagination/Pagination.cjs.map +1 -1
- package/dist/cjs/components/Pill/Pill.cjs +5 -5
- package/dist/cjs/components/Pill/Pill.cjs.map +1 -1
- package/dist/cjs/components/ProgressBar/ProgressBar.cjs +5 -5
- package/dist/cjs/components/ProgressBar/ProgressBar.cjs.map +1 -1
- package/dist/cjs/components/Radio/Radio.cjs +3 -3
- package/dist/cjs/components/Radio/Radio.cjs.map +1 -1
- package/dist/cjs/components/Select/Select.cjs +11 -8
- package/dist/cjs/components/Select/Select.cjs.map +1 -1
- package/dist/cjs/components/Skeleton/Skeleton.cjs +1 -1
- package/dist/cjs/components/Skeleton/Skeleton.cjs.map +1 -1
- package/dist/cjs/components/Slider/SliderLayout.cjs +12 -5
- package/dist/cjs/components/Slider/SliderLayout.cjs.map +1 -1
- package/dist/cjs/components/Slider/SliderThumb.cjs +3 -3
- package/dist/cjs/components/Slider/SliderThumb.cjs.map +1 -1
- package/dist/cjs/components/Snackbar/Snackbar.cjs +6 -6
- package/dist/cjs/components/Snackbar/Snackbar.cjs.map +1 -1
- package/dist/cjs/components/Stepper/StepperStep.cjs +9 -9
- package/dist/cjs/components/Stepper/StepperStep.cjs.map +1 -1
- package/dist/cjs/components/Switch/Switch.cjs +1 -1
- package/dist/cjs/components/Switch/Switch.cjs.map +1 -1
- package/dist/cjs/components/SwitchField/SwitchField.cjs +2 -2
- package/dist/cjs/components/SwitchField/SwitchField.cjs.map +1 -1
- package/dist/cjs/components/SwitchToggle/SwitchToggle.cjs +1 -1
- package/dist/cjs/components/SwitchToggle/SwitchToggle.cjs.map +1 -1
- package/dist/cjs/components/Table/Table.cjs +7 -7
- package/dist/cjs/components/Table/Table.cjs.map +1 -1
- package/dist/cjs/components/Table/TablePagination.cjs +2 -2
- package/dist/cjs/components/Table/TablePagination.cjs.map +1 -1
- package/dist/cjs/components/Tabs/TabsTrigger.cjs +2 -2
- package/dist/cjs/components/Tabs/TabsTrigger.cjs.map +1 -1
- package/dist/cjs/components/TextArea/TextArea.cjs +5 -5
- package/dist/cjs/components/TextArea/TextArea.cjs.map +1 -1
- package/dist/cjs/components/TextField/TextField.cjs +5 -5
- package/dist/cjs/components/TextField/TextField.cjs.map +1 -1
- package/dist/cjs/components/Toast/Toast.cjs +2 -2
- package/dist/cjs/components/Toast/Toast.cjs.map +1 -1
- package/dist/cjs/components/Tooltip/Tooltip.cjs +1 -1
- package/dist/cjs/components/Tooltip/Tooltip.cjs.map +1 -1
- package/dist/components/Accordion/AccordionContent.mjs +1 -1
- package/dist/components/Accordion/AccordionContent.mjs.map +1 -1
- package/dist/components/Accordion/AccordionTrigger.mjs +2 -2
- package/dist/components/Accordion/AccordionTrigger.mjs.map +1 -1
- package/dist/components/Alert/Alert.mjs +2 -2
- package/dist/components/Alert/Alert.mjs.map +1 -1
- package/dist/components/AudioUpload/AudioUpload.mjs +6 -6
- package/dist/components/AudioUpload/AudioUpload.mjs.map +1 -1
- package/dist/components/Autocomplete/Autocomplete.mjs +6 -6
- package/dist/components/Autocomplete/Autocomplete.mjs.map +1 -1
- package/dist/components/Autocomplete/AutocompleteDropdownContent.mjs +4 -4
- package/dist/components/Autocomplete/AutocompleteDropdownContent.mjs.map +1 -1
- package/dist/components/Autocomplete/AutocompleteOptionItem.mjs +1 -1
- package/dist/components/Autocomplete/AutocompleteOptionItem.mjs.map +1 -1
- package/dist/components/Autocomplete/AutocompleteTag.mjs +1 -1
- package/dist/components/Autocomplete/AutocompleteTag.mjs.map +1 -1
- package/dist/components/Badge/Badge.mjs +12 -12
- package/dist/components/Badge/Badge.mjs.map +1 -1
- package/dist/components/Banner/Banner.mjs +11 -11
- package/dist/components/Banner/Banner.mjs.map +1 -1
- package/dist/components/BottomNavigation/BottomNavigation.mjs +2 -2
- package/dist/components/BottomNavigation/BottomNavigation.mjs.map +1 -1
- package/dist/components/BottomNavigation/BottomNavigationAction.mjs +2 -2
- package/dist/components/BottomNavigation/BottomNavigationAction.mjs.map +1 -1
- package/dist/components/Breadcrumb/Breadcrumb.mjs +2 -2
- package/dist/components/Breadcrumb/Breadcrumb.mjs.map +1 -1
- package/dist/components/Button/Button.mjs +9 -9
- package/dist/components/Button/Button.mjs.map +1 -1
- package/dist/components/Card/Card.mjs +2 -2
- package/dist/components/Card/Card.mjs.map +1 -1
- package/dist/components/Chart/ChartCard.mjs +4 -4
- package/dist/components/Chart/ChartCard.mjs.map +1 -1
- package/dist/components/Chart/ChartPieLegend.mjs +2 -2
- package/dist/components/Chart/ChartPieLegend.mjs.map +1 -1
- package/dist/components/Chart/ChartSeriesToggle.mjs +1 -1
- package/dist/components/Chart/ChartSeriesToggle.mjs.map +1 -1
- package/dist/components/ChatInput/ChatInput.mjs +4 -4
- package/dist/components/ChatInput/ChatInput.mjs.map +1 -1
- package/dist/components/Checkbox/Checkbox.mjs +3 -3
- package/dist/components/Checkbox/Checkbox.mjs.map +1 -1
- package/dist/components/Chip/Chip.mjs +3 -3
- package/dist/components/Chip/Chip.mjs.map +1 -1
- package/dist/components/Count/Count.mjs +7 -7
- package/dist/components/Count/Count.mjs.map +1 -1
- package/dist/components/CreatorCard/CreatorCard.mjs +4 -4
- package/dist/components/CreatorCard/CreatorCard.mjs.map +1 -1
- package/dist/components/CreatorCover/CreatorCover.mjs +5 -5
- package/dist/components/CreatorCover/CreatorCover.mjs.map +1 -1
- package/dist/components/CreatorTile/CreatorTile.mjs +2 -2
- package/dist/components/CreatorTile/CreatorTile.mjs.map +1 -1
- package/dist/components/DatePicker/DatePicker.mjs +5 -5
- package/dist/components/DatePicker/DatePicker.mjs.map +1 -1
- package/dist/components/Dialog/Dialog.mjs +4 -4
- package/dist/components/Dialog/Dialog.mjs.map +1 -1
- package/dist/components/Divider/Divider.mjs +1 -1
- package/dist/components/Divider/Divider.mjs.map +1 -1
- package/dist/components/Drawer/Drawer.mjs +3 -3
- package/dist/components/Drawer/Drawer.mjs.map +1 -1
- package/dist/components/DropdownMenu/DropdownMenu.mjs +13 -13
- package/dist/components/DropdownMenu/DropdownMenu.mjs.map +1 -1
- package/dist/components/EmptyState/EmptyState.mjs +6 -6
- package/dist/components/EmptyState/EmptyState.mjs.map +1 -1
- package/dist/components/IconButton/IconButton.mjs +6 -6
- package/dist/components/IconButton/IconButton.mjs.map +1 -1
- package/dist/components/InfoBox/InfoBox.mjs +4 -4
- package/dist/components/InfoBox/InfoBox.mjs.map +1 -1
- package/dist/components/InlineEdit/InlineEdit.mjs +1 -1
- package/dist/components/InlineEdit/InlineEdit.mjs.map +1 -1
- package/dist/components/Logo/Logo.mjs +2 -2
- package/dist/components/Logo/Logo.mjs.map +1 -1
- package/dist/components/MobileStepper/MobileStepper.mjs +1 -1
- package/dist/components/MobileStepper/MobileStepper.mjs.map +1 -1
- package/dist/components/Pagination/Pagination.mjs +1 -1
- package/dist/components/Pagination/Pagination.mjs.map +1 -1
- package/dist/components/Pill/Pill.mjs +5 -5
- package/dist/components/Pill/Pill.mjs.map +1 -1
- package/dist/components/ProgressBar/ProgressBar.mjs +5 -5
- package/dist/components/ProgressBar/ProgressBar.mjs.map +1 -1
- package/dist/components/Radio/Radio.mjs +3 -3
- package/dist/components/Radio/Radio.mjs.map +1 -1
- package/dist/components/Select/Select.mjs +11 -8
- package/dist/components/Select/Select.mjs.map +1 -1
- package/dist/components/Skeleton/Skeleton.mjs +1 -1
- package/dist/components/Skeleton/Skeleton.mjs.map +1 -1
- package/dist/components/Slider/SliderLayout.mjs +12 -5
- package/dist/components/Slider/SliderLayout.mjs.map +1 -1
- package/dist/components/Slider/SliderThumb.mjs +3 -3
- package/dist/components/Slider/SliderThumb.mjs.map +1 -1
- package/dist/components/Snackbar/Snackbar.mjs +6 -6
- package/dist/components/Snackbar/Snackbar.mjs.map +1 -1
- package/dist/components/Stepper/StepperStep.mjs +9 -9
- package/dist/components/Stepper/StepperStep.mjs.map +1 -1
- package/dist/components/Switch/Switch.mjs +1 -1
- package/dist/components/Switch/Switch.mjs.map +1 -1
- package/dist/components/SwitchField/SwitchField.mjs +2 -2
- package/dist/components/SwitchField/SwitchField.mjs.map +1 -1
- package/dist/components/SwitchToggle/SwitchToggle.mjs +1 -1
- package/dist/components/SwitchToggle/SwitchToggle.mjs.map +1 -1
- package/dist/components/Table/Table.mjs +7 -7
- package/dist/components/Table/Table.mjs.map +1 -1
- package/dist/components/Table/TablePagination.mjs +2 -2
- package/dist/components/Table/TablePagination.mjs.map +1 -1
- package/dist/components/Tabs/TabsTrigger.mjs +2 -2
- package/dist/components/Tabs/TabsTrigger.mjs.map +1 -1
- package/dist/components/TextArea/TextArea.mjs +5 -5
- package/dist/components/TextArea/TextArea.mjs.map +1 -1
- package/dist/components/TextField/TextField.mjs +5 -5
- package/dist/components/TextField/TextField.mjs.map +1 -1
- package/dist/components/Toast/Toast.mjs +2 -2
- package/dist/components/Toast/Toast.mjs.map +1 -1
- package/dist/components/Tooltip/Tooltip.mjs +1 -1
- package/dist/components/Tooltip/Tooltip.mjs.map +1 -1
- package/dist/styles/base.css +2 -2
- package/dist/styles/theme.css +626 -195
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Snackbar.cjs","sources":["../../../../src/components/Snackbar/Snackbar.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { Button } from \"../Button/Button\";\nimport { IconButton } from \"../IconButton/IconButton\";\nimport { CrossIcon } from \"../Icons/CrossIcon\";\n\n/** Layout variant of the snackbar. */\nexport type SnackbarVariant = \"default\" | \"vipEarn\" | \"welcome\";\n\nexport interface SnackbarProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"title\"> {\n /** Layout variant of the snackbar. @default \"default\" */\n variant?: SnackbarVariant;\n /** Icon element displayed at the leading edge (used by the `vipEarn` variant). */\n icon?: React.ReactNode;\n /** Title content. */\n title?: React.ReactNode;\n /** Descriptive body text. */\n description?: React.ReactNode;\n /** Whether to show primary/secondary action buttons. @default true */\n showActions?: boolean;\n /** Primary CTA label — renders a default {@link Button}. */\n primaryLabel?: string;\n /** Click handler for the primary CTA (used together with `primaryLabel`). */\n primaryOnClick?: () => void;\n /** Custom element rendered as the primary CTA. Overrides `primaryLabel` / `primaryOnClick`. */\n primarySlot?: React.ReactNode;\n /** Secondary CTA label — renders a default {@link Button}. */\n secondaryLabel?: string;\n /** Click handler for the secondary CTA (used together with `secondaryLabel`). */\n secondaryOnClick?: () => void;\n /** Custom element rendered as the secondary CTA. Overrides `secondaryLabel` / `secondaryOnClick`. */\n secondarySlot?: React.ReactNode;\n /** Whether to show the close button. @default false */\n closable?: boolean;\n /** Callback fired when the close button is clicked. */\n onClose?: () => void;\n /** Accessible label for the close button. @default \"Close snackbar\" */\n closeLabel?: string;\n}\n\nfunction CloseButton({\n onClose,\n className,\n closeLabel = \"Close snackbar\",\n}: {\n onClose?: () => void;\n className?: string;\n closeLabel?: string;\n}) {\n return (\n <IconButton\n variant=\"tertiary\"\n size=\"24\"\n onClick={onClose}\n icon={<CrossIcon />}\n className={cn(\"shrink-0\", className)}\n aria-label={closeLabel}\n />\n );\n}\n\n/**\n * Resolves a CTA slot. If a custom slot is provided it takes precedence,\n * otherwise a default Button is rendered from label + onClick.\n */\nfunction resolveCtaSlot(\n slot: React.ReactNode | undefined,\n label: string | undefined,\n onClick: (() => void) | undefined,\n buttonProps: React.ComponentProps<typeof Button>,\n): React.ReactNode | null {\n if (slot) return slot;\n if (label) {\n return (\n <Button onClick={onClick} {...buttonProps}>\n {label}\n </Button>\n );\n }\n return null;\n}\n\nfunction VipEarnContent({\n icon,\n title,\n description,\n showActions,\n primarySlot,\n primaryLabel,\n primaryOnClick,\n}: Pick<\n SnackbarProps,\n | \"icon\"\n | \"title\"\n | \"description\"\n | \"showActions\"\n | \"primarySlot\"\n | \"primaryLabel\"\n | \"primaryOnClick\"\n>) {\n const primary = resolveCtaSlot(primarySlot, primaryLabel, primaryOnClick, {\n variant: \"text\",\n size: \"24\",\n });\n\n return (\n <>\n {icon && (\n <span className=\"flex shrink-0\" aria-hidden=\"true\">\n {icon}\n </span>\n )}\n <div className=\"flex min-w-0 flex-1 flex-col gap-4\">\n <div className=\"flex flex-col\">\n {title && (\n <p className=\"typography-semibold-body-lg text-content-primary leading-6\">{title}</p>\n )}\n {description && (\n <p className=\"typography-regular-body-md text-content-secondary\">{description}</p>\n )}\n </div>\n {showActions && primary && <div className=\"self-start\">{primary}</div>}\n </div>\n </>\n );\n}\n\nfunction WelcomeContent({\n title,\n description,\n showActions,\n primarySlot,\n primaryLabel,\n primaryOnClick,\n secondarySlot,\n secondaryLabel,\n secondaryOnClick,\n}: Pick<\n SnackbarProps,\n | \"title\"\n | \"description\"\n | \"showActions\"\n | \"primarySlot\"\n | \"primaryLabel\"\n | \"primaryOnClick\"\n | \"secondarySlot\"\n | \"secondaryLabel\"\n | \"secondaryOnClick\"\n>) {\n const primary = resolveCtaSlot(primarySlot, primaryLabel, primaryOnClick, {\n variant: \"primary\",\n });\n const secondary = resolveCtaSlot(secondarySlot, secondaryLabel, secondaryOnClick, {\n variant: \"secondary\",\n });\n\n return (\n <>\n <div className=\"flex flex-col items-center gap-2 px-8 text-center text-content-primary\">\n {title && <p className=\"typography-bold-heading-xs text-content-primary\">{title}</p>}\n {description && (\n <p className=\"typography-regular-body-md text-content-secondary\">{description}</p>\n )}\n </div>\n {showActions && (primary || secondary) && (\n <div className=\"flex w-full flex-col gap-4 px-8 sm:flex-row sm:*:flex-1\">\n {secondary}\n {primary}\n </div>\n )}\n </>\n );\n}\n\nfunction DefaultContent({\n children,\n showActions,\n primarySlot,\n primaryLabel,\n primaryOnClick,\n secondarySlot,\n secondaryLabel,\n secondaryOnClick,\n}: Pick<\n SnackbarProps,\n | \"children\"\n | \"showActions\"\n | \"primarySlot\"\n | \"primaryLabel\"\n | \"primaryOnClick\"\n | \"secondarySlot\"\n | \"secondaryLabel\"\n | \"secondaryOnClick\"\n>) {\n const primary = resolveCtaSlot(primarySlot, primaryLabel, primaryOnClick, {\n variant: \"primary\",\n size: \"40\",\n });\n const secondary = resolveCtaSlot(secondarySlot, secondaryLabel, secondaryOnClick, {\n variant: \"tertiary\",\n size: \"40\",\n });\n\n return (\n <>\n <div className=\"typography-regular-body-lg flex min-w-0 flex-1 items-center self-stretch text-content-primary\">\n {children}\n </div>\n {showActions && (primary || secondary) && (\n <div className=\"flex shrink-0 items-start gap-2\">\n {primary}\n {secondary}\n </div>\n )}\n </>\n );\n}\n\n/**\n * A prominent inline message with optional title, description, action buttons,\n * and close control. Supports three layout variants: `default`, `vipEarn`, and\n * `welcome`.\n *\n * @example\n * ```tsx\n * <Snackbar\n * variant=\"default\"\n * primaryLabel=\"Undo\"\n * primaryOnClick={undo}\n * closable\n * onClose={dismiss}\n * >\n * Item deleted\n * </Snackbar>\n * ```\n */\nexport const Snackbar = React.forwardRef<HTMLDivElement, SnackbarProps>(\n (\n {\n className,\n variant = \"default\",\n icon,\n title,\n description,\n showActions = true,\n primaryLabel,\n primaryOnClick,\n primarySlot,\n secondaryLabel,\n secondaryOnClick,\n secondarySlot,\n closable = false,\n onClose,\n closeLabel,\n children,\n ...props\n },\n ref,\n ) => {\n return (\n /* biome-ignore lint/a11y/useSemanticElements: output cannot contain div children; browsers would break the wrapper. */\n <div\n ref={ref}\n role=\"status\"\n data-testid=\"snackbar\"\n className={cn(\n \"flex gap-4 rounded-md\",\n (variant === \"default\" || variant === \"vipEarn\") &&\n \"border border-neutral-alphas-50 bg-surface-primary p-4 backdrop-blur-md\",\n variant === \"default\" && \"flex-wrap items-start\",\n variant === \"vipEarn\" && \"items-start\",\n variant === \"welcome\" && \"relative flex-col items-center bg-bg-primary py-6\",\n className,\n )}\n {...props}\n >\n {variant === \"vipEarn\" && (\n <VipEarnContent\n icon={icon}\n title={title}\n description={description}\n showActions={showActions}\n primarySlot={primarySlot}\n primaryLabel={primaryLabel}\n primaryOnClick={primaryOnClick}\n />\n )}\n {variant === \"welcome\" && (\n <WelcomeContent\n title={title}\n description={description}\n showActions={showActions}\n primarySlot={primarySlot}\n primaryLabel={primaryLabel}\n primaryOnClick={primaryOnClick}\n secondarySlot={secondarySlot}\n secondaryLabel={secondaryLabel}\n secondaryOnClick={secondaryOnClick}\n />\n )}\n {variant === \"default\" && (\n <DefaultContent\n showActions={showActions}\n primarySlot={primarySlot}\n primaryLabel={primaryLabel}\n primaryOnClick={primaryOnClick}\n secondarySlot={secondarySlot}\n secondaryLabel={secondaryLabel}\n secondaryOnClick={secondaryOnClick}\n >\n {children}\n </DefaultContent>\n )}\n {closable && (\n <CloseButton\n onClose={onClose}\n closeLabel={closeLabel}\n className={variant === \"welcome\" ? \"absolute top-2 right-2\" : undefined}\n />\n )}\n </div>\n );\n },\n);\n\nSnackbar.displayName = \"Snackbar\";\n"],"names":["jsx","IconButton","CrossIcon","cn","Button","jsxs","Fragment","React"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,SAAS,YAAY;AAAA,EACnB;AAAA,EACA;AAAA,EACA,aAAa;AACf,GAIG;AACD,SACEA,2BAAAA;AAAAA,I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AAA,EAIR;AACF;AAEA,SAAS,cAAc;;"}
|
|
1
|
+
{"version":3,"file":"Snackbar.cjs","sources":["../../../../src/components/Snackbar/Snackbar.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { Button } from \"../Button/Button\";\nimport { IconButton } from \"../IconButton/IconButton\";\nimport { CrossIcon } from \"../Icons/CrossIcon\";\n\n/** Layout variant of the snackbar. */\nexport type SnackbarVariant = \"default\" | \"vipEarn\" | \"welcome\";\n\nexport interface SnackbarProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"title\"> {\n /** Layout variant of the snackbar. @default \"default\" */\n variant?: SnackbarVariant;\n /** Icon element displayed at the leading edge (used by the `vipEarn` variant). */\n icon?: React.ReactNode;\n /** Title content. */\n title?: React.ReactNode;\n /** Descriptive body text. */\n description?: React.ReactNode;\n /** Whether to show primary/secondary action buttons. @default true */\n showActions?: boolean;\n /** Primary CTA label — renders a default {@link Button}. */\n primaryLabel?: string;\n /** Click handler for the primary CTA (used together with `primaryLabel`). */\n primaryOnClick?: () => void;\n /** Custom element rendered as the primary CTA. Overrides `primaryLabel` / `primaryOnClick`. */\n primarySlot?: React.ReactNode;\n /** Secondary CTA label — renders a default {@link Button}. */\n secondaryLabel?: string;\n /** Click handler for the secondary CTA (used together with `secondaryLabel`). */\n secondaryOnClick?: () => void;\n /** Custom element rendered as the secondary CTA. Overrides `secondaryLabel` / `secondaryOnClick`. */\n secondarySlot?: React.ReactNode;\n /** Whether to show the close button. @default false */\n closable?: boolean;\n /** Callback fired when the close button is clicked. */\n onClose?: () => void;\n /** Accessible label for the close button. @default \"Close snackbar\" */\n closeLabel?: string;\n}\n\nfunction CloseButton({\n onClose,\n className,\n closeLabel = \"Close snackbar\",\n}: {\n onClose?: () => void;\n className?: string;\n closeLabel?: string;\n}) {\n return (\n <IconButton\n variant=\"tertiary\"\n size=\"24\"\n onClick={onClose}\n icon={<CrossIcon />}\n className={cn(\"shrink-0\", className)}\n aria-label={closeLabel}\n />\n );\n}\n\n/**\n * Resolves a CTA slot. If a custom slot is provided it takes precedence,\n * otherwise a default Button is rendered from label + onClick.\n */\nfunction resolveCtaSlot(\n slot: React.ReactNode | undefined,\n label: string | undefined,\n onClick: (() => void) | undefined,\n buttonProps: React.ComponentProps<typeof Button>,\n): React.ReactNode | null {\n if (slot) return slot;\n if (label) {\n return (\n <Button onClick={onClick} {...buttonProps}>\n {label}\n </Button>\n );\n }\n return null;\n}\n\nfunction VipEarnContent({\n icon,\n title,\n description,\n showActions,\n primarySlot,\n primaryLabel,\n primaryOnClick,\n}: Pick<\n SnackbarProps,\n | \"icon\"\n | \"title\"\n | \"description\"\n | \"showActions\"\n | \"primarySlot\"\n | \"primaryLabel\"\n | \"primaryOnClick\"\n>) {\n const primary = resolveCtaSlot(primarySlot, primaryLabel, primaryOnClick, {\n variant: \"text\",\n size: \"24\",\n });\n\n return (\n <>\n {icon && (\n <span className=\"flex shrink-0\" aria-hidden=\"true\">\n {icon}\n </span>\n )}\n <div className=\"flex min-w-0 flex-1 flex-col gap-4\">\n <div className=\"flex flex-col\">\n {title && (\n <p className=\"typography-body-default-16px-semibold text-content-primary leading-6\">\n {title}\n </p>\n )}\n {description && (\n <p className=\"typography-body-small-14px-regular text-content-secondary\">\n {description}\n </p>\n )}\n </div>\n {showActions && primary && <div className=\"self-start\">{primary}</div>}\n </div>\n </>\n );\n}\n\nfunction WelcomeContent({\n title,\n description,\n showActions,\n primarySlot,\n primaryLabel,\n primaryOnClick,\n secondarySlot,\n secondaryLabel,\n secondaryOnClick,\n}: Pick<\n SnackbarProps,\n | \"title\"\n | \"description\"\n | \"showActions\"\n | \"primarySlot\"\n | \"primaryLabel\"\n | \"primaryOnClick\"\n | \"secondarySlot\"\n | \"secondaryLabel\"\n | \"secondaryOnClick\"\n>) {\n const primary = resolveCtaSlot(primarySlot, primaryLabel, primaryOnClick, {\n variant: \"primary\",\n });\n const secondary = resolveCtaSlot(secondarySlot, secondaryLabel, secondaryOnClick, {\n variant: \"secondary\",\n });\n\n return (\n <>\n <div className=\"flex flex-col items-center gap-2 px-8 text-center text-content-primary\">\n {title && <p className=\"typography-header-heading-xs text-content-primary\">{title}</p>}\n {description && (\n <p className=\"typography-body-small-14px-regular text-content-secondary\">{description}</p>\n )}\n </div>\n {showActions && (primary || secondary) && (\n <div className=\"flex w-full flex-col gap-4 px-8 sm:flex-row sm:*:flex-1\">\n {secondary}\n {primary}\n </div>\n )}\n </>\n );\n}\n\nfunction DefaultContent({\n children,\n showActions,\n primarySlot,\n primaryLabel,\n primaryOnClick,\n secondarySlot,\n secondaryLabel,\n secondaryOnClick,\n}: Pick<\n SnackbarProps,\n | \"children\"\n | \"showActions\"\n | \"primarySlot\"\n | \"primaryLabel\"\n | \"primaryOnClick\"\n | \"secondarySlot\"\n | \"secondaryLabel\"\n | \"secondaryOnClick\"\n>) {\n const primary = resolveCtaSlot(primarySlot, primaryLabel, primaryOnClick, {\n variant: \"primary\",\n size: \"40\",\n });\n const secondary = resolveCtaSlot(secondarySlot, secondaryLabel, secondaryOnClick, {\n variant: \"tertiary\",\n size: \"40\",\n });\n\n return (\n <>\n <div className=\"typography-body-default-16px-regular flex min-w-0 flex-1 items-center self-stretch text-content-primary\">\n {children}\n </div>\n {showActions && (primary || secondary) && (\n <div className=\"flex shrink-0 items-start gap-2\">\n {primary}\n {secondary}\n </div>\n )}\n </>\n );\n}\n\n/**\n * A prominent inline message with optional title, description, action buttons,\n * and close control. Supports three layout variants: `default`, `vipEarn`, and\n * `welcome`.\n *\n * @example\n * ```tsx\n * <Snackbar\n * variant=\"default\"\n * primaryLabel=\"Undo\"\n * primaryOnClick={undo}\n * closable\n * onClose={dismiss}\n * >\n * Item deleted\n * </Snackbar>\n * ```\n */\nexport const Snackbar = React.forwardRef<HTMLDivElement, SnackbarProps>(\n (\n {\n className,\n variant = \"default\",\n icon,\n title,\n description,\n showActions = true,\n primaryLabel,\n primaryOnClick,\n primarySlot,\n secondaryLabel,\n secondaryOnClick,\n secondarySlot,\n closable = false,\n onClose,\n closeLabel,\n children,\n ...props\n },\n ref,\n ) => {\n return (\n /* biome-ignore lint/a11y/useSemanticElements: output cannot contain div children; browsers would break the wrapper. */\n <div\n ref={ref}\n role=\"status\"\n data-testid=\"snackbar\"\n className={cn(\n \"flex gap-4 rounded-md\",\n (variant === \"default\" || variant === \"vipEarn\") &&\n \"border border-neutral-alphas-50 bg-surface-primary p-4 backdrop-blur-md\",\n variant === \"default\" && \"flex-wrap items-start\",\n variant === \"vipEarn\" && \"items-start\",\n variant === \"welcome\" && \"relative flex-col items-center bg-background-primary py-6\",\n className,\n )}\n {...props}\n >\n {variant === \"vipEarn\" && (\n <VipEarnContent\n icon={icon}\n title={title}\n description={description}\n showActions={showActions}\n primarySlot={primarySlot}\n primaryLabel={primaryLabel}\n primaryOnClick={primaryOnClick}\n />\n )}\n {variant === \"welcome\" && (\n <WelcomeContent\n title={title}\n description={description}\n showActions={showActions}\n primarySlot={primarySlot}\n primaryLabel={primaryLabel}\n primaryOnClick={primaryOnClick}\n secondarySlot={secondarySlot}\n secondaryLabel={secondaryLabel}\n secondaryOnClick={secondaryOnClick}\n />\n )}\n {variant === \"default\" && (\n <DefaultContent\n showActions={showActions}\n primarySlot={primarySlot}\n primaryLabel={primaryLabel}\n primaryOnClick={primaryOnClick}\n secondarySlot={secondarySlot}\n secondaryLabel={secondaryLabel}\n secondaryOnClick={secondaryOnClick}\n >\n {children}\n </DefaultContent>\n )}\n {closable && (\n <CloseButton\n onClose={onClose}\n closeLabel={closeLabel}\n className={variant === \"welcome\" ? \"absolute top-2 right-2\" : undefined}\n />\n )}\n </div>\n );\n },\n);\n\nSnackbar.displayName = \"Snackbar\";\n"],"names":["jsx","IconButton","CrossIcon","cn","Button","jsxs","Fragment","React"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,SAAS,YAAY;AAAA,EACnB;AAAA,EACA;AAAA,EACA,aAAa;AACf,GAIG;AACD,SACEA,2BAAAA;AAAA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,EAIR;AACF;AAEA,SAAS,cAAc;;"}
|
|
@@ -33,9 +33,9 @@ const INDICATOR_STATE = {
|
|
|
33
33
|
upcoming: "bg-neutral-alphas-50"
|
|
34
34
|
};
|
|
35
35
|
const NUMBER_TYPOGRAPHY = {
|
|
36
|
-
sm: "typography-
|
|
37
|
-
md: "typography-
|
|
38
|
-
lg: "typography-
|
|
36
|
+
sm: "typography-description-12px-semibold",
|
|
37
|
+
md: "typography-body-small-14px-semibold",
|
|
38
|
+
lg: "typography-body-default-16px-semibold"
|
|
39
39
|
};
|
|
40
40
|
const NUMBER_COLOR = {
|
|
41
41
|
completed: "",
|
|
@@ -48,14 +48,14 @@ const CONTAINER_GAP = {
|
|
|
48
48
|
lg: "gap-2"
|
|
49
49
|
};
|
|
50
50
|
const TITLE_TYPOGRAPHY = {
|
|
51
|
-
sm: "typography-
|
|
52
|
-
md: "typography-
|
|
53
|
-
lg: "typography-
|
|
51
|
+
sm: "typography-description-12px-regular",
|
|
52
|
+
md: "typography-body-small-14px-regular",
|
|
53
|
+
lg: "typography-body-default-16px-regular"
|
|
54
54
|
};
|
|
55
55
|
const DESCRIPTION_TYPOGRAPHY = {
|
|
56
|
-
sm: "typography-
|
|
57
|
-
md: "typography-
|
|
58
|
-
lg: "typography-
|
|
56
|
+
sm: "typography-description-12px-regular",
|
|
57
|
+
md: "typography-description-12px-regular",
|
|
58
|
+
lg: "typography-body-small-14px-regular"
|
|
59
59
|
};
|
|
60
60
|
const LABEL_COLOR = {
|
|
61
61
|
completed: "text-content-secondary",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StepperStep.cjs","sources":["../../../../src/components/Stepper/StepperStep.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"@/utils/cn\";\nimport { CheckIcon } from \"../Icons/CheckIcon\";\n\n/** Current state of a step in the stepper. */\nexport type StepperStepState = \"completed\" | \"active\" | \"upcoming\";\n\n/** Size preset for the step indicator and labels. */\nexport type StepperStepSize = \"sm\" | \"md\" | \"lg\";\n\nexport interface StepperStepProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Current state of the step. @default \"upcoming\" */\n state?: StepperStepState;\n /** Size preset for the indicator and labels. @default \"md\" */\n size?: StepperStepSize;\n /** Step number displayed in the indicator for active and upcoming states. */\n stepNumber?: number;\n /** Primary label shown below the indicator. */\n title?: string;\n /** Secondary description shown below the title. */\n description?: string;\n}\n\nconst INDICATOR_SIZE: Record<StepperStepSize, string> = {\n sm: \"size-6\",\n md: \"size-8\",\n lg: \"size-10\",\n};\n\nconst INDICATOR_STATE: Record<StepperStepState, string> = {\n completed: \"bg-success-surface\",\n active: \"border border-brand-primary-default bg-brand-primary-muted\",\n upcoming: \"bg-neutral-alphas-50\",\n};\n\nconst NUMBER_TYPOGRAPHY: Record<StepperStepSize, string> = {\n sm: \"typography-
|
|
1
|
+
{"version":3,"file":"StepperStep.cjs","sources":["../../../../src/components/Stepper/StepperStep.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"@/utils/cn\";\nimport { CheckIcon } from \"../Icons/CheckIcon\";\n\n/** Current state of a step in the stepper. */\nexport type StepperStepState = \"completed\" | \"active\" | \"upcoming\";\n\n/** Size preset for the step indicator and labels. */\nexport type StepperStepSize = \"sm\" | \"md\" | \"lg\";\n\nexport interface StepperStepProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Current state of the step. @default \"upcoming\" */\n state?: StepperStepState;\n /** Size preset for the indicator and labels. @default \"md\" */\n size?: StepperStepSize;\n /** Step number displayed in the indicator for active and upcoming states. */\n stepNumber?: number;\n /** Primary label shown below the indicator. */\n title?: string;\n /** Secondary description shown below the title. */\n description?: string;\n}\n\nconst INDICATOR_SIZE: Record<StepperStepSize, string> = {\n sm: \"size-6\",\n md: \"size-8\",\n lg: \"size-10\",\n};\n\nconst INDICATOR_STATE: Record<StepperStepState, string> = {\n completed: \"bg-success-surface\",\n active: \"border border-brand-primary-default bg-brand-primary-muted\",\n upcoming: \"bg-neutral-alphas-50\",\n};\n\nconst NUMBER_TYPOGRAPHY: Record<StepperStepSize, string> = {\n sm: \"typography-description-12px-semibold\",\n md: \"typography-body-small-14px-semibold\",\n lg: \"typography-body-default-16px-semibold\",\n};\n\nconst NUMBER_COLOR: Record<StepperStepState, string> = {\n completed: \"\",\n active: \"text-content-primary\",\n upcoming: \"text-content-secondary\",\n};\n\nconst CONTAINER_GAP: Record<StepperStepSize, string> = {\n sm: \"gap-1\",\n md: \"gap-2\",\n lg: \"gap-2\",\n};\n\nconst TITLE_TYPOGRAPHY: Record<StepperStepSize, string> = {\n sm: \"typography-description-12px-regular\",\n md: \"typography-body-small-14px-regular\",\n lg: \"typography-body-default-16px-regular\",\n};\n\nconst DESCRIPTION_TYPOGRAPHY: Record<StepperStepSize, string> = {\n sm: \"typography-description-12px-regular\",\n md: \"typography-description-12px-regular\",\n lg: \"typography-body-small-14px-regular\",\n};\n\nconst LABEL_COLOR: Record<StepperStepState, string> = {\n completed: \"text-content-secondary\",\n active: \"text-content-primary\",\n upcoming: \"text-content-tertiary\",\n};\n\nconst CHECK_ICON_SIZE: Record<StepperStepSize, string> = {\n sm: \"size-3\",\n md: \"size-4\",\n lg: \"size-5\",\n};\n\n/**\n * A single step indicator with optional labels, used standalone or within a {@link Stepper}.\n *\n * @example\n * ```tsx\n * <StepperStep state=\"active\" stepNumber={2} title=\"Profile\" description=\"Set up profile\" />\n * ```\n */\nexport const StepperStep = React.forwardRef<HTMLDivElement, StepperStepProps>(\n (\n { state = \"upcoming\", size = \"md\", stepNumber, title, description, className, ...props },\n ref,\n ) => {\n const hasLabels = title != null || description != null;\n\n return (\n <div\n ref={ref}\n className={cn(\"flex flex-col items-center\", CONTAINER_GAP[size], className)}\n {...props}\n >\n <div\n className={cn(\n \"flex shrink-0 items-center justify-center rounded-full\",\n INDICATOR_SIZE[size],\n INDICATOR_STATE[state],\n )}\n aria-hidden=\"true\"\n >\n {state === \"completed\" ? (\n <CheckIcon className={cn(CHECK_ICON_SIZE[size], \"text-success-content\")} />\n ) : (\n <span className={cn(NUMBER_TYPOGRAPHY[size], NUMBER_COLOR[state])}>{stepNumber}</span>\n )}\n </div>\n\n {hasLabels && (\n <div className={cn(\"flex flex-col items-center gap-1 text-center\", LABEL_COLOR[state])}>\n {title != null && <span className={TITLE_TYPOGRAPHY[size]}>{title}</span>}\n {description != null && (\n <span className={DESCRIPTION_TYPOGRAPHY[size]}>{description}</span>\n )}\n </div>\n )}\n </div>\n );\n },\n);\n\nStepperStep.displayName = \"StepperStep\";\n"],"names":["React","jsxs","cn","jsx","CheckIcon"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAuBA,MAAM,iBAAkD;AAAA,EACtD,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN;AAEA,MAAM,kBAAoD;AAAA,EACxD,WAAW;AAAA,EACX,QAAQ;AAAA,EACR,UAAU;AACZ;AAEA,MAAM,oBAAqD;AAAA,EACzD,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN;AAEA,MAAM,eAAiD;AAAA,EACrD,WAAW;AAAA,EACX,QAAQ;AAAA,EACR,UAAU;AACZ;AAEA,MAAM,gBAAiD;AAAA,EACrD,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN;AAEA,MAAM,mBAAoD;AAAA,EACxD,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN;AAEA,MAAM,yBAA0D;AAAA,EAC9D,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN;AAEA,MAAM,cAAgD;AAAA,EACpD,WAAW;AAAA,EACX,QAAQ;AAAA,EACR,UAAU;AACZ;AAEA,MAAM,kBAAmD;AAAA,EACvD,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN;AAUO,MAAM,cAAcA,iBAAM;AAAA,EAC/B,CACE,EAAE,QAAQ,YAAY,OAAO,MAAM,YAAY,OAAO,aAAa,WAAW,GAAG,MAAA,GACjF,QACG;AACH,UAAM,YAAY,SAAS,QAAQ,eAAe;AAElD,WACEC,2BAAAA;AAAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,WAAWC,GAAAA,GAAG,8BAA8B,cAAc,IAAI,GAAG,SAAS;AAAA,QACzE,GAAG;AAAA,QAEJ,UAAA;AAAA,UAAAC,2BAAAA;AAAAA,YAAC;AAAA,YAAA;AAAA,cACC,WAAWD,GAAAA;AAAAA,gBACT;AAAA,gBACA,eAAe,IAAI;AAAA,gBACnB,gBAAgB,KAAK;AAAA,cAAA;AAAA,cAEvB,eAAY;AAAA,cAEX,UAAA,UAAU,cACTC,2BAAAA,IAACC,UAAAA,WAAA,EAAU,WAAWF,GAAAA,GAAG,gBAAgB,IAAI,GAAG,sBAAsB,EAAA,CAAG,IAEzEC,2BAAAA,IAAC,QAAA,EAAK,WAAWD,GAAAA,GAAG,kBAAkB,IAAI,GAAG,aAAa,KAAK,CAAC,GAAI,UAAA,WAAA,CAAW;AAAA,YAAA;AAAA,UAAA;AAAA,UAIlF,6CACE,OAAA,EAAI,WAAWA,GAAAA,GAAG,gDAAgD,YAAY,KAAK,CAAC,GAClF,UAAA;AAAA,YAAA,SAAS,QAAQC,+BAAC,QAAA,EAAK,WAAW,iBAAiB,IAAI,GAAI,UAAA,OAAM;AAAA,YACjE,eAAe,QACdA,2BAAAA,IAAC,QAAA,EAAK,WAAW,uBAAuB,IAAI,GAAI,UAAA,YAAA,CAAY;AAAA,UAAA,EAAA,CAEhE;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAIR;AACF;AAEA,YAAY,cAAc;;"}
|
|
@@ -45,7 +45,7 @@ const Switch = React__namespace.forwardRef(({ className, size = "default", ...pr
|
|
|
45
45
|
SwitchPrimitive__namespace.Thumb,
|
|
46
46
|
{
|
|
47
47
|
className: cn.cn(
|
|
48
|
-
"pointer-events-none rounded-full bg-
|
|
48
|
+
"pointer-events-none rounded-full bg-background-primary shadow-sm transition-transform duration-150",
|
|
49
49
|
thumbSizeClass
|
|
50
50
|
)
|
|
51
51
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Switch.cjs","sources":["../../../../src/components/Switch/Switch.tsx"],"sourcesContent":["import * as SwitchPrimitive from \"@radix-ui/react-switch\";\nimport * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\n\n/** Size variant of the switch toggle. */\nexport type SwitchSize = \"default\" | \"small\";\n\nexport interface SwitchProps\n extends Omit<React.ComponentPropsWithoutRef<typeof SwitchPrimitive.Root>, \"asChild\"> {\n /** Size variant of the switch. @default \"default\" */\n size?: SwitchSize;\n}\n\n/**\n * A toggle switch for boolean on/off states. Built on Radix UI `Switch`.\n *\n * For a labelled switch with helper text, see {@link SwitchField}.\n *\n * @example\n * ```tsx\n * <Switch checked={on} onCheckedChange={setOn} />\n * ```\n */\nexport const Switch = React.forwardRef<\n React.ComponentRef<typeof SwitchPrimitive.Root>,\n SwitchProps\n>(({ className, size = \"default\", ...props }, ref) => {\n const thumbSizeClass =\n size === \"default\"\n ? \"size-4.5 translate-x-0.75 data-[state=checked]:translate-x-4.75\"\n : \"size-4 translate-x-0.5 data-[state=checked]:translate-x-4.25\";\n\n return (\n <SwitchPrimitive.Root\n ref={ref}\n className={cn(\n \"inline-flex shrink-0 cursor-pointer items-center rounded-full border border-transparent transition-colors duration-150\",\n \"focus-visible:shadow-focus-ring focus-visible:outline-none\",\n \"data-[state=checked]:border-neutral-alphas-200 data-[state=checked]:bg-brand-primary-default\",\n \"data-[state=unchecked]:bg-neutral-alphas-400\",\n \"not-disabled:active:opacity-80\",\n \"disabled:cursor-not-allowed disabled:opacity-50\",\n size === \"default\" && \"h-6 w-10.5\",\n size === \"small\" && \"h-5 w-9\",\n className,\n )}\n {...props}\n >\n <SwitchPrimitive.Thumb\n className={cn(\n \"pointer-events-none rounded-full bg-
|
|
1
|
+
{"version":3,"file":"Switch.cjs","sources":["../../../../src/components/Switch/Switch.tsx"],"sourcesContent":["import * as SwitchPrimitive from \"@radix-ui/react-switch\";\nimport * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\n\n/** Size variant of the switch toggle. */\nexport type SwitchSize = \"default\" | \"small\";\n\nexport interface SwitchProps\n extends Omit<React.ComponentPropsWithoutRef<typeof SwitchPrimitive.Root>, \"asChild\"> {\n /** Size variant of the switch. @default \"default\" */\n size?: SwitchSize;\n}\n\n/**\n * A toggle switch for boolean on/off states. Built on Radix UI `Switch`.\n *\n * For a labelled switch with helper text, see {@link SwitchField}.\n *\n * @example\n * ```tsx\n * <Switch checked={on} onCheckedChange={setOn} />\n * ```\n */\nexport const Switch = React.forwardRef<\n React.ComponentRef<typeof SwitchPrimitive.Root>,\n SwitchProps\n>(({ className, size = \"default\", ...props }, ref) => {\n const thumbSizeClass =\n size === \"default\"\n ? \"size-4.5 translate-x-0.75 data-[state=checked]:translate-x-4.75\"\n : \"size-4 translate-x-0.5 data-[state=checked]:translate-x-4.25\";\n\n return (\n <SwitchPrimitive.Root\n ref={ref}\n className={cn(\n \"inline-flex shrink-0 cursor-pointer items-center rounded-full border border-transparent transition-colors duration-150\",\n \"focus-visible:shadow-focus-ring focus-visible:outline-none\",\n \"data-[state=checked]:border-neutral-alphas-200 data-[state=checked]:bg-brand-primary-default\",\n \"data-[state=unchecked]:bg-neutral-alphas-400\",\n \"not-disabled:active:opacity-80\",\n \"disabled:cursor-not-allowed disabled:opacity-50\",\n size === \"default\" && \"h-6 w-10.5\",\n size === \"small\" && \"h-5 w-9\",\n className,\n )}\n {...props}\n >\n <SwitchPrimitive.Thumb\n className={cn(\n \"pointer-events-none rounded-full bg-background-primary shadow-sm transition-transform duration-150\",\n thumbSizeClass,\n )}\n />\n </SwitchPrimitive.Root>\n );\n});\n\nSwitch.displayName = \"Switch\";\n"],"names":["React","jsx","SwitchPrimitive","cn"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAuBO,MAAM,SAASA,iBAAM,WAG1B,CAAC,EAAE,WAAW,OAAO,WAAW,GAAG,MAAA,GAAS,QAAQ;AACpD,QAAM,iBACJ,SAAS,YACL,oEACA;AAEN,SACEC,2BAAAA;AAAAA,IAACC,2BAAgB;AAAA,IAAhB;AAAA,MACC;AAAA,MACA,WAAWC,GAAAA;AAAAA,QACT;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,SAAS,aAAa;AAAA,QACtB,SAAS,WAAW;AAAA,QACpB;AAAA,MAAA;AAAA,MAED,GAAG;AAAA,MAEJ,UAAAF,2BAAAA;AAAAA,QAACC,2BAAgB;AAAA,QAAhB;AAAA,UACC,WAAWC,GAAAA;AAAAA,YACT;AAAA,YACA;AAAA,UAAA;AAAA,QACF;AAAA,MAAA;AAAA,IACF;AAAA,EAAA;AAGN,CAAC;AAED,OAAO,cAAc;;"}
|
|
@@ -67,7 +67,7 @@ const SwitchField = React__namespace.forwardRef(
|
|
|
67
67
|
className: cn.cn(
|
|
68
68
|
"cursor-pointer select-none text-content-primary",
|
|
69
69
|
disabled && "cursor-not-allowed text-content-tertiary",
|
|
70
|
-
size === "default" ? "typography-
|
|
70
|
+
size === "default" ? "typography-body-default-16px-semibold" : "typography-body-small-14px-semibold"
|
|
71
71
|
),
|
|
72
72
|
children: label
|
|
73
73
|
}
|
|
@@ -90,7 +90,7 @@ const SwitchField = React__namespace.forwardRef(
|
|
|
90
90
|
className: cn.cn(
|
|
91
91
|
"text-content-secondary",
|
|
92
92
|
disabled && "text-content-tertiary",
|
|
93
|
-
size === "default" ? "typography-
|
|
93
|
+
size === "default" ? "typography-body-small-14px-regular" : "typography-description-12px-regular"
|
|
94
94
|
),
|
|
95
95
|
children: helperText
|
|
96
96
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SwitchField.cjs","sources":["../../../../src/components/SwitchField/SwitchField.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { InfoCircleIcon } from \"../Icons/InfoCircleIcon\";\nimport { Switch, type SwitchSize } from \"../Switch/Switch\";\nimport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from \"../Tooltip/Tooltip\";\n\n/** Side on which the switch toggle is positioned relative to the label. */\nexport type SwitchFieldOrientation = \"right\" | \"left\";\n\nexport interface SwitchFieldProps\n extends Omit<React.ComponentPropsWithoutRef<typeof Switch>, \"size\" | \"className\"> {\n /** Side on which the switch is placed relative to the label. @default \"right\" */\n orientation?: SwitchFieldOrientation;\n /** Size variant of the switch and accompanying text. @default \"default\" */\n size?: SwitchSize;\n /** Label text displayed next to the switch. */\n label?: string;\n /** Descriptive text displayed below the label. */\n helperText?: string;\n /** Tooltip text shown when hovering the info icon next to the label. */\n infoText?: string;\n /** Accessible label for the info tooltip trigger button. Override for i18n.\n * @default \"More information\"\n */\n infoLabel?: string;\n /** Additional CSS class name for the outer wrapper. */\n className?: string;\n}\n\n/**\n * A labelled switch field with optional helper text and info tooltip. Composes\n * the {@link Switch} component with a `<label>` and description.\n *\n * @example\n * ```tsx\n * <SwitchField\n * label=\"Notifications\"\n * helperText=\"Receive push notifications\"\n * checked={enabled}\n * onCheckedChange={setEnabled}\n * />\n * ```\n */\nexport const SwitchField = React.forwardRef<React.ComponentRef<typeof Switch>, SwitchFieldProps>(\n (\n {\n className,\n orientation = \"right\",\n size = \"default\",\n label,\n helperText,\n infoText,\n infoLabel = \"More information\",\n disabled,\n id: propId,\n ...props\n },\n ref,\n ) => {\n const generatedId = React.useId();\n const id = propId ?? generatedId;\n const helperTextId = helperText ? `${id}-helper` : undefined;\n\n const switchElement = (\n <Switch\n ref={ref}\n id={id}\n size={size}\n disabled={disabled}\n aria-describedby={helperTextId}\n {...props}\n />\n );\n\n const labelContent = (label || helperText) && (\n <div\n className={cn(\n \"flex min-w-0 flex-1 flex-col items-start\",\n size === \"default\" ? \"gap-1\" : \"gap-0.5\",\n )}\n >\n {label && (\n <div className=\"flex items-center gap-1\">\n <label\n htmlFor={id}\n className={cn(\n \"cursor-pointer select-none text-content-primary\",\n disabled && \"cursor-not-allowed text-content-tertiary\",\n size === \"default\"
|
|
1
|
+
{"version":3,"file":"SwitchField.cjs","sources":["../../../../src/components/SwitchField/SwitchField.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { InfoCircleIcon } from \"../Icons/InfoCircleIcon\";\nimport { Switch, type SwitchSize } from \"../Switch/Switch\";\nimport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from \"../Tooltip/Tooltip\";\n\n/** Side on which the switch toggle is positioned relative to the label. */\nexport type SwitchFieldOrientation = \"right\" | \"left\";\n\nexport interface SwitchFieldProps\n extends Omit<React.ComponentPropsWithoutRef<typeof Switch>, \"size\" | \"className\"> {\n /** Side on which the switch is placed relative to the label. @default \"right\" */\n orientation?: SwitchFieldOrientation;\n /** Size variant of the switch and accompanying text. @default \"default\" */\n size?: SwitchSize;\n /** Label text displayed next to the switch. */\n label?: string;\n /** Descriptive text displayed below the label. */\n helperText?: string;\n /** Tooltip text shown when hovering the info icon next to the label. */\n infoText?: string;\n /** Accessible label for the info tooltip trigger button. Override for i18n.\n * @default \"More information\"\n */\n infoLabel?: string;\n /** Additional CSS class name for the outer wrapper. */\n className?: string;\n}\n\n/**\n * A labelled switch field with optional helper text and info tooltip. Composes\n * the {@link Switch} component with a `<label>` and description.\n *\n * @example\n * ```tsx\n * <SwitchField\n * label=\"Notifications\"\n * helperText=\"Receive push notifications\"\n * checked={enabled}\n * onCheckedChange={setEnabled}\n * />\n * ```\n */\nexport const SwitchField = React.forwardRef<React.ComponentRef<typeof Switch>, SwitchFieldProps>(\n (\n {\n className,\n orientation = \"right\",\n size = \"default\",\n label,\n helperText,\n infoText,\n infoLabel = \"More information\",\n disabled,\n id: propId,\n ...props\n },\n ref,\n ) => {\n const generatedId = React.useId();\n const id = propId ?? generatedId;\n const helperTextId = helperText ? `${id}-helper` : undefined;\n\n const switchElement = (\n <Switch\n ref={ref}\n id={id}\n size={size}\n disabled={disabled}\n aria-describedby={helperTextId}\n {...props}\n />\n );\n\n const labelContent = (label || helperText) && (\n <div\n className={cn(\n \"flex min-w-0 flex-1 flex-col items-start\",\n size === \"default\" ? \"gap-1\" : \"gap-0.5\",\n )}\n >\n {label && (\n <div className=\"flex items-center gap-1\">\n <label\n htmlFor={id}\n className={cn(\n \"cursor-pointer select-none text-content-primary\",\n disabled && \"cursor-not-allowed text-content-tertiary\",\n size === \"default\"\n ? \"typography-body-default-16px-semibold\"\n : \"typography-body-small-14px-semibold\",\n )}\n >\n {label}\n </label>\n {infoText && (\n <TooltipProvider>\n <Tooltip>\n <TooltipTrigger asChild>\n <button type=\"button\" aria-label={infoLabel} className=\"flex shrink-0 pt-0.5\">\n <InfoCircleIcon\n aria-hidden=\"true\"\n className=\"size-5 text-content-secondary\"\n />\n </button>\n </TooltipTrigger>\n <TooltipContent side=\"bottom\">{infoText}</TooltipContent>\n </Tooltip>\n </TooltipProvider>\n )}\n </div>\n )}\n {helperText && (\n <span\n id={helperTextId}\n className={cn(\n \"text-content-secondary\",\n disabled && \"text-content-tertiary\",\n size === \"default\"\n ? \"typography-body-small-14px-regular\"\n : \"typography-description-12px-regular\",\n )}\n >\n {helperText}\n </span>\n )}\n </div>\n );\n\n return (\n <div className={cn(\"flex items-start gap-2\", disabled && \"cursor-not-allowed\", className)}>\n {orientation === \"left\" && switchElement}\n {labelContent}\n {orientation === \"right\" && switchElement}\n </div>\n );\n },\n);\n\nSwitchField.displayName = \"SwitchField\";\n"],"names":["React","jsx","Switch","jsxs","cn","TooltipProvider","Tooltip","TooltipTrigger","InfoCircleIcon","TooltipContent"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA2CO,MAAM,cAAcA,iBAAM;AAAA,EAC/B,CACE;AAAA,IACE;AAAA,IACA,cAAc;AAAA,IACd,OAAO;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,IACA,YAAY;AAAA,IACZ;AAAA,IACA,IAAI;AAAA,IACJ,GAAG;AAAA,EAAA,GAEL,QACG;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;AAAA,cACC,IAAI;AAAA,cACJ,WAAWG,GAAAA;AAAAA,gBACT;AAAA,gBACA,YAAY;AAAA,gBACZ,SAAS,YACL,uCACA;AAAA,cAAA;AAAA,cAGL,UAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QACH;AAAA,MAAA;AAAA,IAAA;AAKN,WACED,gCAAC,SAAI,WAAWC,GAAAA,GAAG,0BAA0B,YAAY,sBAAsB,SAAS,GACrF,UAAA;AAAA,MAAA,gBAAgB,UAAU;AAAA,MAC1B;AAAA,MACA,gBAAgB,WAAW;AAAA,IAAA,GAC9B;AAAA,EAEJ;AACF;AAEA,YAAY,cAAc;;"}
|
|
@@ -48,7 +48,7 @@ const SwitchToggle = React__namespace.forwardRef(
|
|
|
48
48
|
const anySelected = options.some((o) => o.value === currentValue);
|
|
49
49
|
const isSecondSelected = currentValue === options[1].value;
|
|
50
50
|
const buttonRefs = React__namespace.useRef([]);
|
|
51
|
-
const sizeClass = size === "24" ? "px-2 py-1 typography-
|
|
51
|
+
const sizeClass = size === "24" ? "px-2 py-1 typography-description-12px-semibold" : size === "32" ? "px-3 py-1.75 typography-body-small-14px-semibold" : "h-10 px-4 py-2.25 typography-body-default-16px-semibold";
|
|
52
52
|
const handleSelect = (optionValue) => {
|
|
53
53
|
if (disabled || optionValue === currentValue) return;
|
|
54
54
|
if (!isControlled) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SwitchToggle.cjs","sources":["../../../../src/components/SwitchToggle/SwitchToggle.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\n\n/** Height of the switch toggle in pixels. */\nexport type SwitchToggleSize = \"24\" | \"32\" | \"40\";\n\n/** Describes one side of the binary toggle. */\nexport interface SwitchToggleOption {\n /** Display label for the option. */\n label: string;\n /** Value identifier returned via `onChange`. */\n value: string;\n}\n\nexport interface SwitchToggleProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"onChange\"> {\n /** Height of the toggle in pixels. @default \"24\" */\n size?: SwitchToggleSize;\n /** The two options to toggle between (exactly two required). */\n options: [SwitchToggleOption, SwitchToggleOption];\n /** Currently selected value (controlled). */\n value?: string;\n /** Initially selected value (uncontrolled). */\n defaultValue?: string;\n /** Callback fired when the selected value changes. */\n onChange?: (value: string) => void;\n /** Whether the toggle is disabled. @default false */\n disabled?: boolean;\n}\n\nfunction warnMissingAccessibleName(ariaLabel?: string, ariaLabelledBy?: string) {\n if (process.env.NODE_ENV !== \"production\") {\n if (!ariaLabel && !ariaLabelledBy) {\n console.warn(\n \"SwitchToggle: no accessible name provided. Pass an `aria-label` or `aria-labelledby` prop.\",\n );\n }\n }\n}\n\n/**\n * A binary segmented toggle rendered as a `radiogroup`. The active option is\n * highlighted with a sliding pill indicator. Supports both controlled and\n * uncontrolled usage.\n *\n * @example\n * ```tsx\n * <SwitchToggle\n * options={[\n * { label: \"Monthly\", value: \"monthly\" },\n * { label: \"Yearly\", value: \"yearly\" },\n * ]}\n * value={billing}\n * onChange={setBilling}\n * />\n * ```\n */\nexport const SwitchToggle = React.forwardRef<HTMLDivElement, SwitchToggleProps>(\n (\n {\n className,\n size = \"24\",\n options,\n value: controlledValue,\n defaultValue,\n onChange,\n disabled = false,\n ...props\n },\n ref,\n ) => {\n warnMissingAccessibleName(props[\"aria-label\"], props[\"aria-labelledby\"]);\n\n // Tracks selection for uncontrolled usage; ignored when `value` prop is provided\n const [internalValue, setInternalValue] = React.useState(defaultValue ?? options[0].value);\n const isControlled = controlledValue !== undefined;\n const currentValue = isControlled ? controlledValue : internalValue;\n const anySelected = options.some((o) => o.value === currentValue);\n const isSecondSelected = currentValue === options[1].value;\n const buttonRefs = React.useRef<(HTMLButtonElement | null)[]>([]);\n\n const sizeClass =\n size === \"24\"\n ? \"px-2 py-1 typography-
|
|
1
|
+
{"version":3,"file":"SwitchToggle.cjs","sources":["../../../../src/components/SwitchToggle/SwitchToggle.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\n\n/** Height of the switch toggle in pixels. */\nexport type SwitchToggleSize = \"24\" | \"32\" | \"40\";\n\n/** Describes one side of the binary toggle. */\nexport interface SwitchToggleOption {\n /** Display label for the option. */\n label: string;\n /** Value identifier returned via `onChange`. */\n value: string;\n}\n\nexport interface SwitchToggleProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"onChange\"> {\n /** Height of the toggle in pixels. @default \"24\" */\n size?: SwitchToggleSize;\n /** The two options to toggle between (exactly two required). */\n options: [SwitchToggleOption, SwitchToggleOption];\n /** Currently selected value (controlled). */\n value?: string;\n /** Initially selected value (uncontrolled). */\n defaultValue?: string;\n /** Callback fired when the selected value changes. */\n onChange?: (value: string) => void;\n /** Whether the toggle is disabled. @default false */\n disabled?: boolean;\n}\n\nfunction warnMissingAccessibleName(ariaLabel?: string, ariaLabelledBy?: string) {\n if (process.env.NODE_ENV !== \"production\") {\n if (!ariaLabel && !ariaLabelledBy) {\n console.warn(\n \"SwitchToggle: no accessible name provided. Pass an `aria-label` or `aria-labelledby` prop.\",\n );\n }\n }\n}\n\n/**\n * A binary segmented toggle rendered as a `radiogroup`. The active option is\n * highlighted with a sliding pill indicator. Supports both controlled and\n * uncontrolled usage.\n *\n * @example\n * ```tsx\n * <SwitchToggle\n * options={[\n * { label: \"Monthly\", value: \"monthly\" },\n * { label: \"Yearly\", value: \"yearly\" },\n * ]}\n * value={billing}\n * onChange={setBilling}\n * />\n * ```\n */\nexport const SwitchToggle = React.forwardRef<HTMLDivElement, SwitchToggleProps>(\n (\n {\n className,\n size = \"24\",\n options,\n value: controlledValue,\n defaultValue,\n onChange,\n disabled = false,\n ...props\n },\n ref,\n ) => {\n warnMissingAccessibleName(props[\"aria-label\"], props[\"aria-labelledby\"]);\n\n // Tracks selection for uncontrolled usage; ignored when `value` prop is provided\n const [internalValue, setInternalValue] = React.useState(defaultValue ?? options[0].value);\n const isControlled = controlledValue !== undefined;\n const currentValue = isControlled ? controlledValue : internalValue;\n const anySelected = options.some((o) => o.value === currentValue);\n const isSecondSelected = currentValue === options[1].value;\n const buttonRefs = React.useRef<(HTMLButtonElement | null)[]>([]);\n\n const sizeClass =\n size === \"24\"\n ? \"px-2 py-1 typography-description-12px-semibold\"\n : size === \"32\"\n ? \"px-3 py-1.75 typography-body-small-14px-semibold\"\n : \"h-10 px-4 py-2.25 typography-body-default-16px-semibold\";\n\n const handleSelect = (optionValue: string) => {\n if (disabled || optionValue === currentValue) return;\n if (!isControlled) {\n setInternalValue(optionValue);\n }\n onChange?.(optionValue);\n };\n\n const handleKeyDown = (e: React.KeyboardEvent, index: number) => {\n const nextIndex =\n e.key === \"ArrowRight\" || e.key === \"ArrowDown\"\n ? (index + 1) % options.length\n : e.key === \"ArrowLeft\" || e.key === \"ArrowUp\"\n ? (index - 1 + options.length) % options.length\n : null;\n if (nextIndex === null) return;\n e.preventDefault();\n const nextOption = options[nextIndex] as (typeof options)[number];\n handleSelect(nextOption.value);\n buttonRefs.current[nextIndex]?.focus();\n };\n\n return (\n <div\n ref={ref}\n role=\"radiogroup\"\n className={cn(\n \"relative inline-grid grid-cols-2 rounded-full border border-neutral-alphas-200 p-1\",\n disabled && \"cursor-not-allowed opacity-50\",\n className,\n )}\n {...props}\n >\n <span\n aria-hidden=\"true\"\n className={cn(\n \"absolute inset-y-1 left-1 w-[calc(50%-4px)] rounded-full border border-brand-primary-default bg-brand-primary-muted\",\n \"motion-safe:transition-transform motion-safe:duration-200 motion-safe:ease-in-out\",\n isSecondSelected && \"translate-x-full\",\n )}\n />\n {options.map((option, index) => {\n const isSelected = currentValue === option.value;\n return (\n // biome-ignore lint/a11y/useSemanticElements: native radio inputs only allow Tab-focus on the checked item; buttons with roving tabindex give full keyboard navigation\n <button\n key={option.value}\n ref={(el) => {\n buttonRefs.current[index] = el;\n }}\n type=\"button\"\n role=\"radio\"\n aria-checked={isSelected}\n tabIndex={isSelected || (!anySelected && index === 0) ? 0 : -1}\n disabled={disabled}\n onClick={() => handleSelect(option.value)}\n onKeyDown={(e) => handleKeyDown(e, index)}\n className={cn(\n \"relative z-10 inline-flex min-w-0 cursor-pointer items-center justify-center rounded-full border border-transparent text-content-primary\",\n \"focus-visible:shadow-focus-ring focus-visible:outline-none\",\n \"active:rounded-full active:bg-brand-primary-muted\",\n disabled && \"pointer-events-none\",\n sizeClass,\n )}\n >\n <span className=\"min-w-0 truncate\">{option.label}</span>\n </button>\n );\n })}\n </div>\n );\n },\n);\n\nSwitchToggle.displayName = \"SwitchToggle\";\n"],"names":["React","jsxs","cn","jsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA6BA,SAAS,0BAA0B,WAAoB,gBAAyB;AAC9E,MAAI,QAAQ,IAAI,aAAa,cAAc;AACzC,QAAI,CAAC,aAAa,CAAC,gBAAgB;AACjC,cAAQ;AAAA,QACN;AAAA,MAAA;AAAA,IAEJ;AAAA,EACF;AACF;AAmBO,MAAM,eAAeA,iBAAM;AAAA,EAChC,CACE;AAAA,IACE;AAAA,IACA,OAAO;AAAA,IACP;AAAA,IACA,OAAO;AAAA,IACP;AAAA,IACA;AAAA,IACA,WAAW;AAAA,IACX,GAAG;AAAA,EAAA,GAEL,QACG;AACH,8BAA0B,MAAM,YAAY,GAAG,MAAM,iBAAiB,CAAC;AAGvE,UAAM,CAAC,eAAe,gBAAgB,IAAIA,iBAAM,SAAS,gBAAgB,QAAQ,CAAC,EAAE,KAAK;AACzF,UAAM,eAAe,oBAAoB;AACzC,UAAM,eAAe,eAAe,kBAAkB;AACtD,UAAM,cAAc,QAAQ,KAAK,CAAC,MAAM,EAAE,UAAU,YAAY;AAChE,UAAM,mBAAmB,iBAAiB,QAAQ,CAAC,EAAE;AACrD,UAAM,aAAaA,iBAAM,OAAqC,EAAE;AAEhE,UAAM,YACJ,SAAS,OACL,mDACA,SAAS,OACP,qDACA;AAER,UAAM,eAAe,CAAC,gBAAwB;AAC5C,UAAI,YAAY,gBAAgB,aAAc;AAC9C,UAAI,CAAC,cAAc;AACjB,yBAAiB,WAAW;AAAA,MAC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A;AAAA,oBACA;AAAA,oBACA,YAAY;AAAA,oBACZ;AAAA,kBAAA;AAAA,kBAGF,UAAAC,2BAAAA,IAAC,QAAA,EAAK,WAAU,oBAAoB,iBAAO,MAAA,CAAM;AAAA,gBAAA;AAAA,gBAnB5C,OAAO;AAAA,cAAA;AAAA;AAAA,UAsBlB,CAAC;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAGP;AACF;AAEA,aAAa,cAAc;;"}
|
|
@@ -125,7 +125,7 @@ const TableHead = React__namespace.forwardRef(
|
|
|
125
125
|
ref,
|
|
126
126
|
scope,
|
|
127
127
|
className: cn.cn(
|
|
128
|
-
"typography-
|
|
128
|
+
"typography-description-12px-semibold box-border min-h-12 border-b border-border-primary px-4 py-3 align-middle text-content-tertiary",
|
|
129
129
|
HEAD_INTENT_CLASSES[intent],
|
|
130
130
|
className
|
|
131
131
|
),
|
|
@@ -155,7 +155,7 @@ const CELL_INTENT_CLASSES = {
|
|
|
155
155
|
const TableCell = React__namespace.forwardRef(
|
|
156
156
|
({ className, cellVariant = "default", intent = "default", ...props }, ref) => {
|
|
157
157
|
const size = useTableSize();
|
|
158
|
-
const typo = intent === "sideLabel" ? "typography-
|
|
158
|
+
const typo = intent === "sideLabel" ? "typography-description-12px-semibold" : "typography-description-12px-regular";
|
|
159
159
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
160
160
|
"td",
|
|
161
161
|
{
|
|
@@ -189,11 +189,11 @@ function TableCellContent({
|
|
|
189
189
|
}) {
|
|
190
190
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn.cn("flex flex-col gap-0.5", className), children: [
|
|
191
191
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1", children: [
|
|
192
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "typography-
|
|
192
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "typography-description-12px-semibold text-content-primary", children: primary }),
|
|
193
193
|
primaryAdornment
|
|
194
194
|
] }),
|
|
195
195
|
(secondary != null || secondaryAdornment != null) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1", children: [
|
|
196
|
-
secondary != null && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "typography-
|
|
196
|
+
secondary != null && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "typography-description-12px-regular text-content-secondary", children: secondary }),
|
|
197
197
|
secondaryAdornment
|
|
198
198
|
] })
|
|
199
199
|
] });
|
|
@@ -250,7 +250,7 @@ const TableProgressTrack = React__namespace.forwardRef(
|
|
|
250
250
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
251
251
|
"div",
|
|
252
252
|
{
|
|
253
|
-
className: "absolute top-0 left-0 h-1 rounded-full bg-buttons-primary",
|
|
253
|
+
className: "absolute top-0 left-0 h-1 rounded-full bg-buttons-primary-default",
|
|
254
254
|
style: { width: `${width}%` },
|
|
255
255
|
"aria-hidden": true
|
|
256
256
|
}
|
|
@@ -285,7 +285,7 @@ const TableSortLabel = React__namespace.forwardRef(
|
|
|
285
285
|
"span",
|
|
286
286
|
{
|
|
287
287
|
className: cn.cn(
|
|
288
|
-
"typography-
|
|
288
|
+
"typography-description-12px-semibold",
|
|
289
289
|
direction != null && "border-b border-content-primary pb-px"
|
|
290
290
|
),
|
|
291
291
|
children
|
|
@@ -328,7 +328,7 @@ function TableRowsPerPageSelect(props) {
|
|
|
328
328
|
defaultValue: "10",
|
|
329
329
|
size: "32",
|
|
330
330
|
"aria-label": ariaLabel,
|
|
331
|
-
className: "w-[154px] [&_button]:rounded-sm [&_button]:border-transparent [&_button]:bg-
|
|
331
|
+
className: "w-[154px] [&_button]:rounded-sm [&_button]:border-transparent [&_button]:bg-inputs-inputs-primary",
|
|
332
332
|
id,
|
|
333
333
|
children: /* @__PURE__ */ jsxRuntime.jsxs(Select.SelectContent, { children: [
|
|
334
334
|
/* @__PURE__ */ jsxRuntime.jsx(Select.SelectItem, { value: "10", children: "10 rows per page" }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Table.cjs","sources":["../../../../src/components/Table/Table.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"@/utils/cn\";\nimport { ArrowDownIcon } from \"../Icons/ArrowDownIcon\";\nimport { ArrowUpIcon } from \"../Icons/ArrowUpIcon\";\nimport { Select, SelectContent, SelectItem } from \"../Select/Select\";\n\n/**\n * Row density for body cells.\n *\n * - `\"md\"` (default) → 64px Figma `V2 Table Cell` Small.\n * - `\"lg\"` → 80px Figma `V2 Table Cell` Large.\n *\n * `\"default\"` is the v2 numeric-token equivalent of `\"md\"` and is preferred\n * for new code.\n */\nexport type TableSize = \"md\" | \"lg\" | \"default\";\n\nexport interface TableCardProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Row density applied to {@link TableCell} descendants. @default \"md\" */\n size?: TableSize;\n}\n\nconst TableSizeContext = React.createContext<TableSize>(\"md\");\n\nfunction useTableSize(): TableSize {\n return React.useContext(TableSizeContext);\n}\n\n/**\n * Surface wrapper for data tables: rounded 24px container with a strong\n * outer border, inner spacing, and size context for {@link TableCell}\n * descendants. Compose with {@link TableScrollArea}, {@link Table},\n * {@link TableHeader}, {@link TableBody}, {@link TableRow},\n * {@link TableHead}, and {@link TableCell}.\n *\n * @example\n * ```tsx\n * <TableCard>\n * <TableScrollArea>\n * <Table>\n * <TableHeader>\n * <TableRow>\n * <TableHead>Name</TableHead>\n * </TableRow>\n * </TableHeader>\n * <TableBody>\n * <TableRow>\n * <TableCell>Jane Doe</TableCell>\n * </TableRow>\n * </TableBody>\n * </Table>\n * </TableScrollArea>\n * </TableCard>\n * ```\n */\nexport const TableCard = React.forwardRef<HTMLDivElement, TableCardProps>(\n ({ className, size = \"md\", ...props }, ref) => {\n return (\n <TableSizeContext.Provider value={size}>\n <div\n ref={ref}\n className={cn(\n \"isolate flex flex-col gap-2 overflow-hidden rounded-3xl border border-border-strong px-3 py-1\",\n className,\n )}\n {...props}\n />\n </TableSizeContext.Provider>\n );\n },\n);\nTableCard.displayName = \"TableCard\";\n\nexport interface TableToolbarProps extends React.HTMLAttributes<HTMLDivElement> {}\n\n/**\n * Optional toolbar row above the table (e.g. bulk selection actions).\n */\nexport const TableToolbar = React.forwardRef<HTMLDivElement, TableToolbarProps>(\n ({ className, ...props }, ref) => {\n return (\n <div\n ref={ref}\n className={cn(\"flex flex-wrap items-center gap-4 px-4 py-3\", className)}\n {...props}\n />\n );\n },\n);\nTableToolbar.displayName = \"TableToolbar\";\n\nexport interface TableScrollAreaProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * No longer needed in v2 — {@link TableCard} handles corner rounding via\n * its own `overflow-hidden rounded-3xl`. Accepted for back-compat.\n *\n * @deprecated v2 ignores this prop; safe to remove.\n */\n roundTop?: boolean;\n}\n\n/**\n * Horizontal scroll container for wide tables. The inner scrollport keeps\n * `border-collapse` styles intact when the table wraps.\n */\nexport const TableScrollArea = React.forwardRef<HTMLDivElement, TableScrollAreaProps>(\n ({ className, children, roundTop: _roundTop, ...props }, ref) => {\n return (\n <div\n ref={ref}\n className={cn(\"relative w-full min-w-0 overflow-hidden\", className)}\n {...props}\n >\n <div className=\"overflow-x-auto\">{children}</div>\n </div>\n );\n },\n);\nTableScrollArea.displayName = \"TableScrollArea\";\n\nexport interface TableProps extends React.TableHTMLAttributes<HTMLTableElement> {}\n\n/**\n * Semantic `<table>` element. Place inside {@link TableScrollArea}.\n */\nexport const Table = React.forwardRef<HTMLTableElement, TableProps>(\n ({ className, ...props }, ref) => {\n return (\n <table\n ref={ref}\n className={cn(\n \"w-full caption-bottom border-separate border-spacing-0 text-left\",\n className,\n )}\n {...props}\n />\n );\n },\n);\nTable.displayName = \"Table\";\n\nexport interface TableHeaderProps extends React.HTMLAttributes<HTMLTableSectionElement> {}\n\nexport const TableHeader = React.forwardRef<HTMLTableSectionElement, TableHeaderProps>(\n ({ className, ...props }, ref) => {\n return <thead ref={ref} className={cn(className)} {...props} />;\n },\n);\nTableHeader.displayName = \"TableHeader\";\n\nexport interface TableBodyProps extends React.HTMLAttributes<HTMLTableSectionElement> {}\n\n/**\n * `<tbody>` wrapper. Removes the bottom border on cells in the final row to\n * match the Figma `V2 Table Final Row` treatment.\n */\nexport const TableBody = React.forwardRef<HTMLTableSectionElement, TableBodyProps>(\n ({ className, ...props }, ref) => {\n return (\n <tbody ref={ref} className={cn(\"[&_tr:last-child_td]:border-b-0\", className)} {...props} />\n );\n },\n);\nTableBody.displayName = \"TableBody\";\n\nexport interface TableFooterProps extends React.HTMLAttributes<HTMLTableSectionElement> {}\n\nexport const TableFooter = React.forwardRef<HTMLTableSectionElement, TableFooterProps>(\n ({ className, ...props }, ref) => {\n return <tfoot ref={ref} className={cn(className)} {...props} />;\n },\n);\nTableFooter.displayName = \"TableFooter\";\n\nexport interface TableRowProps extends React.HTMLAttributes<HTMLTableRowElement> {}\n\nexport const TableRow = React.forwardRef<HTMLTableRowElement, TableRowProps>(\n ({ className, ...props }, ref) => {\n return <tr ref={ref} className={cn(className)} {...props} />;\n },\n);\nTableRow.displayName = \"TableRow\";\n\n/** Column layout preset for {@link TableHead}. */\nexport type TableHeadIntent = \"default\" | \"checkbox\" | \"sort\" | \"leading\";\n\nconst HEAD_INTENT_CLASSES: Record<TableHeadIntent, string> = {\n default: \"text-left\",\n checkbox: \"w-12 min-w-12 max-w-12 text-center\",\n sort: \"text-right\",\n leading: \"min-w-0 w-2/5 text-left\",\n};\n\nexport interface TableHeadProps extends React.ThHTMLAttributes<HTMLTableCellElement> {\n /** Layout preset for common column types. @default \"default\" */\n intent?: TableHeadIntent;\n}\n\n/**\n * Header cell. v2: transparent background, 48px min height, tertiary text,\n * `border-border-primary` bottom rule.\n */\nexport const TableHead = React.forwardRef<HTMLTableCellElement, TableHeadProps>(\n ({ className, intent = \"default\", scope = \"col\", ...props }, ref) => {\n return (\n <th\n ref={ref}\n scope={scope}\n className={cn(\n \"typography-semibold-body-sm box-border min-h-12 border-b border-border-primary px-4 py-3 align-middle text-content-tertiary\",\n HEAD_INTENT_CLASSES[intent],\n className,\n )}\n {...props}\n />\n );\n },\n);\nTableHead.displayName = \"TableHead\";\n\nconst CELL_MIN_HEIGHT: Record<TableSize, string> = {\n md: \"h-16 min-h-16\",\n default: \"h-16 min-h-16\",\n lg: \"h-20 min-h-20\",\n};\n\n/** Bottom border and padding preset for body cells (Figma table cell component). */\nexport type TableCellVariant = \"default\" | \"chip\" | \"pillProgress\";\n\nconst CELL_VARIANT_CLASSES: Record<TableCellVariant, string> = {\n default: \"border-b border-border-primary px-4 py-3\",\n chip: \"border-b border-border-primary px-4 py-3\",\n pillProgress: \"border-b border-border-primary px-4 py-3\",\n};\n\n/** Layout / typography preset for {@link TableCell} (orthogonal to {@link TableCellVariant}). */\nexport type TableCellIntent = \"default\" | \"checkbox\" | \"stacked\" | \"multiline\" | \"sideLabel\";\n\nconst CELL_INTENT_CLASSES: Record<TableCellIntent, string> = {\n default: \"\",\n checkbox: \"w-12 min-w-12 max-w-12 text-center\",\n stacked: \"align-top\",\n multiline: \"max-w-[240px]\",\n sideLabel: \"\",\n};\n\nexport interface TableCellProps extends React.TdHTMLAttributes<HTMLTableCellElement> {\n /** Padding preset for the cell. v2 uses identical padding across variants; values are kept for back-compat. @default \"default\" */\n cellVariant?: TableCellVariant;\n /** Alignment and typography preset for common cell types. @default \"default\" */\n intent?: TableCellIntent;\n}\n\n/**\n * Body cell. v2: `h-16` (or `h-20` when the parent {@link TableCard} uses\n * `size=\"lg\"`), `px-4 py-3` padding, body-sm typography, and a single\n * `border-border-primary` rule that is zeroed by {@link TableBody} for the\n * final row.\n */\nexport const TableCell = React.forwardRef<HTMLTableCellElement, TableCellProps>(\n ({ className, cellVariant = \"default\", intent = \"default\", ...props }, ref) => {\n const size = useTableSize();\n const typo =\n intent === \"sideLabel\" ? \"typography-semibold-body-sm\" : \"typography-regular-body-sm\";\n return (\n <td\n ref={ref}\n className={cn(\n typo,\n \"align-middle text-content-primary\",\n CELL_VARIANT_CLASSES[cellVariant],\n CELL_MIN_HEIGHT[size],\n CELL_INTENT_CLASSES[intent],\n className,\n )}\n {...props}\n />\n );\n },\n);\nTableCell.displayName = \"TableCell\";\n\nexport interface TableCellGroupProps extends React.HTMLAttributes<HTMLDivElement> {}\n\n/**\n * Horizontal group for icons, chips, and metadata inside a {@link TableCell}\n * (Figma `gap-[4px]`).\n */\nexport const TableCellGroup = React.forwardRef<HTMLDivElement, TableCellGroupProps>(\n ({ className, ...props }, ref) => {\n return <div ref={ref} className={cn(\"flex items-center gap-1\", className)} {...props} />;\n },\n);\nTableCellGroup.displayName = \"TableCellGroup\";\n\nexport interface TableCellContentProps {\n /** Primary line (semibold body-sm). */\n primary: React.ReactNode;\n /** Optional secondary line (regular body-sm, secondary color). */\n secondary?: React.ReactNode;\n /** Inline node rendered next to the primary line (icon, chip). */\n primaryAdornment?: React.ReactNode;\n /** Inline node rendered next to the secondary line. */\n secondaryAdornment?: React.ReactNode;\n /** Class for the outer wrapper. */\n className?: string;\n}\n\n/**\n * Two-line content slot matching Figma `V2 Table Content` — primary line\n * (semibold) over an optional secondary line (regular, muted) with a 2px\n * gap. Use inside {@link TableCell} for the common stacked-text pattern.\n */\nexport function TableCellContent({\n primary,\n secondary,\n primaryAdornment,\n secondaryAdornment,\n className,\n}: TableCellContentProps) {\n return (\n <div className={cn(\"flex flex-col gap-0.5\", className)}>\n <div className=\"flex items-center gap-1\">\n <span className=\"typography-semibold-body-sm text-content-primary\">{primary}</span>\n {primaryAdornment}\n </div>\n {(secondary != null || secondaryAdornment != null) && (\n <div className=\"flex items-center gap-1\">\n {secondary != null && (\n <span className=\"typography-regular-body-sm text-content-secondary\">{secondary}</span>\n )}\n {secondaryAdornment}\n </div>\n )}\n </div>\n );\n}\nTableCellContent.displayName = \"TableCellContent\";\n\nexport interface TableMediaThumbnailProps\n extends Omit<React.HTMLAttributes<HTMLDivElement>, \"children\"> {\n /** Image URL. */\n src: string;\n /** Alt text for the image. @default \"\" */\n alt?: string;\n /** Applies the table's blurred-media treatment. @default false */\n blurred?: boolean;\n /** `center` uses the fixed media column width from the lg spec. @default \"start\" */\n align?: \"start\" | \"center\";\n}\n\n/**\n * Square 48px thumbnail used inside {@link TableCell} for media columns\n * (Figma `V2 Media Thumbnail Item`).\n */\nexport const TableMediaThumbnail = React.forwardRef<HTMLDivElement, TableMediaThumbnailProps>(\n ({ className, src, alt = \"\", blurred, align = \"start\", ...props }, ref) => {\n const frame = \"size-12 overflow-hidden rounded-sm bg-neutral-alphas-200\";\n return (\n <div\n ref={ref}\n className={cn(\n align === \"center\" && \"flex w-16 shrink-0 justify-center\",\n align === \"start\" && \"inline-flex shrink-0\",\n )}\n >\n <div className={cn(frame, blurred && \"blur-[2px]\", className)} {...props}>\n <img alt={alt} className=\"size-full object-cover\" src={src} />\n </div>\n </div>\n );\n },\n);\nTableMediaThumbnail.displayName = \"TableMediaThumbnail\";\n\nexport interface TableStatusDotProps extends React.HTMLAttributes<HTMLDivElement> {}\n\n/**\n * Small status indicator dot for table cells (Figma status column).\n */\nexport const TableStatusDot = React.forwardRef<HTMLDivElement, TableStatusDotProps>(\n ({ className, ...props }, ref) => {\n return (\n <div\n ref={ref}\n className={cn(\"size-2 shrink-0 rounded-full bg-info-content\", className)}\n {...props}\n />\n );\n },\n);\nTableStatusDot.displayName = \"TableStatusDot\";\n\nexport interface TableProgressTrackProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Fill width from 0–100. @default 0 */\n value?: number;\n}\n\n/**\n * Thin progress track used with badges in table cells (Figma pill + progress).\n * Renders with `role=\"progressbar\"` and a default `aria-label` of `\"Progress\"`.\n */\nexport const TableProgressTrack = React.forwardRef<HTMLDivElement, TableProgressTrackProps>(\n ({ className, value = 0, \"aria-label\": ariaLabel = \"Progress\", ...props }, ref) => {\n const width = Math.min(100, Math.max(0, value));\n const rounded = Math.round(width);\n return (\n <div\n ref={ref}\n role=\"progressbar\"\n aria-valuenow={rounded}\n aria-valuemin={0}\n aria-valuemax={100}\n aria-label={ariaLabel}\n className={cn(\n \"relative h-1 w-full overflow-hidden rounded-full bg-neutral-alphas-200\",\n className,\n )}\n {...props}\n >\n <div\n className=\"absolute top-0 left-0 h-1 rounded-full bg-buttons-primary\"\n style={{ width: `${width}%` }}\n aria-hidden\n />\n </div>\n );\n },\n);\nTableProgressTrack.displayName = \"TableProgressTrack\";\n\nexport interface TablePillProgressLayoutProps extends React.HTMLAttributes<HTMLDivElement> {}\n\n/**\n * Vertical layout for pill label + {@link TableProgressTrack} in a cell.\n */\nexport const TablePillProgressLayout = React.forwardRef<\n HTMLDivElement,\n TablePillProgressLayoutProps\n>(({ className, ...props }, ref) => {\n return (\n <div\n ref={ref}\n className={cn(\"flex min-w-[120px] flex-col items-start gap-2\", className)}\n {...props}\n />\n );\n});\nTablePillProgressLayout.displayName = \"TablePillProgressLayout\";\n\n/** Current sort direction of a {@link TableSortLabel}. `null` means unsorted. */\nexport type TableSortDirection = \"asc\" | \"desc\" | null;\n\nexport interface TableSortLabelProps extends React.HTMLAttributes<HTMLSpanElement> {\n children: React.ReactNode;\n /**\n * Visual indicator of the column's sort state. When set to `\"asc\"` or\n * `\"desc\"`, a 1px underline accent appears beneath the label and a small\n * directional arrow is shown next to it. @default null\n */\n direction?: TableSortDirection;\n}\n\n/**\n * Sortable column label. v2 expresses the sort state with a 1px underline\n * beneath the label plus a directional arrow when sorted.\n */\nexport const TableSortLabel = React.forwardRef<HTMLSpanElement, TableSortLabelProps>(\n ({ className, children, direction = null, ...props }, ref) => {\n const Icon = direction === \"desc\" ? ArrowDownIcon : ArrowUpIcon;\n return (\n <span\n ref={ref}\n className={cn(\"inline-flex items-center gap-1 text-content-primary\", className)}\n {...props}\n >\n <span\n className={cn(\n \"typography-semibold-body-sm\",\n direction != null && \"border-b border-content-primary pb-px\",\n )}\n >\n {children}\n </span>\n {direction != null && <Icon className=\"size-4 shrink-0\" aria-hidden />}\n </span>\n );\n },\n);\nTableSortLabel.displayName = \"TableSortLabel\";\n\nexport interface TableStackedTextProps {\n /** Primary line (semibold body). */\n title: React.ReactNode;\n /** Secondary line (caption, muted). */\n subtitle: React.ReactNode;\n}\n\n/**\n * Two-line primary + secondary text block for \"cell + info\" patterns.\n *\n * @deprecated Prefer {@link TableCellContent} which supports adornments and\n * matches the Figma `V2 Table Content` slot.\n */\nexport function TableStackedText({ title, subtitle }: TableStackedTextProps) {\n return <TableCellContent primary={title} secondary={subtitle} />;\n}\n\nTableStackedText.displayName = \"TableStackedText\";\n\nexport interface TableLineClampProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Number of lines before ellipsis. @default 2 */\n lines?: 1 | 2 | 3;\n}\n\n/**\n * Clamps child text to a fixed number of lines inside a {@link TableCell}.\n */\nexport const TableLineClamp = React.forwardRef<HTMLDivElement, TableLineClampProps>(\n ({ className, lines = 2, ...props }, ref) => {\n return (\n <div\n ref={ref}\n className={cn(\n lines === 1 && \"line-clamp-1\",\n lines === 2 && \"line-clamp-2\",\n lines === 3 && \"line-clamp-3\",\n className,\n )}\n {...props}\n />\n );\n },\n);\nTableLineClamp.displayName = \"TableLineClamp\";\n\nexport interface TableRowsPerPageSelectProps {\n /** Passed to the trigger for forms and labels. */\n id?: string;\n /** Accessible name for the trigger when no visible label. @default \"Rows per page\" */\n \"aria-label\"?: string;\n}\n\n/**\n * Rows-per-page {@link Select} styled for {@link TablePagination}. v2 uses a\n * subtle pill trigger with the table's secondary-surface background.\n */\nexport function TableRowsPerPageSelect(props: TableRowsPerPageSelectProps) {\n const { id, \"aria-label\": ariaLabel = \"Rows per page\" } = props;\n return (\n <Select\n defaultValue=\"10\"\n size=\"32\"\n aria-label={ariaLabel}\n className=\"w-[154px] [&_button]:rounded-sm [&_button]:border-transparent [&_button]:bg-surface-inputs\"\n id={id}\n >\n <SelectContent>\n <SelectItem value=\"10\">10 rows per page</SelectItem>\n <SelectItem value=\"25\">25 rows per page</SelectItem>\n <SelectItem value=\"50\">50 rows per page</SelectItem>\n </SelectContent>\n </Select>\n );\n}\n"],"names":["React","js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AAK,UAAA,mBAAA,CAAgB;AAAA,MAAA,EAAA,CACzC;AAAA,IAAA;AAAA,EAAA;AAGN;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"Table.cjs","sources":["../../../../src/components/Table/Table.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"@/utils/cn\";\nimport { ArrowDownIcon } from \"../Icons/ArrowDownIcon\";\nimport { ArrowUpIcon } from \"../Icons/ArrowUpIcon\";\nimport { Select, SelectContent, SelectItem } from \"../Select/Select\";\n\n/**\n * Row density for body cells.\n *\n * - `\"md\"` (default) → 64px Figma `V2 Table Cell` Small.\n * - `\"lg\"` → 80px Figma `V2 Table Cell` Large.\n *\n * `\"default\"` is the v2 numeric-token equivalent of `\"md\"` and is preferred\n * for new code.\n */\nexport type TableSize = \"md\" | \"lg\" | \"default\";\n\nexport interface TableCardProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Row density applied to {@link TableCell} descendants. @default \"md\" */\n size?: TableSize;\n}\n\nconst TableSizeContext = React.createContext<TableSize>(\"md\");\n\nfunction useTableSize(): TableSize {\n return React.useContext(TableSizeContext);\n}\n\n/**\n * Surface wrapper for data tables: rounded 24px container with a strong\n * outer border, inner spacing, and size context for {@link TableCell}\n * descendants. Compose with {@link TableScrollArea}, {@link Table},\n * {@link TableHeader}, {@link TableBody}, {@link TableRow},\n * {@link TableHead}, and {@link TableCell}.\n *\n * @example\n * ```tsx\n * <TableCard>\n * <TableScrollArea>\n * <Table>\n * <TableHeader>\n * <TableRow>\n * <TableHead>Name</TableHead>\n * </TableRow>\n * </TableHeader>\n * <TableBody>\n * <TableRow>\n * <TableCell>Jane Doe</TableCell>\n * </TableRow>\n * </TableBody>\n * </Table>\n * </TableScrollArea>\n * </TableCard>\n * ```\n */\nexport const TableCard = React.forwardRef<HTMLDivElement, TableCardProps>(\n ({ className, size = \"md\", ...props }, ref) => {\n return (\n <TableSizeContext.Provider value={size}>\n <div\n ref={ref}\n className={cn(\n \"isolate flex flex-col gap-2 overflow-hidden rounded-3xl border border-border-strong px-3 py-1\",\n className,\n )}\n {...props}\n />\n </TableSizeContext.Provider>\n );\n },\n);\nTableCard.displayName = \"TableCard\";\n\nexport interface TableToolbarProps extends React.HTMLAttributes<HTMLDivElement> {}\n\n/**\n * Optional toolbar row above the table (e.g. bulk selection actions).\n */\nexport const TableToolbar = React.forwardRef<HTMLDivElement, TableToolbarProps>(\n ({ className, ...props }, ref) => {\n return (\n <div\n ref={ref}\n className={cn(\"flex flex-wrap items-center gap-4 px-4 py-3\", className)}\n {...props}\n />\n );\n },\n);\nTableToolbar.displayName = \"TableToolbar\";\n\nexport interface TableScrollAreaProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * No longer needed in v2 — {@link TableCard} handles corner rounding via\n * its own `overflow-hidden rounded-3xl`. Accepted for back-compat.\n *\n * @deprecated v2 ignores this prop; safe to remove.\n */\n roundTop?: boolean;\n}\n\n/**\n * Horizontal scroll container for wide tables. The inner scrollport keeps\n * `border-collapse` styles intact when the table wraps.\n */\nexport const TableScrollArea = React.forwardRef<HTMLDivElement, TableScrollAreaProps>(\n ({ className, children, roundTop: _roundTop, ...props }, ref) => {\n return (\n <div\n ref={ref}\n className={cn(\"relative w-full min-w-0 overflow-hidden\", className)}\n {...props}\n >\n <div className=\"overflow-x-auto\">{children}</div>\n </div>\n );\n },\n);\nTableScrollArea.displayName = \"TableScrollArea\";\n\nexport interface TableProps extends React.TableHTMLAttributes<HTMLTableElement> {}\n\n/**\n * Semantic `<table>` element. Place inside {@link TableScrollArea}.\n */\nexport const Table = React.forwardRef<HTMLTableElement, TableProps>(\n ({ className, ...props }, ref) => {\n return (\n <table\n ref={ref}\n className={cn(\n \"w-full caption-bottom border-separate border-spacing-0 text-left\",\n className,\n )}\n {...props}\n />\n );\n },\n);\nTable.displayName = \"Table\";\n\nexport interface TableHeaderProps extends React.HTMLAttributes<HTMLTableSectionElement> {}\n\nexport const TableHeader = React.forwardRef<HTMLTableSectionElement, TableHeaderProps>(\n ({ className, ...props }, ref) => {\n return <thead ref={ref} className={cn(className)} {...props} />;\n },\n);\nTableHeader.displayName = \"TableHeader\";\n\nexport interface TableBodyProps extends React.HTMLAttributes<HTMLTableSectionElement> {}\n\n/**\n * `<tbody>` wrapper. Removes the bottom border on cells in the final row to\n * match the Figma `V2 Table Final Row` treatment.\n */\nexport const TableBody = React.forwardRef<HTMLTableSectionElement, TableBodyProps>(\n ({ className, ...props }, ref) => {\n return (\n <tbody ref={ref} className={cn(\"[&_tr:last-child_td]:border-b-0\", className)} {...props} />\n );\n },\n);\nTableBody.displayName = \"TableBody\";\n\nexport interface TableFooterProps extends React.HTMLAttributes<HTMLTableSectionElement> {}\n\nexport const TableFooter = React.forwardRef<HTMLTableSectionElement, TableFooterProps>(\n ({ className, ...props }, ref) => {\n return <tfoot ref={ref} className={cn(className)} {...props} />;\n },\n);\nTableFooter.displayName = \"TableFooter\";\n\nexport interface TableRowProps extends React.HTMLAttributes<HTMLTableRowElement> {}\n\nexport const TableRow = React.forwardRef<HTMLTableRowElement, TableRowProps>(\n ({ className, ...props }, ref) => {\n return <tr ref={ref} className={cn(className)} {...props} />;\n },\n);\nTableRow.displayName = \"TableRow\";\n\n/** Column layout preset for {@link TableHead}. */\nexport type TableHeadIntent = \"default\" | \"checkbox\" | \"sort\" | \"leading\";\n\nconst HEAD_INTENT_CLASSES: Record<TableHeadIntent, string> = {\n default: \"text-left\",\n checkbox: \"w-12 min-w-12 max-w-12 text-center\",\n sort: \"text-right\",\n leading: \"min-w-0 w-2/5 text-left\",\n};\n\nexport interface TableHeadProps extends React.ThHTMLAttributes<HTMLTableCellElement> {\n /** Layout preset for common column types. @default \"default\" */\n intent?: TableHeadIntent;\n}\n\n/**\n * Header cell. v2: transparent background, 48px min height, tertiary text,\n * `border-border-primary` bottom rule.\n */\nexport const TableHead = React.forwardRef<HTMLTableCellElement, TableHeadProps>(\n ({ className, intent = \"default\", scope = \"col\", ...props }, ref) => {\n return (\n <th\n ref={ref}\n scope={scope}\n className={cn(\n \"typography-description-12px-semibold box-border min-h-12 border-b border-border-primary px-4 py-3 align-middle text-content-tertiary\",\n HEAD_INTENT_CLASSES[intent],\n className,\n )}\n {...props}\n />\n );\n },\n);\nTableHead.displayName = \"TableHead\";\n\nconst CELL_MIN_HEIGHT: Record<TableSize, string> = {\n md: \"h-16 min-h-16\",\n default: \"h-16 min-h-16\",\n lg: \"h-20 min-h-20\",\n};\n\n/** Bottom border and padding preset for body cells (Figma table cell component). */\nexport type TableCellVariant = \"default\" | \"chip\" | \"pillProgress\";\n\nconst CELL_VARIANT_CLASSES: Record<TableCellVariant, string> = {\n default: \"border-b border-border-primary px-4 py-3\",\n chip: \"border-b border-border-primary px-4 py-3\",\n pillProgress: \"border-b border-border-primary px-4 py-3\",\n};\n\n/** Layout / typography preset for {@link TableCell} (orthogonal to {@link TableCellVariant}). */\nexport type TableCellIntent = \"default\" | \"checkbox\" | \"stacked\" | \"multiline\" | \"sideLabel\";\n\nconst CELL_INTENT_CLASSES: Record<TableCellIntent, string> = {\n default: \"\",\n checkbox: \"w-12 min-w-12 max-w-12 text-center\",\n stacked: \"align-top\",\n multiline: \"max-w-[240px]\",\n sideLabel: \"\",\n};\n\nexport interface TableCellProps extends React.TdHTMLAttributes<HTMLTableCellElement> {\n /** Padding preset for the cell. v2 uses identical padding across variants; values are kept for back-compat. @default \"default\" */\n cellVariant?: TableCellVariant;\n /** Alignment and typography preset for common cell types. @default \"default\" */\n intent?: TableCellIntent;\n}\n\n/**\n * Body cell. v2: `h-16` (or `h-20` when the parent {@link TableCard} uses\n * `size=\"lg\"`), `px-4 py-3` padding, body-sm typography, and a single\n * `border-border-primary` rule that is zeroed by {@link TableBody} for the\n * final row.\n */\nexport const TableCell = React.forwardRef<HTMLTableCellElement, TableCellProps>(\n ({ className, cellVariant = \"default\", intent = \"default\", ...props }, ref) => {\n const size = useTableSize();\n const typo =\n intent === \"sideLabel\"\n ? \"typography-description-12px-semibold\"\n : \"typography-description-12px-regular\";\n return (\n <td\n ref={ref}\n className={cn(\n typo,\n \"align-middle text-content-primary\",\n CELL_VARIANT_CLASSES[cellVariant],\n CELL_MIN_HEIGHT[size],\n CELL_INTENT_CLASSES[intent],\n className,\n )}\n {...props}\n />\n );\n },\n);\nTableCell.displayName = \"TableCell\";\n\nexport interface TableCellGroupProps extends React.HTMLAttributes<HTMLDivElement> {}\n\n/**\n * Horizontal group for icons, chips, and metadata inside a {@link TableCell}\n * (Figma `gap-[4px]`).\n */\nexport const TableCellGroup = React.forwardRef<HTMLDivElement, TableCellGroupProps>(\n ({ className, ...props }, ref) => {\n return <div ref={ref} className={cn(\"flex items-center gap-1\", className)} {...props} />;\n },\n);\nTableCellGroup.displayName = \"TableCellGroup\";\n\nexport interface TableCellContentProps {\n /** Primary line (semibold body-sm). */\n primary: React.ReactNode;\n /** Optional secondary line (regular body-sm, secondary color). */\n secondary?: React.ReactNode;\n /** Inline node rendered next to the primary line (icon, chip). */\n primaryAdornment?: React.ReactNode;\n /** Inline node rendered next to the secondary line. */\n secondaryAdornment?: React.ReactNode;\n /** Class for the outer wrapper. */\n className?: string;\n}\n\n/**\n * Two-line content slot matching Figma `V2 Table Content` — primary line\n * (semibold) over an optional secondary line (regular, muted) with a 2px\n * gap. Use inside {@link TableCell} for the common stacked-text pattern.\n */\nexport function TableCellContent({\n primary,\n secondary,\n primaryAdornment,\n secondaryAdornment,\n className,\n}: TableCellContentProps) {\n return (\n <div className={cn(\"flex flex-col gap-0.5\", className)}>\n <div className=\"flex items-center gap-1\">\n <span className=\"typography-description-12px-semibold text-content-primary\">{primary}</span>\n {primaryAdornment}\n </div>\n {(secondary != null || secondaryAdornment != null) && (\n <div className=\"flex items-center gap-1\">\n {secondary != null && (\n <span className=\"typography-description-12px-regular text-content-secondary\">\n {secondary}\n </span>\n )}\n {secondaryAdornment}\n </div>\n )}\n </div>\n );\n}\nTableCellContent.displayName = \"TableCellContent\";\n\nexport interface TableMediaThumbnailProps\n extends Omit<React.HTMLAttributes<HTMLDivElement>, \"children\"> {\n /** Image URL. */\n src: string;\n /** Alt text for the image. @default \"\" */\n alt?: string;\n /** Applies the table's blurred-media treatment. @default false */\n blurred?: boolean;\n /** `center` uses the fixed media column width from the lg spec. @default \"start\" */\n align?: \"start\" | \"center\";\n}\n\n/**\n * Square 48px thumbnail used inside {@link TableCell} for media columns\n * (Figma `V2 Media Thumbnail Item`).\n */\nexport const TableMediaThumbnail = React.forwardRef<HTMLDivElement, TableMediaThumbnailProps>(\n ({ className, src, alt = \"\", blurred, align = \"start\", ...props }, ref) => {\n const frame = \"size-12 overflow-hidden rounded-sm bg-neutral-alphas-200\";\n return (\n <div\n ref={ref}\n className={cn(\n align === \"center\" && \"flex w-16 shrink-0 justify-center\",\n align === \"start\" && \"inline-flex shrink-0\",\n )}\n >\n <div className={cn(frame, blurred && \"blur-[2px]\", className)} {...props}>\n <img alt={alt} className=\"size-full object-cover\" src={src} />\n </div>\n </div>\n );\n },\n);\nTableMediaThumbnail.displayName = \"TableMediaThumbnail\";\n\nexport interface TableStatusDotProps extends React.HTMLAttributes<HTMLDivElement> {}\n\n/**\n * Small status indicator dot for table cells (Figma status column).\n */\nexport const TableStatusDot = React.forwardRef<HTMLDivElement, TableStatusDotProps>(\n ({ className, ...props }, ref) => {\n return (\n <div\n ref={ref}\n className={cn(\"size-2 shrink-0 rounded-full bg-info-content\", className)}\n {...props}\n />\n );\n },\n);\nTableStatusDot.displayName = \"TableStatusDot\";\n\nexport interface TableProgressTrackProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Fill width from 0–100. @default 0 */\n value?: number;\n}\n\n/**\n * Thin progress track used with badges in table cells (Figma pill + progress).\n * Renders with `role=\"progressbar\"` and a default `aria-label` of `\"Progress\"`.\n */\nexport const TableProgressTrack = React.forwardRef<HTMLDivElement, TableProgressTrackProps>(\n ({ className, value = 0, \"aria-label\": ariaLabel = \"Progress\", ...props }, ref) => {\n const width = Math.min(100, Math.max(0, value));\n const rounded = Math.round(width);\n return (\n <div\n ref={ref}\n role=\"progressbar\"\n aria-valuenow={rounded}\n aria-valuemin={0}\n aria-valuemax={100}\n aria-label={ariaLabel}\n className={cn(\n \"relative h-1 w-full overflow-hidden rounded-full bg-neutral-alphas-200\",\n className,\n )}\n {...props}\n >\n <div\n className=\"absolute top-0 left-0 h-1 rounded-full bg-buttons-primary-default\"\n style={{ width: `${width}%` }}\n aria-hidden\n />\n </div>\n );\n },\n);\nTableProgressTrack.displayName = \"TableProgressTrack\";\n\nexport interface TablePillProgressLayoutProps extends React.HTMLAttributes<HTMLDivElement> {}\n\n/**\n * Vertical layout for pill label + {@link TableProgressTrack} in a cell.\n */\nexport const TablePillProgressLayout = React.forwardRef<\n HTMLDivElement,\n TablePillProgressLayoutProps\n>(({ className, ...props }, ref) => {\n return (\n <div\n ref={ref}\n className={cn(\"flex min-w-[120px] flex-col items-start gap-2\", className)}\n {...props}\n />\n );\n});\nTablePillProgressLayout.displayName = \"TablePillProgressLayout\";\n\n/** Current sort direction of a {@link TableSortLabel}. `null` means unsorted. */\nexport type TableSortDirection = \"asc\" | \"desc\" | null;\n\nexport interface TableSortLabelProps extends React.HTMLAttributes<HTMLSpanElement> {\n children: React.ReactNode;\n /**\n * Visual indicator of the column's sort state. When set to `\"asc\"` or\n * `\"desc\"`, a 1px underline accent appears beneath the label and a small\n * directional arrow is shown next to it. @default null\n */\n direction?: TableSortDirection;\n}\n\n/**\n * Sortable column label. v2 expresses the sort state with a 1px underline\n * beneath the label plus a directional arrow when sorted.\n */\nexport const TableSortLabel = React.forwardRef<HTMLSpanElement, TableSortLabelProps>(\n ({ className, children, direction = null, ...props }, ref) => {\n const Icon = direction === \"desc\" ? ArrowDownIcon : ArrowUpIcon;\n return (\n <span\n ref={ref}\n className={cn(\"inline-flex items-center gap-1 text-content-primary\", className)}\n {...props}\n >\n <span\n className={cn(\n \"typography-description-12px-semibold\",\n direction != null && \"border-b border-content-primary pb-px\",\n )}\n >\n {children}\n </span>\n {direction != null && <Icon className=\"size-4 shrink-0\" aria-hidden />}\n </span>\n );\n },\n);\nTableSortLabel.displayName = \"TableSortLabel\";\n\nexport interface TableStackedTextProps {\n /** Primary line (semibold body). */\n title: React.ReactNode;\n /** Secondary line (caption, muted). */\n subtitle: React.ReactNode;\n}\n\n/**\n * Two-line primary + secondary text block for \"cell + info\" patterns.\n *\n * @deprecated Prefer {@link TableCellContent} which supports adornments and\n * matches the Figma `V2 Table Content` slot.\n */\nexport function TableStackedText({ title, subtitle }: TableStackedTextProps) {\n return <TableCellContent primary={title} secondary={subtitle} />;\n}\n\nTableStackedText.displayName = \"TableStackedText\";\n\nexport interface TableLineClampProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Number of lines before ellipsis. @default 2 */\n lines?: 1 | 2 | 3;\n}\n\n/**\n * Clamps child text to a fixed number of lines inside a {@link TableCell}.\n */\nexport const TableLineClamp = React.forwardRef<HTMLDivElement, TableLineClampProps>(\n ({ className, lines = 2, ...props }, ref) => {\n return (\n <div\n ref={ref}\n className={cn(\n lines === 1 && \"line-clamp-1\",\n lines === 2 && \"line-clamp-2\",\n lines === 3 && \"line-clamp-3\",\n className,\n )}\n {...props}\n />\n );\n },\n);\nTableLineClamp.displayName = \"TableLineClamp\";\n\nexport interface TableRowsPerPageSelectProps {\n /** Passed to the trigger for forms and labels. */\n id?: string;\n /** Accessible name for the trigger when no visible label. @default \"Rows per page\" */\n \"aria-label\"?: string;\n}\n\n/**\n * Rows-per-page {@link Select} styled for {@link TablePagination}. v2 uses a\n * subtle pill trigger with the table's secondary-surface background.\n */\nexport function TableRowsPerPageSelect(props: TableRowsPerPageSelectProps) {\n const { id, \"aria-label\": ariaLabel = \"Rows per page\" } = props;\n return (\n <Select\n defaultValue=\"10\"\n size=\"32\"\n aria-label={ariaLabel}\n className=\"w-[154px] [&_button]:rounded-sm [&_button]:border-transparent [&_button]:bg-inputs-inputs-primary\"\n id={id}\n >\n <SelectContent>\n <SelectItem value=\"10\">10 rows per page</SelectItem>\n <SelectItem value=\"25\">25 rows per page</SelectItem>\n <SelectItem value=\"50\">50 rows per page</SelectItem>\n </SelectContent>\n </Select>\n );\n}\n"],"names":["React","jsx","cn","jsxs","ArrowDownIcon","ArrowUpIcon","Select","SelectContent","SelectItem"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAsBA,MAAM,mBAAmBA,iBAAM,cAAyB,IAAI;AAE5D,SAAS,eAA0B;AACjC,SAAOA,iBAAM,WAAW,gBAAgB;AAC1C;AA6BO,MAAM,YAAYA,iBAAM;AAAA,EAC7B,CAAC,EAAE,WAAW,OAAO,MAAM,GAAG,MAAA,GAAS,QAAQ;AAC7C,WACEC,2BAAAA,IAAC,iBAAiB,UAAjB,EAA0B,OAAO,MAChC,UAAAA,2BAAAA;AAAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,WAAWC,GAAAA;AAAAA,UACT;AAAA,UACA;AAAA,QAAA;AAAA,QAED,GAAG;AAAA,MAAA;AAAA,IAAA,GAER;AAAA,EAEJ;AACF;AACA,UAAU,cAAc;AAOjB,MAAM,eAAeF,iBAAM;AAAA,EAChC,CAAC,EAAE,WAAW,GAAG,MAAA,GAAS,QAAQ;AAChC,WACEC,2BAAAA;AAAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,WAAWC,GAAAA,GAAG,+CAA+C,SAAS;AAAA,QACrE,GAAG;AAAA,MAAA;AAAA,IAAA;AAAA,EAGV;AACF;AACA,aAAa,cAAc;AAgBpB,MAAM,kBAAkBF,iBAAM;AAAA,EACnC,CAAC,EAAE,WAAW,UAAU,UAAU,WAAW,GAAG,MAAA,GAAS,QAAQ;AAC/D,WACEC,2BAAAA;AAAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,WAAWC,GAAAA,GAAG,2CAA2C,SAAS;AAAA,QACjE,GAAG;AAAA,QAEJ,UAAAD,2BAAAA,IAAC,OAAA,EAAI,WAAU,mBAAmB,SAAA,CAAS;AAAA,MAAA;AAAA,I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A,EAAW,OAAM,MAAK,UAAA,oBAAgB;AAAA,QACvCP,2BAAAA,IAACO,OAAAA,YAAA,EAAW,OAAM,MAAK,UAAA,mBAAA,CAAgB;AAAA,MAAA,EAAA,CACzC;AAAA,IAAA;AAAA,EAAA;AAGN;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -37,7 +37,7 @@ const TablePagination = React__namespace.forwardRef(
|
|
|
37
37
|
"div",
|
|
38
38
|
{
|
|
39
39
|
className: cn.cn(
|
|
40
|
-
"typography-
|
|
40
|
+
"typography-description-12px-regular min-w-0 flex-1 text-content-secondary",
|
|
41
41
|
leadingSlot == null && "text-left",
|
|
42
42
|
leadingSlot != null && "text-right"
|
|
43
43
|
),
|
|
@@ -59,7 +59,7 @@ const TablePagination = React__namespace.forwardRef(
|
|
|
59
59
|
children: [
|
|
60
60
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex min-h-0 min-w-0 flex-1 items-center", children: leadingSlot }),
|
|
61
61
|
paginationSlot != null ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex shrink-0 items-center justify-center", children: paginationSlot }) : null,
|
|
62
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "typography-
|
|
62
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "typography-description-12px-regular min-w-0 flex-1 text-right text-content-secondary", children: summary })
|
|
63
63
|
]
|
|
64
64
|
}
|
|
65
65
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TablePagination.cjs","sources":["../../../../src/components/Table/TablePagination.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"@/utils/cn\";\n\n/** Layout preset for the pagination bar — desktop (range on the right) or stacked mobile. */\nexport type TablePaginationLayout = \"desktop\" | \"mobile\";\n\nexport interface TablePaginationProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Layout preset. @default \"desktop\" */\n layout?: TablePaginationLayout;\n /** Left (desktop) or top row (mobile) content, e.g. rows-per-page {@link Select}. */\n leadingSlot?: React.ReactNode;\n /** Center (desktop) or bottom row (mobile) content, e.g. {@link Pagination}. */\n paginationSlot?: React.ReactNode;\n /** Summary text or node (e.g. current range and total). */\n summary: React.ReactNode;\n}\n\n/**\n * Footer bar for data tables: rows-per-page control, page navigation, and\n * range summary. Pair `paginationSlot` with {@link Pagination} for numbered\n * controls.\n *\n * v2 sits flush inside {@link TableCard} (`px-3` matches the card's inner\n * gutter); the chip styling now lives on the {@link TableRowsPerPageSelect}\n * trigger itself.\n *\n * @example\n * ```tsx\n * <TablePagination\n * leadingSlot={<TableRowsPerPageSelect />}\n * paginationSlot={<Pagination totalPages={5} currentPage={2} onPageChange={setPage} />}\n * summary=\"20–30 of 100 rows\"\n * />\n * ```\n */\nexport const TablePagination = React.forwardRef<HTMLDivElement, TablePaginationProps>(\n ({ className, layout = \"desktop\", leadingSlot, paginationSlot, summary, ...props }, ref) => {\n if (layout === \"mobile\") {\n return (\n <div\n ref={ref}\n className={cn(\"flex w-full max-w-full flex-col gap-4 px-3 py-3\", className)}\n {...props}\n >\n <div className=\"flex w-full items-center gap-2\">\n {leadingSlot != null ? (\n <div className=\"flex min-w-0 shrink-0 items-center\">{leadingSlot}</div>\n ) : null}\n <div\n className={cn(\n \"typography-
|
|
1
|
+
{"version":3,"file":"TablePagination.cjs","sources":["../../../../src/components/Table/TablePagination.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"@/utils/cn\";\n\n/** Layout preset for the pagination bar — desktop (range on the right) or stacked mobile. */\nexport type TablePaginationLayout = \"desktop\" | \"mobile\";\n\nexport interface TablePaginationProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Layout preset. @default \"desktop\" */\n layout?: TablePaginationLayout;\n /** Left (desktop) or top row (mobile) content, e.g. rows-per-page {@link Select}. */\n leadingSlot?: React.ReactNode;\n /** Center (desktop) or bottom row (mobile) content, e.g. {@link Pagination}. */\n paginationSlot?: React.ReactNode;\n /** Summary text or node (e.g. current range and total). */\n summary: React.ReactNode;\n}\n\n/**\n * Footer bar for data tables: rows-per-page control, page navigation, and\n * range summary. Pair `paginationSlot` with {@link Pagination} for numbered\n * controls.\n *\n * v2 sits flush inside {@link TableCard} (`px-3` matches the card's inner\n * gutter); the chip styling now lives on the {@link TableRowsPerPageSelect}\n * trigger itself.\n *\n * @example\n * ```tsx\n * <TablePagination\n * leadingSlot={<TableRowsPerPageSelect />}\n * paginationSlot={<Pagination totalPages={5} currentPage={2} onPageChange={setPage} />}\n * summary=\"20–30 of 100 rows\"\n * />\n * ```\n */\nexport const TablePagination = React.forwardRef<HTMLDivElement, TablePaginationProps>(\n ({ className, layout = \"desktop\", leadingSlot, paginationSlot, summary, ...props }, ref) => {\n if (layout === \"mobile\") {\n return (\n <div\n ref={ref}\n className={cn(\"flex w-full max-w-full flex-col gap-4 px-3 py-3\", className)}\n {...props}\n >\n <div className=\"flex w-full items-center gap-2\">\n {leadingSlot != null ? (\n <div className=\"flex min-w-0 shrink-0 items-center\">{leadingSlot}</div>\n ) : null}\n <div\n className={cn(\n \"typography-description-12px-regular min-w-0 flex-1 text-content-secondary\",\n leadingSlot == null && \"text-left\",\n leadingSlot != null && \"text-right\",\n )}\n >\n {summary}\n </div>\n </div>\n {paginationSlot != null ? (\n <div className=\"flex justify-center\">{paginationSlot}</div>\n ) : null}\n </div>\n );\n }\n\n return (\n <div\n ref={ref}\n className={cn(\"flex w-full flex-wrap items-center gap-3 px-3 py-3\", className)}\n {...props}\n >\n <div className=\"flex min-h-0 min-w-0 flex-1 items-center\">{leadingSlot}</div>\n {paginationSlot != null ? (\n <div className=\"flex shrink-0 items-center justify-center\">{paginationSlot}</div>\n ) : null}\n <div className=\"typography-description-12px-regular min-w-0 flex-1 text-right text-content-secondary\">\n {summary}\n </div>\n </div>\n );\n },\n);\nTablePagination.displayName = \"TablePagination\";\n"],"names":["React","jsxs","cn","jsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAmCO,MAAM,kBAAkBA,iBAAM;AAAA,EACnC,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
|
31
31
|
"inline-flex min-w-0 items-center justify-center",
|
|
32
32
|
"rounded-xs",
|
|
33
|
-
"typography-
|
|
33
|
+
"typography-body-default-16px-semibold cursor-pointer text-content-primary",
|
|
34
34
|
"motion-safe:transition-colors motion-safe:duration-150 motion-safe:ease-in-out",
|
|
35
35
|
"data-[orientation=horizontal]:px-4 data-[orientation=horizontal]:py-3",
|
|
36
36
|
"data-[orientation=vertical]:justify-start data-[orientation=vertical]:px-4 data-[orientation=vertical]:py-3",
|
|
@@ -41,7 +41,7 @@ const TabsTrigger = React__namespace.forwardRef(({ className, children, ...props
|
|
|
41
41
|
"data-disabled:pointer-events-none",
|
|
42
42
|
"data-disabled:data-[state=active]:text-content-tertiary",
|
|
43
43
|
"data-disabled:data-[state=inactive]:text-neutral-alphas-300",
|
|
44
|
-
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-interaction-focus focus-visible:ring-offset-2 focus-visible:ring-offset-
|
|
44
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-interaction-focus focus-visible:ring-offset-2 focus-visible:ring-offset-background-primary",
|
|
45
45
|
className
|
|
46
46
|
),
|
|
47
47
|
...props,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabsTrigger.cjs","sources":["../../../../src/components/Tabs/TabsTrigger.tsx"],"sourcesContent":["import * as TabsPrimitive from \"@radix-ui/react-tabs\";\nimport * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\n\n/** Props for the {@link TabsTrigger} button component. */\nexport type TabsTriggerProps = React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger>;\n\n/** An interactive tab button that activates its associated {@link TabsContent} panel when clicked. */\nexport const TabsTrigger = React.forwardRef<\n React.ComponentRef<typeof TabsPrimitive.Trigger>,\n TabsTriggerProps\n>(({ className, children, ...props }, ref) => (\n <TabsPrimitive.Trigger\n ref={ref}\n className={cn(\n \"inline-flex min-w-0 items-center justify-center\",\n \"rounded-xs\",\n \"typography-
|
|
1
|
+
{"version":3,"file":"TabsTrigger.cjs","sources":["../../../../src/components/Tabs/TabsTrigger.tsx"],"sourcesContent":["import * as TabsPrimitive from \"@radix-ui/react-tabs\";\nimport * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\n\n/** Props for the {@link TabsTrigger} button component. */\nexport type TabsTriggerProps = React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger>;\n\n/** An interactive tab button that activates its associated {@link TabsContent} panel when clicked. */\nexport const TabsTrigger = React.forwardRef<\n React.ComponentRef<typeof TabsPrimitive.Trigger>,\n TabsTriggerProps\n>(({ className, children, ...props }, ref) => (\n <TabsPrimitive.Trigger\n ref={ref}\n className={cn(\n \"inline-flex min-w-0 items-center justify-center\",\n \"rounded-xs\",\n \"typography-body-default-16px-semibold cursor-pointer text-content-primary\",\n \"motion-safe:transition-colors motion-safe:duration-150 motion-safe:ease-in-out\",\n \"data-[orientation=horizontal]:px-4 data-[orientation=horizontal]:py-3\",\n \"data-[orientation=vertical]:justify-start data-[orientation=vertical]:px-4 data-[orientation=vertical]:py-3\",\n \"data-[state=active]:hover:text-buttons-primary-muted\",\n \"data-[state=inactive]:hover:text-neutral-alphas-300\",\n \"data-[state=active]:active:text-buttons-primary-muted\",\n \"data-[state=inactive]:active:text-neutral-alphas-300\",\n \"data-disabled:pointer-events-none\",\n \"data-disabled:data-[state=active]:text-content-tertiary\",\n \"data-disabled:data-[state=inactive]:text-neutral-alphas-300\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-interaction-focus focus-visible:ring-offset-2 focus-visible:ring-offset-background-primary\",\n className,\n )}\n {...props}\n >\n <span className=\"min-w-0 truncate\">{children}</span>\n </TabsPrimitive.Trigger>\n));\n\nTabsTrigger.displayName = \"TabsTrigger\";\n"],"names":["React","jsx","TabsPrimitive","cn"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAQO,MAAM,cAAcA,iBAAM,WAG/B,CAAC,EAAE,WAAW,UAAU,GAAG,SAAS,QACpCC,2BAAAA;AAAAA,EAACC,yBAAc;AAAA,EAAd;AAAA,IACC;AAAA,IACA,WAAWC,GAAAA;AAAAA,MACT;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IAAA;AAAA,IAED,GAAG;AAAA,IAEJ,UAAAF,2BAAAA,IAAC,QAAA,EAAK,WAAU,oBAAoB,SAAA,CAAS;AAAA,EAAA;AAC/C,CACD;AAED,YAAY,cAAc;;"}
|
|
@@ -30,9 +30,9 @@ const CONTAINER_MIN_HEIGHT = {
|
|
|
30
30
|
"32": "min-h-8"
|
|
31
31
|
};
|
|
32
32
|
const TEXTAREA_SIZE_CLASSES = {
|
|
33
|
-
"48": "py-3 typography-
|
|
34
|
-
"40": "py-2 typography-
|
|
35
|
-
"32": "py-2 typography-
|
|
33
|
+
"48": "py-3 typography-body-default-16px-regular autofill-body-lg",
|
|
34
|
+
"40": "py-2 typography-body-default-16px-regular autofill-body-lg",
|
|
35
|
+
"32": "py-2 typography-body-small-14px-regular autofill-body-md"
|
|
36
36
|
};
|
|
37
37
|
const PADDING_HORIZONTAL = {
|
|
38
38
|
"48": "px-4",
|
|
@@ -78,7 +78,7 @@ function TextAreaHelperText({
|
|
|
78
78
|
{
|
|
79
79
|
id,
|
|
80
80
|
className: cn.cn(
|
|
81
|
-
"typography-
|
|
81
|
+
"typography-description-12px-regular px-2 pt-1 pb-0.5",
|
|
82
82
|
error ? "text-error-content" : "text-content-secondary"
|
|
83
83
|
),
|
|
84
84
|
children
|
|
@@ -179,7 +179,7 @@ const TextArea = React__namespace.forwardRef(
|
|
|
179
179
|
"label",
|
|
180
180
|
{
|
|
181
181
|
htmlFor: inputId,
|
|
182
|
-
className: "typography-
|
|
182
|
+
className: "typography-description-12px-semibold px-1 pt-1 pb-2 text-content-primary",
|
|
183
183
|
children: label
|
|
184
184
|
}
|
|
185
185
|
),
|