powell-react 0.0.2 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (166) hide show
  1. package/dist/cjs/index.js +36892 -59
  2. package/dist/cjs/index.js.map +1 -1
  3. package/dist/cjs/types/api/PowellProvider.d.ts +5 -0
  4. package/dist/cjs/types/api/configService.d.ts +2 -0
  5. package/dist/cjs/types/api/forms.d.ts +73 -0
  6. package/dist/cjs/types/api/index.d.ts +5 -0
  7. package/dist/cjs/types/api/powellDefaults.d.ts +2 -0
  8. package/dist/cjs/types/api/primereact.d.ts +981 -0
  9. package/dist/cjs/types/components/AutoComplete/AutoComplete.d.ts +24 -0
  10. package/dist/cjs/types/components/AutoComplete/index.d.ts +1 -0
  11. package/dist/cjs/types/components/Button/Button.d.ts +21 -6
  12. package/dist/cjs/types/components/Button/index.d.ts +1 -2
  13. package/dist/cjs/types/components/CascadeSelect/CascadeSelect.d.ts +24 -0
  14. package/dist/cjs/types/components/CascadeSelect/index.d.ts +1 -0
  15. package/dist/cjs/types/components/Checkbox/Checkbox.d.ts +21 -0
  16. package/dist/cjs/types/components/Checkbox/index.d.ts +1 -0
  17. package/dist/cjs/types/components/Chips/Chips.d.ts +24 -0
  18. package/dist/cjs/types/components/Chips/index.d.ts +1 -0
  19. package/dist/cjs/types/components/ColorPicker/ColorPicker.d.ts +24 -0
  20. package/dist/cjs/types/components/ColorPicker/index.d.ts +1 -0
  21. package/dist/cjs/types/components/Dropdown/Dropdown.d.ts +24 -0
  22. package/dist/cjs/types/components/Dropdown/index.d.ts +1 -0
  23. package/dist/cjs/types/components/Editor/Editor.d.ts +23 -0
  24. package/dist/cjs/types/components/Editor/index.d.ts +1 -0
  25. package/dist/cjs/types/components/FormContainer/FormContainer.d.ts +7 -0
  26. package/dist/cjs/types/components/FormContainer/FormContext.d.ts +4 -0
  27. package/dist/cjs/types/components/FormContainer/index.d.ts +2 -0
  28. package/dist/cjs/types/components/InputMask/InputMask.d.ts +24 -0
  29. package/dist/cjs/types/components/InputMask/index.d.ts +1 -0
  30. package/dist/cjs/types/components/InputNumber/InputNumber.d.ts +24 -0
  31. package/dist/cjs/types/components/InputNumber/index.d.ts +1 -0
  32. package/dist/cjs/types/components/InputOtp/InputOtp.d.ts +21 -0
  33. package/dist/cjs/types/components/InputOtp/index.d.ts +1 -0
  34. package/dist/cjs/types/components/InputPassword/InputPassword.d.ts +24 -0
  35. package/dist/cjs/types/components/InputPassword/index.d.ts +1 -0
  36. package/dist/cjs/types/components/InputSwitch/InputSwitch.d.ts +21 -0
  37. package/dist/cjs/types/components/InputSwitch/index.d.ts +1 -0
  38. package/dist/cjs/types/components/InputText/InputText.d.ts +24 -0
  39. package/dist/cjs/types/components/InputText/index.d.ts +1 -0
  40. package/dist/cjs/types/components/InputTextarea/InputTextarea.d.ts +23 -0
  41. package/dist/cjs/types/components/InputTextarea/index.d.ts +1 -0
  42. package/dist/cjs/types/components/Knob/Knob.d.ts +21 -0
  43. package/dist/cjs/types/components/Knob/index.d.ts +1 -0
  44. package/dist/cjs/types/components/ListBox/ListBox.d.ts +21 -0
  45. package/dist/cjs/types/components/ListBox/index.d.ts +1 -0
  46. package/dist/cjs/types/components/Mention/Mention.d.ts +24 -0
  47. package/dist/cjs/types/components/Mention/index.d.ts +1 -0
  48. package/dist/cjs/types/components/MultiSelect/MultiSelect.d.ts +24 -0
  49. package/dist/cjs/types/components/MultiSelect/index.d.ts +1 -0
  50. package/dist/cjs/types/components/MultiStateCheckbox/MultiStateCheckbox.d.ts +21 -0
  51. package/dist/cjs/types/components/MultiStateCheckbox/index.d.ts +1 -0
  52. package/dist/cjs/types/components/RadioGroup/RadioGroup.d.ts +24 -0
  53. package/dist/cjs/types/components/RadioGroup/index.d.ts +1 -0
  54. package/dist/cjs/types/components/Rating/Rating.d.ts +21 -0
  55. package/dist/cjs/types/components/Rating/index.d.ts +1 -0
  56. package/dist/cjs/types/components/SelectButton/SelectButton.d.ts +21 -0
  57. package/dist/cjs/types/components/SelectButton/index.d.ts +1 -0
  58. package/dist/cjs/types/components/Slider/Slider.d.ts +21 -0
  59. package/dist/cjs/types/components/Slider/index.d.ts +1 -0
  60. package/dist/cjs/types/components/ToggleButton/ToggleButton.d.ts +21 -0
  61. package/dist/cjs/types/components/ToggleButton/index.d.ts +1 -0
  62. package/dist/cjs/types/components/TreeSelect/TreeSelect.d.ts +24 -0
  63. package/dist/cjs/types/components/TreeSelect/index.d.ts +1 -0
  64. package/dist/cjs/types/components/TriStateCheckbox/TriStateCheckbox.d.ts +21 -0
  65. package/dist/cjs/types/components/TriStateCheckbox/index.d.ts +1 -0
  66. package/dist/cjs/types/components22/Button/Button.d.ts +7 -0
  67. package/dist/cjs/types/components22/Button/index.d.ts +2 -0
  68. package/dist/cjs/types/hooks/index.d.ts +3 -0
  69. package/dist/cjs/types/hooks/useApplyConfig.d.ts +17 -0
  70. package/dist/cjs/types/hooks/useFormContext.d.ts +2 -0
  71. package/dist/cjs/types/hooks/usePowellConfig.d.ts +2 -0
  72. package/dist/cjs/types/index.d.ts +1 -1
  73. package/dist/cjs/types/models/common.d.ts +7 -0
  74. package/dist/cjs/types/models/config.d.ts +13 -0
  75. package/dist/cjs/types/models/forms.d.ts +28 -0
  76. package/dist/cjs/types/models/index.d.ts +3 -0
  77. package/dist/cjs/types/utils/globalState.d.ts +19 -0
  78. package/dist/cjs/types/utils/index.d.ts +2 -0
  79. package/dist/cjs/types/utils/utilsService.d.ts +8 -0
  80. package/dist/esm/index.js +36893 -59
  81. package/dist/esm/index.js.map +1 -1
  82. package/dist/esm/types/api/PowellProvider.d.ts +5 -0
  83. package/dist/esm/types/api/configService.d.ts +2 -0
  84. package/dist/esm/types/api/forms.d.ts +73 -0
  85. package/dist/esm/types/api/index.d.ts +5 -0
  86. package/dist/esm/types/api/powellDefaults.d.ts +2 -0
  87. package/dist/esm/types/api/primereact.d.ts +981 -0
  88. package/dist/esm/types/components/AutoComplete/AutoComplete.d.ts +24 -0
  89. package/dist/esm/types/components/AutoComplete/index.d.ts +1 -0
  90. package/dist/esm/types/components/Button/Button.d.ts +21 -6
  91. package/dist/esm/types/components/Button/index.d.ts +1 -2
  92. package/dist/esm/types/components/CascadeSelect/CascadeSelect.d.ts +24 -0
  93. package/dist/esm/types/components/CascadeSelect/index.d.ts +1 -0
  94. package/dist/esm/types/components/Checkbox/Checkbox.d.ts +21 -0
  95. package/dist/esm/types/components/Checkbox/index.d.ts +1 -0
  96. package/dist/esm/types/components/Chips/Chips.d.ts +24 -0
  97. package/dist/esm/types/components/Chips/index.d.ts +1 -0
  98. package/dist/esm/types/components/ColorPicker/ColorPicker.d.ts +24 -0
  99. package/dist/esm/types/components/ColorPicker/index.d.ts +1 -0
  100. package/dist/esm/types/components/Dropdown/Dropdown.d.ts +24 -0
  101. package/dist/esm/types/components/Dropdown/index.d.ts +1 -0
  102. package/dist/esm/types/components/Editor/Editor.d.ts +23 -0
  103. package/dist/esm/types/components/Editor/index.d.ts +1 -0
  104. package/dist/esm/types/components/FormContainer/FormContainer.d.ts +7 -0
  105. package/dist/esm/types/components/FormContainer/FormContext.d.ts +4 -0
  106. package/dist/esm/types/components/FormContainer/index.d.ts +2 -0
  107. package/dist/esm/types/components/InputMask/InputMask.d.ts +24 -0
  108. package/dist/esm/types/components/InputMask/index.d.ts +1 -0
  109. package/dist/esm/types/components/InputNumber/InputNumber.d.ts +24 -0
  110. package/dist/esm/types/components/InputNumber/index.d.ts +1 -0
  111. package/dist/esm/types/components/InputOtp/InputOtp.d.ts +21 -0
  112. package/dist/esm/types/components/InputOtp/index.d.ts +1 -0
  113. package/dist/esm/types/components/InputPassword/InputPassword.d.ts +24 -0
  114. package/dist/esm/types/components/InputPassword/index.d.ts +1 -0
  115. package/dist/esm/types/components/InputSwitch/InputSwitch.d.ts +21 -0
  116. package/dist/esm/types/components/InputSwitch/index.d.ts +1 -0
  117. package/dist/esm/types/components/InputText/InputText.d.ts +24 -0
  118. package/dist/esm/types/components/InputText/index.d.ts +1 -0
  119. package/dist/esm/types/components/InputTextarea/InputTextarea.d.ts +23 -0
  120. package/dist/esm/types/components/InputTextarea/index.d.ts +1 -0
  121. package/dist/esm/types/components/Knob/Knob.d.ts +21 -0
  122. package/dist/esm/types/components/Knob/index.d.ts +1 -0
  123. package/dist/esm/types/components/ListBox/ListBox.d.ts +21 -0
  124. package/dist/esm/types/components/ListBox/index.d.ts +1 -0
  125. package/dist/esm/types/components/Mention/Mention.d.ts +24 -0
  126. package/dist/esm/types/components/Mention/index.d.ts +1 -0
  127. package/dist/esm/types/components/MultiSelect/MultiSelect.d.ts +24 -0
  128. package/dist/esm/types/components/MultiSelect/index.d.ts +1 -0
  129. package/dist/esm/types/components/MultiStateCheckbox/MultiStateCheckbox.d.ts +21 -0
  130. package/dist/esm/types/components/MultiStateCheckbox/index.d.ts +1 -0
  131. package/dist/esm/types/components/RadioGroup/RadioGroup.d.ts +24 -0
  132. package/dist/esm/types/components/RadioGroup/index.d.ts +1 -0
  133. package/dist/esm/types/components/Rating/Rating.d.ts +21 -0
  134. package/dist/esm/types/components/Rating/index.d.ts +1 -0
  135. package/dist/esm/types/components/SelectButton/SelectButton.d.ts +21 -0
  136. package/dist/esm/types/components/SelectButton/index.d.ts +1 -0
  137. package/dist/esm/types/components/Slider/Slider.d.ts +21 -0
  138. package/dist/esm/types/components/Slider/index.d.ts +1 -0
  139. package/dist/esm/types/components/ToggleButton/ToggleButton.d.ts +21 -0
  140. package/dist/esm/types/components/ToggleButton/index.d.ts +1 -0
  141. package/dist/esm/types/components/TreeSelect/TreeSelect.d.ts +24 -0
  142. package/dist/esm/types/components/TreeSelect/index.d.ts +1 -0
  143. package/dist/esm/types/components/TriStateCheckbox/TriStateCheckbox.d.ts +21 -0
  144. package/dist/esm/types/components/TriStateCheckbox/index.d.ts +1 -0
  145. package/dist/esm/types/components22/Button/Button.d.ts +7 -0
  146. package/dist/esm/types/components22/Button/index.d.ts +2 -0
  147. package/dist/esm/types/hooks/index.d.ts +3 -0
  148. package/dist/esm/types/hooks/useApplyConfig.d.ts +17 -0
  149. package/dist/esm/types/hooks/useFormContext.d.ts +2 -0
  150. package/dist/esm/types/hooks/usePowellConfig.d.ts +2 -0
  151. package/dist/esm/types/index.d.ts +1 -1
  152. package/dist/esm/types/models/common.d.ts +7 -0
  153. package/dist/esm/types/models/config.d.ts +13 -0
  154. package/dist/esm/types/models/forms.d.ts +28 -0
  155. package/dist/esm/types/models/index.d.ts +3 -0
  156. package/dist/esm/types/utils/globalState.d.ts +19 -0
  157. package/dist/esm/types/utils/index.d.ts +2 -0
  158. package/dist/esm/types/utils/utilsService.d.ts +8 -0
  159. package/dist/index.d.ts +22 -7
  160. package/package.json +1 -1
  161. /package/dist/cjs/types/{components → components22}/Input/Input.d.ts +0 -0
  162. /package/dist/cjs/types/{components → components22}/Input/index.d.ts +0 -0
  163. /package/dist/cjs/types/{components → components22}/index.d.ts +0 -0
  164. /package/dist/esm/types/{components → components22}/Input/Input.d.ts +0 -0
  165. /package/dist/esm/types/{components → components22}/Input/index.d.ts +0 -0
  166. /package/dist/esm/types/{components → components22}/index.d.ts +0 -0
@@ -0,0 +1,21 @@
1
+ import { ChangeEvent, ReactNode } from "react";
2
+ import { FixLabelPosition } from "@models";
3
+ import { $SelectButtonProps } from "@api";
4
+ import { SafeAny } from "@models";
5
+ import './SelectButton.scss';
6
+ interface SelectButtonProps extends Omit<$SelectButtonProps, 'checked'> {
7
+ checked?: boolean;
8
+ name?: string;
9
+ parseError?: (error: string) => ReactNode;
10
+ transform?: {
11
+ input?: (value: SafeAny) => string;
12
+ output?: (event: ChangeEvent<HTMLInputElement>) => SafeAny;
13
+ };
14
+ showRequiredStar?: boolean;
15
+ rtl?: boolean;
16
+ label?: string;
17
+ hint?: string;
18
+ labelPosition?: FixLabelPosition;
19
+ }
20
+ export declare const SelectButton: (props: SelectButtonProps) => import("react/jsx-runtime").JSX.Element;
21
+ export {};
@@ -0,0 +1 @@
1
+ export * from "./SelectButton";
@@ -0,0 +1,21 @@
1
+ import { ChangeEvent, ReactNode } from "react";
2
+ import { FixLabelPosition } from "@models";
3
+ import { $SliderProps } from "@api";
4
+ import { SafeAny } from "@models";
5
+ import './Slider.scss';
6
+ interface SliderProps extends Omit<$SliderProps, 'checked'> {
7
+ checked?: boolean;
8
+ name?: string;
9
+ parseError?: (error: string) => ReactNode;
10
+ transform?: {
11
+ input?: (value: SafeAny) => string;
12
+ output?: (event: ChangeEvent<HTMLInputElement>) => SafeAny;
13
+ };
14
+ showRequiredStar?: boolean;
15
+ rtl?: boolean;
16
+ label?: string;
17
+ hint?: string;
18
+ labelPosition?: FixLabelPosition;
19
+ }
20
+ export declare const Slider: (props: SliderProps) => import("react/jsx-runtime").JSX.Element;
21
+ export {};
@@ -0,0 +1 @@
1
+ export * from "./Slider";
@@ -0,0 +1,21 @@
1
+ import { ChangeEvent, ReactNode } from "react";
2
+ import { FixLabelPosition } from "@models";
3
+ import { $ToggleButtonProps } from "@api";
4
+ import { SafeAny } from "@models";
5
+ import './ToggleButton.scss';
6
+ interface ToggleButtonProps extends Omit<$ToggleButtonProps, 'checked'> {
7
+ checked?: boolean;
8
+ name?: string;
9
+ parseError?: (error: string) => ReactNode;
10
+ transform?: {
11
+ input?: (value: SafeAny) => string;
12
+ output?: (event: ChangeEvent<HTMLInputElement>) => SafeAny;
13
+ };
14
+ showRequiredStar?: boolean;
15
+ rtl?: boolean;
16
+ label?: string;
17
+ hint?: string;
18
+ labelPosition?: FixLabelPosition;
19
+ }
20
+ export declare const ToggleButton: (props: ToggleButtonProps) => import("react/jsx-runtime").JSX.Element;
21
+ export {};
@@ -0,0 +1 @@
1
+ export * from "./ToggleButton";
@@ -0,0 +1,24 @@
1
+ import { ChangeEvent, ReactNode } from "react";
2
+ import { Addon, LabelPosition, Size } from "@models";
3
+ import { $IconFieldProps, $TreeSelectProps } from "@api";
4
+ import { SafeAny } from "@models";
5
+ import './TreeSelect.scss';
6
+ interface TreeSelectProps extends $TreeSelectProps {
7
+ name?: string;
8
+ parseError?: (error: string) => ReactNode;
9
+ transform?: {
10
+ input?: (value: SafeAny) => string;
11
+ output?: (event: ChangeEvent<HTMLInputElement>) => SafeAny;
12
+ };
13
+ showRequiredStar?: boolean;
14
+ rtl?: boolean;
15
+ label?: string;
16
+ icon?: string | ReactNode;
17
+ hint?: string;
18
+ inputSize?: Size;
19
+ addon?: Addon;
20
+ iconPosition?: $IconFieldProps["iconPosition"];
21
+ labelPosition?: LabelPosition;
22
+ }
23
+ export declare const TreeSelect: (props: TreeSelectProps) => import("react/jsx-runtime").JSX.Element;
24
+ export {};
@@ -0,0 +1 @@
1
+ export * from "./TreeSelect";
@@ -0,0 +1,21 @@
1
+ import { ChangeEvent, ReactNode } from "react";
2
+ import { FixLabelPosition } from "@models";
3
+ import { $TriStateCheckboxProps } from "@api";
4
+ import { SafeAny } from "@models";
5
+ import './TriStateCheckbox.scss';
6
+ interface TriStateCheckboxProps extends Omit<$TriStateCheckboxProps, 'checked'> {
7
+ checked?: boolean;
8
+ name?: string;
9
+ parseError?: (error: string) => ReactNode;
10
+ transform?: {
11
+ input?: (value: SafeAny) => string;
12
+ output?: (event: ChangeEvent<HTMLInputElement>) => SafeAny;
13
+ };
14
+ showRequiredStar?: boolean;
15
+ rtl?: boolean;
16
+ label?: string;
17
+ hint?: string;
18
+ labelPosition?: FixLabelPosition;
19
+ }
20
+ export declare const TriStateCheckbox: (props: TriStateCheckboxProps) => import("react/jsx-runtime").JSX.Element;
21
+ export {};
@@ -0,0 +1 @@
1
+ export * from "./TriStateCheckbox";
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ import "./Button.css";
3
+ export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
4
+ variant?: "primary" | "secondary";
5
+ }
6
+ declare const Button: React.FC<ButtonProps>;
7
+ export default Button;
@@ -0,0 +1,2 @@
1
+ import Button from "./Button";
2
+ export default Button;
@@ -0,0 +1,3 @@
1
+ export * from "./useApplyConfig";
2
+ export * from "./useFormContext";
3
+ export * from "./usePowellConfig";
@@ -0,0 +1,17 @@
1
+ import { PowellConfig } from "@models";
2
+ interface ApplyConfigOptions {
3
+ isFixLabel?: boolean;
4
+ sizable?: boolean;
5
+ }
6
+ interface CommonConfigProps {
7
+ rtl?: PowellConfig["rtl"];
8
+ showRequiredStar?: PowellConfig["showRequiredStar"];
9
+ labelPosition?: PowellConfig["labelPosition"];
10
+ inputSize?: PowellConfig["inputSize"];
11
+ }
12
+ export declare const useApplyConfig: <T extends CommonConfigProps>(props: T, options?: ApplyConfigOptions) => T & {
13
+ rtl: boolean | undefined;
14
+ showRequiredStar: boolean | undefined;
15
+ labelPosition: import("@models").LabelPosition | undefined;
16
+ };
17
+ export {};
@@ -0,0 +1,2 @@
1
+ import { $FormikContextType, $FormikValues } from "@api";
2
+ export declare const useFormContext: () => $FormikContextType<$FormikValues> | null;
@@ -0,0 +1,2 @@
1
+ import { PowellConfig } from "@models";
2
+ export declare const usePowellConfig: () => [config: PowellConfig, (c: Partial<PowellConfig>) => any];
@@ -1 +1 @@
1
- export * from "./components";
1
+ export { Button } from "./components/Button";
@@ -0,0 +1,7 @@
1
+ export type ButtonAppearance = 'default' | 'text' | 'outlined' | 'link';
2
+ export type Direction = 'rtl' | 'ltr';
3
+ export type Size = 'sm' | 'md' | 'lg';
4
+ export type Orientation = 'horizontal' | 'vertical';
5
+ export type Position = 'left' | 'right' | 'top' | 'bottom';
6
+ export type Nullable<T = void> = T | null | undefined;
7
+ export type SafeAny = any;
@@ -0,0 +1,13 @@
1
+ import { $APIOptions } from "@api";
2
+ import { FixLabelPosition, LabelPosition, Size } from "@models";
3
+ export type ThemeName = "arya-blue" | "arya-green" | "arya-orange" | "arya-purple" | "bootstrap4-dark-blue" | "bootstrap4-dark-purple" | "bootstrap4-light-blue" | "bootstrap4-light-purple" | "fluent-light" | "lara-dark-amber" | "lara-dark-blue" | "lara-dark-cyan" | "lara-dark-green" | "lara-dark-indigo" | "lara-dark-pink" | "lara-dark-purple" | "lara-dark-teal" | "lara-light-amber" | "lara-light-blue" | "lara-light-cyan" | "lara-light-green" | "lara-light-indigo" | "lara-light-pink" | "lara-light-purple" | "lara-light-teal" | "luna-amber" | "luna-blue" | "luna-green" | "luna-pink" | "md-dark-deeppurple" | "md-dark-indigo" | "md-light-deeppurple" | "md-light-indigo" | "mdc-dark-deeppurple" | "mdc-dark-indigo" | "mdc-light-deeppurple" | "mdc-light-indigo" | "mira" | "nano" | "nova" | "nova-accent" | "nova-alt" | "rhea" | "saga-blue" | "saga-green" | "saga-orange" | "saga-purple" | "soho-dark" | "soho-light" | "tailwind-light" | "vela-blue" | "vela-green" | "vela-orange" | "vela-purple" | "viva-dark" | "viva-light";
4
+ type OmittedApiOptions = Omit<$APIOptions, "setAppendTo" | "setStyleContainer" | "setAutoZIndex" | "setCssTransition" | "setFilterMatchModeOptions" | "setHideOverlaysOnDocumentScrolling" | "setInputStyle" | "setLocale" | "setNonce" | "setNullSortOrder" | "setRipple" | "setZIndex" | "setPt" | "changeTheme">;
5
+ export interface PowellConfig extends OmittedApiOptions {
6
+ theme?: ThemeName;
7
+ rtl?: boolean;
8
+ showRequiredStar?: boolean;
9
+ inputSize?: Size;
10
+ labelPosition?: LabelPosition;
11
+ fixLabelPosition?: FixLabelPosition;
12
+ }
13
+ export {};
@@ -0,0 +1,28 @@
1
+ import { $ButtonProps } from "@api";
2
+ import { ButtonAppearance, Position, SafeAny } from "@models";
3
+ import { MouseEvent } from "react";
4
+ export type LabelPosition = 'float' | 'fix-side' | 'fix-top';
5
+ export type FixLabelPosition = Exclude<LabelPosition, 'float'>;
6
+ export type IconPosition = Exclude<Position, 'top' | 'bottom'>;
7
+ export interface AddonConfig {
8
+ type: 'button' | 'icon' | 'text';
9
+ label?: string;
10
+ severity?: $ButtonProps["severity"];
11
+ appearance?: ButtonAppearance;
12
+ icon?: string;
13
+ iconPosition?: IconPosition;
14
+ text?: string;
15
+ onClick?: (event: MouseEvent<HTMLElement>) => void;
16
+ }
17
+ export interface Addon {
18
+ before?: AddonConfig;
19
+ after?: AddonConfig;
20
+ }
21
+ export type TransformOptions<V = SafeAny, T = SafeAny> = {
22
+ value: V;
23
+ onChange: (...event: V[]) => void;
24
+ transform?: {
25
+ input?: (value: V) => SafeAny;
26
+ output?: (...event: T[]) => SafeAny;
27
+ };
28
+ };
@@ -0,0 +1,3 @@
1
+ export * from "./common";
2
+ export * from "./config";
3
+ export * from "./forms";
@@ -0,0 +1,19 @@
1
+ import { SetStateAction } from "react";
2
+ type Set<T> = (newState: SetStateAction<T>, callback?: (newState: T) => void) => void;
3
+ type UseSelector<T> = <TSelected = unknown>(selector: (state: T) => TSelected, equalityFn?: Comparator<TSelected>) => TSelected;
4
+ export interface StateWithValue<T> {
5
+ use: () => [T, Set<T>];
6
+ useValue: () => T;
7
+ get: () => T;
8
+ useSelector: UseSelector<T>;
9
+ set: Set<T>;
10
+ reset: () => void;
11
+ subscribe(subscriber: SubscriberFunc<T>): () => void;
12
+ }
13
+ type SubscriberFunc<T> = (newState: T, previousState: T) => void;
14
+ interface Options<T> {
15
+ onSet?: SubscriberFunc<T>;
16
+ }
17
+ type Comparator<TSelected = unknown> = (a: TSelected, b: TSelected) => boolean;
18
+ export declare function globalState<T>(initialValue: T, options?: Options<T>): StateWithValue<T>;
19
+ export {};
@@ -0,0 +1,2 @@
1
+ export * from "./globalState";
2
+ export * from "./utilsService";
@@ -0,0 +1,8 @@
1
+ import { AddonConfig, TransformOptions } from "@models";
2
+ import { $FormikContextType, $FormikValues } from "@api";
3
+ export declare const getAddonTemplate: (config?: AddonConfig) => import("react/jsx-runtime").JSX.Element;
4
+ export declare const isRequiredField: (formContext: $FormikContextType<$FormikValues> | null, name: string | undefined) => any;
5
+ export declare const transformer: <V = any, T = any>(options: TransformOptions<V, T>) => {
6
+ value: V;
7
+ onChange: (...event: T[]) => void;
8
+ };
package/dist/index.d.ts CHANGED
@@ -1,11 +1,26 @@
1
- import React from 'react';
1
+ import * as react from 'react';
2
+ import { MouseEvent } from 'react';
2
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
+ import { $ButtonProps } from '@api';
5
+ import { ButtonAppearance } from '@models';
3
6
 
4
- interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
5
- variant?: "primary" | "secondary";
7
+ type ButtonState = 'default' | 'loading' | 'next';
8
+ interface ButtonOnClickAsyncEvent {
9
+ loadingCallback: (ok?: boolean) => void;
10
+ event: MouseEvent<HTMLButtonElement>;
6
11
  }
7
- declare const Button: React.FC<ButtonProps>;
8
-
9
- declare const Input: () => react_jsx_runtime.JSX.Element;
12
+ interface ButtonProps extends Omit<$ButtonProps, "loading" | "link" | "text" | "outlined"> {
13
+ async?: boolean;
14
+ onClickAsync?: (event: ButtonOnClickAsyncEvent) => void;
15
+ appearance?: ButtonAppearance;
16
+ nextLabel?: string;
17
+ nextIcon?: string;
18
+ nextRaised?: boolean;
19
+ nextAppearance?: ButtonAppearance;
20
+ nextSeverity?: ButtonProps['severity'];
21
+ state?: ButtonState;
22
+ onStateChange?: (state: ButtonState) => void;
23
+ }
24
+ declare const Button: react.MemoExoticComponent<(props: ButtonProps) => react_jsx_runtime.JSX.Element>;
10
25
 
11
- export { Button, Input };
26
+ export { Button };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "powell-react",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/index.d.ts",