xmlui 0.7.26 → 0.7.28

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 (83) hide show
  1. package/dist/{apiInterceptorWorker-BlvgbCSf.mjs → apiInterceptorWorker-FalV8U3I.mjs} +1 -1
  2. package/dist/{index-CWLnzVw7.mjs → index-CTUFRo8v.mjs} +9969 -9448
  3. package/dist/scripts/src/components/APICall/APICall.js +69 -32
  4. package/dist/scripts/src/components/Accordion/Accordion.js +27 -7
  5. package/dist/scripts/src/components/Accordion/AccordionNative.js +9 -3
  6. package/dist/scripts/src/components/Alert/Alert.js +25 -6
  7. package/dist/scripts/src/components/App/App.js +48 -13
  8. package/dist/scripts/src/components/AppHeader/AppHeader.js +13 -6
  9. package/dist/scripts/src/components/AppState/AppState.js +14 -8
  10. package/dist/scripts/src/components/Avatar/Avatar.js +14 -3
  11. package/dist/scripts/src/components/Avatar/AvatarNative.js +5 -2
  12. package/dist/scripts/src/components/Backdrop/Backdrop.js +10 -2
  13. package/dist/scripts/src/components/Backdrop/BackdropNative.js +6 -2
  14. package/dist/scripts/src/components/Badge/Badge.js +17 -9
  15. package/dist/scripts/src/components/Badge/BadgeNative.js +6 -4
  16. package/dist/scripts/src/components/Bookmark/Bookmark.js +24 -11
  17. package/dist/scripts/src/components/Bookmark/BookmarkNative.js +8 -4
  18. package/dist/scripts/src/components/Button/Button.js +1 -7
  19. package/dist/scripts/src/components/ButtonGroup/ButtonGroup.js +22 -8
  20. package/dist/scripts/src/components/Card/Card.js +31 -10
  21. package/dist/scripts/src/components/Card/CardNative.js +6 -3
  22. package/dist/scripts/src/components/Carousel/Carousel.js +61 -12
  23. package/dist/scripts/src/components/Carousel/CarouselNative.js +13 -2
  24. package/dist/scripts/src/components/ChangeListener/ChangeListener.js +10 -3
  25. package/dist/scripts/src/components/ChangeListener/ChangeListenerNative.js +5 -1
  26. package/dist/scripts/src/components/Checkbox/Checkbox.js +8 -7
  27. package/dist/scripts/src/components/ColorPicker/ColorPicker.js +3 -3
  28. package/dist/scripts/src/components/ColorPicker/ColorPickerNative.js +8 -2
  29. package/dist/scripts/src/components/Column/Column.js +39 -17
  30. package/dist/scripts/src/components/ContentSeparator/ContentSeparator.js +11 -3
  31. package/dist/scripts/src/components/ContentSeparator/ContentSeparatorNative.js +5 -2
  32. package/dist/scripts/src/components/DatePicker/DatePicker.js +42 -10
  33. package/dist/scripts/src/components/DatePicker/DatePickerNative.js +67 -26
  34. package/dist/scripts/src/components/DropdownMenu/DropdownMenu.js +52 -12
  35. package/dist/scripts/src/components/DropdownMenu/DropdownMenuNative.js +14 -3
  36. package/dist/scripts/src/components/FileUploadDropZone/FileUploadDropZone.js +13 -4
  37. package/dist/scripts/src/components/FlowLayout/FlowLayout.js +18 -8
  38. package/dist/scripts/src/components/FlowLayout/FlowLayoutNative.js +5 -1
  39. package/dist/scripts/src/components/Form/Form.js +53 -17
  40. package/dist/scripts/src/components/Form/FormNative.js +9 -1
  41. package/dist/scripts/src/components/FormItem/FormItem.js +11 -5
  42. package/dist/scripts/src/components/FormItem/FormItemNative.js +6 -1
  43. package/dist/scripts/src/components/Heading/Heading.js +23 -4
  44. package/dist/scripts/src/components/Heading/HeadingNative.js +9 -4
  45. package/dist/scripts/src/components/Icon/Icon.js +6 -2
  46. package/dist/scripts/src/components/Icon/IconNative.js +2 -2
  47. package/dist/scripts/src/components/Image/Image.js +5 -1
  48. package/dist/scripts/src/components/Items/Items.js +4 -2
  49. package/dist/scripts/src/components/Items/ItemsNative.js +1 -3
  50. package/dist/scripts/src/components/Link/Link.js +13 -4
  51. package/dist/scripts/src/components/List/List.js +22 -5
  52. package/dist/scripts/src/components/Markdown/Markdown.js +8 -4
  53. package/dist/scripts/src/components/ModalDialog/ModalDialog.js +12 -6
  54. package/dist/scripts/src/components/NavLink/NavLink.js +28 -10
  55. package/dist/scripts/src/components/NoResult/NoResult.js +6 -2
  56. package/dist/scripts/src/components/NumberBox/NumberBox.js +22 -6
  57. package/dist/scripts/src/components/ProgressBar/ProgressBar.js +5 -1
  58. package/dist/scripts/src/components/Spinner/Spinner.js +10 -2
  59. package/dist/scripts/src/components/Splitter/Splitter.js +38 -13
  60. package/dist/scripts/src/components/Stack/Stack.js +39 -11
  61. package/dist/scripts/src/components/StickyBox/StickyBox.js +7 -2
  62. package/dist/scripts/src/components/StickyBox/StickyBoxNative.js +10 -3
  63. package/dist/scripts/src/components/Switch/Switch.js +6 -7
  64. package/dist/scripts/src/components/Table/Table.js +35 -18
  65. package/dist/scripts/src/components/TableOfContents/TableOfContents.js +13 -4
  66. package/dist/scripts/src/components/TableOfContents/TableOfContentsNative.js +15 -22
  67. package/dist/scripts/src/components/Tabs/Tabs.js +8 -3
  68. package/dist/scripts/src/components/Text/Text.js +20 -8
  69. package/dist/scripts/src/components/TextArea/TextArea.js +30 -13
  70. package/dist/scripts/src/components/Theme/Theme.js +6 -2
  71. package/dist/scripts/src/components/Toggle/Toggle.js +10 -2
  72. package/dist/scripts/src/components/abstractions.js +14 -3
  73. package/dist/scripts/src/components/metadata-helpers.js +20 -8
  74. package/dist/scripts/src/components-core/TableOfContentsContext.js +57 -17
  75. package/dist/scripts/src/components-core/loader/DataLoader.js +1 -1
  76. package/dist/scripts/src/components-core/utils/hooks.js +3 -0
  77. package/dist/scripts/src/components-core/utils/misc.js +3 -0
  78. package/dist/style.css +1 -1
  79. package/dist/xmlui-metadata.mjs +10975 -6047
  80. package/dist/xmlui-metadata.umd.js +17 -17
  81. package/dist/xmlui-standalone.umd.js +182 -182
  82. package/dist/xmlui.mjs +1 -1
  83. package/package.json +1 -1
@@ -22,18 +22,25 @@ exports.TableMd = (0, ComponentDefs_1.createMetadata)({
22
22
  description: `\`${COMP}\` is a component that displays cells organized into rows and columns. The \`${COMP}\` ` +
23
23
  `component is virtualized so it only renders visible cells.`,
24
24
  props: {
25
- items: (0, ComponentDefs_1.d)(`You can use \`items\` as an alias for the \`data\` property. ` +
25
+ items: (0, metadata_helpers_1.dInternal)(`You can use \`items\` as an alias for the \`data\` property. ` +
26
26
  `When you bind the table to a data source (e.g. an API endpoint), ` +
27
27
  `the \`data\` acts as the property that accepts a URL to fetch information from an API. ` +
28
28
  `When both \`items\` and \`data\` are used, \`items\` has priority.`),
29
29
  data: (0, ComponentDefs_1.d)(`The component receives data via this property. The \`data\` property is a list of items ` +
30
30
  `that the \`Table\` can display.`),
31
- isPaginated: (0, ComponentDefs_1.d)(`This property adds pagination controls to the \`${COMP}\`.`),
31
+ isPaginated: {
32
+ description: `This property adds pagination controls to the \`${COMP}\`.`,
33
+ valueType: "boolean",
34
+ defaultValue: false,
35
+ },
32
36
  loading: (0, ComponentDefs_1.d)(`This boolean property indicates if the component is fetching (or processing) data. This ` +
33
37
  `property is useful when data is loaded conditionally or receiving it takes some time.`),
34
38
  headerHeight: (0, ComponentDefs_1.d)(`This optional property is used to specify the height of the table header.`),
35
39
  rowsSelectable: (0, ComponentDefs_1.d)(`Indicates whether the rows are selectable (\`true\`) or not (\`false\`).`),
36
- pageSizes: (0, ComponentDefs_1.d)(`Describes how big a page should be for pagination.`),
40
+ pageSizes: {
41
+ description: "This property holds an array of page sizes (numbers) the user can select for " +
42
+ "pagination. If this property is not defined, the component allows only a page size of 10 items.",
43
+ },
37
44
  rowDisabledPredicate: (0, ComponentDefs_1.d)(`This property defines a predicate function with a return value that determines if the ` +
38
45
  `row should be disabled. The function retrieves the item to display and should return ` +
39
46
  `a Boolean-like value.`),
@@ -42,21 +49,31 @@ exports.TableMd = (0, ComponentDefs_1.createMetadata)({
42
49
  sortDirection: (0, ComponentDefs_1.d)(`This property determines the sort order to be \`ascending\` or \`descending\`. This ` +
43
50
  `property only works if the [\`sortBy\`](#sortby) property is also set.`),
44
51
  autoFocus: (0, metadata_helpers_1.dAutoFocus)(),
45
- hideHeader: (0, ComponentDefs_1.d)(`Set the header visibility using this property. Set it to \`true\` to hide the header.`),
46
- iconNoSort: (0, ComponentDefs_1.d)(`Allows the customization of the icon displayed in the ${COMP} column header when ` +
47
- `when sorting is enabled and sorting is not done according to the column.`),
48
- iconSortAsc: (0, ComponentDefs_1.d)(`Allows the customization of the icon displayed in the ${COMP} column header when sorting ` +
49
- `is enabled, sorting is done according to the column, and the column is sorted in ` +
50
- `ascending order.`),
51
- iconSortDesc: (0, ComponentDefs_1.d)(`Allows the customization of the icon displayed in the ${COMP} column header when sorting ` +
52
- `is enabled, sorting is done according to the column, and the column is sorted in ` +
53
- `descending order.`),
54
- enableMultiRowSelection: (0, ComponentDefs_1.d)(`This boolean property indicates whether you can select multiple rows in the table. ` +
55
- `This property only has an effect when the rowsSelectable property is set. Setting it ` +
56
- `to \`false\` limits selection to a single row.`),
57
- alwaysShowSelectionHeader: (0, ComponentDefs_1.d)("This property indicates when the row selection header is displayed. When the value is " +
58
- "`true,` the selection header is always visible. Otherwise, it is displayed only " +
59
- "when hovered.", null, "boolean", false),
52
+ hideHeader: {
53
+ description: "Set the header visibility using this property. Set it to \`true\` to hide the header.",
54
+ valueType: "boolean",
55
+ defaultValue: false,
56
+ },
57
+ iconNoSort: (0, ComponentDefs_1.d)(`Allows setting the icon displayed in the ${COMP} column header when sorting is ` +
58
+ `enabled, but the column remains unsorted.`),
59
+ iconSortAsc: (0, ComponentDefs_1.d)(`Allows setting the icon displayed in the ${COMP} column header when sorting is enabled, ` +
60
+ `and the column is sorted in ascending order.`),
61
+ iconSortDesc: (0, ComponentDefs_1.d)(`Allows setting the icon displayed in the ${COMP} column header when sorting is enabled, ` +
62
+ `and the column is sorted in descending order.`),
63
+ enableMultiRowSelection: {
64
+ description: `This boolean property indicates whether you can select multiple rows in the table. ` +
65
+ `This property only has an effect when the rowsSelectable property is set. Setting it ` +
66
+ `to \`false\` limits selection to a single row.`,
67
+ valueType: "boolean",
68
+ defaultValue: true,
69
+ },
70
+ alwaysShowSelectionHeader: {
71
+ description: "This property indicates when the row selection header is displayed. When the value is " +
72
+ "`true,` the selection header is always visible. Otherwise, it is displayed only " +
73
+ "when hovered.",
74
+ valueType: "boolean",
75
+ defaultValue: false,
76
+ },
60
77
  },
61
78
  events: {
62
79
  sortingDidChange: (0, ComponentDefs_1.d)(`This event is fired when the table data sorting has changed. It has two arguments: ` +
@@ -17,10 +17,19 @@ exports.TableOfContentsMd = (0, ComponentDefs_1.createMetadata)({
17
17
  `and displays them in a tree representing their hierarchy. When you select an item ` +
18
18
  `in this tree, the component navigates the page to the selected position.`,
19
19
  props: {
20
- smoothScrolling: (0, ComponentDefs_1.d)(`This property indicates that smooth scrolling is used while scrolling the selected table ` +
21
- `of contents items into view.`),
22
- maxHeadingLevel: (0, ComponentDefs_1.d)("Defines the maximum heading level to include in the table of contents. Headings " +
23
- "with a level greater than this value will be excluded."),
20
+ smoothScrolling: {
21
+ description: `This property indicates that smooth scrolling is used while scrolling the selected table ` +
22
+ `of contents items into view.`,
23
+ valueType: "boolean",
24
+ defaultValue: "false",
25
+ },
26
+ maxHeadingLevel: {
27
+ description: "Defines the maximum heading level (1 to 6) to include in the table of contents. " +
28
+ "For example, if it is 2, then `H1` and `H2` are displayed, but lower levels " +
29
+ "(`H3` to `H6`) are not.",
30
+ valueType: "number",
31
+ defaultValue: "6",
32
+ },
24
33
  },
25
34
  themeVars: (0, themeVars_1.parseScssVar)(TableOfContents_module_scss_1.default.themeVars),
26
35
  defaultThemeVars: {
@@ -12,15 +12,19 @@ const react_compose_refs_1 = require("@radix-ui/react-compose-refs");
12
12
  const classnames_1 = __importDefault(require("classnames"));
13
13
  const TableOfContents_module_scss_1 = __importDefault(require("./TableOfContents.module.scss"));
14
14
  const TableOfContentsContext_1 = require("../../components-core/TableOfContentsContext");
15
- const react_router_dom_1 = require("react-router-dom");
16
15
  exports.TableOfContents = (0, react_1.forwardRef)(function TableOfContents({ style, smoothScrolling, maxHeadingLevel = 6 }, forwardedRef) {
17
16
  const tocRef = (0, react_1.useRef)(null);
18
- const { headings, setObserveIntersection, activeAnchorId, setActiveAnchorId } = (0, TableOfContentsContext_1.useTableOfContents)();
17
+ const [activeAnchorId, setActiveId] = (0, react_1.useState)(null);
18
+ const { headings, scrollToAnchor, subscribeToActiveAnchorChange } = (0, TableOfContentsContext_1.useTableOfContents)();
19
+ (0, react_1.useLayoutEffect)(() => {
20
+ return subscribeToActiveAnchorChange((id) => {
21
+ const foundHeading = headings.find((heading) => heading.id === id);
22
+ if (foundHeading.level <= maxHeadingLevel) {
23
+ setActiveId(id);
24
+ }
25
+ });
26
+ }, [headings, maxHeadingLevel, subscribeToActiveAnchorChange]);
19
27
  const ref = forwardedRef ? (0, react_compose_refs_1.composeRefs)(tocRef, forwardedRef) : tocRef;
20
- const navigate = (0, react_router_dom_1.useNavigate)();
21
- (0, react_1.useEffect)(() => {
22
- setObserveIntersection(true);
23
- }, [setObserveIntersection]);
24
28
  (0, react_1.useEffect)(() => {
25
29
  if (activeAnchorId && (tocRef === null || tocRef === void 0 ? void 0 : tocRef.current)) {
26
30
  const activeAnchor = tocRef.current.querySelector(`#${activeAnchorId}`);
@@ -47,22 +51,11 @@ exports.TableOfContents = (0, react_1.forwardRef)(function TableOfContents({ sty
47
51
  [TableOfContents_module_scss_1.default.head_5]: value.level === 5,
48
52
  [TableOfContents_module_scss_1.default.head_6]: value.level === 6,
49
53
  }), to: `#${value.id}`, onClick: (event) => {
50
- event.preventDefault();
51
- value.anchor.scrollIntoView({
52
- block: "start",
53
- inline: "start",
54
- behavior: smoothScrolling ? "smooth" : "auto",
55
- });
56
- setActiveAnchorId(value.id);
57
- requestAnimationFrame(() => {
58
- navigate({
59
- hash: `#${value.id}`,
60
- }, {
61
- state: {
62
- preventHashScroll: true
63
- },
64
- });
65
- });
54
+ // cmd/ctrl + click - open in new tab, don't prevent that
55
+ if (!event.ctrlKey && !event.metaKey && !event.metaKey) {
56
+ event.preventDefault();
57
+ }
58
+ scrollToAnchor(value.id, smoothScrolling);
66
59
  }, id: value.id, children: value.text }) }, value.id));
67
60
  }
68
61
  return null;
@@ -19,9 +19,14 @@ exports.TabsMd = (0, ComponentDefs_1.createMetadata)({
19
19
  props: {
20
20
  activeTab: (0, ComponentDefs_1.d)(`This property indicates the index of the active tab. The indexing starts from 0, ` +
21
21
  `representing the starting (leftmost) tab.`),
22
- orientation: (0, ComponentDefs_1.d)(`This property indicates the orientation of the component. In horizontal orientation, ` +
23
- `the tab sections are laid out on the left side of the content panel, while in vertical ` +
24
- `orientation, the buttons are at the top.`),
22
+ orientation: {
23
+ description: `This property indicates the orientation of the component. In horizontal orientation, ` +
24
+ `the tab sections are laid out on the left side of the content panel, while in vertical ` +
25
+ `orientation, the buttons are at the top.`,
26
+ availableValues: ["horizontal", "vertical"],
27
+ defaultValue: "vertical",
28
+ valueType: "string",
29
+ },
25
30
  tabTemplate: (0, metadata_helpers_1.dComponent)(`This property declares the template for the clickable tab area.`),
26
31
  },
27
32
  apis: {
@@ -29,14 +29,26 @@ exports.TextMd = (0, ComponentDefs_1.createMetadata)({
29
29
  props: {
30
30
  value: (0, ComponentDefs_1.d)(`The text to be displayed. This value can also be set via nesting the text into ` +
31
31
  `the \`${COMP}\` component.`),
32
- variant: (0, ComponentDefs_1.d)(`Optional string value that provides named presets for text variants with a ` +
33
- `unique combination of font style, weight, size, color and other parameters.`, abstractions_1.variantOptionsMd),
34
- maxLines: (0, ComponentDefs_1.d)(`This property determines the maximum number of lines the component can wrap to. ` +
35
- `If there is no space to display all the contents, the component displays up to ` +
36
- `as many lines as specified in this property.`),
37
- preserveLinebreaks: (0, ComponentDefs_1.d)(`This property indicates if linebreaks should be preserved when displaying text.`),
38
- ellipses: (0, ComponentDefs_1.d)(`This property indicates whether ellipses should be displayed when the text is ` +
39
- `cropped (\`true\`) or not (\`false\`).`),
32
+ variant: {
33
+ description: "An optional string value that provides named presets for text variants with a " +
34
+ "unique combination of font style, weight, size, color, and other parameters. " +
35
+ "If not defined, the text uses the current style of its context.",
36
+ availableValues: abstractions_1.variantOptionsMd,
37
+ },
38
+ maxLines: (0, ComponentDefs_1.d)("This property determines the maximum number of lines the component can wrap to. " +
39
+ "If there is no space to display all the contents, the component displays up to as " +
40
+ "many lines as specified in this property. When the value is not defined, there is no limit on the displayed lines."),
41
+ preserveLinebreaks: {
42
+ description: `This property indicates if linebreaks should be preserved when displaying text.`,
43
+ valueType: "boolean",
44
+ defaultValue: "false",
45
+ },
46
+ ellipses: {
47
+ description: "This property indicates whether ellipses should be displayed when the text is " +
48
+ "cropped (\`true\`) or not (\`false\`).",
49
+ valueType: "boolean",
50
+ defaultValue: false,
51
+ },
40
52
  },
41
53
  themeVars: (0, themeVars_1.parseScssVar)(Text_module_scss_1.default.themeVars),
42
54
  defaultThemeVars: {
@@ -13,7 +13,7 @@ const metadata_helpers_1 = require("../metadata-helpers");
13
13
  const TextAreaNative_1 = require("./TextAreaNative");
14
14
  const COMP = "TextArea";
15
15
  exports.resizeOptionsMd = [
16
- { value: "undefined", description: "No resizing" },
16
+ { value: "(undefined)", description: "No resizing" },
17
17
  { value: "horizontal", description: "Can only resize horizontally" },
18
18
  { value: "vertical", description: "Can only resize vertically" },
19
19
  { value: "both", description: "Can resize in both dimensions" },
@@ -22,16 +22,31 @@ exports.TextAreaMd = (0, ComponentDefs_1.createMetadata)({
22
22
  status: "experimental",
23
23
  description: `\`${COMP}\` is a component that provides a multiline text input area.`,
24
24
  props: {
25
- enterSubmits: (0, ComponentDefs_1.d)(`This optional boolean property indicates whether pressing the \`Enter\` key on the ` +
26
- `keyboard prompts the parent \`Form\` component to submit. The default value is is \`true\`.`),
27
- escResets: (0, ComponentDefs_1.d)(`This boolean property indicates whether the ${COMP} contents should be reset when pressing ` +
28
- `the ESC key.`),
29
- maxRows: (0, ComponentDefs_1.d)(`This optional number property maximizes the number of lines the \`${COMP}\` can grow to.`),
30
- minRows: (0, ComponentDefs_1.d)(`This optional number property indicates the minimum number of lines the \`${COMP}\` ` +
31
- `has and specifies its size accordingly.`),
32
- rows: (0, ComponentDefs_1.d)(`Specifies the number of lines or rows (and thus, its size) the component has.`),
33
- autoSize: (0, ComponentDefs_1.d)(`If set to \`true\`, this boolean property enables the \`${COMP}\` to resize ` +
34
- `automatically based on the number of lines inside it.`, null, "boolean", false),
25
+ enterSubmits: {
26
+ description: "This optional boolean property indicates whether pressing the \`Enter\` key on the " +
27
+ "keyboard prompts the parent \`Form\` component to submit.",
28
+ valueType: "boolean",
29
+ defaultValue: true,
30
+ },
31
+ escResets: {
32
+ description: `This boolean property indicates whether the ${COMP} contents should be reset when pressing ` +
33
+ `the ESC key.`,
34
+ valueType: "boolean",
35
+ defaultValue: false,
36
+ },
37
+ maxRows: (0, ComponentDefs_1.d)(`This optional property sets the maximum number of text rows the \`${COMP}\` can grow.`),
38
+ minRows: (0, ComponentDefs_1.d)(`This optional property sets the minimum number of text rows the \`${COMP}\` can shrink.`),
39
+ rows: {
40
+ description: `Specifies the number of rows the component initially has.`,
41
+ valueType: "number",
42
+ defaultValue: 2,
43
+ },
44
+ autoSize: {
45
+ description: `If set to \`true\`, this boolean property enables the \`${COMP}\` to resize ` +
46
+ `automatically based on the number of lines inside it.`,
47
+ valueType: "boolean",
48
+ defaultValue: false,
49
+ },
35
50
  placeholder: (0, metadata_helpers_1.dPlaceholder)(),
36
51
  initialValue: (0, metadata_helpers_1.dInitialValue)(),
37
52
  label: (0, metadata_helpers_1.dLabel)(),
@@ -44,8 +59,10 @@ exports.TextAreaMd = (0, ComponentDefs_1.createMetadata)({
44
59
  readOnly: (0, metadata_helpers_1.dReadonly)(),
45
60
  enabled: (0, metadata_helpers_1.dEnabled)(),
46
61
  validationStatus: (0, metadata_helpers_1.dValidationStatus)(),
47
- resize: (0, ComponentDefs_1.d)(`This optional property specifies in which dimensions can the \`TextArea\` ` +
48
- `be resized by the user.`, exports.resizeOptionsMd),
62
+ resize: { description: `This optional property specifies in which dimensions can the \`TextArea\` ` +
63
+ `be resized by the user.`,
64
+ availableValues: exports.resizeOptionsMd,
65
+ },
49
66
  },
50
67
  events: {
51
68
  gotFocus: (0, metadata_helpers_1.dGotFocus)(COMP),
@@ -25,8 +25,12 @@ exports.ThemeMd = (0, ComponentDefs_1.createMetadata)({
25
25
  allowArbitraryProps: true,
26
26
  props: {
27
27
  themeId: (0, ComponentDefs_1.d)(`This property specifies which theme to use by setting the theme's id.`),
28
- tone: (0, ComponentDefs_1.d)(`This property allows the setting of the current theme's tone. Tone is either ` +
29
- `\`light\` or \`dark\`.`),
28
+ tone: {
29
+ description: "This property allows the setting of the current theme's tone.",
30
+ availableValues: ["light", "dark"],
31
+ valueType: "string",
32
+ defaultValue: "light",
33
+ },
30
34
  root: (0, ComponentDefs_1.d)(`This property indicates whether the component is at the root of the application.`),
31
35
  },
32
36
  opaque: true,
@@ -36,7 +36,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
36
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.Toggle = void 0;
39
+ exports.Toggle = exports.defaultProps = void 0;
40
40
  const jsx_runtime_1 = require("react/jsx-runtime");
41
41
  const react_1 = require("react");
42
42
  const react_2 = require("react");
@@ -46,7 +46,14 @@ const Toggle_module_scss_1 = __importDefault(require("./Toggle.module.scss"));
46
46
  const constants_1 = require("../../components-core/constants");
47
47
  const misc_1 = require("../../components-core/utils/misc");
48
48
  const ItemWithLabel_1 = require("../FormItem/ItemWithLabel");
49
- exports.Toggle = (0, react_3.forwardRef)(function Toggle({ id, initialValue = false, value = false, enabled = true, style, readOnly, validationStatus = "none", updateState = constants_1.noop, onDidChange = constants_1.noop, onFocus = constants_1.noop, onBlur = constants_1.noop, variant = "checkbox", indeterminate = false, className, label, labelPosition = "start", labelWidth, labelBreak, required, registerComponentApi, inputRenderer, }, forwardedRef) {
49
+ exports.defaultProps = {
50
+ initialValue: false,
51
+ value: false,
52
+ enabled: true,
53
+ validationStatus: "none",
54
+ indeterminate: false,
55
+ };
56
+ exports.Toggle = (0, react_3.forwardRef)(function Toggle({ id, initialValue = exports.defaultProps.initialValue, value = exports.defaultProps.value, enabled = exports.defaultProps.enabled, style, readOnly, validationStatus = exports.defaultProps.validationStatus, updateState = constants_1.noop, onDidChange = constants_1.noop, onFocus = constants_1.noop, onBlur = constants_1.noop, variant = "checkbox", indeterminate = exports.defaultProps.indeterminate, className, label, labelPosition = "end", labelWidth, labelBreak, required, registerComponentApi, inputRenderer, }, forwardedRef) {
50
57
  const generatedId = (0, react_1.useId)();
51
58
  const inputId = id || generatedId;
52
59
  const innerRef = react_3.default.useRef(null);
@@ -98,6 +105,7 @@ exports.Toggle = (0, react_3.forwardRef)(function Toggle({ id, initialValue = fa
98
105
  [Toggle_module_scss_1.default.warning]: validationStatus === "warning",
99
106
  [Toggle_module_scss_1.default.valid]: validationStatus === "valid",
100
107
  }) })), [
108
+ inputId,
101
109
  className,
102
110
  enabled,
103
111
  handleOnBlur,
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.VariantPropsKeys = exports.variantOptionsMd = exports.TextVariantElement = exports.orderingValues = exports.scrollAnchoringNames = exports.scrollAnchoringValues = exports.validationStatusMd = exports.validationStatusNames = exports.validationStatusValues = exports.triggerPositionNames = exports.labelPositionMd = exports.labelPositionNames = exports.labelPositionValues = exports.placementMd = exports.placementNames = exports.statusColorMd = exports.statusColorNames = exports.iconPositionMd = exports.iconPositionNames = exports.iconPositionValues = exports.orientationOptionMd = exports.orientationOptionNames = exports.alignmentOptionMd = exports.alignmentOptionNames = exports.alignmentOptionValues = exports.buttonAriaNames = exports.buttonVariantMd = exports.buttonVariantNames = exports.buttonTypesMd = exports.buttonTypeNames = exports.buttonTypeValues = exports.buttonThemeMd = exports.buttonThemeNames = exports.sizeNames = exports.sizeMd = exports.viewportSizeNames = exports.viewportSizeMd = exports.LinkTargetMd = exports.LinkTargetNames = void 0;
3
+ exports.httpMethodNames = exports.VariantPropsKeys = exports.variantOptionsMd = exports.TextVariantElement = exports.orderingValues = exports.scrollAnchoringNames = exports.scrollAnchoringValues = exports.validationStatusMd = exports.validationStatusNames = exports.validationStatusValues = exports.triggerPositionNames = exports.labelPositionMd = exports.labelPositionNames = exports.labelPositionValues = exports.placementMd = exports.placementNames = exports.statusColorMd = exports.statusColorNames = exports.iconPositionMd = exports.iconPositionNames = exports.iconPositionValues = exports.orientationOptionMd = exports.orientationOptionNames = exports.alignmentOptionMd = exports.alignmentOptionNames = exports.alignmentOptionValues = exports.buttonAriaNames = exports.buttonVariantMd = exports.buttonVariantNames = exports.buttonTypesMd = exports.buttonTypeNames = exports.buttonTypeValues = exports.buttonThemeMd = exports.buttonThemeNames = exports.sizeNames = exports.sizeMd = exports.viewportSizeNames = exports.viewportSizeMd = exports.LinkTargetMd = exports.LinkTargetNames = void 0;
4
4
  exports.LinkTargetNames = ["_self", "_blank", "_parent", "_top", "_unfencedTop"];
5
5
  exports.LinkTargetMd = [
6
6
  {
@@ -21,8 +21,8 @@ exports.LinkTargetMd = [
21
21
  },
22
22
  {
23
23
  value: "_unfencedTop",
24
- description: "Allows embedded fenced frames to navigate the top-level frame, i.e. traversing beyond the root of the fenced frame."
25
- }
24
+ description: "Allows embedded fenced frames to navigate the top-level frame, i.e. traversing beyond the root of the fenced frame.",
25
+ },
26
26
  ];
27
27
  // --- Available view sizes
28
28
  exports.viewportSizeMd = [
@@ -291,3 +291,14 @@ exports.variantOptionsMd = [
291
291
  const AbbreviationKeys = ["title"];
292
292
  const InsertedKeys = ["cite", "dateTime"];
293
293
  exports.VariantPropsKeys = [...AbbreviationKeys, ...InsertedKeys];
294
+ exports.httpMethodNames = [
295
+ "get",
296
+ "post",
297
+ "put",
298
+ "delete",
299
+ "patch",
300
+ "head",
301
+ "options",
302
+ "trace",
303
+ "connect",
304
+ ];
@@ -62,22 +62,24 @@ function dDidChange(comp) {
62
62
  description: `This event is triggered when value of ${comp} has changed.`,
63
63
  };
64
64
  }
65
- function dIndeterminate() {
65
+ function dIndeterminate(defaultValue) {
66
66
  return {
67
67
  description: `The \`true\` value of this property signals that the component is in an ` +
68
68
  `_intedeterminate state_.`,
69
+ defaultValue,
69
70
  };
70
71
  }
71
72
  function dLabel() {
72
73
  return {
73
74
  description: `This property sets the label of the component.`,
75
+ valueType: "string",
74
76
  };
75
77
  }
76
78
  function dLabelPosition(def) {
77
79
  return {
78
80
  description: `Places the label at the given position of the component.`,
79
81
  availableValues: abstractions_1.labelPositionMd,
80
- defaultValue: def,
82
+ defaultValue: def !== null && def !== void 0 ? def : "top",
81
83
  };
82
84
  }
83
85
  function dLabelWidth(comp) {
@@ -100,22 +102,24 @@ function dAutoFocus() {
100
102
  defaultValue: false,
101
103
  };
102
104
  }
103
- function dInitialValue(def) {
105
+ function dInitialValue(value) {
104
106
  return {
105
107
  description: `This property sets the component's initial value.`,
106
- defaultValue: def,
108
+ defaultValue: value,
107
109
  };
108
110
  }
109
- function dReadonly() {
111
+ function dReadonly(readOnly) {
110
112
  return {
111
113
  description: `Set this property to \`true\` to disallow changing the component value.`,
114
+ valueType: "boolean",
115
+ defaultValue: readOnly !== null && readOnly !== void 0 ? readOnly : false,
112
116
  };
113
117
  }
114
- function dEnabled() {
118
+ function dEnabled(isEnabled) {
115
119
  return {
116
120
  description: `This boolean property value indicates whether the component responds to user events (\`true\`) or not (\`false\`).`,
117
121
  valueType: "boolean",
118
- defaultValue: true,
122
+ defaultValue: isEnabled !== null && isEnabled !== void 0 ? isEnabled : true,
119
123
  };
120
124
  }
121
125
  function dMulti() {
@@ -125,10 +129,11 @@ function dMulti() {
125
129
  defaultValue: false,
126
130
  };
127
131
  }
128
- function dValidationStatus() {
132
+ function dValidationStatus(value) {
129
133
  return {
130
134
  description: `This property allows you to set the validation status of the input component.`,
131
135
  availableValues: abstractions_1.validationStatusMd,
136
+ defaultValue: value !== null && value !== void 0 ? value : "none",
132
137
  };
133
138
  }
134
139
  function dValueApi() {
@@ -152,41 +157,48 @@ function dComponent(description) {
152
157
  function dPlaceholder() {
153
158
  return {
154
159
  description: `A placeholder text that is visible in the input field when its empty.`,
160
+ valueType: "string",
155
161
  };
156
162
  }
157
163
  function dMaxLength() {
158
164
  return {
159
165
  description: `This property sets the maximum length of the input it accepts.`,
166
+ valueType: "number",
160
167
  };
161
168
  }
162
169
  function dRequired() {
163
170
  return {
164
171
  description: `Set this property to \`true\` to indicate it must have a value ` +
165
172
  `before submitting the containing form.`,
173
+ valueType: "boolean",
166
174
  };
167
175
  }
168
176
  function dStartText() {
169
177
  return {
170
178
  description: `This property sets a text to appear at the start (left side when the ` +
171
179
  `left-to-right direction is set) of the input.`,
180
+ valueType: "string",
172
181
  };
173
182
  }
174
183
  function dStartIcon() {
175
184
  return {
176
185
  description: `This property sets an icon to appear at the start (left side when the ` +
177
186
  `left-to-right direction is set) of the input.`,
187
+ valueType: "string",
178
188
  };
179
189
  }
180
190
  function dEndText() {
181
191
  return {
182
192
  description: `This property sets a text to appear on the end (right side when the ` +
183
193
  `left-to-right direction is set) of the input.`,
194
+ valueType: "string",
184
195
  };
185
196
  }
186
197
  function dEndIcon() {
187
198
  return {
188
199
  description: `This property sets an icon to appear on the end (right side when the ` +
189
200
  `left-to-right direction is set) of the input.`,
201
+ valueType: "string",
190
202
  };
191
203
  }
192
204
  function dExpanded(comp) {
@@ -7,6 +7,8 @@ const jsx_runtime_1 = require("react/jsx-runtime");
7
7
  const react_1 = require("react");
8
8
  const hooks_1 = require("./utils/hooks");
9
9
  const react_2 = require("@remix-run/react");
10
+ const constants_1 = require("./constants");
11
+ const react_router_dom_1 = require("react-router-dom");
10
12
  /**
11
13
  * Several components work together to represent the hierarchy of a particular
12
14
  * app page as a TOC. This React component provides a context for storing this
@@ -18,9 +20,8 @@ exports.TableOfContentsContext = (0, react_1.createContext)(null);
18
20
  */
19
21
  function TableOfContentsProvider({ children }) {
20
22
  var _a, _b;
21
- const [headings, setHeadings] = (0, react_1.useState)({});
22
- const [observeIntersection, setObserveIntersection] = (0, react_1.useState)(false);
23
- const [activeId, setActiveId] = (0, react_1.useState)(null);
23
+ const [headings, setHeadings] = (0, react_1.useState)(constants_1.EMPTY_OBJECT);
24
+ const [callbacks, setCallbacks] = (0, react_1.useState)(constants_1.EMPTY_ARRAY);
24
25
  const observer = (0, react_1.useRef)(null);
25
26
  const initialHeading = (0, react_1.useRef)(null);
26
27
  const thisRef = (0, react_1.useRef)({
@@ -32,25 +33,33 @@ function TableOfContentsProvider({ children }) {
32
33
  thisRef.current.suspendPositionBasedSetActiveId = false;
33
34
  }, []),
34
35
  });
36
+ const notify = (0, react_1.useCallback)((id) => {
37
+ callbacks.forEach((cb) => cb(id));
38
+ }, [callbacks]);
35
39
  (0, react_1.useEffect)(() => {
36
- if (observeIntersection) {
40
+ if (callbacks.length) {
37
41
  const handleObserver = (entries) => {
38
42
  entries.forEach((entry) => {
39
43
  if (entry === null || entry === void 0 ? void 0 : entry.isIntersecting) {
40
44
  if (!thisRef.current.suspendPositionBasedSetActiveId) {
41
- setActiveId(entry.target.id);
45
+ notify(entry.target.id);
42
46
  }
43
47
  }
44
48
  });
45
49
  };
50
+ // stolen from nextra: https://github.com/shuding/nextra/blob/3729f67059f1fbdd3f98125bebabbe568c918694/packages/nextra-theme-docs/src/mdx-components/heading-anchor.client.tsx
51
+ // let headerHeight = getComputedStyle(scrollParent || document.body).getPropertyValue(
52
+ // '--header-abs-height'
53
+ // );
46
54
  observer.current = new IntersectionObserver(handleObserver, {
47
- rootMargin: "0px 0px -50%",
48
- threshold: [0, 1],
55
+ rootMargin: `0% 0% -80%`,
56
+ // root: scrollParent,
57
+ // threshold: [0, 1],
49
58
  });
50
59
  Object.values(headings).forEach((elem) => { var _a, _b; return (_b = (_a = observer === null || observer === void 0 ? void 0 : observer.current) === null || _a === void 0 ? void 0 : _a.observe) === null || _b === void 0 ? void 0 : _b.call(_a, elem.anchor); });
51
60
  return () => { var _a; return (_a = observer.current) === null || _a === void 0 ? void 0 : _a.disconnect(); };
52
61
  }
53
- }, [headings, observeIntersection]);
62
+ }, [callbacks.length, headings, notify, scrollParent]);
54
63
  const registerHeading = (0, react_1.useCallback)((headingItem) => {
55
64
  setHeadings((prevHeadings) => {
56
65
  return Object.assign(Object.assign({}, prevHeadings), { [headingItem.id]: headingItem });
@@ -63,12 +72,28 @@ function TableOfContentsProvider({ children }) {
63
72
  });
64
73
  };
65
74
  }, []);
66
- const setActiveAnchorId = (0, react_1.useCallback)((id) => {
67
- if (headings[id]) {
75
+ const navigate = (0, react_router_dom_1.useNavigate)();
76
+ const scrollToAnchor = (0, react_1.useCallback)((id, smoothScrolling) => {
77
+ const value = headings[id];
78
+ if (value) {
79
+ value.anchor.scrollIntoView({
80
+ block: "start",
81
+ inline: "start",
82
+ behavior: smoothScrolling ? "smooth" : "auto",
83
+ });
84
+ notify(id);
85
+ requestAnimationFrame(() => {
86
+ navigate({
87
+ hash: `#${value.id}`,
88
+ }, {
89
+ state: {
90
+ preventHashScroll: true,
91
+ },
92
+ });
93
+ });
68
94
  thisRef.current.suspendPositionBasedSetActiveId = true;
69
- setActiveId(id);
70
95
  }
71
- }, [headings]);
96
+ }, [headings, navigate, notify]);
72
97
  const sortedHeadings = (0, react_1.useMemo)(() => {
73
98
  return Object.values(headings).sort(function (a, b) {
74
99
  if (a.anchor === b.anchor)
@@ -100,16 +125,31 @@ function TableOfContentsProvider({ children }) {
100
125
  }
101
126
  }
102
127
  }, [location.hash, sortedHeadings]);
128
+ const subscribeToActiveAnchorChange = (0, react_1.useCallback)((cb) => {
129
+ setCallbacks((prev) => {
130
+ return [...prev, cb];
131
+ });
132
+ return () => {
133
+ setCallbacks((prev) => {
134
+ return prev.filter((item) => item !== cb);
135
+ });
136
+ };
137
+ }, []);
103
138
  const contextValue = (0, react_1.useMemo)(() => {
104
139
  return {
105
140
  registerHeading,
106
141
  headings: sortedHeadings,
107
- observeIntersection,
108
- setObserveIntersection,
109
- activeAnchorId: activeId,
110
- setActiveAnchorId,
142
+ scrollToAnchor,
143
+ subscribeToActiveAnchorChange,
144
+ hasTableOfContents: callbacks.length > 0,
111
145
  };
112
- }, [registerHeading, sortedHeadings, observeIntersection, activeId, setActiveAnchorId]);
146
+ }, [
147
+ registerHeading,
148
+ sortedHeadings,
149
+ scrollToAnchor,
150
+ subscribeToActiveAnchorChange,
151
+ callbacks.length,
152
+ ]);
113
153
  return ((0, jsx_runtime_1.jsx)(exports.TableOfContentsContext.Provider, { value: contextValue, children: children }));
114
154
  }
115
155
  function useTableOfContents() {
@@ -66,7 +66,7 @@ function DataLoader({ loader, state, registerComponentApi, onLoaded, onError, lo
66
66
  }), [api, loader.props, state]);
67
67
  const queryId = (0, react_1.useMemo)(() => {
68
68
  return new DataLoaderQueryKeyGenerator_1.DataLoaderQueryKeyGenerator(url, queryParams, appContext === null || appContext === void 0 ? void 0 : appContext.appGlobals.apiUrl, body, rawBody).asKey();
69
- }, [appContext === null || appContext === void 0 ? void 0 : appContext.appGlobals.apiUrl, queryParams, url]);
69
+ }, [appContext === null || appContext === void 0 ? void 0 : appContext.appGlobals.apiUrl, queryParams, url, body, rawBody]);
70
70
  const stateRef = (0, react_1.useRef)({ state, appContext });
71
71
  stateRef.current = { state, appContext };
72
72
  const loadingToastIdRef = (0, react_1.useRef)(undefined);
@@ -256,6 +256,9 @@ function getScrollParent(element) {
256
256
  return document.body;
257
257
  }
258
258
  for (let parent = element;; parent = parent.parentElement) {
259
+ if (!parent) {
260
+ return null;
261
+ }
259
262
  style = getComputedStyle(parent);
260
263
  if (excludeStaticParent && style.position === "static") {
261
264
  continue;