@accelint/design-toolkit 5.2.0 → 6.0.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/catalog-info.yaml +44 -0
- package/dist/components/accordion/index.js +1 -1
- package/dist/components/accordion/index.js.map +1 -1
- package/dist/components/accordion/styles.d.ts +3 -3
- package/dist/components/accordion/styles.js +1 -1
- package/dist/components/accordion/styles.js.map +1 -1
- package/dist/components/action-bar/index.d.ts +11 -0
- package/dist/components/action-bar/index.js.map +1 -1
- package/dist/components/breadcrumbs/index.d.ts +12 -0
- package/dist/components/breadcrumbs/index.js.map +1 -1
- package/dist/components/button/styles.js +1 -1
- package/dist/components/button/styles.js.map +1 -1
- package/dist/components/clock/index.d.ts +39 -0
- package/dist/components/clock/index.js +4 -0
- package/dist/components/clock/index.js.map +1 -0
- package/dist/components/clock/types.d.ts +7 -0
- package/dist/components/clock/types.js +2 -0
- package/dist/components/clock/types.js.map +1 -0
- package/dist/components/combobox-field/index.d.ts +11 -0
- package/dist/components/combobox-field/index.js.map +1 -1
- package/dist/components/combobox-field/styles.js +1 -1
- package/dist/components/combobox-field/styles.js.map +1 -1
- package/dist/components/dialog/index.js +1 -1
- package/dist/components/dialog/index.js.map +1 -1
- package/dist/components/drawer/index.d.ts +36 -1
- package/dist/components/drawer/index.js +1 -1
- package/dist/components/drawer/index.js.map +1 -1
- package/dist/components/lines/index.d.ts +9 -0
- package/dist/components/lines/index.js.map +1 -1
- package/dist/components/link/index.d.ts +9 -0
- package/dist/components/link/index.js.map +1 -1
- package/dist/components/link/styles.js +1 -1
- package/dist/components/link/styles.js.map +1 -1
- package/dist/components/notice/events.d.ts +10 -0
- package/dist/components/notice/events.js +2 -0
- package/dist/components/notice/events.js.map +1 -0
- package/dist/components/notice/index.d.ts +20 -0
- package/dist/components/notice/index.js +4 -0
- package/dist/components/notice/index.js.map +1 -0
- package/dist/components/notice/styles.d.ts +60 -0
- package/dist/components/notice/styles.js +2 -0
- package/dist/components/notice/styles.js.map +1 -0
- package/dist/components/notice/types.d.ts +75 -0
- package/dist/components/notice/types.js +2 -0
- package/dist/components/notice/types.js.map +1 -0
- package/dist/components/query-builder/index.js +1 -1
- package/dist/components/query-builder/index.js.map +1 -1
- package/dist/components/sidenav/index.d.ts +56 -0
- package/dist/components/sidenav/index.js +1 -1
- package/dist/components/sidenav/index.js.map +1 -1
- package/dist/components/slider/index.js +1 -1
- package/dist/components/slider/index.js.map +1 -1
- package/dist/components/slider/styles.js +1 -1
- package/dist/components/slider/styles.js.map +1 -1
- package/dist/components/table/index.d.ts +9 -0
- package/dist/components/table/index.js +1 -1
- package/dist/components/table/index.js.map +1 -1
- package/dist/components/tabs/styles.js +1 -1
- package/dist/components/tabs/styles.js.map +1 -1
- package/dist/components/time-field/index.d.ts +9 -0
- package/dist/components/time-field/index.js.map +1 -1
- package/dist/components/tooltip/index.d.ts +23 -34
- package/dist/components/tooltip/index.js +1 -1
- package/dist/components/tooltip/index.js.map +1 -1
- package/dist/components/tooltip/types.d.ts +5 -6
- package/dist/components/tree/index.d.ts +22 -1
- 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/components/view-stack/index.d.ts +42 -2
- package/dist/components/view-stack/index.js +1 -1
- package/dist/components/view-stack/index.js.map +1 -1
- package/dist/index.css +5 -3
- package/dist/index.d.ts +12 -5
- package/dist/index.js +1 -1
- package/dist/metafile-esm.json +1 -1
- package/dist/providers/portal.d.ts +9 -0
- package/dist/providers/portal.js +2 -0
- package/dist/providers/portal.js.map +1 -0
- package/dist/providers/theme-provider.d.ts +6 -6
- package/dist/providers/theme-provider.js +1 -1
- package/dist/providers/theme-provider.js.map +1 -1
- package/dist/styles.css +372 -128
- package/package.json +33 -17
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import {jsx,jsxs,Fragment}from'react/jsx-runtime';import'client-only';import {useOn,useEmit}from'@accelint/bus/react';import {uuid,isUUID}from'@accelint/core';import {ChevronLeft,ArrowNortheast,ChevronDown}from'@accelint/icons';import {createContext,useState,useContext,useRef}from'react';import {Provider,HeadingContext,DEFAULT_SLOT,Header,Button,composeRenderProps,Pressable,Text,TextContext,ToggleButton,Link,Heading,Disclosure,DisclosurePanel,DialogTrigger,Popover}from'react-aria-components';import {containsExactChildren,containsAnyOfExactChildren}from'./../../lib/react.js';import {Avatar,AvatarContext}from'../avatar/index.js';import {DividerContext}from'../divider/index.js';import {Icon,IconContext}from'../icon/index.js';import {Tooltip}from'../tooltip/index.js';import {SidenavEventTypes}from'./events.js';import {SidenavStyles}from'./styles.js';const{sidenav:
|
|
3
|
+
import {jsx,jsxs,Fragment}from'react/jsx-runtime';import'client-only';import {useOn,useEmit}from'@accelint/bus/react';import {uuid,isUUID}from'@accelint/core';import {ChevronLeft,ArrowNortheast,ChevronDown}from'@accelint/icons';import {createContext,useState,useContext,useRef}from'react';import {Provider,HeadingContext,DEFAULT_SLOT,Header,Button,composeRenderProps,Pressable,Text,TextContext,ToggleButton,Link,Heading,Disclosure,DisclosurePanel,DialogTrigger,Popover}from'react-aria-components';import {containsExactChildren,containsAnyOfExactChildren}from'./../../lib/react.js';import {Avatar,AvatarContext}from'../avatar/index.js';import {DividerContext}from'../divider/index.js';import {Icon,IconContext}from'../icon/index.js';import {Tooltip}from'../tooltip/index.js';import {SidenavEventTypes}from'./events.js';import {SidenavStyles}from'./styles.js';const{sidenav:ve,content:pe,header:ce,toggle:ue,heading:ge,divider:Ne,item:Se,text:z,transient:p,avatar:fe,avatarHeading:Pe,avatarIcon:V,avatarText:xe,link:Te,tooltip:b,menu:Ce,menuButton:_,menuHeading:ye,menuPanel:Ie,menuItem:Ee,panelHeading:He,panelContent:G}=SidenavStyles(),f=createContext({id:uuid(),isOpen:false});function d({id:a,className:t,isHiddenWhenClosed:n,children:i,...r}){containsExactChildren({children:i,componentName:d.displayName,restrictions:[[L,{min:1,max:1}],[A,{min:1,max:1}],[M,{min:0,max:1}]]});const[o,m]=useState(false);return useOn(SidenavEventTypes.toggle,s=>{s.payload.id===a&&m(K=>!K);}),useOn(SidenavEventTypes.open,s=>{!o&&s.payload.id===a&&m(true);}),useOn(SidenavEventTypes.close,s=>{o&&s.payload.id===a&&m(false);}),n&&!o?null:jsx(Provider,{values:[[HeadingContext,{slots:{[DEFAULT_SLOT]:{className:ge({className:p()})},menu:{className:ye({className:p()})},panel:{className:He()}}}],[f,{id:a,isOpen:o}]],children:jsx("nav",{...r,className:ve({className:t}),"data-open":o||null,children:i})})}d.displayName="Sidenav";function A({className:a,children:t,...n}){return jsx(Provider,{values:[[DividerContext,{className:Ne()}]],children:jsx("div",{...n,className:pe({className:a}),children:t})})}A.displayName="Sidenav.Content";function L({children:a,classNames:t,...n}){const i=useEmit(SidenavEventTypes.toggle),{id:r}=useContext(f);return jsx(Header,{...n,className:ce({className:t?.header}),children:jsxs(Button,{className:composeRenderProps(t?.button,o=>ue({className:o})),onPress:()=>i({id:r}),children:[a,jsx(Icon,{className:p(),children:jsx(ChevronLeft,{})})]})})}L.displayName="Sidenav.Header";function M(a){return jsx("footer",{...a})}M.displayName="Sidenav.Footer";function J({children:a,for:t,...n}){const[i,r]=isUUID(t)?["toggle",t]:t.split(":"),o=useEmit(SidenavEventTypes[i]);return jsx(Pressable,{...n,onPress:()=>o({id:r}),children:a})}J.displayName="Sidenav.Trigger";function k({children:a,classNames:t,textValue:n,...i}){containsAnyOfExactChildren({children:a,componentName:k.displayName,restrictions:[[[C,{min:1,max:1}]],[[Icon,{min:1,max:1}],[Text,{min:1,max:1}]]]});const{isOpen:r}=useContext(f),o=useRef(null);return jsx(Provider,{values:[[IconContext,{size:"medium"}],[TextContext,{className:z({className:p()})}]],children:jsxs(Tooltip.Trigger,{isDisabled:r,children:[jsx(ToggleButton,{...i,ref:o,className:composeRenderProps(t?.button,m=>Se({className:m})),children:a}),jsx(Tooltip,{parentRef:o,placement:"right",className:b(),children:n})]})})}k.displayName="Sidenav.Item";function B({children:a,classNames:t,textValue:n,...i}){containsExactChildren({children:a,componentName:B.displayName,restrictions:[[Icon,{min:1,max:1}],[Text,{min:1,max:1}]]});const{isOpen:r}=useContext(f),o=useRef(null);return jsx(Provider,{values:[[TextContext,{className:z({className:p()})}]],children:jsxs(Tooltip.Trigger,{isDisabled:r,children:[jsx(Link,{...i,ref:o,className:composeRenderProps(t?.button,m=>Te({className:m})),children:composeRenderProps(a,m=>jsxs(Fragment,{children:[m,jsx(Icon,{className:p(),children:jsx(ArrowNortheast,{})})]}))}),jsxs(Tooltip,{parentRef:o,placement:"right",className:b(),children:[n,jsx(Icon,{children:jsx(ArrowNortheast,{})})]})]})})}B.displayName="Sidenav.Link";function C({children:a,className:t,...n}){return containsAnyOfExactChildren({children:a,componentName:C.displayName,restrictions:[[[Avatar,{min:1,max:1}],[Heading,{min:1,max:1}],[Text,{min:0,max:1}]],[[Icon,{min:1,max:1}],[Heading,{min:1,max:1}],[Text,{min:0,max:1}]]]}),jsx(Provider,{values:[[IconContext,{size:"large",className:V()}],[HeadingContext,{className:Pe({className:p()})}],[TextContext,{className:xe({className:p()})}],[AvatarContext,{classNames:{avatar:V()}}]],children:jsx("div",{...n,className:fe({className:t}),children:a})})}C.displayName="Sidenav.Avatar";function y({icon:a,title:t,classNames:n,children:i,...r}){containsExactChildren({children:i,componentName:y.displayName,restrictions:[[I,{min:2}]]});const{isOpen:o}=useContext(f),m=useRef(null);return o?jsxs(Disclosure,{className:composeRenderProps(n?.menu,s=>Ce({className:s})),children:[jsxs(Button,{...r,slot:"trigger",className:composeRenderProps(n?.button,s=>_({className:s})),children:[a,jsx(Heading,{slot:"menu",children:t}),jsx(Icon,{className:p({className:n?.icon}),children:jsx(ChevronDown,{className:"transform group-expanded/menu:rotate-180"})})]}),jsx(DisclosurePanel,{className:composeRenderProps(n?.disclosurePanel,s=>s??""),children:jsx("div",{className:G({className:n?.panelContent}),children:i})})]}):jsxs(DialogTrigger,{children:[jsxs(Tooltip.Trigger,{isDisabled:o,children:[jsx(Button,{...r,ref:m,className:composeRenderProps(n?.button,s=>_({className:s})),children:a}),jsx(Tooltip,{parentRef:m,placement:"right",className:b(),children:t})]}),jsxs(Popover,{className:composeRenderProps(n?.popoverPanel,s=>Ie({className:s})),placement:"right top",shouldFlip:false,children:[jsx(Heading,{slot:"panel",children:t}),jsx("div",{className:G({className:n?.panelContent}),children:i})]})]})}y.displayName="Sidenav.Menu";function I({className:a,children:t,...n}){return containsExactChildren({children:t,componentName:I.displayName,restrictions:[[Text,{min:1,max:1}]]}),jsx(ToggleButton,{...n,className:composeRenderProps(a,i=>Ee({className:i})),children:t})}I.displayName="Sidenav.Menu.Item",y.Item=I,d.Trigger=J,d.Header=L,d.Item=k,d.Link=B,d.Avatar=C,d.Footer=M,d.Content=A,d.Menu=y;export{d as Sidenav};//# sourceMappingURL=index.js.map
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/sidenav/index.tsx"],"names":["heading","item","text","transient","avatar","avatarIcon","menuItem","panelHeading","panelContent","SidenavStyles","uuid","Sidenav","className","de","Z","W","containsExactChildren","SidenavHeader","setIsOpen","useState","SidenavEventTypes","data","id","prev","useOn","isOpen","isHiddenWhenClosed","jsx","Provider","B","S","HeadingContext","e","g","R","j","SidenavContext","sidenav","children","SidenavContent","rest","content","le","useContext","classNames","P","Button","oe","p","H","emit","l","Icon","u","props","Y","SidenavFooter","SidenavTrigger","type","useEmit","event","Pressable","se","SidenavItem","SidenavAvatar","ref","N","IconContext","TextContext","E","w","jsxs","Tooltip","D","v","composeRenderProps","U","SidenavLink","useRef","te","He","h","tooltip","Avatar","Heading","T","Text","avatarHeading","avatarText","AvatarContext","me","SidenavMenu","title","SidenavMenuItem","Disclosure","menu","X","ne","ee","icon","menuPanel","ie"],"mappings":"01BAkEEA,KACA,CAAA,OACA,CAAA,EAAA,CA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A,CAAAA,CAAAA,CAAAA,CAAAA,IAAAA,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 { useEmit, useOn } from '@accelint/bus/react';\nimport { isUUID, type UniqueId, uuid } from '@accelint/core';\nimport { ArrowNortheast, ChevronDown, ChevronLeft } from '@accelint/icons';\nimport { createContext, useContext, useRef, useState } from 'react';\nimport {\n Button,\n composeRenderProps,\n DEFAULT_SLOT,\n DialogTrigger,\n Disclosure,\n DisclosurePanel,\n Header,\n Heading,\n HeadingContext,\n Link,\n Popover,\n Pressable,\n Provider,\n Text,\n TextContext,\n ToggleButton,\n} from 'react-aria-components';\nimport { containsAnyOfExactChildren, containsExactChildren } from '@/lib/react';\nimport { Avatar, AvatarContext } from '../avatar';\nimport { DividerContext } from '../divider';\nimport { Icon, IconContext } from '../icon';\nimport { Tooltip } from '../tooltip';\nimport { SidenavEventTypes } from './events';\nimport { SidenavStyles } from './styles';\nimport type {\n SidenavAvatarProps,\n SidenavCloseEvent,\n SidenavContentProps,\n SidenavContextValue,\n SidenavEvent,\n SidenavFooterProps,\n SidenavHeaderProps,\n SidenavItemProps,\n SidenavLinkProps,\n SidenavMenuItemProps,\n SidenavMenuProps,\n SidenavOpenEvent,\n SidenavProps,\n SidenavToggleEvent,\n SidenavTriggerProps,\n} from './types';\n\nconst {\n sidenav,\n content,\n header,\n toggle,\n heading,\n divider,\n item,\n text,\n transient,\n avatar,\n avatarHeading,\n avatarIcon,\n avatarText,\n link,\n tooltip,\n menu,\n menuButton,\n menuHeading,\n menuPanel,\n menuItem,\n panelHeading,\n panelContent,\n} = SidenavStyles();\n\nconst SidenavContext = createContext<SidenavContextValue>({\n id: uuid(),\n isOpen: false,\n});\n\nexport function Sidenav({\n id,\n className,\n isHiddenWhenClosed,\n children,\n ...rest\n}: SidenavProps) {\n containsExactChildren({\n children,\n componentName: Sidenav.displayName,\n restrictions: [\n [SidenavHeader, { min: 1, max: 1 }],\n [SidenavContent, { min: 1, max: 1 }],\n [SidenavFooter, { min: 0, max: 1 }],\n ],\n });\n const [isOpen, setIsOpen] = useState(false);\n\n useOn(SidenavEventTypes.toggle, (data: SidenavToggleEvent) => {\n if (data.payload.id === id) {\n setIsOpen((prev) => !prev);\n }\n });\n\n useOn(SidenavEventTypes.open, (data: SidenavOpenEvent) => {\n if (!isOpen && data.payload.id === id) {\n setIsOpen(true);\n }\n });\n\n useOn(SidenavEventTypes.close, (data: SidenavCloseEvent) => {\n if (isOpen && data.payload.id === id) {\n setIsOpen(false);\n }\n });\n\n if (isHiddenWhenClosed && !isOpen) {\n return null;\n }\n\n return (\n <Provider\n values={[\n [\n HeadingContext,\n {\n slots: {\n [DEFAULT_SLOT]: {\n className: heading({ className: transient() }),\n },\n menu: { className: menuHeading({ className: transient() }) },\n panel: { className: panelHeading() },\n },\n },\n ],\n [SidenavContext, { id, isOpen }],\n ]}\n >\n <nav\n {...rest}\n className={sidenav({ className })}\n data-open={isOpen || null}\n >\n {children}\n </nav>\n </Provider>\n );\n}\nSidenav.displayName = 'Sidenav';\n\nfunction SidenavContent({ className, children, ...rest }: SidenavContentProps) {\n return (\n <Provider values={[[DividerContext, { className: divider() }]]}>\n <div {...rest} className={content({ className })}>\n {children}\n </div>\n </Provider>\n );\n}\nSidenavContent.displayName = 'Sidenav.Content';\n\nfunction SidenavHeader({ children, classNames, ...rest }: SidenavHeaderProps) {\n const emit = useEmit<SidenavToggleEvent>(SidenavEventTypes.toggle);\n const { id } = useContext(SidenavContext);\n\n return (\n <Header {...rest} className={header({ className: classNames?.header })}>\n <Button\n className={composeRenderProps(classNames?.button, (className) =>\n toggle({ className }),\n )}\n onPress={() => emit({ id })}\n >\n {children}\n <Icon className={transient()}>\n <ChevronLeft />\n </Icon>\n </Button>\n </Header>\n );\n}\nSidenavHeader.displayName = 'Sidenav.Header';\n\nfunction SidenavFooter(props: SidenavFooterProps) {\n return <footer {...props} />;\n}\nSidenavFooter.displayName = 'Sidenav.Footer';\n\nfunction SidenavTrigger({ children, for: type, ...rest }: SidenavTriggerProps) {\n const [event, id] = (isUUID(type) ? ['toggle', type] : type.split(':')) as [\n 'close' | 'open' | 'toggle',\n UniqueId,\n ];\n const emit = useEmit<SidenavEvent>(SidenavEventTypes[event]);\n\n return (\n <Pressable {...rest} onPress={() => emit({ id })}>\n {children}\n </Pressable>\n );\n}\nSidenavTrigger.displayName = 'Sidenav.Trigger';\n\nfunction SidenavItem({\n children,\n classNames,\n textValue,\n ...rest\n}: SidenavItemProps) {\n containsAnyOfExactChildren({\n children,\n componentName: SidenavItem.displayName,\n restrictions: [\n [[SidenavAvatar, { min: 1, max: 1 }]],\n [\n [Icon, { min: 1, max: 1 }],\n [Text, { min: 1, max: 1 }],\n ],\n ],\n });\n\n const { isOpen } = useContext(SidenavContext);\n\n // Implement ref to place tooltip inside Button DOM to enable contextual styling\n const ref = useRef(null);\n\n return (\n <Provider\n values={[\n [IconContext, { size: 'medium' }],\n [TextContext, { className: text({ className: transient() }) }],\n ]}\n >\n <Tooltip isDisabled={isOpen}>\n <Tooltip.Trigger>\n <ToggleButton\n {...rest}\n ref={ref}\n className={composeRenderProps(classNames?.button, (className) =>\n item({ className }),\n )}\n >\n {children}\n </ToggleButton>\n </Tooltip.Trigger>\n <Tooltip.Body parentRef={ref} placement='right' className={tooltip()}>\n {textValue}\n </Tooltip.Body>\n </Tooltip>\n </Provider>\n );\n}\nSidenavItem.displayName = 'Sidenav.Item';\n\nfunction SidenavLink({\n children,\n classNames,\n textValue,\n ...rest\n}: SidenavLinkProps) {\n containsExactChildren({\n children,\n componentName: SidenavLink.displayName,\n restrictions: [\n [Icon, { min: 1, max: 1 }],\n [Text, { min: 1, max: 1 }],\n ],\n });\n\n const { isOpen } = useContext(SidenavContext);\n\n // Implement ref to place tooltip inside Link DOM to enable contextual styling\n const ref = useRef(null);\n\n return (\n <Provider\n values={[[TextContext, { className: text({ className: transient() }) }]]}\n >\n <Tooltip isDisabled={isOpen}>\n <Tooltip.Trigger>\n <Link\n {...rest}\n ref={ref}\n className={composeRenderProps(classNames?.button, (className) =>\n link({ className }),\n )}\n >\n {composeRenderProps(children, (children) => (\n <>\n {children}\n <Icon className={transient()}>\n <ArrowNortheast />\n </Icon>\n </>\n ))}\n </Link>\n </Tooltip.Trigger>\n <Tooltip.Body parentRef={ref} placement='right' className={tooltip()}>\n {textValue}\n <Icon>\n <ArrowNortheast />\n </Icon>\n </Tooltip.Body>\n </Tooltip>\n </Provider>\n );\n}\nSidenavLink.displayName = 'Sidenav.Link';\n\nfunction SidenavAvatar({ children, className, ...rest }: SidenavAvatarProps) {\n containsAnyOfExactChildren({\n children,\n componentName: SidenavAvatar.displayName,\n restrictions: [\n [\n [Avatar, { min: 1, max: 1 }],\n [Heading, { min: 1, max: 1 }],\n [Text, { min: 0, max: 1 }],\n ],\n [\n [Icon, { min: 1, max: 1 }],\n [Heading, { min: 1, max: 1 }],\n [Text, { min: 0, max: 1 }],\n ],\n ],\n });\n\n return (\n <Provider\n values={[\n [IconContext, { size: 'large', className: avatarIcon() }],\n [\n HeadingContext,\n { className: avatarHeading({ className: transient() }) },\n ],\n [TextContext, { className: avatarText({ className: transient() }) }],\n [AvatarContext, { classNames: { avatar: avatarIcon() } }],\n ]}\n >\n <div {...rest} className={avatar({ className })}>\n {children}\n </div>\n </Provider>\n );\n}\nSidenavAvatar.displayName = 'Sidenav.Avatar';\n\nfunction SidenavMenu({\n icon,\n title,\n classNames,\n children,\n ...rest\n}: SidenavMenuProps) {\n containsExactChildren({\n children,\n componentName: SidenavMenu.displayName,\n restrictions: [[SidenavMenuItem, { min: 2 }]],\n });\n\n const { isOpen } = useContext(SidenavContext);\n const ref = useRef(null);\n\n return isOpen ? (\n <Disclosure\n className={composeRenderProps(classNames?.menu, (className) =>\n menu({ className }),\n )}\n >\n <Button\n {...rest}\n slot='trigger'\n className={composeRenderProps(classNames?.button, (className) =>\n menuButton({ className }),\n )}\n >\n {icon}\n <Heading slot='menu'>{title}</Heading>\n <Icon className={transient({ className: classNames?.icon })}>\n <ChevronDown className='transform group-expanded/menu:rotate-180' />\n </Icon>\n </Button>\n <DisclosurePanel\n className={composeRenderProps(\n classNames?.disclosurePanel,\n (className) => className ?? '',\n )}\n >\n <div className={panelContent({ className: classNames?.panelContent })}>\n {children}\n </div>\n </DisclosurePanel>\n </Disclosure>\n ) : (\n <DialogTrigger>\n <Tooltip isDisabled={isOpen}>\n <Tooltip.Trigger>\n <Button\n {...rest}\n ref={ref}\n className={composeRenderProps(classNames?.button, (className) =>\n menuButton({ className }),\n )}\n >\n {icon}\n </Button>\n </Tooltip.Trigger>\n <Tooltip.Body parentRef={ref} placement='right' className={tooltip()}>\n {title}\n </Tooltip.Body>\n </Tooltip>\n <Popover\n className={composeRenderProps(classNames?.popoverPanel, (className) =>\n menuPanel({ className }),\n )}\n placement='right top'\n shouldFlip={false}\n >\n <Heading slot='panel'>{title}</Heading>\n <div className={panelContent({ className: classNames?.panelContent })}>\n {children}\n </div>\n </Popover>\n </DialogTrigger>\n );\n}\nSidenavMenu.displayName = 'Sidenav.Menu';\n\nfunction SidenavMenuItem({\n className,\n children,\n ...rest\n}: SidenavMenuItemProps) {\n containsExactChildren({\n children,\n componentName: SidenavMenuItem.displayName,\n restrictions: [[Text, { min: 1, max: 1 }]],\n });\n\n return (\n <ToggleButton\n {...rest}\n className={composeRenderProps(className, (className) =>\n menuItem({ className }),\n )}\n >\n {children}\n </ToggleButton>\n );\n}\nSidenavMenuItem.displayName = 'Sidenav.Menu.Item';\n\nSidenavMenu.Item = SidenavMenuItem;\n\nSidenav.Trigger = SidenavTrigger;\nSidenav.Header = SidenavHeader;\nSidenav.Item = SidenavItem;\nSidenav.Link = SidenavLink;\nSidenav.Avatar = SidenavAvatar;\nSidenav.Footer = SidenavFooter;\nSidenav.Content = SidenavContent;\nSidenav.Menu = SidenavMenu;\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/sidenav/index.tsx"],"names":["item","text","transient","avatarIcon","menuPanel","menuItem","panelHeading","panelContent","SidenavStyles","uuid","Sidenav","className","de","Z","W","containsExactChildren","SidenavHeader","setIsOpen","useState","SidenavEventTypes","data","id","prev","useOn","isOpen","isHiddenWhenClosed","jsx","Provider","E","S","HeadingContext","heading","e","g","j","SidenavContext","sidenav","children","SidenavContent","rest","content","le","useContext","F","classNames","P","Button","te","v","D","emit","Icon","ChevronLeft","c","props","Y","SidenavFooter","SidenavTrigger","type","useEmit","event","Pressable","se","SidenavItem","SidenavAvatar","ref","IconContext","TextContext","w","jsxs","Tooltip","O","ToggleButton","composeRenderProps","U","l","tooltip","textValue","u","SidenavLink","useRef","H","oe","De","h","Avatar","Heading","x","Text","N","avatarHeading","R","AvatarContext","me","SidenavMenu","title","SidenavMenuItem","Disclosure","menu","X","ne","icon","ie"],"mappings":"+1BAmEE,CAAA,OACA,CAAA,EAAA,CAAAA,QACAC,EACA,CAAA,MAAA,CAAA,EAAAC,CAAAA,MACA,CAAA,UACA,CAAA,EAAA,CAAA,OACA,CAAA,EAAA,CAAA,IAAA,CAAA,EAAAC,CAAAA,gBAEA,CAAA,CAAA,CAAA,MACA,CAAA,EAAA,CAAA,aAEA,CAAA,EAAA,CAAA,UACA,CAAA,CAAA,CAAA,UACA,CAAA,EAAA,CAAA,IAAA,CAAA,EAAAC,CAAAA,OACA,CAAA,CAAA,CAAAC,kBACAC,CACA,CAAA,CAAA,WAAAC,CACF,EAAIC,UAGF,CAAA,EAAIC,SACJ,CAAA,EAAQ,CACV,YA0DgBC,CAAAA,EACd,CAAA,YACA,CAA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AA,CAAA,GAAA,CAAA,CAAA,SAAc,CAAArB,kBAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,SAElB,CAAA,CAAOqB,CAAAA,CAEnBtF,EAAQ,QAAU+C,CAAAA,CAClB/C,CAAAA,CAAQ,CAAA,CAAA,CAAA,WACA,CAAA,mBAEA,CAAA,CAASsD,CAAAA,IACT,CAAA,CAAA,CAAA,CAAA,CAAA,OACA,CAAA,CAAA,CAAA,CAAA,CAAA,MACA,CAAA,CAAA,CAAA,CAAO8B,CAAAA,IAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,IAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,MAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,MAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,OAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,IAAAA,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 { useEmit, useOn } from '@accelint/bus/react';\nimport { isUUID, type UniqueId, uuid } from '@accelint/core';\nimport { ArrowNortheast, ChevronDown, ChevronLeft } from '@accelint/icons';\nimport { createContext, useContext, useRef, useState } from 'react';\nimport {\n Button,\n composeRenderProps,\n DEFAULT_SLOT,\n DialogTrigger,\n Disclosure,\n DisclosurePanel,\n Header,\n Heading,\n HeadingContext,\n Link,\n Popover,\n Pressable,\n Provider,\n Text,\n TextContext,\n ToggleButton,\n} from 'react-aria-components';\nimport { containsAnyOfExactChildren, containsExactChildren } from '@/lib/react';\nimport { Avatar, AvatarContext } from '../avatar';\nimport { DividerContext } from '../divider';\nimport { Icon, IconContext } from '../icon';\nimport { Tooltip } from '../tooltip';\nimport { SidenavEventTypes } from './events';\nimport { SidenavStyles } from './styles';\nimport type {\n SidenavAvatarProps,\n SidenavCloseEvent,\n SidenavContentProps,\n SidenavContextValue,\n SidenavEvent,\n SidenavFooterProps,\n SidenavHeaderProps,\n SidenavItemProps,\n SidenavLinkProps,\n SidenavMenuItemProps,\n SidenavMenuProps,\n SidenavOpenEvent,\n SidenavProps,\n SidenavToggleEvent,\n SidenavTriggerProps,\n} from './types';\n\nconst {\n sidenav,\n content,\n header,\n toggle,\n heading,\n divider,\n item,\n text,\n transient,\n avatar,\n avatarHeading,\n avatarIcon,\n avatarText,\n link,\n tooltip,\n menu,\n menuButton,\n menuHeading,\n menuPanel,\n menuItem,\n panelHeading,\n panelContent,\n} = SidenavStyles();\n\nconst SidenavContext = createContext<SidenavContextValue>({\n id: uuid(),\n isOpen: false,\n});\n\n/**\n * Sidenav - Collapsible side navigation panel\n *\n * Provides a hierarchical collapsible side navigation intended to be used\n * inside a Drawer.Layout. Supports headers, avatars, nested menus, and items.\n *\n * @example\n * <Drawer.Layout push=\"left\">\n * <Drawer.Layout.Main className=\"col-start-2\">\n * <Sidenav.Trigger>\n * <Button variant=\"icon\" size=\"large\">\n * <Icon>\n * <MenuIcon />\n * </Icon>\n * </Button>\n * </Sidenav.Trigger>\n * </Drawer.Layout.Main>\n * <Sidenav>\n * <Sidenav.Header>\n * <Sidenav.Avatar>\n * <Icon><AppLogo /></Icon>\n * <Heading>Application Header</Heading>\n * <Text>subheader</Text>\n * </Sidenav.Avatar>\n * </Sidenav.Header>\n * <Sidenav.Content>\n * <Heading>Navigation</Heading>\n * <Sidenav.Item>\n * <Icon><HomeIcon /></Icon>\n * <Text>Home</Text>\n * </Sidenav.Item>\n * <Divider />\n * <Sidenav.Item isSelected>\n * <Icon><SettingsIcon /></Icon>\n * <Text>Settings</Text>\n * </Sidenav.Item>\n * <Divider />\n * <Sidenav.Menu title=\"More Options\" icon={<Icon><MenuIcon /></Icon>}>\n * <Sidenav.Menu.Item>\n * <Text>Sub Item 1</Text>\n * </Sidenav.Menu.Item>\n * <Sidenav.Menu.Item>\n * <Text>Sub Item 2</Text>\n * </Sidenav.Menu.Item>\n * </Sidenav.Menu>\n * </Sidenav.Content>\n * <Sidenav.Footer>\n * <Sidenav.Avatar>\n * <Icon><UserIcon /></Icon>\n * <Heading>User Name</Heading>\n * <Text>john@example.com</Text>\n * </Sidenav.Avatar>\n * </Sidenav.Footer>\n * </Sidenav>\n * </Drawer.Layout>\n */\nexport function Sidenav({\n id,\n className,\n isHiddenWhenClosed,\n children,\n ...rest\n}: SidenavProps) {\n containsExactChildren({\n children,\n componentName: Sidenav.displayName,\n restrictions: [\n [SidenavHeader, { min: 1, max: 1 }],\n [SidenavContent, { min: 1, max: 1 }],\n [SidenavFooter, { min: 0, max: 1 }],\n ],\n });\n const [isOpen, setIsOpen] = useState(false);\n\n useOn(SidenavEventTypes.toggle, (data: SidenavToggleEvent) => {\n if (data.payload.id === id) {\n setIsOpen((prev) => !prev);\n }\n });\n\n useOn(SidenavEventTypes.open, (data: SidenavOpenEvent) => {\n if (!isOpen && data.payload.id === id) {\n setIsOpen(true);\n }\n });\n\n useOn(SidenavEventTypes.close, (data: SidenavCloseEvent) => {\n if (isOpen && data.payload.id === id) {\n setIsOpen(false);\n }\n });\n\n if (isHiddenWhenClosed && !isOpen) {\n return null;\n }\n\n return (\n <Provider\n values={[\n [\n HeadingContext,\n {\n slots: {\n [DEFAULT_SLOT]: {\n className: heading({ className: transient() }),\n },\n menu: { className: menuHeading({ className: transient() }) },\n panel: { className: panelHeading() },\n },\n },\n ],\n [SidenavContext, { id, isOpen }],\n ]}\n >\n <nav\n {...rest}\n className={sidenav({ className })}\n data-open={isOpen || null}\n >\n {children}\n </nav>\n </Provider>\n );\n}\nSidenav.displayName = 'Sidenav';\n\nfunction SidenavContent({ className, children, ...rest }: SidenavContentProps) {\n return (\n <Provider values={[[DividerContext, { className: divider() }]]}>\n <div {...rest} className={content({ className })}>\n {children}\n </div>\n </Provider>\n );\n}\nSidenavContent.displayName = 'Sidenav.Content';\n\nfunction SidenavHeader({ children, classNames, ...rest }: SidenavHeaderProps) {\n const emit = useEmit<SidenavToggleEvent>(SidenavEventTypes.toggle);\n const { id } = useContext(SidenavContext);\n\n return (\n <Header {...rest} className={header({ className: classNames?.header })}>\n <Button\n className={composeRenderProps(classNames?.button, (className) =>\n toggle({ className }),\n )}\n onPress={() => emit({ id })}\n >\n {children}\n <Icon className={transient()}>\n <ChevronLeft />\n </Icon>\n </Button>\n </Header>\n );\n}\nSidenavHeader.displayName = 'Sidenav.Header';\n\nfunction SidenavFooter(props: SidenavFooterProps) {\n return <footer {...props} />;\n}\nSidenavFooter.displayName = 'Sidenav.Footer';\n\nfunction SidenavTrigger({ children, for: type, ...rest }: SidenavTriggerProps) {\n const [event, id] = (isUUID(type) ? ['toggle', type] : type.split(':')) as [\n 'close' | 'open' | 'toggle',\n UniqueId,\n ];\n const emit = useEmit<SidenavEvent>(SidenavEventTypes[event]);\n\n return (\n <Pressable {...rest} onPress={() => emit({ id })}>\n {children}\n </Pressable>\n );\n}\nSidenavTrigger.displayName = 'Sidenav.Trigger';\n\nfunction SidenavItem({\n children,\n classNames,\n textValue,\n ...rest\n}: SidenavItemProps) {\n containsAnyOfExactChildren({\n children,\n componentName: SidenavItem.displayName,\n restrictions: [\n [[SidenavAvatar, { min: 1, max: 1 }]],\n [\n [Icon, { min: 1, max: 1 }],\n [Text, { min: 1, max: 1 }],\n ],\n ],\n });\n\n const { isOpen } = useContext(SidenavContext);\n\n // Implement ref to place tooltip inside Button DOM to enable contextual styling\n const ref = useRef(null);\n\n return (\n <Provider\n values={[\n [IconContext, { size: 'medium' }],\n [TextContext, { className: text({ className: transient() }) }],\n ]}\n >\n <Tooltip.Trigger isDisabled={isOpen}>\n <ToggleButton\n {...rest}\n ref={ref}\n className={composeRenderProps(classNames?.button, (className) =>\n item({ className }),\n )}\n >\n {children}\n </ToggleButton>\n <Tooltip parentRef={ref} placement='right' className={tooltip()}>\n {textValue}\n </Tooltip>\n </Tooltip.Trigger>\n </Provider>\n );\n}\nSidenavItem.displayName = 'Sidenav.Item';\n\nfunction SidenavLink({\n children,\n classNames,\n textValue,\n ...rest\n}: SidenavLinkProps) {\n containsExactChildren({\n children,\n componentName: SidenavLink.displayName,\n restrictions: [\n [Icon, { min: 1, max: 1 }],\n [Text, { min: 1, max: 1 }],\n ],\n });\n\n const { isOpen } = useContext(SidenavContext);\n\n // Implement ref to place tooltip inside Link DOM to enable contextual styling\n const ref = useRef(null);\n\n return (\n <Provider\n values={[[TextContext, { className: text({ className: transient() }) }]]}\n >\n <Tooltip.Trigger isDisabled={isOpen}>\n <Link\n {...rest}\n ref={ref}\n className={composeRenderProps(classNames?.button, (className) =>\n link({ className }),\n )}\n >\n {composeRenderProps(children, (children) => (\n <>\n {children}\n <Icon className={transient()}>\n <ArrowNortheast />\n </Icon>\n </>\n ))}\n </Link>\n <Tooltip parentRef={ref} placement='right' className={tooltip()}>\n {textValue}\n <Icon>\n <ArrowNortheast />\n </Icon>\n </Tooltip>\n </Tooltip.Trigger>\n </Provider>\n );\n}\nSidenavLink.displayName = 'Sidenav.Link';\n\nfunction SidenavAvatar({ children, className, ...rest }: SidenavAvatarProps) {\n containsAnyOfExactChildren({\n children,\n componentName: SidenavAvatar.displayName,\n restrictions: [\n [\n [Avatar, { min: 1, max: 1 }],\n [Heading, { min: 1, max: 1 }],\n [Text, { min: 0, max: 1 }],\n ],\n [\n [Icon, { min: 1, max: 1 }],\n [Heading, { min: 1, max: 1 }],\n [Text, { min: 0, max: 1 }],\n ],\n ],\n });\n\n return (\n <Provider\n values={[\n [IconContext, { size: 'large', className: avatarIcon() }],\n [\n HeadingContext,\n { className: avatarHeading({ className: transient() }) },\n ],\n [TextContext, { className: avatarText({ className: transient() }) }],\n [AvatarContext, { classNames: { avatar: avatarIcon() } }],\n ]}\n >\n <div {...rest} className={avatar({ className })}>\n {children}\n </div>\n </Provider>\n );\n}\nSidenavAvatar.displayName = 'Sidenav.Avatar';\n\nfunction SidenavMenu({\n icon,\n title,\n classNames,\n children,\n ...rest\n}: SidenavMenuProps) {\n containsExactChildren({\n children,\n componentName: SidenavMenu.displayName,\n restrictions: [[SidenavMenuItem, { min: 2 }]],\n });\n\n const { isOpen } = useContext(SidenavContext);\n const ref = useRef(null);\n\n return isOpen ? (\n <Disclosure\n className={composeRenderProps(classNames?.menu, (className) =>\n menu({ className }),\n )}\n >\n <Button\n {...rest}\n slot='trigger'\n className={composeRenderProps(classNames?.button, (className) =>\n menuButton({ className }),\n )}\n >\n {icon}\n <Heading slot='menu'>{title}</Heading>\n <Icon className={transient({ className: classNames?.icon })}>\n <ChevronDown className='transform group-expanded/menu:rotate-180' />\n </Icon>\n </Button>\n <DisclosurePanel\n className={composeRenderProps(\n classNames?.disclosurePanel,\n (className) => className ?? '',\n )}\n >\n <div className={panelContent({ className: classNames?.panelContent })}>\n {children}\n </div>\n </DisclosurePanel>\n </Disclosure>\n ) : (\n <DialogTrigger>\n <Tooltip.Trigger isDisabled={isOpen}>\n <Button\n {...rest}\n ref={ref}\n className={composeRenderProps(classNames?.button, (className) =>\n menuButton({ className }),\n )}\n >\n {icon}\n </Button>\n <Tooltip parentRef={ref} placement='right' className={tooltip()}>\n {title}\n </Tooltip>\n </Tooltip.Trigger>\n <Popover\n className={composeRenderProps(classNames?.popoverPanel, (className) =>\n menuPanel({ className }),\n )}\n placement='right top'\n shouldFlip={false}\n >\n <Heading slot='panel'>{title}</Heading>\n <div className={panelContent({ className: classNames?.panelContent })}>\n {children}\n </div>\n </Popover>\n </DialogTrigger>\n );\n}\nSidenavMenu.displayName = 'Sidenav.Menu';\n\nfunction SidenavMenuItem({\n className,\n children,\n ...rest\n}: SidenavMenuItemProps) {\n containsExactChildren({\n children,\n componentName: SidenavMenuItem.displayName,\n restrictions: [[Text, { min: 1, max: 1 }]],\n });\n\n return (\n <ToggleButton\n {...rest}\n className={composeRenderProps(className, (className) =>\n menuItem({ className }),\n )}\n >\n {children}\n </ToggleButton>\n );\n}\nSidenavMenuItem.displayName = 'Sidenav.Menu.Item';\n\nSidenavMenu.Item = SidenavMenuItem;\n\nSidenav.Trigger = SidenavTrigger;\nSidenav.Header = SidenavHeader;\nSidenav.Item = SidenavItem;\nSidenav.Link = SidenavLink;\nSidenav.Avatar = SidenavAvatar;\nSidenav.Footer = SidenavFooter;\nSidenav.Content = SidenavContent;\nSidenav.Menu = SidenavMenu;\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
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:
|
|
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:y,label:A,inputs:F,input:B,thumb:D,track:P,trackBackground:$,trackValue:z,minValue:C,maxValue:L}=SliderStyles(),I=({classNames:e,label:o,layout:T="grid",maxValue:n=100,minValue:d=0,orientation:b="horizontal",showInput:c,showLabel:p=true,...k})=>jsx(Slider,{...k,className:composeRenderProps(e?.slider,a=>y({className:a})),maxValue:n,minValue:d,orientation:b,"aria-label":p?void 0:o,"data-layout":T,children:({state:a})=>jsxs(Fragment,{children:[p&&jsx(Label,{className:A({className:e?.label}),children:o}),c&&jsx("div",{className:F({className:e?.inputs}),children:a.values.map((m,l)=>jsx(Input,{className:composeRenderProps(e?.input,i=>B({className:i})),value:m,onChange:i=>a.setThumbValue(l,Number.parseFloat(i.target.value))},`number-field-${l===0?"min":"max"}`))}),jsxs(SliderTrack,{className:composeRenderProps(e?.track,m=>P({className:m})),children:[jsx("div",{className:$({className:e?.trackBackground})}),a.values.map((m,l)=>jsxs(Fragment$1,{children:[jsx("div",{className:z({className:e?.trackValue}),"data-start":a.values.length===1?0:a.getThumbPercent(0),"data-end":a.getThumbPercent(a.values.length===1?0:1)}),jsxs(Tooltip.Trigger,{isDisabled:!c||a.isThumbDragging(l),children:[jsx(SliderThumb,{index:l,className:composeRenderProps(e?.thumb,i=>D({className:i}))}),jsx(Tooltip,{placement:"top",children:a.getThumbValue(l)})]})]},`slider-${l===0?"min":"max"}`))]}),jsx(Text,{slot:"min",className:C({className:e?.minValue}),children:d}),jsx(Text,{slot:"max",className:L({className:e?.maxValue}),children:n})]})});export{I as Slider};//# sourceMappingURL=index.js.map
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/slider/index.tsx"],"names":["thumb","track","trackValue","SliderStyles","
|
|
1
|
+
{"version":3,"sources":["../../../src/components/slider/index.tsx"],"names":["thumb","track","trackValue","SliderStyles","x","classNames","minValueProp","orientation","jsx","AriaSlider","rest","r","h","className","slider","maxValueProp","showLabel","layout","jsxs","Fragment","u","label","showInput","value","index","Input","composeRenderProps","input","event","state","AriaSliderTrack","_","Tooltip","g","SliderThumb","f","s"],"mappings":"ySA8BE,MAAA,CAAA,MACA,CAAA,CAAA,CAAA,cAEA,CAAA,CAAA,CAAAA,KACA,CAAA,CAAA,CAAAC,+BAEAC,CAAAA,CACA,CAAA,UACA,CAAA,CAAA,CAAA,SACEC,CAAAA,CAAa,QAcf,CAAA,CAAA,CAAA,CAAAC,YAAA,EAAA,CAAA,CAAAC,CAAAA,CACA,WACA,CAAA,CAAA,CAAA,KAAS,CAAA,CAAA,CAAA,MACT,CAAA,CAAA,CAAA,MAAyB,CAA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sB,CAAA,SAAW/B,GAAY,CAAA,UAE5C,CAAA,EAAA,QACH,GACF,QAEJ,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 { Fragment } from 'react';\nimport {\n Slider as AriaSlider,\n SliderTrack as AriaSliderTrack,\n composeRenderProps,\n Input,\n Label,\n SliderThumb,\n Text,\n} from 'react-aria-components';\nimport { Tooltip } from '../tooltip';\nimport { SliderStyles } from './styles';\nimport type { SliderProps } from './types';\n\nconst {\n slider,\n label,\n inputs,\n input,\n thumb,\n track,\n trackBackground,\n trackValue,\n minValue,\n maxValue,\n} = SliderStyles();\n\n/**\n * Slider - An interactive range input component for numeric value selection\n *\n * Provides accessible slider functionality with optional input field integration,\n * flexible layouts, and comprehensive keyboard and mouse interaction support.\n * Perfect for settings, filters, or any numeric input requiring visual feedback.\n *\n * @example\n * // Basic slider\n * <Slider label=\"Volume\" defaultValue={50} />\n */\nexport const Slider = ({\n classNames,\n label: labelProp,\n layout = 'grid',\n maxValue: maxValueProp = 100,\n minValue: minValueProp = 0,\n orientation = 'horizontal',\n showInput,\n showLabel = true,\n ...rest\n}: SliderProps) => {\n return (\n <AriaSlider\n {...rest}\n className={composeRenderProps(classNames?.slider, (className) =>\n slider({ className }),\n )}\n maxValue={maxValueProp}\n minValue={minValueProp}\n orientation={orientation}\n aria-label={showLabel ? undefined : labelProp}\n data-layout={layout}\n >\n {({ state }) => (\n <>\n {showLabel && (\n <Label className={label({ className: classNames?.label })}>\n {labelProp}\n </Label>\n )}\n {showInput && (\n <div\n className={inputs({\n className: classNames?.inputs,\n })}\n >\n {state.values.map((value, index) => (\n <Input\n key={`number-field-${index === 0 ? 'min' : 'max'}`}\n className={composeRenderProps(\n classNames?.input,\n (className) => input({ className }),\n )}\n value={value}\n onChange={(event) =>\n state.setThumbValue(\n index,\n Number.parseFloat(event.target.value),\n )\n }\n />\n ))}\n </div>\n )}\n <AriaSliderTrack\n className={composeRenderProps(classNames?.track, (className) =>\n track({ className }),\n )}\n >\n <div\n className={trackBackground({\n className: classNames?.trackBackground,\n })}\n />\n {state.values.map((_, index) => (\n <Fragment key={`slider-${index === 0 ? 'min' : 'max'}`}>\n <div\n className={trackValue({\n className: classNames?.trackValue,\n })}\n data-start={\n state.values.length === 1 ? 0 : state.getThumbPercent(0)\n }\n data-end={state.getThumbPercent(\n state.values.length === 1 ? 0 : 1,\n )}\n />\n <Tooltip.Trigger\n isDisabled={!showInput || state.isThumbDragging(index)}\n >\n <SliderThumb\n index={index}\n className={composeRenderProps(\n classNames?.thumb,\n (className) => thumb({ className }),\n )}\n />\n <Tooltip placement='top'>\n {state.getThumbValue(index)}\n </Tooltip>\n </Tooltip.Trigger>\n </Fragment>\n ))}\n </AriaSliderTrack>\n <Text\n slot='min'\n className={minValue({ className: classNames?.minValue })}\n >\n {minValueProp}\n </Text>\n <Text\n slot='max'\n className={maxValue({ className: classNames?.maxValue })}\n >\n {maxValueProp}\n </Text>\n </>\n )}\n </AriaSlider>\n );\n};\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
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:
|
|
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: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":["r"],"mappings":"sCAcE,MAAA,CAAO,CACLA,EAAA,CAAA,CAAA,KACE,mCACA,CAAA,kBACA,CAAA,4EAEA,CAAA,6HACA,CAAA,
|
|
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,yKAEA,CAAA,+HAIA,CAAA,sCACA,CAAA,uEAGA,8BACA,CAAA,2EACA,CAAA,mGAEA,CAAA,wEAGA,CAAA,CAAA,KAAA,CAAA,yGAEA,CAAA,KAAA,CAAA,CAAA,yBACA,CAAA,4OAEA,CAAA,qFACA,CAAA,qNAEF,CAAA,CAAA,eACE,CAAA,CAAA,wCACA,CAAA,wWAGF,CAAA,CAAA,UACE,CAAA,CAAA,8CACA,CAAA,gSACA,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: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"]}
|
|
@@ -12,6 +12,15 @@ import 'tailwind-variants';
|
|
|
12
12
|
import './styles.js';
|
|
13
13
|
import 'tailwind-merge';
|
|
14
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Table - Configurable data table with sorting and row actions
|
|
17
|
+
*
|
|
18
|
+
* Standardizes table behavior (sorting, selection, row actions) and can be
|
|
19
|
+
* used with column definitions from TanStack React Table.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* <Table columns={columns} data={data} />
|
|
23
|
+
*/
|
|
15
24
|
declare function Table<T extends {
|
|
16
25
|
id: Key;
|
|
17
26
|
}>({ children, columns: columnsProp, data: dataProp, showCheckbox, kebabPosition, persistRowKebabMenu, persistHeaderKebabMenu, persistNumerals, enableSorting, enableColumnOrdering: enableColumnReordering, enableRowActions, ...rest }: TableProps<T>): react_jsx_runtime.JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
'use client';
|
|
2
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
|
|
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(({id:e})=>e??"")},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
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +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,EAAAC,EAAkB,YAAA,CAAA,CAAA,CAAA,UAAwBC,CAAWC,CAAY,IACxD,CAAC,CAACC,CAAAA,IAAI,CAAA,CAAA,CAAA,CAAA,CAAA,MAEvB,gBAEK,CAAA,CAAA,CAAI,mBAAyD,CAC5D,4BAAAC,CAAAA,CAACC,CAAAA,CAAK,aACJ,EAAA,CAAA,OAACC,CAAA,EAAOC,GAAA,CAAA,KAAQ,CAAA,CAAA,SAAO,CAAA,CAAA,CAAA,EAAA,CAAA,EAAA,EAAW,CAAA,0BAE9B,CAAA,CAAA,QAACC,EAAAD,GAAA,CAAME,MACT,CAAA,CACF,OAEE,CAAA,MAAA,CAAA,YACE,gBAAc,CAAMC,GAAAA,CAASC,IAAE,CAAA,CAC/B,QAAA,CAAUJ,UAAMJ,EAAI,CAAA,CAAA,CAAA,CAAIS,EAAWC,IAAA,CAAAC,IAAQ,CAAA,CAAA,QAE1C,CAAA,CAAAP,GAAA,CAAAO,IAAA,CAAAF,IAAW,CAAA,CAAA,UACd,CAAA,CACAG,IAAM,CAAA,CAAA,EAAA,CAAA,CAAA,QACNA,CAAAA,SACE,CAAA,CAAA,CAAA,KAAA,CAAA,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AAA,CAAA,QAAA,CAAA,CAAA,CAAA0C,CAAAA,CACArD,GAAA,CAAAsD,YAAA,CAAA,QAAA,CAAA,CAAA,KACA,CAAA,CAAA,4CAEA,CAAA,CAAA,CAAA,eACA,CAAA,CAAA,CAAA,sCAEA,CAAA,CAAA,CAAA,gBACA,CAAA,CAAA,CAAA,gBAGFzD,CAAAA,CAAC,kBACC,CAAA,CAAA,CAAA,cACE,CAAA,CAAA,CAAA,eACA,CAAA,CAAA,CAAA,CAAA,QACF,CACAW,IAAAA,CAAC+C,OACC,CAAM,CAAC,GAAGjB,CAAAA,CAAW,QAAoB,CAAG,KAAGC,WAAAA,CAAc,CAAC,YAOlE,CAAA,CAAA,EAAA,CAAA,eACNiB,CAAM,CAAA,CAAA,CAAA,CAAAxD,GAAOuD,UACbC,CAAAA,CAAM,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"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/table/index.tsx"],"names":["moveRowsUp","ie","enableRowActions","TableContext","row","ne","O","jsxs","Menu","o","M","u","Kebab","se","menuItem","K","_","isPinned","jsx","rows","moveRowsDown","persistRowKebabMenu","enableSorting","enableColumnReordering","data","dataProp","rowSelection","useState","columnSelection","rowsToMove","id","firstRowToMove","prevRowId","moveBefore","lastRowToMove","T","nextRowId","actionColumn","RowActionsMenu","columns","Icon","D","showCheckbox","table","H","kebabPosition","getHeaderGroups","getTopRows","getBottomRows","useReactTable","index","setRowSelection","getSortedRowModel","newColumnOrder","ee","newIndex","oe","oldIndex","order","setColumnOrder","children","rest","persistHeaderKebabMenu","TableBody","Table","TableCell","TableHeader","HeaderCell","TableRow"],"mappings":"+tBAiDE,KACA,CAAA,QAAA,CAAA,CAAAA,CAAAA,kBAIA,CAAA,EAAM,CAAE,CAAAC,WAAA,EAAA,CAAA,SAAA,EAAAC,CAAAA,CAAkB,0BAAmCC,CAAY,CAAA,GACxD,CAAC,CAACC,KAAI,CAAA,CAAA,CAAA,CAAA,CAAA,KAAY,CAEnC,mBAES,mBAAyD,CAC5D,CAAA,CAAA,CAAAC,UAAA,CAAAC,YAAA,CAAA,CAAAC,EAACC,CAAAA,CAAK,CAAA,CAAA,WACJ,EAAA,CAAA,QAAC,EAAOC,GAAA,CAAA,KAAQ,CAAA,CAAA,SAAO,CAAA,CAAA,CAAA,EAAA,CAAA,EAAA,EAAW,CAAA,QAChC,CAAAC,IAAA,CAAAC,IAAA,CAAA,iBACGC,CAAAA,CAAAH,IAAMI,MACT,CAAA,CACF,OAEE,oBACE,CAAA,MAAA,CAAA,QAAc,CAAMC,GAAAA,CAASC,IAAE,CAAA,CAC/B,QAAA,CAAUN,GAAA,CAAAO,KAAA,CAAMZ,EAAI,CAAA,CAAA,CAAA,CAAIa,CAAAA,CAAWP,SAAQ,CAAA,CAAA,mBAE1CO,IAAW,CAAA,CAAA,UACd,CAAA,CACAC,IAAM,cACNA,KAAM,CAAA,CAAA,GACJ,CAAA,CAAA,CAAA,KAAA,CAAA,KAAY,CAAE,CAAA,QAAiB,CAC/B,SAAU,CAAA,KAAiBd,EAAKe,CAAIV,GAAA,CACpCE,cAAYM,CAAAA,EAAYb,CAAAA,CAAIK,GAAA,CAAAE,IAAA,CAAA,IAAU,CAAA,CACvC,UAAA,CAA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AA,QAAA,CAAA,CAAA,CAAAyC,CAAAA,CACArD,GAAA,CAAAH,YAAA,CAAA,QAAA,CAAA,CAAA,KACA,CAAA,CAAA,4CAEA,CAAA,CAAA,CAAA,eACA,CAAA,CAAA,CAAA,sCAEA,CAAA,CAAA,CAAA,gBACA,CAAA,CAAA,CAAA,gBAGFC,CAAAA,CAAC,kBACC,CAAA,CAAA,CAAA,cACE,CAAA,CAAA,CAAA,eACA,CAAA,CAAA,CAAA,CAAA,QACF,CACAW,IAAAA,CAAC6C,OACC,CAAM,CAAC,GAAGhB,CAAAA,CAAW,QAAoB,CAAG,KAAGC,WAAAA,CAAc,CAAC,YAOlE,CAAA,CAAA,EAAA,CAAA,eACNgB,CAAM,CAAA,CAAA,CAAA,CAAAvD,GAAOsD,UACbC,CAAAA,CAAM,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\n/**\n * Table - Configurable data table with sorting and row actions\n *\n * Standardizes table behavior (sorting, selection, row actions) and can be\n * used with column definitions from TanStack React Table.\n *\n * @example\n * <Table columns={columns} data={data} />\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 // biome-ignore lint/correctness/useExhaustiveDependencies: can of worms to fix ticket added\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 columnOrder: columns.map(({ id }) => 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"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {tv}from'./../../lib/utils.js';const
|
|
1
|
+
import {tv}from'./../../lib/utils.js';const r=tv({slots:{tabs:["group/tabs flex w-content","orientation-horizontal:flex-col","orientation-vertical:flex-row"],list:["flex","orientation-horizontal:flex-row","orientation-vertical:flex-col"],tab:["fg-primary-muted relative cursor-pointer rounded-small p-s","group-orientation-horizontal/tabs:rounded-b-none","group-orientation-horizontal/tabs:after:absolute group-orientation-horizontal/tabs:after:bottom-0 group-orientation-horizontal/tabs:after:left-0 group-orientation-horizontal/tabs:after:block group-orientation-horizontal/tabs:after:h-[1px] group-orientation-horizontal/tabs:after:w-full group-orientation-horizontal/tabs:after:bg-[color:var(--outline-static)]","enabled:hover:fg-primary-bold","enabled:hover:group-orientation-horizontal/tabs:after:bg-[color:var(--outline-interactive-hover)]","enabled:focus:fg-primary-bold","enabled:focus:group-orientation-horizontal/tabs:after:bg-[color:var(--outline-accent-primary-bold)]","enabled:pressed:fg-pressed","enabled:pressed:group-orientation-horizontal/tabs:after:bg-[color:var(--outline-interactive-pressed)]","enabled:selected:fg-accent-primary-bold enabled:selected:bg-accent-primary-muted","enabled:selected:group-orientation-horizontal/tabs:after:bg-[color:var(--outline-accent-primary-bold)]","enabled:selected:hover:fg-accent-primary-hover enabled:selected:hover:bg-accent-primary-hover","enabled:selected:hover:group-orientation-horizontal/tabs:after:bg-[color:var(--outline-accent-primary-hover)]","enabled:selected:focus-visible:fg-accent-primary-hover enabled:selected:focus-visible:bg-accent-primary-hover","enabled:selected:focus-visible:group-orientation-horizontal/tabs:after:bg-[color:var(--outline-accent-primary-hover)]","enabled:selected:pressed:fg-accent-primary-pressed enabled:selected:pressed:bg-interactive-muted-pressed","enabled:selected:pressed:group-orientation-horizontal/tabs:after:bg-[color:var(--outline-accent-primary-pressed)]","disabled:fg-disabled disabled:cursor-not-allowed","disabled:selected:bg-interactive-disabled","disabled:group-orientation-horizontal/tabs:after:bg-[color:var(--outline-interactive-disabled)]"],panel:"fg-primary-bold p-s"}});export{r as TabStyles};//# sourceMappingURL=styles.js.map
|
|
2
2
|
//# sourceMappingURL=styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/tabs/styles.ts"],"names":["
|
|
1
|
+
{"version":3,"sources":["../../../src/components/tabs/styles.ts"],"names":["e"],"mappings":"6CAeS,CACLA,EAAA,CAAA,CAAA,KACE,CAAA,CAAA,IAAA,CAAA,CAAA,2BACA,CAAA,iEAIA,CAAA,CAAA,IACA,CAAA,CAAA,MAAA,CAAA,iCACA,CAAA,kGAIA,CAAA,kDACA,CAAA,wYAGA,CAAA,mGAEA,CAAA,qIAGA,CAAA,4BACA,CAAA,uGAEA,CAAA,kFACA,CAAA,wGAEA,CAAA,+FACA,CAAA,+NAGA,CAAA,uHAEA,CAAA,8NAGA,CAAA,kDACA,CAAA,6IAGK,CAAA,CAAA,KAAA,CAAA,qBAEV,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 TabStyles = tv({\n slots: {\n tabs: [\n 'group/tabs flex w-content',\n 'orientation-horizontal:flex-col',\n 'orientation-vertical:flex-row',\n ],\n list: [\n 'flex',\n 'orientation-horizontal:flex-row',\n 'orientation-vertical:flex-col',\n ],\n tab: [\n 'fg-primary-muted relative cursor-pointer rounded-small p-s',\n 'group-orientation-horizontal/tabs:rounded-b-none',\n 'group-orientation-horizontal/tabs:after:absolute group-orientation-horizontal/tabs:after:bottom-0 group-orientation-horizontal/tabs:after:left-0 group-orientation-horizontal/tabs:after:block group-orientation-horizontal/tabs:after:h-[1px] group-orientation-horizontal/tabs:after:w-full group-orientation-horizontal/tabs:after:bg-[color:var(--outline-static)]',\n\n 'enabled:hover:fg-primary-bold',\n 'enabled:hover:group-orientation-horizontal/tabs:after:bg-[color:var(--outline-interactive-hover)]',\n\n 'enabled:focus:fg-primary-bold',\n 'enabled:focus:group-orientation-horizontal/tabs:after:bg-[color:var(--outline-accent-primary-bold)]',\n\n 'enabled:pressed:fg-pressed',\n 'enabled:pressed:group-orientation-horizontal/tabs:after:bg-[color:var(--outline-interactive-pressed)]',\n\n 'enabled:selected:fg-accent-primary-bold enabled:selected:bg-accent-primary-muted',\n 'enabled:selected:group-orientation-horizontal/tabs:after:bg-[color:var(--outline-accent-primary-bold)]',\n\n 'enabled:selected:hover:fg-accent-primary-hover enabled:selected:hover:bg-accent-primary-hover',\n 'enabled:selected:hover:group-orientation-horizontal/tabs:after:bg-[color:var(--outline-accent-primary-hover)]',\n\n 'enabled:selected:focus-visible:fg-accent-primary-hover enabled:selected:focus-visible:bg-accent-primary-hover',\n 'enabled:selected:focus-visible:group-orientation-horizontal/tabs:after:bg-[color:var(--outline-accent-primary-hover)]',\n\n 'enabled:selected:pressed:fg-accent-primary-pressed enabled:selected:pressed:bg-interactive-muted-pressed',\n 'enabled:selected:pressed:group-orientation-horizontal/tabs:after:bg-[color:var(--outline-accent-primary-pressed)]',\n\n 'disabled:fg-disabled disabled:cursor-not-allowed',\n 'disabled:selected:bg-interactive-disabled',\n 'disabled:group-orientation-horizontal/tabs:after:bg-[color:var(--outline-interactive-disabled)]',\n ],\n panel: 'fg-primary-bold p-s',\n },\n});\n"]}
|
|
@@ -5,6 +5,15 @@ import 'tailwind-variants';
|
|
|
5
5
|
import './styles.js';
|
|
6
6
|
import 'tailwind-merge';
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* TimeField - Form input for time values
|
|
10
|
+
*
|
|
11
|
+
* A time input field with configurable granularity and size, built on React
|
|
12
|
+
* Aria components and suitable for forms requiring time entry.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* <TimeField label="Time" granularity="second" />
|
|
16
|
+
*/
|
|
8
17
|
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
18
|
|
|
10
19
|
export { TimeField };
|
|
@@ -1 +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":"oUA6BsB,KAAA,CAAAA,QAASC,KAAO,CAAA,CAAA,CAAA,OAAAC,CAAa,CAAA,CAAA,KAAAC,CAAO,CAAA,CAAA,WACxC,CAAA,
|
|
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":"oUA6BsB,KAAA,CAAAA,QAASC,KAAO,CAAA,CAAA,CAAA,OAAAC,CAAa,CAAA,CAAA,KAAAC,CAAO,CAAA,CAAA,WACxC,CAAA,CAWX,CAAA,KAAA,CAAA,CAAA,CAASC,OACd,CAAA,CAAA,CAAA,CAAAC,eAAA,EAAAC,CAAAA,SACA,CAAA,CAAA,CAAA,UACA,CAAA,CAAA,CAAA,WACA,CAAA,CAAA,CAAA,YAAc,CAAA,CACd,CAAA,WAAY,CAAA,CAAA,CACZ,QAAA,CAAA,SACA,CAAOC,C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AAAA,CAACC,IAAAA,CAAA,CACE,oBACUC,CAAAA,CAAmBvB,CAAAA,CAAAA,GAAY,CAAAwB,SAAA,CAAA,CAAA,GAAQd,CAAAA,CAChDf,SACE,CAAAiB,kBAAA,CAAA,CAAAF,EACD,KAGF,CAAA,CAAA,EAAA,CAAA,CAAA,CAACe,SAEE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,QACA,CAAA,CAAA,EAAAR,GAAWM,CAAAA,WACTvB,CAAAA,CAAAA,OAAY,CAAA,CACXU,CAAAA,gCAAwBA,OAIjC,CAAA,CACAW,EAAC,CAAA,CAAA,CAAA,SAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAC,CAAAJ,GAAA,CACT,MACoB,CAAEX,CAAAA,YACnBoB,CAAAA,CAAA,CACC,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,EAAW9B,CAAY,CACrB,EAAA,CAAA,CAAA,EAAAqB,GAAA,CAAAU,IAAA,CAAW3B,CAAAA,SAAY,CAAA,CAAA,CAAA,CACzB,SACK,CAAA,CAAA,EAAA,WAEJ,CAAA,CAAA,CAAA,IAAA4B,CAAAA,aAIH,CAAA,QAA8B5B,CAAY,CAAA,CAAA,CAAA,CAAAiB,GAAA,CAAQP,UAAAA,CAAAA,CAChDb,SAAQ,CAAAe,kBAAA,CAAA,CAAAF,EAAW,KAGpB,CAAA,CAAA,EAAA,CAAA,CAAA,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\n/**\n * TimeField - Form input for time values\n *\n * A time input field with configurable granularity and size, built on React\n * Aria components and suitable for forms requiring time entry.\n *\n * @example\n * <TimeField label=\"Time\" granularity=\"second\" />\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"]}
|