@plexui/vue 0.22.0 → 0.24.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 (93) hide show
  1. package/dist/es/components/Alert/Alert.js +16 -4
  2. package/dist/es/components/Alert/Alert.js.map +1 -1
  3. package/dist/es/components/ColorPicker/ColorPicker.js +13 -9
  4. package/dist/es/components/ColorPicker/ColorPicker.js.map +1 -1
  5. package/dist/es/components/ColorPicker/ColorWell.js +5 -3
  6. package/dist/es/components/ColorPicker/ColorWell.js.map +1 -1
  7. package/dist/es/components/ColorPicker/shared.js +5 -4
  8. package/dist/es/components/ColorPicker/shared.js.map +1 -1
  9. package/dist/es/components/ContextMenu/ContextMenu.js +9 -9
  10. package/dist/es/components/ContextMenu/ContextMenu.js.map +1 -1
  11. package/dist/es/components/ContextMenu/shared.js +25 -5
  12. package/dist/es/components/ContextMenu/shared.js.map +1 -1
  13. package/dist/es/components/DatePicker/CalendarNavigationIcon.js +8 -15
  14. package/dist/es/components/DatePicker/CalendarNavigationIcon.js.map +1 -1
  15. package/dist/es/components/DatePicker/DatePicker.js +3 -3
  16. package/dist/es/components/DatePicker/DatePicker.js.map +1 -1
  17. package/dist/es/components/DatePicker/useCalendarCollisionPadding.js +25 -0
  18. package/dist/es/components/DatePicker/useCalendarCollisionPadding.js.map +1 -0
  19. package/dist/es/components/DateRangePicker/DateRangePicker.js +3 -3
  20. package/dist/es/components/DateRangePicker/DateRangePicker.js.map +1 -1
  21. package/dist/es/components/Dialog/Dialog.js +75 -24
  22. package/dist/es/components/Dialog/Dialog.js.map +1 -1
  23. package/dist/es/components/Dialog/index.js.map +1 -1
  24. package/dist/es/components/Dialog/sheetDrag.js +3 -1
  25. package/dist/es/components/Dialog/sheetDrag.js.map +1 -1
  26. package/dist/es/components/Icon/svg/FilterBadge.js +1 -1
  27. package/dist/es/components/Icon/svg/FilterBadge.js.map +1 -1
  28. package/dist/es/components/Input/Input.js +3 -0
  29. package/dist/es/components/Input/Input.js.map +1 -1
  30. package/dist/es/components/Menu/Menu.js +10 -1
  31. package/dist/es/components/Menu/Menu.js.map +1 -1
  32. package/dist/es/components/PhoneLayout/PhoneLayout.js +9 -1
  33. package/dist/es/components/PhoneLayout/PhoneLayout.js.map +1 -1
  34. package/dist/es/components/Popover/Popover.js +2 -2
  35. package/dist/es/components/Popover/Popover.js.map +1 -1
  36. package/dist/es/components/ProgressSteps/ProgressSteps.js +7 -3
  37. package/dist/es/components/ProgressSteps/ProgressSteps.js.map +1 -1
  38. package/dist/es/components/ProgressSteps/index.js.map +1 -1
  39. package/dist/es/components/Select/Select.js +178 -32
  40. package/dist/es/components/Select/Select.js.map +1 -1
  41. package/dist/es/components/SelectControl/SelectControl.js +3 -1
  42. package/dist/es/components/SelectControl/SelectControl.js.map +1 -1
  43. package/dist/es/components/Slider/Slider.js +24 -11
  44. package/dist/es/components/Slider/Slider.js.map +1 -1
  45. package/dist/es/components/Slider/sliderPrimitive.js +5 -2
  46. package/dist/es/components/Slider/sliderPrimitive.js.map +1 -1
  47. package/dist/es/components/Sortable/Sortable.js +1 -1
  48. package/dist/es/components/Sortable/Sortable.js.map +1 -1
  49. package/dist/es/components/StatCard/index.js +4 -1
  50. package/dist/es/components/StatCard/index.js.map +1 -1
  51. package/dist/es/components/{StatCard/StatCard.js → StatsCard/StatsCard.js} +32 -27
  52. package/dist/es/components/StatsCard/StatsCard.js.map +1 -0
  53. package/dist/es/components/StatsCard/index.js +2 -0
  54. package/dist/es/components/StatsCard/index.js.map +1 -0
  55. package/dist/es/components/SwipeActions/SwipeActions.js +32 -5
  56. package/dist/es/components/SwipeActions/SwipeActions.js.map +1 -1
  57. package/dist/es/components/TabBar/TabBar.js +52 -21
  58. package/dist/es/components/TabBar/TabBar.js.map +1 -1
  59. package/dist/es/components/Tabs/Tabs.js +229 -6
  60. package/dist/es/components/Tabs/Tabs.js.map +1 -1
  61. package/dist/es/components/Toast/index.js.map +1 -1
  62. package/dist/es/components/Toast/toast.js +3 -1
  63. package/dist/es/components/Toast/toast.js.map +1 -1
  64. package/dist/es/components/Toolbar/Toolbar.js.map +1 -1
  65. package/dist/es/lib/menuTriggerCover.js +40 -3
  66. package/dist/es/lib/menuTriggerCover.js.map +1 -1
  67. package/dist/types/components/ColorPicker/ColorPicker.d.ts +3 -2
  68. package/dist/types/components/ColorPicker/shared.d.ts +5 -4
  69. package/dist/types/components/ContextMenu/shared.d.ts +28 -6
  70. package/dist/types/components/DatePicker/useCalendarCollisionPadding.d.ts +9 -0
  71. package/dist/types/components/Dialog/Dialog.d.ts +56 -14
  72. package/dist/types/components/Dialog/index.d.ts +1 -1
  73. package/dist/types/components/Dialog/sheetDrag.d.ts +2 -1
  74. package/dist/types/components/PhoneLayout/PhoneLayout.d.ts +5 -0
  75. package/dist/types/components/Popover/Popover.d.ts +5 -5
  76. package/dist/types/components/ProgressSteps/ProgressSteps.d.ts +17 -3
  77. package/dist/types/components/ProgressSteps/index.d.ts +1 -1
  78. package/dist/types/components/Select/Select.d.ts +19 -8
  79. package/dist/types/components/StatCard/index.d.ts +9 -1
  80. package/dist/types/components/{StatCard/StatCard.d.ts → StatsCard/StatsCard.d.ts} +19 -19
  81. package/dist/types/components/StatsCard/index.d.ts +1 -0
  82. package/dist/types/components/SwipeActions/SwipeActions.d.ts +6 -6
  83. package/dist/types/components/TabBar/TabBar.d.ts +34 -0
  84. package/dist/types/components/Tabs/Tabs.d.ts +33 -2
  85. package/dist/types/components/Toast/index.d.ts +1 -1
  86. package/dist/types/components/Toast/toast.d.ts +11 -2
  87. package/dist/types/components/Toolbar/Toolbar.d.ts +1 -1
  88. package/dist/types/lib/menuTriggerCover.d.ts +16 -2
  89. package/package.json +2 -2
  90. package/dist/es/components/DatePicker/useCalendarGutter.js +0 -14
  91. package/dist/es/components/DatePicker/useCalendarGutter.js.map +0 -1
  92. package/dist/es/components/StatCard/StatCard.js.map +0 -1
  93. package/dist/types/components/DatePicker/useCalendarGutter.d.ts +0 -2
@@ -1 +1 @@
1
- {"version":3,"file":"CalendarNavigationIcon.js","sourceRoot":"","sources":["../../../../src/components/DatePicker/CalendarNavigationIcon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,CAAC,EAA4B,MAAM,KAAK,CAAA;AAC3D,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAC5D,OAAO,CAAC,MAAM,wEAAwE,CAAA;AAItF,yEAAyE;AACzE,iFAAiF;AACjF,MAAM,aAAa,GAAG,0tBAA0tB,CAAA;AAChvB,MAAM,SAAS,GAAG,otBAAotB,CAAA;AAEtuB,MAAM,CAAC,MAAM,sBAAsB,GAAqD,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE;IACxG,MAAM,QAAQ,GAAG,SAAS,KAAK,UAAU,CAAA;IACzC,MAAM,WAAW,GAAG,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,YAAY,CAAA;IAEzD,OAAO,CAAC,CAAC,QAAQ,EAAE,IAAI,EAAE;QACvB,CAAC,CAAC,WAAW,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,WAAW,EAAE,kBAAkB,EAAE,EAAE,EAAE,CAAC;QAChE,CAAC,CAAC,KAAK,EAAE;YACP,KAAK,EAAE,CAAC,CAAC,SAAS;YAClB,gBAAgB,EAAE,SAAS;YAC3B,kBAAkB,EAAE,EAAE;YACtB,KAAK,EAAE,IAAI;YACX,MAAM,EAAE,IAAI;YACZ,OAAO,EAAE,WAAW;YACpB,IAAI,EAAE,cAAc;YACpB,aAAa,EAAE,MAAM;SACtB,EAAE;YACD,CAAC,CAAC,MAAM,EAAE;gBACR,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS;gBACvC,SAAS,EAAE,aAAa,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,eAAe;aACrE,CAAC;SACH,CAAC;KACH,CAAC,CAAA;AACJ,CAAC,CAAA;AAED,sBAAsB,CAAC,YAAY,GAAG,KAAK,CAAA","sourcesContent":["import { Fragment, h, type FunctionalComponent } from \"vue\"\nimport { ChevronLeft, ChevronRight } from \"../Icon/index.js\"\nimport s from \"@plexui/styles/components/DatePicker/CalendarNavigationIcon.module.css\"\n\ntype CalendarNavigationIconProps = { direction: \"previous\" | \"next\" }\n\n// Outlined Figma Compact calendar arrows, nodes 495:46787 and 495:46788.\n// Keep the 15x24 text boxes and their ink offsets; no SF Symbols font is needed.\nconst PREVIOUS_PATH = \"M0 8.64258C0 8.47331 0.0292969 8.31706 0.0878906 8.17383C0.152995 8.0306 0.250651 7.89388 0.380859 7.76367L7.98828 0.322266C8.20964 0.107422 8.47656 0 8.78906 0C9.00391 0 9.19596 0.0520833 9.36523 0.15625C9.54102 0.253906 9.68099 0.38737 9.78516 0.556641C9.88932 0.725911 9.94141 0.917969 9.94141 1.13281C9.94141 1.4388 9.82096 1.71224 9.58008 1.95312L2.72461 8.64258L9.58008 15.332C9.82096 15.5729 9.94141 15.8496 9.94141 16.1621C9.94141 16.3704 9.88932 16.5592 9.78516 16.7285C9.68099 16.9043 9.54102 17.041 9.36523 17.1387C9.19596 17.2428 9.00391 17.2949 8.78906 17.2949C8.47656 17.2949 8.20964 17.1842 7.98828 16.9629L0.380859 9.52148C0.250651 9.39128 0.152995 9.25456 0.0878906 9.11133C0.0292969 8.9681 0 8.81185 0 8.64258Z\"\nconst NEXT_PATH = \"M9.94141 8.64258C9.94141 8.81185 9.90885 8.9681 9.84375 9.11133C9.77865 9.25456 9.68099 9.39128 9.55078 9.52148L1.94336 16.9629C1.72852 17.1842 1.46159 17.2949 1.14258 17.2949C0.934245 17.2949 0.742188 17.2428 0.566406 17.1387C0.390625 17.041 0.250651 16.9043 0.146484 16.7285C0.0488281 16.5592 0 16.3704 0 16.1621C0 15.8496 0.117188 15.5729 0.351562 15.332L7.20703 8.64258L0.351562 1.95312C0.117188 1.71224 0 1.4388 0 1.13281C0 0.917969 0.0488281 0.725911 0.146484 0.556641C0.250651 0.38737 0.390625 0.253906 0.566406 0.15625C0.742188 0.0520833 0.934245 0 1.14258 0C1.46159 0 1.72852 0.107422 1.94336 0.322266L9.55078 7.76367C9.68099 7.89388 9.77865 8.0306 9.84375 8.17383C9.90885 8.31706 9.94141 8.47331 9.94141 8.64258Z\"\n\nexport const CalendarNavigationIcon: FunctionalComponent<CalendarNavigationIconProps> = ({ direction }) => {\n const previous = direction === \"previous\"\n const DesktopIcon = previous ? ChevronLeft : ChevronRight\n\n return h(Fragment, null, [\n h(DesktopIcon, { class: s.DesktopIcon, \"data-no-autosize\": \"\" }),\n h(\"svg\", {\n class: s.PhoneIcon,\n \"data-direction\": direction,\n \"data-no-autosize\": \"\",\n width: \"15\",\n height: \"24\",\n viewBox: \"0 0 15 24\",\n fill: \"currentColor\",\n \"aria-hidden\": \"true\",\n }, [\n h(\"path\", {\n d: previous ? PREVIOUS_PATH : NEXT_PATH,\n transform: `translate(${previous ? 1.25 : 3.818359375} 3.306640625)`,\n }),\n ]),\n ])\n}\n\nCalendarNavigationIcon.inheritAttrs = false\n"]}
1
+ {"version":3,"file":"CalendarNavigationIcon.js","sourceRoot":"","sources":["../../../../src/components/DatePicker/CalendarNavigationIcon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,CAAC,EAA4B,MAAM,KAAK,CAAA;AAC3D,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAC3F,OAAO,CAAC,MAAM,wEAAwE,CAAA;AAItF,+GAA+G;AAC/G,kHAAkH;AAClH,+DAA+D;AAC/D,MAAM,cAAc,GAAG,EAAE,QAAQ,EAAE,cAAc,EAAE,IAAI,EAAE,cAAc,EAAE,CAAA;AAEzE,MAAM,CAAC,MAAM,sBAAsB,GAAqD,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE;IACxG,MAAM,QAAQ,GAAG,SAAS,KAAK,UAAU,CAAA;IACzC,MAAM,WAAW,GAAG,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,YAAY,CAAA;IAEzD,OAAO,CAAC,CAAC,QAAQ,EAAE,IAAI,EAAE;QACvB,CAAC,CAAC,WAAW,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,WAAW,EAAE,kBAAkB,EAAE,EAAE,EAAE,CAAC;QAChE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,cAAc,EAAE;YAC3C,KAAK,EAAE,CAAC,CAAC,SAAS;YAClB,gBAAgB,EAAE,SAAS;YAC3B,kBAAkB,EAAE,EAAE;YACtB,KAAK,EAAE,IAAI;YACX,MAAM,EAAE,IAAI;YACZ,OAAO,EAAE,cAAc,CAAC,SAAS,CAAC;SACnC,CAAC;KACH,CAAC,CAAA;AACJ,CAAC,CAAA;AAED,sBAAsB,CAAC,YAAY,GAAG,KAAK,CAAA","sourcesContent":["import { Fragment, h, type FunctionalComponent } from \"vue\"\nimport { ChevronLeft, ChevronLeftLg, ChevronRight, ChevronRightLg } from \"../Icon/index.js\"\nimport s from \"@plexui/styles/components/DatePicker/CalendarNavigationIcon.module.css\"\n\ntype CalendarNavigationIconProps = { direction: \"previous\" | \"next\" }\n\n// On a phone the arrows keep the 15x24 boxes of the iOS month arrows and the centres of their ink (6.2 and 8.8\n// from the leading edge, 12 from the top), drawn with the large Plex UI chevrons: Apple's symbols may not ship on\n// the web. Each 24px chevron is cut to its box by the viewBox.\nconst PHONE_VIEW_BOX = { previous: \"5.28 0 15 24\", next: \"3.71 0 15 24\" }\n\nexport const CalendarNavigationIcon: FunctionalComponent<CalendarNavigationIconProps> = ({ direction }) => {\n const previous = direction === \"previous\"\n const DesktopIcon = previous ? ChevronLeft : ChevronRight\n\n return h(Fragment, null, [\n h(DesktopIcon, { class: s.DesktopIcon, \"data-no-autosize\": \"\" }),\n h(previous ? ChevronLeftLg : ChevronRightLg, {\n class: s.PhoneIcon,\n \"data-direction\": direction,\n \"data-no-autosize\": \"\",\n width: \"15\",\n height: \"24\",\n viewBox: PHONE_VIEW_BOX[direction],\n }),\n ])\n}\n\nCalendarNavigationIcon.inheritAttrs = false\n"]}
@@ -7,7 +7,7 @@ import { Calendar } from "../Icon/index.js";
7
7
  import { Popover, PopoverContent, PopoverTrigger } from "../Popover/index.js";
8
8
  import { SelectControl } from "../SelectControl/index.js";
9
9
  import { DateCalendar } from "./Calendar.js";
10
- import { useCalendarGutter } from "./useCalendarGutter.js";
10
+ import { useCalendarCollisionPadding } from "./useCalendarCollisionPadding.js";
11
11
  import { DateContextKey } from "./context.js";
12
12
  // Vue port of packages/ui/src/components/DatePicker/DatePicker.tsx.
13
13
  // - `value` + `update:value` (`v-model:value`), plus `change` with the same
@@ -85,7 +85,7 @@ const DatePickerComponent = defineComponent({
85
85
  },
86
86
  setup(props, { emit }) {
87
87
  const wide = useBreakpoint("md");
88
- const calendarGutter = useCalendarGutter();
88
+ const calendarCollisionPadding = useCalendarCollisionPadding();
89
89
  const unwrap = (value) => (value ? toRaw(value) : value);
90
90
  const onChange = (nextValue) => {
91
91
  emit("update:value", nextValue);
@@ -170,7 +170,7 @@ const DatePickerComponent = defineComponent({
170
170
  h(PopoverContent, {
171
171
  class: s.Popover,
172
172
  minWidth: 230,
173
- collisionPadding: wide.value ? 20 : calendarGutter.value,
173
+ collisionPadding: wide.value ? 20 : calendarCollisionPadding.value,
174
174
  side: wide.value || props.side === "top" ? props.side : "bottom",
175
175
  sideOffset: props.sideOffset,
176
176
  align,
@@ -1 +1 @@
1
- {"version":3,"file":"DatePicker.js","sourceRoot":"","sources":["../../../../src/components/DatePicker/DatePicker.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,0DAA0D,CAAA;AACxE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAChC,OAAO,EAAE,eAAe,EAAE,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAiB,MAA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E,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAC9E;yBACF;qBACF,CAAC;oBACF,CAAC,CACC,cAAc,EACd;wBACE,KAAK,EAAE,CAAC,CAAC,OAAO;wBAChB,QAAQ,EAAE,GAAG;wBACb,gBAAgB,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,cAAc,CAAC,KAAK;wBACxD,IAAI,EAAE,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ;wBAChE,UAAU,EAAE,KAAK,CAAC,UAAU;wBAC5B,KAAK;wBACL,WAAW,EAAE,KAAK,CAAC,WAAW,IAAI,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;qBAChE,EACD,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,EAAE,CACrC;iBACF;aACF,CAAC,CAAA;QACJ,CAAC,CAAA;IACH,CAAC;CACF,CAAC,CAAA;AAMF;;;;GAIG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,mBAAmB,CAAA","sourcesContent":["import s from \"@plexui/styles/components/DatePicker/Calendar.module.css\"\nimport { DateTime } from \"luxon\"\nimport { defineComponent, h, provide, toRaw, useId, type PropType } from \"vue\"\nimport type { ControlSize } from \"@plexui/styles/types\"\nimport { useBreakpoint } from \"../../composables/useBreakpoints.js\"\nimport { isAfter } from \"../../lib/dateUtils.js\"\nimport { Calendar } from \"../Icon/index.js\"\nimport { Popover, PopoverContent, PopoverTrigger, type PopoverAlign, type PopoverSide } from \"../Popover/index.js\"\nimport { SelectControl, type DropdownIconType } from \"../SelectControl/index.js\"\nimport { DateCalendar } from \"./Calendar.js\"\nimport { useCalendarGutter } from \"./useCalendarGutter.js\"\nimport { DateContextKey, type DateContextValue } from \"./context.js\"\n\n// Vue port of packages/ui/src/components/DatePicker/DatePicker.tsx.\n// - `value` + `update:value` (`v-model:value`), plus `change` with the same\n// value (React's `onChange`). Like React the picker is controlled: a\n// parent that does not update `value` keeps the shown date.\n// - `aria-label`, `aria-labelledby`, `aria-describedby` and `aria-invalid`\n// reach the trigger, as in React. Other attributes are not passed on\n// (React's DatePicker takes no other props).\n// - DateTime values are read unwrapped (`toRaw`), so a `ref()` holding one\n// (a deep reactive proxy) works like a plain value.\n\nconst DatePickerComponent = defineComponent({\n name: \"DatePicker\",\n inheritAttrs: false,\n props: {\n /** Allow targeting the input for forms and accessibility. */\n id: String,\n \"ariaLabel\": String,\n \"ariaLabelledby\": String,\n \"ariaDescribedby\": String,\n \"ariaInvalid\": {\n type: [Boolean, String] as PropType<boolean | \"true\" | \"false\" | \"grammar\" | \"spelling\">,\n default: undefined,\n },\n /** The selected date value (`v-model:value`). */\n value: { type: Object as PropType<DateTime | null>, default: null },\n /** Defines the earliest selectable date (inclusive). */\n min: Object as PropType<DateTime>,\n /** Defines the latest selectable date (inclusive). */\n max: Object as PropType<DateTime>,\n /** Preferred side; collisions can flip it. On phones, left and right prefer bottom so seven 44px day targets fit. @default \"bottom\" */\n side: { type: String as PropType<PopoverSide>, default: \"bottom\" },\n /** The distance in pixels from the trigger. @default 8 */\n sideOffset: { type: Number, default: 8 },\n /** The preferred alignment against the trigger. @default \"center\" */\n align: { type: String as PropType<PopoverAlign>, default: \"center\" },\n /** An offset in pixels from the \"start\" or \"end\" alignment options. @default 0 */\n alignOffset: Number,\n /** Disables the select visually and from interactions. @default false */\n disabled: { type: Boolean, default: false },\n /** Placeholder text for the select. @default \"Select date...\" */\n placeholder: { type: String, default: \"Select date...\" },\n /** Style variant for the select trigger. @default \"outline\" */\n variant: { type: String as PropType<\"soft\" | \"outline\" | \"ghost\">, default: \"outline\" },\n /** Determines if the select trigger should be a fully rounded pill shape. @default true */\n pill: { type: Boolean, default: true },\n /** Size of the control: `3xs` 22px up to `3xl` 48px. @default \"md\" */\n size: { type: String as PropType<ControlSize>, default: \"md\" },\n /** Icon displayed in the far right of the select trigger. @default \"dropdown\" */\n dropdownIconType: String as PropType<DropdownIconType>,\n /** Custom class applied to the select trigger */\n triggerClassName: String,\n /** Display calendar icon at the start of the trigger. @default true */\n triggerShowIcon: { type: Boolean, default: true },\n /** Format of dates displayed in the trigger. @default \"MM/dd/yy\" (\"MM/dd/yy HH:mm\" with `showTime` and no `triggerTimeFormat`) */\n triggerDateFormat: String,\n /**\n * With `showTime`, the format of the time shown after the date in the trigger. The date and the time are\n * then two parts: in a row of a `FieldGroup` on a phone, the two capsules of iOS's compact date and time.\n */\n triggerTimeFormat: String,\n /** Display a clear action that allows the select to be unset. @default false */\n clearable: { type: Boolean, default: false },\n /** Extends select to 100% of available width. @default false */\n block: { type: Boolean, default: false },\n /** Calendar header: arrow navigation (`\"buttons\"`) or month and year dropdowns. @default \"buttons\" */\n captionLayout: { type: String as PropType<\"buttons\" | \"dropdown\">, default: \"buttons\" },\n /** Show time input below the calendar for combined date and time selection. @default false */\n showTime: { type: Boolean, default: false },\n /** Range of selectable years when `captionLayout` is `\"dropdown\"`. @default [currentYear - 120, currentYear] */\n yearRange: Array as unknown as PropType<[number, number]>,\n },\n emits: {\n \"update:value\": (nextValue: DateTime | null) => nextValue === null || DateTime.isDateTime(nextValue),\n \"change\": (nextValue: DateTime | null) => nextValue === null || DateTime.isDateTime(nextValue),\n },\n setup(props, { emit }) {\n const wide = useBreakpoint(\"md\")\n const calendarGutter = useCalendarGutter()\n const unwrap = <T>(value: T): T => (value ? toRaw(value) : value)\n\n const onChange = (nextValue: DateTime | null) => {\n emit(\"update:value\", nextValue)\n emit(\"change\", nextValue)\n }\n\n const store: DateContextValue = {\n get value() {\n return unwrap(props.value) ?? null\n },\n get min() {\n return unwrap(props.min)\n },\n get max() {\n return unwrap(props.max)\n },\n get disabled() {\n return props.disabled\n },\n get captionLayout() {\n return props.captionLayout\n },\n get showTime() {\n return props.showTime\n },\n get yearRange() {\n return props.yearRange\n },\n onChange,\n }\n provide(DateContextKey, store)\n\n const handleClearClick = () => {\n onChange(null)\n }\n\n // The value text needs an id for aria-labelledby, also when `id` is not set\n const generatedId = useId()\n\n return () => {\n const { id, ariaLabelledby, align, placeholder } = props\n const value = store.value\n const { min, max } = store\n\n // min and max are inclusive, so equal bounds allow one date\n if (min && max && isAfter(min, max)) {\n throw new Error(\"DatePicker error: `min` date must not be after the `max` date\")\n }\n\n const valueId = `${id ?? generatedId}-value`\n\n const timeFormat = props.showTime ? props.triggerTimeFormat : undefined\n const triggerDateFormat = props.triggerDateFormat ?? (props.showTime && !timeFormat ? \"MM/dd/yy HH:mm\" : \"MM/dd/yy\")\n // With a time format the date and the time are two parts, apart by a space; a phone row draws each as a capsule\n const text = !value\n ? placeholder\n : timeFormat\n ? h(\"span\", { \"data-date-parts\": \"\" }, [\n h(\"span\", { \"data-date-part\": \"date\" }, value.toFormat(triggerDateFormat)),\n \" \",\n h(\"span\", { \"data-date-part\": \"time\" }, value.toFormat(timeFormat)),\n ])\n : value.toFormat(triggerDateFormat)\n\n return h(Popover, null, {\n default: () => [\n h(PopoverTrigger, null, {\n default: () => [\n h(\n SelectControl,\n {\n \"id\": id,\n \"aria-label\": props.ariaLabel,\n \"aria-labelledby\": ariaLabelledby ? `${ariaLabelledby} ${valueId}` : undefined,\n \"aria-describedby\": props.ariaDescribedby,\n \"aria-invalid\": props.ariaInvalid,\n \"class\": props.triggerClassName,\n \"data-date-picker\": \"\",\n \"selected\": !!value,\n \"variant\": props.variant,\n \"pill\": props.pill,\n \"block\": props.block,\n \"size\": props.size,\n \"disabled\": props.disabled,\n \"interactOnEnter\": true,\n \"StartIcon\": props.triggerShowIcon ? Calendar : undefined,\n \"dropdownIconType\": props.dropdownIconType,\n \"onClearClick\": props.clearable ? handleClearClick : undefined,\n },\n { default: () => [ariaLabelledby ? h(\"span\", { id: valueId }, text) : text] },\n ),\n ],\n }),\n h(\n PopoverContent,\n {\n class: s.Popover,\n minWidth: 230,\n collisionPadding: wide.value ? 20 : calendarGutter.value,\n side: wide.value || props.side === \"top\" ? props.side : \"bottom\",\n sideOffset: props.sideOffset,\n align,\n alignOffset: props.alignOffset ?? (align === \"center\" ? 0 : -5),\n },\n { default: () => [h(DateCalendar)] },\n ),\n ],\n })\n }\n },\n})\n\ntype DatePickerOwnProps = InstanceType<typeof DatePickerComponent>[\"$props\"]\n\nexport type DatePickerProps = DatePickerOwnProps\n\n/**\n * A date (and optionally time) picker: a SelectControl trigger opening a\n * calendar in a popover. Bind the date (a luxon `DateTime`) with\n * `v-model:value`.\n */\nexport const DatePicker = DatePickerComponent\n"]}
1
+ {"version":3,"file":"DatePicker.js","sourceRoot":"","sources":["../../../../src/components/DatePicker/DatePicker.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,0DAA0D,CAAA;AACxE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAChC,OAAO,EAAE,eAAe,EAAE,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAiB,MAAM,KAAK,CAAA;AAE9E,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAA;AACnE,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAC3C,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAuC,MAAM,qBAAqB,CAAA;AAClH,OAAO,EAAE,aAAa,EAAyB,MAAM,2BAA2B,CAAA;AAChF,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAC5C,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAA;AAC9E,OAAO,EAAE,cAAc,E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,IAAI,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ;wBAChE,UAAU,EAAE,KAAK,CAAC,UAAU;wBAC5B,KAAK;wBACL,WAAW,EAAE,KAAK,CAAC,WAAW,IAAI,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;qBAChE,EACD,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,EAAE,CACrC;iBACF;aACF,CAAC,CAAA;QACJ,CAAC,CAAA;IACH,CAAC;CACF,CAAC,CAAA;AAMF;;;;GAIG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,mBAAmB,CAAA","sourcesContent":["import s from \"@plexui/styles/components/DatePicker/Calendar.module.css\"\nimport { DateTime } from \"luxon\"\nimport { defineComponent, h, provide, toRaw, useId, type PropType } from \"vue\"\nimport type { ControlSize } from \"@plexui/styles/types\"\nimport { useBreakpoint } from \"../../composables/useBreakpoints.js\"\nimport { isAfter } from \"../../lib/dateUtils.js\"\nimport { Calendar } from \"../Icon/index.js\"\nimport { Popover, PopoverContent, PopoverTrigger, type PopoverAlign, type PopoverSide } from \"../Popover/index.js\"\nimport { SelectControl, type DropdownIconType } from \"../SelectControl/index.js\"\nimport { DateCalendar } from \"./Calendar.js\"\nimport { useCalendarCollisionPadding } from \"./useCalendarCollisionPadding.js\"\nimport { DateContextKey, type DateContextValue } from \"./context.js\"\n\n// Vue port of packages/ui/src/components/DatePicker/DatePicker.tsx.\n// - `value` + `update:value` (`v-model:value`), plus `change` with the same\n// value (React's `onChange`). Like React the picker is controlled: a\n// parent that does not update `value` keeps the shown date.\n// - `aria-label`, `aria-labelledby`, `aria-describedby` and `aria-invalid`\n// reach the trigger, as in React. Other attributes are not passed on\n// (React's DatePicker takes no other props).\n// - DateTime values are read unwrapped (`toRaw`), so a `ref()` holding one\n// (a deep reactive proxy) works like a plain value.\n\nconst DatePickerComponent = defineComponent({\n name: \"DatePicker\",\n inheritAttrs: false,\n props: {\n /** Allow targeting the input for forms and accessibility. */\n id: String,\n \"ariaLabel\": String,\n \"ariaLabelledby\": String,\n \"ariaDescribedby\": String,\n \"ariaInvalid\": {\n type: [Boolean, String] as PropType<boolean | \"true\" | \"false\" | \"grammar\" | \"spelling\">,\n default: undefined,\n },\n /** The selected date value (`v-model:value`). */\n value: { type: Object as PropType<DateTime | null>, default: null },\n /** Defines the earliest selectable date (inclusive). */\n min: Object as PropType<DateTime>,\n /** Defines the latest selectable date (inclusive). */\n max: Object as PropType<DateTime>,\n /** Preferred side; collisions can flip it. On phones, left and right prefer bottom so seven 44px day targets fit. @default \"bottom\" */\n side: { type: String as PropType<PopoverSide>, default: \"bottom\" },\n /** The distance in pixels from the trigger. @default 8 */\n sideOffset: { type: Number, default: 8 },\n /** The preferred alignment against the trigger. @default \"center\" */\n align: { type: String as PropType<PopoverAlign>, default: \"center\" },\n /** An offset in pixels from the \"start\" or \"end\" alignment options. @default 0 */\n alignOffset: Number,\n /** Disables the select visually and from interactions. @default false */\n disabled: { type: Boolean, default: false },\n /** Placeholder text for the select. @default \"Select date...\" */\n placeholder: { type: String, default: \"Select date...\" },\n /** Style variant for the select trigger. @default \"outline\" */\n variant: { type: String as PropType<\"soft\" | \"outline\" | \"ghost\">, default: \"outline\" },\n /** Determines if the select trigger should be a fully rounded pill shape. @default true */\n pill: { type: Boolean, default: true },\n /** Size of the control: `3xs` 22px up to `3xl` 48px. @default \"md\" */\n size: { type: String as PropType<ControlSize>, default: \"md\" },\n /** Icon displayed in the far right of the select trigger. @default \"dropdown\" */\n dropdownIconType: String as PropType<DropdownIconType>,\n /** Custom class applied to the select trigger */\n triggerClassName: String,\n /** Display calendar icon at the start of the trigger. @default true */\n triggerShowIcon: { type: Boolean, default: true },\n /** Format of dates displayed in the trigger. @default \"MM/dd/yy\" (\"MM/dd/yy HH:mm\" with `showTime` and no `triggerTimeFormat`) */\n triggerDateFormat: String,\n /**\n * With `showTime`, the format of the time shown after the date in the trigger. The date and the time are\n * then two parts: in a row of a `FieldGroup` on a phone, the two capsules of iOS's compact date and time.\n */\n triggerTimeFormat: String,\n /** Display a clear action that allows the select to be unset. @default false */\n clearable: { type: Boolean, default: false },\n /** Extends select to 100% of available width. @default false */\n block: { type: Boolean, default: false },\n /** Calendar header: arrow navigation (`\"buttons\"`) or month and year dropdowns. @default \"buttons\" */\n captionLayout: { type: String as PropType<\"buttons\" | \"dropdown\">, default: \"buttons\" },\n /** Show time input below the calendar for combined date and time selection. @default false */\n showTime: { type: Boolean, default: false },\n /** Range of selectable years when `captionLayout` is `\"dropdown\"`. @default [currentYear - 120, currentYear] */\n yearRange: Array as unknown as PropType<[number, number]>,\n },\n emits: {\n \"update:value\": (nextValue: DateTime | null) => nextValue === null || DateTime.isDateTime(nextValue),\n \"change\": (nextValue: DateTime | null) => nextValue === null || DateTime.isDateTime(nextValue),\n },\n setup(props, { emit }) {\n const wide = useBreakpoint(\"md\")\n const calendarCollisionPadding = useCalendarCollisionPadding()\n const unwrap = <T>(value: T): T => (value ? toRaw(value) : value)\n\n const onChange = (nextValue: DateTime | null) => {\n emit(\"update:value\", nextValue)\n emit(\"change\", nextValue)\n }\n\n const store: DateContextValue = {\n get value() {\n return unwrap(props.value) ?? null\n },\n get min() {\n return unwrap(props.min)\n },\n get max() {\n return unwrap(props.max)\n },\n get disabled() {\n return props.disabled\n },\n get captionLayout() {\n return props.captionLayout\n },\n get showTime() {\n return props.showTime\n },\n get yearRange() {\n return props.yearRange\n },\n onChange,\n }\n provide(DateContextKey, store)\n\n const handleClearClick = () => {\n onChange(null)\n }\n\n // The value text needs an id for aria-labelledby, also when `id` is not set\n const generatedId = useId()\n\n return () => {\n const { id, ariaLabelledby, align, placeholder } = props\n const value = store.value\n const { min, max } = store\n\n // min and max are inclusive, so equal bounds allow one date\n if (min && max && isAfter(min, max)) {\n throw new Error(\"DatePicker error: `min` date must not be after the `max` date\")\n }\n\n const valueId = `${id ?? generatedId}-value`\n\n const timeFormat = props.showTime ? props.triggerTimeFormat : undefined\n const triggerDateFormat = props.triggerDateFormat ?? (props.showTime && !timeFormat ? \"MM/dd/yy HH:mm\" : \"MM/dd/yy\")\n // With a time format the date and the time are two parts, apart by a space; a phone row draws each as a capsule\n const text = !value\n ? placeholder\n : timeFormat\n ? h(\"span\", { \"data-date-parts\": \"\" }, [\n h(\"span\", { \"data-date-part\": \"date\" }, value.toFormat(triggerDateFormat)),\n \" \",\n h(\"span\", { \"data-date-part\": \"time\" }, value.toFormat(timeFormat)),\n ])\n : value.toFormat(triggerDateFormat)\n\n return h(Popover, null, {\n default: () => [\n h(PopoverTrigger, null, {\n default: () => [\n h(\n SelectControl,\n {\n \"id\": id,\n \"aria-label\": props.ariaLabel,\n \"aria-labelledby\": ariaLabelledby ? `${ariaLabelledby} ${valueId}` : undefined,\n \"aria-describedby\": props.ariaDescribedby,\n \"aria-invalid\": props.ariaInvalid,\n \"class\": props.triggerClassName,\n \"data-date-picker\": \"\",\n \"selected\": !!value,\n \"variant\": props.variant,\n \"pill\": props.pill,\n \"block\": props.block,\n \"size\": props.size,\n \"disabled\": props.disabled,\n \"interactOnEnter\": true,\n \"StartIcon\": props.triggerShowIcon ? Calendar : undefined,\n \"dropdownIconType\": props.dropdownIconType,\n \"onClearClick\": props.clearable ? handleClearClick : undefined,\n },\n { default: () => [ariaLabelledby ? h(\"span\", { id: valueId }, text) : text] },\n ),\n ],\n }),\n h(\n PopoverContent,\n {\n class: s.Popover,\n minWidth: 230,\n collisionPadding: wide.value ? 20 : calendarCollisionPadding.value,\n side: wide.value || props.side === \"top\" ? props.side : \"bottom\",\n sideOffset: props.sideOffset,\n align,\n alignOffset: props.alignOffset ?? (align === \"center\" ? 0 : -5),\n },\n { default: () => [h(DateCalendar)] },\n ),\n ],\n })\n }\n },\n})\n\ntype DatePickerOwnProps = InstanceType<typeof DatePickerComponent>[\"$props\"]\n\nexport type DatePickerProps = DatePickerOwnProps\n\n/**\n * A date (and optionally time) picker: a SelectControl trigger opening a\n * calendar in a popover. Bind the date (a luxon `DateTime`) with\n * `v-model:value`.\n */\nexport const DatePicker = DatePickerComponent\n"]}
@@ -0,0 +1,25 @@
1
+ import { computed, onBeforeUnmount, onMounted, ref } from "vue";
2
+ // Mirrors React's useCalendarCollisionPadding. The calendar's collision padding on a phone: seven 44px days leave the
3
+ // rest of the width to two outer and two inner gutters (the CSS uses the same gutter for its width), and the calendar
4
+ // keeps that gutter above and below. Where the 328px calendar fits with room to spare, its sides keep up to 32px from
5
+ // the screen's edges, as iOS 27.2 keeps the compact date picker's calendar 32pt from the edge it would cross (UIKit
6
+ // and Calendar on an iPhone 17).
7
+ export const calendarCollisionPadding = (width) => {
8
+ const gutter = Math.max(3, Math.min(16, (width - 308) / 4));
9
+ const side = Math.max(gutter, Math.min(32, (width - 328) / 2));
10
+ return { top: gutter, right: side, bottom: gutter, left: side };
11
+ };
12
+ // The root's client width leaves out a classic scrollbar, as the popover's own viewport does; a document with no
13
+ // layout (0) falls back to the window's width.
14
+ const viewportWidth = () => document.documentElement.clientWidth || window.innerWidth;
15
+ export const useCalendarCollisionPadding = () => {
16
+ const width = ref();
17
+ const update = () => { width.value = viewportWidth(); };
18
+ onMounted(() => {
19
+ update();
20
+ window.addEventListener("resize", update);
21
+ });
22
+ onBeforeUnmount(() => window.removeEventListener("resize", update));
23
+ return computed(() => width.value === undefined ? { top: 16, right: 16, bottom: 16, left: 16 } : calendarCollisionPadding(width.value));
24
+ };
25
+ //# sourceMappingURL=useCalendarCollisionPadding.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCalendarCollisionPadding.js","sourceRoot":"","sources":["../../../../src/components/DatePicker/useCalendarCollisionPadding.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,SAAS,EAAE,GAAG,EAAoB,MAAM,KAAK,CAAA;AAIjF,sHAAsH;AACt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C,EAAE,GAAG,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,wBAAwB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAA;AACzI,CAAC,CAAA","sourcesContent":["import { computed, onBeforeUnmount, onMounted, ref, type ComputedRef } from \"vue\"\n\nexport type CalendarCollisionPadding = { top: number; right: number; bottom: number; left: number }\n\n// Mirrors React's useCalendarCollisionPadding. The calendar's collision padding on a phone: seven 44px days leave the\n// rest of the width to two outer and two inner gutters (the CSS uses the same gutter for its width), and the calendar\n// keeps that gutter above and below. Where the 328px calendar fits with room to spare, its sides keep up to 32px from\n// the screen's edges, as iOS 27.2 keeps the compact date picker's calendar 32pt from the edge it would cross (UIKit\n// and Calendar on an iPhone 17).\nexport const calendarCollisionPadding = (width: number): CalendarCollisionPadding => {\n const gutter = Math.max(3, Math.min(16, (width - 308) / 4))\n const side = Math.max(gutter, Math.min(32, (width - 328) / 2))\n return { top: gutter, right: side, bottom: gutter, left: side }\n}\n\n// The root's client width leaves out a classic scrollbar, as the popover's own viewport does; a document with no\n// layout (0) falls back to the window's width.\nconst viewportWidth = () => document.documentElement.clientWidth || window.innerWidth\n\nexport const useCalendarCollisionPadding = (): ComputedRef<CalendarCollisionPadding> => {\n const width = ref<number>()\n const update = () => { width.value = viewportWidth() }\n\n onMounted(() => {\n update()\n window.addEventListener(\"resize\", update)\n })\n onBeforeUnmount(() => window.removeEventListener(\"resize\", update))\n\n return computed(() => width.value === undefined ? { top: 16, right: 16, bottom: 16, left: 16 } : calendarCollisionPadding(width.value))\n}\n"]}
@@ -4,7 +4,7 @@ import { computed, defineComponent, h, provide, toRaw } from "vue";
4
4
  import { useBreakpoint } from "../../composables/useBreakpoints.js";
5
5
  import { isAfter } from "../../lib/dateUtils.js";
6
6
  import { Popover, PopoverContent, PopoverTrigger } from "../Popover/index.js";
7
- import { useCalendarGutter } from "../DatePicker/useCalendarGutter.js";
7
+ import { useCalendarCollisionPadding } from "../DatePicker/useCalendarCollisionPadding.js";
8
8
  import { DateRangeCalendar, DateRangeShortcuts } from "./Calendar.js";
9
9
  import { DateRangeContextKey } from "./context.js";
10
10
  import { DateRangeTrigger } from "./Trigger.js";
@@ -72,7 +72,7 @@ const DateRangePickerComponent = defineComponent({
72
72
  },
73
73
  setup(props, { emit }) {
74
74
  const wide = useBreakpoint("md");
75
- const calendarGutter = useCalendarGutter();
75
+ const calendarCollisionPadding = useCalendarCollisionPadding();
76
76
  const unwrap = (value) => (value ? toRaw(value) : value);
77
77
  // A new range only when `value` or one of its endpoints changes, as the
78
78
  // identity React's effects see. The endpoints are read through the array
@@ -157,7 +157,7 @@ const DateRangePickerComponent = defineComponent({
157
157
  h(PopoverContent, {
158
158
  class: s.Popover,
159
159
  minWidth: 230,
160
- collisionPadding: wide.value ? 20 : calendarGutter.value,
160
+ collisionPadding: wide.value ? 20 : calendarCollisionPadding.value,
161
161
  side: wide.value || props.side === "top" ? props.side : "bottom",
162
162
  sideOffset: props.sideOffset,
163
163
  align,
@@ -1 +1 @@
1
- {"version":3,"file":"DateRangePicker.js","sourceRoot":"","sources":["../../../../src/components/DateRangePicker/DateRangePicker.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,+DAA+D,CAAA;AAC7E,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAChC,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,CAAC,EAAE,OAAO,EAAE,KAAK,EAAiB,MAAM,KAAK,CAAA;AAEjF,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAA;AACnE,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA;AAChD,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAuC,MAAM,qBAAqB,CAAA;AAClH,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAA;AAEtE,OAAO,EAAE,iBAAi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GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,EAAE,CAAC;oBACjE,CAAC,CACC,cAAc,EACd;wBACE,KAAK,EAAE,CAAC,CAAC,OAAO;wBAChB,QAAQ,EAAE,GAAG;wBACb,gBAAgB,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,cAAc,CAAC,KAAK;wBACxD,IAAI,EAAE,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ;wBAChE,UAAU,EAAE,KAAK,CAAC,UAAU;wBAC5B,KAAK;wBACL,WAAW,EAAE,KAAK,CAAC,WAAW,IAAI,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;qBAChE,EACD;wBACE,OAAO,EAAE,GAAG,EAAE,CAAC;4BACb,CAAC,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,kBAAkB,EAAE,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC,EAAE,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC;yBAC3G;qBACF,CACF;iBACF;aACF,CAAC,CAAA;QACJ,CAAC,CAAA;IACH,CAAC;CACF,CAAC,CAAA;AAIF;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,wBAAwB,CAAA","sourcesContent":["import s from \"@plexui/styles/components/DateRangePicker/Calendar.module.css\"\nimport { DateTime } from \"luxon\"\nimport { computed, defineComponent, h, provide, toRaw, type PropType } from \"vue\"\nimport type { ControlSize } from \"@plexui/styles/types\"\nimport { useBreakpoint } from \"../../composables/useBreakpoints.js\"\nimport { isAfter } from \"../../lib/dateUtils.js\"\nimport { Popover, PopoverContent, PopoverTrigger, type PopoverAlign, type PopoverSide } from \"../Popover/index.js\"\nimport { useCalendarGutter } from \"../DatePicker/useCalendarGutter.js\"\nimport type { DropdownIconType } from \"../SelectControl/index.js\"\nimport { DateRangeCalendar, DateRangeShortcuts } from \"./Calendar.js\"\nimport { DateRangeContextKey, type DateRangeContextValue } from \"./context.js\"\nimport { DateRangeTrigger } from \"./Trigger.js\"\nimport { type DateRange, type DateRangeShortcut, type WeekStart } from \"./types.js\"\n\n// Vue port of packages/ui/src/components/DateRangePicker/DateRangePicker.tsx.\n// - `value` + `update:value` (`v-model:value`), plus `change`, which also\n// carries the selected shortcut like React's `onChange(range, shortcut)`.\n// Like React the picker is controlled: a parent that does not update\n// `value` keeps the shown range.\n// - DateTime values are read unwrapped (`toRaw`), so a `ref()` holding a\n// range (a deep reactive proxy) works like a plain value.\n\nconst DateRangePickerComponent = defineComponent({\n name: \"DateRangePicker\",\n inheritAttrs: false,\n props: {\n /** The selected date range value (`v-model:value`). */\n value: { type: Array as unknown as PropType<DateRange | null>, default: null },\n /** Defines the earliest selectable date (inclusive). */\n min: Object as PropType<DateTime>,\n /** Defines the latest selectable date (inclusive). */\n max: Object as PropType<DateTime>,\n /** Maximum length of the selectable range in days (inclusive). */\n maxRangeDays: Number,\n /** The day each week starts on, from 0 (Sunday) to 6 (Saturday). @default 0 */\n weekStartsOn: { type: Number as PropType<WeekStart>, default: 0 },\n /** Date range shortcuts for quick selection, shown to the left of the calendar. Not shown below the md breakpoint: on a phone, offer them in a row of their own (see the docs). */\n shortcuts: Array as PropType<DateRangeShortcut[]>,\n /** Preferred side; collisions can flip it. On phones, left and right prefer bottom so seven 44px day targets fit. @default \"bottom\" */\n side: { type: String as PropType<PopoverSide>, default: \"bottom\" },\n /** The distance in pixels from the trigger. @default 8 */\n sideOffset: { type: Number, default: 8 },\n /** The preferred alignment against the trigger. @default \"center\" */\n align: { type: String as PropType<PopoverAlign>, default: \"center\" },\n /** An offset in pixels from the \"start\" or \"end\" alignment options. @default 0 */\n alignOffset: Number,\n /** Disables the select visually and from interactions. @default false */\n disabled: { type: Boolean, default: false },\n /** Placeholder text for the select. @default \"Select date range...\" */\n placeholder: { type: String, default: \"Select date range...\" },\n /** Style variant for the select trigger. @default \"outline\" */\n variant: { type: String as PropType<\"soft\" | \"outline\" | \"ghost\">, default: \"outline\" },\n /** Determines if the select trigger should be a fully rounded pill shape. @default true */\n pill: { type: Boolean, default: true },\n /** Size of the control: `3xs` 22px up to `3xl` 48px. @default \"md\" */\n size: { type: String as PropType<ControlSize>, default: \"md\" },\n /** Icon displayed in the far right of the select trigger. @default \"dropdown\" */\n dropdownIconType: String as PropType<DropdownIconType>,\n /** Custom class applied to the select trigger */\n triggerClassName: String,\n /** Display calendar icon at the start of the trigger. @default true */\n triggerShowIcon: { type: Boolean, default: true },\n /** Shows a stepper in the trigger when the selected range matches the unit ('month'). */\n triggerStepperUnit: String as PropType<\"month\">,\n /** Format of dates displayed in the trigger. @default \"MM/dd/yy\" */\n triggerDateFormat: { type: String, default: \"MM/dd/yy\" },\n /** Display a clear action that allows the select to be unset. @default false */\n clearable: { type: Boolean, default: false },\n /** Extends select to 100% of available width. @default false */\n block: { type: Boolean, default: false },\n },\n emits: {\n \"update:value\": (nextValue: DateRange | null) => nextValue === null || nextValue.every(DateTime.isDateTime),\n \"change\": (nextValue: DateRange | null, shortcut?: DateRangeShortcut) =>\n (nextValue === null || nextValue.every(DateTime.isDateTime)) &&\n (shortcut === undefined || typeof shortcut.getDateRange === \"function\"),\n },\n setup(props, { emit }) {\n const wide = useBreakpoint(\"md\")\n const calendarGutter = useCalendarGutter()\n const unwrap = <T>(value: T): T => (value ? toRaw(value) : value)\n\n // A new range only when `value` or one of its endpoints changes, as the\n // identity React's effects see. The endpoints are read through the array\n // so that `range.value[0] = date` on a `ref()` range is tracked.\n const value = computed<DateRange | null>(() => {\n const range = props.value\n if (!range) return null\n return [toRaw(range[0]), toRaw(range[1])]\n })\n\n const store: DateRangeContextValue = {\n get value() {\n return value.value\n },\n get min() {\n return unwrap(props.min)\n },\n get max() {\n return unwrap(props.max)\n },\n get maxRangeDays() {\n return props.maxRangeDays\n },\n get weekStartsOn() {\n return props.weekStartsOn\n },\n get triggerStepperUnit() {\n return props.triggerStepperUnit\n },\n get triggerClassName() {\n return props.triggerClassName\n },\n get triggerShowIcon() {\n return props.triggerShowIcon\n },\n get triggerDateFormat() {\n return props.triggerDateFormat\n },\n get disabled() {\n return props.disabled\n },\n get variant() {\n return props.variant\n },\n get pill() {\n return props.pill\n },\n get block() {\n return props.block\n },\n get size() {\n return props.size\n },\n get dropdownIconType() {\n return props.dropdownIconType\n },\n get clearable() {\n return props.clearable\n },\n get placeholder() {\n return props.placeholder\n },\n get shortcuts() {\n return props.shortcuts\n },\n onChange: (nextValue, shortcut) => {\n emit(\"update:value\", nextValue)\n emit(\"change\", nextValue, shortcut)\n },\n }\n provide(DateRangeContextKey, store)\n\n return () => {\n const { min, max } = store\n const { align } = props\n\n // min and max are inclusive, so equal bounds allow one date\n if (min && max && isAfter(min, max)) {\n throw new Error(\"DateRangePicker error: `min` date must not be after the `max` date\")\n }\n\n return h(Popover, null, {\n default: () => [\n h(PopoverTrigger, null, { default: () => [h(DateRangeTrigger)] }),\n h(\n PopoverContent,\n {\n class: s.Popover,\n minWidth: 230,\n collisionPadding: wide.value ? 20 : calendarGutter.value,\n side: wide.value || props.side === \"top\" ? props.side : \"bottom\",\n sideOffset: props.sideOffset,\n align,\n alignOffset: props.alignOffset ?? (align === \"center\" ? 0 : -5),\n },\n {\n default: () => [\n h(\"div\", { class: \"flex\" }, [h(DateRangeShortcuts, { shortcuts: props.shortcuts }), h(DateRangeCalendar)]),\n ],\n },\n ),\n ],\n })\n }\n },\n})\n\nexport type DateRangePickerProps = InstanceType<typeof DateRangePickerComponent>[\"$props\"]\n\n/**\n * A date range picker: a SelectControl trigger (or a month stepper) opening\n * two calendars and optional shortcuts in a popover. Bind the range\n * (`[start, end]` luxon `DateTime`s) with `v-model:value`.\n */\nexport const DateRangePicker = DateRangePickerComponent\n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CAAC,CAAC,CAAC,kBAAkB,EAAE,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC,EAAE,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC;yBAC3G;qBACF,CACF;iBACF;aACF,CAAC,CAAA;QACJ,CAAC,CAAA;IACH,CAAC;CACF,CAAC,CAAA;AAIF;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,wBAAwB,CAAA","sourcesContent":["import s from \"@plexui/styles/components/DateRangePicker/Calendar.module.css\"\nimport { DateTime } from \"luxon\"\nimport { computed, defineComponent, h, provide, toRaw, type PropType } from \"vue\"\nimport type { ControlSize } from \"@plexui/styles/types\"\nimport { useBreakpoint } from \"../../composables/useBreakpoints.js\"\nimport { isAfter } from \"../../lib/dateUtils.js\"\nimport { Popover, PopoverContent, PopoverTrigger, type PopoverAlign, type PopoverSide } from \"../Popover/index.js\"\nimport { useCalendarCollisionPadding } from \"../DatePicker/useCalendarCollisionPadding.js\"\nimport type { DropdownIconType } from \"../SelectControl/index.js\"\nimport { DateRangeCalendar, DateRangeShortcuts } from \"./Calendar.js\"\nimport { DateRangeContextKey, type DateRangeContextValue } from \"./context.js\"\nimport { DateRangeTrigger } from \"./Trigger.js\"\nimport { type DateRange, type DateRangeShortcut, type WeekStart } from \"./types.js\"\n\n// Vue port of packages/ui/src/components/DateRangePicker/DateRangePicker.tsx.\n// - `value` + `update:value` (`v-model:value`), plus `change`, which also\n// carries the selected shortcut like React's `onChange(range, shortcut)`.\n// Like React the picker is controlled: a parent that does not update\n// `value` keeps the shown range.\n// - DateTime values are read unwrapped (`toRaw`), so a `ref()` holding a\n// range (a deep reactive proxy) works like a plain value.\n\nconst DateRangePickerComponent = defineComponent({\n name: \"DateRangePicker\",\n inheritAttrs: false,\n props: {\n /** The selected date range value (`v-model:value`). */\n value: { type: Array as unknown as PropType<DateRange | null>, default: null },\n /** Defines the earliest selectable date (inclusive). */\n min: Object as PropType<DateTime>,\n /** Defines the latest selectable date (inclusive). */\n max: Object as PropType<DateTime>,\n /** Maximum length of the selectable range in days (inclusive). */\n maxRangeDays: Number,\n /** The day each week starts on, from 0 (Sunday) to 6 (Saturday). @default 0 */\n weekStartsOn: { type: Number as PropType<WeekStart>, default: 0 },\n /** Date range shortcuts for quick selection, shown to the left of the calendar. Not shown below the md breakpoint: on a phone, offer them in a row of their own (see the docs). */\n shortcuts: Array as PropType<DateRangeShortcut[]>,\n /** Preferred side; collisions can flip it. On phones, left and right prefer bottom so seven 44px day targets fit. @default \"bottom\" */\n side: { type: String as PropType<PopoverSide>, default: \"bottom\" },\n /** The distance in pixels from the trigger. @default 8 */\n sideOffset: { type: Number, default: 8 },\n /** The preferred alignment against the trigger. @default \"center\" */\n align: { type: String as PropType<PopoverAlign>, default: \"center\" },\n /** An offset in pixels from the \"start\" or \"end\" alignment options. @default 0 */\n alignOffset: Number,\n /** Disables the select visually and from interactions. @default false */\n disabled: { type: Boolean, default: false },\n /** Placeholder text for the select. @default \"Select date range...\" */\n placeholder: { type: String, default: \"Select date range...\" },\n /** Style variant for the select trigger. @default \"outline\" */\n variant: { type: String as PropType<\"soft\" | \"outline\" | \"ghost\">, default: \"outline\" },\n /** Determines if the select trigger should be a fully rounded pill shape. @default true */\n pill: { type: Boolean, default: true },\n /** Size of the control: `3xs` 22px up to `3xl` 48px. @default \"md\" */\n size: { type: String as PropType<ControlSize>, default: \"md\" },\n /** Icon displayed in the far right of the select trigger. @default \"dropdown\" */\n dropdownIconType: String as PropType<DropdownIconType>,\n /** Custom class applied to the select trigger */\n triggerClassName: String,\n /** Display calendar icon at the start of the trigger. @default true */\n triggerShowIcon: { type: Boolean, default: true },\n /** Shows a stepper in the trigger when the selected range matches the unit ('month'). */\n triggerStepperUnit: String as PropType<\"month\">,\n /** Format of dates displayed in the trigger. @default \"MM/dd/yy\" */\n triggerDateFormat: { type: String, default: \"MM/dd/yy\" },\n /** Display a clear action that allows the select to be unset. @default false */\n clearable: { type: Boolean, default: false },\n /** Extends select to 100% of available width. @default false */\n block: { type: Boolean, default: false },\n },\n emits: {\n \"update:value\": (nextValue: DateRange | null) => nextValue === null || nextValue.every(DateTime.isDateTime),\n \"change\": (nextValue: DateRange | null, shortcut?: DateRangeShortcut) =>\n (nextValue === null || nextValue.every(DateTime.isDateTime)) &&\n (shortcut === undefined || typeof shortcut.getDateRange === \"function\"),\n },\n setup(props, { emit }) {\n const wide = useBreakpoint(\"md\")\n const calendarCollisionPadding = useCalendarCollisionPadding()\n const unwrap = <T>(value: T): T => (value ? toRaw(value) : value)\n\n // A new range only when `value` or one of its endpoints changes, as the\n // identity React's effects see. The endpoints are read through the array\n // so that `range.value[0] = date` on a `ref()` range is tracked.\n const value = computed<DateRange | null>(() => {\n const range = props.value\n if (!range) return null\n return [toRaw(range[0]), toRaw(range[1])]\n })\n\n const store: DateRangeContextValue = {\n get value() {\n return value.value\n },\n get min() {\n return unwrap(props.min)\n },\n get max() {\n return unwrap(props.max)\n },\n get maxRangeDays() {\n return props.maxRangeDays\n },\n get weekStartsOn() {\n return props.weekStartsOn\n },\n get triggerStepperUnit() {\n return props.triggerStepperUnit\n },\n get triggerClassName() {\n return props.triggerClassName\n },\n get triggerShowIcon() {\n return props.triggerShowIcon\n },\n get triggerDateFormat() {\n return props.triggerDateFormat\n },\n get disabled() {\n return props.disabled\n },\n get variant() {\n return props.variant\n },\n get pill() {\n return props.pill\n },\n get block() {\n return props.block\n },\n get size() {\n return props.size\n },\n get dropdownIconType() {\n return props.dropdownIconType\n },\n get clearable() {\n return props.clearable\n },\n get placeholder() {\n return props.placeholder\n },\n get shortcuts() {\n return props.shortcuts\n },\n onChange: (nextValue, shortcut) => {\n emit(\"update:value\", nextValue)\n emit(\"change\", nextValue, shortcut)\n },\n }\n provide(DateRangeContextKey, store)\n\n return () => {\n const { min, max } = store\n const { align } = props\n\n // min and max are inclusive, so equal bounds allow one date\n if (min && max && isAfter(min, max)) {\n throw new Error(\"DateRangePicker error: `min` date must not be after the `max` date\")\n }\n\n return h(Popover, null, {\n default: () => [\n h(PopoverTrigger, null, { default: () => [h(DateRangeTrigger)] }),\n h(\n PopoverContent,\n {\n class: s.Popover,\n minWidth: 230,\n collisionPadding: wide.value ? 20 : calendarCollisionPadding.value,\n side: wide.value || props.side === \"top\" ? props.side : \"bottom\",\n sideOffset: props.sideOffset,\n align,\n alignOffset: props.alignOffset ?? (align === \"center\" ? 0 : -5),\n },\n {\n default: () => [\n h(\"div\", { class: \"flex\" }, [h(DateRangeShortcuts, { shortcuts: props.shortcuts }), h(DateRangeCalendar)]),\n ],\n },\n ),\n ],\n })\n }\n },\n})\n\nexport type DateRangePickerProps = InstanceType<typeof DateRangePickerComponent>[\"$props\"]\n\n/**\n * A date range picker: a SelectControl trigger (or a month stepper) opening\n * two calendars and optional shortcuts in a popover. Bind the range\n * (`[start, end]` luxon `DateTime`s) with `v-model:value`.\n */\nexport const DateRangePicker = DateRangePickerComponent\n"]}
@@ -154,9 +154,16 @@ export const DialogContent = defineComponent({
154
154
  * @default "center"
155
155
  */
156
156
  placement: { type: String, default: "center" },
157
- /** Placement at 767px and below, such as a bottom sheet on phones. @default placement */
157
+ /**
158
+ * Where a phone sheet stands at 767px and below: `bottom`, or `fullscreen` for the whole screen. `center` is the
159
+ * alert's place: without `mobileVariant` it makes the dialog an alert. @default "fullscreen" for a fullscreen
160
+ * dialog, else "bottom"
161
+ */
158
162
  mobilePlacement: String,
159
- /** Mobile presentation at 767px and below. Sheets default to bottom placement. */
163
+ /**
164
+ * The iOS presentation at 767px and below. A phone has two modal views: the sheet, which iOS gives any view it
165
+ * presents, and the alert, a short question with its answers (UIAlertController). @default "sheet"
166
+ */
160
167
  mobileVariant: String,
161
168
  /** Mobile panel palette; dark mode uses elevated surfaces. @default "plain" */
162
169
  surface: { type: String, default: "plain" },
@@ -170,8 +177,9 @@ export const DialogContent = defineComponent({
170
177
  */
171
178
  onEscapeKeyDown: Function,
172
179
  /**
173
- * Called on a press or a focus outside the dialog before it closes; `event.preventDefault()` keeps it open, such
174
- * as for a press on a developer panel over the page.
180
+ * Called on a press or a focus outside the dialog, and on a phone sheet pulled down to close, before it closes;
181
+ * `event.preventDefault()` keeps it open, such as for a form with unsaved changes (the sheet then returns, as an
182
+ * iOS sheet does under `isModalInPresentation`), or for a press on a developer panel over the page.
175
183
  */
176
184
  onInteractOutside: Function,
177
185
  /** Stack order of the overlay and the dialog. @default 50 */
@@ -194,13 +202,17 @@ export const DialogContent = defineComponent({
194
202
  const scroll = { scrolled: ref(false), contentBelow: ref(false) };
195
203
  provide(DIALOG_SCROLL, scroll);
196
204
  provide(TOOLBAR_HOST, { kind: "dialog", scrolled: scroll.scrolled, contentBelow: scroll.contentBelow });
197
- provide(DIALOG_SHEET, computed(() => (props.mobileVariant === "sheet" ? { showClose: props.showClose } : null)));
205
+ // A phone has no other modal view than the sheet and the alert (owner 12.11: «нет такого в iOS»): a centered
206
+ // dialog is an alert, any other a sheet, at the bottom or over the whole screen.
207
+ const mobileVariant = computed(() => props.mobileVariant ?? (props.mobilePlacement === "center" ? "alert" : "sheet"));
208
+ const phoneWindow = usePhoneLayout();
209
+ provide(DIALOG_SHEET, computed(() => (mobileVariant.value === "sheet" ? { showClose: props.showClose } : null)));
198
210
  // A dialog opened from a header action is not inside that header's bar
199
211
  provide(DIALOG_BAR, computed(() => false));
200
212
  provide(DIALOG_DESCRIPTION_SLOT, { body: shallowRef(null), own: shallowRef(null) });
201
- const mobilePlacement = computed(() => props.mobileVariant === "alert"
213
+ const mobilePlacement = computed(() => mobileVariant.value === "alert"
202
214
  ? "center"
203
- : props.mobilePlacement ?? (props.mobileVariant === "sheet" ? "bottom" : undefined));
215
+ : (props.mobilePlacement ?? props.placement) === "fullscreen" ? "fullscreen" : "bottom");
204
216
  const rootContext = injectDialogRootContext();
205
217
  // Radix's root makes the content id; Reka's trigger does, so a dialog
206
218
  // without one would render `id=""`
@@ -287,6 +299,15 @@ export const DialogContent = defineComponent({
287
299
  if (!event.defaultPrevented)
288
300
  props.onInteractOutside?.(event);
289
301
  };
302
+ // A sheet pulled down asks as a press outside does: an owner that keeps the dialog open on one, such as a form
303
+ // with unsaved changes, keeps it on the other, and the sheet returns.
304
+ const dismissByDrag = (originalEvent) => {
305
+ const request = new CustomEvent("dialog.sheetDrag", { cancelable: true, detail: { originalEvent } });
306
+ if (ownerKeepsOpen(request))
307
+ return false;
308
+ setOpen(false);
309
+ return true;
310
+ };
290
311
  const handleInteractOutside = (event) => {
291
312
  if (!open.value)
292
313
  event.preventDefault();
@@ -337,13 +358,13 @@ export const DialogContent = defineComponent({
337
358
  barChildren.observe(element, { childList: true });
338
359
  }
339
360
  if (element && mobilePlacement.value === "bottom") {
340
- detachDrag = attachSheetDrag(element, () => setOpen(false));
361
+ detachDrag = attachSheetDrag(element, dismissByDrag);
341
362
  }
342
363
  };
343
364
  watch(mobilePlacement, () => {
344
365
  detachDrag?.();
345
366
  detachDrag = panelElement && mobilePlacement.value === "bottom"
346
- ? attachSheetDrag(panelElement, () => setOpen(false))
367
+ ? attachSheetDrag(panelElement, dismissByDrag)
347
368
  : undefined;
348
369
  });
349
370
  onBeforeUnmount(() => { detachDrag?.(); barObserver?.disconnect(); barChildren?.disconnect(); });
@@ -377,7 +398,7 @@ export const DialogContent = defineComponent({
377
398
  "style": [toCssVariables({ "dialog-width": props.width }), layerStyle(), props.rootProps?.style],
378
399
  "data-placement": props.placement === "center" ? undefined : props.placement,
379
400
  "data-mobile-placement": mobilePlacement.value,
380
- "data-mobile-variant": props.mobileVariant,
401
+ "data-mobile-variant": mobileVariant.value,
381
402
  "data-surface": props.surface,
382
403
  "data-state": open.value ? "open" : "closed",
383
404
  "data-pill": props.pill ? "" : undefined,
@@ -420,7 +441,11 @@ export const DialogContent = defineComponent({
420
441
  const layerStyle = () => toCssVariables({ "dialog-z-index": props.zIndex === undefined ? undefined : String(props.zIndex) });
421
442
  return () => {
422
443
  const { placement } = props;
423
- const crossesScreen = placement === "bottom" || placement === "start" || placement === "end" || placement === "fullscreen" || mobilePlacement.value === "bottom" || mobilePlacement.value === "fullscreen";
444
+ // A sheet crosses the screen on a phone, and wherever its owner asked for one; a dialog left to its defaults
445
+ // stays the centred panel on a desktop, with that panel's timing.
446
+ const sheetCrosses = (phoneWindow.value || phoneLayout.value || props.mobileVariant === "sheet" || props.mobilePlacement !== undefined) &&
447
+ (mobilePlacement.value === "bottom" || mobilePlacement.value === "fullscreen");
448
+ const crossesScreen = placement === "bottom" || placement === "start" || placement === "end" || placement === "fullscreen" || sheetCrosses;
424
449
  // Portaled out of any phone layout, a phone dialog carries its own scope, above its transition: the phone rules
425
450
  // of the style sheet start there.
426
451
  const scoped = (group) => phoneLayout.value && !portalTarget.value ? h("div", { class: s.PhoneScope, "data-plex-layout": "phone" }, [group]) : group;
@@ -444,6 +469,7 @@ export const DialogContent = defineComponent({
444
469
  // The header's own parts, fragments opened up, so its actions can stand at the end of the bar
445
470
  const headerParts = (children) => (children ?? []).flatMap((part) => isVNode(part) && part.type === FragmentVNode ? headerParts(part.children) : Array.isArray(part) ? headerParts(part) : [part]);
446
471
  const isHeaderAction = (part) => isVNode(part) && part.type === DialogHeaderAction;
472
+ const isLeadingAction = (part) => isHeaderAction(part) && part.props?.side === "leading";
447
473
  const isDescription = (part) => isVNode(part) && part.type === DialogDescription;
448
474
  // The parts it holds stand outside the header's bar, as React's descriptions stand outside the bar's provider
449
475
  const OutsideBar = defineComponent({
@@ -476,16 +502,18 @@ export const DialogHeader = defineComponent({
476
502
  const slot = descriptionSlot ? descriptionSlot.own.value ?? descriptionSlot.body.value : null;
477
503
  // On a phone the header of a Sheet is its Toolbar (iOS 27 kit Sheets 507-24684, Toolbar - Top - iPhone
478
504
  // 1-54520): Close at the leading edge, the title alone centered on the row of controls, the header actions
479
- // at the trailing edge, all on one 44px row under the grabber.
505
+ // at the trailing edge, all on one 44px row 16px under the top edge.
480
506
  return [
481
507
  h(Toolbar, mergeProps({ "background": props.background, "data-dialog-bar": "" }, attrs), () => [
482
- sheet?.value?.showClose
508
+ // A step's Back takes the leading place, as the back button of a screen pushed inside an iOS sheet
509
+ sheet?.value?.showClose && !parts.some(isLeadingAction)
483
510
  ? h(ToolbarLeading, { class: s.BarClose }, () => [
484
511
  h(DialogClose, null, { default: () => [h(NavigationButton, { "action": "close", "variant": "ghost", "aria-label": "Close dialog" })] }),
485
512
  ])
486
513
  : null,
514
+ ...parts.filter(isLeadingAction),
487
515
  h("div", { class: [t.Heading, s.BarHeading] }, parts.filter((part) => !isHeaderAction(part) && !isDescription(part))),
488
- ...parts.filter(isHeaderAction),
516
+ ...parts.filter((part) => isHeaderAction(part) && !isLeadingAction(part)),
489
517
  ]),
490
518
  // The description reads as the first text of the content, at the top of DialogBody when there is one
491
519
  descriptions.length > 0
@@ -497,9 +525,23 @@ export const DialogHeader = defineComponent({
497
525
  });
498
526
  export const DialogHeaderAction = defineComponent({
499
527
  name: "DialogHeaderAction",
500
- setup(_props, { slots }) {
528
+ props: {
529
+ /**
530
+ * `leading` puts the action before the title, such as the Back of a step in `DialogSteps`: on a phone Sheet it
531
+ * takes the place of Close, as the back button of a screen pushed inside an iOS sheet does.
532
+ * @default "trailing"
533
+ */
534
+ side: { type: String, default: "trailing" },
535
+ },
536
+ setup(props, { slots }) {
501
537
  const bar = inject(DIALOG_BAR, null);
502
- return () => (bar?.value ? h(ToolbarTrailing, null, () => slots.default?.()) : h("div", { class: s.HeaderAction }, slots.default?.()));
538
+ return () => {
539
+ if (bar?.value && props.side === "leading")
540
+ return h(ToolbarLeading, { class: s.BarClose }, () => slots.default?.());
541
+ if (bar?.value)
542
+ return h(ToolbarTrailing, null, () => slots.default?.());
543
+ return h("div", { "class": s.HeaderAction, "data-side": props.side === "leading" ? "leading" : undefined }, slots.default?.());
544
+ };
503
545
  },
504
546
  });
505
547
  /** The scrolling part between DialogHeader and DialogFooter: with it, only the body scrolls. */
@@ -559,7 +601,7 @@ export const DialogDescriptionSlot = defineComponent({
559
601
  export const DialogFooter = defineComponent({
560
602
  name: "DialogFooter",
561
603
  props: {
562
- /** Override the mobile action layout. Alerts default to inline; sheets to stacked. */
604
+ /** Override the mobile action layout. Two alert actions default to inline, three or more and sheets to stacked. */
563
605
  mobileLayout: String,
564
606
  /** How the bar meets the content scrolled under it in a phone Sheet. @default "soft" */
565
607
  background: { type: String, default: "soft" },
@@ -567,13 +609,22 @@ export const DialogFooter = defineComponent({
567
609
  setup(props, { slots }) {
568
610
  const boundary = useFloatingBoundaryRegistration();
569
611
  const scroll = inject(DIALOG_SCROLL, null);
570
- return () => h("div", {
571
- "ref": boundary?.setFooter,
572
- "class": s.Footer,
573
- "data-mobile-layout": props.mobileLayout,
574
- "data-background": props.background,
575
- "data-content-below": scroll?.contentBelow.value ? "" : undefined,
576
- }, slots.default?.());
612
+ const sheet = inject(DIALOG_SHEET, null);
613
+ const phone = usePhoneLayout();
614
+ return () => {
615
+ const parts = slots.default?.();
616
+ // A phone Sheet stacks its main action on top, as an iOS setup sheet does. A footer is written with it last,
617
+ // where a desktop row ends, so the order is turned in the page itself: focus and a screen reader meet the
618
+ // actions in the order they are seen.
619
+ const turned = sheet?.value && phone.value && props.mobileLayout !== "inline";
620
+ return h("div", {
621
+ "ref": boundary?.setFooter,
622
+ "class": s.Footer,
623
+ "data-mobile-layout": props.mobileLayout,
624
+ "data-background": props.background,
625
+ "data-content-below": scroll?.contentBelow.value ? "" : undefined,
626
+ }, turned ? headerParts(parts).reverse() : parts);
627
+ };
577
628
  },
578
629
  });
579
630
  /** Counts a mounted part, as Radix's title and description counts do. */