@accelint/design-toolkit 5.0.0 → 5.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/accordion/index.js +2 -0
- package/dist/components/accordion/styles.js +1 -1
- package/dist/components/accordion/styles.js.map +1 -1
- package/dist/components/action-bar/index.js +2 -0
- package/dist/components/action-bar/styles.d.ts +1 -1
- package/dist/components/action-bar/styles.js +1 -1
- package/dist/components/action-bar/styles.js.map +1 -1
- package/dist/components/avatar/index.js +2 -0
- package/dist/components/badge/index.js +2 -0
- package/dist/components/breadcrumbs/index.d.ts +15 -0
- package/dist/components/breadcrumbs/index.js +4 -0
- package/dist/components/breadcrumbs/index.js.map +1 -0
- package/dist/components/breadcrumbs/styles.d.ts +48 -0
- package/dist/components/breadcrumbs/styles.js +2 -0
- package/dist/components/breadcrumbs/styles.js.map +1 -0
- package/dist/components/breadcrumbs/types.d.ts +20 -0
- package/dist/components/breadcrumbs/types.js +2 -0
- package/dist/components/breadcrumbs/types.js.map +1 -0
- package/dist/components/button/index.d.ts +2 -2
- package/dist/components/button/index.js +3 -1
- package/dist/components/button/index.js.map +1 -1
- package/dist/components/button/styles.d.ts +15 -15
- package/dist/components/button/styles.js +1 -1
- package/dist/components/button/styles.js.map +1 -1
- package/dist/components/button/types.d.ts +7 -5
- package/dist/components/checkbox/index.js +2 -0
- package/dist/components/chip/index.js +2 -0
- package/dist/components/classification-badge/index.js +3 -1
- package/dist/components/classification-badge/index.js.map +1 -1
- package/dist/components/classification-badge/styles.d.ts +1 -1
- package/dist/components/classification-badge/styles.js +1 -1
- package/dist/components/classification-badge/styles.js.map +1 -1
- package/dist/components/classification-banner/index.js +3 -1
- package/dist/components/classification-banner/index.js.map +1 -1
- package/dist/components/classification-banner/styles.d.ts +1 -1
- package/dist/components/classification-banner/styles.js +1 -1
- package/dist/components/classification-banner/styles.js.map +1 -1
- package/dist/components/color-picker/index.js +2 -0
- package/dist/components/color-picker/styles.d.ts +3 -3
- package/dist/components/combobox-field/index.js +2 -0
- package/dist/components/combobox-field/styles.d.ts +1 -1
- package/dist/components/combobox-field/styles.js +1 -1
- package/dist/components/combobox-field/styles.js.map +1 -1
- package/dist/components/date-field/index.js +2 -0
- package/dist/components/date-field/index.js.map +1 -1
- package/dist/components/date-field/styles.d.ts +1 -1
- package/dist/components/date-field/styles.js +1 -1
- package/dist/components/date-field/styles.js.map +1 -1
- package/dist/components/details-list/index.js +2 -0
- package/dist/components/dialog/index.js +2 -0
- package/dist/components/dialog/styles.d.ts +1 -1
- package/dist/components/dialog/styles.js +1 -1
- package/dist/components/dialog/styles.js.map +1 -1
- package/dist/components/divider/index.d.ts +32 -0
- package/dist/components/divider/index.js +4 -0
- package/dist/components/divider/index.js.map +1 -0
- package/dist/components/divider/styles.d.ts +5 -0
- package/dist/components/divider/styles.js +2 -0
- package/dist/components/divider/styles.js.map +1 -0
- package/dist/components/divider/types.d.ts +11 -0
- package/dist/components/divider/types.js +2 -0
- package/dist/components/divider/types.js.map +1 -0
- package/dist/components/drawer/index.d.ts +12 -2
- package/dist/components/drawer/index.js +3 -1
- package/dist/components/drawer/index.js.map +1 -1
- package/dist/components/drawer/styles.d.ts +3 -3
- package/dist/components/drawer/styles.js +1 -1
- package/dist/components/drawer/styles.js.map +1 -1
- package/dist/components/drawer/types.d.ts +13 -7
- package/dist/components/hero/index.js +2 -0
- package/dist/components/hotkey/index.js +2 -0
- package/dist/components/icon/index.js +3 -1
- package/dist/components/icon/index.js.map +1 -1
- package/dist/components/input/index.js +2 -0
- package/dist/components/input/styles.js +1 -1
- package/dist/components/input/styles.js.map +1 -1
- package/dist/components/label/index.js +2 -0
- package/dist/components/link/index.js +2 -0
- package/dist/components/link/styles.d.ts +1 -1
- package/dist/components/link/styles.js +1 -1
- package/dist/components/link/styles.js.map +1 -1
- package/dist/components/menu/index.js +2 -0
- package/dist/components/menu/styles.js +1 -1
- package/dist/components/menu/styles.js.map +1 -1
- package/dist/components/options/index.js +2 -0
- package/dist/components/options/styles.d.ts +1 -1
- package/dist/components/options/styles.js +1 -1
- package/dist/components/options/styles.js.map +1 -1
- package/dist/components/popover/index.js +2 -0
- package/dist/components/popover/index.js.map +1 -1
- package/dist/components/query-builder/action-element.js +2 -0
- package/dist/components/query-builder/group.js +2 -0
- package/dist/components/query-builder/rule.js +2 -0
- package/dist/components/query-builder/value-editor.js +2 -0
- package/dist/components/radio/index.js +2 -0
- package/dist/components/search-field/index.js +2 -0
- package/dist/components/search-field/styles.js +1 -1
- package/dist/components/search-field/styles.js.map +1 -1
- package/dist/components/select-field/index.js +2 -0
- package/dist/components/select-field/types.d.ts +0 -1
- package/dist/components/sidenav/index.d.ts +16 -8
- package/dist/components/sidenav/index.js +3 -1
- package/dist/components/sidenav/index.js.map +1 -1
- package/dist/components/sidenav/styles.d.ts +43 -1
- package/dist/components/sidenav/styles.js +1 -1
- package/dist/components/sidenav/styles.js.map +1 -1
- package/dist/components/sidenav/types.d.ts +40 -8
- package/dist/components/slider/index.js +2 -0
- package/dist/components/slider/styles.d.ts +1 -1
- package/dist/components/slider/styles.js +1 -1
- package/dist/components/slider/styles.js.map +1 -1
- package/dist/components/switch/index.js +2 -0
- package/dist/components/table/context.d.ts +11 -0
- package/dist/components/table/context.js +2 -0
- package/dist/components/table/context.js.map +1 -0
- package/dist/components/table/index.d.ts +27 -0
- package/dist/components/table/index.js +4 -0
- package/dist/components/table/index.js.map +1 -0
- package/dist/components/table/styles.d.ts +134 -0
- package/dist/components/table/styles.js +2 -0
- package/dist/components/table/styles.js.map +1 -0
- package/dist/components/table/table-body.d.ts +12 -0
- package/dist/components/table/table-body.js +2 -0
- package/dist/components/table/table-body.js.map +1 -0
- package/dist/components/table/table-cell.d.ts +12 -0
- package/dist/components/table/table-cell.js +2 -0
- package/dist/components/table/table-cell.js.map +1 -0
- package/dist/components/table/table-header-cell.d.ts +12 -0
- package/dist/components/table/table-header-cell.js +2 -0
- package/dist/components/table/table-header-cell.js.map +1 -0
- package/dist/components/table/table-header.d.ts +12 -0
- package/dist/components/table/table-header.js +2 -0
- package/dist/components/table/table-header.js.map +1 -0
- package/dist/components/table/table-row.d.ts +12 -0
- package/dist/components/table/table-row.js +2 -0
- package/dist/components/table/table-row.js.map +1 -0
- package/dist/components/table/types.d.ts +185 -0
- package/dist/components/table/types.js +2 -0
- package/dist/components/table/types.js.map +1 -0
- package/dist/components/tabs/index.js +2 -0
- package/dist/components/tabs/styles.d.ts +1 -1
- package/dist/components/tabs/styles.js +1 -1
- package/dist/components/tabs/styles.js.map +1 -1
- package/dist/components/text-area-field/index.js +2 -0
- package/dist/components/text-field/index.js +2 -0
- package/dist/components/time-field/index.d.ts +10 -0
- package/dist/components/time-field/index.js +4 -0
- package/dist/components/time-field/index.js.map +1 -0
- package/dist/components/time-field/styles.d.ts +69 -0
- package/dist/components/time-field/styles.js +2 -0
- package/dist/components/time-field/styles.js.map +1 -0
- package/dist/components/time-field/types.d.ts +23 -0
- package/dist/components/time-field/types.js +2 -0
- package/dist/components/time-field/types.js.map +1 -0
- package/dist/components/tooltip/index.js +3 -1
- package/dist/components/tooltip/index.js.map +1 -1
- package/dist/components/tree/index.js +3 -1
- package/dist/components/tree/index.js.map +1 -1
- package/dist/components/tree/styles.js +1 -1
- package/dist/components/tree/styles.js.map +1 -1
- package/dist/components/view-stack/index.js +2 -0
- package/dist/foundation/token-data.js +1 -1
- package/dist/foundation/token-data.js.map +1 -1
- package/dist/hooks/use-tree/actions/cache.js +1 -1
- package/dist/hooks/use-tree/actions/cache.js.map +1 -1
- package/dist/hooks/use-tree/actions/index.js +2 -0
- package/dist/index.d.ts +21 -2
- package/dist/index.js +1 -1
- package/dist/metafile-esm.json +1 -1
- package/dist/providers/theme-provider.js +2 -0
- package/dist/styles.css +3079 -901
- package/dist/tokens/themes.css +56 -24
- package/dist/tokens/tokens.css +8 -8
- package/dist/tokens/tokens.d.ts +18 -0
- package/dist/tokens/tokens.js +1 -1
- package/dist/tokens/tokens.js.map +1 -1
- package/dist/tokens/types.d.ts +9 -0
- package/dist/variants/variants.css +3 -0
- package/package.json +12 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/sidenav/styles.ts"],"names":["
|
|
1
|
+
{"version":3,"sources":["../../../src/components/sidenav/styles.ts"],"names":["e"],"mappings":"sCAeE,MAAA,CAAO,CACLA,EAAA,CAAA,CAAA,KAAS,CACP,4HACA,CAAA,qBACA,CAAA,yCAGA,CAAA,CAAA,OAAA,CAAA,4IAGA,CAAA,MAAA,CAAA,CAAA,oJAEF,CAAA,CAAA,UAAY,CAAA,mCACG,CAAA,2DACf,CAAA,wKAIE,CAAA,0CACA,CAAA,qFACA,CAAA,8CAEO,CAAA,CAAA,cACA,CAAA,OAAA,CAAA,wBAEP,CAAA,IAAA,CAAA,CAAA,yGACA,CAAA,wDACA,CAAA,gIAEA,CAAA,2CACA,CAAA,yCACA,CAAA,gDACA,CAAA,wDACA,CAAA,oDACA,CAAA,kDAEI,CAAA,CAAA,IAAA,CAAA,+BACK,SAAA,CAAA,6BAET,CAAA,IAAA,CAAA,CAAA,yGACA,CAAA,0DACA,CAAA,0CACA,CAAA,qFACA,CAAA,2CACA,CAAA,kDAEO,CACP,CAAA,OAAA,CAAA,CAAA,gEACA,CAAA,yGAGF,CAAA,UACE,CAAA,CAAA,kFACA,CAAA,gCACA,CAAA,0CACA,CAAA,gIAEF,CAAA,CAAA,WAAa,CAAA,mBACF,SACT,CAAA,CAAA,yEAEF,CAAU,CACR,QAAA,CAAA,CAAA,wFACA,CAAA,4EACA,CAAA,0CACA,CAAA,iIAEA,CAAA,yCACA,CAAA,gDACA,CAAA,wDACA,CAAA,oDACA,CAAA,gEAGA,CAAA,yEACF,CAAA,YAAc,CAAA,qDAEjB,CAAA,CAAA","file":"styles.js","sourcesContent":["/*\n * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { tv } from '@/lib/utils';\n\nexport const SidenavStyles = tv({\n slots: {\n sidenav: [\n 'group/sidenav fg-a11y-on-accent absolute left-0 row-span-full flex h-full flex-col gap-xs bg-surface-default p-m',\n 'closed:items-center',\n 'group-data-[push~=left]/layout:relative',\n ],\n content:\n 'flex h-full max-h-full w-fit flex-col gap-xs group-open/sidenav:w-full group-closed/sidenav:items-center',\n header: 'mb-m flex justify-center',\n avatar: [\n 'grid w-full grid-cols-[auto_1fr] grid-rows-2 items-center gap-x-m [grid-template-areas:\"content_heading\"_\"content_text\"] group-closed/sidenav:flex',\n ],\n avatarIcon: '[grid-area:content]',\n avatarHeading: 'fg-primary-bold text-left text-body-m [grid-area:heading]',\n avatarText:\n 'fg-primary-muted grow-1 text-left text-body-s [grid-area:text]',\n toggle: [\n 'flex cursor-pointer items-center gap-s rounded-medium p-xs group-open/sidenav:px-s',\n 'enabled:hover:bg-interactive-muted-hover',\n 'enabled:focus-visible:bg-interactive-muted-hover enabled:focus-visible:outline-none',\n 'enabled:pressed:bg-interactive-muted-pressed',\n ],\n divider: 'my-s',\n heading: 'text-body-xs uppercase',\n item: [\n 'group/item flex w-full cursor-pointer items-center justify-center gap-s rounded-medium p-xs text-body-m',\n 'group-open/sidenav:px-s group-closed/sidenav:max-w-fit',\n 'enabled:hover:bg-interactive-muted-hover',\n 'enabled:focus-visible:bg-interactive-muted-hover enabled:focus-visible:outline-none',\n 'enabled:pressed:bg-accent-primary-pressed',\n 'enabled:selected:bg-accent-primary-bold',\n 'enabled:selected:hover:bg-accent-primary-hover',\n 'enabled:selected:focus-visible:bg-accent-primary-hover',\n 'enabled:selected:pressed:bg-accent-primary-pressed',\n 'disabled:fg-disabled disabled:cursor-not-allowed',\n ],\n text: 'grow-1 text-left text-body-s',\n transient: 'group-closed/sidenav:hidden',\n link: [\n 'group/link flex w-full cursor-pointer items-center justify-center gap-s rounded-medium p-xs text-body-m',\n 'group-open/sidenav:w-full group-closed/sidenav:max-w-fit',\n 'enabled:hover:bg-interactive-muted-hover',\n 'enabled:focus-visible:bg-interactive-muted-hover enabled:focus-visible:outline-none',\n 'enabled:pressed:bg-accent-primary-pressed',\n 'disabled:fg-disabled disabled:cursor-not-allowed',\n ],\n tooltip: [\n 'absolute flex items-center gap-s whitespace-nowrap text-body-s',\n 'group-disabled/item:fg-disabled group-disabled/link:fg-disabled',\n ],\n menu: 'group/menu relative text-body-s',\n menuButton: [\n 'flex w-full cursor-pointer items-center justify-center gap-s rounded-medium p-xs',\n 'group-closed/sidenav:max-w-fit',\n 'enabled:hover:bg-interactive-muted-hover',\n 'enabled:pressed:bg-interactive-muted-hover enabled:focus-visible:bg-interactive-muted-hover enabled:focus-visible:outline-none',\n ],\n menuHeading: 'flex-1 text-left',\n menuPanel: [\n 'fg-primary-bold rounded-medium bg-surface-raised outline outline-static',\n ],\n menuItem: [\n 'flex w-full cursor-pointer items-center gap-s rounded-medium p-s text-left text-body-s',\n 'group-expanded/menu:block group-open/sidenav:group-expanded/menu:pl-[32px]',\n 'enabled:hover:bg-interactive-muted-hover',\n 'enabled:focus-visible:bg-interactive-muted-hover enabled:focus-visible:outline-none',\n 'enabled:pressed:bg-accent-primary-pressed',\n 'enabled:selected:bg-accent-primary-bold',\n 'enabled:selected:hover:bg-accent-primary-hover',\n 'enabled:selected:focus-visible:bg-accent-primary-hover',\n 'enabled:selected:pressed:bg-accent-primary-pressed',\n 'disabled:fg-disabled disabled:cursor-not-allowed',\n ],\n panelHeading:\n 'min-w-[172px] rounded-t-medium bg-surface-overlay px-m py-s text-body-s',\n panelContent: 'flex flex-col gap-xs bg-surface-default px-xs py-xs',\n },\n});\n"]}
|
|
@@ -1,13 +1,17 @@
|
|
|
1
|
+
import { Payload } from '@accelint/bus';
|
|
2
|
+
import { UniqueId } from '@accelint/core';
|
|
1
3
|
import { ComponentPropsWithRef, PropsWithChildren } from 'react';
|
|
2
|
-
import { Pressable, ToggleButtonProps, LinkProps } from 'react-aria-components';
|
|
4
|
+
import { Pressable, ButtonProps, ToggleButtonProps, LinkProps, DisclosureProps, DisclosurePanelProps, PopoverProps } from 'react-aria-components';
|
|
5
|
+
import { SidenavEventTypes } from './events.js';
|
|
3
6
|
|
|
4
7
|
type SidenavProps = ComponentPropsWithRef<'nav'> & {
|
|
8
|
+
id: UniqueId;
|
|
5
9
|
isHiddenWhenClosed?: boolean;
|
|
6
10
|
};
|
|
7
11
|
type SidenavHeaderProps = PropsWithChildren<{
|
|
8
12
|
classNames?: {
|
|
9
13
|
header?: string;
|
|
10
|
-
button?:
|
|
14
|
+
button?: ButtonProps['className'];
|
|
11
15
|
container?: string;
|
|
12
16
|
icon?: string;
|
|
13
17
|
};
|
|
@@ -15,14 +19,14 @@ type SidenavHeaderProps = PropsWithChildren<{
|
|
|
15
19
|
type SidenavContentProps = ComponentPropsWithRef<'div'>;
|
|
16
20
|
type SidenavItemProps = ToggleButtonProps & {
|
|
17
21
|
classNames?: {
|
|
18
|
-
button?:
|
|
22
|
+
button?: ToggleButtonProps['className'];
|
|
19
23
|
icon?: string;
|
|
20
24
|
};
|
|
21
|
-
textValue
|
|
25
|
+
textValue?: string;
|
|
22
26
|
};
|
|
23
27
|
type SidenavLinkProps = LinkProps & {
|
|
24
28
|
classNames?: {
|
|
25
|
-
button?:
|
|
29
|
+
button?: LinkProps['className'];
|
|
26
30
|
icon?: string;
|
|
27
31
|
};
|
|
28
32
|
textValue: string;
|
|
@@ -30,9 +34,37 @@ type SidenavLinkProps = LinkProps & {
|
|
|
30
34
|
type SidenavAvatarProps = ComponentPropsWithRef<'div'>;
|
|
31
35
|
type SidenavDividerProps = ComponentPropsWithRef<'hr'>;
|
|
32
36
|
type SidenavFooterProps = ComponentPropsWithRef<'footer'>;
|
|
33
|
-
type
|
|
37
|
+
type SidenavCloseEvent = Payload<typeof SidenavEventTypes.close, {
|
|
38
|
+
id: UniqueId;
|
|
39
|
+
}>;
|
|
40
|
+
type SidenavOpenEvent = Payload<typeof SidenavEventTypes.open, {
|
|
41
|
+
id: UniqueId;
|
|
42
|
+
}>;
|
|
43
|
+
type SidenavToggleEvent = Payload<typeof SidenavEventTypes.toggle, {
|
|
44
|
+
id: UniqueId;
|
|
45
|
+
}>;
|
|
46
|
+
type SidenavEvent = SidenavOpenEvent | SidenavToggleEvent | SidenavCloseEvent;
|
|
47
|
+
type TargetedEvents = `close:${UniqueId}` | `open:${UniqueId}` | `toggle:${UniqueId}`;
|
|
48
|
+
type SidenavTriggerProps = ComponentPropsWithRef<typeof Pressable> & {
|
|
49
|
+
for: TargetedEvents | UniqueId;
|
|
50
|
+
};
|
|
34
51
|
type SidenavContextValue = {
|
|
35
|
-
|
|
52
|
+
id: UniqueId;
|
|
53
|
+
isOpen: boolean;
|
|
54
|
+
};
|
|
55
|
+
type SidenavMenuProps = {
|
|
56
|
+
title: string;
|
|
57
|
+
icon: React.ReactNode;
|
|
58
|
+
children: React.ReactNode;
|
|
59
|
+
classNames?: {
|
|
60
|
+
menu?: DisclosureProps['className'];
|
|
61
|
+
button?: ButtonProps['className'];
|
|
62
|
+
icon?: string;
|
|
63
|
+
disclosurePanel?: DisclosurePanelProps['className'];
|
|
64
|
+
popoverPanel?: PopoverProps['className'];
|
|
65
|
+
panelContent?: string;
|
|
66
|
+
};
|
|
36
67
|
};
|
|
68
|
+
type SidenavMenuItemProps = ToggleButtonProps;
|
|
37
69
|
|
|
38
|
-
export type { SidenavAvatarProps, SidenavContentProps, SidenavContextValue, SidenavDividerProps, SidenavFooterProps, SidenavHeaderProps, SidenavItemProps, SidenavLinkProps, SidenavProps, SidenavTriggerProps };
|
|
70
|
+
export type { SidenavAvatarProps, SidenavCloseEvent, SidenavContentProps, SidenavContextValue, SidenavDividerProps, SidenavEvent, SidenavFooterProps, SidenavHeaderProps, SidenavItemProps, SidenavLinkProps, SidenavMenuItemProps, SidenavMenuProps, SidenavOpenEvent, SidenavProps, SidenavToggleEvent, SidenavTriggerProps };
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
1
3
|
import {jsx,jsxs,Fragment}from'react/jsx-runtime';import'client-only';import {Fragment as Fragment$1}from'react';import {Slider,composeRenderProps,Label,Input,SliderTrack,SliderThumb,Text}from'react-aria-components';import {Tooltip}from'../tooltip/index.js';import {SliderStyles}from'./styles.js';const {slider:x,label:A,inputs:B,input:F,thumb:D,track:P,trackBackground:$,trackValue:z,minValue:C,maxValue:L}=SliderStyles(),I=({classNames:r,label:n,layout:T="grid",maxValue:d=100,minValue:c=0,orientation:b="horizontal",showInput:p,showLabel:s=true,...k})=>jsx(Slider,{...k,className:composeRenderProps(r?.slider,a=>x({className:a})),maxValue:d,minValue:c,orientation:b,"aria-label":s?void 0:n,"data-layout":T,children:({state:a})=>jsxs(Fragment,{children:[s&&jsx(Label,{className:A({className:r?.label}),children:n}),p&&jsx("div",{className:B({className:r?.inputs}),children:a.values.map((m,l)=>jsx(Input,{className:composeRenderProps(r?.input,i=>F({className:i})),value:m,onChange:i=>a.setThumbValue(l,Number.parseFloat(i.target.value))},`number-field-${l===0?"min":"max"}`))}),jsxs(SliderTrack,{className:composeRenderProps(r?.track,m=>P({className:m})),children:[jsx("div",{className:$({className:r?.trackBackground})}),a.values.map((m,l)=>jsxs(Fragment$1,{children:[jsx("div",{className:z({className:r?.trackValue}),"data-start":a.values.length===1?0:a.getThumbPercent(0),"data-end":a.getThumbPercent(a.values.length===1?0:1)}),jsxs(Tooltip,{isDisabled:!p||a.isThumbDragging(l),children:[jsx(Tooltip.Trigger,{children:jsx(SliderThumb,{index:l,className:composeRenderProps(r?.thumb,i=>D({className:i}))})}),jsx(Tooltip.Body,{placement:"top",children:a.getThumbValue(l)})]})]},`slider-${l===0?"min":"max"}`))]}),jsx(Text,{slot:"min",className:C({className:r?.minValue}),children:c}),jsx(Text,{slot:"max",className:L({className:r?.maxValue}),children:d})]})});export{I as Slider};//# sourceMappingURL=index.js.map
|
|
2
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {tv}from'
|
|
1
|
+
import {tv}from'./../../lib/utils.js';const t=tv({slots:{slider:["group/slider flex gap-s","layout-grid:grid","layout-stack:flex","orientation-vertical:h-full orientation-vertical:w-fit","orientation-vertical:layout-grid:grid-cols-[auto_auto_auto] orientation-vertical:layout-grid:grid-rows-[auto_auto_1fr_auto]","orientation-vertical:layout-stack:flex-col","orientation-horizontal:h-xl","orientation-horizontal:layout-grid:grid-cols-[auto_1fr_auto] orientation-horizontal:layout-grid:grid-rows-[auto_auto_auto]","orientation-horizontal:layout-stack:w-full orientation-horizontal:layout-stack:items-center"],label:["fg-primary-bold order-1","group-layout-grid/slider:col-start-1","group-orientation-vertical/slider:group-layout-grid/slider:col-span-2"],inputs:["order-5 flex gap-s","group-layout-grid/slider:col-start-3 group-layout-grid/slider:row-start-1","group-orientation-horizontal/slider:flex-row","group-orientation-vertical/slider:flex-col-reverse","group-orientation-vertical/slider:group-layout-grid/slider:row-start-4"],input:"fg-primary-bold w-[50px] rounded-medium px-s py-xs font-display text-body-m outline outline-interactive",track:["relative order-3 h-full","group-orientation-horizontal/slider:h-[20px] group-orientation-horizontal/slider:w-full","group-orientation-horizontal/slider:group-layout-grid/slider:col-span-3 group-orientation-horizontal/slider:group-layout-grid/slider:row-start-2","group-orientation-vertical/slider:h-full group-orientation-vertical/slider:w-[20px]","group-orientation-vertical/slider:group-layout-grid/slider:col-start-2 group-orientation-vertical/slider:group-layout-grid/slider:row-span-3 group-orientation-vertical/slider:group-layout-grid/slider:row-start-2"],trackBackground:["absolute rounded-full bg-surface-muted","group-orientation-horizontal/slider:-translate-y-1/2 group-orientation-horizontal/slider:top-1/2 group-orientation-horizontal/slider:h-xxs group-orientation-horizontal/slider:w-full","group-orientation-vertical/slider:-translate-x-1/2 group-orientation-vertical/slider:left-1/2 group-orientation-vertical/slider:h-full group-orientation-vertical/slider:w-xxs"],trackValue:["absolute rounded-full bg-accent-primary-bold","group-orientation-horizontal/slider:-translate-y-1/2 group-orientation-horizontal/slider:top-1/2 group-orientation-horizontal/slider:right-[calc(100%-attr(data-end_%)*100)] group-orientation-horizontal/slider:left-[calc(attr(data-start_%)*100)] group-orientation-horizontal/slider:h-xxs","group-orientation-vertical/slider:-translate-x-1/2 group-orientation-vertical/slider:top-[calc(100%-attr(data-end_%)*100)] group-orientation-vertical/slider:bottom-[calc(attr(data-start_%)*100)] group-orientation-vertical/slider:left-1/2 group-orientation-vertical/slider:w-xxs"],thumb:["h-m w-m rounded-full bg-accent-primary-bold outline-accent-primary-bold/40","focus-visible:outline-4","hover:outline-4","group-orientation-horizontal/slider:top-1/2","group-orientation-vertical/slider:left-1/2"],minValue:["fg-primary-muted flex items-center font-display text-body-m","group-orientation-vertical/slider:col-start-1 group-orientation-vertical/slider:row-start-4","group-orientation-horizontal/slider:group-layout-grid/slider:col-start-1","group-orientation-horizontal/slider:group-layout-grid/slider:row-start-3","group-orientation-horizontal/slider:order-2","group-orientation-vertical/slider:group-layout-grid/slider:self-end","group-orientation-vertical/slider:group-layout-grid/slider:justify-self-end","group-orientation-vertical/slider:order-4"],maxValue:["fg-primary-muted order-4 flex items-center font-display text-body-m","group-orientation-vertical/slider:order-2","group-orientation-vertical/slider:group-layout-grid/slider:col-start-1 group-orientation-vertical/slider:group-layout-grid/slider:row-start-2","group-orientation-vertical/slider:group-layout-grid/slider:justify-self-end","group-orientation-horizontal/slider:group-layout-grid/slider:col-start-3","group-orientation-horizontal/slider:group-layout-grid/slider:row-start-3","group-orientation-horizontal/slider:group-layout-grid/slider:justify-self-end"]}});export{t as SliderStyles};//# sourceMappingURL=styles.js.map
|
|
2
2
|
//# sourceMappingURL=styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/slider/styles.ts"],"names":["
|
|
1
|
+
{"version":3,"sources":["../../../src/components/slider/styles.ts"],"names":["r"],"mappings":"sCAcE,MAAA,CAAO,CACLA,EAAA,CAAA,CAAA,KACE,mCACA,CAAA,kBACA,CAAA,4EAEA,CAAA,6HACA,CAAA,0EAEA,CAAA,4HACA,CAAA,6FAGA,CAAA,CAAA,KAAA,CAAA,CAAA,yBACA,CAAA,8GAIA,CAAA,CAAA,MAAA,CAAA,CAAA,oBACA,CAAA,0HAEA,CAAA,oDACA,CAAA,wEAGA,CAAA,CAAA,KAAA,CAAA,yGAEA,CAAA,KAAA,CAAA,CAAA,mHAEA,CAAA,kJACA,CAAA,qFACA,CAAA,sOAGA,CAAA,CAAA,gOAEA,CAAA,4LAGA,CAAA,CAAA,+UAEA,CAAA,uRAGA,CAAA,CAAA,KAAA,CAAA,CAAA,sGAEA,CAAA,iBACA,CAAA,0FAGF,CAAU,CACR,QAAA,CAAA,CAAA,2JAEA,CAAA,0EACA,CAAA,wHAEA,CAAA,qEACA,CAAA,yHAGF,CAAU,CACR,QAAA,CAAA,CAAA,qEACA,CAAA,2LAEA,CAAA,6EACA,CAAA,qJAEA,CAAA,+EAGL,CAAA,CAAA,CAAA","file":"styles.js","sourcesContent":["/*\n * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport { tv } from '@/lib/utils';\n\nexport const SliderStyles = tv({\n slots: {\n slider: [\n 'group/slider flex gap-s',\n 'layout-grid:grid',\n 'layout-stack:flex',\n 'orientation-vertical:h-full orientation-vertical:w-fit',\n 'orientation-vertical:layout-grid:grid-cols-[auto_auto_auto] orientation-vertical:layout-grid:grid-rows-[auto_auto_1fr_auto]',\n 'orientation-vertical:layout-stack:flex-col',\n 'orientation-horizontal:h-xl',\n 'orientation-horizontal:layout-grid:grid-cols-[auto_1fr_auto] orientation-horizontal:layout-grid:grid-rows-[auto_auto_auto]',\n 'orientation-horizontal:layout-stack:w-full orientation-horizontal:layout-stack:items-center',\n ],\n label: [\n 'fg-primary-bold order-1',\n 'group-layout-grid/slider:col-start-1',\n 'group-orientation-vertical/slider:group-layout-grid/slider:col-span-2',\n ],\n inputs: [\n 'order-5 flex gap-s',\n 'group-layout-grid/slider:col-start-3 group-layout-grid/slider:row-start-1',\n 'group-orientation-horizontal/slider:flex-row',\n 'group-orientation-vertical/slider:flex-col-reverse',\n 'group-orientation-vertical/slider:group-layout-grid/slider:row-start-4',\n ],\n input:\n 'fg-primary-bold w-[50px] rounded-medium px-s py-xs font-display text-body-m outline outline-interactive',\n track: [\n 'relative order-3 h-full',\n 'group-orientation-horizontal/slider:h-[20px] group-orientation-horizontal/slider:w-full',\n 'group-orientation-horizontal/slider:group-layout-grid/slider:col-span-3 group-orientation-horizontal/slider:group-layout-grid/slider:row-start-2',\n 'group-orientation-vertical/slider:h-full group-orientation-vertical/slider:w-[20px]',\n 'group-orientation-vertical/slider:group-layout-grid/slider:col-start-2 group-orientation-vertical/slider:group-layout-grid/slider:row-span-3 group-orientation-vertical/slider:group-layout-grid/slider:row-start-2',\n ],\n trackBackground: [\n 'absolute rounded-full bg-surface-muted',\n 'group-orientation-horizontal/slider:-translate-y-1/2 group-orientation-horizontal/slider:top-1/2 group-orientation-horizontal/slider:h-xxs group-orientation-horizontal/slider:w-full',\n 'group-orientation-vertical/slider:-translate-x-1/2 group-orientation-vertical/slider:left-1/2 group-orientation-vertical/slider:h-full group-orientation-vertical/slider:w-xxs',\n ],\n trackValue: [\n 'absolute rounded-full bg-accent-primary-bold',\n 'group-orientation-horizontal/slider:-translate-y-1/2 group-orientation-horizontal/slider:top-1/2 group-orientation-horizontal/slider:right-[calc(100%-attr(data-end_%)*100)] group-orientation-horizontal/slider:left-[calc(attr(data-start_%)*100)] group-orientation-horizontal/slider:h-xxs',\n 'group-orientation-vertical/slider:-translate-x-1/2 group-orientation-vertical/slider:top-[calc(100%-attr(data-end_%)*100)] group-orientation-vertical/slider:bottom-[calc(attr(data-start_%)*100)] group-orientation-vertical/slider:left-1/2 group-orientation-vertical/slider:w-xxs',\n ],\n thumb: [\n 'h-m w-m rounded-full bg-accent-primary-bold outline-accent-primary-bold/40',\n 'focus-visible:outline-4',\n 'hover:outline-4',\n 'group-orientation-horizontal/slider:top-1/2',\n 'group-orientation-vertical/slider:left-1/2',\n ],\n minValue: [\n 'fg-primary-muted flex items-center font-display text-body-m',\n 'group-orientation-vertical/slider:col-start-1 group-orientation-vertical/slider:row-start-4',\n 'group-orientation-horizontal/slider:group-layout-grid/slider:col-start-1',\n 'group-orientation-horizontal/slider:group-layout-grid/slider:row-start-3',\n 'group-orientation-horizontal/slider:order-2',\n 'group-orientation-vertical/slider:group-layout-grid/slider:self-end',\n 'group-orientation-vertical/slider:group-layout-grid/slider:justify-self-end',\n 'group-orientation-vertical/slider:order-4',\n ],\n maxValue: [\n 'fg-primary-muted order-4 flex items-center font-display text-body-m',\n 'group-orientation-vertical/slider:order-2',\n 'group-orientation-vertical/slider:group-layout-grid/slider:col-start-1 group-orientation-vertical/slider:group-layout-grid/slider:row-start-2',\n 'group-orientation-vertical/slider:group-layout-grid/slider:justify-self-end',\n 'group-orientation-horizontal/slider:group-layout-grid/slider:col-start-3',\n 'group-orientation-horizontal/slider:group-layout-grid/slider:row-start-3',\n 'group-orientation-horizontal/slider:group-layout-grid/slider:justify-self-end',\n ],\n },\n});\n"]}
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
1
3
|
import {jsx,jsxs,Fragment}from'react/jsx-runtime';import'client-only';import {createContext}from'react';import {useContextProps,Switch,composeRenderProps}from'react-aria-components';import {SwitchStyles}from'./styles.js';const {switch:d,control:u,label:N}=SwitchStyles(),c=createContext(null);function a({children:t,...e}){return jsx(c.Provider,{value:e,children:t})}a.displayName="Switch.Provider";function l({ref:t,...e}){[e,t]=useContextProps(e,t??null,c);const{children:n,classNames:s,labelPosition:p="end",...m}=e;return jsx(Switch,{...m,ref:t,className:composeRenderProps(s?.switch,o=>d({className:o,labelPosition:p})),children:composeRenderProps(n,o=>jsxs(Fragment,{children:[jsx("span",{className:u({className:s?.control})}),o&&jsx("span",{className:N({className:s?.label}),children:o})]}))})}l.displayName="Switch",l.Provider=a;export{l as Switch,c as SwitchContext};//# sourceMappingURL=index.js.map
|
|
2
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { TableContextValue } from './types.js';
|
|
3
|
+
import '@react-types/shared';
|
|
4
|
+
import '@tanstack/react-table';
|
|
5
|
+
import 'tailwind-variants';
|
|
6
|
+
import './styles.js';
|
|
7
|
+
import 'tailwind-merge';
|
|
8
|
+
|
|
9
|
+
declare const TableContext: react.Context<TableContextValue>;
|
|
10
|
+
|
|
11
|
+
export { TableContext };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {createContext}from'react';const n=createContext({moveColumnLeft:()=>{},moveColumnRight:()=>{},setColumnSelection:()=>null,columnSelection:null,persistRowKebabMenu:true,persistHeaderKebabMenu:true,persistNumerals:true,enableSorting:true,enableColumnReordering:true,enableRowActions:true});export{n as TableContext};//# sourceMappingURL=context.js.map
|
|
2
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/table/context.tsx"],"names":["TableContext","createContext"],"mappings":"kCAgBO,MAAMA,CAAAA,CAAeC,aAAAA,CAAiC,CAC3D,cAAA,CAAgB,IAAG,CAAA,CAAA,CACnB,eAAA,CAAiB,IAAG,GACpB,kBAAA,CAAoB,IAAM,IAAA,CAC1B,eAAA,CAAiB,IAAA,CACjB,mBAAA,CAAqB,IAAA,CACrB,sBAAA,CAAwB,IAAA,CACxB,eAAA,CAAiB,IAAA,CACjB,aAAA,CAAe,IAAA,CACf,sBAAA,CAAwB,IAAA,CACxB,gBAAA,CAAkB,IACpB,CAAC","file":"context.js","sourcesContent":["/*\n * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { createContext } from 'react';\nimport type { TableContextValue } from './types';\n\n// Only keep values in context that are needed across multiple component levels\nexport const TableContext = createContext<TableContextValue>({\n moveColumnLeft: () => undefined,\n moveColumnRight: () => undefined,\n setColumnSelection: () => null,\n columnSelection: null,\n persistRowKebabMenu: true,\n persistHeaderKebabMenu: true,\n persistNumerals: true,\n enableSorting: true,\n enableColumnReordering: true,\n enableRowActions: true,\n});\n"]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { HeaderCell } from './table-header-cell.js';
|
|
2
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
|
+
import { TableBody } from './table-body.js';
|
|
4
|
+
import { TableCell } from './table-cell.js';
|
|
5
|
+
import { TableHeader } from './table-header.js';
|
|
6
|
+
import { TableRow } from './table-row.js';
|
|
7
|
+
import { Key } from '@react-types/shared';
|
|
8
|
+
import { TableProps } from './types.js';
|
|
9
|
+
import '@tanstack/react-table';
|
|
10
|
+
import 'react';
|
|
11
|
+
import 'tailwind-variants';
|
|
12
|
+
import './styles.js';
|
|
13
|
+
import 'tailwind-merge';
|
|
14
|
+
|
|
15
|
+
declare function Table<T extends {
|
|
16
|
+
id: Key;
|
|
17
|
+
}>({ children, columns: columnsProp, data: dataProp, showCheckbox, kebabPosition, persistRowKebabMenu, persistHeaderKebabMenu, persistNumerals, enableSorting, enableColumnOrdering: enableColumnReordering, enableRowActions, ...rest }: TableProps<T>): react_jsx_runtime.JSX.Element;
|
|
18
|
+
declare namespace Table {
|
|
19
|
+
var displayName: string;
|
|
20
|
+
var Body: typeof TableBody;
|
|
21
|
+
var Cell: typeof TableCell;
|
|
22
|
+
var Header: typeof TableHeader;
|
|
23
|
+
var HeaderCell: typeof HeaderCell;
|
|
24
|
+
var Row: typeof TableRow;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export { Table };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import {jsx,jsxs}from'react/jsx-runtime';import'client-only';import {Pin,Kebab}from'@accelint/icons';import {useListData}from'@react-stately/data';import {useReactTable,getSortedRowModel,getCoreRowModel}from'@tanstack/react-table';import {useState,useCallback,useMemo,useContext}from'react';import {Button}from'../button/index.js';import {Checkbox}from'../checkbox/index.js';import {Icon}from'../icon/index.js';import {Menu}from'../menu/index.js';import {TableContext}from'./context.js';import {TableStyles}from'./styles.js';import {TableBody}from'./table-body.js';import {TableCell}from'./table-cell.js';import {TableHeader}from'./table-header.js';import {HeaderCell}from'./table-header-cell.js';import {TableRow}from'./table-row.js';const{menuItem:v,notPersistRowKebab:ae}=TableStyles();function ce({moveRowsDown:R,moveRowsUp:g,row:i,rows:a}){const{enableRowActions:p,persistRowKebabMenu:S}=useContext(TableContext),c=!!i.getIsPinned();return p&&jsx("div",{className:S?"":ae(),children:jsxs(Menu.Trigger,{children:[jsx(Button,{variant:"icon","aria-label":"Menu",children:jsx(Icon,{children:jsx(Kebab,{})})}),jsxs(Menu,{children:[jsx(Menu.Item,{classNames:{item:v()},onAction:()=>i.pin(c?false:"top"),children:c?"Unpin":"Pin"}),jsx(Menu.Separator,{}),jsx(Menu.Item,{classNames:{item:v()},onAction:()=>g(i,a),isDisabled:c||i.index===0,children:"Move Up"}),jsx(Menu.Item,{classNames:{item:v()},onAction:()=>R(i,a),isDisabled:c||i.index===a.length-1,children:"Move Down"})]})]})})}function d({children:R,columns:g,data:i,showCheckbox:a,kebabPosition:p="right",persistRowKebabMenu:S=true,persistHeaderKebabMenu:c=true,persistNumerals:L=false,enableSorting:C=true,enableColumnOrdering:z=true,enableRowActions:k=true,...I}){const{items:q,moveAfter:y,moveBefore:P}=useListData({initialItems:i}),[r,E]=useState({}),[h,F]=useState(null),N=useCallback((e,t)=>{const n=r[e.id]?t.filter(({id:m})=>r[m]):[e],l=n[0];if(!l||l.index===0)return;const w=t[l.index-1]?.id;w&&P(w,n.map(({id:m})=>m));},[r,P]),x=useCallback((e,t)=>{const n=r[e.id]?t.filter(({id:m})=>r[m]):[e],l=n[n.length-1];if(!l||l.index===t.length-1)return;const w=t[l.index+1]?.id;w&&y(w,n.map(({id:m})=>m));},[r,y]),b=useMemo(()=>({id:"kebab",cell:({row:e})=>jsx(ce,{moveRowsUp:N,moveRowsDown:x,row:e,rows:X().rows})}),[N,x]),A=useMemo(()=>[{id:"numeral",cell:({row:e})=>e.getIsPinned()?jsx(Icon,{size:"small",children:jsx(Pin,{})}):jsx("span",{"data-testid":"numeral",children:e.index+1})},...a?[{id:"selection",header:({table:e})=>jsx(Checkbox,{isSelected:e.getIsAllRowsSelected(),isIndeterminate:e.getIsSomeRowsSelected(),onChange:e.toggleAllRowsSelected}),cell:({row:e})=>jsx(Checkbox,{isSelected:e.getIsSelected(),isIndeterminate:e.getIsSomeSelected(),onChange:e.toggleSelected})}]:[],...p==="left"?[b]:[],...g??[],...p==="right"?[b]:[]],[a,g,p,b]),{getHeaderGroups:J,getTopRows:Q,getCenterRows:V,getBottomRows:W,getRowModel:X,setColumnOrder:f}=useReactTable({data:q,columns:A,enableSorting:C,initialState:{columnOrder:A.map(e=>e.id)},state:{rowSelection:r},getRowId:(e,t)=>e.id?e.id.toString():t.toString(),enableRowSelection:true,onRowSelectionChange:E,getCoreRowModel:getCoreRowModel(),getSortedRowModel:getSortedRowModel()}),Y=useCallback(e=>{f(t=>{const s=[...t],n=e-1;return n<0?t:([s[e],s[n]]=[s[n],s[e]],s)});},[f]),Z=useCallback(e=>{f(t=>{const s=[...t],n=e+1;return n>=t.length?t:([s[e],s[n]]=[s[n],s[e]],s)});},[f]);return R?jsx("table",{...I,children:R}):jsx(TableContext.Provider,{value:{persistRowKebabMenu:S,persistHeaderKebabMenu:c,persistNumerals:L,enableSorting:C,enableColumnReordering:z,enableRowActions:k,columnSelection:h,setColumnSelection:F,moveColumnLeft:Y,moveColumnRight:Z},children:jsxs("table",{...I,children:[jsx(TableHeader,{headerGroups:J(),columnSelection:h}),jsx(TableBody,{rows:[...Q(),...V(),...W()]})]})})}d.displayName="Table",d.Body=TableBody,d.Cell=TableCell,d.Header=TableHeader,d.HeaderCell=HeaderCell,d.Row=TableRow;export{d as Table};//# sourceMappingURL=index.js.map
|
|
4
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/table/index.tsx"],"names":["moveRowsUp","ie","enableRowActions","useContext","TableContext","row","jsxs","Menu","Button","o","Kebab","se","menuItem","K","isPinned","M","u","jsx","rows","moveRowsDown","persistRowKebabMenu","enableSorting","data","dataProp","rowSelection","useState","columnSelection","rowsToMove","id","firstRowToMove","prevRowId","moveBefore","lastRowToMove","T","nextRowId","moveAfter","actionColumn","RowActionsMenu","columns","useMemo","Icon","D","showCheckbox","table","H","kebabPosition","getHeaderGroups","getTopRows","getBottomRows","useReactTable","col","index","setRowSelection","newColumnOrder","ee","newIndex","oe","oldIndex","order","setColumnOrder","children","rest","persistHeaderKebabMenu","O","TableBody","Table","TableCell","TableHeader","HeaderCell","TableRow"],"mappings":"ouBAkDE,CAAA,QAAA,CAAA,CAAAA,sBAIM,CAAE,CAAAC,WAAA,EAAA,CAAA,SAAA,E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M,IAAA,CAAOC,IACbD,CAAM,EAAA,CAAA,GAAA,CAASE,EACfF,CAAAA,GAAM,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAaG,CAAAA,CAAAA,CACnBH,CAAAA,CAAM,WAAMI,CAAAA,OAAAA,CAAAA,CAAAA,CAAAA,IAAAA,CAAAA,SAAAA,CAAAA,CAAAA,CAAAA,IAAAA,CAAAA,SAAAA,CAAAA,CAAAA,CAAAA,MAAAA,CAAAA,WAAAA,CAAAA,CAAAA,CAAAA,UAAAA,CAAAA,UAAAA,CAAAA,CAAAA,CAAAA,GAAAA,CAAAA,QAAAA","file":"index.js","sourcesContent":["/*\n * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n'use client';\n\nimport 'client-only';\nimport { Kebab, Pin } from '@accelint/icons';\nimport { useListData } from '@react-stately/data';\nimport {\n getCoreRowModel,\n getSortedRowModel,\n type Row,\n type RowSelectionState,\n useReactTable,\n} from '@tanstack/react-table';\nimport { useCallback, useContext, useMemo, useState } from 'react';\nimport { Button } from '../button';\nimport { Checkbox } from '../checkbox';\nimport { Icon } from '../icon';\nimport { Menu } from '../menu';\nimport { TableContext } from './context';\nimport { TableStyles } from './styles';\nimport { TableBody } from './table-body';\nimport { TableCell } from './table-cell';\nimport { TableHeader } from './table-header';\nimport { HeaderCell } from './table-header-cell';\nimport { TableRow } from './table-row';\nimport type { Key } from '@react-types/shared';\nimport type { TableProps } from './types';\n\nconst { menuItem, notPersistRowKebab } = TableStyles();\n\ntype RowActionsMenuProps<T> = {\n row: Row<T>;\n rows: Row<T>[];\n moveRowsDown: (row: Row<T>, rows: Row<T>[]) => void;\n moveRowsUp: (row: Row<T>, rows: Row<T>[]) => void;\n};\n\nfunction RowActionsMenu<T>({\n moveRowsDown,\n moveRowsUp,\n row,\n rows,\n}: RowActionsMenuProps<T>) {\n const { enableRowActions, persistRowKebabMenu } = useContext(TableContext);\n const isPinned = !!row.getIsPinned();\n\n return (\n enableRowActions && (\n <div className={persistRowKebabMenu ? '' : notPersistRowKebab()}>\n <Menu.Trigger>\n <Button variant='icon' aria-label='Menu'>\n <Icon>\n <Kebab />\n </Icon>\n </Button>\n <Menu>\n <Menu.Item\n classNames={{ item: menuItem() }}\n onAction={() => row.pin(isPinned ? false : 'top')}\n >\n {isPinned ? 'Unpin' : 'Pin'}\n </Menu.Item>\n <Menu.Separator />\n <Menu.Item\n classNames={{ item: menuItem() }}\n onAction={() => moveRowsUp(row, rows)}\n isDisabled={isPinned || row.index === 0}\n >\n Move Up\n </Menu.Item>\n <Menu.Item\n classNames={{ item: menuItem() }}\n onAction={() => moveRowsDown(row, rows)}\n isDisabled={isPinned || row.index === rows.length - 1}\n >\n Move Down\n </Menu.Item>\n </Menu>\n </Menu.Trigger>\n </div>\n )\n );\n}\n\nexport function Table<T extends { id: Key }>({\n children,\n columns: columnsProp,\n data: dataProp,\n showCheckbox,\n kebabPosition = 'right',\n persistRowKebabMenu = true,\n persistHeaderKebabMenu = true,\n persistNumerals = false,\n enableSorting = true,\n enableColumnOrdering: enableColumnReordering = true,\n enableRowActions = true,\n ...rest\n}: TableProps<T>) {\n const {\n items: data,\n moveAfter,\n moveBefore,\n } = useListData({\n initialItems: dataProp,\n });\n const [rowSelection, setRowSelection] = useState<RowSelectionState>({});\n const [columnSelection, setColumnSelection] = useState<string | null>(null);\n\n /**\n * moveUpSelectedRows moves the selected rows up in the table.\n * It finds the first selected row, determines its index,\n * and moves it before the previous row if it exists.\n */\n const moveRowsUp = useCallback(\n (row: Row<T>, rows: Row<T>[]) => {\n const isSelected = rowSelection[row.id];\n const rowsToMove = isSelected\n ? rows.filter(({ id }) => rowSelection[id])\n : [row];\n const firstRowToMove = rowsToMove[0];\n\n if (!firstRowToMove || firstRowToMove.index === 0) {\n return;\n }\n\n const prevRowId = rows[firstRowToMove.index - 1]?.id;\n\n if (!prevRowId) {\n return;\n }\n\n moveBefore(\n prevRowId,\n rowsToMove.map(({ id }) => id),\n );\n },\n [rowSelection, moveBefore],\n );\n\n /**\n * moveDownRows moves the selected or active rows down in the table.\n * It finds the last selected row, determines its index,\n * and moves it after the next row if it exists.\n */\n const moveRowsDown = useCallback(\n (row: Row<T>, rows: Row<T>[]) => {\n const isSelected = rowSelection[row.id];\n const rowsToMove = isSelected\n ? rows.filter(({ id }) => rowSelection[id])\n : [row];\n const lastRowToMove = rowsToMove[rowsToMove.length - 1];\n\n if (!lastRowToMove || lastRowToMove.index === rows.length - 1) {\n return;\n }\n\n const nextRowId = rows[lastRowToMove.index + 1]?.id;\n\n if (!nextRowId) {\n return;\n }\n\n moveAfter(\n nextRowId,\n rowsToMove.map(({ id }) => id),\n );\n },\n [rowSelection, moveAfter],\n );\n\n /**\n * actionColumn defines the actions available in the kebab menu for each row.\n * It includes options to move the row up or down in the table.\n */\n const actionColumn: NonNullable<typeof columnsProp>[number] = useMemo(\n () => ({\n id: 'kebab',\n cell: ({ row }) => (\n <RowActionsMenu\n moveRowsUp={moveRowsUp}\n moveRowsDown={moveRowsDown}\n row={row}\n rows={getRowModel().rows}\n />\n ),\n }),\n [moveRowsUp, moveRowsDown],\n );\n\n /**\n * columns defines the structure of the table.\n * It includes the action column and optionally a checkbox column.\n * The kebab menu position can be set to 'left' or 'right'.\n * If showCheckbox is true, a checkbox column is added.\n */\n const columns = useMemo<NonNullable<typeof columnsProp>>(\n () => [\n {\n id: 'numeral',\n cell: ({ row }) =>\n row.getIsPinned() ? (\n <Icon size='small'>\n <Pin />\n </Icon>\n ) : (\n <span data-testid='numeral'>{row.index + 1}</span>\n ),\n },\n ...(showCheckbox\n ? ([\n {\n id: 'selection',\n header: ({ table }) => (\n <Checkbox\n isSelected={table.getIsAllRowsSelected()}\n isIndeterminate={table.getIsSomeRowsSelected()}\n onChange={table.toggleAllRowsSelected}\n />\n ),\n cell: ({ row }) => (\n <Checkbox\n isSelected={row.getIsSelected()}\n isIndeterminate={row.getIsSomeSelected()}\n onChange={row.toggleSelected}\n />\n ),\n },\n ] satisfies NonNullable<typeof columnsProp>)\n : []),\n ...(kebabPosition === 'left' ? [actionColumn] : []),\n ...(columnsProp ?? []),\n ...(kebabPosition === 'right' ? [actionColumn] : []),\n ],\n [showCheckbox, columnsProp, kebabPosition, actionColumn],\n );\n\n const {\n getHeaderGroups,\n getTopRows,\n getCenterRows,\n getBottomRows,\n getRowModel,\n setColumnOrder,\n } = useReactTable<T>({\n data,\n columns,\n enableSorting,\n initialState: {\n // biome-ignore lint/style/noNonNullAssertion: <explanation>\n columnOrder: columns.map((col) => col.id!),\n },\n state: {\n rowSelection,\n },\n getRowId: (row, index) => {\n // Use the index as the row ID if no unique identifier is available\n return row.id ? row.id.toString() : index.toString();\n },\n enableRowSelection: true,\n onRowSelectionChange: setRowSelection,\n getCoreRowModel: getCoreRowModel<T>(),\n getSortedRowModel: getSortedRowModel<T>(),\n });\n\n const moveColumnLeft = useCallback(\n (oldIndex: number) => {\n setColumnOrder((order) => {\n const newColumnOrder = [...order];\n const newIndex = oldIndex - 1;\n\n if (newIndex < 0) {\n return order;\n }\n\n [newColumnOrder[oldIndex], newColumnOrder[newIndex]] = [\n newColumnOrder[newIndex] as string,\n newColumnOrder[oldIndex] as string,\n ];\n\n return newColumnOrder;\n });\n },\n [setColumnOrder],\n );\n\n const moveColumnRight = useCallback(\n (oldIndex: number) => {\n setColumnOrder((order) => {\n const newColumnOrder = [...order];\n const newIndex = oldIndex + 1;\n\n if (newIndex >= order.length) {\n return order;\n }\n\n [newColumnOrder[oldIndex], newColumnOrder[newIndex]] = [\n newColumnOrder[newIndex] as string,\n newColumnOrder[oldIndex] as string,\n ];\n\n return newColumnOrder;\n });\n },\n [setColumnOrder],\n );\n\n if (children) {\n return <table {...rest}>{children}</table>;\n }\n\n return (\n <TableContext.Provider\n value={{\n persistRowKebabMenu,\n persistHeaderKebabMenu,\n persistNumerals,\n enableSorting,\n enableColumnReordering,\n enableRowActions,\n columnSelection,\n setColumnSelection,\n moveColumnLeft,\n moveColumnRight,\n }}\n >\n <table {...rest}>\n <TableHeader\n headerGroups={getHeaderGroups()}\n columnSelection={columnSelection}\n />\n <TableBody\n rows={[...getTopRows(), ...getCenterRows(), ...getBottomRows()]}\n />\n </table>\n </TableContext.Provider>\n );\n}\n\nTable.displayName = 'Table';\nTable.Body = TableBody;\nTable.Cell = TableCell;\nTable.Header = TableHeader;\nTable.HeaderCell = HeaderCell;\nTable.Row = TableRow;\n"]}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import * as tailwind_merge from 'tailwind-merge';
|
|
2
|
+
import * as tailwind_variants from 'tailwind-variants';
|
|
3
|
+
|
|
4
|
+
declare const TableHeaderStyles: tailwind_variants.TVReturnType<{} | {} | {}, undefined, string[], {} | {}, undefined, tailwind_variants.TVReturnType<unknown, undefined, string[], unknown, unknown>>;
|
|
5
|
+
declare const TableCellStylesDefaults: {
|
|
6
|
+
readonly narrow: false;
|
|
7
|
+
readonly numeral: false;
|
|
8
|
+
readonly kebab: false;
|
|
9
|
+
readonly persistent: true;
|
|
10
|
+
};
|
|
11
|
+
declare const TableCellStyles: tailwind_variants.TVReturnType<{
|
|
12
|
+
narrow: {
|
|
13
|
+
true: string;
|
|
14
|
+
false: string;
|
|
15
|
+
};
|
|
16
|
+
isNumeral: {
|
|
17
|
+
true: string;
|
|
18
|
+
false: string;
|
|
19
|
+
};
|
|
20
|
+
notPersistNums: {
|
|
21
|
+
true: string;
|
|
22
|
+
false: string;
|
|
23
|
+
};
|
|
24
|
+
}, undefined, string[], {
|
|
25
|
+
narrow: {
|
|
26
|
+
true: string;
|
|
27
|
+
false: string;
|
|
28
|
+
};
|
|
29
|
+
isNumeral: {
|
|
30
|
+
true: string;
|
|
31
|
+
false: string;
|
|
32
|
+
};
|
|
33
|
+
notPersistNums: {
|
|
34
|
+
true: string;
|
|
35
|
+
false: string;
|
|
36
|
+
};
|
|
37
|
+
}, undefined, tailwind_variants.TVReturnType<{
|
|
38
|
+
narrow: {
|
|
39
|
+
true: string;
|
|
40
|
+
false: string;
|
|
41
|
+
};
|
|
42
|
+
isNumeral: {
|
|
43
|
+
true: string;
|
|
44
|
+
false: string;
|
|
45
|
+
};
|
|
46
|
+
notPersistNums: {
|
|
47
|
+
true: string;
|
|
48
|
+
false: string;
|
|
49
|
+
};
|
|
50
|
+
}, undefined, string[], unknown, unknown>>;
|
|
51
|
+
declare const TableHeaderCellStylesDefaults: {
|
|
52
|
+
readonly narrow: false;
|
|
53
|
+
};
|
|
54
|
+
declare const TableHeaderCellStyles: tailwind_variants.TVReturnType<{
|
|
55
|
+
narrow: {
|
|
56
|
+
true: string;
|
|
57
|
+
false: string;
|
|
58
|
+
};
|
|
59
|
+
isKebabEnabled: {
|
|
60
|
+
true: string;
|
|
61
|
+
false: string;
|
|
62
|
+
};
|
|
63
|
+
notPersistHeaderKebab: {
|
|
64
|
+
true: string;
|
|
65
|
+
false: string;
|
|
66
|
+
};
|
|
67
|
+
}, undefined, string[], {
|
|
68
|
+
narrow: {
|
|
69
|
+
true: string;
|
|
70
|
+
false: string;
|
|
71
|
+
};
|
|
72
|
+
isKebabEnabled: {
|
|
73
|
+
true: string;
|
|
74
|
+
false: string;
|
|
75
|
+
};
|
|
76
|
+
notPersistHeaderKebab: {
|
|
77
|
+
true: string;
|
|
78
|
+
false: string;
|
|
79
|
+
};
|
|
80
|
+
}, undefined, tailwind_variants.TVReturnType<{
|
|
81
|
+
narrow: {
|
|
82
|
+
true: string;
|
|
83
|
+
false: string;
|
|
84
|
+
};
|
|
85
|
+
isKebabEnabled: {
|
|
86
|
+
true: string;
|
|
87
|
+
false: string;
|
|
88
|
+
};
|
|
89
|
+
notPersistHeaderKebab: {
|
|
90
|
+
true: string;
|
|
91
|
+
false: string;
|
|
92
|
+
};
|
|
93
|
+
}, undefined, string[], unknown, unknown>>;
|
|
94
|
+
declare const TableRowStyles: tailwind_variants.TVReturnType<{} | {} | {}, undefined, string[], {} | {}, undefined, tailwind_variants.TVReturnType<unknown, undefined, string[], unknown, unknown>>;
|
|
95
|
+
declare const TableBodyStyles: tailwind_variants.TVReturnType<{} | {} | {}, undefined, string[], {} | {}, undefined, tailwind_variants.TVReturnType<unknown, undefined, string[], unknown, unknown>>;
|
|
96
|
+
declare const TableStyles: tailwind_variants.TVReturnType<{
|
|
97
|
+
[key: string]: {
|
|
98
|
+
[key: string]: tailwind_merge.ClassNameValue | {
|
|
99
|
+
base?: tailwind_merge.ClassNameValue;
|
|
100
|
+
menuItem?: tailwind_merge.ClassNameValue;
|
|
101
|
+
notPersistRowKebab?: tailwind_merge.ClassNameValue;
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
} | {
|
|
105
|
+
[x: string]: {
|
|
106
|
+
[x: string]: tailwind_merge.ClassNameValue | {
|
|
107
|
+
base?: tailwind_merge.ClassNameValue;
|
|
108
|
+
menuItem?: tailwind_merge.ClassNameValue;
|
|
109
|
+
notPersistRowKebab?: tailwind_merge.ClassNameValue;
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
} | {}, {
|
|
113
|
+
base: string;
|
|
114
|
+
menuItem: string;
|
|
115
|
+
notPersistRowKebab: string;
|
|
116
|
+
}, undefined, {
|
|
117
|
+
[key: string]: {
|
|
118
|
+
[key: string]: tailwind_merge.ClassNameValue | {
|
|
119
|
+
base?: tailwind_merge.ClassNameValue;
|
|
120
|
+
menuItem?: tailwind_merge.ClassNameValue;
|
|
121
|
+
notPersistRowKebab?: tailwind_merge.ClassNameValue;
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
} | {}, {
|
|
125
|
+
base: string;
|
|
126
|
+
menuItem: string;
|
|
127
|
+
notPersistRowKebab: string;
|
|
128
|
+
}, tailwind_variants.TVReturnType<unknown, {
|
|
129
|
+
base: string;
|
|
130
|
+
menuItem: string;
|
|
131
|
+
notPersistRowKebab: string;
|
|
132
|
+
}, undefined, unknown, unknown>>;
|
|
133
|
+
|
|
134
|
+
export { TableBodyStyles, TableCellStyles, TableCellStylesDefaults, TableHeaderCellStyles, TableHeaderCellStylesDefaults, TableHeaderStyles, TableRowStyles, TableStyles };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {tv}from'./../../lib/utils.js';const o=tv({base:["group/theader"]}),r={narrow:false,numeral:false,kebab:false,persistent:true},l=tv({base:["fg-primary-bold min-w-l row:bg-surface-raised text-left align-middle font-display text-body-s","selection-end:border-b-1 selection-end:border-b-[var(--outline-accent-primary-bold)]","selected:bg-accent-primary-muted selected:shadow-[1px_1px_0_0_var(--outline-accent-primary-bold),-1px_0_0_0_var(--outline-accent-primary-bold)]"],variants:{narrow:{true:"py-m text-center",false:"p-m"},isNumeral:{true:"fg-primary-muted hover:fg-primary-bold px-s group-not-pinned/row:*:invisible",false:""},notPersistNums:{true:"invisible hover:*:visible group-hover/row:*:visible",false:""}},defaultVariants:r}),t={narrow:false},s=tv({base:["group/header-cell group fg-primary-muted hover:fg-primary-bold flex h-12 items-center justify-between gap-xxs text-left align-middle font-medium text-body-s [&:has([role=checkbox])]:pr-0","selected:bg-accent-primary-muted","selected:shadow-[1px_0_0_0_var(--outline-accent-primary-bold),-1px_-1px_0_0_var(--outline-accent-primary-bold)]"],variants:{narrow:{true:"px-0 py-m",false:"p-m"},isKebabEnabled:{true:"pr-0",false:""},notPersistHeaderKebab:{true:"opacity-0 hover:opacity-100",false:""}},defaultVariants:{narrow:t.narrow}}),i=tv({base:["group/row","border-transparent group-not-selected/tbody:border-1","selected:bg-accent-primary-muted","selected:border-x-[var(--outline-accent-primary-bold)]","has-[+[data-selected]]:not-selected:border-b-[var(--outline-accent-primary-bold)]","not-has-[+[data-selected]]:data-selected:border-b-[var(--outline-accent-primary-bold)]","group-not-selected/tbody:first-of-type:border-t-[var(--outline-static)]","selected:first-of-type:border-t-[var(--outline-accent-primary-bold)]"]}),n=tv({base:["group/tbody"]}),d=tv({slots:{base:"group/table",menuItem:"cursor-pointer disabled:cursor-auto",notPersistRowKebab:"invisible hover:*:visible group-hover/row:*:visible"}});export{n as TableBodyStyles,l as TableCellStyles,r as TableCellStylesDefaults,s as TableHeaderCellStyles,t as TableHeaderCellStylesDefaults,o as TableHeaderStyles,i as TableRowStyles,d as TableStyles};//# sourceMappingURL=styles.js.map
|
|
2
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/table/styles.ts"],"names":["e","TableHeaderCellStylesDefaults","TableRowStyles"],"mappings":"sCAeE,MAAM,CAAC,CAAAA,EAAA,CAAA,CAAA,IAAA,CAAA,CAAA,eAIP,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CACR,MAAA,CAAA,KAAS,CAAA,OACF,CAAA,KACP,CAAA,KAAA,CAAA,KAAA,CAAA,UAIA,OAAM,CACJ,CAAAA,EAAA,CAAA,CAAA,IAAA,CAAA,CAAA,+FACA,CAAA,sFACA,CAAA,iJAEF,CAAU,CACR,QACE,CAAA,CAAA,MAAM,CAAA,CAAA,IAAA,CAAA,kBACC,CAAA,KAET,CAAA,KAAA,CAAA,CAAW,SACH,CAAA,CAAA,IAAA,CAAA,8EAER,CACA,KAAA,CAAA,EAAA,CAAA,CAAA,cACQ,CAAA,CAAA,IAAA,CAAA,qDAGV,CAAA,KACA,CAAA,EAAA,CAAA,CAAA,CAAA,eAIA,CAAA,CAAA,CAAA,CAAA,CAAQ,EACV,CAAA,MAGE,QAAM,CACJ,CAAAA,EAAA,CAAA,CAAA,IAAA,CAAA,CAAA,4LACA,CAAA,kCACA,CAAA,iHAEF,CAAU,CACR,QACE,CAAA,CAAA,MAAM,CAAA,CAAA,IAAA,CAAA,WACC,CAAA,KAET,CAAA,KAAA,CAAA,CAAA,oBAEE,CAAA,MACF,CACA,KAAA,CAAA,EAAA,CAAA,CAAA,qBACQ,CAAA,CAAA,IAAA,CAAA,6BAGV,CAAA,KACA,CAAA,EAAA,CAAA,CAAA,CAAA,eACUC,CAA8B,CAAA,MAE1C,CAAC,EAEYC,MACX,CAAA,CAAA,CAAA,CAAM,CACJ,CAAAF,EAAA,CAAA,CAAA,IAAA,CAAA,CAAA,WACA,CAAA,sDACA,CAAA,2FAGA,CAAA,mFACA,CAAA,wFACA,CAAA,yEACA,CAAA,sEAKF,CAAA,CAAA,CAAA,CAAM,CAAC,CAAAA,EAAA,CAAA,CAAA,IAAA,CAAA,CAAA,aAIP,CAAA,CAAA,CAAA,CAAA,CAAO,CACLA,EAAA,CAAA,CAAA,yBACU,CAAA,QAAA,CAAA,qCACV,CAAA,kBAAoB,CAAA,qDAEvB,CAAA,CAAA","file":"styles.js","sourcesContent":["/*\n * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { tv } from '@/lib/utils';\n\nexport const TableHeaderStyles = tv({\n base: ['group/theader'],\n});\n\nexport const TableCellStylesDefaults = {\n narrow: false,\n numeral: false,\n kebab: false,\n persistent: true,\n} as const;\n\nexport const TableCellStyles = tv({\n base: [\n 'fg-primary-bold min-w-l row:bg-surface-raised text-left align-middle font-display text-body-s',\n 'selection-end:border-b-1 selection-end:border-b-[var(--outline-accent-primary-bold)]',\n 'selected:bg-accent-primary-muted selected:shadow-[1px_1px_0_0_var(--outline-accent-primary-bold),-1px_0_0_0_var(--outline-accent-primary-bold)]',\n ],\n variants: {\n narrow: {\n true: 'py-m text-center',\n false: 'p-m',\n },\n isNumeral: {\n true: 'fg-primary-muted hover:fg-primary-bold px-s group-not-pinned/row:*:invisible',\n false: '',\n },\n notPersistNums: {\n true: 'invisible hover:*:visible group-hover/row:*:visible',\n false: '',\n },\n },\n defaultVariants: TableCellStylesDefaults,\n});\n\nexport const TableHeaderCellStylesDefaults = {\n narrow: false,\n} as const;\n\nexport const TableHeaderCellStyles = tv({\n base: [\n 'group/header-cell group fg-primary-muted hover:fg-primary-bold flex h-12 items-center justify-between gap-xxs text-left align-middle font-medium text-body-s [&:has([role=checkbox])]:pr-0',\n 'selected:bg-accent-primary-muted',\n 'selected:shadow-[1px_0_0_0_var(--outline-accent-primary-bold),-1px_-1px_0_0_var(--outline-accent-primary-bold)]',\n ],\n variants: {\n narrow: {\n true: 'px-0 py-m',\n false: 'p-m',\n },\n isKebabEnabled: {\n true: 'pr-0',\n false: '',\n },\n notPersistHeaderKebab: {\n true: 'opacity-0 hover:opacity-100',\n false: '',\n },\n },\n defaultVariants: {\n narrow: TableHeaderCellStylesDefaults.narrow,\n },\n});\n\nexport const TableRowStyles = tv({\n base: [\n 'group/row',\n 'border-transparent group-not-selected/tbody:border-1',\n 'selected:bg-accent-primary-muted',\n 'selected:border-x-[var(--outline-accent-primary-bold)]',\n /** Ensure border is applied to first and last selected rows */\n 'has-[+[data-selected]]:not-selected:border-b-[var(--outline-accent-primary-bold)]',\n 'not-has-[+[data-selected]]:data-selected:border-b-[var(--outline-accent-primary-bold)]',\n 'group-not-selected/tbody:first-of-type:border-t-[var(--outline-static)]',\n 'selected:first-of-type:border-t-[var(--outline-accent-primary-bold)]',\n ],\n});\n\nexport const TableBodyStyles = tv({\n base: ['group/tbody'],\n});\n\nexport const TableStyles = tv({\n slots: {\n base: 'group/table',\n menuItem: 'cursor-pointer disabled:cursor-auto',\n notPersistRowKebab: 'invisible hover:*:visible group-hover/row:*:visible',\n },\n});\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { TableBodyProps } from './types.js';
|
|
3
|
+
import '@react-types/shared';
|
|
4
|
+
import '@tanstack/react-table';
|
|
5
|
+
import 'react';
|
|
6
|
+
import 'tailwind-variants';
|
|
7
|
+
import './styles.js';
|
|
8
|
+
import 'tailwind-merge';
|
|
9
|
+
|
|
10
|
+
declare function TableBody<T>({ children, className, ref, rows, ...rest }: TableBodyProps<T>): react_jsx_runtime.JSX.Element;
|
|
11
|
+
|
|
12
|
+
export { TableBody };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {jsx}from'react/jsx-runtime';import {TableBodyStyles}from'./styles.js';import {TableRow}from'./table-row.js';function T({children:r,className:y,ref:p,rows:t,...a}){return jsx("tbody",{...a,ref:p,className:TableBodyStyles({className:y}),children:r||t?.map(o=>jsx(TableRow,{row:o},o.id))})}export{T as TableBody};//# sourceMappingURL=table-body.js.map
|
|
2
|
+
//# sourceMappingURL=table-body.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/table/table-body.tsx"],"names":["ref","rows","jsx","e","b","row"],"mappings":"oHAiBO,SACL,CAAA,CAAA,CAAA,QACA,CAAA,CAAA,CAAA,SACAA,CACA,KAAAC,CAAAA,CACA,CAAA,IACF,CAAsB,CACpB,CAAA,GAAA,CAAA,CAAA,CACEC,QAACC,GAAA,CAAA,OAEC,CAAA,CAAA,GACA,CAAA,CAAA,GAAA,CAAA,CAAA,CAAA,SACE,CAAAC,eAAA,CAAA,CAAA,SAGD,CAAA,CAAA,CAAA,CAAA,CAAA,QAAkB,CAAA,CAAA,EAAKC,CAAAA,EAAQH,GAAC,CAAsB,CAAA,EAAAC,GAAKE,CAAAA,QAAAA,CAAbA,CAAAA,GAAkB,CAAE,CAAA,CACrE,CAEJ,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA","file":"table-body.js","sourcesContent":["// __private-exports\n/*\n * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { TableBodyStyles } from './styles';\nimport { TableRow } from './table-row';\nimport type { TableBodyProps } from './types';\n\nexport function TableBody<T>({\n children,\n className,\n ref,\n rows,\n ...rest\n}: TableBodyProps<T>) {\n return (\n <tbody\n {...rest}\n ref={ref}\n className={TableBodyStyles({\n className,\n })}\n >\n {children || rows?.map((row) => <TableRow key={row.id} row={row} />)}\n </tbody>\n );\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { TableCellProps } from './types.js';
|
|
3
|
+
import '@react-types/shared';
|
|
4
|
+
import '@tanstack/react-table';
|
|
5
|
+
import 'react';
|
|
6
|
+
import 'tailwind-variants';
|
|
7
|
+
import './styles.js';
|
|
8
|
+
import 'tailwind-merge';
|
|
9
|
+
|
|
10
|
+
declare function TableCell<T>({ children, ref, className, cell, ...rest }: TableCellProps<T>): react_jsx_runtime.JSX.Element;
|
|
11
|
+
|
|
12
|
+
export { TableCell };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {jsx}from'react/jsx-runtime';import {flexRender}from'@tanstack/react-table';import {useContext}from'react';import {TableContext}from'./context.js';import {TableCellStyles}from'./styles.js';function y({children:t,ref:n,className:r,cell:e,...s}){const{columnSelection:l,persistNumerals:m}=useContext(TableContext),a=e?.column.id==="kebab",o=e?.column.id==="numeral",i=e?.column.id===l;return jsx("td",{...s,ref:n,className:TableCellStyles({className:r,narrow:o||a,isNumeral:o,notPersistNums:o&&!m}),"data-selected":i||null,children:t||e&&flexRender(e.column.columnDef.cell,e.getContext())})}export{y as TableCell};//# sourceMappingURL=table-cell.js.map
|
|
2
|
+
//# sourceMappingURL=table-cell.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/table/table-cell.tsx"],"names":["ref","cell","isKebab","p","isNumeral","jsx","d","b","flexRender","u"],"mappings":"oMAmBO,SACL,CAAA,CAAA,CAAA,QACAA,CACA,CAAA,CAAA,GAAA,CAAA,CAAA,CAAA,SACAC,CAAAA,CACA,KACF,CAAsB,CACpB,CAAA,GAAA,CAAM,CAAE,uBAAiB,CAAA,CAAA,CAAA,eAA2C,CAC9DC,CAAAA,CAAUD,CAAAA,UAAAA,CAAME,YAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAO,MAAO,CAAA,EAAA,GAC9BC,OAAkB,CAAA,CAAA,CAAA,CAAA,QAAc,CAAA,EAAA,GAAA,SACb,CAAA,CAAA,CAAA,CAAA,EAAO,MAIhC,CAAA,EAAA,GAAA,CACEC,CAAAA,OACGC,GAAA,CAAA,SAED,CAAA,CAAA,GAAA,CAAA,CAAA,CAAA,SACE,CAAAC,eAAA,CAAA,CAAA,SACA,CAAA,CATSH,CAAAA,qBAWT,CAAA,CAAA,CAAA,cACD,CACD,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,eAA6B,CAE5B,CAAA,EAAA,IAAA,CAAA,QACUI,CAAWP,GAAK,CAAA,EAAAQ,UAAA,CAAA,CAAO,CAAA,MAAA,CAAA,SAAqB,CAAA,IAAA,CAAA,CAAA,CAAA,UAG7D,EAAA,CAAA,CAAA,CAAA","file":"table-cell.js","sourcesContent":["// __private-exports\n/*\n * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { flexRender } from '@tanstack/react-table';\nimport { useContext } from 'react';\nimport { TableContext } from './context';\nimport { TableCellStyles } from './styles';\nimport type { TableCellProps } from './types';\n\nexport function TableCell<T>({\n children,\n ref,\n className,\n cell,\n ...rest\n}: TableCellProps<T>) {\n const { columnSelection, persistNumerals } = useContext(TableContext);\n const isKebab = cell?.column.id === 'kebab';\n const isNumeral = cell?.column.id === 'numeral';\n const isSelected = cell?.column.id === columnSelection;\n const narrow = isNumeral || isKebab;\n const notPersistNums = isNumeral && !persistNumerals;\n\n return (\n <td\n {...rest}\n ref={ref}\n className={TableCellStyles({\n className,\n narrow,\n isNumeral,\n notPersistNums,\n })}\n data-selected={isSelected || null}\n >\n {children ||\n (cell && flexRender(cell.column.columnDef.cell, cell.getContext()))}\n </td>\n );\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { TableHeaderCellProps } from './types.js';
|
|
3
|
+
import '@react-types/shared';
|
|
4
|
+
import '@tanstack/react-table';
|
|
5
|
+
import 'react';
|
|
6
|
+
import 'tailwind-variants';
|
|
7
|
+
import './styles.js';
|
|
8
|
+
import 'tailwind-merge';
|
|
9
|
+
|
|
10
|
+
declare function HeaderCell<T>({ ref, children, className, header, ...rest }: TableHeaderCellProps<T>): react_jsx_runtime.JSX.Element;
|
|
11
|
+
|
|
12
|
+
export { HeaderCell };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {Kebab,ArrowDown,ArrowUp}from'@accelint/icons';import {flexRender}from'@tanstack/react-table';import {useContext,useState}from'react';import {Button}from'../button/index.js';import {Icon}from'../icon/index.js';import {Menu}from'../menu/index.js';import {TableContext}from'./context.js';import {TableStyles,TableHeaderCellStyles}from'./styles.js';const{menuItem:d}=TableStyles();function x({header:n}){const{enableColumnReordering:m,enableSorting:s,moveColumnLeft:o,moveColumnRight:u,persistHeaderKebabMenu:c,setColumnSelection:a}=useContext(TableContext),[i,b]=useState(false);if(["numeral","kebab","selection"].includes(n.column.id)||!(s||m))return null;const t=n.column.getIsSorted();return jsxs(Menu.Trigger,{onOpenChange:g=>a(g?n.column.id:null),children:[jsx(Button,{variant:"icon","aria-label":"Menu",onHoverChange:b,className:TableHeaderCellStyles({notPersistHeaderKebab:!c}),children:jsxs(Icon,{children:[(!t||i)&&jsx(Kebab,{}),!i&&t==="desc"&&jsx(ArrowDown,{}),!i&&t==="asc"&&jsx(ArrowUp,{})]})}),jsxs(Menu,{children:[m&&jsxs(Fragment,{children:[jsx(Menu.Item,{classNames:{item:d()},onAction:()=>o(n.column.getIndex()),isDisabled:n.column.getIsFirstColumn("center"),children:"Move Column Left"}),jsx(Menu.Item,{classNames:{item:d()},onAction:()=>u(n.column.getIndex()),isDisabled:n.column.getIsLastColumn("center"),children:"Move Column Right"})]}),m&&s&&jsx(Menu.Separator,{}),s&&jsxs(Fragment,{children:[jsx(Menu.Item,{classNames:{item:d()},onAction:()=>n.column.toggleSorting(false),isDisabled:t==="asc",children:"Sort Ascending"}),jsx(Menu.Item,{onAction:()=>n.column.toggleSorting(true),isDisabled:t==="desc",children:"Sort Descending"}),jsx(Menu.Item,{onAction:n.column.clearSorting,isDisabled:!t,children:"Clear Sort"})]})]})]})}function E({ref:n,children:m,className:s,header:o,...u}){const{columnSelection:c,enableColumnReordering:a,enableSorting:i}=useContext(TableContext),b=a||i,t=o?.getContext(),g=o?.column.id==="numeral"||o?.column.id==="kebab";return jsx("th",{...u,ref:n,children:jsx("div",{className:TableHeaderCellStyles({narrow:g,className:s,isKebabEnabled:b}),"data-selected":o?.column.id===c||null,children:m||o&&jsxs(Fragment,{children:[o.column.id!=="kebab"&&t&&flexRender(o.column.columnDef.header,t),jsx(x,{header:o})]})})})}export{E as HeaderCell};//# sourceMappingURL=table-header-cell.js.map
|
|
2
|
+
//# sourceMappingURL=table-header-cell.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/table/table-header-cell.tsx"],"names":["D","C","enableSorting","sort","jsxs","isOpen","r","l","Button","e","A","persistHeaderKebabMenu","Icon","hoveredArrow","jsx","Kebab","w","H","ArrowUp","Menu","S","enableColumnReordering","M","menuItem","header","moveColumnRight","p","children","rest","columnSelection","ref","narrow","I","showKebab","renderProps","flexRender","HeaderCellMenu"],"mappings":"mZAyB6B,MAA0C,QAEnE,CAAA,CAAA,CAAA,CAAAA,WAAA,EAAA,CAAA,SAAA,CAAA,CAAA,CAAA,uCAGA,CAAA,CAAA,CAAA,aACA,CAAA,CAAA,CAAA,cAAA,CAAA,CAAA,CAAA,eACA,CAAA,CAAA,CAAA,sBAG+C,EAAK,CAAA,kBAGxC,CAAA,CAAA,CAAA,CAAAC,UAAS,6BAAW,CAAA,KAAE,CAAA,CAAA,GAAA,CAAA,SAAgB,CAAA,QAChDC,aAEK,QAGT,CAAA,CAAA,CAAMC,MAAc,CAAA,EAAA,CAAA,iBAEpB,IAAA,CACEC,MAAM,CAAA,CAAA,CAAA,CAAA,MACJ,CAAA,WAAeC,GACMA,OAAgBC,IAAA,CAAAC,IAAA,CAAO,OAAS,CAAA,CAGrD,YAACC,CAAAA,CAAA,EACC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,MAAQ,CAAA,iBACG,CAAA,CAAAC,GAAA,CACXC,MAAA,CAAA,CAAA,OAAA,CAAA,MACA,CAAA,YACE,CAAA,MAAA,CAAA,aAAuB,CAACC,CAC1B,CAAC,+BAEDP,CAAAA,CAACQ,qBACYC,CAAiBC,EAACC,CAAAA,CAAA,CAAA,cACFC,IAAA,CAAA,CAAA,SAAW,CAAA,CAAU,CAAA,CAC/C,EAACH,CAAAA,GAAgBV,GAAAA,CAASc,WA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AAc,CAAA,IAAA,CAAA,CAAA,QAAmB,CAAA,CAAA,CAAA,MAAA,CAAA,YAEpE,CAAA,UAQL,CAAA,CAAA,CAAA,CAAA,QACL,CAAA,aACAoB,CAAAA,CACA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,SACA,CAAAH,CAAAA,CACA,GAAGI,CACL,CAAA,CAA4B,uBAClBC,MAAiB,CAAA,CAAA,CAAA,GAAA,CAAA,CAAA,CAAA,CAAA,KAAA,CAAA,eAAwB,CAAA,CAAA,CAAA,sBAGrB,CAAA,CAAA,CAAA,aAE1BL,CAAQ,2BAAO,CAAA,CAAA,CAAA,CAAA,EAAO,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,UAAqB,EAAA,CAAO,CAAA,CAAA,CAAA,EAAO,SAE3D,GAAA,SACG,EAAI,CAAA,EAAGI,MAAWE,GACjB,GAAA,OAAC,QACCrB,GAAA,CAAA,IAAA,CAAA,CAAA,GAAiC,CAC/B,CAAA,GAAA,CAAA,CAAA,CAAAsB,kBAEA,CAAA,CAAA,SAAA,CAAAC,qBAAgBC,CAClB,CAAC,kBACcT,CAAAA,CAAAA,CAAQ,cAAcK,CAAmB,CAAA,CAAA,CAAA,CAAA,eAGrDL,CACCpB,CAAAA,QACG,CAAA,EAAA,GAAAoB,GAAO,IAAA,CAAA,eACNU,IAAAA,CAAAA,QACAC,CAAAA,CAAWX,QAAO,CAAO,CAAA,CAAA,CAAA,MAAA,CAAU,YACpCY,EAAA,CAAe,qBAClB,CAAA,SAKZ,CAAA,MAAA,CAAA,CAAA,CAAA,CAAA3B,GAAA,CAAA,CAAA,CAAA,CAAA,MAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA","file":"table-header-cell.js","sourcesContent":["// __private-exports\n/*\n * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { ArrowDown, ArrowUp, Kebab } from '@accelint/icons';\nimport { flexRender, type Header } from '@tanstack/react-table';\nimport { useContext, useState } from 'react';\nimport { Button } from '../button';\nimport { Icon } from '../icon';\nimport { Menu } from '../menu';\nimport { TableContext } from './context';\nimport { TableHeaderCellStyles, TableStyles } from './styles';\nimport type { TableHeaderCellProps } from './types';\n\nconst { menuItem } = TableStyles();\n\nfunction HeaderCellMenu<T>({ header }: { header: Header<T, unknown> }) {\n const {\n enableColumnReordering,\n enableSorting,\n moveColumnLeft,\n moveColumnRight,\n persistHeaderKebabMenu,\n setColumnSelection,\n } = useContext(TableContext);\n\n const [hoveredArrow, setHoveredArrow] = useState(false);\n\n if (\n ['numeral', 'kebab', 'selection'].includes(header.column.id) ||\n !(enableSorting || enableColumnReordering)\n ) {\n return null;\n }\n\n const sort = header.column.getIsSorted();\n\n return (\n <Menu.Trigger\n onOpenChange={(isOpen) =>\n setColumnSelection(isOpen ? header.column.id : null)\n }\n >\n <Button\n variant='icon'\n aria-label='Menu'\n onHoverChange={setHoveredArrow}\n className={TableHeaderCellStyles({\n notPersistHeaderKebab: !persistHeaderKebabMenu,\n })}\n >\n <Icon>\n {(!sort || hoveredArrow) && <Kebab />}\n {!hoveredArrow && sort === 'desc' && <ArrowDown />}\n {!hoveredArrow && sort === 'asc' && <ArrowUp />}\n </Icon>\n </Button>\n <Menu>\n {enableColumnReordering && (\n <>\n <Menu.Item\n classNames={{ item: menuItem() }}\n onAction={() => moveColumnLeft(header.column.getIndex())}\n isDisabled={header.column.getIsFirstColumn('center')}\n >\n Move Column Left\n </Menu.Item>\n <Menu.Item\n classNames={{ item: menuItem() }}\n onAction={() => moveColumnRight(header.column.getIndex())}\n isDisabled={header.column.getIsLastColumn('center')}\n >\n Move Column Right\n </Menu.Item>\n </>\n )}\n {enableColumnReordering && enableSorting && <Menu.Separator />}\n {enableSorting && (\n <>\n <Menu.Item\n classNames={{ item: menuItem() }}\n onAction={() => header.column.toggleSorting(false)}\n isDisabled={sort === 'asc'}\n >\n Sort Ascending\n </Menu.Item>\n <Menu.Item\n onAction={() => header.column.toggleSorting(true)}\n isDisabled={sort === 'desc'}\n >\n Sort Descending\n </Menu.Item>\n <Menu.Item onAction={header.column.clearSorting} isDisabled={!sort}>\n Clear Sort\n </Menu.Item>\n </>\n )}\n </Menu>\n </Menu.Trigger>\n );\n}\n\nexport function HeaderCell<T>({\n ref,\n children,\n className,\n header,\n ...rest\n}: TableHeaderCellProps<T>) {\n const { columnSelection, enableColumnReordering, enableSorting } =\n useContext(TableContext);\n const showKebab = enableColumnReordering || enableSorting;\n const renderProps = header?.getContext();\n const narrow =\n header?.column.id === 'numeral' || header?.column.id === 'kebab';\n\n return (\n <th {...rest} ref={ref}>\n <div\n className={TableHeaderCellStyles({\n narrow,\n className,\n isKebabEnabled: showKebab,\n })}\n data-selected={header?.column.id === columnSelection || null}\n >\n {children ||\n (header && (\n <>\n {header.column.id !== 'kebab' &&\n renderProps &&\n flexRender(header.column.columnDef.header, renderProps)}\n <HeaderCellMenu header={header} />\n </>\n ))}\n </div>\n </th>\n );\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { TableHeaderProps } from './types.js';
|
|
3
|
+
import '@react-types/shared';
|
|
4
|
+
import '@tanstack/react-table';
|
|
5
|
+
import 'react';
|
|
6
|
+
import 'tailwind-variants';
|
|
7
|
+
import './styles.js';
|
|
8
|
+
import 'tailwind-merge';
|
|
9
|
+
|
|
10
|
+
declare function TableHeader<T>({ ref, children, className, headerGroups, columnSelection, ...rest }: TableHeaderProps<T>): react_jsx_runtime.JSX.Element;
|
|
11
|
+
|
|
12
|
+
export { TableHeader };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {jsx}from'react/jsx-runtime';import {TableHeaderStyles}from'./styles.js';import {HeaderCell}from'./table-header-cell.js';function y({ref:t,children:o,className:l,headerGroups:d,columnSelection:s,...m}){return jsx("thead",{...m,ref:t,className:TableHeaderStyles(l),children:o||d?.map(r=>jsx("tr",{children:r.headers.map(a=>jsx(HeaderCell,{header:a},a.id))},r.id))})}export{y as TableHeader};//# sourceMappingURL=table-header.js.map
|
|
2
|
+
//# sourceMappingURL=table-header.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/table/table-header.tsx"],"names":["ref","jsx","e","p","headerGroup","i","header"],"mappings":"gIAiBO,SACLA,CACA,CAAA,CAAA,GAAA,CAAA,CAAA,CAAA,QACA,CAAA,CAAA,CAAA,SACA,CAAA,CAAA,CAAA,YACA,CAAA,CAAA,CAAA,eAEF,CAAwB,CACtB,CAAA,GAAA,CAAA,CAAA,CACEC,QAACC,GAAA,CAAA,OAAgB,CAAA,CAAA,GAAU,CAAA,CAAA,GAAA,CAAA,CAAA,CAAA,SACxB,CAAAC,iBAAA,CAAA,CAAA,CAAA,CAAA,QACe,CAAA,CAAA,EAAKC,CAAAA,EACjBH,GAAC,CAAA,CAAA,EACEC,kBAAY,CAAA,CAAA,CAAQ,OACnBD,CAAAA,GAAC,CAA2B,CAAA,EAAAC,GAAA,CAAAG,UAAA,CAAQC,CAAAA,MAAQ,CAC7C,CAAA,CAAA,CAHMF,CAAAA,CAAY,EAIrB,CACD,EACL,CAEJ,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA","file":"table-header.js","sourcesContent":["// __private-exports\n/*\n * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { TableHeaderStyles } from './styles';\nimport { HeaderCell } from './table-header-cell';\nimport type { TableHeaderProps } from './types';\n\nexport function TableHeader<T>({\n ref,\n children,\n className,\n headerGroups,\n columnSelection,\n ...rest\n}: TableHeaderProps<T>) {\n return (\n <thead {...rest} ref={ref} className={TableHeaderStyles(className)}>\n {children ||\n headerGroups?.map((headerGroup) => (\n <tr key={headerGroup.id}>\n {headerGroup.headers.map((header) => (\n <HeaderCell key={header.id} header={header} />\n ))}\n </tr>\n ))}\n </thead>\n );\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { TableRowProps } from './types.js';
|
|
3
|
+
import '@react-types/shared';
|
|
4
|
+
import '@tanstack/react-table';
|
|
5
|
+
import 'react';
|
|
6
|
+
import 'tailwind-variants';
|
|
7
|
+
import './styles.js';
|
|
8
|
+
import 'tailwind-merge';
|
|
9
|
+
|
|
10
|
+
declare function TableRow<T>({ ref, children, className, row, ...rest }: TableRowProps<T>): react_jsx_runtime.JSX.Element;
|
|
11
|
+
|
|
12
|
+
export { TableRow };
|