@wordpress/components 19.8.1 → 19.9.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/CHANGELOG.md +12 -0
- package/build/alignment-matrix-control/styles/alignment-matrix-control-styles.js +11 -11
- package/build/alignment-matrix-control/styles/alignment-matrix-control-styles.js.map +1 -1
- package/build/heading/hook.js +1 -1
- package/build/heading/hook.js.map +1 -1
- package/build/input-control/index.js +26 -4
- package/build/input-control/index.js.map +1 -1
- package/build/input-control/styles/input-control-styles.js +25 -25
- package/build/input-control/styles/input-control-styles.js.map +1 -1
- package/build/navigation/styles/navigation-styles.js +12 -12
- package/build/navigation/styles/navigation-styles.js.map +1 -1
- package/build/notice/index.native.js +44 -40
- package/build/notice/index.native.js.map +1 -1
- package/build/notice/list.native.js +27 -45
- package/build/notice/list.native.js.map +1 -1
- package/build/palette-edit/index.js +2 -1
- package/build/palette-edit/index.js.map +1 -1
- package/build/sandbox/index.js +2 -2
- package/build/sandbox/index.js.map +1 -1
- package/build/select-control/styles/select-control-styles.js +5 -5
- package/build/select-control/styles/select-control-styles.js.map +1 -1
- package/build/surface/styles.js +8 -8
- package/build/surface/styles.js.map +1 -1
- package/build/text/hook.js +5 -5
- package/build/text/hook.js.map +1 -1
- package/build/text/styles/text-mixins.native.js +1 -1
- package/build/text/styles/text-mixins.native.js.map +1 -1
- package/build/text/styles.js +7 -7
- package/build/text/styles.js.map +1 -1
- package/build/ui/spinner/component.js +1 -1
- package/build/ui/spinner/component.js.map +1 -1
- package/build/utils/colors-values.js +9 -24
- package/build/utils/colors-values.js.map +1 -1
- package/build-module/alignment-matrix-control/styles/alignment-matrix-control-styles.js +11 -11
- package/build-module/alignment-matrix-control/styles/alignment-matrix-control-styles.js.map +1 -1
- package/build-module/heading/hook.js +1 -1
- package/build-module/heading/hook.js.map +1 -1
- package/build-module/input-control/index.js +23 -3
- package/build-module/input-control/index.js.map +1 -1
- package/build-module/input-control/styles/input-control-styles.js +25 -25
- package/build-module/input-control/styles/input-control-styles.js.map +1 -1
- package/build-module/navigation/styles/navigation-styles.js +13 -13
- package/build-module/navigation/styles/navigation-styles.js.map +1 -1
- package/build-module/notice/index.native.js +45 -41
- package/build-module/notice/index.native.js.map +1 -1
- package/build-module/notice/list.native.js +28 -46
- package/build-module/notice/list.native.js.map +1 -1
- package/build-module/palette-edit/index.js +3 -2
- package/build-module/palette-edit/index.js.map +1 -1
- package/build-module/sandbox/index.js +2 -2
- package/build-module/sandbox/index.js.map +1 -1
- package/build-module/select-control/styles/select-control-styles.js +5 -5
- package/build-module/select-control/styles/select-control-styles.js.map +1 -1
- package/build-module/surface/styles.js +8 -8
- package/build-module/surface/styles.js.map +1 -1
- package/build-module/text/hook.js +5 -5
- package/build-module/text/hook.js.map +1 -1
- package/build-module/text/styles/text-mixins.native.js +2 -2
- package/build-module/text/styles/text-mixins.native.js.map +1 -1
- package/build-module/text/styles.js +7 -7
- package/build-module/text/styles.js.map +1 -1
- package/build-module/ui/spinner/component.js +1 -1
- package/build-module/ui/spinner/component.js.map +1 -1
- package/build-module/utils/colors-values.js +19 -23
- package/build-module/utils/colors-values.js.map +1 -1
- package/build-style/style-rtl.css +17 -0
- package/build-style/style.css +17 -0
- package/build-types/color-picker/styles.d.ts +1 -1
- package/build-types/input-control/index.d.ts +22 -3
- package/build-types/input-control/index.d.ts.map +1 -1
- package/build-types/input-control/input-field.d.ts +1 -1
- package/build-types/input-control/input-field.d.ts.map +1 -1
- package/build-types/input-control/stories/index.d.ts +5 -5
- package/build-types/input-control/styles/input-control-styles.d.ts.map +1 -1
- package/build-types/input-control/types.d.ts +73 -3
- package/build-types/input-control/types.d.ts.map +1 -1
- package/build-types/number-control/styles/number-control-styles.d.ts +1 -1
- package/build-types/text/test/index.d.ts +2 -0
- package/build-types/text/test/index.d.ts.map +1 -0
- package/build-types/utils/colors-values.d.ts +6 -146
- package/build-types/utils/colors-values.d.ts.map +1 -1
- package/package.json +17 -17
- package/src/alignment-matrix-control/styles/alignment-matrix-control-styles.js +5 -3
- package/src/heading/hook.ts +1 -1
- package/src/heading/test/__snapshots__/index.js.snap +3 -3
- package/src/input-control/README.md +2 -2
- package/src/input-control/index.tsx +22 -3
- package/src/input-control/stories/index.tsx +63 -0
- package/src/input-control/styles/input-control-styles.tsx +1 -2
- package/src/input-control/types.ts +73 -2
- package/src/navigation/styles/navigation-styles.js +5 -5
- package/src/notice/index.native.js +44 -54
- package/src/notice/list.native.js +27 -51
- package/src/notice/style.native.scss +1 -0
- package/src/palette-edit/index.js +8 -2
- package/src/query-controls/README.md +2 -2
- package/src/sandbox/index.js +2 -2
- package/src/select-control/styles/select-control-styles.ts +1 -1
- package/src/surface/styles.js +1 -1
- package/src/text/hook.js +1 -1
- package/src/text/styles/text-mixins.native.js +2 -2
- package/src/text/styles.js +1 -1
- package/src/text/test/__snapshots__/{index.js.snap → index.tsx.snap} +16 -0
- package/src/text/test/{index.js → index.tsx} +12 -6
- package/src/toolbar-group/style.scss +20 -0
- package/src/tools-panel/test/__snapshots__/index.js.snap +1 -1
- package/src/ui/spinner/component.js +1 -1
- package/src/ui/spinner/test/__snapshots__/index.js.snap +3 -3
- package/src/utils/colors-values.js +18 -22
- package/tsconfig.json +8 -2
- package/tsconfig.tsbuildinfo +1 -1
- package/build-types/spinner/styles/spinner-styles.d.ts +0 -5
- package/build-types/spinner/styles/spinner-styles.d.ts.map +0 -1
- package/build-types/toggle-group-control/toggle-group-control-option/styles.d.ts +0 -15
- package/build-types/toggle-group-control/toggle-group-control-option/styles.d.ts.map +0 -1
- package/src/input-control/stories/index.js +0 -71
|
@@ -1,52 +1,122 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import type { CSSProperties, ReactNode, ChangeEvent, SyntheticEvent, PointerEvent } from 'react';
|
|
4
|
+
import type { CSSProperties, ReactNode, ChangeEvent, SyntheticEvent, PointerEvent, HTMLInputTypeAttribute } from 'react';
|
|
5
5
|
import type { useDrag } from '@use-gesture/react';
|
|
6
6
|
/**
|
|
7
7
|
* Internal dependencies
|
|
8
8
|
*/
|
|
9
9
|
import type { StateReducer } from './reducer/state';
|
|
10
|
-
import type { FlexProps } from '../flex/types';
|
|
11
10
|
import type { WordPressComponentProps } from '../ui/context';
|
|
11
|
+
import type { FlexProps } from '../flex/types';
|
|
12
12
|
export declare type LabelPosition = 'top' | 'bottom' | 'side' | 'edge';
|
|
13
13
|
export declare type DragDirection = 'n' | 's' | 'e' | 'w';
|
|
14
14
|
export declare type DragProps = Parameters<Parameters<typeof useDrag>[0]>[0];
|
|
15
15
|
export declare type Size = 'default' | 'small' | '__unstable-large';
|
|
16
16
|
interface BaseProps {
|
|
17
17
|
__unstableInputWidth?: CSSProperties['width'];
|
|
18
|
+
/**
|
|
19
|
+
* If true, the label will only be visible to screen readers.
|
|
20
|
+
*
|
|
21
|
+
* @default false
|
|
22
|
+
*/
|
|
18
23
|
hideLabelFromVision?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Whether the component should be in a focused state.
|
|
26
|
+
* Used to coordinate focus states when the actual focused element and the component handling
|
|
27
|
+
* visual focus are separate.
|
|
28
|
+
*
|
|
29
|
+
* @default false
|
|
30
|
+
*/
|
|
19
31
|
isFocused: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* The position of the label.
|
|
34
|
+
*
|
|
35
|
+
* @default 'top'
|
|
36
|
+
*/
|
|
20
37
|
labelPosition?: LabelPosition;
|
|
38
|
+
/**
|
|
39
|
+
* Adjusts the size of the input.
|
|
40
|
+
*
|
|
41
|
+
* @default 'default'
|
|
42
|
+
*/
|
|
21
43
|
size?: Size;
|
|
22
44
|
}
|
|
23
45
|
export declare type InputChangeCallback<E = ChangeEvent<HTMLInputElement> | PointerEvent<HTMLInputElement>, P = {}> = (nextValue: string | undefined, extra: {
|
|
24
46
|
event: E;
|
|
25
47
|
} & P) => void;
|
|
26
48
|
export interface InputFieldProps extends BaseProps {
|
|
49
|
+
/**
|
|
50
|
+
* Determines the drag axis.
|
|
51
|
+
*
|
|
52
|
+
* @default 'n'
|
|
53
|
+
*/
|
|
27
54
|
dragDirection?: DragDirection;
|
|
55
|
+
/**
|
|
56
|
+
* If `isDragEnabled` is true, this controls the amount of `px` to have been dragged before
|
|
57
|
+
* the drag gesture is actually triggered.
|
|
58
|
+
*
|
|
59
|
+
* @default 10
|
|
60
|
+
*/
|
|
28
61
|
dragThreshold?: number;
|
|
62
|
+
/**
|
|
63
|
+
* If true, enables mouse drag gestures.
|
|
64
|
+
*
|
|
65
|
+
* @default false
|
|
66
|
+
*/
|
|
29
67
|
isDragEnabled?: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* If true, the `ENTER` key press is required in order to trigger an `onChange`.
|
|
70
|
+
* If enabled, a change is also triggered when tabbing away (`onBlur`).
|
|
71
|
+
*
|
|
72
|
+
* @default false
|
|
73
|
+
*/
|
|
30
74
|
isPressEnterToChange?: boolean;
|
|
75
|
+
/**
|
|
76
|
+
* A function that receives the value of the input.
|
|
77
|
+
*/
|
|
31
78
|
onChange?: InputChangeCallback;
|
|
32
79
|
onValidate?: (nextValue: string, event?: SyntheticEvent<HTMLInputElement>) => void;
|
|
33
80
|
setIsFocused: (isFocused: boolean) => void;
|
|
34
81
|
stateReducer?: StateReducer;
|
|
82
|
+
/**
|
|
83
|
+
* The current value of the input.
|
|
84
|
+
*/
|
|
35
85
|
value?: string;
|
|
36
86
|
onDragEnd?: (dragProps: DragProps) => void;
|
|
37
87
|
onDragStart?: (dragProps: DragProps) => void;
|
|
38
88
|
onDrag?: (dragProps: DragProps) => void;
|
|
89
|
+
/**
|
|
90
|
+
* Type of the input element to render.
|
|
91
|
+
*
|
|
92
|
+
* @default 'text'
|
|
93
|
+
*/
|
|
94
|
+
type?: HTMLInputTypeAttribute;
|
|
39
95
|
}
|
|
40
96
|
export interface InputBaseProps extends BaseProps, FlexProps {
|
|
41
97
|
children: ReactNode;
|
|
98
|
+
/**
|
|
99
|
+
* Renders an element on the left side of the input.
|
|
100
|
+
*/
|
|
42
101
|
prefix?: ReactNode;
|
|
102
|
+
/**
|
|
103
|
+
* Renders an element on the right side of the input.
|
|
104
|
+
*/
|
|
43
105
|
suffix?: ReactNode;
|
|
106
|
+
/**
|
|
107
|
+
* If true, the `input` will be disabled.
|
|
108
|
+
*
|
|
109
|
+
* @default false
|
|
110
|
+
*/
|
|
44
111
|
disabled?: boolean;
|
|
45
112
|
className?: string;
|
|
46
113
|
id?: string;
|
|
114
|
+
/**
|
|
115
|
+
* If this property is added, a label will be generated using label property as the content.
|
|
116
|
+
*/
|
|
47
117
|
label?: ReactNode;
|
|
48
118
|
}
|
|
49
|
-
export interface InputControlProps extends Omit<InputBaseProps, 'children' | 'isFocused'>,
|
|
119
|
+
export interface InputControlProps extends Omit<InputBaseProps, 'children' | 'isFocused' | keyof FlexProps>,
|
|
50
120
|
/**
|
|
51
121
|
* The `prefix` prop in `WordPressComponentProps< InputFieldProps, 'input', false >` comes from the
|
|
52
122
|
* `HTMLInputAttributes` and clashes with the one from `InputBaseProps`. So we have to omit it from
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/input-control/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EACX,aAAa,EACb,SAAS,EACT,WAAW,EACX,cAAc,EACd,YAAY,EACZ,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAElD;;GAEG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/input-control/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EACX,aAAa,EACb,SAAS,EACT,WAAW,EACX,cAAc,EACd,YAAY,EACZ,sBAAsB,EACtB,MAAM,OAAO,CAAC;AACf,OAAO,K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,GAAG,QAAQ,GAAG,WAAW,GAAG,cAAc,CACxD;IACF,sBAAsB,CAAC,EAAE,eAAe,CAAE,cAAc,CAAE,CAAC;CAC3D;AAED,MAAM,WAAW,sBAAsB;IACtC,QAAQ,EAAE,SAAS,CAAC;IACpB,mBAAmB,CAAC,EAAE,SAAS,CAAE,qBAAqB,CAAE,CAAC;IACzD,aAAa,CAAC,EAAE,SAAS,CAAE,eAAe,CAAE,CAAC;IAC7C,IAAI,CAAC,EAAE,SAAS,CAAE,MAAM,CAAE,CAAC;CAC3B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const Input: import("@emotion/styled").StyledComponent<Pick<import("../../input-control/types").InputControlProps, "type" | "value" | "form" | "label" | "slot" | "style" | "title" | "pattern" | "className" | "color" | "height" | "id" | "lang" | "max" | "min" | "name" | "width" | "role" | "tabIndex" | "crossOrigin" | "
|
|
1
|
+
export const Input: import("@emotion/styled").StyledComponent<Pick<import("../../input-control/types").InputControlProps, "type" | "value" | "form" | "label" | "slot" | "style" | "title" | "pattern" | "className" | "color" | "height" | "id" | "lang" | "max" | "min" | "name" | "width" | "role" | "tabIndex" | "crossOrigin" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "css" | "key" | "list" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "placeholder" | "spellCheck" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "alt" | "src" | "autoFocus" | "disabled" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "autoComplete" | "accept" | "capture" | "checked" | "enterKeyHint" | "maxLength" | "minLength" | "multiple" | "readOnly" | "required" | "size" | "step" | "hideLabelFromVision" | "suffix" | "__unstableInputWidth" | "labelPosition" | "dragDirection" | "dragThreshold" | "isDragEnabled" | "isPressEnterToChange" | "onValidate" | "__unstableStateReducer"> & import("react").RefAttributes<HTMLInputElement> & {
|
|
2
2
|
theme?: import("@emotion/react").Theme | undefined;
|
|
3
3
|
} & {
|
|
4
4
|
hideHTMLArrows: any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/text/test/index.tsx"],"names":[],"mappings":""}
|
|
@@ -1,146 +1,3 @@
|
|
|
1
|
-
export namespace BASE {
|
|
2
|
-
const black: string;
|
|
3
|
-
const white: string;
|
|
4
|
-
}
|
|
5
|
-
export namespace G2 {
|
|
6
|
-
namespace blue {
|
|
7
|
-
namespace medium {
|
|
8
|
-
const focus: string;
|
|
9
|
-
const focusDark: string;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
const gray: {
|
|
13
|
-
900: string;
|
|
14
|
-
700: string;
|
|
15
|
-
600: string;
|
|
16
|
-
400: string;
|
|
17
|
-
300: string;
|
|
18
|
-
200: string;
|
|
19
|
-
100: string;
|
|
20
|
-
};
|
|
21
|
-
namespace darkGray {
|
|
22
|
-
const primary: string;
|
|
23
|
-
const heading: string;
|
|
24
|
-
}
|
|
25
|
-
namespace mediumGray {
|
|
26
|
-
const text: string;
|
|
27
|
-
}
|
|
28
|
-
namespace lightGray {
|
|
29
|
-
const ui: string;
|
|
30
|
-
const secondary: string;
|
|
31
|
-
const tertiary: string;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
export const DARK_GRAY: {
|
|
35
|
-
900: string;
|
|
36
|
-
800: string;
|
|
37
|
-
700: string;
|
|
38
|
-
600: string;
|
|
39
|
-
500: string;
|
|
40
|
-
400: string;
|
|
41
|
-
300: string;
|
|
42
|
-
200: string;
|
|
43
|
-
150: string;
|
|
44
|
-
100: string;
|
|
45
|
-
placeholder: string;
|
|
46
|
-
};
|
|
47
|
-
export const DARK_OPACITY: {
|
|
48
|
-
900: string;
|
|
49
|
-
800: string;
|
|
50
|
-
700: string;
|
|
51
|
-
600: string;
|
|
52
|
-
500: string;
|
|
53
|
-
400: string;
|
|
54
|
-
300: string;
|
|
55
|
-
200: string;
|
|
56
|
-
100: string;
|
|
57
|
-
backgroundFill: string;
|
|
58
|
-
};
|
|
59
|
-
export const DARK_OPACITY_LIGHT: {
|
|
60
|
-
900: string;
|
|
61
|
-
800: string;
|
|
62
|
-
700: string;
|
|
63
|
-
600: string;
|
|
64
|
-
500: string;
|
|
65
|
-
400: string;
|
|
66
|
-
300: string;
|
|
67
|
-
200: string;
|
|
68
|
-
100: string;
|
|
69
|
-
};
|
|
70
|
-
export const LIGHT_GRAY: {
|
|
71
|
-
900: string;
|
|
72
|
-
800: string;
|
|
73
|
-
700: string;
|
|
74
|
-
600: string;
|
|
75
|
-
500: string;
|
|
76
|
-
400: string;
|
|
77
|
-
300: string;
|
|
78
|
-
200: string;
|
|
79
|
-
100: string;
|
|
80
|
-
placeholder: string;
|
|
81
|
-
};
|
|
82
|
-
export const LIGHT_OPACITY_LIGHT: {
|
|
83
|
-
900: string;
|
|
84
|
-
800: string;
|
|
85
|
-
700: string;
|
|
86
|
-
600: string;
|
|
87
|
-
500: string;
|
|
88
|
-
400: string;
|
|
89
|
-
300: string;
|
|
90
|
-
200: string;
|
|
91
|
-
100: string;
|
|
92
|
-
backgroundFill: string;
|
|
93
|
-
};
|
|
94
|
-
export namespace BLUE {
|
|
95
|
-
export const wordpress: {
|
|
96
|
-
700: string;
|
|
97
|
-
};
|
|
98
|
-
export const dark: {
|
|
99
|
-
900: string;
|
|
100
|
-
};
|
|
101
|
-
const medium_1: {
|
|
102
|
-
900: string;
|
|
103
|
-
800: string;
|
|
104
|
-
700: string;
|
|
105
|
-
600: string;
|
|
106
|
-
500: string;
|
|
107
|
-
400: string;
|
|
108
|
-
300: string;
|
|
109
|
-
200: string;
|
|
110
|
-
100: string;
|
|
111
|
-
highlight: string;
|
|
112
|
-
focus: string;
|
|
113
|
-
};
|
|
114
|
-
export { medium_1 as medium };
|
|
115
|
-
}
|
|
116
|
-
export namespace ALERT {
|
|
117
|
-
const yellow: string;
|
|
118
|
-
const red: string;
|
|
119
|
-
const green: string;
|
|
120
|
-
}
|
|
121
|
-
export namespace ADMIN {
|
|
122
|
-
const theme: string;
|
|
123
|
-
const themeDark10: string;
|
|
124
|
-
}
|
|
125
|
-
export namespace UI {
|
|
126
|
-
import theme_1 = ADMIN.theme;
|
|
127
|
-
export { theme_1 as theme };
|
|
128
|
-
import background = BASE.white;
|
|
129
|
-
export { background };
|
|
130
|
-
export const backgroundDisabled: string;
|
|
131
|
-
export const border: string;
|
|
132
|
-
export const borderHover: string;
|
|
133
|
-
import borderFocus = ADMIN.themeDark10;
|
|
134
|
-
export { borderFocus };
|
|
135
|
-
export const borderDisabled: string;
|
|
136
|
-
export const borderLight: string;
|
|
137
|
-
export const label: string;
|
|
138
|
-
export const textDisabled: string;
|
|
139
|
-
import textDark = BASE.white;
|
|
140
|
-
export { textDark };
|
|
141
|
-
import textLight = BASE.black;
|
|
142
|
-
export { textLight };
|
|
143
|
-
}
|
|
144
1
|
export const COLORS: {
|
|
145
2
|
black: string;
|
|
146
3
|
white: string;
|
|
@@ -157,9 +14,6 @@ export const COLORS: {
|
|
|
157
14
|
150: string;
|
|
158
15
|
100: string;
|
|
159
16
|
placeholder: string;
|
|
160
|
-
} & {
|
|
161
|
-
primary: string;
|
|
162
|
-
heading: string;
|
|
163
17
|
};
|
|
164
18
|
darkOpacity: {
|
|
165
19
|
900: string;
|
|
@@ -187,6 +41,12 @@ export const COLORS: {
|
|
|
187
41
|
mediumGray: {
|
|
188
42
|
text: string;
|
|
189
43
|
};
|
|
44
|
+
/**
|
|
45
|
+
* The main gray color object (since Apr 16, 2022).
|
|
46
|
+
*
|
|
47
|
+
* We are in the process of simplifying the colors in this file,
|
|
48
|
+
* please prefer this `gray` object in the meantime.
|
|
49
|
+
*/
|
|
190
50
|
gray: {
|
|
191
51
|
900: string;
|
|
192
52
|
700: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"colors-values.d.ts","sourceRoot":"","sources":["../../src/utils/colors-values.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"colors-values.d.ts","sourceRoot":"","sources":["../../src/utils/colors-values.js"],"names":[],"mappings":"AAgKA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAKC;;;;;OAKG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAQA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/components",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.9.0",
|
|
4
4
|
"description": "UI components for WordPress.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -37,21 +37,21 @@
|
|
|
37
37
|
"@emotion/styled": "^11.6.0",
|
|
38
38
|
"@emotion/utils": "1.0.0",
|
|
39
39
|
"@use-gesture/react": "^10.2.6",
|
|
40
|
-
"@wordpress/a11y": "^3.
|
|
41
|
-
"@wordpress/compose": "^5.
|
|
42
|
-
"@wordpress/date": "^4.
|
|
43
|
-
"@wordpress/deprecated": "^3.
|
|
44
|
-
"@wordpress/dom": "^3.
|
|
45
|
-
"@wordpress/element": "^4.
|
|
46
|
-
"@wordpress/escape-html": "^2.
|
|
47
|
-
"@wordpress/hooks": "^3.
|
|
48
|
-
"@wordpress/i18n": "^4.
|
|
49
|
-
"@wordpress/icons": "^8.
|
|
50
|
-
"@wordpress/is-shallow-equal": "^4.
|
|
51
|
-
"@wordpress/keycodes": "^3.
|
|
52
|
-
"@wordpress/primitives": "^3.
|
|
53
|
-
"@wordpress/rich-text": "^5.
|
|
54
|
-
"@wordpress/warning": "^2.
|
|
40
|
+
"@wordpress/a11y": "^3.7.0",
|
|
41
|
+
"@wordpress/compose": "^5.5.0",
|
|
42
|
+
"@wordpress/date": "^4.7.0",
|
|
43
|
+
"@wordpress/deprecated": "^3.7.0",
|
|
44
|
+
"@wordpress/dom": "^3.7.0",
|
|
45
|
+
"@wordpress/element": "^4.5.0",
|
|
46
|
+
"@wordpress/escape-html": "^2.7.0",
|
|
47
|
+
"@wordpress/hooks": "^3.7.0",
|
|
48
|
+
"@wordpress/i18n": "^4.7.0",
|
|
49
|
+
"@wordpress/icons": "^8.3.0",
|
|
50
|
+
"@wordpress/is-shallow-equal": "^4.7.0",
|
|
51
|
+
"@wordpress/keycodes": "^3.7.0",
|
|
52
|
+
"@wordpress/primitives": "^3.5.0",
|
|
53
|
+
"@wordpress/rich-text": "^5.5.0",
|
|
54
|
+
"@wordpress/warning": "^2.7.0",
|
|
55
55
|
"classnames": "^2.3.1",
|
|
56
56
|
"colord": "^2.7.0",
|
|
57
57
|
"dom-scroll-into-view": "^1.2.1",
|
|
@@ -76,5 +76,5 @@
|
|
|
76
76
|
"publishConfig": {
|
|
77
77
|
"access": "public"
|
|
78
78
|
},
|
|
79
|
-
"gitHead": "
|
|
79
|
+
"gitHead": "1ba52312b56db563df2d8d4fba5b00613fb46d8c"
|
|
80
80
|
}
|
|
@@ -43,9 +43,11 @@ export const Row = styled.div`
|
|
|
43
43
|
`;
|
|
44
44
|
|
|
45
45
|
const pointActive = ( { isActive } ) => {
|
|
46
|
-
const boxShadow = isActive ? `0 0 0 2px ${ COLORS.
|
|
47
|
-
const pointColor = isActive ? COLORS.
|
|
48
|
-
const pointColorHover = isActive
|
|
46
|
+
const boxShadow = isActive ? `0 0 0 2px ${ COLORS.gray[ 900 ] }` : null;
|
|
47
|
+
const pointColor = isActive ? COLORS.gray[ 900 ] : COLORS.lightGray[ 800 ];
|
|
48
|
+
const pointColorHover = isActive
|
|
49
|
+
? COLORS.gray[ 900 ]
|
|
50
|
+
: COLORS.blue.medium.focus;
|
|
49
51
|
|
|
50
52
|
return css`
|
|
51
53
|
box-shadow: ${ boxShadow };
|
package/src/heading/hook.ts
CHANGED
|
@@ -70,7 +70,7 @@ export function useHeading(
|
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
const textProps = useText( {
|
|
73
|
-
color: COLORS.
|
|
73
|
+
color: COLORS.gray[ 900 ],
|
|
74
74
|
size: getHeadingFontSize( level ),
|
|
75
75
|
isBlock: true,
|
|
76
76
|
weight: CONFIG.fontWeightHeading as import('react').CSSProperties[ 'fontWeight' ],
|
|
@@ -5,7 +5,7 @@ exports[`props should render correctly 1`] = `
|
|
|
5
5
|
color: #1e1e1e;
|
|
6
6
|
line-height: 1.2;
|
|
7
7
|
margin: 0;
|
|
8
|
-
color: #
|
|
8
|
+
color: #1e1e1e;
|
|
9
9
|
font-size: calc(1.95 * 13px);
|
|
10
10
|
font-weight: 600;
|
|
11
11
|
display: block;
|
|
@@ -27,7 +27,7 @@ Snapshot Diff:
|
|
|
27
27
|
|
|
28
28
|
Array [
|
|
29
29
|
Object {
|
|
30
|
-
"color": "#
|
|
30
|
+
"color": "#1e1e1e",
|
|
31
31
|
"display": "block",
|
|
32
32
|
- "font-size": "calc(1.25 * 13px)",
|
|
33
33
|
+ "font-size": "calc(1.95 * 13px)",
|
|
@@ -45,7 +45,7 @@ Snapshot Diff:
|
|
|
45
45
|
|
|
46
46
|
Array [
|
|
47
47
|
Object {
|
|
48
|
-
"color": "#
|
|
48
|
+
"color": "#1e1e1e",
|
|
49
49
|
"display": "block",
|
|
50
50
|
- "font-size": "calc(1.25 * 13px)",
|
|
51
51
|
+ "font-size": "calc(1.95 * 13px)",
|
|
@@ -25,7 +25,7 @@ function useUniqueId( idProp?: string ) {
|
|
|
25
25
|
return idProp || id;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
export function
|
|
28
|
+
export function UnforwardedInputControl(
|
|
29
29
|
{
|
|
30
30
|
__unstableStateReducer: stateReducer = ( state ) => state,
|
|
31
31
|
__unstableInputWidth,
|
|
@@ -88,6 +88,25 @@ export function InputControl(
|
|
|
88
88
|
);
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
|
|
91
|
+
/**
|
|
92
|
+
* InputControl components let users enter and edit text. This is an experimental component
|
|
93
|
+
* intended to (in time) merge with or replace `TextControl`.
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
* import { __experimentalInputControl as InputControl } from '@wordpress/components';
|
|
97
|
+
* import { useState } from '@wordpress/compose';
|
|
98
|
+
*
|
|
99
|
+
* const Example = () => {
|
|
100
|
+
* const [ value, setValue ] = useState( '' );
|
|
101
|
+
*
|
|
102
|
+
* return (
|
|
103
|
+
* <InputControl
|
|
104
|
+
* value={ value }
|
|
105
|
+
* onChange={ ( nextValue ) => setValue( nextValue ) }
|
|
106
|
+
* />
|
|
107
|
+
* );
|
|
108
|
+
* };
|
|
109
|
+
*/
|
|
110
|
+
export const InputControl = forwardRef( UnforwardedInputControl );
|
|
92
111
|
|
|
93
|
-
export default
|
|
112
|
+
export default InputControl;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import type { ComponentMeta, ComponentStory } from '@storybook/react';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import InputControl from '..';
|
|
10
|
+
|
|
11
|
+
const meta: ComponentMeta< typeof InputControl > = {
|
|
12
|
+
title: 'Components (Experimental)/InputControl',
|
|
13
|
+
component: InputControl,
|
|
14
|
+
argTypes: {
|
|
15
|
+
__unstableInputWidth: { control: { type: 'text' } },
|
|
16
|
+
__unstableStateReducer: { control: { type: null } },
|
|
17
|
+
onChange: { control: { type: null } },
|
|
18
|
+
prefix: { control: { type: null } },
|
|
19
|
+
suffix: { control: { type: null } },
|
|
20
|
+
type: { control: { type: 'text' } },
|
|
21
|
+
},
|
|
22
|
+
parameters: {
|
|
23
|
+
controls: { expanded: true },
|
|
24
|
+
docs: { source: { state: 'open' } },
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
export default meta;
|
|
28
|
+
|
|
29
|
+
const Template: ComponentStory< typeof InputControl > = ( args ) => (
|
|
30
|
+
<InputControl { ...args } />
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
export const Default = Template.bind( {} );
|
|
34
|
+
Default.args = {
|
|
35
|
+
label: 'Value',
|
|
36
|
+
placeholder: 'Placeholder',
|
|
37
|
+
value: '',
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export const WithPrefix = Template.bind( {} );
|
|
41
|
+
WithPrefix.args = {
|
|
42
|
+
...Default.args,
|
|
43
|
+
prefix: <span style={ { paddingLeft: 8 } }>@</span>,
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export const WithSuffix = Template.bind( {} );
|
|
47
|
+
WithSuffix.args = {
|
|
48
|
+
...Default.args,
|
|
49
|
+
suffix: <button style={ { marginRight: 4 } }>Send</button>,
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export const WithSideLabel = Template.bind( {} );
|
|
53
|
+
WithSideLabel.args = {
|
|
54
|
+
...Default.args,
|
|
55
|
+
labelPosition: 'side',
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export const WithEdgeLabel = Template.bind( {} );
|
|
59
|
+
WithEdgeLabel.args = {
|
|
60
|
+
...Default.args,
|
|
61
|
+
__unstableInputWidth: '20em',
|
|
62
|
+
labelPosition: 'edge',
|
|
63
|
+
};
|
|
@@ -210,7 +210,7 @@ export const Input = styled.input< InputProps >`
|
|
|
210
210
|
box-sizing: border-box;
|
|
211
211
|
border: none;
|
|
212
212
|
box-shadow: none !important;
|
|
213
|
-
color: ${ COLORS.
|
|
213
|
+
color: ${ COLORS.gray[ 900 ] };
|
|
214
214
|
display: block;
|
|
215
215
|
font-family: inherit;
|
|
216
216
|
margin: 0;
|
|
@@ -245,7 +245,6 @@ const labelMargin = ( {
|
|
|
245
245
|
const BaseLabel = styled( Text )< { labelPosition?: LabelPosition } >`
|
|
246
246
|
&&& {
|
|
247
247
|
box-sizing: border-box;
|
|
248
|
-
color: currentColor;
|
|
249
248
|
display: block;
|
|
250
249
|
padding-top: 0;
|
|
251
250
|
padding-bottom: 0;
|