@producteca/producteca-ui-kit 1.5.0-test.9 → 1.6.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.
- package/README.md +34 -14
- package/dist/components/button/button.d.ts +7 -2
- package/dist/components/icons/customIcon/customIcon.d.ts +1 -0
- package/dist/components/inputs/formField/textInput.d.ts +3 -3
- package/dist/components/inputs/index.d.ts +1 -0
- package/dist/components/inputs/searcher/searcher.d.ts +21 -0
- package/dist/components/inputs/selectField/selectField.d.ts +10 -0
- package/dist/components/patterns/index.d.ts +1 -0
- package/dist/components/patterns/saveBar/saveBar.d.ts +26 -0
- package/dist/favicon.svg +22 -0
- package/dist/locales/description.d.ts +13 -9
- package/dist/locales/es.d.ts +29 -0
- package/dist/producteca-ui-kit.es.js +4221 -3959
- package/dist/producteca-ui-kit.umd.js +157 -61
- package/dist/style.css +1 -1
- package/dist/validators/validation.d.ts +3 -3
- package/package.json +6 -4
package/README.md
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Producteca UI Kit ⚛️⚡
|
|
2
|
+
|
|
3
|
+
> 📚 Documentation: [apps.producteca.com/producteca-ui-kit](https://apps.producteca.com/producteca-ui-kit)
|
|
2
4
|
|
|
3
5
|
## Features
|
|
4
6
|
|
|
@@ -46,19 +48,37 @@ Follow these steps to integrate and configure the `@producteca/producteca-ui-kit
|
|
|
46
48
|
|
|
47
49
|
```
|
|
48
50
|
|
|
49
|
-
3. **Remove old
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
51
|
+
3. **Remove old component instances**
|
|
52
|
+
For any component that has been moved to the UI kit (like SelectField, CheckboxInput, etc.), you need to:
|
|
53
|
+
|
|
54
|
+
- Remove the old component files from your project. For example:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
app/components/form/selectField
|
|
58
|
+
app/components/form/checkboxInput
|
|
59
|
+
# or any other component that has been moved to the UI kit
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
- Update your imports to use the components from the UI kit:
|
|
63
|
+
```typescript
|
|
64
|
+
import { SelectField, CheckboxInput /* other components */ } from '@producteca/producteca-ui-kit'
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
4. **Node 12 Compatibility**
|
|
68
|
+
If you're using Node 12 in your project, you'll need to update your Babel configuration to ensure compatibility. Follow these steps:
|
|
69
|
+
|
|
70
|
+
- Update your Babel dependencies to the following versions:
|
|
71
|
+
```json
|
|
72
|
+
{
|
|
73
|
+
"devDependencies": {
|
|
74
|
+
"@babel/core": "^7.23.9",
|
|
75
|
+
"@babel/preset-env": "^7.23.9",
|
|
76
|
+
"@babel/preset-react": "^7.23.3",
|
|
77
|
+
"@babel/preset-typescript": "^7.23.3"
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
- For a complete example of how to implement these changes, refer to this pull request: [Shopify Babel Update Example](https://github.com/Parsimotion/shopify/pull/279)
|
|
62
82
|
|
|
63
83
|
### Auto Publish
|
|
64
84
|
|
|
@@ -1,11 +1,16 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
|
|
1
3
|
interface ButtonProps {
|
|
2
4
|
label: string;
|
|
3
5
|
variant?: 'primary' | 'secondary' | 'success' | 'error';
|
|
4
6
|
outline?: boolean;
|
|
5
|
-
size?: 'sm' | 'lg';
|
|
7
|
+
size?: 'sm' | 'md' | 'lg';
|
|
6
8
|
type?: 'submit' | 'button' | 'reset';
|
|
9
|
+
disabled?: boolean;
|
|
7
10
|
onClick?: () => void;
|
|
11
|
+
rightAdornment?: React.ReactNode;
|
|
12
|
+
leftAdornment?: React.ReactNode;
|
|
8
13
|
}
|
|
9
|
-
export declare const Button: ({ type, variant, size, label, outline, ...props }: ButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export declare const Button: ({ type, variant, size, label, outline, leftAdornment, rightAdornment, ...props }: ButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
15
|
export type { ButtonProps };
|
|
11
16
|
export default Button;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { default as React, ChangeEvent } from 'react';
|
|
2
|
-
import { Meta,
|
|
2
|
+
import { Meta, InputValue } from '../../../validators';
|
|
3
3
|
|
|
4
4
|
export interface TextInputProps {
|
|
5
5
|
meta?: Meta;
|
|
@@ -7,7 +7,7 @@ export interface TextInputProps {
|
|
|
7
7
|
min?: number;
|
|
8
8
|
name: string;
|
|
9
9
|
noErrors?: boolean;
|
|
10
|
-
value?:
|
|
10
|
+
value?: InputValue;
|
|
11
11
|
disabled?: boolean;
|
|
12
12
|
required?: boolean;
|
|
13
13
|
placeholder?: string;
|
|
@@ -15,7 +15,7 @@ export interface TextInputProps {
|
|
|
15
15
|
size?: 'sm' | 'md' | 'lg';
|
|
16
16
|
leftIcon?: React.ReactNode;
|
|
17
17
|
rightIcon?: React.ReactNode;
|
|
18
|
-
isValid?: (value:
|
|
18
|
+
isValid?: (value: InputValue) => boolean;
|
|
19
19
|
type?: 'text' | 'number' | 'password' | undefined;
|
|
20
20
|
onChange: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
21
21
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { SelectOption } from '../selectField/selectField';
|
|
3
|
+
|
|
4
|
+
export interface SearcherProps {
|
|
5
|
+
name: string;
|
|
6
|
+
label?: string;
|
|
7
|
+
size?: 'md' | 'lg';
|
|
8
|
+
placeholder?: string;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
required?: boolean;
|
|
11
|
+
isClearable?: boolean;
|
|
12
|
+
isSearchable?: boolean;
|
|
13
|
+
options: SelectOption[];
|
|
14
|
+
noOptionsMessage?: string;
|
|
15
|
+
rightModifier?: React.ReactNode;
|
|
16
|
+
isOptionDisabled?: (option: SelectOption) => boolean;
|
|
17
|
+
defaultValue?: SelectOption;
|
|
18
|
+
onChange: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
19
|
+
onInputChange: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
20
|
+
}
|
|
21
|
+
export declare const Searcher: React.FC<SearcherProps>;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
+
import { OptionProps, SingleValueProps } from 'react-select';
|
|
2
3
|
|
|
3
4
|
export interface SelectOption {
|
|
4
5
|
label: string;
|
|
5
6
|
value: string | number;
|
|
7
|
+
tooltipMessage?: string;
|
|
6
8
|
[key: string]: any;
|
|
7
9
|
}
|
|
8
10
|
export type SelectOptionType = SelectOption[] | SelectOption | null;
|
|
@@ -26,5 +28,13 @@ export interface SelectFieldProps {
|
|
|
26
28
|
defaultValue?: (string | number) | (string | number)[] | null | undefined;
|
|
27
29
|
onChange: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
28
30
|
}
|
|
31
|
+
export declare const Option: (props: OptionProps<SelectOption>) => import("react/jsx-runtime").JSX.Element;
|
|
32
|
+
export declare const SingleValue: (props: SingleValueProps<SelectOption>) => import("react/jsx-runtime").JSX.Element;
|
|
33
|
+
export declare const SearchComponent: () => import("react/jsx-runtime").JSX.Element;
|
|
34
|
+
export declare const ClearComponent: ({ optionSelected, isClearable, handleChange, }: {
|
|
35
|
+
optionSelected?: SelectOptionType | undefined;
|
|
36
|
+
isClearable: boolean;
|
|
37
|
+
handleChange: (selected: SelectOptionType) => void;
|
|
38
|
+
}) => import("react/jsx-runtime").JSX.Element | null;
|
|
29
39
|
export declare const SelectField: React.FC<SelectFieldProps>;
|
|
30
40
|
export default SelectField;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
|
|
3
|
+
interface SaveButtonProps {
|
|
4
|
+
onSave: () => void;
|
|
5
|
+
label?: string;
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
}
|
|
8
|
+
interface CancelButtonProps {
|
|
9
|
+
onCancel: () => void;
|
|
10
|
+
label?: string;
|
|
11
|
+
[key: string]: any;
|
|
12
|
+
}
|
|
13
|
+
interface PreviousButtonProps {
|
|
14
|
+
onPrevious: () => void;
|
|
15
|
+
label?: string;
|
|
16
|
+
[key: string]: any;
|
|
17
|
+
}
|
|
18
|
+
interface SaveBarProps {
|
|
19
|
+
saveProps: SaveButtonProps;
|
|
20
|
+
cancelProps: CancelButtonProps;
|
|
21
|
+
previousProps?: PreviousButtonProps;
|
|
22
|
+
withoutBorder?: boolean;
|
|
23
|
+
}
|
|
24
|
+
export declare const SaveBar: React.FC<SaveBarProps>;
|
|
25
|
+
export type { SaveBarProps, SaveButtonProps, CancelButtonProps, PreviousButtonProps };
|
|
26
|
+
export default SaveBar;
|
package/dist/favicon.svg
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
3
|
+
<!-- Circular background -->
|
|
4
|
+
<circle cx="16" cy="16" r="16" fill="#0066FF"/>
|
|
5
|
+
|
|
6
|
+
<!-- UI Text with better visibility -->
|
|
7
|
+
<g transform="translate(16, 18)">
|
|
8
|
+
<text
|
|
9
|
+
x="0"
|
|
10
|
+
y="0"
|
|
11
|
+
text-anchor="middle"
|
|
12
|
+
dominant-baseline="middle"
|
|
13
|
+
fill="white"
|
|
14
|
+
font-family="Arial, sans-serif"
|
|
15
|
+
font-weight="900"
|
|
16
|
+
font-size="14"
|
|
17
|
+
letter-spacing="-0.5"
|
|
18
|
+
>
|
|
19
|
+
UI
|
|
20
|
+
</text>
|
|
21
|
+
</g>
|
|
22
|
+
</svg>
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
export declare const onChangeSelectField = "\n Callback que se dispara cuando cambia el valor del input.\n \n #### Par\u00E1metros\n event: `React.ChangeEvent<HTMLInputElement>`\n - `event.target.name`: El nombre del input.\n - `event.target.value`: El valor actual del input, que debe cumplir con la siguiente interfaz:\n \n ```typescript\n interface SelectOption {\n label: string;\n value: string | number;\n [key: string]: any;\n }\n ```\n
|
|
2
|
-
export declare const
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const
|
|
5
|
-
export declare const
|
|
6
|
-
export declare const
|
|
7
|
-
export declare const
|
|
8
|
-
export declare const
|
|
9
|
-
export declare const
|
|
1
|
+
export declare const onChangeSelectField = "\n Callback que se dispara cuando cambia el valor del input.\n \n #### Par\u00E1metros\n event: `React.ChangeEvent<HTMLInputElement>`\n - `event.target.name`: El nombre del input.\n - `event.target.value`: El valor actual del input, que debe cumplir con la siguiente interfaz:\n \n ```typescript\n interface SelectOption {\n label: string;\n value: string | number;\n [key: string]: any;\n }\n ```\n";
|
|
2
|
+
export declare const onInputChange = "\n Callback que se ejecuta cuando escribimos algo en el buscador.\n \n #### Par\u00E1metros\n event: `React.ChangeEvent<HTMLInputElement>`\n - `event.target.name`: El nombre del input.\n - `event.target.value`: El valor actual del input\n";
|
|
3
|
+
export declare const onChangeSearcher = "\n Callback que se ejecuta cuando seleccionamos una opcion del buscador.\n \n #### Par\u00E1metros\n event: `React.ChangeEvent<HTMLInputElement>`\n - `event.target.name`: El nombre del input.\n - `event.target.value`: El valor actual del input, que debe cumplir con la siguiente interfaz:\n \n ``` typescript\n interface SelectOption {\n label: string;\n value: string | number;\n [key: string]: any;\n }\n ```\n";
|
|
4
|
+
export declare const onChangeCheckboxInput = "\n Callback que se dispara cuando cambia el valor del input.\n \n #### Par\u00E1metros\n event: `React.ChangeEvent<HTMLInputElement>`\n - `event.target.name`: El nombre del input.\n - `event.target.value`: Siempre es \"on\"\n";
|
|
5
|
+
export declare const onChangeInput = "\n Callback que se dispara cuando cambia el valor del input.\n \n #### Par\u00E1metros\n event: `React.ChangeEvent<HTMLInputElement>`\n - `event.target.name`: El nombre del input.\n - `event.target.value`: El valor actual del input, que debe cumplir con la siguiente interfaz:\n \n ``` typescript\n value: string | number; \n ```\n";
|
|
6
|
+
export declare const isOptionDisabled = " \n Funcion que recibe un valor de tipo SelectOption y deberia devolver un valor booleano\n Si la opci\u00F3n tiene definida un tooltipMessage se va a mostrar al hacer hover.\n \n#### Ejemplo\n ``` typescript\n const isOptionDisabled = (option: SelectOption) => option.value === 2;\n ```\n \n #### Interfaz\n ```typescript\n interface SelectOption {\n label: string;\n value: string | number;\n tooltipMessage?: string;\n [key: string]: any;\n }\n ```\n";
|
|
7
|
+
export declare const selectFieldDescription = "\n #### Ejemplo de uso \n ```typescript\n <SelectField\n name=\"productId\"\n options={[{ label: \"1\", value: 1 }, { label: \"2\", value: 2, tooltipMessage: \"Este valor no es representativo\" }]}\n onChange={(event) => handleChange(event.target.name, event.target.value)}\n isMultiple\n isClearable={false}\n label={localize('product')}\n isOptionDisabled={(option) => option.value == 2}\n rightModifier={shouldShowLoader && <Spinner />}\n />\n ```\n";
|
|
8
|
+
export declare const formFieldExample = "\n #### Ejemplo de uso\n \n ``` typescript\n <FormField\n label=\"T\u00EDtulo\"\n name=\"textInput\"\n onChange={(event) => handleChange(event.target.name, event.target.value)}\n placeholder=\"Placeholder\"\n size=\"md\"\n type=\"text\"\n isValid={(inputValue) => _.isNumber(inputValue)}\n />\n ```\n";
|
|
9
|
+
export declare const isValidInput = "\n Funcion que recibe un valor de tipo inputValue y deberia devolver un valor booleano.\n \n #### Por ejemplo: (inputValue) => _.isNumber(inputValue)\n \n ``` typescript\n type inputValue = string | number; \n ```\n";
|
|
10
|
+
export declare const checkboxInputExample = "\n #### Ejemplo de uso\n \n ``` typescript\n <CheckboxInput\n items={[\n {\n id: '1',\n label: 'Opci\u00F3n 1'\n },\n {\n id: '2',\n label: 'Opci\u00F3n 2'\n },\n {\n disabled: true,\n id: '3',\n label: 'Opci\u00F3n 3'\n }\n ]}\n name=\"CheckboxList\"\n onChange={(event) => handleChange(event.target.name, event.target.value)}\n size=\"lg\"\n title=\"Selecciona una opci\u00F3n\"\n type=\"checkbox\"\n />\n ```\n";
|
|
11
|
+
export declare const singleCheckboxInputExample = " \n Versi\u00F3n con una sola opci\u00F3n tipo checkbox y un label personalizado:\n \n ```typescript\n const [checked, setChecked] = React.useState(false)\n <SingleCheckboxInput\n name=\"SingleToggle\"\n checked={checked}\n onChange={setChecked}\n label={\"Amazon\"}\n title={locale('syncStockFromChannel')}\n />\n ```\n";
|
|
12
|
+
export declare const searcherExample = " \n Note la diferencia entre onChange y onInputChange (oficia de onSearch):\n \n ```typescript\n <Searcher\n label=\"Search label\"\n name=\"Searcher\"\n onChange={(event) => onSelectOption(event.target.value)}\n onInputChange={(event) => handleSearch(event.target.value)}\n options={[{ label: 'text', value: 1 }]}\n />\n ```\n";
|
|
13
|
+
export declare const saveBarExample = "\n #### Uso b\u00E1sico\n ```typescript\n <SaveBar\n saveProps={{\n onSave: () => handleSave(),\n label: 'Save'\n }}\n cancelProps={{\n onCancel: () => handleCancel(),\n label: 'Cancel'\n }}\n />\n ```\n #### Con bot\u00F3n de navegaci\u00F3n\n ```typescript\n <SaveBar\n saveProps={{\n onSave: () => handleSave(),\n label: 'Save',\n variant: 'primary'\n }}\n cancelProps={{\n onCancel: () => handleCancel(),\n label: 'Cancel'\n }}\n previousProps={{\n onPrevious: () => handlePrevious(),\n label: 'Previous'\n }}\n />\n ```\n #### Ejemplo completo\n ```typescript\n <SaveBar\n saveProps={{\n onSave: () => handleSave(),\n label: 'Guardar cambios',\n variant: 'success',\n disabled: false,\n onClick: () => {},\n }}\n cancelProps={{\n onCancel: () => handleCancel(),\n label: 'Descartar',\n }}\n previousProps={{\n onPrevious: () => handlePrevious(),\n label: 'Anterior',\n variant: 'primary',\n outline: true,\n disabled: false,\n onClick: () => console.log('Previous clicked'),\n }}\n />\n ```\n";
|
package/dist/locales/es.d.ts
CHANGED
|
@@ -12,15 +12,36 @@ declare const _default: {
|
|
|
12
12
|
selectRequiredText: string;
|
|
13
13
|
exportedIcon: string;
|
|
14
14
|
syncStockFromChannel: string;
|
|
15
|
+
add: string;
|
|
16
|
+
previous: string;
|
|
17
|
+
continue: string;
|
|
18
|
+
cancel: string;
|
|
19
|
+
save: string;
|
|
15
20
|
hideSelectedOptionsExplainText: string;
|
|
16
21
|
description: {
|
|
17
22
|
onChangeSelectField: string;
|
|
23
|
+
onInputChange: string;
|
|
24
|
+
onChangeSearcher: string;
|
|
18
25
|
onChangeCheckboxInput: string;
|
|
19
26
|
onChangeInput: string;
|
|
20
27
|
isOptionDisabled: string;
|
|
21
28
|
selectField: {
|
|
22
29
|
example: string;
|
|
23
30
|
defaultValue: string;
|
|
31
|
+
disabled: string;
|
|
32
|
+
disabledOptions: string;
|
|
33
|
+
noOptions: string;
|
|
34
|
+
withIcon: string;
|
|
35
|
+
};
|
|
36
|
+
saveBar: {
|
|
37
|
+
example: string;
|
|
38
|
+
saveButton: string;
|
|
39
|
+
cancelButton: string;
|
|
40
|
+
previousButton: string;
|
|
41
|
+
saveButtonProps: string;
|
|
42
|
+
cancelButtonProps: string;
|
|
43
|
+
previousButtonProps: string;
|
|
44
|
+
withoutBorder: string;
|
|
24
45
|
};
|
|
25
46
|
formField: {
|
|
26
47
|
example: string;
|
|
@@ -33,6 +54,14 @@ declare const _default: {
|
|
|
33
54
|
icons: {
|
|
34
55
|
size: string;
|
|
35
56
|
};
|
|
57
|
+
searcher: {
|
|
58
|
+
example: string;
|
|
59
|
+
exampleOption: string;
|
|
60
|
+
searchPlaceholder: string;
|
|
61
|
+
searchLabel: string;
|
|
62
|
+
noResults: string;
|
|
63
|
+
writeToSearch: string;
|
|
64
|
+
};
|
|
36
65
|
};
|
|
37
66
|
error: {
|
|
38
67
|
required: string;
|