@plexui/vue 0.21.0 → 0.23.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 (81) hide show
  1. package/dist/es/components/Alert/Alert.js +16 -4
  2. package/dist/es/components/Alert/Alert.js.map +1 -1
  3. package/dist/es/components/ColorPicker/ColorPicker.js +13 -9
  4. package/dist/es/components/ColorPicker/ColorPicker.js.map +1 -1
  5. package/dist/es/components/ColorPicker/ColorWell.js +5 -3
  6. package/dist/es/components/ColorPicker/ColorWell.js.map +1 -1
  7. package/dist/es/components/ColorPicker/shared.js +5 -4
  8. package/dist/es/components/ColorPicker/shared.js.map +1 -1
  9. package/dist/es/components/ContextMenu/ContextMenu.js +9 -9
  10. package/dist/es/components/ContextMenu/ContextMenu.js.map +1 -1
  11. package/dist/es/components/ContextMenu/shared.js +25 -5
  12. package/dist/es/components/ContextMenu/shared.js.map +1 -1
  13. package/dist/es/components/DataTable/columnHelpers.js +88 -6
  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 +2 -2
  22. package/dist/es/components/Dialog/Dialog.js.map +1 -1
  23. package/dist/es/components/Input/Input.js +3 -0
  24. package/dist/es/components/Input/Input.js.map +1 -1
  25. package/dist/es/components/Menu/Menu.js +10 -1
  26. package/dist/es/components/Menu/Menu.js.map +1 -1
  27. package/dist/es/components/PhoneLayout/PhoneLayout.js +9 -1
  28. package/dist/es/components/PhoneLayout/PhoneLayout.js.map +1 -1
  29. package/dist/es/components/Popover/Popover.js +2 -2
  30. package/dist/es/components/Popover/Popover.js.map +1 -1
  31. package/dist/es/components/ProgressSteps/ProgressSteps.js +7 -3
  32. package/dist/es/components/ProgressSteps/ProgressSteps.js.map +1 -1
  33. package/dist/es/components/ProgressSteps/index.js.map +1 -1
  34. package/dist/es/components/Select/Select.js +178 -32
  35. package/dist/es/components/Select/Select.js.map +1 -1
  36. package/dist/es/components/SelectControl/SelectControl.js +3 -1
  37. package/dist/es/components/SelectControl/SelectControl.js.map +1 -1
  38. package/dist/es/components/Slider/Slider.js +24 -11
  39. package/dist/es/components/Slider/Slider.js.map +1 -1
  40. package/dist/es/components/Slider/sliderPrimitive.js +5 -2
  41. package/dist/es/components/Slider/sliderPrimitive.js.map +1 -1
  42. package/dist/es/components/Sortable/Sortable.js +1 -1
  43. package/dist/es/components/Sortable/Sortable.js.map +1 -1
  44. package/dist/es/components/StatCard/index.js +4 -1
  45. package/dist/es/components/StatCard/index.js.map +1 -1
  46. package/dist/es/components/{StatCard/StatCard.js → StatsCard/StatsCard.js} +32 -27
  47. package/dist/es/components/StatsCard/StatsCard.js.map +1 -0
  48. package/dist/es/components/StatsCard/index.js +2 -0
  49. package/dist/es/components/StatsCard/index.js.map +1 -0
  50. package/dist/es/components/SwipeActions/SwipeActions.js +32 -5
  51. package/dist/es/components/SwipeActions/SwipeActions.js.map +1 -1
  52. package/dist/es/components/TabBar/TabBar.js +52 -21
  53. package/dist/es/components/TabBar/TabBar.js.map +1 -1
  54. package/dist/es/components/Tabs/Tabs.js +229 -6
  55. package/dist/es/components/Tabs/Tabs.js.map +1 -1
  56. package/dist/es/components/Toolbar/Toolbar.js.map +1 -1
  57. package/dist/es/lib/menuTriggerCover.js +40 -3
  58. package/dist/es/lib/menuTriggerCover.js.map +1 -1
  59. package/dist/types/components/ColorPicker/ColorPicker.d.ts +3 -2
  60. package/dist/types/components/ColorPicker/shared.d.ts +5 -4
  61. package/dist/types/components/ContextMenu/shared.d.ts +28 -6
  62. package/dist/types/components/DatePicker/useCalendarCollisionPadding.d.ts +9 -0
  63. package/dist/types/components/Dialog/Dialog.d.ts +2 -2
  64. package/dist/types/components/PhoneLayout/PhoneLayout.d.ts +5 -0
  65. package/dist/types/components/Popover/Popover.d.ts +5 -5
  66. package/dist/types/components/ProgressSteps/ProgressSteps.d.ts +17 -3
  67. package/dist/types/components/ProgressSteps/index.d.ts +1 -1
  68. package/dist/types/components/Select/Select.d.ts +19 -8
  69. package/dist/types/components/StatCard/index.d.ts +9 -1
  70. package/dist/types/components/{StatCard/StatCard.d.ts → StatsCard/StatsCard.d.ts} +19 -19
  71. package/dist/types/components/StatsCard/index.d.ts +1 -0
  72. package/dist/types/components/SwipeActions/SwipeActions.d.ts +4 -4
  73. package/dist/types/components/TabBar/TabBar.d.ts +34 -0
  74. package/dist/types/components/Tabs/Tabs.d.ts +33 -2
  75. package/dist/types/components/Toolbar/Toolbar.d.ts +1 -1
  76. package/dist/types/lib/menuTriggerCover.d.ts +16 -2
  77. package/package.json +2 -2
  78. package/dist/es/components/DatePicker/useCalendarGutter.js +0 -14
  79. package/dist/es/components/DatePicker/useCalendarGutter.js.map +0 -1
  80. package/dist/es/components/StatCard/StatCard.js.map +0 -1
  81. package/dist/types/components/DatePicker/useCalendarGutter.d.ts +0 -2
@@ -1,7 +1,8 @@
1
1
  import clsx from "clsx";
2
- import { cloneVNode, computed, createCommentVNode, defineComponent, h, inject, markRaw, nextTick, onBeforeUnmount, onBeforeUpdate, onMounted, provide, ref, shallowRef, toRaw, useId, watch, } from "vue";
2
+ import { cloneVNode, computed, createCommentVNode, defineComponent, h, inject, markRaw, nextTick, onBeforeUnmount, onBeforeUpdate, onMounted, provide, ref, shallowRef, toRaw, useId, watch, watchEffect, } from "vue";
3
3
  import { PopoverAnchor as RekaPopoverAnchor, PopoverContent as RekaPopoverContent, PopoverPortal as RekaPopoverPortal, PopoverRoot as RekaPopoverRoot, injectPopoverRootContext, useId as useRekaId, } from "reka-ui";
4
4
  import { useEscCloseStack } from "../../composables/useEscCloseStack.js";
5
+ import { usePhoneWindow } from "../PhoneLayout/PhoneLayout.js";
5
6
  import { useFieldColumns, useFieldRow, useFieldRowPill } from "../../lib/fieldRow.js";
6
7
  import { preventDefaultHandler, toCssVariables, waitForAnimationFrame } from "../../lib/helpers.js";
7
8
  import { Check, Info, Search } from "../Icon/index.js";
@@ -17,6 +18,7 @@ import { overlayTiming } from "../Transition/shared.js";
17
18
  import { isHoverPointer } from "../../lib/inputMode.js";
18
19
  import { createSelectPress } from "../../lib/selectPress.js";
19
20
  import { createFocusRestore } from "../../lib/focusRestore.js";
21
+ import { ignoreReleaseOverTrigger, markCoveredMenuTrigger, observeMenuTriggerCover } from "../../lib/menuTriggerCover.js";
20
22
  import { useFloatingBoundary } from "../../composables/useFloatingBoundary.js";
21
23
  import s from "@plexui/styles/components/Select/Select.module.css";
22
24
  const selectProps = {
@@ -64,12 +66,14 @@ const selectProps = {
64
66
  triggerClassName: String,
65
67
  /** Applies a negative margin using the current gutter to optically align the trigger. */
66
68
  opticallyAlign: String,
67
- /** Display a clear action that allows the select to be unset. @default false */
69
+ /** Display a clear action that allows the select to be unset. On a phone it is the first row of the list, `noneLabel`, as an iOS pop-up button unsets its value with a None row instead of a clear button; a custom `trigger` keeps its own clearing and gets no None row. @default false */
68
70
  clearable: { type: Boolean, default: false },
71
+ /** Label of the row that unsets a `clearable` select on a phone. @default "None" */
72
+ noneLabel: { type: String, default: "None" },
69
73
  /** Extends select to 100% of available width. @default true, except for the ghost variant */
70
74
  block: { type: Boolean, default: undefined },
71
- /** Preferred side of the trigger to render against when open. @default "bottom" */
72
- side: { type: String, default: "bottom" },
75
+ /** Preferred side of the trigger to render against when open. Without one the list opens below its trigger, and on a phone over it, toward the larger part of the screen. @default "bottom" */
76
+ side: { type: String, default: undefined },
73
77
  /** Preferred alignment against the trigger. @default "end" at the end of a `Field row` ("start" in a `FieldGroup columns`), "center" when block, otherwise "start" */
74
78
  align: String,
75
79
  /** Offset in pixels from the "start" or "end" alignment. @default 0 */
@@ -88,7 +92,7 @@ const selectProps = {
88
92
  searchPlaceholder: { type: String, default: "" },
89
93
  /** Accessible name of the search input, independent of the trigger label. @default "Search options" */
90
94
  searchAriaLabel: { type: String, default: "Search options" },
91
- /** Size of the search input in the menu, such as `2xl` for 44px touch targets on phones. @default "md" */
95
+ /** Size of the search input in the menu. A phone list has no search: it is an iOS menu, and a long one scrolls. @default "md" */
92
96
  searchSize: String,
93
97
  /** Message displayed when search results are empty (or the `#searchEmptyMessage` slot) */
94
98
  searchEmptyMessage: { type: [String, Number, Object], default: "No results found." },
@@ -206,8 +210,11 @@ const SelectComponent = defineComponent({
206
210
  ? options.reduce((acc, group) => acc + group.options.length, 0)
207
211
  : options.length;
208
212
  });
209
- // Locking down searchable count to a single value
210
- const searchable = computed(() => optionsCount.value > 15);
213
+ // Locking down searchable count to a single value. A phone's list is an iOS menu, and a menu has no search: a long
214
+ // list scrolls (iOS-menu IMG_5490, Add Payment's Province, 52 options), so it opens with no keyboard either. The
215
+ // window decides, as for the list's place: the list is portaled out of any PhoneLayout.
216
+ const phone = usePhoneWindow();
217
+ const searchable = computed(() => optionsCount.value > 15 && !phone.value);
211
218
  // A block menu matches its field. An inline one, or one at the end of a Field row, fits its
212
219
  // options: no narrower than its trigger (the CSS fallback reads the trigger width), no wider than 300px.
213
220
  const fitsOptions = computed(() => (!block.value || inRow.value) && props.listWidth === undefined);
@@ -217,6 +224,13 @@ const SelectComponent = defineComponent({
217
224
  onBeforeUpdate(() => {
218
225
  slotsVersion.value++;
219
226
  });
227
+ // An iOS pop-up button has no clear button: its value is unset by a None row, first in the list and in a section
228
+ // of its own, checked while nothing is chosen (Reminders' Early Reminder, iOS-menu IMG_5821). The window decides,
229
+ // as for the search. A custom trigger owns its clearing, so only the default one gives its clear button to the row.
230
+ const noneRow = computed(() => {
231
+ void slotsVersion.value;
232
+ return props.clearable && phone.value && !(slots.trigger || props.trigger);
233
+ });
220
234
  provide(SelectContextKey, {
221
235
  props,
222
236
  slots,
@@ -230,6 +244,7 @@ const SelectComponent = defineComponent({
230
244
  listWidth,
231
245
  listMaxWidth,
232
246
  searchable,
247
+ noneRow,
233
248
  actions,
234
249
  onSelect,
235
250
  onActionSelect,
@@ -248,7 +263,7 @@ const SelectTrigger = defineComponent({
248
263
  onOpenChange: Function,
249
264
  },
250
265
  setup(ownProps, { attrs }) {
251
- const { props, slots, slotsVersion, triggerId, triggerEl, block, pill, onSelect } = useSelectContext();
266
+ const { props, slots, slotsVersion, triggerId, triggerEl, block, pill, onSelect, noneRow } = useSelectContext();
252
267
  const typeahead = createTypeahead();
253
268
  const setTriggerEl = (instance) => {
254
269
  triggerEl.value = instance?.$el ?? null;
@@ -325,7 +340,11 @@ const SelectTrigger = defineComponent({
325
340
  "StartIcon": props.TriggerStartIcon,
326
341
  "opticallyAlign": props.opticallyAlign,
327
342
  "dropdownIconType": props.dropdownIconType,
328
- "onClearClick": props.clearable ? handleClearClick : undefined,
343
+ // On a phone the list's None row unsets the value: an iOS pop-up button has no clear button
344
+ "onClearClick": props.clearable && !noneRow.value ? handleClearClick : undefined,
345
+ // The mark lets CSS hide the clear button from the first paint, before a server-rendered page knows the
346
+ // window (SelectControl.module.css)
347
+ "data-select-none-row": props.clearable ? "" : undefined,
329
348
  "onInteract": ownProps.onOpenChange,
330
349
  "interactOnEnter": true,
331
350
  "onKeydown": handleKeyDown,
@@ -414,6 +433,19 @@ const CustomSelect = defineComponent({
414
433
  const open = ref(false);
415
434
  const selectContentRef = shallowRef(null);
416
435
  const popoverTriggerEl = shallowRef(null);
436
+ // A mouse opens the list as its button goes down, so on a phone the list is under it when the button comes up
437
+ // (SelectPopoverContent): that release chooses nothing while it is over the trigger, as in Menu
438
+ watchEffect((onCleanup) => {
439
+ const trigger = popoverTriggerEl.value;
440
+ if (!trigger)
441
+ return;
442
+ const press = (event) => {
443
+ if (event.button === 0 && isHoverPointer(event))
444
+ ignoreReleaseOverTrigger(trigger, event.pointerId);
445
+ };
446
+ trigger.addEventListener("pointerdown", press);
447
+ onCleanup(() => trigger.removeEventListener("pointerdown", press));
448
+ });
417
449
  // Not before mount: server rendering and hydration render no teleport,
418
450
  // as Radix's Portal renders nothing before mount
419
451
  const mounted = ref(false);
@@ -560,6 +592,25 @@ const SelectPopoverContent = defineComponent({
560
592
  const { props, align, alignOffset, listWidth, listMaxWidth, pill } = useSelectContext();
561
593
  const { handleRootOpenChange, popoverTriggerEl, open, selectContentRef } = inject(CustomSelectContextKey);
562
594
  const floatingBoundary = useFloatingBoundary(() => open.value && props.avoidCollisions, { bottom: 30, top: 30 });
595
+ // On a phone the list opens over its trigger, as the pop-up menu of an iOS picker does (ref-app pickers, block 8:
596
+ // the 250pt menu stands over the row's value, its end at the chevron's end, the value hidden under it), and toward
597
+ // the larger part of the screen, as Menu does (menuTriggerCover.ts)
598
+ // Only in a phone-wide window, where the list is laid out as on a phone (Select.module.css)
599
+ const cover = shallowRef(null);
600
+ watchEffect((onCleanup) => {
601
+ const trigger = popoverTriggerEl.value;
602
+ if (!open.value || !trigger)
603
+ return;
604
+ onCleanup(observeMenuTriggerCover(trigger, (value) => { cover.value = value; }, { windowOnly: true }));
605
+ });
606
+ // The covered trigger is hidden while the list is open, and shown again as it closes, before focus returns to it
607
+ watchEffect((onCleanup) => {
608
+ const trigger = popoverTriggerEl.value;
609
+ const content = selectContentRef.value;
610
+ if (!open.value || !cover.value || !trigger || !content)
611
+ return;
612
+ onCleanup(markCoveredMenuTrigger(trigger, content));
613
+ });
563
614
  // Radix (1.8.1) dismisses on the click that follows a primary pointer down outside
564
615
  const { onPointerDownOutside, onFocusOutside } = useDeferredPointerDownOutside((originalEvent) => {
565
616
  // The trigger is not outside: Radix's non-modal content keeps the popover open
@@ -572,8 +623,12 @@ const SelectPopoverContent = defineComponent({
572
623
  as: SelectContentElement,
573
624
  class: s.MenuList,
574
625
  "data-pill": pill.value ? "" : undefined,
575
- side: props.side,
576
- sideOffset: 5,
626
+ // A list that fits its options is the 250pt of an iOS menu on a phone (Select.module.css)
627
+ "data-list-width": listWidth.value === "auto" ? "auto" : undefined,
628
+ // A list given its own width keeps it on a phone too, below the 250pt
629
+ "data-list-sized": typeof listWidth.value === "number" ? "" : undefined,
630
+ side: props.side ?? cover.value?.side ?? "bottom",
631
+ sideOffset: cover.value ? cover.value.sideOffset : 5,
577
632
  align: align.value,
578
633
  alignOffset: alignOffset.value,
579
634
  avoidCollisions: props.avoidCollisions,
@@ -587,7 +642,8 @@ const SelectPopoverContent = defineComponent({
587
642
  style: toCssVariables({
588
643
  "select-list-width": listWidth.value,
589
644
  "select-list-min-width": props.listMinWidth,
590
- "select-list-max-width": listMaxWidth.value,
645
+ // "auto" is no maximum: the variable is left out, so a phone's 250pt floor can read the cap
646
+ "select-list-max-width": listMaxWidth.value === "auto" ? undefined : listMaxWidth.value,
591
647
  }),
592
648
  }, { default: () => h(CustomSelectMenu) });
593
649
  },
@@ -630,7 +686,7 @@ const focusMounted = (element) => {
630
686
  const CustomSelectMenu = defineComponent({
631
687
  name: "CustomSelectMenu",
632
688
  setup() {
633
- const { props, searchable, searchPredicate, listWidth } = useSelectContext();
689
+ const { props, searchable, searchPredicate, listWidth, noneRow } = useSelectContext();
634
690
  const { handleOpenChange } = inject(CustomSelectContextKey);
635
691
  const menuRef = shallowRef(null);
636
692
  const listRef = shallowRef(null);
@@ -638,14 +694,19 @@ const CustomSelectMenu = defineComponent({
638
694
  const searchTerm = ref("");
639
695
  const multiple = props.multiple;
640
696
  const value = props.value;
641
- const highlightedValue = ref(((multiple ? value[0] : value) || getFirstValidOption(props.options)?.value) ?? "");
697
+ // With nothing chosen, the None row is the checked one
698
+ const highlightedValue = ref(noneRow.value && !hasChosenOption(props.options, value)
699
+ ? NONE_OPTION_VALUE
700
+ : ((multiple ? value[0] : value) || getFirstValidOption(props.options)?.value) ?? "");
642
701
  const typeahead = createTypeahead();
643
702
  const listId = `select-list-${useId()}`;
644
703
  // Lock `value` for a given open to prevent janky change during close animation
645
704
  // MultiSelect reads its live selection instead of this per-open snapshot.
646
705
  const openingValue = multiple ? "" : value;
647
706
  // Trim and lowercase search value
648
- const literalSearchTerm = computed(() => searchTerm.value.trim().toLocaleLowerCase());
707
+ // A term counts only while the list has its search: one typed on a desktop is dropped when the window narrows to
708
+ // a phone, whose list has none
709
+ const literalSearchTerm = computed(() => (searchable.value ? searchTerm.value.trim().toLocaleLowerCase() : ""));
649
710
  const filteredOptions = computed(() => filterOptions(props.options, literalSearchTerm.value, searchPredicate()));
650
711
  const firstOption = computed(() => getFirstValidOption(filteredOptions.value));
651
712
  const requestClose = () => handleOpenChange(false);
@@ -682,6 +743,14 @@ const CustomSelectMenu = defineComponent({
682
743
  return;
683
744
  }
684
745
  }
746
+ // Without a value the None row is the checked one
747
+ const noneElement = noneRow.value && !hasChosenOption(props.options, value)
748
+ ? findOptionByValue(NONE_OPTION_VALUE, menuElement)
749
+ : null;
750
+ if (noneElement) {
751
+ highlightOption(NONE_OPTION_VALUE, noneElement);
752
+ return;
753
+ }
685
754
  // If value isn't set, or the selected node wasn't found in the DOM,
686
755
  // attempt to move focus to the first valid option.
687
756
  const firstValidOption = getFirstValidOption(props.options);
@@ -782,6 +851,9 @@ const CustomSelectMenu = defineComponent({
782
851
  if (!target || !menuRef.value) {
783
852
  return;
784
853
  }
854
+ // A list that gave the keys to a search that came with a wider window points at nothing itself
855
+ if (target !== listRef.value)
856
+ listRef.value?.removeAttribute("aria-activedescendant");
785
857
  const highlightedOption = highlightedValue.value ? findOptionByValue(highlightedValue.value, menuRef.value) : null;
786
858
  if (highlightedOption?.id) {
787
859
  target.setAttribute("aria-activedescendant", highlightedOption.id);
@@ -790,8 +862,43 @@ const CustomSelectMenu = defineComponent({
790
862
  target.removeAttribute("aria-activedescendant");
791
863
  }
792
864
  };
793
- watch([highlightedValue, filteredOptions], syncActiveDescendant, { flush: "post" });
865
+ // The search coming or going moves the keys, so the pointer follows them, and the None row coming or going
866
+ watch([highlightedValue, filteredOptions, searchable, noneRow], syncActiveDescendant, { flush: "post" });
867
+ // The window crossed the phone's width while the list was open: the None row came or went. With nothing chosen
868
+ // the highlight moves to it; when it goes, a highlight on it moves to the chosen option or the first one.
869
+ watch(noneRow, (next) => {
870
+ const current = props.value;
871
+ if (next) {
872
+ if (!hasChosenOption(props.options, current))
873
+ highlightedValue.value = NONE_OPTION_VALUE;
874
+ return;
875
+ }
876
+ if (highlightedValue.value !== NONE_OPTION_VALUE)
877
+ return;
878
+ const selectedValue = props.multiple ? current[0] : current;
879
+ highlightedValue.value = (selectedValue || getFirstValidOption(filteredOptions.value)?.value) ?? "";
880
+ });
794
881
  // On mount behavior
882
+ // The window crossed the phone's width while the list was open: the search came or went (a phone's list has none),
883
+ // so its term is cleared and focus moves to what holds the keys now, the search or the list
884
+ watch(searchable, (next) => {
885
+ if (!next)
886
+ searchTerm.value = "";
887
+ void nextTick(() => {
888
+ // The width a desktop list locked for its search would overflow a phone's 250px panel; a desktop locks it again
889
+ if (menuRef.value) {
890
+ menuRef.value.style.minWidth = "";
891
+ if (next && listWidth.value === "auto")
892
+ menuRef.value.style.minWidth = `${menuRef.value.offsetWidth}px`;
893
+ }
894
+ // The post-flush watch above ran before a new search mounted and pointed the list; the search is here now
895
+ syncActiveDescendant();
896
+ const active = document.activeElement;
897
+ if (menuRef.value?.contains(active) && active !== listRef.value)
898
+ return;
899
+ (next ? searchInputRef.value : listRef.value)?.focus({ preventScroll: true });
900
+ });
901
+ });
795
902
  onMounted(() => {
796
903
  syncActiveDescendant();
797
904
  // A long list has a search field: the menu keeps the width of all its options as the results narrow.
@@ -832,9 +939,11 @@ const CustomSelectMenu = defineComponent({
832
939
  }
833
940
  // Reset scroll position to the top
834
941
  listRef.value.scrollTop = 0;
835
- // Highlight first item in the list
942
+ // Highlight first item in the list, or the None row while nothing is chosen
836
943
  const maybeFirstOption = getFirstValidOption(nextFilteredOptions);
837
- if (maybeFirstOption)
944
+ if (noneRow.value && !hasChosenOption(props.options, props.value))
945
+ highlightedValue.value = NONE_OPTION_VALUE;
946
+ else if (maybeFirstOption)
838
947
  highlightedValue.value = maybeFirstOption.value;
839
948
  }, { flush: "post" });
840
949
  return () => h("div", {
@@ -843,7 +952,7 @@ const CustomSelectMenu = defineComponent({
843
952
  ref: menuRef,
844
953
  // Without search, the list takes focus (and the tab stop); the container
845
954
  // stays focusable so a click on it keeps the keys here
846
- tabindex: !searchable.value && filteredOptions.value.length ? -1 : 0,
955
+ tabindex: !searchable.value && (filteredOptions.value.length || noneRow.value) ? -1 : 0,
847
956
  }, [
848
957
  searchable.value
849
958
  ? h(CustomSelectSearch, {
@@ -923,7 +1032,7 @@ const CustomSelectList = defineComponent({
923
1032
  filteredOptions: { type: Array, required: true },
924
1033
  },
925
1034
  setup(props) {
926
- const { props: selectProps, slots, slotsVersion, triggerId, searchable } = useSelectContext();
1035
+ const { props: selectProps, slots, slotsVersion, triggerId, searchable, noneRow } = useSelectContext();
927
1036
  const { listId, listRef } = useCustomSelectMenuContext();
928
1037
  const setListRef = (el) => {
929
1038
  listRef.value = el ?? null;
@@ -931,7 +1040,8 @@ const CustomSelectList = defineComponent({
931
1040
  return () => {
932
1041
  void slotsVersion.value;
933
1042
  const { filteredOptions } = props;
934
- if (!filteredOptions.length) {
1043
+ // A phone's None row still unsets a value when there are no options to show
1044
+ if (!filteredOptions.length && !noneRow.value) {
935
1045
  if (slots.searchEmptyMessage) {
936
1046
  return h("div", { class: s.SearchEmpty }, slots.searchEmptyMessage());
937
1047
  }
@@ -940,13 +1050,15 @@ const CustomSelectList = defineComponent({
940
1050
  ? h("p", { "class": s.SearchEmpty, "data-text-only": "true" }, searchEmptyMessage)
941
1051
  : h("div", { class: s.SearchEmpty }, [searchEmptyMessage]);
942
1052
  }
943
- // We hard limit within groups, so at this level we will only limit flat arrays
1053
+ // We hard limit within groups, so at this level we will only limit flat arrays. The limit asks to search for the
1054
+ // rest, so a list with no search (a phone's) shows every option, as a long iOS menu scrolls (IMG_5490).
944
1055
  const isGrouped = isOptionGroupArray(filteredOptions);
945
- const hasHardLimit = !isGrouped && filteredOptions.length > HARD_OPTIONS_LIMIT;
1056
+ const hardLimit = searchable.value ? HARD_OPTIONS_LIMIT : Infinity;
1057
+ const hasHardLimit = !isGrouped && filteredOptions.length > hardLimit;
946
1058
  const options = isGrouped
947
1059
  ? filteredOptions.map((group) => h(CustomSelectGroup, { key: group.label, group }))
948
1060
  : filteredOptions
949
- .slice(0, HARD_OPTIONS_LIMIT)
1061
+ .slice(0, hardLimit)
950
1062
  .map((option) => h(CustomSelectOption, { key: option.value, option }));
951
1063
  const { ariaLabel, ariaLabelledby } = selectProps;
952
1064
  const customTrigger = !!(slots.trigger || selectProps.trigger);
@@ -964,6 +1076,13 @@ const CustomSelectList = defineComponent({
964
1076
  // iOS Safari applies :active, which draws a pressed option's capsule on a phone, only under a touch listener
965
1077
  "onTouchstartPassive": () => { },
966
1078
  }, [
1079
+ // A phone's None row, in a section of its own as in Reminders (IMG_5821); the section is no group to
1080
+ // assistive tech, so the row is an option of the list
1081
+ noneRow.value
1082
+ ? h("div", { class: s.NoneSection, role: "none" }, [
1083
+ h(CustomSelectOption, { option: { value: NONE_OPTION_VALUE, label: selectProps.noneLabel }, none: true }),
1084
+ ])
1085
+ : null,
967
1086
  ...options,
968
1087
  hasHardLimit ? h(CustomSelectHardLimit, { numHidden: filteredOptions.length - HARD_OPTIONS_LIMIT }) : null,
969
1088
  ]);
@@ -983,11 +1102,13 @@ const CustomSelectGroup = defineComponent({
983
1102
  const groupId = useId();
984
1103
  const headingId = useId();
985
1104
  const { searchTerm, highlightedValue } = useCustomSelectMenuContext();
1105
+ const { searchable } = useSelectContext();
986
1106
  const limitExpanded = ref(false);
987
1107
  return () => {
988
1108
  const { label, options, optionsLimit = DEFAULT_OPTIONS_LIMIT } = props.group;
989
1109
  const hasExpandableLimit = optionsLimit.limit < options.length && !searchTerm.value && !limitExpanded.value;
990
- const hasHardLimit = HARD_OPTIONS_LIMIT < options.length && !hasExpandableLimit;
1110
+ // The hard limit asks to search for the rest: a list with no search (a phone's) shows the whole group once expanded
1111
+ const hasHardLimit = searchable.value && HARD_OPTIONS_LIMIT < options.length && !hasExpandableLimit;
991
1112
  let maybeLimitedOptions = options;
992
1113
  if (hasExpandableLimit) {
993
1114
  maybeLimitedOptions = options.slice(0, optionsLimit.limit);
@@ -1098,10 +1219,14 @@ const CustomSelectExpandableLimit = defineComponent({
1098
1219
  },
1099
1220
  });
1100
1221
  const INTERNAL_DOM_SELECTION_DATA_ATTR = "data-option-id";
1222
+ // The None row's id among the options: it never reaches `onChange`, which gets an empty value instead
1223
+ const NONE_OPTION_VALUE = "plexui-select-none";
1101
1224
  const CustomSelectOption = defineComponent({
1102
1225
  name: "CustomSelectOption",
1103
1226
  props: {
1104
1227
  option: { type: Object, required: true },
1228
+ /** The phone's None row */
1229
+ none: { type: Boolean, default: false },
1105
1230
  },
1106
1231
  setup(props) {
1107
1232
  const { props: selectProps, slots, slotsVersion, onSelect } = useSelectContext();
@@ -1110,11 +1235,21 @@ const CustomSelectOption = defineComponent({
1110
1235
  const optionId = useId();
1111
1236
  // NOTE: SingleSelect mode keeps the opening value instead of the live value
1112
1237
  // to avoid selecting the item as the select closes.
1113
- const isSelected = () => selectProps.multiple
1114
- ? selectProps.value.includes(props.option.value)
1115
- : props.option.value === openingValue;
1238
+ // The None row is checked while nothing is chosen: no value, or none that an option has (the trigger shows the
1239
+ // placeholder then)
1240
+ const isSelected = () => props.none
1241
+ ? !hasChosenOption(selectProps.options, selectProps.multiple ? selectProps.value : openingValue)
1242
+ : selectProps.multiple
1243
+ ? selectProps.value.includes(props.option.value)
1244
+ : props.option.value === openingValue;
1116
1245
  const handlePointerUp = () => {
1117
- if (selectProps.multiple) {
1246
+ if (props.none) {
1247
+ // Unsets the value, as the clear button does, and closes the list, a multiple one too: an iOS menu closes on
1248
+ // a choice, and None leaves nothing more to choose (owner 10.11)
1249
+ onSelect({ value: "", label: "" });
1250
+ requestClose();
1251
+ }
1252
+ else if (selectProps.multiple) {
1118
1253
  // Trigger the change, optionally as a remove
1119
1254
  onSelect(props.option, isSelected());
1120
1255
  }
@@ -1150,9 +1285,10 @@ const CustomSelectOption = defineComponent({
1150
1285
  };
1151
1286
  const renderTooltip = (tooltip) => {
1152
1287
  const content = tooltip.content;
1288
+ const icon = () => h(Info, { class: s.OptionTooltipIcon });
1153
1289
  return typeof content === "function"
1154
- ? h(Tooltip, { maxWidth: tooltip.maxWidth, side: "right" }, { default: () => h(Info), content })
1155
- : h(Tooltip, { content, maxWidth: tooltip.maxWidth, side: "right" }, { default: () => h(Info) });
1290
+ ? h(Tooltip, { maxWidth: tooltip.maxWidth, side: "right" }, { default: icon, content })
1291
+ : h(Tooltip, { content, maxWidth: tooltip.maxWidth, side: "right" }, { default: icon });
1156
1292
  };
1157
1293
  return () => {
1158
1294
  void slotsVersion.value;
@@ -1186,10 +1322,18 @@ const CustomSelectOption = defineComponent({
1186
1322
  ])
1187
1323
  : null,
1188
1324
  h("div", { class: s.OptionLeading }, [
1189
- h("div", { class: s.OptionInner }, [renderOptionView(option), tooltip ? renderTooltip(tooltip) : null]),
1325
+ h("div", { class: s.OptionInner }, [
1326
+ props.none ? option.label : renderOptionView(option),
1327
+ tooltip ? renderTooltip(tooltip) : null,
1328
+ ]),
1190
1329
  // React's `description && ...`: a 0 (or NaN) renders as text
1191
1330
  option.description &&
1192
1331
  h("div", { class: clsx(s.OptionInner, s.OptionDescription) }, [renderContent(option.description)]),
1332
+ // An iOS menu has no tooltips: on a phone the tooltip is the row's subtitle, after the description if
1333
+ // there is one (Select.module.css)
1334
+ tooltip
1335
+ ? h("div", { class: clsx(s.OptionInner, s.OptionTooltipText) }, [renderContent(tooltip.content)])
1336
+ : null,
1193
1337
  ]),
1194
1338
  checkPosition === "end"
1195
1339
  ? h("div", { "class": s.OptionIndicatorSlot, "data-position": "end" }, [
@@ -1346,6 +1490,8 @@ const getOptionByValue = (options, value) => {
1346
1490
  }
1347
1491
  return found;
1348
1492
  };
1493
+ // Whether a value names an option: a value no option has shows the placeholder, as no value does
1494
+ const hasChosenOption = (options, value) => Array.isArray(value) ? getOptionsByValues(options, value).length > 0 : !!getOptionByValue(options, value);
1349
1495
  const getOptionsByValues = (options, values) => {
1350
1496
  let found = [];
1351
1497
  const lookup = new Set(values);