@plexui/ui 0.41.0 → 0.43.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 (79) hide show
  1. package/dist/es/components/Alert/Alert.js +12 -2
  2. package/dist/es/components/Alert/Alert.js.map +1 -1
  3. package/dist/es/components/ColorPicker/ColorPicker.js +12 -10
  4. package/dist/es/components/ColorPicker/ColorPicker.js.map +1 -1
  5. package/dist/es/components/ColorPicker/ColorWell.js +1 -1
  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/DataTable/columnHelpers.js +85 -4
  14. package/dist/es/components/DataTable/columnHelpers.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 +1 -1
  22. package/dist/es/components/Dialog/Dialog.js.map +1 -1
  23. package/dist/es/components/Input/Input.js +1 -1
  24. package/dist/es/components/Input/Input.js.map +1 -1
  25. package/dist/es/components/Menu/Menu.js +15 -2
  26. package/dist/es/components/Menu/Menu.js.map +1 -1
  27. package/dist/es/components/PhoneLayout/PhoneLayout.js +6 -1
  28. package/dist/es/components/PhoneLayout/PhoneLayout.js.map +1 -1
  29. package/dist/es/components/Popover/Popover.js.map +1 -1
  30. package/dist/es/components/ProgressSteps/ProgressSteps.js +1 -1
  31. package/dist/es/components/ProgressSteps/ProgressSteps.js.map +1 -1
  32. package/dist/es/components/ProgressSteps/index.js.map +1 -1
  33. package/dist/es/components/Select/Select.js +155 -25
  34. package/dist/es/components/Select/Select.js.map +1 -1
  35. package/dist/es/components/SelectControl/SelectControl.js +1 -1
  36. package/dist/es/components/SelectControl/SelectControl.js.map +1 -1
  37. package/dist/es/components/Slider/Slider.js +19 -12
  38. package/dist/es/components/Slider/Slider.js.map +1 -1
  39. package/dist/es/components/Sortable/Sortable.js +1 -1
  40. package/dist/es/components/Sortable/Sortable.js.map +1 -1
  41. package/dist/es/components/StatCard/index.js +5 -1
  42. package/dist/es/components/StatCard/index.js.map +1 -1
  43. package/dist/es/components/StatsCard/StatsCard.js +48 -0
  44. package/dist/es/components/StatsCard/StatsCard.js.map +1 -0
  45. package/dist/es/components/StatsCard/index.js +2 -0
  46. package/dist/es/components/StatsCard/index.js.map +1 -0
  47. package/dist/es/components/SwipeActions/SwipeActions.js +30 -8
  48. package/dist/es/components/SwipeActions/SwipeActions.js.map +1 -1
  49. package/dist/es/components/TabBar/TabBar.js +11 -4
  50. package/dist/es/components/TabBar/TabBar.js.map +1 -1
  51. package/dist/es/components/Tabs/Tabs.js +200 -7
  52. package/dist/es/components/Tabs/Tabs.js.map +1 -1
  53. package/dist/es/components/Toolbar/Toolbar.js.map +1 -1
  54. package/dist/es/lib/menuTriggerCover.js +40 -3
  55. package/dist/es/lib/menuTriggerCover.js.map +1 -1
  56. package/dist/types/components/ColorPicker/ColorPicker.d.ts +3 -2
  57. package/dist/types/components/ColorPicker/shared.d.ts +5 -4
  58. package/dist/types/components/ContextMenu/shared.d.ts +28 -6
  59. package/dist/types/components/DatePicker/useCalendarCollisionPadding.d.ts +8 -0
  60. package/dist/types/components/Dialog/Dialog.d.ts +1 -1
  61. package/dist/types/components/PhoneLayout/PhoneLayout.d.ts +5 -0
  62. package/dist/types/components/Popover/Popover.d.ts +2 -2
  63. package/dist/types/components/ProgressSteps/ProgressSteps.d.ts +11 -4
  64. package/dist/types/components/ProgressSteps/index.d.ts +1 -1
  65. package/dist/types/components/Select/Select.d.ts +11 -3
  66. package/dist/types/components/StatCard/index.d.ts +5 -1
  67. package/dist/types/components/{StatCard/StatCard.d.ts → StatsCard/StatsCard.d.ts} +7 -7
  68. package/dist/types/components/StatsCard/index.d.ts +1 -0
  69. package/dist/types/components/SwipeActions/SwipeActions.d.ts +1 -1
  70. package/dist/types/components/TabBar/TabBar.d.ts +12 -2
  71. package/dist/types/components/Tabs/Tabs.d.ts +12 -0
  72. package/dist/types/components/Toolbar/Toolbar.d.ts +1 -1
  73. package/dist/types/lib/menuTriggerCover.d.ts +16 -2
  74. package/package.json +2 -2
  75. package/dist/es/components/DatePicker/useCalendarGutter.js +0 -8
  76. package/dist/es/components/DatePicker/useCalendarGutter.js.map +0 -1
  77. package/dist/es/components/StatCard/StatCard.js +0 -39
  78. package/dist/es/components/StatCard/StatCard.js.map +0 -1
  79. package/dist/types/components/DatePicker/useCalendarGutter.d.ts +0 -1
@@ -10,7 +10,7 @@ import { Calendar } from "../Icon/index.js";
10
10
  import { Popover } from "../Popover/index.js";
11
11
  import { SelectControl } from "../SelectControl/index.js";
12
12
  import { DateCalendar } from "./Calendar.js";
13
- import { useCalendarGutter } from "./useCalendarGutter.js";
13
+ import { useCalendarCollisionPadding } from "./useCalendarCollisionPadding.js";
14
14
  import { DateContext } from "./context.js";
15
15
  export const DatePicker = (props) => {
16
16
  const { id, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid, value, onChange, min, max, side = "bottom", sideOffset = 8, align = "center", alignOffset, variant = "outline", size = "md", clearable = false, disabled = false, dropdownIconType, placeholder = "Select date...", pill = true, block = false, triggerClassName, triggerShowIcon = true, captionLayout = "buttons", showTime = false, yearRange, triggerTimeFormat, triggerDateFormat = showTime && !triggerTimeFormat ? "MM/dd/yy HH:mm" : "MM/dd/yy", } = props;
@@ -21,7 +21,7 @@ export const DatePicker = (props) => {
21
21
  // The value text needs an id for aria-labelledby, also when `id` is not set
22
22
  const generatedId = useId();
23
23
  const wide = useBreakpoint("md");
24
- const calendarGutter = useCalendarGutter();
24
+ const calendarCollisionPadding = useCalendarCollisionPadding();
25
25
  const valueId = `${id ?? generatedId}-value`;
26
26
  // Create stable, mutable references to avoid memoization requirements from consumers
27
27
  const onChangeRef = useLatestValue(onChange);
@@ -69,6 +69,6 @@ export const DatePicker = (props) => {
69
69
  };
70
70
  // With a time format the date and the time are two parts, apart by a space; a phone row draws each as a capsule
71
71
  const triggerValue = !value ? placeholder : showTime && triggerTimeFormat ? (_jsxs("span", { "data-date-parts": "", children: [_jsx("span", { "data-date-part": "date", children: value.toFormat(triggerDateFormat) }), " ", _jsx("span", { "data-date-part": "time", children: value.toFormat(triggerTimeFormat) })] })) : value.toFormat(triggerDateFormat);
72
- return (_jsx(DateContext, { value: store, children: _jsxs(Popover, { children: [_jsx(Popover.Trigger, { children: _jsx(SelectControl, { id: id, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy ? `${ariaLabelledBy} ${valueId}` : undefined, "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid, className: triggerClassName, "data-date-picker": "", selected: !!value, variant: variant, pill: pill, block: block, size: size, disabled: disabled, interactOnEnter: true, StartIcon: triggerShowIcon ? Calendar : undefined, dropdownIconType: dropdownIconType, onClearClick: clearable ? handleClearClick : undefined, children: ariaLabelledBy ? _jsx("span", { id: valueId, children: triggerValue }) : triggerValue }) }), _jsx(Popover.Content, { className: s.Popover, minWidth: 230, collisionPadding: wide ? 20 : calendarGutter, side: wide || side === "top" ? side : "bottom", sideOffset: sideOffset, align: align, alignOffset: alignOffset ?? (align === "center" ? 0 : -5), children: _jsx(DateCalendar, {}) })] }) }));
72
+ return (_jsx(DateContext, { value: store, children: _jsxs(Popover, { children: [_jsx(Popover.Trigger, { children: _jsx(SelectControl, { id: id, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy ? `${ariaLabelledBy} ${valueId}` : undefined, "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid, className: triggerClassName, "data-date-picker": "", selected: !!value, variant: variant, pill: pill, block: block, size: size, disabled: disabled, interactOnEnter: true, StartIcon: triggerShowIcon ? Calendar : undefined, dropdownIconType: dropdownIconType, onClearClick: clearable ? handleClearClick : undefined, children: ariaLabelledBy ? _jsx("span", { id: valueId, children: triggerValue }) : triggerValue }) }), _jsx(Popover.Content, { className: s.Popover, minWidth: 230, collisionPadding: wide ? 20 : calendarCollisionPadding, side: wide || side === "top" ? side : "bottom", sideOffset: sideOffset, align: align, alignOffset: alignOffset ?? (align === "center" ? 0 : -5), children: _jsx(DateCalendar, {}) })] }) }));
73
73
  };
74
74
  //# sourceMappingURL=DatePicker.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DatePicker.js","sourceRoot":"","sources":["../../../../src/components/DatePicker/DatePicker.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,CAAC,MAAM,0DAA0D,CAAA;AACxE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAChC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAClC,OAAO,EAAE,OAAO,EAA4B,MAAM,YAAY,CAAA;AAC9D,OAAO,EAAE,aAAa,EAA2B,MAAM,kBAAkB,CAAA;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AACvD,OAAO,EAAE,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S,sBAC1D,eAAe,kBACnB,WAAW,EACzB,SAAS,EAAE,gBAAgB,sBACV,EAAE,EACnB,QAAQ,EAAE,CAAC,CAAC,KAAK,EACjB,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,QAAQ,EAClB,eAAe,QACf,SAAS,EAAE,eAAe,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,EACjD,gBAAgB,EAAE,gBAAgB,EAClC,YAAY,EAAE,SAAS,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,SAAS,YAErD,cAAc,CAAC,CAAC,CAAC,eAAM,EAAE,EAAE,OAAO,YAAG,YAAY,GAAQ,CAAC,CAAC,CAAC,YAAY,GAC3D,GACA,EAClB,KAAC,OAAO,CAAC,OAAO,IACd,SAAS,EAAE,CAAC,CAAC,OAAO,EACpB,QAAQ,EAAE,GAAG,EACb,gBAAgB,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,cAAc,EAC5C,IAAI,EAAE,IAAI,IAAI,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,EAC9C,UAAU,EAAE,UAAU,EACtB,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,WAAW,IAAI,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,YAEzD,KAAC,YAAY,KAAG,GACA,IACV,GACE,CACf,CAAA;AACH,CAAC,CAAA","sourcesContent":["\"use client\"\n\nimport s from \"@plexui/styles/components/DatePicker/Calendar.module.css\"\nimport { DateTime } from \"luxon\"\nimport { useId, useMemo } from \"react\"\nimport { useBreakpoint } from \"../../hooks/useBreakpoints\"\nimport { useLatestValue } from \"../../hooks/useLatestValue\"\nimport { isAfter } from \"../../lib/dateUtils\"\nimport { Calendar } from \"../Icon\"\nimport { Popover, type PopoverContentProps } from \"../Popover\"\nimport { SelectControl, type SelectControlProps } from \"../SelectControl\"\nimport { DateCalendar } from \"./Calendar\"\nimport { useCalendarGutter } from \"./useCalendarGutter\"\nimport { DateContext, type DateContextValue } from \"./context\"\n\nexport type DatePickerProps = Pick<SelectControlProps, \"aria-label\" | \"aria-labelledby\" | \"aria-describedby\" | \"aria-invalid\"> & {\n /**\n * Allow targeting the input for forms and accessibility.\n */\n id?: string\n /**\n * The selected date value.\n */\n value: DateTime | null\n /**\n * Handler that is triggered when the date changes.\n */\n onChange: (nextValue: DateTime | null) => void\n /**\n * Defines the earliest selectable date (inclusive).\n */\n min?: DateTime\n /**\n * Defines the latest selectable date (inclusive).\n */\n max?: DateTime\n /**\n * The preferred side of the trigger to render against when open. Will be reversed when collisions occur.\n * On phones, left and right prefer bottom so all seven 44px day targets fit.\n * @default bottom\n */\n side?: PopoverContentProps[\"side\"]\n /**\n * The distance in pixels from the trigger.\n * @default 8\n */\n sideOffset?: PopoverContentProps[\"sideOffset\"]\n /**\n * The preferred alignment against the trigger. May change when collisions occur.\n * @default center\n */\n align?: PopoverContentProps[\"align\"]\n /**\n * An offset in pixels from the \"start\" or \"end\" alignment options.\n * @default 0\n */\n alignOffset?: PopoverContentProps[\"alignOffset\"]\n\n /**\n * Disables the select visually and from interactions\n * @default false\n */\n disabled?: boolean\n /**\n * Placeholder text for the select\n * @default Select date...\n */\n placeholder?: string\n /**\n * Style variant for the select trigger\n * @default outline\n */\n variant?: SelectControlProps[\"variant\"]\n /**\n * Determines if the select trigger should be a fully rounded pill shape\n * @default true\n */\n pill?: boolean\n /**\n * Determines size of the size and spacing of the control.\n *\n * | 3xs | 2xs | xs | sm | md | lg | xl | 2xl | 3xl |\n * | ------- | ------- | ------- | ------- | ------- | ------- | ------- | ------- | ------- |\n * | `22px` | `24px` | `26px` | `28px` | `32px` | `36px` | `40px` | `44px` | `48px` |\n * @default md\n */\n size?: SelectControlProps[\"size\"]\n /**\n * Icon displayed in the far right of the select trigger\n * @default dropdown\n */\n dropdownIconType?: SelectControlProps[\"dropdownIconType\"]\n /**\n * Custom class applied to the select trigger\n */\n triggerClassName?: string\n /**\n * Display calendar icon at the start of the trigger\n * @default true\n */\n triggerShowIcon?: boolean\n /**\n * Format of dates displayed in the trigger\n * @default \"MM/dd/yy\", or \"MM/dd/yy HH:mm\" with showTime and no triggerTimeFormat\n */\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 /**\n * Display a clear action that allows the select to be unset.\n * @default false\n */\n clearable?: boolean\n /**\n * Extends select to 100% of available width.\n * @default false\n */\n block?: boolean\n /**\n * Controls how the calendar header is rendered.\n * - `\"buttons\"` — Arrow navigation between months (default)\n * - `\"dropdown\"` — Month and year dropdown selects (ideal for date of birth)\n * @default buttons\n */\n captionLayout?: \"buttons\" | \"dropdown\"\n /**\n * Show time input below the calendar for combined date and time selection.\n * @default false\n */\n showTime?: boolean\n /**\n * Range of selectable years when `captionLayout` is `\"dropdown\"`.\n * @default [currentYear - 120, currentYear]\n */\n yearRange?: [number, number]\n}\n\nexport const DatePicker = (props: DatePickerProps) => {\n const {\n id,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n \"aria-invalid\": ariaInvalid,\n value,\n onChange,\n min,\n max,\n side = \"bottom\",\n sideOffset = 8,\n align = \"center\",\n alignOffset,\n variant = \"outline\",\n size = \"md\",\n clearable = false,\n disabled = false,\n dropdownIconType,\n placeholder = \"Select date...\",\n pill = true,\n block = false,\n triggerClassName,\n triggerShowIcon = true,\n captionLayout = \"buttons\",\n showTime = false,\n yearRange,\n triggerTimeFormat,\n triggerDateFormat = showTime && !triggerTimeFormat ? \"MM/dd/yy HH:mm\" : \"MM/dd/yy\",\n } = 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(\"DatePicker error: `min` date must not be after the `max` date\")\n }\n\n // The value text needs an id for aria-labelledby, also when `id` is not set\n const generatedId = useId()\n const wide = useBreakpoint(\"md\")\n const calendarGutter = useCalendarGutter()\n const valueId = `${id ?? generatedId}-value`\n\n // Create stable, mutable references to avoid memoization requirements from consumers\n const onChangeRef = useLatestValue(onChange)\n\n const store = useMemo<DateContextValue>(\n () => ({\n value,\n min,\n max,\n variant,\n size,\n dropdownIconType,\n clearable,\n disabled,\n placeholder,\n block,\n pill,\n triggerClassName,\n triggerShowIcon,\n triggerDateFormat,\n captionLayout,\n showTime,\n yearRange,\n onChangeRef,\n }),\n [\n value,\n min,\n max,\n variant,\n size,\n dropdownIconType,\n clearable,\n disabled,\n placeholder,\n block,\n pill,\n triggerClassName,\n triggerShowIcon,\n triggerDateFormat,\n captionLayout,\n showTime,\n yearRange,\n onChangeRef,\n ],\n )\n\n const handleClearClick = () => {\n onChangeRef.current(null)\n }\n\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 triggerValue = !value ? placeholder : showTime && triggerTimeFormat ? (\n <span data-date-parts=\"\">\n <span data-date-part=\"date\">{value.toFormat(triggerDateFormat)}</span>{\" \"}\n <span data-date-part=\"time\">{value.toFormat(triggerTimeFormat)}</span>\n </span>\n ) : value.toFormat(triggerDateFormat)\n\n return (\n <DateContext value={store}>\n <Popover>\n <Popover.Trigger>\n <SelectControl\n id={id}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy ? `${ariaLabelledBy} ${valueId}` : undefined}\n aria-describedby={ariaDescribedBy}\n aria-invalid={ariaInvalid}\n className={triggerClassName}\n data-date-picker=\"\"\n selected={!!value}\n variant={variant}\n pill={pill}\n block={block}\n size={size}\n disabled={disabled}\n interactOnEnter\n StartIcon={triggerShowIcon ? Calendar : undefined}\n dropdownIconType={dropdownIconType}\n onClearClick={clearable ? handleClearClick : undefined}\n >\n {ariaLabelledBy ? <span id={valueId}>{triggerValue}</span> : triggerValue}\n </SelectControl>\n </Popover.Trigger>\n <Popover.Content\n className={s.Popover}\n minWidth={230}\n collisionPadding={wide ? 20 : calendarGutter}\n side={wide || side === \"top\" ? side : \"bottom\"}\n sideOffset={sideOffset}\n align={align}\n alignOffset={alignOffset ?? (align === \"center\" ? 0 : -5)}\n >\n <DateCalendar />\n </Popover.Content>\n </Popover>\n </DateContext>\n )\n}\n"]}
1
+ {"version":3,"file":"DatePicker.js","sourceRoot":"","sources":["../../../../src/components/DatePicker/DatePicker.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,CAAC,MAAM,0DAA0D,CAAA;AACxE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAChC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAClC,OAAO,EAAE,OAAO,EAA4B,MAAM,YAAY,CAAA;AAC9D,OAAO,EAAE,aAAa,EAA2B,MAAM,kBAAkB,CAAA;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AACzC,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAA;AAC3E,OAAO,EAAE,WAAW,EAAyB,MAAM,WAAW,CAAA;AA+H9D,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,KAAsB,EAAE,EAAE;IACnD,MAAM,EACJ,EAAE,EACF,YAAY,EAAE,SAAS,EACvB,iBAAiB,EAAE,cAAc,EACjC,kBAAkB,EAAE,eAAe,EACnC,cAAc,EAAE,WAAW,EAC3B,KAAK,EACL,QAAQ,EACR,GAAG,EACH,GAAG,EAC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,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,EACjD,gBAAgB,EAAE,gBAAgB,EAClC,YAAY,EAAE,SAAS,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,SAAS,YAErD,cAAc,CAAC,CAAC,CAAC,eAAM,EAAE,EAAE,OAAO,YAAG,YAAY,GAAQ,CAAC,CAAC,CAAC,YAAY,GAC3D,GACA,EAClB,KAAC,OAAO,CAAC,OAAO,IACd,SAAS,EAAE,CAAC,CAAC,OAAO,EACpB,QAAQ,EAAE,GAAG,EACb,gBAAgB,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,wBAAwB,EACtD,IAAI,EAAE,IAAI,IAAI,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,EAC9C,UAAU,EAAE,UAAU,EACtB,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,WAAW,IAAI,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,YAEzD,KAAC,YAAY,KAAG,GACA,IACV,GACE,CACf,CAAA;AACH,CAAC,CAAA","sourcesContent":["\"use client\"\n\nimport s from \"@plexui/styles/components/DatePicker/Calendar.module.css\"\nimport { DateTime } from \"luxon\"\nimport { useId, useMemo } from \"react\"\nimport { useBreakpoint } from \"../../hooks/useBreakpoints\"\nimport { useLatestValue } from \"../../hooks/useLatestValue\"\nimport { isAfter } from \"../../lib/dateUtils\"\nimport { Calendar } from \"../Icon\"\nimport { Popover, type PopoverContentProps } from \"../Popover\"\nimport { SelectControl, type SelectControlProps } from \"../SelectControl\"\nimport { DateCalendar } from \"./Calendar\"\nimport { useCalendarCollisionPadding } from \"./useCalendarCollisionPadding\"\nimport { DateContext, type DateContextValue } from \"./context\"\n\nexport type DatePickerProps = Pick<SelectControlProps, \"aria-label\" | \"aria-labelledby\" | \"aria-describedby\" | \"aria-invalid\"> & {\n /**\n * Allow targeting the input for forms and accessibility.\n */\n id?: string\n /**\n * The selected date value.\n */\n value: DateTime | null\n /**\n * Handler that is triggered when the date changes.\n */\n onChange: (nextValue: DateTime | null) => void\n /**\n * Defines the earliest selectable date (inclusive).\n */\n min?: DateTime\n /**\n * Defines the latest selectable date (inclusive).\n */\n max?: DateTime\n /**\n * The preferred side of the trigger to render against when open. Will be reversed when collisions occur.\n * On phones, left and right prefer bottom so all seven 44px day targets fit.\n * @default bottom\n */\n side?: PopoverContentProps[\"side\"]\n /**\n * The distance in pixels from the trigger.\n * @default 8\n */\n sideOffset?: PopoverContentProps[\"sideOffset\"]\n /**\n * The preferred alignment against the trigger. May change when collisions occur.\n * @default center\n */\n align?: PopoverContentProps[\"align\"]\n /**\n * An offset in pixels from the \"start\" or \"end\" alignment options.\n * @default 0\n */\n alignOffset?: PopoverContentProps[\"alignOffset\"]\n\n /**\n * Disables the select visually and from interactions\n * @default false\n */\n disabled?: boolean\n /**\n * Placeholder text for the select\n * @default Select date...\n */\n placeholder?: string\n /**\n * Style variant for the select trigger\n * @default outline\n */\n variant?: SelectControlProps[\"variant\"]\n /**\n * Determines if the select trigger should be a fully rounded pill shape\n * @default true\n */\n pill?: boolean\n /**\n * Determines size of the size and spacing of the control.\n *\n * | 3xs | 2xs | xs | sm | md | lg | xl | 2xl | 3xl |\n * | ------- | ------- | ------- | ------- | ------- | ------- | ------- | ------- | ------- |\n * | `22px` | `24px` | `26px` | `28px` | `32px` | `36px` | `40px` | `44px` | `48px` |\n * @default md\n */\n size?: SelectControlProps[\"size\"]\n /**\n * Icon displayed in the far right of the select trigger\n * @default dropdown\n */\n dropdownIconType?: SelectControlProps[\"dropdownIconType\"]\n /**\n * Custom class applied to the select trigger\n */\n triggerClassName?: string\n /**\n * Display calendar icon at the start of the trigger\n * @default true\n */\n triggerShowIcon?: boolean\n /**\n * Format of dates displayed in the trigger\n * @default \"MM/dd/yy\", or \"MM/dd/yy HH:mm\" with showTime and no triggerTimeFormat\n */\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 /**\n * Display a clear action that allows the select to be unset.\n * @default false\n */\n clearable?: boolean\n /**\n * Extends select to 100% of available width.\n * @default false\n */\n block?: boolean\n /**\n * Controls how the calendar header is rendered.\n * - `\"buttons\"` — Arrow navigation between months (default)\n * - `\"dropdown\"` — Month and year dropdown selects (ideal for date of birth)\n * @default buttons\n */\n captionLayout?: \"buttons\" | \"dropdown\"\n /**\n * Show time input below the calendar for combined date and time selection.\n * @default false\n */\n showTime?: boolean\n /**\n * Range of selectable years when `captionLayout` is `\"dropdown\"`.\n * @default [currentYear - 120, currentYear]\n */\n yearRange?: [number, number]\n}\n\nexport const DatePicker = (props: DatePickerProps) => {\n const {\n id,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n \"aria-invalid\": ariaInvalid,\n value,\n onChange,\n min,\n max,\n side = \"bottom\",\n sideOffset = 8,\n align = \"center\",\n alignOffset,\n variant = \"outline\",\n size = \"md\",\n clearable = false,\n disabled = false,\n dropdownIconType,\n placeholder = \"Select date...\",\n pill = true,\n block = false,\n triggerClassName,\n triggerShowIcon = true,\n captionLayout = \"buttons\",\n showTime = false,\n yearRange,\n triggerTimeFormat,\n triggerDateFormat = showTime && !triggerTimeFormat ? \"MM/dd/yy HH:mm\" : \"MM/dd/yy\",\n } = 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(\"DatePicker error: `min` date must not be after the `max` date\")\n }\n\n // The value text needs an id for aria-labelledby, also when `id` is not set\n const generatedId = useId()\n const wide = useBreakpoint(\"md\")\n const calendarCollisionPadding = useCalendarCollisionPadding()\n const valueId = `${id ?? generatedId}-value`\n\n // Create stable, mutable references to avoid memoization requirements from consumers\n const onChangeRef = useLatestValue(onChange)\n\n const store = useMemo<DateContextValue>(\n () => ({\n value,\n min,\n max,\n variant,\n size,\n dropdownIconType,\n clearable,\n disabled,\n placeholder,\n block,\n pill,\n triggerClassName,\n triggerShowIcon,\n triggerDateFormat,\n captionLayout,\n showTime,\n yearRange,\n onChangeRef,\n }),\n [\n value,\n min,\n max,\n variant,\n size,\n dropdownIconType,\n clearable,\n disabled,\n placeholder,\n block,\n pill,\n triggerClassName,\n triggerShowIcon,\n triggerDateFormat,\n captionLayout,\n showTime,\n yearRange,\n onChangeRef,\n ],\n )\n\n const handleClearClick = () => {\n onChangeRef.current(null)\n }\n\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 triggerValue = !value ? placeholder : showTime && triggerTimeFormat ? (\n <span data-date-parts=\"\">\n <span data-date-part=\"date\">{value.toFormat(triggerDateFormat)}</span>{\" \"}\n <span data-date-part=\"time\">{value.toFormat(triggerTimeFormat)}</span>\n </span>\n ) : value.toFormat(triggerDateFormat)\n\n return (\n <DateContext value={store}>\n <Popover>\n <Popover.Trigger>\n <SelectControl\n id={id}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy ? `${ariaLabelledBy} ${valueId}` : undefined}\n aria-describedby={ariaDescribedBy}\n aria-invalid={ariaInvalid}\n className={triggerClassName}\n data-date-picker=\"\"\n selected={!!value}\n variant={variant}\n pill={pill}\n block={block}\n size={size}\n disabled={disabled}\n interactOnEnter\n StartIcon={triggerShowIcon ? Calendar : undefined}\n dropdownIconType={dropdownIconType}\n onClearClick={clearable ? handleClearClick : undefined}\n >\n {ariaLabelledBy ? <span id={valueId}>{triggerValue}</span> : triggerValue}\n </SelectControl>\n </Popover.Trigger>\n <Popover.Content\n className={s.Popover}\n minWidth={230}\n collisionPadding={wide ? 20 : calendarCollisionPadding}\n side={wide || side === \"top\" ? side : \"bottom\"}\n sideOffset={sideOffset}\n align={align}\n alignOffset={alignOffset ?? (align === \"center\" ? 0 : -5)}\n >\n <DateCalendar />\n </Popover.Content>\n </Popover>\n </DateContext>\n )\n}\n"]}
@@ -0,0 +1,25 @@
1
+ import { useEffect, useMemo, useState } from "react";
2
+ // The calendar's collision padding on a phone. Seven 44px days leave the rest of the width to two outer and two
3
+ // inner gutters (Calendar.module.css uses the same gutter for its width), and the calendar keeps that gutter above
4
+ // and below. Where the 328px calendar fits with room to spare, its sides keep up to 32px from the screen's edges, as
5
+ // iOS 27.2 keeps the compact date picker's calendar 32pt from the edge it would cross (UIKit and Calendar on an
6
+ // 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, setWidth] = useState();
17
+ useEffect(() => {
18
+ const update = () => setWidth(viewportWidth());
19
+ update();
20
+ window.addEventListener("resize", update);
21
+ return () => window.removeEventListener("resize", update);
22
+ }, []);
23
+ return useMemo(() => (width === undefined ? { top: 16, right: 16, bottom: 16, left: 16 } : calendarCollisionPadding(width)), [width]);
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,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAIpD,gHAAgH;AAChH,mHAAmH;AACnH,qHAAqH;AACrH,gHAAgH;AAChH,cAAc;AACd,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,KAAa,EAA4B,EAAE;IAClF,MAAM,MAAM,GAAG,IAAI,CAAC,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AE,CAAC,KAAK,CAAC,CAAC,CAAA;AACvI,CAAC,CAAA","sourcesContent":["import { useEffect, useMemo, useState } from \"react\"\n\nexport type CalendarCollisionPadding = { top: number; right: number; bottom: number; left: number }\n\n// The calendar's collision padding on a phone. Seven 44px days leave the rest of the width to two outer and two\n// inner gutters (Calendar.module.css uses the same gutter for its width), and the calendar keeps that gutter above\n// and below. Where the 328px calendar fits with room to spare, its sides keep up to 32px from the screen's edges, as\n// iOS 27.2 keeps the compact date picker's calendar 32pt from the edge it would cross (UIKit and Calendar on an\n// 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 = (): CalendarCollisionPadding => {\n const [width, setWidth] = useState<number>()\n\n useEffect(() => {\n const update = () => setWidth(viewportWidth())\n update()\n window.addEventListener(\"resize\", update)\n return () => window.removeEventListener(\"resize\", update)\n }, [])\n\n return useMemo(() => (width === undefined ? { top: 16, right: 16, bottom: 16, left: 16 } : calendarCollisionPadding(width)), [width])\n}\n"]}
@@ -7,7 +7,7 @@ import { useBreakpoint } from "../../hooks/useBreakpoints.js";
7
7
  import { useLatestValue } from "../../hooks/useLatestValue.js";
8
8
  import { isAfter } from "../../lib/dateUtils.js";
9
9
  import { Popover } from "../Popover/index.js";
10
- import { useCalendarGutter } from "../DatePicker/useCalendarGutter.js";
10
+ import { useCalendarCollisionPadding } from "../DatePicker/useCalendarCollisionPadding.js";
11
11
  import { DateRangeCalendar, DateRangeShortcuts } from "./Calendar.js";
12
12
  import { DateRangeContext } from "./context.js";
13
13
  import { DateRangeTrigger } from "./Trigger.js";
@@ -20,7 +20,7 @@ export const DateRangePicker = (props) => {
20
20
  }
21
21
  // Create stable, mutable references to avoid memoization requirements from consumers
22
22
  const wide = useBreakpoint("md");
23
- const calendarGutter = useCalendarGutter();
23
+ const calendarCollisionPadding = useCalendarCollisionPadding();
24
24
  const onChangeRef = useLatestValue(onChange);
25
25
  const store = useMemo(() => ({
26
26
  value,
@@ -63,6 +63,6 @@ export const DateRangePicker = (props) => {
63
63
  triggerDateFormat,
64
64
  onChangeRef,
65
65
  ]);
66
- return (_jsx(DateRangeContext, { value: store, children: _jsxs(Popover, { children: [_jsx(Popover.Trigger, { children: _jsx(DateRangeTrigger, {}) }), _jsx(Popover.Content, { className: s.Popover, minWidth: 230, collisionPadding: wide ? 20 : calendarGutter, side: wide || side === "top" ? side : "bottom", sideOffset: sideOffset, align: align, alignOffset: alignOffset ?? (align === "center" ? 0 : -5), children: _jsxs("div", { className: "flex", children: [_jsx(DateRangeShortcuts, { shortcuts: shortcuts }), _jsx(DateRangeCalendar, {})] }) })] }) }));
66
+ return (_jsx(DateRangeContext, { value: store, children: _jsxs(Popover, { children: [_jsx(Popover.Trigger, { children: _jsx(DateRangeTrigger, {}) }), _jsx(Popover.Content, { className: s.Popover, minWidth: 230, collisionPadding: wide ? 20 : calendarCollisionPadding, side: wide || side === "top" ? side : "bottom", sideOffset: sideOffset, align: align, alignOffset: alignOffset ?? (align === "center" ? 0 : -5), children: _jsxs("div", { className: "flex", children: [_jsx(DateRangeShortcuts, { shortcuts: shortcuts }), _jsx(DateRangeCalendar, {})] }) })] }) }));
67
67
  };
68
68
  //# sourceMappingURL=DateRangePicker.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DateRangePicker.js","sourceRoot":"","sources":["../../../../src/components/DateRangePicker/DateRangePicker.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,CAAC,MAAM,+DAA+D,CAAA;AAC7E,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAChC,OAAO,EAAE,OAAO,EAAE,MA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D,eAAK,SAAS,EAAC,MAAM,aACnB,KAAC,kBAAkB,IAAC,SAAS,EAAE,SAAS,GAAI,EAC5C,KAAC,iBAAiB,KAAG,IACjB,GACU,IACV,GACO,CACpB,CAAA;AACH,CAAC,CAAA","sourcesContent":["\"use client\"\n\nimport s from \"@plexui/styles/components/DateRangePicker/Calendar.module.css\"\nimport { DateTime } from \"luxon\"\nimport { useMemo } from \"react\"\nimport { useBreakpoint } from \"../../hooks/useBreakpoints\"\nimport { useLatestValue } from \"../../hooks/useLatestValue\"\nimport { isAfter } from \"../../lib/dateUtils\"\nimport { Popover, type PopoverContentProps } from \"../Popover\"\nimport { useCalendarGutter } from \"../DatePicker/useCalendarGutter\"\nimport type { SelectControlProps } from \"../SelectControl\"\nimport { DateRangeCalendar, DateRangeShortcuts } from \"./Calendar\"\nimport { DateRangeContext, type DateRangeContextValue } from \"./context\"\nimport { DateRangeTrigger } from \"./Trigger\"\nimport { type DateRange, type DateRangeShortcut, type WeekStart } from \"./types\"\n\nexport type DateRangePickerProps = {\n /**\n * The selected date range value.\n */\n value: DateRange | null\n /**\n * Handler that is triggered when the date range changes.\n */\n onChange: (nextValue: DateRange | null, shortcut?: DateRangeShortcut) => void\n /**\n * Defines the earliest selectable date (inclusive).\n */\n min?: DateTime\n /**\n * Defines the latest selectable date (inclusive).\n */\n max?: DateTime\n /**\n * Maximum length of the selectable range in days (inclusive).\n * When set, the end date cannot be more than this many days after the start date.\n */\n maxRangeDays?: number\n /**\n * The day each week starts on, from 0 (Sunday) to 6 (Saturday).\n * @default 0\n */\n weekStartsOn?: WeekStart\n /**\n * List of date range shortcuts displayed for quick selection, shown to the left of the calendar.\n * Not shown below the md breakpoint: on a phone, offer them in a row of their own (see the docs).\n */\n shortcuts?: DateRangeShortcut[]\n /**\n * The preferred side of the trigger to render against when open. Will be reversed when collisions occur.\n * On phones, left and right prefer bottom so all seven 44px day targets fit.\n * @default bottom\n */\n side?: PopoverContentProps[\"side\"]\n /**\n * The distance in pixels from the trigger.\n * @default 8\n */\n sideOffset?: PopoverContentProps[\"sideOffset\"]\n /**\n * The preferred alignment against the trigger. May change when collisions occur.\n * @default center\n */\n align?: PopoverContentProps[\"align\"]\n /**\n * An offset in pixels from the \"start\" or \"end\" alignment options.\n * @default 0\n */\n alignOffset?: PopoverContentProps[\"alignOffset\"]\n\n /**\n * Disables the select visually and from interactions\n * @default false\n */\n disabled?: boolean\n /**\n * Placeholder text for the select\n * @default Select date range...\n */\n placeholder?: string\n /**\n * Style variant for the select trigger\n * @default outline\n */\n variant?: SelectControlProps[\"variant\"]\n /**\n * Determines if the select trigger should be a fully rounded pill shape\n * @default true\n */\n pill?: boolean\n /**\n * Determines size of the size and spacing of the control.\n *\n * | 3xs | 2xs | xs | sm | md | lg | xl | 2xl | 3xl |\n * | ------- | ------- | ------- | ------- | ------- | ------- | ------- | ------- | ------- |\n * | `22px` | `24px` | `26px` | `28px` | `32px` | `36px` | `40px` | `44px` | `48px` |\n * @default md\n */\n size?: SelectControlProps[\"size\"]\n /**\n * Icon displayed in the far right of the select trigger\n * @default dropdown\n */\n dropdownIconType?: SelectControlProps[\"dropdownIconType\"]\n /**\n * Custom class applied to the select trigger\n */\n triggerClassName?: string\n /**\n * Display calendar icon at the start of the trigger\n * @default true\n */\n triggerShowIcon?: boolean\n /**\n * Allows the trigger to display as a stepper when the selected date matches the unit.\n * Currently 'month' is the only supported unit.\n */\n triggerStepperUnit?: \"month\"\n /**\n * Format of dates displayed in the trigger\n * @default \"MM/dd/yy\"\n */\n triggerDateFormat?: string\n /**\n * Display a clear action that allows the select to be unset.\n * @default false\n */\n clearable?: boolean\n /**\n * Extends select to 100% of available width.\n * @default false\n */\n block?: boolean\n}\n\nexport const DateRangePicker = (props: DateRangePickerProps) => {\n const {\n value,\n onChange,\n min,\n max,\n maxRangeDays,\n weekStartsOn = 0,\n shortcuts,\n side = \"bottom\",\n sideOffset = 8,\n align = \"center\",\n alignOffset,\n variant = \"outline\",\n size = \"md\",\n clearable = false,\n disabled = false,\n dropdownIconType,\n placeholder = \"Select date range...\",\n pill = true,\n block = false,\n triggerStepperUnit,\n triggerClassName,\n triggerShowIcon = true,\n triggerDateFormat = \"MM/dd/yy\",\n } = 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 // Create stable, mutable references to avoid memoization requirements from consumers\n const wide = useBreakpoint(\"md\")\n const calendarGutter = useCalendarGutter()\n const onChangeRef = useLatestValue(onChange)\n\n const store = useMemo<DateRangeContextValue>(\n () => ({\n value,\n min,\n max,\n maxRangeDays,\n weekStartsOn,\n variant,\n size,\n dropdownIconType,\n clearable,\n disabled,\n placeholder,\n block,\n pill,\n shortcuts,\n triggerStepperUnit,\n triggerClassName,\n triggerShowIcon,\n triggerDateFormat,\n onChangeRef,\n }),\n [\n value,\n min,\n max,\n maxRangeDays,\n weekStartsOn,\n variant,\n size,\n dropdownIconType,\n clearable,\n disabled,\n placeholder,\n block,\n pill,\n shortcuts,\n triggerStepperUnit,\n triggerClassName,\n triggerShowIcon,\n triggerDateFormat,\n onChangeRef,\n ],\n )\n\n return (\n <DateRangeContext value={store}>\n <Popover>\n <Popover.Trigger>\n <DateRangeTrigger />\n </Popover.Trigger>\n <Popover.Content\n className={s.Popover}\n minWidth={230}\n collisionPadding={wide ? 20 : calendarGutter}\n side={wide || side === \"top\" ? side : \"bottom\"}\n sideOffset={sideOffset}\n align={align}\n alignOffset={alignOffset ?? (align === \"center\" ? 0 : -5)}\n >\n <div className=\"flex\">\n <DateRangeShortcuts shortcuts={shortcuts} />\n <DateRangeCalendar />\n </div>\n </Popover.Content>\n </Popover>\n </DateRangeContext>\n )\n}\n"]}
1
+ {"version":3,"file":"DateRangePicker.js","sourceRoot":"","sources":["../../../../src/components/DateRangePicker/DateRangePicker.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,CAAC,MAAM,+DAA+D,CAAA;AAC7E,O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KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,YAEzD,eAAK,SAAS,EAAC,MAAM,aACnB,KAAC,kBAAkB,IAAC,SAAS,EAAE,SAAS,GAAI,EAC5C,KAAC,iBAAiB,KAAG,IACjB,GACU,IACV,GACO,CACpB,CAAA;AACH,CAAC,CAAA","sourcesContent":["\"use client\"\n\nimport s from \"@plexui/styles/components/DateRangePicker/Calendar.module.css\"\nimport { DateTime } from \"luxon\"\nimport { useMemo } from \"react\"\nimport { useBreakpoint } from \"../../hooks/useBreakpoints\"\nimport { useLatestValue } from \"../../hooks/useLatestValue\"\nimport { isAfter } from \"../../lib/dateUtils\"\nimport { Popover, type PopoverContentProps } from \"../Popover\"\nimport { useCalendarCollisionPadding } from \"../DatePicker/useCalendarCollisionPadding\"\nimport type { SelectControlProps } from \"../SelectControl\"\nimport { DateRangeCalendar, DateRangeShortcuts } from \"./Calendar\"\nimport { DateRangeContext, type DateRangeContextValue } from \"./context\"\nimport { DateRangeTrigger } from \"./Trigger\"\nimport { type DateRange, type DateRangeShortcut, type WeekStart } from \"./types\"\n\nexport type DateRangePickerProps = {\n /**\n * The selected date range value.\n */\n value: DateRange | null\n /**\n * Handler that is triggered when the date range changes.\n */\n onChange: (nextValue: DateRange | null, shortcut?: DateRangeShortcut) => void\n /**\n * Defines the earliest selectable date (inclusive).\n */\n min?: DateTime\n /**\n * Defines the latest selectable date (inclusive).\n */\n max?: DateTime\n /**\n * Maximum length of the selectable range in days (inclusive).\n * When set, the end date cannot be more than this many days after the start date.\n */\n maxRangeDays?: number\n /**\n * The day each week starts on, from 0 (Sunday) to 6 (Saturday).\n * @default 0\n */\n weekStartsOn?: WeekStart\n /**\n * List of date range shortcuts displayed for quick selection, shown to the left of the calendar.\n * Not shown below the md breakpoint: on a phone, offer them in a row of their own (see the docs).\n */\n shortcuts?: DateRangeShortcut[]\n /**\n * The preferred side of the trigger to render against when open. Will be reversed when collisions occur.\n * On phones, left and right prefer bottom so all seven 44px day targets fit.\n * @default bottom\n */\n side?: PopoverContentProps[\"side\"]\n /**\n * The distance in pixels from the trigger.\n * @default 8\n */\n sideOffset?: PopoverContentProps[\"sideOffset\"]\n /**\n * The preferred alignment against the trigger. May change when collisions occur.\n * @default center\n */\n align?: PopoverContentProps[\"align\"]\n /**\n * An offset in pixels from the \"start\" or \"end\" alignment options.\n * @default 0\n */\n alignOffset?: PopoverContentProps[\"alignOffset\"]\n\n /**\n * Disables the select visually and from interactions\n * @default false\n */\n disabled?: boolean\n /**\n * Placeholder text for the select\n * @default Select date range...\n */\n placeholder?: string\n /**\n * Style variant for the select trigger\n * @default outline\n */\n variant?: SelectControlProps[\"variant\"]\n /**\n * Determines if the select trigger should be a fully rounded pill shape\n * @default true\n */\n pill?: boolean\n /**\n * Determines size of the size and spacing of the control.\n *\n * | 3xs | 2xs | xs | sm | md | lg | xl | 2xl | 3xl |\n * | ------- | ------- | ------- | ------- | ------- | ------- | ------- | ------- | ------- |\n * | `22px` | `24px` | `26px` | `28px` | `32px` | `36px` | `40px` | `44px` | `48px` |\n * @default md\n */\n size?: SelectControlProps[\"size\"]\n /**\n * Icon displayed in the far right of the select trigger\n * @default dropdown\n */\n dropdownIconType?: SelectControlProps[\"dropdownIconType\"]\n /**\n * Custom class applied to the select trigger\n */\n triggerClassName?: string\n /**\n * Display calendar icon at the start of the trigger\n * @default true\n */\n triggerShowIcon?: boolean\n /**\n * Allows the trigger to display as a stepper when the selected date matches the unit.\n * Currently 'month' is the only supported unit.\n */\n triggerStepperUnit?: \"month\"\n /**\n * Format of dates displayed in the trigger\n * @default \"MM/dd/yy\"\n */\n triggerDateFormat?: string\n /**\n * Display a clear action that allows the select to be unset.\n * @default false\n */\n clearable?: boolean\n /**\n * Extends select to 100% of available width.\n * @default false\n */\n block?: boolean\n}\n\nexport const DateRangePicker = (props: DateRangePickerProps) => {\n const {\n value,\n onChange,\n min,\n max,\n maxRangeDays,\n weekStartsOn = 0,\n shortcuts,\n side = \"bottom\",\n sideOffset = 8,\n align = \"center\",\n alignOffset,\n variant = \"outline\",\n size = \"md\",\n clearable = false,\n disabled = false,\n dropdownIconType,\n placeholder = \"Select date range...\",\n pill = true,\n block = false,\n triggerStepperUnit,\n triggerClassName,\n triggerShowIcon = true,\n triggerDateFormat = \"MM/dd/yy\",\n } = 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 // Create stable, mutable references to avoid memoization requirements from consumers\n const wide = useBreakpoint(\"md\")\n const calendarCollisionPadding = useCalendarCollisionPadding()\n const onChangeRef = useLatestValue(onChange)\n\n const store = useMemo<DateRangeContextValue>(\n () => ({\n value,\n min,\n max,\n maxRangeDays,\n weekStartsOn,\n variant,\n size,\n dropdownIconType,\n clearable,\n disabled,\n placeholder,\n block,\n pill,\n shortcuts,\n triggerStepperUnit,\n triggerClassName,\n triggerShowIcon,\n triggerDateFormat,\n onChangeRef,\n }),\n [\n value,\n min,\n max,\n maxRangeDays,\n weekStartsOn,\n variant,\n size,\n dropdownIconType,\n clearable,\n disabled,\n placeholder,\n block,\n pill,\n shortcuts,\n triggerStepperUnit,\n triggerClassName,\n triggerShowIcon,\n triggerDateFormat,\n onChangeRef,\n ],\n )\n\n return (\n <DateRangeContext value={store}>\n <Popover>\n <Popover.Trigger>\n <DateRangeTrigger />\n </Popover.Trigger>\n <Popover.Content\n className={s.Popover}\n minWidth={230}\n collisionPadding={wide ? 20 : calendarCollisionPadding}\n side={wide || side === \"top\" ? side : \"bottom\"}\n sideOffset={sideOffset}\n align={align}\n alignOffset={alignOffset ?? (align === \"center\" ? 0 : -5)}\n >\n <div className=\"flex\">\n <DateRangeShortcuts shortcuts={shortcuts} />\n <DateRangeCalendar />\n </div>\n </Popover.Content>\n </Popover>\n </DateRangeContext>\n )\n}\n"]}
@@ -174,7 +174,7 @@ const Header = ({ children, className, background = "glass" }) => {
174
174
  const description = descriptions.length > 0 && _jsx("div", { className: s.SheetDescription, children: descriptions });
175
175
  // On a phone the header of a Sheet is its Toolbar (iOS 27 kit Sheets 507-24684, Toolbar - Top - iPhone
176
176
  // 1-54520): Close at the leading edge, the title alone centered on the row of controls, the header actions
177
- // at the trailing edge, all on one 44px row under the grabber.
177
+ // at the trailing edge, all on one 44px row 16px under the top edge.
178
178
  return (_jsxs(_Fragment, { children: [_jsx(Toolbar, { background: background, className: className, "data-dialog-bar": "", children: _jsxs(DialogBarContext.Provider, { value: true, children: [sheet.showClose && (_jsx(Toolbar.Leading, { className: s.BarClose, children: _jsx(RadixDialog.Close, { asChild: true, children: _jsx(NavigationButton, { action: "close", variant: "ghost", "aria-label": "Close dialog" }) }) })), _jsx("div", { className: clsx(t.Heading, s.BarHeading), children: parts.filter((part) => !isHeaderAction(part) && !isDescription(part)) }), parts.filter(isHeaderAction)] }) }), description && (sheet.descriptionSlot ? createPortal(description, sheet.descriptionSlot) : description)] }));
179
179
  }
180
180
  return _jsx("div", { className: clsx(s.Header, className), "data-background": background, "data-scrolled": scrolled ? "" : undefined, children: children });
@@ -1 +1 @@
1
- {"version":3,"file":"Dialog.js","sourceRoot":"","sources":["../../../../src/components/Dialog/Dialog.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EAAE,MAAM,IAAI,WAAW,EAAE,MAAM,UAAU,CAAA;AAChD,OAAO,EACL,QAAQ,EACR,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,cAAc,EACd,WAAW,EACX,UAAU,EACV,SAAS,EACT,eAAe,EACf,OAAO,EACP,MAAM,EACN,QAAQ,GAIT,MAAM,OAAO,CAAA;AACd,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AACxC,OAAO,EAAE,wBAAwB,EAAE,+BAA+B,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAA;AACrI,OAAO,EAAE,gBAAgB,EAAE,MAAM,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AI,CAAC,CAAC,CAAC,KAAK,EAAE,SAAS,CAAC,oBAAkB,SAAS,YACjE,KAAC,eAAe,OAAK,WAAW,EAAE,EAAE,EAAC,KAAK,EAAC,OAAO,QAAC,SAAS,EAAE,CAAC,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,gBAAgB,EAAE,cAAc,EAAE,iBAAiB,YAC5K,kCAAiC,EAAE,EAAC,QAAQ,EAAE,CAAC,CAAC,YAAG,QAAQ,IAAjD,IAAI,CAAoD,GAClD,GACd,CACP,CAAA;AAED,MAAM,KAAK,GAAG,CAAC,EAAE,QAAQ,EAA2B,EAAE,EAAE;IACtD,OAAO,KAAC,WAAW,CAAC,KAAK,IAAC,OAAO,kBAAE,QAAQ,GAAqB,CAAA;AAClE,CAAC,CAAA;AAED,MAAM,CAAC,OAAO,GAAG,OAAO,CAAA;AACxB,MAAM,CAAC,OAAO,GAAG,OAAO,CAAA;AACxB,MAAM,CAAC,MAAM,GAAG,MAAM,CAAA;AACtB,MAAM,CAAC,YAAY,GAAG,YAAY,CAAA;AAClC,MAAM,CAAC,IAAI,GAAG,IAAI,CAAA;AAClB,MAAM,CAAC,MAAM,GAAG,MAAM,CAAA;AACtB,MAAM,CAAC,KAAK,GAAG,KAAK,CAAA;AACpB,MAAM,CAAC,WAAW,GAAG,WAAW,CAAA;AAChC,MAAM,CAAC,eAAe,GAAG,eAAe,CAAA;AACxC,MAAM,CAAC,KAAK,GAAG,KAAK,CAAA;AACpB,MAAM,CAAC,KAAK,GAAG,KAAK,CAAA","sourcesContent":["\"use client\"\n\nimport clsx from \"clsx\"\nimport { Dialog as RadixDialog } from \"radix-ui\"\nimport {\n Children,\n cloneElement,\n createContext,\n Fragment,\n isValidElement,\n useCallback,\n useContext,\n useEffect,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n type CSSProperties,\n type ReactElement,\n type ReactNode,\n} from \"react\"\nimport { createPortal } from \"react-dom\"\nimport { FloatingBoundaryProvider, useFloatingBoundaryRegistration, useFloatingBoundaryScope } from \"../../hooks/useFloatingBoundary\"\nimport { useEscCloseStack } from \"../../hooks/useEscCloseStack\"\nimport { inToastRegion } from \"../../lib/toastRegion\"\nimport { cancelableKeyCopy, dataAttributes, keepMovedFocus, preventDefaultHandler, toCssVariables } from \"../../lib/helpers\"\nimport { useStableCallback } from \"../../hooks/useStableCallback\"\nimport { NavigationButton } from \"../Button/NavigationButton\"\nimport { Toolbar, ToolbarHostContext, type BarBackground, type ToolbarHost } from \"../Toolbar/Toolbar\"\nimport { NO_SCROLL_EDGES, observeScrollEdges, sameScrollEdges, type ScrollEdges } from \"../../lib/scrollEdges\"\nimport { TransitionGroup } from \"../Transition\"\nimport { createExitGuard, overlayTiming, overlayTimingLarge } from \"../Transition/shared\"\nimport { attachSheetDrag } from \"./sheetDrag\"\nimport { watchDialogViewport } from \"./dialogViewport\"\nimport { enterStep, leaveStep, releaseStepHeight, settleStepHeight, STEP_TIMING } from \"./dialogSteps\"\nimport { PhoneLayoutContext, usePhoneLayout, type PhoneLayoutValue } from \"../PhoneLayout/PhoneLayout\"\nimport { usePopoverDismissableSurface } from \"../Popover/deferredOutsidePress\"\nimport s from \"@plexui/styles/components/Dialog/Dialog.module.css\"\nimport t from \"@plexui/styles/components/Toolbar/Toolbar.module.css\"\n\ntype DialogContextValue = {\n open: boolean\n setOpen: (nextState: boolean) => void\n}\n\nconst DOUBLE_CLICK = 300\n\nconst DialogContext = createContext<DialogContextValue | null>(null)\n\nconst useDialogContext = () => {\n const context = useContext(DialogContext)\n\n if (!context) {\n throw new Error(\"Dialog compound components must be used inside <Dialog>\")\n }\n\n return context\n}\n\nexport type DialogProps = {\n open?: boolean\n onOpenChange?: (open: boolean) => void\n children: ReactNode\n}\n\nexport const Dialog = ({\n open: controlledOpen,\n onOpenChange: controlledOnOpenChange,\n children,\n}: DialogProps) => {\n const [open, setOpen] = useState<boolean>(false)\n const isOpen = controlledOpen ?? open\n\n const handleOpenChange = useCallback(\n (nextState: boolean) => {\n controlledOnOpenChange?.(nextState)\n setOpen(nextState)\n },\n [controlledOnOpenChange],\n )\n\n const store = useMemo<DialogContextValue>(\n () => ({\n open: isOpen,\n setOpen: handleOpenChange,\n }),\n [isOpen, handleOpenChange],\n )\n\n return (\n <DialogContext value={store}>\n <RadixDialog.Root open={isOpen} onOpenChange={handleOpenChange}>\n {children}\n </RadixDialog.Root>\n </DialogContext>\n )\n}\n\nconst Trigger = ({ children }: { children: ReactNode }) => {\n return <RadixDialog.Trigger asChild>{children}</RadixDialog.Trigger>\n}\n\nexport type DialogPlacement = \"center\" | \"top\" | \"bottom\" | \"start\" | \"end\" | \"fullscreen\"\n\n/** A press or a focus outside the dialog; `event.detail.originalEvent` is the browser's event. */\nexport type DialogInteractOutsideEvent = CustomEvent<{ originalEvent: PointerEvent | FocusEvent }>\n\n/** Class, style and data attributes for one of the dialog's layers. */\nexport type DialogLayerProps = {\n className?: string\n style?: CSSProperties\n [dataAttribute: `data-${string}`]: string | number | boolean | undefined\n}\n\nexport type DialogContentProps = {\n children: ReactNode\n width?: number | string\n showClose?: boolean\n /**\n * Rounder panel and a round close button, for dialogs that sit beside pill controls.\n * @default false\n */\n pill?: boolean\n className?: string\n /**\n * Where the panel sits: centered, near the top (search, command lists),\n * a sheet along the bottom, a full-height panel on the start or end side,\n * or the whole screen.\n * @default center\n */\n placement?: DialogPlacement\n /** Placement at 767px and below, such as a bottom sheet on phones. @default placement */\n mobilePlacement?: Extract<DialogPlacement, \"center\" | \"bottom\" | \"fullscreen\">\n /** Mobile presentation at 767px and below. Sheets default to bottom placement. */\n mobileVariant?: \"alert\" | \"sheet\"\n /** Mobile panel palette; dark mode uses elevated surfaces. @default \"plain\" */\n surface?: \"plain\" | \"grouped\"\n /**\n * Called when focus moves into the dialog on open. Call\n * `event.preventDefault()` to focus something else yourself.\n */\n onOpenAutoFocus?: (event: Event) => void\n /** Called when focus returns on close. Call `event.preventDefault()` to keep it elsewhere. */\n onCloseAutoFocus?: (event: Event) => void\n /**\n * Called on Escape before the dialog closes. Call `event.preventDefault()` to keep it open, such as for a form\n * with unsaved changes.\n */\n onEscapeKeyDown?: (event: KeyboardEvent) => void\n /**\n * Called on a press or a focus outside the dialog before it closes. Call `event.preventDefault()` to keep it open,\n * such as for a press on a developer panel over the page.\n */\n onInteractOutside?: (event: DialogInteractOutsideEvent) => void\n /** Stack order of the overlay and the dialog. @default 50 */\n zIndex?: number\n /** Class, style and data attributes for the fixed layer that holds the panel. Data attributes of Content land here too. */\n rootProps?: DialogLayerProps\n /** Class, style and data attributes for the overlay. */\n overlayProps?: DialogLayerProps\n /**\n * `phone` lays the dialog out as on a phone at any window width. Inside a PhoneLayout it always is.\n * @default \"auto\"\n */\n layout?: \"auto\" | \"phone\"\n [dataAttribute: `data-${string}`]: string | number | boolean | undefined\n}\n\nconst Content = ({\n children,\n width = 480,\n showClose = true,\n pill = false,\n className,\n placement = \"center\",\n mobilePlacement: requestedMobilePlacement,\n mobileVariant,\n surface = \"plain\",\n onOpenAutoFocus,\n onCloseAutoFocus,\n onEscapeKeyDown,\n onInteractOutside,\n zIndex,\n rootProps,\n overlayProps,\n layout = \"auto\",\n ...rest\n}: DialogContentProps) => {\n const { open, setOpen } = useDialogContext()\n const outerPhoneLayout = useContext(PhoneLayoutContext)\n // A dialog laid out as on a phone by its own prop, outside a PhoneLayout, keeps the window: what it holds and\n // the dialogs it opens are phone ones too.\n const phoneLayout = useMemo<PhoneLayoutValue | null>(\n () => outerPhoneLayout ?? (layout === \"phone\" ? { container: null } : null),\n [outerPhoneLayout, layout],\n )\n const [content, setContent] = useState<HTMLDivElement | null>(null)\n useDialogViewport(content, outerPhoneLayout?.container ?? null)\n const overlaySurfaceRef = usePopoverDismissableSurface()\n const mobilePlacement =\n mobileVariant === \"alert\"\n ? \"center\"\n : requestedMobilePlacement ?? (mobileVariant === \"sheet\" ? \"bottom\" : undefined)\n const [exitGuard] = useState(createExitGuard)\n const [panel, setPanel] = useState<HTMLDivElement | null>(null)\n // Dialog.Body reports where content lies under the bars: they show their lines with it.\n const [edges, setEdgesState] = useState(NO_SCROLL_EDGES)\n const setEdges = useCallback((next: ScrollEdges) => setEdgesState((current) => sameScrollEdges(current, next) ? current : next), [])\n const scroll = useMemo(() => ({ edges, setEdges }), [edges, setEdges])\n const toolbarHost = useMemo<ToolbarHost>(() => ({ kind: \"dialog\", scrolled: edges.scrolled, contentBelow: edges.contentBelow }), [edges])\n // Where a phone Sheet's description goes: the first text of the content, under the bar. Dialog.Body offers\n // its top; a Dialog.DescriptionSlot of the content's own, such as a scroller inside a form, comes first.\n const [bodySlot, setBodySlot] = useState<HTMLElement | null>(null)\n const [ownSlot, setOwnSlot] = useState<HTMLElement | null>(null)\n const descriptionSlot = ownSlot ?? bodySlot\n const sheet = useMemo<DialogSheetValue | null>(\n () => (mobileVariant === \"sheet\" ? { showClose, descriptionSlot, setBodySlot, setOwnSlot } : null),\n [mobileVariant, showClose, descriptionSlot],\n )\n const boundary = useFloatingBoundaryScope()\n const setRoot = boundary.setRoot\n const setPanelRef = useCallback((node: HTMLDivElement | null) => { setPanel(node); setRoot(node) }, [setRoot])\n const openedAt = useRef(0)\n const crossesScreen =\n placement === \"bottom\" || placement === \"start\" || placement === \"end\" || placement === \"fullscreen\" || mobilePlacement === \"bottom\" || mobilePlacement === \"fullscreen\"\n\n // The content of a closing dialog is frozen for its exit, so this reads the owner's latest\n // handler: state that changes together with the close decides where focus returns.\n const handleCloseAutoFocus = useStableCallback((event: Event) => {\n onCloseAutoFocus?.(event)\n keepMovedFocus(event)\n })\n\n useEscCloseStack(open, (event) => {\n if (onEscapeKeyDown) {\n const request = cancelableKeyCopy(event)\n onEscapeKeyDown(request)\n if (request.defaultPrevented) return\n }\n setOpen(false)\n })\n\n useEffect(() => {\n if (open) openedAt.current = performance.now()\n }, [open])\n\n useEffect(() => {\n if (!panel || mobilePlacement !== \"bottom\") return undefined\n return attachSheetDrag(panel, () => setOpen(false))\n }, [panel, mobilePlacement, setOpen])\n\n useLayoutEffect(() => {\n if (!panel) return\n const update = () => {\n // A phone Toolbar takes the place of the header or footer bar on its side: one the dialog places itself\n // before the bar its header becomes.\n const header = panel.querySelector<HTMLElement>(`:scope > ${TOP_TOOLBAR}:not([data-dialog-bar])`)\n ?? panel.querySelector<HTMLElement>(`:scope > ${TOP_TOOLBAR}`)\n ?? panel.querySelector<HTMLElement>(`:scope > .${s.Header}`)\n const footer = panel.querySelector<HTMLElement>(`:scope > ${BOTTOM_TOOLBAR}`) ?? panel.querySelector<HTMLElement>(`:scope > .${s.Footer}`)\n panel.style.setProperty(\"--dialog-header-height\", `${header?.offsetHeight ?? 0}px`)\n panel.style.setProperty(\"--dialog-footer-height\", `${footer?.offsetHeight ?? 0}px`)\n }\n const observer = typeof ResizeObserver !== \"undefined\" ? new ResizeObserver(update) : undefined\n const observeBars = () => {\n observer?.disconnect()\n panel.querySelectorAll<HTMLElement>(`:scope > .${s.Header}, :scope > .${s.Footer}, :scope > [data-toolbar]`)\n .forEach((bar) => observer?.observe(bar, { box: \"border-box\" }))\n update()\n }\n observeBars()\n // A form can add or remove its action bar while the dialog stays open.\n const children = new MutationObserver(observeBars)\n children.observe(panel, { childList: true })\n return () => { observer?.disconnect(); children.disconnect() }\n }, [panel])\n\n const layerStyle = toCssVariables({ \"dialog-z-index\": zIndex === undefined ? undefined : String(zIndex) })\n\n return (\n <FloatingBoundaryProvider value={boundary}>\n <PhoneLayoutContext value={phoneLayout}>\n <RadixDialog.Portal forceMount container={outerPhoneLayout?.container ?? undefined}>\n {/* Portaled out of any phone layout, a phone dialog carries its own scope, above its transition: the phone\n rules of the style sheet start there. */}\n <PhoneScope enabled={phoneLayout !== null && !outerPhoneLayout?.container}>\n {/* A dialog mounted open enters too, as `open` set with the mount does */}\n <TransitionGroup\n {...(crossesScreen ? overlayTimingLarge : overlayTiming)}\n {...exitGuard.transition}\n className={s.Transition}\n overlay\n preventInitialTransition={false}\n >\n {open && (\n <div key=\"dialog\">\n <RadixDialog.Overlay\n {...overlayProps}\n ref={overlaySurfaceRef}\n className={clsx(s.Overlay, overlayProps?.className)}\n style={{ ...layerStyle, ...overlayProps?.style }}\n />\n <RadixDialog.Content\n {...dataAttributes(rest)}\n {...rootProps}\n ref={setContent}\n forceMount\n className={clsx(s.Content, rootProps?.className)}\n data-plex-dialog=\"\"\n style={{ ...toCssVariables({ \"dialog-width\": width }), ...layerStyle, ...rootProps?.style }}\n data-placement={placement === \"center\" ? undefined : placement}\n data-mobile-placement={mobilePlacement}\n data-mobile-variant={mobileVariant}\n data-surface={surface}\n data-pill={pill ? \"\" : undefined}\n onEscapeKeyDown={preventDefaultHandler}\n onInteractOutside={(event) => {\n // A press or focus in a toast is not outside: the toast region is a layer above the dialog. The\n // Toaster stops these before Radix sees them; this holds when the Toaster mounted after the dialog.\n if (inToastRegion(event.detail.originalEvent.target)) return event.preventDefault()\n onInteractOutside?.(event)\n if (event.defaultPrevented) return\n // The second click of a double click lands on the overlay: it must not undo the first\n if (performance.now() - openedAt.current < DOUBLE_CLICK) event.preventDefault()\n else exitGuard.onInteractOutside(event)\n }}\n onOpenAutoFocus={onOpenAutoFocus}\n onCloseAutoFocus={handleCloseAutoFocus}\n >\n <div ref={setPanelRef} className={clsx(s.Panel, className)}>\n {showClose && (\n <RadixDialog.Close asChild>\n <NavigationButton action=\"close\" variant=\"ghost\" className={s.CloseButton} aria-label=\"Close dialog\" />\n </RadixDialog.Close>\n )}\n <DialogScrollContext.Provider value={scroll}>\n <DialogSheetContext.Provider value={sheet}>\n {/* A dialog opened from a header action is not inside that header's bar */}\n <DialogBarContext.Provider value={false}>\n <ToolbarHostContext.Provider value={toolbarHost}>{children}</ToolbarHostContext.Provider>\n </DialogBarContext.Provider>\n </DialogSheetContext.Provider>\n </DialogScrollContext.Provider>\n </div>\n </RadixDialog.Content>\n </div>\n )}\n </TransitionGroup>\n </PhoneScope>\n </RadixDialog.Portal>\n </PhoneLayoutContext>\n </FloatingBoundaryProvider>\n )\n}\n\ntype DialogScrollValue = { edges: ScrollEdges; setEdges: (edges: ScrollEdges) => void }\nconst DialogScrollContext = createContext<DialogScrollValue | null>(null)\n// What the header of a Sheet needs from its Content to become the Sheet's bar on a phone\ntype DialogSheetValue = {\n showClose: boolean\n descriptionSlot: HTMLElement | null\n setBodySlot: (slot: HTMLElement | null) => void\n setOwnSlot: (slot: HTMLElement | null) => void\n}\nconst DialogSheetContext = createContext<DialogSheetValue | null>(null)\n// Inside that bar: the title, the description and the header actions take the Toolbar's parts\nconst DialogBarContext = createContext(false)\n\nconst PhoneScope = ({ enabled, children }: { enabled: boolean; children: ReactNode }) =>\n enabled ? <div className={s.PhoneScope} data-plex-layout=\"phone\">{children}</div> : children\n\nconst useDialogViewport = (content: HTMLElement | null, container: HTMLElement | null) => {\n useLayoutEffect(() => (content ? watchDialogViewport(content, container) : undefined), [content, container])\n}\nconst TOP_TOOLBAR = '[data-toolbar][data-placement=\"top\"]'\nconst BOTTOM_TOOLBAR = '[data-toolbar][data-placement=\"bottom\"]'\n\ntype DialogSlotProps = {\n children: ReactNode\n className?: string\n}\n\n/** How a Sheet's bar meets the content scrolled under it; see `BarBackground`. */\nexport type DialogBarBackground = BarBackground\nexport type DialogHeaderProps = DialogSlotProps & {\n /** How the bar meets the content scrolled under it in a phone Sheet. @default \"glass\" */\n background?: DialogBarBackground\n}\n\n// The header's own parts, fragments opened up, so its actions can stand at the end of the bar. A part from a\n// fragment keeps the fragment's key before its own, so two parts never share a key.\nconst headerParts = (children: ReactNode, prefix = \"\"): ReactNode[] =>\n Children.toArray(children).flatMap((part) => {\n if (!isValidElement<{ children?: ReactNode }>(part)) return [part]\n if (part.type === Fragment) return headerParts(part.props.children, `${prefix}${String(part.key)}/`)\n return [prefix ? cloneElement(part, { key: `${prefix}${String(part.key)}` }) : part]\n })\nconst isHeaderAction = (part: ReactNode): part is ReactElement => isValidElement(part) && part.type === HeaderAction\nconst isDescription = (part: ReactNode): part is ReactElement => isValidElement(part) && part.type === Description\n\nconst Header = ({ children, className, background = \"glass\" }: DialogHeaderProps) => {\n const sheet = useContext(DialogSheetContext)\n const phone = usePhoneLayout()\n const scrolled = useContext(DialogScrollContext)?.edges.scrolled\n if (sheet && phone) {\n const parts = headerParts(children)\n const descriptions = parts.filter(isDescription)\n // The description reads as the first text of the content, at the top of Dialog.Body when there is one\n const description = descriptions.length > 0 && <div className={s.SheetDescription}>{descriptions}</div>\n // On a phone the header of a Sheet is its Toolbar (iOS 27 kit Sheets 507-24684, Toolbar - Top - iPhone\n // 1-54520): Close at the leading edge, the title alone centered on the row of controls, the header actions\n // at the trailing edge, all on one 44px row under the grabber.\n return (\n <>\n <Toolbar background={background} className={className} data-dialog-bar=\"\">\n <DialogBarContext.Provider value={true}>\n {sheet.showClose && (\n <Toolbar.Leading className={s.BarClose}>\n <RadixDialog.Close asChild>\n <NavigationButton action=\"close\" variant=\"ghost\" aria-label=\"Close dialog\" />\n </RadixDialog.Close>\n </Toolbar.Leading>\n )}\n <div className={clsx(t.Heading, s.BarHeading)}>{parts.filter((part) => !isHeaderAction(part) && !isDescription(part))}</div>\n {parts.filter(isHeaderAction)}\n </DialogBarContext.Provider>\n </Toolbar>\n {description && (sheet.descriptionSlot ? createPortal(description, sheet.descriptionSlot) : description)}\n </>\n )\n }\n return <div className={clsx(s.Header, className)} data-background={background} data-scrolled={scrolled ? \"\" : undefined}>{children}</div>\n}\n\nconst HeaderAction = ({ children, className }: DialogSlotProps) => {\n const bar = useContext(DialogBarContext)\n if (bar) return <Toolbar.Trailing className={className}>{children}</Toolbar.Trailing>\n return <div className={clsx(s.HeaderAction, className)}>{children}</div>\n}\n\n/** The scrolling part between Header and Footer: with it, only the body scrolls */\nconst Body = ({ children, className }: DialogSlotProps) => {\n const setEdges = useContext(DialogScrollContext)?.setEdges\n const sheet = useContext(DialogSheetContext)\n const phone = usePhoneLayout()\n // A phone Sheet's description starts the body (Dialog.Header portals it here)\n const setDescriptionSlot = sheet && phone ? sheet.setBodySlot : null\n const element = useRef<HTMLDivElement | null>(null)\n useLayoutEffect(() => {\n const body = element.current\n if (!body || !setEdges) return\n const stop = observeScrollEdges(body, setEdges)\n return () => { stop(); setEdges(NO_SCROLL_EDGES) }\n }, [setEdges])\n return (\n <div ref={element} className={clsx(s.Body, className)}>\n {setDescriptionSlot && <div ref={setDescriptionSlot} className={s.SheetDescriptionSlot} />}\n {children}\n </div>\n )\n}\n\n/**\n * Where a phone Sheet's description goes in content of your own, such as a scroller inside a form so that Enter\n * submits: the description starts it, as it starts Dialog.Body, and it comes before the body's place. It renders\n * nothing outside a phone Sheet.\n */\nconst DescriptionSlot = () => {\n const sheet = useContext(DialogSheetContext)\n const phone = usePhoneLayout()\n const setOwnSlot = sheet && phone ? sheet.setOwnSlot : null\n return setOwnSlot ? <div ref={setOwnSlot} className={s.SheetDescriptionSlot} /> : null\n}\n\nexport type DialogFooterProps = DialogSlotProps & {\n /** How the bar meets the content scrolled under it in a phone Sheet. @default \"soft\" */\n background?: DialogBarBackground\n /** Override the mobile action layout. Alerts default to inline; sheets to stacked. */\n mobileLayout?: \"inline\" | \"stacked\"\n}\n\nconst Footer = ({ children, className, mobileLayout, background = \"soft\" }: DialogFooterProps) => {\n const setFooter = useFloatingBoundaryRegistration()?.setFooter\n const contentBelow = useContext(DialogScrollContext)?.edges.contentBelow\n return (\n <div\n ref={setFooter}\n className={clsx(s.Footer, className)}\n data-mobile-layout={mobileLayout}\n data-background={background}\n data-content-below={contentBelow ? \"\" : undefined}\n >\n {children}\n </div>\n )\n}\n\nconst Title = ({ children, className }: DialogSlotProps) => {\n const bar = useContext(DialogBarContext)\n return <RadixDialog.Title className={clsx(bar ? t.Title : s.Title, className)}>{children}</RadixDialog.Title>\n}\n\nconst Description = ({ children, className }: DialogSlotProps) => {\n const bar = useContext(DialogBarContext)\n const element = useRef<HTMLParagraphElement | null>(null)\n const [shown, setShown] = useState(false)\n useLayoutEffect(() => {\n // The header leaves its own descriptions out of the bar. One the bar still holds, inside a part of the\n // header's own, is the title's second line (Toolbar's subtitle) when the reader sees it; one that is only\n // read out, visually hidden, leaves the title on its one line.\n const node = element.current\n // A measurement of the laid-out description, which only an effect after layout can read\n // eslint-disable-next-line react-hooks/set-state-in-effect\n setShown(bar && !!node && node.offsetHeight > 1 && node.offsetWidth > 1)\n }, [bar, children, className])\n return (\n <RadixDialog.Description ref={element} className={clsx(bar && shown ? t.Subtitle : s.Description, className)}>\n {children}\n </RadixDialog.Description>\n )\n}\n\nexport type DialogStepsProps = {\n /** The step on screen. A new value brings its content in. */\n step: string | number\n /**\n * `forward` brings the new step in from the trailing edge over the one before, as a push on iOS; `back` returns to\n * a step before it.\n * @default \"forward\"\n */\n direction?: \"forward\" | \"back\"\n children: ReactNode\n className?: string\n}\n\n/** The steps of a flow inside a dialog, such as a sign-in that asks for an email and then a code. */\nconst Steps = ({ step, direction = \"forward\", children, className }: DialogStepsProps) => (\n <div className={clsx(s.Steps, className)} data-direction={direction}>\n <TransitionGroup {...STEP_TIMING} as=\"div\" overlay className={s.Step} onEnter={enterStep} onExit={leaveStep} onExitActive={settleStepHeight} onExitComplete={releaseStepHeight}>\n <div key={step} data-dialog-step=\"\" tabIndex={-1}>{children}</div>\n </TransitionGroup>\n </div>\n)\n\nconst Close = ({ children }: { children: ReactNode }) => {\n return <RadixDialog.Close asChild>{children}</RadixDialog.Close>\n}\n\nDialog.Trigger = Trigger\nDialog.Content = Content\nDialog.Header = Header\nDialog.HeaderAction = HeaderAction\nDialog.Body = Body\nDialog.Footer = Footer\nDialog.Title = Title\nDialog.Description = Description\nDialog.DescriptionSlot = DescriptionSlot\nDialog.Close = Close\nDialog.Steps = Steps\n"]}
1
+ {"version":3,"file":"Dialog.js","sourceRoot":"","sources":["../../../../src/components/Dialog/Dialog.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EAAE,MAAM,IAAI,WAAW,EAAE,MAAM,UAAU,CAAA;AAChD,OA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;AACxC,MAAM,CAAC,KAAK,GAAG,KAAK,CAAA;AACpB,MAAM,CAAC,KAAK,GAAG,KAAK,CAAA","sourcesContent":["\"use client\"\n\nimport clsx from \"clsx\"\nimport { Dialog as RadixDialog } from \"radix-ui\"\nimport {\n Children,\n cloneElement,\n createContext,\n Fragment,\n isValidElement,\n useCallback,\n useContext,\n useEffect,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n type CSSProperties,\n type ReactElement,\n type ReactNode,\n} from \"react\"\nimport { createPortal } from \"react-dom\"\nimport { FloatingBoundaryProvider, useFloatingBoundaryRegistration, useFloatingBoundaryScope } from \"../../hooks/useFloatingBoundary\"\nimport { useEscCloseStack } from \"../../hooks/useEscCloseStack\"\nimport { inToastRegion } from \"../../lib/toastRegion\"\nimport { cancelableKeyCopy, dataAttributes, keepMovedFocus, preventDefaultHandler, toCssVariables } from \"../../lib/helpers\"\nimport { useStableCallback } from \"../../hooks/useStableCallback\"\nimport { NavigationButton } from \"../Button/NavigationButton\"\nimport { Toolbar, ToolbarHostContext, type BarBackground, type ToolbarHost } from \"../Toolbar/Toolbar\"\nimport { NO_SCROLL_EDGES, observeScrollEdges, sameScrollEdges, type ScrollEdges } from \"../../lib/scrollEdges\"\nimport { TransitionGroup } from \"../Transition\"\nimport { createExitGuard, overlayTiming, overlayTimingLarge } from \"../Transition/shared\"\nimport { attachSheetDrag } from \"./sheetDrag\"\nimport { watchDialogViewport } from \"./dialogViewport\"\nimport { enterStep, leaveStep, releaseStepHeight, settleStepHeight, STEP_TIMING } from \"./dialogSteps\"\nimport { PhoneLayoutContext, usePhoneLayout, type PhoneLayoutValue } from \"../PhoneLayout/PhoneLayout\"\nimport { usePopoverDismissableSurface } from \"../Popover/deferredOutsidePress\"\nimport s from \"@plexui/styles/components/Dialog/Dialog.module.css\"\nimport t from \"@plexui/styles/components/Toolbar/Toolbar.module.css\"\n\ntype DialogContextValue = {\n open: boolean\n setOpen: (nextState: boolean) => void\n}\n\nconst DOUBLE_CLICK = 300\n\nconst DialogContext = createContext<DialogContextValue | null>(null)\n\nconst useDialogContext = () => {\n const context = useContext(DialogContext)\n\n if (!context) {\n throw new Error(\"Dialog compound components must be used inside <Dialog>\")\n }\n\n return context\n}\n\nexport type DialogProps = {\n open?: boolean\n onOpenChange?: (open: boolean) => void\n children: ReactNode\n}\n\nexport const Dialog = ({\n open: controlledOpen,\n onOpenChange: controlledOnOpenChange,\n children,\n}: DialogProps) => {\n const [open, setOpen] = useState<boolean>(false)\n const isOpen = controlledOpen ?? open\n\n const handleOpenChange = useCallback(\n (nextState: boolean) => {\n controlledOnOpenChange?.(nextState)\n setOpen(nextState)\n },\n [controlledOnOpenChange],\n )\n\n const store = useMemo<DialogContextValue>(\n () => ({\n open: isOpen,\n setOpen: handleOpenChange,\n }),\n [isOpen, handleOpenChange],\n )\n\n return (\n <DialogContext value={store}>\n <RadixDialog.Root open={isOpen} onOpenChange={handleOpenChange}>\n {children}\n </RadixDialog.Root>\n </DialogContext>\n )\n}\n\nconst Trigger = ({ children }: { children: ReactNode }) => {\n return <RadixDialog.Trigger asChild>{children}</RadixDialog.Trigger>\n}\n\nexport type DialogPlacement = \"center\" | \"top\" | \"bottom\" | \"start\" | \"end\" | \"fullscreen\"\n\n/** A press or a focus outside the dialog; `event.detail.originalEvent` is the browser's event. */\nexport type DialogInteractOutsideEvent = CustomEvent<{ originalEvent: PointerEvent | FocusEvent }>\n\n/** Class, style and data attributes for one of the dialog's layers. */\nexport type DialogLayerProps = {\n className?: string\n style?: CSSProperties\n [dataAttribute: `data-${string}`]: string | number | boolean | undefined\n}\n\nexport type DialogContentProps = {\n children: ReactNode\n width?: number | string\n showClose?: boolean\n /**\n * Rounder panel and a round close button, for dialogs that sit beside pill controls.\n * @default false\n */\n pill?: boolean\n className?: string\n /**\n * Where the panel sits: centered, near the top (search, command lists),\n * a sheet along the bottom, a full-height panel on the start or end side,\n * or the whole screen.\n * @default center\n */\n placement?: DialogPlacement\n /** Placement at 767px and below, such as a bottom sheet on phones. @default placement */\n mobilePlacement?: Extract<DialogPlacement, \"center\" | \"bottom\" | \"fullscreen\">\n /** Mobile presentation at 767px and below. Sheets default to bottom placement. */\n mobileVariant?: \"alert\" | \"sheet\"\n /** Mobile panel palette; dark mode uses elevated surfaces. @default \"plain\" */\n surface?: \"plain\" | \"grouped\"\n /**\n * Called when focus moves into the dialog on open. Call\n * `event.preventDefault()` to focus something else yourself.\n */\n onOpenAutoFocus?: (event: Event) => void\n /** Called when focus returns on close. Call `event.preventDefault()` to keep it elsewhere. */\n onCloseAutoFocus?: (event: Event) => void\n /**\n * Called on Escape before the dialog closes. Call `event.preventDefault()` to keep it open, such as for a form\n * with unsaved changes.\n */\n onEscapeKeyDown?: (event: KeyboardEvent) => void\n /**\n * Called on a press or a focus outside the dialog before it closes. Call `event.preventDefault()` to keep it open,\n * such as for a press on a developer panel over the page.\n */\n onInteractOutside?: (event: DialogInteractOutsideEvent) => void\n /** Stack order of the overlay and the dialog. @default 50 */\n zIndex?: number\n /** Class, style and data attributes for the fixed layer that holds the panel. Data attributes of Content land here too. */\n rootProps?: DialogLayerProps\n /** Class, style and data attributes for the overlay. */\n overlayProps?: DialogLayerProps\n /**\n * `phone` lays the dialog out as on a phone at any window width. Inside a PhoneLayout it always is.\n * @default \"auto\"\n */\n layout?: \"auto\" | \"phone\"\n [dataAttribute: `data-${string}`]: string | number | boolean | undefined\n}\n\nconst Content = ({\n children,\n width = 480,\n showClose = true,\n pill = false,\n className,\n placement = \"center\",\n mobilePlacement: requestedMobilePlacement,\n mobileVariant,\n surface = \"plain\",\n onOpenAutoFocus,\n onCloseAutoFocus,\n onEscapeKeyDown,\n onInteractOutside,\n zIndex,\n rootProps,\n overlayProps,\n layout = \"auto\",\n ...rest\n}: DialogContentProps) => {\n const { open, setOpen } = useDialogContext()\n const outerPhoneLayout = useContext(PhoneLayoutContext)\n // A dialog laid out as on a phone by its own prop, outside a PhoneLayout, keeps the window: what it holds and\n // the dialogs it opens are phone ones too.\n const phoneLayout = useMemo<PhoneLayoutValue | null>(\n () => outerPhoneLayout ?? (layout === \"phone\" ? { container: null } : null),\n [outerPhoneLayout, layout],\n )\n const [content, setContent] = useState<HTMLDivElement | null>(null)\n useDialogViewport(content, outerPhoneLayout?.container ?? null)\n const overlaySurfaceRef = usePopoverDismissableSurface()\n const mobilePlacement =\n mobileVariant === \"alert\"\n ? \"center\"\n : requestedMobilePlacement ?? (mobileVariant === \"sheet\" ? \"bottom\" : undefined)\n const [exitGuard] = useState(createExitGuard)\n const [panel, setPanel] = useState<HTMLDivElement | null>(null)\n // Dialog.Body reports where content lies under the bars: they show their lines with it.\n const [edges, setEdgesState] = useState(NO_SCROLL_EDGES)\n const setEdges = useCallback((next: ScrollEdges) => setEdgesState((current) => sameScrollEdges(current, next) ? current : next), [])\n const scroll = useMemo(() => ({ edges, setEdges }), [edges, setEdges])\n const toolbarHost = useMemo<ToolbarHost>(() => ({ kind: \"dialog\", scrolled: edges.scrolled, contentBelow: edges.contentBelow }), [edges])\n // Where a phone Sheet's description goes: the first text of the content, under the bar. Dialog.Body offers\n // its top; a Dialog.DescriptionSlot of the content's own, such as a scroller inside a form, comes first.\n const [bodySlot, setBodySlot] = useState<HTMLElement | null>(null)\n const [ownSlot, setOwnSlot] = useState<HTMLElement | null>(null)\n const descriptionSlot = ownSlot ?? bodySlot\n const sheet = useMemo<DialogSheetValue | null>(\n () => (mobileVariant === \"sheet\" ? { showClose, descriptionSlot, setBodySlot, setOwnSlot } : null),\n [mobileVariant, showClose, descriptionSlot],\n )\n const boundary = useFloatingBoundaryScope()\n const setRoot = boundary.setRoot\n const setPanelRef = useCallback((node: HTMLDivElement | null) => { setPanel(node); setRoot(node) }, [setRoot])\n const openedAt = useRef(0)\n const crossesScreen =\n placement === \"bottom\" || placement === \"start\" || placement === \"end\" || placement === \"fullscreen\" || mobilePlacement === \"bottom\" || mobilePlacement === \"fullscreen\"\n\n // The content of a closing dialog is frozen for its exit, so this reads the owner's latest\n // handler: state that changes together with the close decides where focus returns.\n const handleCloseAutoFocus = useStableCallback((event: Event) => {\n onCloseAutoFocus?.(event)\n keepMovedFocus(event)\n })\n\n useEscCloseStack(open, (event) => {\n if (onEscapeKeyDown) {\n const request = cancelableKeyCopy(event)\n onEscapeKeyDown(request)\n if (request.defaultPrevented) return\n }\n setOpen(false)\n })\n\n useEffect(() => {\n if (open) openedAt.current = performance.now()\n }, [open])\n\n useEffect(() => {\n if (!panel || mobilePlacement !== \"bottom\") return undefined\n return attachSheetDrag(panel, () => setOpen(false))\n }, [panel, mobilePlacement, setOpen])\n\n useLayoutEffect(() => {\n if (!panel) return\n const update = () => {\n // A phone Toolbar takes the place of the header or footer bar on its side: one the dialog places itself\n // before the bar its header becomes.\n const header = panel.querySelector<HTMLElement>(`:scope > ${TOP_TOOLBAR}:not([data-dialog-bar])`)\n ?? panel.querySelector<HTMLElement>(`:scope > ${TOP_TOOLBAR}`)\n ?? panel.querySelector<HTMLElement>(`:scope > .${s.Header}`)\n const footer = panel.querySelector<HTMLElement>(`:scope > ${BOTTOM_TOOLBAR}`) ?? panel.querySelector<HTMLElement>(`:scope > .${s.Footer}`)\n panel.style.setProperty(\"--dialog-header-height\", `${header?.offsetHeight ?? 0}px`)\n panel.style.setProperty(\"--dialog-footer-height\", `${footer?.offsetHeight ?? 0}px`)\n }\n const observer = typeof ResizeObserver !== \"undefined\" ? new ResizeObserver(update) : undefined\n const observeBars = () => {\n observer?.disconnect()\n panel.querySelectorAll<HTMLElement>(`:scope > .${s.Header}, :scope > .${s.Footer}, :scope > [data-toolbar]`)\n .forEach((bar) => observer?.observe(bar, { box: \"border-box\" }))\n update()\n }\n observeBars()\n // A form can add or remove its action bar while the dialog stays open.\n const children = new MutationObserver(observeBars)\n children.observe(panel, { childList: true })\n return () => { observer?.disconnect(); children.disconnect() }\n }, [panel])\n\n const layerStyle = toCssVariables({ \"dialog-z-index\": zIndex === undefined ? undefined : String(zIndex) })\n\n return (\n <FloatingBoundaryProvider value={boundary}>\n <PhoneLayoutContext value={phoneLayout}>\n <RadixDialog.Portal forceMount container={outerPhoneLayout?.container ?? undefined}>\n {/* Portaled out of any phone layout, a phone dialog carries its own scope, above its transition: the phone\n rules of the style sheet start there. */}\n <PhoneScope enabled={phoneLayout !== null && !outerPhoneLayout?.container}>\n {/* A dialog mounted open enters too, as `open` set with the mount does */}\n <TransitionGroup\n {...(crossesScreen ? overlayTimingLarge : overlayTiming)}\n {...exitGuard.transition}\n className={s.Transition}\n overlay\n preventInitialTransition={false}\n >\n {open && (\n <div key=\"dialog\">\n <RadixDialog.Overlay\n {...overlayProps}\n ref={overlaySurfaceRef}\n className={clsx(s.Overlay, overlayProps?.className)}\n style={{ ...layerStyle, ...overlayProps?.style }}\n />\n <RadixDialog.Content\n {...dataAttributes(rest)}\n {...rootProps}\n ref={setContent}\n forceMount\n className={clsx(s.Content, rootProps?.className)}\n data-plex-dialog=\"\"\n style={{ ...toCssVariables({ \"dialog-width\": width }), ...layerStyle, ...rootProps?.style }}\n data-placement={placement === \"center\" ? undefined : placement}\n data-mobile-placement={mobilePlacement}\n data-mobile-variant={mobileVariant}\n data-surface={surface}\n data-pill={pill ? \"\" : undefined}\n onEscapeKeyDown={preventDefaultHandler}\n onInteractOutside={(event) => {\n // A press or focus in a toast is not outside: the toast region is a layer above the dialog. The\n // Toaster stops these before Radix sees them; this holds when the Toaster mounted after the dialog.\n if (inToastRegion(event.detail.originalEvent.target)) return event.preventDefault()\n onInteractOutside?.(event)\n if (event.defaultPrevented) return\n // The second click of a double click lands on the overlay: it must not undo the first\n if (performance.now() - openedAt.current < DOUBLE_CLICK) event.preventDefault()\n else exitGuard.onInteractOutside(event)\n }}\n onOpenAutoFocus={onOpenAutoFocus}\n onCloseAutoFocus={handleCloseAutoFocus}\n >\n <div ref={setPanelRef} className={clsx(s.Panel, className)}>\n {showClose && (\n <RadixDialog.Close asChild>\n <NavigationButton action=\"close\" variant=\"ghost\" className={s.CloseButton} aria-label=\"Close dialog\" />\n </RadixDialog.Close>\n )}\n <DialogScrollContext.Provider value={scroll}>\n <DialogSheetContext.Provider value={sheet}>\n {/* A dialog opened from a header action is not inside that header's bar */}\n <DialogBarContext.Provider value={false}>\n <ToolbarHostContext.Provider value={toolbarHost}>{children}</ToolbarHostContext.Provider>\n </DialogBarContext.Provider>\n </DialogSheetContext.Provider>\n </DialogScrollContext.Provider>\n </div>\n </RadixDialog.Content>\n </div>\n )}\n </TransitionGroup>\n </PhoneScope>\n </RadixDialog.Portal>\n </PhoneLayoutContext>\n </FloatingBoundaryProvider>\n )\n}\n\ntype DialogScrollValue = { edges: ScrollEdges; setEdges: (edges: ScrollEdges) => void }\nconst DialogScrollContext = createContext<DialogScrollValue | null>(null)\n// What the header of a Sheet needs from its Content to become the Sheet's bar on a phone\ntype DialogSheetValue = {\n showClose: boolean\n descriptionSlot: HTMLElement | null\n setBodySlot: (slot: HTMLElement | null) => void\n setOwnSlot: (slot: HTMLElement | null) => void\n}\nconst DialogSheetContext = createContext<DialogSheetValue | null>(null)\n// Inside that bar: the title, the description and the header actions take the Toolbar's parts\nconst DialogBarContext = createContext(false)\n\nconst PhoneScope = ({ enabled, children }: { enabled: boolean; children: ReactNode }) =>\n enabled ? <div className={s.PhoneScope} data-plex-layout=\"phone\">{children}</div> : children\n\nconst useDialogViewport = (content: HTMLElement | null, container: HTMLElement | null) => {\n useLayoutEffect(() => (content ? watchDialogViewport(content, container) : undefined), [content, container])\n}\nconst TOP_TOOLBAR = '[data-toolbar][data-placement=\"top\"]'\nconst BOTTOM_TOOLBAR = '[data-toolbar][data-placement=\"bottom\"]'\n\ntype DialogSlotProps = {\n children: ReactNode\n className?: string\n}\n\n/** How a Sheet's bar meets the content scrolled under it; see `BarBackground`. */\nexport type DialogBarBackground = BarBackground\nexport type DialogHeaderProps = DialogSlotProps & {\n /** How the bar meets the content scrolled under it in a phone Sheet. @default \"glass\" */\n background?: DialogBarBackground\n}\n\n// The header's own parts, fragments opened up, so its actions can stand at the end of the bar. A part from a\n// fragment keeps the fragment's key before its own, so two parts never share a key.\nconst headerParts = (children: ReactNode, prefix = \"\"): ReactNode[] =>\n Children.toArray(children).flatMap((part) => {\n if (!isValidElement<{ children?: ReactNode }>(part)) return [part]\n if (part.type === Fragment) return headerParts(part.props.children, `${prefix}${String(part.key)}/`)\n return [prefix ? cloneElement(part, { key: `${prefix}${String(part.key)}` }) : part]\n })\nconst isHeaderAction = (part: ReactNode): part is ReactElement => isValidElement(part) && part.type === HeaderAction\nconst isDescription = (part: ReactNode): part is ReactElement => isValidElement(part) && part.type === Description\n\nconst Header = ({ children, className, background = \"glass\" }: DialogHeaderProps) => {\n const sheet = useContext(DialogSheetContext)\n const phone = usePhoneLayout()\n const scrolled = useContext(DialogScrollContext)?.edges.scrolled\n if (sheet && phone) {\n const parts = headerParts(children)\n const descriptions = parts.filter(isDescription)\n // The description reads as the first text of the content, at the top of Dialog.Body when there is one\n const description = descriptions.length > 0 && <div className={s.SheetDescription}>{descriptions}</div>\n // On a phone the header of a Sheet is its Toolbar (iOS 27 kit Sheets 507-24684, Toolbar - Top - iPhone\n // 1-54520): Close at the leading edge, the title alone centered on the row of controls, the header actions\n // at the trailing edge, all on one 44px row 16px under the top edge.\n return (\n <>\n <Toolbar background={background} className={className} data-dialog-bar=\"\">\n <DialogBarContext.Provider value={true}>\n {sheet.showClose && (\n <Toolbar.Leading className={s.BarClose}>\n <RadixDialog.Close asChild>\n <NavigationButton action=\"close\" variant=\"ghost\" aria-label=\"Close dialog\" />\n </RadixDialog.Close>\n </Toolbar.Leading>\n )}\n <div className={clsx(t.Heading, s.BarHeading)}>{parts.filter((part) => !isHeaderAction(part) && !isDescription(part))}</div>\n {parts.filter(isHeaderAction)}\n </DialogBarContext.Provider>\n </Toolbar>\n {description && (sheet.descriptionSlot ? createPortal(description, sheet.descriptionSlot) : description)}\n </>\n )\n }\n return <div className={clsx(s.Header, className)} data-background={background} data-scrolled={scrolled ? \"\" : undefined}>{children}</div>\n}\n\nconst HeaderAction = ({ children, className }: DialogSlotProps) => {\n const bar = useContext(DialogBarContext)\n if (bar) return <Toolbar.Trailing className={className}>{children}</Toolbar.Trailing>\n return <div className={clsx(s.HeaderAction, className)}>{children}</div>\n}\n\n/** The scrolling part between Header and Footer: with it, only the body scrolls */\nconst Body = ({ children, className }: DialogSlotProps) => {\n const setEdges = useContext(DialogScrollContext)?.setEdges\n const sheet = useContext(DialogSheetContext)\n const phone = usePhoneLayout()\n // A phone Sheet's description starts the body (Dialog.Header portals it here)\n const setDescriptionSlot = sheet && phone ? sheet.setBodySlot : null\n const element = useRef<HTMLDivElement | null>(null)\n useLayoutEffect(() => {\n const body = element.current\n if (!body || !setEdges) return\n const stop = observeScrollEdges(body, setEdges)\n return () => { stop(); setEdges(NO_SCROLL_EDGES) }\n }, [setEdges])\n return (\n <div ref={element} className={clsx(s.Body, className)}>\n {setDescriptionSlot && <div ref={setDescriptionSlot} className={s.SheetDescriptionSlot} />}\n {children}\n </div>\n )\n}\n\n/**\n * Where a phone Sheet's description goes in content of your own, such as a scroller inside a form so that Enter\n * submits: the description starts it, as it starts Dialog.Body, and it comes before the body's place. It renders\n * nothing outside a phone Sheet.\n */\nconst DescriptionSlot = () => {\n const sheet = useContext(DialogSheetContext)\n const phone = usePhoneLayout()\n const setOwnSlot = sheet && phone ? sheet.setOwnSlot : null\n return setOwnSlot ? <div ref={setOwnSlot} className={s.SheetDescriptionSlot} /> : null\n}\n\nexport type DialogFooterProps = DialogSlotProps & {\n /** How the bar meets the content scrolled under it in a phone Sheet. @default \"soft\" */\n background?: DialogBarBackground\n /** Override the mobile action layout. Two alert actions default to inline, three or more and sheets to stacked. */\n mobileLayout?: \"inline\" | \"stacked\"\n}\n\nconst Footer = ({ children, className, mobileLayout, background = \"soft\" }: DialogFooterProps) => {\n const setFooter = useFloatingBoundaryRegistration()?.setFooter\n const contentBelow = useContext(DialogScrollContext)?.edges.contentBelow\n return (\n <div\n ref={setFooter}\n className={clsx(s.Footer, className)}\n data-mobile-layout={mobileLayout}\n data-background={background}\n data-content-below={contentBelow ? \"\" : undefined}\n >\n {children}\n </div>\n )\n}\n\nconst Title = ({ children, className }: DialogSlotProps) => {\n const bar = useContext(DialogBarContext)\n return <RadixDialog.Title className={clsx(bar ? t.Title : s.Title, className)}>{children}</RadixDialog.Title>\n}\n\nconst Description = ({ children, className }: DialogSlotProps) => {\n const bar = useContext(DialogBarContext)\n const element = useRef<HTMLParagraphElement | null>(null)\n const [shown, setShown] = useState(false)\n useLayoutEffect(() => {\n // The header leaves its own descriptions out of the bar. One the bar still holds, inside a part of the\n // header's own, is the title's second line (Toolbar's subtitle) when the reader sees it; one that is only\n // read out, visually hidden, leaves the title on its one line.\n const node = element.current\n // A measurement of the laid-out description, which only an effect after layout can read\n // eslint-disable-next-line react-hooks/set-state-in-effect\n setShown(bar && !!node && node.offsetHeight > 1 && node.offsetWidth > 1)\n }, [bar, children, className])\n return (\n <RadixDialog.Description ref={element} className={clsx(bar && shown ? t.Subtitle : s.Description, className)}>\n {children}\n </RadixDialog.Description>\n )\n}\n\nexport type DialogStepsProps = {\n /** The step on screen. A new value brings its content in. */\n step: string | number\n /**\n * `forward` brings the new step in from the trailing edge over the one before, as a push on iOS; `back` returns to\n * a step before it.\n * @default \"forward\"\n */\n direction?: \"forward\" | \"back\"\n children: ReactNode\n className?: string\n}\n\n/** The steps of a flow inside a dialog, such as a sign-in that asks for an email and then a code. */\nconst Steps = ({ step, direction = \"forward\", children, className }: DialogStepsProps) => (\n <div className={clsx(s.Steps, className)} data-direction={direction}>\n <TransitionGroup {...STEP_TIMING} as=\"div\" overlay className={s.Step} onEnter={enterStep} onExit={leaveStep} onExitActive={settleStepHeight} onExitComplete={releaseStepHeight}>\n <div key={step} data-dialog-step=\"\" tabIndex={-1}>{children}</div>\n </TransitionGroup>\n </div>\n)\n\nconst Close = ({ children }: { children: ReactNode }) => {\n return <RadixDialog.Close asChild>{children}</RadixDialog.Close>\n}\n\nDialog.Trigger = Trigger\nDialog.Content = Content\nDialog.Header = Header\nDialog.HeaderAction = HeaderAction\nDialog.Body = Body\nDialog.Footer = Footer\nDialog.Title = Title\nDialog.Description = Description\nDialog.DescriptionSlot = DescriptionSlot\nDialog.Close = Close\nDialog.Steps = Steps\n"]}
@@ -94,7 +94,7 @@ const InputRoot = (props) => {
94
94
  onAutofill?.();
95
95
  }
96
96
  };
97
- return (_jsxs("div", { className: clsx(s.Container, className), "data-slot": "input", "data-variant": variant, "data-size": size, "data-gutter-size": gutterSize, "data-focused": focused, "data-disabled": disabled ? "" : undefined, "data-readonly": readOnly ? "" : undefined, "data-invalid": invalid ? "" : undefined, "data-pill": pill ? "" : undefined, "data-optically-align": opticallyAlign, "data-has-start-adornment": StartAdornment ? "" : undefined, "data-has-end-adornment": EndAdornment || showClearButton ? "" : undefined, onMouseDown: handleMouseDown, children: [StartAdornment, _jsx("input", { ...restProps, ref: mergeRefs([ref, inputRef]), id: id || (allowAutofillExtensions ? undefined : onePasswordPreventionId), className: s.Input, type: type, autoComplete: autoComplete, "aria-invalid": restProps["aria-invalid"] ?? (invalid || undefined), name: name, value: value, defaultValue: defaultValue, readOnly: readOnly, disabled: disabled, onFocus: (evt) => {
97
+ return (_jsxs("div", { className: clsx(s.Container, className), "data-slot": "input", "data-variant": variant, "data-size": size, "data-gutter-size": gutterSize, "data-focused": focused, "data-disabled": disabled ? "" : undefined, "data-readonly": readOnly ? "" : undefined, "data-invalid": invalid ? "" : undefined, "data-pill": pill ? "" : undefined, "data-optically-align": opticallyAlign, "data-has-start-adornment": StartAdornment ? "" : undefined, "data-has-end-adornment": EndAdornment || showClearButton ? "" : undefined, "data-end-adornment": EndAdornment ? "" : undefined, onMouseDown: handleMouseDown, children: [StartAdornment, _jsx("input", { ...restProps, ref: mergeRefs([ref, inputRef]), id: id || (allowAutofillExtensions ? undefined : onePasswordPreventionId), className: s.Input, type: type, autoComplete: autoComplete, "aria-invalid": restProps["aria-invalid"] ?? (invalid || undefined), name: name, value: value, defaultValue: defaultValue, readOnly: readOnly, disabled: disabled, onFocus: (evt) => {
98
98
  setFocused(true);
99
99
  onFocus?.(evt);
100
100
  }, onBlur: (evt) => {
@@ -1 +1 @@
1
- {"version":3,"file":"Input.js","sourceRoot":"","sources":["../../../../src/components/Input/Input.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACpD,OAAO,EAAmE,MAAM,aAAa,CAAA;AAC7F,OAAO,EAAE,CAAC,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAC1C,OAAO,CAAC,MAAM,kDAAkD,CAAA;AAuEhE,MAAM,SAAS,GAAG,CAAC,KAAiB,EAAE,EAAE;IACtC,MAAM,QAAQ,GAAG,MAAM,CAA0B,IAAI,CAAC,CAAA;IACtD,MAAM,aAAa,GAAG,KAAK,EAAE,CAAA;IAC7B,qGAAqG;IACrG,wDAAwD;IACxD,MAAM,uBAAuB,GAAG,mBAAmB,aAAa,EAAE,CAAA;IAClE,MAAM,EACJ,EAAE,EACF,IAAI,EACJ,IAAI,GAAG,MAAM,EACb,OAAO,GAAG,SAAS,EACnB,IAAI,GAAG,IAAI,EACX,UAAU,EACV,SAAS,EACT,YAAY,EACZ,QAAQ,GAAG,KAAK,EAChB,QAAQ,GAAG,KAAK,EAChB,OAAO,GAAG,KAAK;IACf,+DAA+D;IAC/D,uBAAuB,GAAG,IAAI,KAAK,UAAU,IAAI,CAAC,CAAC,IAAI,EACvD,OAAO,EACP,MAAM,EACN,gBAAgB,EAChB,UAAU,EACV,UAAU,EACV,cAAc,EAAE,cAAc,EAC9B,YAAY,EAAE,YAAY,EAC1B,OAAO,EACP,IAAI,EAAE,QAAQ,EACd,cAAc,EACd,GAAG,EACH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,IAAI,GAAG,QAAQ,EACf,KAAK,EACL,GAAG,EACH,GAAG,SAAS,EACc,EAAE,EAAE,CAAC,CAC/B,iBACE,GAAG,EAAE,GAAG,EACR,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC,eAAe,EAAE,SAAS,CAAC,gBACjC,KAAK,KACb,SAAS,GACb,CACH,CAAA;AAMD,MAAM,CAAC,MAAM,KAAK,GAAG,SAA2B,CAAA;AAChD,KAAK,CAAC,eAAe,GAAG,oBAAoB,CAAA","sourcesContent":["\"use client\"\n\nimport clsx from \"clsx\"\nimport { useEffect, useId, useRef, useState } from \"react\"\nimport { mergeRefs } from \"react-merge-refs\"\nimport { useFieldRowPill } from \"../../lib/fieldRow\"\nimport { type ControlSize, type SemanticColor, type Sizes, type Variants } from \"../../types\"\nimport { X, XCircleFilled } from \"../Icon\"\nimport s from \"@plexui/styles/components/Input/Input.module.css\"\n\nexport type InputProps = {\n /**\n * Visual style of the input\n * @default outline\n */\n variant?: Variants<\"outline\" | \"soft\" | \"ghost\">\n /**\n * Controls the size of the input\n *\n * | 3xs | 2xs | xs | sm | md | lg | xl | 2xl | 3xl |\n * | ------- | ------- | ------- | ------- | ------- | ------- | ------- | ------- | ------- |\n * | `22px` | `24px` | `26px` | `28px` | `32px` | `36px` | `40px` | `44px` | `48px` |\n *\n * @default md\n */\n size?: ControlSize\n /**\n * Controls gutter on the edges of the input, defaults to value from `size`.\n *\n * | 2xs | xs | sm | md | lg | xl |\n * | ------ | ------ | ------ | ------ | ------ | ------ |\n * | `6px` | `8px` | `10px` | `12px` | `14px` | `16px` |\n */\n gutterSize?: Sizes<\"2xs\" | \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\">\n /**\n * Disables the select visually and from interactions\n * @default false\n */\n disabled?: boolean\n /**\n * Mark the input as invalid\n * @default false\n */\n invalid?: boolean\n /**\n * Allow autofill extensions to appear in the input\n * @default false\n */\n allowAutofillExtensions?: boolean\n /**\n * Select all contents of the input when mounted.\n * @default false\n */\n autoSelect?: boolean\n /** Callback invoked when the input is autofilled by the browser */\n onAutofill?: () => void\n /** Content rendered at the start of the input */\n startAdornment?: React.ReactNode\n /** Content rendered at the end of the input */\n endAdornment?: React.ReactNode\n /**\n * Callback invoked when the clear button is clicked.\n * When provided, displays a clear button that appears when the input has a value.\n */\n onClear?: () => void\n /**\n * Determines if the button should be a fully rounded pill shape\n * @default false, or true at the end of a `Field row`\n */\n pill?: boolean\n /**\n * Applies a negative margin using the current gutter to optically align the input\n * with surrounding content.\n */\n opticallyAlign?: \"start\" | \"end\"\n /** Ref for the input */\n ref?: React.Ref<HTMLInputElement | null>\n} & Omit<React.InputHTMLAttributes<HTMLInputElement>, \"disabled\" | \"size\">\n\nconst InputRoot = (props: InputProps) => {\n const inputRef = useRef<HTMLInputElement | null>(null)\n const inputIdSuffix = useId()\n // Prevent 1Password from appearing: 1Password won't display if it thinks this field is for searching\n // Allow user to override this for connecting to labels.\n const onePasswordPreventionId = `search-ui-input-${inputIdSuffix}`\n const {\n id,\n name,\n type = \"text\",\n variant = \"outline\",\n size = \"md\",\n gutterSize,\n className,\n autoComplete,\n disabled = false,\n readOnly = false,\n invalid = false,\n // Default to `true` when type=\"password\" or presence of `name`\n allowAutofillExtensions = type === \"password\" || !!name,\n onFocus,\n onBlur,\n onAnimationStart,\n onAutofill,\n autoSelect,\n startAdornment: StartAdornment,\n endAdornment: EndAdornment,\n onClear,\n pill: pillProp,\n opticallyAlign,\n ref,\n value,\n defaultValue,\n ...restProps\n } = props\n const pill = useFieldRowPill(pillProp)\n\n // Determine if clear button should be shown\n const hasValue = String((value !== undefined ? value : defaultValue) ?? \"\") !== \"\"\n const showClearButton = !!onClear && hasValue && !disabled && !readOnly\n // Redirect clicks on the container and adornments\n const handleMouseDown = (evt: React.MouseEvent<HTMLDivElement>) => {\n const input = inputRef.current\n // Bail out if the target is not an element or the textarea is not found\n if (!evt.target || !(evt.target instanceof Element) || !input) {\n return\n }\n // Bail out if the target is inside the textarea\n if (input.contains(evt.target)) {\n return\n }\n // Bail out if the target is a button\n if (evt.target.closest(\"button, [type='button'], [role='button'], [role='menuitem']\")) {\n return\n }\n\n evt.preventDefault()\n // If the textarea is not focused, focus it\n if (document.activeElement !== input) {\n input.focus()\n }\n\n const { left, top } = input.getBoundingClientRect()\n const { clientX, clientY } = evt\n // \"Before\" the input: top/left\n const isBefore = clientY < top || clientX < left\n // email, number and other types without the selection API throw on setSelectionRange\n const hasSelection = input.selectionStart !== null\n\n // If this is the first click, clear the selection.\n if (evt.detail === 1) {\n if (!hasSelection) return\n if (isBefore) {\n input.setSelectionRange(0, 0)\n } else {\n const length = input.value.length\n input.setSelectionRange(length, length)\n }\n }\n // If this is the second click, select the first or last word\n else if (evt.detail === 2) {\n if (!hasSelection) return\n // Split the textarea value into words and non-word characters\n const words = input.value.match(/\\w+|[^\\w\\s]/g) || []\n const selectedWord = isBefore ? words.at(0) : words.at(-1)\n if (selectedWord) {\n const wordIndex = isBefore\n ? input.value.indexOf(selectedWord)\n : input.value.lastIndexOf(selectedWord)\n input.setSelectionRange(wordIndex, wordIndex + selectedWord.length)\n }\n }\n // If this is the third click or greater, select the entire input\n else {\n input.select()\n }\n }\n\n const [focused, setFocused] = useState<boolean>(false)\n\n useEffect(() => {\n if (autoSelect) {\n inputRef.current?.select()\n }\n }, [autoSelect])\n\n // The clear button unmounts once the value is gone, so keep focus in the input\n const handleClear = (evt: React.MouseEvent<HTMLButtonElement>) => {\n inputRef.current?.focus()\n ;(onClear as React.MouseEventHandler<HTMLButtonElement> | undefined)?.(evt)\n }\n\n const handleAnimationStart = (evt: React.AnimationEvent<HTMLInputElement>) => {\n onAnimationStart?.(evt)\n if (evt.animationName === \"native-autofill-in\") {\n onAutofill?.()\n }\n }\n\n return (\n <div\n className={clsx(s.Container, className)}\n data-slot=\"input\"\n data-variant={variant}\n data-size={size}\n data-gutter-size={gutterSize}\n data-focused={focused}\n data-disabled={disabled ? \"\" : undefined}\n data-readonly={readOnly ? \"\" : undefined}\n data-invalid={invalid ? \"\" : undefined}\n data-pill={pill ? \"\" : undefined}\n data-optically-align={opticallyAlign}\n data-has-start-adornment={StartAdornment ? \"\" : undefined}\n data-has-end-adornment={EndAdornment || showClearButton ? \"\" : undefined}\n onMouseDown={handleMouseDown}\n >\n {StartAdornment}\n <input\n {...restProps}\n ref={mergeRefs([ref, inputRef])}\n id={id || (allowAutofillExtensions ? undefined : onePasswordPreventionId)}\n className={s.Input}\n type={type}\n autoComplete={autoComplete}\n // Expose the visual invalid state to assistive tech; an explicit aria-invalid wins\n aria-invalid={restProps[\"aria-invalid\"] ?? (invalid || undefined)}\n name={name}\n value={value}\n defaultValue={defaultValue}\n readOnly={readOnly}\n disabled={disabled}\n onFocus={(evt) => {\n setFocused(true)\n onFocus?.(evt)\n }}\n onBlur={(evt) => {\n setFocused(false)\n onBlur?.(evt)\n }}\n onAnimationStart={handleAnimationStart}\n // Prevent LastPass and 1Password from appearing\n data-lpignore={allowAutofillExtensions ? undefined : true}\n data-1p-ignore={allowAutofillExtensions ? undefined : true}\n />\n {showClearButton && (\n <button type=\"button\" aria-label=\"Clear input\" className={s.Clear} onClick={handleClear}>\n <X className={s.ClearIcon} />\n <XCircleFilled className={s.ClearPhoneIcon} />\n </button>\n )}\n {EndAdornment}\n </div>\n )\n}\n\n/* ------------------------------------------------------------------ */\n/* AdornmentButton — canonical inline action button for Input slots */\n/* (mic toggle, visibility toggle, copy, etc.). Sizes itself off the */\n/* parent Input via --input-clear-size / --input-clear-pill-offset */\n/* so it stays visually consistent with the built-in clear button. */\n/* ------------------------------------------------------------------ */\n\nexport type InputAdornmentButtonProps = Omit<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n \"ref\" | \"color\"\n> & {\n ref?: React.Ref<HTMLButtonElement>\n /**\n * Applies a semantic color tint to the pressed (`aria-pressed=\"true\"`) state\n * — the same palette Button accepts. Default `aria-pressed` keeps the\n * neutral primary-soft tint.\n */\n color?: SemanticColor\n}\n\nconst InputAdornmentButton = ({\n className,\n type = \"button\",\n color,\n ref,\n ...restProps\n}: InputAdornmentButtonProps) => (\n <button\n ref={ref}\n type={type}\n className={clsx(s.AdornmentButton, className)}\n data-color={color}\n {...restProps}\n />\n)\n\ntype InputComponent = typeof InputRoot & {\n AdornmentButton: typeof InputAdornmentButton\n}\n\nexport const Input = InputRoot as InputComponent\nInput.AdornmentButton = InputAdornmentButton\n"]}
1
+ {"version":3,"file":"Input.js","sourceRoot":"","sources":["../../../../src/components/Input/Input.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACpD,OAAO,EAAmE,MAAM,aAAa,CAAA;AAC7F,OAAO,EAAE,CAAC,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAC1C,OAAO,CAAC,MAAM,kDAAkD,CAAA;AAuEhE,MAAM,SAAS,GAAG,CAAC,KAAiB,EAAE,EAAE;IACtC,MAAM,QAAQ,GAAG,MAAM,CAA0B,IAAI,CAAC,CAAA;IACtD,MAAM,aAAa,GAAG,KAAK,EAAE,CAAA;IAC7B,qGAAqG;IACrG,wDAAwD;IACxD,MAAM,uBAAuB,GAAG,mBAAmB,aAAa,EAAE,CAAA;IAClE,MAAM,EACJ,EAAE,EACF,IAAI,EACJ,IAAI,GAAG,MAAM,EACb,OAAO,GAAG,SAAS,EACnB,IAAI,GAAG,IAAI,EACX,UAAU,EACV,SAAS,EACT,YAAY,EACZ,QAAQ,GAAG,KAAK,EAChB,QAAQ,GAAG,KAAK,EAChB,OAAO,GAAG,KAAK;IACf,+DAA+D;IAC/D,uBAAuB,GAAG,IAAI,KAAK,UAAU,IAAI,CAAC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,OAAO,EAAE,WAAW,aACrF,KAAC,CAAC,IAAC,SAAS,EAAE,CAAC,CAAC,SAAS,GAAI,EAC7B,KAAC,aAAa,IAAC,SAAS,EAAE,CAAC,CAAC,cAAc,GAAI,IACvC,CACV,EACA,YAAY,IACT,CACP,CAAA;AACH,CAAC,CAAA;AAsBD,MAAM,oBAAoB,GAAG,CAAC,EAC5B,SAAS,EACT,IAAI,GAAG,QAAQ,EACf,KAAK,EACL,GAAG,EACH,GAAG,SAAS,EACc,EAAE,EAAE,CAAC,CAC/B,iBACE,GAAG,EAAE,GAAG,EACR,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC,eAAe,EAAE,SAAS,CAAC,gBACjC,KAAK,KACb,SAAS,GACb,CACH,CAAA;AAMD,MAAM,CAAC,MAAM,KAAK,GAAG,SAA2B,CAAA;AAChD,KAAK,CAAC,eAAe,GAAG,oBAAoB,CAAA","sourcesContent":["\"use client\"\n\nimport clsx from \"clsx\"\nimport { useEffect, useId, useRef, useState } from \"react\"\nimport { mergeRefs } from \"react-merge-refs\"\nimport { useFieldRowPill } from \"../../lib/fieldRow\"\nimport { type ControlSize, type SemanticColor, type Sizes, type Variants } from \"../../types\"\nimport { X, XCircleFilled } from \"../Icon\"\nimport s from \"@plexui/styles/components/Input/Input.module.css\"\n\nexport type InputProps = {\n /**\n * Visual style of the input\n * @default outline\n */\n variant?: Variants<\"outline\" | \"soft\" | \"ghost\">\n /**\n * Controls the size of the input\n *\n * | 3xs | 2xs | xs | sm | md | lg | xl | 2xl | 3xl |\n * | ------- | ------- | ------- | ------- | ------- | ------- | ------- | ------- | ------- |\n * | `22px` | `24px` | `26px` | `28px` | `32px` | `36px` | `40px` | `44px` | `48px` |\n *\n * @default md\n */\n size?: ControlSize\n /**\n * Controls gutter on the edges of the input, defaults to value from `size`.\n *\n * | 2xs | xs | sm | md | lg | xl |\n * | ------ | ------ | ------ | ------ | ------ | ------ |\n * | `6px` | `8px` | `10px` | `12px` | `14px` | `16px` |\n */\n gutterSize?: Sizes<\"2xs\" | \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\">\n /**\n * Disables the select visually and from interactions\n * @default false\n */\n disabled?: boolean\n /**\n * Mark the input as invalid\n * @default false\n */\n invalid?: boolean\n /**\n * Allow autofill extensions to appear in the input\n * @default false\n */\n allowAutofillExtensions?: boolean\n /**\n * Select all contents of the input when mounted.\n * @default false\n */\n autoSelect?: boolean\n /** Callback invoked when the input is autofilled by the browser */\n onAutofill?: () => void\n /** Content rendered at the start of the input */\n startAdornment?: React.ReactNode\n /** Content rendered at the end of the input */\n endAdornment?: React.ReactNode\n /**\n * Callback invoked when the clear button is clicked.\n * When provided, displays a clear button that appears when the input has a value.\n */\n onClear?: () => void\n /**\n * Determines if the button should be a fully rounded pill shape\n * @default false, or true at the end of a `Field row`\n */\n pill?: boolean\n /**\n * Applies a negative margin using the current gutter to optically align the input\n * with surrounding content.\n */\n opticallyAlign?: \"start\" | \"end\"\n /** Ref for the input */\n ref?: React.Ref<HTMLInputElement | null>\n} & Omit<React.InputHTMLAttributes<HTMLInputElement>, \"disabled\" | \"size\">\n\nconst InputRoot = (props: InputProps) => {\n const inputRef = useRef<HTMLInputElement | null>(null)\n const inputIdSuffix = useId()\n // Prevent 1Password from appearing: 1Password won't display if it thinks this field is for searching\n // Allow user to override this for connecting to labels.\n const onePasswordPreventionId = `search-ui-input-${inputIdSuffix}`\n const {\n id,\n name,\n type = \"text\",\n variant = \"outline\",\n size = \"md\",\n gutterSize,\n className,\n autoComplete,\n disabled = false,\n readOnly = false,\n invalid = false,\n // Default to `true` when type=\"password\" or presence of `name`\n allowAutofillExtensions = type === \"password\" || !!name,\n onFocus,\n onBlur,\n onAnimationStart,\n onAutofill,\n autoSelect,\n startAdornment: StartAdornment,\n endAdornment: EndAdornment,\n onClear,\n pill: pillProp,\n opticallyAlign,\n ref,\n value,\n defaultValue,\n ...restProps\n } = props\n const pill = useFieldRowPill(pillProp)\n\n // Determine if clear button should be shown\n const hasValue = String((value !== undefined ? value : defaultValue) ?? \"\") !== \"\"\n const showClearButton = !!onClear && hasValue && !disabled && !readOnly\n // Redirect clicks on the container and adornments\n const handleMouseDown = (evt: React.MouseEvent<HTMLDivElement>) => {\n const input = inputRef.current\n // Bail out if the target is not an element or the textarea is not found\n if (!evt.target || !(evt.target instanceof Element) || !input) {\n return\n }\n // Bail out if the target is inside the textarea\n if (input.contains(evt.target)) {\n return\n }\n // Bail out if the target is a button\n if (evt.target.closest(\"button, [type='button'], [role='button'], [role='menuitem']\")) {\n return\n }\n\n evt.preventDefault()\n // If the textarea is not focused, focus it\n if (document.activeElement !== input) {\n input.focus()\n }\n\n const { left, top } = input.getBoundingClientRect()\n const { clientX, clientY } = evt\n // \"Before\" the input: top/left\n const isBefore = clientY < top || clientX < left\n // email, number and other types without the selection API throw on setSelectionRange\n const hasSelection = input.selectionStart !== null\n\n // If this is the first click, clear the selection.\n if (evt.detail === 1) {\n if (!hasSelection) return\n if (isBefore) {\n input.setSelectionRange(0, 0)\n } else {\n const length = input.value.length\n input.setSelectionRange(length, length)\n }\n }\n // If this is the second click, select the first or last word\n else if (evt.detail === 2) {\n if (!hasSelection) return\n // Split the textarea value into words and non-word characters\n const words = input.value.match(/\\w+|[^\\w\\s]/g) || []\n const selectedWord = isBefore ? words.at(0) : words.at(-1)\n if (selectedWord) {\n const wordIndex = isBefore\n ? input.value.indexOf(selectedWord)\n : input.value.lastIndexOf(selectedWord)\n input.setSelectionRange(wordIndex, wordIndex + selectedWord.length)\n }\n }\n // If this is the third click or greater, select the entire input\n else {\n input.select()\n }\n }\n\n const [focused, setFocused] = useState<boolean>(false)\n\n useEffect(() => {\n if (autoSelect) {\n inputRef.current?.select()\n }\n }, [autoSelect])\n\n // The clear button unmounts once the value is gone, so keep focus in the input\n const handleClear = (evt: React.MouseEvent<HTMLButtonElement>) => {\n inputRef.current?.focus()\n ;(onClear as React.MouseEventHandler<HTMLButtonElement> | undefined)?.(evt)\n }\n\n const handleAnimationStart = (evt: React.AnimationEvent<HTMLInputElement>) => {\n onAnimationStart?.(evt)\n if (evt.animationName === \"native-autofill-in\") {\n onAutofill?.()\n }\n }\n\n return (\n <div\n className={clsx(s.Container, className)}\n data-slot=\"input\"\n data-variant={variant}\n data-size={size}\n data-gutter-size={gutterSize}\n data-focused={focused}\n data-disabled={disabled ? \"\" : undefined}\n data-readonly={readOnly ? \"\" : undefined}\n data-invalid={invalid ? \"\" : undefined}\n data-pill={pill ? \"\" : undefined}\n data-optically-align={opticallyAlign}\n data-has-start-adornment={StartAdornment ? \"\" : undefined}\n data-has-end-adornment={EndAdornment || showClearButton ? \"\" : undefined}\n // Only an end adornment, not the clear button: the phone rules place the clear button at the field's end\n // when nothing follows it, a text adornment too (`:last-child` does not see text)\n data-end-adornment={EndAdornment ? \"\" : undefined}\n onMouseDown={handleMouseDown}\n >\n {StartAdornment}\n <input\n {...restProps}\n ref={mergeRefs([ref, inputRef])}\n id={id || (allowAutofillExtensions ? undefined : onePasswordPreventionId)}\n className={s.Input}\n type={type}\n autoComplete={autoComplete}\n // Expose the visual invalid state to assistive tech; an explicit aria-invalid wins\n aria-invalid={restProps[\"aria-invalid\"] ?? (invalid || undefined)}\n name={name}\n value={value}\n defaultValue={defaultValue}\n readOnly={readOnly}\n disabled={disabled}\n onFocus={(evt) => {\n setFocused(true)\n onFocus?.(evt)\n }}\n onBlur={(evt) => {\n setFocused(false)\n onBlur?.(evt)\n }}\n onAnimationStart={handleAnimationStart}\n // Prevent LastPass and 1Password from appearing\n data-lpignore={allowAutofillExtensions ? undefined : true}\n data-1p-ignore={allowAutofillExtensions ? undefined : true}\n />\n {showClearButton && (\n <button type=\"button\" aria-label=\"Clear input\" className={s.Clear} onClick={handleClear}>\n <X className={s.ClearIcon} />\n <XCircleFilled className={s.ClearPhoneIcon} />\n </button>\n )}\n {EndAdornment}\n </div>\n )\n}\n\n/* ------------------------------------------------------------------ */\n/* AdornmentButton — canonical inline action button for Input slots */\n/* (mic toggle, visibility toggle, copy, etc.). Sizes itself off the */\n/* parent Input via --input-clear-size / --input-clear-pill-offset */\n/* so it stays visually consistent with the built-in clear button. */\n/* ------------------------------------------------------------------ */\n\nexport type InputAdornmentButtonProps = Omit<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n \"ref\" | \"color\"\n> & {\n ref?: React.Ref<HTMLButtonElement>\n /**\n * Applies a semantic color tint to the pressed (`aria-pressed=\"true\"`) state\n * — the same palette Button accepts. Default `aria-pressed` keeps the\n * neutral primary-soft tint.\n */\n color?: SemanticColor\n}\n\nconst InputAdornmentButton = ({\n className,\n type = \"button\",\n color,\n ref,\n ...restProps\n}: InputAdornmentButtonProps) => (\n <button\n ref={ref}\n type={type}\n className={clsx(s.AdornmentButton, className)}\n data-color={color}\n {...restProps}\n />\n)\n\ntype InputComponent = typeof InputRoot & {\n AdornmentButton: typeof InputAdornmentButton\n}\n\nexport const Input = InputRoot as InputComponent\nInput.AdornmentButton = InputAdornmentButton\n"]}
@@ -11,7 +11,7 @@ import { captureInitialPhoneSubmenuFocus, completeInitialPhoneSubmenuFocus, dele
11
11
  import { useEscCloseStack } from "../../hooks/useEscCloseStack.js";
12
12
  import { useLatestValue } from "../../hooks/useLatestValue.js";
13
13
  import { keepMovedFocus, preventDefaultHandler, toCssVariables } from "../../lib/helpers.js";
14
- import { ignoreReleaseOverTrigger, observeMenuTriggerCover } from "../../lib/menuTriggerCover.js";
14
+ import { ignoreReleaseOverTrigger, markCoveredMenuTrigger, observeMenuTriggerCover } from "../../lib/menuTriggerCover.js";
15
15
  import { Button } from "../Button/index.js";
16
16
  import { Check, ChevronDown, ChevronRight } from "../Icon/index.js";
17
17
  import { PhoneLayoutContext } from "../PhoneLayout/PhoneLayout.js";
@@ -219,6 +219,13 @@ const RootMenuContent = DropdownMenu.Content;
219
219
  const Content = ({ children, side, sideOffset, align, alignOffset, width, minWidth, maxHeight, pill = false, layout = "vertical", size, onCloseAutoFocus, onOpenAutoFocus, }) => {
220
220
  const { open, prepareFocusRestore, triggerElement, modal } = useMenuContext();
221
221
  const contentRef = useRef(null);
222
+ // The panel's node as state too: it mounts after the trigger's cover is known, and again when the phone layout moves
223
+ // the portal, so the effect that hides the covered trigger reruns with the node that is on screen
224
+ const [contentElement, setContentElement] = useState(null);
225
+ const setContent = useCallback((node) => {
226
+ contentRef.current = node;
227
+ setContentElement(node);
228
+ }, []);
222
229
  const interactedOutside = useRef(false);
223
230
  const phoneLayout = useMenuPhoneLayout(open);
224
231
  const floatingBoundary = phoneLayout.boundary;
@@ -232,6 +239,12 @@ const Content = ({ children, side, sideOffset, align, alignOffset, width, minWid
232
239
  return observeMenuTriggerCover(triggerElement, setTriggerCover);
233
240
  }, [coversTrigger, triggerElement]);
234
241
  const cover = coversTrigger ? triggerCover : null;
242
+ // A trigger the panel covers whole is hidden while it is open, as iOS turns a bar button into its menu
243
+ useLayoutEffect(() => {
244
+ if (!cover || !triggerElement || !contentElement)
245
+ return;
246
+ return markCoveredMenuTrigger(triggerElement, contentElement);
247
+ }, [cover, triggerElement, contentElement]);
235
248
  const [exitGuard] = useState(createExitGuard);
236
249
  const isHorizontal = layout === "horizontal";
237
250
  // The content of a closing menu is frozen for its exit, so this reads the owner's latest handler.
@@ -273,7 +286,7 @@ const Content = ({ children, side, sideOffset, align, alignOffset, width, minWid
273
286
  if (!modal || isRightClick)
274
287
  interactedOutside.current = true;
275
288
  };
276
- return (_jsx(DropdownMenu.Portal, { forceMount: true, container: phoneLayout.container, children: _jsx(PhoneScope, { enabled: phoneLayout.scoped, children: _jsx(TransitionGroup, { className: s.Menu, ...overlayTiming, ...exitGuard.transition, overlay: true, children: open && (_jsx(RootMenuContent, { ref: contentRef, onOpenAutoFocus: (event) => {
289
+ return (_jsx(DropdownMenu.Portal, { forceMount: true, container: phoneLayout.container, children: _jsx(PhoneScope, { enabled: phoneLayout.scoped, children: _jsx(TransitionGroup, { className: s.Menu, ...overlayTiming, ...exitGuard.transition, overlay: true, children: open && (_jsx(RootMenuContent, { ref: setContent, onOpenAutoFocus: (event) => {
277
290
  onOpenAutoFocus?.(event);
278
291
  delegateInitialPhoneSubmenuFocus(event, contentRef.current);
279
292
  }, forceMount: true, className: s.MenuList, "data-pill": pill ? "" : undefined, side: side ?? cover?.side, sideOffset: cover ? cover.sideOffset : sideOffset ?? 5, align: align, alignOffset: alignOffset ?? (cover || align === "center" ? 0 : -5), avoidCollisions: true, ...floatingBoundary, onEscapeKeyDown: preventDefaultHandler, onInteractOutside: handleInteractOutside, onCloseAutoFocus: handleCloseAutoFocus, "data-layout": isHorizontal ? "horizontal" : undefined, "data-size": isHorizontal && size ? size : undefined, style: toCssVariables({