{"version":3,"file":"types.cjs","sources":["../../../src/components/utils/types.ts"],"sourcesContent":["import React, { ReactNode } from \"react\";\n\nimport PropTypes from 'prop-types';\n\n/**\n * This file contains the types and prop-types for List, ListItem, ListItemPrefix and ListItemSuffix components.\n */\n\n// typescript types\nexport type className = string\nexport type disabled = boolean\nexport type selected = boolean\nexport type children = ReactNode\n\n// javascript prop-types\nexport const propTypesClassName: any = PropTypes.string\nexport const propTypesDisabled: any = PropTypes.bool\nexport const propTypesSelected: any = PropTypes.bool\nexport const propTypesChildren: any = PropTypes.node.isRequired\n\n/** */\nexport type PropsOf<\n  C extends keyof JSX.IntrinsicElements | React.JSXElementConstructor<unknown>\n> = JSX.LibraryManagedAttributes<C, React.ComponentPropsWithoutRef<C>>;\n\ntype AsProp<C extends React.ElementType> = {\n  /**\n   * An override of the default HTML tag.\n   * Can also be another React component.\n   */\n  as?: C;\n};\n\n/**\n * Allows for extending a set of props (`ExtendedProps`) by an overriding set of props\n * (`OverrideProps`), ensuring that any duplicates are overridden by the overriding\n * set of props.\n */\nexport type ExtendableProps<\n  ExtendedProps = {},\n  OverrideProps = {}\n> = OverrideProps & Omit<ExtendedProps, keyof OverrideProps>;\n\n/**\n * Allows for inheriting the props from the specified element type so that\n * props like children, className & style work, as well as element-specific\n * attributes like aria roles. The component (`C`) must be passed in.\n */\nexport type InheritableElementProps<\n  C extends React.ElementType,\n  Props = {}\n> = ExtendableProps<PropsOf<C>, Props>;\n\n/**\n * A more sophisticated version of `InheritableElementProps` where\n * the passed in `as` prop will determine which props can be included\n */\nexport type PolymorphicComponentProps<\n  C extends React.ElementType,\n  Props = {}\n> = InheritableElementProps<C, Props & AsProp<C>>;\n\nexport type PolymorphicRef<C extends React.ElementType> =\n  React.ComponentPropsWithRef<C>[\"ref\"];\n\nexport type PolymorphicComponentPropsWithRef<\n  C extends React.ElementType,\n  Props = {}\n> = PolymorphicComponentProps<C, Props> & { ref?: PolymorphicRef<C> };\n"],"names":["propTypesClassName","PropTypes","default","string","propTypesDisabled","bool","propTypesSelected","propTypesChildren","node","isRequired"],"mappings":"wIAeaA,EAA0BC,EAAUC,QAAAC,OACpCC,EAAyBH,EAAUC,QAAAG,KACnCC,EAAyBL,EAAUC,QAAAG,KACnCE,EAAyBN,UAAUO,KAAKC"}