@nocoo/basalt 2.1.2 → 2.1.7
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/ai/INTEGRATION.md +17 -1
- package/ai/USAGE.md +1 -1
- package/ai/registry.json +75 -75
- package/dist/charts/charts.d.ts +1 -1
- package/dist/charts/charts.js +3 -16
- package/dist/charts/charts.js.map +1 -1
- package/dist/charts/custom-chart.d.ts +1 -1
- package/dist/charts/custom-chart.js +3 -16
- package/dist/charts/custom-chart.js.map +1 -1
- package/dist/charts/grouped-bar.d.ts +1 -1
- package/dist/charts/grouped-bar.js +11 -48
- package/dist/charts/grouped-bar.js.map +1 -1
- package/dist/charts/heatmap-calendar.js +80 -136
- package/dist/charts/heatmap-calendar.js.map +1 -1
- package/dist/charts/slot-bar.js +2 -12
- package/dist/charts/slot-bar.js.map +1 -1
- package/dist/charts/stat-card.js +2 -7
- package/dist/charts/stat-card.js.map +1 -1
- package/dist/charts/timeseries.d.ts +1 -1
- package/dist/charts/timeseries.js +3 -16
- package/dist/charts/timeseries.js.map +1 -1
- package/dist/charts/tooltip.js +13 -51
- package/dist/charts/tooltip.js.map +1 -1
- package/dist/components/autocomplete.d.ts +1 -1
- package/dist/components/autocomplete.js +3 -16
- package/dist/components/autocomplete.js.map +1 -1
- package/dist/components/banner.js +28 -28
- package/dist/components/banner.js.map +1 -1
- package/dist/components/button.js +6 -7
- package/dist/components/button.js.map +1 -1
- package/dist/components/chat-composer.js +1 -2
- package/dist/components/chat-composer.js.map +1 -1
- package/dist/components/checkbox.js +50 -82
- package/dist/components/checkbox.js.map +1 -1
- package/dist/components/code.js +1 -1
- package/dist/components/code.js.map +1 -1
- package/dist/components/combobox.d.ts +1 -1
- package/dist/components/combobox.js +3 -16
- package/dist/components/combobox.js.map +1 -1
- package/dist/components/context-menu.d.ts +1 -67
- package/dist/components/context-menu.js.map +1 -1
- package/dist/components/data-table.js +111 -123
- package/dist/components/data-table.js.map +1 -1
- package/dist/components/date-picker.js +236 -245
- package/dist/components/date-picker.js.map +1 -1
- package/dist/components/dock.js +15 -16
- package/dist/components/dock.js.map +1 -1
- package/dist/components/field.js +20 -23
- package/dist/components/field.js.map +1 -1
- package/dist/components/layer-card.d.ts +1 -1
- package/dist/components/layer-card.js +44 -51
- package/dist/components/layer-card.js.map +1 -1
- package/dist/components/skeleton-line.d.ts +2 -2
- package/dist/components/skeleton-line.js +1 -1
- package/dist/components/skeleton-line.js.map +1 -1
- package/dist/components/switch.js +46 -78
- package/dist/components/switch.js.map +1 -1
- package/dist/providers/accent.js +89 -198
- package/dist/providers/accent.js.map +1 -1
- package/dist/providers/theme.js +46 -144
- package/dist/providers/theme.js.map +1 -1
- package/dist/utils/preference-store.d.ts +16 -0
- package/dist/utils/preference-store.js +106 -0
- package/dist/utils/preference-store.js.map +1 -0
- package/dist/utils/use-checkable-group.d.ts +19 -0
- package/dist/utils/use-checkable-group.js +61 -0
- package/dist/utils/use-checkable-group.js.map +1 -0
- package/package.json +1 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combobox.js","names":[],"sources":["../../src/components/combobox.tsx"],"sourcesContent":["import type { ComponentPropsWithoutRef } from \"react\";\nimport type { InputSize } from \"./input\";\nimport { TypeaheadField, type TypeaheadItem } from \"./typeahead-field\";\n\nexport type ComboboxItem = TypeaheadItem;\n\nexport type ComboboxProps = Omit<\n\tComponentPropsWithoutRef<\"div\">,\n\t\"children\" | \"defaultValue\" | \"onChange\"\n> & {\n\t/**\n\t * Options shown in the list. Selection must match one of these values.\n\t */\n\titems: ComboboxItem[];\n\t/**\n\t * The controlled selected value.\n\t */\n\tvalue?: string;\n\t/**\n\t * The uncontrolled initial value.\n\t */\n\tdefaultValue?: string;\n\t/**\n\t * Called when the selected value changes.\n\t */\n\tonValueChange?: (value: string) => void;\n\t/**\n\t * Native form field name.\n\t */\n\tname?: string;\n\t/**\n\t * Placeholder shown when the field is empty.\n\t * @default Select…\n\t */\n\tplaceholder?: string;\n\t/**\n\t * Disable the field.\n\t * @default false\n\t */\n\tdisabled?: boolean;\n\t/**\n\t * Disable the field and mark it busy.\n\t * @default false\n\t */\n\tloading?: boolean;\n\t/**\n\t * The visual size of the field.\n\t * @default default\n\t */\n\tsize?: InputSize;\n};\n\nexport function Combobox({
|
|
1
|
+
{"version":3,"file":"combobox.js","names":[],"sources":["../../src/components/combobox.tsx"],"sourcesContent":["import type { ComponentPropsWithoutRef } from \"react\";\nimport type { InputSize } from \"./input\";\nimport { TypeaheadField, type TypeaheadItem } from \"./typeahead-field\";\n\nexport type ComboboxItem = TypeaheadItem;\n\nexport type ComboboxProps = Omit<\n\tComponentPropsWithoutRef<\"div\">,\n\t\"children\" | \"defaultValue\" | \"onChange\"\n> & {\n\t/**\n\t * Options shown in the list. Selection must match one of these values.\n\t */\n\titems: ComboboxItem[];\n\t/**\n\t * The controlled selected value.\n\t */\n\tvalue?: string;\n\t/**\n\t * The uncontrolled initial value.\n\t */\n\tdefaultValue?: string;\n\t/**\n\t * Called when the selected value changes.\n\t */\n\tonValueChange?: (value: string) => void;\n\t/**\n\t * Native form field name.\n\t */\n\tname?: string;\n\t/**\n\t * Placeholder shown when the field is empty.\n\t * @default Select…\n\t */\n\tplaceholder?: string;\n\t/**\n\t * Disable the field.\n\t * @default false\n\t */\n\tdisabled?: boolean;\n\t/**\n\t * Disable the field and mark it busy.\n\t * @default false\n\t */\n\tloading?: boolean;\n\t/**\n\t * The visual size of the field.\n\t * @default default\n\t */\n\tsize?: InputSize;\n};\n\nexport function Combobox({ placeholder = \"Select…\", ...rest }: ComboboxProps) {\n\treturn <TypeaheadField placeholder={placeholder} allowFreeform={false} {...rest} />;\n}\n"],"mappings":";;;;AAoDA,SAAgB,EAAS,EAAE,iBAAc,WAAW,GAAG,KAAuB;CAC7E,OAAO,kBAAC,GAAD;EAA6B;EAAa,eAAe;EAAO,GAAI;CAAO,CAAA;AACnF"}
|
|
@@ -136,47 +136,7 @@ export interface ContextMenuItemProps extends Omit<RadixContextMenuItemProps, "d
|
|
|
136
136
|
asChild?: RadixContextMenuItemProps["asChild"];
|
|
137
137
|
}
|
|
138
138
|
export declare const ContextMenuItem: React.ForwardRefExoticComponent<ContextMenuItemProps & React.RefAttributes<HTMLDivElement>>;
|
|
139
|
-
export interface ContextMenuPanelProps extends Omit<React.ComponentProps<typeof ContextMenuPrimitive.Content>, "
|
|
140
|
-
/**
|
|
141
|
-
* Whether keyboard navigation should loop around item boundaries.
|
|
142
|
-
* @default false
|
|
143
|
-
*/
|
|
144
|
-
loop?: RadixContextMenuContentProps["loop"];
|
|
145
|
-
/**
|
|
146
|
-
* Offset in pixels from the start or end alignment position.
|
|
147
|
-
* @default 0
|
|
148
|
-
*/
|
|
149
|
-
alignOffset?: RadixContextMenuContentProps["alignOffset"];
|
|
150
|
-
/**
|
|
151
|
-
* Whether to reposition content to avoid viewport boundary collisions.
|
|
152
|
-
* @default true
|
|
153
|
-
*/
|
|
154
|
-
avoidCollisions?: RadixContextMenuContentProps["avoidCollisions"];
|
|
155
|
-
/**
|
|
156
|
-
* Element or elements bounding boundary collision calculations.
|
|
157
|
-
* @default []
|
|
158
|
-
*/
|
|
159
|
-
collisionBoundary?: RadixContextMenuContentProps["collisionBoundary"];
|
|
160
|
-
/**
|
|
161
|
-
* Virtual padding from collision boundaries in pixels.
|
|
162
|
-
* @default 0
|
|
163
|
-
*/
|
|
164
|
-
collisionPadding?: RadixContextMenuContentProps["collisionPadding"];
|
|
165
|
-
/**
|
|
166
|
-
* Padding in pixels between popper arrow and floating panel edge.
|
|
167
|
-
* @default 0
|
|
168
|
-
*/
|
|
169
|
-
arrowPadding?: RadixContextMenuContentProps["arrowPadding"];
|
|
170
|
-
/**
|
|
171
|
-
* Sticky positioning behavior along the align axis when overflowing.
|
|
172
|
-
* @default "partial"
|
|
173
|
-
*/
|
|
174
|
-
sticky?: RadixContextMenuContentProps["sticky"];
|
|
175
|
-
/**
|
|
176
|
-
* Whether to hide content completely when trigger is fully occluded.
|
|
177
|
-
* @default false
|
|
178
|
-
*/
|
|
179
|
-
hideWhenDetached?: RadixContextMenuContentProps["hideWhenDetached"];
|
|
139
|
+
export interface ContextMenuPanelProps extends Omit<ContextMenuContentProps, "forceMount">, Pick<React.ComponentProps<typeof ContextMenuPrimitive.Content>, "ref"> {
|
|
180
140
|
/**
|
|
181
141
|
* Force mounting content in DOM for external animation controls.
|
|
182
142
|
* When forceMount is true, the content remains mounted even when closed.
|
|
@@ -184,32 +144,6 @@ export interface ContextMenuPanelProps extends Omit<React.ComponentProps<typeof
|
|
|
184
144
|
* Note: Keeping modal content forceMounted may isolate background interactions until unmounted.
|
|
185
145
|
*/
|
|
186
146
|
forceMount?: true;
|
|
187
|
-
/**
|
|
188
|
-
* Change the default rendered div element to the child element, merging props and behavior.
|
|
189
|
-
* Content forwards ref to HTMLDivElement and inherits native div attributes.
|
|
190
|
-
* @default false
|
|
191
|
-
*/
|
|
192
|
-
asChild?: RadixContextMenuContentProps["asChild"];
|
|
193
|
-
/**
|
|
194
|
-
* Callback fired when auto-focusing on close. Can be prevented.
|
|
195
|
-
*/
|
|
196
|
-
onCloseAutoFocus?: RadixContextMenuContentProps["onCloseAutoFocus"];
|
|
197
|
-
/**
|
|
198
|
-
* Callback fired when the Escape key is down on the dismissable layer. Can be prevented.
|
|
199
|
-
*/
|
|
200
|
-
onEscapeKeyDown?: RadixContextMenuContentProps["onEscapeKeyDown"];
|
|
201
|
-
/**
|
|
202
|
-
* Callback fired when a pointerdown event happens outside the bounds of the dismissable layer. Can be prevented.
|
|
203
|
-
*/
|
|
204
|
-
onPointerDownOutside?: RadixContextMenuContentProps["onPointerDownOutside"];
|
|
205
|
-
/**
|
|
206
|
-
* Callback fired when focus moves outside the bounds of the dismissable layer. Can be prevented.
|
|
207
|
-
*/
|
|
208
|
-
onFocusOutside?: RadixContextMenuContentProps["onFocusOutside"];
|
|
209
|
-
/**
|
|
210
|
-
* Callback fired when an interaction (pointerdown or focus) happens outside the bounds of the dismissable layer. Can be prevented.
|
|
211
|
-
*/
|
|
212
|
-
onInteractOutside?: RadixContextMenuContentProps["onInteractOutside"];
|
|
213
147
|
}
|
|
214
148
|
export declare function ContextMenuPanel({ className, ...props }: ContextMenuPanelProps): React.JSX.Element;
|
|
215
149
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-menu.js","names":[],"sources":["../../src/components/context-menu.tsx"],"sourcesContent":["import * as ContextMenuPrimitive from \"@radix-ui/react-context-menu\";\nimport * as React from \"react\";\nimport { cn } from \"../utils/cn\";\nimport { overlayItemClass, overlayPanelClass } from \"./overlay\";\n\ntype RadixContextMenuProps = React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Root>;\ntype RadixContextMenuTriggerProps = React.ComponentPropsWithoutRef<\n\ttypeof ContextMenuPrimitive.Trigger\n>;\ntype RadixContextMenuContentProps = React.ComponentPropsWithoutRef<\n\ttypeof ContextMenuPrimitive.Content\n>;\ntype RadixContextMenuItemProps = React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Item>;\n\nexport interface ContextMenuProps\n\textends Omit<RadixContextMenuProps, \"open\" | \"onOpenChange\" | \"dir\" | \"modal\"> {\n\t/**\n\t * Controlled open state of the context menu.\n\t * When set to true before pointer trigger interaction, positions at the top-left of the viewport.\n\t */\n\topen?: RadixContextMenuProps[\"open\"];\n\t/**\n\t * Callback invoked when open state changes.\n\t */\n\tonOpenChange?: RadixContextMenuProps[\"onOpenChange\"];\n\t/**\n\t * The reading direction of the context menu.\n\t * @default \"ltr\"\n\t */\n\tdir?: RadixContextMenuProps[\"dir\"];\n\t/**\n\t * Whether the context menu is modal, preventing outside interactions.\n\t * @default true\n\t */\n\tmodal?: RadixContextMenuProps[\"modal\"];\n}\n\nexport const ContextMenu = ContextMenuPrimitive.Root;\n\nexport interface ContextMenuTriggerProps\n\textends Omit<RadixContextMenuTriggerProps, \"disabled\" | \"asChild\"> {\n\t/**\n\t * Disable the context menu trigger from opening on right-click.\n\t * @default false\n\t */\n\tdisabled?: RadixContextMenuTriggerProps[\"disabled\"];\n\t/**\n\t * Change the default rendered span element to the child element, merging props and behavior.\n\t * Trigger forwards ref to HTMLSpanElement and inherits native span attributes.\n\t * @default false\n\t */\n\tasChild?: RadixContextMenuTriggerProps[\"asChild\"];\n}\n\nexport const ContextMenuTrigger = ContextMenuPrimitive.Trigger;\n\nexport interface ContextMenuContentProps\n\textends Omit<\n\t\tRadixContextMenuContentProps,\n\t\t| \"loop\"\n\t\t| \"alignOffset\"\n\t\t| \"avoidCollisions\"\n\t\t| \"collisionBoundary\"\n\t\t| \"collisionPadding\"\n\t\t| \"arrowPadding\"\n\t\t| \"sticky\"\n\t\t| \"hideWhenDetached\"\n\t\t| \"forceMount\"\n\t\t| \"asChild\"\n\t\t| \"onCloseAutoFocus\"\n\t\t| \"onEscapeKeyDown\"\n\t\t| \"onPointerDownOutside\"\n\t\t| \"onFocusOutside\"\n\t\t| \"onInteractOutside\"\n\t> {\n\t/**\n\t * Whether keyboard navigation should loop around item boundaries.\n\t * @default false\n\t */\n\tloop?: RadixContextMenuContentProps[\"loop\"];\n\t/**\n\t * Offset in pixels from the start or end alignment position.\n\t * @default 0\n\t */\n\talignOffset?: RadixContextMenuContentProps[\"alignOffset\"];\n\t/**\n\t * Whether to reposition content to avoid viewport boundary collisions.\n\t * @default true\n\t */\n\tavoidCollisions?: RadixContextMenuContentProps[\"avoidCollisions\"];\n\t/**\n\t * Element or elements bounding boundary collision calculations.\n\t * @default []\n\t */\n\tcollisionBoundary?: RadixContextMenuContentProps[\"collisionBoundary\"];\n\t/**\n\t * Virtual padding from collision boundaries in pixels.\n\t * @default 0\n\t */\n\tcollisionPadding?: RadixContextMenuContentProps[\"collisionPadding\"];\n\t/**\n\t * Padding in pixels between popper arrow and floating panel edge.\n\t * @default 0\n\t */\n\tarrowPadding?: RadixContextMenuContentProps[\"arrowPadding\"];\n\t/**\n\t * Sticky positioning behavior along the align axis when overflowing.\n\t * @default \"partial\"\n\t */\n\tsticky?: RadixContextMenuContentProps[\"sticky\"];\n\t/**\n\t * Whether to hide content completely when trigger is fully occluded.\n\t * @default false\n\t */\n\thideWhenDetached?: RadixContextMenuContentProps[\"hideWhenDetached\"];\n\t/**\n\t * Force mounting content in DOM for external animation controls.\n\t * Note: Bare ContextMenuContent mounts directly without a built-in Portal wrapper.\n\t */\n\tforceMount?: true;\n\t/**\n\t * Change the default rendered div element to the child element, merging props and behavior.\n\t * Content forwards ref to HTMLDivElement and inherits native div attributes.\n\t * @default false\n\t */\n\tasChild?: RadixContextMenuContentProps[\"asChild\"];\n\t/**\n\t * Callback fired when auto-focusing on close. Can be prevented.\n\t */\n\tonCloseAutoFocus?: RadixContextMenuContentProps[\"onCloseAutoFocus\"];\n\t/**\n\t * Callback fired when the Escape key is down on the dismissable layer. Can be prevented.\n\t */\n\tonEscapeKeyDown?: RadixContextMenuContentProps[\"onEscapeKeyDown\"];\n\t/**\n\t * Callback fired when a pointerdown event happens outside the bounds of the dismissable layer. Can be prevented.\n\t */\n\tonPointerDownOutside?: RadixContextMenuContentProps[\"onPointerDownOutside\"];\n\t/**\n\t * Callback fired when focus moves outside the bounds of the dismissable layer. Can be prevented.\n\t */\n\tonFocusOutside?: RadixContextMenuContentProps[\"onFocusOutside\"];\n\t/**\n\t * Callback fired when an interaction (pointerdown or focus) happens outside the bounds of the dismissable layer. Can be prevented.\n\t */\n\tonInteractOutside?: RadixContextMenuContentProps[\"onInteractOutside\"];\n}\n\nexport const ContextMenuContent = ContextMenuPrimitive.Content;\n\nexport interface ContextMenuItemProps\n\textends Omit<RadixContextMenuItemProps, \"disabled\" | \"onSelect\" | \"textValue\" | \"asChild\"> {\n\t/**\n\t * Disable the context menu item.\n\t * @default false\n\t */\n\tdisabled?: RadixContextMenuItemProps[\"disabled\"];\n\t/**\n\t * Event handler called when the context menu item is selected (via click or keyboard).\n\t */\n\tonSelect?: RadixContextMenuItemProps[\"onSelect\"];\n\t/**\n\t * Optional text used for typeahead navigation. By default typeahead uses item text content.\n\t */\n\ttextValue?: RadixContextMenuItemProps[\"textValue\"];\n\t/**\n\t * Change the default rendered div element to the child element, merging props and behavior.\n\t * Item forwards ref to HTMLDivElement and inherits native div attributes.\n\t * @default false\n\t */\n\tasChild?: RadixContextMenuItemProps[\"asChild\"];\n}\n\nexport const ContextMenuItem = React.forwardRef<\n\tReact.ElementRef<typeof ContextMenuPrimitive.Item>,\n\tContextMenuItemProps\n>(({ className, ...props }, ref) => (\n\t<ContextMenuPrimitive.Item\n\t\tref={ref}\n\t\tclassName={overlayItemClass(\n\t\t\tcn(\n\t\t\t\t\"relative outline-hidden focus:bg-basalt-accent data-disabled:pointer-events-none data-disabled:opacity-50\",\n\t\t\t\tclassName,\n\t\t\t),\n\t\t)}\n\t\t{...props}\n\t/>\n));\nContextMenuItem.displayName = ContextMenuPrimitive.Item.displayName;\n\nexport interface ContextMenuPanelProps\n\textends Omit<\n\t\tReact.ComponentProps<typeof ContextMenuPrimitive.Content>,\n\t\t| \"loop\"\n\t\t| \"alignOffset\"\n\t\t| \"avoidCollisions\"\n\t\t| \"collisionBoundary\"\n\t\t| \"collisionPadding\"\n\t\t| \"arrowPadding\"\n\t\t| \"sticky\"\n\t\t| \"hideWhenDetached\"\n\t\t| \"forceMount\"\n\t\t| \"asChild\"\n\t\t| \"onCloseAutoFocus\"\n\t\t| \"onEscapeKeyDown\"\n\t\t| \"onPointerDownOutside\"\n\t\t| \"onFocusOutside\"\n\t\t| \"onInteractOutside\"\n\t> {\n\t/**\n\t * Whether keyboard navigation should loop around item boundaries.\n\t * @default false\n\t */\n\tloop?: RadixContextMenuContentProps[\"loop\"];\n\t/**\n\t * Offset in pixels from the start or end alignment position.\n\t * @default 0\n\t */\n\talignOffset?: RadixContextMenuContentProps[\"alignOffset\"];\n\t/**\n\t * Whether to reposition content to avoid viewport boundary collisions.\n\t * @default true\n\t */\n\tavoidCollisions?: RadixContextMenuContentProps[\"avoidCollisions\"];\n\t/**\n\t * Element or elements bounding boundary collision calculations.\n\t * @default []\n\t */\n\tcollisionBoundary?: RadixContextMenuContentProps[\"collisionBoundary\"];\n\t/**\n\t * Virtual padding from collision boundaries in pixels.\n\t * @default 0\n\t */\n\tcollisionPadding?: RadixContextMenuContentProps[\"collisionPadding\"];\n\t/**\n\t * Padding in pixels between popper arrow and floating panel edge.\n\t * @default 0\n\t */\n\tarrowPadding?: RadixContextMenuContentProps[\"arrowPadding\"];\n\t/**\n\t * Sticky positioning behavior along the align axis when overflowing.\n\t * @default \"partial\"\n\t */\n\tsticky?: RadixContextMenuContentProps[\"sticky\"];\n\t/**\n\t * Whether to hide content completely when trigger is fully occluded.\n\t * @default false\n\t */\n\thideWhenDetached?: RadixContextMenuContentProps[\"hideWhenDetached\"];\n\t/**\n\t * Force mounting content in DOM for external animation controls.\n\t * When forceMount is true, the content remains mounted even when closed.\n\t * The caller is responsible for visibility transitions and unmounting after animation completes.\n\t * Note: Keeping modal content forceMounted may isolate background interactions until unmounted.\n\t */\n\tforceMount?: true;\n\t/**\n\t * Change the default rendered div element to the child element, merging props and behavior.\n\t * Content forwards ref to HTMLDivElement and inherits native div attributes.\n\t * @default false\n\t */\n\tasChild?: RadixContextMenuContentProps[\"asChild\"];\n\t/**\n\t * Callback fired when auto-focusing on close. Can be prevented.\n\t */\n\tonCloseAutoFocus?: RadixContextMenuContentProps[\"onCloseAutoFocus\"];\n\t/**\n\t * Callback fired when the Escape key is down on the dismissable layer. Can be prevented.\n\t */\n\tonEscapeKeyDown?: RadixContextMenuContentProps[\"onEscapeKeyDown\"];\n\t/**\n\t * Callback fired when a pointerdown event happens outside the bounds of the dismissable layer. Can be prevented.\n\t */\n\tonPointerDownOutside?: RadixContextMenuContentProps[\"onPointerDownOutside\"];\n\t/**\n\t * Callback fired when focus moves outside the bounds of the dismissable layer. Can be prevented.\n\t */\n\tonFocusOutside?: RadixContextMenuContentProps[\"onFocusOutside\"];\n\t/**\n\t * Callback fired when an interaction (pointerdown or focus) happens outside the bounds of the dismissable layer. Can be prevented.\n\t */\n\tonInteractOutside?: RadixContextMenuContentProps[\"onInteractOutside\"];\n}\n\nexport function ContextMenuPanel({ className, ...props }: ContextMenuPanelProps) {\n\treturn (\n\t\t<ContextMenuPrimitive.Portal forceMount={props.forceMount}>\n\t\t\t<ContextMenuPrimitive.Content\n\t\t\t\tclassName={overlayPanelClass(cn(\"min-w-40\", className))}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t</ContextMenuPrimitive.Portal>\n\t);\n}\n"],"mappings":";;;;;;;AAqCA,IAAa,IAAc,EAAqB,MAiBnC,IAAqB,EAAqB,SA8F1C,IAAqB,EAAqB,SAyB1C,IAAkB,EAAM,YAGlC,EAAE,cAAW,GAAG,KAAS,MAC3B,kBAAC,EAAqB,MAAtB;CACM;CACL,WAAW,EACV,EACC,6GACA,CACD,CACD;CACA,GAAI;AACJ,CAAA,CACD;AACD,EAAgB,cAAc,EAAqB,KAAK;AAgGxD,SAAgB,EAAiB,EAAE,cAAW,GAAG,KAAgC;CAChF,OACC,kBAAC,EAAqB,QAAtB;EAA6B,YAAY,EAAM;EAC9C,UAAA,kBAAC,EAAqB,SAAtB;GACC,WAAW,EAAkB,EAAG,YAAY,CAAS,CAAC;GACtD,GAAI;EACJ,CAAA;CAC2B,CAAA;AAE/B"}
|
|
1
|
+
{"version":3,"file":"context-menu.js","names":[],"sources":["../../src/components/context-menu.tsx"],"sourcesContent":["import * as ContextMenuPrimitive from \"@radix-ui/react-context-menu\";\nimport * as React from \"react\";\nimport { cn } from \"../utils/cn\";\nimport { overlayItemClass, overlayPanelClass } from \"./overlay\";\n\ntype RadixContextMenuProps = React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Root>;\ntype RadixContextMenuTriggerProps = React.ComponentPropsWithoutRef<\n\ttypeof ContextMenuPrimitive.Trigger\n>;\ntype RadixContextMenuContentProps = React.ComponentPropsWithoutRef<\n\ttypeof ContextMenuPrimitive.Content\n>;\ntype RadixContextMenuItemProps = React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Item>;\n\nexport interface ContextMenuProps\n\textends Omit<RadixContextMenuProps, \"open\" | \"onOpenChange\" | \"dir\" | \"modal\"> {\n\t/**\n\t * Controlled open state of the context menu.\n\t * When set to true before pointer trigger interaction, positions at the top-left of the viewport.\n\t */\n\topen?: RadixContextMenuProps[\"open\"];\n\t/**\n\t * Callback invoked when open state changes.\n\t */\n\tonOpenChange?: RadixContextMenuProps[\"onOpenChange\"];\n\t/**\n\t * The reading direction of the context menu.\n\t * @default \"ltr\"\n\t */\n\tdir?: RadixContextMenuProps[\"dir\"];\n\t/**\n\t * Whether the context menu is modal, preventing outside interactions.\n\t * @default true\n\t */\n\tmodal?: RadixContextMenuProps[\"modal\"];\n}\n\nexport const ContextMenu = ContextMenuPrimitive.Root;\n\nexport interface ContextMenuTriggerProps\n\textends Omit<RadixContextMenuTriggerProps, \"disabled\" | \"asChild\"> {\n\t/**\n\t * Disable the context menu trigger from opening on right-click.\n\t * @default false\n\t */\n\tdisabled?: RadixContextMenuTriggerProps[\"disabled\"];\n\t/**\n\t * Change the default rendered span element to the child element, merging props and behavior.\n\t * Trigger forwards ref to HTMLSpanElement and inherits native span attributes.\n\t * @default false\n\t */\n\tasChild?: RadixContextMenuTriggerProps[\"asChild\"];\n}\n\nexport const ContextMenuTrigger = ContextMenuPrimitive.Trigger;\n\nexport interface ContextMenuContentProps\n\textends Omit<\n\t\tRadixContextMenuContentProps,\n\t\t| \"loop\"\n\t\t| \"alignOffset\"\n\t\t| \"avoidCollisions\"\n\t\t| \"collisionBoundary\"\n\t\t| \"collisionPadding\"\n\t\t| \"arrowPadding\"\n\t\t| \"sticky\"\n\t\t| \"hideWhenDetached\"\n\t\t| \"forceMount\"\n\t\t| \"asChild\"\n\t\t| \"onCloseAutoFocus\"\n\t\t| \"onEscapeKeyDown\"\n\t\t| \"onPointerDownOutside\"\n\t\t| \"onFocusOutside\"\n\t\t| \"onInteractOutside\"\n\t> {\n\t/**\n\t * Whether keyboard navigation should loop around item boundaries.\n\t * @default false\n\t */\n\tloop?: RadixContextMenuContentProps[\"loop\"];\n\t/**\n\t * Offset in pixels from the start or end alignment position.\n\t * @default 0\n\t */\n\talignOffset?: RadixContextMenuContentProps[\"alignOffset\"];\n\t/**\n\t * Whether to reposition content to avoid viewport boundary collisions.\n\t * @default true\n\t */\n\tavoidCollisions?: RadixContextMenuContentProps[\"avoidCollisions\"];\n\t/**\n\t * Element or elements bounding boundary collision calculations.\n\t * @default []\n\t */\n\tcollisionBoundary?: RadixContextMenuContentProps[\"collisionBoundary\"];\n\t/**\n\t * Virtual padding from collision boundaries in pixels.\n\t * @default 0\n\t */\n\tcollisionPadding?: RadixContextMenuContentProps[\"collisionPadding\"];\n\t/**\n\t * Padding in pixels between popper arrow and floating panel edge.\n\t * @default 0\n\t */\n\tarrowPadding?: RadixContextMenuContentProps[\"arrowPadding\"];\n\t/**\n\t * Sticky positioning behavior along the align axis when overflowing.\n\t * @default \"partial\"\n\t */\n\tsticky?: RadixContextMenuContentProps[\"sticky\"];\n\t/**\n\t * Whether to hide content completely when trigger is fully occluded.\n\t * @default false\n\t */\n\thideWhenDetached?: RadixContextMenuContentProps[\"hideWhenDetached\"];\n\t/**\n\t * Force mounting content in DOM for external animation controls.\n\t * Note: Bare ContextMenuContent mounts directly without a built-in Portal wrapper.\n\t */\n\tforceMount?: true;\n\t/**\n\t * Change the default rendered div element to the child element, merging props and behavior.\n\t * Content forwards ref to HTMLDivElement and inherits native div attributes.\n\t * @default false\n\t */\n\tasChild?: RadixContextMenuContentProps[\"asChild\"];\n\t/**\n\t * Callback fired when auto-focusing on close. Can be prevented.\n\t */\n\tonCloseAutoFocus?: RadixContextMenuContentProps[\"onCloseAutoFocus\"];\n\t/**\n\t * Callback fired when the Escape key is down on the dismissable layer. Can be prevented.\n\t */\n\tonEscapeKeyDown?: RadixContextMenuContentProps[\"onEscapeKeyDown\"];\n\t/**\n\t * Callback fired when a pointerdown event happens outside the bounds of the dismissable layer. Can be prevented.\n\t */\n\tonPointerDownOutside?: RadixContextMenuContentProps[\"onPointerDownOutside\"];\n\t/**\n\t * Callback fired when focus moves outside the bounds of the dismissable layer. Can be prevented.\n\t */\n\tonFocusOutside?: RadixContextMenuContentProps[\"onFocusOutside\"];\n\t/**\n\t * Callback fired when an interaction (pointerdown or focus) happens outside the bounds of the dismissable layer. Can be prevented.\n\t */\n\tonInteractOutside?: RadixContextMenuContentProps[\"onInteractOutside\"];\n}\n\nexport const ContextMenuContent = ContextMenuPrimitive.Content;\n\nexport interface ContextMenuItemProps\n\textends Omit<RadixContextMenuItemProps, \"disabled\" | \"onSelect\" | \"textValue\" | \"asChild\"> {\n\t/**\n\t * Disable the context menu item.\n\t * @default false\n\t */\n\tdisabled?: RadixContextMenuItemProps[\"disabled\"];\n\t/**\n\t * Event handler called when the context menu item is selected (via click or keyboard).\n\t */\n\tonSelect?: RadixContextMenuItemProps[\"onSelect\"];\n\t/**\n\t * Optional text used for typeahead navigation. By default typeahead uses item text content.\n\t */\n\ttextValue?: RadixContextMenuItemProps[\"textValue\"];\n\t/**\n\t * Change the default rendered div element to the child element, merging props and behavior.\n\t * Item forwards ref to HTMLDivElement and inherits native div attributes.\n\t * @default false\n\t */\n\tasChild?: RadixContextMenuItemProps[\"asChild\"];\n}\n\nexport const ContextMenuItem = React.forwardRef<\n\tReact.ElementRef<typeof ContextMenuPrimitive.Item>,\n\tContextMenuItemProps\n>(({ className, ...props }, ref) => (\n\t<ContextMenuPrimitive.Item\n\t\tref={ref}\n\t\tclassName={overlayItemClass(\n\t\t\tcn(\n\t\t\t\t\"relative outline-hidden focus:bg-basalt-accent data-disabled:pointer-events-none data-disabled:opacity-50\",\n\t\t\t\tclassName,\n\t\t\t),\n\t\t)}\n\t\t{...props}\n\t/>\n));\nContextMenuItem.displayName = ContextMenuPrimitive.Item.displayName;\n\nexport interface ContextMenuPanelProps\n\textends Omit<ContextMenuContentProps, \"forceMount\">,\n\t\tPick<React.ComponentProps<typeof ContextMenuPrimitive.Content>, \"ref\"> {\n\t/**\n\t * Force mounting content in DOM for external animation controls.\n\t * When forceMount is true, the content remains mounted even when closed.\n\t * The caller is responsible for visibility transitions and unmounting after animation completes.\n\t * Note: Keeping modal content forceMounted may isolate background interactions until unmounted.\n\t */\n\tforceMount?: true;\n}\n\nexport function ContextMenuPanel({ className, ...props }: ContextMenuPanelProps) {\n\treturn (\n\t\t<ContextMenuPrimitive.Portal forceMount={props.forceMount}>\n\t\t\t<ContextMenuPrimitive.Content\n\t\t\t\tclassName={overlayPanelClass(cn(\"min-w-40\", className))}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t</ContextMenuPrimitive.Portal>\n\t);\n}\n"],"mappings":";;;;;;;AAqCA,IAAa,IAAc,EAAqB,MAiBnC,IAAqB,EAAqB,SA8F1C,IAAqB,EAAqB,SAyB1C,IAAkB,EAAM,YAGlC,EAAE,cAAW,GAAG,KAAS,MAC3B,kBAAC,EAAqB,MAAtB;CACM;CACL,WAAW,EACV,EACC,6GACA,CACD,CACD;CACA,GAAI;AACJ,CAAA,CACD;AACD,EAAgB,cAAc,EAAqB,KAAK;AAcxD,SAAgB,EAAiB,EAAE,cAAW,GAAG,KAAgC;CAChF,OACC,kBAAC,EAAqB,QAAtB;EAA6B,YAAY,EAAM;EAC9C,UAAA,kBAAC,EAAqB,SAAtB;GACC,WAAW,EAAkB,EAAG,YAAY,CAAS,CAAC;GACtD,GAAI;EACJ,CAAA;CAC2B,CAAA;AAE/B"}
|
|
@@ -4,31 +4,23 @@ import { Button as t } from "./button.js";
|
|
|
4
4
|
import { SkeletonLine as n } from "./skeleton-line.js";
|
|
5
5
|
import { Pagination as r } from "./pagination.js";
|
|
6
6
|
import { Table as i, TableBody as a, TableCell as o, TableHead as s, TableHeader as c, TableRow as l } from "./table.js";
|
|
7
|
-
import { useCallback as u, useEffect as d, useLayoutEffect as
|
|
8
|
-
import { jsx as
|
|
7
|
+
import { useCallback as u, useEffect as d, useLayoutEffect as ee, useMemo as te, useRef as f, useState as p } from "react";
|
|
8
|
+
import { jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
9
9
|
//#region src/components/data-table.tsx
|
|
10
|
-
function
|
|
11
|
-
return typeof e == "bigint" ? e : typeof e == "number" && Number.isFinite(e) && Number.isInteger(e) ? BigInt(e) : null;
|
|
12
|
-
}
|
|
13
|
-
function v(e, t) {
|
|
14
|
-
let n = BigInt(Math.trunc(e));
|
|
15
|
-
return n < t ? -1 : n > t || e > Number(n) ? 1 : -1;
|
|
16
|
-
}
|
|
17
|
-
function y(e) {
|
|
10
|
+
function g(e) {
|
|
18
11
|
return e === -Infinity ? 0 : typeof e == "bigint" || typeof e == "number" && Number.isFinite(e) ? 1 : e === Infinity ? 2 : typeof e == "number" ? 3 : typeof e == "string" ? 4 : 5;
|
|
19
12
|
}
|
|
20
|
-
function
|
|
21
|
-
let n =
|
|
13
|
+
function ne(e, t) {
|
|
14
|
+
let n = g(e), r = g(t);
|
|
22
15
|
if (n !== r) return n - r;
|
|
23
16
|
if (n === 1) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
return n !== null && r !== null ? n < r ? -1 : +(n > r) : typeof e == "number" && typeof t == "bigint" ? v(e, t) : typeof e == "bigint" && typeof t == "number" ? -v(t, e) : e - t;
|
|
17
|
+
let n = e, r = t;
|
|
18
|
+
return n < r ? -1 : +(n > r);
|
|
27
19
|
}
|
|
28
20
|
let i = String(e), a = String(t);
|
|
29
21
|
return i < a ? -1 : +(i > a);
|
|
30
22
|
}
|
|
31
|
-
function
|
|
23
|
+
function re(e, t, n, r) {
|
|
32
24
|
if (e === null) return "prim:null";
|
|
33
25
|
if (e === void 0) return "prim:undefined";
|
|
34
26
|
if (typeof e == "symbol") {
|
|
@@ -38,225 +30,221 @@ function ne(e, t, n, r) {
|
|
|
38
30
|
let i = typeof e;
|
|
39
31
|
return i === "number" ? Object.is(e, -0) ? "prim:number:-0" : `prim:number:${String(e)}` : i === "string" || i === "bigint" || i === "boolean" ? `prim:${i}:${String(e)}` : `prim:${t}`;
|
|
40
32
|
}
|
|
41
|
-
function
|
|
33
|
+
function _(e) {
|
|
42
34
|
return e.startsWith("dup:") || e.startsWith("gen:");
|
|
43
35
|
}
|
|
44
|
-
function
|
|
45
|
-
return e.startsWith("id:") || e.startsWith("get:");
|
|
46
|
-
}
|
|
47
|
-
function b(e) {
|
|
36
|
+
function v(e) {
|
|
48
37
|
return typeof e == "function" || typeof e == "object" && !!e;
|
|
49
38
|
}
|
|
50
|
-
function
|
|
39
|
+
function ie(e, t) {
|
|
51
40
|
if (e.filterValue) return String(e.filterValue(t));
|
|
52
41
|
if (e.sortValue) return String(e.sortValue(t));
|
|
53
42
|
let n = e.accessor(t);
|
|
54
43
|
return typeof n == "string" || typeof n == "number" || typeof n == "bigint" ? String(n) : "";
|
|
55
44
|
}
|
|
56
|
-
function
|
|
45
|
+
function y(e, t, n, r) {
|
|
57
46
|
let i = r?.(e, t);
|
|
58
|
-
return i === void 0 ?
|
|
47
|
+
return i === void 0 ? v(e) && "id" in e && e.id != null ? String(e.id) : n : i;
|
|
59
48
|
}
|
|
60
|
-
function
|
|
61
|
-
let [he, ge] =
|
|
62
|
-
|
|
63
|
-
}, [ve, ye] =
|
|
49
|
+
function b({ data: g, columns: b, filter: ae = "", loading: x = !1, empty: oe = "No results", selected: S, defaultSelected: C, onSelectedChange: w, multiple: se = !1, page: T, defaultPage: ce = 1, pageSize: E, onPageChange: le, getRowId: D, className: ue, sort: O, defaultSort: de = null, onSortChange: fe, manualSorting: k = !1, manualPagination: A = !1, manualFiltering: j = !1, total: M, error: N, onRetry: P, retryLabel: pe = "Try again", "aria-label": F = "Data table", "aria-describedby": me }) {
|
|
50
|
+
let [he, ge] = p(de), I = O === void 0 ? he : O, _e = (e) => {
|
|
51
|
+
O === void 0 && ge(e), fe?.(e);
|
|
52
|
+
}, [ve, ye] = p(C ?? []), [L, be] = p(ce), R = f(/* @__PURE__ */ new WeakMap()), z = f(0), B = f(/* @__PURE__ */ new WeakMap()), V = f(/* @__PURE__ */ new Map()), H = f(/* @__PURE__ */ new Map()), U = f(/* @__PURE__ */ new Map()), xe = f(/* @__PURE__ */ new Map()), W = ae.trim().toLowerCase(), G = te(() => {
|
|
64
53
|
let e = (e) => {
|
|
65
|
-
let t =
|
|
66
|
-
return t || (t = `basalt-row-${z.current++}`,
|
|
54
|
+
let t = R.current.get(e);
|
|
55
|
+
return t || (t = `basalt-row-${z.current++}`, R.current.set(e, t)), t;
|
|
67
56
|
}, t = (e, t) => {
|
|
68
|
-
let n =
|
|
57
|
+
let n = D?.(e, t);
|
|
69
58
|
if (n !== void 0) return `get:${n}`;
|
|
70
|
-
if (
|
|
59
|
+
if (v(e) && "id" in e) {
|
|
71
60
|
let t = e.id;
|
|
72
61
|
if (t != null) return `id:${String(t)}`;
|
|
73
62
|
}
|
|
74
|
-
}, n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), s =
|
|
75
|
-
if (!
|
|
76
|
-
let
|
|
77
|
-
|
|
78
|
-
let
|
|
79
|
-
if (
|
|
80
|
-
let e = i.get(
|
|
81
|
-
e.push(
|
|
63
|
+
}, n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), s = (e, n, s, c) => {
|
|
64
|
+
if (!c) return;
|
|
65
|
+
let l = a.get(c) ?? [];
|
|
66
|
+
l.push(s), a.set(c, l), o.set(s, c);
|
|
67
|
+
let u = t(e, n);
|
|
68
|
+
if (u && (r.set(u, s), _(s))) {
|
|
69
|
+
let e = i.get(u) ?? [];
|
|
70
|
+
e.push(s), i.set(u, e);
|
|
82
71
|
}
|
|
83
|
-
},
|
|
84
|
-
let n =
|
|
85
|
-
return n &&
|
|
72
|
+
}, c = /* @__PURE__ */ new WeakMap(), l = g.map((e, t) => {
|
|
73
|
+
let n = v(e) ? e : null, r = n ? c.get(n) ?? 0 : 0;
|
|
74
|
+
return n && c.set(n, r + 1), {
|
|
86
75
|
row: e,
|
|
87
76
|
index: t,
|
|
88
77
|
occurrence: r,
|
|
89
78
|
key: void 0
|
|
90
79
|
};
|
|
91
80
|
});
|
|
92
|
-
for (let e of
|
|
93
|
-
let t =
|
|
81
|
+
for (let e of l) {
|
|
82
|
+
let t = v(e.row) ? e.row : null;
|
|
94
83
|
if (!t) continue;
|
|
95
84
|
let r = B.current.get(t)?.[e.occurrence];
|
|
96
85
|
!r || n.has(r) || V.current.get(r) === t && (e.key = r, n.add(r));
|
|
97
86
|
}
|
|
98
|
-
let
|
|
99
|
-
let
|
|
100
|
-
if (o) return
|
|
87
|
+
let u = l.map(({ row: r, index: i, occurrence: a, key: o }) => {
|
|
88
|
+
let c = v(r) ? r : null;
|
|
89
|
+
if (o) return s(r, i, o, c), {
|
|
101
90
|
row: r,
|
|
102
91
|
key: o,
|
|
103
|
-
selectId:
|
|
92
|
+
selectId: y(r, i, o, D)
|
|
104
93
|
};
|
|
105
94
|
let l = a > 0, u, d = t(r, i);
|
|
106
|
-
if (d && (u = d),
|
|
107
|
-
let t = e(
|
|
95
|
+
if (d && (u = d), c) {
|
|
96
|
+
let t = e(c);
|
|
108
97
|
if (!u) u = l ? `gen:${t}#${a}` : `gen:${t}`;
|
|
109
98
|
else if (n.has(u) || l) u = (U.current.get(u) ?? []).find((e) => !n.has(e)) ?? (l ? `dup:${t}#${a}` : `dup:${t}`);
|
|
110
99
|
else {
|
|
111
100
|
let e = H.current.get(u);
|
|
112
|
-
e && !n.has(e) &&
|
|
101
|
+
e && !n.has(e) && _(e) && (u = e);
|
|
113
102
|
}
|
|
114
103
|
}
|
|
115
|
-
if (u ??=
|
|
104
|
+
if (u ??= re(r, i, xe.current, z), n.has(u)) {
|
|
116
105
|
let e = 0, t = `occ:${u}#${e}`;
|
|
117
106
|
for (; n.has(t);) e += 1, t = `occ:${u}#${e}`;
|
|
118
107
|
u = t;
|
|
119
108
|
}
|
|
120
|
-
return n.add(u),
|
|
109
|
+
return n.add(u), s(r, i, u, c), {
|
|
121
110
|
row: r,
|
|
122
111
|
key: u,
|
|
123
|
-
selectId:
|
|
112
|
+
selectId: y(r, i, u, D)
|
|
124
113
|
};
|
|
125
|
-
}),
|
|
114
|
+
}), d = W && !j ? u.filter(({ row: e }) => b.some((t) => ie(t, e).toLowerCase().includes(W))) : u;
|
|
126
115
|
return {
|
|
127
116
|
rows: (() => {
|
|
128
|
-
if (!
|
|
129
|
-
let e =
|
|
130
|
-
return e ? [...
|
|
131
|
-
let r =
|
|
132
|
-
return
|
|
133
|
-
}) :
|
|
117
|
+
if (!I || k) return d;
|
|
118
|
+
let e = b.find((e) => e.id === I.id);
|
|
119
|
+
return e ? [...d].sort((t, n) => {
|
|
120
|
+
let r = ne(e.sortValue?.(t.row) ?? e.accessor(t.row), e.sortValue?.(n.row) ?? e.accessor(n.row));
|
|
121
|
+
return I.dir === "asc" ? r : -r;
|
|
122
|
+
}) : d;
|
|
134
123
|
})(),
|
|
135
124
|
assigned: a,
|
|
136
125
|
owner: o,
|
|
137
|
-
canonical: s,
|
|
138
126
|
lastKey: r,
|
|
139
127
|
dups: i
|
|
140
128
|
};
|
|
141
129
|
}, [
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
130
|
+
b,
|
|
131
|
+
g,
|
|
132
|
+
D,
|
|
145
133
|
W,
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
134
|
+
I,
|
|
135
|
+
j,
|
|
136
|
+
k
|
|
149
137
|
]);
|
|
150
|
-
|
|
138
|
+
ee(() => {
|
|
151
139
|
for (let [e, t] of G.assigned) B.current.set(e, t);
|
|
152
|
-
V.current = G.owner,
|
|
140
|
+
V.current = G.owner, H.current = G.lastKey, U.current = G.dups;
|
|
153
141
|
}, [G]);
|
|
154
|
-
let K =
|
|
155
|
-
|
|
156
|
-
}, [
|
|
157
|
-
|
|
158
|
-
}, [le,
|
|
142
|
+
let K = S !== void 0 || C !== void 0 || w !== void 0, q = S ?? ve, J = u((e) => {
|
|
143
|
+
S === void 0 && ye(e), w?.(e);
|
|
144
|
+
}, [w, S]), Se = A && M !== void 0 ? Math.max(0, M) : G.rows.length, Y = E && E > 0 ? Math.max(1, Math.ceil(Se / E)) : 1, X = Math.min(Y, Math.max(1, T ?? L)), Z = u((e) => {
|
|
145
|
+
T === void 0 && be(e), le?.(e);
|
|
146
|
+
}, [le, T]), Q = f(null);
|
|
159
147
|
d(() => {
|
|
160
|
-
let e =
|
|
161
|
-
if (e ===
|
|
162
|
-
|
|
148
|
+
let e = T ?? L;
|
|
149
|
+
if (e === X || x) {
|
|
150
|
+
Q.current = null;
|
|
163
151
|
return;
|
|
164
152
|
}
|
|
165
|
-
let t = `${e}:${
|
|
166
|
-
|
|
153
|
+
let t = `${e}:${X}`;
|
|
154
|
+
Q.current !== t && (Q.current = t, Z(X));
|
|
167
155
|
}, [
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
156
|
+
T,
|
|
157
|
+
L,
|
|
158
|
+
X,
|
|
159
|
+
x,
|
|
160
|
+
Z
|
|
173
161
|
]);
|
|
174
|
-
let
|
|
162
|
+
let Ce = !A && E && E > 0 ? G.rows.slice((X - 1) * E, X * E) : G.rows, $ = b.length + +!!K, we = (e) => {
|
|
175
163
|
if (se) {
|
|
176
164
|
J(q.includes(e) ? q.filter((t) => t !== e) : [...q, e]);
|
|
177
165
|
return;
|
|
178
166
|
}
|
|
179
167
|
J(q.includes(e) ? [] : [e]);
|
|
180
168
|
};
|
|
181
|
-
return /* @__PURE__ */
|
|
169
|
+
return /* @__PURE__ */ h("div", {
|
|
182
170
|
className: "flex min-w-0 flex-col gap-3",
|
|
183
|
-
children: [/* @__PURE__ */
|
|
171
|
+
children: [/* @__PURE__ */ m("div", {
|
|
184
172
|
role: "region",
|
|
185
|
-
"aria-label": `${
|
|
173
|
+
"aria-label": `${F} scroll area`,
|
|
186
174
|
tabIndex: 0,
|
|
187
175
|
className: "min-w-0 overflow-x-auto rounded-basalt-md focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-basalt-primary",
|
|
188
|
-
children: /* @__PURE__ */
|
|
176
|
+
children: /* @__PURE__ */ h(i, {
|
|
189
177
|
className: e("w-full", ue),
|
|
190
|
-
"aria-label":
|
|
178
|
+
"aria-label": F,
|
|
191
179
|
"aria-describedby": me,
|
|
192
|
-
"aria-busy":
|
|
193
|
-
children: [/* @__PURE__ */
|
|
180
|
+
"aria-busy": x || void 0,
|
|
181
|
+
children: [/* @__PURE__ */ m(c, { children: /* @__PURE__ */ h(l, { children: [K ? /* @__PURE__ */ m(s, { children: /* @__PURE__ */ m("span", {
|
|
194
182
|
className: "sr-only",
|
|
195
183
|
children: "Select"
|
|
196
|
-
}) }) : null,
|
|
184
|
+
}) }) : null, b.map((e) => /* @__PURE__ */ m(s, {
|
|
197
185
|
className: e.headerClassName,
|
|
198
186
|
style: { width: e.width },
|
|
199
187
|
scope: "col",
|
|
200
|
-
"aria-sort": e.sortable === !1 ? void 0 :
|
|
201
|
-
children: e.sortable === !1 ? e.headerContent ?? e.header : /* @__PURE__ */
|
|
188
|
+
"aria-sort": e.sortable === !1 ? void 0 : I?.id === e.id ? I.dir === "asc" ? "ascending" : "descending" : "none",
|
|
189
|
+
children: e.sortable === !1 ? e.headerContent ?? e.header : /* @__PURE__ */ h("button", {
|
|
202
190
|
type: "button",
|
|
203
191
|
"aria-label": e.header,
|
|
204
192
|
className: "appearance-none border-0 bg-transparent p-0 font-inherit text-inherit font-medium cursor-pointer rounded-sm focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-basalt-primary",
|
|
205
|
-
onClick: () => _e(
|
|
193
|
+
onClick: () => _e(I?.id === e.id && I.dir === "asc" ? {
|
|
206
194
|
id: e.id,
|
|
207
195
|
dir: "desc"
|
|
208
196
|
} : {
|
|
209
197
|
id: e.id,
|
|
210
198
|
dir: "asc"
|
|
211
199
|
}),
|
|
212
|
-
children: [e.headerContent ?? e.header,
|
|
200
|
+
children: [e.headerContent ?? e.header, I?.id === e.id ? I.dir === "asc" ? " ↑" : " ↓" : ""]
|
|
213
201
|
})
|
|
214
|
-
}, e.id))] }) }), /* @__PURE__ */
|
|
202
|
+
}, e.id))] }) }), /* @__PURE__ */ m(a, { children: x ? /* @__PURE__ */ m(l, { children: /* @__PURE__ */ m(o, {
|
|
215
203
|
colSpan: $,
|
|
216
|
-
children: /* @__PURE__ */
|
|
204
|
+
children: /* @__PURE__ */ h("div", {
|
|
217
205
|
role: "status",
|
|
218
206
|
className: "flex flex-col gap-2 py-2",
|
|
219
207
|
children: [
|
|
220
|
-
/* @__PURE__ */
|
|
208
|
+
/* @__PURE__ */ m("span", {
|
|
221
209
|
className: "sr-only",
|
|
222
210
|
children: "Loading"
|
|
223
211
|
}),
|
|
224
|
-
/* @__PURE__ */
|
|
225
|
-
/* @__PURE__ */
|
|
226
|
-
/* @__PURE__ */
|
|
212
|
+
/* @__PURE__ */ m(n, {}),
|
|
213
|
+
/* @__PURE__ */ m(n, {}),
|
|
214
|
+
/* @__PURE__ */ m(n, {})
|
|
227
215
|
]
|
|
228
216
|
})
|
|
229
|
-
}) }) :
|
|
217
|
+
}) }) : N != null && N !== !1 ? /* @__PURE__ */ m(l, { children: /* @__PURE__ */ m(o, {
|
|
230
218
|
colSpan: $,
|
|
231
|
-
children: /* @__PURE__ */
|
|
219
|
+
children: /* @__PURE__ */ h("div", {
|
|
232
220
|
role: "alert",
|
|
233
221
|
className: "flex flex-wrap items-center justify-between gap-3 py-6",
|
|
234
|
-
children: [/* @__PURE__ */
|
|
222
|
+
children: [/* @__PURE__ */ m("div", { children: N }), P ? /* @__PURE__ */ m(t, {
|
|
235
223
|
variant: "outline",
|
|
236
224
|
size: "sm",
|
|
237
|
-
onClick:
|
|
225
|
+
onClick: P,
|
|
238
226
|
children: pe
|
|
239
227
|
}) : null]
|
|
240
228
|
})
|
|
241
|
-
}) }) :
|
|
229
|
+
}) }) : Ce.length === 0 ? /* @__PURE__ */ m(l, { children: /* @__PURE__ */ m(o, {
|
|
242
230
|
colSpan: $,
|
|
243
|
-
children: /* @__PURE__ */
|
|
231
|
+
children: /* @__PURE__ */ m("div", {
|
|
244
232
|
role: "status",
|
|
245
233
|
children: oe
|
|
246
234
|
})
|
|
247
|
-
}) }) :
|
|
235
|
+
}) }) : Ce.map(({ row: e, key: t, selectId: n }) => {
|
|
248
236
|
let r = q.includes(n);
|
|
249
|
-
return /* @__PURE__ */
|
|
237
|
+
return /* @__PURE__ */ h(l, {
|
|
250
238
|
variant: r ? "selected" : "default",
|
|
251
239
|
"aria-selected": K ? r : void 0,
|
|
252
|
-
children: [K ? /* @__PURE__ */
|
|
240
|
+
children: [K ? /* @__PURE__ */ m(o, { children: /* @__PURE__ */ m("input", {
|
|
253
241
|
type: "checkbox",
|
|
254
242
|
checked: r,
|
|
255
243
|
"aria-label": `Select ${n}`,
|
|
256
|
-
onChange: () =>
|
|
257
|
-
}) }) : null,
|
|
244
|
+
onChange: () => we(n)
|
|
245
|
+
}) }) : null, b.map((t) => {
|
|
258
246
|
let n = t.accessor(e);
|
|
259
|
-
return /* @__PURE__ */
|
|
247
|
+
return /* @__PURE__ */ m(o, {
|
|
260
248
|
className: t.cellClassName,
|
|
261
249
|
children: typeof n == "bigint" ? String(n) : n
|
|
262
250
|
}, t.id);
|
|
@@ -264,15 +252,15 @@ function S({ data: _, columns: v, filter: y = "", loading: S = !1, empty: oe = "
|
|
|
264
252
|
}, t);
|
|
265
253
|
}) })]
|
|
266
254
|
})
|
|
267
|
-
}),
|
|
268
|
-
page:
|
|
269
|
-
pageCount:
|
|
270
|
-
disabled:
|
|
271
|
-
onPageChange:
|
|
255
|
+
}), E && E > 0 ? /* @__PURE__ */ m(r, {
|
|
256
|
+
page: X,
|
|
257
|
+
pageCount: Y,
|
|
258
|
+
disabled: x,
|
|
259
|
+
onPageChange: Z
|
|
272
260
|
}) : null]
|
|
273
261
|
});
|
|
274
262
|
}
|
|
275
263
|
//#endregion
|
|
276
|
-
export {
|
|
264
|
+
export { b as DataTable };
|
|
277
265
|
|
|
278
266
|
//# sourceMappingURL=data-table.js.map
|