@wordpress/components 29.1.1 → 29.3.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 +29 -6
- package/CONTRIBUTING.md +4 -4
- package/README.md +1 -1
- package/build/badge/index.js +26 -22
- package/build/badge/index.js.map +1 -1
- package/build/border-box-control/border-box-control-linked-button/component.js +8 -15
- package/build/border-box-control/border-box-control-linked-button/component.js.map +1 -1
- package/build/box-control/index.js +6 -0
- package/build/box-control/index.js.map +1 -1
- package/build/box-control/linked-button.js +7 -11
- package/build/box-control/linked-button.js.map +1 -1
- package/build/box-control/types.js.map +1 -1
- package/build/circular-option-picker/circular-option-picker-option.js +9 -7
- package/build/circular-option-picker/circular-option-picker-option.js.map +1 -1
- package/build/circular-option-picker/circular-option-picker.js +0 -1
- package/build/circular-option-picker/circular-option-picker.js.map +1 -1
- package/build/color-palette/index.js +1 -6
- package/build/color-palette/index.js.map +1 -1
- package/build/font-size-picker/index.native.js +1 -1
- package/build/font-size-picker/index.native.js.map +1 -1
- package/build/higher-order/with-focus-return/index.js +1 -1
- package/build/higher-order/with-focus-return/index.js.map +1 -1
- package/build/input-control/styles/input-control-styles.js +22 -22
- package/build/input-control/styles/input-control-styles.js.map +1 -1
- package/build/menu/checkbox-item.js +6 -6
- package/build/menu/checkbox-item.js.map +1 -1
- package/build/menu/context.js +2 -2
- package/build/menu/context.js.map +1 -1
- package/build/menu/group-label.js +4 -4
- package/build/menu/group-label.js.map +1 -1
- package/build/menu/group.js +4 -4
- package/build/menu/group.js.map +1 -1
- package/build/menu/index.js +87 -14
- package/build/menu/index.js.map +1 -1
- package/build/menu/item-help-text.js +4 -4
- package/build/menu/item-help-text.js.map +1 -1
- package/build/menu/item-label.js +4 -4
- package/build/menu/item-label.js.map +1 -1
- package/build/menu/item.js +6 -6
- package/build/menu/item.js.map +1 -1
- package/build/menu/popover.js +5 -5
- package/build/menu/popover.js.map +1 -1
- package/build/menu/radio-item.js +6 -6
- package/build/menu/radio-item.js.map +1 -1
- package/build/menu/separator.js +4 -4
- package/build/menu/separator.js.map +1 -1
- package/build/menu/styles.js +41 -41
- package/build/menu/styles.js.map +1 -1
- package/build/menu/submenu-trigger-item.js +5 -5
- package/build/menu/submenu-trigger-item.js.map +1 -1
- package/build/menu/trigger-button.js +3 -3
- package/build/menu/trigger-button.js.map +1 -1
- package/build/menu/types.js.map +1 -1
- package/build/mobile/bottom-sheet/nav-bar/action-button.native.js +1 -1
- package/build/mobile/bottom-sheet/nav-bar/action-button.native.js.map +1 -1
- package/build/mobile/utils/get-px-from-css-unit.native.js +3 -3
- package/build/mobile/utils/get-px-from-css-unit.native.js.map +1 -1
- package/build/notice/types.js.map +1 -1
- package/build/search-control/index.js +1 -1
- package/build/search-control/index.js.map +1 -1
- package/build/text/hook.js +8 -6
- package/build/text/hook.js.map +1 -1
- package/build/text/utils.js +1 -1
- package/build/text/utils.js.map +1 -1
- package/build-module/badge/index.js +28 -22
- package/build-module/badge/index.js.map +1 -1
- package/build-module/border-box-control/border-box-control-linked-button/component.js +8 -15
- package/build-module/border-box-control/border-box-control-linked-button/component.js.map +1 -1
- package/build-module/box-control/index.js +6 -0
- package/build-module/box-control/index.js.map +1 -1
- package/build-module/box-control/linked-button.js +7 -11
- package/build-module/box-control/linked-button.js.map +1 -1
- package/build-module/box-control/types.js.map +1 -1
- package/build-module/circular-option-picker/circular-option-picker-option.js +9 -7
- package/build-module/circular-option-picker/circular-option-picker-option.js.map +1 -1
- package/build-module/circular-option-picker/circular-option-picker.js +0 -1
- package/build-module/circular-option-picker/circular-option-picker.js.map +1 -1
- package/build-module/color-palette/index.js +1 -6
- package/build-module/color-palette/index.js.map +1 -1
- package/build-module/font-size-picker/index.native.js +1 -1
- package/build-module/font-size-picker/index.native.js.map +1 -1
- package/build-module/higher-order/with-focus-return/index.js +1 -1
- package/build-module/higher-order/with-focus-return/index.js.map +1 -1
- package/build-module/input-control/styles/input-control-styles.js +22 -22
- package/build-module/input-control/styles/input-control-styles.js.map +1 -1
- package/build-module/menu/checkbox-item.js +6 -6
- package/build-module/menu/checkbox-item.js.map +1 -1
- package/build-module/menu/context.js +1 -1
- package/build-module/menu/context.js.map +1 -1
- package/build-module/menu/group-label.js +4 -4
- package/build-module/menu/group-label.js.map +1 -1
- package/build-module/menu/group.js +4 -4
- package/build-module/menu/group.js.map +1 -1
- package/build-module/menu/index.js +99 -26
- package/build-module/menu/index.js.map +1 -1
- package/build-module/menu/item-help-text.js +4 -4
- package/build-module/menu/item-help-text.js.map +1 -1
- package/build-module/menu/item-label.js +4 -4
- package/build-module/menu/item-label.js.map +1 -1
- package/build-module/menu/item.js +6 -6
- package/build-module/menu/item.js.map +1 -1
- package/build-module/menu/popover.js +5 -5
- package/build-module/menu/popover.js.map +1 -1
- package/build-module/menu/radio-item.js +6 -6
- package/build-module/menu/radio-item.js.map +1 -1
- package/build-module/menu/separator.js +4 -4
- package/build-module/menu/separator.js.map +1 -1
- package/build-module/menu/styles.js +40 -40
- package/build-module/menu/styles.js.map +1 -1
- package/build-module/menu/submenu-trigger-item.js +6 -6
- package/build-module/menu/submenu-trigger-item.js.map +1 -1
- package/build-module/menu/trigger-button.js +3 -3
- package/build-module/menu/trigger-button.js.map +1 -1
- package/build-module/menu/types.js.map +1 -1
- package/build-module/mobile/bottom-sheet/nav-bar/action-button.native.js +1 -1
- package/build-module/mobile/bottom-sheet/nav-bar/action-button.native.js.map +1 -1
- package/build-module/mobile/utils/get-px-from-css-unit.native.js +3 -3
- package/build-module/mobile/utils/get-px-from-css-unit.native.js.map +1 -1
- package/build-module/notice/types.js.map +1 -1
- package/build-module/search-control/index.js +1 -1
- package/build-module/search-control/index.js.map +1 -1
- package/build-module/text/hook.js +8 -6
- package/build-module/text/hook.js.map +1 -1
- package/build-module/text/utils.js +1 -1
- package/build-module/text/utils.js.map +1 -1
- package/build-style/style-rtl.css +89 -170
- package/build-style/style.css +89 -170
- package/build-types/badge/index.d.ts.map +1 -1
- package/build-types/border-box-control/border-box-control-linked-button/component.d.ts.map +1 -1
- package/build-types/box-control/index.d.ts.map +1 -1
- package/build-types/box-control/linked-button.d.ts.map +1 -1
- package/build-types/box-control/stories/index.story.d.ts +7 -2331
- package/build-types/box-control/stories/index.story.d.ts.map +1 -1
- package/build-types/box-control/types.d.ts +15 -3
- package/build-types/box-control/types.d.ts.map +1 -1
- package/build-types/circular-option-picker/circular-option-picker-option.d.ts.map +1 -1
- package/build-types/circular-option-picker/circular-option-picker.d.ts.map +1 -1
- package/build-types/circular-option-picker/stories/index.story.d.ts.map +1 -1
- package/build-types/color-palette/index.d.ts.map +1 -1
- package/build-types/higher-order/with-focus-return/index.d.ts +1 -1
- package/build-types/input-control/styles/input-control-styles.d.ts.map +1 -1
- package/build-types/menu/checkbox-item.d.ts +2 -2
- package/build-types/menu/checkbox-item.d.ts.map +1 -1
- package/build-types/menu/context.d.ts +2 -2
- package/build-types/menu/context.d.ts.map +1 -1
- package/build-types/menu/group-label.d.ts +2 -2
- package/build-types/menu/group-label.d.ts.map +1 -1
- package/build-types/menu/group.d.ts +2 -2
- package/build-types/menu/group.d.ts.map +1 -1
- package/build-types/menu/index.d.ts +84 -12
- package/build-types/menu/index.d.ts.map +1 -1
- package/build-types/menu/item-help-text.d.ts +1 -1
- package/build-types/menu/item-help-text.d.ts.map +1 -1
- package/build-types/menu/item-label.d.ts +1 -1
- package/build-types/menu/item-label.d.ts.map +1 -1
- package/build-types/menu/item.d.ts +2 -2
- package/build-types/menu/item.d.ts.map +1 -1
- package/build-types/menu/popover.d.ts +2 -2
- package/build-types/menu/popover.d.ts.map +1 -1
- package/build-types/menu/radio-item.d.ts +2 -2
- package/build-types/menu/radio-item.d.ts.map +1 -1
- package/build-types/menu/separator.d.ts +2 -2
- package/build-types/menu/separator.d.ts.map +1 -1
- package/build-types/menu/styles.d.ts +15 -15
- package/build-types/menu/styles.d.ts.map +1 -1
- package/build-types/menu/submenu-trigger-item.d.ts +2 -2
- package/build-types/menu/submenu-trigger-item.d.ts.map +1 -1
- package/build-types/menu/trigger-button.d.ts +2 -2
- package/build-types/menu/trigger-button.d.ts.map +1 -1
- package/build-types/menu/types.d.ts +10 -10
- package/build-types/menu/types.d.ts.map +1 -1
- package/build-types/menu-group/stories/index.story.d.ts +1 -1
- package/build-types/notice/types.d.ts +1 -1
- package/build-types/progress-bar/stories/index.story.d.ts +1 -1
- package/build-types/tabs/stories/index.story.d.ts +0 -3
- package/build-types/tabs/stories/index.story.d.ts.map +1 -1
- package/build-types/text/hook.d.ts.map +1 -1
- package/build-types/text/utils.d.ts +1 -1
- package/package.json +19 -19
- package/src/animate/style.scss +16 -12
- package/src/badge/index.tsx +28 -27
- package/src/border-box-control/border-box-control-linked-button/component.tsx +9 -14
- package/src/border-control/test/index.js +12 -4
- package/src/box-control/index.tsx +9 -0
- package/src/box-control/linked-button.tsx +8 -11
- package/src/box-control/test/index.tsx +9 -2
- package/src/box-control/types.ts +26 -11
- package/src/button/style.scss +15 -12
- package/src/checkbox-control/style.scss +4 -2
- package/src/circular-option-picker/README.md +1 -2
- package/src/circular-option-picker/circular-option-picker-option.tsx +17 -10
- package/src/circular-option-picker/circular-option-picker.tsx +0 -1
- package/src/circular-option-picker/stories/index.story.tsx +0 -1
- package/src/circular-option-picker/style.scss +10 -5
- package/src/color-palette/index.tsx +0 -7
- package/src/color-palette/test/index.tsx +2 -8
- package/src/combobox-control/test/index.tsx +1 -1
- package/src/drop-zone/style.scss +6 -9
- package/src/font-size-picker/index.native.js +1 -1
- package/src/form-toggle/style.scss +17 -10
- package/src/form-token-field/style.scss +9 -4
- package/src/higher-order/navigate-regions/style.scss +2 -2
- package/src/higher-order/with-focus-return/index.tsx +1 -1
- package/src/input-control/styles/input-control-styles.tsx +6 -0
- package/src/menu/README.md +421 -174
- package/src/menu/checkbox-item.tsx +12 -12
- package/src/menu/context.tsx +2 -4
- package/src/menu/docs-manifest.json +62 -0
- package/src/menu/group-label.tsx +7 -7
- package/src/menu/group.tsx +7 -11
- package/src/menu/index.tsx +101 -31
- package/src/menu/item-help-text.tsx +5 -7
- package/src/menu/item-label.tsx +5 -7
- package/src/menu/item.tsx +12 -12
- package/src/menu/popover.tsx +9 -9
- package/src/menu/radio-item.tsx +12 -12
- package/src/menu/separator.tsx +7 -7
- package/src/menu/stories/best-practices.mdx +38 -0
- package/src/menu/stories/index.story.tsx +8 -8
- package/src/menu/styles.ts +24 -24
- package/src/menu/submenu-trigger-item.tsx +9 -9
- package/src/menu/trigger-button.tsx +6 -6
- package/src/menu/types.ts +10 -10
- package/src/menu-group/stories/index.story.tsx +2 -2
- package/src/mobile/bottom-sheet/nav-bar/action-button.native.js +1 -1
- package/src/mobile/utils/get-px-from-css-unit.native.js +3 -3
- package/src/modal/style.scss +4 -2
- package/src/modal/test/index.tsx +5 -4
- package/src/notice/README.md +3 -3
- package/src/notice/types.ts +1 -1
- package/src/palette-edit/test/index.tsx +1 -1
- package/src/panel/style.scss +14 -6
- package/src/placeholder/style.scss +5 -3
- package/src/progress-bar/stories/index.story.tsx +1 -1
- package/src/resizable-box/style.scss +14 -9
- package/src/search-control/index.tsx +1 -1
- package/src/tab-panel/style.scss +6 -4
- package/src/tabs/stories/index.story.tsx +0 -131
- package/src/text/README.md +1 -1
- package/src/text/hook.ts +3 -2
- package/src/text/stories/index.story.tsx +2 -2
- package/src/text/test/index.tsx +1 -1
- package/src/text/utils.ts +1 -1
- package/src/text-highlight/test/index.tsx +3 -3
- package/src/toolbar/toolbar/style.scss +4 -3
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
4
|
import type * as Ariakit from '@ariakit/react';
|
|
5
|
-
export interface
|
|
5
|
+
export interface ContextProps {
|
|
6
6
|
/**
|
|
7
7
|
* The ariakit store shared across all Menu subcomponents.
|
|
8
8
|
*/
|
|
@@ -12,7 +12,7 @@ export interface MenuContext {
|
|
|
12
12
|
*/
|
|
13
13
|
variant?: 'toolbar';
|
|
14
14
|
}
|
|
15
|
-
export interface
|
|
15
|
+
export interface Props {
|
|
16
16
|
/**
|
|
17
17
|
* The elements, which should include one instance of the `Menu.TriggerButton`
|
|
18
18
|
* component and one instance of the `Menu.Popover` component.
|
|
@@ -47,7 +47,7 @@ export interface MenuProps {
|
|
|
47
47
|
*/
|
|
48
48
|
placement?: Ariakit.MenuProviderProps['placement'];
|
|
49
49
|
}
|
|
50
|
-
export interface
|
|
50
|
+
export interface PopoverProps {
|
|
51
51
|
/**
|
|
52
52
|
* The contents of the menu popover, which should include instances of the
|
|
53
53
|
* `Menu.Item`, `Menu.CheckboxItem`, `Menu.RadioItem`, `Menu.Group`, and
|
|
@@ -94,7 +94,7 @@ export interface MenuPopoverProps {
|
|
|
94
94
|
*/
|
|
95
95
|
hideOnEscape?: Ariakit.MenuProps['hideOnEscape'];
|
|
96
96
|
}
|
|
97
|
-
export interface
|
|
97
|
+
export interface TriggerButtonProps {
|
|
98
98
|
/**
|
|
99
99
|
* The contents of the menu trigger button.
|
|
100
100
|
*/
|
|
@@ -134,7 +134,7 @@ export interface MenuTriggerButtonProps {
|
|
|
134
134
|
*/
|
|
135
135
|
accessibleWhenDisabled?: Ariakit.MenuButtonProps['accessibleWhenDisabled'];
|
|
136
136
|
}
|
|
137
|
-
export interface
|
|
137
|
+
export interface GroupProps {
|
|
138
138
|
/**
|
|
139
139
|
* The contents of the menu group, which should include one instance of the
|
|
140
140
|
* `Menu.GroupLabel` component and one or more instances of `Menu.Item`,
|
|
@@ -142,14 +142,14 @@ export interface MenuGroupProps {
|
|
|
142
142
|
*/
|
|
143
143
|
children: Ariakit.MenuGroupProps['children'];
|
|
144
144
|
}
|
|
145
|
-
export interface
|
|
145
|
+
export interface GroupLabelProps {
|
|
146
146
|
/**
|
|
147
147
|
* The contents of the menu group label, which should provide an accessible
|
|
148
148
|
* label for the menu group.
|
|
149
149
|
*/
|
|
150
150
|
children: Ariakit.MenuGroupLabelProps['children'];
|
|
151
151
|
}
|
|
152
|
-
export interface
|
|
152
|
+
export interface ItemProps {
|
|
153
153
|
/**
|
|
154
154
|
* The contents of the menu item, which could include one instance of the
|
|
155
155
|
* `Menu.ItemLabel` component and/or one instance of the `Menu.ItemHelpText`
|
|
@@ -195,7 +195,7 @@ export interface MenuItemProps {
|
|
|
195
195
|
*/
|
|
196
196
|
store?: Ariakit.MenuItemProps['store'];
|
|
197
197
|
}
|
|
198
|
-
export interface
|
|
198
|
+
export interface CheckboxItemProps {
|
|
199
199
|
/**
|
|
200
200
|
* The contents of the menu item, which could include one instance of the
|
|
201
201
|
* `Menu.ItemLabel` component and/or one instance of the `Menu.ItemHelpText`
|
|
@@ -258,7 +258,7 @@ export interface MenuCheckboxItemProps {
|
|
|
258
258
|
*/
|
|
259
259
|
onChange?: Ariakit.MenuItemCheckboxProps['onChange'];
|
|
260
260
|
}
|
|
261
|
-
export interface
|
|
261
|
+
export interface RadioItemProps {
|
|
262
262
|
/**
|
|
263
263
|
* The contents of the menu item, which could include one instance of the
|
|
264
264
|
* `Menu.ItemLabel` component and/or one instance of the `Menu.ItemHelpText`
|
|
@@ -320,6 +320,6 @@ export interface MenuRadioItemProps {
|
|
|
320
320
|
*/
|
|
321
321
|
onChange?: Ariakit.MenuItemRadioProps['onChange'];
|
|
322
322
|
}
|
|
323
|
-
export interface
|
|
323
|
+
export interface SeparatorProps {
|
|
324
324
|
}
|
|
325
325
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/menu/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAE/C,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/menu/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAE/C,MAAM,WAAW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cAAc,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAE,gBAAgB,CAAE,CAAC;IAChE;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAE,UAAU,CAAE,CAAC;CACpD;AAED,MAAM,WAAW,cAAc;CAAG"}
|
|
@@ -13,5 +13,5 @@ export declare const Default: StoryFn<typeof MenuGroup>;
|
|
|
13
13
|
* When other menu items exist above or below a MenuGroup, the group
|
|
14
14
|
* should have a divider line between it and the adjacent item.
|
|
15
15
|
*/
|
|
16
|
-
export declare const
|
|
16
|
+
export declare const WithSeparator: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, import("../types").MenuGroupProps>;
|
|
17
17
|
//# sourceMappingURL=index.story.d.ts.map
|
|
@@ -15,7 +15,7 @@ export declare const Default: StoryFn<typeof ProgressBar>;
|
|
|
15
15
|
* You can override the default `width` by passing a custom CSS class via the
|
|
16
16
|
* `className` prop.
|
|
17
17
|
*
|
|
18
|
-
* This example shows a progress bar with an
|
|
18
|
+
* This example shows a progress bar with an overridden `width` of `100%` which
|
|
19
19
|
* makes it fit all available horizontal space of the parent element. The CSS
|
|
20
20
|
* class looks like this:
|
|
21
21
|
*
|
|
@@ -16,7 +16,4 @@ export declare const WithTabIconsAndTooltips: import("@storybook/csf").Annotated
|
|
|
16
16
|
export declare const ManualActivation: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, import("../types").TabsProps>;
|
|
17
17
|
export declare const UsingSlotFill: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, import("../types").TabsProps>;
|
|
18
18
|
export declare const InsertCustomElements: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, import("../types").TabsProps>;
|
|
19
|
-
export declare const ControlledMode: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, import("../types").TabsProps>;
|
|
20
|
-
export declare const TabBecomesDisabled: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, import("../types").TabsProps>;
|
|
21
|
-
export declare const TabGetsRemoved: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, import("../types").TabsProps>;
|
|
22
19
|
//# sourceMappingURL=index.story.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../src/tabs/stories/index.story.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAStD;;GAEG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../src/tabs/stories/index.story.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAStD;;GAEG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAM1B,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,IAAI,CAwB5B,CAAC;AACF,eAAe,IAAI,CAAC;AA+BpB,eAAO,MAAM,OAAO,mHAAsB,CAAC;AAE3C,eAAO,MAAM,yBAAyB,EAAE,OAAO,CAAE,OAAO,IAAI,CAqG3D,CAAC;AAiBF,eAAO,MAAM,QAAQ,mHAA8B,CAAC;AAwBpD,eAAO,MAAM,WAAW,mHAAiC,CAAC;AA0C1D,eAAO,MAAM,uBAAuB,mHAEnC,CAAC;AAEF,eAAO,MAAM,gBAAgB,mHAAsB,CAAC;AA0CpD,eAAO,MAAM,aAAa,mHAAmC,CAAC;AA0D9D,eAAO,MAAM,oBAAoB,mHAAiC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hook.d.ts","sourceRoot":"","sources":["../../src/text/hook.ts"],"names":[],"mappings":"AAWA;;GAEG;AACH,OAAO,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;;;;;;;;;;EA8J/C"}
|
|
@@ -15,7 +15,7 @@ import type { FindAllArgs } from 'highlight-words-core';
|
|
|
15
15
|
* @property {string | Record<string, unknown>} [highlightClassName=''] Classname to apply to highlighted text or a Record of classnames to apply to given text (which should be the key).
|
|
16
16
|
* @property {import('react').AllHTMLAttributes<HTMLDivElement>['style']} [highlightStyle={}] Styles to apply to highlighted text.
|
|
17
17
|
* @property {keyof JSX.IntrinsicElements} [highlightTag='mark'] Tag to use for the highlighted text.
|
|
18
|
-
* @property {import('highlight-words-core').FindAllArgs['sanitize']} [sanitize] Custom `
|
|
18
|
+
* @property {import('highlight-words-core').FindAllArgs['sanitize']} [sanitize] Custom `sanitize` function to pass to `highlight-words-core`.
|
|
19
19
|
* @property {string[]} [searchWords=[]] Words to search for and highlight.
|
|
20
20
|
* @property {string} [unhighlightClassName=''] Classname to apply to unhighlighted text.
|
|
21
21
|
* @property {import('react').AllHTMLAttributes<HTMLDivElement>['style']} [unhighlightStyle] Style to apply to unhighlighted text.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/components",
|
|
3
|
-
"version": "29.
|
|
3
|
+
"version": "29.3.0",
|
|
4
4
|
"description": "UI components for WordPress.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -44,23 +44,23 @@
|
|
|
44
44
|
"@types/gradient-parser": "0.1.3",
|
|
45
45
|
"@types/highlight-words-core": "1.2.1",
|
|
46
46
|
"@use-gesture/react": "^10.3.1",
|
|
47
|
-
"@wordpress/a11y": "^4.
|
|
48
|
-
"@wordpress/compose": "^7.
|
|
49
|
-
"@wordpress/date": "^5.
|
|
50
|
-
"@wordpress/deprecated": "^4.
|
|
51
|
-
"@wordpress/dom": "^4.
|
|
52
|
-
"@wordpress/element": "^6.
|
|
53
|
-
"@wordpress/escape-html": "^3.
|
|
54
|
-
"@wordpress/hooks": "^4.
|
|
55
|
-
"@wordpress/html-entities": "^4.
|
|
56
|
-
"@wordpress/i18n": "^5.
|
|
57
|
-
"@wordpress/icons": "^10.
|
|
58
|
-
"@wordpress/is-shallow-equal": "^5.
|
|
59
|
-
"@wordpress/keycodes": "^4.
|
|
60
|
-
"@wordpress/primitives": "^4.
|
|
61
|
-
"@wordpress/private-apis": "^1.
|
|
62
|
-
"@wordpress/rich-text": "^7.
|
|
63
|
-
"@wordpress/warning": "^3.
|
|
47
|
+
"@wordpress/a11y": "^4.17.0",
|
|
48
|
+
"@wordpress/compose": "^7.17.0",
|
|
49
|
+
"@wordpress/date": "^5.17.0",
|
|
50
|
+
"@wordpress/deprecated": "^4.17.0",
|
|
51
|
+
"@wordpress/dom": "^4.17.0",
|
|
52
|
+
"@wordpress/element": "^6.17.0",
|
|
53
|
+
"@wordpress/escape-html": "^3.17.0",
|
|
54
|
+
"@wordpress/hooks": "^4.17.0",
|
|
55
|
+
"@wordpress/html-entities": "^4.17.0",
|
|
56
|
+
"@wordpress/i18n": "^5.17.0",
|
|
57
|
+
"@wordpress/icons": "^10.17.0",
|
|
58
|
+
"@wordpress/is-shallow-equal": "^5.17.0",
|
|
59
|
+
"@wordpress/keycodes": "^4.17.0",
|
|
60
|
+
"@wordpress/primitives": "^4.17.0",
|
|
61
|
+
"@wordpress/private-apis": "^1.17.0",
|
|
62
|
+
"@wordpress/rich-text": "^7.17.0",
|
|
63
|
+
"@wordpress/warning": "^3.17.0",
|
|
64
64
|
"change-case": "^4.1.2",
|
|
65
65
|
"clsx": "^2.1.1",
|
|
66
66
|
"colord": "^2.7.0",
|
|
@@ -85,5 +85,5 @@
|
|
|
85
85
|
"publishConfig": {
|
|
86
86
|
"access": "public"
|
|
87
87
|
},
|
|
88
|
-
"gitHead": "
|
|
88
|
+
"gitHead": "68a831c3178197fe87db284d4b94e5743bfb6b6c"
|
|
89
89
|
}
|
package/src/animate/style.scss
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
.components-animate__appear {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
@media not (prefers-reduced-motion) {
|
|
3
|
+
animation: components-animate__appear-animation 0.1s cubic-bezier(0, 0, 0.2, 1) 0s;
|
|
4
|
+
animation-fill-mode: forwards;
|
|
5
|
+
}
|
|
5
6
|
|
|
6
7
|
&.is-from-top,
|
|
7
8
|
&.is-from-top.is-from-left {
|
|
@@ -29,16 +30,17 @@
|
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
.components-animate__slide-in {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
@media not (prefers-reduced-motion) {
|
|
34
|
+
animation: components-animate__slide-in-animation 0.1s cubic-bezier(0, 0, 0.2, 1);
|
|
35
|
+
animation-fill-mode: forwards;
|
|
35
36
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
&.is-from-left {
|
|
38
|
+
transform: translateX(+100%);
|
|
39
|
+
}
|
|
39
40
|
|
|
40
|
-
|
|
41
|
-
|
|
41
|
+
&.is-from-right {
|
|
42
|
+
transform: translateX(-100%);
|
|
43
|
+
}
|
|
42
44
|
}
|
|
43
45
|
}
|
|
44
46
|
|
|
@@ -49,7 +51,9 @@
|
|
|
49
51
|
}
|
|
50
52
|
|
|
51
53
|
.components-animate__loading {
|
|
52
|
-
|
|
54
|
+
@media not (prefers-reduced-motion) {
|
|
55
|
+
animation: components-animate__loading 1.6s ease-in-out infinite;
|
|
56
|
+
}
|
|
53
57
|
}
|
|
54
58
|
|
|
55
59
|
@keyframes components-animate__loading {
|
package/src/badge/index.tsx
CHANGED
|
@@ -15,45 +15,46 @@ import type { BadgeProps } from './types';
|
|
|
15
15
|
import type { WordPressComponentProps } from '../context';
|
|
16
16
|
import Icon from '../icon';
|
|
17
17
|
|
|
18
|
+
/**
|
|
19
|
+
* Returns an icon based on the badge context.
|
|
20
|
+
*
|
|
21
|
+
* @return The corresponding icon for the provided context.
|
|
22
|
+
*/
|
|
23
|
+
function contextBasedIcon( intent: BadgeProps[ 'intent' ] = 'default' ) {
|
|
24
|
+
switch ( intent ) {
|
|
25
|
+
case 'info':
|
|
26
|
+
return info;
|
|
27
|
+
case 'success':
|
|
28
|
+
return published;
|
|
29
|
+
case 'warning':
|
|
30
|
+
return caution;
|
|
31
|
+
case 'error':
|
|
32
|
+
return error;
|
|
33
|
+
default:
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
18
38
|
function Badge( {
|
|
19
39
|
className,
|
|
20
40
|
intent = 'default',
|
|
21
41
|
children,
|
|
22
42
|
...props
|
|
23
43
|
}: WordPressComponentProps< BadgeProps, 'span', false > ) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
*
|
|
27
|
-
* @return The corresponding icon for the provided context.
|
|
28
|
-
*/
|
|
29
|
-
function contextBasedIcon() {
|
|
30
|
-
switch ( intent ) {
|
|
31
|
-
case 'info':
|
|
32
|
-
return info;
|
|
33
|
-
case 'success':
|
|
34
|
-
return published;
|
|
35
|
-
case 'warning':
|
|
36
|
-
return caution;
|
|
37
|
-
case 'error':
|
|
38
|
-
return error;
|
|
39
|
-
default:
|
|
40
|
-
return null;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
44
|
+
const icon = contextBasedIcon( intent );
|
|
45
|
+
const hasIcon = !! icon;
|
|
43
46
|
|
|
44
47
|
return (
|
|
45
48
|
<span
|
|
46
|
-
className={ clsx(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
className
|
|
51
|
-
) }
|
|
49
|
+
className={ clsx( 'components-badge', className, {
|
|
50
|
+
[ `is-${ intent }` ]: intent,
|
|
51
|
+
'has-icon': hasIcon,
|
|
52
|
+
} ) }
|
|
52
53
|
{ ...props }
|
|
53
54
|
>
|
|
54
|
-
{
|
|
55
|
+
{ hasIcon && (
|
|
55
56
|
<Icon
|
|
56
|
-
icon={
|
|
57
|
+
icon={ icon }
|
|
57
58
|
size={ 16 }
|
|
58
59
|
fill="currentColor"
|
|
59
60
|
className="components-badge__icon"
|
|
@@ -8,8 +8,6 @@ import { __ } from '@wordpress/i18n';
|
|
|
8
8
|
* Internal dependencies
|
|
9
9
|
*/
|
|
10
10
|
import Button from '../../button';
|
|
11
|
-
import Tooltip from '../../tooltip';
|
|
12
|
-
import { View } from '../../view';
|
|
13
11
|
import type { WordPressComponentProps } from '../../context';
|
|
14
12
|
import { contextConnect } from '../../context';
|
|
15
13
|
import { useBorderBoxControlLinkedButton } from './hook';
|
|
@@ -25,18 +23,15 @@ const BorderBoxControlLinkedButton = (
|
|
|
25
23
|
const label = isLinked ? __( 'Unlink sides' ) : __( 'Link sides' );
|
|
26
24
|
|
|
27
25
|
return (
|
|
28
|
-
<
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
/>
|
|
38
|
-
</View>
|
|
39
|
-
</Tooltip>
|
|
26
|
+
<Button
|
|
27
|
+
{ ...buttonProps }
|
|
28
|
+
size="small"
|
|
29
|
+
icon={ isLinked ? link : linkOff }
|
|
30
|
+
iconSize={ 24 }
|
|
31
|
+
label={ label }
|
|
32
|
+
ref={ forwardedRef }
|
|
33
|
+
className={ className }
|
|
34
|
+
/>
|
|
40
35
|
);
|
|
41
36
|
};
|
|
42
37
|
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
fireEvent,
|
|
6
|
+
render,
|
|
7
|
+
screen,
|
|
8
|
+
waitFor,
|
|
9
|
+
within,
|
|
10
|
+
} from '@testing-library/react';
|
|
5
11
|
import userEvent from '@testing-library/user-event';
|
|
6
12
|
|
|
7
13
|
/**
|
|
@@ -56,7 +62,7 @@ const getButton = ( name ) => {
|
|
|
56
62
|
};
|
|
57
63
|
|
|
58
64
|
const getColorOption = ( color ) => {
|
|
59
|
-
return screen.getByRole( 'option', { name:
|
|
65
|
+
return screen.getByRole( 'option', { name: `${ color }` } );
|
|
60
66
|
};
|
|
61
67
|
|
|
62
68
|
const queryButton = ( name ) => {
|
|
@@ -131,9 +137,11 @@ describe( 'BorderControl', () => {
|
|
|
131
137
|
await openPopover( user );
|
|
132
138
|
|
|
133
139
|
const customColorPicker = getButton( /Custom color picker/ );
|
|
134
|
-
const
|
|
135
|
-
name:
|
|
140
|
+
const circularOptionPicker = screen.getByRole( 'listbox', {
|
|
141
|
+
name: 'Custom color picker.',
|
|
136
142
|
} );
|
|
143
|
+
const colorSwatchButtons =
|
|
144
|
+
within( circularOptionPicker ).getAllByRole( 'option' );
|
|
137
145
|
const styleLabel = screen.getByText( 'Style' );
|
|
138
146
|
const solidButton = getButton( 'Solid' );
|
|
139
147
|
const dashedButton = getButton( 'Dashed' );
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import { useInstanceId } from '@wordpress/compose';
|
|
5
5
|
import { useState } from '@wordpress/element';
|
|
6
6
|
import { __ } from '@wordpress/i18n';
|
|
7
|
+
import warning from '@wordpress/warning';
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* Internal dependencies
|
|
@@ -166,6 +167,14 @@ function BoxControl( {
|
|
|
166
167
|
} );
|
|
167
168
|
const sidesToRender = getAllowedSides( sides );
|
|
168
169
|
|
|
170
|
+
if ( ( presets && ! presetKey ) || ( ! presets && presetKey ) ) {
|
|
171
|
+
const definedProp = presets ? 'presets' : 'presetKey';
|
|
172
|
+
const missingProp = presets ? 'presetKey' : 'presets';
|
|
173
|
+
warning(
|
|
174
|
+
`wp.components.BoxControl: the '${ missingProp }' prop is required when the '${ definedProp }' prop is defined.`
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
|
|
169
178
|
return (
|
|
170
179
|
<Grid
|
|
171
180
|
id={ id }
|
|
@@ -8,7 +8,6 @@ import { __ } from '@wordpress/i18n';
|
|
|
8
8
|
* Internal dependencies
|
|
9
9
|
*/
|
|
10
10
|
import Button from '../button';
|
|
11
|
-
import Tooltip from '../tooltip';
|
|
12
11
|
|
|
13
12
|
export default function LinkedButton( {
|
|
14
13
|
isLinked,
|
|
@@ -17,15 +16,13 @@ export default function LinkedButton( {
|
|
|
17
16
|
const label = isLinked ? __( 'Unlink sides' ) : __( 'Link sides' );
|
|
18
17
|
|
|
19
18
|
return (
|
|
20
|
-
<
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
/>
|
|
29
|
-
</Tooltip>
|
|
19
|
+
<Button
|
|
20
|
+
{ ...props }
|
|
21
|
+
className="component-box-control__linked-button"
|
|
22
|
+
size="small"
|
|
23
|
+
icon={ isLinked ? link : linkOff }
|
|
24
|
+
iconSize={ 24 }
|
|
25
|
+
label={ label }
|
|
26
|
+
/>
|
|
30
27
|
);
|
|
31
28
|
}
|
|
@@ -15,8 +15,15 @@ import { useState } from '@wordpress/element';
|
|
|
15
15
|
import BoxControl from '..';
|
|
16
16
|
import type { BoxControlProps, BoxControlValue } from '../types';
|
|
17
17
|
|
|
18
|
+
// Since `BoxControlProps` is a the result of type unions, we need to use
|
|
19
|
+
// a distributive version of the standard `Omit` utility.
|
|
20
|
+
// See https://stackoverflow.com/a/57103940
|
|
21
|
+
type DistributiveOmit< T, K extends keyof any > = T extends any
|
|
22
|
+
? Omit< T, K >
|
|
23
|
+
: never;
|
|
24
|
+
|
|
18
25
|
const ControlledBoxControl = (
|
|
19
|
-
extraProps:
|
|
26
|
+
extraProps: DistributiveOmit< BoxControlProps, 'onChange' >
|
|
20
27
|
) => {
|
|
21
28
|
const [ state, setState ] = useState< BoxControlValue >();
|
|
22
29
|
|
|
@@ -33,7 +40,7 @@ const ControlledBoxControl = (
|
|
|
33
40
|
const UncontrolledBoxControl = ( {
|
|
34
41
|
onChange = () => {},
|
|
35
42
|
...props
|
|
36
|
-
}:
|
|
43
|
+
}: DistributiveOmit< BoxControlProps, 'onChange' > & {
|
|
37
44
|
onChange?: BoxControlProps[ 'onChange' ];
|
|
38
45
|
} ) => <BoxControl __next40pxDefaultSize onChange={ onChange } { ...props } />;
|
|
39
46
|
|
package/src/box-control/types.ts
CHANGED
|
@@ -100,17 +100,32 @@ export type BoxControlProps = Pick< UnitControlProps, 'units' > &
|
|
|
100
100
|
* @default false
|
|
101
101
|
*/
|
|
102
102
|
__next40pxDefaultSize?: boolean;
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
103
|
+
} & (
|
|
104
|
+
| {
|
|
105
|
+
/**
|
|
106
|
+
* Available presets to pick from.
|
|
107
|
+
*/
|
|
108
|
+
presets?: never;
|
|
109
|
+
/**
|
|
110
|
+
* The key of the preset to apply.
|
|
111
|
+
* If you provide a list of presets, you must provide a preset key to use.
|
|
112
|
+
* The format of preset selected values is going to be `var:preset|${ presetKey }|${ presetSlug }`
|
|
113
|
+
*/
|
|
114
|
+
presetKey?: never;
|
|
115
|
+
}
|
|
116
|
+
| {
|
|
117
|
+
/**
|
|
118
|
+
* Available presets to pick from.
|
|
119
|
+
*/
|
|
120
|
+
presets: Preset[];
|
|
121
|
+
/**
|
|
122
|
+
* The key of the preset to apply.
|
|
123
|
+
* If you provide a list of presets, you must provide a preset key to use.
|
|
124
|
+
* The format of preset selected values is going to be `var:preset|${ presetKey }|${ presetSlug }`
|
|
125
|
+
*/
|
|
126
|
+
presetKey: string;
|
|
127
|
+
}
|
|
128
|
+
);
|
|
114
129
|
|
|
115
130
|
export type BoxControlInputControlProps = UnitControlPassthroughProps & {
|
|
116
131
|
onChange?: ( nextValues: BoxControlValue ) => void;
|
package/src/button/style.scss
CHANGED
|
@@ -15,8 +15,11 @@
|
|
|
15
15
|
cursor: pointer;
|
|
16
16
|
-webkit-appearance: none;
|
|
17
17
|
background: none;
|
|
18
|
-
|
|
19
|
-
@
|
|
18
|
+
|
|
19
|
+
@media not (prefers-reduced-motion) {
|
|
20
|
+
transition: box-shadow 0.1s linear;
|
|
21
|
+
}
|
|
22
|
+
|
|
20
23
|
height: $button-size;
|
|
21
24
|
align-items: center;
|
|
22
25
|
box-sizing: border-box;
|
|
@@ -245,10 +248,13 @@
|
|
|
245
248
|
text-align: left;
|
|
246
249
|
color: $components-color-accent;
|
|
247
250
|
text-decoration: underline;
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
251
|
+
|
|
252
|
+
@media not (prefers-reduced-motion) {
|
|
253
|
+
transition-property: border, background, color;
|
|
254
|
+
transition-duration: 0.05s;
|
|
255
|
+
transition-timing-function: ease-in-out;
|
|
256
|
+
}
|
|
257
|
+
|
|
252
258
|
height: auto;
|
|
253
259
|
|
|
254
260
|
&:focus {
|
|
@@ -275,11 +281,8 @@
|
|
|
275
281
|
&.is-secondary.is-busy,
|
|
276
282
|
&.is-secondary.is-busy:disabled,
|
|
277
283
|
&.is-secondary.is-busy[aria-disabled="true"] {
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
// as soon as https://github.com/WordPress/gutenberg/issues/55566 is closed.
|
|
281
|
-
@media (prefers-reduced-motion: reduce) {
|
|
282
|
-
animation-duration: 0s;
|
|
284
|
+
@media not (prefers-reduced-motion) {
|
|
285
|
+
animation: components-button__busy-animation 2500ms infinite linear;
|
|
283
286
|
}
|
|
284
287
|
background-size: 100px 100%;
|
|
285
288
|
/* stylelint-disable -- Disable reason: This function call looks nicer when each argument is on its own line. */
|
|
@@ -376,7 +379,7 @@
|
|
|
376
379
|
fill: currentColor;
|
|
377
380
|
outline: none;
|
|
378
381
|
|
|
379
|
-
//
|
|
382
|
+
// Optimize for high contrast modes.
|
|
380
383
|
// See also https://blogs.windows.com/msedgedev/2020/09/17/styling-for-windows-high-contrast-with-new-standards-for-forced-colors/.
|
|
381
384
|
@media (forced-colors: active) {
|
|
382
385
|
fill: CanvasText;
|
|
@@ -32,8 +32,10 @@
|
|
|
32
32
|
height: var(--checkbox-input-size);
|
|
33
33
|
|
|
34
34
|
appearance: none;
|
|
35
|
-
|
|
36
|
-
@
|
|
35
|
+
|
|
36
|
+
@media not (prefers-reduced-motion) {
|
|
37
|
+
transition: 0.1s border-color ease-in-out;
|
|
38
|
+
}
|
|
37
39
|
|
|
38
40
|
&:focus {
|
|
39
41
|
@include button-style-outset__focus(var(--wp-admin-theme-color));
|
|
@@ -29,7 +29,6 @@ const Example = () => {
|
|
|
29
29
|
style={ { backgroundColor: color, color } }
|
|
30
30
|
isSelected={ index === currentColor }
|
|
31
31
|
onClick={ () => setCurrentColor( index ) }
|
|
32
|
-
aria-label={ name }
|
|
33
32
|
/>
|
|
34
33
|
);
|
|
35
34
|
} ) }
|
|
@@ -150,6 +149,6 @@ Inherits all of the [`Dropdown` props](/packages/components/src/dropdown/README.
|
|
|
150
149
|
|
|
151
150
|
Props for the underlying `Button` component.
|
|
152
151
|
|
|
153
|
-
Inherits all of the [`Button` props](/packages/components/src/button/README.md#props), except for `href`, `target`, and `children`.
|
|
152
|
+
Inherits all of the [`Button` props](/packages/components/src/button/README.md#props), except for `href`, `target`, and `children`.
|
|
154
153
|
|
|
155
154
|
- Required: No
|