@tribepad/themis 1.5.8 → 1.6.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/CHANGELOG.md +26 -0
- package/dist/elements/AlertDialog/index.js +1 -1
- package/dist/elements/AlertDialog/index.js.map +1 -1
- package/dist/elements/AlertDialog/index.mjs +1 -1
- package/dist/elements/AlertDialog/index.mjs.map +1 -1
- package/dist/elements/Badge/index.js +1 -1
- package/dist/elements/Badge/index.js.map +1 -1
- package/dist/elements/Badge/index.mjs +1 -1
- package/dist/elements/Badge/index.mjs.map +1 -1
- package/dist/elements/Breadcrumbs/index.js +1 -1
- package/dist/elements/Breadcrumbs/index.js.map +1 -1
- package/dist/elements/Breadcrumbs/index.mjs +1 -1
- package/dist/elements/Breadcrumbs/index.mjs.map +1 -1
- package/dist/elements/Button/index.js +1 -1
- package/dist/elements/Button/index.js.map +1 -1
- package/dist/elements/Button/index.mjs +1 -1
- package/dist/elements/Button/index.mjs.map +1 -1
- package/dist/elements/Card/index.js +1 -1
- package/dist/elements/Card/index.js.map +1 -1
- package/dist/elements/Card/index.mjs +1 -1
- package/dist/elements/Card/index.mjs.map +1 -1
- package/dist/elements/Carousel/index.js +1 -1
- package/dist/elements/Carousel/index.js.map +1 -1
- package/dist/elements/Carousel/index.mjs +1 -1
- package/dist/elements/Carousel/index.mjs.map +1 -1
- package/dist/elements/Chart/index.js +1 -1
- package/dist/elements/Chart/index.js.map +1 -1
- package/dist/elements/Chart/index.mjs +1 -1
- package/dist/elements/Chart/index.mjs.map +1 -1
- package/dist/elements/ChatInterface/index.js +1 -1
- package/dist/elements/ChatInterface/index.js.map +1 -1
- package/dist/elements/ChatInterface/index.mjs +1 -1
- package/dist/elements/ChatInterface/index.mjs.map +1 -1
- package/dist/elements/Checkbox/Checkbox.d.ts.map +1 -1
- package/dist/elements/Checkbox/index.js +1 -1
- package/dist/elements/Checkbox/index.js.map +1 -1
- package/dist/elements/Checkbox/index.mjs +1 -1
- package/dist/elements/Checkbox/index.mjs.map +1 -1
- package/dist/elements/CheckboxGroup/index.js +1 -1
- package/dist/elements/CheckboxGroup/index.js.map +1 -1
- package/dist/elements/CheckboxGroup/index.mjs +1 -1
- package/dist/elements/CheckboxGroup/index.mjs.map +1 -1
- package/dist/elements/ColorPicker/index.js +1 -1
- package/dist/elements/ColorPicker/index.js.map +1 -1
- package/dist/elements/ColorPicker/index.mjs +1 -1
- package/dist/elements/ColorPicker/index.mjs.map +1 -1
- package/dist/elements/Combobox/Combobox.styles.d.ts.map +1 -1
- package/dist/elements/Combobox/index.js +1 -1
- package/dist/elements/Combobox/index.js.map +1 -1
- package/dist/elements/Combobox/index.mjs +1 -1
- package/dist/elements/Combobox/index.mjs.map +1 -1
- package/dist/elements/DatePicker/index.js +1 -1
- package/dist/elements/DatePicker/index.js.map +1 -1
- package/dist/elements/DatePicker/index.mjs +1 -1
- package/dist/elements/DatePicker/index.mjs.map +1 -1
- package/dist/elements/Dropdown/index.js +1 -1
- package/dist/elements/Dropdown/index.js.map +1 -1
- package/dist/elements/Dropdown/index.mjs +1 -1
- package/dist/elements/Dropdown/index.mjs.map +1 -1
- package/dist/elements/FileField/index.js +1 -1
- package/dist/elements/FileField/index.js.map +1 -1
- package/dist/elements/FileField/index.mjs +1 -1
- package/dist/elements/FileField/index.mjs.map +1 -1
- package/dist/elements/Filters/AppliedFilters.d.ts +4 -0
- package/dist/elements/Filters/AppliedFilters.d.ts.map +1 -0
- package/dist/elements/Filters/FilterPopover.d.ts +33 -0
- package/dist/elements/Filters/FilterPopover.d.ts.map +1 -0
- package/dist/elements/Filters/Filters.d.ts +25 -0
- package/dist/elements/Filters/Filters.d.ts.map +1 -0
- package/dist/elements/Filters/Filters.styles.d.ts +24 -0
- package/dist/elements/Filters/Filters.styles.d.ts.map +1 -0
- package/dist/elements/Filters/Filters.types.d.ts +123 -0
- package/dist/elements/Filters/Filters.types.d.ts.map +1 -0
- package/dist/elements/Filters/FiltersContext.d.ts +36 -0
- package/dist/elements/Filters/FiltersContext.d.ts.map +1 -0
- package/dist/elements/Filters/index.css +2 -0
- package/dist/elements/Filters/index.css.map +1 -0
- package/dist/elements/Filters/index.d.ts +26 -0
- package/dist/elements/Filters/index.d.ts.map +1 -0
- package/dist/elements/Filters/index.js +3 -0
- package/dist/elements/Filters/index.js.map +1 -0
- package/dist/elements/Filters/index.mjs +3 -0
- package/dist/elements/Filters/index.mjs.map +1 -0
- package/dist/elements/Modal/Modal.styles.d.ts.map +1 -1
- package/dist/elements/Modal/index.js +1 -1
- package/dist/elements/Modal/index.js.map +1 -1
- package/dist/elements/Modal/index.mjs +1 -1
- package/dist/elements/Modal/index.mjs.map +1 -1
- package/dist/elements/NumberField/index.js +1 -1
- package/dist/elements/NumberField/index.js.map +1 -1
- package/dist/elements/NumberField/index.mjs +1 -1
- package/dist/elements/NumberField/index.mjs.map +1 -1
- package/dist/elements/PageTitle/PageTitle.d.ts.map +1 -1
- package/dist/elements/PageTitle/PageTitle.styles.d.ts.map +1 -1
- package/dist/elements/PageTitle/index.js +1 -1
- package/dist/elements/PageTitle/index.js.map +1 -1
- package/dist/elements/PageTitle/index.mjs +1 -1
- package/dist/elements/PageTitle/index.mjs.map +1 -1
- package/dist/elements/Pagination/index.js +1 -1
- package/dist/elements/Pagination/index.js.map +1 -1
- package/dist/elements/Pagination/index.mjs +1 -1
- package/dist/elements/Pagination/index.mjs.map +1 -1
- package/dist/elements/Panel/Panel.d.ts.map +1 -1
- package/dist/elements/Panel/index.js +1 -1
- package/dist/elements/Panel/index.js.map +1 -1
- package/dist/elements/Panel/index.mjs +1 -1
- package/dist/elements/Panel/index.mjs.map +1 -1
- package/dist/elements/PasswordField/PasswordField.types.d.ts +34 -34
- package/dist/elements/PasswordField/index.js +1 -1
- package/dist/elements/PasswordField/index.js.map +1 -1
- package/dist/elements/PasswordField/index.mjs +1 -1
- package/dist/elements/PasswordField/index.mjs.map +1 -1
- package/dist/elements/RadioGroup/index.js +1 -1
- package/dist/elements/RadioGroup/index.js.map +1 -1
- package/dist/elements/RadioGroup/index.mjs +1 -1
- package/dist/elements/RadioGroup/index.mjs.map +1 -1
- package/dist/elements/RatingScale/RatingScale.styles.d.ts.map +1 -1
- package/dist/elements/RatingScale/index.js +1 -1
- package/dist/elements/RatingScale/index.js.map +1 -1
- package/dist/elements/RatingScale/index.mjs +1 -1
- package/dist/elements/RatingScale/index.mjs.map +1 -1
- package/dist/elements/Resizable/components/ResizablePopover.d.ts.map +1 -1
- package/dist/elements/Resizable/index.js +1 -1
- package/dist/elements/Resizable/index.js.map +1 -1
- package/dist/elements/Resizable/index.mjs +1 -1
- package/dist/elements/Resizable/index.mjs.map +1 -1
- package/dist/elements/SearchField/index.js +1 -1
- package/dist/elements/SearchField/index.js.map +1 -1
- package/dist/elements/SearchField/index.mjs +1 -1
- package/dist/elements/SearchField/index.mjs.map +1 -1
- package/dist/elements/Select/Select.styles.d.ts.map +1 -1
- package/dist/elements/Select/index.js +1 -1
- package/dist/elements/Select/index.js.map +1 -1
- package/dist/elements/Select/index.mjs +1 -1
- package/dist/elements/Select/index.mjs.map +1 -1
- package/dist/elements/Sidebar/Sidebar.styles.d.ts +34 -3
- package/dist/elements/Sidebar/Sidebar.styles.d.ts.map +1 -1
- package/dist/elements/Sidebar/Sidebar.types.d.ts +6 -0
- package/dist/elements/Sidebar/Sidebar.types.d.ts.map +1 -1
- package/dist/elements/Sidebar/SidebarPanel.d.ts.map +1 -1
- package/dist/elements/Sidebar/SidebarRail.d.ts.map +1 -1
- package/dist/elements/Sidebar/index.js +1 -1
- package/dist/elements/Sidebar/index.js.map +1 -1
- package/dist/elements/Sidebar/index.mjs +1 -1
- package/dist/elements/Sidebar/index.mjs.map +1 -1
- package/dist/elements/SituationalJudgement/index.js +1 -1
- package/dist/elements/SituationalJudgement/index.js.map +1 -1
- package/dist/elements/SituationalJudgement/index.mjs +1 -1
- package/dist/elements/SituationalJudgement/index.mjs.map +1 -1
- package/dist/elements/Switch/index.js +1 -1
- package/dist/elements/Switch/index.js.map +1 -1
- package/dist/elements/Switch/index.mjs +1 -1
- package/dist/elements/Switch/index.mjs.map +1 -1
- package/dist/elements/Table/BulkActionBar.d.ts +5 -0
- package/dist/elements/Table/BulkActionBar.d.ts.map +1 -0
- package/dist/elements/Table/BulkActionBar.styles.d.ts +17 -0
- package/dist/elements/Table/BulkActionBar.styles.d.ts.map +1 -0
- package/dist/elements/Table/BulkActionBar.types.d.ts +136 -0
- package/dist/elements/Table/BulkActionBar.types.d.ts.map +1 -0
- package/dist/elements/Table/Table.d.ts.map +1 -1
- package/dist/elements/Table/Table.styles.d.ts +2 -2
- package/dist/elements/Table/Table.styles.d.ts.map +1 -1
- package/dist/elements/Table/Table.types.d.ts +14 -4
- package/dist/elements/Table/Table.types.d.ts.map +1 -1
- package/dist/elements/Table/TableCardList.d.ts +25 -0
- package/dist/elements/Table/TableCardList.d.ts.map +1 -0
- package/dist/elements/Table/TableCardList.styles.d.ts +15 -0
- package/dist/elements/Table/TableCardList.styles.d.ts.map +1 -0
- package/dist/elements/Table/TableCardList.types.d.ts +48 -0
- package/dist/elements/Table/TableCardList.types.d.ts.map +1 -0
- package/dist/elements/Table/index.d.ts +9 -0
- package/dist/elements/Table/index.d.ts.map +1 -1
- package/dist/elements/Table/index.js +1 -1
- package/dist/elements/Table/index.js.map +1 -1
- package/dist/elements/Table/index.mjs +1 -1
- package/dist/elements/Table/index.mjs.map +1 -1
- package/dist/elements/Table/resolveSelectedCount.d.ts +20 -0
- package/dist/elements/Table/resolveSelectedCount.d.ts.map +1 -0
- package/dist/elements/Table/useBulkActionShortcut.d.ts +29 -0
- package/dist/elements/Table/useBulkActionShortcut.d.ts.map +1 -0
- package/dist/elements/Tabs/Tabs.d.ts.map +1 -1
- package/dist/elements/Tabs/index.js +1 -1
- package/dist/elements/Tabs/index.js.map +1 -1
- package/dist/elements/Tabs/index.mjs +1 -1
- package/dist/elements/Tabs/index.mjs.map +1 -1
- package/dist/elements/TextField/TextField.types.d.ts +68 -68
- package/dist/elements/TextField/index.js +1 -1
- package/dist/elements/TextField/index.js.map +1 -1
- package/dist/elements/TextField/index.mjs +1 -1
- package/dist/elements/TextField/index.mjs.map +1 -1
- package/dist/elements/Toast/Toast.d.ts.map +1 -1
- package/dist/elements/Toast/index.js +1 -1
- package/dist/elements/Toast/index.js.map +1 -1
- package/dist/elements/Toast/index.mjs +1 -1
- package/dist/elements/Toast/index.mjs.map +1 -1
- package/dist/elements/Tooltip/index.js +1 -1
- package/dist/elements/Tooltip/index.js.map +1 -1
- package/dist/elements/Tooltip/index.mjs +1 -1
- package/dist/elements/Tooltip/index.mjs.map +1 -1
- package/dist/elements/Wizard/index.js +1 -1
- package/dist/elements/Wizard/index.js.map +1 -1
- package/dist/elements/Wizard/index.mjs +1 -1
- package/dist/elements/Wizard/index.mjs.map +1 -1
- package/dist/elements/index.d.ts +4 -1
- package/dist/elements/index.d.ts.map +1 -1
- package/dist/elements/index.js +1 -1
- package/dist/elements/index.js.map +1 -1
- package/dist/elements/index.mjs +1 -1
- package/dist/elements/index.mjs.map +1 -1
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +1 -1
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +1 -1
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/hooks/useContainerNarrow.d.ts +15 -0
- package/dist/hooks/useContainerNarrow.d.ts.map +1 -0
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/dist/styles/defaults.css +15 -0
- package/dist/styles/index.js +1 -1
- package/dist/styles/index.js.map +1 -1
- package/dist/styles/index.mjs +1 -1
- package/dist/styles/index.mjs.map +1 -1
- package/dist/styles/interaction-states.d.ts +2 -2
- package/dist/styles/interaction-states.d.ts.map +1 -1
- package/package.json +6 -1
- package/src/elements/Filters/Filters.stories.tsx +148 -0
- package/src/elements/PageTitle/PageTitle.stories.tsx +15 -19
- package/src/elements/Sidebar/Sidebar.stories.tsx +13 -2
- package/src/elements/Table/Table.stories.tsx +467 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/cn.ts","../../../src/utils/shouldAnimate.ts","../../../src/hooks/useReducedMotion.ts","../../../src/styles/interaction-states.ts","../../../src/elements/Switch/Switch.tsx","../../../src/schemas/BaseComponentProps.ts","../../../src/elements/Switch/Switch.types.ts"],"names":["cn","inputs","twMerge","clsx","shouldAnimate","animated","prefersReducedMotion","QUERY","getInitialState","useReducedMotion","setPrefersReducedMotion","useState","useEffect","mql","handler","event","FOCUS_STYLES","PRESSED_STYLES","HOVER_STYLES","HIGH_CONTRAST_FOCUS","HIGH_CONTRAST_HOVER","HIGH_CONTRAST_PRESSED","DEFAULT_INTERACTIONS","cachedAnimate","loadMotionAnimate","m","DEFAULT_SPRING","switchOuterVariants","cva","switchTrackVariants","switchThumbVariants","Switch","memo","forwardRef","className","variant","size","label","description","isDisabled","isReadOnly","springConfig","onChangeProp","props","ref","doAnimate","thumbRef","useRef","motionReady","animateRef","activeAnimation","fn","isCurrentlySelected","handleChange","useCallback","isSelected","useMotionThumb","jsx","AriaSwitch","_classNameProps","renderProps","jsxs","Fragment","BaseComponentPropsSchema","z","SwitchPropsSchema"],"mappings":"mSAcO,SAASA,CAAAA,CAAAA,GAAMC,CAAAA,CAA8B,CAClD,OAAOC,OAAAA,CAAQC,KAAKF,CAAM,CAAC,CAC7B,CCNO,SAASG,EACdC,CAAAA,CACAC,CAAAA,CACS,CAET,OADI,EAAAD,IAAa,KAAA,EACbC,CAAAA,CAEN,CCbA,IAAMC,CAAAA,CAAQ,mCAEd,SAASC,CAAAA,EAA2B,CAClC,OAAI,OAAO,OAAW,GAAA,CAAoB,KAAA,CACnC,OAAO,UAAA,CAAWD,CAAK,EAAE,OAClC,CASO,SAASE,CAAAA,EAA4B,CAC1C,GAAM,CAACH,CAAAA,CAAsBI,CAAuB,CAAA,C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wind CSS classes with conflict resolution\n *\n * Combines clsx for conditional classes and tailwind-merge for deduplication\n *\n * @example\n * cn('px-2 py-1', 'px-4') // => 'py-1 px-4' (px-4 overrides px-2)\n * cn('text-red-500', condition && 'text-blue-500') // => conditional application\n */\n\nimport { clsx, type ClassValue } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\nexport function cn(...inputs: ClassValue[]): string {\n return twMerge(clsx(inputs));\n}\n","/**\n * Determines whether a component should animate.\n *\n * Returns `false` if:\n * - The `animated` prop is explicitly `false`\n * - The user prefers reduced motion\n *\n * @param animated - The component's `animated` prop value (default: `true`)\n * @param prefersReducedMotion - Whether the user prefers reduced motion\n */\nexport function shouldAnimate(\n animated: boolean | undefined,\n prefersReducedMotion: boolean,\n): boolean {\n if (animated === false) return false;\n if (prefersReducedMotion) return false;\n return true;\n}\n","'use client';\n\nimport { useState, useEffect } from 'react';\n\nconst QUERY = '(prefers-reduced-motion: reduce)';\n\nfunction getInitialState(): boolean {\n if (typeof window === 'undefined') return false;\n return window.matchMedia(QUERY).matches;\n}\n\n/**\n * Detects whether the user prefers reduced motion.\n *\n * - SSR-safe (returns `false` on the server)\n * - Reacts to changes in the OS preference\n * - Cleans up the listener on unmount\n */\nexport function useReducedMotion(): boolean {\n const [prefersReducedMotion, setPrefersReducedMotion] = useState(getInitialState);\n\n useEffect(() => {\n const mql = window.matchMedia(QUERY);\n setPrefersReducedMotion(mql.matches);\n\n const handler = (event: MediaQueryListEvent): void => {\n setPrefersReducedMotion(event.matches);\n };\n\n mql.addEventListener('change', handler);\n return () => mql.removeEventListener('change', handler);\n }, []);\n\n return prefersReducedMotion;\n}\n","/**\n * Global Interaction State Styles\n *\n * Consistent interaction patterns across all Themis components.\n * These styles ensure WCAG 2.2 AAA compliance and predictable UX.\n *\n * @see spec.md FR-010 (Visible focus ring for keyboard navigation)\n * @see spec.md FR-031 (Pressed state feedback)\n * @see spec.md FR-012 (High contrast mode support)\n * @see constitution.md Principle IV (Accessibility First)\n */\n\n/**\n * Focus state styles (FR-010)\n * Visible focus ring for keyboard navigation - WCAG 2.2 Level AAA\n *\n * Components can override by extending these styles:\n * @example\n * cn(FOCUS_STYLES, \"ring-4\") // Increases ring width to 4px\n */\nexport const FOCUS_STYLES = \"data-[focus-visible]:ring-2 data-[focus-visible]:ring-[var(--themis-ring)] data-[focus-visible]:ring-offset-2\";\n\n/**\n * Pressed/Active state styles (FR-031)\n * Visual feedback for press interactions\n *\n * Components can override the scale amount:\n * @example\n * cn(PRESSED_STYLES_BASE, \"data-[pressed]:scale-[0.95]\") // More pronounced scale\n */\nexport const PRESSED_STYLES = \"data-[pressed]:scale-[0.97]\";\n\n/**\n * Base pressed styles without scale (for components that need different feedback)\n */\nexport const PRESSED_STYLES_BASE = \"data-[pressed]:transition-transform data-[pressed]:duration-100\";\n\n/**\n * Hover state styles\n * Elevation change on hover for better affordance\n *\n * Components can override shadow depth:\n * @example\n * cn(HOVER_STYLES_BASE, \"data-[hovered]:shadow-lg\") // Larger shadow\n */\nexport const HOVER_STYLES = \"data-[hovered]:shadow-md\";\n\n/**\n * Base hover styles without shadow (for components that use different hover effects)\n */\nexport const HOVER_STYLES_BASE = \"data-[hovered]:transition-shadow data-[hovered]:duration-200\";\n\n/**\n * High contrast mode focus (FR-012)\n * Enhanced outlines for users requiring high contrast\n *\n * Uses 'hc:' prefix for prefers-contrast: more media query\n */\nexport const HIGH_CONTRAST_FOCUS = \"hc:data-[focus-visible]:outline hc:data-[focus-visible]:outline-4 hc:data-[focus-visible]:outline-offset-2 hc:data-[focus-visible]:outline-foreground\";\n\n/**\n * High contrast mode hover (FR-012)\n * Enhanced outlines for hover in high contrast mode\n */\nexport const HIGH_CONTRAST_HOVER = \"hc:data-[hovered]:outline hc:data-[hovered]:outline-2 hc:data-[hovered]:outline-foreground\";\n\n/**\n * High contrast mode pressed state\n * Enhanced outlines for pressed state in high contrast mode\n */\nexport const HIGH_CONTRAST_PRESSED = \"hc:data-[pressed]:outline hc:data-[pressed]:outline-2 hc:data-[pressed]:outline-offset-1 hc:data-[pressed]:outline-foreground\";\n\n/**\n * Combined high contrast styles\n * Use this for components that need all high contrast interaction states\n */\nexport const HIGH_CONTRAST_INTERACTIONS = `${HIGH_CONTRAST_FOCUS} ${HIGH_CONTRAST_HOVER} ${HIGH_CONTRAST_PRESSED}`;\n\n/**\n * Disabled state styles\n * Consistent disabled appearance across all components\n */\nexport const DISABLED_STYLES = \"disabled:pointer-events-none disabled:opacity-50\";\n\n/**\n * Default interaction bundle\n * Most common combination for interactive components\n *\n * Includes: focus ring, pressed scale, hover shadow, high contrast enhancements\n *\n * @example\n * <button className={cn(DEFAULT_INTERACTIONS, \"bg-primary\")}>Click</button>\n */\nexport const DEFAULT_INTERACTIONS = `${FOCUS_STYLES} ${PRESSED_STYLES} ${HOVER_STYLES} ${HIGH_CONTRAST_FOCUS} ${HIGH_CONTRAST_HOVER} ${HIGH_CONTRAST_PRESSED}`;\n\n/**\n * Subtle interaction bundle\n * For components that need less pronounced feedback\n *\n * Includes: focus ring and high contrast, but no hover shadow or pressed scale\n */\nexport const SUBTLE_INTERACTIONS = `${FOCUS_STYLES} ${HIGH_CONTRAST_FOCUS}`;\n\n/**\n * Non-interactive element styles\n * For elements that should indicate they are not interactive\n */\nexport const NON_INTERACTIVE = \"cursor-default select-none\";\n","\"use client\";\n\n/**\n * Switch Component\n * Accessible toggle switch with React Aria primitives and CVA styling.\n * Supports optional spring animation via motion.dev.\n *\n * @see React Aria Switch: https://react-spectrum.adobe.com/react-aria/Switch.html\n * @see ShadCN Switch: https://ui.shadcn.com/docs/components/switch\n * @see spec.md (WCAG 2.2 AAA - 7:1 contrast ratio, 44x44px touch targets)\n * @see constitution.md Principle IV (Accessibility First)\n */\n\nimport { forwardRef, memo, useRef, useEffect, useCallback } from 'react';\nimport {\n Switch as AriaSwitch,\n type SwitchProps as AriaSwitchProps,\n} from 'react-aria-components';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { cn } from '../../utils/cn';\nimport { shouldAnimate } from '../../utils/shouldAnimate';\nimport { useReducedMotion } from '../../hooks/useReducedMotion';\nimport { DEFAULT_INTERACTIONS } from '../../styles/interaction-states';\nimport type { AnimatedProps, SpringConfig } from '../../types/animation';\n\n// ---------------------------------------------------------------------------\n// Motion lazy-loader — avoids hard dep on optional peer\n// ---------------------------------------------------------------------------\n\ntype AnimateFn = (\n element: Element,\n keyframes: Record<string, string | number>,\n options?: Record<string, unknown>,\n) => { stop: () => void };\n\nlet cachedAnimate: AnimateFn | null | undefined; // undefined = pending, null = unavailable\n\nfunction loadMotionAnimate(): Promise<AnimateFn | null> {\n if (cachedAnimate !== undefined) return Promise.resolve(cachedAnimate);\n\n return import('motion')\n .then((m) => {\n cachedAnimate = m.animate as unknown as AnimateFn;\n return cachedAnimate;\n })\n .catch(() => {\n cachedAnimate = null;\n return null;\n });\n}\n\n// ---------------------------------------------------------------------------\n// Default spring configuration\n// ---------------------------------------------------------------------------\n\nconst DEFAULT_SPRING: SpringConfig = { stiffness: 500, damping: 30 };\n\n// ---------------------------------------------------------------------------\n// CVA Variants\n// ---------------------------------------------------------------------------\n\n/**\n * Layer 1: Transparent outer touch target (44x44px minimum)\n * This layer handles the WCAG 2.2 AAA touch target requirement\n * Always invisible, centers the visual switch inside\n */\nconst switchOuterVariants = cva(\n // Base styles - WCAG 2.2 AAA: 44x44px minimum touch target\n \"inline-flex shrink-0 cursor-pointer items-center justify-center min-h-[44px] min-w-[44px] disabled:cursor-not-allowed disabled:opacity-50 data-[readonly]:cursor-default\",\n {\n variants: {},\n defaultVariants: {},\n }\n);\n\n/**\n * Layer 2: Visual switch track/background (adjustable size)\n * This layer provides the visual appearance and size flexibility\n * Background color changes based on variant and selection state\n */\nconst switchTrackVariants = cva(\n // Base styles - visual track with transitions and focus states\n \"relative inline-flex shrink-0 items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)] focus-visible:ring-offset-2 focus-visible:ring-offset-background\",\n {\n variants: {\n variant: {\n // Default variant: Uses primary color when selected\n default:\n \"bg-[var(--border)] data-[selected]:bg-[var(--primary)]\",\n // Destructive variant: Uses destructive/error color when selected\n destructive:\n \"bg-[var(--border)] data-[selected]:bg-[var(--destructive-background)]\",\n },\n size: {\n // Small: h-6 w-10 (visual track size)\n sm: \"h-6 w-10\",\n // Default: h-7 w-12\n default: \"h-7 w-12\",\n // Large: h-8 w-14\n lg: \"h-8 w-14\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n },\n }\n);\n\n/**\n * Layer 3: Switch thumb (sliding circle)\n * Inner visual element that slides horizontally when switch is selected.\n * When spring animation is active, CSS transition is removed and\n * motion.dev controls the translateX via inline transform.\n */\nconst switchThumbVariants = cva(\n // Base styles: rounded circle with shadow\n \"pointer-events-none absolute left-0.5 rounded-full bg-[var(--content-background)] shadow-lg ring-0\",\n {\n variants: {\n size: {\n // Thumb is slightly smaller than track height for proper padding\n sm: \"h-4 w-4\",\n default: \"h-5 w-5\",\n lg: \"h-6 w-6\",\n },\n animated: {\n // When CSS handles the animation (motion.dev unavailable or disabled)\n false: \"transition-transform data-[selected]:translate-x-full\",\n // When motion.dev handles the animation — no CSS transition\n true: \"\",\n },\n },\n defaultVariants: {\n size: \"default\",\n animated: false,\n },\n }\n);\n\n// ---------------------------------------------------------------------------\n// Component\n// ---------------------------------------------------------------------------\n\nexport interface SwitchProps\n extends Omit<AriaSwitchProps, 'className' | 'children'>,\n VariantProps<typeof switchTrackVariants>,\n AnimatedProps {\n variant?: 'default' | 'destructive';\n size?: 'sm' | 'default' | 'lg';\n label?: string;\n description?: string;\n className?: string;\n /** Spring physics configuration. Default: { stiffness: 500, damping: 30 } */\n springConfig?: SpringConfig;\n}\n\n/**\n * Switch Component\n * Fully accessible toggle switch with React Aria and themed styling.\n * When `animated` is true (default) and motion.dev is installed,\n * the thumb uses spring physics for a natural bounce effect.\n */\nconst Switch = memo(forwardRef<HTMLLabelElement, SwitchProps>(\n (\n {\n className,\n variant,\n size,\n label,\n description,\n isDisabled,\n isReadOnly,\n animated,\n springConfig = DEFAULT_SPRING,\n onChange: onChangeProp,\n ...props\n },\n ref\n ) => {\n const prefersReducedMotion = useReducedMotion();\n const doAnimate = shouldAnimate(animated, prefersReducedMotion);\n\n const thumbRef = useRef<HTMLDivElement>(null);\n const motionReady = useRef(false);\n const animateRef = useRef<AnimateFn | null>(null);\n const activeAnimation = useRef<{ stop: () => void } | null>(null);\n\n // Preload motion.dev when animation is desired\n useEffect(() => {\n if (!doAnimate) return;\n\n loadMotionAnimate().then((fn) => {\n if (fn) {\n animateRef.current = fn;\n motionReady.current = true;\n\n // Set initial thumb position if already selected (no animation)\n if (thumbRef.current) {\n const isCurrentlySelected = thumbRef.current.hasAttribute('data-selected');\n thumbRef.current.style.transform = isCurrentlySelected\n ? 'translateX(100%)'\n : 'translateX(0)';\n }\n }\n });\n }, [doAnimate]);\n\n const handleChange = useCallback(\n (isSelected: boolean) => {\n // Forward to consumer's onChange\n onChangeProp?.(isSelected);\n\n // Trigger spring animation if motion is ready\n if (doAnimate && motionReady.current && animateRef.current && thumbRef.current) {\n // Stop any in-progress animation\n activeAnimation.current?.stop();\n\n activeAnimation.current = animateRef.current(\n thumbRef.current,\n { x: isSelected ? '100%' : '0%' },\n {\n type: 'spring',\n stiffness: springConfig.stiffness,\n damping: springConfig.damping,\n },\n );\n }\n },\n [doAnimate, springConfig.stiffness, springConfig.damping, onChangeProp],\n );\n\n // Use motion for thumb position when motion.dev is handling it\n const useMotionThumb = doAnimate;\n\n return (\n <AriaSwitch\n ref={ref}\n isDisabled={isDisabled}\n isReadOnly={isReadOnly}\n onChange={handleChange}\n className={(_classNameProps) =>\n cn(\n \"group inline-flex items-center gap-2\",\n isDisabled && \"cursor-not-allowed opacity-50\",\n className\n )\n }\n {...props}\n >\n {(renderProps) => (\n <>\n {/* Layer 1: Transparent outer touch target (44x44px WCAG compliant) */}\n <div\n className={cn(switchOuterVariants())}\n data-selected={renderProps.isSelected || undefined}\n data-readonly={isReadOnly || undefined}\n >\n {/* Layer 2: Visual switch track (adjustable size with variants) */}\n <div\n className={cn(\n switchTrackVariants({ variant, size }),\n DEFAULT_INTERACTIONS\n )}\n data-selected={renderProps.isSelected || undefined}\n >\n {/* Layer 3: Thumb (sliding circle, absolutely positioned) */}\n <div\n ref={thumbRef}\n className={cn(switchThumbVariants({\n size,\n animated: useMotionThumb,\n }))}\n data-selected={renderProps.isSelected || undefined}\n />\n </div>\n </div>\n\n {/* Optional label and description */}\n {(label || description) && (\n <div className=\"flex flex-col\">\n {label && (\n <span className=\"text-sm font-medium text-[var(--content-foreground)]\">\n {label}\n </span>\n )}\n {description && (\n <span className=\"text-xs text-[var(--menu-muted)]\">\n {description}\n </span>\n )}\n </div>\n )}\n </>\n )}\n </AriaSwitch>\n );\n }\n));\n\nSwitch.displayName = \"Switch\";\n\nexport { Switch, switchOuterVariants, switchTrackVariants, switchThumbVariants };\n","import { z } from 'zod';\n\n/**\n * Base props schema for all Themis components\n * Ensures consistent accessibility and styling APIs across the library\n *\n * @see spec.md FR-009 to FR-014 (Accessibility Requirements)\n * @see constitution.md Principle IV (Accessibility First - WCAG 2.2 AA minimum)\n */\nexport const BaseComponentPropsSchema = z.object({\n // Styling\n className: z.string().optional(),\n\n // React\n children: z.any().optional(), // ReactNode not directly supported by Zod\n id: z.string().optional(),\n\n // Accessibility (WCAG 2.2 AA requirements)\n 'aria-label': z.string().optional(),\n 'aria-labelledby': z.string().optional(),\n 'aria-describedby': z.string().optional(),\n 'aria-live': z.enum(['off', 'polite', 'assertive']).optional(),\n 'aria-hidden': z.boolean().optional(),\n\n // Testing & Development\n 'data-testid': z.string().optional(),\n});\n\nexport type BaseComponentProps = z.infer<typeof BaseComponentPropsSchema>;\n","import { z } from 'zod';\nimport { BaseComponentPropsSchema } from '../../schemas/BaseComponentProps';\nimport type { SwitchProps as AriaSwitchProps } from 'react-aria-components';\n\n/**\n * Switch props schema extending BaseComponentProps\n *\n * @see React Aria Switch: https://react-spectrum.adobe.com/react-aria/Switch.html\n * @see ShadCN Switch: https://ui.shadcn.com/docs/components/switch\n * @see spec.md (WCAG 2.2 AAA - 7:1 contrast, 44x44px touch targets)\n * @see constitution.md Principle IV (Accessibility First)\n */\nexport const SwitchPropsSchema = BaseComponentPropsSchema.extend({\n // State management (controlled/uncontrolled)\n isSelected: z.boolean().optional(),\n defaultSelected: z.boolean().optional().default(false),\n onChange: z.function().optional(),\n\n // Variants (matching Button pattern)\n variant: z\n .enum(['default', 'destructive'])\n .optional()\n .default('default'),\n\n // Sizes (3 sizes for consistency)\n size: z.enum(['sm', 'default', 'lg']).optional().default('default'),\n\n // States\n isDisabled: z.boolean().optional().default(false),\n isReadOnly: z.boolean().optional().default(false),\n\n // Labels (optional built-in labeling)\n label: z.string().optional(),\n description: z.string().optional(),\n\n // React Aria SwitchProps integration\n onFocus: z.function().optional(),\n onBlur: z.function().optional(),\n onFocusChange: z.function().optional(),\n autoFocus: z.boolean().optional(),\n\n // Animation (ADR 020 - Micro-Interaction Animation System)\n animated: z.boolean().optional().default(true),\n springConfig: z\n .object({\n stiffness: z.number(),\n damping: z.number(),\n })\n .optional(),\n});\n\nexport interface SwitchPropsOwn {\n className?: string;\n children?: unknown;\n id?: string;\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n 'aria-describedby'?: string;\n 'aria-hidden'?: boolean;\n 'data-testid'?: string;\n isSelected?: boolean;\n defaultSelected?: boolean;\n onChange?: (...args: unknown[]) => unknown;\n variant?: 'default' | 'destructive';\n size?: 'sm' | 'default' | 'lg';\n isDisabled?: boolean;\n isReadOnly?: boolean;\n label?: string;\n description?: string;\n onFocus?: (...args: unknown[]) => unknown;\n onBlur?: (...args: unknown[]) => unknown;\n onFocusChange?: (...args: unknown[]) => unknown;\n autoFocus?: boolean;\n animated?: boolean;\n springConfig?: { stiffness: number; damping: number };\n}\n\nexport type SwitchProps = SwitchPropsOwn &\n Omit<AriaSwitchProps, keyof SwitchPropsOwn>;\n\nexport type SwitchVariant = SwitchPropsOwn['variant'];\nexport type SwitchSize = SwitchPropsOwn['size'];\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/cn.ts","../../../src/utils/shouldAnimate.ts","../../../src/hooks/useReducedMotion.ts","../../../src/styles/interaction-states.ts","../../../src/elements/Switch/Switch.tsx","../../../src/schemas/BaseComponentProps.ts","../../../src/elements/Switch/Switch.types.ts"],"names":["cn","inputs","twMerge","clsx","shouldAnimate","animated","prefersReducedMotion","QUERY","getInitialState","useReducedMotion","setPrefersReducedMotion","useState","useEffect","mql","handler","event","FOCUS_STYLES","PRESSED_STYLES","HIGH_CONTRAST_FOCUS","HIGH_CONTRAST_HOVER","HIGH_CONTRAST_PRESSED","DEFAULT_INTERACTIONS","cachedAnimate","loadMotionAnimate","m","DEFAULT_SPRING","switchOuterVariants","cva","switchTrackVariants","switchThumbVariants","Switch","memo","forwardRef","className","variant","size","label","description","isDisabled","isReadOnly","springConfig","onChangeProp","props","ref","doAnimate","thumbRef","useRef","motionReady","animateRef","activeAnimation","fn","isCurrentlySelected","handleChange","useCallback","isSelected","useMotionThumb","jsx","AriaSwitch","_classNameProps","renderProps","jsxs","Fragment","BaseComponentPropsSchema","z","SwitchPropsSchema"],"mappings":"mSAcO,SAASA,CAAAA,CAAAA,GAAMC,CAAAA,CAA8B,CAClD,OAAOC,OAAAA,CAAQC,KAAKF,CAAM,CAAC,CAC7B,CCNO,SAASG,EACdC,CAAAA,CACAC,CAAAA,CACS,CAET,OADI,EAAAD,IAAa,KAAA,EACbC,CAAAA,CAEN,CCbA,IAAMC,CAAAA,CAAQ,mCAEd,SAASC,CAAAA,EAA2B,CAClC,OAAI,OAAO,OAAW,GAAA,CAAoB,KAAA,CACnC,OAAO,UAAA,CAAWD,CAAK,EAAE,OAClC,CASO,SAASE,CAAAA,EAA4B,CAC1C,GAAM,CAACH,CAAAA,CAAsBI,CAAuB,CAAA,CAAIC,QAAAA,CAASH,CAAe,CAAA,CAEhF,OAAAI,UA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D,WAAYC,CAAAA,CAAE,OAAA,GAAU,QAAA,EAAS,CACjC,gBAAiBA,CAAAA,CAAE,OAAA,GAAU,QAAA,EAAS,CAAE,QAAQ,KAAK,CAAA,CACrD,SAAUA,CAAAA,CAAE,QAAA,GAAW,QAAA,EAAS,CAGhC,QAASA,CAAAA,CACN,IAAA,CAAK,CAAC,SAAA,CAAW,aAAa,CAAC,CAAA,CAC/B,QAAA,GACA,OAAA,CAAQ,SAAS,EAGpB,IAAA,CAAMA,CAAAA,CAAE,KAAK,CAAC,IAAA,CAAM,UAAW,IAAI,CAAC,EAAE,QAAA,EAAS,CAAE,QAAQ,SAAS,CAAA,CAGlE,WAAYA,CAAAA,CAAE,OAAA,GAAU,QAAA,EAAS,CAAE,QAAQ,KAAK,CAAA,CAChD,WAAYA,CAAAA,CAAE,OAAA,GAAU,QAAA,EAAS,CAAE,QAAQ,KAAK,CAAA,CAGhD,MAAOA,CAAAA,CAAE,MAAA,GAAS,QAAA,EAAS,CAC3B,YAAaA,CAAAA,CAAE,MAAA,GAAS,QAAA,EAAS,CAGjC,QAASA,CAAAA,CAAE,QAAA,GAAW,QAAA,EAAS,CAC/B,OAAQA,CAAAA,CAAE,QAAA,GAAW,QAAA,EAAS,CAC9B,cAAeA,CAAAA,CAAE,QAAA,GAAW,QAAA,EAAS,CACrC,UAAWA,CAAAA,CAAE,OAAA,GAAU,QAAA,EAAS,CAGhC,SAAUA,CAAAA,CAAE,OAAA,GAAU,QAAA,EAAS,CAAE,QAAQ,IAAI,CAAA,CAC7C,aAAcA,CAAAA,CACX,MAAA,CAAO,CACN,SAAA,CAAWA,CAAAA,CAAE,QAAO,CACpB,OAAA,CAASA,EAAE,MAAA,EACb,CAAC,CAAA,CACA,QAAA,EACL,CAAC","file":"index.mjs","sourcesContent":["/**\n * Class Name Utility\n * Merges Tailwind CSS classes with conflict resolution\n *\n * Combines clsx for conditional classes and tailwind-merge for deduplication\n *\n * @example\n * cn('px-2 py-1', 'px-4') // => 'py-1 px-4' (px-4 overrides px-2)\n * cn('text-red-500', condition && 'text-blue-500') // => conditional application\n */\n\nimport { clsx, type ClassValue } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\nexport function cn(...inputs: ClassValue[]): string {\n return twMerge(clsx(inputs));\n}\n","/**\n * Determines whether a component should animate.\n *\n * Returns `false` if:\n * - The `animated` prop is explicitly `false`\n * - The user prefers reduced motion\n *\n * @param animated - The component's `animated` prop value (default: `true`)\n * @param prefersReducedMotion - Whether the user prefers reduced motion\n */\nexport function shouldAnimate(\n animated: boolean | undefined,\n prefersReducedMotion: boolean,\n): boolean {\n if (animated === false) return false;\n if (prefersReducedMotion) return false;\n return true;\n}\n","'use client';\n\nimport { useState, useEffect } from 'react';\n\nconst QUERY = '(prefers-reduced-motion: reduce)';\n\nfunction getInitialState(): boolean {\n if (typeof window === 'undefined') return false;\n return window.matchMedia(QUERY).matches;\n}\n\n/**\n * Detects whether the user prefers reduced motion.\n *\n * - SSR-safe (returns `false` on the server)\n * - Reacts to changes in the OS preference\n * - Cleans up the listener on unmount\n */\nexport function useReducedMotion(): boolean {\n const [prefersReducedMotion, setPrefersReducedMotion] = useState(getInitialState);\n\n useEffect(() => {\n const mql = window.matchMedia(QUERY);\n setPrefersReducedMotion(mql.matches);\n\n const handler = (event: MediaQueryListEvent): void => {\n setPrefersReducedMotion(event.matches);\n };\n\n mql.addEventListener('change', handler);\n return () => mql.removeEventListener('change', handler);\n }, []);\n\n return prefersReducedMotion;\n}\n","/**\n * Global Interaction State Styles\n *\n * Consistent interaction patterns across all Themis components.\n * These styles ensure WCAG 2.2 AAA compliance and predictable UX.\n *\n * @see spec.md FR-010 (Visible focus ring for keyboard navigation)\n * @see spec.md FR-031 (Pressed state feedback)\n * @see spec.md FR-012 (High contrast mode support)\n * @see constitution.md Principle IV (Accessibility First)\n */\n\n/**\n * Focus state styles (FR-010)\n * Visible focus ring for keyboard navigation - WCAG 2.2 Level AAA\n *\n * Components can override by extending these styles:\n * @example\n * cn(FOCUS_STYLES, \"ring-4\") // Increases ring width to 4px\n */\nexport const FOCUS_STYLES = \"data-[focus-visible]:ring-2 data-[focus-visible]:ring-[var(--themis-ring)] data-[focus-visible]:ring-offset-2\";\n\n/**\n * Pressed/Active state styles (FR-031)\n * Visual feedback for press interactions\n *\n * Components can override the scale amount:\n * @example\n * cn(PRESSED_STYLES_BASE, \"data-[pressed]:scale-[0.95]\") // More pronounced scale\n */\nexport const PRESSED_STYLES = \"data-[pressed]:scale-[0.97]\";\n\n/**\n * Base pressed styles without scale (for components that need different feedback)\n */\nexport const PRESSED_STYLES_BASE = \"data-[pressed]:transition-transform data-[pressed]:duration-100\";\n\n/**\n * Hover state styles\n * Elevation change on hover for better affordance\n *\n * Components can override shadow depth:\n * @example\n * cn(HOVER_STYLES_BASE, \"data-[hovered]:shadow-lg\") // Larger shadow\n */\nexport const HOVER_STYLES = \"\";\n\n/**\n * Base hover styles without shadow (for components that use different hover effects)\n */\nexport const HOVER_STYLES_BASE = \"data-[hovered]:transition-shadow data-[hovered]:duration-200\";\n\n/**\n * High contrast mode focus (FR-012)\n * Enhanced outlines for users requiring high contrast\n *\n * Uses 'hc:' prefix for prefers-contrast: more media query\n */\nexport const HIGH_CONTRAST_FOCUS = \"hc:data-[focus-visible]:outline hc:data-[focus-visible]:outline-4 hc:data-[focus-visible]:outline-offset-2 hc:data-[focus-visible]:outline-foreground\";\n\n/**\n * High contrast mode hover (FR-012)\n * Enhanced outlines for hover in high contrast mode\n */\nexport const HIGH_CONTRAST_HOVER = \"hc:data-[hovered]:outline hc:data-[hovered]:outline-2 hc:data-[hovered]:outline-foreground\";\n\n/**\n * High contrast mode pressed state\n * Enhanced outlines for pressed state in high contrast mode\n */\nexport const HIGH_CONTRAST_PRESSED = \"hc:data-[pressed]:outline hc:data-[pressed]:outline-2 hc:data-[pressed]:outline-offset-1 hc:data-[pressed]:outline-foreground\";\n\n/**\n * Combined high contrast styles\n * Use this for components that need all high contrast interaction states\n */\nexport const HIGH_CONTRAST_INTERACTIONS = `${HIGH_CONTRAST_FOCUS} ${HIGH_CONTRAST_HOVER} ${HIGH_CONTRAST_PRESSED}`;\n\n/**\n * Disabled state styles\n * Consistent disabled appearance across all components\n */\nexport const DISABLED_STYLES = \"disabled:pointer-events-none disabled:opacity-50\";\n\n/**\n * Default interaction bundle\n * Most common combination for interactive components\n *\n * Includes: focus ring, pressed scale, hover shadow, high contrast enhancements\n *\n * @example\n * <button className={cn(DEFAULT_INTERACTIONS, \"bg-primary\")}>Click</button>\n */\nexport const DEFAULT_INTERACTIONS = `${FOCUS_STYLES} ${PRESSED_STYLES} ${HOVER_STYLES} ${HIGH_CONTRAST_FOCUS} ${HIGH_CONTRAST_HOVER} ${HIGH_CONTRAST_PRESSED}`;\n\n/**\n * Subtle interaction bundle\n * For components that need less pronounced feedback\n *\n * Includes: focus ring and high contrast, but no hover shadow or pressed scale\n */\nexport const SUBTLE_INTERACTIONS = `${FOCUS_STYLES} ${HIGH_CONTRAST_FOCUS}`;\n\n/**\n * Non-interactive element styles\n * For elements that should indicate they are not interactive\n */\nexport const NON_INTERACTIVE = \"cursor-default select-none\";\n","\"use client\";\n\n/**\n * Switch Component\n * Accessible toggle switch with React Aria primitives and CVA styling.\n * Supports optional spring animation via motion.dev.\n *\n * @see React Aria Switch: https://react-spectrum.adobe.com/react-aria/Switch.html\n * @see ShadCN Switch: https://ui.shadcn.com/docs/components/switch\n * @see spec.md (WCAG 2.2 AAA - 7:1 contrast ratio, 44x44px touch targets)\n * @see constitution.md Principle IV (Accessibility First)\n */\n\nimport { forwardRef, memo, useRef, useEffect, useCallback } from 'react';\nimport {\n Switch as AriaSwitch,\n type SwitchProps as AriaSwitchProps,\n} from 'react-aria-components';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { cn } from '../../utils/cn';\nimport { shouldAnimate } from '../../utils/shouldAnimate';\nimport { useReducedMotion } from '../../hooks/useReducedMotion';\nimport { DEFAULT_INTERACTIONS } from '../../styles/interaction-states';\nimport type { AnimatedProps, SpringConfig } from '../../types/animation';\n\n// ---------------------------------------------------------------------------\n// Motion lazy-loader — avoids hard dep on optional peer\n// ---------------------------------------------------------------------------\n\ntype AnimateFn = (\n element: Element,\n keyframes: Record<string, string | number>,\n options?: Record<string, unknown>,\n) => { stop: () => void };\n\nlet cachedAnimate: AnimateFn | null | undefined; // undefined = pending, null = unavailable\n\nfunction loadMotionAnimate(): Promise<AnimateFn | null> {\n if (cachedAnimate !== undefined) return Promise.resolve(cachedAnimate);\n\n return import('motion')\n .then((m) => {\n cachedAnimate = m.animate as unknown as AnimateFn;\n return cachedAnimate;\n })\n .catch(() => {\n cachedAnimate = null;\n return null;\n });\n}\n\n// ---------------------------------------------------------------------------\n// Default spring configuration\n// ---------------------------------------------------------------------------\n\nconst DEFAULT_SPRING: SpringConfig = { stiffness: 500, damping: 30 };\n\n// ---------------------------------------------------------------------------\n// CVA Variants\n// ---------------------------------------------------------------------------\n\n/**\n * Layer 1: Transparent outer touch target (44x44px minimum)\n * This layer handles the WCAG 2.2 AAA touch target requirement\n * Always invisible, centers the visual switch inside\n */\nconst switchOuterVariants = cva(\n // Base styles - WCAG 2.2 AAA: 44x44px minimum touch target\n \"inline-flex shrink-0 cursor-pointer items-center justify-center min-h-[44px] min-w-[44px] disabled:cursor-not-allowed disabled:opacity-50 data-[readonly]:cursor-default\",\n {\n variants: {},\n defaultVariants: {},\n }\n);\n\n/**\n * Layer 2: Visual switch track/background (adjustable size)\n * This layer provides the visual appearance and size flexibility\n * Background color changes based on variant and selection state\n */\nconst switchTrackVariants = cva(\n // Base styles - visual track with transitions and focus states\n \"relative inline-flex shrink-0 items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)] focus-visible:ring-offset-2 focus-visible:ring-offset-background\",\n {\n variants: {\n variant: {\n // Default variant: Uses primary color when selected\n default:\n \"bg-[var(--border)] data-[selected]:bg-[var(--primary)]\",\n // Destructive variant: Uses destructive/error color when selected\n destructive:\n \"bg-[var(--border)] data-[selected]:bg-[var(--destructive-background)]\",\n },\n size: {\n // Small: h-6 w-10 (visual track size)\n sm: \"h-6 w-10\",\n // Default: h-7 w-12\n default: \"h-7 w-12\",\n // Large: h-8 w-14\n lg: \"h-8 w-14\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n },\n }\n);\n\n/**\n * Layer 3: Switch thumb (sliding circle)\n * Inner visual element that slides horizontally when switch is selected.\n * When spring animation is active, CSS transition is removed and\n * motion.dev controls the translateX via inline transform.\n */\nconst switchThumbVariants = cva(\n // Base styles: rounded circle with shadow\n \"pointer-events-none absolute left-0.5 rounded-full bg-[var(--content-background)] ring-0\",\n {\n variants: {\n size: {\n // Thumb is slightly smaller than track height for proper padding\n sm: \"h-4 w-4\",\n default: \"h-5 w-5\",\n lg: \"h-6 w-6\",\n },\n animated: {\n // When CSS handles the animation (motion.dev unavailable or disabled)\n false: \"transition-transform data-[selected]:translate-x-full\",\n // When motion.dev handles the animation — no CSS transition\n true: \"\",\n },\n },\n defaultVariants: {\n size: \"default\",\n animated: false,\n },\n }\n);\n\n// ---------------------------------------------------------------------------\n// Component\n// ---------------------------------------------------------------------------\n\nexport interface SwitchProps\n extends Omit<AriaSwitchProps, 'className' | 'children'>,\n VariantProps<typeof switchTrackVariants>,\n AnimatedProps {\n variant?: 'default' | 'destructive';\n size?: 'sm' | 'default' | 'lg';\n label?: string;\n description?: string;\n className?: string;\n /** Spring physics configuration. Default: { stiffness: 500, damping: 30 } */\n springConfig?: SpringConfig;\n}\n\n/**\n * Switch Component\n * Fully accessible toggle switch with React Aria and themed styling.\n * When `animated` is true (default) and motion.dev is installed,\n * the thumb uses spring physics for a natural bounce effect.\n */\nconst Switch = memo(forwardRef<HTMLLabelElement, SwitchProps>(\n (\n {\n className,\n variant,\n size,\n label,\n description,\n isDisabled,\n isReadOnly,\n animated,\n springConfig = DEFAULT_SPRING,\n onChange: onChangeProp,\n ...props\n },\n ref\n ) => {\n const prefersReducedMotion = useReducedMotion();\n const doAnimate = shouldAnimate(animated, prefersReducedMotion);\n\n const thumbRef = useRef<HTMLDivElement>(null);\n const motionReady = useRef(false);\n const animateRef = useRef<AnimateFn | null>(null);\n const activeAnimation = useRef<{ stop: () => void } | null>(null);\n\n // Preload motion.dev when animation is desired\n useEffect(() => {\n if (!doAnimate) return;\n\n loadMotionAnimate().then((fn) => {\n if (fn) {\n animateRef.current = fn;\n motionReady.current = true;\n\n // Set initial thumb position if already selected (no animation)\n if (thumbRef.current) {\n const isCurrentlySelected = thumbRef.current.hasAttribute('data-selected');\n thumbRef.current.style.transform = isCurrentlySelected\n ? 'translateX(100%)'\n : 'translateX(0)';\n }\n }\n });\n }, [doAnimate]);\n\n const handleChange = useCallback(\n (isSelected: boolean) => {\n // Forward to consumer's onChange\n onChangeProp?.(isSelected);\n\n // Trigger spring animation if motion is ready\n if (doAnimate && motionReady.current && animateRef.current && thumbRef.current) {\n // Stop any in-progress animation\n activeAnimation.current?.stop();\n\n activeAnimation.current = animateRef.current(\n thumbRef.current,\n { x: isSelected ? '100%' : '0%' },\n {\n type: 'spring',\n stiffness: springConfig.stiffness,\n damping: springConfig.damping,\n },\n );\n }\n },\n [doAnimate, springConfig.stiffness, springConfig.damping, onChangeProp],\n );\n\n // Use motion for thumb position when motion.dev is handling it\n const useMotionThumb = doAnimate;\n\n return (\n <AriaSwitch\n ref={ref}\n isDisabled={isDisabled}\n isReadOnly={isReadOnly}\n onChange={handleChange}\n className={(_classNameProps) =>\n cn(\n \"group inline-flex items-center gap-2\",\n isDisabled && \"cursor-not-allowed opacity-50\",\n className\n )\n }\n {...props}\n >\n {(renderProps) => (\n <>\n {/* Layer 1: Transparent outer touch target (44x44px WCAG compliant) */}\n <div\n className={cn(switchOuterVariants())}\n data-selected={renderProps.isSelected || undefined}\n data-readonly={isReadOnly || undefined}\n >\n {/* Layer 2: Visual switch track (adjustable size with variants) */}\n <div\n className={cn(\n switchTrackVariants({ variant, size }),\n DEFAULT_INTERACTIONS\n )}\n data-selected={renderProps.isSelected || undefined}\n >\n {/* Layer 3: Thumb (sliding circle, absolutely positioned) */}\n <div\n ref={thumbRef}\n className={cn(switchThumbVariants({\n size,\n animated: useMotionThumb,\n }))}\n data-selected={renderProps.isSelected || undefined}\n />\n </div>\n </div>\n\n {/* Optional label and description */}\n {(label || description) && (\n <div className=\"flex flex-col\">\n {label && (\n <span className=\"text-sm font-medium text-[var(--content-foreground)]\">\n {label}\n </span>\n )}\n {description && (\n <span className=\"text-xs text-[var(--menu-muted)]\">\n {description}\n </span>\n )}\n </div>\n )}\n </>\n )}\n </AriaSwitch>\n );\n }\n));\n\nSwitch.displayName = \"Switch\";\n\nexport { Switch, switchOuterVariants, switchTrackVariants, switchThumbVariants };\n","import { z } from 'zod';\n\n/**\n * Base props schema for all Themis components\n * Ensures consistent accessibility and styling APIs across the library\n *\n * @see spec.md FR-009 to FR-014 (Accessibility Requirements)\n * @see constitution.md Principle IV (Accessibility First - WCAG 2.2 AA minimum)\n */\nexport const BaseComponentPropsSchema = z.object({\n // Styling\n className: z.string().optional(),\n\n // React\n children: z.any().optional(), // ReactNode not directly supported by Zod\n id: z.string().optional(),\n\n // Accessibility (WCAG 2.2 AA requirements)\n 'aria-label': z.string().optional(),\n 'aria-labelledby': z.string().optional(),\n 'aria-describedby': z.string().optional(),\n 'aria-live': z.enum(['off', 'polite', 'assertive']).optional(),\n 'aria-hidden': z.boolean().optional(),\n\n // Testing & Development\n 'data-testid': z.string().optional(),\n});\n\nexport type BaseComponentProps = z.infer<typeof BaseComponentPropsSchema>;\n","import { z } from 'zod';\nimport { BaseComponentPropsSchema } from '../../schemas/BaseComponentProps';\nimport type { SwitchProps as AriaSwitchProps } from 'react-aria-components';\n\n/**\n * Switch props schema extending BaseComponentProps\n *\n * @see React Aria Switch: https://react-spectrum.adobe.com/react-aria/Switch.html\n * @see ShadCN Switch: https://ui.shadcn.com/docs/components/switch\n * @see spec.md (WCAG 2.2 AAA - 7:1 contrast, 44x44px touch targets)\n * @see constitution.md Principle IV (Accessibility First)\n */\nexport const SwitchPropsSchema = BaseComponentPropsSchema.extend({\n // State management (controlled/uncontrolled)\n isSelected: z.boolean().optional(),\n defaultSelected: z.boolean().optional().default(false),\n onChange: z.function().optional(),\n\n // Variants (matching Button pattern)\n variant: z\n .enum(['default', 'destructive'])\n .optional()\n .default('default'),\n\n // Sizes (3 sizes for consistency)\n size: z.enum(['sm', 'default', 'lg']).optional().default('default'),\n\n // States\n isDisabled: z.boolean().optional().default(false),\n isReadOnly: z.boolean().optional().default(false),\n\n // Labels (optional built-in labeling)\n label: z.string().optional(),\n description: z.string().optional(),\n\n // React Aria SwitchProps integration\n onFocus: z.function().optional(),\n onBlur: z.function().optional(),\n onFocusChange: z.function().optional(),\n autoFocus: z.boolean().optional(),\n\n // Animation (ADR 020 - Micro-Interaction Animation System)\n animated: z.boolean().optional().default(true),\n springConfig: z\n .object({\n stiffness: z.number(),\n damping: z.number(),\n })\n .optional(),\n});\n\nexport interface SwitchPropsOwn {\n className?: string;\n children?: unknown;\n id?: string;\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n 'aria-describedby'?: string;\n 'aria-hidden'?: boolean;\n 'data-testid'?: string;\n isSelected?: boolean;\n defaultSelected?: boolean;\n onChange?: (...args: unknown[]) => unknown;\n variant?: 'default' | 'destructive';\n size?: 'sm' | 'default' | 'lg';\n isDisabled?: boolean;\n isReadOnly?: boolean;\n label?: string;\n description?: string;\n onFocus?: (...args: unknown[]) => unknown;\n onBlur?: (...args: unknown[]) => unknown;\n onFocusChange?: (...args: unknown[]) => unknown;\n autoFocus?: boolean;\n animated?: boolean;\n springConfig?: { stiffness: number; damping: number };\n}\n\nexport type SwitchProps = SwitchPropsOwn &\n Omit<AriaSwitchProps, keyof SwitchPropsOwn>;\n\nexport type SwitchVariant = SwitchPropsOwn['variant'];\nexport type SwitchSize = SwitchPropsOwn['size'];\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { BulkActionBarProps } from './BulkActionBar.types';
|
|
2
|
+
declare const BulkActionBar: import("react").ForwardRefExoticComponent<BulkActionBarProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
3
|
+
export { BulkActionBar };
|
|
4
|
+
export { bulkActionBarVariants, bulkActionToolbarVariants, bulkActionHintVariants, } from './BulkActionBar.styles';
|
|
5
|
+
//# sourceMappingURL=BulkActionBar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BulkActionBar.d.ts","sourceRoot":"","sources":["../../../src/elements/Table/BulkActionBar.tsx"],"names":[],"mappings":"AAiCA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAOhE,QAAA,MAAM,aAAa,+GAkKlB,CAAC;AAIF,OAAO,EAAE,aAAa,EAAE,CAAC;AACzB,OAAO,EACL,qBAAqB,EACrB,yBAAyB,EACzB,sBAAsB,GACvB,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BulkActionBar wrapper. Appears above the table when rows are selected.
|
|
3
|
+
* Sticky by default so it stays reachable while the user scrolls + selects.
|
|
4
|
+
*/
|
|
5
|
+
export declare const bulkActionBarVariants: (props?: ({
|
|
6
|
+
sticky?: boolean | null | undefined;
|
|
7
|
+
framed?: boolean | null | undefined;
|
|
8
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
9
|
+
/** The roving toolbar region inside the bar. */
|
|
10
|
+
export declare const bulkActionToolbarVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
11
|
+
/** The visible (decorative) jump-shortcut hint. */
|
|
12
|
+
export declare const bulkActionHintVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
13
|
+
/** The kbd key inside the jump-shortcut hint. */
|
|
14
|
+
export declare const bulkActionKbdVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
15
|
+
/** A bulk action button — outline on the lilac band, brand-coloured text + icon. */
|
|
16
|
+
export declare const bulkActionButtonVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
17
|
+
//# sourceMappingURL=BulkActionBar.styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BulkActionBar.styles.d.ts","sourceRoot":"","sources":["../../../src/elements/Table/BulkActionBar.styles.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,eAAO,MAAM,qBAAqB;;;8EA4BjC,CAAC;AAEF,gDAAgD;AAChD,eAAO,MAAM,yBAAyB,oFAEpC,CAAC;AAEH,mDAAmD;AACnD,eAAO,MAAM,sBAAsB,oFAEjC,CAAC;AAEH,iDAAiD;AACjD,eAAO,MAAM,qBAAqB,oFAKhC,CAAC;AAEH,oFAAoF;AACpF,eAAO,MAAM,wBAAwB,oFAGnC,CAAC"}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* A single action shown in the {@link BulkActionBar} toolbar.
|
|
5
|
+
* The bar is domain-free: the consumer supplies translated labels + icons.
|
|
6
|
+
*/
|
|
7
|
+
export interface BulkAction {
|
|
8
|
+
/** Stable identifier; passed back to `onAction`. */
|
|
9
|
+
id: string;
|
|
10
|
+
/** Visible label (consumer-translated). */
|
|
11
|
+
label: string;
|
|
12
|
+
/** Optional leading icon (decorative — the bar applies `aria-hidden`). */
|
|
13
|
+
icon?: ReactNode;
|
|
14
|
+
/** Visual emphasis. `'danger'` renders the destructive treatment. */
|
|
15
|
+
tone?: 'default' | 'danger';
|
|
16
|
+
/** Per-action disable (e.g. an action invalid for the current selection). */
|
|
17
|
+
isDisabled?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export declare const BulkActionSchema: z.ZodObject<{
|
|
20
|
+
id: z.ZodString;
|
|
21
|
+
label: z.ZodString;
|
|
22
|
+
icon: z.ZodOptional<z.ZodCustom<ReactNode, ReactNode>>;
|
|
23
|
+
tone: z.ZodOptional<z.ZodEnum<{
|
|
24
|
+
default: "default";
|
|
25
|
+
danger: "danger";
|
|
26
|
+
}>>;
|
|
27
|
+
isDisabled: z.ZodOptional<z.ZodBoolean>;
|
|
28
|
+
}, z.core.$strip>;
|
|
29
|
+
/**
|
|
30
|
+
* i18n strings the (domain-free) bar needs. The bar never calls
|
|
31
|
+
* `useTranslations` — the consumer owns all copy.
|
|
32
|
+
*/
|
|
33
|
+
export interface BulkActionBarLabels {
|
|
34
|
+
/** e.g. `(n) => "{n} selected"` — drives the visible count + the live announcement. */
|
|
35
|
+
selectedCount: (count: number) => string;
|
|
36
|
+
/** Label for the leading "Clear" control. */
|
|
37
|
+
clear: string;
|
|
38
|
+
/** Toolbar `aria-label`, e.g. `(n) => "Bulk actions for {n} selected"`. */
|
|
39
|
+
toolbarLabel: (count: number) => string;
|
|
40
|
+
/**
|
|
41
|
+
* Optional screen-reader clause stating how many actions are available, e.g.
|
|
42
|
+
* `(n) => "{n} actions available"`. Folded into the live announcement (derived
|
|
43
|
+
* from `actions.length`) so SR users know the toolbar holds more than one control.
|
|
44
|
+
*/
|
|
45
|
+
actionsAvailable?: (count: number) => string;
|
|
46
|
+
/**
|
|
47
|
+
* Visible jump-shortcut hint. Receives the styled `<kbd>` key node so the
|
|
48
|
+
* consumer can place it within translated text, e.g. `(key) => <>Press {key} to jump here</>`.
|
|
49
|
+
*/
|
|
50
|
+
jumpHint?: (key: ReactNode) => ReactNode;
|
|
51
|
+
/** Screen-reader announcement of the shortcut (plain text), e.g. "Press A to jump to bulk actions". */
|
|
52
|
+
jumpAnnouncement?: string;
|
|
53
|
+
}
|
|
54
|
+
export declare const BulkActionBarLabelsSchema: z.ZodObject<{
|
|
55
|
+
selectedCount: z.ZodCustom<(count: number) => string, (count: number) => string>;
|
|
56
|
+
clear: z.ZodString;
|
|
57
|
+
toolbarLabel: z.ZodCustom<(count: number) => string, (count: number) => string>;
|
|
58
|
+
actionsAvailable: z.ZodOptional<z.ZodCustom<(count: number) => string, (count: number) => string>>;
|
|
59
|
+
jumpHint: z.ZodOptional<z.ZodCustom<(key: ReactNode) => ReactNode, (key: ReactNode) => ReactNode>>;
|
|
60
|
+
jumpAnnouncement: z.ZodOptional<z.ZodString>;
|
|
61
|
+
}, z.core.$strip>;
|
|
62
|
+
export declare const BulkActionBarPropsSchema: z.ZodObject<{
|
|
63
|
+
className: z.ZodOptional<z.ZodString>;
|
|
64
|
+
children: z.ZodOptional<z.ZodAny>;
|
|
65
|
+
id: z.ZodOptional<z.ZodString>;
|
|
66
|
+
'aria-label': z.ZodOptional<z.ZodString>;
|
|
67
|
+
'aria-labelledby': z.ZodOptional<z.ZodString>;
|
|
68
|
+
'aria-describedby': z.ZodOptional<z.ZodString>;
|
|
69
|
+
'aria-live': z.ZodOptional<z.ZodEnum<{
|
|
70
|
+
off: "off";
|
|
71
|
+
polite: "polite";
|
|
72
|
+
assertive: "assertive";
|
|
73
|
+
}>>;
|
|
74
|
+
'aria-hidden': z.ZodOptional<z.ZodBoolean>;
|
|
75
|
+
'data-testid': z.ZodOptional<z.ZodString>;
|
|
76
|
+
selectedCount: z.ZodNumber;
|
|
77
|
+
actions: z.ZodArray<z.ZodObject<{
|
|
78
|
+
id: z.ZodString;
|
|
79
|
+
label: z.ZodString;
|
|
80
|
+
icon: z.ZodOptional<z.ZodCustom<ReactNode, ReactNode>>;
|
|
81
|
+
tone: z.ZodOptional<z.ZodEnum<{
|
|
82
|
+
default: "default";
|
|
83
|
+
danger: "danger";
|
|
84
|
+
}>>;
|
|
85
|
+
isDisabled: z.ZodOptional<z.ZodBoolean>;
|
|
86
|
+
}, z.core.$strip>>;
|
|
87
|
+
onAction: z.ZodCustom<(id: string) => void, (id: string) => void>;
|
|
88
|
+
onClearSelection: z.ZodCustom<() => void, () => void>;
|
|
89
|
+
sticky: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
90
|
+
framed: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
91
|
+
showJumpHint: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
92
|
+
shortcutKey: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
93
|
+
labels: z.ZodObject<{
|
|
94
|
+
selectedCount: z.ZodCustom<(count: number) => string, (count: number) => string>;
|
|
95
|
+
clear: z.ZodString;
|
|
96
|
+
toolbarLabel: z.ZodCustom<(count: number) => string, (count: number) => string>;
|
|
97
|
+
actionsAvailable: z.ZodOptional<z.ZodCustom<(count: number) => string, (count: number) => string>>;
|
|
98
|
+
jumpHint: z.ZodOptional<z.ZodCustom<(key: ReactNode) => ReactNode, (key: ReactNode) => ReactNode>>;
|
|
99
|
+
jumpAnnouncement: z.ZodOptional<z.ZodString>;
|
|
100
|
+
}, z.core.$strip>;
|
|
101
|
+
}, z.core.$strip>;
|
|
102
|
+
export interface BulkActionBarProps {
|
|
103
|
+
/**
|
|
104
|
+
* Number of selected rows. Drives the visible count, the `aria-live`
|
|
105
|
+
* announcement, and whether the toolbar renders. Compute it from your
|
|
106
|
+
* React-Aria `Selection` with {@link resolveSelectedCount} so the `'all'`
|
|
107
|
+
* sentinel is handled correctly.
|
|
108
|
+
*/
|
|
109
|
+
selectedCount: number;
|
|
110
|
+
/** Actions, in toolbar order. Rendered after the "Clear" control. */
|
|
111
|
+
actions: BulkAction[];
|
|
112
|
+
/** Invoked with the action id when an action is activated. */
|
|
113
|
+
onAction: (id: string) => void;
|
|
114
|
+
/** Clears the consumer's selection. Renders the leading "Clear" control. */
|
|
115
|
+
onClearSelection: () => void;
|
|
116
|
+
/** Stick to the top of the scroll container. Default `true`. */
|
|
117
|
+
sticky?: boolean;
|
|
118
|
+
/**
|
|
119
|
+
* Render as a self-contained Card (border + rounded corners) for standalone use
|
|
120
|
+
* outside the Table's `toolbar` slot. Default `false` (bottom rule only — the
|
|
121
|
+
* Table card frame supplies the border).
|
|
122
|
+
*/
|
|
123
|
+
framed?: boolean;
|
|
124
|
+
/**
|
|
125
|
+
* Show the jump-shortcut hint (visible + announced). Set `true` ONLY when the
|
|
126
|
+
* consumer has wired {@link useBulkActionShortcut}. Default `false`.
|
|
127
|
+
*/
|
|
128
|
+
showJumpHint?: boolean;
|
|
129
|
+
/** The key letter shown in the jump-shortcut `<kbd>`. Default `'A'`. */
|
|
130
|
+
shortcutKey?: string;
|
|
131
|
+
/** i18n strings — the bar is domain-free and must not call `useTranslations`. */
|
|
132
|
+
labels: BulkActionBarLabels;
|
|
133
|
+
className?: string;
|
|
134
|
+
'data-testid'?: string;
|
|
135
|
+
}
|
|
136
|
+
//# sourceMappingURL=BulkActionBar.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BulkActionBar.types.d.ts","sourceRoot":"","sources":["../../../src/elements/Table/BulkActionBar.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAMvC;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB,oDAAoD;IACpD,EAAE,EAAE,MAAM,CAAC;IACX,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,0EAA0E;IAC1E,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,qEAAqE;IACrE,IAAI,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IAC5B,6EAA6E;IAC7E,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,eAAO,MAAM,gBAAgB;;;;;;;;;iBAM3B,CAAC;AAEH;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,uFAAuF;IACvF,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IACzC,6CAA6C;IAC7C,KAAK,EAAE,MAAM,CAAC;IACd,2EAA2E;IAC3E,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IACxC;;;;OAIG;IACH,gB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WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iFAAiF;IACjF,MAAM,EAAE,mBAAmB,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Table.d.ts","sourceRoot":"","sources":["../../../src/elements/Table/Table.tsx"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,OAAO,EAOL,KAAK,YAAY,EACjB,KAAK,YAAY,EAClB,MAAM,OAAO,CAAC;AACf,OAAO,EAaL,KAAK,SAAS,EACd,KAAK,cAAc,EACpB,MAAM,uBAAuB,CAAC;AAI/B,OAAO,EACL,sBAAsB,EACtB,aAAa,EACb,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACpB,cAAc,EACd,WAAW,EACX,YAAY,EACb,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EACV,UAAU,EACV,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,WAAW,EACX,QAAQ,EACR,SAAS,EAGV,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"Table.d.ts","sourceRoot":"","sources":["../../../src/elements/Table/Table.tsx"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,OAAO,EAOL,KAAK,YAAY,EACjB,KAAK,YAAY,EAClB,MAAM,OAAO,CAAC;AACf,OAAO,EAaL,KAAK,SAAS,EACd,KAAK,cAAc,EACpB,MAAM,uBAAuB,CAAC;AAI/B,OAAO,EACL,sBAAsB,EACtB,aAAa,EACb,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACpB,cAAc,EACd,WAAW,EACX,YAAY,EACb,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EACV,UAAU,EACV,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,WAAW,EACX,QAAQ,EACR,SAAS,EAGV,MAAM,eAAe,CAAC;AA0BvB,QAAA,MAAM,KAAK,yGAuEV,CAAC;AAwCF,QAAA,MAAM,WAAW,EAAmC,CAAC,CAAC,SAAS,MAAM,EACnE,KAAK,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAAG;IAAE,GAAG,CAAC,EAAE,YAAY,CAAC,uBAAuB,CAAC,CAAA;CAAE,KACzE,YAAY,CAAC;AAmClB,QAAA,MAAM,SAAS,EAAiC,CAAC,CAAC,SAAS,MAAM,EAC/D,KAAK,EAAE,cAAc,CAAC,CAAC,CAAC,GAAG;IAAE,GAAG,CAAC,EAAE,YAAY,CAAC,uBAAuB,CAAC,CAAA;CAAE,KACvE,YAAY,CAAC;AAQlB,QAAA,MAAM,WAAW,sHAahB,CAAC;AAQF,QAAA,MAAM,YAAY,uHAajB,CAAC;AAQF,QAAA,MAAM,MAAM,8GAwDX,CAAC;AA0DF,QAAA,MAAM,GAAG,EAA2B,CAAC,CAAC,SAAS,MAAM,EACnD,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG;IAAE,GAAG,CAAC,EAAE,YAAY,CAAC,mBAAmB,CAAC,CAAA;CAAE,KAC7D,YAAY,CAAC;AAQlB,QAAA,MAAM,IAAI,uGAcR,CAAC;AAQH,OAAO,EACL,KAAK,EACL,WAAW,EACX,SAAS,EACT,WAAW,EACX,YAAY,EACZ,MAAM,EACN,GAAG,EACH,IAAI,GACL,CAAC;AAGF,OAAO,EACL,sBAAsB,EACtB,aAAa,EACb,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACpB,cAAc,EACd,WAAW,EACX,YAAY,GACb,CAAC;AAGF,YAAY,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const tableContainerVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
2
2
|
export declare const tableVariants: (props?: ({
|
|
3
|
-
variant?: "default" | "bordered" |
|
|
3
|
+
variant?: "default" | "bordered" | null | undefined;
|
|
4
4
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
5
5
|
export declare const tableHeaderVariants: (props?: ({
|
|
6
6
|
sticky?: boolean | null | undefined;
|
|
@@ -14,7 +14,7 @@ export declare const columnVariants: (props?: ({
|
|
|
14
14
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
15
15
|
export declare const rowVariants: (props?: ({
|
|
16
16
|
isSelected?: boolean | null | undefined;
|
|
17
|
-
|
|
17
|
+
zebra?: boolean | null | undefined;
|
|
18
18
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
19
19
|
export declare const cellVariants: (props?: ({
|
|
20
20
|
align?: "end" | "center" | "start" | null | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Table.styles.d.ts","sourceRoot":"","sources":["../../../src/elements/Table/Table.styles.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Table.styles.d.ts","sourceRoot":"","sources":["../../../src/elements/Table/Table.styles.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,sBAAsB,oFAGjC,CAAC;AAGH,eAAO,MAAM,aAAa;;8EAezB,CAAC;AAIF,eAAO,MAAM,mBAAmB;;8EAU9B,CAAC;AAGH,eAAO,MAAM,mBAAmB,oFAK9B,CAAC;AAGH,eAAO,MAAM,oBAAoB,oFAE/B,CAAC;AAGH,eAAO,MAAM,cAAc;;;;8EAkC1B,CAAC;AAGF,eAAO,MAAM,WAAW;;;8EA2BvB,CAAC;AAGF,eAAO,MAAM,YAAY;;;;8EAyBxB,CAAC"}
|
|
@@ -6,12 +6,14 @@ export type { Selection, SortDescriptor, Key };
|
|
|
6
6
|
* Table visual variant
|
|
7
7
|
* - default: Clean minimal styling
|
|
8
8
|
* - bordered: All cells have borders
|
|
9
|
-
*
|
|
9
|
+
*
|
|
10
|
+
* Note: alternating row backgrounds are controlled by the orthogonal `zebra`
|
|
11
|
+
* prop (on by default), not a variant — zebra composes with both default and
|
|
12
|
+
* bordered.
|
|
10
13
|
*/
|
|
11
14
|
export declare const TableVariantSchema: z.ZodEnum<{
|
|
12
15
|
default: "default";
|
|
13
16
|
bordered: "bordered";
|
|
14
|
-
striped: "striped";
|
|
15
17
|
}>;
|
|
16
18
|
export type TableVariant = z.infer<typeof TableVariantSchema>;
|
|
17
19
|
/**
|
|
@@ -133,7 +135,6 @@ export declare const TablePropsSchema: z.ZodObject<{
|
|
|
133
135
|
variant: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
134
136
|
default: "default";
|
|
135
137
|
bordered: "bordered";
|
|
136
|
-
striped: "striped";
|
|
137
138
|
}>>>;
|
|
138
139
|
size: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
139
140
|
default: "default";
|
|
@@ -141,6 +142,8 @@ export declare const TablePropsSchema: z.ZodObject<{
|
|
|
141
142
|
lg: "lg";
|
|
142
143
|
}>>>;
|
|
143
144
|
stickyHeader: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
145
|
+
zebra: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
146
|
+
toolbar: z.ZodOptional<z.ZodCustom<ReactNode, ReactNode>>;
|
|
144
147
|
className: z.ZodOptional<z.ZodString>;
|
|
145
148
|
}, z.core.$strip>;
|
|
146
149
|
export interface TableProps {
|
|
@@ -167,6 +170,12 @@ export interface TableProps {
|
|
|
167
170
|
variant?: TableVariant;
|
|
168
171
|
size?: TableSize;
|
|
169
172
|
stickyHeader?: boolean;
|
|
173
|
+
zebra?: boolean;
|
|
174
|
+
/**
|
|
175
|
+
* Optional sticky toolbar rendered inside the card frame, above the header
|
|
176
|
+
* (e.g. a `BulkActionBar`). Sits within the same border/radius as the table.
|
|
177
|
+
*/
|
|
178
|
+
toolbar?: ReactNode;
|
|
170
179
|
}
|
|
171
180
|
/**
|
|
172
181
|
* TableHeader props schema
|
|
@@ -400,6 +409,7 @@ export type TableVariantProps = {
|
|
|
400
409
|
variant?: TableVariant;
|
|
401
410
|
size?: TableSize;
|
|
402
411
|
stickyHeader?: boolean;
|
|
412
|
+
zebra?: boolean;
|
|
403
413
|
};
|
|
404
414
|
export type ColumnVariantProps = {
|
|
405
415
|
align?: Align;
|
|
@@ -410,7 +420,7 @@ export type ColumnVariantProps = {
|
|
|
410
420
|
export type RowVariantProps = {
|
|
411
421
|
isSelected?: boolean;
|
|
412
422
|
isDisabled?: boolean;
|
|
413
|
-
|
|
423
|
+
zebra?: boolean;
|
|
414
424
|
size?: TableSize;
|
|
415
425
|
};
|
|
416
426
|
export type CellVariantProps = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Table.types.d.ts","sourceRoot":"","sources":["../../../src/elements/Table/Table.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAM5E,YAAY,EAAE,SAAS,EAAE,cAAc,EAAE,GAAG,EAAE,CAAC;AAM/C
|
|
1
|
+
{"version":3,"file":"Table.types.d.ts","sourceRoot":"","sources":["../../../src/elements/Table/Table.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAM5E,YAAY,EAAE,SAAS,EAAE,cAAc,EAAE,GAAG,EAAE,CAAC;AAM/C;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB;;;EAAkC,CAAC;AAClE,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D;;;;;GAKG;AACH,eAAO,MAAM,eA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nB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAMD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TableCardList — the narrow-viewport / narrow-container card view that pairs
|
|
3
|
+
* with the desktop `Table`. Render it instead of `<Table>` when
|
|
4
|
+
* {@link useContainerNarrow} reports the container is below your breakpoint:
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* const ref = useRef<HTMLDivElement>(null);
|
|
8
|
+
* const narrow = useContainerNarrow(ref, 680);
|
|
9
|
+
* <div ref={ref}>
|
|
10
|
+
* {narrow
|
|
11
|
+
* ? <TableCardList items={rows} getRowId={(r) => r.id} renderCard={...} selectionMode="multiple" selectedKeys={k} onSelectionChange={setK} … />
|
|
12
|
+
* : <Table selectedKeys={k} onSelectionChange={setK} …>…</Table>}
|
|
13
|
+
* </div>
|
|
14
|
+
*
|
|
15
|
+
* Selection + sort state are consumer-owned (same `selectedKeys`/`sortDescriptor`
|
|
16
|
+
* as the desktop Table), so switching views preserves them. Card mode adds a
|
|
17
|
+
* select-all + a Sort `<Select>` (there are no clickable column headers).
|
|
18
|
+
*/
|
|
19
|
+
import { type ReactElement } from 'react';
|
|
20
|
+
import type { TableCardListProps } from './TableCardList.types';
|
|
21
|
+
export declare function TableCardList<T extends object>({ items, getRowId, renderCard, selectionMode, selectedKeys, onSelectionChange, sortDescriptor, onSortChange, sortColumns, renderEmptyState, labels, 'aria-label': ariaLabel, className, 'data-testid': dataTestId, }: TableCardListProps<T>): ReactElement;
|
|
22
|
+
export declare namespace TableCardList {
|
|
23
|
+
var displayName: string;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=TableCardList.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableCardList.d.ts","sourceRoot":"","sources":["../../../src/elements/Table/TableCardList.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,OAAO,CAAC;AAe1C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAEhE,wBAAgB,aAAa,CAAC,CAAC,SAAS,MAAM,EAAE,EAC9C,KAAK,EACL,QAAQ,EACR,UAAU,EACV,aAAsB,EACtB,YAA6B,EAC7B,iBAAiB,EACjB,cAAc,EACd,YAAY,EACZ,WAAgB,EAChB,gBAAgB,EAChB,MAAM,EACN,YAAY,EAAE,SAAS,EACvB,SAAS,EACT,aAAa,EAAE,UAA8B,GAC9C,EAAE,kBAAkB,CAAC,CAAC,CAAC,GAAG,YAAY,CA+HtC;yBA9Ie,aAAa"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** Card region wrapper (the narrow-mode replacement for the table). */
|
|
2
|
+
export declare const cardRegionVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
3
|
+
/** Tools row above the cards: select-all + sort control. */
|
|
4
|
+
export declare const cardToolsVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
5
|
+
/** The card list. */
|
|
6
|
+
export declare const cardListVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
7
|
+
/** A single card. Selected cards take the shared `--selected` tint. */
|
|
8
|
+
export declare const cardVariants: (props?: ({
|
|
9
|
+
isSelected?: boolean | null | undefined;
|
|
10
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
11
|
+
/** The per-card selection checkbox cell (≥44px target). */
|
|
12
|
+
export declare const cardCheckVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
13
|
+
/** The card body (consumer-rendered content). */
|
|
14
|
+
export declare const cardContentVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
15
|
+
//# sourceMappingURL=TableCardList.styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableCardList.styles.d.ts","sourceRoot":"","sources":["../../../src/elements/Table/TableCardList.styles.ts"],"names":[],"mappings":"AAEA,uEAAuE;AACvE,eAAO,MAAM,kBAAkB,oFAA+B,CAAC;AAE/D,4DAA4D;AAC5D,eAAO,MAAM,iBAAiB,oFAE5B,CAAC;AAEH,qBAAqB;AACrB,eAAO,MAAM,gBAAgB,oFAAmD,CAAC;AAEjF,uEAAuE;AACvE,eAAO,MAAM,YAAY;;8EAexB,CAAC;AAEF,2DAA2D;AAC3D,eAAO,MAAM,iBAAiB,oFAE5B,CAAC;AAEH,iDAAiD;AACjD,eAAO,MAAM,mBAAmB,oFAA0B,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { Selection, SortDescriptor, Key } from 'react-aria-components';
|
|
3
|
+
/** A sortable column surfaced in the card-list Sort dropdown. */
|
|
4
|
+
export interface CardSortColumn {
|
|
5
|
+
/** Matches the desktop `<Column id>` so sort state is shared across views. */
|
|
6
|
+
id: string;
|
|
7
|
+
/** Visible, translated label. */
|
|
8
|
+
label: string;
|
|
9
|
+
}
|
|
10
|
+
export interface TableCardListLabels {
|
|
11
|
+
/** Accessible-name builder for the results status, e.g. `(n) => "{n} results"`. */
|
|
12
|
+
results: (count: number) => string;
|
|
13
|
+
/** "Select all" control label. */
|
|
14
|
+
selectAll: string;
|
|
15
|
+
/** Sort `<Select>` label, e.g. "Sort". */
|
|
16
|
+
sort: string;
|
|
17
|
+
/** Sort `<Select>` placeholder, e.g. "Sort by…". */
|
|
18
|
+
sortPlaceholder?: string;
|
|
19
|
+
/** Sort-direction toggle aria-label, receives the *current* direction. */
|
|
20
|
+
sortDirection: (direction: 'ascending' | 'descending') => string;
|
|
21
|
+
/** Per-card selection checkbox aria-label. */
|
|
22
|
+
selectItem: (item: unknown) => string;
|
|
23
|
+
}
|
|
24
|
+
export interface TableCardListProps<T extends object> {
|
|
25
|
+
/** Row data (already sorted/paginated by the consumer, mirroring the desktop Table's `items`). */
|
|
26
|
+
items: T[];
|
|
27
|
+
/** Stable id per row (same as the desktop `Row key`). */
|
|
28
|
+
getRowId: (item: T) => Key;
|
|
29
|
+
/** Renders a single card's body. */
|
|
30
|
+
renderCard: (item: T) => ReactNode;
|
|
31
|
+
/** Selection — `'multiple'` shows per-card checkboxes + select-all. */
|
|
32
|
+
selectionMode?: 'none' | 'multiple';
|
|
33
|
+
selectedKeys?: Selection;
|
|
34
|
+
onSelectionChange?: (keys: Selection) => void;
|
|
35
|
+
/** Sorting — shares `sortDescriptor`/`onSortChange` with the desktop Table. */
|
|
36
|
+
sortDescriptor?: SortDescriptor;
|
|
37
|
+
onSortChange?: (descriptor: SortDescriptor) => void;
|
|
38
|
+
/** The sortable columns offered in the Sort dropdown. */
|
|
39
|
+
sortColumns?: CardSortColumn[];
|
|
40
|
+
/** Empty state when there are no items. */
|
|
41
|
+
renderEmptyState?: () => ReactNode;
|
|
42
|
+
/** i18n strings — the component is domain-free. */
|
|
43
|
+
labels: TableCardListLabels;
|
|
44
|
+
'aria-label'?: string;
|
|
45
|
+
className?: string;
|
|
46
|
+
'data-testid'?: string;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=TableCardList.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableCardList.types.d.ts","sourceRoot":"","sources":["../../../src/elements/Table/TableCardList.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAE5E,iEAAiE;AACjE,MAAM,WAAW,cAAc;IAC7B,8EAA8E;IAC9E,EAAE,EAAE,MAAM,CAAC;IACX,iCAAiC;IACjC,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,mBAAmB;IAClC,mFAAmF;IACnF,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IACnC,kCAAkC;IAClC,SAAS,EAAE,MAAM,CAAC;IAClB,0CAA0C;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,oDAAoD;IACpD,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,0EAA0E;IAC1E,aAAa,EAAE,CAAC,SAAS,EAAE,WAAW,GAAG,YAAY,KAAK,MAAM,CAAC;IACjE,8CAA8C;IAC9C,UAAU,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,MAAM,CAAC;CACvC;AAED,MAAM,WAAW,kBAAkB,CAAC,CAAC,SAAS,MAAM;IAClD,kGAAkG;IAClG,KAAK,EAAE,CAAC,EAAE,CAAC;IACX,yDAAyD;IACzD,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,GAAG,CAAC;IAC3B,oCAAoC;IACpC,UAAU,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,SAAS,CAAC;IAEnC,uEAAuE;IACvE,aAAa,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC;IACpC,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAC;IAE9C,+EAA+E;IAC/E,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,YAAY,CAAC,EAAE,CAAC,UAAU,EAAE,cAAc,KAAK,IAAI,CAAC;IACpD,yDAAyD;IACzD,WAAW,CAAC,EAAE,cAAc,EAAE,CAAC;IAE/B,2CAA2C;IAC3C,gBAAgB,CAAC,EAAE,MAAM,SAAS,CAAC;IAEnC,mDAAmD;IACnD,MAAM,EAAE,mBAAmB,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB"}
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
export { Table, TableHeader, TableBody, TableFooter, TableCaption, Column, Row, Cell, } from './Table';
|
|
2
|
+
export { BulkActionBar } from './BulkActionBar';
|
|
3
|
+
export { resolveSelectedCount } from './resolveSelectedCount';
|
|
4
|
+
export { useBulkActionShortcut } from './useBulkActionShortcut';
|
|
5
|
+
export { TableCardList } from './TableCardList';
|
|
6
|
+
export { useContainerNarrow } from '../../hooks/useContainerNarrow';
|
|
7
|
+
export type { TableCardListProps, TableCardListLabels, CardSortColumn, } from './TableCardList.types';
|
|
8
|
+
export type { UseBulkActionShortcutOptions, } from './useBulkActionShortcut';
|
|
9
|
+
export type { BulkActionBarProps, BulkAction, BulkActionBarLabels, } from './BulkActionBar.types';
|
|
2
10
|
export { tableVariants, tableContainerVariants, tableHeaderVariants, tableFooterVariants, tableCaptionVariants, columnVariants, rowVariants, cellVariants, } from './Table';
|
|
11
|
+
export { bulkActionBarVariants, bulkActionToolbarVariants, bulkActionHintVariants, } from './BulkActionBar';
|
|
3
12
|
export type { TableProps, TableHeaderProps, TableBodyProps, TableFooterProps, TableCaptionProps, ColumnProps, RowProps, CellProps, TableVariant, TableSize, SortDescriptor, Selection, } from './Table.types';
|
|
4
13
|
export type { Selection as AriaSelection, SortDescriptor as AriaSortDescriptor } from './Table';
|
|
5
14
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/elements/Table/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,EACL,WAAW,EACX,SAAS,EACT,WAAW,EACX,YAAY,EACZ,MAAM,EACN,GAAG,EACH,IAAI,GACL,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,aAAa,EACb,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACpB,cAAc,EACd,WAAW,EACX,YAAY,GACb,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/elements/Table/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,EACL,WAAW,EACX,SAAS,EACT,WAAW,EACX,YAAY,EACZ,MAAM,EACN,GAAG,EACH,IAAI,GACL,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAGhE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,YAAY,EACV,kBAAkB,EAClB,mBAAmB,EACnB,cAAc,GACf,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EACV,4BAA4B,GAC7B,MAAM,yBAAyB,CAAC;AACjC,YAAY,EACV,kBAAkB,EAClB,UAAU,EACV,mBAAmB,GACpB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EACL,aAAa,EACb,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACpB,cAAc,EACd,WAAW,EACX,YAAY,GACb,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,qBAAqB,EACrB,yBAAyB,EACzB,sBAAsB,GACvB,MAAM,iBAAiB,CAAC;AAGzB,YAAY,EACV,UAAU,EACV,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,WAAW,EACX,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,SAAS,EACT,cAAc,EACd,SAAS,GACV,MAAM,eAAe,CAAC;AAGvB,YAAY,EAAE,SAAS,IAAI,aAAa,EAAE,cAAc,IAAI,kBAAkB,EAAE,MAAM,SAAS,CAAC"}
|