@zag-js/popover 1.35.2 → 1.36.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -3,7 +3,7 @@ export { anatomy } from './popover.anatomy.mjs';
3
3
  export { connect } from './popover.connect.mjs';
4
4
  export { machine } from './popover.machine.mjs';
5
5
  export { props, splitProps } from './popover.props.mjs';
6
- export { PopoverApi as Api, ElementIds, PopoverMachine as Machine, OpenChangeDetails, PopoverProps as Props, PopoverService as Service } from './popover.types.mjs';
6
+ export { PopoverApi as Api, ElementIds, IntlTranslations, PopoverMachine as Machine, OpenChangeDetails, PopoverProps as Props, PopoverService as Service } from './popover.types.mjs';
7
7
  export { Placement, PositioningOptions } from '@zag-js/popper';
8
8
  import '@zag-js/anatomy';
9
9
  import '@zag-js/types';
package/dist/index.d.ts CHANGED
@@ -3,7 +3,7 @@ export { anatomy } from './popover.anatomy.js';
3
3
  export { connect } from './popover.connect.js';
4
4
  export { machine } from './popover.machine.js';
5
5
  export { props, splitProps } from './popover.props.js';
6
- export { PopoverApi as Api, ElementIds, PopoverMachine as Machine, OpenChangeDetails, PopoverProps as Props, PopoverService as Service } from './popover.types.js';
6
+ export { PopoverApi as Api, ElementIds, IntlTranslations, PopoverMachine as Machine, OpenChangeDetails, PopoverProps as Props, PopoverService as Service } from './popover.types.js';
7
7
  export { Placement, PositioningOptions } from '@zag-js/popper';
8
8
  import '@zag-js/anatomy';
9
9
  import '@zag-js/types';
@@ -39,6 +39,7 @@ var import_popover = require("./popover.anatomy.js");
39
39
  var dom = __toESM(require("./popover.dom.js"));
40
40
  function connect(service, normalize) {
41
41
  const { state, context, send, computed, prop, scope } = service;
42
+ const translations = prop("translations");
42
43
  const open = state.matches("open");
43
44
  const currentPlacement = context.get("currentPlacement");
44
45
  const portalled = computed("currentPortalled");
@@ -157,7 +158,7 @@ function connect(service, normalize) {
157
158
  dir: prop("dir"),
158
159
  id: dom.getCloseTriggerId(scope),
159
160
  type: "button",
160
- "aria-label": "close",
161
+ "aria-label": translations.closeTriggerLabel,
161
162
  onClick(event) {
162
163
  if (event.defaultPrevented) return;
163
164
  event.stopPropagation();
@@ -5,6 +5,7 @@ import { parts } from "./popover.anatomy.mjs";
5
5
  import * as dom from "./popover.dom.mjs";
6
6
  function connect(service, normalize) {
7
7
  const { state, context, send, computed, prop, scope } = service;
8
+ const translations = prop("translations");
8
9
  const open = state.matches("open");
9
10
  const currentPlacement = context.get("currentPlacement");
10
11
  const portalled = computed("currentPortalled");
@@ -123,7 +124,7 @@ function connect(service, normalize) {
123
124
  dir: prop("dir"),
124
125
  id: dom.getCloseTriggerId(scope),
125
126
  type: "button",
126
- "aria-label": "close",
127
+ "aria-label": translations.closeTriggerLabel,
127
128
  onClick(event) {
128
129
  if (event.defaultPrevented) return;
129
130
  event.stopPropagation();
@@ -50,6 +50,10 @@ var machine = (0, import_core.createMachine)({
50
50
  modal: false,
51
51
  portalled: true,
52
52
  ...props,
53
+ translations: {
54
+ closeTriggerLabel: "close",
55
+ ...props.translations
56
+ },
53
57
  positioning: {
54
58
  placement: "bottom",
55
59
  ...props.positioning
@@ -16,6 +16,10 @@ var machine = createMachine({
16
16
  modal: false,
17
17
  portalled: true,
18
18
  ...props,
19
+ translations: {
20
+ closeTriggerLabel: "close",
21
+ ...props.translations
22
+ },
19
23
  positioning: {
20
24
  placement: "bottom",
21
25
  ...props.positioning
@@ -46,7 +46,8 @@ var props = (0, import_types.createProps)()([
46
46
  "open",
47
47
  "persistentElements",
48
48
  "portalled",
49
- "positioning"
49
+ "positioning",
50
+ "translations"
50
51
  ]);
51
52
  var splitProps = (0, import_utils.createSplitProps)(props);
52
53
  // Annotate the CommonJS export names for ESM import in node:
@@ -21,7 +21,8 @@ var props = createProps()([
21
21
  "open",
22
22
  "persistentElements",
23
23
  "portalled",
24
- "positioning"
24
+ "positioning",
25
+ "translations"
25
26
  ]);
26
27
  var splitProps = createSplitProps(props);
27
28
  export {
@@ -7,6 +7,9 @@ import { PropTypes, RequiredBy, CommonProperties, DirectionProperty } from '@zag
7
7
  interface OpenChangeDetails {
8
8
  open: boolean;
9
9
  }
10
+ interface IntlTranslations {
11
+ closeTriggerLabel?: string | undefined;
12
+ }
10
13
  type ElementIds = Partial<{
11
14
  anchor: string;
12
15
  trigger: string;
@@ -18,6 +21,10 @@ type ElementIds = Partial<{
18
21
  arrow: string;
19
22
  }>;
20
23
  interface PopoverProps extends CommonProperties, DirectionProperty, DismissableElementHandlers, PersistentElementOptions {
24
+ /**
25
+ * Specifies the localized strings that identifies the accessibility elements and their states
26
+ */
27
+ translations?: IntlTranslations | undefined;
21
28
  /**
22
29
  * The ids of the elements in the popover. Useful for composition.
23
30
  */
@@ -78,7 +85,7 @@ interface PopoverProps extends CommonProperties, DirectionProperty, DismissableE
78
85
  */
79
86
  defaultOpen?: boolean | undefined;
80
87
  }
81
- type PropsWithDefault = "closeOnInteractOutside" | "closeOnEscape" | "modal" | "portalled" | "autoFocus" | "positioning";
88
+ type PropsWithDefault = "closeOnInteractOutside" | "closeOnEscape" | "modal" | "portalled" | "autoFocus" | "positioning" | "translations";
82
89
  type ComputedContext = Readonly<{
83
90
  /**
84
91
  * The computed value of `portalled`
@@ -139,4 +146,4 @@ interface PopoverApi<T extends PropTypes = PropTypes> {
139
146
  getCloseTriggerProps: () => T["button"];
140
147
  }
141
148
 
142
- export type { ElementIds, OpenChangeDetails, PopoverApi, PopoverMachine, PopoverProps, PopoverSchema, PopoverService };
149
+ export type { ElementIds, IntlTranslations, OpenChangeDetails, PopoverApi, PopoverMachine, PopoverProps, PopoverSchema, PopoverService };
@@ -7,6 +7,9 @@ import { PropTypes, RequiredBy, CommonProperties, DirectionProperty } from '@zag
7
7
  interface OpenChangeDetails {
8
8
  open: boolean;
9
9
  }
10
+ interface IntlTranslations {
11
+ closeTriggerLabel?: string | undefined;
12
+ }
10
13
  type ElementIds = Partial<{
11
14
  anchor: string;
12
15
  trigger: string;
@@ -18,6 +21,10 @@ type ElementIds = Partial<{
18
21
  arrow: string;
19
22
  }>;
20
23
  interface PopoverProps extends CommonProperties, DirectionProperty, DismissableElementHandlers, PersistentElementOptions {
24
+ /**
25
+ * Specifies the localized strings that identifies the accessibility elements and their states
26
+ */
27
+ translations?: IntlTranslations | undefined;
21
28
  /**
22
29
  * The ids of the elements in the popover. Useful for composition.
23
30
  */
@@ -78,7 +85,7 @@ interface PopoverProps extends CommonProperties, DirectionProperty, DismissableE
78
85
  */
79
86
  defaultOpen?: boolean | undefined;
80
87
  }
81
- type PropsWithDefault = "closeOnInteractOutside" | "closeOnEscape" | "modal" | "portalled" | "autoFocus" | "positioning";
88
+ type PropsWithDefault = "closeOnInteractOutside" | "closeOnEscape" | "modal" | "portalled" | "autoFocus" | "positioning" | "translations";
82
89
  type ComputedContext = Readonly<{
83
90
  /**
84
91
  * The computed value of `portalled`
@@ -139,4 +146,4 @@ interface PopoverApi<T extends PropTypes = PropTypes> {
139
146
  getCloseTriggerProps: () => T["button"];
140
147
  }
141
148
 
142
- export type { ElementIds, OpenChangeDetails, PopoverApi, PopoverMachine, PopoverProps, PopoverSchema, PopoverService };
149
+ export type { ElementIds, IntlTranslations, OpenChangeDetails, PopoverApi, PopoverMachine, PopoverProps, PopoverSchema, PopoverService };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/popover",
3
- "version": "1.35.2",
3
+ "version": "1.36.0",
4
4
  "description": "Core logic for the popover widget implemented as a state machine",
5
5
  "keywords": [
6
6
  "js",
@@ -26,16 +26,16 @@
26
26
  "url": "https://github.com/chakra-ui/zag/issues"
27
27
  },
28
28
  "dependencies": {
29
- "@zag-js/aria-hidden": "1.35.2",
30
- "@zag-js/anatomy": "1.35.2",
31
- "@zag-js/core": "1.35.2",
32
- "@zag-js/dom-query": "1.35.2",
33
- "@zag-js/utils": "1.35.2",
34
- "@zag-js/dismissable": "1.35.2",
35
- "@zag-js/remove-scroll": "1.35.2",
36
- "@zag-js/types": "1.35.2",
37
- "@zag-js/focus-trap": "1.35.2",
38
- "@zag-js/popper": "1.35.2"
29
+ "@zag-js/anatomy": "1.36.0",
30
+ "@zag-js/aria-hidden": "1.36.0",
31
+ "@zag-js/core": "1.36.0",
32
+ "@zag-js/dom-query": "1.36.0",
33
+ "@zag-js/utils": "1.36.0",
34
+ "@zag-js/dismissable": "1.36.0",
35
+ "@zag-js/popper": "1.36.0",
36
+ "@zag-js/remove-scroll": "1.36.0",
37
+ "@zag-js/types": "1.36.0",
38
+ "@zag-js/focus-trap": "1.36.0"
39
39
  },
40
40
  "devDependencies": {
41
41
  "clean-package": "2.2.0"