@hopper-ui/components 1.3.30 → 1.3.32

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 (218) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/Avatar/src/AnonymousAvatar.css +37 -37
  3. package/dist/Avatar/src/AnonymousAvatar.js +2 -2
  4. package/dist/Avatar/src/Avatar.css +55 -55
  5. package/dist/Avatar/src/Avatar.js +3 -3
  6. package/dist/Avatar/src/DeletedAvatar.css +37 -37
  7. package/dist/Avatar/src/DeletedAvatar.js +2 -2
  8. package/dist/Avatar/src/RichIconAvatarImage.css +37 -37
  9. package/dist/Avatar/src/RichIconAvatarImage.js +1 -1
  10. package/dist/Avatar/src/index.css +55 -55
  11. package/dist/Avatar/src/index.js +5 -5
  12. package/dist/Badge/src/Badge.css +42 -42
  13. package/dist/Badge/src/Badge.js +2 -2
  14. package/dist/Badge/src/FloatingBadge.css +37 -37
  15. package/dist/Badge/src/FloatingBadge.js +1 -1
  16. package/dist/Badge/src/index.css +52 -52
  17. package/dist/Badge/src/index.js +3 -3
  18. package/dist/Card/src/Card.css +247 -0
  19. package/dist/Card/src/Card.d.ts +22 -0
  20. package/dist/Card/src/Card.js +7 -0
  21. package/dist/Card/src/CardContext.d.ts +10 -0
  22. package/dist/Card/src/CardContext.js +2 -0
  23. package/dist/Card/src/index.css +247 -0
  24. package/dist/Card/src/index.d.ts +7 -0
  25. package/dist/Card/src/index.js +7 -0
  26. package/dist/ComboBox/src/ComboBox.css +562 -2120
  27. package/dist/ComboBox/src/ComboBox.js +25 -96
  28. package/dist/ComboBox/src/index.css +562 -2120
  29. package/dist/ComboBox/src/index.js +25 -96
  30. package/dist/Divider/src/Divider.css +29 -29
  31. package/dist/Divider/src/Divider.js +1 -1
  32. package/dist/Divider/src/index.css +29 -29
  33. package/dist/Divider/src/index.js +1 -1
  34. package/dist/ErrorMessage/src/ErrorMessage.css +29 -29
  35. package/dist/ErrorMessage/src/ErrorMessage.js +2 -2
  36. package/dist/ErrorMessage/src/index.css +29 -29
  37. package/dist/ErrorMessage/src/index.js +2 -2
  38. package/dist/Form/src/Form.css +1593 -1836
  39. package/dist/Form/src/Form.js +11 -102
  40. package/dist/Form/src/index.css +1593 -1836
  41. package/dist/Form/src/index.js +11 -102
  42. package/dist/HelperMessage/src/HelperMessage.css +29 -29
  43. package/dist/HelperMessage/src/HelperMessage.js +2 -2
  44. package/dist/HelperMessage/src/index.css +29 -29
  45. package/dist/HelperMessage/src/index.js +2 -2
  46. package/dist/IconList/src/IconList.css +28 -28
  47. package/dist/IconList/src/IconList.js +1 -1
  48. package/dist/IconList/src/index.css +28 -28
  49. package/dist/IconList/src/index.js +1 -1
  50. package/dist/Link/src/Link.css +49 -49
  51. package/dist/Link/src/Link.js +8 -8
  52. package/dist/Link/src/index.css +49 -49
  53. package/dist/Link/src/index.js +8 -8
  54. package/dist/ListBox/src/ListBox.css +274 -274
  55. package/dist/ListBox/src/ListBox.js +14 -14
  56. package/dist/ListBox/src/ListBoxItem.css +262 -262
  57. package/dist/ListBox/src/ListBoxItem.js +13 -13
  58. package/dist/ListBox/src/ListBoxItemSkeleton.css +34 -34
  59. package/dist/ListBox/src/ListBoxItemSkeleton.js +1 -1
  60. package/dist/ListBox/src/index.css +274 -274
  61. package/dist/ListBox/src/index.js +14 -14
  62. package/dist/Select/src/Select.css +597 -2154
  63. package/dist/Select/src/Select.js +27 -96
  64. package/dist/Select/src/SelectValue.css +61 -61
  65. package/dist/Select/src/SelectValue.js +6 -6
  66. package/dist/Select/src/index.css +566 -2123
  67. package/dist/Select/src/index.d.ts +1 -1
  68. package/dist/Select/src/index.js +27 -96
  69. package/dist/Spinner/src/Spinner.css +37 -37
  70. package/dist/Spinner/src/Spinner.js +2 -2
  71. package/dist/Spinner/src/index.css +37 -37
  72. package/dist/Spinner/src/index.js +2 -2
  73. package/dist/buttons/src/Button.css +93 -93
  74. package/dist/buttons/src/Button.js +10 -10
  75. package/dist/buttons/src/ButtonGroup.css +38 -38
  76. package/dist/buttons/src/ButtonGroup.js +2 -2
  77. package/dist/buttons/src/ClearButton.css +98 -98
  78. package/dist/buttons/src/ClearButton.js +2 -2
  79. package/dist/buttons/src/EmbeddedButton.css +98 -98
  80. package/dist/buttons/src/EmbeddedButton.js +1 -1
  81. package/dist/buttons/src/LinkButton.css +102 -102
  82. package/dist/buttons/src/LinkButton.js +9 -9
  83. package/dist/buttons/src/index.css +249 -249
  84. package/dist/buttons/src/index.js +17 -17
  85. package/dist/checkbox/src/Checkbox.css +46 -46
  86. package/dist/checkbox/src/Checkbox.js +9 -9
  87. package/dist/checkbox/src/CheckboxField.css +33 -33
  88. package/dist/checkbox/src/CheckboxField.js +2 -2
  89. package/dist/checkbox/src/CheckboxGroup.css +98 -98
  90. package/dist/checkbox/src/CheckboxGroup.js +7 -7
  91. package/dist/checkbox/src/DecorativeCheckbox.css +54 -54
  92. package/dist/checkbox/src/DecorativeCheckbox.js +9 -9
  93. package/dist/checkbox/src/index.css +98 -98
  94. package/dist/checkbox/src/index.js +16 -16
  95. package/dist/{chunk-T62GNS7A.js → chunk-2PIWQBQ7.js} +2 -2
  96. package/dist/{chunk-QXOFUM6L.js → chunk-2ZAWI3VO.js} +1 -1
  97. package/dist/chunk-425TRLX5.js +71 -0
  98. package/dist/{chunk-44XBQWFL.js → chunk-4XMDZ5QF.js} +1 -1
  99. package/dist/{chunk-6RCOGX6X.js → chunk-52EKMM7G.js} +3 -3
  100. package/dist/{chunk-SJTPZSVU.js → chunk-5TE4QKZ2.js} +2 -2
  101. package/dist/{chunk-FWIQZGWG.js → chunk-5YGTZWHS.js} +1 -1
  102. package/dist/{chunk-ZZVFZ7I7.js → chunk-6XSOF5IT.js} +3 -3
  103. package/dist/{chunk-NPJBY3QK.js → chunk-77K422AK.js} +1 -1
  104. package/dist/{chunk-4YZZWHBM.js → chunk-7ITDXJPN.js} +6 -6
  105. package/dist/{chunk-WR3P4XWE.js → chunk-7OZNJCXL.js} +6 -6
  106. package/dist/chunk-7RTEFFZS.js +159 -0
  107. package/dist/{chunk-J2GXT52N.js → chunk-B2PZHGGT.js} +2 -2
  108. package/dist/{chunk-J4ZUH2ZP.js → chunk-BAX352BZ.js} +1 -1
  109. package/dist/{chunk-LFCEYG5R.js → chunk-F3GTLFKR.js} +1 -1
  110. package/dist/{chunk-2JMXBZHI.js → chunk-FXB7BBJB.js} +2 -2
  111. package/dist/{chunk-VLVEXVWZ.js → chunk-HPEGBHAQ.js} +1 -1
  112. package/dist/{chunk-CVMHGZQE.js → chunk-JHZLRSJY.js} +1 -1
  113. package/dist/{chunk-5MYQ7W33.js → chunk-JZV3EU5P.js} +5 -5
  114. package/dist/{chunk-UO5QJHXD.js → chunk-KXZYWFM3.js} +5 -5
  115. package/dist/{chunk-TMVKRT2P.js → chunk-MCSPPEQN.js} +1 -1
  116. package/dist/{chunk-VAKUV6QI.js → chunk-MMCWVCOD.js} +2 -2
  117. package/dist/{chunk-2MYELF25.js → chunk-MOIFFJJ3.js} +1 -1
  118. package/dist/{chunk-SFMVHFVH.js → chunk-MY7R6ZMF.js} +2 -2
  119. package/dist/{chunk-NE3BRLPL.js → chunk-N7ORIARY.js} +2 -2
  120. package/dist/{chunk-FVH4W7VW.js → chunk-OAUTLKSG.js} +7 -7
  121. package/dist/{chunk-47FKFZ4S.js → chunk-OEMWDVBB.js} +3 -3
  122. package/dist/{chunk-2SXSYPWT.js → chunk-OFYHUD3N.js} +2 -2
  123. package/dist/{chunk-WUZ4LSNY.js → chunk-PME32XAH.js} +6 -6
  124. package/dist/chunk-PR6Q2XJD.js +270 -0
  125. package/dist/{chunk-DZHNBZQQ.js → chunk-QDIICTRS.js} +2 -2
  126. package/dist/{chunk-CY7GW4SB.js → chunk-SMNKMZIC.js} +9 -9
  127. package/dist/{chunk-YWNQJ4FB.js → chunk-SWQEWYNM.js} +1 -1
  128. package/dist/{chunk-KUEXWJCI.js → chunk-U7NERCPG.js} +6 -6
  129. package/dist/{chunk-GRQTYLL6.js → chunk-UEZ6JMBX.js} +2 -2
  130. package/dist/{chunk-7Q6MXAW6.js → chunk-UJAYZEVR.js} +2 -2
  131. package/dist/{chunk-L5FDVVDI.js → chunk-UOVCHVGX.js} +4 -4
  132. package/dist/chunk-UYDOZLJW.js +153 -0
  133. package/dist/{chunk-HQPE2NHR.js → chunk-UYXVO6TB.js} +1 -1
  134. package/dist/chunk-V2EQFVTJ.js +7 -0
  135. package/dist/{chunk-LXWLN4DS.js → chunk-VYFGV7LF.js} +3 -3
  136. package/dist/{chunk-DOKGX5N4.js → chunk-VYNPGUH2.js} +1 -1
  137. package/dist/{chunk-5TIGRW6E.js → chunk-WJ6YDFFC.js} +1 -1
  138. package/dist/{chunk-3SNUQFBZ.js → chunk-WXP3P4KY.js} +3 -3
  139. package/dist/{chunk-4I7NFPPR.js → chunk-X5SCISRD.js} +2 -2
  140. package/dist/{chunk-6S4ZOYNF.js → chunk-XDJMIWOT.js} +4 -4
  141. package/dist/{chunk-MBX35AGZ.js → chunk-XTY7LASB.js} +3 -3
  142. package/dist/{chunk-S5NKOTEO.js → chunk-Y75VH6OP.js} +1 -1
  143. package/dist/chunk-YTKE4ERV.js +205 -0
  144. package/dist/{chunk-PHGFB7Z7.js → chunk-ZTS67CFU.js} +23 -14
  145. package/dist/{chunk-64EU3M5O.js → chunk-ZUL2DWRU.js} +2 -2
  146. package/dist/index.css +1022 -996
  147. package/dist/index.d.ts +4 -2
  148. package/dist/index.js +88 -80
  149. package/dist/inputs/src/InputGroup.css +264 -264
  150. package/dist/inputs/src/InputGroup.js +1 -1
  151. package/dist/inputs/src/NumberField.css +286 -286
  152. package/dist/inputs/src/NumberField.js +12 -12
  153. package/dist/inputs/src/PasswordField.css +274 -274
  154. package/dist/inputs/src/PasswordField.js +12 -12
  155. package/dist/inputs/src/RemainingCharacterCount.css +30 -30
  156. package/dist/inputs/src/RemainingCharacterCount.js +6 -6
  157. package/dist/inputs/src/SearchField.css +280 -280
  158. package/dist/inputs/src/SearchField.js +13 -13
  159. package/dist/inputs/src/TextArea.css +281 -281
  160. package/dist/inputs/src/TextArea.js +12 -12
  161. package/dist/inputs/src/TextField.css +278 -278
  162. package/dist/inputs/src/TextField.js +15 -15
  163. package/dist/inputs/src/index.css +324 -324
  164. package/dist/inputs/src/index.js +24 -24
  165. package/dist/overlays/Popover/src/Popover.css +2150 -3870
  166. package/dist/overlays/Popover/src/Popover.d.ts +1 -1
  167. package/dist/overlays/Popover/src/Popover.js +11 -106
  168. package/dist/overlays/Popover/src/PopoverContext.d.ts +1 -1
  169. package/dist/overlays/Popover/src/index.css +2150 -3870
  170. package/dist/overlays/Popover/src/index.d.ts +1 -1
  171. package/dist/overlays/Popover/src/index.js +12 -106
  172. package/dist/radio/src/DecorativeRadio.css +54 -54
  173. package/dist/radio/src/DecorativeRadio.js +8 -8
  174. package/dist/radio/src/Radio.css +46 -46
  175. package/dist/radio/src/Radio.js +8 -8
  176. package/dist/radio/src/RadioField.css +33 -33
  177. package/dist/radio/src/RadioField.js +2 -2
  178. package/dist/radio/src/RadioGroup.css +98 -98
  179. package/dist/radio/src/RadioGroup.js +6 -6
  180. package/dist/radio/src/index.css +98 -98
  181. package/dist/radio/src/index.js +14 -14
  182. package/dist/switch/src/Switch.css +43 -43
  183. package/dist/switch/src/Switch.js +8 -8
  184. package/dist/switch/src/SwitchField.css +33 -33
  185. package/dist/switch/src/SwitchField.d.ts +8 -3
  186. package/dist/switch/src/SwitchField.js +4 -2
  187. package/dist/switch/src/index.css +49 -49
  188. package/dist/switch/src/index.js +10 -10
  189. package/dist/tag/src/Tag.css +390 -390
  190. package/dist/tag/src/Tag.js +11 -11
  191. package/dist/tag/src/TagGroup.css +37 -37
  192. package/dist/tag/src/TagGroup.js +3 -3
  193. package/dist/tag/src/TagList.css +27 -27
  194. package/dist/tag/src/index.css +400 -400
  195. package/dist/tag/src/index.js +15 -15
  196. package/dist/typography/Heading/src/Heading.css +27 -27
  197. package/dist/typography/Heading/src/Heading.js +1 -1
  198. package/dist/typography/Heading/src/index.css +27 -27
  199. package/dist/typography/Heading/src/index.js +1 -1
  200. package/dist/typography/Label/src/Label.css +27 -27
  201. package/dist/typography/Label/src/Label.js +1 -1
  202. package/dist/typography/Label/src/index.css +27 -27
  203. package/dist/typography/Label/src/index.js +1 -1
  204. package/dist/typography/OverlineText/src/OverlineText.css +27 -27
  205. package/dist/typography/OverlineText/src/OverlineText.js +1 -1
  206. package/dist/typography/OverlineText/src/index.css +27 -27
  207. package/dist/typography/OverlineText/src/index.js +1 -1
  208. package/dist/typography/Text/src/Text.css +27 -27
  209. package/dist/typography/Text/src/Text.js +1 -1
  210. package/dist/typography/Text/src/index.css +27 -27
  211. package/dist/typography/Text/src/index.js +1 -1
  212. package/dist/utils/src/EnsureTextWrapper.css +27 -27
  213. package/dist/utils/src/EnsureTextWrapper.js +6 -6
  214. package/dist/utils/src/index.css +27 -27
  215. package/dist/utils/src/index.js +7 -7
  216. package/package.json +2 -1
  217. package/dist/chunk-UCAG6OQL.js +0 -1155
  218. /package/dist/{chunk-LJXTJRSB.js → chunk-DBIN32YS.js} +0 -0
@@ -1,1155 +0,0 @@
1
- import { PopoverContext } from './chunk-SC6ZK5ON.js';
2
- import { TagGroupContext } from './chunk-LCAS3YQV.js';
3
- import { RadioGroupContext } from './chunk-5MBJWRZD.js';
4
- import { TextFieldContext } from './chunk-O4XPUINW.js';
5
- import { ContentContext } from './chunk-IXB2WK56.js';
6
- import { _Footer } from './chunk-VOZN65OL.js';
7
- import { FooterContext } from './chunk-I67NHYK4.js';
8
- import { NumberFieldContext } from './chunk-ZQ3AWYRR.js';
9
- import { PasswordFieldContext } from './chunk-QW45G6K4.js';
10
- import { SearchFieldContext } from './chunk-3NKF5TPD.js';
11
- import { TextAreaContext } from './chunk-MHQZXLKW.js';
12
- import { CheckboxGroupContext } from './chunk-N7YDPVZL.js';
13
- import { CheckboxFieldContext } from './chunk-ZGNK4GWA.js';
14
- import { LinkButtonContext } from './chunk-3UQFC2NQ.js';
15
- import { ButtonContext as ButtonContext$1 } from './chunk-WMTWFKKP.js';
16
- import { ButtonGroupContext } from './chunk-VJQ7M2BK.js';
17
- import { SelectContext } from './chunk-T24MBA34.js';
18
- import { _SelectValue } from './chunk-T62GNS7A.js';
19
- import { LinkContext } from './chunk-4VVNSXIB.js';
20
- import { _HopperProvider } from './chunk-NMKBUGSO.js';
21
- import { _ListBox } from './chunk-3SNUQFBZ.js';
22
- import { isFunction, isNil } from './chunk-TIPN4VYD.js';
23
- import { ListBoxContext } from './chunk-UIEP5BA5.js';
24
- import { CheckboxContext } from './chunk-2EAZPH3M.js';
25
- import { ensureTextWrapper } from './chunk-HQPE2NHR.js';
26
- import { HeadingContext } from './chunk-TXZ6BMFR.js';
27
- import { _Label } from './chunk-J4ZUH2ZP.js';
28
- import { LabelContext } from './chunk-QCA3ZR56.js';
29
- import { FormContext } from './chunk-EURJK4ZT.js';
30
- import { _HelperMessage } from './chunk-4I7NFPPR.js';
31
- import { _ErrorMessage } from './chunk-NE3BRLPL.js';
32
- import { ComboBoxContext } from './chunk-4XHTP4GX.js';
33
- import { BadgeContext } from './chunk-CQDLZ42T.js';
34
- import { TextContext as TextContext$1 } from './chunk-X6SER3TZ.js';
35
- import { ClearProviders, ClearContainerSlots } from './chunk-HXI3MEEK.js';
36
- import { composeClassnameRenderProps } from './chunk-65JPI4FL.js';
37
- import { SlotProvider } from './chunk-M36KANKC.js';
38
- import { cssModule } from './chunk-KVDXQMWI.js';
39
- import { IconContext, AngleUpIcon, AngleDownIcon } from '@hopper-ui/icons';
40
- import { useStyledSystem, useResponsiveValue, useColorSchemeContext } from '@hopper-ui/styled-system';
41
- export * from '@hopper-ui/styled-system';
42
- import { useObjectRef, mergeRefs, useResizeObserver } from '@react-aria/utils';
43
- import { forwardRef, useRef, useState, useCallback, useReducer, useEffect } from 'react';
44
- import { useContextProps, useSlottedContext, InputContext, composeRenderProps, TextContext, ButtonContext, ComboBox as ComboBox$1, Group, Input, Button, Form as Form$1, Select as Select$1, Popover as Popover$1, Dialog } from 'react-aria-components';
45
- export { Collection } from 'react-aria-components';
46
- import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
47
- import clsx2 from 'clsx';
48
-
49
- // css-module:./ComboBox.module.css#css-module
50
- var ComboBox_module_default = { "hop-ComboBox": "ComboBox-module__hop-ComboBox___1N3kV", "hop-ComboBox--fluid": "ComboBox-module__hop-ComboBox--fluid___-VgDZ", "hop-ComboBox__label": "ComboBox-module__hop-ComboBox__label___NbAqN", "hop-ComboBox__trigger": "ComboBox-module__hop-ComboBox__trigger___eYFje", "hop-ComboBox__trigger--sm": "ComboBox-module__hop-ComboBox__trigger--sm___93UuE", "hop-ComboBox__trigger--md": "ComboBox-module__hop-ComboBox__trigger--md___ylYrj", "hop-ComboBox__input": "ComboBox-module__hop-ComboBox__input___k3njP", "hop-ComboBox__button": "ComboBox-module__hop-ComboBox__button___Ie8rf", "hop-ComboBox__prefix": "ComboBox-module__hop-ComboBox__prefix___QefIV", "hop-ComboBox__button-icon": "ComboBox-module__hop-ComboBox__button-icon___ndDZb", "hop-ComboBox__helper-message": "ComboBox-module__hop-ComboBox__helper-message___G6eXm", "hop-ComboBox__error-message": "ComboBox-module__hop-ComboBox__error-message___mjRbr" };
51
- var GlobalComboBoxCssSelector = "hop-ComboBox";
52
- function ComboBox(props, ref) {
53
- var _a, _b, _c, _d, _e;
54
- const {
55
- inputRef: userProvidedInputRef = null,
56
- ...propsWithoutRef
57
- } = props;
58
- [props, ref] = useContextProps(propsWithoutRef, ref, ComboBoxContext);
59
- const { stylingProps, ...ownProps } = useStyledSystem(props);
60
- const {
61
- align: alignProp,
62
- className,
63
- children,
64
- description,
65
- direction: directionProp,
66
- errorMessage,
67
- footer,
68
- isAutoMenuWidth,
69
- isFluid: isFluidProp,
70
- isInvalid,
71
- isLoading,
72
- isRequired,
73
- items,
74
- label,
75
- listBoxProps,
76
- menuTrigger = "focus",
77
- necessityIndicator,
78
- onLoadMore,
79
- popoverProps,
80
- placeholder,
81
- prefix,
82
- selectionIndicator,
83
- shouldFlip,
84
- size: sizeProp,
85
- style: styleProp,
86
- triggerProps,
87
- ...otherProps
88
- } = ownProps;
89
- const inputRef = useObjectRef(mergeRefs(userProvidedInputRef, (_a = props.inputRef) != null ? _a : null));
90
- const inputContext = useSlottedContext(InputContext);
91
- const mergedInputRefs = (inputContext == null ? void 0 : inputContext.ref) ? mergeRefs(inputRef, inputContext.ref) : inputRef;
92
- const triggerRef = useRef(null);
93
- const buttonRef = useRef(null);
94
- const [triggerWidth, setTriggerWidth] = useState(null);
95
- const onResize = useCallback(() => {
96
- if (triggerRef.current) {
97
- setTriggerWidth(triggerRef.current.offsetWidth + "px");
98
- }
99
- }, [triggerRef]);
100
- useResizeObserver({
101
- ref: triggerRef,
102
- onResize
103
- });
104
- const { stylingProps: triggerStylingProps, ...triggerOwnProps } = useStyledSystem(triggerProps != null ? triggerProps : {});
105
- const {
106
- className: triggerClassName,
107
- style: triggerStyleProp,
108
- ...otherTriggerProps
109
- } = triggerOwnProps;
110
- const {
111
- style: popoverStyleProp
112
- } = popoverProps != null ? popoverProps : {};
113
- const size = (_b = useResponsiveValue(sizeProp)) != null ? _b : "md";
114
- const isFluid = (_c = useResponsiveValue(isFluidProp)) != null ? _c : false;
115
- const align = (_d = useResponsiveValue(alignProp)) != null ? _d : "start";
116
- const direction = (_e = useResponsiveValue(directionProp)) != null ? _e : "bottom";
117
- const classNames = composeClassnameRenderProps(
118
- className,
119
- GlobalComboBoxCssSelector,
120
- cssModule(
121
- ComboBox_module_default,
122
- "hop-ComboBox",
123
- isFluid && "fluid",
124
- size
125
- ),
126
- stylingProps.className
127
- );
128
- const triggerClassNames = composeClassnameRenderProps(
129
- triggerClassName,
130
- cssModule(
131
- ComboBox_module_default,
132
- "hop-ComboBox__trigger",
133
- size
134
- ),
135
- triggerStylingProps.className
136
- );
137
- const buttonClassNames = composeClassnameRenderProps(
138
- cssModule(
139
- ComboBox_module_default,
140
- "hop-ComboBox__button"
141
- )
142
- );
143
- const inputClassNames = composeClassnameRenderProps(
144
- inputContext == null ? void 0 : inputContext.className,
145
- ComboBox_module_default["hop-ComboBox__input"]
146
- );
147
- const style = composeRenderProps(styleProp, (prev) => {
148
- return {
149
- ...stylingProps.style,
150
- ...prev
151
- };
152
- });
153
- const triggerStyle = composeRenderProps(triggerStyleProp, (prev) => {
154
- return {
155
- ...triggerStylingProps.style,
156
- ...prev
157
- };
158
- });
159
- const popoverStyle = composeRenderProps(popoverStyleProp, (prev) => {
160
- return {
161
- ...prev,
162
- "--custom-trigger-width": triggerWidth
163
- };
164
- });
165
- const footerMarkup = footer ? /* @__PURE__ */ jsx(
166
- ClearProviders,
167
- {
168
- values: [
169
- TextContext,
170
- TextContext$1,
171
- ButtonContext
172
- ],
173
- children: /* @__PURE__ */ jsx(
174
- SlotProvider,
175
- {
176
- values: [
177
- [TextContext$1, {
178
- size
179
- }]
180
- ],
181
- children: /* @__PURE__ */ jsx(_Footer, { children: ensureTextWrapper(footer) })
182
- }
183
- )
184
- }
185
- ) : null;
186
- const handleMouseDown = useCallback((e) => {
187
- if (inputRef.current && e.target !== inputRef.current && buttonRef.current && e.target !== buttonRef.current) {
188
- inputRef.current.focus();
189
- e.preventDefault();
190
- }
191
- }, [inputRef]);
192
- const prefixMarkup = prefix ? /* @__PURE__ */ jsx(
193
- SlotProvider,
194
- {
195
- values: [
196
- [TextContext$1, { size, className: ComboBox_module_default["hop-ComboBox__prefix"] }],
197
- [IconContext, { size, className: ComboBox_module_default["hop-ComboBox__prefix"] }]
198
- ],
199
- children: /* @__PURE__ */ jsx(ClearContainerSlots, { children: ensureTextWrapper(prefix) })
200
- }
201
- ) : null;
202
- return /* @__PURE__ */ jsx(
203
- ComboBox$1,
204
- {
205
- ref,
206
- className: classNames,
207
- style,
208
- isInvalid,
209
- isRequired,
210
- items,
211
- menuTrigger,
212
- ...otherProps,
213
- children: (comboBoxRenderProps) => {
214
- const { isOpen } = comboBoxRenderProps;
215
- const ButtonIcon = isOpen ? AngleUpIcon : AngleDownIcon;
216
- return /* @__PURE__ */ jsxs(Fragment, { children: [
217
- label && /* @__PURE__ */ jsx(
218
- _Label,
219
- {
220
- className: ComboBox_module_default["hop-ComboBox__label"],
221
- isRequired,
222
- necessityIndicator,
223
- children: label
224
- }
225
- ),
226
- /* @__PURE__ */ jsxs(
227
- _Popover,
228
- {
229
- isAutoWidth: isAutoMenuWidth,
230
- isNonDialog: true,
231
- placement: `${direction} ${align}`,
232
- shouldFlip,
233
- style: popoverStyle,
234
- triggerRef,
235
- ...popoverProps,
236
- children: [
237
- /* @__PURE__ */ jsx(
238
- SlotProvider,
239
- {
240
- values: [
241
- [BadgeContext, {
242
- variant: "secondary"
243
- }]
244
- ],
245
- children: /* @__PURE__ */ jsx(
246
- _ListBox,
247
- {
248
- size,
249
- isInvalid,
250
- items,
251
- isLoading,
252
- onLoadMore,
253
- selectionIndicator,
254
- ...listBoxProps,
255
- children
256
- }
257
- )
258
- }
259
- ),
260
- footerMarkup
261
- ]
262
- }
263
- ),
264
- /* @__PURE__ */ jsxs(
265
- Group,
266
- {
267
- ref: triggerRef,
268
- className: triggerClassNames,
269
- style: triggerStyle,
270
- onMouseDown: handleMouseDown,
271
- "data-selected": isOpen || void 0,
272
- ...otherTriggerProps,
273
- children: [
274
- prefixMarkup,
275
- /* @__PURE__ */ jsx(
276
- Input,
277
- {
278
- ref: mergedInputRefs,
279
- className: inputClassNames,
280
- placeholder
281
- }
282
- ),
283
- /* @__PURE__ */ jsx(Button, { className: buttonClassNames, ref: buttonRef, children: /* @__PURE__ */ jsx(ButtonIcon, { size: "sm", className: ComboBox_module_default["hop-ComboBox__button-icon"] }) })
284
- ]
285
- }
286
- ),
287
- description && /* @__PURE__ */ jsx(_HelperMessage, { className: ComboBox_module_default["hop-ComboBox__helper-message"], children: description }),
288
- /* @__PURE__ */ jsx(_ErrorMessage, { className: ComboBox_module_default["hop-ComboBox__error-message"], children: errorMessage })
289
- ] });
290
- }
291
- }
292
- );
293
- }
294
- var _ComboBox = forwardRef(ComboBox);
295
- _ComboBox.displayName = "ComboBox";
296
-
297
- // css-module:./Form.module.css#css-module
298
- var Form_module_default = { "hop-Form": "Form-module__hop-Form___8-7ZN" };
299
- var GlobalFormCssSelector = "hop-Form";
300
- function Form(props, ref) {
301
- var _a;
302
- [props, ref] = useContextProps(props, ref, FormContext);
303
- const { stylingProps, ...ownProps } = useStyledSystem(props);
304
- const {
305
- className,
306
- children,
307
- style,
308
- isFluid,
309
- isDisabled,
310
- necessityIndicator,
311
- size: sizeProp,
312
- ...otherProps
313
- } = ownProps;
314
- const size = (_a = useResponsiveValue(sizeProp)) != null ? _a : "md";
315
- const classNames = clsx2(
316
- GlobalFormCssSelector,
317
- cssModule(
318
- Form_module_default,
319
- "hop-Form"
320
- ),
321
- stylingProps.className,
322
- className
323
- );
324
- const mergedStyles = {
325
- ...stylingProps.style,
326
- ...style
327
- };
328
- return /* @__PURE__ */ jsx(
329
- SlotProvider,
330
- {
331
- values: [
332
- [LabelContext, {
333
- necessityIndicator
334
- }],
335
- [TextFieldContext, {
336
- isDisabled,
337
- isFluid,
338
- necessityIndicator,
339
- size
340
- }],
341
- [PasswordFieldContext, {
342
- isDisabled,
343
- isFluid,
344
- necessityIndicator,
345
- size
346
- }],
347
- [SearchFieldContext, {
348
- isDisabled,
349
- isFluid,
350
- necessityIndicator,
351
- size
352
- }],
353
- [NumberFieldContext, {
354
- isDisabled,
355
- necessityIndicator,
356
- size,
357
- isFluid
358
- }],
359
- [TextAreaContext, {
360
- isDisabled,
361
- necessityIndicator,
362
- size,
363
- isFluid
364
- }],
365
- [RadioGroupContext, {
366
- isDisabled,
367
- necessityIndicator,
368
- size
369
- }],
370
- [CheckboxContext, {
371
- isDisabled,
372
- size
373
- }],
374
- [CheckboxFieldContext, {
375
- isDisabled,
376
- size
377
- }],
378
- [CheckboxGroupContext, {
379
- isDisabled,
380
- necessityIndicator,
381
- size
382
- }],
383
- [ButtonContext$1, { isDisabled, size }]
384
- ],
385
- children: /* @__PURE__ */ jsx(
386
- SlotProvider,
387
- {
388
- values: [
389
- [SelectContext, {
390
- isDisabled,
391
- isFluid,
392
- necessityIndicator,
393
- size
394
- }],
395
- [ComboBoxContext, {
396
- isDisabled,
397
- isFluid,
398
- necessityIndicator,
399
- size
400
- }],
401
- [TagGroupContext, {
402
- necessityIndicator,
403
- size
404
- }],
405
- [LinkButtonContext, { isDisabled, size }]
406
- ],
407
- children: /* @__PURE__ */ jsx(
408
- Form$1,
409
- {
410
- ref,
411
- className: classNames,
412
- style: mergedStyles,
413
- ...otherProps,
414
- children
415
- }
416
- )
417
- }
418
- )
419
- }
420
- );
421
- }
422
- var _Form = forwardRef(Form);
423
- _Form.displayName = "Form";
424
-
425
- // css-module:./Select.module.css#css-module
426
- var Select_module_default = { "hop-Select": "Select-module__hop-Select___72t6b", "hop-Select--fluid": "Select-module__hop-Select--fluid___uvqu7", "hop-Select__label": "Select-module__hop-Select__label___KfPsT", "hop-Select__button": "Select-module__hop-Select__button___1acb0", "hop-Select__button--sm": "Select-module__hop-Select__button--sm___EMqHq", "hop-Select__button--md": "Select-module__hop-Select__button--md___4NQkN", "hop-Select__prefix": "Select-module__hop-Select__prefix___L0TQM", "hop-Select__button-icon": "Select-module__hop-Select__button-icon___urNie", "hop-Select__helper-message": "Select-module__hop-Select__helper-message___h9cKu", "hop-Select__error-message": "Select-module__hop-Select__error-message___UUsdD" };
427
- var GlobalSelectCssSelector = "hop-Select";
428
- function Select(props, ref) {
429
- var _a, _b, _c, _d;
430
- [props, ref] = useContextProps(props, ref, SelectContext);
431
- const { stylingProps, ...ownProps } = useStyledSystem(props);
432
- const {
433
- align: alignProp,
434
- className,
435
- children,
436
- description,
437
- direction: directionProp,
438
- errorMessage,
439
- footer,
440
- isAutoMenuWidth,
441
- isFluid: isFluidProp,
442
- isInvalid,
443
- isLoading,
444
- isRequired,
445
- items,
446
- label,
447
- listBoxProps,
448
- necessityIndicator,
449
- onLoadMore,
450
- popoverProps,
451
- prefix,
452
- renderValue,
453
- selectionIndicator,
454
- shouldFlip,
455
- size: sizeProp,
456
- style: styleProp,
457
- triggerProps,
458
- ...otherProps
459
- } = ownProps;
460
- const { stylingProps: triggerStylingProps, ...triggerOwnProps } = useStyledSystem(triggerProps != null ? triggerProps : {});
461
- const {
462
- className: triggerClassName,
463
- style: triggerStyleProp,
464
- ...otherTriggerProps
465
- } = triggerOwnProps;
466
- const size = (_a = useResponsiveValue(sizeProp)) != null ? _a : "md";
467
- const isFluid = (_b = useResponsiveValue(isFluidProp)) != null ? _b : false;
468
- const align = (_c = useResponsiveValue(alignProp)) != null ? _c : "start";
469
- const direction = (_d = useResponsiveValue(directionProp)) != null ? _d : "bottom";
470
- const classNames = composeClassnameRenderProps(
471
- className,
472
- GlobalSelectCssSelector,
473
- cssModule(
474
- Select_module_default,
475
- "hop-Select",
476
- isFluid && "fluid",
477
- size
478
- ),
479
- stylingProps.className
480
- );
481
- const buttonClassNames = composeClassnameRenderProps(
482
- triggerClassName,
483
- cssModule(
484
- Select_module_default,
485
- "hop-Select__button",
486
- size
487
- ),
488
- triggerStylingProps.className
489
- );
490
- const style = composeRenderProps(styleProp, (prev) => {
491
- return {
492
- ...stylingProps.style,
493
- ...prev
494
- };
495
- });
496
- const triggerStyle = composeRenderProps(triggerStyleProp, (prev) => {
497
- return {
498
- ...triggerStylingProps.style,
499
- ...prev
500
- };
501
- });
502
- const prefixMarkup = prefix ? /* @__PURE__ */ jsx(
503
- SlotProvider,
504
- {
505
- values: [
506
- [TextContext$1, { size, className: Select_module_default["hop-Select__prefix"] }],
507
- [IconContext, { size, className: Select_module_default["hop-Select__prefix"] }]
508
- ],
509
- children: /* @__PURE__ */ jsx(ClearContainerSlots, { children: ensureTextWrapper(prefix) })
510
- }
511
- ) : null;
512
- const footerMarkup = footer ? /* @__PURE__ */ jsx(
513
- ClearProviders,
514
- {
515
- values: [
516
- TextContext,
517
- TextContext$1,
518
- ButtonContext
519
- ],
520
- children: /* @__PURE__ */ jsx(
521
- SlotProvider,
522
- {
523
- values: [
524
- [TextContext$1, {
525
- size
526
- }]
527
- ],
528
- children: /* @__PURE__ */ jsx(_Footer, { children: ensureTextWrapper(footer) })
529
- }
530
- )
531
- }
532
- ) : null;
533
- return /* @__PURE__ */ jsx(
534
- Select$1,
535
- {
536
- ref,
537
- className: classNames,
538
- style,
539
- isInvalid,
540
- isRequired,
541
- ...otherProps,
542
- children: (selectRenderProps) => {
543
- const { isOpen } = selectRenderProps;
544
- const ButtonIcon = isOpen ? AngleUpIcon : AngleDownIcon;
545
- return /* @__PURE__ */ jsxs(Fragment, { children: [
546
- label && /* @__PURE__ */ jsx(
547
- _Label,
548
- {
549
- className: Select_module_default["hop-Select__label"],
550
- isRequired,
551
- necessityIndicator,
552
- children: label
553
- }
554
- ),
555
- /* @__PURE__ */ jsxs(
556
- _Popover,
557
- {
558
- isAutoWidth: isAutoMenuWidth,
559
- isNonDialog: true,
560
- placement: `${direction} ${align}`,
561
- shouldFlip,
562
- ...popoverProps,
563
- children: [
564
- /* @__PURE__ */ jsx(
565
- SlotProvider,
566
- {
567
- values: [
568
- [BadgeContext, {
569
- variant: "secondary"
570
- }]
571
- ],
572
- children: /* @__PURE__ */ jsx(
573
- _ListBox,
574
- {
575
- size,
576
- isInvalid,
577
- items,
578
- isLoading,
579
- onLoadMore,
580
- selectionIndicator,
581
- ...listBoxProps,
582
- children
583
- }
584
- )
585
- }
586
- ),
587
- footerMarkup
588
- ]
589
- }
590
- ),
591
- /* @__PURE__ */ jsxs(Button, { className: buttonClassNames, style: triggerStyle, "data-invalid": isInvalid || void 0, ...otherTriggerProps, children: [
592
- prefixMarkup,
593
- /* @__PURE__ */ jsx(_SelectValue, { size, children: (valueRenderProps) => {
594
- return renderValue == null ? void 0 : renderValue(valueRenderProps);
595
- } }),
596
- /* @__PURE__ */ jsx(ButtonIcon, { size: "sm", className: Select_module_default["hop-Select__button-icon"] })
597
- ] }),
598
- description && /* @__PURE__ */ jsx(_HelperMessage, { className: Select_module_default["hop-Select__helper-message"], children: description }),
599
- /* @__PURE__ */ jsx(_ErrorMessage, { className: Select_module_default["hop-Select__error-message"], children: errorMessage })
600
- ] });
601
- }
602
- }
603
- );
604
- }
605
- var _Select = forwardRef(Select);
606
- _Select.displayName = "Select";
607
- function $0d86e9c8f07f9a7b$export$79c0c687a5963b0a(opts, dispatch) {
608
- let { cursor, getKey } = opts;
609
- return {
610
- setSelectedKeys(selectedKeys) {
611
- dispatch((state) => ({
612
- ...state,
613
- selectedKeys
614
- }));
615
- },
616
- setFilterText(filterText) {
617
- dispatch((state) => ({
618
- ...state,
619
- filterText
620
- }));
621
- },
622
- insert(index, ...values) {
623
- dispatch((state) => $0d86e9c8f07f9a7b$var$insert(state, index, ...values));
624
- },
625
- insertBefore(key, ...values) {
626
- dispatch((state) => {
627
- let index = state.items.findIndex((item) => getKey(item) === key);
628
- if (index === -1) {
629
- if (state.items.length === 0) index = 0;
630
- else return state;
631
- }
632
- return $0d86e9c8f07f9a7b$var$insert(state, index, ...values);
633
- });
634
- },
635
- insertAfter(key, ...values) {
636
- dispatch((state) => {
637
- let index = state.items.findIndex((item) => getKey(item) === key);
638
- if (index === -1) {
639
- if (state.items.length === 0) index = 0;
640
- else return state;
641
- }
642
- return $0d86e9c8f07f9a7b$var$insert(state, index + 1, ...values);
643
- });
644
- },
645
- prepend(...values) {
646
- dispatch((state) => $0d86e9c8f07f9a7b$var$insert(state, 0, ...values));
647
- },
648
- append(...values) {
649
- dispatch((state) => $0d86e9c8f07f9a7b$var$insert(state, state.items.length, ...values));
650
- },
651
- remove(...keys) {
652
- dispatch((state) => {
653
- let keySet = new Set(keys);
654
- let items = state.items.filter((item) => !keySet.has(getKey(item)));
655
- let selection = "all";
656
- if (state.selectedKeys !== "all") {
657
- selection = new Set(state.selectedKeys);
658
- for (let key of keys) selection.delete(key);
659
- }
660
- if (cursor == null && items.length === 0) selection = /* @__PURE__ */ new Set();
661
- return {
662
- ...state,
663
- items,
664
- selectedKeys: selection
665
- };
666
- });
667
- },
668
- removeSelectedItems() {
669
- dispatch((state) => {
670
- if (state.selectedKeys === "all") return {
671
- ...state,
672
- items: [],
673
- selectedKeys: /* @__PURE__ */ new Set()
674
- };
675
- let selectedKeys = state.selectedKeys;
676
- let items = state.items.filter((item) => !selectedKeys.has(getKey(item)));
677
- return {
678
- ...state,
679
- items,
680
- selectedKeys: /* @__PURE__ */ new Set()
681
- };
682
- });
683
- },
684
- move(key, toIndex) {
685
- dispatch((state) => {
686
- let index = state.items.findIndex((item2) => getKey(item2) === key);
687
- if (index === -1) return state;
688
- let copy = state.items.slice();
689
- let [item] = copy.splice(index, 1);
690
- copy.splice(toIndex, 0, item);
691
- return {
692
- ...state,
693
- items: copy
694
- };
695
- });
696
- },
697
- moveBefore(key, keys) {
698
- dispatch((state) => {
699
- let toIndex = state.items.findIndex((item) => getKey(item) === key);
700
- if (toIndex === -1) return state;
701
- let keyArray = Array.isArray(keys) ? keys : [
702
- ...keys
703
- ];
704
- let indices = keyArray.map((key2) => state.items.findIndex((item) => getKey(item) === key2)).sort((a, b) => a - b);
705
- return $0d86e9c8f07f9a7b$var$move(state, indices, toIndex);
706
- });
707
- },
708
- moveAfter(key, keys) {
709
- dispatch((state) => {
710
- let toIndex = state.items.findIndex((item) => getKey(item) === key);
711
- if (toIndex === -1) return state;
712
- let keyArray = Array.isArray(keys) ? keys : [
713
- ...keys
714
- ];
715
- let indices = keyArray.map((key2) => state.items.findIndex((item) => getKey(item) === key2)).sort((a, b) => a - b);
716
- return $0d86e9c8f07f9a7b$var$move(state, indices, toIndex + 1);
717
- });
718
- },
719
- update(key, newValue) {
720
- dispatch((state) => {
721
- let index = state.items.findIndex((item) => getKey(item) === key);
722
- if (index === -1) return state;
723
- return {
724
- ...state,
725
- items: [
726
- ...state.items.slice(0, index),
727
- newValue,
728
- ...state.items.slice(index + 1)
729
- ]
730
- };
731
- });
732
- }
733
- };
734
- }
735
- function $0d86e9c8f07f9a7b$var$insert(state, index, ...values) {
736
- return {
737
- ...state,
738
- items: [
739
- ...state.items.slice(0, index),
740
- ...values,
741
- ...state.items.slice(index)
742
- ]
743
- };
744
- }
745
- function $0d86e9c8f07f9a7b$var$move(state, indices, toIndex) {
746
- toIndex -= indices.filter((index) => index < toIndex).length;
747
- let moves = indices.map((from) => ({
748
- from,
749
- to: toIndex++
750
- }));
751
- for (let i = 0; i < moves.length; i++) {
752
- let a = moves[i].from;
753
- for (let j = i; j < moves.length; j++) {
754
- let b = moves[j].from;
755
- if (b > a) moves[j].from--;
756
- }
757
- }
758
- for (let i = 0; i < moves.length; i++) {
759
- let a = moves[i];
760
- for (let j = moves.length - 1; j > i; j--) {
761
- let b = moves[j];
762
- if (b.from < a.to) a.to++;
763
- else b.from++;
764
- }
765
- }
766
- let copy = state.items.slice();
767
- for (let move of moves) {
768
- let [item] = copy.splice(move.from, 1);
769
- copy.splice(move.to, 0, item);
770
- }
771
- return {
772
- ...state,
773
- items: copy
774
- };
775
- }
776
- function $f86e6c1ec7da6ebb$var$reducer(data, action) {
777
- let selectedKeys;
778
- switch (data.state) {
779
- case "idle":
780
- case "error":
781
- switch (action.type) {
782
- case "loading":
783
- case "loadingMore":
784
- case "sorting":
785
- case "filtering":
786
- var _action_filterText, _action_sortDescriptor;
787
- return {
788
- ...data,
789
- filterText: (_action_filterText = action.filterText) !== null && _action_filterText !== void 0 ? _action_filterText : data.filterText,
790
- state: action.type,
791
- // Reset items to an empty list if loading, but not when sorting.
792
- items: action.type === "loading" ? [] : data.items,
793
- sortDescriptor: (_action_sortDescriptor = action.sortDescriptor) !== null && _action_sortDescriptor !== void 0 ? _action_sortDescriptor : data.sortDescriptor,
794
- abortController: action.abortController
795
- };
796
- case "update":
797
- return {
798
- ...data,
799
- ...action.updater(data)
800
- };
801
- case "success":
802
- case "error":
803
- return data;
804
- default:
805
- throw new Error(`Invalid action "${action.type}" in state "${data.state}"`);
806
- }
807
- case "loading":
808
- case "sorting":
809
- case "filtering":
810
- switch (action.type) {
811
- case "success":
812
- if (action.abortController !== data.abortController) return data;
813
- var _action_selectedKeys;
814
- selectedKeys = (_action_selectedKeys = action.selectedKeys) !== null && _action_selectedKeys !== void 0 ? _action_selectedKeys : data.selectedKeys;
815
- var _action_filterText1, _action_sortDescriptor1;
816
- return {
817
- ...data,
818
- filterText: (_action_filterText1 = action.filterText) !== null && _action_filterText1 !== void 0 ? _action_filterText1 : data.filterText,
819
- state: "idle",
820
- items: [
821
- ...action.items
822
- ],
823
- selectedKeys: selectedKeys === "all" ? "all" : new Set(selectedKeys),
824
- sortDescriptor: (_action_sortDescriptor1 = action.sortDescriptor) !== null && _action_sortDescriptor1 !== void 0 ? _action_sortDescriptor1 : data.sortDescriptor,
825
- abortController: null,
826
- cursor: action.cursor
827
- };
828
- case "error":
829
- if (action.abortController !== data.abortController) return data;
830
- return {
831
- ...data,
832
- state: "error",
833
- error: action.error,
834
- abortController: null
835
- };
836
- case "loading":
837
- case "loadingMore":
838
- case "sorting":
839
- case "filtering":
840
- data.abortController.abort();
841
- var _action_filterText2;
842
- return {
843
- ...data,
844
- filterText: (_action_filterText2 = action.filterText) !== null && _action_filterText2 !== void 0 ? _action_filterText2 : data.filterText,
845
- state: action.type,
846
- // Reset items to an empty list if loading, but not when sorting.
847
- items: action.type === "loading" ? [] : data.items,
848
- abortController: action.abortController
849
- };
850
- case "update":
851
- return {
852
- ...data,
853
- ...action.updater(data)
854
- };
855
- default:
856
- throw new Error(`Invalid action "${action.type}" in state "${data.state}"`);
857
- }
858
- case "loadingMore":
859
- switch (action.type) {
860
- case "success":
861
- var _action_selectedKeys1;
862
- selectedKeys = data.selectedKeys === "all" || action.selectedKeys === "all" ? "all" : /* @__PURE__ */ new Set([
863
- ...data.selectedKeys,
864
- ...(_action_selectedKeys1 = action.selectedKeys) !== null && _action_selectedKeys1 !== void 0 ? _action_selectedKeys1 : []
865
- ]);
866
- var _action_sortDescriptor2;
867
- return {
868
- ...data,
869
- state: "idle",
870
- items: [
871
- ...data.items,
872
- ...action.items
873
- ],
874
- selectedKeys,
875
- sortDescriptor: (_action_sortDescriptor2 = action.sortDescriptor) !== null && _action_sortDescriptor2 !== void 0 ? _action_sortDescriptor2 : data.sortDescriptor,
876
- abortController: null,
877
- cursor: action.cursor
878
- };
879
- case "error":
880
- if (action.abortController !== data.abortController) return data;
881
- return {
882
- ...data,
883
- state: "error",
884
- error: action.error
885
- };
886
- case "loading":
887
- case "sorting":
888
- case "filtering":
889
- data.abortController.abort();
890
- var _action_filterText3;
891
- return {
892
- ...data,
893
- filterText: (_action_filterText3 = action.filterText) !== null && _action_filterText3 !== void 0 ? _action_filterText3 : data.filterText,
894
- state: action.type,
895
- // Reset items to an empty list if loading, but not when sorting.
896
- items: action.type === "loading" ? [] : data.items,
897
- abortController: action.abortController
898
- };
899
- case "loadingMore":
900
- action.abortController.abort();
901
- return data;
902
- case "update":
903
- return {
904
- ...data,
905
- ...action.updater(data)
906
- };
907
- default:
908
- throw new Error(`Invalid action "${action.type}" in state "${data.state}"`);
909
- }
910
- default:
911
- throw new Error(`Invalid state "${data.state}"`);
912
- }
913
- }
914
- function $f86e6c1ec7da6ebb$export$bc3384a35de93d66(options) {
915
- const { load, sort, initialSelectedKeys, initialSortDescriptor, getKey = (item) => item.id || item.key, initialFilterText = "" } = options;
916
- let [data, dispatch] = (useReducer)($f86e6c1ec7da6ebb$var$reducer, {
917
- state: "idle",
918
- error: null,
919
- items: [],
920
- selectedKeys: initialSelectedKeys === "all" ? "all" : new Set(initialSelectedKeys),
921
- sortDescriptor: initialSortDescriptor,
922
- filterText: initialFilterText
923
- });
924
- const dispatchFetch = async (action, fn) => {
925
- let abortController = new AbortController();
926
- try {
927
- dispatch({
928
- ...action,
929
- abortController
930
- });
931
- var _action_filterText;
932
- let previousFilterText = (_action_filterText = action.filterText) !== null && _action_filterText !== void 0 ? _action_filterText : data.filterText;
933
- var _action_sortDescriptor;
934
- let response = await fn({
935
- items: data.items.slice(),
936
- selectedKeys: data.selectedKeys,
937
- sortDescriptor: (_action_sortDescriptor = action.sortDescriptor) !== null && _action_sortDescriptor !== void 0 ? _action_sortDescriptor : data.sortDescriptor,
938
- signal: abortController.signal,
939
- cursor: action.type === "loadingMore" ? data.cursor : null,
940
- filterText: previousFilterText
941
- });
942
- var _response_filterText;
943
- let filterText = (_response_filterText = response.filterText) !== null && _response_filterText !== void 0 ? _response_filterText : previousFilterText;
944
- dispatch({
945
- type: "success",
946
- ...response,
947
- abortController
948
- });
949
- if (filterText && filterText !== previousFilterText && !abortController.signal.aborted) dispatchFetch({
950
- type: "filtering",
951
- filterText
952
- }, load);
953
- } catch (e) {
954
- dispatch({
955
- type: "error",
956
- error: e,
957
- abortController
958
- });
959
- }
960
- };
961
- let didDispatchInitialFetch = (useRef)(false);
962
- (useEffect)(() => {
963
- if (!didDispatchInitialFetch.current) {
964
- dispatchFetch({
965
- type: "loading"
966
- }, load);
967
- didDispatchInitialFetch.current = true;
968
- }
969
- }, []);
970
- return {
971
- items: data.items,
972
- selectedKeys: data.selectedKeys,
973
- sortDescriptor: data.sortDescriptor,
974
- isLoading: data.state === "loading" || data.state === "loadingMore" || data.state === "sorting" || data.state === "filtering",
975
- loadingState: data.state,
976
- error: data.error,
977
- filterText: data.filterText,
978
- getItem(key) {
979
- return data.items.find((item) => getKey(item) === key);
980
- },
981
- reload() {
982
- dispatchFetch({
983
- type: "loading"
984
- }, load);
985
- },
986
- loadMore() {
987
- if (data.state === "loadingMore" || data.state === "filtering" || data.cursor == null) return;
988
- dispatchFetch({
989
- type: "loadingMore"
990
- }, load);
991
- },
992
- sort(sortDescriptor) {
993
- dispatchFetch({
994
- type: "sorting",
995
- sortDescriptor
996
- }, sort || load);
997
- },
998
- ...($0d86e9c8f07f9a7b$export$79c0c687a5963b0a)({
999
- ...options,
1000
- getKey,
1001
- cursor: data.cursor
1002
- }, (fn) => {
1003
- dispatch({
1004
- type: "update",
1005
- updater: fn
1006
- });
1007
- }),
1008
- setFilterText(filterText) {
1009
- dispatchFetch({
1010
- type: "filtering",
1011
- filterText
1012
- }, load);
1013
- }
1014
- };
1015
- }
1016
-
1017
- // css-module:./Popover.module.css#css-module
1018
- var Popover_module_default = { "hop-Popover": "Popover-module__hop-Popover___O1hxD", "fade": "Popover-module__fade___M6MSl", "hop-Popover__wrapper": "Popover-module__hop-Popover__wrapper___FiFqq", "hop-Popover__dialog": "Popover-module__hop-Popover__dialog___EdxN2", "hop-Popover__dropdown": "Popover-module__hop-Popover__dropdown___0n3T8", "hop-Popover__title": "Popover-module__hop-Popover__title___XeW0X", "hop-Popover__content": "Popover-module__hop-Popover__content___MK7yG", "hop-Popover__list-box": "Popover-module__hop-Popover__list-box___x9aN4", "hop-Popover__footer": "Popover-module__hop-Popover__footer___W8Uyh", "hop-Popover__actions": "Popover-module__hop-Popover__actions___aydxV", "hop-Popover__action": "Popover-module__hop-Popover__action___N2C1w" };
1019
- var GlobalPopoverCssSelector = "hop-Popover";
1020
- function Popover(props, ref) {
1021
- var _a;
1022
- [props, ref] = useContextProps(props, ref, PopoverContext);
1023
- const { stylingProps, ...ownProps } = useStyledSystem(props);
1024
- const {
1025
- isAutoWidth,
1026
- children,
1027
- className,
1028
- offset = 4,
1029
- boundaryOffset,
1030
- isNonDialog,
1031
- containerPadding = 16,
1032
- containerProps,
1033
- placement: placementProp,
1034
- style: styleProp,
1035
- ...otherProps
1036
- } = ownProps;
1037
- const placement = (_a = useResponsiveValue(placementProp)) != null ? _a : "bottom";
1038
- const { stylingProps: containerStylingProps, ...containerOwnProps } = useStyledSystem(containerProps != null ? containerProps : {});
1039
- const {
1040
- className: containerClassName,
1041
- style: containerStyleProp,
1042
- slot,
1043
- ...containerOtherProps
1044
- } = containerOwnProps;
1045
- const { colorScheme } = useColorSchemeContext();
1046
- const popoverClassNames = composeClassnameRenderProps(
1047
- className,
1048
- GlobalPopoverCssSelector,
1049
- cssModule(
1050
- Popover_module_default,
1051
- "hop-Popover",
1052
- isNonDialog && "non-dialog"
1053
- ),
1054
- stylingProps.className
1055
- );
1056
- const containerClassNames = isNonDialog ? clsx2(containerClassName, Popover_module_default["hop-Popover__dropdown"], containerStylingProps.className) : clsx2(containerClassName, Popover_module_default["hop-Popover__dialog"], containerStylingProps.className);
1057
- const style = composeRenderProps(styleProp, (prev) => {
1058
- return {
1059
- ...stylingProps.style,
1060
- "--container-padding": `${containerPadding}px`,
1061
- ...prev
1062
- };
1063
- });
1064
- const containerStyle = {
1065
- ...containerStylingProps.style,
1066
- ...containerStyleProp
1067
- };
1068
- return /* @__PURE__ */ jsx(
1069
- Popover$1,
1070
- {
1071
- offset,
1072
- ref,
1073
- className: popoverClassNames,
1074
- arrowBoundaryOffset: boundaryOffset,
1075
- "data-auto-width": isAutoWidth || void 0,
1076
- containerPadding,
1077
- style,
1078
- placement,
1079
- ...otherProps,
1080
- children: (state) => {
1081
- const content = isFunction(children) && !isNil(children) ? children(state) : children;
1082
- if (isNonDialog) {
1083
- return /* @__PURE__ */ jsx(_HopperProvider, { colorScheme, className: Popover_module_default["hop-Popover__wrapper"], children: /* @__PURE__ */ jsx(
1084
- "div",
1085
- {
1086
- ...containerOtherProps,
1087
- className: containerClassNames,
1088
- style: containerStyle,
1089
- slot: slot || void 0,
1090
- children: /* @__PURE__ */ jsx(
1091
- SlotProvider,
1092
- {
1093
- values: [
1094
- [ListBoxContext, {
1095
- className: Popover_module_default["hop-Popover__list-box"]
1096
- }],
1097
- [FooterContext, {
1098
- className: Popover_module_default["hop-Popover__footer"]
1099
- }],
1100
- [LinkContext, {
1101
- size: "sm",
1102
- variant: "primary",
1103
- isQuiet: true
1104
- }]
1105
- ],
1106
- children: content
1107
- }
1108
- )
1109
- }
1110
- ) });
1111
- }
1112
- return /* @__PURE__ */ jsx(_HopperProvider, { colorScheme, children: /* @__PURE__ */ jsx(Dialog, { ...containerOtherProps, className: containerClassNames, style: containerStyle, children: /* @__PURE__ */ jsx(
1113
- SlotProvider,
1114
- {
1115
- values: [
1116
- [HeadingContext, {
1117
- className: Popover_module_default["hop-Popover__title"],
1118
- size: "xs"
1119
- }],
1120
- [ButtonContext$1, {
1121
- size: "sm",
1122
- className: Popover_module_default["hop-Popover__action"]
1123
- }],
1124
- [LinkButtonContext, {
1125
- size: "sm",
1126
- className: Popover_module_default["hop-Popover__action"]
1127
- }],
1128
- [ButtonGroupContext, {
1129
- size: "sm",
1130
- align: "end",
1131
- className: Popover_module_default["hop-Popover__actions"]
1132
- }],
1133
- [ContentContext, {
1134
- className: Popover_module_default["hop-Popover__content"]
1135
- }],
1136
- [FooterContext, {
1137
- className: Popover_module_default["hop-Popover__footer"]
1138
- }],
1139
- [LinkContext, {
1140
- size: "sm",
1141
- variant: "primary",
1142
- isQuiet: true
1143
- }]
1144
- ],
1145
- children: content
1146
- }
1147
- ) }) });
1148
- }
1149
- }
1150
- );
1151
- }
1152
- var _Popover = forwardRef(Popover);
1153
- _Popover.displayName = "Popover";
1154
-
1155
- export { $f86e6c1ec7da6ebb$export$bc3384a35de93d66, GlobalComboBoxCssSelector, GlobalFormCssSelector, GlobalPopoverCssSelector, GlobalSelectCssSelector, _ComboBox, _Form, _Popover, _Select };