@accelint/design-toolkit 5.1.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/styles.js +1 -1
- package/dist/components/accordion/styles.js.map +1 -1
- 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 +1 -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/color-picker/styles.d.ts +3 -3
- 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 +1 -1
- package/dist/components/drawer/index.js.map +1 -1
- 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/input/styles.js +1 -1
- package/dist/components/input/styles.js.map +1 -1
- package/dist/components/menu/styles.js +1 -1
- package/dist/components/menu/styles.js.map +1 -1
- package/dist/components/search-field/styles.js +1 -1
- package/dist/components/search-field/styles.js.map +1 -1
- package/dist/components/select-field/types.d.ts +0 -1
- package/dist/components/sidenav/index.d.ts +1 -6
- package/dist/components/sidenav/index.js +1 -1
- package/dist/components/sidenav/index.js.map +1 -1
- package/dist/components/sidenav/styles.js +1 -1
- package/dist/components/sidenav/styles.js.map +1 -1
- 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/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/tree/index.js +1 -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/foundation/token-data.js +1 -1
- package/dist/foundation/token-data.js.map +1 -1
- package/dist/index.d.ts +20 -1
- package/dist/index.js +1 -1
- package/dist/metafile-esm.json +1 -1
- package/dist/styles.css +3038 -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 +9 -3
|
@@ -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,MAA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,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 };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {jsx}from'react/jsx-runtime';import {TableRowStyles}from'./styles.js';import {TableCell}from'./table-cell.js';function i({ref:o,children:a,className:s,row:e,...p}){const r=e?.getAllCells();return jsx("tr",{...p,ref:o,className:TableRowStyles({className:s}),"data-pinned":e?.getIsPinned()||null,"data-selected":e?.getIsSelected()||null,children:a||r?.map(l=>jsx(TableCell,{cell:l},l.id))})}export{i as TableRow};//# sourceMappingURL=table-row.js.map
|
|
2
|
+
//# sourceMappingURL=table-row.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/table/table-row.tsx"],"names":["ref","row","cells","jsx","t","cell"],"mappings":"qHAiBO,SACLA,CACA,CAAA,CAAA,GAAA,CAAA,CAAA,CAAA,QACA,CAAA,CAAA,CAAA,SACAC,CACA,CAAA,CAAA,GACF,CAAqB,CACnB,CAAA,GAAA,CAAA,CAAMC,CAAAA,CAAQD,MAAK,CAAA,CAAA,CAAA,EAAA,WAEnB,EACEE,QACGC,GAAA,CAAA,IACD,CAAA,CAAA,GACA,CAAA,CAAA,GAAA,CAAA,CAAA,CAAA,mCACA,CAAA,CAAA,CAAA,CAAA,CAAA,aAAkB,CAAA,CAAA,EAAA,WAAiB,wBACf,CAAA,CAAA,EAAA,aAAmB,EAEtC,EAAA,IAAA,CAAA,QACQ,CAAA,CAAA,KAAcD,GAAC,CAAwB,CAAA,EAAAC,GAAA,CAAMC,SAAAA,CAAAA,CAAfA,IAAqB,CAAE,EAChE,CAEJ,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA","file":"table-row.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 { TableRowStyles } from './styles';\nimport { TableCell } from './table-cell';\nimport type { TableRowProps } from './types';\n\nexport function TableRow<T>({\n ref,\n children,\n className,\n row,\n ...rest\n}: TableRowProps<T>) {\n const cells = row?.getAllCells();\n\n return (\n <tr\n {...rest}\n ref={ref}\n className={TableRowStyles({ className })}\n data-pinned={row?.getIsPinned() || null}\n data-selected={row?.getIsSelected() || null}\n >\n {children ||\n cells?.map((cell) => <TableCell key={cell.id} cell={cell} />)}\n </tr>\n );\n}\n"]}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { Key } from '@react-types/shared';
|
|
2
|
+
import { ColumnDef, Row, Cell, HeaderGroup, Header } from '@tanstack/react-table';
|
|
3
|
+
import { Dispatch, SetStateAction, ComponentPropsWithRef, PropsWithChildren } from 'react';
|
|
4
|
+
import { VariantProps } from 'tailwind-variants';
|
|
5
|
+
import { TableCellStyles, TableHeaderCellStyles } from './styles.js';
|
|
6
|
+
import 'tailwind-merge';
|
|
7
|
+
|
|
8
|
+
type BaseTableProps = Omit<ComponentPropsWithRef<'table'>, 'children'>;
|
|
9
|
+
type ExtendedTableProps<T extends {
|
|
10
|
+
id: Key;
|
|
11
|
+
}> = {
|
|
12
|
+
/**
|
|
13
|
+
* An array of column definitions, one for each key in `T`.
|
|
14
|
+
*/
|
|
15
|
+
columns: {
|
|
16
|
+
[K in keyof Required<T>]: ColumnDef<T, T[K]>;
|
|
17
|
+
}[keyof T][];
|
|
18
|
+
/**
|
|
19
|
+
* An array of data objects of type `T`.
|
|
20
|
+
* Each object must have a unique `id` property.
|
|
21
|
+
*/
|
|
22
|
+
data: T[];
|
|
23
|
+
/**
|
|
24
|
+
* Whether to display a checkbox column.
|
|
25
|
+
*/
|
|
26
|
+
showCheckbox?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Position of the kebab menu, either 'left' or 'right'.
|
|
29
|
+
*/
|
|
30
|
+
kebabPosition?: 'left' | 'right';
|
|
31
|
+
/**
|
|
32
|
+
* Whether to persist the header kebab menu.
|
|
33
|
+
* If true, the header kebab menu is always visible.
|
|
34
|
+
* If false, it is only visible on hover or when the row is hovered.
|
|
35
|
+
*/
|
|
36
|
+
persistHeaderKebabMenu?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Whether to persist the kebab menu.
|
|
39
|
+
* If true, the kebab menu is always visible.
|
|
40
|
+
* If false, it is only visible on hover or when the row is hovered.
|
|
41
|
+
*/
|
|
42
|
+
persistRowKebabMenu?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Whether to persist numeral columns.
|
|
45
|
+
* If true, numeral columns are always visible.
|
|
46
|
+
* If false, they are only visible on hover or when the row is hovered.
|
|
47
|
+
*/
|
|
48
|
+
persistNumerals?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Whether to enable sorting.
|
|
51
|
+
* If true, the table will support sorting.
|
|
52
|
+
* If false, the table will not support sorting.
|
|
53
|
+
*/
|
|
54
|
+
enableSorting?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Whether to enable column ordering.
|
|
57
|
+
* If true, the table will support column ordering.
|
|
58
|
+
* If false, the table will not support column ordering.
|
|
59
|
+
*/
|
|
60
|
+
enableColumnOrdering?: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Whether to enable actions for rows.
|
|
63
|
+
* If true, the table will support ability to take action on row.
|
|
64
|
+
* If false, the table will not support ability to take action on row.
|
|
65
|
+
*/
|
|
66
|
+
enableRowActions?: boolean;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Props for the Table component.
|
|
70
|
+
*
|
|
71
|
+
* @template T - The type of data objects, which must include an `id` property of type `string` or `number`.
|
|
72
|
+
*
|
|
73
|
+
* This type extends `BaseTableProps` and supports two mutually exclusive prop sets:
|
|
74
|
+
*
|
|
75
|
+
* 1. **Data Table Mode**:
|
|
76
|
+
* - `columns`: An array of column definitions, one for each key in `T`.
|
|
77
|
+
* - `data`: An array of data objects of type `T`.
|
|
78
|
+
* - `showCheckbox` (optional): Whether to display a checkbox column.
|
|
79
|
+
* - `kebabPosition` (optional): Position of the kebab menu, either `'left'` or `'right'`.
|
|
80
|
+
* - `persistRowActionMenu` (optional): Whether to persist the kebab menu.
|
|
81
|
+
* - `persistNumerals` (optional): Whether to persist numeral columns.
|
|
82
|
+
* - `children`: Must not be provided in this mode.
|
|
83
|
+
*
|
|
84
|
+
* 2. **Custom Content Mode**:
|
|
85
|
+
* - All table-related props (`data`, `columns`, etc.) must not be provided.
|
|
86
|
+
* - Allows for custom children content.
|
|
87
|
+
*
|
|
88
|
+
* @see {@link BaseTableProps}
|
|
89
|
+
*/
|
|
90
|
+
type TableProps<T extends {
|
|
91
|
+
id: Key;
|
|
92
|
+
}> = BaseTableProps & ((ExtendedTableProps<T> & {
|
|
93
|
+
children?: never;
|
|
94
|
+
}) | PropsWithChildren<{
|
|
95
|
+
[K in keyof ExtendedTableProps<T>]?: never;
|
|
96
|
+
}>);
|
|
97
|
+
/**
|
|
98
|
+
* Props for the `<tbody>` section of a table component.
|
|
99
|
+
*
|
|
100
|
+
* Extends standard HTML attributes and ref attributes for the `<tbody>` element,
|
|
101
|
+
* allowing you to pass any valid HTML properties or refs to the table body.
|
|
102
|
+
*
|
|
103
|
+
* @see {@link HTMLAttributes}
|
|
104
|
+
* @see {@link RefAttributes}
|
|
105
|
+
*/
|
|
106
|
+
type TableBodyProps<T> = ComponentPropsWithRef<'tbody'> & {
|
|
107
|
+
rows?: Row<T>[];
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* Props for a table row (`<tr>`) component.
|
|
111
|
+
*
|
|
112
|
+
* Extends standard HTML attributes and ref attributes for an HTMLTableRowElement,
|
|
113
|
+
* allowing you to pass any valid `<tr>` properties and a ref.
|
|
114
|
+
*
|
|
115
|
+
* @see {@link HTMLAttributes}
|
|
116
|
+
* @see {@link RefAttributes}
|
|
117
|
+
*/
|
|
118
|
+
type TableRowProps<T> = ComponentPropsWithRef<'tr'> & {
|
|
119
|
+
row?: Row<T>;
|
|
120
|
+
};
|
|
121
|
+
/**
|
|
122
|
+
* Props for a table cell component.
|
|
123
|
+
*
|
|
124
|
+
* Extends the standard HTML `<td>` element attributes and includes variant styling props.
|
|
125
|
+
*
|
|
126
|
+
* @remarks
|
|
127
|
+
* - Inherits all properties from `TdHTMLAttributes<HTMLTableCellElement>`.
|
|
128
|
+
* - Includes variant properties from `cellStyles`.
|
|
129
|
+
* - Optionally accepts a `ref` to the underlying `<td>` element.
|
|
130
|
+
*
|
|
131
|
+
* @property ref - Optional React ref for the table cell element.
|
|
132
|
+
* @property className - Optional class name for custom styling.
|
|
133
|
+
* @property narrow - Optional boolean to apply narrow styling.
|
|
134
|
+
* @property numeral - Optional boolean to apply numeral styling.
|
|
135
|
+
* @property persistent - Optional boolean to control visibility behavior.
|
|
136
|
+
* If true, the cell is always visible.
|
|
137
|
+
* If false, the cell content is only visible on hover or when the row is hovered.
|
|
138
|
+
*/
|
|
139
|
+
type TableCellProps<T> = ComponentPropsWithRef<'td'> & VariantProps<typeof TableCellStyles> & {
|
|
140
|
+
cell?: Cell<T, unknown>;
|
|
141
|
+
};
|
|
142
|
+
/**
|
|
143
|
+
* Props for a table header cell component.
|
|
144
|
+
*
|
|
145
|
+
* This type combines standard HTML `<th>` element attributes, style variant props,
|
|
146
|
+
* and ref attributes for a table header cell.
|
|
147
|
+
*
|
|
148
|
+
* @see {@link VariantProps}
|
|
149
|
+
* @see {@link RefAttributes}
|
|
150
|
+
*/
|
|
151
|
+
type TableHeaderCellProps<T> = ComponentPropsWithRef<'th'> & VariantProps<typeof TableHeaderCellStyles> & {
|
|
152
|
+
header?: Header<T, unknown>;
|
|
153
|
+
};
|
|
154
|
+
/**
|
|
155
|
+
* Props for the table header (`<thead>`) component.
|
|
156
|
+
*
|
|
157
|
+
* Extends standard HTML attributes and ref attributes for an HTMLTableSectionElement.
|
|
158
|
+
*
|
|
159
|
+
* @see {@link HTMLAttributes}
|
|
160
|
+
* @see {@link RefAttributes}
|
|
161
|
+
*/
|
|
162
|
+
type TableHeaderProps<T> = ComponentPropsWithRef<'thead'> & {
|
|
163
|
+
/**
|
|
164
|
+
* Array of header groups of the table
|
|
165
|
+
*/
|
|
166
|
+
headerGroups?: HeaderGroup<T>[];
|
|
167
|
+
/**
|
|
168
|
+
* The currently selected column ID
|
|
169
|
+
*/
|
|
170
|
+
columnSelection?: string | null;
|
|
171
|
+
};
|
|
172
|
+
type TableContextValue = {
|
|
173
|
+
columnSelection: string | null;
|
|
174
|
+
enableColumnReordering: boolean;
|
|
175
|
+
enableSorting: boolean;
|
|
176
|
+
enableRowActions: boolean;
|
|
177
|
+
persistHeaderKebabMenu: boolean;
|
|
178
|
+
persistRowKebabMenu: boolean;
|
|
179
|
+
persistNumerals: boolean;
|
|
180
|
+
moveColumnLeft: (index: number) => void;
|
|
181
|
+
moveColumnRight: (index: number) => void;
|
|
182
|
+
setColumnSelection: Dispatch<SetStateAction<string | null>>;
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
export type { TableBodyProps, TableCellProps, TableContextValue, TableHeaderCellProps, TableHeaderProps, TableProps, TableRowProps };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"types.js"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { TimeValue } from 'react-aria-components';
|
|
3
|
+
import { TimeFieldProps } from './types.js';
|
|
4
|
+
import 'tailwind-variants';
|
|
5
|
+
import './styles.js';
|
|
6
|
+
import 'tailwind-merge';
|
|
7
|
+
|
|
8
|
+
declare function TimeField<T extends TimeValue>({ classNames, description: descriptionProp, errorMessage: errorMessageProp, granularity, hourCycle, inputProps, label: labelProp, shouldForceLeadingZeros, size, isDisabled, isInvalid: isInvalidProp, isRequired, ...rest }: TimeFieldProps<T>): react_jsx_runtime.JSX.Element;
|
|
9
|
+
|
|
10
|
+
export { TimeField };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import {jsx,jsxs,Fragment}from'react/jsx-runtime';import'client-only';import {Time}from'@accelint/icons';import {TimeField,composeRenderProps,DateInput,DateSegment,Text,FieldError}from'react-aria-components';import {Icon}from'../icon/index.js';import {Label}from'../label/index.js';import {TimeFieldStyles}from'./styles.js';const{field:R,label:c,control:V,input:Z,description:k,error:q,segment:C}=TimeFieldStyles();function P({classNames:i,description:s,errorMessage:T,granularity:f="second",hourCycle:F=24,inputProps:b,label:m,shouldForceLeadingZeros:g=true,size:t="medium",isDisabled:y,isInvalid:n,isRequired:d,...A}){const l=T||null,p=t==="small";return jsx(TimeField,{...A,className:composeRenderProps(i?.field,o=>R({className:o})),granularity:f,hourCycle:F,shouldForceLeadingZeros:g,isDisabled:y,isInvalid:n||(l?true:void 0),isRequired:d,"aria-label":m,"data-size":t,children:({isDisabled:o})=>jsxs(Fragment,{children:[!p&&c&&jsx(Label,{className:c({className:i?.label}),isDisabled:o,isRequired:d,children:m}),jsxs("div",{className:V({className:i?.control}),children:[t==="medium"&&jsx(Icon,{children:jsx(Time,{})}),jsx(DateInput,{...b,className:composeRenderProps(i?.input,r=>Z({className:r})),children:r=>jsx(DateSegment,{segment:r,className:composeRenderProps(i?.segment,D=>C({className:D}))})}),jsx("span",{children:"Z"})]}),s&&!(p||n)&&!l&&jsx(Text,{className:k({className:i?.description}),slot:"description",children:s}),jsx(FieldError,{className:composeRenderProps(i?.error,r=>q({className:r})),children:l})]})})}export{P as TimeField};//# sourceMappingURL=index.js.map
|
|
4
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/time-field/index.tsx"],"names":["control","input","description","error","TimeField","M","classNames","labelProp","shouldForceLeadingZeros","isDisabled","isInvalidProp","isRequired","isSmall","AriaTimeField","rest","L","className","field","a","hourCycle","label","Label","w","e","E","u","size","jsx","AriaDateInput","composeRenderProps","v","segmentProp","AriaText","x","descriptionProp","errorMessage"],"mappings":"oU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AA,CAAAmB,SAMb,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,QAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA","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'use client';\n\nimport 'client-only';\nimport { Time } from '@accelint/icons';\nimport {\n DateInput as AriaDateInput,\n Text as AriaText,\n TimeField as AriaTimeField,\n composeRenderProps,\n DateSegment,\n FieldError,\n type TimeValue,\n} from 'react-aria-components';\nimport { Icon } from '../icon';\nimport { Label } from '../label';\nimport { TimeFieldStyles } from './styles';\nimport type { TimeFieldProps } from './types';\n\nconst { field, label, control, input, description, error, segment } =\n TimeFieldStyles();\n\nexport function TimeField<T extends TimeValue>({\n classNames,\n description: descriptionProp,\n errorMessage: errorMessageProp,\n granularity = 'second',\n hourCycle = 24,\n inputProps,\n label: labelProp,\n shouldForceLeadingZeros = true,\n size = 'medium',\n isDisabled,\n isInvalid: isInvalidProp,\n isRequired,\n ...rest\n}: TimeFieldProps<T>) {\n const errorMessage = errorMessageProp || null; // Protect against empty string\n const isSmall = size === 'small';\n\n return (\n <AriaTimeField<T>\n {...rest}\n className={composeRenderProps(classNames?.field, (className) =>\n field({ className }),\n )}\n granularity={granularity}\n hourCycle={hourCycle}\n shouldForceLeadingZeros={shouldForceLeadingZeros}\n isDisabled={isDisabled}\n isInvalid={isInvalidProp || (errorMessage ? true : undefined)} // Leave uncontrolled if possible to fallback to validation state\n isRequired={isRequired}\n aria-label={labelProp}\n data-size={size}\n >\n {(\n { isDisabled }, // Rely on internal state, not props, since state could differ from props\n ) => (\n <>\n {!isSmall && label && (\n <Label\n className={label({ className: classNames?.label })}\n isDisabled={isDisabled}\n isRequired={isRequired}\n >\n {labelProp}\n </Label>\n )}\n <div className={control({ className: classNames?.control })}>\n {size === 'medium' && (\n <Icon>\n <Time />\n </Icon>\n )}\n <AriaDateInput\n {...inputProps}\n className={composeRenderProps(classNames?.input, (className) =>\n input({\n className,\n }),\n )}\n >\n {(segmentProp) => (\n <DateSegment\n segment={segmentProp}\n className={composeRenderProps(\n classNames?.segment,\n (className) => segment({ className }),\n )}\n />\n )}\n </AriaDateInput>\n <span>Z</span>\n </div>\n {descriptionProp && !(isSmall || isInvalidProp) && !errorMessage && (\n <AriaText\n className={description({\n className: classNames?.description,\n })}\n slot='description'\n >\n {descriptionProp}\n </AriaText>\n )}\n <FieldError\n className={composeRenderProps(classNames?.error, (className) =>\n error({ className }),\n )}\n >\n {errorMessage}\n </FieldError>\n </>\n )}\n </AriaTimeField>\n );\n}\n"]}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import * as tailwind_variants from 'tailwind-variants';
|
|
2
|
+
import * as tailwind_merge from 'tailwind-merge';
|
|
3
|
+
|
|
4
|
+
declare const TimeFieldSylesDefaults: {
|
|
5
|
+
readonly isDisabled: false;
|
|
6
|
+
};
|
|
7
|
+
declare const TimeFieldStyles: tailwind_variants.TVReturnType<{
|
|
8
|
+
[key: string]: {
|
|
9
|
+
[key: string]: tailwind_merge.ClassNameValue | {
|
|
10
|
+
description?: tailwind_merge.ClassNameValue;
|
|
11
|
+
input?: tailwind_merge.ClassNameValue;
|
|
12
|
+
label?: tailwind_merge.ClassNameValue;
|
|
13
|
+
control?: tailwind_merge.ClassNameValue;
|
|
14
|
+
field?: tailwind_merge.ClassNameValue;
|
|
15
|
+
error?: tailwind_merge.ClassNameValue;
|
|
16
|
+
segment?: tailwind_merge.ClassNameValue;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
} | {
|
|
20
|
+
[x: string]: {
|
|
21
|
+
[x: string]: tailwind_merge.ClassNameValue | {
|
|
22
|
+
description?: tailwind_merge.ClassNameValue;
|
|
23
|
+
input?: tailwind_merge.ClassNameValue;
|
|
24
|
+
label?: tailwind_merge.ClassNameValue;
|
|
25
|
+
control?: tailwind_merge.ClassNameValue;
|
|
26
|
+
field?: tailwind_merge.ClassNameValue;
|
|
27
|
+
error?: tailwind_merge.ClassNameValue;
|
|
28
|
+
segment?: tailwind_merge.ClassNameValue;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
} | {}, {
|
|
32
|
+
field: string;
|
|
33
|
+
label: string;
|
|
34
|
+
control: string[];
|
|
35
|
+
input: string;
|
|
36
|
+
segment: string[];
|
|
37
|
+
description: string[];
|
|
38
|
+
error: string;
|
|
39
|
+
}, undefined, {
|
|
40
|
+
[key: string]: {
|
|
41
|
+
[key: string]: tailwind_merge.ClassNameValue | {
|
|
42
|
+
description?: tailwind_merge.ClassNameValue;
|
|
43
|
+
input?: tailwind_merge.ClassNameValue;
|
|
44
|
+
label?: tailwind_merge.ClassNameValue;
|
|
45
|
+
control?: tailwind_merge.ClassNameValue;
|
|
46
|
+
field?: tailwind_merge.ClassNameValue;
|
|
47
|
+
error?: tailwind_merge.ClassNameValue;
|
|
48
|
+
segment?: tailwind_merge.ClassNameValue;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
} | {}, {
|
|
52
|
+
field: string;
|
|
53
|
+
label: string;
|
|
54
|
+
control: string[];
|
|
55
|
+
input: string;
|
|
56
|
+
segment: string[];
|
|
57
|
+
description: string[];
|
|
58
|
+
error: string;
|
|
59
|
+
}, tailwind_variants.TVReturnType<unknown, {
|
|
60
|
+
field: string;
|
|
61
|
+
label: string;
|
|
62
|
+
control: string[];
|
|
63
|
+
input: string;
|
|
64
|
+
segment: string[];
|
|
65
|
+
description: string[];
|
|
66
|
+
error: string;
|
|
67
|
+
}, undefined, unknown, unknown>>;
|
|
68
|
+
|
|
69
|
+
export { TimeFieldStyles, TimeFieldSylesDefaults };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {tv}from'./../../lib/utils.js';const i={isDisabled:false},t=tv({slots:{field:"group/time-field flex flex-col gap-xs",label:"",control:["flex w-full items-center gap-xs rounded-medium px-s py-xs font-display outline outline-interactive","group-size-medium/time-field:text-body-s","group-size-small/time-field:text-body-xs","fg-primary-bold","hover:outline-interactive-hover","focus-visible-within:outline-accent-primary-bold","group-invalid/time-field:outline-serious-bold","group-disabled/time-field:placeholder:fg-disabled group-disabled/time-field:fg-disabled group-disabled/time-field:outline-interactive-disabled"],input:"flex",segment:["text-right","placeholder-shown:fg-primary-muted","focus-visible:fg-a11y-on-accent focus-visible:bg-accent-primary-bold focus-visible:outline-none"],description:["fg-primary-muted text-body-xs","group-disabled/time-field:fg-disabled"],error:"fg-serious-bold text-body-xs"},defaultVariants:i});export{t as TimeFieldStyles,i as TimeFieldSylesDefaults};//# sourceMappingURL=styles.js.map
|
|
2
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/time-field/styles.ts"],"names":["e"],"mappings":"sCAcE,MAAA,CAAA,CAAA,CAAA,UAIA,CAAA,KAAA,CAAA,CAAA,CAAO,CACLA,EAAA,CAAA,CAAA,KAAO,CAAA,CAAA,KAAA,CAAA,uCAEP,CAAA,KAAA,CAAA,EACE,CAAA,OAAA,CAAA,CAAA,oGACA,CAAA,0CACA,CAAA,4DAEA,CAAA,iCACA,CAAA,kGAEA,CAAA,gJAEK,CAAA,CAAA,KACP,CAAA,MACE,CAAA,OAAA,CAAA,CAAA,YACA,CAAA,oCACA,CAAA,iGAEF,CAAA,CAAA,4CAEE,CAAA,uCAEK,CAAA,CAAA,KAAA,CAAA,8BAET,CAAA,CAAA,eACD,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 TimeFieldSylesDefaults = {\n isDisabled: false,\n} as const;\n\nexport const TimeFieldStyles = tv({\n slots: {\n field: 'group/time-field flex flex-col gap-xs',\n label: '',\n control: [\n 'flex w-full items-center gap-xs rounded-medium px-s py-xs font-display outline outline-interactive',\n 'group-size-medium/time-field:text-body-s',\n 'group-size-small/time-field:text-body-xs',\n 'fg-primary-bold',\n 'hover:outline-interactive-hover',\n 'focus-visible-within:outline-accent-primary-bold',\n 'group-invalid/time-field:outline-serious-bold',\n 'group-disabled/time-field:placeholder:fg-disabled group-disabled/time-field:fg-disabled group-disabled/time-field:outline-interactive-disabled',\n ],\n input: 'flex',\n segment: [\n 'text-right',\n 'placeholder-shown:fg-primary-muted',\n 'focus-visible:fg-a11y-on-accent focus-visible:bg-accent-primary-bold focus-visible:outline-none',\n ],\n description: [\n 'fg-primary-muted text-body-xs',\n 'group-disabled/time-field:fg-disabled',\n ],\n error: 'fg-serious-bold text-body-xs',\n },\n defaultVariants: TimeFieldSylesDefaults,\n});\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { TimeValue, TimeFieldProps as TimeFieldProps$1, LabelProps, DateInputProps, DateSegmentProps, FieldErrorProps } from 'react-aria-components';
|
|
2
|
+
import { VariantProps } from 'tailwind-variants';
|
|
3
|
+
import { TimeFieldStyles } from './styles.js';
|
|
4
|
+
import 'tailwind-merge';
|
|
5
|
+
|
|
6
|
+
type TimeFieldProps<T extends TimeValue> = Omit<TimeFieldProps$1<T>, 'children' | 'className' | 'placeholder'> & VariantProps<typeof TimeFieldStyles> & {
|
|
7
|
+
classNames?: {
|
|
8
|
+
field?: TimeFieldProps$1<T>['className'];
|
|
9
|
+
label?: LabelProps['className'];
|
|
10
|
+
control?: string;
|
|
11
|
+
input?: DateInputProps['className'];
|
|
12
|
+
segment?: DateSegmentProps['className'];
|
|
13
|
+
description?: string;
|
|
14
|
+
error?: FieldErrorProps['className'];
|
|
15
|
+
};
|
|
16
|
+
label?: string;
|
|
17
|
+
description?: string;
|
|
18
|
+
errorMessage?: string;
|
|
19
|
+
size?: 'small' | 'medium';
|
|
20
|
+
inputProps?: Omit<DateInputProps, 'children' | 'className'>;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export type { TimeFieldProps };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"types.js"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import {jsx,jsxs}from'react/jsx-runtime';import
|
|
3
|
+
import {jsx,jsxs}from'react/jsx-runtime';import {Show,Hide,ChevronDown,ChevronUp,DragVert}from'@accelint/icons';import {Cache}from'./../../hooks/use-tree/actions/cache.js';import'client-only';import {createContext,memo,useContext,useMemo}from'react';import {TreeItemContent,TreeItem,composeRenderProps,Text,useDragAndDrop,Tree,DropIndicator}from'react-aria-components';import {Button}from'../button/index.js';import {Checkbox}from'../checkbox/index.js';import {Icon}from'../icon/index.js';import {Lines}from'../lines/index.js';import {TreeStyles,TreeStylesDefaults}from'./styles.js';const {tree:pe,item:ue,content:ye,display:fe,icon:be,label:ve,actions:Te,spacing:E,description:he,drag:Ie,expansion:Ce,visibility:ge}=TreeStyles(),x=createContext({visibilityComputedKeys:new Set,showRuleLines:true,showVisibility:false,variant:TreeStylesDefaults.variant,isStatic:true,onVisibilityChange:()=>{}}),xe=t=>jsx(DropIndicator,{target:t,className:"border border-highlight-hover"}),we=memo(function({level:o,isLastOfSet:s}){const{showRuleLines:m,variant:r}=useContext(x);return Array.from({length:o}).map((i,n)=>{const a=n===o-1?"branch":"vert",d=s&&n>0?"last":a;return jsx(Lines,{variant:d,size:r==="crammed"?"medium":"large",isVisible:m,className:E({variant:r})},n)})});function H({children:t,className:o,disabledKeys:s,dragAndDropConfig:m,expandedKeys:r,items:i,selectedKeys:n,showRuleLines:a=true,showVisibility:d=true,selectionMode:l="multiple",variant:w=TreeStylesDefaults.variant,visibleKeys:y,onVisibilityChange:K,onSelectionChange:N,...D}){if(i&&(s||r||n||y))throw new Error("Tree should only be controlled with state from either `items` or keys props, not both");if(!!i!=(typeof t=="function"))throw new Error("Tree `items` and node iterator `children` must be used together");const{dragAndDropHooks:V}=useDragAndDrop({renderDropIndicator:xe,getAllowedDropOperations:()=>["move"],getDropOperation:()=>"move",...m}),f=useMemo(()=>i?new Cache([...i]):null,[i]),c=useMemo(()=>f?.getAllNodes(),[f]),{disabledKeys:S,expandedKeys:T,selectedKeys:h,visibleKeys:A,visibilityComputedKeys:I}=useMemo(()=>{const p={disabledKeys:c?new Set:s,expandedKeys:c?new Set:r,selectedKeys:c?new Set:n,visibleKeys:c?new Set:y,visibilityComputedKeys:new Set};return c?c.reduce((b,{key:C,isDisabled:G,isExpanded:J,isSelected:Q,isVisible:X,isVisibleComputed:Y})=>(G&&b.disabledKeys?.add(C),J&&b.expandedKeys?.add(C),Q&&b.selectedKeys?.add(C),X&&b.visibleKeys?.add(C),Y&&b.visibilityComputedKeys.add(C),b),p):p},[c,s,r,n,y]),F=h?p=>{p!=="all"&&N?.(p);}:void 0;return jsx(x.Provider,{value:{disabledKeys:S,expandedKeys:T,selectedKeys:h,showRuleLines:a,showVisibility:d,variant:w,visibleKeys:A,visibilityComputedKeys:I,isStatic:typeof t!="function",onVisibilityChange:K??(()=>{})},children:jsx(Tree,{...D,className:composeRenderProps(o,p=>pe({className:p,variant:w})),disabledKeys:S,dragAndDropHooks:V,expandedKeys:T,items:i,selectedKeys:h,onSelectionChange:F,selectionMode:l,children:t})})}H.displayName="Tree";const z=createContext({isVisible:true,isViewable:true,ancestors:[]});function u({className:t,id:o,...s}){const{visibilityComputedKeys:m,visibleKeys:r,isStatic:i}=useContext(x),{ancestors:n}=useContext(z),a=m?.has(o)||i&&n.every(l=>r?.has(l)),d=r?.has(o);return jsx(z.Provider,{value:{isVisible:d,isViewable:a,ancestors:[...n,o]},children:jsx(TreeItem,{...s,id:o,className:composeRenderProps(t,l=>ue({className:l})),"data-viewable":a||null,"data-visible":d||null})})}u.displayName="Tree.Item";function M({children:t}){const{showVisibility:o,variant:s,visibleKeys:m,onVisibilityChange:r}=useContext(x),{isVisible:i,isViewable:n}=useContext(z),a=s==="cozy"?"medium":"small";return jsx(TreeItemContent,{children:d=>{const{id:l,allowsDragging:w,hasChildItems:y,level:K,selectionBehavior:N,selectionMode:D,state:V,isDisabled:f,isExpanded:c,isSelected:S}=d,T=!(V.collection.getItem(l)?.nextKey||y),h=N==="toggle"&&D!=="none",A=()=>{const I=new Set(m);m?.has(l)?I.delete(l):I.add(l),r?.(I);};return jsx(Icon.Provider,{size:a,children:jsxs("div",{className:ye({variant:s}),"data-last-of-set":T,children:[o&&jsx(Button,{variant:"icon",color:"mono-bold",size:a,onPress:A,isDisabled:f,className:ge(),children:jsx(Icon,{children:i?jsx(Show,{}):jsx(Hide,{})})}),K>1&&jsx(we,{level:K,isLastOfSet:T}),y?jsx(Button,{slot:"chevron",variant:"icon",size:a,className:Ce(),children:jsx(Icon,{children:c?jsx(ChevronDown,{}):jsx(ChevronUp,{})})}):jsx("div",{className:E({variant:s})}),jsx("div",{className:fe({variant:s}),children:typeof t=="function"?t({...d,variant:s,isVisible:i,isViewable:n,defaultChildren:null}):t}),h&&jsx(Checkbox,{slot:"selection",isSelected:S,isDisabled:f}),w&&jsx(Button,{slot:"drag",variant:"icon",size:a,isDisabled:f,className:Ie({}),children:jsx(Icon,{children:jsx(DragVert,{})})})]})})}})}M.displayName="Tree.Item.Content";function W({children:t,className:o}){return jsx(Text,{className:ve({className:o}),children:t})}W.displayName="Tree.Item.Label";function U({children:t,className:o}){const{variant:s}=useContext(x);return s!=="crammed"?jsx(Text,{"data-slot":"description",className:he({className:o,variant:s}),children:t}):null}U.displayName="Tree.Item.Description";function _({children:t,className:o}){return jsx(Icon,{className:be({className:o}),children:t})}_.displayName="Tree.Item.PrefixIcon";function q({children:t,className:o}){return jsx("div",{className:Te({className:o}),children:t})}q.displayName="Tree.Icon.Actions",H.Item=u,u.Content=M,u.Label=W,u.Description=U,u.PrefixIcon=_,u.Actions=q;export{H as Tree,x as TreeContext,u as TreeItem,z as TreeItemContext};//# sourceMappingURL=index.js.map
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/tree/index.tsx"],"names":["label","description","drag","expansion","TreeStyles","me","B","target","jsx","e","re","TreeLines","se","showRuleLines","variant","TreeContext","_","i","type","level","Lines","ce","spacing","Tree","children","className","disabledKeysProp","selectionMode","onVisibilityChange","k","onSelectionChange","items","defaultRenderDropIndicator","ae","nodes","P","le","disabledKeys","visibilityComputedKeys","acc","selectedKeysProp","visibleKeysProp","isExpanded","isSelected","isDisabled","key","isVisible","isVisibleComputed","expandedKeysProp","handleSelectionChange","selectedKeys","AriaTree","oe","O","expandedKeys","TreeItem","visibleKeys","isStatic","isViewable","ancestors","v","id","TreeItemContext","rest","item","ie","useContext","renderProps","allowsDragging","ne","state","isLastOfSet","hasChildItems","keys","size","jsxs","g","Ke","Button","handlePress","L","visibility","Hide","te","ee","ChevronUp","$","display","shouldShowSelection","j","ItemLabel","R","ItemDescription","ItemIcon","actions","ItemContent","ItemActions"],"mappings":"ukBAuDEA,MAAAA,CAAAA,IACA,CAAA,EAAA,CAAA,IACA,CAAA,EAAA,CAAA,OACA,CAAA,EAAA,CAAA,OAAAC,CAAAA,EACA,CAAA,IAAAC,CAAAA,EACA,CAAA,KAAA,CAAA,EAAA,CAAAC,OACA,CAAA,EAAA,CAAA,OACEC,CAAAA,CAA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,SAAe,CAAA,CAAA,CAAA,CAAAD,CAAAA,OAEtCf,GAAA,CAAA,KAAA,CAAA,CAAA,SAAc,CAAA,EAAA,CAAA,CAAA,SAErB,CAAA,CAAA,CAAA,CAAA,CAAO8C,QACH,CAAA,CAAA,CAAA,CAAUwC,CAAAA,CACnBxC,CAAAA,WACS,CAAA,mBACA,CAAA,CAAA,CAAA,IAAasC,CAAAA,CACtBtC,EAAS,CAAA,OAAUyC,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,KAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,WAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,UAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,OAAAA,CAAAA,CAAAA","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'use client';\n\nimport 'client-only';\nimport { ChevronDown, ChevronUp, DragVert, Hide, Show } from '@accelint/icons';\nimport {\n createContext,\n memo,\n type PropsWithChildren,\n useContext,\n useMemo,\n} from 'react';\nimport {\n Tree as AriaTree,\n TreeItem as AriaTreeItem,\n TreeItemContent as AriaTreeItemContent,\n composeRenderProps,\n DropIndicator,\n type DropTarget,\n Text,\n type TextProps,\n useDragAndDrop,\n} from 'react-aria-components';\nimport { Cache } from '@/hooks/use-tree/actions/cache';\nimport { Button } from '../button';\nimport { Checkbox } from '../checkbox';\nimport { Icon } from '../icon';\nimport { Lines } from '../lines';\nimport { TreeStyles, TreeStylesDefaults } from './styles';\nimport type { Key, Selection } from '@react-types/shared';\nimport type { IconProps } from '../icon/types';\nimport type {\n TreeContextValue,\n TreeItemContentProps,\n TreeItemContextValue,\n TreeItemProps,\n TreeProps,\n} from './types';\n\nconst {\n tree,\n item,\n content,\n display,\n icon,\n label,\n actions,\n spacing,\n description,\n drag,\n expansion,\n visibility,\n} = TreeStyles();\n\nexport const TreeContext = createContext<TreeContextValue>({\n visibilityComputedKeys: new Set(),\n showRuleLines: true,\n showVisibility: false,\n variant: TreeStylesDefaults.variant,\n isStatic: true,\n onVisibilityChange: () => undefined,\n});\n\nconst defaultRenderDropIndicator = (target: DropTarget) => (\n <DropIndicator target={target} className='border border-highlight-hover' />\n);\n\nconst TreeLines = memo(function TreeLines({\n level,\n isLastOfSet,\n}: {\n level: number;\n isLastOfSet: boolean;\n}) {\n const { showRuleLines, variant } = useContext(TreeContext);\n\n return Array.from({ length: level }).map((_, i) => {\n const type = i === level - 1 ? 'branch' : 'vert';\n const line = isLastOfSet && i > 0 ? 'last' : type;\n const size = variant === 'crammed' ? 'medium' : 'large';\n\n return (\n <Lines\n // biome-ignore lint/suspicious/noArrayIndexKey: index should be the key, only count matters\n key={i}\n variant={line}\n size={size}\n isVisible={showRuleLines}\n className={spacing({ variant })}\n />\n );\n });\n});\n\nexport function Tree<T>({\n children,\n className,\n disabledKeys: disabledKeysProp,\n dragAndDropConfig,\n expandedKeys: expandedKeysProp,\n items,\n selectedKeys: selectedKeysProp,\n showRuleLines = true,\n showVisibility = true,\n selectionMode = 'multiple',\n variant = TreeStylesDefaults.variant,\n visibleKeys: visibleKeysProp,\n onVisibilityChange,\n onSelectionChange,\n ...rest\n}: TreeProps<T>) {\n /**\n * A static collection is hard-coded. Dynamic is data-driven from an external source.\n * https://react-spectrum.adobe.com/react-aria/Tree.html#content\n *\n * Controlled state should only be used on a static tree.\n */\n if (\n items &&\n (disabledKeysProp ||\n expandedKeysProp ||\n selectedKeysProp ||\n visibleKeysProp)\n ) {\n throw new Error(\n 'Tree should only be controlled with state from either `items` or keys props, not both',\n );\n }\n\n /**\n * A static tree won't support the node iterator pattern.\n */\n if (!!items !== (typeof children === 'function')) {\n throw new Error(\n 'Tree `items` and node iterator `children` must be used together',\n );\n }\n\n const { dragAndDropHooks } = useDragAndDrop({\n renderDropIndicator: defaultRenderDropIndicator,\n getAllowedDropOperations: () => ['move'],\n getDropOperation: () => 'move',\n ...dragAndDropConfig,\n });\n const cache = useMemo(() => (items ? new Cache([...items]) : null), [items]);\n const nodes = useMemo(() => cache?.getAllNodes(), [cache]);\n const {\n disabledKeys,\n expandedKeys,\n selectedKeys,\n visibleKeys,\n visibilityComputedKeys,\n } = useMemo(() => {\n const acc = {\n disabledKeys: nodes ? new Set<Key>() : disabledKeysProp,\n expandedKeys: nodes ? new Set<Key>() : expandedKeysProp,\n selectedKeys: nodes ? new Set<Key>() : selectedKeysProp,\n visibleKeys: nodes ? new Set<Key>() : visibleKeysProp,\n visibilityComputedKeys: new Set<Key>(),\n };\n\n if (!nodes) {\n return acc;\n }\n\n return nodes.reduce(\n (\n acc,\n {\n key,\n isDisabled,\n isExpanded,\n isSelected,\n isVisible,\n isVisibleComputed,\n },\n ) => {\n if (isDisabled) {\n acc.disabledKeys?.add(key);\n }\n if (isExpanded) {\n acc.expandedKeys?.add(key);\n }\n if (isSelected) {\n acc.selectedKeys?.add(key);\n }\n if (isVisible) {\n acc.visibleKeys?.add(key);\n }\n if (isVisibleComputed) {\n acc.visibilityComputedKeys.add(key);\n }\n return acc;\n },\n acc,\n );\n }, [\n nodes,\n disabledKeysProp,\n expandedKeysProp,\n selectedKeysProp,\n visibleKeysProp,\n ]);\n\n const handleSelectionChange = selectedKeys\n ? (selection: Selection) => {\n if (selection !== 'all') {\n onSelectionChange?.(selection);\n }\n }\n : undefined;\n\n return (\n <TreeContext.Provider\n value={{\n disabledKeys,\n expandedKeys,\n selectedKeys,\n showRuleLines,\n showVisibility,\n variant,\n visibleKeys,\n visibilityComputedKeys,\n isStatic: typeof children !== 'function',\n onVisibilityChange: onVisibilityChange ?? (() => undefined), // TODO: improve\n }}\n >\n <AriaTree\n {...rest}\n className={composeRenderProps(className, (className) =>\n tree({ className, variant }),\n )}\n disabledKeys={disabledKeys}\n dragAndDropHooks={dragAndDropHooks}\n expandedKeys={expandedKeys}\n items={items}\n selectedKeys={selectedKeys}\n onSelectionChange={handleSelectionChange}\n selectionMode={selectionMode}\n >\n {children}\n </AriaTree>\n </TreeContext.Provider>\n );\n}\nTree.displayName = 'Tree';\n\nexport const TreeItemContext = createContext<TreeItemContextValue>({\n isVisible: true,\n isViewable: true,\n ancestors: [],\n});\n\nexport function TreeItem({ className, id, ...rest }: TreeItemProps) {\n const { visibilityComputedKeys, visibleKeys, isStatic } =\n useContext(TreeContext);\n const { ancestors } = useContext(TreeItemContext);\n const isViewable =\n visibilityComputedKeys?.has(id) ||\n (isStatic && ancestors.every((key) => visibleKeys?.has(key)));\n const isVisible = visibleKeys?.has(id);\n\n return (\n <TreeItemContext.Provider\n value={{\n isVisible,\n isViewable,\n ancestors: [...ancestors, id],\n }}\n >\n <AriaTreeItem\n {...rest}\n id={id}\n className={composeRenderProps(className, (className) =>\n item({ className }),\n )}\n data-viewable={isViewable || null}\n data-visible={isVisible || null}\n />\n </TreeItemContext.Provider>\n );\n}\nTreeItem.displayName = 'Tree.Item';\n\nfunction ItemContent({ children }: TreeItemContentProps) {\n const { showVisibility, variant, visibleKeys, onVisibilityChange } =\n useContext(TreeContext);\n const { isVisible, isViewable } = useContext(TreeItemContext);\n const size = variant === 'cozy' ? 'medium' : 'small';\n\n return (\n <AriaTreeItemContent>\n {(renderProps) => {\n const {\n id,\n allowsDragging,\n hasChildItems,\n level,\n selectionBehavior,\n selectionMode,\n state,\n isDisabled,\n isExpanded,\n isSelected,\n } = renderProps;\n\n const isLastOfSet = !(\n state.collection.getItem(id)?.nextKey || hasChildItems\n );\n const shouldShowSelection =\n selectionBehavior === 'toggle' && selectionMode !== 'none';\n\n const handlePress = () => {\n const keys = new Set<Key>(visibleKeys);\n visibleKeys?.has(id) ? keys.delete(id) : keys.add(id);\n onVisibilityChange?.(keys);\n };\n\n return (\n <Icon.Provider size={size}>\n <div\n className={content({ variant })}\n data-last-of-set={isLastOfSet}\n >\n {showVisibility && (\n <Button\n variant='icon'\n color='info'\n size={size}\n onPress={handlePress}\n isDisabled={isDisabled}\n className={visibility()}\n >\n <Icon>{isVisible ? <Show /> : <Hide />}</Icon>\n </Button>\n )}\n {level > 1 && (\n <TreeLines level={level} isLastOfSet={isLastOfSet} />\n )}\n {hasChildItems ? (\n <Button\n slot='chevron'\n variant='icon'\n size={size}\n className={expansion()}\n >\n <Icon>{isExpanded ? <ChevronDown /> : <ChevronUp />}</Icon>\n </Button>\n ) : (\n <div className={spacing({ variant })} />\n )}\n <div className={display({ variant })}>\n {typeof children === 'function'\n ? children({\n ...renderProps,\n variant,\n isVisible,\n isViewable: isViewable,\n defaultChildren: null,\n })\n : children}\n </div>\n {shouldShowSelection && (\n <Checkbox\n slot='selection'\n isSelected={isSelected}\n isDisabled={isDisabled}\n />\n )}\n {allowsDragging && (\n <Button\n slot='drag'\n variant='icon'\n size={size}\n isDisabled={isDisabled}\n className={drag({})}\n >\n <Icon>\n <DragVert />\n </Icon>\n </Button>\n )}\n </div>\n </Icon.Provider>\n );\n }}\n </AriaTreeItemContent>\n );\n}\nItemContent.displayName = 'Tree.Item.Content';\n\nfunction ItemLabel({ children, className }: TextProps) {\n return <Text className={label({ className })}>{children}</Text>;\n}\nItemLabel.displayName = 'Tree.Item.Label';\n\nfunction ItemDescription({ children, className }: TextProps) {\n const { variant } = useContext(TreeContext);\n\n return variant !== 'crammed' ? (\n <Text\n data-slot='description'\n className={description({ className, variant })}\n >\n {children}\n </Text>\n ) : null;\n}\nItemDescription.displayName = 'Tree.Item.Description';\n\nfunction ItemIcon({ children, className }: IconProps) {\n return <Icon className={icon({ className })}>{children}</Icon>;\n}\nItemIcon.displayName = 'Tree.Item.PrefixIcon';\n\nfunction ItemActions({\n children,\n className,\n}: PropsWithChildren & { className?: string }) {\n return <div className={actions({ className })}>{children}</div>;\n}\nItemActions.displayName = 'Tree.Icon.Actions';\n\nTree.Item = TreeItem;\nTreeItem.Content = ItemContent;\nTreeItem.Label = ItemLabel;\nTreeItem.Description = ItemDescription;\nTreeItem.PrefixIcon = ItemIcon;\nTreeItem.Actions = ItemActions;\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/tree/index.tsx"],"names":["label","description","drag","expansion","TreeStyles","me","B","target","jsx","e","ae","TreeLines","se","showRuleLines","variant","TreeContext","_","i","type","level","Lines","ce","spacing","Tree","children","className","disabledKeysProp","selectionMode","onVisibilityChange","k","onSelectionChange","items","defaultRenderDropIndicator","le","nodes","P","oe","disabledKeys","visibilityComputedKeys","acc","selectedKeysProp","visibleKeysProp","isExpanded","isSelected","isDisabled","key","isVisible","isVisibleComputed","expandedKeysProp","handleSelectionChange","selectedKeys","AriaTree","ie","O","expandedKeys","TreeItem","visibleKeys","isStatic","isViewable","ancestors","v","id","TreeItemContext","rest","item","ne","useContext","renderProps","allowsDragging","re","state","isLastOfSet","hasChildItems","keys","size","jsxs","g","Ke","Button","handlePress","L","visibility","Hide","te","ee","ChevronUp","$","display","shouldShowSelection","j","ItemLabel","R","ItemDescription","ItemIcon","actions","ItemContent","ItemActions"],"mappings":"ukBAuDEA,MAAAA,CAAAA,IACA,CAAA,EAAA,CAAA,IACA,CAAA,EAAA,CAAA,OACA,CAAA,EAAA,CAAA,OAAAC,CAAAA,EACA,CAAA,IAAAC,CAAAA,EACA,CAAA,KAAA,CAAA,EAAA,CAAAC,OACA,CAAA,EAAA,CAAA,OACEC,CAAAA,CAAAA,CAAW,WAGb,CAAA,EAAA,CAAA,IAAA,CAAA,EAAA,CAAA,SAAwB,CAAA,EAAI,CAAA,UAC5B,CAAA,EAAA,CAAA,CAAAC,UAAe,EACf,CAAA,CAAA,CAAAC,aAAA,CAAA,CAAA,sBAC4B,CAAA,IAAA,GAC5B,CAAA,aACA,CAAA,IAAA,CAAA,cAAoB,CAAA,KA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AAasC,CAAAA,CACtBtC,EAAS,CAAA,OAAUyC,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,KAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,WAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,UAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,OAAAA,CAAAA,CAAAA","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'use client';\n\nimport { ChevronDown, ChevronUp, DragVert, Hide, Show } from '@accelint/icons';\nimport { Cache } from '@/hooks/use-tree/actions/cache';\nimport type { Key, Selection } from '@react-types/shared';\nimport 'client-only';\nimport {\n createContext,\n memo,\n type PropsWithChildren,\n useContext,\n useMemo,\n} from 'react';\nimport {\n Tree as AriaTree,\n TreeItem as AriaTreeItem,\n TreeItemContent as AriaTreeItemContent,\n composeRenderProps,\n DropIndicator,\n type DropTarget,\n Text,\n type TextProps,\n useDragAndDrop,\n} from 'react-aria-components';\nimport { Button } from '../button';\nimport { Checkbox } from '../checkbox';\nimport { Icon } from '../icon';\nimport { Lines } from '../lines';\nimport { TreeStyles, TreeStylesDefaults } from './styles';\nimport type { IconProps } from '../icon/types';\nimport type {\n TreeContextValue,\n TreeItemContentProps,\n TreeItemContextValue,\n TreeItemProps,\n TreeProps,\n} from './types';\n\nconst {\n tree,\n item,\n content,\n display,\n icon,\n label,\n actions,\n spacing,\n description,\n drag,\n expansion,\n visibility,\n} = TreeStyles();\n\nexport const TreeContext = createContext<TreeContextValue>({\n visibilityComputedKeys: new Set(),\n showRuleLines: true,\n showVisibility: false,\n variant: TreeStylesDefaults.variant,\n isStatic: true,\n onVisibilityChange: () => undefined,\n});\n\nconst defaultRenderDropIndicator = (target: DropTarget) => (\n <DropIndicator target={target} className='border border-highlight-hover' />\n);\n\nconst TreeLines = memo(function TreeLines({\n level,\n isLastOfSet,\n}: {\n level: number;\n isLastOfSet: boolean;\n}) {\n const { showRuleLines, variant } = useContext(TreeContext);\n\n return Array.from({ length: level }).map((_, i) => {\n const type = i === level - 1 ? 'branch' : 'vert';\n const line = isLastOfSet && i > 0 ? 'last' : type;\n const size = variant === 'crammed' ? 'medium' : 'large';\n\n return (\n <Lines\n // biome-ignore lint/suspicious/noArrayIndexKey: index should be the key, only count matters\n key={i}\n variant={line}\n size={size}\n isVisible={showRuleLines}\n className={spacing({ variant })}\n />\n );\n });\n});\n\nexport function Tree<T>({\n children,\n className,\n disabledKeys: disabledKeysProp,\n dragAndDropConfig,\n expandedKeys: expandedKeysProp,\n items,\n selectedKeys: selectedKeysProp,\n showRuleLines = true,\n showVisibility = true,\n selectionMode = 'multiple',\n variant = TreeStylesDefaults.variant,\n visibleKeys: visibleKeysProp,\n onVisibilityChange,\n onSelectionChange,\n ...rest\n}: TreeProps<T>) {\n /**\n * A static collection is hard-coded. Dynamic is data-driven from an external source.\n * https://react-spectrum.adobe.com/react-aria/Tree.html#content\n *\n * Controlled state should only be used on a static tree.\n */\n if (\n items &&\n (disabledKeysProp ||\n expandedKeysProp ||\n selectedKeysProp ||\n visibleKeysProp)\n ) {\n throw new Error(\n 'Tree should only be controlled with state from either `items` or keys props, not both',\n );\n }\n\n /**\n * A static tree won't support the node iterator pattern.\n */\n if (!!items !== (typeof children === 'function')) {\n throw new Error(\n 'Tree `items` and node iterator `children` must be used together',\n );\n }\n\n const { dragAndDropHooks } = useDragAndDrop({\n renderDropIndicator: defaultRenderDropIndicator,\n getAllowedDropOperations: () => ['move'],\n getDropOperation: () => 'move',\n ...dragAndDropConfig,\n });\n const cache = useMemo(() => (items ? new Cache([...items]) : null), [items]);\n const nodes = useMemo(() => cache?.getAllNodes(), [cache]);\n const {\n disabledKeys,\n expandedKeys,\n selectedKeys,\n visibleKeys,\n visibilityComputedKeys,\n } = useMemo(() => {\n const acc = {\n disabledKeys: nodes ? new Set<Key>() : disabledKeysProp,\n expandedKeys: nodes ? new Set<Key>() : expandedKeysProp,\n selectedKeys: nodes ? new Set<Key>() : selectedKeysProp,\n visibleKeys: nodes ? new Set<Key>() : visibleKeysProp,\n visibilityComputedKeys: new Set<Key>(),\n };\n\n if (!nodes) {\n return acc;\n }\n\n return nodes.reduce(\n (\n acc,\n {\n key,\n isDisabled,\n isExpanded,\n isSelected,\n isVisible,\n isVisibleComputed,\n },\n ) => {\n if (isDisabled) {\n acc.disabledKeys?.add(key);\n }\n if (isExpanded) {\n acc.expandedKeys?.add(key);\n }\n if (isSelected) {\n acc.selectedKeys?.add(key);\n }\n if (isVisible) {\n acc.visibleKeys?.add(key);\n }\n if (isVisibleComputed) {\n acc.visibilityComputedKeys.add(key);\n }\n return acc;\n },\n acc,\n );\n }, [\n nodes,\n disabledKeysProp,\n expandedKeysProp,\n selectedKeysProp,\n visibleKeysProp,\n ]);\n\n const handleSelectionChange = selectedKeys\n ? (selection: Selection) => {\n if (selection !== 'all') {\n onSelectionChange?.(selection);\n }\n }\n : undefined;\n\n return (\n <TreeContext.Provider\n value={{\n disabledKeys,\n expandedKeys,\n selectedKeys,\n showRuleLines,\n showVisibility,\n variant,\n visibleKeys,\n visibilityComputedKeys,\n isStatic: typeof children !== 'function',\n onVisibilityChange: onVisibilityChange ?? (() => undefined), // TODO: improve\n }}\n >\n <AriaTree\n {...rest}\n className={composeRenderProps(className, (className) =>\n tree({ className, variant }),\n )}\n disabledKeys={disabledKeys}\n dragAndDropHooks={dragAndDropHooks}\n expandedKeys={expandedKeys}\n items={items}\n selectedKeys={selectedKeys}\n onSelectionChange={handleSelectionChange}\n selectionMode={selectionMode}\n >\n {children}\n </AriaTree>\n </TreeContext.Provider>\n );\n}\nTree.displayName = 'Tree';\n\nexport const TreeItemContext = createContext<TreeItemContextValue>({\n isVisible: true,\n isViewable: true,\n ancestors: [],\n});\n\nexport function TreeItem({ className, id, ...rest }: TreeItemProps) {\n const { visibilityComputedKeys, visibleKeys, isStatic } =\n useContext(TreeContext);\n const { ancestors } = useContext(TreeItemContext);\n const isViewable =\n visibilityComputedKeys?.has(id) ||\n (isStatic && ancestors.every((key) => visibleKeys?.has(key)));\n const isVisible = visibleKeys?.has(id);\n\n return (\n <TreeItemContext.Provider\n value={{\n isVisible,\n isViewable,\n ancestors: [...ancestors, id],\n }}\n >\n <AriaTreeItem\n {...rest}\n id={id}\n className={composeRenderProps(className, (className) =>\n item({ className }),\n )}\n data-viewable={isViewable || null}\n data-visible={isVisible || null}\n />\n </TreeItemContext.Provider>\n );\n}\nTreeItem.displayName = 'Tree.Item';\n\nfunction ItemContent({ children }: TreeItemContentProps) {\n const { showVisibility, variant, visibleKeys, onVisibilityChange } =\n useContext(TreeContext);\n const { isVisible, isViewable } = useContext(TreeItemContext);\n const size = variant === 'cozy' ? 'medium' : 'small';\n\n return (\n <AriaTreeItemContent>\n {(renderProps) => {\n const {\n id,\n allowsDragging,\n hasChildItems,\n level,\n selectionBehavior,\n selectionMode,\n state,\n isDisabled,\n isExpanded,\n isSelected,\n } = renderProps;\n\n const isLastOfSet = !(\n state.collection.getItem(id)?.nextKey || hasChildItems\n );\n const shouldShowSelection =\n selectionBehavior === 'toggle' && selectionMode !== 'none';\n\n const handlePress = () => {\n const keys = new Set<Key>(visibleKeys);\n visibleKeys?.has(id) ? keys.delete(id) : keys.add(id);\n onVisibilityChange?.(keys);\n };\n\n return (\n <Icon.Provider size={size}>\n <div\n className={content({ variant })}\n data-last-of-set={isLastOfSet}\n >\n {showVisibility && (\n <Button\n variant='icon'\n color='mono-bold'\n size={size}\n onPress={handlePress}\n isDisabled={isDisabled}\n className={visibility()}\n >\n <Icon>{isVisible ? <Show /> : <Hide />}</Icon>\n </Button>\n )}\n {level > 1 && (\n <TreeLines level={level} isLastOfSet={isLastOfSet} />\n )}\n {hasChildItems ? (\n <Button\n slot='chevron'\n variant='icon'\n size={size}\n className={expansion()}\n >\n <Icon>{isExpanded ? <ChevronDown /> : <ChevronUp />}</Icon>\n </Button>\n ) : (\n <div className={spacing({ variant })} />\n )}\n <div className={display({ variant })}>\n {typeof children === 'function'\n ? children({\n ...renderProps,\n variant,\n isVisible,\n isViewable: isViewable,\n defaultChildren: null,\n })\n : children}\n </div>\n {shouldShowSelection && (\n <Checkbox\n slot='selection'\n isSelected={isSelected}\n isDisabled={isDisabled}\n />\n )}\n {allowsDragging && (\n <Button\n slot='drag'\n variant='icon'\n size={size}\n isDisabled={isDisabled}\n className={drag({})}\n >\n <Icon>\n <DragVert />\n </Icon>\n </Button>\n )}\n </div>\n </Icon.Provider>\n );\n }}\n </AriaTreeItemContent>\n );\n}\nItemContent.displayName = 'Tree.Item.Content';\n\nfunction ItemLabel({ children, className }: TextProps) {\n return <Text className={label({ className })}>{children}</Text>;\n}\nItemLabel.displayName = 'Tree.Item.Label';\n\nfunction ItemDescription({ children, className }: TextProps) {\n const { variant } = useContext(TreeContext);\n\n return variant !== 'crammed' ? (\n <Text\n data-slot='description'\n className={description({ className, variant })}\n >\n {children}\n </Text>\n ) : null;\n}\nItemDescription.displayName = 'Tree.Item.Description';\n\nfunction ItemIcon({ children, className }: IconProps) {\n return <Icon className={icon({ className })}>{children}</Icon>;\n}\nItemIcon.displayName = 'Tree.Item.PrefixIcon';\n\nfunction ItemActions({\n children,\n className,\n}: PropsWithChildren & { className?: string }) {\n return <div className={actions({ className })}>{children}</div>;\n}\nItemActions.displayName = 'Tree.Icon.Actions';\n\nTree.Item = TreeItem;\nTreeItem.Content = ItemContent;\nTreeItem.Label = ItemLabel;\nTreeItem.Description = ItemDescription;\nTreeItem.PrefixIcon = ItemIcon;\nTreeItem.Actions = ItemActions;\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {tv}from'./../../lib/utils.js';const t={variant:"cozy"},a=tv({slots:{tree:"overflow-auto outline-hidden",item:["not-visible:fg-primary-muted not-viewable:fg-primary-muted fg-primary-bold px-s","group/tree-item rounded-medium hover:bg-interactive-muted-hover","drop-target:border drop-target:bg-accent-primary-muted/20 drop-target:outline-accent-primary-bold","disabled:cursor-not-allowed disabled:border-none disabled:hover:bg-transparent disabled:data-[drop-target=true]:bg-transparent"],content:["flex items-center justify-items-start px-xs","overflow-x group w-full outline-hidden"],display:'grid flex-1 grid-cols-[auto_auto_1fr_auto] items-center [grid-template-areas:"icon_label_space_action"_"icon_description_space_action"]',icon:"[grid-area:icon]",label:"not-has-[+[data-slot=description]]:row-span-full [grid-area:label]",description:"fg-primary-muted text-body-s [grid-area:description]",actions:"flex shrink-0 items-center [grid-area:action]",spacing:"",visibility:["group-not-visible/tree-item:enabled:color-
|
|
1
|
+
import {tv}from'./../../lib/utils.js';const t={variant:"cozy"},a=tv({slots:{tree:"overflow-auto outline-hidden",item:["not-visible:fg-primary-muted not-viewable:fg-primary-muted fg-primary-bold px-s","group/tree-item rounded-medium hover:bg-interactive-muted-hover","drop-target:border drop-target:bg-accent-primary-muted/20 drop-target:outline-accent-primary-bold","disabled:cursor-not-allowed disabled:border-none disabled:hover:bg-transparent disabled:data-[drop-target=true]:bg-transparent"],content:["flex items-center justify-items-start px-xs","overflow-x group w-full outline-hidden"],display:'grid flex-1 grid-cols-[auto_auto_1fr_auto] items-center [grid-template-areas:"icon_label_space_action"_"icon_description_space_action"]',icon:"[grid-area:icon]",label:"not-has-[+[data-slot=description]]:row-span-full [grid-area:label]",description:"fg-primary-muted text-body-s [grid-area:description]",actions:"flex shrink-0 items-center [grid-area:action]",spacing:"",visibility:["group-not-visible/tree-item:enabled:color-mono-bold:fg-primary-muted","group-not-viewable/tree-item:enabled:color-mono-bold:fg-primary-muted fg-primary-bold","fg-primary-bold"],expansion:["group-not-visible/tree-item:enabled:color-mono-bold:fg-primary-muted","group-not-viewable/tree-item:enabled:color-mono-bold:fg-primary-muted fg-primary-bold","fg-primary-bold"],drag:["group-not-visible/tree-item:enabled:color-mono-bold:fg-primary-muted","group-not-viewable/tree-item:enabled:color-mono-bold:fg-primary-muted fg-primary-bold","fg-primary-bold"]},variants:{variant:{cozy:{content:"min-h-[48px] text-header-m",display:"gap-x-s px-xs",label:"gap-xs",actions:"gap-x-xs",spacing:"min-h-[46px] w-[28px]",item:"min-h-s"},compact:{content:"min-h-[36px] gap-xs text-header-s",display:"gap-x-s px-xxs",label:"gap-xs",actions:"gap-x-xxs",spacing:"min-h-[38px] w-[20px]",item:"min-h-l"},crammed:{content:"gap-xs text-header-s",display:"gap-x-xs px-xxs",label:"gap-xs",actions:"gap-x-xxs",spacing:"min-h-xl w-[20px]",item:"min-h-s"}}},defaultVariants:t});export{a as TreeStyles,t as TreeStylesDefaults};//# sourceMappingURL=styles.js.map
|
|
2
2
|
//# sourceMappingURL=styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/tree/styles.ts"],"names":["TreeStyles","tv","e"],"mappings":"sCAeE,MAAA,CAAS,CAAA,CAAA,OAGEA,CAAaC,SACjB,CACLC,EAAA,CAAA,CAAA,KAAM,CAAA,CAAA,IAAA,CAAA,8BAEJ,CAAA,IAAA,CAAA,CAAA,iFACA,CAAA,iEACA,CAAA,mGACA,CAAA,gIAEO,CACP,CAAA,OAAA,CAAA,CAAA,6CACA,CAAA,wCAGA,CAAA,CAAA,OAAA,CAAA,yIACI,CAAA,IAAA,CAAA,kBACC,CAAA,KAAA,CAAA,gFACM,CAAA,sDACJ,CAAA,OAAA,CAAA,+CACA,CAAA,OACT,CAAA,EAAA,CAAA,UACE,CAAA,CAAA,
|
|
1
|
+
{"version":3,"sources":["../../../src/components/tree/styles.ts"],"names":["TreeStyles","tv","e"],"mappings":"sCAeE,MAAA,CAAS,CAAA,CAAA,OAGEA,CAAaC,SACjB,CACLC,EAAA,CAAA,CAAA,KAAM,CAAA,CAAA,IAAA,CAAA,8BAEJ,CAAA,IAAA,CAAA,CAAA,iFACA,CAAA,iEACA,CAAA,mGACA,CAAA,gIAEO,CACP,CAAA,OAAA,CAAA,CAAA,6CACA,CAAA,wCAGA,CAAA,CAAA,OAAA,CAAA,yIACI,CAAA,IAAA,CAAA,kBACC,CAAA,KAAA,CAAA,gFACM,CAAA,sDACJ,CAAA,OAAA,CAAA,+CACA,CAAA,OACT,CAAA,EAAA,CAAA,UACE,CAAA,CAAA,sEACA,CAAA,uFACA,CAAA,iBAEF,CAAA,CAAW,SACT,CAAA,CAAA,sEACA,CAAA,uFACA,CAAA,iBAGA,CAAA,CAAA,IAAA,CAAA,CAAA,sEACA,CAAA,yGAIJ,CAAA,CAAU,CACR,QAAS,CACP,QACE,CAAA,CAAA,IAAS,CAAA,CAAA,OAAA,CAAA,4BACA,CAAA,OAAA,CAAA,qBAET,CAAA,QAAS,CAAA,OAAA,CAAA,UACA,CAAA,OAAA,CAAA,uBACH,CAAA,IACR,CAAA,SACS,CACP,CAAA,OAAS,CAAA,CAAA,OAAA,CAAA,mCACA,CAAA,OAAA,CAAA,sBAET,CAAA,QAAS,CAAA,OAAA,CAAA,WACA,CAAA,OAAA,CAAA,uBACH,CAAA,IACR,UACS,CACP,CAAA,OAAS,CAAA,CAAA,OAAA,CAAA,sBACA,CAAA,OAAA,CAAA,iBACF,CAAA,KACP,CAAA,QAAS,CAAA,OAAA,CAAA,WACA,CAAA,OAAA,CAAA,mBACH,CAAA,IACR,CACF,SAEF,CAAA,CAAA,CAAA,CAAA,eACD,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 */\n\nimport { tv } from '@/lib/utils';\n\nexport const TreeStylesDefaults = {\n variant: 'cozy',\n} as const;\n\nexport const TreeStyles = tv({\n slots: {\n tree: 'overflow-auto outline-hidden',\n item: [\n 'not-visible:fg-primary-muted not-viewable:fg-primary-muted fg-primary-bold px-s',\n 'group/tree-item rounded-medium hover:bg-interactive-muted-hover',\n 'drop-target:border drop-target:bg-accent-primary-muted/20 drop-target:outline-accent-primary-bold',\n 'disabled:cursor-not-allowed disabled:border-none disabled:hover:bg-transparent disabled:data-[drop-target=true]:bg-transparent',\n ],\n content: [\n 'flex items-center justify-items-start px-xs',\n 'overflow-x group w-full outline-hidden',\n ],\n display:\n 'grid flex-1 grid-cols-[auto_auto_1fr_auto] items-center [grid-template-areas:\"icon_label_space_action\"_\"icon_description_space_action\"]',\n icon: '[grid-area:icon]',\n label: 'not-has-[+[data-slot=description]]:row-span-full [grid-area:label]',\n description: 'fg-primary-muted text-body-s [grid-area:description]',\n actions: 'flex shrink-0 items-center [grid-area:action]',\n spacing: '',\n visibility: [\n 'group-not-visible/tree-item:enabled:color-mono-bold:fg-primary-muted',\n 'group-not-viewable/tree-item:enabled:color-mono-bold:fg-primary-muted fg-primary-bold',\n 'fg-primary-bold',\n ],\n expansion: [\n 'group-not-visible/tree-item:enabled:color-mono-bold:fg-primary-muted',\n 'group-not-viewable/tree-item:enabled:color-mono-bold:fg-primary-muted fg-primary-bold',\n 'fg-primary-bold',\n ],\n drag: [\n 'group-not-visible/tree-item:enabled:color-mono-bold:fg-primary-muted',\n 'group-not-viewable/tree-item:enabled:color-mono-bold:fg-primary-muted fg-primary-bold',\n 'fg-primary-bold',\n ],\n },\n variants: {\n variant: {\n cozy: {\n content: 'min-h-[48px] text-header-m',\n display: 'gap-x-s px-xs',\n label: 'gap-xs',\n actions: 'gap-x-xs',\n spacing: 'min-h-[46px] w-[28px]',\n item: 'min-h-s',\n },\n compact: {\n content: 'min-h-[36px] gap-xs text-header-s',\n display: 'gap-x-s px-xxs',\n label: 'gap-xs',\n actions: 'gap-x-xxs',\n spacing: 'min-h-[38px] w-[20px]',\n item: 'min-h-l',\n },\n crammed: {\n content: 'gap-xs text-header-s',\n display: 'gap-x-xs px-xxs',\n label: 'gap-xs',\n actions: 'gap-x-xxs',\n spacing: 'min-h-xl w-[20px]',\n item: 'min-h-s',\n },\n },\n },\n defaultVariants: TreeStylesDefaults,\n});\n"]}
|