@sio-group/form-react 0.4.2 → 0.4.3

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/index.d.cts CHANGED
@@ -1,6 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import React, { CSSProperties, ComponentType, ComponentPropsWithoutRef, HTMLAttributes } from 'react';
3
3
  import { LayoutType, FormField, IconType, AcceptType, CaptureType, SpinnerVariant, SelectOption, Option, FieldConfigMap } from '@sio-group/form-types';
4
+ import { ButtonProps, LinkProps } from '@sio-group/ui-core';
4
5
  import { Properties } from 'csstype';
5
6
  import { ValidationRule } from '@sio-group/form-types/src/core/valudation-rule';
6
7
 
@@ -9,38 +10,6 @@ interface FormLayout {
9
10
  layout?: LayoutType;
10
11
  }
11
12
 
12
- type ButtonType = 'button' | 'submit' | 'reset';
13
- type Variant = 'primary' | 'secondary' | 'link';
14
- type Color = 'default' | 'error' | 'success' | 'warning' | 'info';
15
- type Size = 'sm' | 'md' | 'lg';
16
-
17
- type BaseUiProps = {
18
- variant?: Variant;
19
- label?: string | React.ReactNode;
20
- color?: Color;
21
- size?: Size;
22
- block?: boolean;
23
- loading?: boolean;
24
- disabled?: boolean;
25
- className?: string;
26
- ariaLabel?: string;
27
- style?: React.CSSProperties;
28
- children?: React.ReactNode;
29
- };
30
-
31
- type ButtonProps = BaseUiProps & {
32
- type?: ButtonType;
33
- onClick: (e: React.MouseEvent) => void;
34
- };
35
-
36
- type LinkProps = Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'onClick' | 'color'> &
37
- BaseUiProps & {
38
- to: string;
39
- navigate?: () => void;
40
- external?: boolean;
41
- onClick?: (e: React.MouseEvent) => void;
42
- };
43
-
44
13
  type FormContainerProps = ComponentPropsWithoutRef<'form'>;
45
14
  type ButtonContainerProps = HTMLAttributes<HTMLDivElement>;
46
15
 
@@ -196,71 +165,6 @@ declare const useForm: ({ disableWhenOffline }?: UseFormOptions) => {
196
165
  getField: (name: string) => FieldState | undefined;
197
166
  };
198
167
 
199
- /**
200
- * Button component for user interaction.
201
- *
202
- * @component
203
- * @example
204
- * // Primaire button
205
- * <Button label="Save" onClick={handleSave} />
206
- *
207
- * @example
208
- * // Submit button with loading state
209
- * <Button
210
- * type="submit"
211
- * label="Send"
212
- * variant="primary"
213
- * loading
214
- * />
215
- *
216
- * @example
217
- * // Button with icon and tekst
218
- * <Button type="button" onClick={handleClick}>
219
- * <Icon name="plus" />
220
- * <span>Add</span>
221
- * </Button>
222
- *
223
- * @example
224
- * // Error variant
225
- * <Button
226
- * type="button"
227
- * label="Delete"
228
- * variant="secondary"
229
- * color="error"
230
- * onClick={handleDelete}
231
- * />
232
- */
233
- declare const Button: React.FC<ButtonProps>;
234
-
235
- /**
236
- * Custom Link component for internal or external navigation
237
- *
238
- * @component
239
- * @example
240
- * // Internal link
241
- * <Link to="/dashboard" label="Dashboard" />
242
- *
243
- * @example
244
- * // External link
245
- * // external property is optional
246
- * // http(s), ftp, email and tel with automatically render as external
247
- * <Link to="https://example.com" label="Visit website" external />
248
- *
249
- * @example
250
- * // Link with loading state
251
- * <Link to="/profile" label="Profile" loading />
252
- *
253
- * @example
254
- * // Link with custom click handler en navigation
255
- * <Link
256
- * to="/settings"
257
- * label="Settings"
258
- * onClick={() => console.log('clicked')}
259
- * navigate={customNavigate}
260
- * />
261
- */
262
- declare const Link: React.FC<LinkProps>;
263
-
264
168
  declare const Checkbox: ({ value, onChange, name, id, label, required, setTouched, readOnly, disabled, icon, description, focused, errors, touched, type, className, style, }: FieldProps) => react_jsx_runtime.JSX.Element;
265
169
 
266
170
  declare const Input: React.MemoExoticComponent<(props: FieldProps) => react_jsx_runtime.JSX.Element>;
@@ -281,4 +185,4 @@ declare const Select: ({ value, onChange, options, multiple, name, id, placehold
281
185
 
282
186
  declare const Textarea: ({ value, onChange, rows, cols, name, id, placeholder, label, required, autocomplete, setTouched, setFocused, readOnly, disabled, icon, description, focused, errors, touched, type, className, style, }: TextareaFieldProps) => react_jsx_runtime.JSX.Element;
283
187
 
284
- export { Button, type ButtonProps, Checkbox, DateInput, type FieldProps, FileInput, Form, type FormConfig, type FormLayout, Input, Link, type LinkProps, NumberInput, Radio, RangeInput, Select, TextInput, Textarea, useForm };
188
+ export { Checkbox, DateInput, type FieldProps, FileInput, Form, type FormConfig, type FormLayout, Input, NumberInput, Radio, RangeInput, Select, TextInput, Textarea, useForm };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import React, { CSSProperties, ComponentType, ComponentPropsWithoutRef, HTMLAttributes } from 'react';
3
3
  import { LayoutType, FormField, IconType, AcceptType, CaptureType, SpinnerVariant, SelectOption, Option, FieldConfigMap } from '@sio-group/form-types';
4
+ import { ButtonProps, LinkProps } from '@sio-group/ui-core';
4
5
  import { Properties } from 'csstype';
5
6
  import { ValidationRule } from '@sio-group/form-types/src/core/valudation-rule';
6
7
 
@@ -9,38 +10,6 @@ interface FormLayout {
9
10
  layout?: LayoutType;
10
11
  }
11
12
 
12
- type ButtonType = 'button' | 'submit' | 'reset';
13
- type Variant = 'primary' | 'secondary' | 'link';
14
- type Color = 'default' | 'error' | 'success' | 'warning' | 'info';
15
- type Size = 'sm' | 'md' | 'lg';
16
-
17
- type BaseUiProps = {
18
- variant?: Variant;
19
- label?: string | React.ReactNode;
20
- color?: Color;
21
- size?: Size;
22
- block?: boolean;
23
- loading?: boolean;
24
- disabled?: boolean;
25
- className?: string;
26
- ariaLabel?: string;
27
- style?: React.CSSProperties;
28
- children?: React.ReactNode;
29
- };
30
-
31
- type ButtonProps = BaseUiProps & {
32
- type?: ButtonType;
33
- onClick: (e: React.MouseEvent) => void;
34
- };
35
-
36
- type LinkProps = Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'onClick' | 'color'> &
37
- BaseUiProps & {
38
- to: string;
39
- navigate?: () => void;
40
- external?: boolean;
41
- onClick?: (e: React.MouseEvent) => void;
42
- };
43
-
44
13
  type FormContainerProps = ComponentPropsWithoutRef<'form'>;
45
14
  type ButtonContainerProps = HTMLAttributes<HTMLDivElement>;
46
15
 
@@ -196,71 +165,6 @@ declare const useForm: ({ disableWhenOffline }?: UseFormOptions) => {
196
165
  getField: (name: string) => FieldState | undefined;
197
166
  };
198
167
 
199
- /**
200
- * Button component for user interaction.
201
- *
202
- * @component
203
- * @example
204
- * // Primaire button
205
- * <Button label="Save" onClick={handleSave} />
206
- *
207
- * @example
208
- * // Submit button with loading state
209
- * <Button
210
- * type="submit"
211
- * label="Send"
212
- * variant="primary"
213
- * loading
214
- * />
215
- *
216
- * @example
217
- * // Button with icon and tekst
218
- * <Button type="button" onClick={handleClick}>
219
- * <Icon name="plus" />
220
- * <span>Add</span>
221
- * </Button>
222
- *
223
- * @example
224
- * // Error variant
225
- * <Button
226
- * type="button"
227
- * label="Delete"
228
- * variant="secondary"
229
- * color="error"
230
- * onClick={handleDelete}
231
- * />
232
- */
233
- declare const Button: React.FC<ButtonProps>;
234
-
235
- /**
236
- * Custom Link component for internal or external navigation
237
- *
238
- * @component
239
- * @example
240
- * // Internal link
241
- * <Link to="/dashboard" label="Dashboard" />
242
- *
243
- * @example
244
- * // External link
245
- * // external property is optional
246
- * // http(s), ftp, email and tel with automatically render as external
247
- * <Link to="https://example.com" label="Visit website" external />
248
- *
249
- * @example
250
- * // Link with loading state
251
- * <Link to="/profile" label="Profile" loading />
252
- *
253
- * @example
254
- * // Link with custom click handler en navigation
255
- * <Link
256
- * to="/settings"
257
- * label="Settings"
258
- * onClick={() => console.log('clicked')}
259
- * navigate={customNavigate}
260
- * />
261
- */
262
- declare const Link: React.FC<LinkProps>;
263
-
264
168
  declare const Checkbox: ({ value, onChange, name, id, label, required, setTouched, readOnly, disabled, icon, description, focused, errors, touched, type, className, style, }: FieldProps) => react_jsx_runtime.JSX.Element;
265
169
 
266
170
  declare const Input: React.MemoExoticComponent<(props: FieldProps) => react_jsx_runtime.JSX.Element>;
@@ -281,4 +185,4 @@ declare const Select: ({ value, onChange, options, multiple, name, id, placehold
281
185
 
282
186
  declare const Textarea: ({ value, onChange, rows, cols, name, id, placeholder, label, required, autocomplete, setTouched, setFocused, readOnly, disabled, icon, description, focused, errors, touched, type, className, style, }: TextareaFieldProps) => react_jsx_runtime.JSX.Element;
283
187
 
284
- export { Button, type ButtonProps, Checkbox, DateInput, type FieldProps, FileInput, Form, type FormConfig, type FormLayout, Input, Link, type LinkProps, NumberInput, Radio, RangeInput, Select, TextInput, Textarea, useForm };
188
+ export { Checkbox, DateInput, type FieldProps, FileInput, Form, type FormConfig, type FormLayout, Input, NumberInput, Radio, RangeInput, Select, TextInput, Textarea, useForm };