@wordpress/components 29.7.0 → 29.8.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.
@@ -396,7 +396,7 @@
396
396
  color: var(--wp-components-color-accent, var(--wp-admin-theme-color, #3858e9));
397
397
  background: transparent;
398
398
  }
399
- .components-button.is-tertiary:hover:not(:disabled, [aria-disabled=true]) {
399
+ .components-button.is-tertiary:hover:not(:disabled, [aria-disabled=true], .is-pressed) {
400
400
  background: color-mix(in srgb, var(--wp-components-color-accent, var(--wp-admin-theme-color, #3858e9)) 4%, transparent);
401
401
  color: var(--wp-components-color-accent-darker-20, var(--wp-admin-theme-color-darker-20, #183ad6));
402
402
  }
@@ -894,6 +894,8 @@ input.components-combobox-control__input[type=text] {
894
894
  margin: 0;
895
895
  line-height: inherit;
896
896
  min-height: auto;
897
+ background: var(--wp-components-color-background, #fff);
898
+ color: var(--wp-components-color-foreground, #1e1e1e);
897
899
  }
898
900
  @media (min-width: 600px) {
899
901
  input.components-combobox-control__input[type=text] {
@@ -934,8 +936,8 @@ input.components-combobox-control__input[type=text]:focus {
934
936
  }
935
937
  }
936
938
  .components-combobox-control__suggestions-container:focus {
937
- border-color: var(--wp-admin-theme-color);
938
- box-shadow: 0 0 0 0.5px var(--wp-admin-theme-color);
939
+ border-color: var(--wp-components-color-accent, var(--wp-admin-theme-color, #3858e9));
940
+ box-shadow: 0 0 0 0.5px var(--wp-components-color-accent, var(--wp-admin-theme-color, #3858e9));
939
941
  outline: 2px solid transparent;
940
942
  }
941
943
  .components-combobox-control__suggestions-container::-webkit-input-placeholder {
@@ -948,8 +950,8 @@ input.components-combobox-control__input[type=text]:focus {
948
950
  color: rgba(30, 30, 30, 0.62);
949
951
  }
950
952
  .components-combobox-control__suggestions-container:focus-within {
951
- border-color: var(--wp-admin-theme-color);
952
- box-shadow: 0 0 0 0.5px var(--wp-admin-theme-color);
953
+ border-color: var(--wp-components-color-accent, var(--wp-admin-theme-color, #3858e9));
954
+ box-shadow: 0 0 0 0.5px var(--wp-components-color-accent, var(--wp-admin-theme-color, #3858e9));
953
955
  outline: 2px solid transparent;
954
956
  }
955
957
  .components-combobox-control__suggestions-container .components-spinner {
@@ -1455,8 +1457,8 @@ body.is-dragging-components-draggable {
1455
1457
  }
1456
1458
  }
1457
1459
  .components-form-token-field__input-container:focus {
1458
- border-color: var(--wp-admin-theme-color);
1459
- box-shadow: 0 0 0 0.5px var(--wp-admin-theme-color);
1460
+ border-color: var(--wp-components-color-accent, var(--wp-admin-theme-color, #3858e9));
1461
+ box-shadow: 0 0 0 0.5px var(--wp-components-color-accent, var(--wp-admin-theme-color, #3858e9));
1460
1462
  outline: 2px solid transparent;
1461
1463
  }
1462
1464
  .components-form-token-field__input-container::-webkit-input-placeholder {
@@ -1473,8 +1475,8 @@ body.is-dragging-components-draggable {
1473
1475
  border-color: #ddd;
1474
1476
  }
1475
1477
  .components-form-token-field__input-container.is-active {
1476
- border-color: var(--wp-admin-theme-color);
1477
- box-shadow: 0 0 0 0.5px var(--wp-admin-theme-color);
1478
+ border-color: var(--wp-components-color-accent, var(--wp-admin-theme-color, #3858e9));
1479
+ box-shadow: 0 0 0 0.5px var(--wp-components-color-accent, var(--wp-admin-theme-color, #3858e9));
1478
1480
  outline: 2px solid transparent;
1479
1481
  }
1480
1482
  .components-form-token-field__input-container input[type=text].components-form-token-field__input {
@@ -1490,7 +1492,7 @@ body.is-dragging-components-draggable {
1490
1492
  min-width: 50px;
1491
1493
  background: inherit;
1492
1494
  border: 0;
1493
- color: #1e1e1e;
1495
+ color: var(--wp-components-color-foreground, #1e1e1e);
1494
1496
  box-shadow: none;
1495
1497
  }
1496
1498
  @media (min-width: 600px) {
@@ -1602,7 +1604,7 @@ body.is-dragging-components-draggable {
1602
1604
  }
1603
1605
 
1604
1606
  .components-form-token-field__suggestion {
1605
- color: #1e1e1e;
1607
+ color: var(--wp-components-color-foreground, #1e1e1e);
1606
1608
  display: block;
1607
1609
  font-size: 13px;
1608
1610
  padding: 8px 12px;
@@ -1612,7 +1614,7 @@ body.is-dragging-components-draggable {
1612
1614
  }
1613
1615
  .components-form-token-field__suggestion.is-selected {
1614
1616
  background: var(--wp-components-color-accent, var(--wp-admin-theme-color, #3858e9));
1615
- color: #fff;
1617
+ color: var(--wp-components-color-foreground-inverted, #fff);
1616
1618
  }
1617
1619
  .components-form-token-field__suggestion[aria-disabled=true] {
1618
1620
  pointer-events: none;
@@ -1,11 +1,12 @@
1
1
  import type { WordPressComponentProps } from '../context';
2
- import type { PopoverProps } from './types';
2
+ import type { PopoverProps, PopoverSlotProps } from './types';
3
3
  /**
4
4
  * Name of slot in which popover should fill.
5
5
  *
6
6
  * @type {string}
7
7
  */
8
8
  export declare const SLOT_NAME = "Popover";
9
+ export declare const PopoverSlot: import("react").ForwardRefExoticComponent<PopoverSlotProps & import("react").RefAttributes<HTMLDivElement>>;
9
10
  /**
10
11
  * `Popover` renders its content in a floating modal. If no explicit anchor is passed via props, it anchors to its parent element by default.
11
12
  *
@@ -29,6 +30,21 @@ export declare const SLOT_NAME = "Popover";
29
30
  * ```
30
31
  *
31
32
  */
32
- export declare const Popover: import("../context").WordPressComponent<import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | null, Omit<WordPressComponentProps<PopoverProps, "div", false>, "inherit" | "initial" | "layout" | "drag" | "transition" | "onDrag" | "onDragEnd" | "onDragStart" | "onAnimationStart" | "viewport" | "exit" | "whileHover" | "whileTap" | "whileDrag" | "whileFocus" | "whileInView" | "transformTemplate" | "data-framer-appear-id" | "variants" | "onBeforeLayoutMeasure" | "onLayoutMeasure" | "onUpdate" | "onAnimationComplete" | "onPan" | "onPanStart" | "onPanSessionStart" | "onPanEnd" | "onTap" | "onTapStart" | "onTapCancel" | "globalTapTarget" | "onHoverStart" | "onHoverEnd" | "onViewportEnter" | "onViewportLeave" | "dragDirectionLock" | "dragPropagation" | "dragConstraints" | "dragElastic" | "dragMomentum" | "dragTransition" | "dragControls" | "dragSnapToOrigin" | "dragListener" | "onMeasureDragConstraints" | "_dragX" | "_dragY" | "onDirectionLock" | "onDragTransitionEnd" | "layoutId" | "onLayoutAnimationStart" | "onLayoutAnimationComplete" | "layoutDependency" | "layoutScroll" | "layoutRoot" | "custom" | "ignoreStrict"> & import("react").RefAttributes<any>, boolean>;
33
+ export declare const Popover: import("../context").WordPressComponent<import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | null, Omit<WordPressComponentProps<PopoverProps, "div", false>, "inherit" | "initial" | "layout" | "drag" | "transition" | "onDrag" | "onDragEnd" | "onDragStart" | "onAnimationStart" | "viewport" | "exit" | "whileHover" | "whileTap" | "whileDrag" | "whileFocus" | "whileInView" | "transformTemplate" | "data-framer-appear-id" | "variants" | "onBeforeLayoutMeasure" | "onLayoutMeasure" | "onUpdate" | "onAnimationComplete" | "onPan" | "onPanStart" | "onPanSessionStart" | "onPanEnd" | "onTap" | "onTapStart" | "onTapCancel" | "globalTapTarget" | "onHoverStart" | "onHoverEnd" | "onViewportEnter" | "onViewportLeave" | "dragDirectionLock" | "dragPropagation" | "dragConstraints" | "dragElastic" | "dragMomentum" | "dragTransition" | "dragControls" | "dragSnapToOrigin" | "dragListener" | "onMeasureDragConstraints" | "_dragX" | "_dragY" | "onDirectionLock" | "onDragTransitionEnd" | "layoutId" | "onLayoutAnimationStart" | "onLayoutAnimationComplete" | "layoutDependency" | "layoutScroll" | "layoutRoot" | "custom" | "ignoreStrict"> & import("react").RefAttributes<any>, boolean> & {
34
+ /**
35
+ * Renders a slot that is used internally by Popover for rendering content.
36
+ */
37
+ Slot: import("react").ForwardRefExoticComponent<PopoverSlotProps & import("react").RefAttributes<HTMLDivElement>> & {
38
+ displayName: string;
39
+ };
40
+ /**
41
+ * Provides a context to manage popover slot names.
42
+ *
43
+ * This is marked as unstable and should not be used directly.
44
+ */
45
+ __unstableSlotNameProvider: import("react").Provider<string | undefined> & {
46
+ displayName: string;
47
+ };
48
+ };
33
49
  export default Popover;
34
50
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/popover/index.tsx"],"names":[],"mappings":"AAwDA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAC1D,OAAO,KAAK,EACX,YAAY,EAGZ,MAAM,SAAS,CAAC;AAIjB;;;;GAIG;AACH,eAAO,MAAM,SAAS,YAAY,CAAC;AA0ZnC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,OAAO,+qCAAkD,CAAC;AAqBvE,eAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/popover/index.tsx"],"names":[],"mappings":"AAwDA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAC1D,OAAO,KAAK,EACX,YAAY,EAGZ,gBAAgB,EAChB,MAAM,SAAS,CAAC;AAIjB;;;;GAIG;AACH,eAAO,MAAM,SAAS,YAAY,CAAC;AA2ZnC,eAAO,MAAM,WAAW,6GAWvB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,OAAO;IAGlB;;OAEG;;;;IAIH;;;;OAIG;;;;CAKJ,CAAC;AAEF,eAAe,OAAO,CAAC"}
@@ -1,6 +1,13 @@
1
1
  declare const _default: {
2
2
  title: string;
3
- component: import("../../../context").WordPressComponent<import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | null, Omit<import("../../../context").WordPressComponentProps<import("../../types").PopoverProps, "div", false>, "inherit" | "initial" | "layout" | "drag" | "transition" | "onDrag" | "onDragEnd" | "onDragStart" | "onAnimationStart" | "viewport" | "exit" | "whileHover" | "whileTap" | "whileDrag" | "whileFocus" | "whileInView" | "transformTemplate" | "data-framer-appear-id" | "variants" | "onBeforeLayoutMeasure" | "onLayoutMeasure" | "onUpdate" | "onAnimationComplete" | "onPan" | "onPanStart" | "onPanSessionStart" | "onPanEnd" | "onTap" | "onTapStart" | "onTapCancel" | "globalTapTarget" | "onHoverStart" | "onHoverEnd" | "onViewportEnter" | "onViewportLeave" | "dragDirectionLock" | "dragPropagation" | "dragConstraints" | "dragElastic" | "dragMomentum" | "dragTransition" | "dragControls" | "dragSnapToOrigin" | "dragListener" | "onMeasureDragConstraints" | "_dragX" | "_dragY" | "onDirectionLock" | "onDragTransitionEnd" | "layoutId" | "onLayoutAnimationStart" | "onLayoutAnimationComplete" | "layoutDependency" | "layoutScroll" | "layoutRoot" | "custom" | "ignoreStrict"> & import("react").RefAttributes<any>, boolean>;
3
+ component: import("../../../context").WordPressComponent<import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | null, Omit<import("../../../context").WordPressComponentProps<import("../../types").PopoverProps, "div", false>, "inherit" | "initial" | "layout" | "drag" | "transition" | "onDrag" | "onDragEnd" | "onDragStart" | "onAnimationStart" | "viewport" | "exit" | "whileHover" | "whileTap" | "whileDrag" | "whileFocus" | "whileInView" | "transformTemplate" | "data-framer-appear-id" | "variants" | "onBeforeLayoutMeasure" | "onLayoutMeasure" | "onUpdate" | "onAnimationComplete" | "onPan" | "onPanStart" | "onPanSessionStart" | "onPanEnd" | "onTap" | "onTapStart" | "onTapCancel" | "globalTapTarget" | "onHoverStart" | "onHoverEnd" | "onViewportEnter" | "onViewportLeave" | "dragDirectionLock" | "dragPropagation" | "dragConstraints" | "dragElastic" | "dragMomentum" | "dragTransition" | "dragControls" | "dragSnapToOrigin" | "dragListener" | "onMeasureDragConstraints" | "_dragX" | "_dragY" | "onDirectionLock" | "onDragTransitionEnd" | "layoutId" | "onLayoutAnimationStart" | "onLayoutAnimationComplete" | "layoutDependency" | "layoutScroll" | "layoutRoot" | "custom" | "ignoreStrict"> & import("react").RefAttributes<any>, boolean> & {
4
+ Slot: import("react").ForwardRefExoticComponent<import("../../types").PopoverSlotProps & import("react").RefAttributes<HTMLDivElement>> & {
5
+ displayName: string;
6
+ };
7
+ __unstableSlotNameProvider: import("react").Provider<string | undefined> & {
8
+ displayName: string;
9
+ };
10
+ };
4
11
  };
5
12
  export default _default;
6
13
  export declare const Default: () => import("react").JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../../src/popover/stories/e2e/index.story.tsx"],"names":[],"mappings":";;;;AAUA,wBAGE;AAEF,eAAO,MAAM,OAAO,mCASnB,CAAC"}
1
+ {"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../../src/popover/stories/e2e/index.story.tsx"],"names":[],"mappings":";;;;;;;;;;;AAUA,wBAGE;AAEF,eAAO,MAAM,OAAO,mCASnB,CAAC"}
@@ -10,4 +10,5 @@ export declare const Unstyled: StoryObj<typeof Popover>;
10
10
  export declare const AllPlacements: StoryObj<typeof Popover>;
11
11
  export declare const DynamicHeight: StoryObj<typeof Popover>;
12
12
  export declare const WithSlotOutsideIframe: StoryObj<typeof Popover>;
13
+ export declare const WithCloseHandlers: StoryObj<typeof Popover>;
13
14
  //# sourceMappingURL=index.story.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../src/popover/stories/index.story.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAWvD,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAoB7B,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,OAAO,CAqB/B,CAAC;AAEF,eAAe,IAAI,CAAC;AA2BpB,eAAO,MAAM,OAAO,EAAE,QAAQ,CAAE,OAAO,OAAO,CA+C7C,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,QAAQ,CAAE,OAAO,OAAO,CAO9C,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAE,OAAO,OAAO,CAkDnD,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAE,OAAO,OAAO,CAqDnD,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAE,OAAO,OAAO,CAO3D,CAAC"}
1
+ {"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../src/popover/stories/index.story.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAWvD,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAoB7B,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,OAAO,CAyB/B,CAAC;AAEF,eAAe,IAAI,CAAC;AA2BpB,eAAO,MAAM,OAAO,EAAE,QAAQ,CAAE,OAAO,OAAO,CAkD7C,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,QAAQ,CAAE,OAAO,OAAO,CAO9C,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAE,OAAO,OAAO,CAkDnD,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAE,OAAO,OAAO,CAqDnD,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAE,OAAO,OAAO,CAO3D,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAE,OAAO,OAAO,CAwEvD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/popover/test/utils/index.tsx"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,OAAO,MAAM,OAAO,CAAC;AA8B5B,eAAO,MAAM,yCAAyC,UAC9C,KAAK,CAAC,cAAc,CAAE,OAAO,OAAO,CAAE,gCA+C7C,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/popover/test/utils/index.tsx"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,OAAO,MAAM,OAAO,CAAC;AA8B5B,eAAO,MAAM,yCAAyC,UAC9C,KAAK,CAAC,cAAc,CAAE,OAAO,OAAO,CAAE,gCA8C7C,CAAC"}
@@ -191,5 +191,14 @@ export type PopoverProps = {
191
191
  */
192
192
  isAlternate?: boolean;
193
193
  };
194
+ export type PopoverSlotProps = {
195
+ /**
196
+ * The name of the Slot in which the popover should be rendered. It should
197
+ * be also passed to the corresponding `PopoverSlot` component.
198
+ *
199
+ * @default 'Popover'
200
+ */
201
+ name?: string;
202
+ };
194
203
  export {};
195
204
  //# 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,KAAK,aAAa,GAAG,KAAK,GAAG,QAAQ,GAAG,QAAQ,CAAC;AACjD,KAAK,aAAa,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;AACjD,KAAK,cAAc,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;AAE1D,KAAK,wBAAwB,GAAG,OAAO,GAAG;IACzC,aAAa,CAAC,EAAE,QAAQ,CAAC;CACzB,CAAC;AAEF,KAAK,gBAAgB,GAAG,SAAS,GAAG,SAAS,CAAC;AAE9C,MAAM,MAAM,yBAAyB,GAAG,gBAAgB,CACvD,OAAO,GAAG,IAAI,GAAG,SAAS,CAC1B,CAAC;AACF,MAAM,MAAM,yBAAyB,GAAG;IAAE,GAAG,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE,CAAC;AAE1E,MAAM,MAAM,cAAc,GAAG,IAAI,CAAE,OAAO,EAAE,uBAAuB,CAAE,GAAG;IACvE,aAAa,CAAC,EAAE,QAAQ,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IAC1B;;;;;OAKG;IACH,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AC;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;IAC9B;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC9B;;;;;OAKG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACd,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/components",
3
- "version": "29.7.0",
3
+ "version": "29.8.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.21.0",
48
- "@wordpress/compose": "^7.21.0",
49
- "@wordpress/date": "^5.21.0",
50
- "@wordpress/deprecated": "^4.21.0",
51
- "@wordpress/dom": "^4.21.0",
52
- "@wordpress/element": "^6.21.0",
53
- "@wordpress/escape-html": "^3.21.0",
54
- "@wordpress/hooks": "^4.21.0",
55
- "@wordpress/html-entities": "^4.21.0",
56
- "@wordpress/i18n": "^5.21.0",
57
- "@wordpress/icons": "^10.21.0",
58
- "@wordpress/is-shallow-equal": "^5.21.0",
59
- "@wordpress/keycodes": "^4.21.0",
60
- "@wordpress/primitives": "^4.21.0",
61
- "@wordpress/private-apis": "^1.21.0",
62
- "@wordpress/rich-text": "^7.21.0",
63
- "@wordpress/warning": "^3.21.0",
47
+ "@wordpress/a11y": "^4.22.0",
48
+ "@wordpress/compose": "^7.22.0",
49
+ "@wordpress/date": "^5.22.0",
50
+ "@wordpress/deprecated": "^4.22.0",
51
+ "@wordpress/dom": "^4.22.0",
52
+ "@wordpress/element": "^6.22.0",
53
+ "@wordpress/escape-html": "^3.22.0",
54
+ "@wordpress/hooks": "^4.22.0",
55
+ "@wordpress/html-entities": "^4.22.0",
56
+ "@wordpress/i18n": "^5.22.0",
57
+ "@wordpress/icons": "^10.22.0",
58
+ "@wordpress/is-shallow-equal": "^5.22.0",
59
+ "@wordpress/keycodes": "^4.22.0",
60
+ "@wordpress/primitives": "^4.22.0",
61
+ "@wordpress/private-apis": "^1.22.0",
62
+ "@wordpress/rich-text": "^7.22.0",
63
+ "@wordpress/warning": "^3.22.0",
64
64
  "change-case": "^4.1.2",
65
65
  "clsx": "^2.1.1",
66
66
  "colord": "^2.7.0",
@@ -68,7 +68,7 @@
68
68
  "deepmerge": "^4.3.0",
69
69
  "fast-deep-equal": "^3.1.3",
70
70
  "framer-motion": "^11.1.9",
71
- "gradient-parser": "^0.1.5",
71
+ "gradient-parser": "1.0.2",
72
72
  "highlight-words-core": "^1.2.2",
73
73
  "is-plain-object": "^5.0.0",
74
74
  "memize": "^2.1.0",
@@ -85,5 +85,5 @@
85
85
  "publishConfig": {
86
86
  "access": "public"
87
87
  },
88
- "gitHead": "104af00f9abcd7a4d36b87e648f148c72cc4ea5f"
88
+ "gitHead": "01a314d7e46a50101e328fdb11959c441e49372d"
89
89
  }
@@ -167,7 +167,7 @@
167
167
  color: $components-color-accent;
168
168
  background: transparent;
169
169
 
170
- &:hover:not(:disabled, [aria-disabled="true"]) {
170
+ &:hover:not(:disabled, [aria-disabled="true"], .is-pressed) {
171
171
  background: color-mix(in srgb, $components-color-accent 4%, transparent);
172
172
  color: $components-color-accent-darker-20;
173
173
  }
@@ -12,6 +12,8 @@ input.components-combobox-control__input[type="text"] {
12
12
  margin: 0;
13
13
  line-height: inherit;
14
14
  min-height: auto;
15
+ background: $components-color-background;
16
+ color: $components-color-foreground;
15
17
 
16
18
  // Resolves Zooming on iOS devices
17
19
  // https://github.com/WordPress/gutenberg/issues/27405
@@ -26,7 +28,7 @@ input.components-combobox-control__input[type="text"] {
26
28
  }
27
29
 
28
30
  .components-combobox-control__suggestions-container {
29
- @include input-control;
31
+ @include input-control($components-color-accent);
30
32
  display: flex;
31
33
  flex-wrap: wrap;
32
34
  align-items: flex-start;
@@ -34,7 +36,7 @@ input.components-combobox-control__input[type="text"] {
34
36
  padding: 0;
35
37
 
36
38
  &:focus-within {
37
- @include input-style__focus();
39
+ @include input-style__focus($components-color-accent);
38
40
  }
39
41
 
40
42
  .components-spinner {
@@ -1,5 +1,5 @@
1
1
  .components-form-token-field__input-container {
2
- @include input-control();
2
+ @include input-control($components-color-accent);
3
3
  width: 100%;
4
4
  padding: 0;
5
5
  cursor: text;
@@ -10,7 +10,7 @@
10
10
  }
11
11
 
12
12
  &.is-active {
13
- @include input-style__focus();
13
+ @include input-style__focus($components-color-accent);
14
14
  }
15
15
 
16
16
  // Token input
@@ -27,7 +27,7 @@
27
27
  min-width: 50px;
28
28
  background: inherit;
29
29
  border: 0;
30
- color: $gray-900;
30
+ color: $components-color-foreground;
31
31
  box-shadow: none;
32
32
 
33
33
  // Resolves Zooming on iOS devices
@@ -168,7 +168,7 @@
168
168
  }
169
169
 
170
170
  .components-form-token-field__suggestion {
171
- color: $gray-900;
171
+ color: $components-color-foreground;
172
172
  display: block;
173
173
  font-size: $default-font-size;
174
174
  padding: $grid-unit-10 $grid-unit-15;
@@ -178,7 +178,7 @@
178
178
 
179
179
  &.is-selected {
180
180
  background: $components-color-accent;
181
- color: $white;
181
+ color: $components-color-foreground-inverted;
182
182
  }
183
183
 
184
184
  &[aria-disabled="true"] {
@@ -59,6 +59,7 @@ import type {
59
59
  PopoverProps,
60
60
  PopoverAnchorRefReference,
61
61
  PopoverAnchorRefTopBottom,
62
+ PopoverSlotProps,
62
63
  } from './types';
63
64
  import { overlayMiddlewares } from './overlay-middlewares';
64
65
  import { StyleProvider } from '../style-provider';
@@ -478,6 +479,20 @@ const UnforwardedPopover = (
478
479
  );
479
480
  };
480
481
 
482
+ // Export the PopoverSlot individually to allow typescript to pick the types up.
483
+ export const PopoverSlot = forwardRef< HTMLDivElement, PopoverSlotProps >(
484
+ ( { name = SLOT_NAME }, ref ) => {
485
+ return (
486
+ <Slot
487
+ bubblesVirtually
488
+ name={ name }
489
+ className="popover-slot"
490
+ ref={ ref }
491
+ />
492
+ );
493
+ }
494
+ );
495
+
481
496
  /**
482
497
  * `Popover` renders its content in a floating modal. If no explicit anchor is passed via props, it anchors to its parent element by default.
483
498
  *
@@ -501,25 +516,24 @@ const UnforwardedPopover = (
501
516
  * ```
502
517
  *
503
518
  */
504
- export const Popover = contextConnect( UnforwardedPopover, 'Popover' );
505
-
506
- function PopoverSlot(
507
- { name = SLOT_NAME }: { name?: string },
508
- ref: ForwardedRef< any >
509
- ) {
510
- return (
511
- <Slot
512
- bubblesVirtually
513
- name={ name }
514
- className="popover-slot"
515
- ref={ ref }
516
- />
517
- );
518
- }
519
-
520
- // @ts-expect-error For Legacy Reasons
521
- Popover.Slot = forwardRef( PopoverSlot );
522
- // @ts-expect-error For Legacy Reasons
523
- Popover.__unstableSlotNameProvider = slotNameContext.Provider;
519
+ export const Popover = Object.assign(
520
+ contextConnect( UnforwardedPopover, 'Popover' ),
521
+ {
522
+ /**
523
+ * Renders a slot that is used internally by Popover for rendering content.
524
+ */
525
+ Slot: Object.assign( PopoverSlot, {
526
+ displayName: 'Popover.Slot',
527
+ } ),
528
+ /**
529
+ * Provides a context to manage popover slot names.
530
+ *
531
+ * This is marked as unstable and should not be used directly.
532
+ */
533
+ __unstableSlotNameProvider: Object.assign( slotNameContext.Provider, {
534
+ displayName: 'Popover.__unstableSlotNameProvider',
535
+ } ),
536
+ }
537
+ );
524
538
 
525
539
  export default Popover;
@@ -36,6 +36,10 @@ const meta: Meta< typeof Popover > = {
36
36
  title: 'Components/Overlays/Popover',
37
37
  id: 'components-popover',
38
38
  component: Popover,
39
+ subcomponents: {
40
+ // @ts-expect-error - See https://github.com/storybookjs/storybook/issues/23170
41
+ 'Popover.Slot': Popover.Slot,
42
+ },
39
43
  argTypes: {
40
44
  anchor: { control: false },
41
45
  anchorRef: { control: false },
@@ -86,10 +90,13 @@ export const Default: StoryObj< typeof Popover > = {
86
90
  decorators: [
87
91
  ( Story ) => {
88
92
  const [ isVisible, setIsVisible ] = useState( false );
89
- const toggleVisible = () => {
93
+ const buttonRef = useRef< HTMLButtonElement | undefined >();
94
+ const toggleVisible = ( event: React.MouseEvent ) => {
95
+ if ( buttonRef.current && event.target !== buttonRef.current ) {
96
+ return;
97
+ }
90
98
  setIsVisible( ( state ) => ! state );
91
99
  };
92
- const buttonRef = useRef< HTMLButtonElement | undefined >();
93
100
  useEffect( () => {
94
101
  buttonRef.current?.scrollIntoView?.( {
95
102
  block: 'center',
@@ -255,3 +262,77 @@ export const WithSlotOutsideIframe: StoryObj< typeof Popover > = {
255
262
  ...Default.args,
256
263
  },
257
264
  };
265
+
266
+ export const WithCloseHandlers: StoryObj< typeof Popover > = {
267
+ render: function WithCloseHandlersStory( args ) {
268
+ const [ isVisible, setIsVisible ] = useState( false );
269
+ const buttonRef = useRef< HTMLButtonElement >( null );
270
+
271
+ const toggleVisible = ( event: React.MouseEvent ) => {
272
+ if ( buttonRef.current && event.target !== buttonRef.current ) {
273
+ return;
274
+ }
275
+ setIsVisible( ( prev ) => ! prev );
276
+ };
277
+
278
+ const handleClose = () => {
279
+ args.onClose?.();
280
+ setIsVisible( false );
281
+ };
282
+
283
+ const handleFocusOutside = ( e: React.SyntheticEvent ) => {
284
+ args.onFocusOutside?.( e );
285
+ setIsVisible( false );
286
+ };
287
+
288
+ useEffect( () => {
289
+ buttonRef.current?.scrollIntoView( {
290
+ block: 'center',
291
+ inline: 'center',
292
+ } );
293
+ }, [] );
294
+
295
+ return (
296
+ <div
297
+ style={ {
298
+ width: '300vw',
299
+ height: '300vh',
300
+ display: 'flex',
301
+ alignItems: 'center',
302
+ justifyContent: 'center',
303
+ } }
304
+ >
305
+ <Button
306
+ variant="secondary"
307
+ onClick={ toggleVisible }
308
+ ref={ buttonRef }
309
+ >
310
+ Toggle Popover
311
+ { isVisible && (
312
+ <Popover
313
+ { ...args }
314
+ onClose={ handleClose }
315
+ onFocusOutside={ handleFocusOutside }
316
+ >
317
+ { args.children }
318
+ </Popover>
319
+ ) }
320
+ </Button>
321
+ </div>
322
+ );
323
+ },
324
+ args: {
325
+ ...Default.args,
326
+ focusOnMount: true,
327
+ children: (
328
+ <div style={ { width: '280px', whiteSpace: 'normal' } }>
329
+ <p>
330
+ Clicking outside triggers the onFocusOutside callback prop.
331
+ </p>
332
+ <p>
333
+ Pressing the Escape key triggers the onClose callback prop.
334
+ </p>
335
+ </div>
336
+ ),
337
+ },
338
+ };
@@ -46,7 +46,6 @@ export const PopoverInsideIframeRenderedInExternalSlot = (
46
46
 
47
47
  return (
48
48
  <SlotFillProvider>
49
- { /* @ts-expect-error Slot is not currently typed on Popover */ }
50
49
  <Popover.Slot name={ SLOT_NAME } />
51
50
  <GenericIframe
52
51
  style={ {
@@ -206,3 +206,13 @@ export type PopoverProps = {
206
206
  */
207
207
  isAlternate?: boolean;
208
208
  };
209
+
210
+ export type PopoverSlotProps = {
211
+ /**
212
+ * The name of the Slot in which the popover should be rendered. It should
213
+ * be also passed to the corresponding `PopoverSlot` component.
214
+ *
215
+ * @default 'Popover'
216
+ */
217
+ name?: string;
218
+ };