libmodulor 0.16.0 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (170) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +1 -1
  3. package/dist/esm/app/workers/AppSrcFilePathBuilder.js +1 -1
  4. package/dist/esm/apps/Helper/src/lib/project.js +6 -6
  5. package/dist/esm/apps/Helper/src/ucds/CreateProjectUCD.js +1 -1
  6. package/dist/esm/dt/DataType.d.ts +9 -9
  7. package/dist/esm/dt/base/TBase.d.ts +1 -1
  8. package/dist/esm/dt/base/TBoolean.d.ts +1 -1
  9. package/dist/esm/dt/base/TInt.d.ts +1 -1
  10. package/dist/esm/dt/base/TNumber.d.ts +1 -1
  11. package/dist/esm/dt/final/TDateISO8601.d.ts +1 -1
  12. package/dist/esm/dt/final/TEmail.js +1 -1
  13. package/dist/esm/dt/final/TFile.d.ts +1 -1
  14. package/dist/esm/dt/final/TGeolocation.d.ts +1 -1
  15. package/dist/esm/dt/final/TJSONString.d.ts +1 -1
  16. package/dist/esm/dt/final/TJSONString.js +1 -1
  17. package/dist/esm/dt/final/TJWT.d.ts +1 -1
  18. package/dist/esm/dt/final/TJWT.js +1 -1
  19. package/dist/esm/dt/final/TURL.d.ts +1 -1
  20. package/dist/esm/dt/final/TURL.js +1 -1
  21. package/dist/esm/dt/index.d.ts +16 -16
  22. package/dist/esm/dt/index.js +8 -8
  23. package/dist/esm/i18n/locales/en.js +2 -2
  24. package/dist/esm/i18n/locales/fr.js +3 -3
  25. package/dist/esm/index.d.ts +2 -2
  26. package/dist/esm/index.js +2 -2
  27. package/dist/esm/index.react.d.ts +4 -3
  28. package/dist/esm/index.react.js +2 -1
  29. package/dist/esm/index.rn.d.ts +1 -0
  30. package/dist/esm/index.rn.js +1 -0
  31. package/dist/esm/index.web.d.ts +1 -1
  32. package/dist/esm/index.web.js +1 -1
  33. package/dist/esm/std/HTTPAPICallExecutor.d.ts +2 -5
  34. package/dist/esm/std/HTTPAPICaller.d.ts +6 -0
  35. package/dist/esm/std/consts.d.ts +1 -1
  36. package/dist/esm/std/impl/JoseJWTManager.js +1 -1
  37. package/dist/esm/std/impl/MistralAILLMManager.js +2 -2
  38. package/dist/esm/std/impl/NodeCryptoManager.d.ts +1 -1
  39. package/dist/esm/std/impl/NodeEnvironmentManager.js +1 -1
  40. package/dist/esm/std/impl/NodeFSManager.js +1 -1
  41. package/dist/esm/std/impl/OllamaLLMManager.js +1 -1
  42. package/dist/esm/std/impl/OpenAILLMManager.js +2 -2
  43. package/dist/esm/std/impl/SimpleHTTPAPICaller.js +2 -2
  44. package/dist/esm/std/impl/WebCryptoManager.d.ts +1 -1
  45. package/dist/esm/std/index.d.ts +3 -3
  46. package/dist/esm/std/index.js +3 -3
  47. package/dist/esm/target/lib/cli/CommandExecutor.js +2 -2
  48. package/dist/esm/target/lib/react/DIContextProvider.d.ts +3 -5
  49. package/dist/esm/target/lib/react/DIContextProvider.js +4 -3
  50. package/dist/esm/target/lib/react/StyleContextProvider.d.ts +32 -0
  51. package/dist/esm/target/lib/react/StyleContextProvider.js +17 -0
  52. package/dist/esm/target/lib/react/UCContainer.js +4 -3
  53. package/dist/esm/target/lib/react/UCEntrypoint.d.ts +2 -2
  54. package/dist/esm/target/lib/react/UCEntrypoint.js +3 -3
  55. package/dist/esm/target/lib/react/UCOutputFieldValueFragment.d.ts +5 -6
  56. package/dist/esm/target/lib/react/UCOutputFieldValueFragment.js +4 -4
  57. package/dist/esm/target/lib/react/UCPanel.js +15 -21
  58. package/dist/esm/target/lib/react/entrypoint.d.ts +1 -1
  59. package/dist/esm/target/lib/react/form.d.ts +10 -11
  60. package/dist/esm/target/lib/react/form.js +4 -0
  61. package/dist/esm/target/lib/react/touchable.d.ts +2 -3
  62. package/dist/esm/target/lib/react/useAction.d.ts +1 -1
  63. package/dist/esm/target/lib/react/useAction.js +11 -13
  64. package/dist/esm/target/lib/rn/input.d.ts +2 -2
  65. package/dist/esm/target/lib/rn/input.js +3 -3
  66. package/dist/esm/target/lib/server/RequestChecker.js +1 -1
  67. package/dist/esm/target/lib/server/ServerRequestHandler.js +3 -3
  68. package/dist/esm/target/lib/web/input.d.ts +2 -3
  69. package/dist/esm/target/lib/web/input.js +3 -4
  70. package/dist/esm/target/node-core-cli/NodeCoreCLIManager.js +1 -1
  71. package/dist/esm/target/node-core-cli/commands.js +1 -1
  72. package/dist/esm/target/node-express-server/NodeExpressServerManager.js +1 -1
  73. package/dist/esm/target/node-hono-server/NodeHonoServerManager.js +1 -1
  74. package/dist/esm/target/node-mcp-server/NodeLocalStdioMCPServerManager.js +2 -2
  75. package/dist/esm/target/node-mcp-server/funcs.js +1 -1
  76. package/dist/esm/target/react-native-pure/UCAutoExecLoader.d.ts +1 -1
  77. package/dist/esm/target/react-native-pure/UCAutoExecLoader.js +4 -2
  78. package/dist/esm/target/react-native-pure/UCEntrypointTouchable.d.ts +1 -1
  79. package/dist/esm/target/react-native-pure/UCEntrypointTouchable.js +4 -3
  80. package/dist/esm/target/react-native-pure/UCExecTouchable.d.ts +1 -1
  81. package/dist/esm/target/react-native-pure/UCExecTouchable.js +4 -3
  82. package/dist/esm/target/react-native-pure/UCForm.d.ts +1 -1
  83. package/dist/esm/target/react-native-pure/UCForm.js +4 -5
  84. package/dist/esm/target/react-native-pure/UCFormField.js +6 -6
  85. package/dist/esm/target/react-native-pure/UCFormFieldControl.d.ts +2 -2
  86. package/dist/esm/target/react-native-pure/UCFormFieldControl.js +63 -6
  87. package/dist/esm/target/react-native-pure/UCFormFieldDesc.d.ts +1 -1
  88. package/dist/esm/target/react-native-pure/UCFormFieldDesc.js +4 -2
  89. package/dist/esm/target/react-native-pure/UCFormFieldErr.d.ts +1 -1
  90. package/dist/esm/target/react-native-pure/UCFormFieldErr.js +4 -2
  91. package/dist/esm/target/react-native-pure/UCFormFieldLabel.d.ts +1 -1
  92. package/dist/esm/target/react-native-pure/UCFormFieldLabel.js +6 -2
  93. package/dist/esm/target/react-native-pure/UCFormSubmitControl.d.ts +1 -1
  94. package/dist/esm/target/react-native-pure/UCFormSubmitControl.js +4 -3
  95. package/dist/esm/target/react-native-pure/UCOutputFieldValue.d.ts +1 -1
  96. package/dist/esm/target/react-native-pure/UCOutputFieldValue.js +4 -3
  97. package/dist/esm/target/react-web-pure/UCAutoExecLoader.d.ts +1 -1
  98. package/dist/esm/target/react-web-pure/UCAutoExecLoader.js +4 -2
  99. package/dist/esm/target/react-web-pure/UCEntrypointTouchable.d.ts +2 -2
  100. package/dist/esm/target/react-web-pure/UCEntrypointTouchable.js +5 -3
  101. package/dist/esm/target/react-web-pure/UCExecTouchable.d.ts +2 -2
  102. package/dist/esm/target/react-web-pure/UCExecTouchable.js +5 -3
  103. package/dist/esm/target/react-web-pure/UCForm.d.ts +1 -1
  104. package/dist/esm/target/react-web-pure/UCForm.js +6 -5
  105. package/dist/esm/target/react-web-pure/UCFormField.d.ts +1 -1
  106. package/dist/esm/target/react-web-pure/UCFormField.js +6 -7
  107. package/dist/esm/target/react-web-pure/UCFormFieldControl.d.ts +3 -3
  108. package/dist/esm/target/react-web-pure/UCFormFieldControl.js +27 -8
  109. package/dist/esm/target/react-web-pure/UCFormFieldDesc.d.ts +2 -2
  110. package/dist/esm/target/react-web-pure/UCFormFieldDesc.js +5 -3
  111. package/dist/esm/target/react-web-pure/UCFormFieldErr.d.ts +2 -2
  112. package/dist/esm/target/react-web-pure/UCFormFieldErr.js +5 -3
  113. package/dist/esm/target/react-web-pure/UCFormFieldLabel.d.ts +2 -2
  114. package/dist/esm/target/react-web-pure/UCFormFieldLabel.js +7 -4
  115. package/dist/esm/target/react-web-pure/UCFormSubmitControl.d.ts +2 -2
  116. package/dist/esm/target/react-web-pure/UCFormSubmitControl.js +5 -3
  117. package/dist/esm/target/react-web-pure/UCOutputFieldValue.d.ts +2 -2
  118. package/dist/esm/target/react-web-pure/UCOutputFieldValue.js +5 -4
  119. package/dist/esm/testing/AppTester.d.ts +2 -2
  120. package/dist/esm/testing/AppTester.js +2 -2
  121. package/dist/esm/testing/UCDefASTParser.js +1 -1
  122. package/dist/esm/testing/impl/SimpleAppDocsEmitter.js +1 -1
  123. package/dist/esm/testing/impl/TypeScriptLibUCDefASTParser.d.ts +1 -1
  124. package/dist/esm/testing/impl/TypeScriptLibUCDefASTParser.js +2 -3
  125. package/dist/esm/testing/index.d.ts +6 -6
  126. package/dist/esm/testing/index.js +2 -2
  127. package/dist/esm/testing/uc-auth.js +1 -1
  128. package/dist/esm/testing/workers/AppTesterCtxInitializer.js +1 -1
  129. package/dist/esm/testing/workers/UCExecutor.js +1 -1
  130. package/dist/esm/testing/workers/checkers/UCDefSourcesChecker.d.ts +1 -1
  131. package/dist/esm/testing/workers/checkers/UCDefSourcesChecker.js +3 -3
  132. package/dist/esm/uc/UC.d.ts +2 -2
  133. package/dist/esm/uc/UC.js +2 -2
  134. package/dist/esm/uc/UCInputField.d.ts +1 -1
  135. package/dist/esm/uc/helpers/UCOutputReader.d.ts +3 -3
  136. package/dist/esm/uc/impl/HTTPUCTransporter.d.ts +1 -1
  137. package/dist/esm/uc/impl/HTTPUCTransporter.js +3 -4
  138. package/dist/esm/uc/impl/InMemoryUCDataStore.d.ts +1 -1
  139. package/dist/esm/uc/impl/KnexUCDataStore.d.ts +1 -1
  140. package/dist/esm/uc/impl/RNUCClientConfirmManager.d.ts +10 -0
  141. package/dist/esm/uc/impl/RNUCClientConfirmManager.js +44 -0
  142. package/dist/esm/uc/impl/SimpleUCManager.d.ts +2 -2
  143. package/dist/esm/uc/index.d.ts +30 -30
  144. package/dist/esm/uc/index.js +30 -30
  145. package/dist/esm/uc/io/input/AggregateInput.d.ts +1 -1
  146. package/dist/esm/uc/io/input/ListInput.d.ts +1 -1
  147. package/dist/esm/uc/main.d.ts +1 -1
  148. package/dist/esm/uc/manager.d.ts +2 -2
  149. package/dist/esm/uc/output-part.d.ts +1 -1
  150. package/dist/esm/uc/policy.d.ts +1 -1
  151. package/dist/esm/uc/transporter.d.ts +1 -1
  152. package/dist/esm/uc/utils/appendUCInputToURL.d.ts +1 -1
  153. package/dist/esm/uc/utils/fmtVal.d.ts +1 -1
  154. package/dist/esm/uc/utils/rInput.d.ts +1 -1
  155. package/dist/esm/uc/utils/recIs.d.ts +1 -1
  156. package/dist/esm/uc/utils/ucHTTPContract.d.ts +1 -1
  157. package/dist/esm/uc/utils/ucMountingPoint.d.ts +1 -1
  158. package/dist/esm/uc/workers/SimpleAggregateFinder.d.ts +1 -1
  159. package/dist/esm/uc/workers/SimpleAggregateOwnershipChecker.d.ts +2 -2
  160. package/dist/esm/uc/workers/UCBuilder.d.ts +1 -1
  161. package/dist/esm/uc/workers/UCExecChecker.d.ts +1 -1
  162. package/dist/esm/uc/workers/UCInputFilesProcessor.d.ts +1 -1
  163. package/dist/esm/uc/workers/UCInputValidator.d.ts +1 -1
  164. package/dist/esm/utils/index.d.ts +1 -1
  165. package/dist/esm/utils/ioc/bindNodeCore.js +1 -1
  166. package/dist/esm/utils/ioc/bindRN.js +5 -0
  167. package/dist/esm/utils/numbers/fmt.js +1 -1
  168. package/package.json +8 -8
  169. package/pnpm-workspace.yaml +5 -4
  170. package/tsconfig.json +36 -0
@@ -1,4 +1,4 @@
1
- import { ucMountingPoint, ucifIsMandatory } from '../../uc/index.js';
1
+ import { ucifIsMandatory, ucMountingPoint } from '../../uc/index.js';
2
2
  import { fmtBold, fmtCommand, fmtPadEndFor, fmtSection, } from '../../utils/index.js';
3
3
  import { print } from '../lib/cli/renderer.js';
4
4
  const FLAG_PREFIX = '--';
@@ -16,10 +16,10 @@ import cookieParser from 'cookie-parser';
16
16
  import express, {} from 'express';
17
17
  import fileUpload from 'express-fileupload';
18
18
  import { inject, injectable } from 'inversify';
19
- import { stop } from '../lib/server-node/stop.js';
20
19
  import { EntrypointsBuilder } from '../lib/server/EntrypointsBuilder.js';
21
20
  import { ServerRequestHandler, } from '../lib/server/ServerRequestHandler.js';
22
21
  import { ServerSSLCertLoader } from '../lib/server/ServerSSLCertLoader.js';
22
+ import { stop } from '../lib/server-node/stop.js';
23
23
  import { HelmetMiddlewareBuilder } from './middlewares/HelmetMiddlewareBuilder.js';
24
24
  let NodeExpressServerManager = class NodeExpressServerManager {
25
25
  entrypointsBuilder;
@@ -20,10 +20,10 @@ import { logger } from 'hono/logger';
20
20
  import { secureHeaders } from 'hono/secure-headers';
21
21
  import { inject, injectable } from 'inversify';
22
22
  import { fromFormData } from '../../utils/index.js';
23
- import { stop } from '../lib/server-node/stop.js';
24
23
  import { EntrypointsBuilder } from '../lib/server/EntrypointsBuilder.js';
25
24
  import { ServerRequestHandler, } from '../lib/server/ServerRequestHandler.js';
26
25
  import { ServerSSLCertLoader } from '../lib/server/ServerSSLCertLoader.js';
26
+ import { stop } from '../lib/server-node/stop.js';
27
27
  let NodeHonoServerManager = class NodeHonoServerManager {
28
28
  entrypointsBuilder;
29
29
  environmentManager;
@@ -15,7 +15,7 @@ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'
15
15
  import { CallToolRequestSchema, ListToolsRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
16
16
  import { inject, injectable } from 'inversify';
17
17
  import { WordingManager } from '../../i18n/index.js';
18
- import { UCBuilder, ucMountingPoint, ucifIsMandatory, } from '../../uc/index.js';
18
+ import { UCBuilder, ucifIsMandatory, ucMountingPoint, } from '../../uc/index.js';
19
19
  import { propertyType, resError, resObj } from './funcs.js';
20
20
  /**
21
21
  * A simple MCP Server implementation
@@ -82,7 +82,7 @@ let NodeLocalStdioMCPServerManager = class NodeLocalStdioMCPServerManager {
82
82
  }
83
83
  const inputSchema = this.buildInputSchema(uc);
84
84
  const mountingPoint = uc.def.ext?.cmd?.mountAt ?? ucMountingPoint(uc);
85
- const tool = { name: mountingPoint, inputSchema };
85
+ const tool = { inputSchema, name: mountingPoint };
86
86
  this.tools.set(mountingPoint, { appName: appManifest.name, tool, ucd });
87
87
  }
88
88
  async mountStaticDir(_dirPath) {
@@ -24,13 +24,13 @@ export function propertyType(def) {
24
24
  }
25
25
  export function resError(err) {
26
26
  return {
27
- isError: true,
28
27
  content: [
29
28
  {
30
29
  text: err.message,
31
30
  type: 'text',
32
31
  },
33
32
  ],
33
+ isError: true,
34
34
  };
35
35
  }
36
36
  export function resObj(obj) {
@@ -1,2 +1,2 @@
1
- import { type ReactElement } from 'react';
1
+ import type { ReactElement } from 'react';
2
2
  export declare function UCAutoExecLoader(): ReactElement;
@@ -1,5 +1,7 @@
1
- import React, {} from 'react';
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { ActivityIndicator } from 'react-native';
3
+ import { useStyleContext } from '../lib/react/StyleContextProvider.js';
3
4
  export function UCAutoExecLoader() {
4
- return React.createElement(ActivityIndicator, null);
5
+ const { autoExecLoader } = useStyleContext();
6
+ return _jsx(ActivityIndicator, { style: autoExecLoader?.style });
5
7
  }
@@ -1,4 +1,4 @@
1
- import { type ReactElement } from 'react';
1
+ import type { ReactElement } from 'react';
2
2
  import type { UCInput, UCOPIBase } from '../../uc/index.js';
3
3
  import type { UCEntrypointTouchableProps } from '../lib/react/touchable.js';
4
4
  export declare function UCEntrypointTouchable<I extends UCInput | undefined = undefined, OPI0 extends UCOPIBase | undefined = undefined, OPI1 extends UCOPIBase | undefined = undefined>({ onPress, wording, }: UCEntrypointTouchableProps<I, OPI0, OPI1>): ReactElement;
@@ -1,6 +1,7 @@
1
- import React, {} from 'react';
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { Pressable, Text } from 'react-native';
3
+ import { useStyleContext } from '../lib/react/StyleContextProvider.js';
3
4
  export function UCEntrypointTouchable({ onPress, wording, }) {
4
- return (React.createElement(Pressable, { onPress: onPress },
5
- React.createElement(Text, null, wording.label)));
5
+ const { entrypointTouchable } = useStyleContext();
6
+ return (_jsx(Pressable, { onPress: onPress, children: _jsx(Text, { style: entrypointTouchable?.style, children: wording.label }) }));
6
7
  }
@@ -1,4 +1,4 @@
1
- import { type ReactElement } from 'react';
1
+ import type { ReactElement } from 'react';
2
2
  import type { UCInput, UCOPIBase } from '../../uc/index.js';
3
3
  import type { UCExecTouchableProps } from '../lib/react/touchable.js';
4
4
  export declare function UCExecTouchable<I extends UCInput | undefined = undefined, OPI0 extends UCOPIBase | undefined = undefined, OPI1 extends UCOPIBase | undefined = undefined>({ disabled, execState, onSubmit, uc, }: UCExecTouchableProps<I, OPI0, OPI1>): ReactElement;
@@ -1,9 +1,10 @@
1
- import React, {} from 'react';
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { Pressable, Text } from 'react-native';
3
3
  import { useDIContext } from '../lib/react/DIContextProvider.js';
4
+ import { useStyleContext } from '../lib/react/StyleContextProvider.js';
4
5
  export function UCExecTouchable({ disabled, execState, onSubmit, uc, }) {
5
6
  const { wordingManager } = useDIContext();
7
+ const { execTouchable } = useStyleContext();
6
8
  const label = wordingManager.ucISubmit(uc.def, execState);
7
- return (React.createElement(Pressable, { disabled: disabled, onPress: onSubmit },
8
- React.createElement(Text, null, label)));
9
+ return (_jsx(Pressable, { disabled: disabled, onPress: onSubmit, children: _jsx(Text, { style: execTouchable?.style, children: label }) }));
9
10
  }
@@ -1,4 +1,4 @@
1
- import { type ReactElement } from 'react';
1
+ import type { ReactElement } from 'react';
2
2
  import type { UCInput, UCOPIBase } from '../../uc/index.js';
3
3
  import type { UCFormProps } from '../lib/react/form.js';
4
4
  export declare function UCForm<I extends UCInput | undefined = undefined, OPI0 extends UCOPIBase | undefined = undefined, OPI1 extends UCOPIBase | undefined = undefined>({ disabled, execState, onChange, onSubmit, uc, }: UCFormProps<I, OPI0, OPI1>): ReactElement;
@@ -1,13 +1,12 @@
1
- import React, {} from 'react';
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { View } from 'react-native';
3
+ import { useStyleContext } from '../lib/react/StyleContextProvider.js';
3
4
  import { UCFormField } from './UCFormField.js';
4
5
  import { UCFormSubmitControl } from './UCFormSubmitControl.js';
5
6
  export function UCForm({ disabled, execState, onChange, onSubmit, uc, }) {
7
+ const { form } = useStyleContext();
6
8
  const onPress = async () => {
7
9
  await onSubmit();
8
10
  };
9
- return (React.createElement(View, null,
10
- uc.inputFieldsForForm().map((f) => (React.createElement(View, { key: f.key },
11
- React.createElement(UCFormField, { disabled: disabled, execState: execState, f: f, onChange: onChange })))),
12
- React.createElement(UCFormSubmitControl, { execState: execState, disabled: disabled, onPress: onPress, uc: uc })));
11
+ return (_jsxs(View, { style: form?.style, children: [uc.inputFieldsForForm().map((f) => (_jsx(UCFormField, { disabled: disabled, execState: execState, f: f, onChange: onChange }, f.key))), _jsx(UCFormSubmitControl, { disabled: disabled, execState: execState, onPress: onPress, uc: uc })] }));
13
12
  }
@@ -1,21 +1,21 @@
1
- import React, { useState } from 'react';
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from 'react';
3
+ import { View } from 'react-native';
2
4
  import { useDIContext } from '../lib/react/DIContextProvider.js';
3
5
  import { UC_FORM_FIELD_ELEMENTS, validateFormField, } from '../lib/react/form.js';
6
+ import { useStyleContext } from '../lib/react/StyleContextProvider.js';
4
7
  import { UCFormFieldControl } from './UCFormFieldControl.js';
5
8
  import { UCFormFieldDesc } from './UCFormFieldDesc.js';
6
9
  import { UCFormFieldErr } from './UCFormFieldErr.js';
7
10
  import { UCFormFieldLabel } from './UCFormFieldLabel.js';
8
11
  export function UCFormField({ disabled, execState, f, onChange: onChangeBase, only, }) {
9
12
  const { i18nManager } = useDIContext();
13
+ const { formField } = useStyleContext();
10
14
  const [errMsg, setErrMsg] = useState(null);
11
15
  const onChange = (f, op, v) => {
12
16
  setErrMsg(validateFormField(i18nManager, f, v));
13
17
  onChangeBase(f, op, v);
14
18
  };
15
19
  const elements = only ?? UC_FORM_FIELD_ELEMENTS;
16
- return (React.createElement(React.Fragment, null,
17
- elements.includes('label') && React.createElement(UCFormFieldLabel, { f: f }),
18
- elements.includes('control') && (React.createElement(UCFormFieldControl, { disabled: disabled, execState: execState, f: f, onChange: onChange })),
19
- elements.includes('err') && errMsg && (React.createElement(UCFormFieldErr, { errMsg: errMsg })),
20
- elements.includes('desc') && React.createElement(UCFormFieldDesc, { f: f })));
20
+ return (_jsxs(View, { style: formField?.style, children: [elements.includes('label') && _jsx(UCFormFieldLabel, { f: f }), elements.includes('control') && (_jsx(UCFormFieldControl, { disabled: disabled, execState: execState, f: f, onChange: onChange })), elements.includes('err') && errMsg && (_jsx(UCFormFieldErr, { errMsg: errMsg })), elements.includes('desc') && _jsx(UCFormFieldDesc, { f: f })] }));
21
21
  }
@@ -1,4 +1,4 @@
1
1
  import { type ReactElement } from 'react';
2
- import type { DataType } from '../../dt/index.js';
2
+ import { type DataType } from '../../dt/index.js';
3
3
  import type { UCFormFieldControlProps } from '../lib/react/form.js';
4
- export declare function UCFormFieldControl<T extends DataType>({ errMsg, execState, f, onChange: onChangeBase, }: UCFormFieldControlProps<T>): ReactElement;
4
+ export declare function UCFormFieldControl<T extends DataType>({ disabled, errMsg, execState, f, onChange: onChangeBase, }: UCFormFieldControlProps<T>): ReactElement;
@@ -1,16 +1,30 @@
1
- import React, { useEffect, useState } from 'react';
2
- import { TextInput } from 'react-native';
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useEffect, useState } from 'react';
3
+ import { FlatList, Pressable, StyleSheet, Switch, Text, TextInput, } from 'react-native';
4
+ import { TBoolean } from '../../dt/index.js';
3
5
  import { UCInputFieldChangeOperator, ucifRepeatability, } from '../../uc/index.js';
4
6
  import { isBlank } from '../../utils/index.js';
7
+ import { styleDef, useStyleContext, } from '../lib/react/StyleContextProvider.js';
5
8
  import { rnInputDef } from '../lib/rn/input.js';
6
9
  const MULTIPLE_VALUES_SEPARATOR = ',';
7
- export function UCFormFieldControl({ errMsg = null, execState, f, onChange: onChangeBase, }) {
10
+ // TODO : Split this into smaller components
11
+ export function UCFormFieldControl({ disabled, errMsg = null, execState, f, onChange: onChangeBase, }) {
12
+ const { colors, formFieldControl, renderFormFieldControl } = useStyleContext();
8
13
  const [internalValue, setInternalValue] = useState(f.getValue());
9
- // biome-ignore lint/correctness/useExhaustiveDependencies: false positive : It is actually necessary (only `field` does not trigger the effect)
14
+ // biome-ignore lint/correctness/useExhaustiveDependencies: false positive : It is actually necessary (only `f` does not trigger the effect)
10
15
  useEffect(() => {
11
16
  setInternalValue(f.getValue());
12
17
  }, [f.getValue()]);
13
- const attrs = rnInputDef(f, execState, errMsg);
18
+ const component = renderFormFieldControl?.({
19
+ disabled,
20
+ errMsg,
21
+ execState,
22
+ f,
23
+ onChange: onChangeBase,
24
+ });
25
+ if (component) {
26
+ return component;
27
+ }
14
28
  const onChangeText = (value) => {
15
29
  const [isRepeatable] = ucifRepeatability(f.def);
16
30
  if (isRepeatable && typeof value === 'string') {
@@ -24,6 +38,39 @@ export function UCFormFieldControl({ errMsg = null, execState, f, onChange: onCh
24
38
  }
25
39
  setInternalValue(value);
26
40
  };
41
+ const onSelect = (value) => {
42
+ if (internalValue === value) {
43
+ onChangeBase(f, UCInputFieldChangeOperator.RESET, null);
44
+ setInternalValue(null);
45
+ return;
46
+ }
47
+ onChangeBase(f, UCInputFieldChangeOperator.SET, value);
48
+ setInternalValue(value);
49
+ };
50
+ const onValueChange = (value) => {
51
+ onChangeBase(f, UCInputFieldChangeOperator.SET, value);
52
+ setInternalValue(value);
53
+ };
54
+ const attrs = rnInputDef(f, disabled, errMsg);
55
+ const { type } = f.def;
56
+ const options = type.getOptions();
57
+ if (options) {
58
+ // TODO : Handle type.hasStrictOptions() => display an input text alongside the options
59
+ // TODO : Consider using a picker when the options count > X
60
+ return (_jsx(FlatList, { data: options, horizontal: true, keyExtractor: (item) => item.value.toString(), renderItem: ({ item }) => (_jsx(Pressable, { disabled: !attrs.spec?.editable, onPress: () => onSelect(item.value), style: [
61
+ styles.selectOption,
62
+ {
63
+ borderColor: item.value === internalValue
64
+ ? colors?.primary
65
+ : 'transparent',
66
+ },
67
+ ], children: _jsx(Text, { children: item.label }) })), showsHorizontalScrollIndicator: false, style: styles.select }));
68
+ }
69
+ // TODO : Implement picker for TFile (requires a dependency...)
70
+ if (type instanceof TBoolean) {
71
+ const { style } = styleDef(formFieldControl, 'Switch');
72
+ return (_jsx(Switch, { disabled: !attrs.spec?.editable, onValueChange: onValueChange, style: style, trackColor: { true: colors?.primary }, value: internalValue }));
73
+ }
27
74
  let valueAsString = '';
28
75
  if (!isBlank(internalValue)) {
29
76
  if (Array.isArray(internalValue)) {
@@ -33,5 +80,15 @@ export function UCFormFieldControl({ errMsg = null, execState, f, onChange: onCh
33
80
  valueAsString = internalValue.toString();
34
81
  }
35
82
  }
36
- return (React.createElement(TextInput, { ...attrs.spec, onChangeText: onChangeText, value: valueAsString }));
83
+ const { style } = styleDef(formFieldControl, 'TextInput', 'default');
84
+ return (_jsx(TextInput, { ...attrs.spec, onChangeText: onChangeText, style: style, value: valueAsString }));
37
85
  }
86
+ const styles = StyleSheet.create({
87
+ select: {
88
+ flexGrow: 0, // Prevent the list from extending full height
89
+ },
90
+ selectOption: {
91
+ borderWidth: 1,
92
+ padding: 2,
93
+ },
94
+ });
@@ -1,4 +1,4 @@
1
- import { type ReactElement } from 'react';
1
+ import type { ReactElement } from 'react';
2
2
  import type { DataType } from '../../dt/index.js';
3
3
  import type { UCFormFieldDescProps } from '../lib/react/form.js';
4
4
  export declare function UCFormFieldDesc<T extends DataType>({ f, }: UCFormFieldDescProps<T>): ReactElement | null;
@@ -1,11 +1,13 @@
1
- import React, {} from 'react';
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { Text } from 'react-native';
3
3
  import { useDIContext } from '../lib/react/DIContextProvider.js';
4
+ import { useStyleContext } from '../lib/react/StyleContextProvider.js';
4
5
  export function UCFormFieldDesc({ f, }) {
5
6
  const { wordingManager } = useDIContext();
7
+ const { formFieldDesc } = useStyleContext();
6
8
  const { desc } = wordingManager.ucif(f);
7
9
  if (!desc) {
8
10
  return null;
9
11
  }
10
- return React.createElement(Text, null, desc);
12
+ return _jsx(Text, { style: formFieldDesc?.style, children: desc });
11
13
  }
@@ -1,3 +1,3 @@
1
- import { type ReactElement } from 'react';
1
+ import type { ReactElement } from 'react';
2
2
  import type { UCFormFieldErrProps } from '../lib/react/form.js';
3
3
  export declare function UCFormFieldErr({ errMsg }: UCFormFieldErrProps): ReactElement;
@@ -1,5 +1,7 @@
1
- import React, {} from 'react';
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { Text } from 'react-native';
3
+ import { useStyleContext } from '../lib/react/StyleContextProvider.js';
3
4
  export function UCFormFieldErr({ errMsg }) {
4
- return React.createElement(Text, null, errMsg);
5
+ const { formFieldErr } = useStyleContext();
6
+ return _jsx(Text, { style: formFieldErr?.style, children: errMsg });
5
7
  }
@@ -1,4 +1,4 @@
1
- import { type ReactElement } from 'react';
1
+ import type { ReactElement } from 'react';
2
2
  import type { DataType } from '../../dt/index.js';
3
3
  import type { UCFormFieldLabelProps } from '../lib/react/form.js';
4
4
  export declare function UCFormFieldLabel<T extends DataType>({ f, }: UCFormFieldLabelProps<T>): ReactElement;
@@ -1,8 +1,12 @@
1
- import React, {} from 'react';
1
+ import { jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Text } from 'react-native';
3
+ import { ucifIsMandatory } from '../../uc/index.js';
3
4
  import { useDIContext } from '../lib/react/DIContextProvider.js';
5
+ import { useStyleContext } from '../lib/react/StyleContextProvider.js';
4
6
  export function UCFormFieldLabel({ f, }) {
5
7
  const { wordingManager } = useDIContext();
8
+ const { formFieldLabel } = useStyleContext();
6
9
  const { label } = wordingManager.ucif(f);
7
- return React.createElement(Text, null, label);
10
+ const mandatory = ucifIsMandatory(f.def);
11
+ return (_jsxs(Text, { style: formFieldLabel?.style, children: [label, mandatory && ' *'] }));
8
12
  }
@@ -1,4 +1,4 @@
1
- import { type ReactElement } from 'react';
1
+ import type { ReactElement } from 'react';
2
2
  import type { UCInput, UCOPIBase } from '../../uc/index.js';
3
3
  import type { UCFormSubmitControlProps } from '../lib/react/form.js';
4
4
  export declare function UCFormSubmitControl<I extends UCInput | undefined = undefined, OPI0 extends UCOPIBase | undefined = undefined, OPI1 extends UCOPIBase | undefined = undefined>({ execState, disabled, onPress, uc, }: UCFormSubmitControlProps<I, OPI0, OPI1>): ReactElement;
@@ -1,8 +1,9 @@
1
- import React, {} from 'react';
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { Pressable, Text } from 'react-native';
3
3
  import { useDIContext } from '../lib/react/DIContextProvider.js';
4
+ import { useStyleContext } from '../lib/react/StyleContextProvider.js';
4
5
  export function UCFormSubmitControl({ execState, disabled, onPress, uc, }) {
5
6
  const { wordingManager } = useDIContext();
6
- return (React.createElement(Pressable, { onPress: onPress, disabled: disabled },
7
- React.createElement(Text, null, wordingManager.ucISubmit(uc.def, execState))));
7
+ const { formSubmitControl } = useStyleContext();
8
+ return (_jsx(Pressable, { disabled: disabled, onPress: onPress, children: _jsx(Text, { style: formSubmitControl?.style, children: wordingManager.ucISubmit(uc.def, execState) }) }));
8
9
  }
@@ -1,4 +1,4 @@
1
- import { type ReactElement } from 'react';
1
+ import type { ReactElement } from 'react';
2
2
  import type { DataType } from '../../dt/index.js';
3
3
  import type { UCOPIBase } from '../../uc/index.js';
4
4
  import { type Props } from '../lib/react/UCOutputFieldValueFragment.js';
@@ -1,7 +1,8 @@
1
- import React, {} from 'react';
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { Text } from 'react-native';
3
+ import { useStyleContext } from '../lib/react/StyleContextProvider.js';
3
4
  import { UCOutputFieldValueFragment, } from '../lib/react/UCOutputFieldValueFragment.js';
4
5
  export function UCOutputFieldValue(props) {
5
- return (React.createElement(Text, null,
6
- React.createElement(UCOutputFieldValueFragment, { ...props })));
6
+ const { outputFieldValue } = useStyleContext();
7
+ return (_jsx(Text, { style: outputFieldValue?.style, children: _jsx(UCOutputFieldValueFragment, { ...props }) }));
7
8
  }
@@ -1,2 +1,2 @@
1
- import { type ReactElement } from 'react';
1
+ import type { ReactElement } from 'react';
2
2
  export declare function UCAutoExecLoader(): ReactElement;
@@ -1,4 +1,6 @@
1
- import React, {} from 'react';
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useStyleContext } from '../lib/react/StyleContextProvider.js';
2
3
  export function UCAutoExecLoader() {
3
- return React.createElement("div", null, "...");
4
+ const { autoExecLoader } = useStyleContext();
5
+ return (_jsx("div", { className: autoExecLoader?.className, style: autoExecLoader?.style, children: "..." }));
4
6
  }
@@ -1,4 +1,4 @@
1
- import { type ReactElement } from 'react';
1
+ import type { ReactElement } from 'react';
2
2
  import type { UCInput, UCOPIBase } from '../../uc/index.js';
3
3
  import type { UCEntrypointTouchableProps } from '../lib/react/touchable.js';
4
- export declare function UCEntrypointTouchable<I extends UCInput | undefined = undefined, OPI0 extends UCOPIBase | undefined = undefined, OPI1 extends UCOPIBase | undefined = undefined>({ className, path, wording, }: UCEntrypointTouchableProps<I, OPI0, OPI1>): ReactElement;
4
+ export declare function UCEntrypointTouchable<I extends UCInput | undefined = undefined, OPI0 extends UCOPIBase | undefined = undefined, OPI1 extends UCOPIBase | undefined = undefined>({ path, wording }: UCEntrypointTouchableProps<I, OPI0, OPI1>): ReactElement;
@@ -1,4 +1,6 @@
1
- import React, {} from 'react';
2
- export function UCEntrypointTouchable({ className, path, wording, }) {
3
- return (React.createElement("a", { className: className, href: path, title: wording.desc ?? undefined }, wording.label));
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useStyleContext } from '../lib/react/StyleContextProvider.js';
3
+ export function UCEntrypointTouchable({ path, wording }) {
4
+ const { entrypointTouchable } = useStyleContext();
5
+ return (_jsx("a", { className: entrypointTouchable?.className, href: path, style: entrypointTouchable?.style, title: wording.desc ?? undefined, children: wording.label }));
4
6
  }
@@ -1,4 +1,4 @@
1
- import { type ReactElement } from 'react';
1
+ import type { ReactElement } from 'react';
2
2
  import type { UCInput, UCOPIBase } from '../../uc/index.js';
3
3
  import type { UCExecTouchableProps } from '../lib/react/touchable.js';
4
- export declare function UCExecTouchable<I extends UCInput | undefined = undefined, OPI0 extends UCOPIBase | undefined = undefined, OPI1 extends UCOPIBase | undefined = undefined>({ className, disabled, execState, onSubmit, uc, }: UCExecTouchableProps<I, OPI0, OPI1>): ReactElement;
4
+ export declare function UCExecTouchable<I extends UCInput | undefined = undefined, OPI0 extends UCOPIBase | undefined = undefined, OPI1 extends UCOPIBase | undefined = undefined>({ disabled, execState, onSubmit, uc, }: UCExecTouchableProps<I, OPI0, OPI1>): ReactElement;
@@ -1,7 +1,9 @@
1
- import React, {} from 'react';
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useDIContext } from '../lib/react/DIContextProvider.js';
3
- export function UCExecTouchable({ className, disabled, execState, onSubmit, uc, }) {
3
+ import { useStyleContext } from '../lib/react/StyleContextProvider.js';
4
+ export function UCExecTouchable({ disabled, execState, onSubmit, uc, }) {
4
5
  const { wordingManager } = useDIContext();
6
+ const { execTouchable } = useStyleContext();
5
7
  const label = wordingManager.ucISubmit(uc.def, execState);
6
- return (React.createElement("button", { className: className, disabled: disabled, onClick: onSubmit, type: "button" }, label));
8
+ return (_jsx("button", { className: execTouchable?.className, disabled: disabled, onClick: onSubmit, style: execTouchable?.style, type: "button", children: label }));
7
9
  }
@@ -1,4 +1,4 @@
1
1
  import { type ReactElement } from 'react';
2
2
  import type { UCInput, UCOPIBase } from '../../uc/index.js';
3
3
  import type { UCFormProps } from '../lib/react/form.js';
4
- export declare function UCForm<I extends UCInput | undefined = undefined, OPI0 extends UCOPIBase | undefined = undefined, OPI1 extends UCOPIBase | undefined = undefined>({ className, clearAfterExec, disabled, execState, onChange, onSubmit: onSubmitBase, uc, }: UCFormProps<I, OPI0, OPI1>): ReactElement;
4
+ export declare function UCForm<I extends UCInput | undefined = undefined, OPI0 extends UCOPIBase | undefined = undefined, OPI1 extends UCOPIBase | undefined = undefined>({ clearAfterExec, disabled, execState, onChange, onSubmit: onSubmitBase, uc, }: UCFormProps<I, OPI0, OPI1>): ReactElement;
@@ -1,7 +1,10 @@
1
- import React, { useRef } from 'react';
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useRef } from 'react';
3
+ import { useStyleContext } from '../lib/react/StyleContextProvider.js';
2
4
  import { UCFormField } from './UCFormField.js';
3
5
  import { UCFormSubmitControl } from './UCFormSubmitControl.js';
4
- export function UCForm({ className, clearAfterExec, disabled, execState, onChange, onSubmit: onSubmitBase, uc, }) {
6
+ export function UCForm({ clearAfterExec, disabled, execState, onChange, onSubmit: onSubmitBase, uc, }) {
7
+ const { form } = useStyleContext();
5
8
  const formRef = useRef(null);
6
9
  const onSubmit = async (e) => {
7
10
  e.preventDefault();
@@ -10,7 +13,5 @@ export function UCForm({ className, clearAfterExec, disabled, execState, onChang
10
13
  formRef.current?.reset();
11
14
  }
12
15
  };
13
- return (React.createElement("form", { className: className, onSubmit: onSubmit, ref: formRef },
14
- uc.inputFieldsForForm().map((f) => (React.createElement(UCFormField, { key: f.key, disabled: disabled, execState: execState, f: f, onChange: onChange }))),
15
- React.createElement(UCFormSubmitControl, { execState: execState, disabled: disabled, uc: uc })));
16
+ return (_jsxs("form", { className: form?.className, onSubmit: onSubmit, ref: formRef, style: form?.style, children: [uc.inputFieldsForForm().map((f) => (_jsx(UCFormField, { disabled: disabled, execState: execState, f: f, onChange: onChange }, f.key))), _jsx(UCFormSubmitControl, { disabled: disabled, execState: execState, uc: uc })] }));
16
17
  }
@@ -1,4 +1,4 @@
1
1
  import { type ReactElement } from 'react';
2
2
  import type { DataType } from '../../dt/index.js';
3
3
  import { type UCFormFieldProps } from '../lib/react/form.js';
4
- export declare function UCFormField<T extends DataType>({ className, disabled, execState, f, onChange: onChangeBase, only, }: UCFormFieldProps<T>): ReactElement;
4
+ export declare function UCFormField<T extends DataType>({ disabled, execState, f, onChange: onChangeBase, only, }: UCFormFieldProps<T>): ReactElement;
@@ -1,21 +1,20 @@
1
- import React, { useState } from 'react';
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from 'react';
2
3
  import { useDIContext } from '../lib/react/DIContextProvider.js';
3
4
  import { UC_FORM_FIELD_ELEMENTS, validateFormField, } from '../lib/react/form.js';
5
+ import { useStyleContext } from '../lib/react/StyleContextProvider.js';
4
6
  import { UCFormFieldControl } from './UCFormFieldControl.js';
5
7
  import { UCFormFieldDesc } from './UCFormFieldDesc.js';
6
8
  import { UCFormFieldErr } from './UCFormFieldErr.js';
7
9
  import { UCFormFieldLabel } from './UCFormFieldLabel.js';
8
- export function UCFormField({ className, disabled, execState, f, onChange: onChangeBase, only, }) {
10
+ export function UCFormField({ disabled, execState, f, onChange: onChangeBase, only, }) {
9
11
  const { i18nManager } = useDIContext();
12
+ const { formField } = useStyleContext();
10
13
  const [errMsg, setErrMsg] = useState(null);
11
14
  const onChange = (f, op, v) => {
12
15
  setErrMsg(validateFormField(i18nManager, f, v));
13
16
  onChangeBase(f, op, v);
14
17
  };
15
18
  const elements = only ?? UC_FORM_FIELD_ELEMENTS;
16
- return (React.createElement("div", { className: className },
17
- elements.includes('label') && React.createElement(UCFormFieldLabel, { f: f }),
18
- elements.includes('control') && (React.createElement(UCFormFieldControl, { disabled: disabled, execState: execState, f: f, onChange: onChange })),
19
- elements.includes('err') && errMsg && (React.createElement(UCFormFieldErr, { errMsg: errMsg })),
20
- elements.includes('desc') && React.createElement(UCFormFieldDesc, { f: f })));
19
+ return (_jsxs("div", { className: formField?.className, style: formField?.style, children: [elements.includes('label') && _jsx(UCFormFieldLabel, { f: f }), elements.includes('control') && (_jsx(UCFormFieldControl, { disabled: disabled, execState: execState, f: f, onChange: onChange })), elements.includes('err') && errMsg && (_jsx(UCFormFieldErr, { errMsg: errMsg })), elements.includes('desc') && _jsx(UCFormFieldDesc, { f: f })] }));
21
20
  }
@@ -1,4 +1,4 @@
1
- import { type ReactElement } from 'react';
2
- import type { DataType } from '../../dt/index.js';
1
+ import type { ReactElement } from 'react';
2
+ import { type DataType } from '../../dt/index.js';
3
3
  import type { UCFormFieldControlProps } from '../lib/react/form.js';
4
- export declare function UCFormFieldControl<T extends DataType>({ className, errMsg, execState, f, onChange: onChangeBase, }: UCFormFieldControlProps<T>): ReactElement;
4
+ export declare function UCFormFieldControl<T extends DataType>({ disabled, errMsg, execState, f, onChange: onChangeBase, }: UCFormFieldControlProps<T>): ReactElement;
@@ -1,11 +1,25 @@
1
- import React, {} from 'react';
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { TBoolean } from '../../dt/index.js';
2
3
  import { UCInputFieldChangeOperator, ucifRepeatability, } from '../../uc/index.js';
4
+ import { styleDef, useStyleContext, } from '../lib/react/StyleContextProvider.js';
3
5
  import { htmlInputDef } from '../lib/web/input.js';
4
6
  const CHECKED_FIELD_TYPES = ['checkbox', 'radio'];
5
7
  const FILE_FIELD_TYPES = ['file'];
6
8
  const MULTIPLE_VALUES_SEPARATOR = ',';
7
- export function UCFormFieldControl({ className, errMsg = null, execState, f, onChange: onChangeBase, }) {
8
- const attrs = htmlInputDef(f, execState, errMsg, className);
9
+ // TODO : Split this into smaller components
10
+ export function UCFormFieldControl({ disabled, errMsg = null, execState, f, onChange: onChangeBase, }) {
11
+ const { formFieldControl, renderFormFieldControl } = useStyleContext();
12
+ const component = renderFormFieldControl?.({
13
+ disabled,
14
+ errMsg,
15
+ execState,
16
+ f,
17
+ onChange: onChangeBase,
18
+ });
19
+ if (component) {
20
+ return component;
21
+ }
22
+ const attrs = htmlInputDef(f, disabled, errMsg);
9
23
  const onChange = (e) => {
10
24
  const target = e.currentTarget;
11
25
  const type = target.type;
@@ -36,16 +50,21 @@ export function UCFormFieldControl({ className, errMsg = null, execState, f, onC
36
50
  const defaultChecked = attrs.internal?.checked;
37
51
  const defaultValue = attrs.internal?.value;
38
52
  if (attrs.internal?.multiline) {
39
- return (React.createElement("textarea", { ...attrs.spec, defaultValue: defaultValue, onChange: onChange }));
53
+ const { className, style } = styleDef(formFieldControl, 'textarea', 'default');
54
+ return (_jsx("textarea", { ...attrs.spec, className: className, defaultValue: defaultValue, onChange: onChange, style: style }));
40
55
  }
41
56
  const { type } = f.def;
57
+ if (type instanceof TBoolean) {
58
+ const { className, style } = styleDef(formFieldControl, 'checkbox');
59
+ return (_jsx("input", { ...attrs.spec, className: className, defaultChecked: defaultChecked, defaultValue: defaultValue, onChange: onChange, style: style }));
60
+ }
42
61
  const options = type.getOptions();
43
62
  if (options) {
44
63
  // TODO : Handle type.hasStrictOptions() => display an input text alongside the select
45
64
  // TODO : Consider using a radio and/or checkbox and/or selectable buttons when the options count < X
46
- return (React.createElement("select", { ...attrs.spec, defaultValue: defaultValue, onChange: onChange },
47
- React.createElement("option", null),
48
- options.map((o) => (React.createElement("option", { key: o.value.toString(), value: o.value.toString() }, o.label)))));
65
+ const { className, style } = styleDef(formFieldControl, 'select', 'default');
66
+ return (_jsxs("select", { ...attrs.spec, className: className, defaultValue: defaultValue, onChange: onChange, style: style, children: [_jsx("option", {}), options.map((o) => (_jsx("option", { value: o.value.toString(), children: o.label }, o.value.toString())))] }));
49
67
  }
50
- return (React.createElement("input", { ...attrs.spec, defaultChecked: defaultChecked, defaultValue: defaultValue, onChange: onChange }));
68
+ const { className, style } = styleDef(formFieldControl, 'input', 'default');
69
+ return (_jsx("input", { ...attrs.spec, className: className, defaultChecked: defaultChecked, defaultValue: defaultValue, onChange: onChange, style: style }));
51
70
  }
@@ -1,4 +1,4 @@
1
- import { type ReactElement } from 'react';
1
+ import type { ReactElement } from 'react';
2
2
  import type { DataType } from '../../dt/index.js';
3
3
  import type { UCFormFieldDescProps } from '../lib/react/form.js';
4
- export declare function UCFormFieldDesc<T extends DataType>({ className, f, }: UCFormFieldDescProps<T>): ReactElement | null;
4
+ export declare function UCFormFieldDesc<T extends DataType>({ f, }: UCFormFieldDescProps<T>): ReactElement | null;