@viasat/beam-react 2.30.0 → 2.36.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 (170) hide show
  1. package/assets/ActionList.css +1 -1
  2. package/assets/Avatar.css +1 -1
  3. package/assets/Badge.css +1 -1
  4. package/assets/Button.css +1 -1
  5. package/assets/Checkbox.css +1 -1
  6. package/assets/Chip.css +1 -1
  7. package/assets/ChipGroup.css +1 -1
  8. package/assets/CloseButton.css +1 -1
  9. package/assets/DateField.css +1 -0
  10. package/assets/EmptyState.css +1 -1
  11. package/assets/{floatingui.css → FloatingUI.css} +1 -1
  12. package/assets/InputChoiceGroup.css +1 -1
  13. package/assets/Link.css +1 -1
  14. package/assets/NativeSelect.css +1 -1
  15. package/assets/Pagination.css +1 -1
  16. package/assets/ProgressBar.css +1 -1
  17. package/assets/RadioButton.css +1 -1
  18. package/assets/Search.css +1 -1
  19. package/assets/SpinnerWrap.css +1 -1
  20. package/assets/Switch.css +1 -1
  21. package/assets/TextArea.css +1 -1
  22. package/assets/TextField.css +1 -1
  23. package/assets/card.css +1 -1
  24. package/assets/combobox.css +1 -1
  25. package/assets/fileUpload.css +1 -1
  26. package/assets/header.css +1 -1
  27. package/assets/index.css +1 -1
  28. package/assets/panel.css +1 -1
  29. package/assets/segmentedControl.css +1 -1
  30. package/assets/slider.css +1 -1
  31. package/assets/stepper.css +1 -1
  32. package/chunks/DateField.Segment.7oCeBSNo.js +1 -0
  33. package/chunks/DateField.Segment.DbjGMAPP.js +99 -0
  34. package/chunks/FloatingUI.arrow.DFhYQv_F.js +1 -0
  35. package/chunks/FloatingUI.arrow.tN5_IctZ.js +27 -0
  36. package/chunks/panel.module.BVmRxZHo.js +1 -0
  37. package/chunks/{panel.module.BblnuBjO.js → panel.module.CnHWv4EZ.js} +1 -3
  38. package/index.cjs.js +1 -1
  39. package/index.es.js +35 -33
  40. package/lib/ActionList/ActionList.Group.d.ts +1 -1
  41. package/lib/Autocomplete/Autocomplete.cjs.js +1 -1
  42. package/lib/Autocomplete/Autocomplete.d.ts +5 -5
  43. package/lib/Autocomplete/Autocomplete.es.js +296 -268
  44. package/lib/Autocomplete/AutocompleteDropdown.cjs.js +1 -1
  45. package/lib/Autocomplete/AutocompleteDropdown.es.js +15 -12
  46. package/lib/FloatingUI/FloatingUI.arrow.cjs.js +1 -1
  47. package/lib/FloatingUI/FloatingUI.arrow.es.js +6 -17
  48. package/lib/FloatingUI/FloatingUI.content.cjs.js +1 -1
  49. package/lib/FloatingUI/FloatingUI.content.es.js +17 -18
  50. package/lib/Search/SearchDropdown.cjs.js +1 -1
  51. package/lib/Search/SearchDropdown.es.js +1 -1
  52. package/lib/Select/Select.cjs.js +1 -1
  53. package/lib/Select/Select.d.ts +3 -2
  54. package/lib/Select/Select.es.js +208 -195
  55. package/lib/Select/SelectDropdown.cjs.js +1 -1
  56. package/lib/Select/SelectDropdown.es.js +15 -12
  57. package/lib/_Options/Option.cjs.js +1 -1
  58. package/lib/_Options/Option.context.cjs.js +1 -1
  59. package/lib/_Options/Option.context.d.ts +31 -13
  60. package/lib/_Options/Option.context.es.js +133 -88
  61. package/lib/_Options/Option.es.js +23 -21
  62. package/lib/_Options/Option.types.d.ts +23 -0
  63. package/lib/_Options/OptionGroup.cjs.js +1 -0
  64. package/lib/_Options/OptionGroup.context.cjs.js +1 -0
  65. package/lib/_Options/OptionGroup.context.d.ts +6 -0
  66. package/lib/_Options/OptionGroup.context.es.js +6 -0
  67. package/lib/_Options/OptionGroup.d.ts +3 -0
  68. package/lib/_Options/OptionGroup.es.js +22 -0
  69. package/lib/_Options/getLastVisibleStructureIndex.cjs.js +1 -0
  70. package/lib/_Options/getLastVisibleStructureIndex.d.ts +15 -0
  71. package/lib/_Options/getLastVisibleStructureIndex.es.js +14 -0
  72. package/lib/_Options/index.cjs.js +1 -1
  73. package/lib/_Options/index.d.ts +4 -0
  74. package/lib/_Options/index.es.js +13 -4
  75. package/lib/_Options/useRenderOption.cjs.js +1 -0
  76. package/lib/_Options/useRenderOption.d.ts +30 -0
  77. package/lib/_Options/useRenderOption.es.js +43 -0
  78. package/lib/index.cjs.js +1 -1
  79. package/lib/index.d.ts +1 -0
  80. package/lib/index.es.js +27 -25
  81. package/lib/wip/DateField/DateField.Segment.cjs.js +1 -0
  82. package/lib/wip/DateField/DateField.Segment.d.ts +2 -0
  83. package/lib/wip/DateField/DateField.Segment.es.js +8 -0
  84. package/lib/wip/DateField/DateField.Segments.cjs.js +1 -0
  85. package/lib/wip/DateField/DateField.Segments.d.ts +17 -0
  86. package/lib/wip/DateField/DateField.Segments.es.js +61 -0
  87. package/lib/wip/DateField/DateField.cjs.js +1 -0
  88. package/lib/wip/DateField/DateField.d.ts +3 -0
  89. package/lib/wip/DateField/DateField.es.js +191 -0
  90. package/lib/wip/DateField/DateField.types.cjs.js +1 -0
  91. package/lib/wip/DateField/DateField.types.d.ts +118 -0
  92. package/lib/wip/DateField/DateField.types.es.js +1 -0
  93. package/lib/wip/DateField/DateField.utils.cjs.js +1 -0
  94. package/lib/wip/DateField/DateField.utils.d.ts +26 -0
  95. package/lib/wip/DateField/DateField.utils.es.js +45 -0
  96. package/lib/wip/DateField/DateField.validation.cjs.js +1 -0
  97. package/lib/wip/DateField/DateField.validation.d.ts +26 -0
  98. package/lib/wip/DateField/DateField.validation.es.js +24 -0
  99. package/lib/wip/DateField/index.cjs.js +1 -0
  100. package/lib/wip/DateField/index.d.ts +2 -0
  101. package/lib/wip/DateField/index.es.js +4 -0
  102. package/lib/wip/DateField/useDateFieldFocus.cjs.js +1 -0
  103. package/lib/wip/DateField/useDateFieldFocus.d.ts +23 -0
  104. package/lib/wip/DateField/useDateFieldFocus.es.js +65 -0
  105. package/lib/wip/DateField/useDateFieldForm.cjs.js +1 -0
  106. package/lib/wip/DateField/useDateFieldForm.d.ts +32 -0
  107. package/lib/wip/DateField/useDateFieldForm.es.js +51 -0
  108. package/lib/wip/DateField/useDateFieldSegments.cjs.js +1 -0
  109. package/lib/wip/DateField/useDateFieldSegments.d.ts +7 -0
  110. package/lib/wip/DateField/useDateFieldSegments.es.js +13 -0
  111. package/lib/wip/DateField/useDateFieldValidity.cjs.js +1 -0
  112. package/lib/wip/DateField/useDateFieldValidity.d.ts +23 -0
  113. package/lib/wip/DateField/useDateFieldValidity.es.js +19 -0
  114. package/lib/wip/DateField/useDateFieldValue.cjs.js +1 -0
  115. package/lib/wip/DateField/useDateFieldValue.d.ts +19 -0
  116. package/lib/wip/DateField/useDateFieldValue.es.js +62 -0
  117. package/lib/wip/DateField/useInvalidState.cjs.js +1 -0
  118. package/lib/wip/DateField/useInvalidState.d.ts +13 -0
  119. package/lib/wip/DateField/useInvalidState.es.js +8 -0
  120. package/lib/wip/Panel/Footer/Panel.Footer.Actions.cjs.js +1 -1
  121. package/lib/wip/Panel/Footer/Panel.Footer.Actions.es.js +1 -1
  122. package/lib/wip/Panel/Footer/Panel.Footer.cjs.js +1 -1
  123. package/lib/wip/Panel/Footer/Panel.Footer.es.js +1 -1
  124. package/lib/wip/Panel/Header/Panel.Header.ContentAfter.cjs.js +1 -1
  125. package/lib/wip/Panel/Header/Panel.Header.ContentAfter.es.js +1 -1
  126. package/lib/wip/Panel/Header/Panel.Header.ContentBefore.cjs.js +1 -1
  127. package/lib/wip/Panel/Header/Panel.Header.ContentBefore.es.js +1 -1
  128. package/lib/wip/Panel/Header/Panel.Header.Description.cjs.js +1 -1
  129. package/lib/wip/Panel/Header/Panel.Header.Description.es.js +1 -1
  130. package/lib/wip/Panel/Header/Panel.Header.Heading.cjs.js +1 -1
  131. package/lib/wip/Panel/Header/Panel.Header.Heading.es.js +1 -1
  132. package/lib/wip/Panel/Header/Panel.Header.Row.cjs.js +1 -1
  133. package/lib/wip/Panel/Header/Panel.Header.Row.es.js +1 -1
  134. package/lib/wip/Panel/Header/Panel.Header.Subheader.cjs.js +1 -1
  135. package/lib/wip/Panel/Header/Panel.Header.Subheader.es.js +1 -1
  136. package/lib/wip/Panel/Header/Panel.Header.cjs.js +1 -1
  137. package/lib/wip/Panel/Header/Panel.Header.es.js +1 -1
  138. package/lib/wip/Panel/Panel.Body.cjs.js +1 -1
  139. package/lib/wip/Panel/Panel.Body.es.js +1 -1
  140. package/lib/wip/Panel/Panel.Inline.cjs.js +1 -1
  141. package/lib/wip/Panel/Panel.Inline.d.ts +3 -1
  142. package/lib/wip/Panel/Panel.Inline.es.js +44 -40
  143. package/lib/wip/Panel/Panel.Overlay.cjs.js +1 -1
  144. package/lib/wip/Panel/Panel.Overlay.d.ts +18 -2
  145. package/lib/wip/Panel/Panel.Overlay.es.js +110 -84
  146. package/lib/wip/Panel/Panel.ResizeHandle.cjs.js +1 -1
  147. package/lib/wip/Panel/Panel.ResizeHandle.es.js +1 -1
  148. package/lib/wip/Panel/Panel.cjs.js +1 -1
  149. package/lib/wip/Panel/Panel.d.ts +1 -1
  150. package/lib/wip/Panel/Panel.es.js +125 -94
  151. package/lib/wip/Panel/Panel.helpers.cjs.js +1 -1
  152. package/lib/wip/Panel/Panel.helpers.d.ts +2 -1
  153. package/lib/wip/Panel/Panel.helpers.es.js +37 -35
  154. package/lib/wip/Panel/Panel.types.d.ts +64 -10
  155. package/lib/wip/Panel/Panel.useResize.cjs.js +1 -1
  156. package/lib/wip/Panel/Panel.useResize.d.ts +3 -1
  157. package/lib/wip/Panel/Panel.useResize.es.js +34 -30
  158. package/package.json +6 -6
  159. package/utils/hooks/index.cjs.js +1 -1
  160. package/utils/hooks/index.d.ts +1 -0
  161. package/utils/hooks/index.es.js +12 -10
  162. package/utils/hooks/useElementResize.cjs.js +1 -1
  163. package/utils/hooks/useElementResize.d.ts +1 -1
  164. package/utils/hooks/useElementResize.es.js +33 -33
  165. package/utils/hooks/usePrevious.cjs.js +1 -0
  166. package/utils/hooks/usePrevious.d.ts +5 -0
  167. package/utils/hooks/usePrevious.es.js +10 -0
  168. package/chunks/floatingui.module.BcBFebz0.js +0 -10
  169. package/chunks/floatingui.module.D3Aw_aYe.js +0 -1
  170. package/chunks/panel.module.CVyUzyCZ.js +0 -1
@@ -1,298 +1,325 @@
1
- import { jsxs as C, jsx as i } from "react/jsx-runtime";
2
- import Qe, { useCallback as Ue, useState as Xe, useMemo as O, useRef as Ye, createElement as Ze } from "react";
3
- import { g as et } from "../../chunks/classNames.BTJmrO_L.js";
4
- import { t as tt } from "../../chunks/constants.CKKGf1-i.js";
1
+ import { jsxs as C, jsx as n } from "react/jsx-runtime";
2
+ import { g as st } from "../../chunks/classNames.BTJmrO_L.js";
3
+ import { t as it } from "../../chunks/constants.CKKGf1-i.js";
5
4
  import { s as r } from "../../chunks/combobox.module.D_HXP875.js";
6
- import L from "clsx";
7
- import { b as ot, H as st } from "../../chunks/form.context.D7b4066_.js";
8
- import { LabelProvider as rt } from "../Form/contexts/label.context.es.js";
9
- import { HelperTextProvider as lt } from "../Form/contexts/helperText.context.es.js";
10
- import { ActionList as T } from "../ActionList/ActionList.es.js";
11
- import { useCreateOptionsContext as it, OptionsProvider as at } from "../_Options/Option.context.es.js";
12
- import { Option as nt } from "../_Options/Option.es.js";
13
- import { useSelectValue as dt } from "../_Options/useSelectValue.es.js";
14
- import { useAutocompleteDropdown as ct } from "./useAutocompleteDropdown.es.js";
15
- import { AutocompleteDropdown as pt } from "./AutocompleteDropdown.es.js";
16
- import { useAutocompleteChips as ut } from "./useAutocompleteChips.es.js";
17
- import { useAutocompleteKeyboardManager as mt } from "./useAutocompleteKeyboardManager.es.js";
18
- import ft from "./utils/filterOptions.es.js";
19
- import bt from "./useClearSelection.es.js";
20
- import { AutocompleteField as ht } from "./AutocompleteField.es.js";
21
- import xt from "./useAutocompleteA11y.es.js";
22
- import { useAutocompleteInteractions as yt } from "./useAutocompleteInteractions.es.js";
23
- import { createSelectionStrategy as vt } from "../_Options/strategies/SelectionStrategy.es.js";
24
- import { OptionChips as Ct } from "../_Options/OptionChips.es.js";
25
- const { baseClassNamePrefix: Ot, subElementClassPrefix: R, classModifierPrefix: a } = et("combobox"), Pt = Qe.forwardRef(
5
+ import lt from "clsx";
6
+ import nt, { useCallback as at, useState as dt, useMemo as h, useRef as pt } from "react";
7
+ import { b as ct, H as ut } from "../../chunks/form.context.D7b4066_.js";
8
+ import { LabelProvider as mt } from "../Form/contexts/label.context.es.js";
9
+ import { HelperTextProvider as ft } from "../Form/contexts/helperText.context.es.js";
10
+ import { ActionList as Q } from "../ActionList/ActionList.es.js";
11
+ import { useCreateOptionsContext as bt, OptionsProvider as ht } from "../_Options/Option.context.es.js";
12
+ import { Option as xt } from "../_Options/Option.es.js";
13
+ import { OptionGroup as gt } from "../_Options/OptionGroup.es.js";
14
+ import "../_Options/OptionGroup.context.es.js";
15
+ import { getLastVisibleStructureIndex as yt } from "../_Options/getLastVisibleStructureIndex.es.js";
16
+ import { useRenderOption as vt } from "../_Options/useRenderOption.es.js";
17
+ import { useSelectValue as Ot } from "../_Options/useSelectValue.es.js";
18
+ import { useAutocompleteDropdown as Ct } from "./useAutocompleteDropdown.es.js";
19
+ import { AutocompleteDropdown as It } from "./AutocompleteDropdown.es.js";
20
+ import { useAutocompleteChips as Pt } from "./useAutocompleteChips.es.js";
21
+ import { useAutocompleteKeyboardManager as At } from "./useAutocompleteKeyboardManager.es.js";
22
+ import St from "./utils/filterOptions.es.js";
23
+ import Bt from "./useClearSelection.es.js";
24
+ import { AutocompleteField as Vt } from "./AutocompleteField.es.js";
25
+ import $t from "./useAutocompleteA11y.es.js";
26
+ import { useAutocompleteInteractions as Nt } from "./useAutocompleteInteractions.es.js";
27
+ import { createSelectionStrategy as wt } from "../_Options/strategies/SelectionStrategy.es.js";
28
+ import { OptionChips as Rt } from "../_Options/OptionChips.es.js";
29
+ const { baseClassNamePrefix: Dt, subElementClassPrefix: L, classModifierPrefix: a } = st("combobox"), Ft = nt.forwardRef(
26
30
  ({
27
- theme: P,
28
- width: K,
29
- error: d,
30
- children: G,
31
- label: W = null,
32
- contentBefore: _,
33
- contentAfter: z,
34
- fluid: J = !1,
35
- helperText: k = null,
36
- validationRules: Q = [],
37
- className: U,
38
- hideRequiredMarker: X = !1,
39
- disabled: Y = !1,
40
- readOnly: Z = !1,
41
- required: ee = !1,
42
- placeholder: te = "",
43
- onChange: f,
44
- noResultsText: oe = "No results found",
45
- optionFilter: g,
46
- hideChevron: se = !1,
47
- ...b
48
- }, re) => {
31
+ theme: I,
32
+ width: U,
33
+ error: p,
34
+ children: X,
35
+ label: Y = null,
36
+ contentBefore: Z,
37
+ contentAfter: ee,
38
+ fluid: te = !1,
39
+ helperText: q = null,
40
+ validationRules: oe = [],
41
+ className: re,
42
+ hideRequiredMarker: se = !1,
43
+ disabled: ie = !1,
44
+ readOnly: le = !1,
45
+ required: ne = !1,
46
+ placeholder: ae = "",
47
+ onChange: x,
48
+ noResultsText: de = "No results found",
49
+ optionFilter: P,
50
+ hideChevron: pe = !1,
51
+ ...g
52
+ }, ce) => {
49
53
  const {
50
- id: w,
51
- name: le,
52
- "aria-describedby": ie,
53
- multiple: o = !1,
54
- clearable: ae = o,
55
- ...ne
56
- } = b, { showErrors: de, isInvalid: ce, errorShown: pe, disabled: s, readOnly: l, required: I } = ot({
57
- name: le,
58
- validationRules: Q,
59
- disabledProp: Y,
60
- readOnlyProp: Z,
61
- requiredProp: ee
62
- }), { aria: h, ids: ue } = xt({
63
- helperText: k,
64
- externalDescribedBy: ie,
65
- error: d,
66
- errorShown: pe,
67
- invalid: !!d || ce
68
- }), { helperTextId: me, errorId: fe, validationErrorsId: be, labelId: A } = ue, he = !!(d != null && d.length), xe = Ue(
69
- (t) => {
70
- f == null || f(t);
54
+ id: H,
55
+ name: ue,
56
+ "aria-describedby": me,
57
+ multiple: t = !1,
58
+ clearable: fe = t,
59
+ ...be
60
+ } = g, { showErrors: he, isInvalid: xe, errorShown: ge, disabled: o, readOnly: i, required: A } = ct({
61
+ name: ue,
62
+ validationRules: oe,
63
+ disabledProp: ie,
64
+ readOnlyProp: le,
65
+ requiredProp: ne
66
+ }), { aria: y, ids: ye } = $t({
67
+ helperText: q,
68
+ externalDescribedBy: me,
69
+ error: p,
70
+ errorShown: ge,
71
+ invalid: !!p || xe
72
+ }), { helperTextId: ve, errorId: Oe, validationErrorsId: Ce, labelId: S } = ye, Ie = !!(p != null && p.length), Pe = at(
73
+ (e) => {
74
+ x == null || x(e);
71
75
  },
72
- [f]
76
+ [x]
73
77
  ), {
74
- value: c,
75
- setValue: E,
76
- selectProps: ye,
77
- handleBlur: ve,
78
- singleValue: S
79
- } = dt({ onChange: xe, ...b }, re), [p, $] = Xe(null), N = !p && (!c || Array.isArray(c) && !c.length), {
80
- optionsContext: Ce,
81
- optionIds: n,
82
- optionsProps: u,
83
- selectedOptionsProps: B,
84
- deselectOptionValue: M,
85
- getOptionByIndex: Oe
86
- } = it(c, E, o), Pe = O(() => {
87
- if (!S) return;
88
- const t = n.map((e) => u.get(e)).findIndex((e) => (e == null ? void 0 : e.value) === S);
89
- return t !== -1 ? t : void 0;
90
- }, [n, u, S]), D = Ye(null), {
91
- getFieldProps: ge,
92
- getInputProps: Ie,
93
- dropdownProps: Ae,
94
- refs: Se,
95
- open: V,
96
- setOpen: x,
97
- status: $e,
98
- setDisplayActiveIndex: Ne
99
- } = ct({
100
- disabled: s,
101
- readOnly: l,
102
- lastSelectedOptionIndex: Pe,
103
- fieldRef: D
104
- }), y = Se.domReference, Be = L(
105
- r[Ot],
106
- P && tt(P),
107
- J && r[`${a}fluid`],
108
- h.invalid && r[`${a}error`],
109
- s && r[`${a}disabled`],
110
- l && r[`${a}read-only`],
111
- N && r[`${a}empty`],
112
- o && r[`${a}multiple`],
78
+ value: u,
79
+ setValue: k,
80
+ selectProps: Ae,
81
+ handleBlur: Se,
82
+ singleValue: B
83
+ } = Ot({ onChange: Pe, ...g }, ce), [m, V] = dt(null), $ = !m && (!u || Array.isArray(u) && !u.length), {
84
+ optionsContext: Be,
85
+ optionIds: d,
86
+ optionsProps: f,
87
+ selectedOptionsProps: N,
88
+ deselectOptionValue: T,
89
+ getOptionByIndex: Ve,
90
+ structureIds: w,
91
+ groupsProps: R,
92
+ optionGroupOf: j,
93
+ optionIdsByGroup: D
94
+ } = bt(u, k, t), $e = h(() => {
95
+ if (!B) return;
96
+ const e = d.map((s) => f.get(s)).findIndex((s) => (s == null ? void 0 : s.value) === B);
97
+ return e !== -1 ? e : void 0;
98
+ }, [d, f, B]), F = pt(null), {
99
+ getFieldProps: Ne,
100
+ getInputProps: we,
101
+ dropdownProps: Re,
102
+ refs: De,
103
+ open: K,
104
+ setOpen: v,
105
+ status: Fe,
106
+ setDisplayActiveIndex: Ge
107
+ } = Ct({
108
+ disabled: o,
109
+ readOnly: i,
110
+ lastSelectedOptionIndex: $e,
111
+ fieldRef: F
112
+ }), O = De.domReference, Ee = lt(
113
+ r[Dt],
114
+ I && it(I),
115
+ te && r[`${a}fluid`],
116
+ y.invalid && r[`${a}error`],
117
+ o && r[`${a}disabled`],
118
+ i && r[`${a}read-only`],
119
+ $ && r[`${a}empty`],
120
+ t && r[`${a}multiple`],
113
121
  r[`${a}autocomplete`],
114
- r[`${a}dropdown-${$e}`],
115
- U
116
- ), { canClear: De, handleClear: Fe } = bt({
117
- multiple: o,
118
- clearable: ae,
119
- isEmpty: N,
120
- disabled: s,
121
- readOnly: l,
122
- setValue: E,
123
- setSearchText: $,
124
- inputRef: y,
125
- setOpen: x
122
+ r[`${a}dropdown-${Fe}`],
123
+ re
124
+ ), { canClear: Le, handleClear: Me } = Bt({
125
+ multiple: t,
126
+ clearable: fe,
127
+ isEmpty: $,
128
+ disabled: o,
129
+ readOnly: i,
130
+ setValue: k,
131
+ setSearchText: V,
132
+ inputRef: O,
133
+ setOpen: v
126
134
  }), {
127
- chipGroupProps: Re,
128
- handleBlur: ke,
129
- selectedChip: we,
130
- setSelectedChip: Ee,
131
- enabled: Me,
132
- selectPreviousChip: Ve,
133
- selectNextChip: qe,
134
- options: He,
135
- deselectOptionValue: Le
136
- } = ut({
137
- multiple: o,
138
- disabled: s,
139
- readOnly: l,
140
- open: V,
141
- setOpen: x,
142
- options: B,
143
- deselectOptionValue: M,
144
- fieldRef: D,
145
- inputRef: y
146
- }), { getKeyboardProps: q } = mt({
147
- multiple: o,
148
- disabled: s,
149
- readOnly: l,
150
- open: V,
151
- setOpen: x,
152
- inputRef: y,
153
- fieldRef: D,
135
+ chipGroupProps: qe,
136
+ handleBlur: He,
137
+ selectedChip: ke,
138
+ setSelectedChip: Te,
139
+ enabled: je,
140
+ selectPreviousChip: Ke,
141
+ selectNextChip: We,
142
+ options: _e,
143
+ deselectOptionValue: ze
144
+ } = Pt({
145
+ multiple: t,
146
+ disabled: o,
147
+ readOnly: i,
148
+ open: K,
149
+ setOpen: v,
150
+ options: N,
151
+ deselectOptionValue: T,
152
+ fieldRef: F,
153
+ inputRef: O
154
+ }), { getKeyboardProps: W } = At({
155
+ multiple: t,
156
+ disabled: o,
157
+ readOnly: i,
158
+ open: K,
159
+ setOpen: v,
160
+ inputRef: O,
161
+ fieldRef: F,
154
162
  chips: {
155
- enabled: Me,
156
- selectedChip: we,
157
- setSelectedChip: Ee,
158
- selectPreviousChip: Ve,
159
- selectNextChip: qe,
160
- options: He,
161
- deselectOptionValue: Le
163
+ enabled: je,
164
+ selectedChip: ke,
165
+ setSelectedChip: Te,
166
+ selectPreviousChip: Ke,
167
+ selectNextChip: We,
168
+ options: _e,
169
+ deselectOptionValue: ze
162
170
  }
163
- }), H = O(
164
- () => vt(o),
165
- [o]
166
- ), { handleBlur: Te, handleFocus: je, handleItemClick: Ke } = yt({
167
- selectionStrategy: H,
168
- selectedOptions: B,
169
- inputRef: y,
170
- blurSelect: ve,
171
- blurChips: ke,
172
- setSearchText: $,
173
- setOpen: x,
174
- searchText: p,
175
- getOptionByIndex: Oe,
176
- setDisplayActiveIndex: Ne
177
- }), F = O(
178
- () => n.reduce((t, e) => {
179
- const m = u.get(e);
180
- if (!m) return t;
181
- const v = g ? g(m, p) : ft(m, p);
182
- return t[e] = v, t;
171
+ }), _ = h(
172
+ () => wt(t),
173
+ [t]
174
+ ), { handleBlur: Je, handleFocus: Qe, handleItemClick: Ue } = Nt({
175
+ selectionStrategy: _,
176
+ selectedOptions: N,
177
+ inputRef: O,
178
+ blurSelect: Se,
179
+ blurChips: He,
180
+ setSearchText: V,
181
+ setOpen: v,
182
+ searchText: m,
183
+ getOptionByIndex: Ve,
184
+ setDisplayActiveIndex: Ge
185
+ }), c = h(
186
+ () => d.reduce((e, s) => {
187
+ const l = f.get(s);
188
+ if (!l) return e;
189
+ const b = j.get(s), J = b ? R.get(b) : void 0, G = P ? P(l, m, J) : St(l, m);
190
+ return e[s] = G, e;
183
191
  }, {}),
184
- [n, u, p, g]
185
- ), Ge = O(() => n.every((t) => F[t]), [n, F]), { ref: We, ..._e } = q(ge()), ze = q(Ie());
186
- return /* @__PURE__ */ C(at, { value: Ce, children: [
187
- /* @__PURE__ */ C("div", { className: Be, style: { maxWidth: K }, children: [
188
- /* @__PURE__ */ i(
189
- rt,
192
+ [
193
+ d,
194
+ f,
195
+ m,
196
+ P,
197
+ j,
198
+ R
199
+ ]
200
+ ), Xe = h(() => d.length === 0 ? !1 : d.every((e) => c[e]), [d, c]), Ye = h(
201
+ () => yt(
202
+ w,
203
+ D,
204
+ c
205
+ ),
206
+ [w, D, c]
207
+ ), z = vt({
208
+ optionsProps: f,
209
+ selectionStrategy: _,
210
+ value: u,
211
+ multiple: t,
212
+ optionClassName: r[`${L}option`],
213
+ filteredOptionsById: c
214
+ }), { ref: Ze, ...et } = W(Ne()), tt = W(we());
215
+ return /* @__PURE__ */ C(ht, { value: Be, children: [
216
+ /* @__PURE__ */ C("div", { className: Ee, style: { maxWidth: U }, children: [
217
+ /* @__PURE__ */ n(
218
+ mt,
190
219
  {
191
- ctxHtmlFor: w,
192
- ctxDisabled: s,
193
- ctxRequired: I && !X,
194
- ctxId: A,
195
- children: W
220
+ ctxHtmlFor: H,
221
+ ctxDisabled: o,
222
+ ctxRequired: A && !se,
223
+ ctxId: S,
224
+ children: Y
196
225
  }
197
226
  ),
198
- /* @__PURE__ */ i(
199
- ht,
227
+ /* @__PURE__ */ n(
228
+ Vt,
200
229
  {
201
- id: w,
202
- disabled: s,
203
- readOnly: l,
204
- required: I,
205
- contentBefore: _,
206
- contentAfter: z,
207
- chips: /* @__PURE__ */ i(
208
- Ct,
230
+ id: H,
231
+ disabled: o,
232
+ readOnly: i,
233
+ required: A,
234
+ contentBefore: Z,
235
+ contentAfter: ee,
236
+ chips: /* @__PURE__ */ n(
237
+ Rt,
209
238
  {
210
- multiple: o,
211
- disabled: s,
212
- readOnly: l,
213
- selectedOptions: B,
214
- deselectOptionValue: M,
215
- chipGroupProps: Re,
216
- input: /* @__PURE__ */ i(
239
+ multiple: t,
240
+ disabled: o,
241
+ readOnly: i,
242
+ selectedOptions: N,
243
+ deselectOptionValue: T,
244
+ chipGroupProps: qe,
245
+ input: /* @__PURE__ */ n(
217
246
  "input",
218
247
  {
219
- className: r[`${R}field__input`],
220
- "aria-readonly": l,
221
- "aria-disabled": s,
222
- "aria-required": I,
223
- "aria-invalid": h.invalid,
224
- "aria-errormessage": h.errorMessage || void 0,
225
- "aria-labelledby": !b.ariaLabel && A ? A : void 0,
226
- "aria-label": b.ariaLabel,
227
- "aria-describedby": h.describedBy,
228
- placeholder: o && !N ? "" : te,
229
- onChange: (t) => $(t.target.value),
230
- disabled: s,
231
- readOnly: l,
248
+ className: r[`${L}field__input`],
249
+ "aria-readonly": i,
250
+ "aria-disabled": o,
251
+ "aria-required": A,
252
+ "aria-invalid": y.invalid,
253
+ "aria-errormessage": y.errorMessage || void 0,
254
+ "aria-labelledby": !g.ariaLabel && S ? S : void 0,
255
+ "aria-label": g.ariaLabel,
256
+ "aria-describedby": y.describedBy,
257
+ placeholder: t && !$ ? "" : ae,
258
+ onChange: (e) => V(e.target.value),
259
+ disabled: o,
260
+ readOnly: i,
232
261
  autoComplete: "off",
233
- tabIndex: s ? -1 : 0,
262
+ tabIndex: o ? -1 : 0,
234
263
  autoFocus: !1,
235
- ...ze
264
+ ...tt
236
265
  }
237
266
  )
238
267
  }
239
268
  ),
240
- hasClearButton: De,
241
- hideChevron: se,
242
- onClear: Fe,
243
- onBlur: Te,
244
- onFocusCapture: je,
245
- ..._e,
246
- ref: We
269
+ hasClearButton: Le,
270
+ hideChevron: pe,
271
+ onClear: Me,
272
+ onBlur: Je,
273
+ onFocusCapture: Qe,
274
+ ...et,
275
+ ref: Ze
247
276
  }
248
277
  ),
249
- /* @__PURE__ */ C(lt, { ctxId: me, ctxDisabled: s, children: [
250
- k,
251
- he && /* @__PURE__ */ i(st, { id: fe, appearance: "negative", children: d })
278
+ /* @__PURE__ */ C(ft, { ctxId: ve, ctxDisabled: o, children: [
279
+ q,
280
+ Ie && /* @__PURE__ */ n(ut, { id: Oe, appearance: "negative", children: p })
252
281
  ] }),
253
- de(be)
282
+ he(Ce)
254
283
  ] }),
255
- /* @__PURE__ */ C("select", { ...ne, ...ye, hidden: !0, multiple: o, children: [
256
- /* @__PURE__ */ i("option", { value: "", children: "empty" }),
257
- G
284
+ /* @__PURE__ */ C("select", { ...be, ...Ae, hidden: !0, multiple: t, children: [
285
+ /* @__PURE__ */ n("option", { value: "", children: "empty" }),
286
+ X
258
287
  ] }),
259
- /* @__PURE__ */ i(
260
- pt,
288
+ /* @__PURE__ */ n(
289
+ It,
261
290
  {
262
- ...Ae,
263
- className: r[`${R}dropdown`],
264
- disabled: s,
265
- readOnly: l,
266
- theme: P,
267
- multiple: o,
268
- onItemClick: Ke,
269
- children: /* @__PURE__ */ i(
270
- T,
291
+ ...Re,
292
+ className: r[`${L}dropdown`],
293
+ disabled: o,
294
+ readOnly: i,
295
+ theme: I,
296
+ multiple: t,
297
+ onItemClick: Ue,
298
+ children: /* @__PURE__ */ n(
299
+ Q,
271
300
  {
272
301
  role: "listbox",
273
- noResults: Ge ? oe : void 0,
274
- children: n.map((t) => {
275
- const e = u.get(t);
276
- if (!e) return null;
277
- const m = H.isSelected(
278
- e.value,
279
- c
280
- ), v = F[t], Je = v || e.disabled;
281
- return /* @__PURE__ */ Ze(
282
- T.Item,
302
+ noResults: Xe ? de : void 0,
303
+ children: w.map((e, s) => {
304
+ if (e.kind === "option")
305
+ return z(e.id);
306
+ const l = R.get(e.id);
307
+ if (!l) return null;
308
+ const b = D.get(e.id) ?? [], G = !b.some(
309
+ (E) => !c[E]
310
+ ), ot = s === Ye, rt = !!l.divider && !ot;
311
+ return /* @__PURE__ */ n(
312
+ Q.Group,
283
313
  {
284
- ...e,
285
- className: L(
286
- r[`${R}option`],
287
- e.className
288
- ),
289
- disabled: Je,
290
- hidden: v,
291
- defaultSelected: m,
292
- key: `opt-${e.value ?? e.label}`,
293
- kind: o ? "checkbox" : "singleCheckMark",
294
- role: "option"
295
- }
314
+ heading: l.heading,
315
+ divider: rt,
316
+ disabled: l.disabled,
317
+ hidden: G,
318
+ children: b.map(
319
+ (E) => z(E, l.disabled)
320
+ )
321
+ },
322
+ e.id
296
323
  );
297
324
  })
298
325
  }
@@ -301,10 +328,11 @@ const { baseClassNamePrefix: Ot, subElementClassPrefix: R, classModifierPrefix:
301
328
  )
302
329
  ] });
303
330
  }
304
- ), j = Pt;
305
- j.Option = nt;
306
- j.displayName = "Autocomplete";
331
+ ), M = Ft;
332
+ M.Option = xt;
333
+ M.OptionGroup = gt;
334
+ M.displayName = "Autocomplete";
307
335
  export {
308
- j as Autocomplete,
309
- j as default
336
+ M as Autocomplete,
337
+ M as default
310
338
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),r=require("@floating-ui/react"),B=require("../Box/Box.cjs.js"),C=require("clsx"),a=require("../../chunks/classNames.DAeKwerT.js"),P=require("../../chunks/constants.hwjHOsvT.js"),v=require("../ActionList/ActionList.context.cjs.js"),y=require("react"),A=require("../../chunks/floatingui.module.D3Aw_aYe.js"),O=require("../../chunks/popover.module.DGUJIXrP.js");require("../_Options/Option.context.cjs.js");const M=require("../_Options/Option.cjs.js");require("../../chunks/form.context.hesWPMlU.js");require("../Form/contexts/label.context.cjs.js");require("../Form/contexts/helperText.context.cjs.js");const{baseClassNamePrefix:S}=a.getBEMClassNames("floatingui"),{baseClassNamePrefix:w}=a.getBEMClassNames("popover"),L=[M.Option],T=({setOpen:o,isMounted:n,status:l,nodeId:u,context:c,getFloatingProps:d,floatingStyles:x,labelsRef:f,elementsRef:p,getItemProps:q,setFloating:g,disabled:m,readOnly:N,theme:t,className:b,children:F,multiple:i,activeIndex:_,onItemClick:s})=>{const j=y.useCallback(h=>{s==null||s(h),!i&&o(!1)},[i,s,o]);return n?e.jsx(r.FloatingTree,{children:e.jsx(r.FloatingNode,{id:u,children:e.jsx(r.FloatingPortal,{children:e.jsx(r.FloatingFocusManager,{context:c,modal:!1,initialFocus:0,disabled:m||N,closeOnFocusOut:!0,restoreFocus:!0,returnFocus:!0,guards:!0,order:["content","reference"],children:e.jsx(B.Box,{"data-status":l,className:C(t&&P.themeClassName(t),A.floatinguiStyles[S],O.popoverStyles[w],b),...d(),style:x,ref:g,children:e.jsx(v.ActionListContextProvider,{allowChildrenTypes:L,getItemProps:q,itemsFocusable:!1,onItemClick:j,labelsRef:f,elementsRef:p,activeIndex:_,children:F})})})})})}):null};exports.AutocompleteDropdown=T;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("@floating-ui/react"),B=require("../Box/Box.cjs.js"),C=require("clsx"),a=require("../../chunks/classNames.DAeKwerT.js"),P=require("../../chunks/constants.hwjHOsvT.js"),v=require("../ActionList/ActionList.context.cjs.js"),y=require("react"),A=require("../../chunks/FloatingUI.arrow.DFhYQv_F.js"),O=require("../../chunks/popover.module.DGUJIXrP.js");require("../_Options/Option.context.cjs.js");const w=require("../_Options/Option.cjs.js");require("../_Options/OptionGroup.context.cjs.js");require("../../utils/hooks/useId.cjs.js");require("../ActionList/ActionList.cjs.js");require("../../chunks/form.context.hesWPMlU.js");require("../Form/contexts/label.context.cjs.js");require("../Form/contexts/helperText.context.cjs.js");const{baseClassNamePrefix:M}=a.getBEMClassNames("floatingui"),{baseClassNamePrefix:S}=a.getBEMClassNames("popover"),L=[w.Option],T=({setOpen:o,isMounted:n,status:l,nodeId:u,context:c,getFloatingProps:d,floatingStyles:q,labelsRef:x,elementsRef:g,getItemProps:p,setFloating:f,disabled:m,readOnly:F,theme:t,className:_,children:b,multiple:i,activeIndex:N,onItemClick:r})=>{const j=y.useCallback(h=>{r==null||r(h),!i&&o(!1)},[i,r,o]);return n?e.jsx(s.FloatingTree,{children:e.jsx(s.FloatingNode,{id:u,children:e.jsx(s.FloatingPortal,{children:e.jsx(s.FloatingFocusManager,{context:c,modal:!1,initialFocus:0,disabled:m||F,closeOnFocusOut:!0,restoreFocus:!0,returnFocus:!0,guards:!0,order:["content","reference"],children:e.jsx(B.Box,{"data-status":l,className:C(t&&P.themeClassName(t),A.floatinguiStyles[M],O.popoverStyles[S],_),...d(),style:q,ref:f,children:e.jsx(v.ActionListContextProvider,{allowChildrenTypes:L,getItemProps:p,itemsFocusable:!1,onItemClick:j,labelsRef:x,elementsRef:g,activeIndex:N,children:b})})})})})}):null};exports.AutocompleteDropdown=T;