@accelint/design-toolkit 2.1.0 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/accordion/index.js +1 -1
- package/dist/components/accordion/index.js.map +1 -1
- package/dist/components/avatar/index.js +1 -1
- package/dist/components/avatar/index.js.map +1 -1
- package/dist/components/button/index.js +1 -1
- package/dist/components/button/index.js.map +1 -1
- package/dist/components/checkbox/index.js +1 -1
- package/dist/components/checkbox/index.js.map +1 -1
- package/dist/components/chip/index.js +1 -1
- package/dist/components/chip/index.js.map +1 -1
- package/dist/components/color-picker/index.js +1 -1
- package/dist/components/color-picker/index.js.map +1 -1
- package/dist/components/combobox/index.js +1 -1
- package/dist/components/combobox/index.js.map +1 -1
- package/dist/components/date-field/index.js +1 -1
- package/dist/components/date-field/index.js.map +1 -1
- package/dist/components/dialog/index.js +1 -1
- package/dist/components/dialog/index.js.map +1 -1
- package/dist/components/floating-button/index.js +1 -1
- package/dist/components/floating-button/index.js.map +1 -1
- package/dist/components/icon/index.js +1 -1
- package/dist/components/icon/index.js.map +1 -1
- package/dist/components/icon-button/index.js +1 -1
- package/dist/components/icon-button/index.js.map +1 -1
- package/dist/components/label/index.js +1 -1
- package/dist/components/label/index.js.map +1 -1
- package/dist/components/options/index.js +1 -1
- package/dist/components/options/index.js.map +1 -1
- package/dist/components/options-item/index.js +1 -1
- package/dist/components/options-item/index.js.map +1 -1
- package/dist/components/popover/index.d.ts +32 -0
- package/dist/components/popover/index.js +2 -0
- package/dist/components/popover/index.js.map +1 -0
- package/dist/components/popover/styles.d.ts +47 -0
- package/dist/components/popover/styles.js +2 -0
- package/dist/components/popover/styles.js.map +1 -0
- package/dist/components/popover/types.d.ts +24 -0
- package/dist/components/popover/types.js +2 -0
- package/dist/components/popover/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/radio/index.js +1 -1
- package/dist/components/radio/index.js.map +1 -1
- package/dist/components/search-field/index.js +1 -1
- package/dist/components/search-field/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/switch/index.js +1 -1
- package/dist/components/switch/index.js.map +1 -1
- package/dist/components/tabs/index.js +1 -1
- package/dist/components/tabs/index.js.map +1 -1
- package/dist/components/text-area/index.js.map +1 -1
- package/dist/components/text-field/index.js.map +1 -1
- package/dist/components/toggle-icon-button/index.js +1 -1
- package/dist/components/toggle-icon-button/index.js.map +1 -1
- package/dist/components/tooltip/index.js +1 -1
- package/dist/components/tooltip/index.js.map +1 -1
- package/dist/index.css +4 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +1 -1
- package/dist/metafile-esm.json +1 -1
- package/dist/styles.css +20 -0
- package/package.json +4 -4
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/dialog/index.tsx"],"names":["R","h","useDialogContext","useContext","DialogContext","z","ctx","size","isOpen","RACDialogTrigger","s","B","Dialog","forwardRef","ref","isSSR","useIsSSR","portal","setPortal","y","useState","N","useEffect","P","parentRef","port","node","jsx","RACModalOverlay","T","n","DialogBody","className","S","buttonSize","buttonSizes","dialogSize","DialogButton","DialogContent","DialogFooter","DialogTitle"],"mappings":"8UAqCE,IAAA,CAAA,CAAAA,GAAA,CAAA,4EAIM,CAAA,CAAA,IAAI,CAAA,CAAA,EAAA,CAAA,oGAGN,CAAA,CAAA,eACQ,CAAA,CAAA,IAId,CAAA,IAGE,CAAA,CAAA,CAAI,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CACJ,OAAI,CAAA,EAAA,CACN,QAa0D,CAAA,CAAA,CAAA,CAAMC,mBAE1DC,CAAAA,IAAmB,CAAM,CAC7B,CAAA,CAAA,CAAA,IAAYC,CAAWC,IACvB,CAAA,CAAIC,UAACC,CAAAA,CACH,MAAM,CAAA,CAAA,MAAI,IAAM,KAAA,CAAA,gDAElB,CAAOA,CACT,OAYE,CA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,CAAE,GAAA,CAAA,GAAiB,CAAI5B,IACvBgC,CAAAA,CAAaC,CAAAA,CAAYC,CAAU,EACzC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CACET,CAAAA,OACEjB,GAAA,CAAMwB,MAAAA,CACL,CAAA,IAGD,CAAA,CAAA,CAAA,GAAA,CAAA,CAAA,SAAc,CAAAJ,EAAA,CAAA,wBAEb,CAAA,CAAA,CAAA,CAAA,QAKc,CAAC,CACpB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,QACA,CAAA,CAAA,CAAA,SAEA,CAAA,CAAM,CAAE,GAAA,CAAA,IAAS5B,IACjB,CAAA,CAAA,CAAA,CAAA,CAAA,EACEyB,CAAAA,OAACjB,GACC,CAAA,KAAA,CAAA,CAAA,SACE,CAAAoB,EAAA,CAAA,yBACS,CAAA,CAAA,GAAQ,IAAA,EACjBvB,MAAS,CAAA,CAAA,SACTyB,OAGD,CAAA,CAAA,CAAA,CAAA,QAKA,CAAA,CAAA,CAAA,CAAA,EAAA,CAASK,CAAAA,MACT,CAAA,CAAA,CAAA,CAAA,CAAUC,OACV,CAAA,CAAA,CAAA,CAASC,CAAAA,MACT,CAAA,CAAA,CAAQC,CAAAA,CACf5B,KAAO,CAAA,CAAOmB,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\nimport { cn } from '@/lib/utils';\nimport { useIsSSR } from '@react-aria/ssr';\nimport { cva } from 'cva';\nimport {\n type PropsWithChildren,\n type ReactNode,\n type RefObject,\n createContext,\n forwardRef,\n useContext,\n useEffect,\n useState,\n} from 'react';\nimport {\n type DialogRenderProps,\n type DialogTriggerProps,\n Dialog as RACDialog,\n DialogTrigger as RACDialogTrigger,\n Heading as RACHeading,\n Modal as RACModal,\n ModalOverlay as RACModalOverlay,\n} from 'react-aria-components';\nimport { Button, type ButtonProps } from '../button';\n\nconst dialogClasses = cva(\n 'flex flex-col align-end font-light text-body-m text-default-dark',\n {\n variants: {\n size: {\n sm: 'min-w-[280px] max-w-[280px] rounded-medium p-l',\n lg: 'min-w-[320px] max-w-[720px] rounded-large p-xl',\n },\n defaultVariants: {\n size: 'sm',\n },\n },\n },\n);\n\nconst buttonSizes: Record<string, ButtonProps['size']> = {\n sm: 'small',\n lg: 'medium',\n};\n\ntype DialogSize = 'sm' | 'lg';\n\ninterface DialogContextValue {\n size: DialogSize;\n isDismissable?: boolean;\n isKeyboardDismissDisabled?: boolean;\n isOpen?: boolean;\n onOpenChange?: (isOpen: boolean) => void;\n parentRef?: RefObject<HTMLElement | null>;\n}\n\nconst DialogContext = createContext<DialogContextValue>({ size: 'sm' });\n\nconst useDialogContext = () => {\n const ctx = useContext(DialogContext);\n if (!ctx) {\n throw new Error('Dialog components must be used within <Dialog>');\n }\n return ctx;\n};\n\nexport interface DialogProps extends DialogTriggerProps {\n size?: DialogSize;\n isDismissable?: boolean;\n isKeyboardDismissDisabled?: boolean;\n isOpen?: boolean;\n onOpenChange?: (isOpen: boolean) => void;\n parentRef?: RefObject<HTMLElement | null>;\n}\n\nexport const Dialog = ({\n children,\n size,\n isOpen,\n onOpenChange,\n isDismissable = true,\n isKeyboardDismissDisabled = true,\n parentRef,\n}: DialogProps) => {\n return (\n <RACDialogTrigger>\n <DialogContext.Provider\n value={{\n size: size ?? 'sm',\n isDismissable,\n isOpen,\n onOpenChange,\n parentRef,\n isKeyboardDismissDisabled,\n }}\n >\n {children}\n </DialogContext.Provider>\n </RACDialogTrigger>\n );\n};\nDialog.displayName = 'Dialog';\n\ninterface DialogBodyProps {\n children: ReactNode | ReactNode[] | ((opts: DialogRenderProps) => ReactNode);\n}\n\nconst DialogBody = forwardRef<HTMLDivElement, DialogBodyProps>(\n ({ children, ...rest }, ref) => {\n const {\n size,\n isDismissable,\n isOpen,\n onOpenChange,\n parentRef,\n isKeyboardDismissDisabled,\n } = useDialogContext();\n const isSSR = useIsSSR();\n const [portal, setPortal] = useState(isSSR ? null : document.body);\n\n useEffect(() => {\n const node = parentRef?.current;\n /* Ensure proper ssr hydration TODO */\n const port = isSSR ? null : document.createElement('div');\n\n if (node && port) {\n node.appendChild(port);\n setPortal(port);\n }\n\n return () => {\n port?.remove();\n\n setPortal(isSSR ? null : document.body);\n };\n }, [isSSR, parentRef]);\n\n return portal ? (\n <RACModalOverlay\n UNSTABLE_portalContainer={portal}\n isKeyboardDismissDisabled={!isDismissable && isKeyboardDismissDisabled}\n isOpen={isOpen}\n onOpenChange={onOpenChange}\n isDismissable={isDismissable}\n className='absolute inset-0 flex items-center justify-center'\n {...rest}\n >\n <RACModal\n ref={ref}\n className={cn(\n 'flex flex-col justify-center bg-surface-overlay align-start',\n size === 'sm' && 'rounded-medium',\n size === 'lg' && 'rounded-large',\n )}\n >\n <RACDialog className={dialogClasses({ size })}>{children}</RACDialog>\n </RACModal>\n </RACModalOverlay>\n ) : null;\n },\n);\nDialogBody.displayName = 'DialogBody';\n\nconst DialogContent = ({\n children,\n className,\n}: PropsWithChildren<{ className?: string }>) => {\n const { size } = useDialogContext();\n return (\n <div\n className={cn(\n 'flex flex-col',\n size === 'sm' && 'gap-xs',\n size === 'lg' && 'gap-l',\n className,\n )}\n >\n {children}\n </div>\n );\n};\n\nexport const DialogTitle = ({\n children,\n className,\n}: PropsWithChildren<{ className?: string }>) => {\n const { size } = useDialogContext();\n return (\n <RACHeading\n slot='title'\n className={cn(\n 'text-default-light',\n size === 'sm' && 'mb-s text-header-m',\n size === 'lg' && 'mb-m text-header-l',\n className,\n )}\n >\n {children}\n </RACHeading>\n );\n};\n\nconst DialogButton = ({ children, className, ...props }: ButtonProps) => {\n const { size: dialogSize } = useDialogContext();\n const buttonSize = buttonSizes[dialogSize];\n return (\n <Button\n size={buttonSize}\n {...props}\n //overriding the style to deal with rac's pressed state inherited\n //from the trigger state\n className={cn('dtk-pressed:bg-initial', className)}\n >\n {children}\n </Button>\n );\n};\n\nconst DialogFooter = ({\n children,\n className,\n}: PropsWithChildren<{ className?: string }>) => {\n const { size } = useDialogContext();\n return (\n <div\n className={cn(\n 'flex justify-end gap-xs',\n size === 'sm' && 'mt-l',\n size === 'lg' && 'mt-xl',\n className,\n )}\n >\n {children}\n </div>\n );\n};\n\nDialog.Button = DialogButton;\nDialog.Content = DialogContent;\nDialog.Footer = DialogFooter;\nDialog.Title = DialogTitle;\nDialog.Body = DialogBody;\n"]}
|
1
|
+
{"version":3,"sources":["../../../src/components/dialog/index.tsx"],"names":["h","useDialogContext","useContext","DialogContext","z","ctx","size","isOpen","RACDialogTrigger","s","B","Dialog","forwardRef","v","ref","isSSR","useIsSSR","portal","setPortal","y","useState","N","useEffect","parentRef","port","node","jsx","RACModalOverlay","n","O","DialogBody","className","S","buttonSize","buttonSizes","dialogSize","DialogButton","DialogContent","DialogFooter","DialogTitle"],"mappings":"8aAyCI,CAAA,CAAA,QAEI,CAAA,CAAA,yDACI,CAAA,EAAA,CAAA,gDAEN,CAAA,CAAA,qBAKN,CAAA,IAGE,GAAI,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CACJ,OAAI,CAAA,EAAA,CACN,QAa0D,CAAA,CAAA,CAAA,CAAMA,aAAA,CAAA,CAAA,IAE1DC,CAAAA,IAAmB,CAAM,CAC7B,CAAA,CAAA,CAAA,IAAYC,CAAWC,IACvB,CAAA,CAAIC,UAACC,CAAAA,CACH,CAAA,CAAA,GAAA,CAAM,CAAA,CAAA,MAAI,IAAM,KAAA,CAAA,iDAEXA,CACT,OAYE,CAAA,CAAA,CAAA,CAAA,CAAA,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AAA,QAAU,CAAA,CAAA,CAAA,YAAuC,GACvE,CAAM,CAAE,GAAA,CAAA,GAAiB,CAAI3B,IACvBgC,CAAAA,CAAaC,CAAAA,CAAYC,CAAU,EACzC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CACET,CAAAA,OACEjB,GAAA,CAAMwB,MAAAA,CACL,CAAA,IAGD,CAAA,CAAA,CAAA,GAAA,CAAA,CAAA,SAAc,CAAAL,EAAA,CAAA,wBAEb,CAAA,CAAA,CAAA,CAAA,QAKc,CAAC,CACpB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,QACA,CAAA,CAAA,CAAA,SAEA,CAAA,CAAM,CAAE,GAAA,CAAA,IAAS3B,IACjB,CAAA,CAAA,CAAA,CAAA,CAAA,EACEyB,CAAAA,OAACjB,GACC,CAAA,KAAA,CAAA,CAAA,SACE,CAAAmB,EAAA,CAAA,yBACS,CAAA,CAAA,GAAQ,IAAA,EACjBtB,MAAS,CAAA,CAAA,SACTyB,OAGD,CAAA,CAAA,CAAA,CAAA,QAKA,CAAA,CAAA,CAAA,CAAA,EAAA,CAASK,CAAAA,MACT,CAAA,CAAA,CAAA,CAAA,CAAUC,OACV,CAAA,CAAA,CAAA,CAASC,CAAAA,MACT,CAAA,CAAA,CAAQC,CAAAA,CACf5B,KAAO,CAAA,CAAOmB,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\n'use client';\nimport { cn } from '@/lib/utils';\nimport { useIsSSR } from '@react-aria/ssr';\nimport 'client-only';\nimport { cva } from 'cva';\nimport {\n type PropsWithChildren,\n type ReactNode,\n type RefObject,\n createContext,\n forwardRef,\n useContext,\n useEffect,\n useState,\n} from 'react';\nimport {\n type DialogRenderProps,\n type DialogTriggerProps,\n Dialog as RACDialog,\n DialogTrigger as RACDialogTrigger,\n Heading as RACHeading,\n Modal as RACModal,\n ModalOverlay as RACModalOverlay,\n} from 'react-aria-components';\nimport { Button, type ButtonProps } from '../button';\n\nconst dialogClasses = cva(\n 'flex flex-col align-end font-light text-body-m text-default-dark',\n {\n variants: {\n size: {\n sm: 'min-w-[280px] max-w-[280px] rounded-medium p-l',\n lg: 'min-w-[320px] max-w-[720px] rounded-large p-xl',\n },\n defaultVariants: {\n size: 'sm',\n },\n },\n },\n);\n\nconst buttonSizes: Record<string, ButtonProps['size']> = {\n sm: 'small',\n lg: 'medium',\n};\n\ntype DialogSize = 'sm' | 'lg';\n\ninterface DialogContextValue {\n size: DialogSize;\n isDismissable?: boolean;\n isKeyboardDismissDisabled?: boolean;\n isOpen?: boolean;\n onOpenChange?: (isOpen: boolean) => void;\n parentRef?: RefObject<HTMLElement | null>;\n}\n\nconst DialogContext = createContext<DialogContextValue>({ size: 'sm' });\n\nconst useDialogContext = () => {\n const ctx = useContext(DialogContext);\n if (!ctx) {\n throw new Error('Dialog components must be used within <Dialog>');\n }\n return ctx;\n};\n\nexport interface DialogProps extends DialogTriggerProps {\n size?: DialogSize;\n isDismissable?: boolean;\n isKeyboardDismissDisabled?: boolean;\n isOpen?: boolean;\n onOpenChange?: (isOpen: boolean) => void;\n parentRef?: RefObject<HTMLElement | null>;\n}\n\nexport const Dialog = ({\n children,\n size,\n isOpen,\n onOpenChange,\n isDismissable = true,\n isKeyboardDismissDisabled = true,\n parentRef,\n}: DialogProps) => {\n return (\n <RACDialogTrigger>\n <DialogContext.Provider\n value={{\n size: size ?? 'sm',\n isDismissable,\n isOpen,\n onOpenChange,\n parentRef,\n isKeyboardDismissDisabled,\n }}\n >\n {children}\n </DialogContext.Provider>\n </RACDialogTrigger>\n );\n};\nDialog.displayName = 'Dialog';\n\ninterface DialogBodyProps {\n children: ReactNode | ReactNode[] | ((opts: DialogRenderProps) => ReactNode);\n}\n\nconst DialogBody = forwardRef<HTMLDivElement, DialogBodyProps>(\n ({ children, ...rest }, ref) => {\n const {\n size,\n isDismissable,\n isOpen,\n onOpenChange,\n parentRef,\n isKeyboardDismissDisabled,\n } = useDialogContext();\n const isSSR = useIsSSR();\n const [portal, setPortal] = useState(isSSR ? null : document.body);\n\n useEffect(() => {\n const node = parentRef?.current;\n /* Ensure proper ssr hydration TODO */\n const port = isSSR ? null : document.createElement('div');\n\n if (node && port) {\n node.appendChild(port);\n setPortal(port);\n }\n\n return () => {\n port?.remove();\n\n setPortal(isSSR ? null : document.body);\n };\n }, [isSSR, parentRef]);\n\n return portal ? (\n <RACModalOverlay\n UNSTABLE_portalContainer={portal}\n isKeyboardDismissDisabled={!isDismissable && isKeyboardDismissDisabled}\n isOpen={isOpen}\n onOpenChange={onOpenChange}\n isDismissable={isDismissable}\n className='absolute inset-0 flex items-center justify-center'\n {...rest}\n >\n <RACModal\n ref={ref}\n className={cn(\n 'flex flex-col justify-center bg-surface-overlay align-start',\n size === 'sm' && 'rounded-medium',\n size === 'lg' && 'rounded-large',\n )}\n >\n <RACDialog className={dialogClasses({ size })}>{children}</RACDialog>\n </RACModal>\n </RACModalOverlay>\n ) : null;\n },\n);\nDialogBody.displayName = 'DialogBody';\n\nconst DialogContent = ({\n children,\n className,\n}: PropsWithChildren<{ className?: string }>) => {\n const { size } = useDialogContext();\n return (\n <div\n className={cn(\n 'flex flex-col',\n size === 'sm' && 'gap-xs',\n size === 'lg' && 'gap-l',\n className,\n )}\n >\n {children}\n </div>\n );\n};\n\nexport const DialogTitle = ({\n children,\n className,\n}: PropsWithChildren<{ className?: string }>) => {\n const { size } = useDialogContext();\n return (\n <RACHeading\n slot='title'\n className={cn(\n 'text-default-light',\n size === 'sm' && 'mb-s text-header-m',\n size === 'lg' && 'mb-m text-header-l',\n className,\n )}\n >\n {children}\n </RACHeading>\n );\n};\n\nconst DialogButton = ({ children, className, ...props }: ButtonProps) => {\n const { size: dialogSize } = useDialogContext();\n const buttonSize = buttonSizes[dialogSize];\n return (\n <Button\n size={buttonSize}\n {...props}\n //overriding the style to deal with rac's pressed state inherited\n //from the trigger state\n className={cn('dtk-pressed:bg-initial', className)}\n >\n {children}\n </Button>\n );\n};\n\nconst DialogFooter = ({\n children,\n className,\n}: PropsWithChildren<{ className?: string }>) => {\n const { size } = useDialogContext();\n return (\n <div\n className={cn(\n 'flex justify-end gap-xs',\n size === 'sm' && 'mt-l',\n size === 'lg' && 'mt-xl',\n className,\n )}\n >\n {children}\n </div>\n );\n};\n\nDialog.Button = DialogButton;\nDialog.Content = DialogContent;\nDialog.Footer = DialogFooter;\nDialog.Title = DialogTitle;\nDialog.Body = DialogBody;\n"]}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import {cn}from'./../../lib/utils.js';import {cva}from'cva';import {Button,composeRenderProps}from'react-aria-components';import {jsx}from'react/jsx-runtime';var o=cva(["absolute right-[20px] bottom-[20px] inline-flex size-[32px] cursor-pointer items-center justify-center rounded-full bg-transparent shadow-elevation-overlay outline outline-interactive-default","icon-default-dark [--icon-size:var(--spacing-xl)]","hover:icon-default-light hover:bg-interactive-hover-dark hover:outline-interactive-hover","focus:icon-default-light focus:bg-interactive-hover-dark focus:outline-interactive-hover"],{variants:{isDisabled:{true:"icon-disabled hover:icon-disabled cursor-not-allowed bg-interactive-disabled outline-interactive-disabled hover:bg-interactive-disabled hover:outline-interactive-disabled focus:bg-interactive-disabled focus:outline-interactive-disabled",false:""}},defaultVariants:{isDisabled:false}}),a=({className:e,isDisabled:t,...n})=>jsx(Button,{className:composeRenderProps(e,r=>cn(o({className:r,isDisabled:t}))),isDisabled:t,...n});a.displayName="FloatingButton";a.as=(e,t)=>cn(o({...e,className:t}));export{a as FloatingButton};//# sourceMappingURL=index.js.map
|
1
|
+
import {cn}from'./../../lib/utils.js';import'client-only';import {cva}from'cva';import {Button,composeRenderProps}from'react-aria-components';import {jsx}from'react/jsx-runtime';var o=cva(["absolute right-[20px] bottom-[20px] inline-flex size-[32px] cursor-pointer items-center justify-center rounded-full bg-transparent shadow-elevation-overlay outline outline-interactive-default","icon-default-dark [--icon-size:var(--spacing-xl)]","hover:icon-default-light hover:bg-interactive-hover-dark hover:outline-interactive-hover","focus:icon-default-light focus:bg-interactive-hover-dark focus:outline-interactive-hover"],{variants:{isDisabled:{true:"icon-disabled hover:icon-disabled cursor-not-allowed bg-interactive-disabled outline-interactive-disabled hover:bg-interactive-disabled hover:outline-interactive-disabled focus:bg-interactive-disabled focus:outline-interactive-disabled",false:""}},defaultVariants:{isDisabled:false}}),a=({className:e,isDisabled:t,...n})=>jsx(Button,{className:composeRenderProps(e,r=>cn(o({className:r,isDisabled:t}))),isDisabled:t,...n});a.displayName="FloatingButton";a.as=(e,t)=>cn(o({...e,className:t}));export{a as FloatingButton};//# sourceMappingURL=index.js.map
|
2
2
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/floating-button/index.tsx"],"names":["
|
1
|
+
{"version":3,"sources":["../../../src/components/floating-button/index.tsx"],"names":["FloatingButton","AriaButton","u","l","className","cn","floatingButtonStyles","props"],"mappings":"8XAyBI,CAAA,mDACA,CAAA,gMAKE,CAAA,CAAA,UACQ,CAAA,CAAA,IAAA,CAAA,6OACC,CAAA,KAGX,CAAA,EAAA,CAAA,CAAA,CAAA,2BAWSA,CAAAA,KAAkB,CAC7B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,sBAGF,CAAA,CAAA,CAAA,GACGC,EAAA,GACCC,GAAA,CAAAC,MAAA,CAAA,CAAA,SAA0CC,CACxCC,mBACEC,CAAAA,CAAqB,CACnB,iBACA,CAAA,CAAA,CAAA,UAIN,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,UACIC,CACN,EAEFP,GAAe,CAAA,CAAA,EAAA,CAAA,CAAA,4BAEbO,CAAAA,CACAH,CAAAA,EAAAA,CACGC,EAAGC,CAAAA,CAAqB,KAAKC,CAAAA,CAAO,CAAA,CAAA,GAAA,CAAA,CAAA,SAAY,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\n'use client';\nimport { cn } from '@/lib/utils';\nimport 'client-only';\nimport { type VariantProps, cva } from 'cva';\nimport {\n Button as AriaButton,\n type ButtonProps as AriaButtonProps,\n composeRenderProps,\n} from 'react-aria-components';\n\nconst floatingButtonStyles = cva(\n [\n 'absolute right-[20px] bottom-[20px] inline-flex size-[32px] cursor-pointer items-center justify-center rounded-full bg-transparent shadow-elevation-overlay outline outline-interactive-default',\n 'icon-default-dark [--icon-size:var(--spacing-xl)]',\n 'hover:icon-default-light hover:bg-interactive-hover-dark hover:outline-interactive-hover',\n 'focus:icon-default-light focus:bg-interactive-hover-dark focus:outline-interactive-hover',\n ],\n {\n variants: {\n isDisabled: {\n true: 'icon-disabled hover:icon-disabled cursor-not-allowed bg-interactive-disabled outline-interactive-disabled hover:bg-interactive-disabled hover:outline-interactive-disabled focus:bg-interactive-disabled focus:outline-interactive-disabled',\n false: '',\n },\n },\n defaultVariants: {\n isDisabled: false,\n },\n },\n);\n\nexport interface FloatingButtonProps\n extends Omit<AriaButtonProps, 'isDisabled'> {\n isDisabled?: boolean;\n}\n\nexport const FloatingButton = ({\n className,\n isDisabled,\n ...props\n}: FloatingButtonProps) => (\n <AriaButton\n className={composeRenderProps(className, (className) =>\n cn(\n floatingButtonStyles({\n className,\n isDisabled,\n }),\n ),\n )}\n isDisabled={isDisabled}\n {...props}\n />\n);\nFloatingButton.displayName = 'FloatingButton';\nFloatingButton.as = (\n props: VariantProps<typeof floatingButtonStyles>,\n className?: string | string[],\n) => cn(floatingButtonStyles({ ...props, className }));\n"]}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import {createContext}from'react';import {useContextProps}from'react-aria-components';import {IconStylesDefaults,IconStyles}from'./styles.js';import {jsx}from'react/jsx-runtime';var n=createContext(null);function r({children:o,...e}){return jsx(n.Provider,{value:e,children:o})}r.displayName="Icon.Provider";function t({ref:o,...e}){[e,o]=useContextProps(e,o??null,n);let{children:c,className:i,size:
|
1
|
+
import'client-only';import {createContext}from'react';import {useContextProps}from'react-aria-components';import {IconStylesDefaults,IconStyles}from'./styles.js';import {jsx}from'react/jsx-runtime';var n=createContext(null);function r({children:o,...e}){return jsx(n.Provider,{value:e,children:o})}r.displayName="Icon.Provider";function t({ref:o,...e}){[e,o]=useContextProps(e,o??null,n);let{children:c,className:i,size:p=IconStylesDefaults.size,...l}=e;return jsx("span",{...l,ref:o,className:IconStyles({className:i,size:p}),children:c})}t.displayName="Icon";t.Provider=r;export{t as Icon,n as IconContext};//# sourceMappingURL=index.js.map
|
2
2
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/icon/index.tsx"],"names":["IconContext","createContext","
|
1
|
+
{"version":3,"sources":["../../../src/components/icon/index.tsx"],"names":["IconContext","createContext","children","jsx","props","IconProvider","Icon","ref","useContextProps","className","size","IconStylesDefaults","rest","IconStyles"],"mappings":"sMAkBaA,IAAAA,CACXC,CAAAA,aAAwD,CAAA,IAAI,EAE9D,UAAsB,CAAE,CAAA,QAAAC,EAAU,CAAA,GAAS,EAAsB,CAC/D,CAAA,OAAOC,GAACH,CAAAA,CAAY,CAAA,QAAZ,CAAqB,MAAOI,CAAAA,CAAQ,CAAA,QAAAF,CAAAA,CAAS,CACvD,CACAG,CAAAA,CAAa,YAAc,CAAA,eAEpB,CAAA,SAASC,CAAK,CAAE,CAAA,GAAAC,CAAAA,CAAK,IAAS,CAAA,CAAc,CACjD,CAACH,CAAAA,CAAOG,CAAG,CAAA,CAAIC,CAAAA,eAAgBJ,CAAAA,CAAOG,CAAAA,CAAAA,EAAO,IAAMP,CAAW,EAE9D,CAAA,GACE,CAAA,QAAAE,CAAAA,CACA,CAAA,SAAAO,CAAAA,CACA,KAAAC,CAAAA,CAAOC,CAAAA,kBAAmB,CAAA,IAC1B,CAAA,GACF,CAAA,CAAIP,EAEJ,CAAA,OACED,GAAC,QAAM,CAAA,GAAGS,CAAM,IAAKL,CAAAA,CAAK,CAAA,SAAWM,CAAAA,UAAW,CAAE,CAAA,SAAAJ,CAAAA,CAAW,KAAAC,CAAK,CAAC,CAAA,CAChE,CAAA,QAAAR,CAAAA,CACH,CAEJ,CACAI,CAAAA,CAAK,CAAA,WAAc,CAAA,MACnBA,CAAAA,CAAK,CAAA,QAAWD,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\nimport 'client-only';\nimport { createContext } from 'react';\nimport { type ContextValue, useContextProps } from 'react-aria-components';\nimport { IconStyles, IconStylesDefaults } from './styles';\nimport type { IconProps, IconProviderProps } from './types';\n\nexport const IconContext =\n createContext<ContextValue<IconProps, HTMLSpanElement>>(null);\n\nfunction IconProvider({ children, ...props }: IconProviderProps) {\n return <IconContext.Provider value={props}>{children}</IconContext.Provider>;\n}\nIconProvider.displayName = 'Icon.Provider';\n\nexport function Icon({ ref, ...props }: IconProps) {\n [props, ref] = useContextProps(props, ref ?? null, IconContext);\n\n const {\n children,\n className,\n size = IconStylesDefaults.size,\n ...rest\n } = props;\n\n return (\n <span {...rest} ref={ref} className={IconStyles({ className, size })}>\n {children}\n </span>\n );\n}\nIcon.displayName = 'Icon';\nIcon.Provider = IconProvider;\n"]}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import {expectsIconWrapper}from'./../../lib/react.js';import {cn}from'./../../lib/utils.js';import {cva}from'cva';import {Button,composeRenderProps}from'react-aria-components';import {jsx}from'react/jsx-runtime';var o=cva("inline-flex cursor-pointer items-center justify-center bg-transparent dtk-pressed:bg-interactive-hover-dark outline-none hover:bg-interactive-hover-dark focus:bg-interactive-hover-dark",{variants:{variant:{primary:"icon-default-light",secondary:"icon-default-dark hover:icon-default-light dtk-pressed:icon-default-light focus:icon-default-light",child:"bg-transparent dtk-pressed:bg-transparent hover:bg-transparent focus:bg-default-light/5"},size:{medium:"size-[28px] rounded-medium [--icon-size:var(--spacing-xl)]",small:"size-[20px] rounded-small [--icon-size:var(--spacing-l)]"},isDisabled:{true:"icon-disabled fg-disabled hover:fg-disabled focus:fg-disabled cursor-not-allowed bg-transparent dtk-pressed:bg-transparent hover:bg-transparent focus:bg-transparent",false:""}},compoundVariants:[{isDisabled:true,variant:"child",className:"cursor-default"}],defaultVariants:{isDisabled:false,size:"medium",variant:"primary"}}),r=({className:e,size:t="medium",variant:s="primary",isDisabled:a,...n})=>(expectsIconWrapper({children:n.children,componentName:r.displayName}),jsx(Button,{className:composeRenderProps(e,d=>cn(o({isDisabled:a,size:t,variant:s,className:d}))),isDisabled:a,...n}));r.displayName="IconButton";r.as=(e,t)=>cn(o({...e,className:t}));export{r as IconButton};//# sourceMappingURL=index.js.map
|
1
|
+
import {expectsIconWrapper}from'./../../lib/react.js';import {cn}from'./../../lib/utils.js';import'client-only';import {cva}from'cva';import {Button,composeRenderProps}from'react-aria-components';import {jsx}from'react/jsx-runtime';var o=cva("inline-flex cursor-pointer items-center justify-center bg-transparent dtk-pressed:bg-interactive-hover-dark outline-none hover:bg-interactive-hover-dark focus:bg-interactive-hover-dark",{variants:{variant:{primary:"icon-default-light",secondary:"icon-default-dark hover:icon-default-light dtk-pressed:icon-default-light focus:icon-default-light",child:"bg-transparent dtk-pressed:bg-transparent hover:bg-transparent focus:bg-default-light/5"},size:{medium:"size-[28px] rounded-medium [--icon-size:var(--spacing-xl)]",small:"size-[20px] rounded-small [--icon-size:var(--spacing-l)]"},isDisabled:{true:"icon-disabled fg-disabled hover:fg-disabled focus:fg-disabled cursor-not-allowed bg-transparent dtk-pressed:bg-transparent hover:bg-transparent focus:bg-transparent",false:""}},compoundVariants:[{isDisabled:true,variant:"child",className:"cursor-default"}],defaultVariants:{isDisabled:false,size:"medium",variant:"primary"}}),r=({className:e,size:t="medium",variant:s="primary",isDisabled:a,...n})=>(expectsIconWrapper({children:n.children,componentName:r.displayName}),jsx(Button,{className:composeRenderProps(e,d=>cn(o({isDisabled:a,size:t,variant:s,className:d}))),isDisabled:a,...n}));r.displayName="IconButton";r.as=(e,t)=>cn(o({...e,className:t}));export{r as IconButton};//# sourceMappingURL=index.js.map
|
2
2
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/icon-button/index.tsx"],"names":["c","IconButton","className","l","jsx","m","composeRenderProps","u","i","isDisabled","cn","iconButtonStyles","props"],"mappings":"
|
1
|
+
{"version":3,"sources":["../../../src/components/icon-button/index.tsx"],"names":["c","IconButton","className","l","jsx","m","composeRenderProps","u","i","isDisabled","cn","iconButtonStyles","props"],"mappings":"wOAwBE,IAAA,CAAA,CAAAA,GAAA,CAAA,0LAGI,CAAA,CAAA,QACE,CAAA,CAAA,qCAEE,CAAA,SAAA,CAAA,oGAEA,CAAA,KAAA,CAAA,yFAGF,CAAQ,0EACD,CAAA,KAAA,CAAA,0DAGP,CAAA,CAAA,UAAM,CAAA,CAAA,IAAA,CAAA,sKAIV,CAAA,KAAA,CAAA,EAAA,CAAA,CAAA,CAAA,gBAEgB,CAAA,CAAA,CACZ,uBACA,CAAA,OAAW,CAAA,SAAA,CAAA,kCAID,CAAA,CACZ,iBACA,IAAA,CAAA,QAAS,CAAA,OAWFC,CAAAA,aACXC,CAAAA,CACA,CAAA,CAAA,SAAO,CAAA,CAAA,CAAA,IACP,CAAA,CAAA,CAAA,QAAU,CAAA,OACV,CAAA,CAAA,CAAA,SACA,CAAA,UAEmB,CACjB,CAAA,CAAA,GAAA,CAAA,CAAA,IAAgBC,kBAAA,CAAA,CAAA,oBACDF,aACjB,CAAC,CAAA,CAGCG,WACE,CAAA,CAAA,CAAAC,GAAWC,CAAAA,MAAmBJ,EAAYA,SAGpC,CAAAK,kBAAA,CAAA,CAAA,CAAA,CAAA,EAAAC,EAAA,CAAAC,CAAAA,CACA,CAAA,iBAEA,CAAA,CAAA,CAAA,OACF,CAAC,CACH,CACF,SACA,CAAA,CAAA,CAAA,CAAYA,EACX,CAAA,UAKI,CAAA,CAAA,CAAA,GAAA,CAAA,CAAA,CAAA,EAAc,CAAA,CAAA,WACzBR,CAAAA,YAGKS,CAAGC,CAAAA,CAAiB,EAAE,CAAA,CAAGC,CAAAA,CAAO,CAAA,GAAAJ,EAAA,CAAA,CAAA,CAAA,CAAA,GAAW,CAAC,CAAA,SAAA,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\n'use client';\nimport { expectsIconWrapper } from '@/lib/react';\nimport { cn } from '@/lib/utils';\nimport 'client-only';\nimport { type VariantProps, cva } from 'cva';\nimport {\n Button as AriaButton,\n type ButtonProps as AriaButtonProps,\n composeRenderProps,\n} from 'react-aria-components';\n\nconst iconButtonStyles = cva(\n 'inline-flex cursor-pointer items-center justify-center bg-transparent dtk-pressed:bg-interactive-hover-dark outline-none hover:bg-interactive-hover-dark focus:bg-interactive-hover-dark',\n {\n variants: {\n variant: {\n primary: 'icon-default-light',\n secondary:\n 'icon-default-dark hover:icon-default-light dtk-pressed:icon-default-light focus:icon-default-light',\n child:\n 'bg-transparent dtk-pressed:bg-transparent hover:bg-transparent focus:bg-default-light/5',\n },\n size: {\n medium: 'size-[28px] rounded-medium [--icon-size:var(--spacing-xl)]',\n small: 'size-[20px] rounded-small [--icon-size:var(--spacing-l)]',\n },\n isDisabled: {\n true: 'icon-disabled fg-disabled hover:fg-disabled focus:fg-disabled cursor-not-allowed bg-transparent dtk-pressed:bg-transparent hover:bg-transparent focus:bg-transparent',\n false: '',\n },\n },\n compoundVariants: [\n {\n isDisabled: true,\n variant: 'child',\n className: 'cursor-default',\n },\n ],\n defaultVariants: {\n isDisabled: false,\n size: 'medium',\n variant: 'primary',\n },\n },\n);\n\nexport interface IconButtonProps\n extends Omit<AriaButtonProps, 'isDisabled'>,\n VariantProps<typeof iconButtonStyles> {\n isDisabled?: boolean;\n}\n\nexport const IconButton = ({\n className,\n size = 'medium',\n variant = 'primary',\n isDisabled,\n ...props\n}: IconButtonProps) => {\n expectsIconWrapper({\n children: props.children,\n componentName: IconButton.displayName,\n });\n\n return (\n <AriaButton\n className={composeRenderProps(className, (className) =>\n cn(\n iconButtonStyles({\n isDisabled,\n size,\n variant,\n className,\n }),\n ),\n )}\n isDisabled={isDisabled}\n {...props}\n />\n );\n};\n\nIconButton.displayName = 'IconButton';\nIconButton.as = (\n props: VariantProps<typeof iconButtonStyles>,\n className?: string | string[],\n) => cn(iconButtonStyles({ ...props, className }));\n"]}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import {cn}from'./../../lib/utils.js';import {cva}from'cva';import {Label}from'react-aria-components';import {jsxs}from'react/jsx-runtime';var l=cva("fg-default-light flex items-center gap-xs text-header-s",{variants:{isDisabled:{true:"fg-disabled",false:"fg-default-light"}},defaultVariants:{isDisabled:false}});function s({children:a,className:i,isDisabled:t,isOptional:r,...o}){return jsxs(Label,{...o,className:cn(l({isDisabled:t,className:i})),children:[a," ",r&&"(optional)"]})}s.displayName="Label";s.as=a=>cn(l({className:a}));export{s as Label};//# sourceMappingURL=index.js.map
|
1
|
+
import {cn}from'./../../lib/utils.js';import'client-only';import {cva}from'cva';import {Label}from'react-aria-components';import {jsxs}from'react/jsx-runtime';var l=cva("fg-default-light flex items-center gap-xs text-header-s",{variants:{isDisabled:{true:"fg-disabled",false:"fg-default-light"}},defaultVariants:{isDisabled:false}});function s({children:a,className:i,isDisabled:t,isOptional:r,...o}){return jsxs(Label,{...o,className:cn(l({isDisabled:t,className:i})),children:[a," ",r&&"(optional)"]})}s.displayName="Label";s.as=a=>cn(l({className:a}));export{s as Label};//# sourceMappingURL=index.js.map
|
2
2
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/label/index.tsx"],"names":["
|
1
|
+
{"version":3,"sources":["../../../src/components/label/index.tsx"],"names":["b","jsxs","p","props","e","isOptional","cn","labelStyles"],"mappings":"mKAsBE,CAAA,CAAAA,GAAA,CAAA,yDAEE,CAAA,CAAA,oBAEU,oBACC,CAAA,KAAA,CAAA,kBAGX,CAAA,CAAA,CAAA,eACE,CAAA,CAAA,UAUC,8BAEL,CAAA,CAAA,CAAA,SACA,CAAA,CAAA,CAAA,UACA,CAAA,CAAA,CAAA,UAEF,CAAA,CAAe,CACb,GAAA,CAAA,CAAA,CAAA,CACEC,OACGC,IAAGC,MACJ,CAAA,CAAA,GAAA,CAAA,CAAA,SAA4B,CAAAC,EAAA,CAAA,CAAA,CAAA,CAAA,UAAY,CAAA,CAAA,CAAA,uBAE9B,CAAEC,GAAc,GAAA,CAAA,CAAA,EAAA,YAI1B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,qBACwCC,CAAAA,EAAGC,CAAY,CAAE,EAAAH,EAAA,CAAA,CAAA,CAAA,CAAA,SAAY,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\n'use client';\nimport { cn } from '@/lib/utils';\nimport 'client-only';\nimport { cva } from 'cva';\nimport {\n Label as AriaLabel,\n type LabelProps as AriaLabelProps,\n} from 'react-aria-components';\n\nconst labelStyles = cva(\n 'fg-default-light flex items-center gap-xs text-header-s',\n {\n variants: {\n isDisabled: {\n true: 'fg-disabled',\n false: 'fg-default-light',\n },\n },\n defaultVariants: {\n isDisabled: false,\n },\n },\n);\n\ninterface LabelProps extends AriaLabelProps {\n isDisabled?: boolean;\n isOptional?: boolean;\n}\n\nexport function Label({\n children,\n className,\n isDisabled,\n isOptional,\n ...props\n}: LabelProps) {\n return (\n <AriaLabel\n {...props}\n className={cn(labelStyles({ isDisabled, className }))}\n >\n {children} {isOptional && '(optional)'}\n </AriaLabel>\n );\n}\nLabel.displayName = 'Label';\nLabel.as = (className?: string | string[]) => cn(labelStyles({ className }));\n"]}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import'client-only';import {createContext}from'react';import {ListBox,ListBoxSection,Header,Collection}from'react-aria-components';import {OptionsItem}from'../options-item/index.js';import {jsx,jsxs}from'react/jsx-runtime';var I=createContext({size:"large",type:"default"});function s({children:e,className:o,description:i,errorMessage:f,label:
|
1
|
+
import'client-only';import {createContext}from'react';import {ListBox,ListBoxSection,Header,Collection}from'react-aria-components';import {OptionsItem}from'../options-item/index.js';import {jsx,jsxs}from'react/jsx-runtime';var I=createContext({size:"large",type:"default"});function s({children:e,className:o,description:i,errorMessage:f,label:u,placeholder:y,size:n,type:a,...p}){return jsx(I.Provider,{value:{size:n,type:a},children:jsx(ListBox,{className:"max-h-[200px] overflow-y-auto overflow-x-clip rounded-medium bg-surface-overlay shadow-elevation-overlay outline outline-static-light",...p,children:e})})}s.displayName="Options";s.Item=OptionsItem;function r({children:e,header:o,items:i}){return jsxs(ListBoxSection,{id:o,className:"mt-s border-default-dark border-t first:border-none",children:[jsx(Header,{className:"m-xs my-s text-default-dark text-header-xs",children:o}),jsx(Collection,{items:i,children:e})]})}r.displayName="Options.Section";s.Section=r;export{s as Options,I as OptionsContext,r as OptionsSection};//# sourceMappingURL=index.js.map
|
2
2
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/options/index.tsx"],"names":["OptionsContext","createContext","Options","children","className","description","errorMessage","label","placeholder","size","type","jsx","AriaListBox","props","OptionsItem","OptionsSection","header","items","jsxs","AriaListBoxSection","AriaHeader","AriaListBoxCollection"],"mappings":"+
|
1
|
+
{"version":3,"sources":["../../../src/components/options/index.tsx"],"names":["OptionsContext","createContext","Options","children","className","description","errorMessage","label","placeholder","size","type","jsx","AriaListBox","props","OptionsItem","OptionsSection","header","items","jsxs","AriaListBoxSection","AriaHeader","AriaListBoxCollection"],"mappings":"+NAwCaA,IAAAA,CAAiBC,CAAAA,aAE5B,CACA,KAAM,CAAA,OACN,CAAA,IAAM,CAAA,SACP,CAAA,EAEM,SAASC,CAAgC,CAC9C,CAAA,QAAAC,CAAAA,CACA,CAAA,SAAAC,CAAAA,CACA,CAAA,WAAAC,CAAAA,CACA,CAAA,YAAAC,CAAAA,CACA,MAAAC,CAAAA,CACA,CAAA,WAAAC,CAAAA,CACA,CAAA,IAAAC,CAAAA,CACA,CAAA,IAAAC,CAAAA,CACA,CAAA,GACF,CAAA,CAAoB,CAClB,CAAA,OACEC,GAACX,CAAAA,CAAe,CAAA,QAAf,CAAwB,MAAO,CAAE,CAAA,IAAAS,CAAAA,CAAM,CAAA,IAAAC,CAAK,CAAA,CAC3C,CAAA,QAAAC,CAAAA,GAACC,CAAAA,OAAA,CACC,CAAA,SAAU,CAAA,uIACT,CAAA,GAAGC,CAEH,CAAA,QAAAV,CAAAA,CACH,CAAA,CACF,CAEJ,CACAD,CAAAA,CAAQ,CAAA,WAAc,CAAA,SAEtBA,CAAAA,CAAQ,CAAA,IAAOY,CAAAA,WAOR,CAAA,SAASC,CAAuC,CACrD,CAAA,QAAAZ,CAAAA,CACA,CAAA,MAAAa,CAAAA,CACA,MAAAC,CACF,CAAA,CAA2B,CACzB,CAAA,OACEC,IAACC,CAAAA,cAAA,CACC,CAAA,EAAIH,CAAAA,CACJ,CAAA,SAAU,CAAA,qDAEV,CAAA,QAAA,CAAAL,CAAAA,GAACS,CAAAA,MAAA,CAAW,CAAA,SAAU,6CACnB,CAAA,QAAAJ,CAAAA,CACH,CAAA,CACAL,CAAAA,GAACU,CAAAA,UAAA,CAAsB,CAAA,KAAOJ,CAAAA,CAAQ,CAAA,QAAAd,CAAAA,CAAS,CAAA,CAAA,CACjD,CAEJ,CACAY,CAAAA,CAAe,CAAA,WAAc,CAAA,iBAC7Bb,EAAQ,CAAA,OAAUa,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\n'use client';\nimport 'client-only';\nimport { createContext } from 'react';\nimport {\n Header as AriaHeader,\n ListBox as AriaListBox,\n Collection as AriaListBoxCollection,\n type ListBoxProps as AriaListBoxProps,\n ListBoxSection as AriaListBoxSection,\n type ListBoxSectionProps as AriaListBoxSectionProps,\n} from 'react-aria-components';\nimport {\n type IOptionsItem,\n OptionsItem,\n type OptionsItemProps,\n} from '../options-item';\n\nexport interface OptionsProps<T extends IOptionsItem>\n extends AriaListBoxProps<T> {\n className?: string;\n description?: string;\n errorMessage?: string;\n label?: string;\n placeholder?: string;\n size?: OptionsItemProps<T>['size'];\n type?: OptionsItemProps<T>['type'];\n}\n\nexport const OptionsContext = createContext<\n Pick<OptionsProps<IOptionsItem>, 'size' | 'type'>\n>({\n size: 'large',\n type: 'default',\n});\n\nexport function Options<T extends IOptionsItem>({\n children,\n className,\n description,\n errorMessage,\n label,\n placeholder,\n size,\n type,\n ...props\n}: OptionsProps<T>) {\n return (\n <OptionsContext.Provider value={{ size, type }}>\n <AriaListBox<T>\n className='max-h-[200px] overflow-y-auto overflow-x-clip rounded-medium bg-surface-overlay shadow-elevation-overlay outline outline-static-light'\n {...props}\n >\n {children}\n </AriaListBox>\n </OptionsContext.Provider>\n );\n}\nOptions.displayName = 'Options';\n\nOptions.Item = OptionsItem;\n\ninterface OptionsSectionProps<T extends IOptionsItem>\n extends AriaListBoxSectionProps<T> {\n header?: string;\n}\n\nexport function OptionsSection<T extends IOptionsItem>({\n children,\n header,\n items,\n}: OptionsSectionProps<T>) {\n return (\n <AriaListBoxSection\n id={header}\n className='mt-s border-default-dark border-t first:border-none'\n >\n <AriaHeader className='m-xs my-s text-default-dark text-header-xs'>\n {header}\n </AriaHeader>\n <AriaListBoxCollection items={items}>{children}</AriaListBoxCollection>\n </AriaListBoxSection>\n );\n}\nOptionsSection.displayName = 'Options.Section';\nOptions.Section = OptionsSection;\n"]}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import
|
1
|
+
import {mergeProps}from'@react-aria/utils';import'client-only';import {cva}from'cva';import {useContext,useMemo}from'react';import {ListBoxItem,Text}from'react-aria-components';import {Icon}from'../icon/index.js';import {OptionsContext}from'../options/index.js';import {jsx,jsxs,Fragment}from'react/jsx-runtime';var k=cva(["fg-default-light flex items-center gap-s p-s text-body-s ","**:data-[slot=description]:fg-default-dark **:data-[slot=description]:text-body-xs","hover:fg-inverse-light hover:**:data-[slot=description]:fg-inverse-light","dtk-focus:fg-inverse-light dtk-focus:**:data-[slot=description]:fg-inverse-light ","dtk-disabled:fg-disabled dtk-disabled:**:data-[slot=description]:fg-disabled dtk-disabled:bg-transparent","dtk-focus:bg-highlight-bold hover:bg-highlight-bold"],{variants:{type:{destructive:"dtk-focus:bg-serious-bold hover:bg-serious-bold",default:"dtk-focus:bg-highlight-bold hover:bg-highlight-bold"},size:{large:"pt-s pb-s",small:"pt-xs pb-xs"}},defaultVariants:{size:"large"}});function O({children:e,className:c,description:s,prefixIcon:i,suffixIcon:o,name:a,type:r,size:n,...f}){let p=useContext(OptionsContext)??{},{size:g,type:x}=useMemo(()=>mergeProps(p,{size:n,type:r}),[p,n,r]);return jsx(ListBoxItem,{textValue:a,...f,className:k({type:x,size:g,className:c}),children:u=>typeof e=="function"?e(u):jsxs(Fragment,{children:[jsx("span",{className:"flex w-[16px] items-center",children:i&&jsx(Icon,{children:i})}),jsxs("div",{className:"flex min-w-0 flex-auto flex-col gap-xxs",children:[jsx(Text,{className:"truncate",slot:"label",children:a}),s&&jsx(Text,{className:"truncate","data-slot":"description",slot:"description",children:s})]}),jsx("span",{className:"flex w-[16px] items-center",children:o&&jsx(Icon,{size:"small",children:o})})]})})}O.displayName="OptionsItem";export{O as OptionsItem};//# sourceMappingURL=index.js.map
|
2
2
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/options-item/index.tsx"],"names":["cva","
|
1
|
+
{"version":3,"sources":["../../../src/components/options-item/index.tsx"],"names":["cva","b","children","className","prefixIcon","suffixIcon","name","typeProp","sizeProp","useContext","OptionsContext","N","size","useMemo","v","optionsContext","AriaListBoxItem","y","optionsItemStyles","type","renderProps","jsxs","Fragment","T","jsx","t","Icon","l","m","AriaText","d","description","OptionsItem"],"mappings":"wTAyBA,IAA0BA,CAAAA,CACxBC,GACE,CAAA,CAAA,2DACA,CAAA,oFACA,CAAA,0EACA,CAAA,mFACA,CAAA,0GACA,CAAA,qDAEF,CACE,CAAA,CAAA,QACE,CAAA,CAAA,IACE,CAAA,CAAA,6DACA,CAAA,OAAS,CAAA,qDAEX,CAAA,CAAA,IACE,OAAO,CAAA,WACP,CAAA,KAAO,CAAA,aAEX,CACA,CAAA,CAAA,eACE,CAAA,CAAA,IAAM,CAAA,OAGZ,CAAA,CAoBO,CAAA,CAAA,SAA6C,CAClD,CAAA,CAAA,QAAAC,CACA,CAAA,CAAA,SAAAC,CACA,CAAA,CAAA,YACA,CAAA,CAAA,UAAAC,CACA,CAAA,CAAA,UAAAC,CACA,CAAA,CAAA,IAAAC,CACA,MAAMC,CACN,CAAA,CAAA,IAAMC,CACN,CAAA,CAAA,GACF,CAAwB,CACtB,CAAA,CAAA,IAAuBC,CAAAA,CAAWC,UAAc,CAAAC,cAAA,CAAK,IAE7C,CAAA,CAAA,IAAAC,CAAM,CAAA,CAAA,IAAK,CAAA,CAAIC,EACrBC,OAAA,CAAA,IACaC,WAAgB,CACzB,CAAA,CAAA,KACA,CAAA,CAAA,IACF,CAAC,CAAA,CACH,CAACA,CAAAA,CAAgBP,EAAUD,CAAQ,CACrC,CAAA,CAEA,CAAA,CAAA,OACGS,GAAAA,CAAAC,WACC,CAAA,CAAA,SAAWX,CACV,CAAA,CAAA,GACD,CAAA,CAAA,SAAWY,CAAkB,CAAE,CAAA,CAAA,IAAAC,CAAM,CAAA,CAAA,IAAAP,CAAM,CAAA,CAAA,SAAU,CAAC,CAAA,CAErD,CAAA,CAAA,QAACQ,CAAAA,CACI,EAAA,OAAOlB,CAAa,EAAA,WACNkB,CAAW,CAAA,CAI3BC,CAAAA,CAAAC,IAAAA,CAAAC,QACE,CAAA,CAAA,QAAAC,EAACC,GAAA,CAAA,MAAK,CAAA,CAAA,SAAU,CAAA,4BACb,CAAA,QAAArB,CAAAA,CAAcoB,EAACE,IAAAC,IAAM,CAAA,CAAA,QAAAvB,CAAW,CAAA,CACnC,CAAA,CAEAiB,CAAAA,CAACO,UAAI,CAAA,CAAA,SAAU,CAAA,yCACb,CAAA,QAAAJ,CAAAA,CAACK,GAAAA,CAAAC,IAAS,WAAU,CAAA,UAAW,CAAA,IAAK,CAAA,OACjC,CAAA,QAAAxB,CACH,CAAA,CACCyB,GACCP,EAACK,GAAAA,CAAAC,IACC,CAAA,CAAA,SAAU,CAAA,UACV,CAAA,yBACA,CAAA,IAAK,CAAA,aAEJ,CAAA,QAAAC,CACH,CAAA,CAAA,CAEJ,CAAA,CACAP,EAACC,GAAA,CAAA,MAAK,CAAA,CAAA,SAAU,CAAA,4BACb,CAAA,QAAApB,CAAAA,CAAcmB,EAACE,IAAAC,IAAK,CAAA,CAAA,IAAK,CAAA,OAAS,CAAA,QAAAtB,CAAW,CAAA,CAChD,GACF,CAAA,CAGN,CAEJ,CACA2B,CAAAA,CAAY,CAAA,CAAA,WAAc,CAAA,aAAA","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';\nimport { mergeProps } from '@react-aria/utils';\nimport 'client-only';\nimport { type VariantProps, cva } from 'cva';\nimport { type ReactNode, useContext, useMemo } from 'react';\nimport {\n ListBoxItem as AriaListBoxItem,\n type ListBoxItemProps as AriaListBoxItemProps,\n Text as AriaText,\n} from 'react-aria-components';\nimport { Icon } from '../icon';\nimport { OptionsContext } from '../options';\n\nconst optionsItemStyles = cva(\n [\n 'fg-default-light flex items-center gap-s p-s text-body-s ',\n '**:data-[slot=description]:fg-default-dark **:data-[slot=description]:text-body-xs',\n 'hover:fg-inverse-light hover:**:data-[slot=description]:fg-inverse-light',\n 'dtk-focus:fg-inverse-light dtk-focus:**:data-[slot=description]:fg-inverse-light ',\n 'dtk-disabled:fg-disabled dtk-disabled:**:data-[slot=description]:fg-disabled dtk-disabled:bg-transparent',\n 'dtk-focus:bg-highlight-bold hover:bg-highlight-bold',\n ],\n {\n variants: {\n type: {\n destructive: 'dtk-focus:bg-serious-bold hover:bg-serious-bold',\n default: 'dtk-focus:bg-highlight-bold hover:bg-highlight-bold',\n },\n size: {\n large: 'pt-s pb-s',\n small: 'pt-xs pb-xs',\n },\n },\n defaultVariants: {\n size: 'large',\n },\n },\n);\n\nexport interface IOptionsItem {\n children?: IOptionsItem[];\n description?: string;\n prefixIcon?: ReactNode;\n suffixIcon?: ReactNode;\n id?: string | number;\n name: string;\n}\n\nexport interface OptionsItemProps<T extends IOptionsItem>\n extends VariantProps<typeof optionsItemStyles>,\n AriaListBoxItemProps<T> {\n description?: string;\n prefixIcon?: ReactNode;\n suffixIcon?: ReactNode;\n name: string;\n}\n\nexport function OptionsItem<T extends IOptionsItem>({\n children,\n className,\n description,\n prefixIcon,\n suffixIcon,\n name,\n type: typeProp,\n size: sizeProp,\n ...props\n}: OptionsItemProps<T>) {\n const optionsContext = useContext(OptionsContext) ?? {};\n\n const { size, type } = useMemo(\n () =>\n mergeProps(optionsContext, {\n size: sizeProp,\n type: typeProp,\n }),\n [optionsContext, sizeProp, typeProp],\n );\n\n return (\n <AriaListBoxItem<T>\n textValue={name}\n {...props}\n className={optionsItemStyles({ type, size, className })}\n >\n {(renderProps) => {\n if (typeof children === 'function') {\n return children(renderProps);\n }\n\n return (\n <>\n <span className='flex w-[16px] items-center'>\n {prefixIcon && <Icon>{prefixIcon}</Icon>}\n </span>\n\n <div className='flex min-w-0 flex-auto flex-col gap-xxs'>\n <AriaText className='truncate' slot='label'>\n {name}\n </AriaText>\n {description && (\n <AriaText\n className='truncate'\n data-slot='description'\n slot='description'\n >\n {description}\n </AriaText>\n )}\n </div>\n <span className='flex w-[16px] items-center'>\n {suffixIcon && <Icon size='small'>{suffixIcon}</Icon>}\n </span>\n </>\n );\n }}\n </AriaListBoxItem>\n );\n}\nOptionsItem.displayName = 'OptionsItem';\n"]}
|
@@ -0,0 +1,32 @@
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
2
|
+
import { ReactNode } from 'react';
|
3
|
+
import { PopoverProps, PopoverTitleProps, PopoverContentProps, PopoverBodyProps, PopoverTriggerProps } from './types.js';
|
4
|
+
import 'react-aria-components';
|
5
|
+
|
6
|
+
declare const Popover: {
|
7
|
+
({ placement, children, ...rest }: PopoverProps): react_jsx_runtime.JSX.Element;
|
8
|
+
displayName: string;
|
9
|
+
Title: {
|
10
|
+
({ children, className, ...rest }: PopoverTitleProps): react_jsx_runtime.JSX.Element;
|
11
|
+
displayName: string;
|
12
|
+
};
|
13
|
+
Content: {
|
14
|
+
({ children, className, ...rest }: PopoverContentProps): react_jsx_runtime.JSX.Element;
|
15
|
+
displayName: string;
|
16
|
+
};
|
17
|
+
Body: {
|
18
|
+
({ children, className }: PopoverBodyProps): react_jsx_runtime.JSX.Element;
|
19
|
+
displayName: string;
|
20
|
+
};
|
21
|
+
Footer: {
|
22
|
+
({ children, className, }: {
|
23
|
+
children: ReactNode;
|
24
|
+
className?: string;
|
25
|
+
}): react_jsx_runtime.JSX.Element;
|
26
|
+
displayName: string;
|
27
|
+
};
|
28
|
+
Trigger: ({ children, ...props }: PopoverTriggerProps) => react_jsx_runtime.JSX.Element;
|
29
|
+
};
|
30
|
+
declare const PopoverTrigger: ({ children, ...props }: PopoverTriggerProps) => react_jsx_runtime.JSX.Element;
|
31
|
+
|
32
|
+
export { Popover, PopoverTrigger };
|
@@ -0,0 +1,2 @@
|
|
1
|
+
import'client-only';import {DialogTrigger,Pressable,Popover,Dialog,Heading}from'react-aria-components';import {PopoverStyles}from'./styles.js';import {jsx}from'react/jsx-runtime';var {content:c,body:y,title:N,footer:T}=PopoverStyles(),t=({placement:r="bottom",children:o,...p})=>jsx(DialogTrigger,{...p,children:o});t.displayName="Popover";var A=({children:r,...o})=>jsx(Pressable,{...o,children:r});t.displayName="Popover.Trigger";var i=({children:r,className:o,...p})=>jsx(Popover,{className:c({className:o}),...p,children:jsx(Dialog,{children:r})});i.displayName="Popover.Content";var a=({children:r,className:o,...p})=>jsx(Heading,{slot:"title",className:N({className:o}),...p,children:r});a.displayName="Popover.Title";var s=({children:r,className:o})=>jsx("div",{className:y({className:o}),children:r});s.displayName="Popover.Body";var P=({children:r,className:o})=>jsx("div",{className:T({className:o}),children:r});P.displayName="Popover.Footer";t.Title=a;t.Content=i;t.Body=s;t.Footer=P;t.Trigger=A;export{t as Popover,A as PopoverTrigger};//# sourceMappingURL=index.js.map
|
2
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../../src/components/popover/index.tsx"],"names":["content","body","title","footer","PopoverStyles","Popover","placement","children","jsx","AriaDialogTrigger","rest","PopoverTrigger","Pressable","props","PopoverContent","className","AriaPopover","AriaDialog","PopoverTitle","AriaHeading","PopoverBody","PopoverFooter"],"mappings":"mLAiCM,IAAE,CAAA,OAAAA,EAAS,CAAA,IAAAC,CAAAA,CAAM,MAAAC,CAAAA,CAAO,CAAA,MAAAC,CAAO,CAAA,CAAIC,CAAAA,aAAc,EAE1CC,CAAAA,CAAU,CAAC,CACtB,UAAAC,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,KAAMC,CAAgB,CAAC,CACrB,CAAA,QAAAd,CAAAA,CACA,UAAAQ,CACF,CAAA,CAAA,GACSP,GAAC,CAAA,KAAA,CAAI,CAAA,SAAWL,CAAAA,CAAO,CAAE,CAAA,SAAAY,CAAU,CAAC,CAAA,CAAI,CAAA,QAAAR,EAAS,CAAA,CAE1Dc,CAAAA,CAAc,CAAA,WAAc,CAAA,gBAE5BhB,CAAAA,CAAQ,CAAA,KAAQa,EAChBb,CAAAA,CAAQ,CAAA,OAAUS,EAClBT,CAAAA,CAAQ,CAAA,IAAOe,EACff,CAAAA,CAAQ,CAAA,MAASgB,CAAAA,CACjBhB,CAAAA,CAAQ,CAAA,OAAUM,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\n'use client';\nimport 'client-only';\nimport type { ReactNode } from 'react';\nimport {\n Dialog as AriaDialog,\n DialogTrigger as AriaDialogTrigger,\n Heading as AriaHeading,\n Popover as AriaPopover,\n Pressable,\n} from 'react-aria-components';\n\nimport type {\n PopoverBodyProps,\n PopoverContentProps,\n PopoverProps,\n PopoverTitleProps,\n PopoverTriggerProps,\n} from './types';\n\nimport { PopoverStyles } from './styles';\n\nconst { content, body, title, footer } = PopoverStyles();\n\nexport const Popover = ({\n placement = 'bottom',\n children,\n ...rest\n}: PopoverProps) => {\n return <AriaDialogTrigger {...rest}>{children}</AriaDialogTrigger>;\n};\nPopover.displayName = 'Popover';\n\nexport const PopoverTrigger = ({ children, ...props }: PopoverTriggerProps) => {\n return <Pressable {...props}>{children}</Pressable>;\n};\nPopover.displayName = 'Popover.Trigger';\n\nconst PopoverContent = ({\n children,\n className,\n ...rest\n}: PopoverContentProps) => {\n return (\n <AriaPopover className={content({ className })} {...rest}>\n {/* @ts-expect-error package version mismatch TODO */}\n <AriaDialog>{children}</AriaDialog>\n </AriaPopover>\n );\n};\nPopoverContent.displayName = 'Popover.Content';\n\nconst PopoverTitle = ({ children, className, ...rest }: PopoverTitleProps) => {\n return (\n <AriaHeading slot='title' className={title({ className })} {...rest}>\n {children}\n </AriaHeading>\n );\n};\n\nPopoverTitle.displayName = 'Popover.Title';\n\nconst PopoverBody = ({ children, className }: PopoverBodyProps) => {\n return <div className={body({ className })}>{children}</div>;\n};\nPopoverBody.displayName = 'Popover.Body';\n\nconst PopoverFooter = ({\n children,\n className,\n}: { children: ReactNode; className?: string }) => {\n return <div className={footer({ className })}>{children}</div>;\n};\nPopoverFooter.displayName = 'Popover.Footer';\n\nPopover.Title = PopoverTitle;\nPopover.Content = PopoverContent;\nPopover.Body = PopoverBody;\nPopover.Footer = PopoverFooter;\nPopover.Trigger = PopoverTrigger;\n"]}
|
@@ -0,0 +1,47 @@
|
|
1
|
+
import * as tailwind_variants from 'tailwind-variants';
|
2
|
+
|
3
|
+
declare const PopoverStyles: tailwind_variants.TVReturnType<{
|
4
|
+
[key: string]: {
|
5
|
+
[key: string]: tailwind_variants.ClassValue | {
|
6
|
+
content?: tailwind_variants.ClassValue;
|
7
|
+
body?: tailwind_variants.ClassValue;
|
8
|
+
footer?: tailwind_variants.ClassValue;
|
9
|
+
title?: tailwind_variants.ClassValue;
|
10
|
+
};
|
11
|
+
};
|
12
|
+
} | {
|
13
|
+
[x: string]: {
|
14
|
+
[x: string]: tailwind_variants.ClassValue | {
|
15
|
+
content?: tailwind_variants.ClassValue;
|
16
|
+
body?: tailwind_variants.ClassValue;
|
17
|
+
footer?: tailwind_variants.ClassValue;
|
18
|
+
title?: tailwind_variants.ClassValue;
|
19
|
+
};
|
20
|
+
};
|
21
|
+
} | {}, {
|
22
|
+
content: string;
|
23
|
+
body: string;
|
24
|
+
title: string;
|
25
|
+
footer: string;
|
26
|
+
}, undefined, {
|
27
|
+
[key: string]: {
|
28
|
+
[key: string]: tailwind_variants.ClassValue | {
|
29
|
+
content?: tailwind_variants.ClassValue;
|
30
|
+
body?: tailwind_variants.ClassValue;
|
31
|
+
footer?: tailwind_variants.ClassValue;
|
32
|
+
title?: tailwind_variants.ClassValue;
|
33
|
+
};
|
34
|
+
};
|
35
|
+
} | {}, {
|
36
|
+
content: string;
|
37
|
+
body: string;
|
38
|
+
title: string;
|
39
|
+
footer: string;
|
40
|
+
}, tailwind_variants.TVReturnType<unknown, {
|
41
|
+
content: string;
|
42
|
+
body: string;
|
43
|
+
title: string;
|
44
|
+
footer: string;
|
45
|
+
}, undefined, unknown, unknown, undefined>>;
|
46
|
+
|
47
|
+
export { PopoverStyles };
|
@@ -0,0 +1,2 @@
|
|
1
|
+
import {tv}from'./../../lib/utils.js';var o=tv({slots:{content:"max-w-[280px] rounded-medium border border-static-light bg-surface-raised p-s",body:"fg-default-dark text-body-s",title:"fg-default-light mb-s text-header-m",footer:"mt-s flex justify-end gap-s"}});export{o as PopoverStyles};//# sourceMappingURL=styles.js.map
|
2
|
+
//# sourceMappingURL=styles.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../../src/components/popover/styles.ts"],"names":["t"],"mappings":"sCAcE,IAAA,CAAA,CAAAA,EAAA,CAAO,CACL,KAAA,CAAA,CAAA,OACE,CAAA,+EACI,CAAA,IAAA,CAAA,6BACC,4CACP,CAAQ,MAAA,CAAA,6BAEX,CAAA,CAAA","file":"styles.js","sourcesContent":["/* 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 PopoverStyles = tv({\n slots: {\n content:\n 'max-w-[280px] rounded-medium border border-static-light bg-surface-raised p-s',\n body: 'fg-default-dark text-body-s',\n title: 'fg-default-light mb-s text-header-m',\n footer: 'mt-s flex justify-end gap-s',\n },\n});\n"]}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
import { ReactNode, ComponentProps } from 'react';
|
2
|
+
import { HeadingProps, PopoverProps as PopoverProps$1, PopoverRenderProps, Pressable } from 'react-aria-components';
|
3
|
+
|
4
|
+
interface PopoverProps {
|
5
|
+
placement?: 'left' | 'right' | 'top' | 'bottom';
|
6
|
+
children?: ReactNode;
|
7
|
+
}
|
8
|
+
interface PopoverTriggerProps extends ComponentProps<typeof Pressable> {
|
9
|
+
}
|
10
|
+
interface PopoverContentProps extends Omit<PopoverProps$1, 'children'> {
|
11
|
+
children?: ReactNode | ((props: PopoverRenderProps & {
|
12
|
+
close: () => void;
|
13
|
+
}) => ReactNode);
|
14
|
+
className?: string;
|
15
|
+
}
|
16
|
+
interface PopoverTitleProps extends Omit<HeadingProps, 'children'> {
|
17
|
+
children?: ReactNode;
|
18
|
+
}
|
19
|
+
interface PopoverBodyProps {
|
20
|
+
children?: ReactNode;
|
21
|
+
className?: string;
|
22
|
+
}
|
23
|
+
|
24
|
+
export type { PopoverBodyProps, PopoverContentProps, PopoverProps, PopoverTitleProps, PopoverTriggerProps };
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"types.js"}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import {LockFill,Delete,Duplicate}from'@accelint/icons';import {useMemo,createContext,useCallback}from'react';import {QueryBuilder}from'react-querybuilder';import {cn}from'../../lib/utils.js';import {Icon}from'../icon/index.js';import {IconButton}from'../icon-button/index.js';import {Label}from'../label/index.js';import {Radio}from'../radio/index.js';import {Tooltip}from'../tooltip/index.js';import {ActionElement}from'./action-element.js';import {RuleGroup,RuleGroupHeaderComponent,RuleGroupFooterComponent}from'./group.js';import {Rule}from'./rule.js';import {getValidationResult,pressToMouseEvent}from'./utils.js';import {ValueEditor}from'./value-editor.js';import {ValueSelector}from'./value-selector.js';import {jsx,jsxs}from'react/jsx-runtime';var N={AND:"All rules below must be true for a match",OR:"One of the rules below must be true for a match"};function C({options:r,value:n,handleOnChange:l}){return jsxs(Radio.Group,{value:n,onChange:l,orientation:"horizontal",children:[jsx(Label,{children:"Combinator"}),r.map(o=>jsx(Radio,{value:o.label,children:jsxs(Tooltip,{children:[jsx(Tooltip.Trigger,{children:jsx("span",{children:o.label})}),jsx(Tooltip.Body,{placement:"top",children:N[o.label]})]})},o.label))]})}function x({handleOnClick:r,className:n,...l}){let o=useCallback(i=>r(pressToMouseEvent(i)),[r]);return jsx(IconButton,{size:"small",onPress:o,className:n,...l,children:jsx(Icon,{children:jsx(Delete,{})})})}function u({handleOnClick:r,className:n,...l}){let o=useCallback(i=>r(pressToMouseEvent(i)),[r]);return jsx(IconButton,{size:"small",onPress:o,className:n,...l,children:jsx(Icon,{children:jsx(LockFill,{})})})}function p({handleOnClick:r,className:n,...l}){let o=useCallback(i=>r(pressToMouseEvent(i)),[r]);return jsx(IconButton,{size:"small",onPress:o,className:n,...l,children:jsx(Icon,{children:jsx(Duplicate,{})})})}function t({controlClassnames:r,controlElements:n,orientation:l="horizontal",showRuleLines:o=true,...i}){let G=useMemo(()=>({combinatorSelector:C,cloneGroupAction:p,cloneRuleAction:p,removeRuleAction:x,lockGroupAction:u,lockRuleAction:u,ruleGroup:RuleGroup,rule:Rule,actionElement:ActionElement,valueSelector:ValueSelector,valueEditor:ValueEditor,...n}),[n]),y=useMemo(()=>({queryBuilder:"border border-transparent",ruleGroup:"group col-span-full flex flex-col gap-s p-s border border-info rounded-medium",header:"flex gap-s",body:cn("group grid gap-x-s empty:hidden",o?"grid-cols-[10px_minmax(100px,_1fr)_min-content]":"grid-cols-[minmax(100px,_1fr)_min-content]"),combinators:"my-s",addRule:"",addGroup:"",cloneRule:"fg-interactive hover:fg-interactive-hover",cloneGroup:"fg-interactive hover:fg-interactive-hover",removeGroup:"",rule:cn("flex gap-xs py-s",l==="vertical"?"flex-col":"min-height-[50px] items-start"),fields:"w-full",operators:"",value:"w-full",removeRule:"",valid:"",invalid:"",disabled:"",lockRule:"fg-interactive hover:fg-interactive-hover",lockGroup:"fg-interactive hover:fg-interactive-hover",valueSource:"",valueListItem:""}),[l,o]),Q=useMemo(()=>({...y,...r}),[r,y]),E=createContext({orientation:l,showRuleLines:o});return jsx(QueryBuilder,{showNotToggle:false,showShiftActions:false,enableDragAndDrop:false,controlClassnames:Q,controlElements:G,context:E,listsAsArrays:true,...i})}t.CombinatorSelector=C;t.RemoveRuleAction=x;t.LockAction=u;t.CloneAction=p;t.ActionElement=ActionElement;t.Rule=Rule;t.RuleGroup=RuleGroup;t.RuleGroupHeaderComponent=RuleGroupHeaderComponent;t.RuleGroupFooterComponent=RuleGroupFooterComponent;t.getValidationResult=getValidationResult;t.ValueEditor=ValueEditor;t.ValueSelector=ValueSelector;export{t as QueryBuilder};//# sourceMappingURL=index.js.map
|
1
|
+
import {LockFill,Delete,Duplicate}from'@accelint/icons';import'client-only';import {useMemo,createContext,useCallback}from'react';import {QueryBuilder}from'react-querybuilder';import {cn}from'../../lib/utils.js';import {Icon}from'../icon/index.js';import {IconButton}from'../icon-button/index.js';import {Label}from'../label/index.js';import {Radio}from'../radio/index.js';import {Tooltip}from'../tooltip/index.js';import {ActionElement}from'./action-element.js';import {RuleGroup,RuleGroupHeaderComponent,RuleGroupFooterComponent}from'./group.js';import {Rule}from'./rule.js';import {getValidationResult,pressToMouseEvent}from'./utils.js';import {ValueEditor}from'./value-editor.js';import {ValueSelector}from'./value-selector.js';import {jsx,jsxs}from'react/jsx-runtime';var N={AND:"All rules below must be true for a match",OR:"One of the rules below must be true for a match"};function C({options:r,value:n,handleOnChange:l}){return jsxs(Radio.Group,{value:n,onChange:l,orientation:"horizontal",children:[jsx(Label,{children:"Combinator"}),r.map(o=>jsx(Radio,{value:o.label,children:jsxs(Tooltip,{children:[jsx(Tooltip.Trigger,{children:jsx("span",{children:o.label})}),jsx(Tooltip.Body,{placement:"top",children:N[o.label]})]})},o.label))]})}function x({handleOnClick:r,className:n,...l}){let o=useCallback(i=>r(pressToMouseEvent(i)),[r]);return jsx(IconButton,{size:"small",onPress:o,className:n,...l,children:jsx(Icon,{children:jsx(Delete,{})})})}function u({handleOnClick:r,className:n,...l}){let o=useCallback(i=>r(pressToMouseEvent(i)),[r]);return jsx(IconButton,{size:"small",onPress:o,className:n,...l,children:jsx(Icon,{children:jsx(LockFill,{})})})}function p({handleOnClick:r,className:n,...l}){let o=useCallback(i=>r(pressToMouseEvent(i)),[r]);return jsx(IconButton,{size:"small",onPress:o,className:n,...l,children:jsx(Icon,{children:jsx(Duplicate,{})})})}function t({controlClassnames:r,controlElements:n,orientation:l="horizontal",showRuleLines:o=true,...i}){let G=useMemo(()=>({combinatorSelector:C,cloneGroupAction:p,cloneRuleAction:p,removeRuleAction:x,lockGroupAction:u,lockRuleAction:u,ruleGroup:RuleGroup,rule:Rule,actionElement:ActionElement,valueSelector:ValueSelector,valueEditor:ValueEditor,...n}),[n]),y=useMemo(()=>({queryBuilder:"border border-transparent",ruleGroup:"group col-span-full flex flex-col gap-s p-s border border-info rounded-medium",header:"flex gap-s",body:cn("group grid gap-x-s empty:hidden",o?"grid-cols-[10px_minmax(100px,_1fr)_min-content]":"grid-cols-[minmax(100px,_1fr)_min-content]"),combinators:"my-s",addRule:"",addGroup:"",cloneRule:"fg-interactive hover:fg-interactive-hover",cloneGroup:"fg-interactive hover:fg-interactive-hover",removeGroup:"",rule:cn("flex gap-xs py-s",l==="vertical"?"flex-col":"min-height-[50px] items-start"),fields:"w-full",operators:"",value:"w-full",removeRule:"",valid:"",invalid:"",disabled:"",lockRule:"fg-interactive hover:fg-interactive-hover",lockGroup:"fg-interactive hover:fg-interactive-hover",valueSource:"",valueListItem:""}),[l,o]),Q=useMemo(()=>({...y,...r}),[r,y]),E=createContext({orientation:l,showRuleLines:o});return jsx(QueryBuilder,{showNotToggle:false,showShiftActions:false,enableDragAndDrop:false,controlClassnames:Q,controlElements:G,context:E,listsAsArrays:true,...i})}t.CombinatorSelector=C;t.RemoveRuleAction=x;t.LockAction=u;t.CloneAction=p;t.ActionElement=ActionElement;t.Rule=Rule;t.RuleGroup=RuleGroup;t.RuleGroupHeaderComponent=RuleGroupHeaderComponent;t.RuleGroupFooterComponent=RuleGroupFooterComponent;t.getValidationResult=getValidationResult;t.ValueEditor=ValueEditor;t.ValueSelector=ValueSelector;export{t as QueryBuilder};//# sourceMappingURL=index.js.map
|
2
2
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/query-builder/index.tsx"],"names":["CombinatorSelector","options","jsxs","Radio","v","g","handleOnChange","jsx","Label","e","V","option","Tooltip","a","RemoveRuleAction","className","handlePress","event","handleOnClick","m","f","IconButton","d","Icon","Delete","w","LockAction","LockFill","F","CloneAction","Duplicate","T","QueryBuilder","orientation","mergedElements","s","RuleGroup","B","P","b","A","ValueEditor","h","defaultClassnames","useMemo","R","mergedClassnames","QueryBuilderContext","createContext","D","RQBBuilder","S","L","I","k","ValueSelector"],"mappings":"ivBA2GO,IAAA,CAAA,CAAA,CAAA,GAAA,CAAA,0CACD,CAAA,EAAA,CAAA,iDAGGA,CAAmB,CAC1B,SAAAC,CACA,CAAA,CAAA,OACA,CAAA,CAAA,CAAA,KAAA,CAAA,CAAA,CAAA,cAGEC,CAAAA,CAACC,CAAAA,CAAM,CAAA,OACLC,IAAA,CAAAC,KAAA,CAAA,KACA,CAAA,CAAA,KAAUC,CAAAA,CACV,CAAA,QAAA,CAAA,CAAA,CAAY,WAAA,CAAA,YAEZC,CAACC,QAAM,CAA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AA,KAAA,CAAA,iBACA,CAAA,KAAA,CAAA,iBACA,CAAA,CAAA,CAAA,eACSJ,CACT,CAAA,CAAA,OAAA,CAAA,CAAA,CAAA,aAMNf,CAAa,IAAA,CAAA,GAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,kBACA,CAAA,CAAA,CAAA,CAAA,CAAA,gBACA,CAAA,CAAA,CAAA,CAAaN,CAAAA,UACb,CAAA,CAAA,CAAA,CAAA,CAAcG,WACd,CAAA,CAAA,CAAA,CAAA,CAAA,aAEbG,CAAAA,aAAa,CAAA,CAAA,CAAA,IAAA,CAAAM,IAAA,CAAYF,CAAAA,CACzBJ,SAAa,CAAAK,SAAA,CAAA,CAAA,CAAA,wBACA,CAAAe,wBAAA,CAAA,CAAA,CAAA,wBACA,CAAAC,wBAAA,CAAA,CAAA,CAAA,mBACA,CAAAC,mBAAA,CAAA,CAAA,CAAcb,WACd,CAAAC,WAAA,CAAA,CAAA,CAAA,aAAgBa,CAAAA,aAAAA","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\nimport { Duplicate, LockFill } from '@accelint/icons';\nimport { Delete } from '@accelint/icons';\nimport type { PressEvent } from '@react-types/shared';\nimport { type ReactElement, createContext, useCallback, useMemo } from 'react';\nimport {\n type ActionProps,\n type Classnames,\n type CombinatorSelectorProps,\n type FullCombinator,\n type FullField,\n type FullOperator,\n QueryBuilder as RQBBuilder,\n type Classnames as RQBClassnames,\n type Field as RQBField,\n type QueryBuilderProps as RQBProps,\n type RuleGroupType as RQBRuleGroupType,\n type ValueEditorProps,\n} from 'react-querybuilder';\nimport type { LiteralUnion } from 'type-fest';\nimport { cn } from '../../lib/utils';\nimport { Icon } from '../icon';\nimport { IconButton } from '../icon-button';\nimport { Label } from '../label';\nimport { Radio } from '../radio';\nimport { Tooltip } from '../tooltip';\nimport { ActionElement } from './action-element';\nimport {\n RuleGroup,\n RuleGroupFooterComponent,\n RuleGroupHeaderComponent,\n} from './group';\nimport { Rule } from './rule';\nimport { getValidationResult, pressToMouseEvent } from './utils';\nimport { ValueEditor } from './value-editor';\nimport { ValueSelector } from './value-selector';\n\nexport type RuleGroupType = RQBRuleGroupType;\nexport type Field = RQBField;\n\nexport type DefaultRQBProps = RQBProps<\n RuleGroupType,\n FullField,\n FullOperator,\n FullCombinator\n>;\n\n// TODO: need to add multiselect back in when we have a compatible component\nexport type QueryBuilderValueEditors = Record<\n LiteralUnion<\n Exclude<ValueEditorProps['type'], null | undefined | 'multiselect'>,\n string\n >,\n (props: ValueEditorProps) => ReactElement\n>;\n\n/**\n * Omitted props are currently unsupported functionality\n */\nexport type QueryBuilderProps = Partial<\n Omit<\n DefaultRQBProps,\n | 'showCombinatorsBetweenRules'\n | 'independentCombinators'\n | 'listsAsArrays'\n | 'enableDragAndDrop'\n | 'showNotToggle'\n | 'showShiftActions'\n > & {\n orientation?: 'horizontal' | 'vertical';\n showRuleLines?: boolean;\n }\n>;\n\n/**\n * Omitted classnames are for unsupported features\n */\nexport type ClassNames = Omit<\n RQBClassnames,\n | 'betweenRules'\n | 'branches'\n | 'dndDragging'\n | 'dndOver'\n | 'dndCopy'\n | 'dndGroup'\n | 'dragHandle'\n | 'shiftActions'\n | 'notToggle'\n>;\n\nexport type QueryBuilderContextType = Pick<\n QueryBuilderProps,\n 'showRuleLines' | 'orientation'\n>;\n\nconst operatorDescriptions: Record<string, string> = {\n AND: 'All rules below must be true for a match',\n OR: 'One of the rules below must be true for a match',\n};\n\nfunction CombinatorSelector({\n options,\n value,\n handleOnChange,\n}: CombinatorSelectorProps) {\n return (\n <Radio.Group\n value={value}\n onChange={handleOnChange}\n orientation='horizontal'\n >\n <Label>Combinator</Label>\n {options.map((option) => (\n <Radio key={option.label} value={option.label}>\n <Tooltip>\n <Tooltip.Trigger>\n <span>{option.label}</span>\n </Tooltip.Trigger>\n <Tooltip.Body placement='top'>\n {operatorDescriptions[option.label]}\n </Tooltip.Body>\n </Tooltip>\n </Radio>\n ))}\n </Radio.Group>\n );\n}\n\nfunction RemoveRuleAction({ handleOnClick, className, ...rest }: ActionProps) {\n // TODO: remove pressToMouseEvent when design-system is removed\n const handlePress = useCallback(\n (event: PressEvent) => handleOnClick(pressToMouseEvent(event)),\n [handleOnClick],\n );\n\n return (\n <IconButton\n size='small'\n onPress={handlePress}\n className={className}\n {...rest}\n >\n <Icon>\n <Delete />\n </Icon>\n </IconButton>\n );\n}\n\nfunction LockAction({ handleOnClick, className, ...rest }: ActionProps) {\n // TODO: remove pressToMouseEvent when design-system is removed\n const handlePress = useCallback(\n (event: PressEvent) => handleOnClick(pressToMouseEvent(event)),\n [handleOnClick],\n );\n\n return (\n <IconButton\n size={'small'}\n onPress={handlePress}\n className={className}\n {...rest}\n >\n <Icon>\n <LockFill />\n </Icon>\n </IconButton>\n );\n}\n\nfunction CloneAction({ handleOnClick, className, ...rest }: ActionProps) {\n // TODO: remove pressToMouseEvent when design-system is removed\n const handlePress = useCallback(\n (event: PressEvent) => handleOnClick(pressToMouseEvent(event)),\n [handleOnClick],\n );\n\n return (\n <IconButton\n size={'small'}\n onPress={handlePress}\n className={className}\n {...rest}\n >\n <Icon>\n <Duplicate />\n </Icon>\n </IconButton>\n );\n}\n\nexport function QueryBuilder({\n controlClassnames,\n controlElements,\n orientation = 'horizontal',\n showRuleLines = true,\n ...rest\n}: QueryBuilderProps) {\n /**\n * Represents the list of available controls that the component can use as a custom\n * component override.Passed in as a map of our custom defaults, but can be\n * overridden by using the controlElements prop\n */\n const mergedElements = useMemo(\n () => ({\n combinatorSelector: CombinatorSelector,\n cloneGroupAction: CloneAction,\n cloneRuleAction: CloneAction,\n removeRuleAction: RemoveRuleAction,\n lockGroupAction: LockAction,\n lockRuleAction: LockAction,\n ruleGroup: RuleGroup,\n rule: Rule,\n actionElement: ActionElement,\n valueSelector: ValueSelector,\n valueEditor: ValueEditor,\n ...controlElements,\n }),\n [controlElements],\n );\n\n /**\n * Represents the list of available classnames that the component will recognize.\n * Passed in as a map as all the default styling, but can be overridden by using the\n * controlClassnames prop\n */\n const defaultClassnames: Partial<Classnames> = useMemo(\n () => ({\n queryBuilder: 'border border-transparent',\n ruleGroup:\n 'group col-span-full flex flex-col gap-s p-s border border-info rounded-medium',\n header: 'flex gap-s',\n body: cn(\n 'group grid gap-x-s empty:hidden',\n showRuleLines\n ? 'grid-cols-[10px_minmax(100px,_1fr)_min-content]'\n : 'grid-cols-[minmax(100px,_1fr)_min-content]',\n ),\n combinators: 'my-s',\n addRule: '',\n addGroup: '',\n cloneRule: 'fg-interactive hover:fg-interactive-hover',\n cloneGroup: 'fg-interactive hover:fg-interactive-hover',\n removeGroup: '',\n rule: cn(\n 'flex gap-xs py-s',\n orientation === 'vertical'\n ? 'flex-col'\n : 'min-height-[50px] items-start',\n ),\n fields: 'w-full',\n operators: '',\n value: 'w-full',\n removeRule: '',\n valid: '',\n invalid: '',\n disabled: '',\n lockRule: 'fg-interactive hover:fg-interactive-hover',\n lockGroup: 'fg-interactive hover:fg-interactive-hover',\n valueSource: '',\n valueListItem: '',\n }),\n [orientation, showRuleLines],\n );\n\n const mergedClassnames = useMemo(() => {\n return {\n ...defaultClassnames,\n ...controlClassnames,\n };\n }, [controlClassnames, defaultClassnames]);\n\n const QueryBuilderContext = createContext<QueryBuilderContextType>({\n orientation,\n showRuleLines,\n });\n\n return (\n <RQBBuilder\n showNotToggle={false}\n showShiftActions={false}\n enableDragAndDrop={false}\n controlClassnames={mergedClassnames}\n controlElements={mergedElements}\n context={QueryBuilderContext}\n listsAsArrays\n {...rest}\n />\n );\n}\n\nQueryBuilder.CombinatorSelector = CombinatorSelector;\nQueryBuilder.RemoveRuleAction = RemoveRuleAction;\nQueryBuilder.LockAction = LockAction;\nQueryBuilder.CloneAction = CloneAction;\nQueryBuilder.ActionElement = ActionElement;\nQueryBuilder.Rule = Rule;\nQueryBuilder.RuleGroup = RuleGroup;\nQueryBuilder.RuleGroupHeaderComponent = RuleGroupHeaderComponent;\nQueryBuilder.RuleGroupFooterComponent = RuleGroupFooterComponent;\nQueryBuilder.getValidationResult = getValidationResult;\nQueryBuilder.ValueEditor = ValueEditor;\nQueryBuilder.ValueSelector = ValueSelector;\n"]}
|
1
|
+
{"version":3,"sources":["../../../src/components/query-builder/index.tsx"],"names":["CombinatorSelector","options","jsxs","Radio","v","g","handleOnChange","jsx","Label","e","V","option","Tooltip","a","RemoveRuleAction","className","handlePress","event","handleOnClick","c","f","IconButton","d","Icon","Delete","T","LockAction","LockFill","w","CloneAction","Duplicate","F","QueryBuilder","orientation","mergedElements","s","RuleGroup","B","P","b","A","ValueEditor","h","defaultClassnames","useMemo","R","mergedClassnames","QueryBuilderContext","createContext","D","RQBBuilder","S","L","I","k","ValueSelector"],"mappings":"qwBA4GO,IAAA,CAAA,CAAA,CAAA,GAAA,CAAA,0CACD,CAAA,EAAA,CAAA,iDAGGA,CAAmB,CAC1B,SAAAC,CACA,CAAA,CAAA,OACA,CAAA,CAAA,CAAA,KAAA,CAAA,CAAA,CAAA,cAGEC,CAAAA,CAACC,CAAAA,CAAM,CAAA,OACLC,IAAA,CAAAC,KAAA,CAAA,KACA,CAAA,CAAA,KAAUC,CAAAA,CACV,CAAA,QAAA,CAAA,CAAA,CAAY,WAAA,CAAA,YAEZC,CAACC,QAAM,CAAA,CAAAC,GAAA,CAAAC,KAAA,CAAA,CAAA,QAAA,CAAA,YAELH,CAAAA,CAACJ,CAAAA,CAAA,CAAyB,GAAA,CAAA,CAAA,EAAOQ,GAAO,aACtC,CAAA,CAAA,CAAA,KAACC,CAAAA,QACC,CAAAR,IAAA,CAAAS,OA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CAAA,CAAA,CAAA,CAAA,gBACA,CAAA,CAAA,CAAA,CAAaN,CAAAA,UACb,CAAA,CAAA,CAAA,CAAA,CAAcG,WACd,CAAA,CAAA,CAAA,CAAA,CAAA,aAEbG,CAAAA,aAAa,CAAA,CAAA,CAAA,IAAA,CAAAM,IAAA,CAAYF,CAAAA,CACzBJ,SAAa,CAAAK,SAAA,CAAA,CAAA,CAAA,wBACA,CAAAe,wBAAA,CAAA,CAAA,CAAA,wBACA,CAAAC,wBAAA,CAAA,CAAA,CAAA,mBACA,CAAAC,mBAAA,CAAA,CAAA,CAAcb,WACd,CAAAC,WAAA,CAAA,CAAA,CAAA,aAAgBa,CAAAA,aAAAA","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';\nimport { Delete, Duplicate, LockFill } from '@accelint/icons';\nimport type { PressEvent } from '@react-types/shared';\nimport 'client-only';\nimport { type ReactElement, createContext, useCallback, useMemo } from 'react';\nimport {\n type ActionProps,\n type Classnames,\n type CombinatorSelectorProps,\n type FullCombinator,\n type FullField,\n type FullOperator,\n QueryBuilder as RQBBuilder,\n type Classnames as RQBClassnames,\n type Field as RQBField,\n type QueryBuilderProps as RQBProps,\n type RuleGroupType as RQBRuleGroupType,\n type ValueEditorProps,\n} from 'react-querybuilder';\nimport type { LiteralUnion } from 'type-fest';\nimport { cn } from '../../lib/utils';\nimport { Icon } from '../icon';\nimport { IconButton } from '../icon-button';\nimport { Label } from '../label';\nimport { Radio } from '../radio';\nimport { Tooltip } from '../tooltip';\nimport { ActionElement } from './action-element';\nimport {\n RuleGroup,\n RuleGroupFooterComponent,\n RuleGroupHeaderComponent,\n} from './group';\nimport { Rule } from './rule';\nimport { getValidationResult, pressToMouseEvent } from './utils';\nimport { ValueEditor } from './value-editor';\nimport { ValueSelector } from './value-selector';\n\nexport type RuleGroupType = RQBRuleGroupType;\nexport type Field = RQBField;\n\nexport type DefaultRQBProps = RQBProps<\n RuleGroupType,\n FullField,\n FullOperator,\n FullCombinator\n>;\n\n// TODO: need to add multiselect back in when we have a compatible component\nexport type QueryBuilderValueEditors = Record<\n LiteralUnion<\n Exclude<ValueEditorProps['type'], null | undefined | 'multiselect'>,\n string\n >,\n (props: ValueEditorProps) => ReactElement\n>;\n\n/**\n * Omitted props are currently unsupported functionality\n */\nexport type QueryBuilderProps = Partial<\n Omit<\n DefaultRQBProps,\n | 'showCombinatorsBetweenRules'\n | 'independentCombinators'\n | 'listsAsArrays'\n | 'enableDragAndDrop'\n | 'showNotToggle'\n | 'showShiftActions'\n > & {\n orientation?: 'horizontal' | 'vertical';\n showRuleLines?: boolean;\n }\n>;\n\n/**\n * Omitted classnames are for unsupported features\n */\nexport type ClassNames = Omit<\n RQBClassnames,\n | 'betweenRules'\n | 'branches'\n | 'dndDragging'\n | 'dndOver'\n | 'dndCopy'\n | 'dndGroup'\n | 'dragHandle'\n | 'shiftActions'\n | 'notToggle'\n>;\n\nexport type QueryBuilderContextType = Pick<\n QueryBuilderProps,\n 'showRuleLines' | 'orientation'\n>;\n\nconst operatorDescriptions: Record<string, string> = {\n AND: 'All rules below must be true for a match',\n OR: 'One of the rules below must be true for a match',\n};\n\nfunction CombinatorSelector({\n options,\n value,\n handleOnChange,\n}: CombinatorSelectorProps) {\n return (\n <Radio.Group\n value={value}\n onChange={handleOnChange}\n orientation='horizontal'\n >\n <Label>Combinator</Label>\n {options.map((option) => (\n <Radio key={option.label} value={option.label}>\n <Tooltip>\n <Tooltip.Trigger>\n <span>{option.label}</span>\n </Tooltip.Trigger>\n <Tooltip.Body placement='top'>\n {operatorDescriptions[option.label]}\n </Tooltip.Body>\n </Tooltip>\n </Radio>\n ))}\n </Radio.Group>\n );\n}\n\nfunction RemoveRuleAction({ handleOnClick, className, ...rest }: ActionProps) {\n // TODO: remove pressToMouseEvent when design-system is removed\n const handlePress = useCallback(\n (event: PressEvent) => handleOnClick(pressToMouseEvent(event)),\n [handleOnClick],\n );\n\n return (\n <IconButton\n size='small'\n onPress={handlePress}\n className={className}\n {...rest}\n >\n <Icon>\n <Delete />\n </Icon>\n </IconButton>\n );\n}\n\nfunction LockAction({ handleOnClick, className, ...rest }: ActionProps) {\n // TODO: remove pressToMouseEvent when design-system is removed\n const handlePress = useCallback(\n (event: PressEvent) => handleOnClick(pressToMouseEvent(event)),\n [handleOnClick],\n );\n\n return (\n <IconButton\n size={'small'}\n onPress={handlePress}\n className={className}\n {...rest}\n >\n <Icon>\n <LockFill />\n </Icon>\n </IconButton>\n );\n}\n\nfunction CloneAction({ handleOnClick, className, ...rest }: ActionProps) {\n // TODO: remove pressToMouseEvent when design-system is removed\n const handlePress = useCallback(\n (event: PressEvent) => handleOnClick(pressToMouseEvent(event)),\n [handleOnClick],\n );\n\n return (\n <IconButton\n size={'small'}\n onPress={handlePress}\n className={className}\n {...rest}\n >\n <Icon>\n <Duplicate />\n </Icon>\n </IconButton>\n );\n}\n\nexport function QueryBuilder({\n controlClassnames,\n controlElements,\n orientation = 'horizontal',\n showRuleLines = true,\n ...rest\n}: QueryBuilderProps) {\n /**\n * Represents the list of available controls that the component can use as a custom\n * component override.Passed in as a map of our custom defaults, but can be\n * overridden by using the controlElements prop\n */\n const mergedElements = useMemo(\n () => ({\n combinatorSelector: CombinatorSelector,\n cloneGroupAction: CloneAction,\n cloneRuleAction: CloneAction,\n removeRuleAction: RemoveRuleAction,\n lockGroupAction: LockAction,\n lockRuleAction: LockAction,\n ruleGroup: RuleGroup,\n rule: Rule,\n actionElement: ActionElement,\n valueSelector: ValueSelector,\n valueEditor: ValueEditor,\n ...controlElements,\n }),\n [controlElements],\n );\n\n /**\n * Represents the list of available classnames that the component will recognize.\n * Passed in as a map as all the default styling, but can be overridden by using the\n * controlClassnames prop\n */\n const defaultClassnames: Partial<Classnames> = useMemo(\n () => ({\n queryBuilder: 'border border-transparent',\n ruleGroup:\n 'group col-span-full flex flex-col gap-s p-s border border-info rounded-medium',\n header: 'flex gap-s',\n body: cn(\n 'group grid gap-x-s empty:hidden',\n showRuleLines\n ? 'grid-cols-[10px_minmax(100px,_1fr)_min-content]'\n : 'grid-cols-[minmax(100px,_1fr)_min-content]',\n ),\n combinators: 'my-s',\n addRule: '',\n addGroup: '',\n cloneRule: 'fg-interactive hover:fg-interactive-hover',\n cloneGroup: 'fg-interactive hover:fg-interactive-hover',\n removeGroup: '',\n rule: cn(\n 'flex gap-xs py-s',\n orientation === 'vertical'\n ? 'flex-col'\n : 'min-height-[50px] items-start',\n ),\n fields: 'w-full',\n operators: '',\n value: 'w-full',\n removeRule: '',\n valid: '',\n invalid: '',\n disabled: '',\n lockRule: 'fg-interactive hover:fg-interactive-hover',\n lockGroup: 'fg-interactive hover:fg-interactive-hover',\n valueSource: '',\n valueListItem: '',\n }),\n [orientation, showRuleLines],\n );\n\n const mergedClassnames = useMemo(() => {\n return {\n ...defaultClassnames,\n ...controlClassnames,\n };\n }, [controlClassnames, defaultClassnames]);\n\n const QueryBuilderContext = createContext<QueryBuilderContextType>({\n orientation,\n showRuleLines,\n });\n\n return (\n <RQBBuilder\n showNotToggle={false}\n showShiftActions={false}\n enableDragAndDrop={false}\n controlClassnames={mergedClassnames}\n controlElements={mergedElements}\n context={QueryBuilderContext}\n listsAsArrays\n {...rest}\n />\n );\n}\n\nQueryBuilder.CombinatorSelector = CombinatorSelector;\nQueryBuilder.RemoveRuleAction = RemoveRuleAction;\nQueryBuilder.LockAction = LockAction;\nQueryBuilder.CloneAction = CloneAction;\nQueryBuilder.ActionElement = ActionElement;\nQueryBuilder.Rule = Rule;\nQueryBuilder.RuleGroup = RuleGroup;\nQueryBuilder.RuleGroupHeaderComponent = RuleGroupHeaderComponent;\nQueryBuilder.RuleGroupFooterComponent = RuleGroupFooterComponent;\nQueryBuilder.getValidationResult = getValidationResult;\nQueryBuilder.ValueEditor = ValueEditor;\nQueryBuilder.ValueSelector = ValueSelector;\n"]}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import {cn}from'./../../lib/utils.js';import {cva}from'cva';import {Radio,RadioGroup,composeRenderProps}from'react-aria-components';import {Label}from'../label/index.js';import {jsx,jsxs,Fragment}from'react/jsx-runtime';var v=cva("fg-default-light flex size-l items-center justify-center rounded-round outline outline-interactive before:block before:size-s before:rounded-round before:bg-transparent",{variants:{isSelected:{true:"outline-highlight before:bg-highlight"},isFocused:{true:"outline-interactive-hover hover:outline-interactive-hover"},isHovered:{true:"outline-interactive-hover hover:outline-interactive-hover"},isDisabled:{true:"outline-interactive-disabled"}},compoundVariants:[{isDisabled:true,isSelected:true,className:"hover:interactive-disabled outline-interactive-disabled before:bg-interactive-disabled"},{isDisabled:true,className:"hover:interactive-disabled outline-interactive-disabled"}],defaultVariants:{isDisabled:false,isFocused:false,isHovered:false,isSelected:false}});function m({className:i,children:o
|
1
|
+
import {cn}from'./../../lib/utils.js';import'client-only';import {cva}from'cva';import {Radio,RadioGroup,composeRenderProps}from'react-aria-components';import {Label}from'../label/index.js';import {jsx,jsxs,Fragment}from'react/jsx-runtime';var v=cva("fg-default-light flex size-l items-center justify-center rounded-round outline outline-interactive before:block before:size-s before:rounded-round before:bg-transparent",{variants:{isSelected:{true:"outline-highlight before:bg-highlight"},isFocused:{true:"outline-interactive-hover hover:outline-interactive-hover"},isHovered:{true:"outline-interactive-hover hover:outline-interactive-hover"},isDisabled:{true:"outline-interactive-disabled"}},compoundVariants:[{isDisabled:true,isSelected:true,className:"hover:interactive-disabled outline-interactive-disabled before:bg-interactive-disabled"},{isDisabled:true,className:"hover:interactive-disabled outline-interactive-disabled"}],defaultVariants:{isDisabled:false,isFocused:false,isHovered:false,isSelected:false}});function m({className:i,children:t,...o}){return jsx(Radio,{...o,className:cn("fg-default-light flex items-center gap-m dtk-disabled:text-interactive-disabled",i),children:e=>jsxs(Fragment,{children:[jsx("div",{className:cn(v({isDisabled:e.isDisabled,isFocused:e.isFocused,isHovered:e.isHovered,isSelected:e.isSelected})),"aria-hidden":true}),typeof t=="function"?t(e):t]})})}function R({children:i,className:t,label:o,...e}){return jsx(RadioGroup,{...e,className:composeRenderProps(t,(a,n)=>cn("fg-default-light flex flex-col gap-m text-body-s",n.orientation==="horizontal"&&"flex-row items-center",a)),children:a=>jsxs(Fragment,{children:[o?jsx(Label,{children:o}):void 0,typeof i=="function"?i(a):i]})})}m.Group=R;export{m as Radio};//# sourceMappingURL=index.js.map
|
2
2
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/radio/index.tsx"],"names":["u","jsx","args","c","s","l","d","
|
1
|
+
{"version":3,"sources":["../../../src/components/radio/index.tsx"],"names":["u","jsx","args","c","s","l","d","r","children","label","props","f","renderProps","cn","b","Radio","RadioGroup"],"mappings":"gPA2BE,IAAA,CAAA,CAAAA,GAAA,CAAA,0KAEE,CAAA,CAAA,QACE,CAAA,CAAA,UACQ,CAAA,CAAA,IAAA,CAAA,oHAKR,CAAA,CAAA,SACQ,CAAA,CAAA,IAAA,CAAA,+HAQN,CAAA,CAAA,CAAA,UACA,CAAA,IAAA,CAAA,yBAEE,CAAA,wFAGF,CAAA,CAAA,CAAA,yBACW,CAAA,yDAGf,CAAA,CAAA,CAAA,eACE,CAAA,CAAA,UACA,CAAA,KAAA,CAAA,yBAEA,CAAA,KAAA,CAAA,UAOC,CAAA,KAAA,CAAA,CAAA,CAAA,CAAA,qBAA4B,CAAA,CAAA,CAAA,QAAkB,CAAe,CAClE,CAAA,GAAA,CAAA,CAAA,CACEC,CAAAA,OACMC,GAAAA,CACJC,qBACE,CAAAC,EAAA,CAAA,iFAID,CAAA,CAAA,CAAA,CAAA,QACC,CACE,CAAA,EAAAC,IAAA,CAAAC,QAAA,CAAA,CAAA,QAAC,CAAA,CAAAC,GACC,iBAEI,CAAAH,EAAA,CAAA,CAAA,CAAA,CAAA,uBACA,CAAA,SAAiB,CAAA,CAAA,CAAA,SACjB,CAAA,SAAiB,CAAA,CAAA,CAAA,oBACC,CAAA,CAAA,CAAA,2BAKvB,CAAA,IAAA,CAAA,CAAOI,CAAAA,OAAa,CAAA,EAAA,UAA+BA,CACtD,CAAA,CAEJ,CAEJ,CAOA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,SAAsB,CAAA,CAAA,CAAA,QAAU,CAAA,CAAA,CAAA,SAAW,CAAAC,EAAO,MAA6B,CAC7E,CAAA,GAAA,CAAA,CAAA,CACER,QACMS,GAAAA,CACJC,UAAA,CAAA,CAAA,GAAA,CAAA,CAAA,SAAqDC,qBACnDC,CAAAA,CACE,CAAA,CAAA,CAAA,GAAAT,EAAA,CAAA,kDACY,CAAA,CAAA,CAAA,WAAgB,GAAA,YAAgB,EAAA,oCAO9C,CACG,CAAA,EAAAC,IAAA,CAAAC,QAAA,CAAA,CAAA,QAAS,CAAO,CAAA,CAAA,CAAAC,GAAA,CAAAO,KAAA,CAAA,CAAA,YAChB,CAAA,MAAON,CAAAA,OAAa,CAAA,EAAA,WACvB,CAAA,CAEJ,CAEJ,CAEAO,CAAAA,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQC,CAAAA,CAAAA,KAAAA,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\n'use client';\nimport { cn } from '@/lib/utils';\nimport 'client-only';\nimport { cva } from 'cva';\nimport type React from 'react';\nimport {\n Radio as AriaRadio,\n RadioGroup as AriaRadioGroup,\n type RadioGroupProps as AriaRadioGroupProps,\n type RadioProps as AriaRadioProps,\n composeRenderProps,\n} from 'react-aria-components';\nimport { Label } from '../label';\n\nconst radioStyles = cva(\n 'fg-default-light flex size-l items-center justify-center rounded-round outline outline-interactive before:block before:size-s before:rounded-round before:bg-transparent',\n {\n variants: {\n isSelected: {\n true: 'outline-highlight before:bg-highlight',\n },\n isFocused: {\n true: 'outline-interactive-hover hover:outline-interactive-hover',\n },\n isHovered: {\n true: 'outline-interactive-hover hover:outline-interactive-hover',\n },\n isDisabled: {\n true: 'outline-interactive-disabled',\n },\n },\n compoundVariants: [\n {\n isDisabled: true,\n isSelected: true,\n className:\n 'hover:interactive-disabled outline-interactive-disabled before:bg-interactive-disabled',\n },\n {\n isDisabled: true,\n className: 'hover:interactive-disabled outline-interactive-disabled',\n },\n ],\n defaultVariants: {\n isDisabled: false,\n isFocused: false,\n isHovered: false,\n isSelected: false,\n },\n },\n);\n\nexport interface RadioProps extends AriaRadioProps {}\n\nexport function Radio({ className, children, ...args }: RadioProps) {\n return (\n <AriaRadio\n {...args}\n className={cn(\n 'fg-default-light flex items-center gap-m dtk-disabled:text-interactive-disabled',\n className,\n )}\n >\n {(props) => (\n <>\n <div\n className={cn(\n radioStyles({\n isDisabled: props.isDisabled,\n isFocused: props.isFocused,\n isHovered: props.isHovered,\n isSelected: props.isSelected,\n }),\n )}\n aria-hidden\n />\n {typeof children === 'function' ? children(props) : children}\n </>\n )}\n </AriaRadio>\n );\n}\n\nexport interface RadioGroupProps extends AriaRadioGroupProps {\n // children: React.JSX.Element;\n label?: string | React.JSX.Element;\n}\n\nfunction RadioGroup({ children, className, label, ...props }: RadioGroupProps) {\n return (\n <AriaRadioGroup\n {...props}\n className={composeRenderProps(className, (className, renderProps) =>\n cn(\n 'fg-default-light flex flex-col gap-m text-body-s',\n renderProps.orientation === 'horizontal' && 'flex-row items-center',\n\n className,\n ),\n )}\n >\n {(props) => (\n <>\n {label ? <Label>{label}</Label> : undefined}\n {typeof children === 'function' ? children(props) : children}\n </>\n )}\n </AriaRadioGroup>\n );\n}\n\nRadio.Group = RadioGroup;\n"]}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import {cn}from'./../../lib/utils.js';import {Search,Loop,CancelFill}from'@accelint/icons';import {cva}from'cva';import {SearchField,Input,Button}from'react-aria-components';import {Icon}from'../icon/index.js';import {jsxs,jsx}from'react/jsx-runtime';var v=cva(["hide-cancel block w-full rounded-round p-s pr-[30px] pl-[35px] font-display text-body-s outline"],{variants:{isDisabled:{true:"text-disabled outline-interactive-disabled placeholder:text-disabled",false:"text-default-light placeholder:text-default-dark hover:outline-interactive-hover focus:outline-highlight"},variant:{filled:"bg-surface-raised outline-static-dark",outlined:"outline-interactive"}}}),g=({className:i,placeholder:l="Search",variant:o="outlined",isLoading:r=false,...s})=>jsxs(SearchField,{className:cn("group relative",i),...s,children:[jsx(Icon,{className:"fg-interactive-hover absolute top-[6px] left-[7px]",children:jsx(Search,{})}),jsx(Input,{placeholder:l,className:({isDisabled:d})=>cn(v({isDisabled:d,variant:o}))}),r?jsx(Icon,{className:"fg-interactive-hover absolute top-[6px] right-[8px] animate-spin",children:jsx(Loop,{className:"scale-x-[-1]"})}):jsx(Button,{className:"fg-default-dark hover:fg-interactive-hover absolute top-[8px] right-[8px] cursor-pointer group-dtk-disabled:hidden group-dtk-empty:hidden",children:jsx(Icon,{size:"small",children:jsx(CancelFill,{})})})]});g.displayName="SearchField";export{g as SearchField};//# sourceMappingURL=index.js.map
|
1
|
+
import {cn}from'./../../lib/utils.js';import {Search,Loop,CancelFill}from'@accelint/icons';import'client-only';import {cva}from'cva';import {SearchField,Input,Button}from'react-aria-components';import {Icon}from'../icon/index.js';import {jsxs,jsx}from'react/jsx-runtime';var v=cva(["hide-cancel block w-full rounded-round p-s pr-[30px] pl-[35px] font-display text-body-s outline"],{variants:{isDisabled:{true:"text-disabled outline-interactive-disabled placeholder:text-disabled",false:"text-default-light placeholder:text-default-dark hover:outline-interactive-hover focus:outline-highlight"},variant:{filled:"bg-surface-raised outline-static-dark",outlined:"outline-interactive"}}}),g=({className:i,placeholder:l="Search",variant:o="outlined",isLoading:r=false,...s})=>jsxs(SearchField,{className:cn("group relative",i),...s,children:[jsx(Icon,{className:"fg-interactive-hover absolute top-[6px] left-[7px]",children:jsx(Search,{})}),jsx(Input,{placeholder:l,className:({isDisabled:d})=>cn(v({isDisabled:d,variant:o}))}),r?jsx(Icon,{className:"fg-interactive-hover absolute top-[6px] right-[8px] animate-spin",children:jsx(Loop,{className:"scale-x-[-1]"})}):jsx(Button,{className:"fg-default-dark hover:fg-interactive-hover absolute top-[8px] right-[8px] cursor-pointer group-dtk-disabled:hidden group-dtk-empty:hidden",children:jsx(Icon,{size:"small",children:jsx(CancelFill,{})})})]});g.displayName="SearchField";export{g as SearchField};//# sourceMappingURL=index.js.map
|
2
2
|
//# sourceMappingURL=index.js.map
|