@thunderid/react 1.3.3 → 1.4.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 (226) hide show
  1. package/dist/cjs/components/presentation/ChangeCredential/BaseChangeCredential.cjs +1 -1
  2. package/dist/cjs/components/presentation/auth/AcceptInvite/BaseAcceptInvite.cjs +1 -1
  3. package/dist/cjs/components/presentation/auth/AcceptInvite/BaseAcceptInvite.cjs.map +1 -1
  4. package/dist/cjs/components/presentation/auth/AuthOptionFactory.cjs +56 -17
  5. package/dist/cjs/components/presentation/auth/AuthOptionFactory.cjs.map +1 -1
  6. package/dist/cjs/components/presentation/auth/InviteUser/BaseInviteUser.cjs +21 -5
  7. package/dist/cjs/components/presentation/auth/InviteUser/BaseInviteUser.cjs.map +1 -1
  8. package/dist/cjs/components/presentation/auth/InviteUser/InviteUser.cjs +6 -0
  9. package/dist/cjs/components/presentation/auth/InviteUser/InviteUser.cjs.map +1 -1
  10. package/dist/cjs/components/presentation/auth/SignIn/BaseSignIn.cjs +1 -0
  11. package/dist/cjs/components/presentation/auth/SignIn/BaseSignIn.cjs.map +1 -1
  12. package/dist/cjs/components/presentation/auth/SignIn/SignIn.cjs +2 -3
  13. package/dist/cjs/components/presentation/auth/SignIn/SignIn.cjs.map +1 -1
  14. package/dist/cjs/components/presentation/auth/SignUp/BaseSignUp.cjs +1 -0
  15. package/dist/cjs/components/presentation/auth/SignUp/BaseSignUp.cjs.map +1 -1
  16. package/dist/cjs/components/primitives/AffixedField/AffixedField.cjs +11 -1
  17. package/dist/cjs/components/primitives/AffixedField/AffixedField.cjs.map +1 -1
  18. package/dist/cjs/components/primitives/AuthFlowSelect/AuthFlowSelect.cjs +21 -0
  19. package/dist/cjs/components/primitives/AuthFlowSelect/AuthFlowSelect.cjs.map +1 -0
  20. package/dist/cjs/components/primitives/AuthFlowSelect/BaseAuthFlowSelect.cjs +32 -0
  21. package/dist/cjs/components/primitives/AuthFlowSelect/BaseAuthFlowSelect.cjs.map +1 -0
  22. package/dist/cjs/components/primitives/Checkbox/Checkbox.cjs +11 -1
  23. package/dist/cjs/components/primitives/Checkbox/Checkbox.cjs.map +1 -1
  24. package/dist/cjs/components/primitives/CopyableText/CopyableText.cjs +41 -21
  25. package/dist/cjs/components/primitives/CopyableText/CopyableText.cjs.map +1 -1
  26. package/dist/cjs/components/primitives/CopyableText/CopyableText.styles.cjs +5 -2
  27. package/dist/cjs/components/primitives/CopyableText/CopyableText.styles.cjs.map +1 -1
  28. package/dist/cjs/components/primitives/DatePicker/DatePicker.cjs +11 -1
  29. package/dist/cjs/components/primitives/DatePicker/DatePicker.cjs.map +1 -1
  30. package/dist/cjs/components/primitives/FormControl/FormControl.cjs +2 -1
  31. package/dist/cjs/components/primitives/FormControl/FormControl.cjs.map +1 -1
  32. package/dist/cjs/components/primitives/Icons/Copy.cjs +33 -0
  33. package/dist/cjs/components/primitives/Icons/Copy.cjs.map +1 -0
  34. package/dist/cjs/components/primitives/MultiInput/MultiInput.cjs +11 -2
  35. package/dist/cjs/components/primitives/MultiInput/MultiInput.cjs.map +1 -1
  36. package/dist/cjs/components/primitives/OtpField/OtpField.cjs +9 -0
  37. package/dist/cjs/components/primitives/OtpField/OtpField.cjs.map +1 -1
  38. package/dist/cjs/components/primitives/PasswordField/PasswordField.cjs +2 -1
  39. package/dist/cjs/components/primitives/PasswordField/PasswordField.cjs.map +1 -1
  40. package/dist/cjs/components/primitives/Select/ResourceSelect.cjs +104 -0
  41. package/dist/cjs/components/primitives/Select/ResourceSelect.cjs.map +1 -0
  42. package/dist/cjs/components/primitives/Select/Select.cjs +80 -21
  43. package/dist/cjs/components/primitives/Select/Select.cjs.map +1 -1
  44. package/dist/cjs/components/primitives/Select/Select.styles.cjs +19 -3
  45. package/dist/cjs/components/primitives/Select/Select.styles.cjs.map +1 -1
  46. package/dist/cjs/components/primitives/Select/useSelectMessages.cjs +21 -0
  47. package/dist/cjs/components/primitives/Select/useSelectMessages.cjs.map +1 -0
  48. package/dist/cjs/components/primitives/TextField/TextField.cjs +30 -4
  49. package/dist/cjs/components/primitives/TextField/TextField.cjs.map +1 -1
  50. package/dist/cjs/components/primitives/TextField/TextField.styles.cjs +18 -5
  51. package/dist/cjs/components/primitives/TextField/TextField.styles.cjs.map +1 -1
  52. package/dist/cjs/components/primitives/Toggle/Toggle.cjs +10 -1
  53. package/dist/cjs/components/primitives/Toggle/Toggle.cjs.map +1 -1
  54. package/dist/cjs/components/primitives/UserSelect/BaseUserSelect.cjs +33 -0
  55. package/dist/cjs/components/primitives/UserSelect/BaseUserSelect.cjs.map +1 -0
  56. package/dist/cjs/components/primitives/UserSelect/UserSelect.cjs +21 -0
  57. package/dist/cjs/components/primitives/UserSelect/UserSelect.cjs.map +1 -0
  58. package/dist/cjs/components/primitives/UserTypeSelect/BaseUserTypeSelect.cjs +31 -0
  59. package/dist/cjs/components/primitives/UserTypeSelect/BaseUserTypeSelect.cjs.map +1 -0
  60. package/dist/cjs/components/primitives/UserTypeSelect/UserTypeSelect.cjs +21 -0
  61. package/dist/cjs/components/primitives/UserTypeSelect/UserTypeSelect.cjs.map +1 -0
  62. package/dist/cjs/contexts/Theme/ThemeProvider.cjs +1 -1
  63. package/dist/cjs/contexts/Theme/ThemeProvider.cjs.map +1 -1
  64. package/dist/cjs/contexts/ThunderID/ThunderIDContext.cjs.map +1 -1
  65. package/dist/cjs/contexts/ThunderID/ThunderIDProvider.cjs +1 -1
  66. package/dist/cjs/contexts/ThunderID/ThunderIDProvider.cjs.map +1 -1
  67. package/dist/cjs/hooks/useFetchAuthFlows.cjs +36 -0
  68. package/dist/cjs/hooks/useFetchAuthFlows.cjs.map +1 -0
  69. package/dist/cjs/hooks/useFetchUserTypes.cjs +34 -0
  70. package/dist/cjs/hooks/useFetchUserTypes.cjs.map +1 -0
  71. package/dist/cjs/hooks/useFetchUsers.cjs +35 -0
  72. package/dist/cjs/hooks/useFetchUsers.cjs.map +1 -0
  73. package/dist/cjs/hooks/useInfiniteOptions.cjs +129 -0
  74. package/dist/cjs/hooks/useInfiniteOptions.cjs.map +1 -0
  75. package/dist/cjs/hooks/useManagementEndpoint.cjs.map +1 -1
  76. package/dist/cjs/index.cjs +56 -0
  77. package/dist/cjs/utils/createAuthenticatedFetcher.cjs +1 -0
  78. package/dist/cjs/utils/createAuthenticatedFetcher.cjs.map +1 -1
  79. package/dist/components/presentation/ChangeCredential/BaseChangeCredential.js +1 -1
  80. package/dist/components/presentation/auth/AcceptInvite/BaseAcceptInvite.d.ts.map +1 -1
  81. package/dist/components/presentation/auth/AcceptInvite/BaseAcceptInvite.js +1 -1
  82. package/dist/components/presentation/auth/AcceptInvite/BaseAcceptInvite.js.map +1 -1
  83. package/dist/components/presentation/auth/AuthOptionFactory.d.ts +9 -1
  84. package/dist/components/presentation/auth/AuthOptionFactory.d.ts.map +1 -1
  85. package/dist/components/presentation/auth/AuthOptionFactory.js +56 -17
  86. package/dist/components/presentation/auth/AuthOptionFactory.js.map +1 -1
  87. package/dist/components/presentation/auth/InviteUser/BaseInviteUser.d.ts +18 -2
  88. package/dist/components/presentation/auth/InviteUser/BaseInviteUser.d.ts.map +1 -1
  89. package/dist/components/presentation/auth/InviteUser/BaseInviteUser.js +22 -6
  90. package/dist/components/presentation/auth/InviteUser/BaseInviteUser.js.map +1 -1
  91. package/dist/components/presentation/auth/InviteUser/InviteUser.d.ts +2 -1
  92. package/dist/components/presentation/auth/InviteUser/InviteUser.d.ts.map +1 -1
  93. package/dist/components/presentation/auth/InviteUser/InviteUser.js +6 -0
  94. package/dist/components/presentation/auth/InviteUser/InviteUser.js.map +1 -1
  95. package/dist/components/presentation/auth/SignIn/BaseSignIn.d.ts +4 -0
  96. package/dist/components/presentation/auth/SignIn/BaseSignIn.d.ts.map +1 -1
  97. package/dist/components/presentation/auth/SignIn/BaseSignIn.js +1 -0
  98. package/dist/components/presentation/auth/SignIn/BaseSignIn.js.map +1 -1
  99. package/dist/components/presentation/auth/SignIn/SignIn.d.ts.map +1 -1
  100. package/dist/components/presentation/auth/SignIn/SignIn.js +2 -3
  101. package/dist/components/presentation/auth/SignIn/SignIn.js.map +1 -1
  102. package/dist/components/presentation/auth/SignUp/BaseSignUp.d.ts +4 -0
  103. package/dist/components/presentation/auth/SignUp/BaseSignUp.d.ts.map +1 -1
  104. package/dist/components/presentation/auth/SignUp/BaseSignUp.js +1 -0
  105. package/dist/components/presentation/auth/SignUp/BaseSignUp.js.map +1 -1
  106. package/dist/components/primitives/AffixedField/AffixedField.d.ts.map +1 -1
  107. package/dist/components/primitives/AffixedField/AffixedField.js +11 -1
  108. package/dist/components/primitives/AffixedField/AffixedField.js.map +1 -1
  109. package/dist/components/primitives/AuthFlowSelect/AuthFlowSelect.d.ts +11 -0
  110. package/dist/components/primitives/AuthFlowSelect/AuthFlowSelect.d.ts.map +1 -0
  111. package/dist/components/primitives/AuthFlowSelect/AuthFlowSelect.js +19 -0
  112. package/dist/components/primitives/AuthFlowSelect/AuthFlowSelect.js.map +1 -0
  113. package/dist/components/primitives/AuthFlowSelect/BaseAuthFlowSelect.d.ts +14 -0
  114. package/dist/components/primitives/AuthFlowSelect/BaseAuthFlowSelect.d.ts.map +1 -0
  115. package/dist/components/primitives/AuthFlowSelect/BaseAuthFlowSelect.js +29 -0
  116. package/dist/components/primitives/AuthFlowSelect/BaseAuthFlowSelect.js.map +1 -0
  117. package/dist/components/primitives/Checkbox/Checkbox.d.ts.map +1 -1
  118. package/dist/components/primitives/Checkbox/Checkbox.js +10 -1
  119. package/dist/components/primitives/Checkbox/Checkbox.js.map +1 -1
  120. package/dist/components/primitives/CopyableText/CopyableText.d.ts +9 -0
  121. package/dist/components/primitives/CopyableText/CopyableText.d.ts.map +1 -1
  122. package/dist/components/primitives/CopyableText/CopyableText.js +40 -21
  123. package/dist/components/primitives/CopyableText/CopyableText.js.map +1 -1
  124. package/dist/components/primitives/CopyableText/CopyableText.styles.d.ts.map +1 -1
  125. package/dist/components/primitives/CopyableText/CopyableText.styles.js +5 -2
  126. package/dist/components/primitives/CopyableText/CopyableText.styles.js.map +1 -1
  127. package/dist/components/primitives/DatePicker/DatePicker.d.ts.map +1 -1
  128. package/dist/components/primitives/DatePicker/DatePicker.js +10 -1
  129. package/dist/components/primitives/DatePicker/DatePicker.js.map +1 -1
  130. package/dist/components/primitives/FormControl/FormControl.d.ts +4 -0
  131. package/dist/components/primitives/FormControl/FormControl.d.ts.map +1 -1
  132. package/dist/components/primitives/FormControl/FormControl.js +2 -1
  133. package/dist/components/primitives/FormControl/FormControl.js.map +1 -1
  134. package/dist/components/primitives/Icons/Copy.d.ts +7 -0
  135. package/dist/components/primitives/Icons/Copy.d.ts.map +1 -0
  136. package/dist/components/primitives/Icons/Copy.js +31 -0
  137. package/dist/components/primitives/Icons/Copy.js.map +1 -0
  138. package/dist/components/primitives/MultiInput/MultiInput.d.ts.map +1 -1
  139. package/dist/components/primitives/MultiInput/MultiInput.js +12 -3
  140. package/dist/components/primitives/MultiInput/MultiInput.js.map +1 -1
  141. package/dist/components/primitives/OtpField/OtpField.d.ts.map +1 -1
  142. package/dist/components/primitives/OtpField/OtpField.js +10 -1
  143. package/dist/components/primitives/OtpField/OtpField.js.map +1 -1
  144. package/dist/components/primitives/PasswordField/PasswordField.d.ts +9 -1
  145. package/dist/components/primitives/PasswordField/PasswordField.d.ts.map +1 -1
  146. package/dist/components/primitives/PasswordField/PasswordField.js +2 -1
  147. package/dist/components/primitives/PasswordField/PasswordField.js.map +1 -1
  148. package/dist/components/primitives/Select/ResourceSelect.d.ts +36 -0
  149. package/dist/components/primitives/Select/ResourceSelect.d.ts.map +1 -0
  150. package/dist/components/primitives/Select/ResourceSelect.js +100 -0
  151. package/dist/components/primitives/Select/ResourceSelect.js.map +1 -0
  152. package/dist/components/primitives/Select/Select.d.ts +22 -13
  153. package/dist/components/primitives/Select/Select.d.ts.map +1 -1
  154. package/dist/components/primitives/Select/Select.js +80 -22
  155. package/dist/components/primitives/Select/Select.js.map +1 -1
  156. package/dist/components/primitives/Select/Select.styles.d.ts.map +1 -1
  157. package/dist/components/primitives/Select/Select.styles.js +19 -3
  158. package/dist/components/primitives/Select/Select.styles.js.map +1 -1
  159. package/dist/components/primitives/Select/__tests__/selectTestUtils.d.ts +6 -0
  160. package/dist/components/primitives/Select/__tests__/selectTestUtils.d.ts.map +1 -0
  161. package/dist/components/primitives/Select/useSelectMessages.d.ts +9 -0
  162. package/dist/components/primitives/Select/useSelectMessages.d.ts.map +1 -0
  163. package/dist/components/primitives/Select/useSelectMessages.js +18 -0
  164. package/dist/components/primitives/Select/useSelectMessages.js.map +1 -0
  165. package/dist/components/primitives/TextField/TextField.d.ts +8 -0
  166. package/dist/components/primitives/TextField/TextField.d.ts.map +1 -1
  167. package/dist/components/primitives/TextField/TextField.js +29 -4
  168. package/dist/components/primitives/TextField/TextField.js.map +1 -1
  169. package/dist/components/primitives/TextField/TextField.styles.d.ts +2 -1
  170. package/dist/components/primitives/TextField/TextField.styles.d.ts.map +1 -1
  171. package/dist/components/primitives/TextField/TextField.styles.js +18 -5
  172. package/dist/components/primitives/TextField/TextField.styles.js.map +1 -1
  173. package/dist/components/primitives/Toggle/Toggle.d.ts.map +1 -1
  174. package/dist/components/primitives/Toggle/Toggle.js +9 -1
  175. package/dist/components/primitives/Toggle/Toggle.js.map +1 -1
  176. package/dist/components/primitives/UserSelect/BaseUserSelect.d.ts +15 -0
  177. package/dist/components/primitives/UserSelect/BaseUserSelect.d.ts.map +1 -0
  178. package/dist/components/primitives/UserSelect/BaseUserSelect.js +30 -0
  179. package/dist/components/primitives/UserSelect/BaseUserSelect.js.map +1 -0
  180. package/dist/components/primitives/UserSelect/UserSelect.d.ts +11 -0
  181. package/dist/components/primitives/UserSelect/UserSelect.d.ts.map +1 -0
  182. package/dist/components/primitives/UserSelect/UserSelect.js +19 -0
  183. package/dist/components/primitives/UserSelect/UserSelect.js.map +1 -0
  184. package/dist/components/primitives/UserTypeSelect/BaseUserTypeSelect.d.ts +14 -0
  185. package/dist/components/primitives/UserTypeSelect/BaseUserTypeSelect.d.ts.map +1 -0
  186. package/dist/components/primitives/UserTypeSelect/BaseUserTypeSelect.js +28 -0
  187. package/dist/components/primitives/UserTypeSelect/BaseUserTypeSelect.js.map +1 -0
  188. package/dist/components/primitives/UserTypeSelect/UserTypeSelect.d.ts +11 -0
  189. package/dist/components/primitives/UserTypeSelect/UserTypeSelect.d.ts.map +1 -0
  190. package/dist/components/primitives/UserTypeSelect/UserTypeSelect.js +19 -0
  191. package/dist/components/primitives/UserTypeSelect/UserTypeSelect.js.map +1 -0
  192. package/dist/contexts/Theme/ThemeProvider.d.ts.map +1 -1
  193. package/dist/contexts/Theme/ThemeProvider.js +1 -1
  194. package/dist/contexts/Theme/ThemeProvider.js.map +1 -1
  195. package/dist/contexts/ThunderID/ThunderIDContext.d.ts +4 -3
  196. package/dist/contexts/ThunderID/ThunderIDContext.d.ts.map +1 -1
  197. package/dist/contexts/ThunderID/ThunderIDContext.js.map +1 -1
  198. package/dist/contexts/ThunderID/ThunderIDProvider.d.ts.map +1 -1
  199. package/dist/contexts/ThunderID/ThunderIDProvider.js +1 -1
  200. package/dist/contexts/ThunderID/ThunderIDProvider.js.map +1 -1
  201. package/dist/hooks/useFetchAuthFlows.d.ts +9 -0
  202. package/dist/hooks/useFetchAuthFlows.d.ts.map +1 -0
  203. package/dist/hooks/useFetchAuthFlows.js +33 -0
  204. package/dist/hooks/useFetchAuthFlows.js.map +1 -0
  205. package/dist/hooks/useFetchUserTypes.d.ts +8 -0
  206. package/dist/hooks/useFetchUserTypes.d.ts.map +1 -0
  207. package/dist/hooks/useFetchUserTypes.js +31 -0
  208. package/dist/hooks/useFetchUserTypes.js.map +1 -0
  209. package/dist/hooks/useFetchUsers.d.ts +8 -0
  210. package/dist/hooks/useFetchUsers.d.ts.map +1 -0
  211. package/dist/hooks/useFetchUsers.js +32 -0
  212. package/dist/hooks/useFetchUsers.js.map +1 -0
  213. package/dist/hooks/useInfiniteOptions.d.ts +31 -0
  214. package/dist/hooks/useInfiniteOptions.d.ts.map +1 -0
  215. package/dist/hooks/useInfiniteOptions.js +126 -0
  216. package/dist/hooks/useInfiniteOptions.js.map +1 -0
  217. package/dist/hooks/useManagementEndpoint.d.ts +1 -1
  218. package/dist/hooks/useManagementEndpoint.d.ts.map +1 -1
  219. package/dist/hooks/useManagementEndpoint.js.map +1 -1
  220. package/dist/index.d.ts +18 -1
  221. package/dist/index.d.ts.map +1 -1
  222. package/dist/index.js +12 -2
  223. package/dist/utils/createAuthenticatedFetcher.d.ts.map +1 -1
  224. package/dist/utils/createAuthenticatedFetcher.js +1 -0
  225. package/dist/utils/createAuthenticatedFetcher.js.map +1 -1
  226. package/package.json +4 -4
@@ -4,42 +4,101 @@ const require_useTheme = require('../../../contexts/Theme/useTheme.cjs');
4
4
  const require_FormControl = require('../FormControl/FormControl.cjs');
5
5
  const require_InputLabel = require('../InputLabel/InputLabel.cjs');
6
6
  const require_Select_styles = require('./Select.styles.cjs');
7
+ const require_useSelectMessages = require('./useSelectMessages.cjs');
7
8
  let __thunderid_browser = require("@thunderid/browser");
8
9
  __thunderid_browser = require_rolldown_runtime.__toESM(__thunderid_browser);
10
+ let react = require("react");
11
+ react = require_rolldown_runtime.__toESM(react);
9
12
  let react_jsx_runtime = require("react/jsx-runtime");
10
13
  react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
11
14
 
12
15
  //#region src/components/primitives/Select/Select.tsx
13
- const Select = ({ label, error, className, required, disabled, helperText, placeholder, options, style = {},...rest }) => {
16
+ const Select = ({ label, error, className, required, disabled, helperText, placeholder, options = void 0, emptyText = void 0, loading = false, onLoadMore = void 0, onChange = void 0, selectedOption = void 0, style = {},...rest }) => {
14
17
  const { theme, colorScheme } = require_useTheme.default();
18
+ const messages = require_useSelectMessages.default();
15
19
  const hasError = !!error;
20
+ const generatedId = (0, react.useId)();
21
+ const inputId = rest.id ?? generatedId;
22
+ const helperTextId = error || helperText ? `${inputId}-helper-text` : void 0;
23
+ const describedBy = [rest["aria-describedby"], helperTextId].filter(Boolean).join(" ") || void 0;
16
24
  const styles = require_Select_styles.default(theme, colorScheme, disabled ?? false, hasError);
25
+ const items = (0, react.useMemo)(() => (0, __thunderid_browser.normalizeSelectOptions)(options), [options]);
26
+ const selectRef = (0, react.useRef)(null);
27
+ const chosenValueRef = (0, react.useRef)("");
28
+ (0, react.useEffect)(() => {
29
+ const current = selectRef.current?.value;
30
+ if (current !== void 0 && current !== __thunderid_browser.SelectConstants.LOAD_MORE_OPTION_VALUE) chosenValueRef.current = current;
31
+ });
32
+ const handleChange = (event) => {
33
+ if (event.target.value !== __thunderid_browser.SelectConstants.LOAD_MORE_OPTION_VALUE) {
34
+ chosenValueRef.current = event.target.value;
35
+ onChange?.(event);
36
+ return;
37
+ }
38
+ event.target.value = chosenValueRef.current;
39
+ onLoadMore?.();
40
+ };
17
41
  const selectClassName = require_emotion.cx((0, __thunderid_browser.withVendorCSSClassPrefix)((0, __thunderid_browser.bem)("select", "input")), styles["select"], hasError && styles["selectError"], disabled && styles["selectDisabled"]);
42
+ const showsSelectedOption = selectedOption !== void 0 && rest.value !== void 0 && String(rest.value) === selectedOption.value && !items.some((item) => item.value === selectedOption.value);
43
+ let statusText;
44
+ if (loading) statusText = items.length === 0 ? messages.loading : messages.loadingMore;
45
+ else if (items.length === 0 && !onLoadMore) statusText = emptyText;
46
+ const hasStatus = onLoadMore !== void 0 || emptyText !== void 0 || loading;
47
+ const showsLoadMore = onLoadMore !== void 0 && (items.length > 0 || !loading);
18
48
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_FormControl.default, {
19
49
  error,
20
50
  helperText,
51
+ helperTextId,
21
52
  className: require_emotion.cx((0, __thunderid_browser.withVendorCSSClassPrefix)((0, __thunderid_browser.bem)("select")), className),
22
53
  style,
23
- children: [label && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_InputLabel.default, {
24
- required,
25
- error: hasError,
26
- children: label
27
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
28
- className: selectClassName,
29
- disabled,
30
- "aria-invalid": hasError,
31
- "aria-required": required,
32
- ...rest,
33
- children: [placeholder && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
34
- value: "",
35
- disabled: true,
36
- children: placeholder
37
- }), options.map((option) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
38
- value: option.value,
39
- className: styles["option"],
40
- children: option.label
41
- }, option.value))]
42
- })]
54
+ children: [
55
+ label && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_InputLabel.default, {
56
+ htmlFor: inputId,
57
+ required,
58
+ error: hasError,
59
+ children: label
60
+ }),
61
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
62
+ className: selectClassName,
63
+ disabled,
64
+ "aria-invalid": hasError,
65
+ "aria-required": required,
66
+ "aria-busy": loading || void 0,
67
+ ...rest,
68
+ id: inputId,
69
+ "aria-describedby": describedBy,
70
+ ref: selectRef,
71
+ onChange: onLoadMore ? handleChange : onChange,
72
+ children: [
73
+ placeholder && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
74
+ value: "",
75
+ disabled: Boolean(required),
76
+ children: placeholder
77
+ }),
78
+ showsSelectedOption && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
79
+ value: selectedOption?.value,
80
+ children: selectedOption?.label
81
+ }),
82
+ items.map((option) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
83
+ value: option.value,
84
+ disabled: option.disabled,
85
+ className: styles["option"],
86
+ children: option.label
87
+ }, option.value)),
88
+ showsLoadMore && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
89
+ value: __thunderid_browser.SelectConstants.LOAD_MORE_OPTION_VALUE,
90
+ disabled: loading,
91
+ className: require_emotion.cx((0, __thunderid_browser.withVendorCSSClassPrefix)((0, __thunderid_browser.bem)("select", "load-more")), styles["option"], styles["loadMore"]),
92
+ children: loading ? messages.loadingMore : messages.loadMore
93
+ })
94
+ ]
95
+ }),
96
+ hasStatus && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
97
+ role: "status",
98
+ className: styles["status"],
99
+ children: statusText
100
+ })
101
+ ]
43
102
  });
44
103
  };
45
104
  var Select_default = Select;
@@ -1 +1 @@
1
- {"version":3,"file":"Select.cjs","names":["Select: FC<SelectProps>","useTheme","styles: Record<string, string>","useStyles","selectClassName: string","cx","FormControl","InputLabel"],"sources":["../../../../../src/components/primitives/Select/Select.tsx"],"sourcesContent":["// Copyright 2024 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {withVendorCSSClassPrefix, bem} from '@thunderid/browser';\nimport {FC, SelectHTMLAttributes} from 'react';\nimport useStyles from './Select.styles';\nimport useTheme from '../../../contexts/Theme/useTheme';\nimport {cx} from '../../../styles/emotion';\nimport FormControl from '../FormControl/FormControl';\nimport InputLabel from '../InputLabel/InputLabel';\n\nexport interface SelectOption {\n /**\n * The text that will be displayed in the select\n */\n label: string;\n /**\n * The value that will be submitted with the form\n */\n value: string;\n}\n\nexport interface SelectProps extends Omit<SelectHTMLAttributes<HTMLSelectElement>, 'className'> {\n /**\n * Additional CSS class names\n */\n className?: string;\n /**\n * Whether the field is disabled\n */\n disabled?: boolean;\n /**\n * Error message to display below the select\n */\n error?: string;\n /**\n * Helper text to display below the select\n */\n helperText?: string;\n /**\n * Label text to display above the select\n */\n label?: string;\n /**\n * The options to display in the select\n */\n options: SelectOption[];\n /**\n * Placeholder text for the default/empty option\n */\n placeholder?: string;\n /**\n * Whether the field is required\n */\n required?: boolean;\n}\n\nconst Select: FC<SelectProps> = ({\n label,\n error,\n className,\n required,\n disabled,\n helperText,\n placeholder,\n options,\n style = {},\n ...rest\n}: SelectProps) => {\n const {theme, colorScheme}: ReturnType<typeof useTheme> = useTheme();\n const hasError = !!error;\n const styles: Record<string, string> = useStyles(theme, colorScheme, disabled ?? false, hasError);\n\n const selectClassName: string = cx(\n withVendorCSSClassPrefix(bem('select', 'input')),\n styles['select'],\n hasError && styles['selectError'],\n disabled && styles['selectDisabled'],\n );\n\n return (\n <FormControl\n error={error}\n helperText={helperText}\n className={cx(withVendorCSSClassPrefix(bem('select')), className)}\n style={style}\n >\n {label && (\n <InputLabel required={required} error={hasError}>\n {label}\n </InputLabel>\n )}\n <select\n className={selectClassName}\n disabled={disabled}\n aria-invalid={hasError}\n aria-required={required}\n {...rest}\n >\n {placeholder && (\n <option value=\"\" disabled>\n {placeholder}\n </option>\n )}\n {options.map((option: SelectOption) => (\n <option key={option.value} value={option.value} className={styles['option']}>\n {option.label}\n </option>\n ))}\n </select>\n </FormControl>\n );\n};\n\nexport default Select;\n"],"mappings":";;;;;;;;;;;;AAyDA,MAAMA,UAA2B,EAC/B,OACA,OACA,WACA,UACA,UACA,YACA,aACA,SACA,QAAQ,EAAE,CACV,GAAG,WACc;CACjB,MAAM,EAAC,OAAO,gBAA4CC,0BAAU;CACpE,MAAM,WAAW,CAAC,CAAC;CACnB,MAAMC,SAAiCC,8BAAU,OAAO,aAAa,YAAY,OAAO,SAAS;CAEjG,MAAMC,kBAA0BC,kGACD,UAAU,QAAQ,CAAC,EAChD,OAAO,WACP,YAAY,OAAO,gBACnB,YAAY,OAAO,kBACpB;AAED,QACE,4CAACC;EACQ;EACK;EACZ,WAAWD,kGAAgC,SAAS,CAAC,EAAE,UAAU;EAC1D;aAEN,SACC,2CAACE;GAAqB;GAAU,OAAO;aACpC;IACU,EAEf,4CAAC;GACC,WAAW;GACD;GACV,gBAAc;GACd,iBAAe;GACf,GAAI;cAEH,eACC,2CAAC;IAAO,OAAM;IAAG;cACd;KACM,EAEV,QAAQ,KAAK,WACZ,2CAAC;IAA0B,OAAO,OAAO;IAAO,WAAW,OAAO;cAC/D,OAAO;MADG,OAAO,MAEX,CACT;IACK;GACG;;AAIlB,qBAAe"}
1
+ {"version":3,"file":"Select.cjs","names":["Select: FC<SelectProps>","useTheme","messages: SelectMessages","useSelectMessages","generatedId: string","inputId: string","helperTextId: string | undefined","describedBy: string | undefined","styles: Record<string, string>","useStyles","items: SelectOption[]","selectRef: RefObject<HTMLSelectElement | null>","chosenValueRef: RefObject<string>","current: string | undefined","SelectConstants","selectClassName: string","cx","showsSelectedOption: boolean","statusText: string | undefined","hasStatus: boolean","showsLoadMore: boolean","FormControl","InputLabel"],"sources":["../../../../../src/components/primitives/Select/Select.tsx"],"sourcesContent":["// Copyright 2024 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {bem, normalizeSelectOptions, SelectConstants, withVendorCSSClassPrefix} from '@thunderid/browser';\nimport type {SelectOption, SelectOptionInput} from '@thunderid/browser';\nimport {ChangeEvent, FC, RefObject, SelectHTMLAttributes, useEffect, useId, useMemo, useRef} from 'react';\nimport useStyles from './Select.styles';\nimport useSelectMessages, {SelectMessages} from './useSelectMessages';\nimport useTheme from '../../../contexts/Theme/useTheme';\nimport {cx} from '../../../styles/emotion';\nimport FormControl from '../FormControl/FormControl';\nimport InputLabel from '../InputLabel/InputLabel';\n\nexport type {SelectOption, SelectOptionInput};\n\nexport interface SelectProps extends Omit<SelectHTMLAttributes<HTMLSelectElement>, 'className'> {\n /**\n * Additional CSS class names\n */\n className?: string;\n /**\n * Whether the field is disabled\n */\n disabled?: boolean;\n /**\n * Text shown below the select when it has no options, nothing is loading and there is nothing more to load\n */\n emptyText?: string;\n /**\n * Error message to display below the select\n */\n error?: string;\n /**\n * Helper text to display below the select\n */\n helperText?: string;\n /**\n * Label text to display above the select\n */\n label?: string;\n /**\n * Whether options are being fetched. The load more option waits, and a select with no options shows a loading message\n */\n loading?: boolean;\n /**\n * Called when the load more option, listed after the last one, is chosen. Choosing it does not change the selection.\n * The option is listed only when this is set, so pass it only while more options may be available\n */\n onLoadMore?: () => void;\n /**\n * The options to display: strings, numbers, or `{label, value, disabled?}` objects\n */\n options?: readonly (SelectOptionInput | null | undefined)[] | null;\n /**\n * Placeholder text for the default/empty option. While the field is not required, choosing it clears the selection\n */\n placeholder?: string;\n /**\n * Whether the field is required\n */\n required?: boolean;\n /**\n * Label of the selected option while `value` is not among `options`, such as a value loaded from saved data\n */\n selectedOption?: SelectOption;\n}\n\nconst Select: FC<SelectProps> = ({\n label,\n error,\n className,\n required,\n disabled,\n helperText,\n placeholder,\n options = undefined,\n emptyText = undefined,\n loading = false,\n onLoadMore = undefined,\n onChange = undefined,\n selectedOption = undefined,\n style = {},\n ...rest\n}: SelectProps) => {\n const {theme, colorScheme}: ReturnType<typeof useTheme> = useTheme();\n const messages: SelectMessages = useSelectMessages();\n const hasError = !!error;\n const generatedId: string = useId();\n const inputId: string = rest.id ?? generatedId;\n const helperTextId: string | undefined = error || helperText ? `${inputId}-helper-text` : undefined;\n const describedBy: string | undefined =\n [rest['aria-describedby'], helperTextId].filter(Boolean).join(' ') || undefined;\n const styles: Record<string, string> = useStyles(theme, colorScheme, disabled ?? false, hasError);\n const items: SelectOption[] = useMemo(() => normalizeSelectOptions(options), [options]);\n const selectRef: RefObject<HTMLSelectElement | null> = useRef<HTMLSelectElement>(null);\n const chosenValueRef: RefObject<string> = useRef<string>('');\n\n // The value to put back when the load more option is chosen, since choosing it is not a selection.\n useEffect(() => {\n const current: string | undefined = selectRef.current?.value;\n\n if (current !== undefined && current !== SelectConstants.LOAD_MORE_OPTION_VALUE) {\n chosenValueRef.current = current;\n }\n });\n\n const handleChange = (event: ChangeEvent<HTMLSelectElement>): void => {\n if (event.target.value !== SelectConstants.LOAD_MORE_OPTION_VALUE) {\n chosenValueRef.current = event.target.value;\n onChange?.(event);\n\n return;\n }\n\n event.target.value = chosenValueRef.current;\n onLoadMore?.();\n };\n\n const selectClassName: string = cx(\n withVendorCSSClassPrefix(bem('select', 'input')),\n styles['select'],\n hasError && styles['selectError'],\n disabled && styles['selectDisabled'],\n );\n\n const showsSelectedOption: boolean =\n selectedOption !== undefined &&\n rest.value !== undefined &&\n String(rest.value) === selectedOption.value &&\n !items.some((item: SelectOption) => item.value === selectedOption.value);\n\n let statusText: string | undefined;\n\n if (loading) {\n statusText = items.length === 0 ? messages.loading : messages.loadingMore;\n } else if (items.length === 0 && !onLoadMore) {\n statusText = emptyText;\n }\n\n const hasStatus: boolean = onLoadMore !== undefined || emptyText !== undefined || loading;\n const showsLoadMore: boolean = onLoadMore !== undefined && (items.length > 0 || !loading);\n\n return (\n <FormControl\n error={error}\n helperText={helperText}\n helperTextId={helperTextId}\n className={cx(withVendorCSSClassPrefix(bem('select')), className)}\n style={style}\n >\n {label && (\n <InputLabel htmlFor={inputId} required={required} error={hasError}>\n {label}\n </InputLabel>\n )}\n <select\n className={selectClassName}\n disabled={disabled}\n aria-invalid={hasError}\n aria-required={required}\n aria-busy={loading || undefined}\n {...rest}\n id={inputId}\n aria-describedby={describedBy}\n ref={selectRef}\n onChange={onLoadMore ? handleChange : onChange}\n >\n {placeholder && (\n <option value=\"\" disabled={Boolean(required)}>\n {placeholder}\n </option>\n )}\n {showsSelectedOption && <option value={selectedOption?.value}>{selectedOption?.label}</option>}\n {items.map((option: SelectOption) => (\n <option key={option.value} value={option.value} disabled={option.disabled} className={styles['option']}>\n {option.label}\n </option>\n ))}\n {showsLoadMore && (\n <option\n value={SelectConstants.LOAD_MORE_OPTION_VALUE}\n disabled={loading}\n className={cx(withVendorCSSClassPrefix(bem('select', 'load-more')), styles['option'], styles['loadMore'])}\n >\n {loading ? messages.loadingMore : messages.loadMore}\n </option>\n )}\n </select>\n {hasStatus && (\n <span role=\"status\" className={styles['status']}>\n {statusText}\n </span>\n )}\n </FormControl>\n );\n};\n\nexport default Select;\n"],"mappings":";;;;;;;;;;;;;;;AAmEA,MAAMA,UAA2B,EAC/B,OACA,OACA,WACA,UACA,UACA,YACA,aACA,UAAU,QACV,YAAY,QACZ,UAAU,OACV,aAAa,QACb,WAAW,QACX,iBAAiB,QACjB,QAAQ,EAAE,CACV,GAAG,WACc;CACjB,MAAM,EAAC,OAAO,gBAA4CC,0BAAU;CACpE,MAAMC,WAA2BC,mCAAmB;CACpD,MAAM,WAAW,CAAC,CAAC;CACnB,MAAMC,gCAA6B;CACnC,MAAMC,UAAkB,KAAK,MAAM;CACnC,MAAMC,eAAmC,SAAS,aAAa,GAAG,QAAQ,gBAAgB;CAC1F,MAAMC,cACJ,CAAC,KAAK,qBAAqB,aAAa,CAAC,OAAO,QAAQ,CAAC,KAAK,IAAI,IAAI;CACxE,MAAMC,SAAiCC,8BAAU,OAAO,aAAa,YAAY,OAAO,SAAS;CACjG,MAAMC,iFAA6D,QAAQ,EAAE,CAAC,QAAQ,CAAC;CACvF,MAAMC,8BAA2E,KAAK;CACtF,MAAMC,mCAAmD,GAAG;AAG5D,4BAAgB;EACd,MAAMC,UAA8B,UAAU,SAAS;AAEvD,MAAI,YAAY,UAAa,YAAYC,oCAAgB,uBACvD,gBAAe,UAAU;GAE3B;CAEF,MAAM,gBAAgB,UAAgD;AACpE,MAAI,MAAM,OAAO,UAAUA,oCAAgB,wBAAwB;AACjE,kBAAe,UAAU,MAAM,OAAO;AACtC,cAAW,MAAM;AAEjB;;AAGF,QAAM,OAAO,QAAQ,eAAe;AACpC,gBAAc;;CAGhB,MAAMC,kBAA0BC,kGACD,UAAU,QAAQ,CAAC,EAChD,OAAO,WACP,YAAY,OAAO,gBACnB,YAAY,OAAO,kBACpB;CAED,MAAMC,sBACJ,mBAAmB,UACnB,KAAK,UAAU,UACf,OAAO,KAAK,MAAM,KAAK,eAAe,SACtC,CAAC,MAAM,MAAM,SAAuB,KAAK,UAAU,eAAe,MAAM;CAE1E,IAAIC;AAEJ,KAAI,QACF,cAAa,MAAM,WAAW,IAAI,SAAS,UAAU,SAAS;UACrD,MAAM,WAAW,KAAK,CAAC,WAChC,cAAa;CAGf,MAAMC,YAAqB,eAAe,UAAa,cAAc,UAAa;CAClF,MAAMC,gBAAyB,eAAe,WAAc,MAAM,SAAS,KAAK,CAAC;AAEjF,QACE,4CAACC;EACQ;EACK;EACE;EACd,WAAWL,kGAAgC,SAAS,CAAC,EAAE,UAAU;EAC1D;;GAEN,SACC,2CAACM;IAAW,SAAS;IAAmB;IAAU,OAAO;cACtD;KACU;GAEf,4CAAC;IACC,WAAW;IACD;IACV,gBAAc;IACd,iBAAe;IACf,aAAW,WAAW;IACtB,GAAI;IACJ,IAAI;IACJ,oBAAkB;IAClB,KAAK;IACL,UAAU,aAAa,eAAe;;KAErC,eACC,2CAAC;MAAO,OAAM;MAAG,UAAU,QAAQ,SAAS;gBACzC;OACM;KAEV,uBAAuB,2CAAC;MAAO,OAAO,gBAAgB;gBAAQ,gBAAgB;OAAe;KAC7F,MAAM,KAAK,WACV,2CAAC;MAA0B,OAAO,OAAO;MAAO,UAAU,OAAO;MAAU,WAAW,OAAO;gBAC1F,OAAO;QADG,OAAO,MAEX,CACT;KACD,iBACC,2CAAC;MACC,OAAOR,oCAAgB;MACvB,UAAU;MACV,WAAWE,kGAAgC,UAAU,YAAY,CAAC,EAAE,OAAO,WAAW,OAAO,YAAY;gBAExG,UAAU,SAAS,cAAc,SAAS;OACpC;;KAEJ;GACR,aACC,2CAAC;IAAK,MAAK;IAAS,WAAW,OAAO;cACnC;KACI;;GAEG;;AAIlB,qBAAe"}
@@ -65,8 +65,7 @@ const useStyles = (theme, colorScheme, disabled, hasError) => (0, react.useMemo)
65
65
  opacity: 0.6;
66
66
  cursor: not-allowed;
67
67
  `;
68
- return {
69
- option: require_emotion.css`
68
+ const option = require_emotion.css`
70
69
  padding: calc(${theme.vars.spacing.unit} / 2) ${theme.vars.spacing.unit};
71
70
  color: ${theme.vars.colors.text.primary};
72
71
  background-color: ${theme.vars.colors.background.surface};
@@ -79,10 +78,27 @@ const useStyles = (theme, colorScheme, disabled, hasError) => (0, react.useMemo)
79
78
  background-color: ${theme.vars.colors.primary.main};
80
79
  color: ${theme.vars.colors.primary.contrastText};
81
80
  }
81
+ `;
82
+ const status = require_emotion.css`
83
+ display: block;
84
+ margin-top: calc(${theme.vars.spacing.unit} / 2);
85
+ font-size: ${theme.vars.typography.fontSizes.sm};
86
+ color: ${theme.vars.colors.text.secondary};
87
+
88
+ &:empty {
89
+ display: none;
90
+ }
91
+ `;
92
+ return {
93
+ loadMore: require_emotion.css`
94
+ color: ${theme.vars.colors.primary.main};
95
+ font-weight: ${theme.vars.typography.fontWeights.medium};
82
96
  `,
97
+ option,
83
98
  select,
84
99
  selectDisabled,
85
- selectError
100
+ selectError,
101
+ status
86
102
  };
87
103
  }, [
88
104
  theme,
@@ -1 +1 @@
1
- {"version":3,"file":"Select.styles.cjs","names":["select: string","selectError: string","selectDisabled: string"],"sources":["../../../../../src/components/primitives/Select/Select.styles.ts"],"sourcesContent":["// Copyright 2024 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {Theme} from '@thunderid/browser';\nimport {useMemo} from 'react';\nimport {css} from '../../../styles/emotion';\n\n/**\n * Creates styles for the Select component using BEM methodology\n * @param theme - The theme object containing design tokens\n * @param colorScheme - The current color scheme (used for memoization)\n * @param disabled - Whether the component is disabled\n * @param hasError - Whether the component has an error\n * @returns Object containing CSS class names for component styling\n */\nconst useStyles = (theme: Theme, colorScheme: string, disabled: boolean, hasError: boolean): Record<string, string> =>\n useMemo(() => {\n const dropdownArrowColor: string = theme.colors.text.secondary.replace('#', '');\n const dropdownArrow = `data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23${dropdownArrowColor}%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E`;\n\n const select: string = css`\n width: 100%;\n padding: ${theme.vars.spacing.unit} calc(${theme.vars.spacing.unit} * 1.5);\n border: 1px solid ${hasError ? theme.vars.colors.error.main : theme.vars.colors.border};\n border-radius: ${theme.vars.components?.Field?.root?.borderRadius || theme.vars.borderRadius.medium};\n font-size: ${theme.vars.typography.fontSizes.md};\n font-family: ${theme.vars.typography.fontFamily};\n color: ${theme.vars.colors.text.primary};\n background-color: ${disabled ? theme.vars.colors.background.disabled : theme.vars.colors.background.surface};\n outline: none;\n transition:\n border-color 0.2s ease,\n box-shadow 0.2s ease;\n appearance: none;\n background-image: url('${dropdownArrow}');\n background-repeat: no-repeat;\n background-position: right 0.7em top 50%;\n background-size: 0.65em auto;\n cursor: ${disabled ? 'not-allowed' : 'pointer'};\n\n &:focus {\n border-color: ${hasError ? theme.vars.colors.error.main : theme.vars.colors.primary.main};\n box-shadow: 0 0 0 2px ${hasError ? `${theme.vars.colors.error.main}20` : `${theme.vars.colors.primary.main}20`};\n }\n\n &:disabled {\n opacity: 0.6;\n cursor: not-allowed;\n }\n\n &:hover:not(:disabled) {\n border-color: ${hasError ? theme.vars.colors.error.main : theme.vars.colors.primary.main};\n }\n `;\n\n const selectError: string = css`\n border-color: ${theme.vars.colors.error.main};\n\n &:focus {\n border-color: ${theme.vars.colors.error.main};\n box-shadow: 0 0 0 2px ${theme.vars.colors.error.main}20;\n }\n\n &:hover:not(:disabled) {\n border-color: ${theme.vars.colors.error.main};\n }\n `;\n\n const selectDisabled: string = css`\n background-color: ${theme.vars.colors.background.disabled};\n opacity: 0.6;\n cursor: not-allowed;\n `;\n\n const option: string = css`\n padding: calc(${theme.vars.spacing.unit} / 2) ${theme.vars.spacing.unit};\n color: ${theme.vars.colors.text.primary};\n background-color: ${theme.vars.colors.background.surface};\n\n &:hover {\n background-color: ${theme.vars.colors.action.hover};\n }\n\n &:checked {\n background-color: ${theme.vars.colors.primary.main};\n color: ${theme.vars.colors.primary.contrastText};\n }\n `;\n\n return {\n option,\n select,\n selectDisabled,\n selectError,\n };\n }, [theme, colorScheme, disabled, hasError]);\n\nexport default useStyles;\n"],"mappings":";;;;;;;;;;;;;;AAeA,MAAM,aAAa,OAAc,aAAqB,UAAmB,sCACzD;CAEZ,MAAM,gBAAgB,yKADa,MAAM,OAAO,KAAK,UAAU,QAAQ,KAAK,GAAG,CACmI;CAElN,MAAMA,SAAiB,mBAAG;;iBAEb,MAAM,KAAK,QAAQ,KAAK,QAAQ,MAAM,KAAK,QAAQ,KAAK;0BAC/C,WAAW,MAAM,KAAK,OAAO,MAAM,OAAO,MAAM,KAAK,OAAO,OAAO;uBACtE,MAAM,KAAK,YAAY,OAAO,MAAM,gBAAgB,MAAM,KAAK,aAAa,OAAO;mBACvF,MAAM,KAAK,WAAW,UAAU,GAAG;qBACjC,MAAM,KAAK,WAAW,WAAW;eACvC,MAAM,KAAK,OAAO,KAAK,QAAQ;0BACpB,WAAW,MAAM,KAAK,OAAO,WAAW,WAAW,MAAM,KAAK,OAAO,WAAW,QAAQ;;;;;;+BAMnF,cAAc;;;;gBAI7B,WAAW,gBAAgB,UAAU;;;wBAG7B,WAAW,MAAM,KAAK,OAAO,MAAM,OAAO,MAAM,KAAK,OAAO,QAAQ,KAAK;gCACjE,WAAW,GAAG,MAAM,KAAK,OAAO,MAAM,KAAK,MAAM,GAAG,MAAM,KAAK,OAAO,QAAQ,KAAK,IAAI;;;;;;;;;wBAS/F,WAAW,MAAM,KAAK,OAAO,MAAM,OAAO,MAAM,KAAK,OAAO,QAAQ,KAAK;;;CAI7F,MAAMC,cAAsB,mBAAG;sBACb,MAAM,KAAK,OAAO,MAAM,KAAK;;;wBAG3B,MAAM,KAAK,OAAO,MAAM,KAAK;gCACrB,MAAM,KAAK,OAAO,MAAM,KAAK;;;;wBAIrC,MAAM,KAAK,OAAO,MAAM,KAAK;;;CAIjD,MAAMC,iBAAyB,mBAAG;0BACZ,MAAM,KAAK,OAAO,WAAW,SAAS;;;;AAoB5D,QAAO;EACL,QAhBqB,mBAAG;sBACR,MAAM,KAAK,QAAQ,KAAK,QAAQ,MAAM,KAAK,QAAQ,KAAK;eAC/D,MAAM,KAAK,OAAO,KAAK,QAAQ;0BACpB,MAAM,KAAK,OAAO,WAAW,QAAQ;;;4BAGnC,MAAM,KAAK,OAAO,OAAO,MAAM;;;;4BAI/B,MAAM,KAAK,OAAO,QAAQ,KAAK;iBAC1C,MAAM,KAAK,OAAO,QAAQ,aAAa;;;EAMlD;EACA;EACA;EACD;GACA;CAAC;CAAO;CAAa;CAAU;CAAS,CAAC;AAE9C,4BAAe"}
1
+ {"version":3,"file":"Select.styles.cjs","names":["select: string","selectError: string","selectDisabled: string","option: string","status: string"],"sources":["../../../../../src/components/primitives/Select/Select.styles.ts"],"sourcesContent":["// Copyright 2024 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {Theme} from '@thunderid/browser';\nimport {useMemo} from 'react';\nimport {css} from '../../../styles/emotion';\n\n/**\n * Creates styles for the Select component using BEM methodology\n * @param theme - The theme object containing design tokens\n * @param colorScheme - The current color scheme (used for memoization)\n * @param disabled - Whether the component is disabled\n * @param hasError - Whether the component has an error\n * @returns Object containing CSS class names for component styling\n */\nconst useStyles = (theme: Theme, colorScheme: string, disabled: boolean, hasError: boolean): Record<string, string> =>\n useMemo(() => {\n const dropdownArrowColor: string = theme.colors.text.secondary.replace('#', '');\n const dropdownArrow = `data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23${dropdownArrowColor}%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E`;\n\n const select: string = css`\n width: 100%;\n padding: ${theme.vars.spacing.unit} calc(${theme.vars.spacing.unit} * 1.5);\n border: 1px solid ${hasError ? theme.vars.colors.error.main : theme.vars.colors.border};\n border-radius: ${theme.vars.components?.Field?.root?.borderRadius || theme.vars.borderRadius.medium};\n font-size: ${theme.vars.typography.fontSizes.md};\n font-family: ${theme.vars.typography.fontFamily};\n color: ${theme.vars.colors.text.primary};\n background-color: ${disabled ? theme.vars.colors.background.disabled : theme.vars.colors.background.surface};\n outline: none;\n transition:\n border-color 0.2s ease,\n box-shadow 0.2s ease;\n appearance: none;\n background-image: url('${dropdownArrow}');\n background-repeat: no-repeat;\n background-position: right 0.7em top 50%;\n background-size: 0.65em auto;\n cursor: ${disabled ? 'not-allowed' : 'pointer'};\n\n &:focus {\n border-color: ${hasError ? theme.vars.colors.error.main : theme.vars.colors.primary.main};\n box-shadow: 0 0 0 2px ${hasError ? `${theme.vars.colors.error.main}20` : `${theme.vars.colors.primary.main}20`};\n }\n\n &:disabled {\n opacity: 0.6;\n cursor: not-allowed;\n }\n\n &:hover:not(:disabled) {\n border-color: ${hasError ? theme.vars.colors.error.main : theme.vars.colors.primary.main};\n }\n `;\n\n const selectError: string = css`\n border-color: ${theme.vars.colors.error.main};\n\n &:focus {\n border-color: ${theme.vars.colors.error.main};\n box-shadow: 0 0 0 2px ${theme.vars.colors.error.main}20;\n }\n\n &:hover:not(:disabled) {\n border-color: ${theme.vars.colors.error.main};\n }\n `;\n\n const selectDisabled: string = css`\n background-color: ${theme.vars.colors.background.disabled};\n opacity: 0.6;\n cursor: not-allowed;\n `;\n\n const option: string = css`\n padding: calc(${theme.vars.spacing.unit} / 2) ${theme.vars.spacing.unit};\n color: ${theme.vars.colors.text.primary};\n background-color: ${theme.vars.colors.background.surface};\n\n &:hover {\n background-color: ${theme.vars.colors.action.hover};\n }\n\n &:checked {\n background-color: ${theme.vars.colors.primary.main};\n color: ${theme.vars.colors.primary.contrastText};\n }\n `;\n\n const status: string = css`\n display: block;\n margin-top: calc(${theme.vars.spacing.unit} / 2);\n font-size: ${theme.vars.typography.fontSizes.sm};\n color: ${theme.vars.colors.text.secondary};\n\n &:empty {\n display: none;\n }\n `;\n\n const loadMore: string = css`\n color: ${theme.vars.colors.primary.main};\n font-weight: ${theme.vars.typography.fontWeights.medium};\n `;\n\n return {\n loadMore,\n option,\n select,\n selectDisabled,\n selectError,\n status,\n };\n }, [theme, colorScheme, disabled, hasError]);\n\nexport default useStyles;\n"],"mappings":";;;;;;;;;;;;;;AAeA,MAAM,aAAa,OAAc,aAAqB,UAAmB,sCACzD;CAEZ,MAAM,gBAAgB,yKADa,MAAM,OAAO,KAAK,UAAU,QAAQ,KAAK,GAAG,CACmI;CAElN,MAAMA,SAAiB,mBAAG;;iBAEb,MAAM,KAAK,QAAQ,KAAK,QAAQ,MAAM,KAAK,QAAQ,KAAK;0BAC/C,WAAW,MAAM,KAAK,OAAO,MAAM,OAAO,MAAM,KAAK,OAAO,OAAO;uBACtE,MAAM,KAAK,YAAY,OAAO,MAAM,gBAAgB,MAAM,KAAK,aAAa,OAAO;mBACvF,MAAM,KAAK,WAAW,UAAU,GAAG;qBACjC,MAAM,KAAK,WAAW,WAAW;eACvC,MAAM,KAAK,OAAO,KAAK,QAAQ;0BACpB,WAAW,MAAM,KAAK,OAAO,WAAW,WAAW,MAAM,KAAK,OAAO,WAAW,QAAQ;;;;;;+BAMnF,cAAc;;;;gBAI7B,WAAW,gBAAgB,UAAU;;;wBAG7B,WAAW,MAAM,KAAK,OAAO,MAAM,OAAO,MAAM,KAAK,OAAO,QAAQ,KAAK;gCACjE,WAAW,GAAG,MAAM,KAAK,OAAO,MAAM,KAAK,MAAM,GAAG,MAAM,KAAK,OAAO,QAAQ,KAAK,IAAI;;;;;;;;;wBAS/F,WAAW,MAAM,KAAK,OAAO,MAAM,OAAO,MAAM,KAAK,OAAO,QAAQ,KAAK;;;CAI7F,MAAMC,cAAsB,mBAAG;sBACb,MAAM,KAAK,OAAO,MAAM,KAAK;;;wBAG3B,MAAM,KAAK,OAAO,MAAM,KAAK;gCACrB,MAAM,KAAK,OAAO,MAAM,KAAK;;;;wBAIrC,MAAM,KAAK,OAAO,MAAM,KAAK;;;CAIjD,MAAMC,iBAAyB,mBAAG;0BACZ,MAAM,KAAK,OAAO,WAAW,SAAS;;;;CAK5D,MAAMC,SAAiB,mBAAG;sBACR,MAAM,KAAK,QAAQ,KAAK,QAAQ,MAAM,KAAK,QAAQ,KAAK;eAC/D,MAAM,KAAK,OAAO,KAAK,QAAQ;0BACpB,MAAM,KAAK,OAAO,WAAW,QAAQ;;;4BAGnC,MAAM,KAAK,OAAO,OAAO,MAAM;;;;4BAI/B,MAAM,KAAK,OAAO,QAAQ,KAAK;iBAC1C,MAAM,KAAK,OAAO,QAAQ,aAAa;;;CAIpD,MAAMC,SAAiB,mBAAG;;yBAEL,MAAM,KAAK,QAAQ,KAAK;mBAC9B,MAAM,KAAK,WAAW,UAAU,GAAG;eACvC,MAAM,KAAK,OAAO,KAAK,UAAU;;;;;;AAY5C,QAAO;EACL,UANuB,mBAAG;eACjB,MAAM,KAAK,OAAO,QAAQ,KAAK;qBACzB,MAAM,KAAK,WAAW,YAAY,OAAO;;EAKxD;EACA;EACA;EACA;EACA;EACD;GACA;CAAC;CAAO;CAAa;CAAU;CAAS,CAAC;AAE9C,4BAAe"}
@@ -0,0 +1,21 @@
1
+ const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
2
+ const require_I18nContext = require('../../../contexts/I18n/I18nContext.cjs');
3
+ let __thunderid_browser = require("@thunderid/browser");
4
+ __thunderid_browser = require_rolldown_runtime.__toESM(__thunderid_browser);
5
+ let react = require("react");
6
+ react = require_rolldown_runtime.__toESM(react);
7
+
8
+ //#region src/components/primitives/Select/useSelectMessages.ts
9
+ /**
10
+ * The wording of `Select`: the active translations when there is an I18n provider, English otherwise, so `Select`
11
+ * works without a provider.
12
+ */
13
+ const useSelectMessages = () => {
14
+ const i18n = (0, react.useContext)(require_I18nContext.default);
15
+ return (0, react.useMemo)(() => (0, __thunderid_browser.getSelectMessages)(i18n ? (key) => i18n.t(key) : void 0), [i18n]);
16
+ };
17
+ var useSelectMessages_default = useSelectMessages;
18
+
19
+ //#endregion
20
+ exports.default = useSelectMessages_default;
21
+ //# sourceMappingURL=useSelectMessages.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSelectMessages.cjs","names":["i18n: ContextType<typeof I18nContext>","I18nContext"],"sources":["../../../../../src/components/primitives/Select/useSelectMessages.ts"],"sourcesContent":["// Copyright 2026 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {getSelectMessages} from '@thunderid/browser';\nimport type {SelectMessages} from '@thunderid/browser';\nimport {ContextType, useContext, useMemo} from 'react';\nimport I18nContext from '../../../contexts/I18n/I18nContext';\n\nexport type {SelectMessages};\n\n/**\n * The wording of `Select`: the active translations when there is an I18n provider, English otherwise, so `Select`\n * works without a provider.\n */\nconst useSelectMessages = (): SelectMessages => {\n const i18n: ContextType<typeof I18nContext> = useContext(I18nContext);\n\n return useMemo((): SelectMessages => getSelectMessages(i18n ? (key: string) => i18n.t(key) : undefined), [i18n]);\n};\n\nexport default useSelectMessages;\n"],"mappings":";;;;;;;;;;;;AAcA,MAAM,0BAA0C;CAC9C,MAAMA,6BAAmDC,4BAAY;AAErE,4EAAuD,QAAQ,QAAgB,KAAK,EAAE,IAAI,GAAG,OAAU,EAAE,CAAC,KAAK,CAAC;;AAGlH,gCAAe"}
@@ -6,24 +6,42 @@ const require_InputLabel = require('../InputLabel/InputLabel.cjs');
6
6
  const require_TextField_styles = require('./TextField.styles.cjs');
7
7
  let __thunderid_browser = require("@thunderid/browser");
8
8
  __thunderid_browser = require_rolldown_runtime.__toESM(__thunderid_browser);
9
+ let react = require("react");
10
+ react = require_rolldown_runtime.__toESM(react);
9
11
  let react_jsx_runtime = require("react/jsx-runtime");
10
12
  react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
11
13
 
12
14
  //#region src/components/primitives/TextField/TextField.tsx
13
- const TextField = ({ label, error, required, className, disabled, helperText, startIcon, endIcon, onStartIconClick, onEndIconClick, type = "text", style = {},...rest }) => {
15
+ /**
16
+ * Makes an element with `role="button"` respond to Enter and Space, as a native button does.
17
+ */
18
+ const activateOnKey = (activate) => (event) => {
19
+ if (event.key === "Enter" || event.key === " ") {
20
+ event.preventDefault();
21
+ activate();
22
+ }
23
+ };
24
+ const TextField = ({ label, error, required, className, disabled, helperText, startIcon, endAdornment, endIcon, endIconLabel = "End icon", onStartIconClick, onEndIconClick, type = "text", style = {},...rest }) => {
14
25
  const { theme, colorScheme } = require_useTheme.default();
26
+ const generatedId = (0, react.useId)();
27
+ const inputId = rest.id ?? generatedId;
28
+ const helperTextId = error || helperText ? `${inputId}-helper-text` : void 0;
29
+ const describedBy = [rest["aria-describedby"], helperTextId].filter(Boolean).join(" ") || void 0;
15
30
  const hasError = !!error;
16
- const styles = require_TextField_styles.default(theme, colorScheme, disabled ?? false, hasError, !!startIcon, !!endIcon);
31
+ const styles = require_TextField_styles.default(theme, colorScheme, disabled ?? false, hasError, !!startIcon, !!endIcon, !!endAdornment);
17
32
  const inputClassName = require_emotion.cx((0, __thunderid_browser.withVendorCSSClassPrefix)((0, __thunderid_browser.bem)("text-field", "input")), styles["input"], hasError && styles["inputError"], disabled && styles["inputDisabled"]);
18
33
  const containerClassName = require_emotion.cx((0, __thunderid_browser.withVendorCSSClassPrefix)((0, __thunderid_browser.bem)("text-field", "container")), styles["inputContainer"]);
19
34
  const startIconClassName = require_emotion.cx((0, __thunderid_browser.withVendorCSSClassPrefix)((0, __thunderid_browser.bem)("text-field", "start-icon")), styles["startIcon"]);
20
35
  const endIconClassName = require_emotion.cx((0, __thunderid_browser.withVendorCSSClassPrefix)((0, __thunderid_browser.bem)("text-field", "end-icon")), styles["endIcon"]);
36
+ const endAdornmentClassName = require_emotion.cx((0, __thunderid_browser.withVendorCSSClassPrefix)((0, __thunderid_browser.bem)("text-field", "end-adornment")), styles["endAdornment"]);
21
37
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_FormControl.default, {
22
38
  error,
23
39
  helperText,
40
+ helperTextId,
24
41
  className: require_emotion.cx((0, __thunderid_browser.withVendorCSSClassPrefix)((0, __thunderid_browser.bem)("text-field")), className),
25
42
  style,
26
43
  children: [label && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_InputLabel.default, {
44
+ htmlFor: inputId,
27
45
  required,
28
46
  error: hasError,
29
47
  children: label
@@ -35,6 +53,7 @@ const TextField = ({ label, error, required, className, disabled, helperText, st
35
53
  onClick: onStartIconClick,
36
54
  role: onStartIconClick ? "button" : void 0,
37
55
  tabIndex: onStartIconClick && !disabled ? 0 : void 0,
56
+ onKeyDown: onStartIconClick && !disabled ? activateOnKey(onStartIconClick) : void 0,
38
57
  "aria-label": "Start icon",
39
58
  children: startIcon
40
59
  }),
@@ -44,15 +63,22 @@ const TextField = ({ label, error, required, className, disabled, helperText, st
44
63
  disabled,
45
64
  "aria-invalid": hasError,
46
65
  "aria-required": required,
47
- ...rest
66
+ ...rest,
67
+ id: inputId,
68
+ "aria-describedby": describedBy
48
69
  }),
49
70
  endIcon && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
50
71
  className: endIconClassName,
51
72
  onClick: onEndIconClick,
52
73
  role: onEndIconClick ? "button" : void 0,
53
74
  tabIndex: onEndIconClick && !disabled ? 0 : void 0,
54
- "aria-label": "End icon",
75
+ onKeyDown: onEndIconClick && !disabled ? activateOnKey(onEndIconClick) : void 0,
76
+ "aria-label": endIconLabel,
55
77
  children: endIcon
78
+ }),
79
+ endAdornment && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
80
+ className: endAdornmentClassName,
81
+ children: endAdornment
56
82
  })
57
83
  ]
58
84
  })]
@@ -1 +1 @@
1
- {"version":3,"file":"TextField.cjs","names":["TextField: FC<TextFieldProps>","useTheme","styles: Record<string, string>","useStyles","inputClassName: string","cx","containerClassName: string","startIconClassName: string","endIconClassName: string","FormControl","InputLabel"],"sources":["../../../../../src/components/primitives/TextField/TextField.tsx"],"sourcesContent":["// Copyright 2024 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {withVendorCSSClassPrefix, bem} from '@thunderid/browser';\nimport {FC, InputHTMLAttributes, ReactNode} from 'react';\nimport useStyles from './TextField.styles';\nimport useTheme from '../../../contexts/Theme/useTheme';\nimport {cx} from '../../../styles/emotion';\nimport FormControl from '../FormControl/FormControl';\nimport InputLabel from '../InputLabel/InputLabel';\n\nexport interface TextFieldProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'className'> {\n /**\n * Additional CSS class names\n */\n className?: string;\n /**\n * Whether the field is disabled\n */\n disabled?: boolean;\n /**\n * Icon to display at the end (right) of the input\n */\n endIcon?: ReactNode;\n /**\n * Error message to display below the input\n */\n error?: string;\n /**\n * Helper text to display below the input\n */\n helperText?: string;\n /**\n * Label text to display above the input\n */\n label?: string;\n /**\n * Click handler for the end icon\n */\n onEndIconClick?: () => void;\n /**\n * Click handler for the start icon\n */\n onStartIconClick?: () => void;\n /**\n * Whether the field is required\n */\n required?: boolean;\n /**\n * Icon to display at the start (left) of the input\n */\n startIcon?: ReactNode;\n}\n\nconst TextField: FC<TextFieldProps> = ({\n label,\n error,\n required,\n className,\n disabled,\n helperText,\n startIcon,\n endIcon,\n onStartIconClick,\n onEndIconClick,\n type = 'text',\n style = {},\n ...rest\n}: TextFieldProps) => {\n const {theme, colorScheme}: ReturnType<typeof useTheme> = useTheme();\n const hasError = !!error;\n const hasStartIcon = !!startIcon;\n const hasEndIcon = !!endIcon;\n const styles: Record<string, string> = useStyles(\n theme,\n colorScheme,\n disabled ?? false,\n hasError,\n hasStartIcon,\n hasEndIcon,\n );\n\n const inputClassName: string = cx(\n withVendorCSSClassPrefix(bem('text-field', 'input')),\n styles['input'],\n hasError && styles['inputError'],\n disabled && styles['inputDisabled'],\n );\n\n const containerClassName: string = cx(\n withVendorCSSClassPrefix(bem('text-field', 'container')),\n styles['inputContainer'],\n );\n\n const startIconClassName: string = cx(withVendorCSSClassPrefix(bem('text-field', 'start-icon')), styles['startIcon']);\n\n const endIconClassName: string = cx(withVendorCSSClassPrefix(bem('text-field', 'end-icon')), styles['endIcon']);\n\n return (\n <FormControl\n error={error}\n helperText={helperText}\n className={cx(withVendorCSSClassPrefix(bem('text-field')), className)}\n style={style}\n >\n {label && (\n <InputLabel required={required} error={hasError}>\n {label}\n </InputLabel>\n )}\n <div className={containerClassName}>\n {startIcon && (\n <div\n className={startIconClassName}\n onClick={onStartIconClick}\n role={onStartIconClick ? 'button' : undefined}\n tabIndex={onStartIconClick && !disabled ? 0 : undefined}\n aria-label=\"Start icon\"\n >\n {startIcon}\n </div>\n )}\n <input\n className={inputClassName}\n type={type}\n disabled={disabled}\n aria-invalid={hasError}\n aria-required={required}\n {...rest}\n />\n {endIcon && (\n <div\n className={endIconClassName}\n onClick={onEndIconClick}\n role={onEndIconClick ? 'button' : undefined}\n tabIndex={onEndIconClick && !disabled ? 0 : undefined}\n aria-label=\"End icon\"\n >\n {endIcon}\n </div>\n )}\n </div>\n </FormControl>\n );\n};\n\nexport default TextField;\n"],"mappings":";;;;;;;;;;;;AAsDA,MAAMA,aAAiC,EACrC,OACA,OACA,UACA,WACA,UACA,YACA,WACA,SACA,kBACA,gBACA,OAAO,QACP,QAAQ,EAAE,CACV,GAAG,WACiB;CACpB,MAAM,EAAC,OAAO,gBAA4CC,0BAAU;CACpE,MAAM,WAAW,CAAC,CAAC;CAGnB,MAAMC,SAAiCC,iCACrC,OACA,aACA,YAAY,OACZ,UANmB,CAAC,CAAC,WACJ,CAAC,CAAC,QAQpB;CAED,MAAMC,iBAAyBC,kGACA,cAAc,QAAQ,CAAC,EACpD,OAAO,UACP,YAAY,OAAO,eACnB,YAAY,OAAO,iBACpB;CAED,MAAMC,qBAA6BD,kGACJ,cAAc,YAAY,CAAC,EACxD,OAAO,kBACR;CAED,MAAME,qBAA6BF,kGAAgC,cAAc,aAAa,CAAC,EAAE,OAAO,aAAa;CAErH,MAAMG,mBAA2BH,kGAAgC,cAAc,WAAW,CAAC,EAAE,OAAO,WAAW;AAE/G,QACE,4CAACI;EACQ;EACK;EACZ,WAAWJ,kGAAgC,aAAa,CAAC,EAAE,UAAU;EAC9D;aAEN,SACC,2CAACK;GAAqB;GAAU,OAAO;aACpC;IACU,EAEf,4CAAC;GAAI,WAAW;;IACb,aACC,2CAAC;KACC,WAAW;KACX,SAAS;KACT,MAAM,mBAAmB,WAAW;KACpC,UAAU,oBAAoB,CAAC,WAAW,IAAI;KAC9C,cAAW;eAEV;MACG;IAER,2CAAC;KACC,WAAW;KACL;KACI;KACV,gBAAc;KACd,iBAAe;KACf,GAAI;MACJ;IACD,WACC,2CAAC;KACC,WAAW;KACX,SAAS;KACT,MAAM,iBAAiB,WAAW;KAClC,UAAU,kBAAkB,CAAC,WAAW,IAAI;KAC5C,cAAW;eAEV;MACG;;IAEJ;GACM;;AAIlB,wBAAe"}
1
+ {"version":3,"file":"TextField.cjs","names":["TextField: FC<TextFieldProps>","useTheme","generatedId: string","inputId: string","helperTextId: string | undefined","describedBy: string | undefined","styles: Record<string, string>","useStyles","inputClassName: string","cx","containerClassName: string","startIconClassName: string","endIconClassName: string","endAdornmentClassName: string","FormControl","InputLabel"],"sources":["../../../../../src/components/primitives/TextField/TextField.tsx"],"sourcesContent":["// Copyright 2024 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {withVendorCSSClassPrefix, bem} from '@thunderid/browser';\nimport {FC, InputHTMLAttributes, KeyboardEvent, ReactNode, useId} from 'react';\nimport useStyles from './TextField.styles';\nimport useTheme from '../../../contexts/Theme/useTheme';\nimport {cx} from '../../../styles/emotion';\nimport FormControl from '../FormControl/FormControl';\nimport InputLabel from '../InputLabel/InputLabel';\n\nexport interface TextFieldProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'className'> {\n /**\n * Additional CSS class names\n */\n className?: string;\n /**\n * Whether the field is disabled\n */\n disabled?: boolean;\n /**\n * Extra content shown inside the field, at its end after the end icon, such as an action button\n */\n endAdornment?: ReactNode;\n /**\n * Icon to display at the end (right) of the input\n */\n endIcon?: ReactNode;\n /**\n * Accessible name of the end icon when it is a button, that is when `onEndIconClick` is set\n */\n endIconLabel?: string;\n /**\n * Error message to display below the input\n */\n error?: string;\n /**\n * Helper text to display below the input\n */\n helperText?: string;\n /**\n * Label text to display above the input\n */\n label?: string;\n /**\n * Click handler for the end icon\n */\n onEndIconClick?: () => void;\n /**\n * Click handler for the start icon\n */\n onStartIconClick?: () => void;\n /**\n * Whether the field is required\n */\n required?: boolean;\n /**\n * Icon to display at the start (left) of the input\n */\n startIcon?: ReactNode;\n}\n\n/**\n * Makes an element with `role=\"button\"` respond to Enter and Space, as a native button does.\n */\nconst activateOnKey =\n (activate: () => void) =>\n (event: KeyboardEvent<HTMLDivElement>): void => {\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n activate();\n }\n };\n\nconst TextField: FC<TextFieldProps> = ({\n label,\n error,\n required,\n className,\n disabled,\n helperText,\n startIcon,\n endAdornment,\n endIcon,\n endIconLabel = 'End icon',\n onStartIconClick,\n onEndIconClick,\n type = 'text',\n style = {},\n ...rest\n}: TextFieldProps) => {\n const {theme, colorScheme}: ReturnType<typeof useTheme> = useTheme();\n const generatedId: string = useId();\n const inputId: string = rest.id ?? generatedId;\n const helperTextId: string | undefined = error || helperText ? `${inputId}-helper-text` : undefined;\n const describedBy: string | undefined =\n [rest['aria-describedby'], helperTextId].filter(Boolean).join(' ') || undefined;\n const hasError = !!error;\n const hasStartIcon = !!startIcon;\n const hasEndIcon = !!endIcon;\n const hasEndAdornment = !!endAdornment;\n const styles: Record<string, string> = useStyles(\n theme,\n colorScheme,\n disabled ?? false,\n hasError,\n hasStartIcon,\n hasEndIcon,\n hasEndAdornment,\n );\n\n const inputClassName: string = cx(\n withVendorCSSClassPrefix(bem('text-field', 'input')),\n styles['input'],\n hasError && styles['inputError'],\n disabled && styles['inputDisabled'],\n );\n\n const containerClassName: string = cx(\n withVendorCSSClassPrefix(bem('text-field', 'container')),\n styles['inputContainer'],\n );\n\n const startIconClassName: string = cx(withVendorCSSClassPrefix(bem('text-field', 'start-icon')), styles['startIcon']);\n\n const endIconClassName: string = cx(withVendorCSSClassPrefix(bem('text-field', 'end-icon')), styles['endIcon']);\n\n const endAdornmentClassName: string = cx(\n withVendorCSSClassPrefix(bem('text-field', 'end-adornment')),\n styles['endAdornment'],\n );\n\n return (\n <FormControl\n error={error}\n helperText={helperText}\n helperTextId={helperTextId}\n className={cx(withVendorCSSClassPrefix(bem('text-field')), className)}\n style={style}\n >\n {label && (\n <InputLabel htmlFor={inputId} required={required} error={hasError}>\n {label}\n </InputLabel>\n )}\n <div className={containerClassName}>\n {startIcon && (\n <div\n className={startIconClassName}\n onClick={onStartIconClick}\n role={onStartIconClick ? 'button' : undefined}\n tabIndex={onStartIconClick && !disabled ? 0 : undefined}\n onKeyDown={onStartIconClick && !disabled ? activateOnKey(onStartIconClick) : undefined}\n aria-label=\"Start icon\"\n >\n {startIcon}\n </div>\n )}\n <input\n className={inputClassName}\n type={type}\n disabled={disabled}\n aria-invalid={hasError}\n aria-required={required}\n {...rest}\n id={inputId}\n aria-describedby={describedBy}\n />\n {endIcon && (\n <div\n className={endIconClassName}\n onClick={onEndIconClick}\n role={onEndIconClick ? 'button' : undefined}\n tabIndex={onEndIconClick && !disabled ? 0 : undefined}\n onKeyDown={onEndIconClick && !disabled ? activateOnKey(onEndIconClick) : undefined}\n aria-label={endIconLabel}\n >\n {endIcon}\n </div>\n )}\n {endAdornment && <div className={endAdornmentClassName}>{endAdornment}</div>}\n </div>\n </FormControl>\n );\n};\n\nexport default TextField;\n"],"mappings":";;;;;;;;;;;;;;;;;AAiEA,MAAM,iBACH,cACA,UAA+C;AAC9C,KAAI,MAAM,QAAQ,WAAW,MAAM,QAAQ,KAAK;AAC9C,QAAM,gBAAgB;AACtB,YAAU;;;AAIhB,MAAMA,aAAiC,EACrC,OACA,OACA,UACA,WACA,UACA,YACA,WACA,cACA,SACA,eAAe,YACf,kBACA,gBACA,OAAO,QACP,QAAQ,EAAE,CACV,GAAG,WACiB;CACpB,MAAM,EAAC,OAAO,gBAA4CC,0BAAU;CACpE,MAAMC,gCAA6B;CACnC,MAAMC,UAAkB,KAAK,MAAM;CACnC,MAAMC,eAAmC,SAAS,aAAa,GAAG,QAAQ,gBAAgB;CAC1F,MAAMC,cACJ,CAAC,KAAK,qBAAqB,aAAa,CAAC,OAAO,QAAQ,CAAC,KAAK,IAAI,IAAI;CACxE,MAAM,WAAW,CAAC,CAAC;CAInB,MAAMC,SAAiCC,iCACrC,OACA,aACA,YAAY,OACZ,UAPmB,CAAC,CAAC,WACJ,CAAC,CAAC,SACG,CAAC,CAAC,aASzB;CAED,MAAMC,iBAAyBC,kGACA,cAAc,QAAQ,CAAC,EACpD,OAAO,UACP,YAAY,OAAO,eACnB,YAAY,OAAO,iBACpB;CAED,MAAMC,qBAA6BD,kGACJ,cAAc,YAAY,CAAC,EACxD,OAAO,kBACR;CAED,MAAME,qBAA6BF,kGAAgC,cAAc,aAAa,CAAC,EAAE,OAAO,aAAa;CAErH,MAAMG,mBAA2BH,kGAAgC,cAAc,WAAW,CAAC,EAAE,OAAO,WAAW;CAE/G,MAAMI,wBAAgCJ,kGACP,cAAc,gBAAgB,CAAC,EAC5D,OAAO,gBACR;AAED,QACE,4CAACK;EACQ;EACK;EACE;EACd,WAAWL,kGAAgC,aAAa,CAAC,EAAE,UAAU;EAC9D;aAEN,SACC,2CAACM;GAAW,SAAS;GAAmB;GAAU,OAAO;aACtD;IACU,EAEf,4CAAC;GAAI,WAAW;;IACb,aACC,2CAAC;KACC,WAAW;KACX,SAAS;KACT,MAAM,mBAAmB,WAAW;KACpC,UAAU,oBAAoB,CAAC,WAAW,IAAI;KAC9C,WAAW,oBAAoB,CAAC,WAAW,cAAc,iBAAiB,GAAG;KAC7E,cAAW;eAEV;MACG;IAER,2CAAC;KACC,WAAW;KACL;KACI;KACV,gBAAc;KACd,iBAAe;KACf,GAAI;KACJ,IAAI;KACJ,oBAAkB;MAClB;IACD,WACC,2CAAC;KACC,WAAW;KACX,SAAS;KACT,MAAM,iBAAiB,WAAW;KAClC,UAAU,kBAAkB,CAAC,WAAW,IAAI;KAC5C,WAAW,kBAAkB,CAAC,WAAW,cAAc,eAAe,GAAG;KACzE,cAAY;eAEX;MACG;IAEP,gBAAgB,2CAAC;KAAI,WAAW;eAAwB;MAAmB;;IACxE;GACM;;AAIlB,wBAAe"}
@@ -12,11 +12,14 @@ react = require_rolldown_runtime.__toESM(react);
12
12
  * @param hasError - Whether the component has an error
13
13
  * @param hasStartIcon - Whether the component has a start icon
14
14
  * @param hasEndIcon - Whether the component has an end icon
15
+ * @param hasEndAdornment - Whether the component has extra content before the end icon
15
16
  * @returns Object containing CSS class names for component styling
16
17
  */
17
- const useStyles = (theme, colorScheme, disabled, hasError, hasStartIcon, hasEndIcon) => (0, react.useMemo)(() => {
18
+ const useStyles = (theme, colorScheme, disabled, hasError, hasStartIcon, hasEndIcon, hasEndAdornment = false) => (0, react.useMemo)(() => {
18
19
  const inlineStartPadding = hasStartIcon ? `calc(${theme.vars.spacing.unit} * 5)` : `calc(${theme.vars.spacing.unit} * 1.5)`;
19
- const inlineEndPadding = hasEndIcon ? `calc(${theme.vars.spacing.unit} * 5)` : `calc(${theme.vars.spacing.unit} * 1.5)`;
20
+ let inlineEndPadding = `calc(${theme.vars.spacing.unit} * 1.5)`;
21
+ if (hasEndIcon && hasEndAdornment) inlineEndPadding = `calc(${theme.vars.spacing.unit} * 8)`;
22
+ else if (hasEndIcon || hasEndAdornment) inlineEndPadding = `calc(${theme.vars.spacing.unit} * 5)`;
20
23
  const inputContainer = require_emotion.css`
21
24
  position: relative;
22
25
  display: flex;
@@ -104,11 +107,20 @@ const useStyles = (theme, colorScheme, disabled, hasError, hasStartIcon, hasEndI
104
107
  ${icon};
105
108
  inset-inline-start: ${theme.vars.spacing.unit};
106
109
  `;
107
- return {
108
- endIcon: require_emotion.css`
110
+ const endIcon = require_emotion.css`
109
111
  ${icon};
112
+ inset-inline-end: calc(${theme.vars.spacing.unit} * ${hasEndAdornment ? 4.5 : 1});
113
+ `;
114
+ return {
115
+ endAdornment: require_emotion.css`
116
+ position: absolute;
117
+ display: flex;
118
+ align-items: center;
119
+ top: 50%;
120
+ transform: translateY(-50%);
110
121
  inset-inline-end: ${theme.vars.spacing.unit};
111
122
  `,
123
+ endIcon,
112
124
  icon,
113
125
  input,
114
126
  inputContainer,
@@ -122,7 +134,8 @@ const useStyles = (theme, colorScheme, disabled, hasError, hasStartIcon, hasEndI
122
134
  disabled,
123
135
  hasError,
124
136
  hasStartIcon,
125
- hasEndIcon
137
+ hasEndIcon,
138
+ hasEndAdornment
126
139
  ]);
127
140
  var TextField_styles_default = useStyles;
128
141
 
@@ -1 +1 @@
1
- {"version":3,"file":"TextField.styles.cjs","names":["inlineStartPadding: string","inlineEndPadding: string","inputContainer: string","input: string","inputError: string","inputDisabled: string","icon: string","startIcon: string"],"sources":["../../../../../src/components/primitives/TextField/TextField.styles.ts"],"sourcesContent":["// Copyright 2024 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {Theme} from '@thunderid/browser';\nimport {useMemo} from 'react';\nimport {css} from '../../../styles/emotion';\n\n/**\n * Creates styles for the TextField component using BEM methodology\n * @param theme - The theme object containing design tokens\n * @param colorScheme - The current color scheme (used for memoization)\n * @param disabled - Whether the component is disabled\n * @param hasError - Whether the component has an error\n * @param hasStartIcon - Whether the component has a start icon\n * @param hasEndIcon - Whether the component has an end icon\n * @returns Object containing CSS class names for component styling\n */\nconst useStyles = (\n theme: Theme,\n colorScheme: string,\n disabled: boolean,\n hasError: boolean,\n hasStartIcon: boolean,\n hasEndIcon: boolean,\n): Record<string, string> =>\n useMemo(() => {\n const inlineStartPadding: string = hasStartIcon\n ? `calc(${theme.vars.spacing.unit} * 5)`\n : `calc(${theme.vars.spacing.unit} * 1.5)`;\n const inlineEndPadding: string = hasEndIcon\n ? `calc(${theme.vars.spacing.unit} * 5)`\n : `calc(${theme.vars.spacing.unit} * 1.5)`;\n\n const inputContainer: string = css`\n position: relative;\n display: flex;\n align-items: center;\n `;\n\n const input: string = css`\n width: 100%;\n padding-block: ${theme.vars.spacing.unit};\n padding-inline-start: ${inlineStartPadding};\n padding-inline-end: ${inlineEndPadding};\n border: 1px solid ${hasError ? theme.vars.colors.error.main : theme.vars.colors.border};\n border-radius: ${theme.vars.components?.Field?.root?.borderRadius || theme.vars.borderRadius.medium};\n font-size: ${theme.vars.typography.fontSizes.md};\n font-family: ${theme.vars.typography.fontFamily};\n color: ${theme.vars.colors.text.primary};\n background-color: ${disabled ? theme.vars.colors.background.disabled : theme.vars.colors.background.surface};\n outline: none;\n transition:\n border-color 0.2s ease,\n box-shadow 0.2s ease;\n\n &:focus {\n border-color: ${hasError ? theme.vars.colors.error.main : theme.vars.colors.primary.main};\n box-shadow: 0 0 0 2px ${hasError ? `${theme.vars.colors.error.main}20` : `${theme.vars.colors.primary.main}20`};\n }\n\n &:disabled {\n opacity: 0.6;\n cursor: not-allowed;\n }\n\n &:hover:not(:disabled) {\n border-color: ${hasError ? theme.vars.colors.error.main : theme.vars.colors.primary.main};\n }\n\n &::placeholder {\n color: ${theme.vars.colors.text.secondary};\n opacity: 0.7;\n }\n `;\n\n const inputError: string = css`\n border-color: ${theme.vars.colors.error.main};\n\n &:focus {\n border-color: ${theme.vars.colors.error.main};\n box-shadow: 0 0 0 2px ${theme.vars.colors.error.main}20;\n }\n\n &:hover:not(:disabled) {\n border-color: ${theme.vars.colors.error.main};\n }\n `;\n\n const inputDisabled: string = css`\n background-color: ${theme.vars.colors.background.disabled};\n opacity: 0.6;\n cursor: not-allowed;\n `;\n\n const icon: string = css`\n position: absolute;\n background: none;\n border: none;\n cursor: ${disabled ? 'not-allowed' : 'pointer'};\n padding: calc(${theme.vars.spacing.unit} / 2);\n display: flex;\n align-items: center;\n justify-content: center;\n color: ${theme.vars.colors.text.secondary};\n opacity: ${disabled ? 0.5 : 1};\n top: 50%;\n transform: translateY(-50%);\n transition:\n color 0.2s ease,\n opacity 0.2s ease;\n\n &:hover:not(:disabled) {\n color: ${theme.vars.colors.text.primary};\n }\n\n &:focus {\n outline: 2px solid ${theme.vars.colors.primary.main};\n outline-offset: 2px;\n }\n `;\n\n const startIcon: string = css`\n ${icon};\n inset-inline-start: ${theme.vars.spacing.unit};\n `;\n\n const endIcon: string = css`\n ${icon};\n inset-inline-end: ${theme.vars.spacing.unit};\n `;\n\n return {\n endIcon,\n icon,\n input,\n inputContainer,\n inputDisabled,\n inputError,\n startIcon,\n };\n }, [theme, colorScheme, disabled, hasError, hasStartIcon, hasEndIcon]);\n\nexport default useStyles;\n"],"mappings":";;;;;;;;;;;;;;;;AAiBA,MAAM,aACJ,OACA,aACA,UACA,UACA,cACA,wCAEc;CACZ,MAAMA,qBAA6B,eAC/B,QAAQ,MAAM,KAAK,QAAQ,KAAK,SAChC,QAAQ,MAAM,KAAK,QAAQ,KAAK;CACpC,MAAMC,mBAA2B,aAC7B,QAAQ,MAAM,KAAK,QAAQ,KAAK,SAChC,QAAQ,MAAM,KAAK,QAAQ,KAAK;CAEpC,MAAMC,iBAAyB,mBAAG;;;;;CAMlC,MAAMC,QAAgB,mBAAG;;uBAEN,MAAM,KAAK,QAAQ,KAAK;8BACjB,mBAAmB;4BACrB,iBAAiB;0BACnB,WAAW,MAAM,KAAK,OAAO,MAAM,OAAO,MAAM,KAAK,OAAO,OAAO;uBACtE,MAAM,KAAK,YAAY,OAAO,MAAM,gBAAgB,MAAM,KAAK,aAAa,OAAO;mBACvF,MAAM,KAAK,WAAW,UAAU,GAAG;qBACjC,MAAM,KAAK,WAAW,WAAW;eACvC,MAAM,KAAK,OAAO,KAAK,QAAQ;0BACpB,WAAW,MAAM,KAAK,OAAO,WAAW,WAAW,MAAM,KAAK,OAAO,WAAW,QAAQ;;;;;;;wBAO1F,WAAW,MAAM,KAAK,OAAO,MAAM,OAAO,MAAM,KAAK,OAAO,QAAQ,KAAK;gCACjE,WAAW,GAAG,MAAM,KAAK,OAAO,MAAM,KAAK,MAAM,GAAG,MAAM,KAAK,OAAO,QAAQ,KAAK,IAAI;;;;;;;;;wBAS/F,WAAW,MAAM,KAAK,OAAO,MAAM,OAAO,MAAM,KAAK,OAAO,QAAQ,KAAK;;;;iBAIhF,MAAM,KAAK,OAAO,KAAK,UAAU;;;;CAK9C,MAAMC,aAAqB,mBAAG;sBACZ,MAAM,KAAK,OAAO,MAAM,KAAK;;;wBAG3B,MAAM,KAAK,OAAO,MAAM,KAAK;gCACrB,MAAM,KAAK,OAAO,MAAM,KAAK;;;;wBAIrC,MAAM,KAAK,OAAO,MAAM,KAAK;;;CAIjD,MAAMC,gBAAwB,mBAAG;0BACX,MAAM,KAAK,OAAO,WAAW,SAAS;;;;CAK5D,MAAMC,OAAe,mBAAG;;;;gBAIZ,WAAW,gBAAgB,UAAU;sBAC/B,MAAM,KAAK,QAAQ,KAAK;;;;eAI/B,MAAM,KAAK,OAAO,KAAK,UAAU;iBAC/B,WAAW,KAAM,EAAE;;;;;;;;iBAQnB,MAAM,KAAK,OAAO,KAAK,QAAQ;;;;6BAInB,MAAM,KAAK,OAAO,QAAQ,KAAK;;;;CAKxD,MAAMC,YAAoB,mBAAG;QACzB,KAAK;4BACe,MAAM,KAAK,QAAQ,KAAK;;AAQhD,QAAO;EACL,SANsB,mBAAG;QACvB,KAAK;0BACa,MAAM,KAAK,QAAQ,KAAK;;EAK5C;EACA;EACA;EACA;EACA;EACA;EACD;GACA;CAAC;CAAO;CAAa;CAAU;CAAU;CAAc;CAAW,CAAC;AAExE,+BAAe"}
1
+ {"version":3,"file":"TextField.styles.cjs","names":["inlineStartPadding: string","inputContainer: string","input: string","inputError: string","inputDisabled: string","icon: string","startIcon: string","endIcon: string"],"sources":["../../../../../src/components/primitives/TextField/TextField.styles.ts"],"sourcesContent":["// Copyright 2024 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {Theme} from '@thunderid/browser';\nimport {useMemo} from 'react';\nimport {css} from '../../../styles/emotion';\n\n/**\n * Creates styles for the TextField component using BEM methodology\n * @param theme - The theme object containing design tokens\n * @param colorScheme - The current color scheme (used for memoization)\n * @param disabled - Whether the component is disabled\n * @param hasError - Whether the component has an error\n * @param hasStartIcon - Whether the component has a start icon\n * @param hasEndIcon - Whether the component has an end icon\n * @param hasEndAdornment - Whether the component has extra content before the end icon\n * @returns Object containing CSS class names for component styling\n */\nconst useStyles = (\n theme: Theme,\n colorScheme: string,\n disabled: boolean,\n hasError: boolean,\n hasStartIcon: boolean,\n hasEndIcon: boolean,\n hasEndAdornment = false,\n): Record<string, string> =>\n useMemo(() => {\n const inlineStartPadding: string = hasStartIcon\n ? `calc(${theme.vars.spacing.unit} * 5)`\n : `calc(${theme.vars.spacing.unit} * 1.5)`;\n let inlineEndPadding = `calc(${theme.vars.spacing.unit} * 1.5)`;\n\n if (hasEndIcon && hasEndAdornment) {\n inlineEndPadding = `calc(${theme.vars.spacing.unit} * 8)`;\n } else if (hasEndIcon || hasEndAdornment) {\n inlineEndPadding = `calc(${theme.vars.spacing.unit} * 5)`;\n }\n\n const inputContainer: string = css`\n position: relative;\n display: flex;\n align-items: center;\n `;\n\n const input: string = css`\n width: 100%;\n padding-block: ${theme.vars.spacing.unit};\n padding-inline-start: ${inlineStartPadding};\n padding-inline-end: ${inlineEndPadding};\n border: 1px solid ${hasError ? theme.vars.colors.error.main : theme.vars.colors.border};\n border-radius: ${theme.vars.components?.Field?.root?.borderRadius || theme.vars.borderRadius.medium};\n font-size: ${theme.vars.typography.fontSizes.md};\n font-family: ${theme.vars.typography.fontFamily};\n color: ${theme.vars.colors.text.primary};\n background-color: ${disabled ? theme.vars.colors.background.disabled : theme.vars.colors.background.surface};\n outline: none;\n transition:\n border-color 0.2s ease,\n box-shadow 0.2s ease;\n\n &:focus {\n border-color: ${hasError ? theme.vars.colors.error.main : theme.vars.colors.primary.main};\n box-shadow: 0 0 0 2px ${hasError ? `${theme.vars.colors.error.main}20` : `${theme.vars.colors.primary.main}20`};\n }\n\n &:disabled {\n opacity: 0.6;\n cursor: not-allowed;\n }\n\n &:hover:not(:disabled) {\n border-color: ${hasError ? theme.vars.colors.error.main : theme.vars.colors.primary.main};\n }\n\n &::placeholder {\n color: ${theme.vars.colors.text.secondary};\n opacity: 0.7;\n }\n `;\n\n const inputError: string = css`\n border-color: ${theme.vars.colors.error.main};\n\n &:focus {\n border-color: ${theme.vars.colors.error.main};\n box-shadow: 0 0 0 2px ${theme.vars.colors.error.main}20;\n }\n\n &:hover:not(:disabled) {\n border-color: ${theme.vars.colors.error.main};\n }\n `;\n\n const inputDisabled: string = css`\n background-color: ${theme.vars.colors.background.disabled};\n opacity: 0.6;\n cursor: not-allowed;\n `;\n\n const icon: string = css`\n position: absolute;\n background: none;\n border: none;\n cursor: ${disabled ? 'not-allowed' : 'pointer'};\n padding: calc(${theme.vars.spacing.unit} / 2);\n display: flex;\n align-items: center;\n justify-content: center;\n color: ${theme.vars.colors.text.secondary};\n opacity: ${disabled ? 0.5 : 1};\n top: 50%;\n transform: translateY(-50%);\n transition:\n color 0.2s ease,\n opacity 0.2s ease;\n\n &:hover:not(:disabled) {\n color: ${theme.vars.colors.text.primary};\n }\n\n &:focus {\n outline: 2px solid ${theme.vars.colors.primary.main};\n outline-offset: 2px;\n }\n `;\n\n const startIcon: string = css`\n ${icon};\n inset-inline-start: ${theme.vars.spacing.unit};\n `;\n\n const endIcon: string = css`\n ${icon};\n inset-inline-end: calc(${theme.vars.spacing.unit} * ${hasEndAdornment ? 4.5 : 1});\n `;\n\n const endAdornment: string = css`\n position: absolute;\n display: flex;\n align-items: center;\n top: 50%;\n transform: translateY(-50%);\n inset-inline-end: ${theme.vars.spacing.unit};\n `;\n\n return {\n endAdornment,\n endIcon,\n icon,\n input,\n inputContainer,\n inputDisabled,\n inputError,\n startIcon,\n };\n }, [theme, colorScheme, disabled, hasError, hasStartIcon, hasEndIcon, hasEndAdornment]);\n\nexport default useStyles;\n"],"mappings":";;;;;;;;;;;;;;;;;AAkBA,MAAM,aACJ,OACA,aACA,UACA,UACA,cACA,YACA,kBAAkB,mCAEJ;CACZ,MAAMA,qBAA6B,eAC/B,QAAQ,MAAM,KAAK,QAAQ,KAAK,SAChC,QAAQ,MAAM,KAAK,QAAQ,KAAK;CACpC,IAAI,mBAAmB,QAAQ,MAAM,KAAK,QAAQ,KAAK;AAEvD,KAAI,cAAc,gBAChB,oBAAmB,QAAQ,MAAM,KAAK,QAAQ,KAAK;UAC1C,cAAc,gBACvB,oBAAmB,QAAQ,MAAM,KAAK,QAAQ,KAAK;CAGrD,MAAMC,iBAAyB,mBAAG;;;;;CAMlC,MAAMC,QAAgB,mBAAG;;uBAEN,MAAM,KAAK,QAAQ,KAAK;8BACjB,mBAAmB;4BACrB,iBAAiB;0BACnB,WAAW,MAAM,KAAK,OAAO,MAAM,OAAO,MAAM,KAAK,OAAO,OAAO;uBACtE,MAAM,KAAK,YAAY,OAAO,MAAM,gBAAgB,MAAM,KAAK,aAAa,OAAO;mBACvF,MAAM,KAAK,WAAW,UAAU,GAAG;qBACjC,MAAM,KAAK,WAAW,WAAW;eACvC,MAAM,KAAK,OAAO,KAAK,QAAQ;0BACpB,WAAW,MAAM,KAAK,OAAO,WAAW,WAAW,MAAM,KAAK,OAAO,WAAW,QAAQ;;;;;;;wBAO1F,WAAW,MAAM,KAAK,OAAO,MAAM,OAAO,MAAM,KAAK,OAAO,QAAQ,KAAK;gCACjE,WAAW,GAAG,MAAM,KAAK,OAAO,MAAM,KAAK,MAAM,GAAG,MAAM,KAAK,OAAO,QAAQ,KAAK,IAAI;;;;;;;;;wBAS/F,WAAW,MAAM,KAAK,OAAO,MAAM,OAAO,MAAM,KAAK,OAAO,QAAQ,KAAK;;;;iBAIhF,MAAM,KAAK,OAAO,KAAK,UAAU;;;;CAK9C,MAAMC,aAAqB,mBAAG;sBACZ,MAAM,KAAK,OAAO,MAAM,KAAK;;;wBAG3B,MAAM,KAAK,OAAO,MAAM,KAAK;gCACrB,MAAM,KAAK,OAAO,MAAM,KAAK;;;;wBAIrC,MAAM,KAAK,OAAO,MAAM,KAAK;;;CAIjD,MAAMC,gBAAwB,mBAAG;0BACX,MAAM,KAAK,OAAO,WAAW,SAAS;;;;CAK5D,MAAMC,OAAe,mBAAG;;;;gBAIZ,WAAW,gBAAgB,UAAU;sBAC/B,MAAM,KAAK,QAAQ,KAAK;;;;eAI/B,MAAM,KAAK,OAAO,KAAK,UAAU;iBAC/B,WAAW,KAAM,EAAE;;;;;;;;iBAQnB,MAAM,KAAK,OAAO,KAAK,QAAQ;;;;6BAInB,MAAM,KAAK,OAAO,QAAQ,KAAK;;;;CAKxD,MAAMC,YAAoB,mBAAG;QACzB,KAAK;4BACe,MAAM,KAAK,QAAQ,KAAK;;CAGhD,MAAMC,UAAkB,mBAAG;QACvB,KAAK;+BACkB,MAAM,KAAK,QAAQ,KAAK,KAAK,kBAAkB,MAAM,EAAE;;AAYlF,QAAO;EACL,cAV2B,mBAAG;;;;;;0BAMV,MAAM,KAAK,QAAQ,KAAK;;EAK5C;EACA;EACA;EACA;EACA;EACA;EACA;EACD;GACA;CAAC;CAAO;CAAa;CAAU;CAAU;CAAc;CAAY;CAAgB,CAAC;AAEzF,+BAAe"}
@@ -6,6 +6,8 @@ const require_FormControl = require('../FormControl/FormControl.cjs');
6
6
  const require_InputLabel = require('../InputLabel/InputLabel.cjs');
7
7
  let __thunderid_browser = require("@thunderid/browser");
8
8
  __thunderid_browser = require_rolldown_runtime.__toESM(__thunderid_browser);
9
+ let react = require("react");
10
+ react = require_rolldown_runtime.__toESM(react);
9
11
  let react_jsx_runtime = require("react/jsx-runtime");
10
12
  react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
11
13
 
@@ -23,10 +25,15 @@ react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
23
25
  const Toggle = ({ label, error, className, required, helperText, style = {},...rest }) => {
24
26
  const { theme, colorScheme } = require_useTheme.default();
25
27
  const hasError = !!error;
28
+ const generatedId = (0, react.useId)();
29
+ const inputId = rest.id ?? generatedId;
30
+ const helperTextId = error || helperText ? `${inputId}-helper-text` : void 0;
31
+ const describedBy = [rest["aria-describedby"], helperTextId].filter(Boolean).join(" ") || void 0;
26
32
  const styles = require_Toggle_styles.default(theme, colorScheme, hasError, !!required);
27
33
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_FormControl.default, {
28
34
  error,
29
35
  helperText,
36
+ helperTextId,
30
37
  className: require_emotion.cx((0, __thunderid_browser.withVendorCSSClassPrefix)((0, __thunderid_browser.bem)("toggle")), className),
31
38
  helperTextMarginLeft: `calc(${theme.vars.spacing.unit} * 5.5)`,
32
39
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
@@ -39,7 +46,9 @@ const Toggle = ({ label, error, className, required, helperText, style = {},...r
39
46
  className: require_emotion.cx((0, __thunderid_browser.withVendorCSSClassPrefix)((0, __thunderid_browser.bem)("toggle", "input")), styles["input"]),
40
47
  "aria-invalid": hasError,
41
48
  "aria-required": required,
42
- ...rest
49
+ ...rest,
50
+ id: inputId,
51
+ "aria-describedby": describedBy
43
52
  }),
44
53
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
45
54
  className: require_emotion.cx((0, __thunderid_browser.withVendorCSSClassPrefix)((0, __thunderid_browser.bem)("toggle", "track")), styles["track"]),
@@ -1 +1 @@
1
- {"version":3,"file":"Toggle.cjs","names":["Toggle: FC<ToggleProps>","useTheme","styles: Record<string, string>","useStyles","FormControl","cx","InputLabel"],"sources":["../../../../../src/components/primitives/Toggle/Toggle.tsx"],"sourcesContent":["// Copyright 2026 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {withVendorCSSClassPrefix, bem} from '@thunderid/browser';\nimport {FC, InputHTMLAttributes} from 'react';\nimport useStyles from './Toggle.styles';\nimport useTheme from '../../../contexts/Theme/useTheme';\nimport {cx} from '../../../styles/emotion';\nimport FormControl from '../FormControl/FormControl';\nimport InputLabel from '../InputLabel/InputLabel';\n\n/**\n * Props for the Toggle component.\n */\nexport interface ToggleProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'className' | 'type'> {\n className?: string;\n error?: string;\n helperText?: string;\n label?: string;\n required?: boolean;\n}\n\n/**\n * A Toggle component that represents a boolean input. It is built on top of a hidden checkbox input\n * and styled to look like a switch.\n *\n * The component is wrapped in a FormControl to display error messages and helper text.\n * The label is associated with the input for accessibility.\n *\n * @param props - Props for the Toggle component\n * @returns A JSX element representing the Toggle\n */\nconst Toggle: FC<ToggleProps> = ({label, error, className, required, helperText, style = {}, ...rest}: ToggleProps) => {\n const {theme, colorScheme}: ReturnType<typeof useTheme> = useTheme();\n const hasError = !!error;\n const styles: Record<string, string> = useStyles(theme, colorScheme, hasError, !!required);\n\n return (\n <FormControl\n error={error}\n helperText={helperText}\n className={cx(withVendorCSSClassPrefix(bem('toggle')), className)}\n helperTextMarginLeft={`calc(${theme.vars.spacing.unit} * 5.5)`}\n >\n <label style={style} className={cx(withVendorCSSClassPrefix(bem('toggle', 'container')), styles['container'])}>\n <input\n type=\"checkbox\"\n role=\"switch\"\n className={cx(withVendorCSSClassPrefix(bem('toggle', 'input')), styles['input'])}\n aria-invalid={hasError}\n aria-required={required}\n {...rest}\n />\n <div className={cx(withVendorCSSClassPrefix(bem('toggle', 'track')), styles['track'])}>\n <span className={cx(withVendorCSSClassPrefix(bem('toggle', 'thumb')), styles['thumb'])} />\n </div>\n {label && (\n <InputLabel\n required={required}\n error={hasError}\n variant=\"inline\"\n className={cx(withVendorCSSClassPrefix(bem('toggle', 'label')), styles['label'], styles['errorLabel'], {\n [withVendorCSSClassPrefix(bem('toggle', 'label', 'error'))]: hasError,\n })}\n >\n {label}\n </InputLabel>\n )}\n </label>\n </FormControl>\n );\n};\n\nexport default Toggle;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAgCA,MAAMA,UAA2B,EAAC,OAAO,OAAO,WAAW,UAAU,YAAY,QAAQ,EAAE,CAAE,GAAG,WAAuB;CACrH,MAAM,EAAC,OAAO,gBAA4CC,0BAAU;CACpE,MAAM,WAAW,CAAC,CAAC;CACnB,MAAMC,SAAiCC,8BAAU,OAAO,aAAa,UAAU,CAAC,CAAC,SAAS;AAE1F,QACE,2CAACC;EACQ;EACK;EACZ,WAAWC,kGAAgC,SAAS,CAAC,EAAE,UAAU;EACjE,sBAAsB,QAAQ,MAAM,KAAK,QAAQ,KAAK;YAEtD,4CAAC;GAAa;GAAO,WAAWA,kGAAgC,UAAU,YAAY,CAAC,EAAE,OAAO,aAAa;;IAC3G,2CAAC;KACC,MAAK;KACL,MAAK;KACL,WAAWA,kGAAgC,UAAU,QAAQ,CAAC,EAAE,OAAO,SAAS;KAChF,gBAAc;KACd,iBAAe;KACf,GAAI;MACJ;IACF,2CAAC;KAAI,WAAWA,kGAAgC,UAAU,QAAQ,CAAC,EAAE,OAAO,SAAS;eACnF,2CAAC,UAAK,WAAWA,kGAAgC,UAAU,QAAQ,CAAC,EAAE,OAAO,SAAS,GAAI;MACtF;IACL,SACC,2CAACC;KACW;KACV,OAAO;KACP,SAAQ;KACR,WAAWD,kGAAgC,UAAU,QAAQ,CAAC,EAAE,OAAO,UAAU,OAAO,eAAe,kFACvE,UAAU,SAAS,QAAQ,CAAC,GAAG,UAC9D,CAAC;eAED;MACU;;IAET;GACI;;AAIlB,qBAAe"}
1
+ {"version":3,"file":"Toggle.cjs","names":["Toggle: FC<ToggleProps>","useTheme","generatedId: string","inputId: string","helperTextId: string | undefined","describedBy: string | undefined","styles: Record<string, string>","useStyles","FormControl","cx","InputLabel"],"sources":["../../../../../src/components/primitives/Toggle/Toggle.tsx"],"sourcesContent":["// Copyright 2026 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {withVendorCSSClassPrefix, bem} from '@thunderid/browser';\nimport {FC, InputHTMLAttributes, useId} from 'react';\nimport useStyles from './Toggle.styles';\nimport useTheme from '../../../contexts/Theme/useTheme';\nimport {cx} from '../../../styles/emotion';\nimport FormControl from '../FormControl/FormControl';\nimport InputLabel from '../InputLabel/InputLabel';\n\n/**\n * Props for the Toggle component.\n */\nexport interface ToggleProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'className' | 'type'> {\n className?: string;\n error?: string;\n helperText?: string;\n label?: string;\n required?: boolean;\n}\n\n/**\n * A Toggle component that represents a boolean input. It is built on top of a hidden checkbox input\n * and styled to look like a switch.\n *\n * The component is wrapped in a FormControl to display error messages and helper text.\n * The label is associated with the input for accessibility.\n *\n * @param props - Props for the Toggle component\n * @returns A JSX element representing the Toggle\n */\nconst Toggle: FC<ToggleProps> = ({label, error, className, required, helperText, style = {}, ...rest}: ToggleProps) => {\n const {theme, colorScheme}: ReturnType<typeof useTheme> = useTheme();\n const hasError = !!error;\n const generatedId: string = useId();\n const inputId: string = rest.id ?? generatedId;\n const helperTextId: string | undefined = error || helperText ? `${inputId}-helper-text` : undefined;\n const describedBy: string | undefined =\n [rest['aria-describedby'], helperTextId].filter(Boolean).join(' ') || undefined;\n const styles: Record<string, string> = useStyles(theme, colorScheme, hasError, !!required);\n\n return (\n <FormControl\n error={error}\n helperText={helperText}\n helperTextId={helperTextId}\n className={cx(withVendorCSSClassPrefix(bem('toggle')), className)}\n helperTextMarginLeft={`calc(${theme.vars.spacing.unit} * 5.5)`}\n >\n <label style={style} className={cx(withVendorCSSClassPrefix(bem('toggle', 'container')), styles['container'])}>\n <input\n type=\"checkbox\"\n role=\"switch\"\n className={cx(withVendorCSSClassPrefix(bem('toggle', 'input')), styles['input'])}\n aria-invalid={hasError}\n aria-required={required}\n {...rest}\n id={inputId}\n aria-describedby={describedBy}\n />\n <div className={cx(withVendorCSSClassPrefix(bem('toggle', 'track')), styles['track'])}>\n <span className={cx(withVendorCSSClassPrefix(bem('toggle', 'thumb')), styles['thumb'])} />\n </div>\n {label && (\n <InputLabel\n required={required}\n error={hasError}\n variant=\"inline\"\n className={cx(withVendorCSSClassPrefix(bem('toggle', 'label')), styles['label'], styles['errorLabel'], {\n [withVendorCSSClassPrefix(bem('toggle', 'label', 'error'))]: hasError,\n })}\n >\n {label}\n </InputLabel>\n )}\n </label>\n </FormControl>\n );\n};\n\nexport default Toggle;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAgCA,MAAMA,UAA2B,EAAC,OAAO,OAAO,WAAW,UAAU,YAAY,QAAQ,EAAE,CAAE,GAAG,WAAuB;CACrH,MAAM,EAAC,OAAO,gBAA4CC,0BAAU;CACpE,MAAM,WAAW,CAAC,CAAC;CACnB,MAAMC,gCAA6B;CACnC,MAAMC,UAAkB,KAAK,MAAM;CACnC,MAAMC,eAAmC,SAAS,aAAa,GAAG,QAAQ,gBAAgB;CAC1F,MAAMC,cACJ,CAAC,KAAK,qBAAqB,aAAa,CAAC,OAAO,QAAQ,CAAC,KAAK,IAAI,IAAI;CACxE,MAAMC,SAAiCC,8BAAU,OAAO,aAAa,UAAU,CAAC,CAAC,SAAS;AAE1F,QACE,2CAACC;EACQ;EACK;EACE;EACd,WAAWC,kGAAgC,SAAS,CAAC,EAAE,UAAU;EACjE,sBAAsB,QAAQ,MAAM,KAAK,QAAQ,KAAK;YAEtD,4CAAC;GAAa;GAAO,WAAWA,kGAAgC,UAAU,YAAY,CAAC,EAAE,OAAO,aAAa;;IAC3G,2CAAC;KACC,MAAK;KACL,MAAK;KACL,WAAWA,kGAAgC,UAAU,QAAQ,CAAC,EAAE,OAAO,SAAS;KAChF,gBAAc;KACd,iBAAe;KACf,GAAI;KACJ,IAAI;KACJ,oBAAkB;MAClB;IACF,2CAAC;KAAI,WAAWA,kGAAgC,UAAU,QAAQ,CAAC,EAAE,OAAO,SAAS;eACnF,2CAAC,UAAK,WAAWA,kGAAgC,UAAU,QAAQ,CAAC,EAAE,OAAO,SAAS,GAAI;MACtF;IACL,SACC,2CAACC;KACW;KACV,OAAO;KACP,SAAQ;KACR,WAAWD,kGAAgC,UAAU,QAAQ,CAAC,EAAE,OAAO,UAAU,OAAO,eAAe,kFACvE,UAAU,SAAS,QAAQ,CAAC,GAAG,UAC9D,CAAC;eAED;MACU;;IAET;GACI;;AAIlB,qBAAe"}
@@ -0,0 +1,33 @@
1
+ const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
2
+ const require_ResourceSelect = require('../Select/ResourceSelect.cjs');
3
+ let __thunderid_browser = require("@thunderid/browser");
4
+ __thunderid_browser = require_rolldown_runtime.__toESM(__thunderid_browser);
5
+ let react_jsx_runtime = require("react/jsx-runtime");
6
+ react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
7
+
8
+ //#region src/components/primitives/UserSelect/BaseUserSelect.tsx
9
+ const USER_DEFAULTS = { labelAttributes: __thunderid_browser.UserSelectConstants.LABEL_ATTRIBUTES };
10
+ /**
11
+ * Single-user picker: a `Select` that loads from the given `fetchUsers`, submitting the user's ID and
12
+ * labelling each user from `display`, `username`, or `email` unless `mapping` says otherwise.
13
+ * Building block for {@link UserSelect}; for a custom data source use `Select` with `useInfiniteOptions`.
14
+ */
15
+ const BaseUserSelect = ({ fetchUsers, mapping,...rest }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ResourceSelect.default, {
16
+ ...rest,
17
+ bemBlock: "user-select",
18
+ defaults: USER_DEFAULTS,
19
+ fallbackMessages: {
20
+ ariaLabel: "Select a user",
21
+ empty: "No users found."
22
+ },
23
+ fetchPage: fetchUsers,
24
+ mapping,
25
+ messageKey: "user_select",
26
+ resource: "users",
27
+ type: __thunderid_browser.EmbeddedFlowComponentType.UserSelect
28
+ });
29
+ var BaseUserSelect_default = BaseUserSelect;
30
+
31
+ //#endregion
32
+ exports.default = BaseUserSelect_default;
33
+ //# sourceMappingURL=BaseUserSelect.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseUserSelect.cjs","names":["USER_DEFAULTS: SelectOptionDefaults","UserSelectConstants","BaseUserSelect: FC<BaseUserSelectProps>","ResourceSelect","EmbeddedFlowComponentType"],"sources":["../../../../../src/components/primitives/UserSelect/BaseUserSelect.tsx"],"sourcesContent":["// Copyright 2026 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {EmbeddedFlowComponentType, UserSelectConstants} from '@thunderid/browser';\nimport type {FetchUsers, SelectOptionDefaults, UserSelectOptionMapping} from '@thunderid/browser';\nimport {FC} from 'react';\nimport ResourceSelect, {ResourceSelectProps} from '../Select/ResourceSelect';\n\nexport interface BaseUserSelectProps\n extends Omit<\n ResourceSelectProps,\n 'bemBlock' | 'defaults' | 'fallbackMessages' | 'fetchPage' | 'mapping' | 'messageKey' | 'resource' | 'type'\n > {\n fetchUsers?: FetchUsers;\n mapping?: UserSelectOptionMapping;\n}\n\nconst USER_DEFAULTS: SelectOptionDefaults = {labelAttributes: UserSelectConstants.LABEL_ATTRIBUTES};\n\n/**\n * Single-user picker: a `Select` that loads from the given `fetchUsers`, submitting the user's ID and\n * labelling each user from `display`, `username`, or `email` unless `mapping` says otherwise.\n * Building block for {@link UserSelect}; for a custom data source use `Select` with `useInfiniteOptions`.\n */\nconst BaseUserSelect: FC<BaseUserSelectProps> = ({fetchUsers, mapping, ...rest}: BaseUserSelectProps) => (\n <ResourceSelect\n {...rest}\n bemBlock=\"user-select\"\n defaults={USER_DEFAULTS}\n fallbackMessages={{ariaLabel: 'Select a user', empty: 'No users found.'}}\n fetchPage={fetchUsers}\n mapping={mapping}\n messageKey=\"user_select\"\n resource=\"users\"\n type={EmbeddedFlowComponentType.UserSelect}\n />\n);\n\nexport default BaseUserSelect;\n"],"mappings":";;;;;;;;AAiBA,MAAMA,gBAAsC,EAAC,iBAAiBC,wCAAoB,kBAAiB;;;;;;AAOnG,MAAMC,kBAA2C,EAAC,YAAY,QAAS,GAAG,WACxE,2CAACC;CACC,GAAI;CACJ,UAAS;CACT,UAAU;CACV,kBAAkB;EAAC,WAAW;EAAiB,OAAO;EAAkB;CACxE,WAAW;CACF;CACT,YAAW;CACX,UAAS;CACT,MAAMC,8CAA0B;EAChC;AAGJ,6BAAe"}
@@ -0,0 +1,21 @@
1
+ const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
2
+ const require_useFetchUsers = require('../../../hooks/useFetchUsers.cjs');
3
+ const require_BaseUserSelect = require('./BaseUserSelect.cjs');
4
+ let react_jsx_runtime = require("react/jsx-runtime");
5
+ react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
6
+
7
+ //#region src/components/primitives/UserSelect/UserSelect.tsx
8
+ /**
9
+ * Single-user picker for signed-in screens. It loads the user directory itself with the signed-in
10
+ * user's access token and submits the chosen user's ID, so it takes no data source. For any other
11
+ * data source use {@link Select} with {@link useInfiniteOptions}.
12
+ */
13
+ const UserSelect = (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_BaseUserSelect.default, {
14
+ ...props,
15
+ fetchUsers: require_useFetchUsers.default()
16
+ });
17
+ var UserSelect_default = UserSelect;
18
+
19
+ //#endregion
20
+ exports.default = UserSelect_default;
21
+ //# sourceMappingURL=UserSelect.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UserSelect.cjs","names":["UserSelect: FC<UserSelectProps>","BaseUserSelect","useFetchUsers"],"sources":["../../../../../src/components/primitives/UserSelect/UserSelect.tsx"],"sourcesContent":["// Copyright 2026 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {FC} from 'react';\nimport BaseUserSelect, {BaseUserSelectProps} from './BaseUserSelect';\nimport useFetchUsers from '../../../hooks/useFetchUsers';\n\nexport type UserSelectProps = Omit<BaseUserSelectProps, 'fetchUsers'>;\n\n/**\n * Single-user picker for signed-in screens. It loads the user directory itself with the signed-in\n * user's access token and submits the chosen user's ID, so it takes no data source. For any other\n * data source use {@link Select} with {@link useInfiniteOptions}.\n */\nconst UserSelect: FC<UserSelectProps> = (props: UserSelectProps) => (\n <BaseUserSelect {...props} fetchUsers={useFetchUsers()} />\n);\n\nexport default UserSelect;\n"],"mappings":";;;;;;;;;;;;AAcA,MAAMA,cAAmC,UACvC,2CAACC;CAAe,GAAI;CAAO,YAAYC,+BAAe;EAAI;AAG5D,yBAAe"}