@wordpress/components 21.0.6 → 21.0.7
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 +18 -0
- package/build/autocomplete/index.js +11 -9
- package/build/autocomplete/index.js.map +1 -1
- package/build/circular-option-picker/index.js +14 -14
- package/build/circular-option-picker/index.js.map +1 -1
- package/build/color-palette/index.js +83 -30
- package/build/color-palette/index.js.map +1 -1
- package/build/color-palette/styles.js +3 -3
- package/build/color-palette/styles.js.map +1 -1
- package/build/color-palette/types.js +6 -0
- package/build/color-palette/types.js.map +1 -0
- package/build/form-token-field/index.js +12 -10
- package/build/form-token-field/index.js.map +1 -1
- package/build/popover/index.js +1 -26
- package/build/popover/index.js.map +1 -1
- package/build-module/autocomplete/index.js +10 -9
- package/build-module/autocomplete/index.js.map +1 -1
- package/build-module/circular-option-picker/index.js +14 -14
- package/build-module/circular-option-picker/index.js.map +1 -1
- package/build-module/color-palette/index.js +81 -28
- package/build-module/color-palette/index.js.map +1 -1
- package/build-module/color-palette/styles.js +3 -3
- package/build-module/color-palette/styles.js.map +1 -1
- package/build-module/color-palette/types.js +2 -0
- package/build-module/color-palette/types.js.map +1 -0
- package/build-module/form-token-field/index.js +11 -10
- package/build-module/form-token-field/index.js.map +1 -1
- package/build-module/popover/index.js +1 -26
- package/build-module/popover/index.js.map +1 -1
- package/build-types/border-control/types.d.ts +1 -1
- package/build-types/border-control/types.d.ts.map +1 -1
- package/build-types/circular-option-picker/index.d.ts +4 -24
- package/build-types/circular-option-picker/index.d.ts.map +1 -1
- package/build-types/color-palette/index.d.ts +33 -18
- package/build-types/color-palette/index.d.ts.map +1 -1
- package/build-types/color-palette/stories/index.d.ts +21 -0
- package/build-types/color-palette/stories/index.d.ts.map +1 -0
- package/build-types/color-palette/styles.d.ts +2 -1
- package/build-types/color-palette/styles.d.ts.map +1 -1
- package/build-types/color-palette/test/index.d.ts +2 -0
- package/build-types/color-palette/test/index.d.ts.map +1 -0
- package/build-types/color-palette/types.d.ts +86 -0
- package/build-types/color-palette/types.d.ts.map +1 -0
- package/build-types/confirm-dialog/component.d.ts +4 -4
- package/build-types/form-token-field/index.d.ts.map +1 -1
- package/build-types/popover/index.d.ts.map +1 -1
- package/build-types/popover/types.d.ts +0 -14
- package/build-types/popover/types.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/autocomplete/index.js +18 -9
- package/src/border-control/types.ts +1 -1
- package/src/circular-option-picker/index.js +14 -20
- package/src/color-palette/README.md +51 -49
- package/src/color-palette/{index.js → index.tsx} +132 -51
- package/src/color-palette/stories/{index.js → index.tsx} +38 -27
- package/src/color-palette/{styles.js → styles.ts} +0 -0
- package/src/color-palette/test/__snapshots__/index.tsx.snap +270 -0
- package/src/color-palette/test/index.tsx +164 -0
- package/src/color-palette/types.ts +93 -0
- package/src/form-token-field/index.tsx +21 -10
- package/src/form-token-field/test/index.tsx +167 -73
- package/src/popover/README.md +3 -9
- package/src/popover/index.tsx +1 -25
- package/src/popover/types.ts +0 -14
- package/tsconfig.tsbuildinfo +1 -1
- package/src/color-palette/test/__snapshots__/index.js.snap +0 -1207
- package/src/color-palette/test/index.js +0 -118
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import type { CSSProperties, MouseEventHandler, ReactNode } from 'react';
|
|
5
|
+
declare type OnColorChange = (newColor?: string) => void;
|
|
6
|
+
export declare type ColorObject = {
|
|
7
|
+
name: string;
|
|
8
|
+
color: NonNullable<CSSProperties['color']>;
|
|
9
|
+
};
|
|
10
|
+
export declare type PaletteObject = {
|
|
11
|
+
name: string;
|
|
12
|
+
colors: ColorObject[];
|
|
13
|
+
};
|
|
14
|
+
declare type PaletteProps = {
|
|
15
|
+
className?: string;
|
|
16
|
+
clearColor: () => void;
|
|
17
|
+
onChange: OnColorChange;
|
|
18
|
+
value?: string;
|
|
19
|
+
actions?: ReactNode;
|
|
20
|
+
};
|
|
21
|
+
export declare type SinglePaletteProps = PaletteProps & {
|
|
22
|
+
colors: ColorObject[];
|
|
23
|
+
};
|
|
24
|
+
export declare type MultiplePalettesProps = PaletteProps & {
|
|
25
|
+
colors: PaletteObject[];
|
|
26
|
+
};
|
|
27
|
+
export declare type CustomColorPickerDropdownProps = {
|
|
28
|
+
isRenderedInSidebar: boolean;
|
|
29
|
+
renderContent: () => ReactNode;
|
|
30
|
+
popoverProps?: string[];
|
|
31
|
+
renderToggle: (props: {
|
|
32
|
+
isOpen: boolean;
|
|
33
|
+
onToggle: MouseEventHandler<HTMLButtonElement>;
|
|
34
|
+
}) => ReactNode;
|
|
35
|
+
};
|
|
36
|
+
export declare type ColorPaletteProps = {
|
|
37
|
+
/**
|
|
38
|
+
* Whether the palette should have a clearing button.
|
|
39
|
+
*
|
|
40
|
+
* @default true
|
|
41
|
+
*/
|
|
42
|
+
clearable?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Array with the colors to be shown. When displaying multiple color palettes
|
|
45
|
+
* to choose from, the format of the array changes from an array of colors
|
|
46
|
+
* objects, to an array of color palettes.
|
|
47
|
+
*
|
|
48
|
+
* @default []
|
|
49
|
+
*/
|
|
50
|
+
colors?: (PaletteObject | ColorObject)[];
|
|
51
|
+
/**
|
|
52
|
+
* Whether to allow the user to pick a custom color on top of the predefined
|
|
53
|
+
* choices (defined via the `colors` prop).
|
|
54
|
+
*
|
|
55
|
+
* @default false
|
|
56
|
+
*/
|
|
57
|
+
disableCustomColors?: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Whether the color picker should display the alpha channel
|
|
60
|
+
* both in the bottom inputs as well as in the color picker itself.
|
|
61
|
+
*/
|
|
62
|
+
enableAlpha?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Callback called when a color is selected.
|
|
65
|
+
*/
|
|
66
|
+
onChange: OnColorChange;
|
|
67
|
+
/**
|
|
68
|
+
* Currently active value.
|
|
69
|
+
*/
|
|
70
|
+
value?: string;
|
|
71
|
+
/**
|
|
72
|
+
* Whether the colors prop is an array of color palettes,
|
|
73
|
+
* rather than an array of color objects.
|
|
74
|
+
*
|
|
75
|
+
* @default false
|
|
76
|
+
*/
|
|
77
|
+
__experimentalHasMultipleOrigins?: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Whether this is rendered in the sidebar.
|
|
80
|
+
*
|
|
81
|
+
* @default false
|
|
82
|
+
*/
|
|
83
|
+
__experimentalIsRenderedInSidebar?: boolean;
|
|
84
|
+
};
|
|
85
|
+
export {};
|
|
86
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/color-palette/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEzE,aAAK,aAAa,GAAG,CAAE,QAAQ,CAAC,EAAE,MAAM,KAAM,IAAI,CAAC;AAEnD,oBAAY,WAAW,GAAG;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,WAAW,CAAE,aAAa,CAAE,OAAO,CAAE,CAAE,CAAC;CAC/C,CAAC;AAEF,oBAAY,aAAa,GAAG;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,WAAW,EAAE,CAAC;CACtB,CAAC;AAEF,aAAK,YAAY,GAAG;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,QAAQ,EAAE,aAAa,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,SAAS,CAAC;CACpB,CAAC;AAEF,oBAAY,kBAAkB,GAAG,YAAY,GAAG;IAC/C,MAAM,EAAE,WAAW,EAAE,CAAC;CACtB,CAAC;AAEF,oBAAY,qBAAqB,GAAG,YAAY,GAAG;IAClD,MAAM,EAAE,aAAa,EAAE,CAAC;CACxB,CAAC;AAGF,oBAAY,8BAA8B,GAAG;IAC5C,mBAAmB,EAAE,OAAO,CAAC;IAC7B,aAAa,EAAE,MAAM,SAAS,CAAC;IAC/B,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,YAAY,EAAE,CAAE,KAAK,EAAE;QACtB,MAAM,EAAE,OAAO,CAAC;QAChB,QAAQ,EAAE,iBAAiB,CAAE,iBAAiB,CAAE,CAAC;KACjD,KAAM,SAAS,CAAC;CACjB,CAAC;AAEF,oBAAY,iBAAiB,GAAG;IAC/B;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,CAAE,aAAa,GAAG,WAAW,CAAE,EAAE,CAAC;IAC3C;;;;;OAKG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;OAEG;IACH,QAAQ,EAAE,aAAa,CAAC;IACxB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;OAKG;IACH,gCAAgC,CAAC,EAAE,OAAO,CAAC;IAC3C;;;;OAIG;IACH,iCAAiC,CAAC,EAAE,OAAO,CAAC;CAC5C,CAAC"}
|
|
@@ -8,12 +8,12 @@ declare const _default: import("../ui/context").WordPressComponent<import("react
|
|
|
8
8
|
} & {
|
|
9
9
|
onCancel: (event: DialogInputEvent) => void;
|
|
10
10
|
isOpen: boolean;
|
|
11
|
-
} & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>>, "as" | keyof {
|
|
11
|
+
} & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>>, "as" | "isOpen" | keyof {
|
|
12
12
|
children: import("react").ReactNode;
|
|
13
13
|
onConfirm: (event: DialogInputEvent) => void;
|
|
14
14
|
confirmButtonText?: string | undefined;
|
|
15
15
|
cancelButtonText?: string | undefined;
|
|
16
|
-
} | "onCancel"
|
|
16
|
+
} | "onCancel"> & import("react").RefAttributes<any>, boolean> | import("../ui/context").WordPressComponent<import("react").ElementType<any>, {
|
|
17
17
|
children: import("react").ReactNode;
|
|
18
18
|
onConfirm: (event: DialogInputEvent) => void;
|
|
19
19
|
confirmButtonText?: string | undefined;
|
|
@@ -21,11 +21,11 @@ declare const _default: import("../ui/context").WordPressComponent<import("react
|
|
|
21
21
|
} & {
|
|
22
22
|
onCancel?: ((event: DialogInputEvent) => void) | undefined;
|
|
23
23
|
isOpen?: undefined;
|
|
24
|
-
} & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>>, "as" | keyof {
|
|
24
|
+
} & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>>, "as" | "isOpen" | keyof {
|
|
25
25
|
children: import("react").ReactNode;
|
|
26
26
|
onConfirm: (event: DialogInputEvent) => void;
|
|
27
27
|
confirmButtonText?: string | undefined;
|
|
28
28
|
cancelButtonText?: string | undefined;
|
|
29
|
-
} | "onCancel"
|
|
29
|
+
} | "onCancel"> & import("react").RefAttributes<any>, boolean>;
|
|
30
30
|
export default _default;
|
|
31
31
|
//# sourceMappingURL=component.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/form-token-field/index.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/form-token-field/index.tsx"],"names":[],"mappings":";AAiCA,OAAO,KAAK,EAAE,mBAAmB,EAAa,MAAM,SAAS,CAAC;AAM9D;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAE,KAAK,EAAE,mBAAmB,eA4qBzD;AAED,eAAe,cAAc,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/popover/index.tsx"],"names":[],"mappings":";AA2DA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,KAAK,EACX,YAAY,EAIZ,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/popover/index.tsx"],"names":[],"mappings":";AA2DA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,KAAK,EACX,YAAY,EAIZ,MAAM,SAAS,CAAC;AA+cjB;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,OAAO,qhCAAmC,CAAC;AAsBxD,eAAe,OAAO,CAAC"}
|
|
@@ -138,14 +138,6 @@ export declare type PopoverProps = {
|
|
|
138
138
|
* @deprecated
|
|
139
139
|
*/
|
|
140
140
|
__unstableForcePosition?: boolean;
|
|
141
|
-
/**
|
|
142
|
-
* Enables the `Popover` to shift in order to stay in view when meeting the
|
|
143
|
-
* viewport edges.
|
|
144
|
-
* _Note: this prop is deprecated. Use the `shift` prop instead._
|
|
145
|
-
*
|
|
146
|
-
* @deprecated
|
|
147
|
-
*/
|
|
148
|
-
__unstableShift?: boolean;
|
|
149
141
|
/**
|
|
150
142
|
* An object extending a `DOMRect` with an additional optional `ownerDocument`
|
|
151
143
|
* property, used to specify a fixed popover position.
|
|
@@ -168,12 +160,6 @@ export declare type PopoverProps = {
|
|
|
168
160
|
* @deprecated
|
|
169
161
|
*/
|
|
170
162
|
getAnchorRect?: (fallbackReferenceElement: Element | null) => DomRectWithOwnerDocument;
|
|
171
|
-
/**
|
|
172
|
-
* _Note: this prop is deprecated and has no effect on the component._
|
|
173
|
-
*
|
|
174
|
-
* @deprecated
|
|
175
|
-
*/
|
|
176
|
-
range?: unknown;
|
|
177
163
|
};
|
|
178
164
|
export {};
|
|
179
165
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/popover/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AACzE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAExD,aAAK,aAAa,GAAG,KAAK,GAAG,QAAQ,GAAG,QAAQ,CAAC;AACjD,aAAK,aAAa,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;AACjD,aAAK,cAAc,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;AAE1D,aAAK,wBAAwB,GAAG,OAAO,GAAG;IACzC,aAAa,CAAC,EAAE,QAAQ,CAAC;CACzB,CAAC;AAEF,oBAAY,oBAAoB,GAAG;IAClC,SAAS,EAAE,SAAS,CAAC;IACrB,aAAa,CAAC,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF,oBAAY,yBAAyB,GAAG,gBAAgB,CACvD,OAAO,GAAG,IAAI,GAAG,SAAS,CAC1B,CAAC;AACF,oBAAY,yBAAyB,GAAG;IAAE,GAAG,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE,CAAC;AAE1E,oBAAY,cAAc,GAAG,IAAI,CAAE,OAAO,EAAE,uBAAuB,CAAE,GAAG;IACvE,aAAa,CAAC,EAAE,QAAQ,CAAC;CACzB,CAAC;AAEF,oBAAY,YAAY,GAAG;IAC1B;;;;;OAKG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,OAAO,GAAG,cAAc,GAAG,IAAI,CAAC;IACzC;;;;OAI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IG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB;;;;OAIG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB;;;OAGG;IACH,QAAQ,CAAC,EACN,GAAI,aAAc,IAAK,aAAc,EAAE,GACvC,GAAI,aAAc,IAAK,aAAc,IAAK,cAAe,EAAE,CAAC;IAC/D;;;;;OAKG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;;OAKG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAGhB;;;;;;OAMG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC;;;;;OAKG;IACH,UAAU,CAAC,EAAE,wBAAwB,CAAC;IACtC;;;;;;OAMG;IACH,SAAS,CAAC,EACP,OAAO,GACP,yBAAyB,GACzB,yBAAyB,GACzB,KAAK,CAAC;IACT;;;;;OAKG;IACH,aAAa,CAAC,EAAE,CACf,wBAAwB,EAAE,OAAO,GAAG,IAAI,KACpC,wBAAwB,CAAC;CAC9B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/components",
|
|
3
|
-
"version": "21.0.
|
|
3
|
+
"version": "21.0.7",
|
|
4
4
|
"description": "UI components for WordPress.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -78,5 +78,5 @@
|
|
|
78
78
|
"publishConfig": {
|
|
79
79
|
"access": "public"
|
|
80
80
|
},
|
|
81
|
-
"gitHead": "
|
|
81
|
+
"gitHead": "6566f5fe9ece6ad5ae550349d3b1f0944a011040"
|
|
82
82
|
}
|
|
@@ -14,6 +14,15 @@ import {
|
|
|
14
14
|
useRef,
|
|
15
15
|
useMemo,
|
|
16
16
|
} from '@wordpress/element';
|
|
17
|
+
import {
|
|
18
|
+
ENTER,
|
|
19
|
+
ESCAPE,
|
|
20
|
+
UP,
|
|
21
|
+
DOWN,
|
|
22
|
+
LEFT,
|
|
23
|
+
RIGHT,
|
|
24
|
+
BACKSPACE,
|
|
25
|
+
} from '@wordpress/keycodes';
|
|
17
26
|
import { __, _n, sprintf } from '@wordpress/i18n';
|
|
18
27
|
import {
|
|
19
28
|
useInstanceId,
|
|
@@ -212,7 +221,7 @@ function useAutocomplete( {
|
|
|
212
221
|
}
|
|
213
222
|
|
|
214
223
|
function handleKeyDown( event ) {
|
|
215
|
-
backspacing.current = event.
|
|
224
|
+
backspacing.current = event.keyCode === BACKSPACE;
|
|
216
225
|
|
|
217
226
|
if ( ! autocompleter ) {
|
|
218
227
|
return;
|
|
@@ -223,8 +232,8 @@ function useAutocomplete( {
|
|
|
223
232
|
if ( event.defaultPrevented ) {
|
|
224
233
|
return;
|
|
225
234
|
}
|
|
226
|
-
switch ( event.
|
|
227
|
-
case
|
|
235
|
+
switch ( event.keyCode ) {
|
|
236
|
+
case UP:
|
|
228
237
|
setSelectedIndex(
|
|
229
238
|
( selectedIndex === 0
|
|
230
239
|
? filteredOptions.length
|
|
@@ -232,24 +241,24 @@ function useAutocomplete( {
|
|
|
232
241
|
);
|
|
233
242
|
break;
|
|
234
243
|
|
|
235
|
-
case
|
|
244
|
+
case DOWN:
|
|
236
245
|
setSelectedIndex(
|
|
237
246
|
( selectedIndex + 1 ) % filteredOptions.length
|
|
238
247
|
);
|
|
239
248
|
break;
|
|
240
249
|
|
|
241
|
-
case
|
|
250
|
+
case ESCAPE:
|
|
242
251
|
setAutocompleter( null );
|
|
243
252
|
setAutocompleterUI( null );
|
|
244
253
|
event.preventDefault();
|
|
245
254
|
break;
|
|
246
255
|
|
|
247
|
-
case
|
|
256
|
+
case ENTER:
|
|
248
257
|
select( filteredOptions[ selectedIndex ] );
|
|
249
258
|
break;
|
|
250
259
|
|
|
251
|
-
case
|
|
252
|
-
case
|
|
260
|
+
case LEFT:
|
|
261
|
+
case RIGHT:
|
|
253
262
|
reset();
|
|
254
263
|
return;
|
|
255
264
|
|
|
@@ -257,7 +266,7 @@ function useAutocomplete( {
|
|
|
257
266
|
return;
|
|
258
267
|
}
|
|
259
268
|
|
|
260
|
-
// Any handled
|
|
269
|
+
// Any handled keycode should prevent original behavior. This relies on
|
|
261
270
|
// the early return in the default case.
|
|
262
271
|
event.preventDefault();
|
|
263
272
|
}
|
|
@@ -16,13 +16,14 @@ import Button from '../button';
|
|
|
16
16
|
import Dropdown from '../dropdown';
|
|
17
17
|
import Tooltip from '../tooltip';
|
|
18
18
|
|
|
19
|
-
function Option( {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
function Option( props ) {
|
|
20
|
+
const {
|
|
21
|
+
className,
|
|
22
|
+
isSelected,
|
|
23
|
+
selectedIconProps,
|
|
24
|
+
tooltipText,
|
|
25
|
+
...additionalProps
|
|
26
|
+
} = props;
|
|
26
27
|
const optionButton = (
|
|
27
28
|
<Button
|
|
28
29
|
isPressed={ isSelected }
|
|
@@ -52,12 +53,8 @@ function Option( {
|
|
|
52
53
|
);
|
|
53
54
|
}
|
|
54
55
|
|
|
55
|
-
function DropdownLinkAction( {
|
|
56
|
-
buttonProps,
|
|
57
|
-
className,
|
|
58
|
-
dropdownProps,
|
|
59
|
-
linkText,
|
|
60
|
-
} ) {
|
|
56
|
+
function DropdownLinkAction( props ) {
|
|
57
|
+
const { buttonProps, className, dropdownProps, linkText } = props;
|
|
61
58
|
return (
|
|
62
59
|
<Dropdown
|
|
63
60
|
className={ classnames(
|
|
@@ -80,7 +77,8 @@ function DropdownLinkAction( {
|
|
|
80
77
|
);
|
|
81
78
|
}
|
|
82
79
|
|
|
83
|
-
function ButtonAction(
|
|
80
|
+
function ButtonAction( props ) {
|
|
81
|
+
const { className, children, ...additionalProps } = props;
|
|
84
82
|
return (
|
|
85
83
|
<Button
|
|
86
84
|
className={ classnames(
|
|
@@ -95,12 +93,8 @@ function ButtonAction( { className, children, ...additionalProps } ) {
|
|
|
95
93
|
);
|
|
96
94
|
}
|
|
97
95
|
|
|
98
|
-
export default function CircularOptionPicker( {
|
|
99
|
-
actions,
|
|
100
|
-
className,
|
|
101
|
-
options,
|
|
102
|
-
children,
|
|
103
|
-
} ) {
|
|
96
|
+
export default function CircularOptionPicker( props ) {
|
|
97
|
+
const { actions, className, options, children } = props;
|
|
104
98
|
return (
|
|
105
99
|
<div
|
|
106
100
|
className={ classnames(
|
|
@@ -1,54 +1,6 @@
|
|
|
1
1
|
# ColorPalette
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
The component accepts the following props.
|
|
6
|
-
|
|
7
|
-
{ colors, disableCustomColors = false, value, onChange, className, clearable = true }
|
|
8
|
-
|
|
9
|
-
### colors
|
|
10
|
-
|
|
11
|
-
Array with the colors to be shown.
|
|
12
|
-
|
|
13
|
-
- Type: `Array`
|
|
14
|
-
- Required: Yes
|
|
15
|
-
|
|
16
|
-
### disableCustomColors
|
|
17
|
-
|
|
18
|
-
Whether to allow custom color or not.
|
|
19
|
-
|
|
20
|
-
- Type: `Boolean`
|
|
21
|
-
- Required: No
|
|
22
|
-
- Default: false
|
|
23
|
-
|
|
24
|
-
### value
|
|
25
|
-
|
|
26
|
-
currently active value
|
|
27
|
-
|
|
28
|
-
- Type: `String`
|
|
29
|
-
- Required: No
|
|
30
|
-
|
|
31
|
-
### onChange
|
|
32
|
-
|
|
33
|
-
Callback called when a color is selected.
|
|
34
|
-
|
|
35
|
-
- Type: `Function`
|
|
36
|
-
- Required: Yes
|
|
37
|
-
|
|
38
|
-
### className
|
|
39
|
-
|
|
40
|
-
classes to be applied to the container.
|
|
41
|
-
|
|
42
|
-
- Type: `String`
|
|
43
|
-
- Required: No
|
|
44
|
-
|
|
45
|
-
### clearable
|
|
46
|
-
|
|
47
|
-
Whether the palette should have a clearing button or not.
|
|
48
|
-
|
|
49
|
-
- Type: `Boolean`
|
|
50
|
-
- Required: No
|
|
51
|
-
- Default: true
|
|
3
|
+
`ColorPalette` allows the user to pick a color from a list of pre-defined color entries.
|
|
52
4
|
|
|
53
5
|
## Usage
|
|
54
6
|
|
|
@@ -79,3 +31,53 @@ If you're using this component outside the editor, you can
|
|
|
79
31
|
for the `ColorPalette`'s color swatches, by rendering your `ColorPalette` with a
|
|
80
32
|
`Popover.Slot` further up the element tree and within a
|
|
81
33
|
`SlotFillProvider` overall.
|
|
34
|
+
|
|
35
|
+
## Props
|
|
36
|
+
|
|
37
|
+
The component accepts the following props.
|
|
38
|
+
|
|
39
|
+
### `colors`: `( PaletteObject | ColorObject )[]`
|
|
40
|
+
|
|
41
|
+
Array with the colors to be shown. When displaying multiple color palettes to choose from, the format of the array changes from an array of colors objects, to an array of color palettes.
|
|
42
|
+
|
|
43
|
+
- Required: No
|
|
44
|
+
- Default: `[]`
|
|
45
|
+
|
|
46
|
+
### `disableCustomColors`: `boolean`
|
|
47
|
+
|
|
48
|
+
Whether to allow the user to pick a custom color on top of the predefined choices (defined via the `colors` prop).
|
|
49
|
+
|
|
50
|
+
- Required: No
|
|
51
|
+
- Default: `false`
|
|
52
|
+
|
|
53
|
+
### `enableAlpha`: `boolean`
|
|
54
|
+
|
|
55
|
+
Whether the color picker should display the alpha channel both in the bottom inputs as well as in the color picker itself.
|
|
56
|
+
|
|
57
|
+
- Required: No
|
|
58
|
+
- Default: `false`
|
|
59
|
+
|
|
60
|
+
### `value`: `string`
|
|
61
|
+
|
|
62
|
+
currently active value
|
|
63
|
+
|
|
64
|
+
- Required: No
|
|
65
|
+
|
|
66
|
+
### `onChange`: `OnColorChange`
|
|
67
|
+
|
|
68
|
+
Callback called when a color is selected.
|
|
69
|
+
|
|
70
|
+
- Required: Yes
|
|
71
|
+
|
|
72
|
+
### `className`: `string`
|
|
73
|
+
|
|
74
|
+
classes to be applied to the container.
|
|
75
|
+
|
|
76
|
+
- Required: No
|
|
77
|
+
|
|
78
|
+
### `clearable`: `boolean`
|
|
79
|
+
|
|
80
|
+
Whether the palette should have a clearing button.
|
|
81
|
+
|
|
82
|
+
- Required: No
|
|
83
|
+
- Default: `true`
|