@cratis/components 4.39.5 → 4.40.1

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 (133) hide show
  1. package/compat-manifest.json +13 -13
  2. package/dist/esm/Chat/Kit/ChatComposer.d.ts.map +1 -1
  3. package/dist/esm/Chat/Kit/ChatComposer.js +14 -7
  4. package/dist/esm/Chat/Kit/ChatComposer.js.map +1 -1
  5. package/dist/esm/Chat/Kit/Mentions/MentionSuggestions.d.ts +3 -1
  6. package/dist/esm/Chat/Kit/Mentions/MentionSuggestions.d.ts.map +1 -1
  7. package/dist/esm/Chat/Kit/Mentions/MentionSuggestions.js +2 -1
  8. package/dist/esm/Chat/Kit/Mentions/MentionSuggestions.js.map +1 -1
  9. package/dist/esm/Chat/Kit/Mentions/mentionOptionId.d.ts +9 -0
  10. package/dist/esm/Chat/Kit/Mentions/mentionOptionId.d.ts.map +1 -0
  11. package/dist/esm/Chat/Kit/Mentions/mentionOptionId.js +4 -0
  12. package/dist/esm/Chat/Kit/Mentions/mentionOptionId.js.map +1 -0
  13. package/dist/esm/Common/DatePickerButtonBar.d.ts +15 -0
  14. package/dist/esm/Common/DatePickerButtonBar.d.ts.map +1 -0
  15. package/dist/esm/Common/DatePickerButtonBar.js +17 -0
  16. package/dist/esm/Common/DatePickerButtonBar.js.map +1 -0
  17. package/dist/esm/Common/DatePickerCalendar.d.ts +8 -0
  18. package/dist/esm/Common/DatePickerCalendar.d.ts.map +1 -0
  19. package/dist/esm/Common/DatePickerCalendar.js +29 -0
  20. package/dist/esm/Common/DatePickerCalendar.js.map +1 -0
  21. package/dist/esm/Common/DatePickerDateInput.d.ts +14 -0
  22. package/dist/esm/Common/DatePickerDateInput.d.ts.map +1 -0
  23. package/dist/esm/Common/DatePickerDateInput.js +9 -0
  24. package/dist/esm/Common/DatePickerDateInput.js.map +1 -0
  25. package/dist/esm/Common/DatePickerGroup.d.ts +21 -0
  26. package/dist/esm/Common/DatePickerGroup.d.ts.map +1 -0
  27. package/dist/esm/Common/DatePickerGroup.js +10 -0
  28. package/dist/esm/Common/DatePickerGroup.js.map +1 -0
  29. package/dist/esm/Common/DatePickerInputImplementation.d.ts +1 -1
  30. package/dist/esm/Common/DatePickerInputImplementation.d.ts.map +1 -1
  31. package/dist/esm/Common/DatePickerInputImplementation.js +35 -91
  32. package/dist/esm/Common/DatePickerInputImplementation.js.map +1 -1
  33. package/dist/esm/Common/DatePickerPopover.d.ts +12 -0
  34. package/dist/esm/Common/DatePickerPopover.d.ts.map +1 -0
  35. package/dist/esm/Common/DatePickerPopover.js +11 -0
  36. package/dist/esm/Common/DatePickerPopover.js.map +1 -0
  37. package/dist/esm/Common/datePickerStateAttributes.d.ts +38 -0
  38. package/dist/esm/Common/datePickerStateAttributes.d.ts.map +1 -0
  39. package/dist/esm/Common/datePickerStateAttributes.js +26 -0
  40. package/dist/esm/Common/datePickerStateAttributes.js.map +1 -0
  41. package/dist/esm/Common/datePickerValues.d.ts +11 -0
  42. package/dist/esm/Common/datePickerValues.d.ts.map +1 -0
  43. package/dist/esm/Common/datePickerValues.js +23 -0
  44. package/dist/esm/Common/datePickerValues.js.map +1 -0
  45. package/dist/esm/Common/toolbarFocusQueries.d.ts +13 -0
  46. package/dist/esm/Common/toolbarFocusQueries.d.ts.map +1 -0
  47. package/dist/esm/Common/toolbarFocusQueries.js +46 -0
  48. package/dist/esm/Common/toolbarFocusQueries.js.map +1 -0
  49. package/dist/esm/Common/toolbarNavigationCandidates.d.ts +7 -0
  50. package/dist/esm/Common/toolbarNavigationCandidates.d.ts.map +1 -0
  51. package/dist/esm/Common/toolbarNavigationCandidates.js +44 -0
  52. package/dist/esm/Common/toolbarNavigationCandidates.js.map +1 -0
  53. package/dist/esm/Common/toolbarTabStop.d.ts +28 -0
  54. package/dist/esm/Common/toolbarTabStop.d.ts.map +1 -0
  55. package/dist/esm/Common/toolbarTabStop.js +94 -0
  56. package/dist/esm/Common/toolbarTabStop.js.map +1 -0
  57. package/dist/esm/Common/useDatePickerState.d.ts +591 -0
  58. package/dist/esm/Common/useDatePickerState.d.ts.map +1 -0
  59. package/dist/esm/Common/useDatePickerState.js +78 -0
  60. package/dist/esm/Common/useDatePickerState.js.map +1 -0
  61. package/dist/esm/Common/useMicrotaskScheduler.d.ts +3 -0
  62. package/dist/esm/Common/useMicrotaskScheduler.d.ts.map +1 -0
  63. package/dist/esm/Common/useMicrotaskScheduler.js +17 -0
  64. package/dist/esm/Common/useMicrotaskScheduler.js.map +1 -0
  65. package/dist/esm/Common/useToolbarKeyboardNavigation.d.ts +1 -2
  66. package/dist/esm/Common/useToolbarKeyboardNavigation.d.ts.map +1 -1
  67. package/dist/esm/Common/useToolbarKeyboardNavigation.js +12 -211
  68. package/dist/esm/Common/useToolbarKeyboardNavigation.js.map +1 -1
  69. package/dist/esm/Common/useToolbarTabStop.d.ts +9 -0
  70. package/dist/esm/Common/useToolbarTabStop.d.ts.map +1 -0
  71. package/dist/esm/Common/useToolbarTabStop.js +81 -0
  72. package/dist/esm/Common/useToolbarTabStop.js.map +1 -0
  73. package/dist/esm/Dropdown/ComboBoxCommitBridge.d.ts +13 -0
  74. package/dist/esm/Dropdown/ComboBoxCommitBridge.d.ts.map +1 -0
  75. package/dist/esm/Dropdown/ComboBoxCommitBridge.js +16 -0
  76. package/dist/esm/Dropdown/ComboBoxCommitBridge.js.map +1 -0
  77. package/dist/esm/Dropdown/DropdownBranchProps.d.ts +10 -0
  78. package/dist/esm/Dropdown/DropdownBranchProps.d.ts.map +1 -0
  79. package/dist/esm/Dropdown/DropdownBranchProps.js +4 -0
  80. package/dist/esm/Dropdown/DropdownBranchProps.js.map +1 -0
  81. package/dist/esm/Dropdown/DropdownImplementation.d.ts +1 -2
  82. package/dist/esm/Dropdown/DropdownImplementation.d.ts.map +1 -1
  83. package/dist/esm/Dropdown/DropdownImplementation.js +16 -192
  84. package/dist/esm/Dropdown/DropdownImplementation.js.map +1 -1
  85. package/dist/esm/Dropdown/DropdownOptionLists.d.ts +15 -0
  86. package/dist/esm/Dropdown/DropdownOptionLists.d.ts.map +1 -0
  87. package/dist/esm/Dropdown/DropdownOptionLists.js +12 -0
  88. package/dist/esm/Dropdown/DropdownOptionLists.js.map +1 -0
  89. package/dist/esm/Dropdown/DropdownParts.d.ts +46 -0
  90. package/dist/esm/Dropdown/DropdownParts.d.ts.map +1 -0
  91. package/dist/esm/Dropdown/DropdownParts.js +14 -0
  92. package/dist/esm/Dropdown/DropdownParts.js.map +1 -0
  93. package/dist/esm/Dropdown/FilterDropdown.d.ts +7 -0
  94. package/dist/esm/Dropdown/FilterDropdown.d.ts.map +1 -0
  95. package/dist/esm/Dropdown/FilterDropdown.js +31 -0
  96. package/dist/esm/Dropdown/FilterDropdown.js.map +1 -0
  97. package/dist/esm/Dropdown/MultipleSelectDropdown.d.ts +4 -0
  98. package/dist/esm/Dropdown/MultipleSelectDropdown.d.ts.map +1 -0
  99. package/dist/esm/Dropdown/MultipleSelectDropdown.js +23 -0
  100. package/dist/esm/Dropdown/MultipleSelectDropdown.js.map +1 -0
  101. package/dist/esm/Dropdown/SingleSelectDropdown.d.ts +4 -0
  102. package/dist/esm/Dropdown/SingleSelectDropdown.d.ts.map +1 -0
  103. package/dist/esm/Dropdown/SingleSelectDropdown.js +16 -0
  104. package/dist/esm/Dropdown/SingleSelectDropdown.js.map +1 -0
  105. package/dist/esm/Dropdown/SingleSelectTrigger.d.ts +4 -0
  106. package/dist/esm/Dropdown/SingleSelectTrigger.d.ts.map +1 -0
  107. package/dist/esm/Dropdown/SingleSelectTrigger.js +16 -0
  108. package/dist/esm/Dropdown/SingleSelectTrigger.js.map +1 -0
  109. package/dist/esm/Dropdown/dropdownAttributes.d.ts +867 -0
  110. package/dist/esm/Dropdown/dropdownAttributes.d.ts.map +1 -0
  111. package/dist/esm/Dropdown/dropdownAttributes.js +9 -0
  112. package/dist/esm/Dropdown/dropdownAttributes.js.map +1 -0
  113. package/dist/esm/Dropdown/renderTriggerWithOpenState.d.ts +4 -0
  114. package/dist/esm/Dropdown/renderTriggerWithOpenState.d.ts.map +1 -0
  115. package/dist/esm/Dropdown/renderTriggerWithOpenState.js +8 -0
  116. package/dist/esm/Dropdown/renderTriggerWithOpenState.js.map +1 -0
  117. package/dist/esm/Dropdown/resolveOptions.d.ts +12 -0
  118. package/dist/esm/Dropdown/resolveOptions.d.ts.map +1 -0
  119. package/dist/esm/Dropdown/resolveOptions.js +36 -0
  120. package/dist/esm/Dropdown/resolveOptions.js.map +1 -0
  121. package/dist/esm/Dropdown/useDropdownHandlers.d.ts +12 -0
  122. package/dist/esm/Dropdown/useDropdownHandlers.d.ts.map +1 -0
  123. package/dist/esm/Dropdown/useDropdownHandlers.js +50 -0
  124. package/dist/esm/Dropdown/useDropdownHandlers.js.map +1 -0
  125. package/dist/esm/Dropdown/useDropdownState.d.ts +28 -0
  126. package/dist/esm/Dropdown/useDropdownState.d.ts.map +1 -0
  127. package/dist/esm/Dropdown/useDropdownState.js +91 -0
  128. package/dist/esm/Dropdown/useDropdownState.js.map +1 -0
  129. package/dist/esm/styles.Canvas.css +1 -0
  130. package/dist/esm/styles.Chat.css +1 -0
  131. package/dist/esm/styles.css +1 -0
  132. package/dist/esm/theme.css +1 -0
  133. package/package.json +6 -4
@@ -0,0 +1,78 @@
1
+ import { zIndexAboveDialog, OVERLAY_OFFSET } from '../renderer/dialogStack.js';
2
+ import { useNearestDialogZIndex } from '../renderer/DialogStackContext.js';
3
+ import { classNames } from '../ClassNames/classNames.js';
4
+ import 'react/jsx-runtime';
5
+ import 'react';
6
+ import 'react-aria-components/I18nProvider';
7
+ import 'react-aria-components';
8
+ import 'ts-deepmerge';
9
+ import 'react-dom';
10
+ import { useCratisComponentsConfig } from '../configuration/CratisComponentsContext.js';
11
+ import '../Notifications/toast.js';
12
+ import '../renderer/RendererContext.js';
13
+ import { resolveDatePickerBounds } from './datePickerValues.js';
14
+
15
+ const resolvePopoverZIndex = (nearestDialogZIndex) => nearestDialogZIndex === null
16
+ ? 'var(--cratis-z-index-overlay)'
17
+ : zIndexAboveDialog(nearestDialogZIndex, OVERLAY_OFFSET);
18
+ const flag = (own, fromInput) => own ?? fromInput ?? false;
19
+ const resolveStateFlags = ({ invalid, disabled, readOnly, pt }) => ({
20
+ effectiveDisabled: flag(disabled, pt?.input?.disabled),
21
+ effectiveReadOnly: flag(readOnly, pt?.input?.readOnly),
22
+ effectiveInvalid: flag(invalid, pt?.input?.['aria-invalid']),
23
+ });
24
+ const resolveActionFlags = ({ effectiveDisabled, effectiveReadOnly }, pt) => {
25
+ const actionsDisabled = effectiveDisabled || effectiveReadOnly;
26
+ return { actionsDisabled, clearDisabled: actionsDisabled || pt?.clear?.disabled || false };
27
+ };
28
+ const resolveLabels = ({ todayLabel, clearLabel }, messages) => ({
29
+ resolvedTodayLabel: todayLabel ?? messages?.today ?? 'Today',
30
+ resolvedClearLabel: clearLabel ?? messages?.clear ?? 'Clear',
31
+ });
32
+ const resolveAriaAssociations = (props) => ({
33
+ inputId: props.id ?? props.pt?.input?.id,
34
+ effectiveAriaLabelledby: props['aria-labelledby'] ?? props.pt?.input?.['aria-labelledby'],
35
+ effectiveAriaDescribedby: props['aria-describedby'] ?? props.pt?.input?.['aria-describedby'],
36
+ });
37
+ const resolveAccessibleLabel = (props, messages) => {
38
+ const effectivePlaceholder = props.placeholder ?? props.pt?.input?.placeholder;
39
+ return {
40
+ effectivePlaceholder,
41
+ effectiveAriaLabel: resolveAccessibleName(props['aria-label'], effectivePlaceholder, props.pt, messages),
42
+ };
43
+ };
44
+ const resolveAccessibleName = (ariaLabel, placeholder, pt, messages) => ariaLabel ?? pt?.input?.['aria-label'] ?? placeholder ?? messages?.label ?? 'Date';
45
+ const inputPartAttributes = (pt) => ({
46
+ ...pt?.input,
47
+ id: undefined,
48
+ className: undefined,
49
+ style: undefined,
50
+ disabled: undefined,
51
+ readOnly: undefined,
52
+ placeholder: undefined,
53
+ 'aria-label': undefined,
54
+ 'aria-labelledby': undefined,
55
+ 'aria-describedby': undefined,
56
+ 'aria-invalid': undefined,
57
+ });
58
+ const useDatePickerState = (props) => {
59
+ const { pt, className, showTime, minDate, maxDate } = props;
60
+ const nearestDialogZIndex = useNearestDialogZIndex();
61
+ const datePickerMessages = useCratisComponentsConfig().messages?.datePicker;
62
+ const stateFlags = resolveStateFlags(props);
63
+ return {
64
+ datePickerMessages,
65
+ resolvedPopoverZIndex: resolvePopoverZIndex(nearestDialogZIndex),
66
+ ...resolveLabels(props, datePickerMessages),
67
+ ...resolveDatePickerBounds(minDate, maxDate, showTime),
68
+ rootClassName: classNames('cratis-date-picker', pt?.root?.className, className),
69
+ ...stateFlags,
70
+ ...resolveActionFlags(stateFlags, pt),
71
+ ...resolveAriaAssociations(props),
72
+ ...resolveAccessibleLabel(props, datePickerMessages),
73
+ inputPartAttributes: inputPartAttributes(pt),
74
+ };
75
+ };
76
+
77
+ export { useDatePickerState };
78
+ //# sourceMappingURL=useDatePickerState.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDatePickerState.js","sources":["../../../Common/useDatePickerState.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { OVERLAY_OFFSET, zIndexAboveDialog } from '../renderer/dialogStack';\nimport { useNearestDialogZIndex } from '../renderer/DialogStackContext';\nimport { classNames } from '../ClassNames/classNames';\nimport { useCratisComponentsConfig } from './CratisComponentsProvider';\nimport { resolveDatePickerBounds } from './datePickerValues';\nimport type { DatePickerInputPassThrough, DatePickerInputProps } from './DatePickerInput';\n\ntype DatePickerStateInput = Pick<\n DatePickerInputProps,\n | 'invalid'\n | 'disabled'\n | 'readOnly'\n | 'id'\n | 'placeholder'\n | 'showTime'\n | 'minDate'\n | 'maxDate'\n | 'className'\n | 'pt'\n | 'todayLabel'\n | 'clearLabel'\n | 'aria-label'\n | 'aria-labelledby'\n | 'aria-describedby'\n>;\n\ntype DatePickerMessages = NonNullable<\n ReturnType<typeof useCratisComponentsConfig>['messages']\n>['datePicker'];\n\nconst resolvePopoverZIndex = (nearestDialogZIndex: string | null) =>\n nearestDialogZIndex === null\n ? 'var(--cratis-z-index-overlay)'\n : zIndexAboveDialog(nearestDialogZIndex, OVERLAY_OFFSET);\n\nconst flag = (own: boolean | undefined, fromInput: boolean | undefined) => own ?? fromInput ?? false;\n\nconst resolveStateFlags = ({ invalid, disabled, readOnly, pt }: DatePickerStateInput) => ({\n effectiveDisabled: flag(disabled, pt?.input?.disabled),\n effectiveReadOnly: flag(readOnly, pt?.input?.readOnly),\n effectiveInvalid: flag(invalid, pt?.input?.['aria-invalid']),\n});\n\nconst resolveActionFlags = (\n { effectiveDisabled, effectiveReadOnly }: ReturnType<typeof resolveStateFlags>,\n pt: DatePickerInputPassThrough | undefined,\n) => {\n const actionsDisabled = effectiveDisabled || effectiveReadOnly;\n return { actionsDisabled, clearDisabled: actionsDisabled || pt?.clear?.disabled || false };\n};\n\nconst resolveLabels = ({ todayLabel, clearLabel }: DatePickerStateInput, messages: DatePickerMessages) => ({\n resolvedTodayLabel: todayLabel ?? messages?.today ?? 'Today',\n resolvedClearLabel: clearLabel ?? messages?.clear ?? 'Clear',\n});\n\nconst resolveAriaAssociations = (props: DatePickerStateInput) => ({\n inputId: props.id ?? props.pt?.input?.id,\n effectiveAriaLabelledby: props['aria-labelledby'] ?? props.pt?.input?.['aria-labelledby'],\n effectiveAriaDescribedby: props['aria-describedby'] ?? props.pt?.input?.['aria-describedby'],\n});\n\nconst resolveAccessibleLabel = (props: DatePickerStateInput, messages: DatePickerMessages) => {\n const effectivePlaceholder = props.placeholder ?? props.pt?.input?.placeholder;\n return {\n effectivePlaceholder,\n effectiveAriaLabel: resolveAccessibleName(props['aria-label'], effectivePlaceholder, props.pt, messages),\n };\n};\n\nconst resolveAccessibleName = (\n ariaLabel: string | undefined,\n placeholder: string | undefined,\n pt: DatePickerInputPassThrough | undefined,\n messages: DatePickerMessages,\n) => ariaLabel ?? pt?.input?.['aria-label'] ?? placeholder ?? messages?.label ?? 'Date';\n\n// Everything the input part carries except what the picker owns itself.\nconst inputPartAttributes = (pt: DatePickerInputPassThrough | undefined) => ({\n ...pt?.input,\n id: undefined,\n className: undefined,\n style: undefined,\n disabled: undefined,\n readOnly: undefined,\n placeholder: undefined,\n 'aria-label': undefined,\n 'aria-labelledby': undefined,\n 'aria-describedby': undefined,\n 'aria-invalid': undefined,\n});\n\nexport type DatePickerInputPartAttributes = ReturnType<typeof inputPartAttributes>;\n\n/** Derives every effective value the date picker renders from its props, pass-through parts and provider messages. */\nexport const useDatePickerState = (props: DatePickerStateInput) => {\n const { pt, className, showTime, minDate, maxDate } = props;\n const nearestDialogZIndex = useNearestDialogZIndex();\n const datePickerMessages = useCratisComponentsConfig().messages?.datePicker;\n const stateFlags = resolveStateFlags(props);\n return {\n datePickerMessages,\n resolvedPopoverZIndex: resolvePopoverZIndex(nearestDialogZIndex),\n ...resolveLabels(props, datePickerMessages),\n ...resolveDatePickerBounds(minDate, maxDate, showTime),\n rootClassName: classNames('cratis-date-picker', pt?.root?.className, className),\n ...stateFlags,\n ...resolveActionFlags(stateFlags, pt),\n ...resolveAriaAssociations(props),\n ...resolveAccessibleLabel(props, datePickerMessages),\n inputPartAttributes: inputPartAttributes(pt),\n };\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAiCA,MAAM,oBAAoB,GAAG,CAAC,mBAAkC,KAC5D,mBAAmB,KAAK;AACpB,MAAE;AACF,MAAE,iBAAiB,CAAC,mBAAmB,EAAE,cAAc,CAAC;AAEhE,MAAM,IAAI,GAAG,CAAC,GAAwB,EAAE,SAA8B,KAAK,GAAG,IAAI,SAAS,IAAI,KAAK;AAEpG,MAAM,iBAAiB,GAAG,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,EAAwB,MAAM;IACtF,iBAAiB,EAAE,IAAI,CAAC,QAAQ,EAAE,EAAE,EAAE,KAAK,EAAE,QAAQ,CAAC;IACtD,iBAAiB,EAAE,IAAI,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AO,EAAE,QAAQ,CAAC;AACtD,QAAA,aAAa,EAAE,UAAU,CAAC,oBAAoB,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,CAAC;AAC/E,QAAA,GAAG,UAAU;AACb,QAAA,GAAG,kBAAkB,CAAC,UAAU,EAAE,EAAE,CAAC;QACrC,GAAG,uBAAuB,CAAC,KAAK,CAAC;AACjC,QAAA,GAAG,sBAAsB,CAAC,KAAK,EAAE,kBAAkB,CAAC;AACpD,QAAA,mBAAmB,EAAE,mBAAmB,CAAC,EAAE,CAAC;KAC/C;AACL;;"}
@@ -0,0 +1,3 @@
1
+ /** Returns a function that runs the callback once in a microtask however often it is called before then. */
2
+ export declare const useMicrotaskScheduler: (callback: () => void) => () => void;
3
+ //# sourceMappingURL=useMicrotaskScheduler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useMicrotaskScheduler.d.ts","sourceRoot":"","sources":["../../../Common/useMicrotaskScheduler.ts"],"names":[],"mappings":"AAKA,4GAA4G;AAC5G,eAAO,MAAM,qBAAqB,aAAc,MAAM,IAAI,eAUzD,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { useRef, useCallback } from 'react';
2
+
3
+ const useMicrotaskScheduler = (callback) => {
4
+ const scheduled = useRef(false);
5
+ return useCallback(() => {
6
+ if (scheduled.current)
7
+ return;
8
+ scheduled.current = true;
9
+ queueMicrotask(() => {
10
+ scheduled.current = false;
11
+ callback();
12
+ });
13
+ }, [callback]);
14
+ };
15
+
16
+ export { useMicrotaskScheduler };
17
+ //# sourceMappingURL=useMicrotaskScheduler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useMicrotaskScheduler.js","sources":["../../../Common/useMicrotaskScheduler.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { useCallback, useRef } from 'react';\n\n/** Returns a function that runs the callback once in a microtask however often it is called before then. */\nexport const useMicrotaskScheduler = (callback: () => void) => {\n const scheduled = useRef(false);\n return useCallback(() => {\n if (scheduled.current) return;\n scheduled.current = true;\n queueMicrotask(() => {\n scheduled.current = false;\n callback();\n });\n }, [callback]);\n};\n"],"names":[],"mappings":";;AAMO,MAAM,qBAAqB,GAAG,CAAC,QAAoB,KAAI;AAC1D,IAAA,MAAM,SAAS,GAAG,MAAM,CAAC,KAAK,CAAC;IAC/B,OAAO,WAAW,CAAC,MAAK;QACpB,IAAI,SAAS,CAAC,OAAO;YAAE;AACvB,QAAA,SAAS,CAAC,OAAO,GAAG,IAAI;QACxB,cAAc,CAAC,MAAK;AAChB,YAAA,SAAS,CAAC,OAAO,GAAG,KAAK;AACzB,YAAA,QAAQ,EAAE;AACd,QAAA,CAAC,CAAC;AACN,IAAA,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC;AAClB;;"}
@@ -1,12 +1,11 @@
1
1
  import { type KeyboardEvent } from 'react';
2
2
  import { ToolbarFocusMode } from './ToolbarFocusMode.js';
3
- import type { ToolbarRoving } from './ToolbarRovingContext.js';
4
3
  type Orientation = 'horizontal' | 'vertical';
5
4
  /** Components-owned toolbar focus behavior; never captures keys from child widgets. */
6
5
  export declare const useToolbarKeyboardNavigation: (orientation: Orientation, focusMode: ToolbarFocusMode) => {
7
6
  rootRef: import("react").RefObject<HTMLDivElement | null>;
8
7
  onKeyDown: (event: KeyboardEvent<HTMLDivElement>) => void;
9
- roving: ToolbarRoving | null;
8
+ roving: import("./ToolbarRovingContext.js").ToolbarRoving | null;
10
9
  };
11
10
  export {};
12
11
  //# sourceMappingURL=useToolbarKeyboardNavigation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useToolbarKeyboardNavigation.d.ts","sourceRoot":"","sources":["../../../Common/useToolbarKeyboardNavigation.ts"],"names":[],"mappings":"AAGA,OAAO,EAAiD,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;AAC1F,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAoB,CAAC;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAAwB,CAAC;AAK5D,KAAK,WAAW,GAAG,YAAY,GAAG,UAAU,CAAC;AAE7C,uFAAuF;AACvF,eAAO,MAAM,4BAA4B,gBAAiB,WAAW,aAAa,gBAAgB;;uBAkLpE,aAAa,CAAC,cAAc,CAAC;;CAwC1D,CAAC"}
1
+ {"version":3,"file":"useToolbarKeyboardNavigation.d.ts","sourceRoot":"","sources":["../../../Common/useToolbarKeyboardNavigation.ts"],"names":[],"mappings":"AAGA,OAAO,EAAU,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAoB,CAAC;AAMtD,KAAK,WAAW,GAAG,YAAY,GAAG,UAAU,CAAC;AAE7C,uFAAuF;AACvF,eAAO,MAAM,4BAA4B,gBAAiB,WAAW,aAAa,gBAAgB;;uBAIpE,aAAa,CAAC,cAAc,CAAC;;CAU1D,CAAC"}
@@ -1,222 +1,23 @@
1
- import { useRef, useCallback, useLayoutEffect, useMemo } from 'react';
1
+ import { useRef } from 'react';
2
2
  import { ToolbarFocusMode } from './ToolbarFocusMode.js';
3
+ import { shouldIgnoreKey, resolveKeyTool, resolveDirection } from './toolbarFocusQueries.js';
4
+ import { candidatesFor, focusFirstFocusable } from './toolbarNavigationCandidates.js';
5
+ import { availableTools } from './toolbarTabStop.js';
6
+ import { useToolbarTabStop } from './useToolbarTabStop.js';
3
7
 
4
- const toolSelector = 'button, a[href], input, select, textarea, [tabindex]';
5
- const widgetSelector = 'input:not([type="button"]):not([type="submit"]):not([type="reset"]), textarea, select, [contenteditable]:not([contenteditable="false"]), [role="slider"], [role="spinbutton"], [role="textbox"], [role="combobox"], [role="listbox"], [role="menu"], [role="menubar"], [role="tree"], [role="grid"], [role="application"]';
6
8
  const useToolbarKeyboardNavigation = (orientation, focusMode) => {
7
9
  const rootRef = useRef(null);
8
- const singleTabStop = focusMode === ToolbarFocusMode.SingleTabStop;
9
- const managedByKey = useRef(new Map());
10
- const keyByManaged = useRef(new Map());
11
- const activeKeyRef = useRef(null);
12
- const listeners = useRef(new Set());
13
- const inScopeRef = useRef(new Set());
14
- const resizeObserverRef = useRef(null);
15
- const isInToolbarScope = useCallback((tool) => {
16
- const root = rootRef.current;
17
- return !!root && tool !== root && root.contains(tool) && tool.closest('[role="toolbar"]') === root;
18
- }, []);
19
- const isAvailable = useCallback((tool) => {
20
- const root = rootRef.current;
21
- if (!root || !isInToolbarScope(tool) || tool.matches(':disabled, [disabled], [aria-disabled="true"]'))
22
- return false;
23
- if (tool.getAttribute('tabindex') === '-1' && !keyByManaged.current.has(tool))
24
- return false;
25
- for (let element = tool; element && element !== root; element = element.parentElement) {
26
- if (element.hidden || element.hasAttribute('inert') || element.getAttribute('aria-hidden') === 'true')
27
- return false;
28
- const style = getComputedStyle(element);
29
- if (style.display === 'none' || style.visibility === 'hidden' || style.visibility === 'collapse')
30
- return false;
31
- }
32
- return true;
33
- }, [isInToolbarScope]);
34
- const tools = useCallback(() => {
35
- const root = rootRef.current;
36
- if (!root)
37
- return [];
38
- return Array.from(root.querySelectorAll(toolSelector)).filter(isAvailable);
39
- }, [isAvailable]);
40
- const notify = useCallback(() => listeners.current.forEach(listener => listener()), []);
41
- const setActiveKey = useCallback((key) => {
42
- if (activeKeyRef.current === key)
43
- return false;
44
- activeKeyRef.current = key;
45
- notify();
46
- return true;
47
- }, [notify]);
48
- const reconcile = useCallback(() => {
49
- if (!singleTabStop)
50
- return;
51
- let scopeChanged = false;
52
- for (const key of inScopeRef.current) {
53
- if (!managedByKey.current.has(key))
54
- inScopeRef.current.delete(key);
55
- }
56
- for (const [key, element] of managedByKey.current) {
57
- const inside = isInToolbarScope(element);
58
- if (inside === inScopeRef.current.has(key))
59
- continue;
60
- if (inside)
61
- inScopeRef.current.add(key);
62
- else
63
- inScopeRef.current.delete(key);
64
- scopeChanged = true;
65
- }
66
- const current = activeKeyRef.current;
67
- const element = current === null ? undefined : managedByKey.current.get(current);
68
- if (!(element && inScopeRef.current.has(current) && isAvailable(element))) {
69
- const first = tools().find(tool => inScopeRef.current.has(keyByManaged.current.get(tool) ?? ''));
70
- if (setActiveKey(first ? keyByManaged.current.get(first) : null))
71
- return;
72
- }
73
- if (scopeChanged)
74
- notify();
75
- }, [singleTabStop, isInToolbarScope, isAvailable, tools, setActiveKey, notify]);
76
- const reconcileScheduled = useRef(false);
77
- const scheduleReconcile = useCallback(() => {
78
- if (reconcileScheduled.current)
79
- return;
80
- reconcileScheduled.current = true;
81
- queueMicrotask(() => {
82
- reconcileScheduled.current = false;
83
- reconcile();
84
- });
85
- }, [reconcile]);
86
- const pendingRemovalRef = useRef(new Set());
87
- const removalCheckScheduledRef = useRef(false);
88
- const scheduleRemovalCheck = useCallback(() => {
89
- if (removalCheckScheduledRef.current)
90
- return;
91
- removalCheckScheduledRef.current = true;
92
- queueMicrotask(() => {
93
- removalCheckScheduledRef.current = false;
94
- if (pendingRemovalRef.current.size === 0)
95
- return;
96
- for (const key of pendingRemovalRef.current) {
97
- const element = managedByKey.current.get(key);
98
- if (element) {
99
- keyByManaged.current.delete(element);
100
- resizeObserverRef.current?.unobserve(element);
101
- }
102
- managedByKey.current.delete(key);
103
- }
104
- pendingRemovalRef.current.clear();
105
- reconcile();
106
- });
107
- }, [reconcile]);
108
- useLayoutEffect(reconcile);
109
- useLayoutEffect(() => {
110
- const root = rootRef.current;
111
- if (!root || !singleTabStop)
112
- return;
113
- const affectsManagedTool = (record) => {
114
- if (record.type === 'childList')
115
- return true;
116
- for (const tool of keyByManaged.current.keys()) {
117
- if (record.target === tool || record.target.contains(tool))
118
- return true;
119
- }
120
- return false;
121
- };
122
- const observer = new MutationObserver(records => {
123
- if (records.some(affectsManagedTool))
124
- scheduleReconcile();
125
- });
126
- observer.observe(root, {
127
- childList: true,
128
- subtree: true,
129
- attributes: true,
130
- attributeFilter: ['hidden', 'inert', 'aria-hidden', 'aria-disabled', 'disabled', 'style', 'class'],
131
- });
132
- if (typeof ResizeObserver !== 'undefined') {
133
- resizeObserverRef.current = new ResizeObserver(scheduleReconcile);
134
- managedByKey.current.forEach(tool => resizeObserverRef.current.observe(tool));
135
- }
136
- return () => {
137
- observer.disconnect();
138
- resizeObserverRef.current?.disconnect();
139
- resizeObserverRef.current = null;
140
- };
141
- }, [singleTabStop, scheduleReconcile]);
142
- const roving = useMemo(() => singleTabStop ? {
143
- getActiveKey: () => activeKeyRef.current,
144
- isInScope: key => inScopeRef.current.has(key),
145
- subscribe: listener => {
146
- listeners.current.add(listener);
147
- return () => listeners.current.delete(listener);
148
- },
149
- register: (key, element) => {
150
- const previous = managedByKey.current.get(key);
151
- if (!element) {
152
- if (previous)
153
- pendingRemovalRef.current.add(key);
154
- scheduleRemovalCheck();
155
- return;
156
- }
157
- if (previous === element && pendingRemovalRef.current.delete(key))
158
- return;
159
- pendingRemovalRef.current.delete(key);
160
- if (previous === element)
161
- return;
162
- if (previous) {
163
- keyByManaged.current.delete(previous);
164
- resizeObserverRef.current?.unobserve(previous);
165
- }
166
- managedByKey.current.set(key, element);
167
- keyByManaged.current.set(element, key);
168
- resizeObserverRef.current?.observe(element);
169
- scheduleReconcile();
170
- },
171
- activate: key => {
172
- if (inScopeRef.current.has(key))
173
- setActiveKey(key);
174
- },
175
- } : null, [singleTabStop, scheduleReconcile, scheduleRemovalCheck, setActiveKey]);
10
+ const { state, roving } = useToolbarTabStop(rootRef, focusMode === ToolbarFocusMode.SingleTabStop);
176
11
  const onKeyDown = (event) => {
177
- if (focusMode === ToolbarFocusMode.None || event.defaultPrevented || event.isPropagationStopped() ||
178
- event.altKey || event.ctrlKey || event.metaKey || event.shiftKey || event.nativeEvent.isComposing)
12
+ if (shouldIgnoreKey(event, focusMode))
179
13
  return;
180
14
  const root = rootRef.current;
181
- const target = event.target;
182
- if (!(target instanceof Element) || !root?.contains(target) ||
183
- target.closest('[role="toolbar"]') !== root)
184
- return;
185
- for (let element = target; element && element !== root; element = element.parentElement) {
186
- if (element.matches(widgetSelector))
187
- return;
188
- }
189
- const available = tools();
190
- const current = target.closest(toolSelector);
191
- if (!current || current === root || current.closest('[role="toolbar"]') !== root)
15
+ const current = resolveKeyTool(root, event.target);
16
+ if (!root || !current)
192
17
  return;
193
- const index = available.indexOf(current);
194
- const directionElement = root.closest('[dir]');
195
- const direction = getComputedStyle(root).direction || directionElement?.dir || 'ltr';
196
- const forward = direction === 'rtl' ? 'ArrowLeft' : 'ArrowRight';
197
- const backward = direction === 'rtl' ? 'ArrowRight' : 'ArrowLeft';
198
- let candidates = [];
199
- if (event.key === 'Home')
200
- candidates = available;
201
- else if (event.key === 'End')
202
- candidates = available.slice().reverse();
203
- else if (event.key === (orientation === 'vertical' ? 'ArrowDown' : forward))
204
- candidates = index >= 0
205
- ? available.slice(index + 1)
206
- : available.filter(tool => !!(current.compareDocumentPosition(tool) & Node.DOCUMENT_POSITION_FOLLOWING));
207
- else if (event.key === (orientation === 'vertical' ? 'ArrowUp' : backward))
208
- candidates = index >= 0
209
- ? available.slice(0, index).reverse()
210
- : available.slice().reverse().filter(tool => !!(current.compareDocumentPosition(tool) & Node.DOCUMENT_POSITION_PRECEDING));
211
- for (const candidate of candidates) {
212
- if (candidate === current)
213
- return;
214
- candidate.focus();
215
- if (candidate.getRootNode().activeElement === candidate || candidate.matches(':focus')) {
216
- event.preventDefault();
217
- return;
218
- }
219
- }
18
+ const candidates = candidatesFor(event.key, orientation, resolveDirection(root), availableTools(root, state), current);
19
+ if (focusFirstFocusable(candidates, current))
20
+ event.preventDefault();
220
21
  };
221
22
  return { rootRef, onKeyDown, roving };
222
23
  };
@@ -1 +1 @@
1
- {"version":3,"file":"useToolbarKeyboardNavigation.js","sources":["../../../Common/useToolbarKeyboardNavigation.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { useCallback, useLayoutEffect, useMemo, useRef, type KeyboardEvent } from 'react';\nimport { ToolbarFocusMode } from './ToolbarFocusMode';\nimport type { ToolbarRoving } from './ToolbarRovingContext';\n\nconst toolSelector = 'button, a[href], input, select, textarea, [tabindex]';\nconst widgetSelector = 'input:not([type=\"button\"]):not([type=\"submit\"]):not([type=\"reset\"]), textarea, select, [contenteditable]:not([contenteditable=\"false\"]), [role=\"slider\"], [role=\"spinbutton\"], [role=\"textbox\"], [role=\"combobox\"], [role=\"listbox\"], [role=\"menu\"], [role=\"menubar\"], [role=\"tree\"], [role=\"grid\"], [role=\"application\"]';\n\ntype Orientation = 'horizontal' | 'vertical';\n\n/** Components-owned toolbar focus behavior; never captures keys from child widgets. */\nexport const useToolbarKeyboardNavigation = (orientation: Orientation, focusMode: ToolbarFocusMode) => {\n const rootRef = useRef<HTMLDivElement>(null);\n const singleTabStop = focusMode === ToolbarFocusMode.SingleTabStop;\n // Tools the toolbar owns in single-Tab-stop mode. Their -1 tab index comes from this toolbar,\n // so it does not make them unreachable by arrow keys.\n const managedByKey = useRef(new Map<string, HTMLElement>());\n const keyByManaged = useRef(new Map<HTMLElement, string>());\n const activeKeyRef = useRef<string | null>(null);\n const listeners = useRef(new Set<() => void>());\n\n // Keys of managed tools that lie in this toolbar's own DOM scope. A tool rendered through a\n // portal or under a nested consumer toolbar can never be reached from here, so it keeps its\n // native Tab stop instead of a -1 the toolbar could never lift.\n const inScopeRef = useRef(new Set<string>());\n const resizeObserverRef = useRef<ResizeObserver | null>(null);\n\n const isInToolbarScope = useCallback((tool: Element) => {\n const root = rootRef.current;\n return !!root && tool !== root && root.contains(tool) && tool.closest('[role=\"toolbar\"]') === root;\n }, []);\n\n const isAvailable = useCallback((tool: HTMLElement) => {\n const root = rootRef.current;\n if (!root || !isInToolbarScope(tool) || tool.matches(':disabled, [disabled], [aria-disabled=\"true\"]')) return false;\n if (tool.getAttribute('tabindex') === '-1' && !keyByManaged.current.has(tool)) return false;\n for (let element: HTMLElement | null = tool; element && element !== root; element = element.parentElement) {\n if (element.hidden || element.hasAttribute('inert') || element.getAttribute('aria-hidden') === 'true') return false;\n const style = getComputedStyle(element);\n if (style.display === 'none' || style.visibility === 'hidden' || style.visibility === 'collapse') return false;\n }\n return true;\n }, [isInToolbarScope]);\n\n const tools = useCallback(() => {\n const root = rootRef.current;\n if (!root) return [];\n return Array.from(root.querySelectorAll<HTMLElement>(toolSelector)).filter(isAvailable);\n }, [isAvailable]);\n\n const notify = useCallback(() => listeners.current.forEach(listener => listener()), []);\n\n const setActiveKey = useCallback((key: string | null) => {\n if (activeKeyRef.current === key) return false;\n activeKeyRef.current = key;\n notify();\n return true;\n }, [notify]);\n\n // Keep the active tool available: when it is removed, disabled, hidden, moved out of scope, or\n // opts out with its own tab index, the first available tool the toolbar owns becomes the single\n // Tab stop. This only changes the toolbar's own state; tools render their tab index from it.\n const reconcile = useCallback(() => {\n if (!singleTabStop) return;\n let scopeChanged = false;\n for (const key of inScopeRef.current) {\n if (!managedByKey.current.has(key)) inScopeRef.current.delete(key);\n }\n for (const [key, element] of managedByKey.current) {\n const inside = isInToolbarScope(element);\n if (inside === inScopeRef.current.has(key)) continue;\n if (inside) inScopeRef.current.add(key);\n else inScopeRef.current.delete(key);\n scopeChanged = true;\n }\n const current = activeKeyRef.current;\n const element = current === null ? undefined : managedByKey.current.get(current);\n // Checking the active tool alone is enough on most renders; the full scan runs only when it is gone.\n if (!(element && inScopeRef.current.has(current!) && isAvailable(element))) {\n const first = tools().find(tool => inScopeRef.current.has(keyByManaged.current.get(tool) ?? ''));\n if (setActiveKey(first ? keyByManaged.current.get(first)! : null)) return;\n }\n if (scopeChanged) notify();\n }, [singleTabStop, isInToolbarScope, isAvailable, tools, setActiveKey, notify]);\n\n // Several registrations and mutations in one commit or frame need only one check.\n const reconcileScheduled = useRef(false);\n const scheduleReconcile = useCallback(() => {\n if (reconcileScheduled.current) return;\n reconcileScheduled.current = true;\n queueMicrotask(() => {\n reconcileScheduled.current = false;\n reconcile();\n });\n }, [reconcile]);\n\n // Tools that unregistered and did not register again: forget them, and choose a new Tab stop\n // if one of them was active (unmounted, or given its own tab index).\n const pendingRemovalRef = useRef(new Set<string>());\n const removalCheckScheduledRef = useRef(false);\n const scheduleRemovalCheck = useCallback(() => {\n if (removalCheckScheduledRef.current) return;\n removalCheckScheduledRef.current = true;\n queueMicrotask(() => {\n removalCheckScheduledRef.current = false;\n if (pendingRemovalRef.current.size === 0) return;\n for (const key of pendingRemovalRef.current) {\n const element = managedByKey.current.get(key);\n if (element) {\n keyByManaged.current.delete(element);\n resizeObserverRef.current?.unobserve(element);\n }\n managedByKey.current.delete(key);\n }\n pendingRemovalRef.current.clear();\n reconcile();\n });\n }, [reconcile]);\n\n useLayoutEffect(reconcile);\n useLayoutEffect(() => {\n const root = rootRef.current;\n if (!root || !singleTabStop) return;\n // Only changes on a managed tool or one of its ancestors can make it unavailable.\n const affectsManagedTool = (record: MutationRecord) => {\n if (record.type === 'childList') return true;\n for (const tool of keyByManaged.current.keys()) {\n if (record.target === tool || record.target.contains(tool)) return true;\n }\n return false;\n };\n const observer = new MutationObserver(records => {\n if (records.some(affectsManagedTool)) scheduleReconcile();\n });\n observer.observe(root, {\n childList: true,\n subtree: true,\n attributes: true,\n attributeFilter: ['hidden', 'inert', 'aria-hidden', 'aria-disabled', 'disabled', 'style', 'class'],\n });\n // Hiding through a stylesheet alone, such as a media query, changes no attribute; the\n // hidden tool's box collapses instead.\n if (typeof ResizeObserver !== 'undefined') {\n resizeObserverRef.current = new ResizeObserver(scheduleReconcile);\n managedByKey.current.forEach(tool => resizeObserverRef.current!.observe(tool));\n }\n return () => {\n observer.disconnect();\n resizeObserverRef.current?.disconnect();\n resizeObserverRef.current = null;\n };\n }, [singleTabStop, scheduleReconcile]);\n\n const roving = useMemo<ToolbarRoving | null>(() => singleTabStop ? {\n getActiveKey: () => activeKeyRef.current,\n isInScope: key => inScopeRef.current.has(key),\n subscribe: listener => {\n listeners.current.add(listener);\n return () => listeners.current.delete(listener);\n },\n register: (key, element) => {\n const previous = managedByKey.current.get(key);\n if (!element) {\n // A tooltip wrapper builds a new merged ref on every render, so React detaches and\n // re-attaches the same element within one commit. Removal waits for a microtask,\n // and a re-attach of the same element in between costs nothing.\n if (previous) pendingRemovalRef.current.add(key);\n scheduleRemovalCheck();\n return;\n }\n if (previous === element && pendingRemovalRef.current.delete(key)) return;\n pendingRemovalRef.current.delete(key);\n if (previous === element) return;\n if (previous) {\n keyByManaged.current.delete(previous);\n resizeObserverRef.current?.unobserve(previous);\n }\n managedByKey.current.set(key, element);\n keyByManaged.current.set(element, key);\n resizeObserverRef.current?.observe(element);\n // A new tool may be the first available one or lie out of scope.\n scheduleReconcile();\n },\n // A tool outside the toolbar's scope cannot hold its single Tab stop.\n activate: key => {\n if (inScopeRef.current.has(key)) setActiveKey(key);\n },\n } : null, [singleTabStop, scheduleReconcile, scheduleRemovalCheck, setActiveKey]);\n\n const onKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n if (focusMode === ToolbarFocusMode.None || event.defaultPrevented || event.isPropagationStopped() ||\n event.altKey || event.ctrlKey || event.metaKey || event.shiftKey || event.nativeEvent.isComposing) return;\n const root = rootRef.current;\n const target = event.target;\n // React events from a portal may bubble here without a DOM ancestor relationship.\n if (!(target instanceof Element) || !root?.contains(target) ||\n target.closest('[role=\"toolbar\"]') !== root) return;\n for (let element: Element | null = target; element && element !== root; element = element.parentElement) {\n if (element.matches(widgetSelector)) return;\n }\n const available = tools();\n const current = target.closest<HTMLElement>(toolSelector);\n if (!current || current === root || current.closest('[role=\"toolbar\"]') !== root) return;\n const index = available.indexOf(current);\n\n const directionElement = root.closest<HTMLElement>('[dir]');\n const direction = getComputedStyle(root).direction || directionElement?.dir || 'ltr';\n const forward = direction === 'rtl' ? 'ArrowLeft' : 'ArrowRight';\n const backward = direction === 'rtl' ? 'ArrowRight' : 'ArrowLeft';\n let candidates: HTMLElement[] = [];\n if (event.key === 'Home') candidates = available;\n else if (event.key === 'End') candidates = available.slice().reverse();\n else if (event.key === (orientation === 'vertical' ? 'ArrowDown' : forward)) candidates = index >= 0\n ? available.slice(index + 1)\n : available.filter(tool => !!(current.compareDocumentPosition(tool) & Node.DOCUMENT_POSITION_FOLLOWING));\n else if (event.key === (orientation === 'vertical' ? 'ArrowUp' : backward)) candidates = index >= 0\n ? available.slice(0, index).reverse()\n : available.slice().reverse().filter(tool => !!(current.compareDocumentPosition(tool) & Node.DOCUMENT_POSITION_PRECEDING));\n for (const candidate of candidates) {\n if (candidate === current) return;\n candidate.focus();\n if ((candidate.getRootNode() as Document | ShadowRoot).activeElement === candidate || candidate.matches(':focus')) {\n event.preventDefault();\n return;\n }\n }\n };\n\n return { rootRef, onKeyDown, roving };\n};\n"],"names":[],"mappings":";;;AAOA,MAAM,YAAY,GAAG,sDAAsD;AAC3E,MAAM,cAAc,GAAG,2TAA2T;MAKrU,4BAA4B,GAAG,CAAC,WAAwB,EAAE,SAA2B,KAAI;AAClG,IAAA,MAAM,OAAO,GAAG,MAAM,CAAiB,IAAI,CAAC;AAC5C,IAAA,MAAM,aAAa,GAAG,SAAS,KAAK,gBAAgB,CAAC,aAAa;IAGlE,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,GAAG,EAAuB,CAAC;IAC3D,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,GAAG,EAAuB,CAAC;AAC3D,IAAA,MAAM,YAAY,GAAG,MAAM,CAAgB,IAAI,CAAC;IAChD,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,GAAG,EAAc,CAAC;IAK/C,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,GAAG,EAAU,CAAC;AAC5C,IAAA,MAAM,iBAAiB,GAAG,MAAM,CAAwB,IAAI,CAAC;AAE7D,IAAA,MAAM,gBAAgB,GAAG,WAAW,CAAC,CAAC,IAAa,KAAI;AACnD,QAAA,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO;QAC5B,OAAO,CAAC,CAAC,IAAI,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,OAAO,C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cAAc,EAAE;gBACtB;YACJ;QACJ;AACJ,IAAA,CAAC;AAED,IAAA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE;AACzC;;"}
1
+ {"version":3,"file":"useToolbarKeyboardNavigation.js","sources":["../../../Common/useToolbarKeyboardNavigation.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { useRef, type KeyboardEvent } from 'react';\nimport { ToolbarFocusMode } from './ToolbarFocusMode';\nimport { resolveDirection, resolveKeyTool, shouldIgnoreKey } from './toolbarFocusQueries';\nimport { candidatesFor, focusFirstFocusable } from './toolbarNavigationCandidates';\nimport { availableTools } from './toolbarTabStop';\nimport { useToolbarTabStop } from './useToolbarTabStop';\n\ntype Orientation = 'horizontal' | 'vertical';\n\n/** Components-owned toolbar focus behavior; never captures keys from child widgets. */\nexport const useToolbarKeyboardNavigation = (orientation: Orientation, focusMode: ToolbarFocusMode) => {\n const rootRef = useRef<HTMLDivElement>(null);\n const { state, roving } = useToolbarTabStop(rootRef, focusMode === ToolbarFocusMode.SingleTabStop);\n\n const onKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n if (shouldIgnoreKey(event, focusMode)) return;\n const root = rootRef.current;\n const current = resolveKeyTool(root, event.target);\n if (!root || !current) return;\n const candidates = candidatesFor(event.key, orientation, resolveDirection(root), availableTools(root, state), current);\n if (focusFirstFocusable(candidates, current)) event.preventDefault();\n };\n\n return { rootRef, onKeyDown, roving };\n};\n"],"names":[],"mappings":";;;;;;;MAaa,4BAA4B,GAAG,CAAC,WAAwB,EAAE,SAA2B,KAAI;AAClG,IAAA,MAAM,OAAO,GAAG,MAAM,CAAiB,IAAI,CAAC;AAC5C,IAAA,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,iBAAiB,CAAC,OAAO,EAAE,SAAS,KAAK,gBAAgB,CAAC,aAAa,CAAC;AAElG,IAAA,MAAM,SAAS,GAAG,CAAC,KAAoC,KAAI;AACvD,QAAA,IAAI,eAAe,CAAC,KAAK,EAAE,SAAS,CAAC;YAAE;AACvC,QAAA,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO;QAC5B,MAAM,OAAO,GAAG,cAAc,CAAC,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC;AAClD,QAAA,IAAI,CAAC,IAAI,IAAI,CAAC,OAAO;YAAE;QACvB,MAAM,UAAU,GAAG,aAAa,CAAC,KAAK,CAAC,GAAG,EAAE,WAAW,EAAE,gBAAgB,CAAC,IAAI,CAAC,EAAE,cAAc,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,OAAO,CAAC;AACtH,QAAA,IAAI,mBAAmB,CAAC,UAAU,EAAE,OAAO,CAAC;YAAE,KAAK,CAAC,cAAc,EAAE;AACxE,IAAA,CAAC;AAED,IAAA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE;AACzC;;"}
@@ -0,0 +1,9 @@
1
+ import { type RefObject } from 'react';
2
+ import type { ToolbarRoving } from './ToolbarRovingContext.js';
3
+ import { type ToolbarTabStopState } from './toolbarTabStop.js';
4
+ /** Owns the single Tab stop of a toolbar: which managed tool is active, and the roving context tools register with. */
5
+ export declare const useToolbarTabStop: (rootRef: RefObject<HTMLElement | null>, singleTabStop: boolean) => {
6
+ state: ToolbarTabStopState;
7
+ roving: ToolbarRoving | null;
8
+ };
9
+ //# sourceMappingURL=useToolbarTabStop.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useToolbarTabStop.d.ts","sourceRoot":"","sources":["../../../Common/useToolbarTabStop.ts"],"names":[],"mappings":"AAGA,OAAO,EAAmD,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACxF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAAwB,CAAC;AAC5D,OAAO,EAOH,KAAK,mBAAmB,EAC3B,MAAM,qBAAkB,CAAC;AAmC1B,uHAAuH;AACvH,eAAO,MAAM,iBAAiB,YAAa,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,iBAAiB,OAAO;;;CAmD/F,CAAC"}
@@ -0,0 +1,81 @@
1
+ import { useState, useCallback, useLayoutEffect, useMemo } from 'react';
2
+ import { createToolbarTabStopState, reconcileTabStop, dropPendingRemovals, setActiveKey, markForRemoval, registerManagedTool } from './toolbarTabStop.js';
3
+ import { useMicrotaskScheduler } from './useMicrotaskScheduler.js';
4
+
5
+ const affectsManagedTool = (state, record) => {
6
+ if (record.type === 'childList')
7
+ return true;
8
+ for (const tool of state.keyByManaged.keys()) {
9
+ if (record.target === tool || record.target.contains(tool))
10
+ return true;
11
+ }
12
+ return false;
13
+ };
14
+ const observeToolbar = (root, state, scheduleReconcile) => {
15
+ const observer = new MutationObserver(records => {
16
+ if (records.some(record => affectsManagedTool(state, record)))
17
+ scheduleReconcile();
18
+ });
19
+ observer.observe(root, {
20
+ childList: true,
21
+ subtree: true,
22
+ attributes: true,
23
+ attributeFilter: ['hidden', 'inert', 'aria-hidden', 'aria-disabled', 'disabled', 'style', 'class'],
24
+ });
25
+ if (typeof ResizeObserver !== 'undefined') {
26
+ state.resizeObserver = new ResizeObserver(scheduleReconcile);
27
+ state.managedByKey.forEach(tool => state.resizeObserver.observe(tool));
28
+ }
29
+ return () => {
30
+ observer.disconnect();
31
+ state.resizeObserver?.disconnect();
32
+ state.resizeObserver = null;
33
+ };
34
+ };
35
+ const useToolbarTabStop = (rootRef, singleTabStop) => {
36
+ const [state] = useState(createToolbarTabStopState);
37
+ const reconcile = useCallback(() => {
38
+ if (singleTabStop)
39
+ reconcileTabStop(rootRef.current, state);
40
+ }, [singleTabStop, rootRef, state]);
41
+ const scheduleReconcile = useMicrotaskScheduler(reconcile);
42
+ const processRemovals = useCallback(() => {
43
+ if (state.pendingRemoval.size === 0)
44
+ return;
45
+ dropPendingRemovals(state);
46
+ reconcile();
47
+ }, [state, reconcile]);
48
+ const scheduleRemovalCheck = useMicrotaskScheduler(processRemovals);
49
+ useLayoutEffect(reconcile);
50
+ useLayoutEffect(() => {
51
+ const root = rootRef.current;
52
+ if (!root || !singleTabStop)
53
+ return;
54
+ return observeToolbar(root, state, scheduleReconcile);
55
+ }, [singleTabStop, scheduleReconcile, rootRef, state]);
56
+ const roving = useMemo(() => singleTabStop ? {
57
+ getActiveKey: () => state.activeKey,
58
+ isInScope: key => state.inScope.has(key),
59
+ subscribe: listener => {
60
+ state.listeners.add(listener);
61
+ return () => state.listeners.delete(listener);
62
+ },
63
+ register: (key, element) => {
64
+ if (!element) {
65
+ markForRemoval(state, key);
66
+ scheduleRemovalCheck();
67
+ return;
68
+ }
69
+ if (registerManagedTool(state, key, element))
70
+ scheduleReconcile();
71
+ },
72
+ activate: key => {
73
+ if (state.inScope.has(key))
74
+ setActiveKey(state, key);
75
+ },
76
+ } : null, [singleTabStop, state, scheduleReconcile, scheduleRemovalCheck]);
77
+ return { state, roving };
78
+ };
79
+
80
+ export { useToolbarTabStop };
81
+ //# sourceMappingURL=useToolbarTabStop.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useToolbarTabStop.js","sources":["../../../Common/useToolbarTabStop.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { useCallback, useLayoutEffect, useMemo, useState, type RefObject } from 'react';\nimport type { ToolbarRoving } from './ToolbarRovingContext';\nimport {\n createToolbarTabStopState,\n dropPendingRemovals,\n markForRemoval,\n reconcileTabStop,\n registerManagedTool,\n setActiveKey,\n type ToolbarTabStopState,\n} from './toolbarTabStop';\nimport { useMicrotaskScheduler } from './useMicrotaskScheduler';\n\n// Only changes on a managed tool or one of its ancestors can make it unavailable.\nconst affectsManagedTool = (state: ToolbarTabStopState, record: MutationRecord): boolean => {\n if (record.type === 'childList') return true;\n for (const tool of state.keyByManaged.keys()) {\n if (record.target === tool || record.target.contains(tool)) return true;\n }\n return false;\n};\n\nconst observeToolbar = (root: HTMLElement, state: ToolbarTabStopState, scheduleReconcile: () => void) => {\n const observer = new MutationObserver(records => {\n if (records.some(record => affectsManagedTool(state, record))) scheduleReconcile();\n });\n observer.observe(root, {\n childList: true,\n subtree: true,\n attributes: true,\n attributeFilter: ['hidden', 'inert', 'aria-hidden', 'aria-disabled', 'disabled', 'style', 'class'],\n });\n // Hiding through a stylesheet alone, such as a media query, changes no attribute; the\n // hidden tool's box collapses instead.\n if (typeof ResizeObserver !== 'undefined') {\n state.resizeObserver = new ResizeObserver(scheduleReconcile);\n state.managedByKey.forEach(tool => state.resizeObserver!.observe(tool));\n }\n return () => {\n observer.disconnect();\n state.resizeObserver?.disconnect();\n state.resizeObserver = null;\n };\n};\n\n/** Owns the single Tab stop of a toolbar: which managed tool is active, and the roving context tools register with. */\nexport const useToolbarTabStop = (rootRef: RefObject<HTMLElement | null>, singleTabStop: boolean) => {\n const [state] = useState(createToolbarTabStopState);\n\n const reconcile = useCallback(() => {\n if (singleTabStop) reconcileTabStop(rootRef.current, state);\n }, [singleTabStop, rootRef, state]);\n\n // Several registrations and mutations in one commit or frame need only one check.\n const scheduleReconcile = useMicrotaskScheduler(reconcile);\n\n // Tools that unregistered and did not register again: forget them, and choose a new Tab stop\n // if one of them was active (unmounted, or given its own tab index).\n const processRemovals = useCallback(() => {\n if (state.pendingRemoval.size === 0) return;\n dropPendingRemovals(state);\n reconcile();\n }, [state, reconcile]);\n const scheduleRemovalCheck = useMicrotaskScheduler(processRemovals);\n\n useLayoutEffect(reconcile);\n useLayoutEffect(() => {\n const root = rootRef.current;\n if (!root || !singleTabStop) return;\n return observeToolbar(root, state, scheduleReconcile);\n }, [singleTabStop, scheduleReconcile, rootRef, state]);\n\n const roving = useMemo<ToolbarRoving | null>(() => singleTabStop ? {\n getActiveKey: () => state.activeKey,\n isInScope: key => state.inScope.has(key),\n subscribe: listener => {\n state.listeners.add(listener);\n return () => state.listeners.delete(listener);\n },\n register: (key, element) => {\n if (!element) {\n // A tooltip wrapper builds a new merged ref on every render, so React detaches and\n // re-attaches the same element within one commit. Removal waits for a microtask.\n markForRemoval(state, key);\n scheduleRemovalCheck();\n return;\n }\n // A new tool may be the first available one or lie out of scope.\n if (registerManagedTool(state, key, element)) scheduleReconcile();\n },\n // A tool outside the toolbar's scope cannot hold its single Tab stop.\n activate: key => {\n if (state.inScope.has(key)) setActiveKey(state, key);\n },\n } : null, [singleTabStop, state, scheduleReconcile, scheduleRemovalCheck]);\n\n return { state, roving };\n};\n"],"names":[],"mappings":";;;;AAiBA,MAAM,kBAAkB,GAAG,CAAC,KAA0B,EAAE,MAAsB,KAAa;AACvF,IAAA,IAAI,MAAM,CAAC,IAAI,KAAK,WAAW;AAAE,QAAA,OAAO,IAAI;IAC5C,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,YAAY,CAAC,IAAI,EAAE,EAAE;AAC1C,QAAA,IAAI,MAAM,CAAC,MAAM,KAAK,IAAI,IAAI,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC;AAAE,YAAA,OAAO,IAAI;IAC3E;AACA,IAAA,OAAO,KAAK;AAChB,CAAC;AAED,MAAM,cAAc,GAAG,CAAC,IAAiB,EAAE,KAA0B,EAAE,iBAA6B,KAAI;AACpG,IAAA,MAAM,QAAQ,GAAG,IAAI,gBAAgB,CAAC,OAAO,IAAG;AAC5C,QAAA,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,IAAI,kBAAkB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;AAAE,YAAA,iBAAiB,EAAE;AACtF,IAAA,CAAC,CAAC;AACF,IAAA,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE;AACnB,QAAA,SAAS,EAAE,IAAI;AACf,QAAA,OAAO,EAAE,IAAI;AACb,QAAA,UAAU,EAAE,IAAI;AAChB,QAAA,eAAe,EAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,CAAC;AACrG,KAAA,CAAC;AAGF,IAAA,IAA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AAO,cAAc,CAAC,IAAI,EAAE,KAAK,EAAE,iBAAiB,CAAC;IACzD,CAAC,EAAE,CAAC,aAAa,EAAE,iBAAiB,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;IAEtD,MAAM,MAAM,GAAG,OAAO,CAAuB,MAAM,aAAa,GAAG;AAC/D,QAAA,YAAY,EAAE,MAAM,KAAK,CAAC,SAAS;AACnC,QAAA,SAAS,EAAE,GAAG,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC;QACxC,SAAS,EAAE,QAAQ,IAAG;AAClB,YAAA,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC;YAC7B,OAAO,MAAM,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC;QACjD,CAAC;AACD,QAAA,QAAQ,EAAE,CAAC,GAAG,EAAE,OAAO,KAAI;YACvB,IAAI,CAAC,OAAO,EAAE;AAGV,gBAAA,cAAc,CAAC,KAAK,EAAE,GAAG,CAAC;AAC1B,gBAAA,oBAAoB,EAAE;gBACtB;YACJ;AAEA,YAAA,IAAI,mBAAmB,CAAC,KAAK,EAAE,GAAG,EAAE,OAAO,CAAC;AAAE,gBAAA,iBAAiB,EAAE;QACrE,CAAC;QAED,QAAQ,EAAE,GAAG,IAAG;AACZ,YAAA,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC;AAAE,gBAAA,YAAY,CAAC,KAAK,EAAE,GAAG,CAAC;QACxD,CAAC;AACJ,KAAA,GAAG,IAAI,EAAE,CAAC,aAAa,EAAE,KAAK,EAAE,iBAAiB,EAAE,oBAAoB,CAAC,CAAC;AAE1E,IAAA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE;AAC5B;;"}
@@ -0,0 +1,13 @@
1
+ import type { RefObject } from 'react';
2
+ /** The part of the ComboBox lifecycle a commit has to reach, from outside the ComboBox subtree. */
3
+ export interface CommittableComboBox {
4
+ close: () => void;
5
+ }
6
+ /**
7
+ * Publishes the ComboBox state to the commit handler, which is declared outside the ComboBox and so
8
+ * cannot read the context itself. Renders nothing.
9
+ */
10
+ export declare const ComboBoxCommitBridge: ({ handle, }: {
11
+ handle: RefObject<CommittableComboBox | null>;
12
+ }) => null;
13
+ //# sourceMappingURL=ComboBoxCommitBridge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ComboBoxCommitBridge.d.ts","sourceRoot":"","sources":["../../../Dropdown/ComboBoxCommitBridge.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,mGAAmG;AACnG,MAAM,WAAW,mBAAmB;IAChC,KAAK,EAAE,MAAM,IAAI,CAAC;CACrB;AAED;;;GAGG;AACH,eAAO,MAAM,oBAAoB,gBAE9B;IACC,MAAM,EAAE,SAAS,CAAC,mBAAmB,GAAG,IAAI,CAAC,CAAC;CACjD,SASA,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { useContext, useEffect } from 'react';
2
+ import { ComboBoxStateContext } from 'react-aria-components/ComboBox';
3
+
4
+ const ComboBoxCommitBridge = ({ handle, }) => {
5
+ const state = useContext(ComboBoxStateContext);
6
+ useEffect(() => {
7
+ handle.current = state;
8
+ return () => {
9
+ handle.current = null;
10
+ };
11
+ });
12
+ return null;
13
+ };
14
+
15
+ export { ComboBoxCommitBridge };
16
+ //# sourceMappingURL=ComboBoxCommitBridge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ComboBoxCommitBridge.js","sources":["../../../Dropdown/ComboBoxCommitBridge.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { useContext, useEffect } from 'react';\nimport type { RefObject } from 'react';\nimport { ComboBoxStateContext } from 'react-aria-components/ComboBox';\n\n/** The part of the ComboBox lifecycle a commit has to reach, from outside the ComboBox subtree. */\nexport interface CommittableComboBox {\n close: () => void;\n}\n\n/**\n * Publishes the ComboBox state to the commit handler, which is declared outside the ComboBox and so\n * cannot read the context itself. Renders nothing.\n */\nexport const ComboBoxCommitBridge = ({\n handle,\n}: {\n handle: RefObject<CommittableComboBox | null>;\n}) => {\n const state = useContext(ComboBoxStateContext);\n useEffect(() => {\n handle.current = state;\n return () => {\n handle.current = null;\n };\n });\n return null;\n};\n"],"names":[],"mappings":";;;MAgBa,oBAAoB,GAAG,CAAC,EACjC,MAAM,GAGT,KAAI;AACD,IAAA,MAAM,KAAK,GAAG,UAAU,CAAC,oBAAoB,CAAC;IAC9C,SAAS,CAAC,MAAK;AACX,QAAA,MAAM,CAAC,OAAO,GAAG,KAAK;AACtB,QAAA,OAAO,MAAK;AACR,YAAA,MAAM,CAAC,OAAO,GAAG,IAAI;AACzB,QAAA,CAAC;AACL,IAAA,CAAC,CAAC;AACF,IAAA,OAAO,IAAI;AACf;;"}
@@ -0,0 +1,10 @@
1
+ import type { DropdownProps } from './Dropdown.js';
2
+ import type { useDropdownHandlers } from './useDropdownHandlers.js';
3
+ import type { DropdownState } from './useDropdownState.js';
4
+ /** What every dropdown variant receives: the public props, the derived state and the handlers. */
5
+ export interface DropdownBranchProps<T> {
6
+ props: DropdownProps<T>;
7
+ state: DropdownState;
8
+ handlers: ReturnType<typeof useDropdownHandlers<T>>;
9
+ }
10
+ //# sourceMappingURL=DropdownBranchProps.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DropdownBranchProps.d.ts","sourceRoot":"","sources":["../../../Dropdown/DropdownBranchProps.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAY,CAAC;AAChD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAAuB,CAAC;AACjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAoB,CAAC;AAExD,kGAAkG;AAClG,MAAM,WAAW,mBAAmB,CAAC,CAAC;IAClC,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;IACxB,KAAK,EAAE,aAAa,CAAC;IACrB,QAAQ,EAAE,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC;CACvD"}
@@ -0,0 +1,4 @@
1
+ // Copyright (c) Cratis. All rights reserved.
2
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
+ export {};
4
+ //# sourceMappingURL=DropdownBranchProps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DropdownBranchProps.js","sourceRoot":"","sources":["../../../Dropdown/DropdownBranchProps.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG","sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport type { DropdownProps } from './Dropdown';\nimport type { useDropdownHandlers } from './useDropdownHandlers';\nimport type { DropdownState } from './useDropdownState';\n\n/** What every dropdown variant receives: the public props, the derived state and the handlers. */\nexport interface DropdownBranchProps<T> {\n props: DropdownProps<T>;\n state: DropdownState;\n handlers: ReturnType<typeof useDropdownHandlers<T>>;\n}\n"]}