@accelint/design-toolkit 1.0.1 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/dist/components/accordion/index.d.ts +2 -2
  2. package/dist/components/avatar/index.d.ts +4 -4
  3. package/dist/components/badge/index.d.ts +2 -2
  4. package/dist/components/box/index.d.ts +3 -3
  5. package/dist/components/checkbox/index.d.ts +2 -2
  6. package/dist/components/chip/index.d.ts +2 -2
  7. package/dist/components/color-picker/index.d.ts +21 -0
  8. package/dist/components/color-picker/index.js +2 -0
  9. package/dist/components/color-picker/index.js.map +1 -0
  10. package/dist/components/combobox/index.js +1 -1
  11. package/dist/components/combobox/index.js.map +1 -1
  12. package/dist/components/date-field/index.d.ts +28 -0
  13. package/dist/components/date-field/index.js +2 -0
  14. package/dist/components/date-field/index.js.map +1 -0
  15. package/dist/components/dialog/index.d.ts +40 -0
  16. package/dist/components/dialog/index.js +2 -0
  17. package/dist/components/dialog/index.js.map +1 -0
  18. package/dist/components/icon/index.js +1 -1
  19. package/dist/components/icon/index.js.map +1 -1
  20. package/dist/components/query-builder/action-element.d.ts +6 -0
  21. package/dist/components/query-builder/action-element.js +2 -0
  22. package/dist/components/query-builder/action-element.js.map +1 -0
  23. package/dist/components/query-builder/constants.d.ts +3 -0
  24. package/dist/components/query-builder/constants.js +2 -0
  25. package/dist/components/query-builder/constants.js.map +1 -0
  26. package/dist/components/query-builder/example-configuration.d.ts +30 -0
  27. package/dist/components/query-builder/example-configuration.js +2 -0
  28. package/dist/components/query-builder/example-configuration.js.map +1 -0
  29. package/dist/components/query-builder/group.d.ts +8 -0
  30. package/dist/components/query-builder/group.js +2 -0
  31. package/dist/components/query-builder/group.js.map +1 -0
  32. package/dist/components/query-builder/index.d.ts +44 -0
  33. package/dist/components/query-builder/index.js +2 -0
  34. package/dist/components/query-builder/index.js.map +1 -0
  35. package/dist/components/query-builder/rule.d.ts +6 -0
  36. package/dist/components/query-builder/rule.js +2 -0
  37. package/dist/components/query-builder/rule.js.map +1 -0
  38. package/dist/components/query-builder/utils.d.ts +14 -0
  39. package/dist/components/query-builder/utils.js +2 -0
  40. package/dist/components/query-builder/utils.js.map +1 -0
  41. package/dist/components/query-builder/value-editor.d.ts +6 -0
  42. package/dist/components/query-builder/value-editor.js +2 -0
  43. package/dist/components/query-builder/value-editor.js.map +1 -0
  44. package/dist/components/query-builder/value-selector.d.ts +6 -0
  45. package/dist/components/query-builder/value-selector.js +2 -0
  46. package/dist/components/query-builder/value-selector.js.map +1 -0
  47. package/dist/components/radio/index.d.ts +2 -2
  48. package/dist/components/radio/index.js +1 -1
  49. package/dist/components/radio/index.js.map +1 -1
  50. package/dist/components/search-field/index.d.ts +19 -0
  51. package/dist/components/search-field/index.js +2 -0
  52. package/dist/components/search-field/index.js.map +1 -0
  53. package/dist/components/switch/index.d.ts +1 -1
  54. package/dist/components/switch/index.js +1 -1
  55. package/dist/components/switch/index.js.map +1 -1
  56. package/dist/components/tabs/index.d.ts +33 -0
  57. package/dist/components/tabs/index.js +2 -0
  58. package/dist/components/tabs/index.js.map +1 -0
  59. package/dist/components/text-area/index.js +1 -1
  60. package/dist/components/text-area/index.js.map +1 -1
  61. package/dist/components/text-field/index.js +1 -1
  62. package/dist/components/text-field/index.js.map +1 -1
  63. package/dist/components/tooltip/index.d.ts +2 -2
  64. package/dist/components/tooltip/index.js +1 -1
  65. package/dist/components/tooltip/index.js.map +1 -1
  66. package/dist/index.css +54 -0
  67. package/dist/index.d.ts +14 -0
  68. package/dist/index.js +1 -1
  69. package/dist/lib/react.d.ts +15 -3
  70. package/dist/lib/react.js +4 -1
  71. package/dist/lib/react.js.map +1 -1
  72. package/dist/metafile-esm.json +1 -1
  73. package/dist/styles.css +439 -6
  74. package/package.json +21 -5
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/text-area/index.tsx"],"names":["g","className","selectOnFocus","size","ref","props","TextAreaContext","P","a","d","T","e","isDisabled","textAreaStyles","isInvalid","Input","isReadOnly","label","isSmall","shouldShowDescription","shouldShowError","jsxs","AriaTextField","b","Label","v","jsx","AriaText","x","errorMessage","TextArea"],"mappings":"2PA6BE,IAAC,CAAA,CAAAA,GAAA,CAAA,CAAA,0EAEC,CAAA,CAAA,CAAA,QACE,CAAA,CAAA,UACQ,CAAA,CAAA,IAAA,CAAA,sEAEJ,CAAA,KAAA,CAAA,0GAEO,CAAA,CAAA,SACH,CAAA,CAAA,IAAA,CAAA,iBAEI,CAAA,CAAA,UACJ,CAAA,CAAA,IAAA,CAAA,+BAGN,CAAQ,CAAA,IAAA,CAAA,CAAA,MAAA,CAAA,aAEV,CAAA,KAAA,CAAA,cACa,CAAA,CAAA,WAEX,CAAA,CAAA,IAAA,CAAA,EACF,CAAA,KAEgB,CAAA,EAAA,CAAA,CAAA,CAAA,gBAEF,CAAA,CAAA,CAAA,yBAEZ,CAAA,IAAA,CAAA,SACF,CAAA,8BAEe,CAAA,CAAA,CAAA,WACD,CAAA,IAAA,CAAA,WACN,KACN,CAAA,IAAA,CAAA,QAAA,CAAA,SACF,CACF,OACiB,CAAA,CAAA,CAAA,eACF,CAAA,CAAA,YACP,KACR,CAAA,IAAA,CAAA,QAYF,CAAAC,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,SACM,CAAA,CAAA,CAAA,GACN,CAAAC,CAAAA,CAAAA,IAAAA,CAAAA,aACAC,CAAAA,CAAAA,CAAAA,KAAO,CACP,IAAA,CAAA,CAAA,CAAA,QAEA,CAAA,GAAQC,CAAAA,CAAG,IAAoBC,CAAAA,CAAOD,CAAKE,CAAAA,CAAe,gBAEtDD,CAAM,CAAA,CAAA,CAAA,CAAAE,eAAA,CAAA,CAAA,CAAA,CAAA,QAEL,CAAAC,GAAA,CACC,iBAEI,CAAAC,EAAA,CAAA,CAAA,CAAA,CAAA,UACYJ,CAAAA,KAAAA,CAAAA,UACZ,CAAA,CAAA,CAAA,QACA,CAAAJ,IAAAA,CAAA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CACC,CAAA,CAAA,CAAAJ,GAAA,CAAA,CAAA,CAAA,CAAA,SACA,CAAA,CAAA,CAAA,WACML,CAAAA,CACL,CAAIE,IACP,EACCc,CACCO,GAAAA,CAACC,CAAA,CAAA,CACC,sBAEEf,CAAAA,EAAAA,CAAAA,CAAAA,4DAEG,CAAA,CAAA,CAAA,IAAA,CAAA,sBAMPc,CAAAA,CAACC,EAAA,CACC,CAAA,EAAAnB,GAAA,CAAAoB,IAAA,CAAA,CAAA,SACA,CAAA,0DAECC,CAAAA,QAMXC,EAAS,CAAc,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,WAAA,CAAA,UAAA","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 {\n Text as AriaText,\n TextArea as AriaTextArea,\n type TextAreaProps as AriaTextAreaProps,\n TextField as AriaTextField,\n type TextFieldProps as AriaTextFieldProps,\n TextAreaContext,\n useContextProps,\n} from 'react-aria-components';\n\nimport { cn } from '@/lib/utils';\nimport { type VariantProps, cva } from 'cva';\nimport type { ForwardedRef } from 'react';\nimport { Label } from '../label';\n\nconst textAreaStyles = cva(\n ['block w-full rounded-medium p-s font-display outline outline-interactive'],\n {\n variants: {\n isDisabled: {\n true: 'text-disabled outline-interactive-disabled placeholder:text-disabled',\n false:\n 'text-default-light placeholder:text-default-dark hover:outline-interactive-hover focus:outline-highlight',\n },\n isInvalid: {\n true: 'outline-serious',\n },\n isReadOnly: {\n true: 'rounded-none p-0 outline-none',\n },\n size: {\n medium: 'text-body-s',\n small: 'text-body-xs',\n },\n isClearable: {\n true: '',\n false: '',\n },\n },\n compoundVariants: [\n {\n isDisabled: true,\n isInvalid: true,\n className: 'outline-interactive-disabled',\n },\n {\n isClearable: true,\n isDisabled: false,\n size: 'medium',\n className: 'pr-xl',\n },\n ],\n defaultVariants: {\n isClearable: false,\n size: 'medium',\n },\n },\n);\n\ninterface InputProps\n extends VariantProps<typeof textAreaStyles>,\n Omit<AriaTextAreaProps, 'size'> {\n selectOnFocus?: boolean;\n ref?: ForwardedRef<HTMLTextAreaElement>;\n}\n\nconst Input = ({\n className,\n ref = null,\n selectOnFocus = false,\n size = 'medium',\n ...props\n}: InputProps) => {\n [props, ref] = useContextProps(props, ref, TextAreaContext);\n\n if (props.readOnly) {\n return (\n <span\n className={cn(\n textAreaStyles({\n isDisabled: false,\n isReadOnly: props.readOnly,\n size,\n className,\n }),\n )}\n >\n {props.value || '\\u00A0'}\n </span>\n );\n }\n\n return (\n <div className='relative flex items-center'>\n <AriaTextArea\n {...props}\n onFocus={(e) => {\n if (selectOnFocus) {\n ref.current?.select();\n }\n\n props.onFocus?.(e);\n }}\n ref={ref}\n className={({ isDisabled, isInvalid }) =>\n cn(\n textAreaStyles({\n isDisabled,\n isInvalid,\n isReadOnly: props.readOnly,\n size,\n className,\n }),\n )\n }\n />\n </div>\n );\n};\nInput.displayName = 'TextArea.Input';\n\nexport interface TextAreaProps\n extends Omit<\n VariantProps<typeof textAreaStyles>,\n 'isDisabled' | 'isInvalid' | 'isReadOnly'\n >,\n Omit<AriaTextFieldProps, 'className'>,\n Omit<InputProps, keyof AriaTextFieldProps> {\n className?: string;\n description?: string;\n errorMessage?: string;\n label?: string;\n placeholder?: string;\n}\n\nexport function TextArea({\n className,\n description,\n errorMessage,\n isDisabled,\n isInvalid,\n isReadOnly,\n label,\n placeholder,\n size = 'medium',\n ...props\n}: TextAreaProps) {\n const isSmall = size === 'small';\n const shouldShowDescription = !(isSmall || isInvalid) || isDisabled;\n const shouldShowError = isInvalid && !isDisabled && !isReadOnly;\n\n return (\n <AriaTextField\n {...(props as AriaTextFieldProps)}\n isDisabled={isDisabled}\n isInvalid={isInvalid}\n isReadOnly={isReadOnly}\n className={'flex flex-col gap-xs'}\n >\n {!isSmall && (\n <Label\n className='empty:hidden'\n isDisabled={isDisabled}\n isOptional={!props.isRequired}\n >\n {label}\n </Label>\n )}\n <Input\n className={className}\n placeholder={placeholder}\n size={size}\n {...(props as InputProps)}\n />\n {shouldShowDescription && (\n <AriaText\n className={cn([\n 'fg-default-dark text-body-xs empty:hidden',\n isDisabled && 'fg-disabled',\n ])}\n slot='description'\n >\n {description}\n </AriaText>\n )}\n {shouldShowError && (\n <AriaText\n className='fg-serious text-body-xs empty:hidden'\n slot='errorMessage'\n >\n {errorMessage}\n </AriaText>\n )}\n </AriaTextField>\n );\n}\nTextArea.displayName = 'TextArea';\n"]}
1
+ {"version":3,"sources":["../../../src/components/text-area/index.tsx"],"names":["g","ref","size","props","TextAreaContext","jsx","cn","T","e","isInvalid","textAreaStyles","n","className","Input","TextArea","description","errorMessage","label","placeholder","isSmall","shouldShowDescription","isDisabled","shouldShowError","isReadOnly","jsxs","b","Label","a","AriaText","x"],"mappings":"2PA6BE,IAAC,CAAA,CAAAA,GAAA,CAAA,CAAA,0EAEC,CAAA,CAAA,CAAA,QACE,CAAA,CAAA,UACQ,CAAA,CAAA,IAAA,CAAA,sEAEJ,CAAA,KAAA,CAAA,0GAEO,CAAA,CAAA,SACH,CAAA,CAAA,IAAA,CAAA,iBAEI,CAAA,CAAA,UACJ,CAAA,CAAA,IAAA,CAAA,+BAGN,CAAQ,CAAA,IAAA,CAAA,CAAA,MAAA,CAAA,aAEV,CAAA,KAAA,CAAA,cACa,CAAA,CAAA,WAEX,CAAA,CAAA,IAAA,CAAA,EACF,CAAA,KAEgB,CAAA,EAAA,CAAA,CAAA,CAAA,gBAEd,CAAA,CAAA,CAAA,UACW,CAAA,IAAA,CAAA,SACA,CAAA,IAAA,CAAA,SAAA,CAA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BUC,CAAAA,SACd,CAAA,CAAA,CAAA,SACAC,CAAAA,CAAAA,CAAAA,WACAC,CAAAA,CAAAA,CAAAA,yBAEA,CAAA,CAAA,CAAA,SACA,CAAA,CAAA,CAAA,UACAC,CAAAA,CAAAA,CACA,KAAAC,CAAAA,CAAAA,CAAAA,WACAhB,CAAO,CAAA,CAAA,IAAA,CAAA,CAAA,CAAA,QAGP,CAAA,GAAMiB,EAAUjB,CAAS,CAAA,IAAA,CAAA,CAAA,CAAA,GACnBkB,OAAqCX,CAAcY,CAAAA,CAAAA,EAAAA,CACnDC,EAAkBb,CAAa,CAAA,EAACY,CAAc,CAAA,CAAA,CAACE,GAGnDC,CAAAA,CAAAA,EAAAA,CAAAA,CAAAA,CAAAA,OACOrB,IACL,CAAAsB,SAAA,CAAA,CAAA,GAAA,CAAA,CAAA,UACA,CAAA,CAAA,CAAA,SACYF,CAAAA,CAAAA,CAAAA,UACD,CAAA,CAAA,CAAA,SAAA,CAAA,+BAGRG,CAAA,CAAA,CACC,uBACA,CAAA,cAAA,CAAA,UACA,CAAA,CAAA,CAAA,UAAmB,CAAA,CAAA,CAAA,CAAA,UAElBT,CAAAA,QAGJJ,CAAA,CAAM,CAAA,CAAA,CAAAc,GAAA,CAAA,CAAA,CAAA,CAAA,SAAmCT,CAAAA,CAAAA,CAAAA,WAAmBhB,CAAAA,CAAM,KAEjEG,CAAAA,CAACuB,CAAA,CAAA,CACC,sBAEEP,CAAAA,EAAAA,CAAAA,CAAAA,4DAEG,CAAA,CAAA,CAAA,IAAA,CAAA,sBAMPhB,CAAAA,CAACuB,EAAA,CACC,CAAA,EAAAD,GAAA,CAAAE,IAAA,CAAA,CAAA,SACA,CAAA,0DAECb,CAAAA,QAMXF,EAAS,CAAc,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,WAAA,CAAA,UAAA","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 {\n Text as AriaText,\n TextArea as AriaTextArea,\n type TextAreaProps as AriaTextAreaProps,\n TextField as AriaTextField,\n type TextFieldProps as AriaTextFieldProps,\n TextAreaContext,\n useContextProps,\n} from 'react-aria-components';\n\nimport { cn } from '@/lib/utils';\nimport { type VariantProps, cva } from 'cva';\nimport type { ForwardedRef } from 'react';\nimport { Label } from '../label';\n\nconst textAreaStyles = cva(\n ['block w-full rounded-medium p-s font-display outline outline-interactive'],\n {\n variants: {\n isDisabled: {\n true: 'text-disabled outline-interactive-disabled placeholder:text-disabled',\n false:\n 'text-default-light placeholder:text-default-dark hover:outline-interactive-hover focus:outline-highlight',\n },\n isInvalid: {\n true: 'outline-serious',\n },\n isReadOnly: {\n true: 'rounded-none p-0 outline-none',\n },\n size: {\n medium: 'text-body-s',\n small: 'text-body-xs',\n },\n isClearable: {\n true: '',\n false: '',\n },\n },\n compoundVariants: [\n {\n isDisabled: true,\n isInvalid: true,\n className: 'outline-interactive-disabled',\n },\n {\n isClearable: true,\n isDisabled: false,\n size: 'medium',\n className: 'pr-xl',\n },\n ],\n defaultVariants: {\n isClearable: false,\n size: 'medium',\n },\n },\n);\n\ninterface InputProps\n extends VariantProps<typeof textAreaStyles>,\n Omit<AriaTextAreaProps, 'size'> {\n selectOnFocus?: boolean;\n ref?: ForwardedRef<HTMLTextAreaElement>;\n}\n\nconst Input = ({\n className,\n ref = null,\n selectOnFocus = false,\n size = 'medium',\n ...props\n}: InputProps) => {\n [props, ref] = useContextProps(props, ref, TextAreaContext);\n\n if (props.readOnly) {\n return (\n <span\n className={cn(\n textAreaStyles({\n isDisabled: false,\n isReadOnly: props.readOnly,\n size,\n className,\n }),\n )}\n >\n {props.value || '\\u00A0'}\n </span>\n );\n }\n\n return (\n <div className='relative flex items-center'>\n <AriaTextArea\n {...props}\n onFocus={(e) => {\n if (selectOnFocus) {\n ref.current?.select();\n }\n\n props.onFocus?.(e);\n }}\n ref={ref}\n className={({ isDisabled, isInvalid }) =>\n cn(\n textAreaStyles({\n isDisabled,\n isInvalid,\n isReadOnly: props.readOnly,\n size,\n className,\n }),\n )\n }\n />\n </div>\n );\n};\nInput.displayName = 'TextArea.Input';\n\nexport interface TextAreaProps\n extends Omit<\n VariantProps<typeof textAreaStyles>,\n 'isDisabled' | 'isInvalid' | 'isReadOnly'\n >,\n Omit<AriaTextFieldProps, 'className'>,\n Omit<InputProps, keyof AriaTextFieldProps> {\n className?: string;\n description?: string;\n errorMessage?: string;\n label?: string;\n placeholder?: string;\n}\n\nexport function TextArea({\n className,\n description,\n errorMessage,\n isDisabled,\n isInvalid,\n isReadOnly,\n label,\n placeholder,\n size = 'medium',\n ...props\n}: TextAreaProps) {\n const isSmall = size === 'small';\n const shouldShowDescription = !(isSmall || isInvalid) || isDisabled;\n const shouldShowError = isInvalid && !isDisabled && !isReadOnly;\n\n return (\n <AriaTextField\n {...(props as AriaTextFieldProps)}\n isDisabled={isDisabled}\n isInvalid={isInvalid}\n isReadOnly={isReadOnly}\n className={'flex flex-col gap-xs'}\n >\n {!isSmall && (\n <Label\n className='empty:hidden'\n isDisabled={isDisabled}\n isOptional={!props.isRequired}\n >\n {label}\n </Label>\n )}\n <Input className={className} placeholder={placeholder} size={size} />\n {shouldShowDescription && (\n <AriaText\n className={cn([\n 'fg-default-dark text-body-xs empty:hidden',\n isDisabled && 'fg-disabled',\n ])}\n slot='description'\n >\n {description}\n </AriaText>\n )}\n {shouldShowError && (\n <AriaText\n className='fg-serious text-body-xs empty:hidden'\n slot='errorMessage'\n >\n {errorMessage}\n </AriaText>\n )}\n </AriaTextField>\n );\n}\nTextArea.displayName = 'TextArea';\n"]}
@@ -1,2 +1,2 @@
1
- import'client-only';import {TextField,Text,useContextProps,InputContext,Input,Button}from'react-aria-components';import {cn}from'./../../lib/utils.js';import {CancelFill}from'@accelint/icons';import {cva}from'cva';import {useEffect}from'react';import {Icon}from'../icon/index.js';import {Label}from'../label/index.js';import {jsxs,jsx}from'react/jsx-runtime';var f=cva(["block w-full rounded-medium px-s py-xs font-display outline outline-interactive"],{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"},isInvalid:{true:"outline-serious"},isReadOnly:{true:"rounded-none p-0 outline-none"},size:{medium:"text-body-s",small:"text-body-xs"},isClearable:{true:"",false:""}},compoundVariants:[{isDisabled:true,isInvalid:true,className:"outline-interactive-disabled"},{isClearable:true,isDisabled:false,size:"medium",className:"pr-xl"}],defaultVariants:{isClearable:false,size:"medium"}}),y={target:{value:""}},k=({className:r,isClearable:i=true,ref:t=null,selectOnFocus:o=false,size:a="medium",...e})=>{[e,t]=useContextProps(e,t,InputContext),useEffect(()=>{function s(n){i&&n.key==="Escape"&&e.onChange?.(y);}return t.current?.addEventListener("keydown",s),()=>t.current?.removeEventListener("keydown",s)},[i,e.onChange,t]);let d=!e.readOnly&&e.value&&a!=="small"&&i&&!e.disabled;return e.readOnly?jsx("span",{className:cn(f({isClearable:false,isDisabled:false,isReadOnly:e.readOnly,size:a,className:r})),children:e.value||"\xA0"}):jsxs("div",{className:"relative flex items-center",children:[jsx(Input,{...e,onFocus:s=>{o&&t.current?.select(),e.onFocus?.(s);},ref:t,className:({isDisabled:s,isInvalid:n})=>cn(f({isClearable:i,isDisabled:s,isInvalid:n,isReadOnly:e.readOnly,size:a,className:r}))}),d&&jsx(Button,{className:"fg-default-dark icon-size-m hover:fg-interactive-hover absolute right-[5px] cursor-pointer",excludeFromTabOrder:true,onPress:()=>{e.onChange?.(y),t.current?.focus();},children:jsx(Icon,{children:jsx(CancelFill,{})})})]})};function M({className:r,isClearable:i=true,description:t,errorMessage:o,isDisabled:a,isInvalid:e,isReadOnly:d,label:s,placeholder:n,size:m="medium",...u}){let x=m==="small",b=t&&(!(x||e)||a),v=o&&e&&!a&&!d;return jsxs(TextField,{...u,isDisabled:a,isInvalid:e,isReadOnly:d,className:"flex flex-col gap-xs",children:[!x&&jsx(Label,{className:"empty:hidden",isDisabled:a,isOptional:!u.isRequired,children:s}),jsx(k,{className:r,isClearable:i,placeholder:n,size:m,...u}),b&&jsx(Text,{className:cn(["fg-default-dark text-body-xs empty:hidden",a&&"fg-disabled"]),slot:"description",children:t}),v&&jsx(Text,{className:"fg-serious text-body-xs empty:hidden",slot:"errorMessage",children:o})]})}export{M as TextField};//# sourceMappingURL=index.js.map
1
+ import'client-only';import {TextField,Text,useContextProps,InputContext,Input,Button}from'react-aria-components';import {cn}from'./../../lib/utils.js';import {CancelFill}from'@accelint/icons';import {cva}from'cva';import {useEffect}from'react';import {Icon}from'../icon/index.js';import {Label}from'../label/index.js';import {jsxs,jsx}from'react/jsx-runtime';var f=cva(["block w-full rounded-medium px-s py-xs font-display outline outline-interactive"],{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"},isInvalid:{true:"outline-serious focus:outline-serious"},isReadOnly:{true:"rounded-none p-0 outline-none"},size:{medium:"text-body-s",small:"text-body-xs"},isClearable:{true:"",false:""}},compoundVariants:[{isDisabled:true,isInvalid:true,className:"outline-interactive-disabled"},{isClearable:true,isDisabled:false,size:"medium",className:"pr-xl"}],defaultVariants:{isClearable:false,size:"medium"}}),y={target:{value:""}},k=({className:r,isClearable:l=true,ref:t=null,selectOnFocus:o=false,size:a="medium",...e})=>{[e,t]=useContextProps(e,t,InputContext),useEffect(()=>{function i(n){l&&n.key==="Escape"&&e.onChange?.(y);}return t.current?.addEventListener("keydown",i),()=>t.current?.removeEventListener("keydown",i)},[l,e.onChange,t]);let d=!e.readOnly&&e.value&&a!=="small"&&l&&!e.disabled;return e.readOnly?jsx("span",{className:cn(f({isClearable:false,isDisabled:false,isReadOnly:e.readOnly,size:a,className:r})),children:e.value||"\xA0"}):jsxs("div",{className:"relative flex items-center",children:[jsx(Input,{onFocus:i=>{o&&t.current?.select(),e.onFocus?.(i);},ref:t,className:({isDisabled:i,isInvalid:n})=>cn(f({isClearable:l,isDisabled:i,isInvalid:n,isReadOnly:e.readOnly,size:a,className:r}))}),d&&jsx(Button,{className:"fg-default-dark icon-size-m hover:fg-interactive-hover absolute right-[5px] cursor-pointer",excludeFromTabOrder:true,onPress:()=>{e.onChange?.(y),t.current?.focus();},children:jsx(Icon,{children:jsx(CancelFill,{})})})]})};function M({className:r,isClearable:l=true,description:t,errorMessage:o,isDisabled:a,isInvalid:e,isReadOnly:d,label:i,placeholder:n,size:m="medium",...u}){let p=m==="small",b=t&&(!(p||e)||a),v=o&&e&&!a&&!d;return jsxs(TextField,{...u,isDisabled:a,isInvalid:e,isReadOnly:d,className:"flex flex-col gap-xs",children:[!p&&jsx(Label,{className:"empty:hidden",isDisabled:a,isOptional:!u.isRequired,children:i}),jsx(k,{className:r,isClearable:l,placeholder:n,size:m,...u}),b&&jsx(Text,{className:cn(["fg-default-dark text-body-xs empty:hidden",a&&"fg-disabled"]),slot:"description",children:t}),v&&jsx(Text,{className:"fg-serious text-body-xs empty:hidden",slot:"errorMessage",children:o})]})}export{M as TextField};//# sourceMappingURL=index.js.map
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/text-field/index.tsx"],"names":["C","className","ref","size","useContextProps","props","InputContext","useEffect","I","handleKeyPressed","shouldShowClearButton","isClearable","jsx","l","cn","c","jsxs","h","g","e","isDisabled","isInvalid","Button","P","N","O","TextField","description","label","isSmall","shouldShowError","errorMessage","AriaTextField","isReadOnly","placeholder","shouldShowDescription","AriaText","p"],"mappings":"uWAiCI,IAAA,CAAA,CAAAA,GA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SAAA,CAAA,sCAGT,CAAA,IAAA,CAAA,cAAA,CAAAN,QAKX,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA","file":"index.js","sourcesContent":["/*\n * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport 'client-only';\nimport {\n Input as AriaInput,\n type InputProps as AriaInputProps,\n Text as AriaText,\n TextField as AriaTextField,\n type TextFieldProps as AriaTextFieldProps,\n Button,\n InputContext,\n useContextProps,\n} from 'react-aria-components';\n\nimport { cn } from '@/lib/utils';\nimport { CancelFill } from '@accelint/icons';\nimport { type VariantProps, cva } from 'cva';\nimport { type ChangeEvent, type ForwardedRef, useEffect } from 'react';\nimport { Icon } from '../icon';\nimport { Label } from '../label';\n\nconst textFieldStyles = cva(\n [\n 'block w-full rounded-medium px-s py-xs font-display outline outline-interactive',\n ],\n {\n variants: {\n isDisabled: {\n true: 'text-disabled outline-interactive-disabled placeholder:text-disabled',\n false:\n 'text-default-light placeholder:text-default-dark hover:outline-interactive-hover focus:outline-highlight',\n },\n isInvalid: {\n true: 'outline-serious',\n },\n isReadOnly: {\n true: 'rounded-none p-0 outline-none',\n },\n size: {\n medium: 'text-body-s',\n small: 'text-body-xs',\n },\n isClearable: {\n true: '',\n false: '',\n },\n },\n compoundVariants: [\n {\n isDisabled: true,\n isInvalid: true,\n className: 'outline-interactive-disabled',\n },\n {\n isClearable: true,\n isDisabled: false,\n size: 'medium',\n className: 'pr-xl',\n },\n ],\n defaultVariants: {\n isClearable: false,\n size: 'medium',\n },\n },\n);\n\ninterface InputProps\n extends VariantProps<typeof textFieldStyles>,\n Omit<AriaInputProps, 'size'> {\n isClearable?: boolean;\n selectOnFocus?: boolean;\n ref?: ForwardedRef<HTMLInputElement>;\n}\n\nconst clearInputEvent = {\n target: { value: '' },\n} as ChangeEvent<HTMLInputElement>;\n\nconst Input = ({\n className,\n isClearable = true,\n ref = null,\n selectOnFocus = false,\n size = 'medium',\n ...props\n}: InputProps) => {\n [props, ref] = useContextProps(props, ref, InputContext);\n\n useEffect(() => {\n function handleKeyPressed(e: KeyboardEvent) {\n if (isClearable && e.key === 'Escape') {\n props.onChange?.(clearInputEvent);\n }\n }\n\n ref.current?.addEventListener('keydown', handleKeyPressed);\n\n return () => ref.current?.removeEventListener('keydown', handleKeyPressed);\n }, [isClearable, props.onChange, ref]);\n\n const shouldShowClearButton =\n !props.readOnly &&\n props.value &&\n size !== 'small' &&\n isClearable &&\n !props.disabled;\n\n if (props.readOnly) {\n return (\n <span\n className={cn(\n textFieldStyles({\n isClearable: false,\n isDisabled: false,\n isReadOnly: props.readOnly,\n size,\n className,\n }),\n )}\n >\n {props.value || '\\u00A0'}\n </span>\n );\n }\n\n return (\n <div className='relative flex items-center'>\n <AriaInput\n {...props}\n onFocus={(e) => {\n if (selectOnFocus) {\n ref.current?.select();\n }\n\n props.onFocus?.(e);\n }}\n ref={ref}\n className={({ isDisabled, isInvalid }) =>\n cn(\n textFieldStyles({\n isClearable,\n isDisabled,\n isInvalid,\n isReadOnly: props.readOnly,\n size,\n className,\n }),\n )\n }\n />\n {shouldShowClearButton && (\n <Button\n className='fg-default-dark icon-size-m hover:fg-interactive-hover absolute right-[5px] cursor-pointer'\n excludeFromTabOrder\n onPress={() => {\n props.onChange?.(clearInputEvent);\n ref.current?.focus();\n }}\n >\n <Icon>\n <CancelFill />\n </Icon>\n </Button>\n )}\n </div>\n );\n};\n\nexport interface TextFieldProps\n extends Omit<\n VariantProps<typeof textFieldStyles>,\n 'isDisabled' | 'isInvalid' | 'isReadOnly'\n >,\n Omit<AriaTextFieldProps, 'className'>,\n Omit<InputProps, keyof AriaTextFieldProps> {\n className?: string;\n isClearable?: boolean;\n description?: string;\n errorMessage?: string;\n label?: string;\n placeholder?: string;\n}\n\nexport function TextField({\n className,\n isClearable = true,\n description,\n errorMessage,\n isDisabled,\n isInvalid,\n isReadOnly,\n label,\n placeholder,\n size = 'medium',\n ...props\n}: TextFieldProps) {\n const isSmall = size === 'small';\n const shouldShowDescription =\n description && (!(isSmall || isInvalid) || isDisabled);\n const shouldShowError =\n errorMessage && isInvalid && !isDisabled && !isReadOnly;\n\n return (\n <AriaTextField\n {...(props as TextFieldProps)}\n isDisabled={isDisabled}\n isInvalid={isInvalid}\n isReadOnly={isReadOnly}\n className={'flex flex-col gap-xs'}\n >\n {!isSmall && (\n <Label\n className='empty:hidden'\n isDisabled={isDisabled}\n isOptional={!props.isRequired}\n >\n {label}\n </Label>\n )}\n <Input\n className={className}\n isClearable={isClearable}\n placeholder={placeholder}\n size={size}\n {...(props as InputProps)}\n />\n {shouldShowDescription && (\n <AriaText\n className={cn([\n 'fg-default-dark text-body-xs empty:hidden',\n isDisabled && 'fg-disabled',\n ])}\n slot='description'\n >\n {description}\n </AriaText>\n )}\n {shouldShowError && (\n <AriaText\n className='fg-serious text-body-xs empty:hidden'\n slot='errorMessage'\n >\n {errorMessage}\n </AriaText>\n )}\n </AriaTextField>\n );\n}\n"]}
1
+ {"version":3,"sources":["../../../src/components/text-field/index.tsx"],"names":["C","isClearable","ref","size","props","InputContext","useEffect","I","handleKeyPressed","e","shouldShowClearButton","jsx","s","c","jsxs","h","isDisabled","isInvalid","Button","P","N","O","TextField","description","label","isSmall","shouldShowError","errorMessage","AriaTextField","isReadOnly","className","placeholder","shouldShowDescription","AriaText","x"],"mappings":"uWAiCI,IACF,CAAA,CAAAA,GAAA,CAAA,CAAA,iFAEE,CAAA,CAAA,CAAU,QACI,CAAA,CAAA,UAEV,CAAA,CAAA,IAAA,CAAA,uLAGF,CAAA,CAAA,SAEA,CAAA,CAAA,IAAA,C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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 {\n Input as AriaInput,\n type InputProps as AriaInputProps,\n Text as AriaText,\n TextField as AriaTextField,\n type TextFieldProps as AriaTextFieldProps,\n Button,\n InputContext,\n useContextProps,\n} from 'react-aria-components';\n\nimport { cn } from '@/lib/utils';\nimport { CancelFill } from '@accelint/icons';\nimport { type VariantProps, cva } from 'cva';\nimport { type ChangeEvent, type ForwardedRef, useEffect } from 'react';\nimport { Icon } from '../icon';\nimport { Label } from '../label';\n\nconst textFieldStyles = cva(\n [\n 'block w-full rounded-medium px-s py-xs font-display outline outline-interactive',\n ],\n {\n variants: {\n isDisabled: {\n true: 'text-disabled outline-interactive-disabled placeholder:text-disabled',\n false:\n 'text-default-light placeholder:text-default-dark hover:outline-interactive-hover focus:outline-highlight',\n },\n isInvalid: {\n true: 'outline-serious focus:outline-serious',\n },\n isReadOnly: {\n true: 'rounded-none p-0 outline-none',\n },\n size: {\n medium: 'text-body-s',\n small: 'text-body-xs',\n },\n isClearable: {\n true: '',\n false: '',\n },\n },\n compoundVariants: [\n {\n isDisabled: true,\n isInvalid: true,\n className: 'outline-interactive-disabled',\n },\n {\n isClearable: true,\n isDisabled: false,\n size: 'medium',\n className: 'pr-xl',\n },\n ],\n defaultVariants: {\n isClearable: false,\n size: 'medium',\n },\n },\n);\n\ninterface InputProps\n extends VariantProps<typeof textFieldStyles>,\n Omit<AriaInputProps, 'size'> {\n isClearable?: boolean;\n selectOnFocus?: boolean;\n ref?: ForwardedRef<HTMLInputElement>;\n}\n\nconst clearInputEvent = {\n target: { value: '' },\n} as ChangeEvent<HTMLInputElement>;\n\nconst Input = ({\n className,\n isClearable = true,\n ref = null,\n selectOnFocus = false,\n size = 'medium',\n ...props\n}: InputProps) => {\n [props, ref] = useContextProps(props, ref, InputContext);\n\n useEffect(() => {\n function handleKeyPressed(e: KeyboardEvent) {\n if (isClearable && e.key === 'Escape') {\n props.onChange?.(clearInputEvent);\n }\n }\n\n ref.current?.addEventListener('keydown', handleKeyPressed);\n\n return () => ref.current?.removeEventListener('keydown', handleKeyPressed);\n }, [isClearable, props.onChange, ref]);\n\n const shouldShowClearButton =\n !props.readOnly &&\n props.value &&\n size !== 'small' &&\n isClearable &&\n !props.disabled;\n\n if (props.readOnly) {\n return (\n <span\n className={cn(\n textFieldStyles({\n isClearable: false,\n isDisabled: false,\n isReadOnly: props.readOnly,\n size,\n className,\n }),\n )}\n >\n {props.value || '\\u00A0'}\n </span>\n );\n }\n\n return (\n <div className='relative flex items-center'>\n <AriaInput\n onFocus={(e) => {\n if (selectOnFocus) {\n ref.current?.select();\n }\n\n props.onFocus?.(e);\n }}\n ref={ref}\n className={({ isDisabled, isInvalid }) =>\n cn(\n textFieldStyles({\n isClearable,\n isDisabled,\n isInvalid,\n isReadOnly: props.readOnly,\n size,\n className,\n }),\n )\n }\n />\n {shouldShowClearButton && (\n <Button\n className='fg-default-dark icon-size-m hover:fg-interactive-hover absolute right-[5px] cursor-pointer'\n excludeFromTabOrder\n onPress={() => {\n props.onChange?.(clearInputEvent);\n ref.current?.focus();\n }}\n >\n <Icon>\n <CancelFill />\n </Icon>\n </Button>\n )}\n </div>\n );\n};\n\nexport interface TextFieldProps\n extends Omit<\n VariantProps<typeof textFieldStyles>,\n 'isDisabled' | 'isInvalid' | 'isReadOnly'\n >,\n Omit<AriaTextFieldProps, 'className'>,\n Omit<InputProps, keyof AriaTextFieldProps> {\n className?: string;\n isClearable?: boolean;\n description?: string;\n errorMessage?: string;\n label?: string;\n placeholder?: string;\n}\n\nexport function TextField({\n className,\n isClearable = true,\n description,\n errorMessage,\n isDisabled,\n isInvalid,\n isReadOnly,\n label,\n placeholder,\n size = 'medium',\n ...props\n}: TextFieldProps) {\n const isSmall = size === 'small';\n const shouldShowDescription =\n description && (!(isSmall || isInvalid) || isDisabled);\n const shouldShowError =\n errorMessage && isInvalid && !isDisabled && !isReadOnly;\n\n return (\n <AriaTextField\n {...(props as TextFieldProps)}\n isDisabled={isDisabled}\n isInvalid={isInvalid}\n isReadOnly={isReadOnly}\n className={'flex flex-col gap-xs'}\n >\n {!isSmall && (\n <Label\n className='empty:hidden'\n isDisabled={isDisabled}\n isOptional={!props.isRequired}\n >\n {label}\n </Label>\n )}\n <Input\n className={className}\n isClearable={isClearable}\n placeholder={placeholder}\n size={size}\n {...(props as InputProps)}\n />\n {shouldShowDescription && (\n <AriaText\n className={cn([\n 'fg-default-dark text-body-xs empty:hidden',\n isDisabled && 'fg-disabled',\n ])}\n slot='description'\n >\n {description}\n </AriaText>\n )}\n {shouldShowError && (\n <AriaText\n className='fg-serious text-body-xs empty:hidden'\n slot='errorMessage'\n >\n {errorMessage}\n </AriaText>\n )}\n </AriaTextField>\n );\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as cva_types from 'cva/types';
3
3
  import { VariantProps } from 'cva';
4
- import React from 'react';
4
+ import React__default from 'react';
5
5
  import { TooltipTriggerComponentProps, Focusable, TooltipProps as TooltipProps$1 } from 'react-aria-components';
6
6
 
7
7
  declare const tooltipStyles: (props?: cva_types.ClassProp | undefined) => string;
@@ -20,7 +20,7 @@ declare namespace Tooltip {
20
20
  displayName: string;
21
21
  };
22
22
  }
23
- interface TooltipTriggerProps extends React.ComponentProps<typeof Focusable> {
23
+ interface TooltipTriggerProps extends React__default.ComponentProps<typeof Focusable> {
24
24
  }
25
25
  declare const TooltipTrigger: {
26
26
  ({ children, ...props }: TooltipTriggerProps): react_jsx_runtime.JSX.Element;
@@ -1,2 +1,2 @@
1
- import {containsExactChildren}from'./../../lib/react.js';import {cn}from'./../../lib/utils.js';import {cva}from'cva';import {TooltipTrigger,Focusable,Tooltip}from'react-aria-components';import {jsx}from'react/jsx-runtime';var n=cva("fg-default-light flex max-w-[160px] items-center justify-center break-words rounded-small bg-surface-overlay px-s py-xs text-center text-body-xs shadow-elevation-overlay");function e({children:o,closeDelay:t=0,delay:r=400,...p}){return containsExactChildren({children:o,componentName:e.displayName,restrictions:{[i.displayName]:1,[s.displayName]:1}}),jsx(TooltipTrigger,{closeDelay:t,delay:r,...p,children:o})}e.displayName="Tooltip";e.as=(o,t)=>cn(n({...o,className:t}));var i=({children:o,...t})=>jsx(Focusable,{...t,children:o});i.displayName="Tooltip.Trigger";var s=({children:o,className:t,offset:r=5,placement:p="bottom",...T})=>jsx(Tooltip,{...T,className:cn(n({className:t})),offset:r,placement:p,children:o});s.displayName="Tooltip.Body";e.Trigger=i;e.Body=s;export{e as Tooltip,s as TooltipBody,i as TooltipTrigger};//# sourceMappingURL=index.js.map
1
+ import {containsExactChildren}from'./../../lib/react.js';import {cn}from'./../../lib/utils.js';import {cva}from'cva';import {TooltipTrigger,Focusable,Tooltip}from'react-aria-components';import {jsx}from'react/jsx-runtime';var n=cva("fg-default-light flex max-w-[160px] items-center justify-center break-words rounded-small bg-surface-overlay px-s py-xs text-center text-body-xs shadow-elevation-overlay");function e({children:o,closeDelay:t=0,delay:r=400,...p}){return containsExactChildren({children:o,componentName:e.displayName,restrictions:{[i.displayName]:{min:1,max:1},[s.displayName]:{min:1,max:1}}}),jsx(TooltipTrigger,{closeDelay:t,delay:r,...p,children:o})}e.displayName="Tooltip";e.as=(o,t)=>cn(n({...o,className:t}));var i=({children:o,...t})=>jsx(Focusable,{...t,children:o});i.displayName="Tooltip.Trigger";var s=({children:o,className:t,offset:r=5,placement:p="bottom",...T})=>jsx(Tooltip,{...T,className:cn(n({className:t})),offset:r,placement:p,children:o});s.displayName="Tooltip.Body";e.Trigger=i;e.Body=s;export{e as Tooltip,s as TooltipBody,i as TooltipTrigger};//# sourceMappingURL=index.js.map
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/tooltip/index.tsx"],"names":["closeDelay","containsExactChildren","m","Tooltip","l","props","children","cn","tooltipStyles","a","Focusable","TooltipTrigger","offset","placement","c","className","TooltipBody"],"mappings":"mZA8BE,WACA,CAAA,CAAA,CAAA,QAAAA,EAAa,CACb,UACA,CAAA,CAAA,CAAA,CAAA,CAAA,KAEA,CAAAC,CAAAA,CAAAA,GAAAA,CAAAA,GACE,CAAA,CAAA,CAAA,CAAA,OACAC,qBAAeC,CAAAA,CAAAA,QAAAA,CAAAA,CAAAA,CAAAA,aACf,CAAA,CAAA,CAAA,WAAc,CACZ,YAA2B,CAAA,CAAA,CAAA,CAAG,YACN,EAAA,CAAA,CAAA,CAAA,CAAG,CAC7B,WAImB,EAAA,CAAA,CAAA,CAAA,CAAA,CAAAC,GAAA,CAAYJ,cAAY,CAAA,CAAA,UAAkBK,CAAAA,CAC1D,SAAAC,GAGP,CACAH,CAAQ,QAAA,CAAA,CAAA,CAAA,CAAA,CAAc,CACtBA,CAAAA,qBAGKI,CAAGC,EAAc,EAAE,CAAA,CAAGH,CAAO,CAAA,CAAA,GAAAI,EAAA,CAAA,CAAA,CAAA,CAAA,GAAW,CAAC,CAKvC,SAA0B,CAAAH,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,IAAAA,CAAU,GAAGD,QACpCK,CAAA,CAAW,CAAGL,GAAAA,CAAQ,CAAAC,GAAAA,GAAAA,CAAAA,SAAAA,CAAAA,CAAAA,IAEhCK,CAAe,QAAA,CAAA,CAAA,CAAA,EAAc,+BAK3B,CAAAL,IACA,CAAA,CAAA,CAAA,CAAA,SACA,CAAAM,CAAAA,SACA,CAAA,CAAA,CAAA,MAAA,CAAAC,EAAY,CACZ,CAAA,SAAA,CAAGR,CACL,CAAA,QAGO,IACD,CAAA,CAAA,GAAAD,GAAA,CAAAU,OAAA,CAAA,CAAA,GAAcN,CAAc,CAAA,SAAEO,CAAAA,EAAAA,CAAU,CAAC,CAAC,CAAA,SAClCH,CACR,WAEC,CAAA,CAAA,CAAA,SACH,CAAA,CAGJI,SAA0B,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,WAAA,CAAA,eAGlB,CAAOA,CAAAA,OAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,IAAAA,CAAAA,CAAAA","file":"index.js","sourcesContent":["import { containsExactChildren } from '@/lib/react';\nimport { cn } from '@/lib/utils';\nimport { type VariantProps, cva } from 'cva';\n/*\n * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport type React from 'react';\nimport {\n Focusable,\n Tooltip as RACTooltip,\n type TooltipProps as RACTooltipProps,\n TooltipTrigger as RACTooltipTrigger,\n type TooltipTriggerComponentProps,\n} from 'react-aria-components';\n\nconst tooltipStyles = cva(\n 'fg-default-light flex max-w-[160px] items-center justify-center break-words rounded-small bg-surface-overlay px-s py-xs text-center text-body-xs shadow-elevation-overlay',\n);\n\nexport interface TooltipProps extends TooltipTriggerComponentProps {}\n\nexport function Tooltip({\n children,\n closeDelay = 0,\n delay = 400,\n ...props\n}: TooltipProps) {\n containsExactChildren({\n children,\n componentName: Tooltip.displayName,\n restrictions: {\n [TooltipTrigger.displayName]: 1,\n [TooltipBody.displayName]: 1,\n },\n });\n\n return (\n <RACTooltipTrigger closeDelay={closeDelay} delay={delay} {...props}>\n {children}\n </RACTooltipTrigger>\n );\n}\nTooltip.displayName = 'Tooltip';\nTooltip.as = (\n props: VariantProps<typeof tooltipStyles>,\n className?: string | string[],\n) => cn(tooltipStyles({ ...props, className }));\n\nexport interface TooltipTriggerProps\n extends React.ComponentProps<typeof Focusable> {}\n\nexport const TooltipTrigger = ({ children, ...props }: TooltipTriggerProps) => {\n return <Focusable {...props}>{children}</Focusable>;\n};\nTooltipTrigger.displayName = 'Tooltip.Trigger';\n\nexport interface TooltipBodyProps extends RACTooltipProps {}\n\nexport const TooltipBody = ({\n children,\n className,\n offset = 5,\n placement = 'bottom',\n ...props\n}: TooltipBodyProps) => {\n return (\n <RACTooltip\n {...props}\n className={cn(tooltipStyles({ className }))}\n offset={offset}\n placement={placement}\n >\n {children}\n </RACTooltip>\n );\n};\nTooltipBody.displayName = 'Tooltip.Body';\n\nTooltip.Trigger = TooltipTrigger;\nTooltip.Body = TooltipBody;\n"]}
1
+ {"version":3,"sources":["../../../src/components/tooltip/index.tsx"],"names":["y","children","closeDelay","containsExactChildren","m","Tooltip","TooltipBody","jsx","RACTooltipTrigger","l","delay","props","tooltipStyles","TooltipTrigger","className","placement","a","offset"],"mappings":"8NAyBA,IAAA,CAAA,CAAAA,GAAA,CAAA,2KAKE,CAAAC,CAAAA,SACA,WAAAC,CAAa,CAAA,CAAA,UACL,CAAA,CAAA,CACR,OAEA,CAAA,CAAA,CAAA,GAAA,CAAAC,GACE,CAAA,CAAA,CAAA,CAAA,OACAC,qBAAeC,CAAAA,CAAAA,QAAAA,CAAAA,CAAAA,CAAAA,cACf,CAAc,CAAA,WAAA,CACZ,cAA2B,CAAG,CAAA,CAAE,WAAe,EAC/C,CAACC,GAAY,CAAA,CAAA,CAAA,GAAA,CAAA,CAAA,CAAA,CAAW,EAAG,CAAE,WAAe,EAEhD,CAAC,GAGCC,CAACC,EAAA,GAAkB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAAC,GAAA,CAAYP,eAAY,CAAOQ,UAAWC,CAC1D,CAAA,CAAA,KAAA,CAAA,CAAA,CAAAV,GAGP,CACAI,CAAQ,QAAA,CAAA,CAAA,CAAA,CAAA,CAAc,aACd,CAAA,SAGAO,CAAAA,CAAAA,CAAc,EAAKD,CAAAA,CAAAA,CAAAA,CAAO,aAAW,CAAC,CAKvC,SAA0B,CAAAV,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,IAAAA,CAAU,GAAGU,QACpC,CAAA,CAAW,CAAGA,GAAAA,CAAQ,mBAAAV,GAAS,CAEzCY,SAA6B,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,WAAA,CAAA,iBAK3B,CAAAZ,KACA,CAAAa,CAAAA,CAAAA,QAAAA,CACA,WACA,UAAAC,CAAY,CAAA,CAAA,CAAA,SACTJ,CAAAA,CACL,SAGO,CAAGA,GAAAA,CACJ,oBAAcC,CAAAA,CAAc,SAAE,CAAAI,EAAAF,CAAU,CAAC,CAAC,UAClCG,CACR,WAEC,CAAA,CAAA,CAAA,SACH,CAAA,CAGJX,SAA0B,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,WAAA,CAAA,eAGlB,CAAOA,CAAAA,OAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,IAAAA,CAAAA,CAAAA","file":"index.js","sourcesContent":["import { containsExactChildren } from '@/lib/react';\nimport { cn } from '@/lib/utils';\nimport { type VariantProps, cva } from 'cva';\n/*\n * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport type React from 'react';\nimport {\n Focusable,\n Tooltip as RACTooltip,\n type TooltipProps as RACTooltipProps,\n TooltipTrigger as RACTooltipTrigger,\n type TooltipTriggerComponentProps,\n} from 'react-aria-components';\n\nconst tooltipStyles = cva(\n 'fg-default-light flex max-w-[160px] items-center justify-center break-words rounded-small bg-surface-overlay px-s py-xs text-center text-body-xs shadow-elevation-overlay',\n);\n\nexport interface TooltipProps extends TooltipTriggerComponentProps {}\n\nexport function Tooltip({\n children,\n closeDelay = 0,\n delay = 400,\n ...props\n}: TooltipProps) {\n containsExactChildren({\n children,\n componentName: Tooltip.displayName,\n restrictions: {\n [TooltipTrigger.displayName]: { min: 1, max: 1 },\n [TooltipBody.displayName]: { min: 1, max: 1 },\n },\n });\n\n return (\n <RACTooltipTrigger closeDelay={closeDelay} delay={delay} {...props}>\n {children}\n </RACTooltipTrigger>\n );\n}\nTooltip.displayName = 'Tooltip';\nTooltip.as = (\n props: VariantProps<typeof tooltipStyles>,\n className?: string | string[],\n) => cn(tooltipStyles({ ...props, className }));\n\nexport interface TooltipTriggerProps\n extends React.ComponentProps<typeof Focusable> {}\n\nexport const TooltipTrigger = ({ children, ...props }: TooltipTriggerProps) => {\n return <Focusable {...props}>{children}</Focusable>;\n};\nTooltipTrigger.displayName = 'Tooltip.Trigger';\n\nexport interface TooltipBodyProps extends RACTooltipProps {}\n\nexport const TooltipBody = ({\n children,\n className,\n offset = 5,\n placement = 'bottom',\n ...props\n}: TooltipBodyProps) => {\n return (\n <RACTooltip\n {...props}\n className={cn(tooltipStyles({ className }))}\n offset={offset}\n placement={placement}\n >\n {children}\n </RACTooltip>\n );\n};\nTooltipBody.displayName = 'Tooltip.Body';\n\nTooltip.Trigger = TooltipTrigger;\nTooltip.Body = TooltipBody;\n"]}
package/dist/index.css CHANGED
@@ -363,3 +363,57 @@
363
363
  --icon-color: --value([ *]);
364
364
  --icon-color: --value(--color- *);
365
365
  }
366
+
367
+ @layer components {
368
+ .hide-cancel::-webkit-search-cancel-button {
369
+ display: none;
370
+ }
371
+
372
+ /**
373
+ * Rule line only applicable to the QueryBuilder component
374
+ */
375
+ .queryBuilder .rule-lines::before {
376
+ content: '';
377
+ width: 10px;
378
+ position: absolute;
379
+ top: 0;
380
+ bottom: 0;
381
+ left: 50%;
382
+ background-image:
383
+ repeating-linear-gradient(to bottom, var(--neutral-04), var(--neutral-04)),
384
+ repeating-linear-gradient(to right, var(--neutral-04), var(--neutral-04));
385
+ background-position: left -1px, center;
386
+ background-repeat: repeat-y, repeat-x;
387
+ background-size: 1px 4px, 4px 1px;
388
+ }
389
+
390
+ .queryBuilder .group > span.rule-lines:last-of-type::before {
391
+ content: '';
392
+ width: 10px;
393
+ position: absolute;
394
+ top: 0;
395
+ bottom: 50%;
396
+ left: 50%;
397
+ background-image:
398
+ repeating-linear-gradient(to bottom,var(--neutral-04), var(--neutral-04)),
399
+ repeating-linear-gradient(to right, var(--neutral-04), var(--neutral-04));
400
+ background-position: left -1px, bottom;
401
+ background-repeat: repeat-y, repeat-x;
402
+ background-size: 1px 4px, 4px 1px;
403
+ }
404
+
405
+ .queryBuilder .group > span.rule-lines:last-of-type:has(~ div.group)::before {
406
+ content: '';
407
+ width: 10px;
408
+ position: absolute;
409
+ top: 0;
410
+ bottom: 0;
411
+ left: 50%;
412
+ background-image:
413
+ repeating-linear-gradient(to bottom, var(--neutral-04), var(--neutral-04)),
414
+ repeating-linear-gradient(to right, var(--neutral-04), var(--neutral-04));
415
+ background-position: left -1px, center;
416
+ background-repeat: repeat-y, repeat-x;
417
+ background-size: 1px 4px, 4px 1px;
418
+ }
419
+ }
package/dist/index.d.ts CHANGED
@@ -7,13 +7,19 @@ export { Checkbox, CheckboxGroupProps, CheckboxProps } from './components/checkb
7
7
  export { Chip, ChipListProps, ChipProps, DeletableChip, SelectableChip } from './components/chip/index.js';
8
8
  export { ClassificationBadge, ClassificationBadgeProps } from './components/classification-badge/index.js';
9
9
  export { ClassificationBanner, ClassificationBannerProps } from './components/classification-banner/index.js';
10
+ export { ColorPicker, ColorPickerProps, useColorPickerState } from './components/color-picker/index.js';
10
11
  export { ComboBox, ComboBoxProps, ComboBoxSection } from './components/combobox/index.js';
12
+ export { DateField, DateFieldProps } from './components/date-field/index.js';
13
+ export { Dialog, DialogProps, DialogTitle } from './components/dialog/index.js';
11
14
  export { FloatingButton, FloatingButtonProps } from './components/floating-button/index.js';
12
15
  export { Icon, IconProps } from './components/icon/index.js';
13
16
  export { IconButton, IconButtonProps } from './components/icon-button/index.js';
14
17
  export { Label } from './components/label/index.js';
18
+ export { ClassNames, DefaultRQBProps, Field, QueryBuilder, QueryBuilderContextType, QueryBuilderProps, QueryBuilderValueEditors, RuleGroupType } from './components/query-builder/index.js';
15
19
  export { Radio, RadioGroupProps, RadioProps } from './components/radio/index.js';
20
+ export { SearchField, SearchFieldProps } from './components/search-field/index.js';
16
21
  export { Switch, SwitchProps } from './components/switch/index.js';
22
+ export { TabListProps, TabPanelProps, TabProps, Tabs, TabsProps } from './components/tabs/index.js';
17
23
  export { TextArea, TextAreaProps } from './components/text-area/index.js';
18
24
  export { TextField, TextFieldProps } from './components/text-field/index.js';
19
25
  export { ToggleIconButton, ToggleIconButtonProps } from './components/toggle-icon-button/index.js';
@@ -27,5 +33,13 @@ import 'react';
27
33
  import 'react-aria-components';
28
34
  import 'cva';
29
35
  import '@radix-ui/react-avatar';
36
+ import '@internationalized/date';
37
+ import './components/query-builder/value-selector.js';
38
+ import 'react-querybuilder';
39
+ import './components/query-builder/value-editor.js';
40
+ import './components/query-builder/group.js';
41
+ import './components/query-builder/rule.js';
42
+ import './components/query-builder/action-element.js';
43
+ import 'type-fest';
30
44
  import 'tailwind-merge';
31
45
  import 'clsx';
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export{Accordion}from'./components/accordion/index.js';export{Avatar}from'./components/avatar/index.js';export{Badge}from'./components/badge/index.js';export{Box}from'./components/box/index.js';export{Button}from'./components/button/index.js';export{Checkbox}from'./components/checkbox/index.js';export{Chip,DeletableChip,SelectableChip}from'./components/chip/index.js';export{ClassificationBadge}from'./components/classification-badge/index.js';export{ClassificationBanner}from'./components/classification-banner/index.js';export{ComboBox,ComboBoxSection}from'./components/combobox/index.js';export{FloatingButton}from'./components/floating-button/index.js';export{Icon}from'./components/icon/index.js';export{IconButton}from'./components/icon-button/index.js';export{Label}from'./components/label/index.js';export{Radio}from'./components/radio/index.js';export{Switch}from'./components/switch/index.js';export{TextArea}from'./components/text-area/index.js';export{TextField}from'./components/text-field/index.js';export{ToggleIconButton}from'./components/toggle-icon-button/index.js';export{Tooltip,TooltipBody,TooltipTrigger}from'./components/tooltip/index.js';export{containsExactChildren,expectsIconWrapper}from'./lib/react.js';export{cn,twMerge}from'./lib/utils.js';//# sourceMappingURL=index.js.map
1
+ export{Accordion}from'./components/accordion/index.js';export{Avatar}from'./components/avatar/index.js';export{Badge}from'./components/badge/index.js';export{Box}from'./components/box/index.js';export{Button}from'./components/button/index.js';export{Checkbox}from'./components/checkbox/index.js';export{Chip,DeletableChip,SelectableChip}from'./components/chip/index.js';export{ClassificationBadge}from'./components/classification-badge/index.js';export{ClassificationBanner}from'./components/classification-banner/index.js';export{ColorPicker,useColorPickerState}from'./components/color-picker/index.js';export{ComboBox,ComboBoxSection}from'./components/combobox/index.js';export{DateField}from'./components/date-field/index.js';export{Dialog,DialogTitle}from'./components/dialog/index.js';export{FloatingButton}from'./components/floating-button/index.js';export{Icon}from'./components/icon/index.js';export{IconButton}from'./components/icon-button/index.js';export{Label}from'./components/label/index.js';export{QueryBuilder}from'./components/query-builder/index.js';export{Radio}from'./components/radio/index.js';export{SearchField}from'./components/search-field/index.js';export{Switch}from'./components/switch/index.js';export{Tabs}from'./components/tabs/index.js';export{TextArea}from'./components/text-area/index.js';export{TextField}from'./components/text-field/index.js';export{ToggleIconButton}from'./components/toggle-icon-button/index.js';export{Tooltip,TooltipBody,TooltipTrigger}from'./components/tooltip/index.js';export{containsExactChildren,expectsIconWrapper}from'./lib/react.js';export{cn,twMerge}from'./lib/utils.js';//# sourceMappingURL=index.js.map
2
2
  //# sourceMappingURL=index.js.map
@@ -2,16 +2,28 @@ import { ReactNode } from 'react';
2
2
 
3
3
  type ContainsExactChildrenProps = {
4
4
  componentName: string;
5
- children: ReactNode | ReactNode[];
6
- restrictions: Record<string, number>;
5
+ children: ReactNode | ReactNode[] | ((values: any & {
6
+ defaultChildren: ReactNode | undefined;
7
+ }) => ReactNode);
8
+ restrictions: Record<string, {
9
+ min: number;
10
+ max?: number;
11
+ }>;
7
12
  };
13
+ /**
14
+ * Validates the intended composite component structure.
15
+ *
16
+ * @param children the children of the component
17
+ * @param componentName the displayName of the component
18
+ * @param restrictions the record of validation rules
19
+ */
8
20
  declare function containsExactChildren({ children, componentName, restrictions, }: ContainsExactChildrenProps): void;
9
21
  /**
10
22
  * I look for svgIcons exported from the @accelint/icons library
11
23
  * and ensure that they are wrapped in an Icon component in order
12
24
  * to get the classes and styles they need in context.
13
25
  *
14
- * Using isValidElement means we will filter out strings, boolean, etc
26
+ * Using isValidElement means we will filter out strings, boolean, etc.
15
27
  * that are valid nodes but not elements.
16
28
  *
17
29
  * @example
package/dist/lib/react.js CHANGED
@@ -1,2 +1,5 @@
1
- import {Children,isValidElement}from'react';function h({children:i,componentName:t,restrictions:o}){let n=Children.toArray(i);if(!n.every(isValidElement))throw new Error(`<${t}> received invalid children.`);let p=n.reduce((e,r)=>({...e,[r.type.displayName]:e[r.type.displayName]-1}),o),s=Object.entries(p).filter(([,e])=>e!==0);if(s.length!==0){let e=s.map(([r,d])=>`${d} of <${r}>`).join(", ");throw new Error(`<${t}> is missing the following: ${e}`)}}function m({children:i,componentName:t}){Children.toArray(i).map(n=>{if(isValidElement(n)&&n.type.name?.startsWith("Svg"))throw new Error(`${t} is using an icon without the required Icon wrapper`)});}export{h as containsExactChildren,m as expectsIconWrapper};//# sourceMappingURL=react.js.map
1
+ import {Children,isValidElement}from'react';var c=class extends Error{constructor(r){super(r),this.name="ComponentStructureError";}};function m({children:s,componentName:r,restrictions:l}){let i=Children.toArray(s);if(!i.every(isValidElement))throw new c(`<${r}> received invalid children.`);let u=i.reduce((n,o)=>{let e=o?.type?.displayName;return e&&(n[e]=(n[e]||0)+1),n},{}),a=[],d=[];for(let[n,{min:o,max:e}]of Object.entries(l)){let t=u[n]??0;t<o&&a.push(`${o-t} of <${n}>`),e!==void 0&&t>e&&d.push(`${t-e} of <${n}>`);}if(a.length||d.length){let n=(e,t)=>t.length?` ${e}:
2
+ ${t.join(", ")}
3
+ `:"",o=`Invalid <${r}> structure
4
+ ${n("Missing the following",a)}${n("Excess of the following",d)}`;throw new c(o.trim())}}function g({children:s,componentName:r}){Children.toArray(s).map(i=>{if(isValidElement(i)&&i.type.name?.startsWith("Svg"))throw new Error(`${r} is using an icon without the required Icon wrapper`)});}export{m as containsExactChildren,g as expectsIconWrapper};//# sourceMappingURL=react.js.map
2
5
  //# sourceMappingURL=react.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/lib/react.ts"],"names":["containsExactChildren","children","componentName","restrictions","childrenComponents","Children","isValidElement","restrictionResults","acc","child","missingComponents","value","restrictionString","key","expectsIconWrapper"],"mappings":"4CAqBO,SAASA,CAAAA,CAAsB,CACpC,QAAA,CAAAC,CACA,CAAA,aAAA,CAAAC,CACA,CAAA,YAAA,CAAAC,CACF,CAA+B,CAAA,CAC7B,IAAMC,CAAAA,CAAqBC,QAAS,CAAA,OAAA,CAAQJ,CAAQ,CAAA,CAEpD,GAAI,CAACG,CAAAA,CAAmB,KAAME,CAAAA,cAAc,CAC1C,CAAA,MAAM,IAAI,KAAA,CAAM,IAAIJ,CAAa,CAAA,4BAAA,CAA8B,CAGjE,CAAA,IAAMK,CAAqBH,CAAAA,CAAAA,CAAmB,MAC5C,CAAA,CAACI,EAAKC,CAAW,IAAA,CAEf,GAAGD,CAAAA,CACH,CAACC,CAAAA,CAAM,IAAK,CAAA,WAAW,EAAGD,CAAIC,CAAAA,CAAAA,CAAM,IAAK,CAAA,WAAW,CAAI,CAAA,CAC1D,CACAN,CAAAA,CAAAA,CACF,EAEMO,CAAoB,CAAA,MAAA,CAAO,OAAQH,CAAAA,CAAkB,CAAE,CAAA,MAAA,CAC3D,CAAC,EAAGI,CAAK,CAAA,GAAMA,CAAU,GAAA,CAC3B,CAEA,CAAA,GAAID,CAAkB,CAAA,MAAA,GAAW,EAAG,CAClC,IAAME,CAAoBF,CAAAA,CAAAA,CACvB,GAAI,CAAA,CAAC,CAACG,CAAAA,CAAKF,CAAK,CAAM,GAAA,CAAA,EAAGA,CAAK,CAAA,KAAA,EAAQE,CAAG,CAAA,CAAA,CAAG,CAC5C,CAAA,IAAA,CAAK,IAAI,CAEZ,CAAA,MAAM,IAAI,KAAA,CACR,CAAIX,CAAAA,EAAAA,CAAa,CAA+BU,4BAAAA,EAAAA,CAAiB,EACnE,CACF,CACF,CAoBO,SAASE,CAAmB,CAAA,CAAE,QAAAb,CAAAA,CAAAA,CAAU,cAAAC,CAAc,CAAA,CAAG,CACnCG,QAAAA,CAAS,OAAQJ,CAAAA,CAAQ,CAEjC,CAAA,GAAA,CAAKQ,GAAU,CAChC,GAAIH,cAAeG,CAAAA,CAAK,CAElBA,EAAAA,CAAAA,CAAM,IAAK,CAAA,IAAA,EAAM,WAAW,KAAK,CAAA,CACnC,MAAM,IAAI,MACR,CAAGP,EAAAA,CAAa,CAClB,mDAAA,CAAA,CAGN,CAAC,EACH","file":"react.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// @ts-nocheck\nimport { Children, type ReactNode, isValidElement } from 'react';\n\ntype ContainsExactChildrenProps = {\n componentName: string;\n children: ReactNode | ReactNode[];\n restrictions: Record<string, number>;\n};\n\nexport function containsExactChildren({\n children,\n componentName,\n restrictions,\n}: ContainsExactChildrenProps) {\n const childrenComponents = Children.toArray(children);\n\n if (!childrenComponents.every(isValidElement)) {\n throw new Error(`<${componentName}> received invalid children.`);\n }\n\n const restrictionResults = childrenComponents.reduce(\n (acc, child) => ({\n // biome-ignore lint/performance/noAccumulatingSpread: this is fine.\n ...acc,\n [child.type.displayName]: acc[child.type.displayName] - 1,\n }),\n restrictions,\n );\n\n const missingComponents = Object.entries(restrictionResults).filter(\n ([, value]) => value !== 0,\n );\n\n if (missingComponents.length !== 0) {\n const restrictionString = missingComponents\n .map(([key, value]) => `${value} of <${key}>`)\n .join(', ');\n\n throw new Error(\n `<${componentName}> is missing the following: ${restrictionString}`,\n );\n }\n}\n\n/**\n * I look for svgIcons exported from the @accelint/icons library\n * and ensure that they are wrapped in an Icon component in order\n * to get the classes and styles they need in context.\n *\n * Using isValidElement means we will filter out strings, boolean, etc\n * that are valid nodes but not elements.\n *\n * @example\n * expectsIconWrapper({\n * children,\n * componentName: Button.displayName,\n * });\n *\n *\n * @param children the children of the calling component\n * @param componentName the displayName of the calling component\n */\nexport function expectsIconWrapper({ children, componentName }) {\n const childrenComponents = Children.toArray(children);\n\n childrenComponents.map((child) => {\n if (isValidElement(child)) {\n // icons should never be a direct child of the parent\n if (child.type.name?.startsWith('Svg')) {\n throw new Error(\n `${componentName} is using an icon without the required Icon wrapper`,\n );\n }\n }\n });\n}\n"]}
1
+ {"version":3,"sources":["../../src/lib/react.ts"],"names":["ComponentStructureError","message","containsExactChildren","children","componentName","restrictions","childrenComponents","Children","isValidElement","accumulationResults","acc","child","name","missingComponentsArray","excessComponentsArray","key","min","max","found","formatList","label","items","errorMessage","expectsIconWrapper"],"mappings":"4CAeA,IAAMA,CAAAA,CAAN,cAAsC,KAAM,CAC1C,WAAA,CAAYC,CAAS,CAAA,CACnB,MAAMA,CAAO,CAAA,CACb,IAAK,CAAA,IAAA,CAAO,0BACd,CACF,CAuBO,CAAA,SAASC,EAAsB,CACpC,QAAA,CAAAC,CACA,CAAA,aAAA,CAAAC,EACA,YAAAC,CAAA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;AAAA,EAAUC,EAAAA,CAAAA,CAAM,IAAK,CAAA,IAAI,CAAC;AAAA,CAAO,CAAA,EAAA,CAEtDC,CACJ,CAAA,CAAA,SAAA,EAAYlB,CAAa,CAAA;AAAA,EACtBe,CAAAA,CAAW,uBAAyBN,CAAAA,CAAsB,CAAC,CAAA,EAC3DM,EAAW,yBAA2BL,CAAAA,CAAqB,CAAC,CAAA,CAAA,CAEjE,MAAM,IAAId,EAAwBsB,CAAa,CAAA,IAAA,EAAM,CACvD,CACF,CAoBO,SAASC,CAAmB,CAAA,CAAE,QAAApB,CAAAA,CAAAA,CAAU,aAAAC,CAAAA,CAAc,EAAG,CACnCG,QAAAA,CAAS,OAAQJ,CAAAA,CAAQ,CAEjC,CAAA,GAAA,CAAKQ,GAAU,CAChC,GAAIH,cAAeG,CAAAA,CAAK,CAElBA,EAAAA,CAAAA,CAAM,KAAK,IAAM,EAAA,UAAA,CAAW,KAAK,CAAA,CACnC,MAAM,IAAI,KACR,CAAA,CAAA,EAAGP,CAAa,CAAA,mDAAA,CAClB,CAGN,CAAC,EACH","file":"react.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// @ts-nocheck\nimport { Children, type ReactNode, isValidElement } from 'react';\n\nclass ComponentStructureError extends Error {\n constructor(message) {\n super(message);\n this.name = 'ComponentStructureError';\n }\n}\n\ntype ContainsExactChildrenProps = {\n componentName: string;\n // biome-ignore lint/suspicious/noExplicitAny: aria render props include a generic type\n children:\n | ReactNode\n | ReactNode[]\n | ((\n values: any & {\n defaultChildren: ReactNode | undefined;\n },\n ) => ReactNode);\n restrictions: Record<string, { min: number; max?: number }>;\n};\n\n/**\n * Validates the intended composite component structure.\n *\n * @param children the children of the component\n * @param componentName the displayName of the component\n * @param restrictions the record of validation rules\n */\nexport function containsExactChildren({\n children,\n componentName,\n restrictions,\n}: ContainsExactChildrenProps) {\n const childrenComponents = Children.toArray(children);\n\n if (!childrenComponents.every(isValidElement)) {\n throw new ComponentStructureError(\n `<${componentName}> received invalid children.`,\n );\n }\n\n const accumulationResults = childrenComponents.reduce((acc, child) => {\n const name = child?.type?.displayName;\n if (name) {\n acc[name] = (acc[name] || 0) + 1;\n }\n return acc;\n }, {});\n\n const missingComponentsArray: string[] = [];\n const excessComponentsArray: string[] = [];\n\n for (const [key, { min, max }] of Object.entries(restrictions)) {\n const found = accumulationResults[key] ?? 0;\n\n if (found < min) {\n missingComponentsArray.push(`${min - found} of <${key}>`);\n }\n\n if (max !== undefined && found > max) {\n excessComponentsArray.push(`${found - max} of <${key}>`);\n }\n }\n\n if (missingComponentsArray.length || excessComponentsArray.length) {\n const formatList = (label: string, items: string[]) =>\n items.length ? `\\t${label}:\\n\\t\\t${items.join(', ')}\\n` : '';\n\n const errorMessage =\n `Invalid <${componentName}> structure \\n` +\n `${formatList('Missing the following', missingComponentsArray)}` +\n `${formatList('Excess of the following', excessComponentsArray)}`;\n\n throw new ComponentStructureError(errorMessage.trim());\n }\n}\n\n/**\n * I look for svgIcons exported from the @accelint/icons library\n * and ensure that they are wrapped in an Icon component in order\n * to get the classes and styles they need in context.\n *\n * Using isValidElement means we will filter out strings, boolean, etc.\n * that are valid nodes but not elements.\n *\n * @example\n * expectsIconWrapper({\n * children,\n * componentName: Button.displayName,\n * });\n *\n *\n * @param children the children of the calling component\n * @param componentName the displayName of the calling component\n */\nexport function expectsIconWrapper({ children, componentName }) {\n const childrenComponents = Children.toArray(children);\n\n childrenComponents.map((child) => {\n if (isValidElement(child)) {\n // icons should never be a direct child of the parent\n if (child.type.name?.startsWith('Svg')) {\n throw new Error(\n `${componentName} is using an icon without the required Icon wrapper`,\n );\n }\n }\n });\n}\n"]}