@accelint/design-system 1.1.5 → 1.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/button/button.css.d.ts +1 -0
- package/dist/components/button/index.d.ts +9 -40
- package/dist/components/button/index.js +23 -17
- package/dist/components/button/index.js.map +1 -1
- package/dist/components/button/types.d.ts +3 -2
- package/dist/components/collection/index.d.ts +2 -2
- package/dist/components/collection/index.js.map +1 -1
- package/dist/components/date-input/index.js +4 -1
- package/dist/components/date-input/index.js.map +1 -1
- package/dist/components/dialog/dialog.css.d.ts +1 -0
- package/dist/components/dialog/index.d.ts +1 -0
- package/dist/components/dialog/types.d.ts +1 -0
- package/dist/components/drawer/drawer.css.d.ts +1 -1
- package/dist/components/drawer/index.d.ts +1 -1
- package/dist/components/drawer/types.d.ts +1 -1
- package/dist/components/index.d.ts +2 -2
- package/dist/components/menu/index.d.ts +2 -2
- package/dist/components/menu/index.js +1 -1
- package/dist/components/menu/index.js.map +1 -1
- package/dist/components/merge-provider/index.js +15 -7
- package/dist/components/merge-provider/index.js.map +1 -1
- package/dist/components/number-field/index.d.ts +1 -1
- package/dist/components/number-field/number-field.css.d.ts +1 -1
- package/dist/components/number-field/types.d.ts +1 -1
- package/dist/components/options/index.js +1 -1
- package/dist/components/options/index.js.map +1 -1
- package/dist/components/picker/index.js.map +1 -1
- package/dist/components/text-field/index.d.ts +3 -128
- package/dist/components/text-field/index.js +3 -3
- package/dist/components/text-field/index.js.map +1 -1
- package/dist/components/tree/index.js +5 -2
- package/dist/components/tree/index.js.map +1 -1
- package/dist/hooks/index.d.ts +11 -11
- package/dist/hooks/use-collection-render/index.d.ts +1 -1
- package/dist/hooks/use-collection-render/index.js +2 -3
- package/dist/hooks/use-collection-render/index.js.map +1 -1
- package/dist/hooks/use-context-props/index.js.map +1 -1
- package/dist/hooks/use-defaults/index.d.ts +32 -80
- package/dist/hooks/use-defaults/index.js +1 -4
- package/dist/hooks/use-defaults/index.js.map +1 -1
- package/dist/hooks/use-defaults/types.d.ts +1 -1
- package/dist/hooks/use-theme/index.d.ts +1 -1
- package/dist/hooks/use-theme/types.d.ts +1 -1
- package/dist/hooks/use-tree/index.js +3 -2
- package/dist/hooks/use-tree/index.js.map +1 -1
- package/dist/hooks/use-tree/utils.js +6 -9
- package/dist/hooks/use-tree/utils.js.map +1 -1
- package/dist/hooks/use-update-effect/index.js.map +1 -1
- package/dist/index.css +32 -32
- package/dist/index.d.ts +5 -5
- package/dist/ladle/actions.js.map +1 -1
- package/dist/test/setup.js +634 -1254
- package/dist/test/setup.js.map +1 -1
- package/dist/utils/props/index.d.ts +1 -2
- package/dist/utils/props/index.js.map +1 -1
- package/package.json +39 -39
|
@@ -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:
|
|
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,aAAa,MAAA,EAAQ;AACxB,IAAA,OAAO,EAAA;AAAA,EACT;AAEA,EA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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,EACH;AACA,EAAA,MAAM,eAAe,YAAA,CAAa,IAAA;AAAA,IACh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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.
|
|
3
|
+
"version": "1.1.7",
|
|
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.
|
|
46
|
-
"@react-aria/collections": "
|
|
47
|
-
"@react-aria/datepicker": "
|
|
48
|
-
"@react-aria/dnd": "
|
|
49
|
-
"@react-aria/focus": "
|
|
50
|
-
"@react-aria/i18n": "
|
|
51
|
-
"@react-aria/interactions": "
|
|
52
|
-
"@react-aria/menu": "
|
|
53
|
-
"@react-aria/overlays": "
|
|
54
|
-
"@react-aria/ssr": "
|
|
55
|
-
"@react-aria/utils": "
|
|
56
|
-
"@react-stately/data": "
|
|
57
|
-
"@react-stately/datepicker": "
|
|
58
|
-
"@react-stately/overlays": "
|
|
59
|
-
"@react-stately/utils": "
|
|
60
|
-
"@react-types/shared": "
|
|
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
|
+
"@react-aria/interactions": "~3.26.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,39 +66,39 @@
|
|
|
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.
|
|
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",
|
|
73
|
-
"@testing-library/dom": "10.4.
|
|
74
|
-
"@testing-library/jest-dom": "6.
|
|
75
|
-
"@testing-library/react": "16.3.
|
|
73
|
+
"@testing-library/dom": "10.4.1",
|
|
74
|
+
"@testing-library/jest-dom": "6.9.1",
|
|
75
|
+
"@testing-library/react": "16.3.1",
|
|
76
76
|
"@testing-library/user-event": "14.6.1",
|
|
77
77
|
"@types/lodash": "4.17.10",
|
|
78
78
|
"@types/react": "19.0.0",
|
|
79
79
|
"@types/react-dom": "19.0.0",
|
|
80
|
-
"@vanilla-extract/esbuild-plugin": "^2.3.
|
|
81
|
-
"@vanilla-extract/vite-plugin": "^5.1.
|
|
82
|
-
"autoprefixer": "10.4.
|
|
83
|
-
"esbuild-plugin-file-path-extensions": "2.1.
|
|
80
|
+
"@vanilla-extract/esbuild-plugin": "^2.3.21",
|
|
81
|
+
"@vanilla-extract/vite-plugin": "^5.1.4",
|
|
82
|
+
"autoprefixer": "10.4.23",
|
|
83
|
+
"esbuild-plugin-file-path-extensions": "2.1.4",
|
|
84
84
|
"esbuild-plugin-lodash": "1.2.0",
|
|
85
85
|
"jsdom": "25.0.1",
|
|
86
86
|
"postcss": "8.4.47",
|
|
87
87
|
"react-querybuilder": "^8.10.0",
|
|
88
|
-
"tsup": "8.5.
|
|
89
|
-
"vite": "
|
|
90
|
-
"vitest": "
|
|
88
|
+
"tsup": "8.5.1",
|
|
89
|
+
"vite": "~7.3.1",
|
|
90
|
+
"vitest": "4.0.16"
|
|
91
91
|
},
|
|
92
92
|
"dependencies": {
|
|
93
|
-
"@accelint/converters": "0.3.
|
|
94
|
-
"@accelint/core": "0.5.
|
|
95
|
-
"@vanilla-extract/css": "1.
|
|
96
|
-
"@vanilla-extract/dynamic": "2.1.
|
|
93
|
+
"@accelint/converters": "0.3.6",
|
|
94
|
+
"@accelint/core": "0.5.2",
|
|
95
|
+
"@vanilla-extract/css": "1.18.0",
|
|
96
|
+
"@vanilla-extract/dynamic": "2.1.5",
|
|
97
97
|
"clsx": "2.1.1",
|
|
98
98
|
"lodash": "4.17.21",
|
|
99
99
|
"type-fest": "4.41.0",
|
|
100
100
|
"typescript": "5.9.3",
|
|
101
|
-
"zod": "4.
|
|
101
|
+
"zod": "4.3.5"
|
|
102
102
|
},
|
|
103
103
|
"$schema": "https://json.schemastore.org/package",
|
|
104
104
|
"author": "https://hypergiant.com",
|
|
@@ -107,13 +107,13 @@
|
|
|
107
107
|
},
|
|
108
108
|
"sideEffects": false,
|
|
109
109
|
"scripts": {
|
|
110
|
-
"bench": "
|
|
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": "
|
|
114
|
-
"lint": "
|
|
115
|
-
"lint:fix": "
|
|
116
|
-
"preview": "
|
|
117
|
-
"test": "
|
|
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
|
}
|