@peculiar/react-components 0.0.2-alpha.301 → 0.0.2-alpha.303

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 (153) hide show
  1. package/dist/cjs/Autocomplete/autocomplete.js +2 -4
  2. package/dist/cjs/Autocomplete/autocomplete.js.map +1 -1
  3. package/dist/cjs/Box/box.js +4 -6
  4. package/dist/cjs/Box/box.js.map +1 -1
  5. package/dist/cjs/Button/button.js +2 -1
  6. package/dist/cjs/Button/button.js.map +1 -1
  7. package/dist/cjs/ButtonBase/button_base.js +4 -4
  8. package/dist/cjs/ButtonBase/button_base.js.map +1 -1
  9. package/dist/cjs/Checkbox/checkbox.js +1 -1
  10. package/dist/cjs/Checkbox/checkbox.js.map +1 -1
  11. package/dist/cjs/Chip/chip.js +5 -5
  12. package/dist/cjs/Chip/chip.js.map +1 -1
  13. package/dist/cjs/Dialog/dialog.js +1 -3
  14. package/dist/cjs/Dialog/dialog.js.map +1 -1
  15. package/dist/cjs/Fab/fab.js +2 -3
  16. package/dist/cjs/Fab/fab.js.map +1 -1
  17. package/dist/cjs/IconButton/icon_button.js +3 -5
  18. package/dist/cjs/IconButton/icon_button.js.map +1 -1
  19. package/dist/cjs/Menu/menu.js +1 -1
  20. package/dist/cjs/Menu/menu.js.map +1 -1
  21. package/dist/cjs/Radio/radio.js +1 -1
  22. package/dist/cjs/Radio/radio.js.map +1 -1
  23. package/dist/cjs/Select/select.js +1 -1
  24. package/dist/cjs/Select/select.js.map +1 -1
  25. package/dist/cjs/Skeleton/skeleton.js +4 -3
  26. package/dist/cjs/Skeleton/skeleton.js.map +1 -1
  27. package/dist/cjs/Switch/switch.js +1 -1
  28. package/dist/cjs/Switch/switch.js.map +1 -1
  29. package/dist/cjs/Tabs/tab.js +6 -6
  30. package/dist/cjs/Tabs/tab.js.map +1 -1
  31. package/dist/cjs/Tabs/tabs.js.map +1 -1
  32. package/dist/cjs/TextField/text_field.js +1 -1
  33. package/dist/cjs/TextField/text_field.js.map +1 -1
  34. package/dist/cjs/TextareaField/textarea_field.js +1 -1
  35. package/dist/cjs/TextareaField/textarea_field.js.map +1 -1
  36. package/dist/cjs/Tooltip/tooltip.js +1 -1
  37. package/dist/cjs/Tooltip/tooltip.js.map +1 -1
  38. package/dist/cjs/Typography/index.js.map +1 -1
  39. package/dist/cjs/Typography/typography.js +4 -3
  40. package/dist/cjs/Typography/typography.js.map +1 -1
  41. package/dist/cjs/system/forward_ref.js +13 -0
  42. package/dist/cjs/system/forward_ref.js.map +1 -0
  43. package/dist/cjs/system/index.js +6 -0
  44. package/dist/cjs/system/index.js.map +1 -0
  45. package/dist/cjs/system/system_types.js +3 -0
  46. package/dist/cjs/system/system_types.js.map +1 -0
  47. package/dist/esm/Autocomplete/autocomplete.js +2 -4
  48. package/dist/esm/Autocomplete/autocomplete.js.map +1 -1
  49. package/dist/esm/Box/box.js +4 -6
  50. package/dist/esm/Box/box.js.map +1 -1
  51. package/dist/esm/Button/button.js +2 -1
  52. package/dist/esm/Button/button.js.map +1 -1
  53. package/dist/esm/ButtonBase/button_base.js +4 -4
  54. package/dist/esm/ButtonBase/button_base.js.map +1 -1
  55. package/dist/esm/Checkbox/checkbox.js +1 -1
  56. package/dist/esm/Checkbox/checkbox.js.map +1 -1
  57. package/dist/esm/Chip/chip.js +5 -5
  58. package/dist/esm/Chip/chip.js.map +1 -1
  59. package/dist/esm/Dialog/dialog.js +1 -3
  60. package/dist/esm/Dialog/dialog.js.map +1 -1
  61. package/dist/esm/Fab/fab.js +2 -3
  62. package/dist/esm/Fab/fab.js.map +1 -1
  63. package/dist/esm/IconButton/icon_button.js +3 -5
  64. package/dist/esm/IconButton/icon_button.js.map +1 -1
  65. package/dist/esm/Menu/menu.js +1 -1
  66. package/dist/esm/Menu/menu.js.map +1 -1
  67. package/dist/esm/Radio/radio.js +1 -1
  68. package/dist/esm/Radio/radio.js.map +1 -1
  69. package/dist/esm/Select/select.js +1 -1
  70. package/dist/esm/Select/select.js.map +1 -1
  71. package/dist/esm/Skeleton/skeleton.js +4 -3
  72. package/dist/esm/Skeleton/skeleton.js.map +1 -1
  73. package/dist/esm/Switch/switch.js +1 -1
  74. package/dist/esm/Switch/switch.js.map +1 -1
  75. package/dist/esm/Tabs/tab.js +6 -6
  76. package/dist/esm/Tabs/tab.js.map +1 -1
  77. package/dist/esm/Tabs/tabs.js.map +1 -1
  78. package/dist/esm/TextField/text_field.js +1 -1
  79. package/dist/esm/TextField/text_field.js.map +1 -1
  80. package/dist/esm/TextareaField/textarea_field.js +1 -1
  81. package/dist/esm/TextareaField/textarea_field.js.map +1 -1
  82. package/dist/esm/Tooltip/tooltip.js +1 -1
  83. package/dist/esm/Tooltip/tooltip.js.map +1 -1
  84. package/dist/esm/Typography/index.js.map +1 -1
  85. package/dist/esm/Typography/typography.js +4 -3
  86. package/dist/esm/Typography/typography.js.map +1 -1
  87. package/dist/esm/system/forward_ref.js +9 -0
  88. package/dist/esm/system/forward_ref.js.map +1 -0
  89. package/dist/esm/system/index.js +2 -0
  90. package/dist/esm/system/index.js.map +1 -0
  91. package/dist/esm/system/system_types.js +2 -0
  92. package/dist/esm/system/system_types.js.map +1 -0
  93. package/dist/esnext/Autocomplete/autocomplete.js +2 -4
  94. package/dist/esnext/Autocomplete/autocomplete.js.map +1 -1
  95. package/dist/esnext/Box/box.js +4 -6
  96. package/dist/esnext/Box/box.js.map +1 -1
  97. package/dist/esnext/Button/button.js +2 -1
  98. package/dist/esnext/Button/button.js.map +1 -1
  99. package/dist/esnext/ButtonBase/button_base.js +4 -4
  100. package/dist/esnext/ButtonBase/button_base.js.map +1 -1
  101. package/dist/esnext/Checkbox/checkbox.js +1 -1
  102. package/dist/esnext/Checkbox/checkbox.js.map +1 -1
  103. package/dist/esnext/Chip/chip.js +5 -5
  104. package/dist/esnext/Chip/chip.js.map +1 -1
  105. package/dist/esnext/Dialog/dialog.js +1 -3
  106. package/dist/esnext/Dialog/dialog.js.map +1 -1
  107. package/dist/esnext/Fab/fab.js +2 -3
  108. package/dist/esnext/Fab/fab.js.map +1 -1
  109. package/dist/esnext/IconButton/icon_button.js +3 -5
  110. package/dist/esnext/IconButton/icon_button.js.map +1 -1
  111. package/dist/esnext/Menu/menu.js +1 -1
  112. package/dist/esnext/Menu/menu.js.map +1 -1
  113. package/dist/esnext/Radio/radio.js +1 -1
  114. package/dist/esnext/Radio/radio.js.map +1 -1
  115. package/dist/esnext/Select/select.js +1 -1
  116. package/dist/esnext/Select/select.js.map +1 -1
  117. package/dist/esnext/Skeleton/skeleton.js +4 -3
  118. package/dist/esnext/Skeleton/skeleton.js.map +1 -1
  119. package/dist/esnext/Switch/switch.js +1 -1
  120. package/dist/esnext/Switch/switch.js.map +1 -1
  121. package/dist/esnext/Tabs/tab.js +6 -6
  122. package/dist/esnext/Tabs/tab.js.map +1 -1
  123. package/dist/esnext/Tabs/tabs.js.map +1 -1
  124. package/dist/esnext/TextField/text_field.js +1 -1
  125. package/dist/esnext/TextField/text_field.js.map +1 -1
  126. package/dist/esnext/TextareaField/textarea_field.js +1 -1
  127. package/dist/esnext/TextareaField/textarea_field.js.map +1 -1
  128. package/dist/esnext/Tooltip/tooltip.js +1 -1
  129. package/dist/esnext/Tooltip/tooltip.js.map +1 -1
  130. package/dist/esnext/Typography/index.js.map +1 -1
  131. package/dist/esnext/Typography/typography.js +4 -3
  132. package/dist/esnext/Typography/typography.js.map +1 -1
  133. package/dist/esnext/system/forward_ref.js +9 -0
  134. package/dist/esnext/system/forward_ref.js.map +1 -0
  135. package/dist/esnext/system/index.js +2 -0
  136. package/dist/esnext/system/index.js.map +1 -0
  137. package/dist/esnext/system/system_types.js +2 -0
  138. package/dist/esnext/system/system_types.js.map +1 -0
  139. package/dist/types/Box/box.d.ts +2 -7
  140. package/dist/types/Button/button.d.ts +2 -14
  141. package/dist/types/ButtonBase/button_base.d.ts +2 -8
  142. package/dist/types/Chip/chip.d.ts +2 -7
  143. package/dist/types/Fab/fab.d.ts +2 -4
  144. package/dist/types/IconButton/icon_button.d.ts +2 -3
  145. package/dist/types/Skeleton/skeleton.d.ts +2 -3
  146. package/dist/types/Tabs/tab.d.ts +3 -8
  147. package/dist/types/Tabs/tabs.d.ts +2 -2
  148. package/dist/types/Typography/index.d.ts +1 -1
  149. package/dist/types/Typography/typography.d.ts +2 -7
  150. package/dist/types/system/forward_ref.d.ts +9 -0
  151. package/dist/types/system/index.d.ts +1 -0
  152. package/dist/types/system/system_types.d.ts +24 -0
  153. package/package.json +3 -3
@@ -1,4 +1,5 @@
1
1
  import * as React from 'react';
2
+ import { forwardRef } from '../system';
2
3
  import { css, cx, } from '../styles';
3
4
  const stylesBase = () => css({
4
5
  label: 'Typography',
@@ -21,8 +22,8 @@ const stylesNoWrap = () => css({
21
22
  whiteSpace: 'nowrap',
22
23
  textOverflow: 'ellipsis',
23
24
  });
24
- export const Typography = React.forwardRef((props, ref) => {
25
- const { variant, className, color, noWrap, component: componentProp, ...other } = props;
25
+ export const Typography = forwardRef((props, ref) => {
26
+ const { variant, className, color, noWrap, as, ...other } = props;
26
27
  const getTagFromVariantProp = () => {
27
28
  if (/h/.test(variant)) {
28
29
  return variant;
@@ -35,7 +36,7 @@ export const Typography = React.forwardRef((props, ref) => {
35
36
  }
36
37
  return 'p';
37
38
  };
38
- const Component = componentProp || getTagFromVariantProp();
39
+ const Component = as || getTagFromVariantProp();
39
40
  return (React.createElement(Component, { ...other, ref: ref, className: cx({
40
41
  [stylesBase()]: true,
41
42
  [stylesVariant(variant)]: !!variant,
@@ -1 +1 @@
1
- {"version":3,"file":"typography.js","sourceRoot":"","sources":["../../../src/Typography/typography.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACL,GAAG,EACH,EAAE,GAGH,MAAM,WAAW,CAAC;AAkCnB,MAAM,UAAU,GAAG,GAAG,EAAE,CAAC,GAAG,CAAC;IAC3B,KAAK,EAAE,YAAY;IACnB,MAAM,EAAE,CAAC;CACV,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AM;YACxB,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,SAAS;SACzB,CAAC,GACF,CACH,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,UAAU,CAAC,WAAW,GAAG,YAAY,CAAC;AAEtC,UAAU,CAAC,YAAY,GAAG;IACxB,OAAO,EAAE,IAAI;IACb,KAAK,EAAE,OAAO;CACf,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { forwardRef as forwardReactRef } from 'react';
2
+ /**
3
+ * All credit goes to Chance (Reach UI), Haz (Reakit) and (fluentui)
4
+ * for creating the base type definitions upon which we improved on
5
+ */
6
+ export function forwardRef(component) {
7
+ return forwardReactRef(component);
8
+ }
9
+ //# sourceMappingURL=forward_ref.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"forward_ref.js","sourceRoot":"","sources":["../../../src/system/forward_ref.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,IAAI,eAAe,EAAE,MAAM,OAAO,CAAC;AAQtD;;;GAGG;AACH,MAAM,UAAU,UAAU,CACxB,SAKC;IAED,OAAO,eAAe,CAAC,SAAS,CAG/B,CAAC;AACJ,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { forwardRef } from './forward_ref';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/system/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=system_types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"system_types.js","sourceRoot":"","sources":["../../../src/system/system_types.ts"],"names":[],"mappings":""}
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { ColorType } from '../styles';
3
- declare type BaseProps = {
3
+ export declare type BoxProps = {
4
4
  /**
5
5
  * The content of the component.
6
6
  */
@@ -9,10 +9,6 @@ declare type BaseProps = {
9
9
  * The className of the component.
10
10
  */
11
11
  className?: string;
12
- /**
13
- * The component used for the root node.
14
- */
15
- component?: React.ElementType;
16
12
  background?: ColorType;
17
13
  borderColor?: ColorType;
18
14
  borderWidth?: number;
@@ -21,5 +17,4 @@ declare type BaseProps = {
21
17
  borderRadius?: number;
22
18
  'data-testid'?: string;
23
19
  };
24
- export declare const Box: React.ForwardRefExoticComponent<BaseProps & React.HTMLAttributes<HTMLElement> & React.RefAttributes<HTMLElement>>;
25
- export {};
20
+ export declare const Box: import("../system/system_types").ComponentWithAs<"div", BoxProps>;
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { ButtonBaseProps } from '../ButtonBase';
3
- declare type BaseProps = {
3
+ export declare type ButtonProps = ButtonBaseProps & {
4
4
  circled?: boolean;
5
5
  /**
6
6
  * Element placed before the children.
@@ -15,16 +15,4 @@ declare type BaseProps = {
15
15
  */
16
16
  withoutPadding?: boolean;
17
17
  };
18
- export declare type ButtonProps = BaseProps & ButtonBaseProps;
19
- export declare const Button: React.ForwardRefExoticComponent<BaseProps & {
20
- children: React.ReactNode;
21
- disabled?: boolean;
22
- variant?: "text" | "contained" | "outlined";
23
- textVariant?: import("../styles").TypographyType;
24
- color?: "default" | "white" | "primary" | "secondary" | "wrong";
25
- size?: "small" | "medium" | "large";
26
- className?: string;
27
- component?: React.ElementType<any>;
28
- 'data-testid'?: string;
29
- } & React.ButtonHTMLAttributes<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>>;
30
- export {};
18
+ export declare const Button: import("../system/system_types").ComponentWithAs<"button", ButtonProps>;
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { TypographyType } from '../styles';
3
- declare type BaseProps = {
3
+ export declare type ButtonBaseProps = {
4
4
  /**
5
5
  * The content of the component.
6
6
  */
@@ -29,12 +29,6 @@ declare type BaseProps = {
29
29
  * The className of the component.
30
30
  */
31
31
  className?: string;
32
- /**
33
- * The component used for the root node.
34
- */
35
- component?: React.ElementType;
36
32
  'data-testid'?: string;
37
33
  };
38
- export declare type ButtonBaseProps = BaseProps & React.ButtonHTMLAttributes<HTMLButtonElement>;
39
- export declare const ButtonBase: React.ForwardRefExoticComponent<BaseProps & React.ButtonHTMLAttributes<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>>;
40
- export {};
34
+ export declare const ButtonBase: import("../system/system_types").ComponentWithAs<"button", ButtonBaseProps>;
@@ -2,7 +2,7 @@ import * as React from 'react';
2
2
  /**
3
3
  * Types.
4
4
  */
5
- declare type BaseProps = {
5
+ export declare type ChipProps = {
6
6
  /**
7
7
  * The content of the component.
8
8
  */
@@ -31,10 +31,6 @@ declare type BaseProps = {
31
31
  * Element placed before the children.
32
32
  */
33
33
  startContent?: React.ReactElement;
34
- /**
35
- * The component used for the root node.
36
- */
37
- component?: React.ElementType;
38
34
  /**
39
35
  * Callback function fired when the delete icon is clicked. If set, the delete icon will be shown.
40
36
  */
@@ -48,5 +44,4 @@ declare type BaseProps = {
48
44
  /**
49
45
  *
50
46
  */
51
- export declare const Chip: React.ForwardRefExoticComponent<BaseProps & React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
52
- export {};
47
+ export declare const Chip: import("../system/system_types").ComponentWithAs<"div", ChipProps>;
@@ -1,10 +1,8 @@
1
- import * as React from 'react';
2
1
  import { ButtonBaseProps } from '../ButtonBase';
3
- declare type BaseProps = {
2
+ export declare type FabProps = Omit<ButtonBaseProps, 'size' | 'variant'> & {
4
3
  /**
5
4
  * The variant to use.
6
5
  */
7
6
  variant?: ('contained' | 'outlined');
8
7
  };
9
- export declare const Fab: React.ForwardRefExoticComponent<BaseProps & Omit<ButtonBaseProps, "size" | "variant"> & React.RefAttributes<HTMLButtonElement>>;
10
- export {};
8
+ export declare const Fab: import("../system/system_types").ComponentWithAs<"button", FabProps>;
@@ -1,10 +1,9 @@
1
- import * as React from 'react';
2
1
  import { ButtonProps } from '../Button';
3
- declare type BaseProps = {
2
+ declare type IconButtonProps = Omit<ButtonProps, 'variant' | 'withoutPadding' | 'startIcon' | 'endIcon'> & {
4
3
  /**
5
4
  * The text that applied to `aria-label` attribute and Tooltip content.
6
5
  */
7
6
  title?: string;
8
7
  };
9
- export declare const IconButton: React.ForwardRefExoticComponent<BaseProps & Omit<ButtonProps, "variant" | "startIcon" | "endIcon" | "withoutPadding"> & React.RefAttributes<HTMLButtonElement>>;
8
+ export declare const IconButton: import("../system/system_types").ComponentWithAs<"button", IconButtonProps>;
10
9
  export {};
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { ColorType } from '../styles';
3
- declare type BaseProps = {
3
+ export declare type SkeletonProps = {
4
4
  /**
5
5
  * Optional children to infer width and height from.
6
6
  */
@@ -26,5 +26,4 @@ declare type BaseProps = {
26
26
  /**
27
27
  *
28
28
  */
29
- export declare const Skeleton: React.ForwardRefExoticComponent<BaseProps & Omit<React.HTMLAttributes<HTMLSpanElement>, "height" | "width" | "children"> & React.RefAttributes<HTMLSpanElement>>;
30
- export {};
29
+ export declare const Skeleton: import("../system/system_types").ComponentWithAs<"span", SkeletonProps>;
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- declare type BaseProps = {
2
+ export declare type TabProps = {
3
3
  /**
4
4
  * The content of the component.
5
5
  */
@@ -20,16 +20,11 @@ declare type BaseProps = {
20
20
  * The color of the component.
21
21
  */
22
22
  color?: ('black' | 'white');
23
- /**
24
- * The component used for the root node.
25
- */
26
- component?: React.ElementType;
27
23
  /**
28
24
  * Callback fired when the value changes.
29
25
  */
30
26
  onChange?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>, value: string) => void;
27
+ onClick?: never;
31
28
  'data-testid'?: string;
32
29
  };
33
- export declare type TabBaseProps = BaseProps & Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'onClick' | 'onChange'>;
34
- export declare const Tab: React.ForwardRefExoticComponent<BaseProps & Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "onChange" | "onClick"> & React.RefAttributes<HTMLButtonElement>>;
35
- export {};
30
+ export declare const Tab: import("../system/system_types").ComponentWithAs<"button", TabProps>;
@@ -1,10 +1,10 @@
1
1
  import * as React from 'react';
2
- import { Tab, TabBaseProps } from './tab';
2
+ import { Tab, TabProps } from './tab';
3
3
  declare type BaseProps = {
4
4
  /**
5
5
  * The content of the component.
6
6
  */
7
- children: React.ReactElement<TabBaseProps, typeof Tab>[];
7
+ children: React.ReactElement<TabProps, typeof Tab>[];
8
8
  /**
9
9
  * The value of the currently selected `Tab`.
10
10
  */
@@ -1 +1 @@
1
- export { Typography, TypographyBaseProps, TypographyProps } from './typography';
1
+ export { Typography, TypographyProps } from './typography';
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { ColorType, TypographyType } from '../styles';
3
- export declare type TypographyBaseProps = {
3
+ export declare type TypographyProps = {
4
4
  /**
5
5
  * The content of the component.
6
6
  */
@@ -23,11 +23,6 @@ export declare type TypographyBaseProps = {
23
23
  * (the element needs to have a width in order to overflow).
24
24
  */
25
25
  noWrap?: boolean;
26
- /**
27
- * The component used for the root node.
28
- */
29
- component?: React.ElementType;
30
26
  'data-testid'?: string;
31
27
  };
32
- export declare type TypographyProps = TypographyBaseProps & React.HTMLAttributes<HTMLElement>;
33
- export declare const Typography: React.ForwardRefExoticComponent<TypographyBaseProps & React.HTMLAttributes<HTMLElement> & React.RefAttributes<HTMLElement>>;
28
+ export declare const Typography: import("../system/system_types").ComponentWithAs<"p", TypographyProps>;
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import type { RightJoinProps, PropsOf, As, ComponentWithAs } from './system_types';
3
+ /**
4
+ * All credit goes to Chance (Reach UI), Haz (Reakit) and (fluentui)
5
+ * for creating the base type definitions upon which we improved on
6
+ */
7
+ export declare function forwardRef<Props extends object, Component extends As>(component: React.ForwardRefRenderFunction<any, RightJoinProps<PropsOf<Component>, Props> & {
8
+ as?: As;
9
+ }>): ComponentWithAs<Component, Props>;
@@ -0,0 +1 @@
1
+ export { forwardRef } from './forward_ref';
@@ -0,0 +1,24 @@
1
+ /// <reference types="react" />
2
+ export declare type As<Props = any> = React.ElementType<Props>;
3
+ export declare type MergeWithAs<ComponentProps extends object, AsProps extends object, AdditionalProps extends object = {}, AsComponent extends As = As> = RightJoinProps<ComponentProps, AdditionalProps> & RightJoinProps<AsProps, AdditionalProps> & {
4
+ /**
5
+ * The component used for the root node.
6
+ */
7
+ as?: AsComponent;
8
+ };
9
+ export declare type ComponentWithAs<Component extends As, Props extends object = {}> = {
10
+ <AsComponent extends As = Component>(props: MergeWithAs<React.ComponentProps<Component>, React.ComponentProps<AsComponent>, Props, AsComponent>): JSX.Element;
11
+ displayName?: string;
12
+ propTypes?: React.WeakValidationMap<any>;
13
+ contextTypes?: React.ValidationMap<any>;
14
+ defaultProps?: Partial<Props>;
15
+ id?: string;
16
+ };
17
+ export declare type PropsOf<T extends As> = React.ComponentPropsWithoutRef<T> & {
18
+ /**
19
+ * The component used for the root node.
20
+ */
21
+ as?: As;
22
+ };
23
+ export declare type OmitCommonProps<Target, OmitAdditionalProps extends keyof any = never> = Omit<Target, 'transition' | 'as' | 'color' | OmitAdditionalProps>;
24
+ export declare type RightJoinProps<SourceProps extends object = {}, OverrideProps extends object = {}> = OmitCommonProps<SourceProps, keyof OverrideProps> & OverrideProps;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@peculiar/react-components",
3
3
  "private": false,
4
- "version": "0.0.2-alpha.301+2e498b5",
4
+ "version": "0.0.2-alpha.303+ce18128",
5
5
  "author": "PeculiarVentures Team",
6
6
  "description": "A simple and customizable component library to build faster, beautiful, and more accessible React applications.",
7
7
  "keywords": [
@@ -42,7 +42,7 @@
42
42
  "dependencies": {
43
43
  "@emotion/core": "^10.1.1",
44
44
  "@emotion/css": "^11.7.1",
45
- "@peculiar/color": "^0.0.2-alpha.301+2e498b5",
45
+ "@peculiar/color": "^0.0.2-alpha.303+ce18128",
46
46
  "@popperjs/core": "^2.11.5",
47
47
  "@types/flat": "^5.0.2",
48
48
  "@types/react-transition-group": "^4.4.4",
@@ -85,5 +85,5 @@
85
85
  "node": ">=12.x"
86
86
  },
87
87
  "license": "MIT",
88
- "gitHead": "2e498b5d832a68a93a47bbdc845db36194d03515"
88
+ "gitHead": "ce18128b8bb5d565fda836208df1503719e152f4"
89
89
  }