@producteca/producteca-ui-kit 1.5.0-test.8 → 1.5.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 CHANGED
@@ -1,4 +1,6 @@
1
- # ⚛️⚡ Node + Vite + React + Typescript
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 SelectField instances**
50
-
51
- - Check for any existing version of `selectField`. If found, delete the file:
52
-
53
- ```bash
54
- app/components/form/selectField
55
-
56
- ```
57
-
58
- - Update any old imports to:
59
- ```bash
60
- import { SelectField } from "@producteca/producteca-ui-kit";
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;
@@ -7,6 +7,7 @@ interface CustomIconProps {
7
7
  size?: iconSize;
8
8
  sx?: SxProps<Theme>;
9
9
  children: ReactElement;
10
+ disabled?: boolean;
10
11
  }
11
12
  export declare const CustomIcon: React.FC<CustomIconProps>;
12
13
  export default CustomIcon;
@@ -1,5 +1,5 @@
1
1
  import { default as React, ChangeEvent } from 'react';
2
- import { Meta, inputValue } from '../../../validators';
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?: inputValue;
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: inputValue) => boolean;
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,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,12 @@
1
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 ";
2
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 ";
3
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 ";
4
- export declare const isOptionDisabled = " \n Funcion que recibe un valor de tipo SelectOption y deberia devolver un valor booleano\n Por ejemplo: (SelectOption) => SelectOption.value == 2\n \n ```typescript\n interface SelectOption {\n label: string;\n value: string | number;\n [key: string]: any;\n }\n ```\n ";
5
- export declare const selectFieldDescription = " \n Ejemplo de uso:\n \n ```typescript\n <SelectField\n name=\"productId\"\n options={[{ label: \"1\", value: 1 }, { label: \"2\", value: 2 }]}\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 ";
6
+ export declare const isOptionDisabled = " \n Funcion que recibe un valor de tipo SelectOption y deberia devolver un valor booleano\n Por ejemplo: (SelectOption) => SelectOption.value == 2\n Si la opci\u00F3n tiene definida un tooltipMessage se va a mostrar al hacer hover.\n \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 \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 ";
6
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 ";
7
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 ";
8
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 ";
9
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 ";
@@ -12,15 +12,22 @@ declare const _default: {
12
12
  selectRequiredText: string;
13
13
  exportedIcon: string;
14
14
  syncStockFromChannel: string;
15
+ add: string;
16
+ continue: string;
15
17
  hideSelectedOptionsExplainText: string;
16
18
  description: {
17
19
  onChangeSelectField: string;
20
+ onInputChange: string;
18
21
  onChangeCheckboxInput: string;
19
22
  onChangeInput: string;
20
23
  isOptionDisabled: string;
21
24
  selectField: {
22
25
  example: string;
23
26
  defaultValue: string;
27
+ disabled: string;
28
+ disabledOptions: string;
29
+ noOptions: string;
30
+ withIcon: string;
24
31
  };
25
32
  formField: {
26
33
  example: string;
@@ -33,6 +40,14 @@ declare const _default: {
33
40
  icons: {
34
41
  size: string;
35
42
  };
43
+ searcher: {
44
+ example: string;
45
+ exampleOption: string;
46
+ searchPlaceholder: string;
47
+ searchLabel: string;
48
+ noResults: string;
49
+ writeToSearch: string;
50
+ };
36
51
  };
37
52
  error: {
38
53
  required: string;