@dashforge/tw 0.3.0-beta → 0.5.0-beta

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.
Files changed (81) hide show
  1. package/CHANGELOG.md +246 -0
  2. package/PARITY.md +483 -0
  3. package/PERFORMANCE.md +169 -0
  4. package/dist/index.esm.js +1055 -2
  5. package/dist/src/components/Accordion/Accordion.d.ts +21 -0
  6. package/dist/src/components/Accordion/Accordion.d.ts.map +1 -0
  7. package/dist/src/components/Accordion/accordion.types.d.ts +74 -0
  8. package/dist/src/components/Accordion/accordion.types.d.ts.map +1 -0
  9. package/dist/src/components/Accordion/accordion.variants.d.ts +58 -0
  10. package/dist/src/components/Accordion/accordion.variants.d.ts.map +1 -0
  11. package/dist/src/components/Dialog/Dialog.d.ts +17 -0
  12. package/dist/src/components/Dialog/Dialog.d.ts.map +1 -0
  13. package/dist/src/components/Dialog/dialog.types.d.ts +75 -0
  14. package/dist/src/components/Dialog/dialog.types.d.ts.map +1 -0
  15. package/dist/src/components/Dialog/dialog.variants.d.ts +80 -0
  16. package/dist/src/components/Dialog/dialog.variants.d.ts.map +1 -0
  17. package/dist/src/components/Pagination/Pagination.d.ts +32 -0
  18. package/dist/src/components/Pagination/Pagination.d.ts.map +1 -0
  19. package/dist/src/components/Pagination/pagination.helpers.d.ts +23 -0
  20. package/dist/src/components/Pagination/pagination.helpers.d.ts.map +1 -0
  21. package/dist/src/components/Pagination/pagination.types.d.ts +120 -0
  22. package/dist/src/components/Pagination/pagination.types.d.ts.map +1 -0
  23. package/dist/src/components/Pagination/pagination.variants.d.ts +150 -0
  24. package/dist/src/components/Pagination/pagination.variants.d.ts.map +1 -0
  25. package/dist/src/components/Popover/Popover.d.ts +15 -0
  26. package/dist/src/components/Popover/Popover.d.ts.map +1 -0
  27. package/dist/src/components/Popover/popover.types.d.ts +45 -0
  28. package/dist/src/components/Popover/popover.types.d.ts.map +1 -0
  29. package/dist/src/components/Popover/popover.variants.d.ts +34 -0
  30. package/dist/src/components/Popover/popover.variants.d.ts.map +1 -0
  31. package/dist/src/components/Skeleton/Skeleton.d.ts +23 -0
  32. package/dist/src/components/Skeleton/Skeleton.d.ts.map +1 -0
  33. package/dist/src/components/Skeleton/skeleton.types.d.ts +56 -0
  34. package/dist/src/components/Skeleton/skeleton.types.d.ts.map +1 -0
  35. package/dist/src/components/Skeleton/skeleton.variants.d.ts +110 -0
  36. package/dist/src/components/Skeleton/skeleton.variants.d.ts.map +1 -0
  37. package/dist/src/components/Tabs/Tabs.d.ts +15 -0
  38. package/dist/src/components/Tabs/Tabs.d.ts.map +1 -0
  39. package/dist/src/components/Tabs/tabs.types.d.ts +55 -0
  40. package/dist/src/components/Tabs/tabs.types.d.ts.map +1 -0
  41. package/dist/src/components/Tabs/tabs.variants.d.ts +82 -0
  42. package/dist/src/components/Tabs/tabs.variants.d.ts.map +1 -0
  43. package/dist/src/components/Tooltip/Tooltip.d.ts +29 -0
  44. package/dist/src/components/Tooltip/Tooltip.d.ts.map +1 -0
  45. package/dist/src/components/Tooltip/tooltip.types.d.ts +47 -0
  46. package/dist/src/components/Tooltip/tooltip.types.d.ts.map +1 -0
  47. package/dist/src/components/Tooltip/tooltip.variants.d.ts +34 -0
  48. package/dist/src/components/Tooltip/tooltip.variants.d.ts.map +1 -0
  49. package/dist/src/index.d.ts +22 -1
  50. package/dist/src/index.d.ts.map +1 -1
  51. package/package.json +8 -3
  52. package/src/components/Accordion/Accordion.test.tsx +95 -0
  53. package/src/components/Accordion/Accordion.tsx +97 -0
  54. package/src/components/Accordion/accordion.types.ts +66 -0
  55. package/src/components/Accordion/accordion.variants.ts +30 -0
  56. package/src/components/Dialog/Dialog.test.tsx +96 -0
  57. package/src/components/Dialog/Dialog.tsx +93 -0
  58. package/src/components/Dialog/dialog.types.ts +62 -0
  59. package/src/components/Dialog/dialog.variants.ts +62 -0
  60. package/src/components/Pagination/Pagination.test.tsx +314 -0
  61. package/src/components/Pagination/Pagination.tsx +275 -0
  62. package/src/components/Pagination/pagination.helpers.ts +102 -0
  63. package/src/components/Pagination/pagination.types.ts +117 -0
  64. package/src/components/Pagination/pagination.variants.ts +111 -0
  65. package/src/components/Popover/Popover.test.tsx +72 -0
  66. package/src/components/Popover/Popover.tsx +55 -0
  67. package/src/components/Popover/popover.types.ts +42 -0
  68. package/src/components/Popover/popover.variants.ts +18 -0
  69. package/src/components/Skeleton/Skeleton.test.tsx +127 -0
  70. package/src/components/Skeleton/Skeleton.tsx +49 -0
  71. package/src/components/Skeleton/skeleton.types.ts +59 -0
  72. package/src/components/Skeleton/skeleton.variants.ts +86 -0
  73. package/src/components/Tabs/Tabs.test.tsx +74 -0
  74. package/src/components/Tabs/Tabs.tsx +66 -0
  75. package/src/components/Tabs/tabs.types.ts +49 -0
  76. package/src/components/Tabs/tabs.variants.ts +58 -0
  77. package/src/components/Tooltip/Tooltip.test.tsx +73 -0
  78. package/src/components/Tooltip/Tooltip.tsx +70 -0
  79. package/src/components/Tooltip/tooltip.types.ts +44 -0
  80. package/src/components/Tooltip/tooltip.variants.ts +18 -0
  81. package/src/index.ts +57 -1
package/dist/index.esm.js CHANGED
@@ -11,6 +11,11 @@ import { useDashFieldMeta } from '@dashforge/forms';
11
11
  import * as RadixCheckbox from '@radix-ui/react-checkbox';
12
12
  import * as RadixSwitch from '@radix-ui/react-switch';
13
13
  import * as RadixRadioGroup from '@radix-ui/react-radio-group';
14
+ import * as RadixDialog from '@radix-ui/react-dialog';
15
+ import * as RadixTabs from '@radix-ui/react-tabs';
16
+ import * as RadixTooltip from '@radix-ui/react-tooltip';
17
+ import * as RadixPopover from '@radix-ui/react-popover';
18
+ import * as RadixAccordion from '@radix-ui/react-accordion';
14
19
 
15
20
  function _extends() {
16
21
  _extends = Object.assign || function assign(target) {
@@ -6791,6 +6796,1054 @@ AspectRatio.displayName = 'AspectRatio';
6791
6796
  });
6792
6797
  VisuallyHidden.displayName = 'VisuallyHidden';
6793
6798
 
6799
+ /**
6800
+ * `<Dialog>` variant recipe.
6801
+ *
6802
+ * Slots:
6803
+ * - `overlay` — backdrop (Radix's `DialogOverlay`)
6804
+ * - `content` — the dialog box itself
6805
+ * - `title` — heading at the top
6806
+ * - `description` — secondary text under the title
6807
+ * - `closeButton` — top-right `×` button
6808
+ * - `body` — main scrollable area
6809
+ * - `actions` — footer action bar
6810
+ *
6811
+ * Three sizes (`sm` / `md` / `lg`) drive the content max-width.
6812
+ * Motion is gated by `prefers-reduced-motion` so the slide-in
6813
+ * animation collapses to an instant appear on users that opt out.
6814
+ */ const dialogVariants = tv({
6815
+ slots: {
6816
+ overlay: [
6817
+ 'fixed inset-0 z-50 bg-neutral-950/60 backdrop-blur-sm',
6818
+ 'data-[state=open]:animate-in data-[state=open]:fade-in-0',
6819
+ 'data-[state=closed]:animate-out data-[state=closed]:fade-out-0',
6820
+ 'motion-reduce:transition-none motion-reduce:duration-0'
6821
+ ],
6822
+ content: [
6823
+ 'fixed left-1/2 top-1/2 z-50 -translate-x-1/2 -translate-y-1/2',
6824
+ 'w-full bg-white dark:bg-neutral-900 rounded-lg shadow-xl',
6825
+ 'border border-neutral-200 dark:border-neutral-800',
6826
+ 'p-6 flex flex-col gap-4 max-h-[90vh]',
6827
+ 'focus:outline-none',
6828
+ 'data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95',
6829
+ 'data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95',
6830
+ 'motion-reduce:transition-none motion-reduce:duration-0'
6831
+ ],
6832
+ title: 'text-lg font-semibold leading-tight text-neutral-900 dark:text-neutral-50',
6833
+ description: 'text-sm text-neutral-600 dark:text-neutral-400',
6834
+ closeButton: [
6835
+ 'absolute top-4 right-4 inline-flex items-center justify-center',
6836
+ 'h-8 w-8 rounded-md text-neutral-500 hover:text-neutral-900',
6837
+ 'dark:text-neutral-400 dark:hover:text-neutral-50',
6838
+ 'hover:bg-neutral-100 dark:hover:bg-neutral-800',
6839
+ 'focus:outline-none focus:ring-2 focus:ring-primary-500',
6840
+ 'transition-colors'
6841
+ ],
6842
+ body: 'flex-1 overflow-y-auto',
6843
+ actions: 'flex justify-end gap-2 pt-2'
6844
+ },
6845
+ variants: {
6846
+ size: {
6847
+ sm: {
6848
+ content: 'max-w-sm'
6849
+ },
6850
+ md: {
6851
+ content: 'max-w-md'
6852
+ },
6853
+ lg: {
6854
+ content: 'max-w-2xl'
6855
+ }
6856
+ }
6857
+ },
6858
+ defaultVariants: {
6859
+ size: 'md'
6860
+ }
6861
+ });
6862
+
6863
+ /**
6864
+ * Dashforge TW `<Dialog>` — declarative modal dialog.
6865
+ *
6866
+ * Built on `@radix-ui/react-dialog`:
6867
+ * - APG dialog pattern out of the box (focus trap, restore focus on
6868
+ * close, Esc-to-close, `aria-modal`, `aria-labelledby`).
6869
+ * - Renders into a portal (no z-index hell).
6870
+ * - Scroll lock on `<body>` while open.
6871
+ *
6872
+ * Use the imperative `useDialog()` (export from this same module) if
6873
+ * you want a `confirm()`-style return value pattern (similar to
6874
+ * `useConfirm()` from `ConfirmDialog`). Use `<Dialog>` when you want
6875
+ * the control flow living in your component tree.
6876
+ */ function Dialog(props) {
6877
+ var _slotProps_overlay, _slotProps_content, _slotProps_title, _slotProps_description, _slotProps_body, _slotProps_closeButton;
6878
+ const { open, onOpenChange, children, title, description, showCloseButton = true, disableBackdropClose = false, disableEscapeClose = false, size = 'md', sx, slotProps } = props;
6879
+ const v = dialogVariants({
6880
+ size
6881
+ });
6882
+ return jsx(RadixDialog.Root, {
6883
+ open: open,
6884
+ onOpenChange: onOpenChange,
6885
+ children: jsxs(RadixDialog.Portal, {
6886
+ children: [
6887
+ jsx(RadixDialog.Overlay, {
6888
+ className: cn(v.overlay(), slotProps == null ? void 0 : (_slotProps_overlay = slotProps.overlay) == null ? void 0 : _slotProps_overlay.className)
6889
+ }),
6890
+ jsxs(RadixDialog.Content, {
6891
+ className: cn(v.content(), sx, slotProps == null ? void 0 : (_slotProps_content = slotProps.content) == null ? void 0 : _slotProps_content.className),
6892
+ onPointerDownOutside: (event)=>{
6893
+ if (disableBackdropClose) event.preventDefault();
6894
+ },
6895
+ onEscapeKeyDown: (event)=>{
6896
+ if (disableEscapeClose) event.preventDefault();
6897
+ },
6898
+ children: [
6899
+ title != null && jsx(RadixDialog.Title, {
6900
+ className: cn(v.title(), slotProps == null ? void 0 : (_slotProps_title = slotProps.title) == null ? void 0 : _slotProps_title.className),
6901
+ children: title
6902
+ }),
6903
+ description != null && jsx(RadixDialog.Description, {
6904
+ className: cn(v.description(), slotProps == null ? void 0 : (_slotProps_description = slotProps.description) == null ? void 0 : _slotProps_description.className),
6905
+ children: description
6906
+ }),
6907
+ jsx("div", {
6908
+ className: cn(v.body(), slotProps == null ? void 0 : (_slotProps_body = slotProps.body) == null ? void 0 : _slotProps_body.className),
6909
+ children: children
6910
+ }),
6911
+ showCloseButton && jsx(RadixDialog.Close, {
6912
+ "aria-label": "Close",
6913
+ className: cn(v.closeButton(), slotProps == null ? void 0 : (_slotProps_closeButton = slotProps.closeButton) == null ? void 0 : _slotProps_closeButton.className),
6914
+ children: jsx("svg", {
6915
+ width: "1em",
6916
+ height: "1em",
6917
+ viewBox: "0 0 16 16",
6918
+ fill: "none",
6919
+ stroke: "currentColor",
6920
+ strokeWidth: "1.5",
6921
+ strokeLinecap: "round",
6922
+ strokeLinejoin: "round",
6923
+ "aria-hidden": "true",
6924
+ children: jsx("path", {
6925
+ d: "M4 4l8 8M12 4l-8 8"
6926
+ })
6927
+ })
6928
+ })
6929
+ ]
6930
+ })
6931
+ ]
6932
+ })
6933
+ });
6934
+ }
6935
+
6936
+ const tabsVariants = tv({
6937
+ slots: {
6938
+ root: 'flex',
6939
+ list: 'inline-flex items-center gap-1',
6940
+ trigger: [
6941
+ 'inline-flex items-center justify-center whitespace-nowrap',
6942
+ 'text-sm font-medium transition-colors',
6943
+ 'focus:outline-none focus-visible:ring-2 focus-visible:ring-primary-500',
6944
+ 'disabled:opacity-50 disabled:pointer-events-none',
6945
+ 'motion-reduce:transition-none'
6946
+ ],
6947
+ content: [
6948
+ 'mt-3 focus:outline-none',
6949
+ 'data-[state=inactive]:hidden'
6950
+ ]
6951
+ },
6952
+ variants: {
6953
+ variant: {
6954
+ underline: {
6955
+ list: 'border-b border-neutral-200 dark:border-neutral-800',
6956
+ trigger: [
6957
+ 'px-3 py-2 border-b-2 border-transparent text-neutral-600 dark:text-neutral-400',
6958
+ 'hover:text-neutral-900 dark:hover:text-neutral-50',
6959
+ 'data-[state=active]:border-primary-500 data-[state=active]:text-primary-700',
6960
+ 'dark:data-[state=active]:text-primary-400'
6961
+ ]
6962
+ },
6963
+ pill: {
6964
+ list: 'rounded-lg bg-neutral-100 dark:bg-neutral-800 p-1',
6965
+ trigger: [
6966
+ 'px-3 py-1.5 rounded-md text-neutral-600 dark:text-neutral-400',
6967
+ 'hover:text-neutral-900 dark:hover:text-neutral-50',
6968
+ 'data-[state=active]:bg-white dark:data-[state=active]:bg-neutral-900',
6969
+ 'data-[state=active]:text-neutral-900 dark:data-[state=active]:text-neutral-50',
6970
+ 'data-[state=active]:shadow-sm'
6971
+ ]
6972
+ }
6973
+ },
6974
+ orientation: {
6975
+ horizontal: {
6976
+ root: 'flex-col',
6977
+ list: 'flex-row'
6978
+ },
6979
+ vertical: {
6980
+ root: 'flex-row gap-4',
6981
+ list: 'flex-col items-stretch'
6982
+ }
6983
+ }
6984
+ },
6985
+ defaultVariants: {
6986
+ variant: 'underline',
6987
+ orientation: 'horizontal'
6988
+ }
6989
+ });
6990
+
6991
+ /**
6992
+ * Dashforge TW `<Tabs>` — declarative tab navigation.
6993
+ *
6994
+ * Built on `@radix-ui/react-tabs`:
6995
+ * - APG tabs pattern (arrow-key navigation, automatic activation,
6996
+ * `role="tablist"` + `role="tab"` + `role="tabpanel"`).
6997
+ * - Controlled / uncontrolled (`value` / `defaultValue`).
6998
+ *
6999
+ * Two variant axes:
7000
+ * - `variant` — `underline` (default) | `pill`
7001
+ * - `orientation` — `horizontal` (default) | `vertical`
7002
+ */ function Tabs(props) {
7003
+ var _items_, _slotProps_root, _slotProps_list;
7004
+ const { items, value, defaultValue, onValueChange, variant = 'underline', orientation = 'horizontal', sx, slotProps } = props;
7005
+ const v = tabsVariants({
7006
+ variant,
7007
+ orientation
7008
+ });
7009
+ const resolvedDefault = defaultValue != null ? defaultValue : (_items_ = items[0]) == null ? void 0 : _items_.value;
7010
+ return jsxs(RadixTabs.Root, {
7011
+ value: value,
7012
+ defaultValue: resolvedDefault,
7013
+ onValueChange: onValueChange,
7014
+ orientation: orientation,
7015
+ className: cn(v.root(), sx, slotProps == null ? void 0 : (_slotProps_root = slotProps.root) == null ? void 0 : _slotProps_root.className),
7016
+ children: [
7017
+ jsx(RadixTabs.List, {
7018
+ className: cn(v.list(), slotProps == null ? void 0 : (_slotProps_list = slotProps.list) == null ? void 0 : _slotProps_list.className),
7019
+ children: items.map((item)=>{
7020
+ var _slotProps_trigger;
7021
+ return jsx(RadixTabs.Trigger, {
7022
+ value: item.value,
7023
+ disabled: item.disabled,
7024
+ className: cn(v.trigger(), slotProps == null ? void 0 : (_slotProps_trigger = slotProps.trigger) == null ? void 0 : _slotProps_trigger.className),
7025
+ children: item.label
7026
+ }, item.value);
7027
+ })
7028
+ }),
7029
+ items.map((item)=>{
7030
+ var _slotProps_content;
7031
+ return jsx(RadixTabs.Content, {
7032
+ value: item.value,
7033
+ className: cn(v.content(), slotProps == null ? void 0 : (_slotProps_content = slotProps.content) == null ? void 0 : _slotProps_content.className),
7034
+ children: item.content
7035
+ }, item.value);
7036
+ })
7037
+ ]
7038
+ });
7039
+ }
7040
+
7041
+ const tooltipVariants = tv({
7042
+ slots: {
7043
+ content: [
7044
+ 'z-50 max-w-xs rounded-md px-3 py-1.5 text-xs font-medium',
7045
+ 'bg-neutral-900 text-neutral-50',
7046
+ 'dark:bg-neutral-50 dark:text-neutral-900',
7047
+ 'shadow-md',
7048
+ 'data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95',
7049
+ 'data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95',
7050
+ 'motion-reduce:transition-none motion-reduce:duration-0'
7051
+ ],
7052
+ arrow: 'fill-neutral-900 dark:fill-neutral-50'
7053
+ }
7054
+ });
7055
+
7056
+ /**
7057
+ * Dashforge TW `<Tooltip>` — hoverable / focusable tooltip.
7058
+ *
7059
+ * Built on `@radix-ui/react-tooltip`:
7060
+ * - APG tooltip pattern: `role="tooltip"`, `aria-describedby` wired
7061
+ * to the trigger automatically (Radix manages the id linkage).
7062
+ * - Shows on hover OR keyboard focus.
7063
+ * - Dismissed on Escape or pointer leave.
7064
+ *
7065
+ * Wrap any single React node — it becomes the trigger via Radix's
7066
+ * `asChild` slot. The trigger inherits `aria-describedby` so screen
7067
+ * readers announce the tooltip content along with the trigger.
7068
+ *
7069
+ * @example
7070
+ * ```tsx
7071
+ * <Tooltip content="Delete this item">
7072
+ * <Button variant="ghost">
7073
+ * <TrashIcon />
7074
+ * </Button>
7075
+ * </Tooltip>
7076
+ * ```
7077
+ *
7078
+ * Each consumer can also wrap the entire app once in
7079
+ * `<RadixTooltip.Provider>` to share delay/skip configuration; we
7080
+ * include a per-component provider here for ease-of-use.
7081
+ */ function Tooltip(props) {
7082
+ var _slotProps_content, _slotProps_arrow;
7083
+ const { children, content, side = 'top', align = 'center', hideArrow = false, delayDuration = 200, open, onOpenChange, sideOffset = 4, slotProps } = props;
7084
+ const v = tooltipVariants();
7085
+ return jsx(RadixTooltip.Provider, {
7086
+ delayDuration: delayDuration,
7087
+ children: jsxs(RadixTooltip.Root, {
7088
+ open: open,
7089
+ onOpenChange: onOpenChange,
7090
+ children: [
7091
+ jsx(RadixTooltip.Trigger, {
7092
+ asChild: true,
7093
+ children: children
7094
+ }),
7095
+ jsx(RadixTooltip.Portal, {
7096
+ children: jsxs(RadixTooltip.Content, {
7097
+ side: side,
7098
+ align: align,
7099
+ sideOffset: sideOffset,
7100
+ className: cn(v.content(), slotProps == null ? void 0 : (_slotProps_content = slotProps.content) == null ? void 0 : _slotProps_content.className),
7101
+ children: [
7102
+ content,
7103
+ !hideArrow && jsx(RadixTooltip.Arrow, {
7104
+ className: cn(v.arrow(), slotProps == null ? void 0 : (_slotProps_arrow = slotProps.arrow) == null ? void 0 : _slotProps_arrow.className)
7105
+ })
7106
+ ]
7107
+ })
7108
+ })
7109
+ ]
7110
+ })
7111
+ });
7112
+ }
7113
+
7114
+ const popoverVariants = tv({
7115
+ slots: {
7116
+ content: [
7117
+ 'z-50 rounded-md border border-neutral-200 dark:border-neutral-800',
7118
+ 'bg-white dark:bg-neutral-900 p-4 shadow-lg',
7119
+ 'text-sm text-neutral-900 dark:text-neutral-50',
7120
+ 'focus:outline-none',
7121
+ 'data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95',
7122
+ 'data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95',
7123
+ 'motion-reduce:transition-none motion-reduce:duration-0'
7124
+ ],
7125
+ arrow: 'fill-white dark:fill-neutral-900'
7126
+ }
7127
+ });
7128
+
7129
+ /**
7130
+ * Dashforge TW `<Popover>` — clickable floating content panel.
7131
+ *
7132
+ * Built on `@radix-ui/react-popover`:
7133
+ * - Focus trap inside the popover (Tab cycles within).
7134
+ * - Outside-click + Escape dismiss.
7135
+ * - APG dialog-like semantics (`role="dialog"` on content).
7136
+ * - Portal-rendered.
7137
+ *
7138
+ * Use `<Popover>` for menus / pickers / settings panels with
7139
+ * interactive children. Use `<Tooltip>` for read-only hints.
7140
+ */ function Popover(props) {
7141
+ var _slotProps_content, _slotProps_arrow;
7142
+ const { children, content, side = 'bottom', align = 'center', showArrow = false, open, onOpenChange, sideOffset = 8, width, slotProps } = props;
7143
+ const v = popoverVariants();
7144
+ return jsxs(RadixPopover.Root, {
7145
+ open: open,
7146
+ onOpenChange: onOpenChange,
7147
+ children: [
7148
+ jsx(RadixPopover.Trigger, {
7149
+ asChild: true,
7150
+ children: children
7151
+ }),
7152
+ jsx(RadixPopover.Portal, {
7153
+ children: jsxs(RadixPopover.Content, {
7154
+ side: side,
7155
+ align: align,
7156
+ sideOffset: sideOffset,
7157
+ style: width != null ? {
7158
+ width
7159
+ } : undefined,
7160
+ className: cn(v.content(), slotProps == null ? void 0 : (_slotProps_content = slotProps.content) == null ? void 0 : _slotProps_content.className),
7161
+ children: [
7162
+ content,
7163
+ showArrow && jsx(RadixPopover.Arrow, {
7164
+ className: cn(v.arrow(), slotProps == null ? void 0 : (_slotProps_arrow = slotProps.arrow) == null ? void 0 : _slotProps_arrow.className)
7165
+ })
7166
+ ]
7167
+ })
7168
+ })
7169
+ ]
7170
+ });
7171
+ }
7172
+
7173
+ const accordionVariants = tv({
7174
+ slots: {
7175
+ root: 'w-full',
7176
+ item: 'border-b border-neutral-200 dark:border-neutral-800',
7177
+ header: 'flex',
7178
+ trigger: [
7179
+ 'flex flex-1 items-center justify-between py-3 text-left',
7180
+ 'text-sm font-medium text-neutral-900 dark:text-neutral-50',
7181
+ 'transition-all hover:underline',
7182
+ 'focus:outline-none focus-visible:ring-2 focus-visible:ring-primary-500 focus-visible:rounded',
7183
+ '[&[data-state=open]>svg]:rotate-180',
7184
+ 'disabled:opacity-50 disabled:pointer-events-none',
7185
+ 'motion-reduce:transition-none'
7186
+ ],
7187
+ content: [
7188
+ 'overflow-hidden text-sm text-neutral-700 dark:text-neutral-300',
7189
+ 'data-[state=open]:animate-accordion-down',
7190
+ 'data-[state=closed]:animate-accordion-up',
7191
+ 'motion-reduce:animate-none'
7192
+ ],
7193
+ chevron: [
7194
+ 'h-4 w-4 shrink-0 text-neutral-500 transition-transform duration-200',
7195
+ 'motion-reduce:transition-none motion-reduce:duration-0'
7196
+ ]
7197
+ }
7198
+ });
7199
+
7200
+ /**
7201
+ * Dashforge TW `<Accordion>` — collapsible section list.
7202
+ *
7203
+ * Built on `@radix-ui/react-accordion`:
7204
+ * - APG accordion pattern: `role="region"` on content, header
7205
+ * button with `aria-expanded` and `aria-controls` linked to
7206
+ * the panel.
7207
+ * - Keyboard support: Space / Enter toggle, ArrowDown / ArrowUp
7208
+ * move focus between triggers, Home / End to extremes.
7209
+ * - Two modes:
7210
+ * - `type="single"` — at most one section open at a time;
7211
+ * `collapsible` allows clicking the open section to close it
7212
+ * (default true).
7213
+ * - `type="multiple"` — multiple sections open simultaneously.
7214
+ *
7215
+ * The trigger renders a chevron that flips 180° via CSS
7216
+ * (`data-state=open` selector) — no React state, no JS animation.
7217
+ */ function Accordion(props) {
7218
+ var _props_collapsible;
7219
+ var _slotProps_root;
7220
+ const v = accordionVariants();
7221
+ const { items, sx, slotProps } = props;
7222
+ const renderItems = (items, slotProps)=>items.map((item)=>{
7223
+ var _slotProps_item, _slotProps_header, _slotProps_trigger, _slotProps_chevron, _slotProps_content;
7224
+ return jsxs(RadixAccordion.Item, {
7225
+ value: item.value,
7226
+ disabled: item.disabled,
7227
+ className: cn(v.item(), slotProps == null ? void 0 : (_slotProps_item = slotProps.item) == null ? void 0 : _slotProps_item.className),
7228
+ children: [
7229
+ jsx(RadixAccordion.Header, {
7230
+ className: cn(v.header(), slotProps == null ? void 0 : (_slotProps_header = slotProps.header) == null ? void 0 : _slotProps_header.className),
7231
+ children: jsxs(RadixAccordion.Trigger, {
7232
+ className: cn(v.trigger(), slotProps == null ? void 0 : (_slotProps_trigger = slotProps.trigger) == null ? void 0 : _slotProps_trigger.className),
7233
+ children: [
7234
+ item.header,
7235
+ jsx("svg", {
7236
+ className: cn(v.chevron(), slotProps == null ? void 0 : (_slotProps_chevron = slotProps.chevron) == null ? void 0 : _slotProps_chevron.className),
7237
+ width: "1em",
7238
+ height: "1em",
7239
+ viewBox: "0 0 16 16",
7240
+ fill: "none",
7241
+ stroke: "currentColor",
7242
+ strokeWidth: "1.5",
7243
+ strokeLinecap: "round",
7244
+ strokeLinejoin: "round",
7245
+ "aria-hidden": "true",
7246
+ children: jsx("path", {
7247
+ d: "M4 6l4 4 4-4"
7248
+ })
7249
+ })
7250
+ ]
7251
+ })
7252
+ }),
7253
+ jsx(RadixAccordion.Content, {
7254
+ className: cn(v.content(), slotProps == null ? void 0 : (_slotProps_content = slotProps.content) == null ? void 0 : _slotProps_content.className),
7255
+ children: jsx("div", {
7256
+ className: "pb-3 pt-0",
7257
+ children: item.content
7258
+ })
7259
+ })
7260
+ ]
7261
+ }, item.value);
7262
+ });
7263
+ if (props.type === 'multiple') {
7264
+ var _slotProps_root1;
7265
+ return jsx(RadixAccordion.Root, {
7266
+ type: "multiple",
7267
+ value: props.value,
7268
+ defaultValue: props.defaultValue,
7269
+ onValueChange: props.onValueChange,
7270
+ className: cn(v.root(), sx, slotProps == null ? void 0 : (_slotProps_root1 = slotProps.root) == null ? void 0 : _slotProps_root1.className),
7271
+ children: renderItems(items, slotProps)
7272
+ });
7273
+ }
7274
+ return jsx(RadixAccordion.Root, {
7275
+ type: "single",
7276
+ collapsible: (_props_collapsible = props.collapsible) != null ? _props_collapsible : true,
7277
+ value: props.value,
7278
+ defaultValue: props.defaultValue,
7279
+ onValueChange: props.onValueChange,
7280
+ className: cn(v.root(), sx, slotProps == null ? void 0 : (_slotProps_root = slotProps.root) == null ? void 0 : _slotProps_root.className),
7281
+ children: renderItems(items, slotProps)
7282
+ });
7283
+ }
7284
+
7285
+ /**
7286
+ * `<Skeleton>` variant recipe.
7287
+ *
7288
+ * Slots:
7289
+ * - `root` — single element (atomic component)
7290
+ *
7291
+ * Variant axes:
7292
+ * - `variant` (`text` | `rectangle` | `circle`) — shape / radius
7293
+ * - `animation` (`pulse` | `wave` | `none`) — how the placeholder
7294
+ * "breathes" while data loads. Always gated on
7295
+ * `prefers-reduced-motion` (no exception — animations are
7296
+ * purely cosmetic).
7297
+ *
7298
+ * Implementation notes:
7299
+ *
7300
+ * - `pulse` uses Tailwind's built-in `animate-pulse` (opacity
7301
+ * 1.0 ↔ 0.5 over 2s, ease-in-out infinite).
7302
+ * - `wave` overlays a moving gradient. Implemented with a
7303
+ * `relative` container + an `::after` pseudo-element via a
7304
+ * Tailwind arbitrary-value class. The gradient slides
7305
+ * horizontally over the surface, mimicking the MUI Skeleton
7306
+ * "wave" look.
7307
+ * - Color uses neutral-200 (light) and neutral-800 (dark) for
7308
+ * the base, picked up automatically by the dashforge preset's
7309
+ * CSS-variable layer.
7310
+ *
7311
+ * Accessibility: the root has `aria-hidden="true"` (set on the JSX
7312
+ * side, not here). Screen readers skip the skeleton entirely;
7313
+ * the surrounding component is responsible for announcing
7314
+ * loading state via `aria-busy` or `aria-live` if needed.
7315
+ */ const skeletonVariants = tv({
7316
+ slots: {
7317
+ root: [
7318
+ 'block',
7319
+ 'bg-neutral-200 dark:bg-neutral-800',
7320
+ 'motion-reduce:animate-none'
7321
+ ]
7322
+ },
7323
+ variants: {
7324
+ variant: {
7325
+ text: {
7326
+ root: 'rounded h-[1em] w-full'
7327
+ },
7328
+ rectangle: {
7329
+ root: 'rounded-md w-full h-[100px]'
7330
+ },
7331
+ circle: {
7332
+ root: 'rounded-full w-10 h-10'
7333
+ }
7334
+ },
7335
+ animation: {
7336
+ pulse: {
7337
+ root: 'animate-pulse'
7338
+ },
7339
+ wave: {
7340
+ root: [
7341
+ 'relative overflow-hidden',
7342
+ // The wave is rendered via an arbitrary-value ::after
7343
+ // pseudo-element with a moving linear gradient. Tailwind
7344
+ // doesn't ship a `wave` keyframe; we use the built-in
7345
+ // `animate-pulse` as a fallback if a consumer needs to
7346
+ // override. The gradient stop direction works in both
7347
+ // light and dark mode (white shimmer in light, lighter
7348
+ // overlay in dark).
7349
+ 'after:absolute after:inset-0',
7350
+ 'after:bg-gradient-to-r after:from-transparent after:via-white/40 after:to-transparent',
7351
+ 'dark:after:via-white/10',
7352
+ 'after:animate-pulse',
7353
+ 'after:motion-reduce:animate-none'
7354
+ ]
7355
+ },
7356
+ none: {
7357
+ root: ''
7358
+ }
7359
+ }
7360
+ },
7361
+ defaultVariants: {
7362
+ variant: 'text',
7363
+ animation: 'pulse'
7364
+ }
7365
+ });
7366
+
7367
+ /**
7368
+ * Dashforge TW `<Skeleton>` — loading placeholder primitive.
7369
+ *
7370
+ * Renders as a non-interactive `<span aria-hidden="true">` so screen
7371
+ * readers skip it. The surrounding component is responsible for
7372
+ * announcing loading state via `aria-busy` or `aria-live` if needed.
7373
+ *
7374
+ * Variants:
7375
+ * - `variant` — `text` (default, line shape) / `rectangle` / `circle`
7376
+ * - `animation` — `pulse` (default) / `wave` / `none`
7377
+ *
7378
+ * Both animations are gated by `prefers-reduced-motion` (WCAG 2.3.3).
7379
+ *
7380
+ * @example
7381
+ * ```tsx
7382
+ * <Skeleton variant="text" width="200px" />
7383
+ * <Skeleton variant="rectangle" width="100%" height="120px" />
7384
+ * <Skeleton variant="circle" width="40px" />
7385
+ * ```
7386
+ */ function Skeleton(props) {
7387
+ var _slotProps_root;
7388
+ const { variant = 'text', animation = 'pulse', width, height, sx, slotProps } = props;
7389
+ const v = skeletonVariants({
7390
+ variant,
7391
+ animation
7392
+ });
7393
+ // Width / height come through as inline style — Tailwind doesn't
7394
+ // know about arbitrary user-supplied lengths. We default `circle`'s
7395
+ // height to `width` so consumers don't have to repeat themselves.
7396
+ const style = {};
7397
+ if (width != null) style.width = width;
7398
+ if (height != null) {
7399
+ style.height = height;
7400
+ } else if (variant === 'circle' && width != null) {
7401
+ style.height = width;
7402
+ }
7403
+ return jsx("span", {
7404
+ "aria-hidden": "true",
7405
+ role: "presentation",
7406
+ className: cn(v.root(), sx, slotProps == null ? void 0 : (_slotProps_root = slotProps.root) == null ? void 0 : _slotProps_root.className),
7407
+ style: style
7408
+ });
7409
+ }
7410
+
7411
+ /**
7412
+ * `<Pagination>` variant recipe.
7413
+ *
7414
+ * Slots:
7415
+ * - `root` — outer `<nav>` container
7416
+ * - `summary` — "Showing X-Y of Z" text
7417
+ * - `list` — `<ul>` of page buttons
7418
+ * - `pageButton` — individual page number button
7419
+ * - `activeButton` — modifier applied to the current page
7420
+ * - `navButton` — first/prev/next/last buttons
7421
+ * - `ellipsis` — `…` rendered when range gap
7422
+ * - `pageSizeSelector` — native `<select>` for page size
7423
+ * - `jumpInput` — direct page jump `<input>`
7424
+ *
7425
+ * Variant axes:
7426
+ * - `variant` — `default` (full kit) | `compact` (number buttons +
7427
+ * prev/next only) | `minimal` ("X / Y pages" + prev/next only).
7428
+ * - `size` — `sm` | `md` (default) | `lg`. Drives padding + text
7429
+ * size on the buttons.
7430
+ */ const paginationVariants = tv({
7431
+ slots: {
7432
+ root: 'flex flex-wrap items-center gap-3',
7433
+ summary: 'text-neutral-600 dark:text-neutral-400',
7434
+ list: 'inline-flex items-center gap-1',
7435
+ pageButton: [
7436
+ 'inline-flex items-center justify-center rounded-md',
7437
+ 'border border-neutral-300 dark:border-neutral-700',
7438
+ 'bg-white dark:bg-neutral-900',
7439
+ 'text-neutral-700 dark:text-neutral-300',
7440
+ 'hover:bg-neutral-50 dark:hover:bg-neutral-800',
7441
+ 'focus:outline-none focus-visible:ring-2 focus-visible:ring-primary-500',
7442
+ 'transition-colors motion-reduce:transition-none',
7443
+ 'disabled:opacity-50 disabled:cursor-not-allowed disabled:pointer-events-none'
7444
+ ],
7445
+ activeButton: [
7446
+ 'bg-primary-500 text-white border-primary-500',
7447
+ 'hover:bg-primary-600 dark:hover:bg-primary-400'
7448
+ ],
7449
+ navButton: [
7450
+ 'inline-flex items-center justify-center rounded-md',
7451
+ 'border border-neutral-300 dark:border-neutral-700',
7452
+ 'bg-white dark:bg-neutral-900',
7453
+ 'text-neutral-700 dark:text-neutral-300',
7454
+ 'hover:bg-neutral-50 dark:hover:bg-neutral-800',
7455
+ 'focus:outline-none focus-visible:ring-2 focus-visible:ring-primary-500',
7456
+ 'transition-colors motion-reduce:transition-none',
7457
+ 'disabled:opacity-50 disabled:cursor-not-allowed disabled:pointer-events-none'
7458
+ ],
7459
+ ellipsis: 'inline-flex items-center justify-center text-neutral-500 px-1',
7460
+ pageSizeSelector: [
7461
+ 'inline-flex items-center gap-2',
7462
+ 'text-neutral-700 dark:text-neutral-300'
7463
+ ],
7464
+ jumpInput: [
7465
+ 'rounded-md border border-neutral-300 dark:border-neutral-700',
7466
+ 'bg-white dark:bg-neutral-900',
7467
+ 'text-neutral-900 dark:text-neutral-50',
7468
+ 'focus:outline-none focus-visible:ring-2 focus-visible:ring-primary-500',
7469
+ 'transition-colors motion-reduce:transition-none'
7470
+ ]
7471
+ },
7472
+ variants: {
7473
+ // Note: variant-driven visibility is enforced via conditional JSX
7474
+ // rendering (in `Pagination.tsx`), NOT via `hidden` Tailwind class.
7475
+ // Reason: `display: none` keeps the elements in the DOM (and in the
7476
+ // a11y tree depending on how it's applied), which leaks into
7477
+ // testing-library `queryByText` and feels semantically wrong for
7478
+ // "this UI piece doesn't exist in this variant". So compact and
7479
+ // minimal slots stay empty here.
7480
+ variant: {
7481
+ default: {},
7482
+ compact: {},
7483
+ minimal: {}
7484
+ },
7485
+ size: {
7486
+ sm: {
7487
+ summary: 'text-xs',
7488
+ pageButton: 'h-7 min-w-7 px-2 text-xs',
7489
+ navButton: 'h-7 min-w-7 px-2 text-xs',
7490
+ ellipsis: 'h-7 min-w-5 text-xs',
7491
+ pageSizeSelector: 'text-xs',
7492
+ jumpInput: 'h-7 px-2 text-xs w-14'
7493
+ },
7494
+ md: {
7495
+ summary: 'text-sm',
7496
+ pageButton: 'h-9 min-w-9 px-3 text-sm',
7497
+ navButton: 'h-9 min-w-9 px-3 text-sm',
7498
+ ellipsis: 'h-9 min-w-6 text-sm',
7499
+ pageSizeSelector: 'text-sm',
7500
+ jumpInput: 'h-9 px-2 text-sm w-16'
7501
+ },
7502
+ lg: {
7503
+ summary: 'text-base',
7504
+ pageButton: 'h-10 min-w-10 px-4 text-base',
7505
+ navButton: 'h-10 min-w-10 px-4 text-base',
7506
+ ellipsis: 'h-10 min-w-7 text-base',
7507
+ pageSizeSelector: 'text-base',
7508
+ jumpInput: 'h-10 px-3 text-base w-20'
7509
+ }
7510
+ }
7511
+ },
7512
+ defaultVariants: {
7513
+ variant: 'default',
7514
+ size: 'md'
7515
+ }
7516
+ });
7517
+
7518
+ /**
7519
+ * Compute the array of page indices (or `'ellipsis'` sentinels) to
7520
+ * render for a `<Pagination>`.
7521
+ *
7522
+ * Algorithm (standard "siblings + boundaries + ellipsis fill"):
7523
+ * 1. Always show `boundaryCount` pages at the start and `boundaryCount`
7524
+ * at the end.
7525
+ * 2. Show `siblingCount` pages on each side of the current page.
7526
+ * 3. Fill gaps wider than 1 with `'ellipsis'`.
7527
+ * 4. If a gap is exactly 1 page wide, include that page directly
7528
+ * (no ellipsis for a single hidden number).
7529
+ *
7530
+ * Output is 1-indexed page numbers OR the literal string `'ellipsis'`.
7531
+ *
7532
+ * @example
7533
+ * ```ts
7534
+ * range(1, 10, 1, 1) // [1, 'ellipsis', 5, 'ellipsis', 10] when current=5
7535
+ * range(1, 5, 1, 1) // [1, 2, 3, 4, 5]
7536
+ * range(1, 100, 1, 1) // edges varying with current
7537
+ * ```
7538
+ */ function computePageRange(currentPage, totalPages, siblingCount, boundaryCount) {
7539
+ if (totalPages <= 0) return [];
7540
+ if (totalPages === 1) return [
7541
+ 1
7542
+ ];
7543
+ // Budget: if `totalPages` fits within boundaries + siblings + current
7544
+ // (plus the 2 hypothetical ellipsis slots), don't bother with ellipses
7545
+ // at all — list every page. Avoids the "[1, 2, …, 5]" footgun where
7546
+ // the user expected to see 3 and 4 explicitly.
7547
+ const minPagesForEllipsis = 2 * boundaryCount + 2 * siblingCount + 3;
7548
+ if (totalPages <= minPagesForEllipsis) {
7549
+ return range(1, totalPages);
7550
+ }
7551
+ const startBoundary = range(1, Math.min(boundaryCount, totalPages));
7552
+ const endBoundary = range(Math.max(totalPages - boundaryCount + 1, boundaryCount + 1), totalPages);
7553
+ const siblingsStart = Math.max(currentPage - siblingCount, boundaryCount + 2);
7554
+ const siblingsEnd = Math.min(currentPage + siblingCount, totalPages - boundaryCount - 1);
7555
+ const siblings = range(siblingsStart, siblingsEnd);
7556
+ const showStartEllipsis = siblingsStart > boundaryCount + 2;
7557
+ const showEndEllipsis = siblingsEnd < totalPages - boundaryCount - 1;
7558
+ const out = [
7559
+ ...startBoundary
7560
+ ];
7561
+ if (showStartEllipsis) {
7562
+ out.push('ellipsis');
7563
+ } else if (siblingsStart === boundaryCount + 2) {
7564
+ // Single hidden page → fill it directly instead of an ellipsis.
7565
+ out.push(boundaryCount + 1);
7566
+ }
7567
+ out.push(...siblings);
7568
+ if (showEndEllipsis) {
7569
+ out.push('ellipsis');
7570
+ } else if (siblingsEnd === totalPages - boundaryCount - 1) {
7571
+ out.push(totalPages - boundaryCount);
7572
+ }
7573
+ out.push(...endBoundary);
7574
+ // Dedupe while preserving order (overlapping ranges produce duplicates
7575
+ // when totalPages is small). Two distinct rules:
7576
+ // 1. Number entries: keep only the first occurrence.
7577
+ // 2. Ellipsis entries: collapse adjacent ellipses to one.
7578
+ const seen = new Set();
7579
+ const deduped = [];
7580
+ let prevWasEllipsis = false;
7581
+ for (const entry of out){
7582
+ if (entry === 'ellipsis') {
7583
+ if (!prevWasEllipsis) {
7584
+ deduped.push('ellipsis');
7585
+ prevWasEllipsis = true;
7586
+ }
7587
+ continue;
7588
+ }
7589
+ if (!seen.has(entry)) {
7590
+ seen.add(entry);
7591
+ deduped.push(entry);
7592
+ prevWasEllipsis = false;
7593
+ }
7594
+ }
7595
+ return deduped;
7596
+ }
7597
+ function range(start, end) {
7598
+ if (end < start) return [];
7599
+ return Array.from({
7600
+ length: end - start + 1
7601
+ }, (_, i)=>start + i);
7602
+ }
7603
+
7604
+ const DEFAULT_LABELS = {
7605
+ first: 'First',
7606
+ prev: 'Previous',
7607
+ next: 'Next',
7608
+ last: 'Last',
7609
+ page: 'Page',
7610
+ of: 'of',
7611
+ showing: 'Showing',
7612
+ perPage: 'per page',
7613
+ goToPage: 'Go to page'
7614
+ };
7615
+ const DEFAULT_PAGE_SIZE_OPTIONS = [
7616
+ 10,
7617
+ 20,
7618
+ 50,
7619
+ 100
7620
+ ];
7621
+ /**
7622
+ * Dashforge TW `<Pagination>` — controlled pagination primitive.
7623
+ *
7624
+ * Three variants:
7625
+ * - `default` — page-size selector + summary + page numbers + nav buttons + jump input
7626
+ * - `compact` — page numbers + nav buttons only (no summary, no selector, no jump)
7627
+ * - `minimal` — "Page X of Y" + prev/next only
7628
+ *
7629
+ * Always controlled (no internal state besides the jump-input draft).
7630
+ *
7631
+ * A11Y:
7632
+ * - `<nav aria-label="Pagination">` root
7633
+ * - `aria-current="page"` on the active page button
7634
+ * - `aria-label` on every interactive element
7635
+ *
7636
+ * @example
7637
+ * ```tsx
7638
+ * const [page, setPage] = useState(1);
7639
+ * const [pageSize, setPageSize] = useState(20);
7640
+ *
7641
+ * <Pagination
7642
+ * page={page}
7643
+ * pageSize={pageSize}
7644
+ * totalCount={1437}
7645
+ * onPageChange={setPage}
7646
+ * onPageSizeChange={setPageSize}
7647
+ * />
7648
+ * ```
7649
+ */ function Pagination(props) {
7650
+ var _slotProps_root, _slotProps_summary, _slotProps_summary1, _slotProps_list, _slotProps_navButton, _slotProps_navButton1, _slotProps_navButton2, _slotProps_navButton3, _slotProps_pageSizeSelector, _slotProps_jumpInput;
7651
+ const { page, pageSize, totalCount, onPageChange, onPageSizeChange, pageSizeOptions = DEFAULT_PAGE_SIZE_OPTIONS, siblingCount = 1, boundaryCount = 1, showFirstLast = true, showJumpInput = true, disabled = false, labels: labelsProp, variant = 'default', size = 'md', sx, slotProps } = props;
7652
+ const labels = _extends({}, DEFAULT_LABELS, labelsProp);
7653
+ const v = paginationVariants({
7654
+ variant,
7655
+ size
7656
+ });
7657
+ const totalPages = Math.max(1, Math.ceil(totalCount / pageSize));
7658
+ const safePage = Math.min(Math.max(1, page), totalPages);
7659
+ const pages = computePageRange(safePage, totalPages, siblingCount, boundaryCount);
7660
+ // Summary range
7661
+ const firstItem = totalCount === 0 ? 0 : (safePage - 1) * pageSize + 1;
7662
+ const lastItem = Math.min(safePage * pageSize, totalCount);
7663
+ // Jump input local state (commit on Enter or blur)
7664
+ const [jumpDraft, setJumpDraft] = useState('');
7665
+ const goTo = useCallback((nextPage)=>{
7666
+ if (disabled) return;
7667
+ const clamped = Math.min(Math.max(1, nextPage), totalPages);
7668
+ if (clamped !== safePage) onPageChange(clamped);
7669
+ }, [
7670
+ disabled,
7671
+ totalPages,
7672
+ safePage,
7673
+ onPageChange
7674
+ ]);
7675
+ const commitJump = useCallback(()=>{
7676
+ const parsed = Number(jumpDraft);
7677
+ if (!Number.isFinite(parsed) || parsed < 1) {
7678
+ setJumpDraft('');
7679
+ return;
7680
+ }
7681
+ goTo(Math.floor(parsed));
7682
+ setJumpDraft('');
7683
+ }, [
7684
+ jumpDraft,
7685
+ goTo
7686
+ ]);
7687
+ const onJumpKeyDown = useCallback((e)=>{
7688
+ if (e.key === 'Enter') {
7689
+ e.preventDefault();
7690
+ commitJump();
7691
+ }
7692
+ }, [
7693
+ commitJump
7694
+ ]);
7695
+ const handlePageSize = useCallback((e)=>{
7696
+ if (!onPageSizeChange) return;
7697
+ const next = Number(e.target.value);
7698
+ if (Number.isFinite(next) && next > 0) onPageSizeChange(next);
7699
+ }, [
7700
+ onPageSizeChange
7701
+ ]);
7702
+ const isMinimal = variant === 'minimal';
7703
+ return jsxs("nav", {
7704
+ "aria-label": "Pagination",
7705
+ className: cn(v.root(), sx, slotProps == null ? void 0 : (_slotProps_root = slotProps.root) == null ? void 0 : _slotProps_root.className),
7706
+ children: [
7707
+ variant === 'default' && jsxs("span", {
7708
+ className: cn(v.summary(), slotProps == null ? void 0 : (_slotProps_summary = slotProps.summary) == null ? void 0 : _slotProps_summary.className),
7709
+ children: [
7710
+ labels.showing,
7711
+ " ",
7712
+ firstItem,
7713
+ "-",
7714
+ lastItem,
7715
+ " ",
7716
+ labels.of,
7717
+ " ",
7718
+ totalCount
7719
+ ]
7720
+ }),
7721
+ isMinimal && jsxs("span", {
7722
+ className: cn(v.summary(), 'text-sm', slotProps == null ? void 0 : (_slotProps_summary1 = slotProps.summary) == null ? void 0 : _slotProps_summary1.className),
7723
+ children: [
7724
+ labels.page,
7725
+ " ",
7726
+ safePage,
7727
+ " ",
7728
+ labels.of,
7729
+ " ",
7730
+ totalPages
7731
+ ]
7732
+ }),
7733
+ jsxs("ul", {
7734
+ className: cn(v.list(), slotProps == null ? void 0 : (_slotProps_list = slotProps.list) == null ? void 0 : _slotProps_list.className),
7735
+ children: [
7736
+ showFirstLast && !isMinimal && jsx("li", {
7737
+ children: jsx("button", {
7738
+ type: "button",
7739
+ "aria-label": labels.first,
7740
+ disabled: disabled || safePage === 1,
7741
+ onClick: ()=>goTo(1),
7742
+ className: cn(v.navButton(), slotProps == null ? void 0 : (_slotProps_navButton = slotProps.navButton) == null ? void 0 : _slotProps_navButton.className),
7743
+ children: "\u00AB"
7744
+ })
7745
+ }),
7746
+ jsx("li", {
7747
+ children: jsx("button", {
7748
+ type: "button",
7749
+ "aria-label": labels.prev,
7750
+ disabled: disabled || safePage === 1,
7751
+ onClick: ()=>goTo(safePage - 1),
7752
+ className: cn(v.navButton(), slotProps == null ? void 0 : (_slotProps_navButton1 = slotProps.navButton) == null ? void 0 : _slotProps_navButton1.className),
7753
+ children: "\u2039"
7754
+ })
7755
+ }),
7756
+ !isMinimal && pages.map((entry, idx)=>{
7757
+ var _slotProps_ellipsis, _slotProps_pageButton, _slotProps_activeButton;
7758
+ return entry === 'ellipsis' ? jsx("li", {
7759
+ children: jsx("span", {
7760
+ "aria-hidden": "true",
7761
+ className: cn(v.ellipsis(), slotProps == null ? void 0 : (_slotProps_ellipsis = slotProps.ellipsis) == null ? void 0 : _slotProps_ellipsis.className),
7762
+ children: "\u2026"
7763
+ })
7764
+ }, `e-${idx}`) : jsx("li", {
7765
+ children: jsx("button", {
7766
+ type: "button",
7767
+ "aria-label": `${labels.page} ${entry}`,
7768
+ "aria-current": entry === safePage ? 'page' : undefined,
7769
+ disabled: disabled,
7770
+ onClick: ()=>goTo(entry),
7771
+ className: cn(v.pageButton(), entry === safePage && v.activeButton(), slotProps == null ? void 0 : (_slotProps_pageButton = slotProps.pageButton) == null ? void 0 : _slotProps_pageButton.className, entry === safePage && (slotProps == null ? void 0 : (_slotProps_activeButton = slotProps.activeButton) == null ? void 0 : _slotProps_activeButton.className)),
7772
+ children: entry
7773
+ })
7774
+ }, entry);
7775
+ }),
7776
+ jsx("li", {
7777
+ children: jsx("button", {
7778
+ type: "button",
7779
+ "aria-label": labels.next,
7780
+ disabled: disabled || safePage === totalPages,
7781
+ onClick: ()=>goTo(safePage + 1),
7782
+ className: cn(v.navButton(), slotProps == null ? void 0 : (_slotProps_navButton2 = slotProps.navButton) == null ? void 0 : _slotProps_navButton2.className),
7783
+ children: "\u203A"
7784
+ })
7785
+ }),
7786
+ showFirstLast && !isMinimal && jsx("li", {
7787
+ children: jsx("button", {
7788
+ type: "button",
7789
+ "aria-label": labels.last,
7790
+ disabled: disabled || safePage === totalPages,
7791
+ onClick: ()=>goTo(totalPages),
7792
+ className: cn(v.navButton(), slotProps == null ? void 0 : (_slotProps_navButton3 = slotProps.navButton) == null ? void 0 : _slotProps_navButton3.className),
7793
+ children: "\u00BB"
7794
+ })
7795
+ })
7796
+ ]
7797
+ }),
7798
+ variant === 'default' && onPageSizeChange && jsxs("label", {
7799
+ className: cn(v.pageSizeSelector(), slotProps == null ? void 0 : (_slotProps_pageSizeSelector = slotProps.pageSizeSelector) == null ? void 0 : _slotProps_pageSizeSelector.className),
7800
+ children: [
7801
+ jsx("span", {
7802
+ className: "sr-only",
7803
+ children: labels.perPage
7804
+ }),
7805
+ jsx("select", {
7806
+ value: pageSize,
7807
+ onChange: handlePageSize,
7808
+ disabled: disabled,
7809
+ "aria-label": labels.perPage,
7810
+ className: cn('rounded-md border border-neutral-300 dark:border-neutral-700 bg-white dark:bg-neutral-900 px-2 py-1', 'focus:outline-none focus-visible:ring-2 focus-visible:ring-primary-500'),
7811
+ children: pageSizeOptions.map((opt)=>jsx("option", {
7812
+ value: opt,
7813
+ children: opt
7814
+ }, opt))
7815
+ }),
7816
+ jsx("span", {
7817
+ children: labels.perPage
7818
+ })
7819
+ ]
7820
+ }),
7821
+ variant === 'default' && showJumpInput && jsxs("label", {
7822
+ className: "inline-flex items-center gap-2",
7823
+ children: [
7824
+ jsx("span", {
7825
+ className: "sr-only",
7826
+ children: labels.goToPage
7827
+ }),
7828
+ jsx("input", {
7829
+ type: "number",
7830
+ min: 1,
7831
+ max: totalPages,
7832
+ value: jumpDraft,
7833
+ placeholder: labels.goToPage,
7834
+ disabled: disabled,
7835
+ onChange: (e)=>setJumpDraft(e.target.value),
7836
+ onKeyDown: onJumpKeyDown,
7837
+ onBlur: commitJump,
7838
+ "aria-label": labels.goToPage,
7839
+ className: cn(v.jumpInput(), slotProps == null ? void 0 : (_slotProps_jumpInput = slotProps.jumpInput) == null ? void 0 : _slotProps_jumpInput.className)
7840
+ })
7841
+ ]
7842
+ })
7843
+ ]
7844
+ });
7845
+ }
7846
+
6794
7847
  /**
6795
7848
  * @dashforge/tw
6796
7849
  *
@@ -6818,6 +7871,6 @@ VisuallyHidden.displayName = 'VisuallyHidden';
6818
7871
  */ // ───── Components ─────
6819
7872
  /**
6820
7873
  * Package version (synced with `package.json` at publish time).
6821
- */ const VERSION = '0.3.0-beta';
7874
+ */ const VERSION = '0.5.0-beta';
6822
7875
 
6823
- export { AppShell, AspectRatio, Autocomplete, Box, Breadcrumbs, Button, Checkbox, ConfirmDialogProvider, Container, DateTimePicker, Divider, Grid, LeftNav, NumberField, OTPField, RadioGroup, SnackbarProvider, Stack, Switch, TextField, Textarea, TopBar, Typography, VERSION, VisuallyHidden, appShellVariants, autocompleteVariants, boxVariants, breadcrumbsVariants, buttonVariants, checkboxVariants, cn, confirmDialogVariants, containerVariants, dateTimePickerVariants, dividerLineVariants, dividerVariants, gridVariants, isoToInputValue, leftNavVariants, numberFieldVariants, otpFieldVariants, radioGroupVariants, snackbarVariants, stackVariants, switchVariants, textFieldVariants, textareaVariants, topBarVariants, typographyVariants, useAccessState, useConfirm, useSnackbar };
7876
+ export { Accordion, AppShell, AspectRatio, Autocomplete, Box, Breadcrumbs, Button, Checkbox, ConfirmDialogProvider, Container, DateTimePicker, Dialog, Divider, Grid, LeftNav, NumberField, OTPField, Pagination, Popover, RadioGroup, Skeleton, SnackbarProvider, Stack, Switch, Tabs, TextField, Textarea, Tooltip, TopBar, Typography, VERSION, VisuallyHidden, accordionVariants, appShellVariants, autocompleteVariants, boxVariants, breadcrumbsVariants, buttonVariants, checkboxVariants, cn, confirmDialogVariants, containerVariants, dateTimePickerVariants, dialogVariants, dividerLineVariants, dividerVariants, gridVariants, isoToInputValue, leftNavVariants, numberFieldVariants, otpFieldVariants, paginationVariants, popoverVariants, radioGroupVariants, skeletonVariants, snackbarVariants, stackVariants, switchVariants, tabsVariants, textFieldVariants, textareaVariants, tooltipVariants, topBarVariants, typographyVariants, useAccessState, useConfirm, useSnackbar };