@up42/up-components 0.2.5 → 0.3.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 (66) hide show
  1. package/dist/cjs/index.js +1 -1
  2. package/dist/cjs/types/components/Box/Box.stories.d.ts +2 -2
  3. package/dist/cjs/types/components/Button/Button.stories.d.ts +1 -0
  4. package/dist/cjs/types/components/Checkbox/Checkbox.stories.d.ts +1 -1
  5. package/dist/cjs/types/components/Chip/Chip.stories.d.ts +1 -1
  6. package/dist/cjs/types/components/EmptyState/EmptyState.d.ts +3 -3
  7. package/dist/cjs/types/components/EmptyState/EmptyState.stories.d.ts +3 -3
  8. package/dist/cjs/types/components/Form/Form.stories.d.ts +5 -0
  9. package/dist/cjs/types/components/FormCheckbox/FormCheckbox.d.ts +5 -8
  10. package/dist/cjs/types/components/FormCheckbox/FormCheckbox.stories.d.ts +3 -3
  11. package/dist/cjs/types/components/FormControl/FormControl.overrides.d.ts +3 -0
  12. package/dist/cjs/types/components/FormInput/FormInput.d.ts +4 -8
  13. package/dist/cjs/types/components/FormInput/FormInput.stories.d.ts +6 -3
  14. package/dist/cjs/types/components/FormLabel/FormLabel.d.ts +8 -0
  15. package/dist/cjs/types/components/FormLabel/FormLabel.test.d.ts +1 -0
  16. package/dist/cjs/types/components/FormRadio/FormRadio.d.ts +6 -9
  17. package/dist/cjs/types/components/FormRadio/FormRadio.stories.d.ts +4 -3
  18. package/dist/cjs/types/components/FormSelect/FormSelect.d.ts +5 -8
  19. package/dist/cjs/types/components/FormSelect/FormSelect.stories.d.ts +4 -3
  20. package/dist/cjs/types/components/FormSwitch/FormSwitch.d.ts +4 -7
  21. package/dist/cjs/types/components/FormSwitch/FormSwitch.stories.d.ts +1 -1
  22. package/dist/cjs/types/components/Input/Input.d.ts +3 -6
  23. package/dist/cjs/types/components/Input/Input.overrides.d.ts +1 -0
  24. package/dist/cjs/types/components/Radio/Radio.stories.d.ts +1 -1
  25. package/dist/cjs/types/components/Select/Select.stories.d.ts +3 -3
  26. package/dist/cjs/types/components/Switch/Switch.d.ts +2 -4
  27. package/dist/cjs/types/components/Switch/Switch.stories.d.ts +1 -2
  28. package/dist/cjs/types/components/Tabs/Tabs.stories.d.ts +1 -1
  29. package/dist/cjs/types/components/Typography/Typography.d.ts +3 -4
  30. package/dist/cjs/types/components/Typography/Typography.stories.d.ts +1 -1
  31. package/dist/cjs/types/global/utils/types.d.ts +4 -6
  32. package/dist/esm/index.js +1 -1
  33. package/dist/esm/types/components/Box/Box.stories.d.ts +2 -2
  34. package/dist/esm/types/components/Button/Button.stories.d.ts +1 -0
  35. package/dist/esm/types/components/Checkbox/Checkbox.stories.d.ts +1 -1
  36. package/dist/esm/types/components/Chip/Chip.stories.d.ts +1 -1
  37. package/dist/esm/types/components/EmptyState/EmptyState.d.ts +3 -3
  38. package/dist/esm/types/components/EmptyState/EmptyState.stories.d.ts +3 -3
  39. package/dist/esm/types/components/Form/Form.stories.d.ts +5 -0
  40. package/dist/esm/types/components/FormCheckbox/FormCheckbox.d.ts +5 -8
  41. package/dist/esm/types/components/FormCheckbox/FormCheckbox.stories.d.ts +3 -3
  42. package/dist/esm/types/components/FormControl/FormControl.overrides.d.ts +3 -0
  43. package/dist/esm/types/components/FormInput/FormInput.d.ts +4 -8
  44. package/dist/esm/types/components/FormInput/FormInput.stories.d.ts +6 -3
  45. package/dist/esm/types/components/FormLabel/FormLabel.d.ts +8 -0
  46. package/dist/esm/types/components/FormLabel/FormLabel.test.d.ts +1 -0
  47. package/dist/esm/types/components/FormRadio/FormRadio.d.ts +6 -9
  48. package/dist/esm/types/components/FormRadio/FormRadio.stories.d.ts +4 -3
  49. package/dist/esm/types/components/FormSelect/FormSelect.d.ts +5 -8
  50. package/dist/esm/types/components/FormSelect/FormSelect.stories.d.ts +4 -3
  51. package/dist/esm/types/components/FormSwitch/FormSwitch.d.ts +4 -7
  52. package/dist/esm/types/components/FormSwitch/FormSwitch.stories.d.ts +1 -1
  53. package/dist/esm/types/components/Input/Input.d.ts +3 -6
  54. package/dist/esm/types/components/Input/Input.overrides.d.ts +1 -0
  55. package/dist/esm/types/components/Radio/Radio.stories.d.ts +1 -1
  56. package/dist/esm/types/components/Select/Select.stories.d.ts +3 -3
  57. package/dist/esm/types/components/Switch/Switch.d.ts +2 -4
  58. package/dist/esm/types/components/Switch/Switch.stories.d.ts +1 -2
  59. package/dist/esm/types/components/Tabs/Tabs.stories.d.ts +1 -1
  60. package/dist/esm/types/components/Typography/Typography.d.ts +3 -4
  61. package/dist/esm/types/components/Typography/Typography.stories.d.ts +1 -1
  62. package/dist/esm/types/global/utils/types.d.ts +4 -6
  63. package/dist/index.d.ts +31 -49
  64. package/package.json +1 -1
  65. package/dist/cjs/types/components/Select/Select.overrides.d.ts +0 -2
  66. package/dist/esm/types/components/Select/Select.overrides.d.ts +0 -2
package/dist/index.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  /// <reference types="react" />
2
2
  export { default as tokens } from '@up42/design-system-tokens/dist/json/tokens.json';
3
3
  import * as _mui_material from '@mui/material';
4
- import { SxProps, Theme, ChipProps as ChipProps$1, AvatarProps as AvatarProps$1, ContainerProps as ContainerProps$1, BoxProps as BoxProps$1, CheckboxProps as CheckboxProps$1, RadioProps as RadioProps$1, RadioGroupProps, SwitchProps as SwitchProps$1, SelectProps as SelectProps$1, TextFieldProps, LinkProps as LinkProps$1, TabsProps as TabsProps$1, TabProps as TabProps$1 } from '@mui/material';
4
+ import { BoxProps as BoxProps$1, TextFieldProps, ChipProps as ChipProps$1, AvatarProps as AvatarProps$1, ContainerProps as ContainerProps$1, CheckboxProps as CheckboxProps$1, RadioProps as RadioProps$1, RadioGroupProps, SwitchProps as SwitchProps$1, SelectProps as SelectProps$1, LinkProps as LinkProps$1, TabsProps as TabsProps$1, TabProps as TabProps$1 } from '@mui/material';
5
5
  export * from '@mui/material';
6
6
  import { ThemeProviderProps } from '@mui/material/styles/ThemeProvider';
7
7
  import { ButtonProps as ButtonProps$1 } from '@mui/material/Button';
8
- import React, { HTMLInputTypeAttribute, ReactNode, ElementType } from 'react';
8
+ import React, { ReactNode, ElementType } from 'react';
9
9
  import { TypographyProps as TypographyProps$1 } from '@mui/material/Typography';
10
10
  import { TableProps as TableProps$1 } from '@mui/material/Table';
11
11
  import { TableBodyProps as TableBodyProps$1 } from '@mui/material/TableBody';
@@ -36,22 +36,25 @@ type MUIGlobalOmit<MuiProps, ComponentProps = unknown> = ComponentProps &
36
36
  | 'focusVisibleClassName'
37
37
  | 'LinkComponent'
38
38
  | 'TouchRippleProps'
39
+ | 'touchRippleRef'
39
40
  >
40
41
 
41
- type BaseProps<ComponentProps = unknown> = ComponentProps & {
42
- sx?: SxProps<Theme>
43
- ref?: React.Ref<unknown>
44
- }
42
+ type BaseProps<D extends React.ElementType = 'div', P = Record<string, unknown>> = BoxProps$1<D, P>
43
+
44
+ type FormBaseProps<C extends React.ElementType> = BaseProps<
45
+ C,
46
+ Pick<TextFieldProps, 'id' | 'label' | 'required' | 'error' | 'disabled' | 'focused' | 'helperText'>
47
+ >
45
48
 
46
49
  declare type ButtonProps = MUIGlobalOmit<ButtonProps$1, {
47
50
  loading?: boolean;
48
51
  }>;
49
52
  declare const Button: ({ color, variant, size, loading, children, ...props }: ButtonProps) => JSX.Element;
50
53
 
51
- declare type TypographyProps = MUIGlobalOmit<TypographyProps$1, {
52
- component?: React.ElementType;
54
+ declare type TypographyProps<C extends React.ElementType = 'p'> = TypographyProps$1<C, {
55
+ component?: C;
53
56
  }>;
54
- declare const Typography: ({ children, ...props }: TypographyProps) => JSX.Element;
57
+ declare const Typography: <C extends React.ElementType<any>>({ children, ...props }: TypographyProps<C>) => JSX.Element;
55
58
 
56
59
  declare type ChipProps = MUIGlobalOmit<Omit<ChipProps$1, 'size'>>;
57
60
  declare const Chip: ({ label, ...props }: ChipProps) => JSX.Element;
@@ -94,69 +97,48 @@ declare const Box: ({ children, ...props }: BoxProps) => JSX.Element;
94
97
  declare type CheckboxProps = MUIGlobalOmit<CheckboxProps$1>;
95
98
  declare const Checkbox: ({ ...props }: CheckboxProps) => JSX.Element;
96
99
 
97
- declare type FormCheckboxProps = MUIGlobalOmit<CheckboxProps, {
100
+ declare type FormCheckboxProps<C extends React.ElementType = 'div'> = CheckboxProps & FormBaseProps<C> & {
98
101
  data: {
99
102
  value: string | number;
100
103
  label?: string;
101
104
  }[];
102
- label?: string;
103
- error?: boolean;
104
- helperText?: string;
105
- }>;
106
- declare const FormCheckbox: ({ id, required, data, label, error, helperText }: FormCheckboxProps) => JSX.Element;
105
+ };
106
+ declare const FormCheckbox: <C extends React.ElementType<any>>({ id, label, required, component, disabled, data, error, helperText, sx, ...props }: FormCheckboxProps<C>) => JSX.Element;
107
107
 
108
108
  declare type RadioProps = MUIGlobalOmit<RadioProps$1>;
109
109
  declare const Radio: (props: RadioProps) => JSX.Element;
110
110
 
111
- declare type FormRadioProps = MUIGlobalOmit<RadioGroupProps, {
111
+ declare type FormRadioProps<C extends React.ElementType = 'div'> = RadioGroupProps & FormBaseProps<C> & {
112
112
  data: {
113
113
  value: string | number;
114
114
  label?: string;
115
+ message?: string;
115
116
  }[];
116
- helperText?: string;
117
- label?: string;
118
- error?: boolean;
119
- required?: boolean;
120
- }>;
121
- declare const FormRadio: ({ id, helperText, label, error, required, name, data }: FormRadioProps) => JSX.Element;
117
+ };
118
+ declare const FormRadio: ({ id, required, component, disabled, data, label, error, helperText, sx, ...props }: FormRadioProps) => JSX.Element;
122
119
 
123
- declare type SwitchProps = MUIGlobalOmit<SwitchProps$1, {
124
- onChange?: (event: React.ChangeEvent<HTMLInputElement>, checked: boolean) => void;
125
- }>;
120
+ declare type SwitchProps = MUIGlobalOmit<SwitchProps$1>;
126
121
  declare const Switch: (props: SwitchProps) => JSX.Element;
127
122
 
128
- interface FormSwitchProps extends SwitchProps {
129
- label?: string;
130
- id?: string;
131
- checked?: boolean;
132
- }
133
- declare const FormSwitch: ({ id, label, checked }: FormSwitchProps) => JSX.Element;
123
+ declare type FormSwitchProps<C extends React.ElementType = 'div'> = SwitchProps & FormBaseProps<C>;
124
+ declare const FormSwitch: <C extends React.ElementType<any>>({ component, disabled, label, error, sx, ...props }: FormSwitchProps<C>) => JSX.Element;
134
125
 
135
126
  declare type SelectProps = MUIGlobalOmit<Omit<SelectProps$1, 'variant' | 'label'>>;
136
127
  declare const Select: (props: SelectProps) => JSX.Element;
137
128
 
138
- declare type FormSelectProps = MUIGlobalOmit<SelectProps, {
129
+ declare type FormSelectProps<C extends React.ElementType = 'div'> = SelectProps & FormBaseProps<C> & {
139
130
  options: {
140
131
  value: string | number;
141
132
  text: string;
142
133
  }[];
143
- label?: string;
144
- error?: boolean;
145
- helperText?: string;
146
- }>;
147
- declare const FormSelect: ({ id, required, options, label, error, placeholder, helperText, value, }: FormSelectProps) => JSX.Element;
148
-
149
- declare type InputProps = MUIGlobalOmit<TextFieldProps> & {
150
- type?: HTMLInputTypeAttribute;
151
134
  };
152
- declare const Input: ({ type, ...otherProps }: InputProps) => JSX.Element;
135
+ declare const FormSelect: ({ id, required, component, disabled, label, error, helperText, sx, options, ...props }: FormSelectProps) => JSX.Element;
153
136
 
154
- declare type FormInputProps = MUIGlobalOmit<InputProps, {
155
- label?: string;
156
- error?: boolean;
157
- helperText?: string;
158
- }>;
159
- declare const FormInput: ({ id, required, label, error, helperText, ...props }: FormInputProps) => JSX.Element;
137
+ declare type InputProps = Omit<TextFieldProps, 'maxRows' | 'minRows' | 'multiline' | 'rows' | 'size' | 'variant'>;
138
+ declare const Input: ({ type, ...props }: InputProps) => JSX.Element;
139
+
140
+ declare type FormInputProps<C extends React.ElementType = 'div'> = InputProps & FormBaseProps<C>;
141
+ declare const FormInput: <C extends React.ElementType<any>>({ id, component, required, disabled, label, error, helperText, sx, ...props }: FormInputProps<C>) => JSX.Element;
160
142
 
161
143
  declare type LinkProps<C extends React.ElementType> = LinkProps$1<C, {
162
144
  component?: C;
@@ -209,7 +191,7 @@ declare type TabGroupProps = {
209
191
  };
210
192
  declare const TabGroup: ({ tabs, nameSpace: _nameSpace, tabContentProps, tabsProps }: TabGroupProps) => JSX.Element;
211
193
 
212
- declare type EmptyStateProps = BaseProps<{
194
+ declare type EmptyStateProps<C extends React.ElementType = 'div'> = BaseProps<C, {
213
195
  /**
214
196
  * Helpful message that conveys the purpose of the screen and the next action to populate the space
215
197
  */
@@ -227,7 +209,7 @@ declare type EmptyStateProps = BaseProps<{
227
209
  */
228
210
  action?: ReactNode;
229
211
  }>;
230
- declare const EmptyState: ({ icon: Icon, title, subTitle, action, ...props }: EmptyStateProps & Omit<JSX.IntrinsicElements['div'], keyof EmptyStateProps>) => JSX.Element;
212
+ declare const EmptyState: <C extends React.ElementType<any>>({ icon: Icon, title, subTitle, action, ...props }: EmptyStateProps<C>) => JSX.Element;
231
213
 
232
214
  declare type TableProps = MUIGlobalOmit<TableProps$1>;
233
215
  declare const Table: ({ children, ...props }: TableProps) => JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@up42/up-components",
3
- "version": "0.2.5",
3
+ "version": "0.3.0",
4
4
  "description": "UP42 Component Library",
5
5
  "author": "Axel Fuhrmann axel.fuhrmann@up42.com",
6
6
  "license": "ISC",
@@ -1,2 +0,0 @@
1
- import { OverridesStyleRules } from '@mui/material/styles/overrides';
2
- export declare const MuiSelect: OverridesStyleRules;
@@ -1,2 +0,0 @@
1
- import { OverridesStyleRules } from '@mui/material/styles/overrides';
2
- export declare const MuiSelect: OverridesStyleRules;