@hopper-ui/components 0.1.1 → 1.0.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 (199) hide show
  1. package/CHANGELOG.md +117 -0
  2. package/dist/HopperProvider/src/HopperProvider.d.ts +33 -1
  3. package/dist/HopperProvider/src/HopperProvider.js +2 -1
  4. package/dist/HopperProvider/src/index.d.ts +1 -0
  5. package/dist/HopperProvider/src/index.js +2 -1
  6. package/dist/IconList/src/IconList.css +4 -4
  7. package/dist/IconList/src/IconList.js +2 -1
  8. package/dist/IconList/src/IconListContext.js +1 -0
  9. package/dist/IconList/src/index.css +4 -4
  10. package/dist/IconList/src/index.js +2 -1
  11. package/dist/Label/src/Label.css +11 -11
  12. package/dist/Label/src/Label.js +2 -1
  13. package/dist/Label/src/LabelContext.js +1 -0
  14. package/dist/Label/src/index.css +11 -11
  15. package/dist/Label/src/index.js +2 -1
  16. package/dist/Link/src/Link.css +165 -0
  17. package/dist/Link/src/Link.d.ts +33 -0
  18. package/dist/Link/src/Link.js +11 -0
  19. package/dist/Link/src/LinkContext.d.ts +8 -0
  20. package/dist/Link/src/LinkContext.js +2 -0
  21. package/dist/Link/src/index.css +165 -0
  22. package/dist/Link/src/index.d.ts +5 -0
  23. package/dist/Link/src/index.js +11 -0
  24. package/dist/Spinner/src/Spinner.css +80 -80
  25. package/dist/Spinner/src/Spinner.d.ts +1 -0
  26. package/dist/Spinner/src/Spinner.js +3 -2
  27. package/dist/Spinner/src/SpinnerContext.js +1 -0
  28. package/dist/Spinner/src/index.css +80 -80
  29. package/dist/Spinner/src/index.js +3 -2
  30. package/dist/Text/src/Text.css +11 -11
  31. package/dist/Text/src/Text.d.ts +2 -3
  32. package/dist/Text/src/Text.js +4 -1
  33. package/dist/Text/src/TextContext.js +1 -0
  34. package/dist/Text/src/index.css +11 -11
  35. package/dist/Text/src/index.d.ts +1 -1
  36. package/dist/Text/src/index.js +4 -1
  37. package/dist/buttons/src/Button.css +557 -358
  38. package/dist/buttons/src/Button.d.ts +15 -10
  39. package/dist/buttons/src/Button.js +12 -8
  40. package/dist/buttons/src/ButtonContext.d.ts +6 -2
  41. package/dist/buttons/src/ButtonContext.js +1 -0
  42. package/dist/buttons/src/ButtonGroup.css +38 -0
  43. package/dist/buttons/src/ButtonGroup.d.ts +40 -0
  44. package/dist/buttons/src/ButtonGroup.js +83 -0
  45. package/dist/buttons/src/ButtonGroupContext.d.ts +9 -0
  46. package/dist/buttons/src/ButtonGroupContext.js +2 -0
  47. package/dist/buttons/src/index.css +557 -358
  48. package/dist/buttons/src/index.d.ts +2 -1
  49. package/dist/buttons/src/index.js +12 -8
  50. package/dist/checkbox/src/Checkbox.css +292 -0
  51. package/dist/checkbox/src/Checkbox.d.ts +20 -0
  52. package/dist/checkbox/src/Checkbox.js +11 -0
  53. package/dist/checkbox/src/CheckboxContext.d.ts +8 -0
  54. package/dist/checkbox/src/CheckboxContext.js +2 -0
  55. package/dist/checkbox/src/CheckboxField.css +119 -0
  56. package/dist/checkbox/src/CheckboxField.d.ts +26 -0
  57. package/dist/checkbox/src/CheckboxField.js +7 -0
  58. package/dist/checkbox/src/CheckboxFieldContext.d.ts +10 -0
  59. package/dist/checkbox/src/CheckboxFieldContext.js +2 -0
  60. package/dist/checkbox/src/CheckboxGroup.css +568 -0
  61. package/dist/checkbox/src/CheckboxGroup.d.ts +30 -0
  62. package/dist/checkbox/src/CheckboxGroup.js +12 -0
  63. package/dist/checkbox/src/CheckboxGroupContext.d.ts +8 -0
  64. package/dist/checkbox/src/CheckboxGroupContext.js +2 -0
  65. package/dist/checkbox/src/CheckboxList.d.ts +17 -0
  66. package/dist/checkbox/src/CheckboxList.js +3 -0
  67. package/dist/checkbox/src/CheckboxListContext.d.ts +10 -0
  68. package/dist/checkbox/src/CheckboxListContext.js +2 -0
  69. package/dist/checkbox/src/index.css +568 -0
  70. package/dist/checkbox/src/index.d.ts +13 -0
  71. package/dist/checkbox/src/index.js +20 -0
  72. package/dist/chip/src/Chip.css +261 -0
  73. package/dist/chip/src/Chip.d.ts +27 -0
  74. package/dist/chip/src/Chip.js +10 -0
  75. package/dist/chip/src/ChipContext.d.ts +10 -0
  76. package/dist/chip/src/ChipContext.js +2 -0
  77. package/dist/chip/src/index.css +261 -0
  78. package/dist/chip/src/index.d.ts +7 -0
  79. package/dist/chip/src/index.js +10 -0
  80. package/dist/chunk-2EAZPH3M.js +7 -0
  81. package/dist/chunk-3FT5XSWV.js +124 -0
  82. package/dist/chunk-3KIUEBO3.js +69 -0
  83. package/dist/chunk-3LRBUQC2.js +43 -0
  84. package/dist/chunk-4VVNSXIB.js +7 -0
  85. package/dist/chunk-5MBJWRZD.js +7 -0
  86. package/dist/chunk-6EMOC7TA.js +83 -0
  87. package/dist/chunk-A7TZHALP.js +7 -0
  88. package/dist/chunk-ACVMW6YD.js +7 -0
  89. package/dist/{chunk-YLDA2M2E.js → chunk-ANVMQBBG.js} +2 -1
  90. package/dist/chunk-BIVAOAN2.js +101 -0
  91. package/dist/chunk-BPM4ETTB.js +35 -0
  92. package/dist/chunk-CE3ABLD2.js +92 -0
  93. package/dist/chunk-CJFCOPMQ.js +57 -0
  94. package/dist/chunk-DGLAGYBD.js +7 -0
  95. package/dist/chunk-EADFYPVX.js +93 -0
  96. package/dist/chunk-ESVVLTEN.js +7 -0
  97. package/dist/chunk-FD4HMY5A.js +91 -0
  98. package/dist/chunk-FU5CCPLP.js +7 -0
  99. package/dist/{chunk-JGYEQS4H.js → chunk-G7RKLBFT.js} +7 -7
  100. package/dist/chunk-H234F7HP.js +83 -0
  101. package/dist/chunk-H5YTU3U7.js +20 -0
  102. package/dist/chunk-H7VJS4MX.js +7 -0
  103. package/dist/chunk-HUJ3PTM7.js +58 -0
  104. package/dist/chunk-HXI3MEEK.js +27 -0
  105. package/dist/chunk-KKFX7YII.js +83 -0
  106. package/dist/chunk-N7YDPVZL.js +7 -0
  107. package/dist/chunk-NH3IVMXB.js +43 -0
  108. package/dist/chunk-NKHMUPAP.js +43 -0
  109. package/dist/chunk-SC4G54ML.js +186 -0
  110. package/dist/{chunk-CMJUZLSA.js → chunk-TRS7R4W3.js} +7 -7
  111. package/dist/chunk-VJQ7M2BK.js +7 -0
  112. package/dist/chunk-VYNBJRJW.js +101 -0
  113. package/dist/chunk-WDUQUPTE.js +7 -0
  114. package/dist/chunk-WTKIUAHI.js +7 -0
  115. package/dist/{chunk-A2IN7HC4.js → chunk-YFTLWL74.js} +8 -9
  116. package/dist/chunk-YHBJAXUY.js +7 -0
  117. package/dist/chunk-YSQDPG26.js +27 -0
  118. package/dist/chunk-ZGNK4GWA.js +7 -0
  119. package/dist/chunk-ZUMAL5WB.js +104 -0
  120. package/dist/errorMessage/src/ErrorMessage.css +102 -0
  121. package/dist/errorMessage/src/ErrorMessage.d.ts +20 -0
  122. package/dist/errorMessage/src/ErrorMessage.js +9 -0
  123. package/dist/errorMessage/src/ErrorMessageContext.d.ts +9 -0
  124. package/dist/errorMessage/src/ErrorMessageContext.js +2 -0
  125. package/dist/errorMessage/src/index.css +102 -0
  126. package/dist/errorMessage/src/index.d.ts +6 -0
  127. package/dist/errorMessage/src/index.js +9 -0
  128. package/dist/helperMessage/src/HelperMessage.css +94 -0
  129. package/dist/helperMessage/src/HelperMessage.d.ts +20 -0
  130. package/dist/helperMessage/src/HelperMessage.js +8 -0
  131. package/dist/helperMessage/src/HelperMessageContext.d.ts +9 -0
  132. package/dist/helperMessage/src/HelperMessageContext.js +2 -0
  133. package/dist/helperMessage/src/index.css +94 -0
  134. package/dist/helperMessage/src/index.d.ts +6 -0
  135. package/dist/helperMessage/src/index.js +8 -0
  136. package/dist/{intl → i18n}/src/index.d.ts +1 -0
  137. package/dist/i18n/src/index.js +2 -0
  138. package/dist/i18n/src/useLocalizedString.d.ts +9 -0
  139. package/dist/i18n/src/useLocalizedString.js +2 -0
  140. package/dist/layout/src/Flex.js +1 -0
  141. package/dist/layout/src/Grid.js +1 -1
  142. package/dist/layout/src/Inline.js +1 -0
  143. package/dist/layout/src/Stack.js +1 -0
  144. package/dist/radio/src/Radio.css +293 -0
  145. package/dist/radio/src/Radio.d.ts +20 -0
  146. package/dist/radio/src/Radio.js +11 -0
  147. package/dist/radio/src/RadioContext.d.ts +8 -0
  148. package/dist/radio/src/RadioContext.js +2 -0
  149. package/dist/radio/src/RadioField.css +119 -0
  150. package/dist/radio/src/RadioField.d.ts +26 -0
  151. package/dist/radio/src/RadioField.js +7 -0
  152. package/dist/radio/src/RadioFieldContext.d.ts +10 -0
  153. package/dist/radio/src/RadioFieldContext.js +2 -0
  154. package/dist/radio/src/RadioGroup.css +570 -0
  155. package/dist/radio/src/RadioGroup.d.ts +30 -0
  156. package/dist/radio/src/RadioGroup.js +12 -0
  157. package/dist/radio/src/RadioGroupContext.d.ts +8 -0
  158. package/dist/radio/src/RadioGroupContext.js +2 -0
  159. package/dist/radio/src/RadioList.d.ts +17 -0
  160. package/dist/radio/src/RadioList.js +3 -0
  161. package/dist/radio/src/RadioListContext.d.ts +10 -0
  162. package/dist/radio/src/RadioListContext.js +2 -0
  163. package/dist/radio/src/index.css +570 -0
  164. package/dist/radio/src/index.d.ts +13 -0
  165. package/dist/radio/src/index.js +20 -0
  166. package/dist/switch/src/Switch.css +236 -0
  167. package/dist/switch/src/Switch.d.ts +20 -0
  168. package/dist/switch/src/Switch.js +11 -0
  169. package/dist/switch/src/SwitchContext.d.ts +8 -0
  170. package/dist/switch/src/SwitchContext.js +2 -0
  171. package/dist/switch/src/SwitchField.css +119 -0
  172. package/dist/switch/src/SwitchField.d.ts +26 -0
  173. package/dist/switch/src/SwitchField.js +7 -0
  174. package/dist/switch/src/SwitchFieldContext.d.ts +10 -0
  175. package/dist/switch/src/SwitchFieldContext.js +2 -0
  176. package/dist/switch/src/index.css +276 -0
  177. package/dist/switch/src/index.d.ts +9 -0
  178. package/dist/switch/src/index.js +13 -0
  179. package/dist/utils/src/ClearSlots.d.ts +28 -0
  180. package/dist/utils/src/ClearSlots.js +2 -0
  181. package/dist/utils/src/SlotProvider.js +1 -0
  182. package/dist/utils/src/composeClassnameRenderProps.js +1 -0
  183. package/dist/utils/src/cssModule.js +1 -0
  184. package/dist/utils/src/index.d.ts +7 -2
  185. package/dist/utils/src/index.js +5 -1
  186. package/dist/utils/src/isTextOnlyChildren.js +1 -0
  187. package/dist/utils/src/sizeAdapter.d.ts +1 -1
  188. package/dist/utils/src/types.d.ts +17 -5
  189. package/dist/utils/src/useRenderProps.d.ts +843 -0
  190. package/dist/utils/src/useRenderProps.js +2 -0
  191. package/dist/utils/src/useSlot.d.ts +8 -0
  192. package/dist/utils/src/useSlot.js +2 -0
  193. package/package.json +32 -27
  194. package/dist/chunk-GXUPEV64.js +0 -24
  195. package/dist/chunk-TNWWLZEQ.js +0 -47
  196. package/dist/chunk-Z34Z6LYX.js +0 -141
  197. package/dist/intl/src/index.js +0 -1
  198. package/dist/intl/src/useLocalizedString.d.ts +0 -26
  199. package/dist/intl/src/useLocalizedString.js +0 -1
@@ -0,0 +1,124 @@
1
+ import { isTextOnlyChildren } from './chunk-ZWU6DRRZ.js';
2
+ import { LinkContext } from './chunk-4VVNSXIB.js';
3
+ import { composeClassnameRenderProps } from './chunk-65JPI4FL.js';
4
+ import { _Text } from './chunk-HUJ3PTM7.js';
5
+ import { TextContext } from './chunk-OE5BLFZI.js';
6
+ import { cssModule } from './chunk-KVDXQMWI.js';
7
+ import { SlotProvider } from './chunk-M36KANKC.js';
8
+ import { IconListContext } from './chunk-DHVVYSLB.js';
9
+ import { IconContext } from '@hopper-ui/icons';
10
+ import { useStyledSystem, useResponsiveValue } from '@hopper-ui/styled-system';
11
+ import { forwardRef } from 'react';
12
+ import { useContextProps, composeRenderProps, DEFAULT_SLOT, Link as Link$1 } from 'react-aria-components';
13
+ import { jsx } from 'react/jsx-runtime';
14
+
15
+ // css-module:./Link.module.css#css-module
16
+ var Link_module_default = { "hop-Link": "Link-module__hop-Link___oiI-Z", "hop-Link--quiet": "Link-module__hop-Link--quiet___Hf4-m", "hop-Link--primary": "Link-module__hop-Link--primary___Oi-l-", "hop-Link--secondary": "Link-module__hop-Link--secondary___r8H7h", "hop-Link__icon": "Link-module__hop-Link__icon___JBrAN", "hop-Link__icon-list": "Link-module__hop-Link__icon-list___GKemr", "hop-Link__text": "Link-module__hop-Link__text___-0Fhk", "hop-Link__start-icon": "Link-module__hop-Link__start-icon___QQAbh", "hop-Link__start-icon-list": "Link-module__hop-Link__start-icon-list___hA3bc" };
17
+ var GlobalLinkCssSelector = "hop-Link";
18
+ var LinkToIconSizeAdapter = {
19
+ inherit: void 0,
20
+ xs: "sm",
21
+ sm: "sm",
22
+ md: "md",
23
+ lg: "md",
24
+ xl: "lg",
25
+ "2xl": "lg"
26
+ };
27
+ function Link(props, ref) {
28
+ var _a;
29
+ [props, ref] = useContextProps(props, ref, LinkContext);
30
+ const { stylingProps, ...ownProps } = useStyledSystem(props);
31
+ const {
32
+ className,
33
+ children: childrenProp,
34
+ size: sizeProp,
35
+ style: styleProp,
36
+ isQuiet,
37
+ isExternal,
38
+ variant = "primary",
39
+ rel,
40
+ target,
41
+ ...otherProps
42
+ } = ownProps;
43
+ const size = (_a = useResponsiveValue(sizeProp)) != null ? _a : "inherit";
44
+ const classNames = composeClassnameRenderProps(
45
+ className,
46
+ GlobalLinkCssSelector,
47
+ cssModule(
48
+ Link_module_default,
49
+ "hop-Link",
50
+ isQuiet && "quiet",
51
+ variant,
52
+ size
53
+ ),
54
+ stylingProps.className
55
+ );
56
+ const style = composeRenderProps(styleProp, (prev) => {
57
+ return {
58
+ ...stylingProps.style,
59
+ ...prev
60
+ };
61
+ });
62
+ const children = composeRenderProps(childrenProp, (prev) => {
63
+ if (prev && isTextOnlyChildren(prev)) {
64
+ return /* @__PURE__ */ jsx(_Text, { children: prev });
65
+ }
66
+ return prev;
67
+ });
68
+ const iconSize = LinkToIconSizeAdapter[size];
69
+ return /* @__PURE__ */ jsx(
70
+ SlotProvider,
71
+ {
72
+ values: [
73
+ [IconListContext, {
74
+ slots: {
75
+ [DEFAULT_SLOT]: {
76
+ color: "inherit",
77
+ size: iconSize,
78
+ className: Link_module_default["hop-Link__icon-list"]
79
+ },
80
+ "start-icon": {
81
+ color: "inherit",
82
+ size: iconSize,
83
+ className: Link_module_default["hop-Link__start-icon-list"]
84
+ }
85
+ }
86
+ }],
87
+ [IconContext, {
88
+ slots: {
89
+ [DEFAULT_SLOT]: {
90
+ color: "inherit",
91
+ size: iconSize,
92
+ className: Link_module_default["hop-Link__icon"]
93
+ },
94
+ "start-icon": {
95
+ color: "inherit",
96
+ size: iconSize,
97
+ className: Link_module_default["hop-Link__start-icon"]
98
+ }
99
+ }
100
+ }],
101
+ [TextContext, {
102
+ size,
103
+ className: Link_module_default["hop-Link__text"]
104
+ }]
105
+ ],
106
+ children: /* @__PURE__ */ jsx(
107
+ Link$1,
108
+ {
109
+ ...otherProps,
110
+ rel: rel != null ? rel : isExternal ? "noopener noreferrer" : void 0,
111
+ target: target != null ? target : isExternal ? "_blank" : void 0,
112
+ ref,
113
+ className: classNames,
114
+ style,
115
+ children
116
+ }
117
+ )
118
+ }
119
+ );
120
+ }
121
+ var _Link = forwardRef(Link);
122
+ _Link.displayName = "Link";
123
+
124
+ export { GlobalLinkCssSelector, _Link };
@@ -0,0 +1,69 @@
1
+ import { ErrorMessageContext } from './chunk-ACVMW6YD.js';
2
+ import { useRenderProps } from './chunk-NH3IVMXB.js';
3
+ import { _Text } from './chunk-HUJ3PTM7.js';
4
+ import { cssModule } from './chunk-KVDXQMWI.js';
5
+ import { WarningIcon } from '@hopper-ui/icons';
6
+ import { useStyledSystem } from '@hopper-ui/styled-system';
7
+ import clsx from 'clsx';
8
+ import { forwardRef, useContext } from 'react';
9
+ import { FieldErrorContext, useContextProps } from 'react-aria-components';
10
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
11
+
12
+ // css-module:./ErrorMessage.module.css#css-module
13
+ var ErrorMessage_module_default = { "hop-ErrorMessage": "ErrorMessage-module__hop-ErrorMessage___rzxzc", "hop-ErrorMessage__icon": "ErrorMessage-module__hop-ErrorMessage__icon___XMlVC" };
14
+ var GlobalErrorMessageCssSelector = "hop-ErrorMessage";
15
+ function ErrorMessage(props, ref) {
16
+ const validation = useContext(FieldErrorContext);
17
+ if (!(validation == null ? void 0 : validation.isInvalid)) {
18
+ return null;
19
+ }
20
+ return /* @__PURE__ */ jsx(ErrorMessageInner, { ...props, ref });
21
+ }
22
+ var _ErrorMessage = forwardRef(ErrorMessage);
23
+ _ErrorMessage.displayName = "ErrorMessage";
24
+ var ErrorMessageInner = forwardRef((props, ref) => {
25
+ const validation = useContext(FieldErrorContext);
26
+ [props, ref] = useContextProps(props, ref, ErrorMessageContext);
27
+ const { stylingProps, ...ownProps } = useStyledSystem(props);
28
+ const { className, children, hideIcon = false, style, slot = "errorMessage", ...otherProps } = ownProps;
29
+ const classNames = clsx(
30
+ GlobalErrorMessageCssSelector,
31
+ cssModule(
32
+ ErrorMessage_module_default,
33
+ "hop-ErrorMessage"
34
+ ),
35
+ stylingProps.className,
36
+ className
37
+ );
38
+ const mergedStyles = {
39
+ ...stylingProps.style,
40
+ ...style
41
+ };
42
+ const warningIcon = !hideIcon && /* @__PURE__ */ jsx(WarningIcon, { size: "sm", className: ErrorMessage_module_default["hop-ErrorMessage__icon"] });
43
+ const renderProps = useRenderProps({
44
+ className: classNames,
45
+ children: children ? /* @__PURE__ */ jsxs(Fragment, { children: [
46
+ warningIcon,
47
+ " ",
48
+ children
49
+ ] }) : null,
50
+ defaultChildren: /* @__PURE__ */ jsxs(Fragment, { children: [
51
+ warningIcon,
52
+ " ",
53
+ validation.validationErrors.join(" ")
54
+ ] }),
55
+ values: validation
56
+ });
57
+ return /* @__PURE__ */ jsx(
58
+ _Text,
59
+ {
60
+ ...otherProps,
61
+ ...renderProps,
62
+ slot,
63
+ ref,
64
+ style: mergedStyles
65
+ }
66
+ );
67
+ });
68
+
69
+ export { GlobalErrorMessageCssSelector, _ErrorMessage };
@@ -0,0 +1,43 @@
1
+ import { CheckboxListContext } from './chunk-WDUQUPTE.js';
2
+ import { useStyledSystem } from '@hopper-ui/styled-system';
3
+ import clsx from 'clsx';
4
+ import { forwardRef } from 'react';
5
+ import { useContextProps } from 'react-aria-components';
6
+ import { jsx } from 'react/jsx-runtime';
7
+
8
+ var GlobalCheckboxListCssSelector = "hop-CheckboxList";
9
+ function CheckboxList(props, ref) {
10
+ [props, ref] = useContextProps(props, ref, CheckboxListContext);
11
+ const { stylingProps, ...ownProps } = useStyledSystem(props);
12
+ const {
13
+ className,
14
+ children,
15
+ style,
16
+ slot,
17
+ ...otherProps
18
+ } = ownProps;
19
+ const classNames = clsx(
20
+ className,
21
+ GlobalCheckboxListCssSelector,
22
+ stylingProps.className
23
+ );
24
+ const mergedStyles = {
25
+ ...stylingProps.style,
26
+ ...style
27
+ };
28
+ return /* @__PURE__ */ jsx(
29
+ "div",
30
+ {
31
+ ...otherProps,
32
+ ref,
33
+ className: classNames,
34
+ style: mergedStyles,
35
+ slot: slot != null ? slot : void 0,
36
+ children
37
+ }
38
+ );
39
+ }
40
+ var _CheckboxList = forwardRef(CheckboxList);
41
+ _CheckboxList.displayName = "CheckboxList";
42
+
43
+ export { GlobalCheckboxListCssSelector, _CheckboxList };
@@ -0,0 +1,7 @@
1
+ import { createContext } from 'react';
2
+
3
+ // src/Link/src/LinkContext.ts
4
+ var LinkContext = createContext({});
5
+ LinkContext.displayName = "LinkContext";
6
+
7
+ export { LinkContext };
@@ -0,0 +1,7 @@
1
+ import { createContext } from 'react';
2
+
3
+ // src/radio/src/RadioGroupContext.ts
4
+ var RadioGroupContext = createContext({});
5
+ RadioGroupContext.displayName = "RadioGroupContext";
6
+
7
+ export { RadioGroupContext };
@@ -0,0 +1,83 @@
1
+ import { SwitchFieldContext } from './chunk-H7VJS4MX.js';
2
+ import { SwitchContext } from './chunk-YHBJAXUY.js';
3
+ import { TextContext } from './chunk-OE5BLFZI.js';
4
+ import { cssModule } from './chunk-KVDXQMWI.js';
5
+ import { SlotProvider } from './chunk-M36KANKC.js';
6
+ import { useStyledSystem, useResponsiveValue } from '@hopper-ui/styled-system';
7
+ import clsx from 'clsx';
8
+ import { forwardRef } from 'react';
9
+ import { useId } from 'react-aria';
10
+ import { useContextProps } from 'react-aria-components';
11
+ import { jsx } from 'react/jsx-runtime';
12
+
13
+ // css-module:./SwitchField.module.css#css-module
14
+ var SwitchField_module_default = { "hop-SwitchField": "SwitchField-module__hop-SwitchField___MErIH", "hop-SwitchField--sm": "SwitchField-module__hop-SwitchField--sm___yuCKo", "hop-SwitchField--md": "SwitchField-module__hop-SwitchField--md___XnuIh", "hop-SwitchField__description": "SwitchField-module__hop-SwitchField__description___cn6Ep", "hop-SwitchField__switch": "SwitchField-module__hop-SwitchField__switch___4JG5h" };
15
+ var GlobalSwitchFieldCssSelector = "hop-SwitchField";
16
+ var SwitchToDescriptionSizeAdapter = {
17
+ sm: "xs",
18
+ md: "sm"
19
+ };
20
+ function SwitchField(props, ref) {
21
+ var _a;
22
+ [props, ref] = useContextProps(props, ref, SwitchFieldContext);
23
+ const { stylingProps, ...ownProps } = useStyledSystem(props);
24
+ const {
25
+ className,
26
+ children,
27
+ isDisabled,
28
+ size: sizeProp = "md",
29
+ style,
30
+ slot,
31
+ ...otherProps
32
+ } = ownProps;
33
+ const size = (_a = useResponsiveValue(sizeProp)) != null ? _a : "md";
34
+ const classNames = clsx(
35
+ className,
36
+ GlobalSwitchFieldCssSelector,
37
+ cssModule(
38
+ SwitchField_module_default,
39
+ "hop-SwitchField",
40
+ size
41
+ ),
42
+ stylingProps.className
43
+ );
44
+ const mergedStyles = {
45
+ ...stylingProps.style,
46
+ ...style
47
+ };
48
+ const descriptionId = useId();
49
+ return /* @__PURE__ */ jsx(
50
+ SlotProvider,
51
+ {
52
+ values: [
53
+ [TextContext, {
54
+ id: descriptionId,
55
+ className: SwitchField_module_default["hop-SwitchField__description"],
56
+ size: SwitchToDescriptionSizeAdapter[size]
57
+ }],
58
+ [SwitchContext, {
59
+ className: SwitchField_module_default["hop-SwitchField__switch"],
60
+ size,
61
+ isDisabled,
62
+ "aria-describedby": descriptionId
63
+ }]
64
+ ],
65
+ children: /* @__PURE__ */ jsx(
66
+ "div",
67
+ {
68
+ ...otherProps,
69
+ ref,
70
+ className: classNames,
71
+ style: mergedStyles,
72
+ slot: slot != null ? slot : void 0,
73
+ "data-disabled": isDisabled,
74
+ children
75
+ }
76
+ )
77
+ }
78
+ );
79
+ }
80
+ var _SwitchField = forwardRef(SwitchField);
81
+ _SwitchField.displayName = "SwitchField";
82
+
83
+ export { GlobalSwitchFieldCssSelector, _SwitchField };
@@ -0,0 +1,7 @@
1
+ import { createContext } from 'react';
2
+
3
+ // src/radio/src/RadioListContext.ts
4
+ var RadioListContext = createContext({});
5
+ RadioListContext.displayName = "RadioListContext";
6
+
7
+ export { RadioListContext };
@@ -0,0 +1,7 @@
1
+ import { createContext } from 'react';
2
+
3
+ // src/errorMessage/src/ErrorMessageContext.ts
4
+ var ErrorMessageContext = createContext({});
5
+ ErrorMessageContext.displayName = "ErrorMessageContext";
6
+
7
+ export { ErrorMessageContext };
@@ -15,6 +15,7 @@ var HopperProvider = (props, ref) => {
15
15
  withCssVariables = true,
16
16
  className,
17
17
  navigate,
18
+ useHref,
18
19
  ...rest
19
20
  } = props;
20
21
  const classNames = clsx(
@@ -23,7 +24,7 @@ var HopperProvider = (props, ref) => {
23
24
  );
24
25
  let content = children;
25
26
  if (navigate) {
26
- content = /* @__PURE__ */ jsx(RouterProvider, { navigate, children });
27
+ content = /* @__PURE__ */ jsx(RouterProvider, { navigate, useHref, children });
27
28
  }
28
29
  return /* @__PURE__ */ jsx(StyledSystemProvider, { ref, withBodyStyle, colorScheme, withCssVariables, className: classNames, ...rest, children: /* @__PURE__ */ jsx(I18nProvider, { locale, children: content }) });
29
30
  };
@@ -0,0 +1,101 @@
1
+ import { RadioFieldContext } from './chunk-DGLAGYBD.js';
2
+ import { RadioGroupContext } from './chunk-5MBJWRZD.js';
3
+ import { RadioListContext } from './chunk-A7TZHALP.js';
4
+ import { RadioContext } from './chunk-FU5CCPLP.js';
5
+ import { ErrorMessageContext } from './chunk-ACVMW6YD.js';
6
+ import { HelperMessageContext } from './chunk-ESVVLTEN.js';
7
+ import { composeClassnameRenderProps } from './chunk-65JPI4FL.js';
8
+ import { cssModule } from './chunk-KVDXQMWI.js';
9
+ import { LabelContext } from './chunk-HVKOIMMW.js';
10
+ import { SlotProvider } from './chunk-M36KANKC.js';
11
+ import { useStyledSystem, useResponsiveValue } from '@hopper-ui/styled-system';
12
+ import { forwardRef } from 'react';
13
+ import { useContextProps, composeRenderProps, RadioGroup as RadioGroup$1 } from 'react-aria-components';
14
+ import { jsx } from 'react/jsx-runtime';
15
+
16
+ // css-module:./RadioGroup.module.css#css-module
17
+ var RadioGroup_module_default = { "hop-RadioGroup": "RadioGroup-module__hop-RadioGroup___tyigb", "hop-RadioGroup--bordered": "RadioGroup-module__hop-RadioGroup--bordered___qqRsL", "hop-RadioGroup--sm": "RadioGroup-module__hop-RadioGroup--sm___tPrLx", "hop-RadioGroup--md": "RadioGroup-module__hop-RadioGroup--md___ycjxA", "hop-RadioGroup__label": "RadioGroup-module__hop-RadioGroup__label___hknla", "hop-RadioGroup__list": "RadioGroup-module__hop-RadioGroup__list___NFcmy", "hop-RadioGroup__radio": "RadioGroup-module__hop-RadioGroup__radio___BXwx0", "hop-RadioGroup__error-message": "RadioGroup-module__hop-RadioGroup__error-message___YSs1D", "hop-RadioGroup__helper-message": "RadioGroup-module__hop-RadioGroup__helper-message___IS5V1" };
18
+ var GlobalRadioGroupCssSelector = "hop-RadioGroup";
19
+ function RadioGroup(props, ref) {
20
+ var _a, _b;
21
+ [props, ref] = useContextProps(props, ref, RadioGroupContext);
22
+ const { stylingProps, ...ownProps } = useStyledSystem(props);
23
+ const {
24
+ className,
25
+ children,
26
+ isDisabled,
27
+ isInvalid,
28
+ orientation: orientationProp = "vertical",
29
+ size: sizeProp = "md",
30
+ style: styleProp,
31
+ variant = "borderless",
32
+ ...otherProps
33
+ } = ownProps;
34
+ const orientation = (_a = useResponsiveValue(orientationProp)) != null ? _a : "vertical";
35
+ const size = (_b = useResponsiveValue(sizeProp)) != null ? _b : "md";
36
+ const classNames = composeClassnameRenderProps(
37
+ className,
38
+ GlobalRadioGroupCssSelector,
39
+ cssModule(
40
+ RadioGroup_module_default,
41
+ "hop-RadioGroup",
42
+ size,
43
+ variant
44
+ ),
45
+ stylingProps.className
46
+ );
47
+ const style = composeRenderProps(styleProp, (prev) => {
48
+ return {
49
+ ...stylingProps.style,
50
+ ...prev
51
+ };
52
+ });
53
+ return /* @__PURE__ */ jsx(
54
+ SlotProvider,
55
+ {
56
+ values: [
57
+ [LabelContext, {
58
+ className: RadioGroup_module_default["hop-RadioGroup__label"],
59
+ size
60
+ }],
61
+ [RadioContext, {
62
+ className: RadioGroup_module_default["hop-RadioGroup__radio"],
63
+ size
64
+ }],
65
+ [RadioFieldContext, {
66
+ className: RadioGroup_module_default["hop-RadioGroup__radio"],
67
+ size,
68
+ isDisabled
69
+ }],
70
+ [RadioListContext, {
71
+ className: RadioGroup_module_default["hop-RadioGroup__list"]
72
+ }],
73
+ [ErrorMessageContext, {
74
+ className: RadioGroup_module_default["hop-RadioGroup__error-message"],
75
+ hideIcon: true
76
+ }],
77
+ [HelperMessageContext, {
78
+ className: RadioGroup_module_default["hop-RadioGroup__helper-message"],
79
+ hideIcon: true
80
+ }]
81
+ ],
82
+ children: /* @__PURE__ */ jsx(
83
+ RadioGroup$1,
84
+ {
85
+ ref,
86
+ className: classNames,
87
+ style,
88
+ isInvalid,
89
+ isDisabled,
90
+ orientation,
91
+ ...otherProps,
92
+ children
93
+ }
94
+ )
95
+ }
96
+ );
97
+ }
98
+ var _RadioGroup = forwardRef(RadioGroup);
99
+ _RadioGroup.displayName = "RadioGroup";
100
+
101
+ export { GlobalRadioGroupCssSelector, _RadioGroup };
@@ -0,0 +1,35 @@
1
+ import { __commonJS, __toESM } from './chunk-YSQDPG26.js';
2
+ import { useLocalizedStringFormatter } from 'react-aria';
3
+
4
+ // src/i18n/intl/en-US.json
5
+ var require_en_US = __commonJS({
6
+ "src/i18n/intl/en-US.json"(exports, module) {
7
+ module.exports = {
8
+ "Button.spinnerAriaLabel": `Loading`,
9
+ "Input.charactersLeft": (args, formatter) => `${formatter.plural(args.charLeft, { "=0": `No characters left`, one: () => `${formatter.number(args.charLeft)} character left`, other: () => `${formatter.number(args.charLeft)} characters left` })}.`
10
+ };
11
+ }
12
+ });
13
+
14
+ // src/i18n/intl/fr-CA.json
15
+ var require_fr_CA = __commonJS({
16
+ "src/i18n/intl/fr-CA.json"(exports, module) {
17
+ module.exports = {
18
+ "Button.spinnerAriaLabel": `Chargement en cours`,
19
+ "Input.charactersLeft": (args, formatter) => `${formatter.plural(args.charLeft, { "=0": `Aucun caract\xE8re restant`, one: () => `${formatter.number(args.charLeft)} caract\xE8re restant`, other: () => `${formatter.number(args.charLeft)} caract\xE8res restants` })}.`
20
+ };
21
+ }
22
+ });
23
+
24
+ // src/i18n/src/useLocalizedString.tsx
25
+ var import_en_US = __toESM(require_en_US(), 1);
26
+ var import_fr_CA = __toESM(require_fr_CA(), 1);
27
+ var Resources = {
28
+ "en-US": import_en_US.default,
29
+ "fr-CA": import_fr_CA.default
30
+ };
31
+ function useLocalizedString() {
32
+ return useLocalizedStringFormatter(Resources, "@hopper-ui/components");
33
+ }
34
+
35
+ export { useLocalizedString };
@@ -0,0 +1,92 @@
1
+ import { RadioContext } from './chunk-FU5CCPLP.js';
2
+ import { isTextOnlyChildren } from './chunk-ZWU6DRRZ.js';
3
+ import { composeClassnameRenderProps } from './chunk-65JPI4FL.js';
4
+ import { _Text } from './chunk-HUJ3PTM7.js';
5
+ import { ClearContainerSlots } from './chunk-HXI3MEEK.js';
6
+ import { TextContext } from './chunk-OE5BLFZI.js';
7
+ import { cssModule } from './chunk-KVDXQMWI.js';
8
+ import { SlotProvider } from './chunk-M36KANKC.js';
9
+ import { IconListContext } from './chunk-DHVVYSLB.js';
10
+ import { BulletIcon, IconContext } from '@hopper-ui/icons';
11
+ import { useStyledSystem, useResponsiveValue } from '@hopper-ui/styled-system';
12
+ import { forwardRef } from 'react';
13
+ import { useContextProps, composeRenderProps, Radio as Radio$1 } from 'react-aria-components';
14
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
15
+
16
+ // css-module:./Radio.module.css#css-module
17
+ var Radio_module_default = { "hop-Radio": "Radio-module__hop-Radio___J9jax", "hop-Radio--sm": "Radio-module__hop-Radio--sm___XzxGj", "hop-Radio--md": "Radio-module__hop-Radio--md___ma6ni", "hop-Radio__icon": "Radio-module__hop-Radio__icon___67u4N", "hop-Radio__icon-list": "Radio-module__hop-Radio__icon-list___AEqkh", "hop-Radio__box": "Radio-module__hop-Radio__box___-lKCg", "hop-Radio__bullet": "Radio-module__hop-Radio__bullet___glY5a", "hop-Radio__text": "Radio-module__hop-Radio__text___P-AeI" };
18
+ var GlobalRadioCssSelector = "hop-Radio";
19
+ function Radio(props, ref) {
20
+ var _a;
21
+ [props, ref] = useContextProps(props, ref, RadioContext);
22
+ const { stylingProps, ...ownProps } = useStyledSystem(props);
23
+ const {
24
+ className,
25
+ children: childrenProp,
26
+ size: sizeProp = "md",
27
+ style: styleProp,
28
+ ...otherProps
29
+ } = ownProps;
30
+ const size = (_a = useResponsiveValue(sizeProp)) != null ? _a : "md";
31
+ const classNames = composeClassnameRenderProps(
32
+ className,
33
+ GlobalRadioCssSelector,
34
+ cssModule(
35
+ Radio_module_default,
36
+ "hop-Radio",
37
+ size
38
+ ),
39
+ stylingProps.className
40
+ );
41
+ const style = composeRenderProps(styleProp, (prev) => {
42
+ return {
43
+ ...stylingProps.style,
44
+ ...prev
45
+ };
46
+ });
47
+ const children = composeRenderProps(childrenProp, (prev) => {
48
+ if (prev && isTextOnlyChildren(prev)) {
49
+ return /* @__PURE__ */ jsx(_Text, { children: prev });
50
+ }
51
+ return prev;
52
+ });
53
+ return /* @__PURE__ */ jsx(
54
+ Radio$1,
55
+ {
56
+ ref,
57
+ className: classNames,
58
+ style,
59
+ ...otherProps,
60
+ children: (radioProps) => {
61
+ const radioIconClassName = Radio_module_default["hop-Radio__bullet"];
62
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
63
+ /* @__PURE__ */ jsx("div", { className: Radio_module_default["hop-Radio__box"], children: /* @__PURE__ */ jsx(BulletIcon, { size, className: radioIconClassName }) }),
64
+ /* @__PURE__ */ jsx(ClearContainerSlots, { children: /* @__PURE__ */ jsx(
65
+ SlotProvider,
66
+ {
67
+ values: [
68
+ [TextContext, {
69
+ className: Radio_module_default["hop-Radio__text"],
70
+ size
71
+ }],
72
+ [IconListContext, {
73
+ className: Radio_module_default["hop-Radio__icon-list"],
74
+ size
75
+ }],
76
+ [IconContext, {
77
+ className: Radio_module_default["hop-Radio__icon"],
78
+ size
79
+ }]
80
+ ],
81
+ children: children(radioProps)
82
+ }
83
+ ) })
84
+ ] });
85
+ }
86
+ }
87
+ );
88
+ }
89
+ var _Radio = forwardRef(Radio);
90
+ _Radio.displayName = "Radio";
91
+
92
+ export { GlobalRadioCssSelector, _Radio };
@@ -0,0 +1,57 @@
1
+ import { HelperMessageContext } from './chunk-ESVVLTEN.js';
2
+ import { _Text } from './chunk-HUJ3PTM7.js';
3
+ import { cssModule } from './chunk-KVDXQMWI.js';
4
+ import { InfoIcon } from '@hopper-ui/icons';
5
+ import { useStyledSystem } from '@hopper-ui/styled-system';
6
+ import clsx from 'clsx';
7
+ import { forwardRef, useContext } from 'react';
8
+ import { useContextProps, FieldErrorContext } from 'react-aria-components';
9
+ import { jsxs, jsx } from 'react/jsx-runtime';
10
+
11
+ // css-module:./HelperMessage.module.css#css-module
12
+ var HelperMessage_module_default = { "hop-HelperMessage": "HelperMessage-module__hop-HelperMessage___cUnyr", "hop-HelperMessage__icon": "HelperMessage-module__hop-HelperMessage__icon___6wjTh" };
13
+ var GlobalHelperMessageCssSelector = "hop-HelperMessage";
14
+ function HelperMessage(props, ref) {
15
+ const validation = useContext(FieldErrorContext);
16
+ if (validation == null ? void 0 : validation.isInvalid) {
17
+ return null;
18
+ }
19
+ return /* @__PURE__ */ jsx(HelperMessageInner, { ...props, ref });
20
+ }
21
+ var _HelperMessage = forwardRef(HelperMessage);
22
+ _HelperMessage.displayName = "HelperMessage";
23
+ var HelperMessageInner = forwardRef((props, ref) => {
24
+ [props, ref] = useContextProps(props, ref, HelperMessageContext);
25
+ const { stylingProps, ...ownProps } = useStyledSystem(props);
26
+ const { className, children, hideIcon = false, style, slot = "description", ...otherProps } = ownProps;
27
+ const classNames = clsx(
28
+ GlobalHelperMessageCssSelector,
29
+ cssModule(
30
+ HelperMessage_module_default,
31
+ "hop-HelperMessage"
32
+ ),
33
+ stylingProps.className,
34
+ className
35
+ );
36
+ const mergedStyles = {
37
+ ...stylingProps.style,
38
+ ...style
39
+ };
40
+ return /* @__PURE__ */ jsxs(
41
+ _Text,
42
+ {
43
+ ...otherProps,
44
+ ref,
45
+ className: classNames,
46
+ style: mergedStyles,
47
+ size: "xs",
48
+ slot,
49
+ children: [
50
+ !hideIcon && /* @__PURE__ */ jsx(InfoIcon, { size: "sm", className: HelperMessage_module_default["hop-HelperMessage__icon"] }),
51
+ children
52
+ ]
53
+ }
54
+ );
55
+ });
56
+
57
+ export { GlobalHelperMessageCssSelector, _HelperMessage };
@@ -0,0 +1,7 @@
1
+ import { createContext } from 'react';
2
+
3
+ // src/radio/src/RadioFieldContext.ts
4
+ var RadioFieldContext = createContext({});
5
+ RadioFieldContext.displayName = "RadioFieldContext";
6
+
7
+ export { RadioFieldContext };