@plexui/vue 0.10.0 → 0.12.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.
Files changed (111) hide show
  1. package/dist/es/components/ButtonGroup/ButtonGroup.js +7 -0
  2. package/dist/es/components/ButtonGroup/ButtonGroup.js.map +1 -1
  3. package/dist/es/components/ButtonGroup/index.js.map +1 -1
  4. package/dist/es/components/ContextMenu/shared.js +3 -2
  5. package/dist/es/components/ContextMenu/shared.js.map +1 -1
  6. package/dist/es/components/Dialog/Dialog.js +135 -18
  7. package/dist/es/components/Dialog/Dialog.js.map +1 -1
  8. package/dist/es/components/Dialog/dialogSteps.js +85 -0
  9. package/dist/es/components/Dialog/dialogSteps.js.map +1 -0
  10. package/dist/es/components/Dialog/dialogViewport.js +74 -0
  11. package/dist/es/components/Dialog/dialogViewport.js.map +1 -0
  12. package/dist/es/components/Dialog/index.js +1 -1
  13. package/dist/es/components/Dialog/index.js.map +1 -1
  14. package/dist/es/components/Dialog/sheetDrag.js +2 -1
  15. package/dist/es/components/Dialog/sheetDrag.js.map +1 -1
  16. package/dist/es/components/IndexBar/IndexBar.js +215 -0
  17. package/dist/es/components/IndexBar/IndexBar.js.map +1 -0
  18. package/dist/es/components/IndexBar/index.js +2 -0
  19. package/dist/es/components/IndexBar/index.js.map +1 -0
  20. package/dist/es/components/MarkdownEditor/MarkdownEditor.js +149 -1
  21. package/dist/es/components/MarkdownEditor/MarkdownEditor.js.map +1 -1
  22. package/dist/es/components/Menu/Menu.js +54 -28
  23. package/dist/es/components/Menu/Menu.js.map +1 -1
  24. package/dist/es/components/Page/Page.js +2 -2
  25. package/dist/es/components/Page/Page.js.map +1 -1
  26. package/dist/es/components/PhoneLayout/PhoneLayout.js +50 -0
  27. package/dist/es/components/PhoneLayout/PhoneLayout.js.map +1 -0
  28. package/dist/es/components/PhoneLayout/index.js +2 -0
  29. package/dist/es/components/PhoneLayout/index.js.map +1 -0
  30. package/dist/es/components/Popover/Popover.js +1 -1
  31. package/dist/es/components/Popover/Popover.js.map +1 -1
  32. package/dist/es/components/Popover/deferredPointerDownOutside.js +59 -4
  33. package/dist/es/components/Popover/deferredPointerDownOutside.js.map +1 -1
  34. package/dist/es/components/Select/Select.js +2 -2
  35. package/dist/es/components/Select/Select.js.map +1 -1
  36. package/dist/es/components/Slider/Slider.js +34 -3
  37. package/dist/es/components/Slider/Slider.js.map +1 -1
  38. package/dist/es/components/SwipeActions/SwipeActions.js +374 -0
  39. package/dist/es/components/SwipeActions/SwipeActions.js.map +1 -0
  40. package/dist/es/components/SwipeActions/index.js +2 -0
  41. package/dist/es/components/SwipeActions/index.js.map +1 -0
  42. package/dist/es/components/Switch/Switch.js +3 -1
  43. package/dist/es/components/Switch/Switch.js.map +1 -1
  44. package/dist/es/components/TabBar/TabBar.js +23 -8
  45. package/dist/es/components/TabBar/TabBar.js.map +1 -1
  46. package/dist/es/components/TabBar/index.js.map +1 -1
  47. package/dist/es/components/Tabs/Tabs.js +1 -0
  48. package/dist/es/components/Tabs/Tabs.js.map +1 -1
  49. package/dist/es/components/TagInput/TagInput.js +3 -46
  50. package/dist/es/components/TagInput/TagInput.js.map +1 -1
  51. package/dist/es/components/Textarea/Textarea.js +1 -0
  52. package/dist/es/components/Textarea/Textarea.js.map +1 -1
  53. package/dist/es/components/Tip/Tip.js +276 -0
  54. package/dist/es/components/Tip/Tip.js.map +1 -0
  55. package/dist/es/components/Tip/index.js +2 -0
  56. package/dist/es/components/Tip/index.js.map +1 -0
  57. package/dist/es/components/Toast/ToastRenderer.js +30 -13
  58. package/dist/es/components/Toast/ToastRenderer.js.map +1 -1
  59. package/dist/es/components/Toast/Toaster.js +17 -6
  60. package/dist/es/components/Toast/Toaster.js.map +1 -1
  61. package/dist/es/components/Toast/toastLifecycle.js +113 -1
  62. package/dist/es/components/Toast/toastLifecycle.js.map +1 -1
  63. package/dist/es/components/Toolbar/Toolbar.js +3 -3
  64. package/dist/es/components/Toolbar/Toolbar.js.map +1 -1
  65. package/dist/es/composables/useEscCloseStack.js +8 -4
  66. package/dist/es/composables/useEscCloseStack.js.map +1 -1
  67. package/dist/es/composables/usePhoneSubmenu.js +3 -2
  68. package/dist/es/composables/usePhoneSubmenu.js.map +1 -1
  69. package/dist/es/lib/floatingBoundary.js +3 -1
  70. package/dist/es/lib/floatingBoundary.js.map +1 -1
  71. package/dist/es/lib/helpers.js +21 -0
  72. package/dist/es/lib/helpers.js.map +1 -1
  73. package/dist/es/lib/menuInitialFocus.js +5 -3
  74. package/dist/es/lib/menuInitialFocus.js.map +1 -1
  75. package/dist/es/lib/menuSubmenuPlacement.js +129 -5
  76. package/dist/es/lib/menuSubmenuPlacement.js.map +1 -1
  77. package/dist/es/lib/menuTriggerCover.js +10 -4
  78. package/dist/es/lib/menuTriggerCover.js.map +1 -1
  79. package/dist/es/lib/phoneLayout.js +16 -0
  80. package/dist/es/lib/phoneLayout.js.map +1 -0
  81. package/dist/es/lib/toastRegion.js +6 -0
  82. package/dist/es/lib/toastRegion.js.map +1 -0
  83. package/dist/types/components/ButtonGroup/ButtonGroup.d.ts +13 -0
  84. package/dist/types/components/ButtonGroup/index.d.ts +1 -1
  85. package/dist/types/components/ContextMenu/shared.d.ts +3 -2
  86. package/dist/types/components/Dialog/Dialog.d.ts +93 -3
  87. package/dist/types/components/Dialog/dialogSteps.d.ts +10 -0
  88. package/dist/types/components/Dialog/dialogViewport.d.ts +1 -0
  89. package/dist/types/components/Dialog/index.d.ts +1 -1
  90. package/dist/types/components/IndexBar/IndexBar.d.ts +112 -0
  91. package/dist/types/components/IndexBar/index.d.ts +1 -0
  92. package/dist/types/components/Menu/Menu.d.ts +14 -15
  93. package/dist/types/components/Page/Page.d.ts +2 -2
  94. package/dist/types/components/PhoneLayout/PhoneLayout.d.ts +21 -0
  95. package/dist/types/components/PhoneLayout/index.d.ts +1 -0
  96. package/dist/types/components/Popover/deferredPointerDownOutside.d.ts +1 -1
  97. package/dist/types/components/SwipeActions/SwipeActions.d.ts +135 -0
  98. package/dist/types/components/SwipeActions/index.d.ts +1 -0
  99. package/dist/types/components/TabBar/TabBar.d.ts +55 -6
  100. package/dist/types/components/TabBar/index.d.ts +1 -1
  101. package/dist/types/components/Tip/Tip.d.ts +146 -0
  102. package/dist/types/components/Tip/index.d.ts +1 -0
  103. package/dist/types/components/Toast/toastLifecycle.d.ts +34 -0
  104. package/dist/types/components/Toolbar/Toolbar.d.ts +9 -7
  105. package/dist/types/composables/useEscCloseStack.d.ts +2 -2
  106. package/dist/types/composables/usePhoneSubmenu.d.ts +2 -1
  107. package/dist/types/lib/helpers.d.ts +6 -0
  108. package/dist/types/lib/menuSubmenuPlacement.d.ts +9 -2
  109. package/dist/types/lib/phoneLayout.d.ts +11 -0
  110. package/dist/types/lib/toastRegion.d.ts +5 -0
  111. package/package.json +2 -2
@@ -7,12 +7,19 @@ const ButtonGroupComponent = defineComponent({
7
7
  props: {
8
8
  /** Direction of the joined buttons. @default "horizontal" */
9
9
  orientation: { type: String, default: "horizontal" },
10
+ /**
11
+ * Phone surface (below 768px, with touch.css). `"glass"` makes the group one glass capsule, the Button Group
12
+ * of the iOS 27 kit, for controls over the content; a group in a Toolbar is one already. `"flat"` keeps the
13
+ * joined buttons in a Toolbar.
14
+ */
15
+ mobileMaterial: String,
10
16
  },
11
17
  setup(props, { slots }) {
12
18
  return () => h("div", {
13
19
  "role": "group",
14
20
  "data-slot": "button-group",
15
21
  "data-orientation": props.orientation,
22
+ "data-mobile-material": props.mobileMaterial,
16
23
  "class": s.Root,
17
24
  }, slots.default?.());
18
25
  },
@@ -1 +1 @@
1
- {"version":3,"file":"ButtonGroup.js","sourceRoot":"","sources":["../../../../src/components/ButtonGroup/ButtonGroup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,CAAC,EAAsC,MAAM,KAAK,CAAA;AAC5E,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AACjD,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MA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AAE,EAAE,KAAK,EAAE,KAAK,EAAE;QAC3B,OAAO,GAAG,EAAE;YACV,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,SAAS,EAAE,GAAG,KAAK,CAAA;YAChD,MAAM,QAAQ,GAAG,EAAE,WAAW,EAAE,mBAAmB,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,SAAS,CAAC,EAAE,GAAG,SAAS,EAAE,CAAA;YACjG,IAAI,CAAC,KAAK,CAAC,OAAO;gBAAE,OAAO,CAAC,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC,CAAA;YAChE,MAAM,KAAK,GAAG,iBAAiB,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC,CAAA;YAClD,OAAO,KAAK,CAAC,CAAC,CAAC,cAAc,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;QACvD,CAAC,CAAA;IACH,CAAC;CACF,CAAC,CAAA","sourcesContent":["import { defineComponent, h, type HTMLAttributes, type PropType } from \"vue\"\nimport { Separator } from \"../Separator/index.js\"\nimport { firstElementChild, mergeSlotProps } from \"../Tooltip/slot.js\"\nimport s from \"@plexui/styles/components/ButtonGroup/ButtonGroup.module.css\"\n\n// Vue port of packages/ui/src/components/ButtonGroup/ButtonGroup.tsx.\n// Exports are flat (`ButtonGroupSeparator` for `ButtonGroup.Separator`, ...).\n// React spreads the remaining props after its own attributes, so caller\n// attributes win; Vue's attribute fallthrough merges them the same way.\n// `asChild` merges the way Radix's Slot does (the slot's class comes first,\n// the child's own props win, the child's handlers run first), which Reka's\n// Slot does not, hence the Tooltip's slot helpers.\n\nexport type ButtonGroupOrientation = \"horizontal\" | \"vertical\"\n\nconst ButtonGroupComponent = defineComponent({\n name: \"ButtonGroup\",\n props: {\n /** Direction of the joined buttons. @default \"horizontal\" */\n orientation: { type: String as PropType<ButtonGroupOrientation>, default: \"horizontal\" },\n },\n setup(props, { slots }) {\n return () =>\n h(\n \"div\",\n {\n \"role\": \"group\",\n \"data-slot\": \"button-group\",\n \"data-orientation\": props.orientation,\n \"class\": s.Root,\n },\n slots.default?.(),\n )\n },\n})\n\ntype ButtonGroupOwnProps = InstanceType<typeof ButtonGroupComponent>[\"$props\"]\n\n/** ButtonGroup props plus the native <div> attributes that fall through to it, as in React. */\nexport type ButtonGroupProps = ButtonGroupOwnProps & Omit<HTMLAttributes, keyof ButtonGroupOwnProps>\n\n/** Joins buttons, inputs and other controls into a single visual unit. */\nexport const ButtonGroup = ButtonGroupComponent as typeof ButtonGroupComponent & {\n new (): { $props: ButtonGroupProps }\n}\n\n/** Thin divider between items (React `ButtonGroup.Separator`). Other props go to `Separator`. */\nexport const ButtonGroupSeparator = defineComponent({\n name: \"ButtonGroupSeparator\",\n props: {\n /**\n * When omitted, uses `\"vertical\"`, the axis that looks right between\n * horizontal items. Pass explicitly inside a vertical group.\n */\n orientation: String as PropType<ButtonGroupOrientation>,\n },\n setup(props) {\n return () =>\n h(Separator, {\n \"data-slot\": \"button-group-separator\",\n \"orientation\": props.orientation ?? \"vertical\",\n \"class\": s.Separator,\n })\n },\n})\n\nexport type ButtonGroupSeparatorProps = InstanceType<typeof ButtonGroupSeparator>[\"$props\"] & {\n decorative?: boolean\n}\n\n/** Muted label sharing the group's joined geometry (React `ButtonGroup.Text`). */\nexport const ButtonGroupText = defineComponent({\n name: \"ButtonGroupText\",\n inheritAttrs: false,\n props: {\n /**\n * Render the passed child (label, span, ...) instead of a `<div>`, while\n * keeping the group's visual treatment.\n * @default false\n */\n asChild: { type: Boolean, default: false },\n },\n setup(props, { attrs, slots }) {\n return () => {\n const { class: className, ...restAttrs } = attrs\n const ownProps = { \"data-slot\": \"button-group-text\", \"class\": [s.Text, className], ...restAttrs }\n if (!props.asChild) return h(\"div\", ownProps, slots.default?.())\n const child = firstElementChild(slots.default?.())\n return child ? mergeSlotProps(child, ownProps) : null\n }\n },\n})\n\nexport type ButtonGroupTextProps = InstanceType<typeof ButtonGroupText>[\"$props\"] & HTMLAttributes\n"]}
1
+ {"version":3,"file":"ButtonGroup.js","sourceRoot":"","sources":["../../../../src/components/ButtonGroup/ButtonGroup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,CAAC,EAAsC,MAAM,KAAK,CAAA;AAC5E,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AACjD,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AACtE,OAAO,CAAC,MAAM,8DAA8D,CAAA;AAc5E,MAAM,oBAAoB,GAAG,eAAe,CAAC;IAC3C,IAAI,EAAE,aAAa;IACnB,KAAK,EAAE;QACL,6DAA6D;QAC7D,WAAW,EAAE,EAAE,IAAI,EAAE,MAA0C,EAAE,OAAO,EAAE,YAAY,EAAE;QACxF;;;;WAIG;QACH,cAAc,EAAE,MAA6C;KAC9D;IACD,KAAK,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE;QACpB,OAAO,GAAG,EAAE,CACV,CAAC,CACC,KAAK,EACL;YACE,MAAM,EAAE,OAAO;YACf,WAAW,EAAE,cAAc;YAC3B,kBAAkB,EAAE,KAAK,CAAC,WAAW;YACrC,sBAAsB,EAAE,KAAK,CAAC,cAAc;YAC5C,OAAO,EAAE,CAAC,CAAC,IAAI;SAChB,EACD,KAAK,CAAC,OAAO,EAAE,EAAE,CAClB,CAAA;IACL,CAAC;CACF,CAAC,CAAA;AAOF,0EAA0E;AAC1E,MAAM,CAAC,MAAM,WAAW,GAAG,oBAE1B,CAAA;AAED,iGAAiG;AACjG,MAAM,CAAC,MAAM,oBAAoB,GAAG,eAAe,CAAC;IAClD,IAAI,EAAE,sBAAsB;IAC5B,KAAK,EAAE;QACL;;;WAGG;QACH,WAAW,EAAE,MAA0C;KACxD;IACD,KAAK,CAAC,KAAK;QACT,OAAO,GAAG,EAAE,CACV,CAAC,CAAC,SAAS,EAAE;YACX,WAAW,EAAE,wBAAwB;YACrC,aAAa,EAAE,KAAK,CAAC,WAAW,IAAI,UAAU;YAC9C,OAAO,EAAE,CAAC,CAAC,SAAS;SACrB,CAAC,CAAA;IACN,CAAC;CACF,CAAC,CAAA;AAMF,kFAAkF;AAClF,MAAM,CAAC,MAAM,eAAe,GAAG,eAAe,CAAC;IAC7C,IAAI,EAAE,iBAAiB;IACvB,YAAY,EAAE,KAAK;IACnB,KAAK,EAAE;QACL;;;;WAIG;QACH,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE;KAC3C;IACD,KAAK,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE;QAC3B,OAAO,GAAG,EAAE;YACV,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,SAAS,EAAE,GAAG,KAAK,CAAA;YAChD,MAAM,QAAQ,GAAG,EAAE,WAAW,EAAE,mBAAmB,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,SAAS,CAAC,EAAE,GAAG,SAAS,EAAE,CAAA;YACjG,IAAI,CAAC,KAAK,CAAC,OAAO;gBAAE,OAAO,CAAC,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC,CAAA;YAChE,MAAM,KAAK,GAAG,iBAAiB,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC,CAAA;YAClD,OAAO,KAAK,CAAC,CAAC,CAAC,cAAc,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;QACvD,CAAC,CAAA;IACH,CAAC;CACF,CAAC,CAAA","sourcesContent":["import { defineComponent, h, type HTMLAttributes, type PropType } from \"vue\"\nimport { Separator } from \"../Separator/index.js\"\nimport { firstElementChild, mergeSlotProps } from \"../Tooltip/slot.js\"\nimport s from \"@plexui/styles/components/ButtonGroup/ButtonGroup.module.css\"\n\n// Vue port of packages/ui/src/components/ButtonGroup/ButtonGroup.tsx.\n// Exports are flat (`ButtonGroupSeparator` for `ButtonGroup.Separator`, ...).\n// React spreads the remaining props after its own attributes, so caller\n// attributes win; Vue's attribute fallthrough merges them the same way.\n// `asChild` merges the way Radix's Slot does (the slot's class comes first,\n// the child's own props win, the child's handlers run first), which Reka's\n// Slot does not, hence the Tooltip's slot helpers.\n\nexport type ButtonGroupOrientation = \"horizontal\" | \"vertical\"\n\nexport type ButtonGroupMobileMaterial = \"glass\" | \"flat\"\n\nconst ButtonGroupComponent = defineComponent({\n name: \"ButtonGroup\",\n props: {\n /** Direction of the joined buttons. @default \"horizontal\" */\n orientation: { type: String as PropType<ButtonGroupOrientation>, default: \"horizontal\" },\n /**\n * Phone surface (below 768px, with touch.css). `\"glass\"` makes the group one glass capsule, the Button Group\n * of the iOS 27 kit, for controls over the content; a group in a Toolbar is one already. `\"flat\"` keeps the\n * joined buttons in a Toolbar.\n */\n mobileMaterial: String as PropType<ButtonGroupMobileMaterial>,\n },\n setup(props, { slots }) {\n return () =>\n h(\n \"div\",\n {\n \"role\": \"group\",\n \"data-slot\": \"button-group\",\n \"data-orientation\": props.orientation,\n \"data-mobile-material\": props.mobileMaterial,\n \"class\": s.Root,\n },\n slots.default?.(),\n )\n },\n})\n\ntype ButtonGroupOwnProps = InstanceType<typeof ButtonGroupComponent>[\"$props\"]\n\n/** ButtonGroup props plus the native <div> attributes that fall through to it, as in React. */\nexport type ButtonGroupProps = ButtonGroupOwnProps & Omit<HTMLAttributes, keyof ButtonGroupOwnProps>\n\n/** Joins buttons, inputs and other controls into a single visual unit. */\nexport const ButtonGroup = ButtonGroupComponent as typeof ButtonGroupComponent & {\n new (): { $props: ButtonGroupProps }\n}\n\n/** Thin divider between items (React `ButtonGroup.Separator`). Other props go to `Separator`. */\nexport const ButtonGroupSeparator = defineComponent({\n name: \"ButtonGroupSeparator\",\n props: {\n /**\n * When omitted, uses `\"vertical\"`, the axis that looks right between\n * horizontal items. Pass explicitly inside a vertical group.\n */\n orientation: String as PropType<ButtonGroupOrientation>,\n },\n setup(props) {\n return () =>\n h(Separator, {\n \"data-slot\": \"button-group-separator\",\n \"orientation\": props.orientation ?? \"vertical\",\n \"class\": s.Separator,\n })\n },\n})\n\nexport type ButtonGroupSeparatorProps = InstanceType<typeof ButtonGroupSeparator>[\"$props\"] & {\n decorative?: boolean\n}\n\n/** Muted label sharing the group's joined geometry (React `ButtonGroup.Text`). */\nexport const ButtonGroupText = defineComponent({\n name: \"ButtonGroupText\",\n inheritAttrs: false,\n props: {\n /**\n * Render the passed child (label, span, ...) instead of a `<div>`, while\n * keeping the group's visual treatment.\n * @default false\n */\n asChild: { type: Boolean, default: false },\n },\n setup(props, { attrs, slots }) {\n return () => {\n const { class: className, ...restAttrs } = attrs\n const ownProps = { \"data-slot\": \"button-group-text\", \"class\": [s.Text, className], ...restAttrs }\n if (!props.asChild) return h(\"div\", ownProps, slots.default?.())\n const child = firstElementChild(slots.default?.())\n return child ? mergeSlotProps(child, ownProps) : null\n }\n },\n})\n\nexport type ButtonGroupTextProps = InstanceType<typeof ButtonGroupText>[\"$props\"] & HTMLAttributes\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/ButtonGroup/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,oBAAoB,EACpB,eAAe,GAKhB,MAAM,kBAAkB,CAAA","sourcesContent":["export {\n ButtonGroup,\n ButtonGroupSeparator,\n ButtonGroupText,\n type ButtonGroupOrientation,\n type ButtonGroupProps,\n type ButtonGroupSeparatorProps,\n type ButtonGroupTextProps,\n} from \"./ButtonGroup.js\"\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/ButtonGroup/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,oBAAoB,EACpB,eAAe,GAMhB,MAAM,kBAAkB,CAAA","sourcesContent":["export {\n ButtonGroup,\n ButtonGroupSeparator,\n ButtonGroupText,\n type ButtonGroupMobileMaterial,\n type ButtonGroupOrientation,\n type ButtonGroupProps,\n type ButtonGroupSeparatorProps,\n type ButtonGroupTextProps,\n} from \"./ButtonGroup.js\"\n"]}
@@ -3,8 +3,9 @@
3
3
  export const CONTEXT_MENU_LONG_PRESS = 500;
4
4
  /** A touch that moves farther than this before then scrolls or drags instead. */
5
5
  export const CONTEXT_MENU_LONG_PRESS_SLOP = 10;
6
- /** The kit's gap between the preview and the menu (Context Menu, Alignment=Vertical: 160 + 18 = 178). */
7
- export const CONTEXT_MENU_PREVIEW_GAP = 18;
6
+ /** The kit's gap between the preview and the menu: iOS 27 Context Menu 125:58750, Alignment=Vertical, the menu at
7
+ * 176.5 under a content area that ends at 160.5 (the iOS 26 kit had 18). */
8
+ export const CONTEXT_MENU_PREVIEW_GAP = 16;
8
9
  /** The kit's preview corner (Content Area, radius 30), for an element without corners of its own. */
9
10
  const PREVIEW_RADIUS = 30;
10
11
  const px = (value, base) => {
@@ -1 +1 @@
1
- {"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../../src/components/ContextMenu/shared.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,4EAA4E;AAC5E,MAAM,CAAC,MAAM,uBAAuB,GAAG,GAAG,CAAA;AAC1C,iFAAiF;AACjF,MAAM,CAAC,MAAM,4BAA4B,GAAG,EAAE,CAAA;AAC9C,yGAAyG;AACzG,MAAM,CAAC,MAAM,wBAAwB,GAAG,EAAE,CAAA;AAC1C,qGAAqG;AACrG,MAAM,cAAc,GAAG,EAAE,CAAA;AAUzB,MAAM,EAAE,GAAG,CAAC,KAAa,EAAE,IAAY,EAAE,EAAE;IACzC,MAAM,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAA;IACvC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC;QAAE,OAAO,CAAC,CAAA;IACtC,OAAO,KAAK,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CA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KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;IAC/B,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,KAAK,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,KAAK,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAA;IACjR,MAAM,GAAG,GAAG,kDAAkD,KAAK,aAAa,MAAM,kBAAkB,KAAK,IAAI,MAAM,uCAAuC,KAAK,IAAI,MAAM,MAAM,IAAI,WAAW,CAAA;IAClM,OAAO,EAAE,qBAAqB,EAAE,2BAA2B,kBAAkB,CAAC,GAAG,CAAC,IAAI,EAAE,CAAA;AAC1F,CAAC","sourcesContent":["// Shared with packages/ui/src/components/ContextMenu/shared.ts: keep the two copies the same.\n/** A touch held this long opens the menu, as a UIKit long press (0.5 s). */\nexport const CONTEXT_MENU_LONG_PRESS = 500\n/** A touch that moves farther than this before then scrolls or drags instead. */\nexport const CONTEXT_MENU_LONG_PRESS_SLOP = 10\n/** The kit's gap between the preview and the menu (Context Menu, Alignment=Vertical: 160 + 18 = 178). */\nexport const CONTEXT_MENU_PREVIEW_GAP = 18\n/** The kit's preview corner (Content Area, radius 30), for an element without corners of its own. */\nconst PREVIEW_RADIUS = 30\n\ntype Rect = { x: number; y: number; width: number; height: number }\n\n/** Where the menu opens: at the pointer, under the element for the keyboard, or beside a touch-and-hold preview. */\nexport type ContextMenuPresentation =\n | { kind: \"pointer\"; rect: Rect }\n | { kind: \"keyboard\"; rect: Rect }\n | { kind: \"preview\"; rect: Rect; radius: number; align: \"start\" | \"end\" }\n\nconst px = (value: string, base: number) => {\n const number = Number.parseFloat(value)\n if (!Number.isFinite(number)) return 0\n return value.trim().endsWith(\"%\") ? (number / 100) * base : number\n}\n\n/**\n * The preview of a touch and hold: the element's box and corner (its own, or `--context-menu-preview-radius`), and\n * the edge the menu keeps to, the one on the side of the touch, as the kit's Side=Leading and Side=Trailing.\n */\nexport function contextMenuPreview(element: HTMLElement, touchX: number): ContextMenuPresentation {\n const box = element.getBoundingClientRect()\n const rect = { x: box.left, y: box.top, width: box.width, height: box.height }\n const style = getComputedStyle(element)\n const short = Math.min(rect.width, rect.height)\n const own = px(style.borderTopLeftRadius, short)\n const fallback = px(style.getPropertyValue(\"--context-menu-preview-radius\"), short) || PREVIEW_RADIUS\n const radius = Math.min(own > 0 ? own : fallback, short / 2)\n const width = element.ownerDocument.defaultView?.innerWidth ?? rect.x + rect.width\n return { kind: \"preview\", rect, radius, align: touchX < width / 2 ? \"start\" : \"end\" }\n}\n\n/** The menu's side, alignment and offsets for a presentation. */\nexport function contextMenuPlacement(presentation: ContextMenuPresentation | null) {\n if (presentation?.kind === \"preview\")\n return { side: \"bottom\" as const, align: presentation.align, sideOffset: CONTEXT_MENU_PREVIEW_GAP, alignOffset: 0 }\n if (presentation?.kind === \"keyboard\") return { side: \"bottom\" as const, align: \"start\" as const, sideOffset: 5, alignOffset: 0 }\n // As a desktop context menu, its corner at the pointer.\n return { side: \"bottom\" as const, align: \"start\" as const, sideOffset: 2, alignOffset: 0 }\n}\n\nconst round = (value: number) => Math.round(value * 100) / 100\n\n/**\n * The dimming covers the page but the element: an SVG mask with the element's rounded box cut out, written to\n * `--context-menu-hole`, so the element stays clear above the dimmed, blurred page.\n */\nexport function contextMenuHoleMask(preview: Extract<ContextMenuPresentation, { kind: \"preview\" }>, viewport?: { width: number; height: number }) {\n const width = round(viewport?.width ?? window.innerWidth)\n const height = round(viewport?.height ?? window.innerHeight)\n const x = round(preview.rect.x)\n const y = round(preview.rect.y)\n const w = round(preview.rect.width)\n const h = round(preview.rect.height)\n const r = round(preview.radius)\n const hole = `M${x + r} ${y}H${round(x + w - r)}A${r} ${r} 0 0 1 ${x + w} ${round(y + r)}V${round(y + h - r)}A${r} ${r} 0 0 1 ${round(x + w - r)} ${round(y + h)}H${round(x + r)}A${r} ${r} 0 0 1 ${x} ${round(y + h - r)}V${round(y + r)}A${r} ${r} 0 0 1 ${round(x + r)} ${y}Z`\n const svg = `<svg xmlns='http://www.w3.org/2000/svg' width='${width}' height='${height}' viewBox='0 0 ${width} ${height}'><path fill-rule='evenodd' d='M0 0H${width}V${height}H0Z${hole}'/></svg>`\n return { \"--context-menu-hole\": `url(\"data:image/svg+xml,${encodeURIComponent(svg)}\")` }\n}\n"]}
1
+ {"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../../src/components/ContextMenu/shared.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,4EAA4E;AAC5E,MAAM,CAAC,MAAM,uBAAuB,GAAG,GAAG,CAAA;AAC1C,iFAAiF;AACjF,MAAM,CAAC,MAAM,4BAA4B,GAAG,EAAE,CAAA;AAC9C;4EAC4E;AAC5E,MAAM,CAAC,MAAM,wBAAwB,GAAG,EAAE,CAAA;AAC1C,qGAAqG;AACrG,MAAM,cAAc,GAAG,EAAE,CAAA;AAUzB,MAAM,EAAE,GAAG,CAAC,KAAa,EAAE,IAAY,EAAE,EAAE;IACzC,MAAM,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAA;IACvC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC;QAAE,OAAO,CAAC,CAA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GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IACpC,MAAM,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;IAC/B,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,KAAK,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,KAAK,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAA;IACjR,MAAM,GAAG,GAAG,kDAAkD,KAAK,aAAa,MAAM,kBAAkB,KAAK,IAAI,MAAM,uCAAuC,KAAK,IAAI,MAAM,MAAM,IAAI,WAAW,CAAA;IAClM,OAAO,EAAE,qBAAqB,EAAE,2BAA2B,kBAAkB,CAAC,GAAG,CAAC,IAAI,EAAE,CAAA;AAC1F,CAAC","sourcesContent":["// Shared with packages/ui/src/components/ContextMenu/shared.ts: keep the two copies the same.\n/** A touch held this long opens the menu, as a UIKit long press (0.5 s). */\nexport const CONTEXT_MENU_LONG_PRESS = 500\n/** A touch that moves farther than this before then scrolls or drags instead. */\nexport const CONTEXT_MENU_LONG_PRESS_SLOP = 10\n/** The kit's gap between the preview and the menu: iOS 27 Context Menu 125:58750, Alignment=Vertical, the menu at\n * 176.5 under a content area that ends at 160.5 (the iOS 26 kit had 18). */\nexport const CONTEXT_MENU_PREVIEW_GAP = 16\n/** The kit's preview corner (Content Area, radius 30), for an element without corners of its own. */\nconst PREVIEW_RADIUS = 30\n\ntype Rect = { x: number; y: number; width: number; height: number }\n\n/** Where the menu opens: at the pointer, under the element for the keyboard, or beside a touch-and-hold preview. */\nexport type ContextMenuPresentation =\n | { kind: \"pointer\"; rect: Rect }\n | { kind: \"keyboard\"; rect: Rect }\n | { kind: \"preview\"; rect: Rect; radius: number; align: \"start\" | \"end\" }\n\nconst px = (value: string, base: number) => {\n const number = Number.parseFloat(value)\n if (!Number.isFinite(number)) return 0\n return value.trim().endsWith(\"%\") ? (number / 100) * base : number\n}\n\n/**\n * The preview of a touch and hold: the element's box and corner (its own, or `--context-menu-preview-radius`), and\n * the edge the menu keeps to, the one on the side of the touch, as the kit's Side=Leading and Side=Trailing.\n */\nexport function contextMenuPreview(element: HTMLElement, touchX: number): ContextMenuPresentation {\n const box = element.getBoundingClientRect()\n const rect = { x: box.left, y: box.top, width: box.width, height: box.height }\n const style = getComputedStyle(element)\n const short = Math.min(rect.width, rect.height)\n const own = px(style.borderTopLeftRadius, short)\n const fallback = px(style.getPropertyValue(\"--context-menu-preview-radius\"), short) || PREVIEW_RADIUS\n const radius = Math.min(own > 0 ? own : fallback, short / 2)\n const width = element.ownerDocument.defaultView?.innerWidth ?? rect.x + rect.width\n return { kind: \"preview\", rect, radius, align: touchX < width / 2 ? \"start\" : \"end\" }\n}\n\n/** The menu's side, alignment and offsets for a presentation. */\nexport function contextMenuPlacement(presentation: ContextMenuPresentation | null) {\n if (presentation?.kind === \"preview\")\n return { side: \"bottom\" as const, align: presentation.align, sideOffset: CONTEXT_MENU_PREVIEW_GAP, alignOffset: 0 }\n if (presentation?.kind === \"keyboard\") return { side: \"bottom\" as const, align: \"start\" as const, sideOffset: 5, alignOffset: 0 }\n // As a desktop context menu, its corner at the pointer.\n return { side: \"bottom\" as const, align: \"start\" as const, sideOffset: 2, alignOffset: 0 }\n}\n\nconst round = (value: number) => Math.round(value * 100) / 100\n\n/**\n * The dimming covers the page but the element: an SVG mask with the element's rounded box cut out, written to\n * `--context-menu-hole`, so the element stays clear above the dimmed, blurred page.\n */\nexport function contextMenuHoleMask(preview: Extract<ContextMenuPresentation, { kind: \"preview\" }>, viewport?: { width: number; height: number }) {\n const width = round(viewport?.width ?? window.innerWidth)\n const height = round(viewport?.height ?? window.innerHeight)\n const x = round(preview.rect.x)\n const y = round(preview.rect.y)\n const w = round(preview.rect.width)\n const h = round(preview.rect.height)\n const r = round(preview.radius)\n const hole = `M${x + r} ${y}H${round(x + w - r)}A${r} ${r} 0 0 1 ${x + w} ${round(y + r)}V${round(y + h - r)}A${r} ${r} 0 0 1 ${round(x + w - r)} ${round(y + h)}H${round(x + r)}A${r} ${r} 0 0 1 ${x} ${round(y + h - r)}V${round(y + r)}A${r} ${r} 0 0 1 ${round(x + r)} ${y}Z`\n const svg = `<svg xmlns='http://www.w3.org/2000/svg' width='${width}' height='${height}' viewBox='0 0 ${width} ${height}'><path fill-rule='evenodd' d='M0 0H${width}V${height}H0Z${hole}'/></svg>`\n return { \"--context-menu-hole\": `url(\"data:image/svg+xml,${encodeURIComponent(svg)}\")` }\n}\n"]}
@@ -1,11 +1,15 @@
1
- import { cloneVNode, computed, createCommentVNode, defineComponent, Fragment as FragmentVNode, h, inject, onBeforeUnmount, onMounted, onUnmounted, provide, ref, watch, isVNode, } from "vue";
1
+ import { cloneVNode, computed, createCommentVNode, defineComponent, Fragment as FragmentVNode, h, inject, onBeforeUnmount, onMounted, onUnmounted, provide, ref, shallowRef, watch, isVNode, } from "vue";
2
2
  import { DialogContent as RekaDialogContent, DialogDescription as RekaDialogDescription, DialogOverlay as RekaDialogOverlay, DialogPortal as RekaDialogPortal, DialogRoot as RekaDialogRoot, DialogTitle as RekaDialogTitle, FocusScope as RekaFocusScope, injectDialogRootContext, useForwardExpose, useId, } from "reka-ui";
3
3
  import { useEscCloseStack } from "../../composables/useEscCloseStack.js";
4
- import { keepMovedFocus, preventDefaultHandler, toCssVariables } from "../../lib/helpers.js";
4
+ import { inToastRegion } from "../../lib/toastRegion.js";
5
+ import { cancelableKeyCopy, dataAttributes, keepMovedFocus, preventDefaultHandler, toCssVariables } from "../../lib/helpers.js";
5
6
  import { dismissableSurfaces, useDeferredPointerDownOutside } from "../Popover/deferredPointerDownOutside.js";
6
7
  import { firstElementChild } from "../Tooltip/slot.js";
7
8
  import { TransitionGroup } from "../Transition/index.js";
8
9
  import { attachSheetDrag } from "./sheetDrag.js";
10
+ import { watchDialogViewport } from "./dialogViewport.js";
11
+ import { enterStep, leaveStep, releaseStepHeight, settleStepHeight, STEP_TIMING } from "./dialogSteps.js";
12
+ import { PHONE_LAYOUT as PHONE_LAYOUT_SCOPE } from "../PhoneLayout/PhoneLayout.js";
9
13
  import { overlayTiming, overlayTimingLarge } from "../Transition/shared.js";
10
14
  import { provideFloatingBoundaryScope, useFloatingBoundaryRegistration } from "../../composables/useFloatingBoundary.js";
11
15
  import { NavigationButton } from "../Button/NavigationButton.js";
@@ -24,9 +28,12 @@ const DIALOG_BAR = Symbol("DialogBar");
24
28
  const PHONE_LAYOUT = "(width <= 767px)";
25
29
  const phoneLayout = () => (typeof window !== "undefined" && typeof window.matchMedia === "function" ? window.matchMedia(PHONE_LAYOUT) : null);
26
30
  const usePhoneLayout = () => {
31
+ // Inside a PhoneLayout, or a dialog with `layout="phone"`, at any window width
32
+ const scope = inject(PHONE_LAYOUT_SCOPE, null);
27
33
  const query = phoneLayout();
28
- const phone = ref(query?.matches ?? false);
29
- const update = () => { phone.value = !!query?.matches; };
34
+ const narrow = ref(query?.matches ?? false);
35
+ const phone = computed(() => !!scope?.phone.value || narrow.value);
36
+ const update = () => { narrow.value = !!query?.matches; };
30
37
  if (!query)
31
38
  return phone;
32
39
  // Safari before 14 has only the older listener methods
@@ -156,9 +163,33 @@ export const DialogContent = defineComponent({
156
163
  onOpenAutoFocus: Function,
157
164
  /** Called when focus returns on close; `event.preventDefault()` keeps it elsewhere. */
158
165
  onCloseAutoFocus: Function,
166
+ /**
167
+ * Called on Escape before the dialog closes; `event.preventDefault()` keeps it open, such as for a form with
168
+ * unsaved changes.
169
+ */
170
+ onEscapeKeyDown: Function,
171
+ /**
172
+ * Called on a press or a focus outside the dialog before it closes; `event.preventDefault()` keeps it open, such
173
+ * as for a press on a developer panel over the page.
174
+ */
175
+ onInteractOutside: Function,
176
+ /** Stack order of the overlay and the dialog. @default 50 */
177
+ zIndex: Number,
178
+ /** Class, style and data attributes for the fixed layer that holds the panel. Data attributes of DialogContent land here too. */
179
+ rootProps: Object,
180
+ /** Class, style and data attributes for the overlay. */
181
+ overlayProps: Object,
182
+ /** `phone` lays the dialog out as on a phone at any window width. Inside a PhoneLayout it always is. @default "auto" */
183
+ layout: { type: String, default: "auto" },
159
184
  },
160
185
  setup(props, { slots, attrs }) {
161
186
  const { open, setOpen, titleCount, descriptionCount } = useDialogContext();
187
+ const outerPhoneLayout = inject(PHONE_LAYOUT_SCOPE, null);
188
+ // A dialog laid out as on a phone by its own prop, outside a PhoneLayout, keeps the window: what it holds and
189
+ // the dialogs it opens are phone ones too, for as long as the prop says so.
190
+ const phoneLayout = computed(() => !!outerPhoneLayout?.phone.value || props.layout === "phone");
191
+ const portalTarget = computed(() => outerPhoneLayout?.container.value ?? null);
192
+ provide(PHONE_LAYOUT_SCOPE, { container: outerPhoneLayout?.container ?? shallowRef(null), phone: phoneLayout });
162
193
  const scroll = { scrolled: ref(false), contentBelow: ref(false) };
163
194
  provide(DIALOG_SCROLL, scroll);
164
195
  provide(TOOLBAR_HOST, { kind: "dialog", scrolled: scroll.scrolled, contentBelow: scroll.contentBelow });
@@ -172,6 +203,15 @@ export const DialogContent = defineComponent({
172
203
  // Radix's root makes the content id; Reka's trigger does, so a dialog
173
204
  // without one would render `id=""`
174
205
  rootContext.contentId ||= useId(undefined, "reka-dialog-content");
206
+ // Reka replaces the root's content ref as it mounts, so the layer is found from the panel once it is in place
207
+ const panelNode = shallowRef(null);
208
+ let stopViewport;
209
+ watch([panelNode, portalTarget], ([panel, box]) => {
210
+ stopViewport?.();
211
+ const content = panel?.closest("[data-plex-dialog]");
212
+ stopViewport = content ? watchDialogViewport(content, box) : undefined;
213
+ }, { flush: "post", immediate: true });
214
+ onBeforeUnmount(() => stopViewport?.());
175
215
  const handleCloseAutoFocus = (rekaEvent) => {
176
216
  // Reka announces unmount before descendant scopes release their traps.
177
217
  // Match Radix (and our Menu adapter): dispatch the cancellable callback
@@ -196,24 +236,55 @@ export const DialogContent = defineComponent({
196
236
  };
197
237
  // Escape goes through the shared stack, as in React, so the dialog
198
238
  // closes before overlays opened earlier (a forced-open Tooltip)
199
- useEscCloseStack(open, () => {
239
+ useEscCloseStack(open, (event) => {
240
+ if (props.onEscapeKeyDown) {
241
+ const request = cancelableKeyCopy(event);
242
+ props.onEscapeKeyDown(request);
243
+ if (request.defaultPrevented)
244
+ return;
245
+ }
200
246
  setOpen(false);
201
247
  });
202
248
  // The second click of a double click lands on the overlay: it must not undo the first
203
249
  let openedAt = 0;
204
- // Radix's modal content: a Ctrl+click (macOS right click) does not dismiss
250
+ // The owner's handler comes first; a prevented interaction keeps the dialog open
251
+ const ownerKeepsOpen = (event) => {
252
+ props.onInteractOutside?.(event);
253
+ return event.defaultPrevented;
254
+ };
255
+ // Radix's modal content: a Ctrl+click (macOS right click) does not dismiss. A deferred press asks the owner when
256
+ // the click completes it, as Radix does, so a form that changed meanwhile can still forbid closing.
205
257
  const outsidePress = useDeferredPointerDownOutside((originalEvent) => {
258
+ const request = new CustomEvent("dismissableLayer.pointerDownOutside", { cancelable: true, detail: { originalEvent } });
259
+ if (ownerKeepsOpen(request))
260
+ return;
206
261
  if (!originalEvent.ctrlKey && performance.now() - openedAt >= DOUBLE_CLICK)
207
262
  setOpen(false);
208
- });
263
+ }, () => rootContext.contentElement.value);
209
264
  const handlePointerDownOutside = (event) => {
210
265
  // The native modal owner outlives logical open. An exiting layer must not
211
266
  // start a deferred dismissal that closes a trigger-driven reopen.
212
267
  if (!open.value)
213
- event.preventDefault();
214
- else
268
+ return event.preventDefault();
269
+ // A press in a toast is not outside: the toast region is a layer above the dialog. The Toaster stops it
270
+ // before Reka sees it; this holds when the Toaster mounted after the dialog.
271
+ if (inToastRegion(event.detail.originalEvent.target))
272
+ return event.preventDefault();
273
+ // A primary mouse or pen press waits for its click; a touch or another button dismisses now, as Reka does
274
+ const { originalEvent } = event.detail;
275
+ if (originalEvent.button === 0 && originalEvent.pointerType !== "touch")
276
+ return outsidePress.onPointerDownOutside(event);
277
+ if (!ownerKeepsOpen(event))
215
278
  outsidePress.onPointerDownOutside(event);
216
279
  };
280
+ // Focus moving out while a press waits for its click is that press, as on Radix: the owner hears of it once
281
+ const handleFocusOutside = (event) => {
282
+ if (inToastRegion(event.detail?.originalEvent.target))
283
+ return event.preventDefault();
284
+ outsidePress.onFocusOutside(event);
285
+ if (!event.defaultPrevented)
286
+ props.onInteractOutside?.(event);
287
+ };
217
288
  const handleInteractOutside = (event) => {
218
289
  if (!open.value)
219
290
  event.preventDefault();
@@ -238,6 +309,7 @@ export const DialogContent = defineComponent({
238
309
  barChildren?.disconnect();
239
310
  detachDrag = undefined;
240
311
  panelElement = element;
312
+ panelNode.value = element ?? null;
241
313
  boundary.setRoot(element);
242
314
  if (element) {
243
315
  const update = () => {
@@ -286,12 +358,21 @@ export const DialogContent = defineComponent({
286
358
  dismissableSurfaces.add(element);
287
359
  };
288
360
  const renderDialog = () => h(DialogSurface, { key: "dialog" }, () => [
289
- h(RekaDialogOverlay, { class: s.Overlay, forceMount: true, ref: setOverlayRef, "data-state": open.value ? "open" : "closed" }),
361
+ h(RekaDialogOverlay, {
362
+ ...props.overlayProps,
363
+ class: [s.Overlay, props.overlayProps?.class],
364
+ style: [layerStyle(), props.overlayProps?.style],
365
+ forceMount: true,
366
+ ref: setOverlayRef,
367
+ "data-state": open.value ? "open" : "closed",
368
+ }),
290
369
  h(RekaDialogContent, {
370
+ ...dataAttributes(attrs),
371
+ ...props.rootProps,
291
372
  "forceMount": true,
292
- "class": s.Content,
373
+ "class": [s.Content, props.rootProps?.class],
293
374
  "data-plex-dialog": "",
294
- "style": toCssVariables({ "dialog-width": props.width }),
375
+ "style": [toCssVariables({ "dialog-width": props.width }), layerStyle(), props.rootProps?.style],
295
376
  "data-placement": props.placement === "center" ? undefined : props.placement,
296
377
  "data-mobile-placement": mobilePlacement.value,
297
378
  "data-mobile-variant": props.mobileVariant,
@@ -305,7 +386,7 @@ export const DialogContent = defineComponent({
305
386
  ...(descriptionCount.value > 0 ? {} : { "aria-describedby": undefined }),
306
387
  "onEscapeKeyDown": preventDefaultHandler,
307
388
  "onPointerDownOutside": handlePointerDownOutside,
308
- "onFocusOutside": outsidePress.onFocusOutside,
389
+ "onFocusOutside": handleFocusOutside,
309
390
  "onInteractOutside": handleInteractOutside,
310
391
  }, {
311
392
  default: () => [
@@ -334,12 +415,16 @@ export const DialogContent = defineComponent({
334
415
  ],
335
416
  }),
336
417
  ]);
418
+ const layerStyle = () => toCssVariables({ "dialog-z-index": props.zIndex === undefined ? undefined : String(props.zIndex) });
337
419
  return () => {
338
420
  const { placement } = props;
339
421
  const crossesScreen = placement === "bottom" || placement === "start" || placement === "end" || placement === "fullscreen" || mobilePlacement.value === "bottom" || mobilePlacement.value === "fullscreen";
340
- return h(RekaDialogPortal, null, {
422
+ // Portaled out of any phone layout, a phone dialog carries its own scope, above its transition: the phone rules
423
+ // of the style sheet start there.
424
+ const scoped = (group) => phoneLayout.value && !portalTarget.value ? h("div", { class: s.PhoneScope, "data-plex-layout": "phone" }, [group]) : group;
425
+ return h(RekaDialogPortal, { to: portalTarget.value ?? undefined }, {
341
426
  default: () => [
342
- h(TransitionGroup,
427
+ scoped(h(TransitionGroup,
343
428
  // A dialog mounted open enters too, as `v-if` and `open` together do
344
429
  {
345
430
  class: s.Transition,
@@ -348,7 +433,7 @@ export const DialogContent = defineComponent({
348
433
  preventInitialTransition: false,
349
434
  },
350
435
  // `open && <div>` in React: closed still renders the empty wrapper
351
- { default: () => [open.value ? renderDialog() : createCommentVNode()] }),
436
+ { default: () => [open.value ? renderDialog() : createCommentVNode()] })),
352
437
  ],
353
438
  });
354
439
  };
@@ -360,8 +445,8 @@ const isHeaderAction = (part) => isVNode(part) && part.type === DialogHeaderActi
360
445
  export const DialogHeader = defineComponent({
361
446
  name: "DialogHeader",
362
447
  props: {
363
- /** How the bar meets the content scrolled under it in a phone Sheet. @default "soft" */
364
- background: { type: String, default: "soft" },
448
+ /** How the bar meets the content scrolled under it in a phone Sheet. @default "glass" */
449
+ background: { type: String, default: "glass" },
365
450
  },
366
451
  setup(props, { slots }) {
367
452
  const scroll = inject(DIALOG_SCROLL, null);
@@ -487,4 +572,36 @@ export const DialogClose = defineComponent({
487
572
  return () => withDialogProps(firstElementChild(slots.default?.()), { type: "button" }, onClick);
488
573
  },
489
574
  });
575
+ /** The steps of a flow inside a dialog, such as a sign-in that asks for an email and then a code. */
576
+ export const DialogSteps = defineComponent({
577
+ name: "DialogSteps",
578
+ props: {
579
+ /** The step on screen. A new value brings its content in. */
580
+ step: { type: [String, Number], required: true },
581
+ /**
582
+ * `forward` brings the new step in from the trailing edge over the one before, as a push on iOS; `back` returns
583
+ * to a step before it.
584
+ * @default "forward"
585
+ */
586
+ direction: { type: String, default: "forward" },
587
+ },
588
+ setup(props, { slots }) {
589
+ return () => {
590
+ // Resolve this step now, so a step that leaves cannot read the next one
591
+ const entry = h("div", { "key": props.step, "data-dialog-step": "", "tabindex": -1 }, slots.default?.());
592
+ return h("div", { "class": s.Steps, "data-direction": props.direction }, [
593
+ h(TransitionGroup, {
594
+ ...STEP_TIMING,
595
+ as: "div",
596
+ overlay: true,
597
+ class: s.Step,
598
+ onEnter: enterStep,
599
+ onExit: leaveStep,
600
+ onExitActive: settleStepHeight,
601
+ onExitComplete: releaseStepHeight,
602
+ }, () => [entry]),
603
+ ]);
604
+ };
605
+ },
606
+ });
490
607
  //# sourceMappingURL=Dialog.js.map