@accelint/design-system 1.1.5 → 1.1.6

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 (82) hide show
  1. package/dist/components/button/button.css.d.ts +25 -24
  2. package/dist/components/button/index.d.ts +9 -40
  3. package/dist/components/button/index.js +23 -17
  4. package/dist/components/button/index.js.map +1 -1
  5. package/dist/components/button/types.d.ts +3 -2
  6. package/dist/components/checkbox/checkbox.css.d.ts +23 -23
  7. package/dist/components/chip/chip.css.d.ts +18 -18
  8. package/dist/components/collection/index.d.ts +2 -2
  9. package/dist/components/collection/index.js.map +1 -1
  10. package/dist/components/combo-box/combo-box.css.d.ts +9 -9
  11. package/dist/components/date-field/date-field.css.d.ts +17 -17
  12. package/dist/components/date-input/date-input.css.d.ts +25 -25
  13. package/dist/components/date-input/index.js +4 -1
  14. package/dist/components/date-input/index.js.map +1 -1
  15. package/dist/components/dialog/dialog.css.d.ts +16 -15
  16. package/dist/components/dialog/index.d.ts +1 -0
  17. package/dist/components/dialog/types.d.ts +1 -0
  18. package/dist/components/drawer/drawer.css.d.ts +17 -17
  19. package/dist/components/drawer/index.d.ts +1 -1
  20. package/dist/components/drawer/types.d.ts +1 -1
  21. package/dist/components/group/group.css.d.ts +7 -7
  22. package/dist/components/icon/icon.css.d.ts +9 -9
  23. package/dist/components/index.d.ts +2 -2
  24. package/dist/components/input/input.css.d.ts +20 -20
  25. package/dist/components/menu/index.d.ts +2 -2
  26. package/dist/components/menu/index.js +1 -1
  27. package/dist/components/menu/index.js.map +1 -1
  28. package/dist/components/menu/menu.css.d.ts +42 -42
  29. package/dist/components/merge-provider/index.js +15 -7
  30. package/dist/components/merge-provider/index.js.map +1 -1
  31. package/dist/components/number-field/index.d.ts +1 -1
  32. package/dist/components/number-field/number-field.css.d.ts +12 -12
  33. package/dist/components/number-field/types.d.ts +1 -1
  34. package/dist/components/options/index.js +1 -1
  35. package/dist/components/options/index.js.map +1 -1
  36. package/dist/components/options/options.css.d.ts +44 -44
  37. package/dist/components/picker/index.js.map +1 -1
  38. package/dist/components/picker/picker.css.d.ts +18 -18
  39. package/dist/components/popover/popover.css.d.ts +12 -12
  40. package/dist/components/query-builder/query-builder.css.d.ts +53 -53
  41. package/dist/components/radio/radio.css.d.ts +22 -22
  42. package/dist/components/search-field/search-field.css.d.ts +9 -9
  43. package/dist/components/select/select.css.d.ts +12 -12
  44. package/dist/components/slider/slider.css.d.ts +27 -27
  45. package/dist/components/switch/switch.css.d.ts +16 -16
  46. package/dist/components/tabs/tabs.css.d.ts +25 -25
  47. package/dist/components/text-field/index.d.ts +3 -128
  48. package/dist/components/text-field/index.js +3 -3
  49. package/dist/components/text-field/index.js.map +1 -1
  50. package/dist/components/text-field/text-field.css.d.ts +8 -8
  51. package/dist/components/textarea/textarea.css.d.ts +22 -22
  52. package/dist/components/time-field/time-field.css.d.ts +17 -17
  53. package/dist/components/tooltip/tooltip.css.d.ts +11 -11
  54. package/dist/components/tree/index.js +5 -2
  55. package/dist/components/tree/index.js.map +1 -1
  56. package/dist/components/tree/tree.css.d.ts +45 -45
  57. package/dist/hooks/index.d.ts +11 -11
  58. package/dist/hooks/use-collection-render/index.d.ts +1 -1
  59. package/dist/hooks/use-collection-render/index.js +2 -3
  60. package/dist/hooks/use-collection-render/index.js.map +1 -1
  61. package/dist/hooks/use-context-props/index.js.map +1 -1
  62. package/dist/hooks/use-defaults/index.d.ts +32 -80
  63. package/dist/hooks/use-defaults/index.js +1 -4
  64. package/dist/hooks/use-defaults/index.js.map +1 -1
  65. package/dist/hooks/use-defaults/types.d.ts +1 -1
  66. package/dist/hooks/use-theme/index.d.ts +1 -1
  67. package/dist/hooks/use-theme/types.d.ts +1 -1
  68. package/dist/hooks/use-tree/index.js +3 -2
  69. package/dist/hooks/use-tree/index.js.map +1 -1
  70. package/dist/hooks/use-tree/utils.js +6 -9
  71. package/dist/hooks/use-tree/utils.js.map +1 -1
  72. package/dist/hooks/use-update-effect/index.js.map +1 -1
  73. package/dist/index.css +32 -32
  74. package/dist/index.d.ts +5 -5
  75. package/dist/ladle/actions.js.map +1 -1
  76. package/dist/styles/theme.css.d.ts +200 -200
  77. package/dist/test/setup.js +646 -1387
  78. package/dist/test/setup.js.map +1 -1
  79. package/dist/utils/css/index.d.ts +1 -1
  80. package/dist/utils/props/index.d.ts +1 -2
  81. package/dist/utils/props/index.js.map +1 -1
  82. package/package.json +27 -27
@@ -31,7 +31,7 @@ declare function computeContract<T extends Contract>(contract: T, css: CSSStyleD
31
31
  * The contract provides a lookup for CSS vars
32
32
  * The values are expected to partially match the contract shapeForm
33
33
  */
34
- declare function reduceContract<T extends Contract, U>(contract: T, values: PartialMapLeafNodes<T, U>): Record<`var(--${string})`, U>;
34
+ declare function reduceContract<T extends Contract, U>(contract: T, values: PartialMapLeafNodes<T, U>): Record<`var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`, U>;
35
35
  /**
36
36
  * Reduce contract and values into Vanilla Extract friendly CSS vars
37
37
  */
@@ -1,7 +1,6 @@
1
1
  import { AsType } from '../../types/generic.js';
2
2
  import { ClassNames } from '../../types/props.js';
3
3
 
4
- type Props<T extends object> = AsType<T> | null | undefined;
5
4
  /**
6
5
  * Deep merges classNames objects by concatenating class values
7
6
  *
@@ -13,7 +12,7 @@ declare function mergeClassNames<T extends ClassNames>(...classNamesToMerge: (T
13
12
  /**
14
13
  * Extends the base margeProps functionality to also merge styles and handle class/style render props
15
14
  */
16
- declare function mergeProps<T extends object>(...propsToMerge: Props<T>[]): T;
15
+ declare function mergeProps<T extends object>(...propsToMerge: AsType<T>[]): T;
17
16
  /**
18
17
  * A helper for not having to reimplement the type check for a renderProp value being a function or not everywhere
19
18
  */
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/utils/props/index.ts"],"names":["mergePropsWithoutStyles"],"mappings":";;;;;;;AA+BA,SAAS,2BAAA,CACP,KAAA,EACA,WAAA,EAAA,GACG,YAAA,EACK;AACR,EAAA,IAAI,CAAC,aA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AA,OAAO,eACH,gBAAA,CAAiB,GAAG,YAAY,CAAA,GAChC,gBAAA,CAAiB,GAAG,YAAY,CAAA;AACtC;AAKO,SAAS,cAAgC,YAAA,EAA6B;AAC3E,EAAA,MAAM,SAAA,GAAY,mBAAA,CAAoB,GAAG,YAAY,CAAA;AACrD,EAAA,MAAM,UAAA,GAAa,oBAAA,CAAqB,GAAG,YAAY,CAAA;AACvD,EAAA,MAAM,KAAA,GAAQ,eAAA,CAAgB,GAAG,YAAY,CAAA;AAE7C,EAAA,OAAO;AAAA,IACL,GAAIA,YAAA,CAAwB,GAAG,YAAY,CAAA;AAAA,IAC3C,GAAI,SAAA,GAAY,EAAE,SAAA,KAAc,EAAC;AAAA,IACjC,GAAI,UAAA,GAAa,EAAE,UAAA,KAAe,EAAC;AAAA,IACnC,GAAI,KAAA,GAAQ,EAAE,KAAA,KAAU;AAAC,GAC3B;AACF;AAKO,SAAS,eAAA,CACd,OACA,MAAA,EACA;AACA,EAAA,IAAI,OAAO,UAAU,UAAA,EAAY;AAC/B,IAAA,OAAQ,MAAgC,MAAM,CAAA;AAAA,EAChD;AAEA,EAAA,OAAO,KAAA;AACT;AAWO,SAAS,eAAA,CACd,OACA,MAAA,EACA;AACA,EAAA,IAAI,OAAO,UAAU,UAAA,EAAY;AAC/B,IAAA,OAAO,CAAC,gBACL,KAAA,CAAoC;AAAA,MACnC,GAAG,WAAA;AAAA,MACH,GAAG;AAAA,KACK,CAAA;AAAA,EACd;AAEA,EAAA,OAAO,KAAA;AACT","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 { mergeProps as mergePropsWithoutStyles } from '@react-aria/utils';\nimport { clsx } from 'clsx';\nimport mergeWith from 'lodash/mergeWith';\nimport { composeRenderProps } from 'react-aria-components';\nimport { z } from 'zod';\nimport type { CSSProperties } from 'react';\nimport type { AsType } from '../../types/generic';\nimport type { ClassNames } from '../../types/props';\nimport type {\n ClassNameRenderProps,\n RenderProps,\n StylePropRenderProps,\n} from '../../types/react-aria';\n\ntype Props<T extends object> = AsType<T> | null | undefined;\n\n/**\n * Recursively process merging of all class name render props\n */\nfunction processClassNameRenderProps<T extends RenderProps<object>>(\n value: string,\n renderProps: ClassNameRenderProps<object>,\n ...propsToMerge: Props<T>[]\n): string {\n if (!propsToMerge.length) {\n return '';\n }\n\n const [props, ...rest] = propsToMerge;\n\n return clsx(\n value,\n composeRenderProps<string, ClassNameRenderProps<object>, string>(\n props?.className ?? '',\n (prev) => processClassNameRenderProps(prev, renderProps, ...rest),\n )(renderProps),\n );\n}\n\n/**\n * Compose class name render props to be processed and merged\n */\nfunction mergeRenderClassName<T extends RenderProps<object>>(\n ...propsToMerge: Props<T>[]\n) {\n return composeRenderProps<string, ClassNameRenderProps<object>, string>(\n (renderProps) => renderProps.defaultClassName ?? '',\n (prev, renderProps) =>\n processClassNameRenderProps(prev, renderProps, ...propsToMerge),\n );\n}\n\n/**\n * Merge static class names\n */\nfunction mergeStaticClassName<T extends RenderProps<object>>(\n ...propsToMerge: Props<T>[]\n) {\n return clsx(\n propsToMerge.reduce<string[]>((acc, props) => {\n if (typeof props?.className !== 'string') {\n return acc;\n }\n\n acc.push(props.className);\n\n return acc;\n }, []),\n );\n}\n\n/**\n * Determine if a static or composed merge of class names is necesary based on the presence of functions\n */\nfunction mergeClassNameProps<T extends RenderProps<object>>(\n ...propsToMerge: Props<T>[]\n) {\n const anyFunctions = propsToMerge.some(\n (props) => typeof props?.className === 'function',\n );\n\n const anyPrimitives = propsToMerge.some(\n (props) => typeof props?.className === 'string',\n );\n\n if (!(anyFunctions || anyPrimitives)) {\n return undefined;\n }\n\n return anyFunctions\n ? mergeRenderClassName(...propsToMerge)\n : mergeStaticClassName(...propsToMerge);\n}\n\nconst classNamesValidator: z.ZodType<ClassNames> = z.record(\n z.string(),\n z.union([z.string(), z.lazy(() => classNamesValidator)]),\n);\n\nconst propsValidator = z.object({\n classNames: classNamesValidator,\n});\n\n/**\n * Deep merges classNames objects within props\n */\nfunction mergeClassNamesProps<T extends object>(...propsToMerge: Props<T>[]) {\n return propsToMerge.reduce<ClassNames | undefined>((acc, props) => {\n const result = propsValidator.safeParse(props);\n\n if (result.success) {\n return acc\n ? mergeWith(acc, result.data.classNames, (accValue, srcValue) =>\n (!accValue || typeof accValue === 'string') &&\n (!srcValue || typeof srcValue === 'string')\n ? clsx(accValue, srcValue)\n : undefined,\n )\n : result.data.classNames;\n }\n\n return acc;\n }, undefined);\n}\n\n/**\n * Deep merges classNames objects by concatenating class values\n *\n * @example\n * mergeClassNames({ foo: 'foo' }, { foo: 'FOO', bar: 'bar' })\n * // returns { foo: 'foo FOO', bar: 'bar' }\n */\nexport function mergeClassNames<T extends ClassNames>(\n ...classNamesToMerge: (T | null | undefined)[]\n) {\n return mergeClassNamesProps(\n ...classNamesToMerge.map((classNames) => ({ classNames })),\n ) as T | undefined;\n}\n\n/**\n * Recursively process merging of all style render props\n */\nfunction processStyleRenderProps<T extends RenderProps<object>>(\n value: CSSProperties,\n renderProps: StylePropRenderProps<object>,\n ...propsToMerge: Props<T>[]\n): CSSProperties {\n if (!propsToMerge.length) {\n return {};\n }\n\n const [props, ...rest] = propsToMerge;\n\n return {\n ...value,\n ...composeRenderProps<\n CSSProperties,\n StylePropRenderProps<object>,\n CSSProperties\n >(props?.style ?? {}, (prev) =>\n processStyleRenderProps(prev, renderProps, ...rest),\n )(renderProps),\n };\n}\n\n/**\n * Compose style render props to be processed and merged\n */\nfunction mergeRenderStyle<T extends RenderProps<object>>(\n ...propsToMerge: Props<T>[]\n) {\n return composeRenderProps<\n CSSProperties,\n StylePropRenderProps<object>,\n CSSProperties\n >(\n (renderProps) => renderProps.defaultStyle ?? {},\n (prev, renderProps) =>\n processStyleRenderProps(prev, renderProps, ...propsToMerge),\n );\n}\n\n/**\n * Merge static styles\n */\nfunction mergeStaticStyle<T extends RenderProps<object>>(\n ...propsToMerge: Props<T>[]\n) {\n return propsToMerge.reduce<CSSProperties>((acc, props) => {\n if (!props?.style) {\n return acc;\n }\n\n return Object.assign({}, acc, props.style);\n }, {});\n}\n\n/**\n * Determine if a static or composed merge of styles is necesary based on the presence of functions\n */\nfunction mergeStyleProps<T extends RenderProps<object>>(\n ...propsToMerge: Props<T>[]\n) {\n const anyFunctions = propsToMerge.some(\n (props) => typeof props?.style === 'function',\n );\n\n const anyObjects = propsToMerge.some(\n (props) => typeof props?.style === 'object' && props.style != null,\n );\n\n if (!(anyFunctions || anyObjects)) {\n return undefined;\n }\n\n return anyFunctions\n ? mergeRenderStyle(...propsToMerge)\n : mergeStaticStyle(...propsToMerge);\n}\n\n/**\n * Extends the base margeProps functionality to also merge styles and handle class/style render props\n */\nexport function mergeProps<T extends object>(...propsToMerge: Props<T>[]): T {\n const className = mergeClassNameProps(...propsToMerge);\n const classNames = mergeClassNamesProps(...propsToMerge);\n const style = mergeStyleProps(...propsToMerge);\n\n return {\n ...(mergePropsWithoutStyles(...propsToMerge) as T),\n ...(className ? { className } : {}),\n ...(classNames ? { classNames } : {}),\n ...(style ? { style } : {}),\n };\n}\n\n/**\n * A helper for not having to reimplement the type check for a renderProp value being a function or not everywhere\n */\nexport function callRenderProps<T extends object, R>(\n value: R | ((renderProps: T) => R),\n values: T,\n) {\n if (typeof value === 'function') {\n return (value as (renderProps: T) => R)(values);\n }\n\n return value;\n}\n\n/**\n * A helper function to pair with React Aria's render props. Typically\n * implemented with children, className and styles\n *\n * Allows for the injection of additional renderProps that a component\n * from React Aria may not already provide\n *\n * If the value isn't a renderProp function, then it is passed through unchanged\n */\nexport function wrapRenderProps<T extends object, U extends object, R>(\n value: R | ((renderProps: T & U) => R),\n inject?: U,\n) {\n if (typeof value === 'function') {\n return (renderProps: T) =>\n (value as (renderProps: T & U) => R)({\n ...renderProps,\n ...inject,\n } as T & U);\n }\n\n return value;\n}\n"]}
1
+ {"version":3,"sources":["../../../src/utils/props/index.ts"],"names":["mergePropsWithoutStyles"],"mappings":";;;;;;;AA+BA,SAAS,2BAAA,CACP,KAAA,EACA,WAAA,EAAA,GACG,YAAA,EACK;AACR,EAAA,IAAI,CAAC,aAAa,MAAA,EAAQ;AACxB,IAAA,OAAO,EAAA;AAAA,EACT;AAEA,EAAA,MAAM,CAAC,KAAA,EAAO,GAAG,IAAI,CAAA,GAAI,YAAA;AAEzB,EAAA,OAAO,IAAA;AAAA,IACL,KAAA;AAAA,IACA,kBAAA;AAAA,MACE,OAAO,SAAA,IAAa,EAAA;AAAA,MACpB,CAAC,IAAA,KAAS,2BAAA,CAA4B,IAAA,EAAM,WAAA,EAAa,GAAG,IAAI;AAAA,MAChE,WAAW;AAAA,GACf;AACF;AAKA,SAAS,wBACJ,YAAA,EACH;AACA,EAAA,OAAO,kBAAA;AAAA,IACL,CAAC,WAAA,KAAgB,WAAA,CAAY,gBAAA,IAAoB,EAAA;AAAA,IACjD,CAAC,IAAA,EAAM,WAAA,KACL,4BAA4B,IAAA,EAAM,WAAA,EAAa,GAAG,YAAY;AAAA,GAClE;AACF;AAKA,SAAS,wBACJ,YAAA,EACH;AACA,EAAA,OAAO,IAAA;AAAA,IACL,YAAA,CAAa,MAAA,CAAiB,CAAC,GAAA,EAAK,KAAA,KAAU;AAC5C,MAAA,IAAI,OAAO,KAAA,EAAO,SAAA,KAAc,QAAA,EAAU;AACxC,QAAA,OAAO,GAAA;AAAA,MACT;AAEA,MAAA,GAAA,CAAI,IAAA,CAAK,MAAM,SAAS,CAAA;AAExB,MAAA,OAAO,GAAA;AAAA,IACT,CAAA,EAAG,EAAE;AAAA,GACP;AACF;AAKA,SAAS,uBACJ,YAAA,EAC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AEA,EAAA,OAAO,KAAA;AACT","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 { mergeProps as mergePropsWithoutStyles } from '@react-aria/utils';\nimport { clsx } from 'clsx';\nimport mergeWith from 'lodash/mergeWith';\nimport { composeRenderProps } from 'react-aria-components';\nimport { z } from 'zod';\nimport type { CSSProperties } from 'react';\nimport type { AsType } from '../../types/generic';\nimport type { ClassNames } from '../../types/props';\nimport type {\n ClassNameRenderProps,\n RenderProps,\n StylePropRenderProps,\n} from '../../types/react-aria';\n\ntype Props<T extends object> = AsType<T> | null | undefined;\n\n/**\n * Recursively process merging of all class name render props\n */\nfunction processClassNameRenderProps<T extends RenderProps<object>>(\n value: string,\n renderProps: ClassNameRenderProps<object>,\n ...propsToMerge: Props<T>[]\n): string {\n if (!propsToMerge.length) {\n return '';\n }\n\n const [props, ...rest] = propsToMerge;\n\n return clsx(\n value,\n composeRenderProps<string, ClassNameRenderProps<object>, string>(\n props?.className ?? '',\n (prev) => processClassNameRenderProps(prev, renderProps, ...rest),\n )(renderProps),\n );\n}\n\n/**\n * Compose class name render props to be processed and merged\n */\nfunction mergeRenderClassName<T extends RenderProps<object>>(\n ...propsToMerge: Props<T>[]\n) {\n return composeRenderProps<string, ClassNameRenderProps<object>, string>(\n (renderProps) => renderProps.defaultClassName ?? '',\n (prev, renderProps) =>\n processClassNameRenderProps(prev, renderProps, ...propsToMerge),\n );\n}\n\n/**\n * Merge static class names\n */\nfunction mergeStaticClassName<T extends RenderProps<object>>(\n ...propsToMerge: Props<T>[]\n) {\n return clsx(\n propsToMerge.reduce<string[]>((acc, props) => {\n if (typeof props?.className !== 'string') {\n return acc;\n }\n\n acc.push(props.className);\n\n return acc;\n }, []),\n );\n}\n\n/**\n * Determine if a static or composed merge of class names is necesary based on the presence of functions\n */\nfunction mergeClassNameProps<T extends RenderProps<object>>(\n ...propsToMerge: Props<T>[]\n) {\n const anyFunctions = propsToMerge.some(\n (props) => typeof props?.className === 'function',\n );\n\n const anyPrimitives = propsToMerge.some(\n (props) => typeof props?.className === 'string',\n );\n\n if (!(anyFunctions || anyPrimitives)) {\n return undefined;\n }\n\n return anyFunctions\n ? mergeRenderClassName(...propsToMerge)\n : mergeStaticClassName(...propsToMerge);\n}\n\nconst classNamesValidator: z.ZodType<ClassNames> = z.record(\n z.string(),\n z.union([z.string(), z.lazy(() => classNamesValidator)]),\n);\n\nconst propsValidator = z.object({\n classNames: classNamesValidator,\n});\n\n/**\n * Deep merges classNames objects within props\n */\nfunction mergeClassNamesProps<T extends object>(...propsToMerge: Props<T>[]) {\n return propsToMerge.reduce<ClassNames | undefined>((acc, props) => {\n const result = propsValidator.safeParse(props);\n\n if (result.success) {\n return acc\n ? mergeWith(acc, result.data.classNames, (accValue, srcValue) =>\n (!accValue || typeof accValue === 'string') &&\n (!srcValue || typeof srcValue === 'string')\n ? clsx(accValue, srcValue)\n : undefined,\n )\n : result.data.classNames;\n }\n\n return acc;\n }, undefined);\n}\n\n/**\n * Deep merges classNames objects by concatenating class values\n *\n * @example\n * mergeClassNames({ foo: 'foo' }, { foo: 'FOO', bar: 'bar' })\n * // returns { foo: 'foo FOO', bar: 'bar' }\n */\nexport function mergeClassNames<T extends ClassNames>(\n ...classNamesToMerge: (T | null | undefined)[]\n) {\n return mergeClassNamesProps(\n ...classNamesToMerge.map((classNames) => ({ classNames })),\n ) as T | undefined;\n}\n\n/**\n * Recursively process merging of all style render props\n */\nfunction processStyleRenderProps<T extends RenderProps<object>>(\n value: CSSProperties,\n renderProps: StylePropRenderProps<object>,\n ...propsToMerge: Props<T>[]\n): CSSProperties {\n if (!propsToMerge.length) {\n return {};\n }\n\n const [props, ...rest] = propsToMerge;\n\n return {\n ...value,\n ...composeRenderProps<\n CSSProperties,\n StylePropRenderProps<object>,\n CSSProperties\n >(props?.style ?? {}, (prev) =>\n processStyleRenderProps(prev, renderProps, ...rest),\n )(renderProps),\n };\n}\n\n/**\n * Compose style render props to be processed and merged\n */\nfunction mergeRenderStyle<T extends RenderProps<object>>(\n ...propsToMerge: Props<T>[]\n) {\n return composeRenderProps<\n CSSProperties,\n StylePropRenderProps<object>,\n CSSProperties\n >(\n (renderProps) => renderProps.defaultStyle ?? {},\n (prev, renderProps) =>\n processStyleRenderProps(prev, renderProps, ...propsToMerge),\n );\n}\n\n/**\n * Merge static styles\n */\nfunction mergeStaticStyle<T extends RenderProps<object>>(\n ...propsToMerge: Props<T>[]\n) {\n return propsToMerge.reduce<CSSProperties>((acc, props) => {\n if (!props?.style) {\n return acc;\n }\n\n return Object.assign({}, acc, props.style);\n }, {});\n}\n\n/**\n * Determine if a static or composed merge of styles is necesary based on the presence of functions\n */\nfunction mergeStyleProps<T extends RenderProps<object>>(\n ...propsToMerge: Props<T>[]\n) {\n const anyFunctions = propsToMerge.some(\n (props) => typeof props?.style === 'function',\n );\n\n const anyObjects = propsToMerge.some(\n (props) => typeof props?.style === 'object' && props.style != null,\n );\n\n if (!(anyFunctions || anyObjects)) {\n return undefined;\n }\n\n return anyFunctions\n ? mergeRenderStyle(...propsToMerge)\n : mergeStaticStyle(...propsToMerge);\n}\n\n/**\n * Extends the base margeProps functionality to also merge styles and handle class/style render props\n */\nexport function mergeProps<T extends object>(...propsToMerge: AsType<T>[]): T {\n const className = mergeClassNameProps(...propsToMerge);\n const classNames = mergeClassNamesProps(...propsToMerge);\n const style = mergeStyleProps(...propsToMerge);\n\n return {\n ...(mergePropsWithoutStyles(...propsToMerge) as T),\n ...(className ? { className } : {}),\n ...(classNames ? { classNames } : {}),\n ...(style ? { style } : {}),\n };\n}\n\n/**\n * A helper for not having to reimplement the type check for a renderProp value being a function or not everywhere\n */\nexport function callRenderProps<T extends object, R>(\n value: R | ((renderProps: T) => R),\n values: T,\n) {\n if (typeof value === 'function') {\n return (value as (renderProps: T) => R)(values);\n }\n\n return value;\n}\n\n/**\n * A helper function to pair with React Aria's render props. Typically\n * implemented with children, className and styles\n *\n * Allows for the injection of additional renderProps that a component\n * from React Aria may not already provide\n *\n * If the value isn't a renderProp function, then it is passed through unchanged\n */\nexport function wrapRenderProps<T extends object, U extends object, R>(\n value: R | ((renderProps: T & U) => R),\n inject?: U,\n) {\n if (typeof value === 'function') {\n return (renderProps: T) =>\n (value as (renderProps: T & U) => R)({\n ...renderProps,\n ...inject,\n } as T & U);\n }\n\n return value;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@accelint/design-system",
3
- "version": "1.1.5",
3
+ "version": "1.1.6",
4
4
  "private": false,
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -42,22 +42,22 @@
42
42
  }
43
43
  },
44
44
  "peerDependencies": {
45
- "@internationalized/date": "^3.8.0",
46
- "@react-aria/collections": "^3.0.0",
47
- "@react-aria/datepicker": "^3.14.5",
48
- "@react-aria/dnd": "^3.10.1",
49
- "@react-aria/focus": "^3.20.5",
50
- "@react-aria/i18n": "^3.12.10",
45
+ "@internationalized/date": "^3.9.0",
46
+ "@react-aria/collections": "~3.0.0",
47
+ "@react-aria/datepicker": "~3.14.5",
48
+ "@react-aria/dnd": "~3.11.2",
49
+ "@react-aria/focus": "~3.20.5",
50
+ "@react-aria/i18n": "~3.12.10",
51
51
  "@react-aria/interactions": "^3.25.3",
52
- "@react-aria/menu": "^3.19.3",
53
- "@react-aria/overlays": "^3.27.3",
54
- "@react-aria/ssr": "^3.9.6",
55
- "@react-aria/utils": "^3.29.1",
56
- "@react-stately/data": "^3.13.1",
57
- "@react-stately/datepicker": "^3.14.2",
58
- "@react-stately/overlays": "^3.6.17",
59
- "@react-stately/utils": "^3.10.7",
60
- "@react-types/shared": "^3.31.0",
52
+ "@react-aria/menu": "~3.19.3",
53
+ "@react-aria/overlays": "~3.29.1",
54
+ "@react-aria/ssr": "~3.9.10",
55
+ "@react-aria/utils": "~3.29.1",
56
+ "@react-stately/data": "~3.13.2",
57
+ "@react-stately/datepicker": "~3.14.2",
58
+ "@react-stately/overlays": "~3.6.17",
59
+ "@react-stately/utils": "~3.10.8",
60
+ "@react-types/shared": "~3.32.0",
61
61
  "react": "19.0.1",
62
62
  "react-aria-components": "1.12.1",
63
63
  "react-dom": "19.0.1",
@@ -66,7 +66,7 @@
66
66
  "devDependencies": {
67
67
  "@accelint/biome-config": "1.0.2",
68
68
  "@accelint/typescript-config": "0.1.4",
69
- "@accelint/vitest-config": "0.1.3",
69
+ "@accelint/vitest-config": "0.1.6",
70
70
  "@fontsource-variable/roboto-flex": "^5.2.8",
71
71
  "@fontsource-variable/roboto-mono": "^5.2.8",
72
72
  "@ladle/react": "^5.1.1",
@@ -86,12 +86,12 @@
86
86
  "postcss": "8.4.47",
87
87
  "react-querybuilder": "^8.10.0",
88
88
  "tsup": "8.5.0",
89
- "vite": "^6.4.1",
90
- "vitest": "2.1.9"
89
+ "vite": "~7.3.0",
90
+ "vitest": "4.0.16"
91
91
  },
92
92
  "dependencies": {
93
- "@accelint/converters": "0.3.4",
94
- "@accelint/core": "0.5.0",
93
+ "@accelint/converters": "0.3.6",
94
+ "@accelint/core": "0.5.2",
95
95
  "@vanilla-extract/css": "1.16.0",
96
96
  "@vanilla-extract/dynamic": "2.1.2",
97
97
  "clsx": "2.1.1",
@@ -107,13 +107,13 @@
107
107
  },
108
108
  "sideEffects": false,
109
109
  "scripts": {
110
- "bench": "pnpm vitest bench --run --dir src",
110
+ "bench": "vitest bench --run --dir src",
111
111
  "build": "rm -rf dist && pnpm tsup --config=tsup.css.config.ts && rm -f dist/index.js && pnpm tsup",
112
112
  "dev": "pnpm tsc --watch",
113
- "index": "pnpm zx ../scripts/indexer.mjs design-system --barrels",
114
- "lint": "pnpm biome lint",
115
- "lint:fix": "pnpm biome lint --write",
116
- "preview": "pnpm ladle serve",
117
- "test": "pnpm vitest --dir=src"
113
+ "index": "zx ../scripts/indexer.mjs design-system --barrels && biome check src/index.ts --write",
114
+ "lint": "biome check .",
115
+ "lint:fix": "biome check . --write",
116
+ "preview": "ladle serve",
117
+ "test": "vitest --dir=src"
118
118
  }
119
119
  }