@webiny/ui 6.3.0-beta.1 → 6.3.0-beta.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/Input/Input.js +1 -1
- package/Input/Input.js.map +1 -1
- package/package.json +9 -7
package/Input/Input.js
CHANGED
package/Input/Input.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useCallback","useMemo","pick","Input","AdminInput","Textarea","AdminTextarea","rmwcProps","props","autoFocus","value","description","placeholder","rows","validation","icon","trailingIcon","onBlur","onChange","rawOnChange","required","inputRef","rest","inputValue","size","getValidIcon","isValidElement","undefined","
|
|
1
|
+
{"version":3,"names":["React","useCallback","useMemo","pick","Input","AdminInput","Textarea","AdminTextarea","rmwcProps","props","autoFocus","value","description","placeholder","rows","validation","icon","trailingIcon","onBlur","onChange","rawOnChange","required","inputRef","rest","inputValue","size","getValidIcon","isValidElement","undefined","createElement","Object","assign","className","forwardEventOnChange","textareaRef","startIcon","endIcon"],"sources":["Input.tsx"],"sourcesContent":["import type { ReactElement } from \"react\";\nimport React, { useCallback, useMemo } from \"react\";\nimport pick from \"lodash/pick.js\";\nimport type { FormComponentProps } from \"~/types.js\";\nimport { Input as AdminInput, Textarea as AdminTextarea } from \"@webiny/admin-ui\";\n\nexport interface TextFieldHelperTextProps {\n /** Make the help text always visible */\n persistent?: boolean;\n /** Make the help a validation message style */\n validationMsg?: boolean;\n /** Content for the help text */\n children: React.ReactNode;\n}\n\nexport interface TextFieldProps {\n /** Sets the value for controlled TextFields. */\n value?: string | number;\n /** Adds help text to the field */\n helpText?: React.ReactNode | TextFieldHelperTextProps;\n /** Shows the character count, must be used in conjunction with maxLength. */\n characterCount?: boolean;\n /** Makes the TextField visually invalid. This is sometimes automatically applied in cases where required or pattern is used. */\n invalid?: boolean;\n /** Makes the Textfield disabled. */\n disabled?: boolean;\n /** Makes the Textfield required. */\n required?: boolean;\n /** Outline the TextField. */\n outlined?: boolean;\n /** How to align the text inside the TextField. Defaults to 'start'. */\n align?: \"start\" | \"end\";\n /** A label for the input. */\n label?: React.ReactNode;\n /** The label floats automatically based on value, but you can use this prop for manual control. */\n floatLabel?: boolean;\n /** Makes a multiline TextField. */\n textarea?: boolean;\n /** Makes the TextField fullwidth. */\n fullwidth?: boolean;\n /** Add a leading icon. */\n icon?: any;\n /** Add a trailing icon. */\n trailingIcon?: any;\n /** By default, props spread to the input. These props are for the component's root container. */\n rootProps?: any;\n /** A reference to the native input or textarea. */\n inputRef?: React.Ref<HTMLInputElement | HTMLTextAreaElement | null>;\n /** The type of input field to render, search, number, etc */\n type?: string;\n /** Add prefix. */\n prefix?: string;\n /** Add suffix. */\n suffix?: string;\n /** Advanced: A reference to the MDCFoundation. */\n foundationRef?: any;\n /** Make textarea resizeable */\n resizeable?: boolean;\n}\n\nexport type InputProps<TValue = any> = FormComponentProps<TValue> &\n TextFieldProps & {\n // Should this input be filled with browser values\n autoComplete?: string;\n\n // If true, will pass native `event` to the `onChange` callback\n rawOnChange?: boolean;\n\n // Auto-focus input\n autoFocus?: boolean;\n\n // Input placeholder\n placeholder?: string;\n\n // Description beneath the input.\n description?: string | ReactElement;\n\n // Converts input into a text area with given number of rows.\n rows?: number;\n\n maxLength?: number;\n\n // A callback that is executed when input focus is lost.\n onBlur?: (e: React.SyntheticEvent<any>) => any;\n\n onKeyDown?: (e: React.SyntheticEvent<any>) => any;\n\n // A callback that gets triggered when the user presses the \"Enter\" key.\n onEnter?: () => any;\n\n // CSS class name\n className?: string;\n\n // For testing purposes.\n \"data-testid\"?: string;\n\n // Size - small, medium or large\n size?: \"small\" | \"medium\" | \"large\";\n\n children?: React.ReactNode;\n };\n\n/**\n * Use Input component to store short string values, like first name, last name, e-mail etc.\n * Additionally, with rows prop, it can also be turned into a text area, to store longer strings.\n */\n\n// IconProps directly passed to RMWC\nconst rmwcProps = [\n \"label\",\n \"type\",\n \"disabled\",\n \"readOnly\",\n \"placeholder\",\n \"onKeyDown\",\n \"onEnter\",\n \"onKeyPress\",\n \"onKeyUp\",\n \"onFocus\",\n \"className\",\n \"maxLength\",\n \"characterCount\",\n \"autoComplete\",\n \"maxLength\"\n];\n\n/**\n * @deprecated This component is deprecated and will be removed in future releases.\n * Please use the `Input` component from the `@webiny/admin-ui` package instead.\n */\nexport const Input = (props: InputProps) => {\n const {\n autoFocus,\n value,\n description,\n placeholder,\n rows,\n validation,\n icon,\n trailingIcon,\n onBlur,\n onChange,\n rawOnChange,\n required,\n inputRef,\n ...rest\n } = props;\n\n let inputValue = value;\n if (value === null || typeof value === \"undefined\") {\n inputValue = \"\";\n }\n\n const size = useMemo(() => {\n if (props.size === \"medium\") {\n return \"md\";\n }\n\n if (props.size === \"large\") {\n return \"lg\";\n }\n\n return \"lg\";\n }, [props.size]);\n\n const getValidIcon = useCallback((icon: React.ReactNode) => {\n if (React.isValidElement(icon)) {\n return icon;\n }\n\n return undefined;\n }, []);\n\n if (rows) {\n return (\n <AdminTextarea\n {...pick(rest, rmwcProps)}\n autoFocus={autoFocus}\n value={inputValue}\n onChange={onChange}\n placeholder={placeholder}\n size={size}\n className={\"webiny-ui-input\"}\n data-testid={props[\"data-testid\"]}\n validation={validation}\n description={description}\n required={required}\n rows={rows}\n forwardEventOnChange={rawOnChange}\n textareaRef={inputRef as React.Ref<HTMLTextAreaElement> | undefined}\n onBlur={onBlur}\n />\n );\n }\n\n return (\n <AdminInput\n {...pick(rest, rmwcProps)}\n autoFocus={autoFocus}\n value={inputValue}\n onChange={onChange}\n startIcon={getValidIcon(icon)}\n endIcon={getValidIcon(trailingIcon)}\n placeholder={placeholder}\n size={size}\n className={\"webiny-ui-input\"}\n data-testid={props[\"data-testid\"]}\n validation={validation}\n description={description}\n required={required}\n forwardEventOnChange={rawOnChange}\n inputRef={inputRef as React.Ref<HTMLInputElement> | undefined}\n onBlur={onBlur}\n />\n );\n};\n"],"mappings":"AACA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,OAAO,QAAQ,OAAO;A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"6.3.0-beta.
|
|
3
|
+
"version": "6.3.0-beta.3",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"
|
|
5
|
+
"exports": {
|
|
6
|
+
"./*": "./*"
|
|
7
|
+
},
|
|
6
8
|
"repository": {
|
|
7
9
|
"type": "git",
|
|
8
10
|
"url": "https://github.com/webiny/webiny-js.git"
|
|
@@ -16,16 +18,16 @@
|
|
|
16
18
|
"license": "MIT",
|
|
17
19
|
"dependencies": {
|
|
18
20
|
"@svgr/webpack": "8.1.0",
|
|
19
|
-
"@webiny/admin-ui": "6.3.0-beta.
|
|
20
|
-
"@webiny/utils": "6.3.0-beta.
|
|
21
|
+
"@webiny/admin-ui": "6.3.0-beta.3",
|
|
22
|
+
"@webiny/utils": "6.3.0-beta.3",
|
|
21
23
|
"classnames": "2.5.1",
|
|
22
24
|
"lodash": "4.18.1"
|
|
23
25
|
},
|
|
24
26
|
"devDependencies": {
|
|
25
27
|
"@emotion/babel-plugin": "11.13.5",
|
|
26
28
|
"@testing-library/react": "16.3.2",
|
|
27
|
-
"@webiny/build-tools": "6.3.0-beta.
|
|
28
|
-
"@webiny/validation": "6.3.0-beta.
|
|
29
|
+
"@webiny/build-tools": "6.3.0-beta.3",
|
|
30
|
+
"@webiny/validation": "6.3.0-beta.3",
|
|
29
31
|
"babel-loader": "10.1.1",
|
|
30
32
|
"execa": "5.1.1",
|
|
31
33
|
"ncp": "2.0.0",
|
|
@@ -49,5 +51,5 @@
|
|
|
49
51
|
]
|
|
50
52
|
}
|
|
51
53
|
},
|
|
52
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "e154ec3326903876c357d35422dc60d29e061419"
|
|
53
55
|
}
|