@zendeskgarden/react-forms 9.15.8 → 9.16.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/dist/esm/elements/Checkbox.js +1 -0
- package/dist/esm/elements/ClearableInput.js +111 -0
- package/dist/esm/elements/FileUpload.js +1 -0
- package/dist/esm/elements/Input.js +4 -2
- package/dist/esm/elements/MediaInput.js +1 -0
- package/dist/esm/elements/Radio.js +1 -0
- package/dist/esm/elements/Range.js +1 -0
- package/dist/esm/elements/Select.js +1 -0
- package/dist/esm/elements/Textarea.js +1 -0
- package/dist/esm/elements/Toggle.js +1 -0
- package/dist/esm/elements/common/Field.js +6 -2
- package/dist/esm/elements/common/Fieldset.js +1 -0
- package/dist/esm/elements/common/Hint.js +1 -0
- package/dist/esm/elements/common/Label.js +9 -1
- package/dist/esm/elements/common/Legend.js +1 -0
- package/dist/esm/elements/common/Message.js +1 -0
- package/dist/esm/elements/common/MessageIcon.js +1 -0
- package/dist/esm/elements/faux-input/FauxInput.js +1 -0
- package/dist/esm/elements/faux-input/components/EndIcon.js +1 -0
- package/dist/esm/elements/faux-input/components/StartIcon.js +1 -0
- package/dist/esm/elements/file-list/FileList.js +1 -0
- package/dist/esm/elements/file-list/components/Close.js +1 -0
- package/dist/esm/elements/file-list/components/Delete.js +1 -0
- package/dist/esm/elements/file-list/components/File.js +1 -0
- package/dist/esm/elements/file-list/components/Item.js +1 -0
- package/dist/esm/elements/input-group/InputGroup.js +26 -49
- package/dist/esm/elements/tiles/components/Description.js +1 -0
- package/dist/esm/elements/tiles/components/Icon.js +1 -0
- package/dist/esm/elements/tiles/components/Label.js +1 -0
- package/dist/esm/elements/tiles/components/Tile.js +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/x-stroke.svg.js +6 -6
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/x-stroke.svg.js +6 -6
- package/dist/esm/styled/checkbox/StyledCheckHint.js +1 -1
- package/dist/esm/styled/checkbox/StyledCheckInput.js +1 -1
- package/dist/esm/styled/checkbox/StyledCheckLabel.js +1 -1
- package/dist/esm/styled/checkbox/StyledCheckMessage.js +1 -1
- package/dist/esm/styled/checkbox/StyledCheckSvg.js +1 -1
- package/dist/esm/styled/checkbox/StyledDashSvg.js +1 -1
- package/dist/esm/styled/common/StyledField.js +1 -1
- package/dist/esm/styled/common/StyledFieldset.js +1 -1
- package/dist/esm/styled/common/StyledHint.js +1 -1
- package/dist/esm/styled/common/StyledLabel.js +1 -1
- package/dist/esm/styled/common/StyledLegend.js +1 -1
- package/dist/esm/styled/common/StyledMessage.js +1 -1
- package/dist/esm/styled/common/StyledMessageIcon.js +1 -1
- package/dist/esm/styled/file-list/StyledFile.js +1 -1
- package/dist/esm/styled/file-list/StyledFileClose.js +1 -1
- package/dist/esm/styled/file-list/StyledFileDelete.js +1 -1
- package/dist/esm/styled/file-list/StyledFileIcon.js +1 -1
- package/dist/esm/styled/file-list/StyledFileList.js +1 -1
- package/dist/esm/styled/file-list/StyledFileListItem.js +1 -1
- package/dist/esm/styled/file-upload/StyledFileUpload.js +1 -1
- package/dist/esm/styled/input-group/StyledClearableInput.js +16 -0
- package/dist/esm/styled/input-group/StyledInputGroup.js +97 -5
- package/dist/esm/styled/radio/StyledRadioHint.js +1 -1
- package/dist/esm/styled/radio/StyledRadioInput.js +1 -1
- package/dist/esm/styled/radio/StyledRadioLabel.js +1 -1
- package/dist/esm/styled/radio/StyledRadioMessage.js +1 -1
- package/dist/esm/styled/radio/StyledRadioSvg.js +1 -1
- package/dist/esm/styled/range/StyledRangeInput.js +1 -1
- package/dist/esm/styled/select/StyledSelect.js +1 -1
- package/dist/esm/styled/select/StyledSelectWrapper.js +1 -1
- package/dist/esm/styled/text/StyledTextFauxInput.js +1 -1
- package/dist/esm/styled/text/StyledTextInput.js +2 -2
- package/dist/esm/styled/text/StyledTextMediaFigure.js +1 -1
- package/dist/esm/styled/text/StyledTextMediaInput.js +1 -1
- package/dist/esm/styled/text/StyledTextarea.js +1 -1
- package/dist/esm/styled/tiles/StyledTile.js +1 -1
- package/dist/esm/styled/tiles/StyledTileDescription.js +1 -1
- package/dist/esm/styled/tiles/StyledTileIcon.js +1 -1
- package/dist/esm/styled/tiles/StyledTileLabel.js +1 -1
- package/dist/esm/styled/toggle/StyledToggleHint.js +1 -1
- package/dist/esm/styled/toggle/StyledToggleInput.js +1 -1
- package/dist/esm/styled/toggle/StyledToggleLabel.js +1 -1
- package/dist/esm/styled/toggle/StyledToggleMessage.js +1 -1
- package/dist/esm/styled/toggle/StyledToggleSvg.js +1 -1
- package/dist/esm/utils/useInputGroupContext.js +53 -2
- package/dist/index.cjs.js +362 -91
- package/dist/typings/elements/ClearableInput.d.ts +12 -0
- package/dist/typings/index.d.ts +3 -1
- package/dist/typings/styled/index.d.ts +1 -0
- package/dist/typings/styled/input-group/StyledClearableInput.d.ts +12 -0
- package/dist/typings/styled/input-group/StyledInputGroup.d.ts +4 -0
- package/dist/typings/types/index.d.ts +22 -3
- package/dist/typings/utils/useFieldContext.d.ts +2 -0
- package/dist/typings/utils/useInputGroupContext.d.ts +22 -0
- package/package.json +4 -3
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import { IClearableInputProps } from '../types';
|
|
9
|
+
/**
|
|
10
|
+
* @extends InputHTMLAttributes<HTMLInputElement>
|
|
11
|
+
*/
|
|
12
|
+
export declare const ClearableInput: React.ForwardRefExoticComponent<IClearableInputProps & React.RefAttributes<HTMLInputElement>>;
|
package/dist/typings/index.d.ts
CHANGED
|
@@ -22,6 +22,8 @@ export { Select } from './elements/Select';
|
|
|
22
22
|
export { Tiles } from './elements/tiles/Tiles';
|
|
23
23
|
/** Input Group */
|
|
24
24
|
export { InputGroup } from './elements/input-group/InputGroup';
|
|
25
|
+
/** Clearable Input */
|
|
26
|
+
export { ClearableInput } from './elements/ClearableInput';
|
|
25
27
|
/** File Upload */
|
|
26
28
|
export { FileUpload } from './elements/FileUpload';
|
|
27
29
|
/** File List */
|
|
@@ -31,4 +33,4 @@ export { File } from './elements/file-list/components/File';
|
|
|
31
33
|
export { FauxInput } from './elements/faux-input/FauxInput';
|
|
32
34
|
export { MediaInput } from './elements/MediaInput';
|
|
33
35
|
/** types */
|
|
34
|
-
export { VALIDATION, type IFieldsetProps, type ILabelProps, type IMessageProps, type ICheckboxProps, type IRadioProps, type IToggleProps, type IInputProps, type ITextareaProps, type ISelectProps, type IFileUploadProps, type IFileProps, type IRangeProps, type IInputGroupProps, type ITilesProps, type ITilesTileProps, type IFauxInputProps, type IFauxInputIconProps as IFauxInputStartIconProps, type IFauxInputIconProps as IFauxInputEndIconProps, type IMediaInputProps } from './types';
|
|
36
|
+
export { VALIDATION, type IFieldsetProps, type ILabelProps, type IMessageProps, type ICheckboxProps, type IRadioProps, type IToggleProps, type IInputProps, type ITextareaProps, type ISelectProps, type IFileUploadProps, type IFileProps, type IRangeProps, type IInputGroupProps, type IClearableInputProps, type ITilesProps, type ITilesTileProps, type IFauxInputProps, type IFauxInputIconProps as IFauxInputStartIconProps, type IFauxInputIconProps as IFauxInputEndIconProps, type IMediaInputProps } from './types';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
export interface IStyledClearableInputProps {
|
|
8
|
+
$isBare?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare const StyledClearableInput: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<Omit<import("../..").IInputGroupProps & import("react").RefAttributes<HTMLDivElement>, "ref"> & {
|
|
11
|
+
ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
12
|
+
}, IStyledClearableInputProps>> & string & Omit<import("react").ForwardRefExoticComponent<import("../..").IInputGroupProps & import("react").RefAttributes<HTMLDivElement>>, keyof import("react").Component<any, {}, any>>;
|
|
@@ -4,8 +4,12 @@
|
|
|
4
4
|
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
5
|
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
6
|
*/
|
|
7
|
+
import { Validation } from '../../types';
|
|
7
8
|
interface IStyledInputGroupProps {
|
|
8
9
|
$isCompact?: boolean;
|
|
10
|
+
$isUnified?: boolean;
|
|
11
|
+
$focusInset?: boolean;
|
|
12
|
+
$validation?: Validation;
|
|
9
13
|
}
|
|
10
14
|
export declare const StyledInputGroup: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("styled-components").FastOmit<import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
11
15
|
ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
5
|
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
6
|
*/
|
|
7
|
-
import { FieldsetHTMLAttributes, HTMLAttributes, InputHTMLAttributes, LabelHTMLAttributes, ReactElement, SelectHTMLAttributes, SVGAttributes, TextareaHTMLAttributes } from 'react';
|
|
7
|
+
import { FieldsetHTMLAttributes, HTMLAttributes, InputHTMLAttributes, LabelHTMLAttributes, ReactElement, Ref, SelectHTMLAttributes, SVGAttributes, TextareaHTMLAttributes } from 'react';
|
|
8
|
+
import { IIconButtonProps } from '@zendeskgarden/react-buttons';
|
|
8
9
|
export declare const VALIDATION: readonly ["success", "warning", "error"];
|
|
9
10
|
export declare const FILE_VALIDATION: readonly ["success", "error"];
|
|
10
11
|
export declare const FILE_TYPE: readonly ["pdf", "zip", "image", "document", "spreadsheet", "presentation", "generic"];
|
|
@@ -16,6 +17,10 @@ export interface IFieldsetProps extends FieldsetHTMLAttributes<HTMLFieldSetEleme
|
|
|
16
17
|
isCompact?: boolean;
|
|
17
18
|
}
|
|
18
19
|
export interface IInputGroupProps extends Pick<IFieldsetProps, 'isCompact'>, HTMLAttributes<HTMLDivElement> {
|
|
20
|
+
/** Applies unified styling so the group is bordered/focused as a single field */
|
|
21
|
+
isUnified?: boolean;
|
|
22
|
+
/** Insets the container's own `isUnified` focus ring, e.g. when nested inside another group */
|
|
23
|
+
focusInset?: boolean;
|
|
19
24
|
}
|
|
20
25
|
export interface ILabelProps extends LabelHTMLAttributes<HTMLLabelElement> {
|
|
21
26
|
/** Applies regular (non-bold) font weight */
|
|
@@ -54,14 +59,28 @@ export interface IInputProps extends IRadioProps {
|
|
|
54
59
|
/** Applies validation state styling */
|
|
55
60
|
validation?: Validation;
|
|
56
61
|
}
|
|
62
|
+
export interface IClearableInputProps extends Omit<IInputProps, 'value' | 'defaultValue'> {
|
|
63
|
+
/** Sets the input's value */
|
|
64
|
+
value?: string;
|
|
65
|
+
/** Sets the input's default value */
|
|
66
|
+
defaultValue?: string;
|
|
67
|
+
/** Defines the clear button's `aria-label` */
|
|
68
|
+
clearButtonLabel?: string;
|
|
69
|
+
/** Applies props to the wrapping InputGroup element */
|
|
70
|
+
wrapperProps?: Omit<IInputGroupProps, 'children' | 'isUnified' | 'isCompact'>;
|
|
71
|
+
/** Applies a ref to the wrapping InputGroup element */
|
|
72
|
+
wrapperRef?: Ref<HTMLDivElement>;
|
|
73
|
+
/** Applies props to the clear IconButton element */
|
|
74
|
+
buttonProps?: IIconButtonProps;
|
|
75
|
+
}
|
|
57
76
|
export interface IMediaInputProps extends IInputProps {
|
|
58
77
|
/** Accepts a "start" icon to display */
|
|
59
78
|
start?: ReactElement;
|
|
60
79
|
/** Accepts an "end" icon to display */
|
|
61
80
|
end?: ReactElement;
|
|
62
|
-
/** Applies props to the wrapping
|
|
81
|
+
/** Applies props to the wrapping FauxInput element */
|
|
63
82
|
wrapperProps?: any;
|
|
64
|
-
/** Applies a ref to the wrapping
|
|
83
|
+
/** Applies a ref to the wrapping FauxInput element */
|
|
65
84
|
wrapperRef?: any;
|
|
66
85
|
}
|
|
67
86
|
export interface IFauxInputProps extends Pick<IInputProps, 'isCompact' | 'isBare' | 'focusInset' | 'validation'>, HTMLAttributes<HTMLDivElement> {
|
|
@@ -15,6 +15,8 @@ interface IFieldContext extends IUseFieldReturnValue {
|
|
|
15
15
|
hasHint: boolean;
|
|
16
16
|
setHasMessage: (messagePresent: boolean) => void;
|
|
17
17
|
hasMessage: boolean;
|
|
18
|
+
setHasLabel: (labelPresent: boolean) => void;
|
|
19
|
+
hasLabel: boolean;
|
|
18
20
|
}
|
|
19
21
|
export declare const FieldContext: import("react").Context<IFieldContext | undefined>;
|
|
20
22
|
/**
|
|
@@ -4,12 +4,34 @@
|
|
|
4
4
|
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
5
|
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
6
|
*/
|
|
7
|
+
import { Validation } from '../types';
|
|
8
|
+
type InputGroupValidationId = object;
|
|
7
9
|
interface IInputGroupContext {
|
|
8
10
|
isCompact?: boolean;
|
|
11
|
+
isUnified?: boolean;
|
|
12
|
+
/** Registers a child Input's validation with the nearest unified group. */
|
|
13
|
+
registerValidation: (id: InputGroupValidationId, validation?: Validation) => void;
|
|
9
14
|
}
|
|
10
15
|
export declare const InputGroupContext: import("react").Context<IInputGroupContext | undefined>;
|
|
11
16
|
/**
|
|
12
17
|
* Retrieve InputGroup component context
|
|
13
18
|
*/
|
|
14
19
|
export declare const useInputGroupContext: () => IInputGroupContext | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* Owns the validation published by nested `Input`s so `InputGroup` can pass
|
|
22
|
+
* `$validation` to its view without inspecting children or stamping DOM attributes.
|
|
23
|
+
* A unified group supports a single validation-bearing `Input`; a second one
|
|
24
|
+
* triggers a development warning, while the Map keeps last-wins and
|
|
25
|
+
* unmount-restore behavior so the unsupported composition degrades gracefully.
|
|
26
|
+
*/
|
|
27
|
+
export declare const useInputGroupValidationState: () => {
|
|
28
|
+
validation: "success" | "warning" | "error" | undefined;
|
|
29
|
+
registerValidation: (id: InputGroupValidationId, next?: Validation) => void;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Publishes `validation` to the nearest unified `InputGroup` so the container
|
|
33
|
+
* can style its chrome from `$validation` without a public DOM attribute.
|
|
34
|
+
* No-ops outside a group, and for the classic (non-unified) variant.
|
|
35
|
+
*/
|
|
36
|
+
export declare const usePublishInputGroupValidation: (validation?: Validation) => void;
|
|
15
37
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zendeskgarden/react-forms",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.16.0",
|
|
4
4
|
"description": "Components relating to form elements in the Garden Design System",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Zendesk Garden <garden@zendesk.com>",
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@zendeskgarden/container-field": "^3.0.21",
|
|
25
25
|
"@zendeskgarden/container-utilities": "^2.0.4",
|
|
26
|
+
"@zendeskgarden/react-buttons": "^9.16.0",
|
|
26
27
|
"lodash.debounce": "^4.0.8",
|
|
27
28
|
"polished": "^4.3.1",
|
|
28
29
|
"prop-types": "^15.5.7",
|
|
@@ -36,7 +37,7 @@
|
|
|
36
37
|
},
|
|
37
38
|
"devDependencies": {
|
|
38
39
|
"@types/lodash.debounce": "4.0.9",
|
|
39
|
-
"@zendeskgarden/react-theming": "^9.
|
|
40
|
+
"@zendeskgarden/react-theming": "^9.16.0",
|
|
40
41
|
"@zendeskgarden/svg-icons": "7.6.0",
|
|
41
42
|
"react-dropzone": "14.3.8"
|
|
42
43
|
},
|
|
@@ -50,5 +51,5 @@
|
|
|
50
51
|
"access": "public"
|
|
51
52
|
},
|
|
52
53
|
"zendeskgarden:src": "src/index.ts",
|
|
53
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "26dc6a8cf9650e9214896d6994a4f3fba1e63541"
|
|
54
55
|
}
|