xmlui 0.7.27 → 0.7.29

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 (58) hide show
  1. package/dist/{apiInterceptorWorker-Ca5HMlfW.mjs → apiInterceptorWorker-BXh2BMZL.mjs} +1 -1
  2. package/dist/{index-BMOK5q0U.mjs → index-B3eDGXIR.mjs} +8488 -8166
  3. package/dist/scripts/src/components/APICall/APICall.js +31 -29
  4. package/dist/scripts/src/components/AppHeader/AppHeader.js +4 -4
  5. package/dist/scripts/src/components/Badge/Badge.js +2 -2
  6. package/dist/scripts/src/components/Bookmark/Bookmark.js +7 -7
  7. package/dist/scripts/src/components/Bookmark/BookmarkNative.js +2 -2
  8. package/dist/scripts/src/components/Button/Button.js +1 -7
  9. package/dist/scripts/src/components/Carousel/Carousel.js +3 -1
  10. package/dist/scripts/src/components/Checkbox/Checkbox.js +0 -1
  11. package/dist/scripts/src/components/ColorPicker/ColorPicker.js +1 -1
  12. package/dist/scripts/src/components/DropdownMenu/DropdownMenu.js +2 -1
  13. package/dist/scripts/src/components/FileUploadDropZone/FileUploadDropZone.js +13 -4
  14. package/dist/scripts/src/components/FlowLayout/FlowLayout.js +18 -8
  15. package/dist/scripts/src/components/FlowLayout/FlowLayoutNative.js +5 -1
  16. package/dist/scripts/src/components/Form/Form.js +53 -17
  17. package/dist/scripts/src/components/Form/FormContext.js +103 -1
  18. package/dist/scripts/src/components/Form/FormNative.js +9 -1
  19. package/dist/scripts/src/components/FormItem/FormItem.js +113 -33
  20. package/dist/scripts/src/components/FormItem/FormItemNative.js +8 -2
  21. package/dist/scripts/src/components/FormItem/Validations.js +1 -1
  22. package/dist/scripts/src/components/Heading/Heading.js +23 -4
  23. package/dist/scripts/src/components/Heading/HeadingNative.js +9 -4
  24. package/dist/scripts/src/components/Icon/Icon.js +5 -2
  25. package/dist/scripts/src/components/Icon/IconNative.js +2 -2
  26. package/dist/scripts/src/components/Image/Image.js +5 -1
  27. package/dist/scripts/src/components/Items/Items.js +4 -2
  28. package/dist/scripts/src/components/Items/ItemsNative.js +1 -3
  29. package/dist/scripts/src/components/Link/Link.js +13 -4
  30. package/dist/scripts/src/components/List/List.js +22 -5
  31. package/dist/scripts/src/components/Markdown/Markdown.js +8 -4
  32. package/dist/scripts/src/components/ModalDialog/ModalDialog.js +12 -6
  33. package/dist/scripts/src/components/NavLink/NavLink.js +28 -10
  34. package/dist/scripts/src/components/NoResult/NoResult.js +6 -2
  35. package/dist/scripts/src/components/NumberBox/NumberBox.js +22 -6
  36. package/dist/scripts/src/components/Option/Option.js +1 -1
  37. package/dist/scripts/src/components/ProgressBar/ProgressBar.js +5 -1
  38. package/dist/scripts/src/components/Spinner/Spinner.js +10 -2
  39. package/dist/scripts/src/components/Splitter/Splitter.js +38 -13
  40. package/dist/scripts/src/components/Stack/Stack.js +39 -11
  41. package/dist/scripts/src/components/StickyBox/StickyBox.js +7 -2
  42. package/dist/scripts/src/components/Switch/Switch.js +0 -1
  43. package/dist/scripts/src/components/Table/Table.js +35 -18
  44. package/dist/scripts/src/components/TableOfContents/TableOfContents.js +13 -4
  45. package/dist/scripts/src/components/TableOfContents/TableOfContentsNative.js +15 -22
  46. package/dist/scripts/src/components/Tabs/Tabs.js +8 -3
  47. package/dist/scripts/src/components/Text/Text.js +20 -8
  48. package/dist/scripts/src/components/TextArea/TextArea.js +30 -13
  49. package/dist/scripts/src/components/Theme/Theme.js +6 -2
  50. package/dist/scripts/src/components/abstractions.js +14 -3
  51. package/dist/scripts/src/components-core/TableOfContentsContext.js +57 -17
  52. package/dist/scripts/src/components-core/utils/extractParam.js +3 -2
  53. package/dist/style.css +1 -1
  54. package/dist/xmlui-metadata.mjs +9307 -5528
  55. package/dist/xmlui-metadata.umd.js +17 -17
  56. package/dist/xmlui-standalone.umd.js +166 -166
  57. package/dist/xmlui.mjs +1 -1
  58. package/package.json +1 -1
@@ -5,6 +5,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const ComponentDefs_1 = require("../../abstractions/ComponentDefs");
6
6
  const renderers_1 = require("../../components-core/renderers");
7
7
  const metadata_helpers_1 = require("../../components/metadata-helpers");
8
+ const abstractions_1 = require("../abstractions");
8
9
  const APICallNative_1 = require("./APICallNative");
9
10
  const COMP = "APICall";
10
11
  exports.APICallMd = (0, ComponentDefs_1.createMetadata)({
@@ -12,66 +13,67 @@ exports.APICallMd = (0, ComponentDefs_1.createMetadata)({
12
13
  `is similar in nature to the \`DataSource\` component which retrieves data from the backend.`,
13
14
  props: {
14
15
  method: {
15
- description: `The method of data manipulation can be done via setting this property. The following ` +
16
- `HTTP methods are available: \`post\`, \`put\`, and \`delete\`.`,
16
+ description: "The method of data manipulation can be done via setting this property.",
17
17
  valueType: "string",
18
+ availableValues: abstractions_1.httpMethodNames,
19
+ defaultValue: "get",
18
20
  },
19
21
  url: {
20
- description: `Use this property to set the URL to send data to.`,
22
+ description: "Use this property to set the URL to send data to.",
21
23
  isRequired: true,
22
24
  valueType: "string",
23
25
  },
24
26
  rawBody: {
25
- description: `This property sets the request body to the value provided here without any conversion. ` +
26
- `Use the * \`body\` property if you want the object sent in JSON. When you define ` +
27
- `\`body\` and \`rawBody\`, the latest one prevails.`,
27
+ description: "This property sets the request body to the value provided here without any conversion. " +
28
+ "Use the * \`body\` property if you want the object sent in JSON. When you define " +
29
+ "\`body\` and \`rawBody\`, the latest one prevails.",
28
30
  valueType: "string",
29
31
  },
30
32
  body: {
31
- description: `This property sets the request body. The object you pass here will be serialized to ` +
32
- `JSON when sending the request. Use the \`rawBody\` property to send another request ` +
33
- `body using its native format. When you define \`body\` and \`rawBody\`, the latest ` +
34
- `one prevails.`,
33
+ description: "This property sets the request body. The object you pass here will be serialized to " +
34
+ "JSON when sending the request. Use the \`rawBody\` property to send another request " +
35
+ "body using its native format. When you define \`body\` and \`rawBody\`, the latest " +
36
+ "one prevails.",
35
37
  valueType: "string",
36
38
  },
37
39
  queryParams: {
38
- description: `This property sets the query parameters for the request. The object you pass here will ` +
39
- `be serialized to a query string and appended to the request URL. You can specify key ` +
40
- `and value pairs where the key is the name of a particular query parameter and the value ` +
41
- `is that parameter's value.`,
40
+ description: "This property sets the query parameters for the request. The object you pass here will " +
41
+ "be serialized to a query string and appended to the request URL. You can specify key " +
42
+ "and value pairs where the key is the name of a particular query parameter and the value " +
43
+ "is that parameter's value.",
42
44
  },
43
45
  headers: {
44
- description: `You can define request header values as key and value pairs, where the key is the ID of ` +
45
- `the particular header and the value is that header's value.`,
46
+ description: "You can define request header values as key and value pairs, where the key is the ID of " +
47
+ "the particular header and the value is that header's value.",
46
48
  },
47
49
  confirmTitle: {
48
- description: `This optional string sets the title in the confirmation dialog that is displayed before ` +
50
+ description: "This optional string sets the title in the confirmation dialog that is displayed before " +
49
51
  `the \`${COMP}\` is executed.`,
50
52
  valueType: "string",
51
53
  },
52
54
  confirmMessage: {
53
- description: `This optional string sets the message in the confirmation dialog that is displayed before ` +
55
+ description: "This optional string sets the message in the confirmation dialog that is displayed before " +
54
56
  `the \`${COMP}\` is executed.`,
55
57
  valueType: "string",
56
58
  },
57
59
  confirmButtonLabel: {
58
- description: `This optional string property enables the customization of the submit button in the ` +
60
+ description: "This optional string property enables the customization of the submit button in the " +
59
61
  `confirmation dialog that is displayed before the \`${COMP}\` is executed.`,
60
62
  valueType: "string",
61
63
  },
62
64
  inProgressNotificationMessage: {
63
- description: `This property customizes the message that is displayed in a toast while the API operation ` +
64
- `is in progress.`,
65
+ description: "This property customizes the message that is displayed in a toast while the API operation " +
66
+ "is in progress.",
65
67
  valueType: "string",
66
68
  },
67
69
  errorNotificationMessage: {
68
- description: `This property defines the message to display automatically when the operation results ` +
69
- `in an error.`,
70
+ description: "This property defines the message to display automatically when the operation results " +
71
+ "in an error.",
70
72
  valueType: "string",
71
73
  },
72
74
  completedNotificationMessage: {
73
- description: `This property defines the message to display automatically when the operation has ` +
74
- `been completed.`,
75
+ description: "This property defines the message to display automatically when the operation has " +
76
+ "been completed.",
75
77
  valueType: "string",
76
78
  },
77
79
  payloadType: (0, metadata_helpers_1.dInternal)(),
@@ -81,14 +83,14 @@ exports.APICallMd = (0, ComponentDefs_1.createMetadata)({
81
83
  getOptimisticValue: (0, metadata_helpers_1.dInternal)(),
82
84
  },
83
85
  events: {
84
- beforeRequest: (0, ComponentDefs_1.d)(`This event fires before the request is sent. Returning an explicit boolean` +
85
- `'false' value will prevent the request from being sent.`),
86
- success: (0, ComponentDefs_1.d)(`This event fires when a request results in a success.`),
86
+ beforeRequest: (0, ComponentDefs_1.d)("This event fires before the request is sent. Returning an explicit boolean" +
87
+ "\`false\` value will prevent the request from being sent."),
88
+ success: (0, ComponentDefs_1.d)("This event fires when a request results in a success."),
87
89
  /**
88
90
  * This event fires when a request results in an error.
89
91
  * @descriptionRef
90
92
  */
91
- error: (0, ComponentDefs_1.d)(`This event fires when a request results in an error.`),
93
+ error: (0, ComponentDefs_1.d)("This event fires when a request results in an error."),
92
94
  progress: (0, metadata_helpers_1.dInternal)(),
93
95
  },
94
96
  contextVars: {
@@ -19,10 +19,10 @@ exports.AppHeaderMd = (0, ComponentDefs_1.createMetadata)({
19
19
  description: `\`${COMP}\` is a placeholder within \`App\` to define a custom application header.`,
20
20
  props: {
21
21
  profileMenuTemplate: (0, metadata_helpers_1.dComponent)(`This property makes the profile menu slot of the \`${COMP}\` component customizable.`),
22
- logoTemplate: (0, metadata_helpers_1.dComponent)(`This property defines the template to use for the logo. With this property, you can ` +
23
- `construct your custom logo instead of using a single image.`),
24
- titleTemplate: (0, metadata_helpers_1.dComponent)(`This property defines the template to use for the title. With this property, you can ` +
25
- `construct your custom title instead of using a single image.`),
22
+ logoTemplate: (0, metadata_helpers_1.dComponent)("This property defines the template to use for the logo. With this property, you can " +
23
+ "construct your custom logo instead of using a single image."),
24
+ titleTemplate: (0, metadata_helpers_1.dComponent)("This property defines the template to use for the title. With this property, you can " +
25
+ "construct your custom title instead of using a single image."),
26
26
  title: {
27
27
  description: "Title for the application logo",
28
28
  valueType: "string",
@@ -22,8 +22,8 @@ exports.BadgeMd = (0, ComponentDefs_1.createMetadata)({
22
22
  isRequired: true,
23
23
  },
24
24
  variant: {
25
- description: `Modifies the shape of the component. Comes in the regular \`badge\` variant or the \`pill\` variant ` +
26
- `with fully rounded corners.`,
25
+ description: "Modifies the shape of the component. Comes in the regular \`badge\` variant or the \`pill\` variant " +
26
+ "with fully rounded corners.",
27
27
  type: "string",
28
28
  availableValues: BadgeNative_1.badgeVariantValues,
29
29
  defaultValue: "badge",
@@ -7,24 +7,24 @@ const renderers_1 = require("../../components-core/renderers");
7
7
  const BookmarkNative_1 = require("./BookmarkNative");
8
8
  const COMP = "Bookmark";
9
9
  exports.BookmarkMd = (0, ComponentDefs_1.createMetadata)({
10
- description: `As its name suggests, this component places a bookmark into its parent component's view. The ` +
11
- `component has an \`id\` that you can use in links to navigate (scroll to) the bookmark's location.`,
10
+ description: "As its name suggests, this component places a bookmark into its parent component's view. The " +
11
+ "component has an \`id\` that you can use in links to navigate (scroll to) the bookmark's location.",
12
12
  opaque: true,
13
13
  props: {
14
14
  uid: {
15
- description: `The unique identifier of the bookmark. You can use this identifier in links to navigate ` +
16
- `to this component's location.`,
15
+ description: "The unique identifier of the bookmark. You can use this identifier in links to navigate " +
16
+ "to this component's location.",
17
17
  valueType: "string",
18
18
  },
19
19
  level: {
20
- description: `The level of the bookmark. The level is used to determine the bookmark's ` +
21
- `position in the table of contents.`,
20
+ description: "The level of the bookmark. The level is used to determine the bookmark's " +
21
+ "position in the table of contents.",
22
22
  valueType: "number",
23
23
  defaultValue: 1,
24
24
  },
25
25
  title: {
26
26
  description: "Defines the text to display the bookmark in the table of contents. If this property is " +
27
- "empty, the text falls back to the value of `id`.",
27
+ "empty, the text falls back to the value of \`id\`.",
28
28
  valueType: "string",
29
29
  },
30
30
  omitFromToc: {
@@ -12,8 +12,8 @@ const Bookmark = ({ uid, level = exports.defaultProps.level, children, title, om
12
12
  const elementRef = (0, react_1.useRef)(null);
13
13
  const tableOfContentsContext = (0, react_1.useContext)(TableOfContentsContext_1.TableOfContentsContext);
14
14
  const registerHeading = tableOfContentsContext === null || tableOfContentsContext === void 0 ? void 0 : tableOfContentsContext.registerHeading;
15
- const observeIntersection = tableOfContentsContext === null || tableOfContentsContext === void 0 ? void 0 : tableOfContentsContext.observeIntersection;
16
- (0, react_1.useEffect)(() => {
15
+ const observeIntersection = tableOfContentsContext === null || tableOfContentsContext === void 0 ? void 0 : tableOfContentsContext.hasTableOfContents;
16
+ (0, react_1.useLayoutEffect)(() => {
17
17
  var _a, _b;
18
18
  if (observeIntersection && elementRef.current && uid && !omitFromToc) {
19
19
  return registerHeading === null || registerHeading === void 0 ? void 0 : registerHeading({
@@ -15,7 +15,7 @@ const IconNative_1 = require("../Icon/IconNative");
15
15
  const ButtonNative_1 = require("./ButtonNative");
16
16
  const COMP = "Button";
17
17
  exports.ButtonMd = (0, ComponentDefs_1.createMetadata)({
18
- description: `Button is an interactive element that triggers an action when clicked.`,
18
+ description: "Button is an interactive element that triggers an action when clicked.",
19
19
  status: "stable",
20
20
  props: {
21
21
  autoFocus: {
@@ -50,13 +50,11 @@ exports.ButtonMd = (0, ComponentDefs_1.createMetadata)({
50
50
  `specified and an icon is set, the ${COMP} will modify its styling to look like a ` +
51
51
  `small icon button. When the ${COMP} has nested children, it will display them and ` +
52
52
  `ignore the value of the \`label\` prop.`,
53
- isRequired: false,
54
53
  type: "string",
55
54
  },
56
55
  type: {
57
56
  description: `This optional string describes how the ${COMP} appears in an HTML context. You ` +
58
57
  `rarely need to set this property explicitly.`,
59
- isRequired: false,
60
58
  availableValues: abstractions_1.buttonTypesMd,
61
59
  valueType: "string",
62
60
  defaultValue: ButtonNative_1.propDefaults.type,
@@ -64,7 +62,6 @@ exports.ButtonMd = (0, ComponentDefs_1.createMetadata)({
64
62
  enabled: {
65
63
  description: `The value of this property indicates whether the button accepts actions (\`true\`) ` +
66
64
  `or does not react to them (\`false\`).`,
67
- isRequired: false,
68
65
  type: "boolean",
69
66
  defaultValue: true,
70
67
  },
@@ -73,12 +70,10 @@ exports.ButtonMd = (0, ComponentDefs_1.createMetadata)({
73
70
  description: `This string value denotes an icon name. The framework will render an icon if XMLUI ` +
74
71
  `recognizes the icon by its name. If no label is specified and an icon is set, the ${COMP} ` +
75
72
  `displays only that icon.`,
76
- isRequired: false,
77
73
  type: "string",
78
74
  },
79
75
  iconPosition: {
80
76
  description: `This optional string determines the location of the icon in the ${COMP}.`,
81
- isRequired: false,
82
77
  availableValues: abstractions_1.iconPositionMd,
83
78
  type: "string",
84
79
  defaultValue: ButtonNative_1.propDefaults.iconPosition,
@@ -86,7 +81,6 @@ exports.ButtonMd = (0, ComponentDefs_1.createMetadata)({
86
81
  contentPosition: {
87
82
  description: `This optional value determines how the label and icon (or nested children) should be placed` +
88
83
  `inside the ${COMP} component.`,
89
- isRequired: false,
90
84
  availableValues: abstractions_1.alignmentOptionMd,
91
85
  type: "string",
92
86
  defaultValue: ButtonNative_1.propDefaults.contentPosition,
@@ -19,7 +19,9 @@ exports.CarouselMd = (0, ComponentDefs_1.createMetadata)({
19
19
  `custom slides) like a carousel.`,
20
20
  props: {
21
21
  orientation: {
22
- description: "This property indicates the orientation of the carousel. The `horizontal` value indicates that the carousel moves horizontally, and the `vertical` value indicates that the carousel moves vertically.",
22
+ description: "This property indicates the orientation of the carousel. The `horizontal` " +
23
+ "value indicates that the carousel moves horizontally, and the `vertical` " +
24
+ "value indicates that the carousel moves vertically.",
23
25
  availableValues: abstractions_1.orientationOptionMd,
24
26
  valueType: "string",
25
27
  defaultValue: CarouselNative_1.defaultProps.orientation,
@@ -36,7 +36,6 @@ exports.CheckboxMd = (0, ComponentDefs_1.createMetadata)({
36
36
  },
37
37
  },
38
38
  events: {
39
- click: (0, metadata_helpers_1.dClick)(COMP),
40
39
  gotFocus: (0, metadata_helpers_1.dGotFocus)(COMP),
41
40
  lostFocus: (0, metadata_helpers_1.dLostFocus)(COMP),
42
41
  didChange: (0, metadata_helpers_1.dDidChange)(COMP),
@@ -13,7 +13,7 @@ const themeVars_1 = require("../../components-core/theming/themeVars");
13
13
  const ColorPicker_module_scss_1 = __importDefault(require("./ColorPicker.module.scss"));
14
14
  const COMP = "ColorPicker";
15
15
  exports.ColorPickerMd = (0, ComponentDefs_1.createMetadata)({
16
- description: ``,
16
+ description: "This component allows the user to select a color with the browser's default color picker control.",
17
17
  props: {
18
18
  initialValue: (0, metadata_helpers_1.dInitialValue)(),
19
19
  label: (0, metadata_helpers_1.dLabel)(),
@@ -21,7 +21,8 @@ exports.DropdownMenuMd = (0, ComponentDefs_1.createMetadata)({
21
21
  label: (0, metadata_helpers_1.dLabel)(),
22
22
  triggerTemplate: (0, metadata_helpers_1.dTriggerTemplate)(DDMCOMP),
23
23
  alignment: {
24
- description: `This property allows you to determine the alignment of the displayed menu items.`,
24
+ description: "This property allows you to determine the alignment of the dropdown panel with " +
25
+ "the displayed menu items.",
25
26
  valueType: "string",
26
27
  availableValues: abstractions_1.alignmentOptionMd,
27
28
  defaultValue: DropdownMenuNative_1.defaultDropdownMenuProps.alignment,
@@ -15,10 +15,19 @@ exports.FileUploadDropZoneMd = (0, ComponentDefs_1.createMetadata)({
15
15
  description: `The \`${COMP}\` component allows users to upload files to a web application by dragging ` +
16
16
  `and dropping files from their local file system onto a designated area within the UI.`,
17
17
  props: {
18
- text: (0, ComponentDefs_1.d)(`With this property, you can change the default text ("Drop files here") to display when files ` +
19
- `are dragged over the drop zone.`),
20
- allowPaste: (0, ComponentDefs_1.d)(`This property indicates if the drop zone accepts files pasted from the clipboard (\`true\`) or ` +
21
- `only dragged files (\`false\`).`),
18
+ text: {
19
+ description: "With this property, you can change the default text to display when files " +
20
+ "are dragged over the drop zone.",
21
+ defaultValue: "Drop files here",
22
+ type: "string",
23
+ },
24
+ allowPaste: {
25
+ description: "This property indicates if the drop zone accepts files pasted from the " +
26
+ "clipboard (\`true\`) or " +
27
+ "only dragged files (\`false\`).",
28
+ type: "boolean",
29
+ defaultValue: true,
30
+ },
22
31
  enabled: (0, ComponentDefs_1.d)(`If set to \`false\`, the drop zone will be disabled and users will not be able to upload files.`, null, "boolean", true),
23
32
  },
24
33
  events: {
@@ -14,15 +14,25 @@ const themeVars_1 = require("../../components-core/theming/themeVars");
14
14
  const FlowLayoutNative_1 = require("./FlowLayoutNative");
15
15
  const COMP = "FlowLayout";
16
16
  exports.FlowLayoutMd = (0, ComponentDefs_1.createMetadata)({
17
- description: `This layout component is used to position content in rows with an auto wrapping feature: if ` +
18
- `the length of the items exceed the available space the layout will wrap into a new line.`,
17
+ description: "This layout component is used to position content in rows with an auto wrapping feature: if " +
18
+ "the length of the items exceed the available space the layout will wrap into a new line.",
19
19
  props: {
20
- gap: (0, ComponentDefs_1.d)(`This property defines the gap between items in the same row and between rows. The ${COMP} ` +
21
- `component creates a new row when an item is about to overflow the current row.`),
22
- columnGap: (0, ComponentDefs_1.d)(`The \`columnGap\` property specifies the space between items in a single row; it overrides ` +
23
- `the \`gap\` value.`),
24
- rowGap: (0, ComponentDefs_1.d)(`The \`rowGap\` property specifies the space between the ${COMP} rows; it overrides ` +
25
- `the \`gap\` value.`),
20
+ gap: {
21
+ description: `This property defines the gap between items in the same row and between rows. The ${COMP} ` +
22
+ `component creates a new row when an item is about to overflow the current row.`,
23
+ type: "string",
24
+ defaultValue: "$gap-normal",
25
+ },
26
+ columnGap: {
27
+ description: "The \`columnGap\` property specifies the space between items in a single row; it overrides " +
28
+ "the \`gap\` value.",
29
+ defaultValue: FlowLayoutNative_1.defaultProps.columnGap,
30
+ },
31
+ rowGap: {
32
+ description: `The \`rowGap\` property specifies the space between the ${COMP} rows; it overrides ` +
33
+ `the \`gap\` value.`,
34
+ defaultValue: FlowLayoutNative_1.defaultProps.rowGap,
35
+ },
26
36
  shadow: (0, ComponentDefs_1.d)(`${COMP} does not support shadow, we're waiting for a decent solution.`),
27
37
  },
28
38
  themeVars: (0, themeVars_1.parseScssVar)(FlowLayout_module_scss_1.default.themeVars),
@@ -14,7 +14,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
14
14
  return (mod && mod.__esModule) ? mod : { "default": mod };
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.FlowLayout = exports.FlowItemWrapper = exports.FlowItemBreak = void 0;
17
+ exports.FlowLayout = exports.defaultProps = exports.FlowItemWrapper = exports.FlowItemBreak = void 0;
18
18
  const jsx_runtime_1 = require("react/jsx-runtime");
19
19
  const react_1 = require("react");
20
20
  const classnames_1 = __importDefault(require("classnames"));
@@ -97,6 +97,10 @@ exports.FlowItemWrapper = (0, react_1.forwardRef)(function FlowItemWrapper(_a, r
97
97
  [FlowLayout_module_scss_1.default.starSized]: isStarSizing,
98
98
  }), ref: ref, children: children }), isStarSizing && (0, jsx_runtime_1.jsx)(exports.FlowItemBreak, {})] }));
99
99
  });
100
+ exports.defaultProps = {
101
+ columnGap: "$gap-normal",
102
+ rowGap: "$gap-normal",
103
+ };
100
104
  exports.FlowLayout = (0, react_1.forwardRef)(function FlowLayout({ style, columnGap = 0, rowGap = 0, children }, forwardedRef) {
101
105
  const [numberOfChildren, setNumberOfChildren] = (0, react_1.useState)(0);
102
106
  const safeColumnGap = numberOfChildren === 1 ? 0 : columnGap;
@@ -19,24 +19,60 @@ exports.FormMd = (0, ComponentDefs_1.createMetadata)({
19
19
  `(or change) data and submit it to the app (a server) for further processing.`,
20
20
  props: {
21
21
  buttonRowTemplate: (0, metadata_helpers_1.dComponent)(`This property allows defining a custom component to display the buttons at the bottom of the form.`),
22
- itemLabelPosition: (0, ComponentDefs_1.d)(`This property sets the position of the item labels within the form.` +
23
- `Individual \`FormItem\` instances can override this property.`, abstractions_1.labelPositionMd, "string", "top"),
24
- itemLabelWidth: (0, ComponentDefs_1.d)(`This property sets the width of the item labels within the form. Individual ` +
25
- `\`FormItem\` instances can override this property.`),
26
- itemLabelBreak: (0, ComponentDefs_1.d)(`This boolean value indicates if form item labels can be split into multiple ` +
27
- `lines if it would overflow the available label width. Individual \`FormItem\` ` +
28
- `instances can override this property.`),
29
- keepModalOpenOnSubmit: (0, ComponentDefs_1.d)("This property prevents the modal from closing when the form is submitted."),
30
- data: (0, ComponentDefs_1.d)(`This property sets the initial value of the form's data structure. The form infrastructure ` +
31
- `uses this value to set the initial state of form items within the form.`),
32
- cancelLabel: (0, ComponentDefs_1.d)(`This property defines the label of the Cancel button, by default, "Cancel".`),
33
- saveLabel: (0, ComponentDefs_1.d)(`This property defines the label of the Save button, by default, "Save".`),
34
- saveInProgressLabel: (0, ComponentDefs_1.d)("This property defines the label of the Save button to display during the " +
35
- "form data submit (save) operation. By default, the value of `saveLabel`."),
36
- swapCancelAndSave: (0, ComponentDefs_1.d)(`By default, the Cancel button is to the left of the Save button. Set this property to ` +
37
- `\`true\` to swap them or \`false\` to keep their original location.`),
22
+ itemLabelPosition: {
23
+ description: `This property sets the position of the item labels within the form.` +
24
+ `Individual \`FormItem\` instances can override this property.`,
25
+ availableValues: abstractions_1.labelPositionMd,
26
+ type: "string",
27
+ defaultValue: FormNative_1.defaultProps.itemLabelPosition,
28
+ },
29
+ itemLabelWidth: {
30
+ description: `This property sets the width of the item labels within the form. Individual ` +
31
+ `\`FormItem\` instances can override this property.`,
32
+ type: "string",
33
+ },
34
+ itemLabelBreak: {
35
+ description: `This boolean value indicates if form item labels can be split into multiple ` +
36
+ `lines if it would overflow the available label width. Individual \`FormItem\` ` +
37
+ `instances can override this property.`,
38
+ type: "boolean",
39
+ defaultValue: FormNative_1.defaultProps.itemLabelBreak,
40
+ },
41
+ keepModalOpenOnSubmit: {
42
+ description: "This property prevents the modal from closing when the form is submitted.",
43
+ type: "boolean",
44
+ defaultValue: FormNative_1.defaultProps.keepModalOpenOnSubmit,
45
+ },
46
+ data: {
47
+ description: `This property sets the initial value of the form's data structure. The form infrastructure ` +
48
+ `uses this value to set the initial state of form items within the form.`,
49
+ },
50
+ cancelLabel: {
51
+ description: "This property defines the label of the Cancel button.",
52
+ type: "string",
53
+ defaultValue: FormNative_1.defaultProps.cancelLabel,
54
+ },
55
+ saveLabel: {
56
+ description: `This property defines the label of the Save button.`,
57
+ type: "string",
58
+ defaultValue: FormNative_1.defaultProps.saveLabel,
59
+ },
60
+ saveInProgressLabel: {
61
+ description: "This property defines the label of the Save button to display during the " +
62
+ "form data submit (save) operation.",
63
+ type: "string",
64
+ defaultValue: FormNative_1.defaultProps.saveInProgressLabel,
65
+ },
66
+ swapCancelAndSave: {
67
+ description: `By default, the Cancel button is to the left of the Save button. Set this property to ` +
68
+ `\`true\` to swap them or \`false\` to keep their original location.`,
69
+ type: "boolean",
70
+ },
38
71
  submitUrl: (0, ComponentDefs_1.d)(`URL to submit the form data.`),
39
- submitMethod: (0, ComponentDefs_1.d)(`HTTP method to use when submitting the form data.`),
72
+ submitMethod: {
73
+ description: "This property sets the HTTP method to use when submitting the form data. If not " +
74
+ "defined, `put` is used when the form has initial data; otherwise, `post`.",
75
+ },
40
76
  enabled: (0, ComponentDefs_1.d)(`Whether the form is enabled or not. The default value is \`true\`.`),
41
77
  _data_url: (0, metadata_helpers_1.dInternal)("when we have an api bound data prop, we inject the url here"),
42
78
  },
@@ -1,9 +1,111 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FormContext = void 0;
3
+ exports.formControlTypesMd = exports.formControlTypes = exports.FormContext = exports.validationModeMd = exports.defaultValidationMode = exports.validationModeValues = exports.validationSeverityMd = exports.validationSeverityValues = void 0;
4
4
  exports.useFormContextPart = useFormContextPart;
5
5
  const use_context_selector_1 = require("use-context-selector");
6
+ exports.validationSeverityValues = ["error", "warning", "valid", "none"];
7
+ exports.validationSeverityMd = [
8
+ { value: "valid", description: "Visual indicator for an input that is accepted" },
9
+ { value: "warning", description: "Visual indicator for an input that produced a warning" },
10
+ { value: "error", description: "Visual indicator for an input that produced an error" },
11
+ ];
12
+ exports.validationModeValues = ["errorLate", "onChanged", "onLostFocus"];
13
+ exports.defaultValidationMode = "errorLate";
14
+ exports.validationModeMd = [
15
+ {
16
+ value: "errorLate",
17
+ description: "Display the error when the field loses focus." +
18
+ "If an error is already displayed, continue for every keystroke until input is accepted.",
19
+ },
20
+ {
21
+ value: "onChanged",
22
+ description: "Display error (if present) for every keystroke.",
23
+ },
24
+ {
25
+ value: "onLostFocus",
26
+ description: "Show/hide error (if present) only if the field loses focus.",
27
+ }
28
+ ];
6
29
  exports.FormContext = (0, use_context_selector_1.createContext)(undefined);
7
30
  function useFormContextPart(selector) {
8
31
  return (0, use_context_selector_1.useContextSelector)(exports.FormContext, selector);
9
32
  }
33
+ exports.formControlTypes = [
34
+ "text",
35
+ "password",
36
+ "textarea",
37
+ "checkbox",
38
+ "number",
39
+ "integer",
40
+ "file",
41
+ "select",
42
+ "autocomplete",
43
+ "datePicker",
44
+ "radioGroup",
45
+ "custom",
46
+ "switch",
47
+ "slider",
48
+ "colorpicker",
49
+ ];
50
+ exports.formControlTypesMd = [
51
+ {
52
+ value: "text",
53
+ description: "Renders TextBox",
54
+ },
55
+ {
56
+ value: "password",
57
+ description: "Renders TextBox with `password` type",
58
+ },
59
+ {
60
+ value: "textarea",
61
+ description: "Renders Textarea",
62
+ },
63
+ {
64
+ value: "checkbox",
65
+ description: "Renders Checkbox",
66
+ },
67
+ {
68
+ value: "number",
69
+ description: "Renders NumberBox",
70
+ },
71
+ {
72
+ value: "integer",
73
+ description: "Renders NumberBox with `integersOnly` set to true",
74
+ },
75
+ {
76
+ value: "file",
77
+ description: "Renders FileInput",
78
+ },
79
+ {
80
+ value: "datePicker",
81
+ description: "Renders DatePicker",
82
+ },
83
+ {
84
+ value: "radioGroup",
85
+ description: "Renders RadioGroup",
86
+ },
87
+ {
88
+ value: "switch",
89
+ description: "Renders Switch",
90
+ },
91
+ {
92
+ value: "select",
93
+ description: "Renders Select",
94
+ },
95
+ {
96
+ value: "autocomplete",
97
+ description: "Renders AutoComplete",
98
+ },
99
+ {
100
+ value: "slider",
101
+ description: "Renders Slider",
102
+ },
103
+ {
104
+ value: "colorpicker",
105
+ description: "Renders ColorPicker",
106
+ },
107
+ {
108
+ value: "custom",
109
+ description: "Custom control specified in children",
110
+ }
111
+ ];
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.getByPath = void 0;
15
+ exports.defaultProps = exports.getByPath = void 0;
16
16
  exports.FormWithContextVar = FormWithContextVar;
17
17
  const jsx_runtime_1 = require("react/jsx-runtime");
18
18
  const react_1 = require("react");
@@ -172,6 +172,14 @@ const initialState = {
172
172
  interactionFlags: {},
173
173
  submitInProgress: false,
174
174
  };
175
+ exports.defaultProps = {
176
+ cancelLabel: "Cancel",
177
+ saveLabel: "Save",
178
+ saveInProgressLabel: "Saving...",
179
+ itemLabelPosition: "top",
180
+ itemLabelBreak: true,
181
+ keepModalOpenOnSubmit: false,
182
+ };
175
183
  const Form = (0, react_2.forwardRef)(function ({ formState, dispatch, initialValue = constants_1.EMPTY_OBJECT, children, style, enabled = true, cancelLabel = "Cancel", saveLabel = "Save", saveInProgressLabel = "Saving...", swapCancelAndSave, onSubmit, onCancel, onReset, buttonRow, id, registerComponentApi, itemLabelBreak = true, itemLabelWidth, itemLabelPosition = "top", keepModalOpenOnSubmit = false, }, ref) {
176
184
  const formRef = (0, react_1.useRef)(null);
177
185
  (0, react_1.useImperativeHandle)(ref, () => formRef.current);