xmlui 0.4.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.
- package/dist/Pdf-DeGhSMXe.mjs +19537 -0
- package/dist/Pdf.css +1 -0
- package/dist/apiInterceptorWorker-CwuUhYyc.mjs +9229 -0
- package/dist/array-USo-Szhp.mjs +12 -0
- package/dist/index-C24dkfpd.mjs +1434 -0
- package/dist/index-ao27SnVp.mjs +145185 -0
- package/dist/index.css +1 -0
- package/dist/nivo-bar.es-CWh0ZlxB.mjs +1666 -0
- package/dist/nivo-geo.es-BTqNt5Db.mjs +1579 -0
- package/dist/nivo-legends.es-BuIxHGSU.mjs +6916 -0
- package/dist/nivo-pie.es-BvCBFA0L.mjs +700 -0
- package/dist/react-apexcharts.min-DqWuDOyO.mjs +8881 -0
- package/dist/scripts/bin/bootstrap.js +11 -0
- package/dist/scripts/bin/build.js +256 -0
- package/dist/scripts/bin/index.js +88 -0
- package/dist/scripts/bin/preview.js +27 -0
- package/dist/scripts/bin/start.js +41 -0
- package/dist/scripts/bin/vite-ueml-plugin.js +113 -0
- package/dist/scripts/bin/viteConfig.js +112 -0
- package/dist/scripts/src/abstractions/ActionDefs.js +2 -0
- package/dist/scripts/src/abstractions/AppContextDefs.js +2 -0
- package/dist/scripts/src/abstractions/BlockScope.js +4 -0
- package/dist/scripts/src/abstractions/ComponentDefs.js +2 -0
- package/dist/scripts/src/abstractions/ComponentDescriptorDefs.js +2 -0
- package/dist/scripts/src/abstractions/ContainerDefs.js +2 -0
- package/dist/scripts/src/abstractions/FunctionDefs.js +2 -0
- package/dist/scripts/src/abstractions/RendererDefs.js +2 -0
- package/dist/scripts/src/abstractions/scripting/ScriptParserError.js +2 -0
- package/dist/scripts/src/abstractions/scripting/ScriptingSourceTree.js +2 -0
- package/dist/scripts/src/abstractions/scripting/Token.js +110 -0
- package/dist/scripts/src/components/App/App.js +253 -0
- package/dist/scripts/src/components/App/AppLayoutContext.js +9 -0
- package/dist/scripts/src/components/App/AppStateContext.js +9 -0
- package/dist/scripts/src/components/App/Sheet.js +89 -0
- package/dist/scripts/src/components/AppHeader/AppHeader.js +121 -0
- package/dist/scripts/src/components/AppState/AppState.js +29 -0
- package/dist/scripts/src/components/Avatar/Avatar.js +81 -0
- package/dist/scripts/src/components/Badge/Badge.js +56 -0
- package/dist/scripts/src/components/BarChart/BarChart.js +199 -0
- package/dist/scripts/src/components/Bookmark/Bookmark.js +11 -0
- package/dist/scripts/src/components/Button/Button.js +196 -0
- package/dist/scripts/src/components/Card/Card.js +65 -0
- package/dist/scripts/src/components/ChangeListener/ChangeListener.js +43 -0
- package/dist/scripts/src/components/Chart/Chart.js +158 -0
- package/dist/scripts/src/components/Checkbox/Checkbox.js +43 -0
- package/dist/scripts/src/components/Combobox/Combobox.js +145 -0
- package/dist/scripts/src/components/ComponentProvider.js +357 -0
- package/dist/scripts/src/components/ContentSeparator/ContentSeparator.js +40 -0
- package/dist/scripts/src/components/DatePicker/DatePicker.js +196 -0
- package/dist/scripts/src/components/DropdownMenu/DropdownMenu.js +175 -0
- package/dist/scripts/src/components/EmojiSelector/EmojiSelector.js +56 -0
- package/dist/scripts/src/components/FileInput/FileInput.js +127 -0
- package/dist/scripts/src/components/FileUploadDropZone/FileUploadDropZone.js +106 -0
- package/dist/scripts/src/components/FlowLayout/FlowLayout.js +139 -0
- package/dist/scripts/src/components/Footer/Footer.js +42 -0
- package/dist/scripts/src/components/Form/Form.js +320 -0
- package/dist/scripts/src/components/Form/FormContext.js +9 -0
- package/dist/scripts/src/components/Form/formActions.js +86 -0
- package/dist/scripts/src/components/FormItem/FormItem.js +204 -0
- package/dist/scripts/src/components/FormItem/HelperText.js +27 -0
- package/dist/scripts/src/components/FormItem/ItemWithLabel.js +39 -0
- package/dist/scripts/src/components/FormItem/Validations.js +346 -0
- package/dist/scripts/src/components/FormSection/FormSection.js +45 -0
- package/dist/scripts/src/components/Heading/Heading.js +206 -0
- package/dist/scripts/src/components/HoverCard/HoverCard.js +45 -0
- package/dist/scripts/src/components/Icon/ApiIcon.js +10 -0
- package/dist/scripts/src/components/Icon/Attach.js +10 -0
- package/dist/scripts/src/components/Icon/Binding.js +11 -0
- package/dist/scripts/src/components/Icon/BoardIcon.js +7 -0
- package/dist/scripts/src/components/Icon/BoxIcon.js +10 -0
- package/dist/scripts/src/components/Icon/CheckIcon.js +7 -0
- package/dist/scripts/src/components/Icon/ChevronDownIcon.js +7 -0
- package/dist/scripts/src/components/Icon/ChevronLeft.js +7 -0
- package/dist/scripts/src/components/Icon/ChevronRight.js +7 -0
- package/dist/scripts/src/components/Icon/ChevronUpIcon.js +7 -0
- package/dist/scripts/src/components/Icon/CodeFileIcon.js +10 -0
- package/dist/scripts/src/components/Icon/CodeSandbox.js +10 -0
- package/dist/scripts/src/components/Icon/CompactListIcon.js +7 -0
- package/dist/scripts/src/components/Icon/ContentCopyIcon.js +7 -0
- package/dist/scripts/src/components/Icon/DatabaseIcon.js +11 -0
- package/dist/scripts/src/components/Icon/DocFileIcon.js +10 -0
- package/dist/scripts/src/components/Icon/DocIcon.js +10 -0
- package/dist/scripts/src/components/Icon/DotMenuHorizontalIcon.js +7 -0
- package/dist/scripts/src/components/Icon/DotMenuIcon.js +7 -0
- package/dist/scripts/src/components/Icon/EmailIcon.js +7 -0
- package/dist/scripts/src/components/Icon/EmptyFolderIcon.js +10 -0
- package/dist/scripts/src/components/Icon/ErrorIcon.js +7 -0
- package/dist/scripts/src/components/Icon/ExpressionIcon.js +10 -0
- package/dist/scripts/src/components/Icon/FillPlusCricleIcon.js +7 -0
- package/dist/scripts/src/components/Icon/FilterIcon.js +10 -0
- package/dist/scripts/src/components/Icon/FolderIcon.js +10 -0
- package/dist/scripts/src/components/Icon/GlobeIcon.js +7 -0
- package/dist/scripts/src/components/Icon/HomeIcon.js +7 -0
- package/dist/scripts/src/components/Icon/HyperLinkIcon.js +7 -0
- package/dist/scripts/src/components/Icon/Icon.js +101 -0
- package/dist/scripts/src/components/Icon/ImageFileIcon.js +10 -0
- package/dist/scripts/src/components/Icon/LinkIcon.js +7 -0
- package/dist/scripts/src/components/Icon/ListIcon.js +7 -0
- package/dist/scripts/src/components/Icon/LooseListIcon.js +7 -0
- package/dist/scripts/src/components/Icon/MoonIcon.js +10 -0
- package/dist/scripts/src/components/Icon/MoreOptionsIcon.js +7 -0
- package/dist/scripts/src/components/Icon/PDFIcon.js +10 -0
- package/dist/scripts/src/components/Icon/PenIcon.js +7 -0
- package/dist/scripts/src/components/Icon/PhoneIcon.js +7 -0
- package/dist/scripts/src/components/Icon/PhotoIcon.js +10 -0
- package/dist/scripts/src/components/Icon/PlusIcon.js +7 -0
- package/dist/scripts/src/components/Icon/SearchIcon.js +7 -0
- package/dist/scripts/src/components/Icon/ShareIcon.js +10 -0
- package/dist/scripts/src/components/Icon/SunIcon.js +10 -0
- package/dist/scripts/src/components/Icon/TrashIcon.js +7 -0
- package/dist/scripts/src/components/Icon/TxtIcon.js +10 -0
- package/dist/scripts/src/components/Icon/UnknownFileIcon.js +10 -0
- package/dist/scripts/src/components/Icon/UnlinkIcon.js +10 -0
- package/dist/scripts/src/components/Icon/UserIcon.js +7 -0
- package/dist/scripts/src/components/Icon/WarningIcon.js +7 -0
- package/dist/scripts/src/components/Icon/XlsIcon.js +10 -0
- package/dist/scripts/src/components/IconProvider.js +249 -0
- package/dist/scripts/src/components/IconRegistryContext.js +307 -0
- package/dist/scripts/src/components/Image/Image.js +34 -0
- package/dist/scripts/src/components/Input/InputAdornment.js +14 -0
- package/dist/scripts/src/components/Input/input-abstractions.js +44 -0
- package/dist/scripts/src/components/Items/Items.js +48 -0
- package/dist/scripts/src/components/Link/Link.js +72 -0
- package/dist/scripts/src/components/List/List.js +442 -0
- package/dist/scripts/src/components/Logo/Logo.js +25 -0
- package/dist/scripts/src/components/Map/Map.js +60 -0
- package/dist/scripts/src/components/Map/world_countries.json +45307 -0
- package/dist/scripts/src/components/Markdown/Markdown.js +120 -0
- package/dist/scripts/src/components/ModalDialog/ConfirmationModalContextProvider.js +106 -0
- package/dist/scripts/src/components/ModalDialog/Dialog.js +20 -0
- package/dist/scripts/src/components/ModalDialog/ModalDialog.js +145 -0
- package/dist/scripts/src/components/MultiCombobox/MultiCombobox.js +249 -0
- package/dist/scripts/src/components/MultiSelect/MultiSelect.js +192 -0
- package/dist/scripts/src/components/NavGroup/NavGroup.js +113 -0
- package/dist/scripts/src/components/NavLink/NavLink.js +115 -0
- package/dist/scripts/src/components/NavPanel/NavPanel.js +101 -0
- package/dist/scripts/src/components/NoResult/NoResult.js +39 -0
- package/dist/scripts/src/components/NumberBox/NumberBox.js +373 -0
- package/dist/scripts/src/components/Option/Option.js +41 -0
- package/dist/scripts/src/components/PageMetaTitle/PageMetaTitle.js +22 -0
- package/dist/scripts/src/components/Pages/Pages.js +74 -0
- package/dist/scripts/src/components/Pdf/LazyPdf.js +44 -0
- package/dist/scripts/src/components/Pdf/Pdf.js +19 -0
- package/dist/scripts/src/components/PieChart/PieChart.js +184 -0
- package/dist/scripts/src/components/PositionedContainer/PositionedContainer.js +29 -0
- package/dist/scripts/src/components/ProgressBar/ProgressBar.js +38 -0
- package/dist/scripts/src/components/Queue/Queue.js +286 -0
- package/dist/scripts/src/components/Queue/queueActions.js +87 -0
- package/dist/scripts/src/components/RadioGroup/RadioGroup.js +144 -0
- package/dist/scripts/src/components/RealTimeAdapter/RealTimeAdapter.js +147 -0
- package/dist/scripts/src/components/Redirect/Redirect.js +10 -0
- package/dist/scripts/src/components/Select/Select.js +139 -0
- package/dist/scripts/src/components/Select/SelectContext.js +45 -0
- package/dist/scripts/src/components/SelectionStore/SelectionStore.js +88 -0
- package/dist/scripts/src/components/SpaceFiller/SpaceFiller.js +22 -0
- package/dist/scripts/src/components/Spinner/Spinner.js +59 -0
- package/dist/scripts/src/components/Splitter/Splitter.js +205 -0
- package/dist/scripts/src/components/Splitter/utils.js +17 -0
- package/dist/scripts/src/components/Stack/Stack.js +117 -0
- package/dist/scripts/src/components/StickyBox/StickyBox.js +33 -0
- package/dist/scripts/src/components/Switch/Switch.js +50 -0
- package/dist/scripts/src/components/Table/Table.js +499 -0
- package/dist/scripts/src/components/Table/useRowSelection.js +169 -0
- package/dist/scripts/src/components/TableColumnDef/TableColumnDef.js +44 -0
- package/dist/scripts/src/components/TableColumnDef/TableContext.js +12 -0
- package/dist/scripts/src/components/Tabs/Tabs.js +85 -0
- package/dist/scripts/src/components/Text/Text.js +175 -0
- package/dist/scripts/src/components/TextArea/TextArea.js +194 -0
- package/dist/scripts/src/components/TextArea/TextAreaResizable.js +63 -0
- package/dist/scripts/src/components/TextArea/useComposedRef.js +50 -0
- package/dist/scripts/src/components/TextBox/TextBox.js +145 -0
- package/dist/scripts/src/components/Theme/NotificationToast.js +39 -0
- package/dist/scripts/src/components/Theme/Theme.js +153 -0
- package/dist/scripts/src/components/ThemeChanger/ThemeChanger.js +125 -0
- package/dist/scripts/src/components/Toggle/Toggle.js +88 -0
- package/dist/scripts/src/components/Tree/TreeComponent.js +79 -0
- package/dist/scripts/src/components/ValidationSummary/ValidationSummary.js +59 -0
- package/dist/scripts/src/components/ViewComponentRegistryContext.js +34 -0
- package/dist/scripts/src/components/abstractions.js +2 -0
- package/dist/scripts/src/components/chart-color-schemes.js +43 -0
- package/dist/scripts/src/components/component-utils.js +32 -0
- package/dist/scripts/src/components/container-helpers.js +18 -0
- package/dist/scripts/src/components-core/ApiBoundComponent.js +189 -0
- package/dist/scripts/src/components-core/AppContext.js +17 -0
- package/dist/scripts/src/components-core/ChildrenSlot.js +10 -0
- package/dist/scripts/src/components-core/Component.js +280 -0
- package/dist/scripts/src/components-core/ComponentDecorator.js +63 -0
- package/dist/scripts/src/components-core/CompoundComponent.js +132 -0
- package/dist/scripts/src/components-core/EngineError.js +91 -0
- package/dist/scripts/src/components-core/ErrorBoundary.js +58 -0
- package/dist/scripts/src/components-core/Fragment.js +14 -0
- package/dist/scripts/src/components-core/InvalidComponent.js +15 -0
- package/dist/scripts/src/components-core/LoaderComponent.js +78 -0
- package/dist/scripts/src/components-core/RestApiProxy.js +341 -0
- package/dist/scripts/src/components-core/RootComponent.js +272 -0
- package/dist/scripts/src/components-core/RouteContext.js +45 -0
- package/dist/scripts/src/components-core/ScrollContext.js +9 -0
- package/dist/scripts/src/components-core/UnknownComponent.js +15 -0
- package/dist/scripts/src/components-core/abstractions/ComponentRenderer.js +2 -0
- package/dist/scripts/src/components-core/abstractions/LoaderRenderer.js +2 -0
- package/dist/scripts/src/components-core/abstractions/containers.js +18 -0
- package/dist/scripts/src/components-core/abstractions/treeAbstractions.js +2 -0
- package/dist/scripts/src/components-core/action/ApiAction.js +276 -0
- package/dist/scripts/src/components-core/action/DownloadFileAction.js +80 -0
- package/dist/scripts/src/components-core/action/NavigateAction.js +20 -0
- package/dist/scripts/src/components-core/action/TimedAction.js +21 -0
- package/dist/scripts/src/components-core/action/UploadAction.js +88 -0
- package/dist/scripts/src/components-core/action/actions.js +15 -0
- package/dist/scripts/src/components-core/appContext/date-functions.js +19 -0
- package/dist/scripts/src/components-core/appContext/misc-utils.js +12 -0
- package/dist/scripts/src/components-core/component-hooks.js +25 -0
- package/dist/scripts/src/components-core/constants.js +18 -0
- package/dist/scripts/src/components-core/container/Container.js +1110 -0
- package/dist/scripts/src/components-core/container/ContainerComponentDef.js +16 -0
- package/dist/scripts/src/components-core/container/buildProxy.js +54 -0
- package/dist/scripts/src/components-core/container/collectFnVarDeps.js +26 -0
- package/dist/scripts/src/components-core/container/valueExtractor.js +195 -0
- package/dist/scripts/src/components-core/descriptorHelper.js +75 -0
- package/dist/scripts/src/components-core/interception/abstractions.js +2 -0
- package/dist/scripts/src/components-core/interception/useApiInterceptorContext.js +9 -0
- package/dist/scripts/src/components-core/loader/ApiLoader.js +46 -0
- package/dist/scripts/src/components-core/loader/DataLoader.js +160 -0
- package/dist/scripts/src/components-core/loader/ExternalDataLoader.js +52 -0
- package/dist/scripts/src/components-core/loader/Loader.js +115 -0
- package/dist/scripts/src/components-core/loader/MockLoaderRenderer.js +32 -0
- package/dist/scripts/src/components-core/loader/PageableLoader.js +240 -0
- package/dist/scripts/src/components-core/renderers.js +45 -0
- package/dist/scripts/src/components-core/reportEngineError.js +59 -0
- package/dist/scripts/src/components-core/script-runner/BindingTreeEvaluationContext.js +35 -0
- package/dist/scripts/src/components-core/script-runner/ICustomOperations.js +34 -0
- package/dist/scripts/src/components-core/script-runner/LogicalThread.js +2 -0
- package/dist/scripts/src/components-core/script-runner/LoopScope.js +2 -0
- package/dist/scripts/src/components-core/script-runner/ParameterParser.js +117 -0
- package/dist/scripts/src/components-core/script-runner/TryScope.js +2 -0
- package/dist/scripts/src/components-core/script-runner/asyncProxy.js +96 -0
- package/dist/scripts/src/components-core/script-runner/bannedFunctions.js +34 -0
- package/dist/scripts/src/components-core/script-runner/custom-operations-registry.js +40 -0
- package/dist/scripts/src/components-core/script-runner/custom-ui-data.js +40 -0
- package/dist/scripts/src/components-core/script-runner/eval-tree-async.js +551 -0
- package/dist/scripts/src/components-core/script-runner/eval-tree-common.js +498 -0
- package/dist/scripts/src/components-core/script-runner/eval-tree-sync.js +434 -0
- package/dist/scripts/src/components-core/script-runner/modules.js +250 -0
- package/dist/scripts/src/components-core/script-runner/process-statement-async.js +818 -0
- package/dist/scripts/src/components-core/script-runner/process-statement-common.js +193 -0
- package/dist/scripts/src/components-core/script-runner/process-statement-sync.js +740 -0
- package/dist/scripts/src/components-core/script-runner/statement-queue.js +62 -0
- package/dist/scripts/src/components-core/script-runner/visitors.js +352 -0
- package/dist/scripts/src/components-core/theming/ThemeContext.js +43 -0
- package/dist/scripts/src/components-core/theming/ThemeProvider.js +334 -0
- package/dist/scripts/src/components-core/theming/abstractions.js +11 -0
- package/dist/scripts/src/components-core/theming/extendThemeUtils.js +114 -0
- package/dist/scripts/src/components-core/theming/hvar.js +105 -0
- package/dist/scripts/src/components-core/theming/themeVars.js +62 -0
- package/dist/scripts/src/components-core/theming/themes/base-utils.js +31 -0
- package/dist/scripts/src/components-core/theming/themes/palette.js +53 -0
- package/dist/scripts/src/components-core/theming/themes/root.js +257 -0
- package/dist/scripts/src/components-core/theming/themes/solid.js +16 -0
- package/dist/scripts/src/components-core/theming/themes/theme-colors.js +407 -0
- package/dist/scripts/src/components-core/theming/themes/xmlui.js +32 -0
- package/dist/scripts/src/components-core/theming/transformThemeVars.js +286 -0
- package/dist/scripts/src/components-core/utils/DataLoaderQueryKeyGenerator.js +34 -0
- package/dist/scripts/src/components-core/utils/LruCache.js +184 -0
- package/dist/scripts/src/components-core/utils/actionUtils.js +32 -0
- package/dist/scripts/src/components-core/utils/classnames.js +58 -0
- package/dist/scripts/src/components-core/utils/css-utils.js +127 -0
- package/dist/scripts/src/components-core/utils/date-utils.js +78 -0
- package/dist/scripts/src/components-core/utils/extractParam.js +148 -0
- package/dist/scripts/src/components-core/utils/hooks.js +221 -0
- package/dist/scripts/src/components-core/utils/mergeProps.js +45 -0
- package/dist/scripts/src/components-core/utils/misc.js +460 -0
- package/dist/scripts/src/components-core/utils/statementUtils.js +205 -0
- package/dist/scripts/src/components-core/utils/treeUtils.js +48 -0
- package/dist/scripts/src/components-core/xmlui-parser.js +52 -0
- package/dist/scripts/src/parsers/scripting/InputStream.js +59 -0
- package/dist/scripts/src/parsers/scripting/Lexer.js +1028 -0
- package/dist/scripts/src/parsers/scripting/Parser.js +2647 -0
- package/dist/scripts/src/parsers/scripting/ParserError.js +46 -0
- package/dist/scripts/src/parsers/scripting/TokenTrait.js +109 -0
- package/dist/scripts/src/parsers/scripting/code-behind-collect.js +118 -0
- package/dist/scripts/src/parsers/scripting/tree-visitor.js +602 -0
- package/dist/scripts/src/parsers/style-parser/StyleInputStream.js +39 -0
- package/dist/scripts/src/parsers/style-parser/StyleLexer.js +621 -0
- package/dist/scripts/src/parsers/style-parser/StyleParser.js +1000 -0
- package/dist/scripts/src/parsers/style-parser/errors.js +37 -0
- package/dist/scripts/src/parsers/style-parser/source-tree.js +2 -0
- package/dist/scripts/src/parsers/style-parser/style-compiler.js +513 -0
- package/dist/scripts/src/parsers/style-parser/tokens.js +42 -0
- package/dist/scripts/src/parsers/ueml/ParserError.js +54 -0
- package/dist/scripts/src/parsers/ueml/UemlHelper.js +579 -0
- package/dist/scripts/src/parsers/ueml/UemlInputStream.js +59 -0
- package/dist/scripts/src/parsers/ueml/UemlLexer.js +868 -0
- package/dist/scripts/src/parsers/ueml/UemlParser.js +1439 -0
- package/dist/scripts/src/parsers/ueml/UemlToken.js +24 -0
- package/dist/scripts/src/parsers/ueml/fileExtensions.js +6 -0
- package/dist/scripts/src/parsers/ueml/source-tree.js +2 -0
- package/dist/scripts/src/parsers/ueml/ueml-tree.js +2 -0
- package/dist/scripts/src/parsers/xmlui-parser/CharacterCodes.js +136 -0
- package/dist/scripts/src/parsers/xmlui-parser/diagnostics.js +100 -0
- package/dist/scripts/src/parsers/xmlui-parser/parser.js +476 -0
- package/dist/scripts/src/parsers/xmlui-parser/scanner.js +415 -0
- package/dist/scripts/src/parsers/xmlui-parser/syntax-kind.js +106 -0
- package/dist/scripts/src/parsers/xmlui-parser/syntax-node.js +2 -0
- package/dist/scripts/src/parsers/xmlui-parser/transform.js +922 -0
- package/dist/scripts/src/parsers/xmlui-parser/utils.js +83 -0
- package/dist/xmlui.es.d.ts +1667 -0
- package/dist/xmlui.es.js +17 -0
- package/dist/xmlui.umd.js +1589 -0
- package/package.json +175 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ItemWithLabel = ItemWithLabel;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const react_1 = require("react");
|
|
9
|
+
const classnames_1 = __importDefault(require("@components-core/utils/classnames"));
|
|
10
|
+
const FormItem_module_scss_1 = __importDefault(require("./FormItem.module.scss"));
|
|
11
|
+
const Spinner_1 = require("@components/Spinner/Spinner");
|
|
12
|
+
const react_slot_1 = require("@radix-ui/react-slot");
|
|
13
|
+
const numberRegex = /^[0-9]+$/;
|
|
14
|
+
function ItemWithLabel({ id, labelPosition = "top", style, label, labelBreak = true, labelWidth, enabled = true, required = false, children, validationInProgress = false, shrinkToLabel = false, onFocus, onBlur, labelStyle, validationResult, }) {
|
|
15
|
+
const generatedId = (0, react_1.useId)();
|
|
16
|
+
const inputId = id || generatedId;
|
|
17
|
+
if (label === undefined) {
|
|
18
|
+
return ((0, jsx_runtime_1.jsx)(react_slot_1.Slot, { style: style, id: inputId, onFocus: onFocus, onBlur: onBlur, children: children }));
|
|
19
|
+
// return cloneElement(children as ReactElement, {
|
|
20
|
+
// ...mergeProps((children as ReactElement).props, {
|
|
21
|
+
// style,
|
|
22
|
+
// id: inputId,
|
|
23
|
+
// onFocus: onFocus,
|
|
24
|
+
// onBlur: onBlur
|
|
25
|
+
// }),
|
|
26
|
+
// });
|
|
27
|
+
}
|
|
28
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)(FormItem_module_scss_1.default.container, {
|
|
29
|
+
[FormItem_module_scss_1.default.top]: labelPosition === "top",
|
|
30
|
+
[FormItem_module_scss_1.default.bottom]: labelPosition === "bottom",
|
|
31
|
+
[FormItem_module_scss_1.default.left]: labelPosition === "left",
|
|
32
|
+
[FormItem_module_scss_1.default.right]: labelPosition === "right",
|
|
33
|
+
[FormItem_module_scss_1.default.shrinkToLabel]: shrinkToLabel,
|
|
34
|
+
}), style: style, onFocus: onFocus, onBlur: onBlur, children: [label && ((0, jsx_runtime_1.jsxs)("label", { htmlFor: inputId, style: Object.assign(Object.assign({}, labelStyle), { width: labelWidth && numberRegex.test(labelWidth) ? `${labelWidth}px` : labelWidth }), className: (0, classnames_1.default)(FormItem_module_scss_1.default.inputLabel, {
|
|
35
|
+
[FormItem_module_scss_1.default.required]: required,
|
|
36
|
+
[FormItem_module_scss_1.default.disabled]: !enabled,
|
|
37
|
+
[FormItem_module_scss_1.default.labelBreak]: labelBreak,
|
|
38
|
+
}), children: [label, " ", required && (0, jsx_runtime_1.jsx)("span", { className: FormItem_module_scss_1.default.requiredMark, children: "*" }), validationInProgress && ((0, jsx_runtime_1.jsx)(Spinner_1.Spinner, { style: { height: "1em", width: "1em", marginLeft: "1em", alignSelf: "center" } }))] })), (0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', flexDirection: 'column', width: labelPosition === "right" ? 'auto' : '100%' }, children: [react_1.Children.only((0, jsx_runtime_1.jsx)(react_slot_1.Slot, { id: inputId, children: children })), validationResult] })] }));
|
|
39
|
+
}
|
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.useValidation = useValidation;
|
|
13
|
+
exports.useValidationDisplay = useValidationDisplay;
|
|
14
|
+
exports.parseSeverity = parseSeverity;
|
|
15
|
+
exports.groupInvalidValidationResultsBySeverity = groupInvalidValidationResultsBySeverity;
|
|
16
|
+
const lodash_es_1 = require("lodash-es");
|
|
17
|
+
const FormContext_1 = require("@components/Form/FormContext");
|
|
18
|
+
const react_1 = require("react");
|
|
19
|
+
const misc_1 = require("@components-core/utils/misc");
|
|
20
|
+
const constants_1 = require("@components-core/constants");
|
|
21
|
+
const formActions_1 = require("@components/Form/formActions");
|
|
22
|
+
function isInputEmpty(value) {
|
|
23
|
+
if (value === undefined || value === null || value === "")
|
|
24
|
+
return true;
|
|
25
|
+
if (typeof value === "string")
|
|
26
|
+
return value.trim().length === 0;
|
|
27
|
+
return (0, lodash_es_1.isEmpty)(value);
|
|
28
|
+
}
|
|
29
|
+
function isMinLengthValid(value = "", boundary) {
|
|
30
|
+
if (typeof value === "string") {
|
|
31
|
+
return value.length >= boundary;
|
|
32
|
+
}
|
|
33
|
+
console.warn("minLength can only be used on strings");
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
function isMaxLengthValid(value = "", boundary) {
|
|
37
|
+
if (typeof value === "string") {
|
|
38
|
+
return value.length <= boundary;
|
|
39
|
+
}
|
|
40
|
+
console.warn("maxLength can only be used on strings");
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
43
|
+
function isMinValueValid(value = "", minValue) {
|
|
44
|
+
if (typeof value !== "string" && !(0, lodash_es_1.isNumber)(value)) {
|
|
45
|
+
console.warn("Range can only be used on strings and numbers");
|
|
46
|
+
}
|
|
47
|
+
return Number(value) >= minValue;
|
|
48
|
+
}
|
|
49
|
+
function isMaxValueValid(value = "", maxValue) {
|
|
50
|
+
if (typeof value !== "string" && !(0, lodash_es_1.isNumber)(value)) {
|
|
51
|
+
console.warn("Range can only be used on strings and numbers");
|
|
52
|
+
}
|
|
53
|
+
return Number(value) <= maxValue;
|
|
54
|
+
}
|
|
55
|
+
function isRegexValid(value = "", regex) {
|
|
56
|
+
if (typeof value === "string") {
|
|
57
|
+
return new RegExp(regex).test(value);
|
|
58
|
+
}
|
|
59
|
+
console.warn("Regex can only be used on strings");
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
class FormItemValidator {
|
|
63
|
+
constructor(validations, onValidate, value) {
|
|
64
|
+
this.validations = validations;
|
|
65
|
+
this.onValidate = onValidate;
|
|
66
|
+
this.value = value;
|
|
67
|
+
this.preValidate = () => {
|
|
68
|
+
const validationResults = [
|
|
69
|
+
this.validateRequired(),
|
|
70
|
+
this.validateLength(),
|
|
71
|
+
this.validateRange(),
|
|
72
|
+
this.validatePattern(),
|
|
73
|
+
this.validateRegex()
|
|
74
|
+
].filter(result => result !== undefined);
|
|
75
|
+
return {
|
|
76
|
+
isValid: validationResults.find(result => !result.isValid) === undefined,
|
|
77
|
+
validatedValue: this.value,
|
|
78
|
+
partial: this.onValidate !== undefined,
|
|
79
|
+
validations: validationResults
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
this.validate = () => __awaiter(this, void 0, void 0, function* () {
|
|
83
|
+
const preValidateResult = this.preValidate();
|
|
84
|
+
const constValidationResult = (yield this.validateCustom()) || [];
|
|
85
|
+
preValidateResult.validations.push(...constValidationResult.map(res => (Object.assign(Object.assign({}, res), { async: true }))));
|
|
86
|
+
return {
|
|
87
|
+
isValid: preValidateResult.validations.find(result => !result.isValid) === undefined,
|
|
88
|
+
validatedValue: this.value,
|
|
89
|
+
partial: false,
|
|
90
|
+
validations: preValidateResult.validations
|
|
91
|
+
};
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
validateRequired() {
|
|
95
|
+
const { required, requiredInvalidMessage } = this.validations;
|
|
96
|
+
if (!required) {
|
|
97
|
+
return undefined;
|
|
98
|
+
}
|
|
99
|
+
return {
|
|
100
|
+
isValid: !isInputEmpty(this.value),
|
|
101
|
+
invalidMessage: requiredInvalidMessage || "This field is required",
|
|
102
|
+
severity: "error"
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
validateLength() {
|
|
106
|
+
const { minLength, maxLength, lengthInvalidMessage, lengthInvalidSeverity = "error" } = this.validations;
|
|
107
|
+
if (minLength === undefined && maxLength === undefined) {
|
|
108
|
+
return undefined;
|
|
109
|
+
}
|
|
110
|
+
if (minLength !== undefined && maxLength === undefined) {
|
|
111
|
+
return {
|
|
112
|
+
isValid: isMinLengthValid(this.value, minLength),
|
|
113
|
+
invalidMessage: lengthInvalidMessage || `Input should be at least ${minLength} ${pluralize(minLength, "character")}`,
|
|
114
|
+
severity: lengthInvalidSeverity
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
if (minLength === undefined && maxLength !== undefined) {
|
|
118
|
+
return {
|
|
119
|
+
isValid: isMaxLengthValid(this.value, maxLength),
|
|
120
|
+
invalidMessage: lengthInvalidMessage || `Input should be up to ${maxLength} ${pluralize(maxLength, "character")}`,
|
|
121
|
+
severity: lengthInvalidSeverity
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
return {
|
|
125
|
+
isValid: isMinLengthValid(this.value, minLength) && isMaxLengthValid(this.value, maxLength),
|
|
126
|
+
invalidMessage: lengthInvalidMessage || `Input length should be between ${minLength} and ${maxLength}`,
|
|
127
|
+
severity: lengthInvalidSeverity
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
validateRange() {
|
|
131
|
+
const { minValue, maxValue, rangeInvalidMessage, rangeInvalidSeverity = "error" } = this.validations;
|
|
132
|
+
if (minValue === undefined && maxValue === undefined) {
|
|
133
|
+
return undefined;
|
|
134
|
+
}
|
|
135
|
+
if (minValue !== undefined && maxValue === undefined) {
|
|
136
|
+
return {
|
|
137
|
+
isValid: isMinValueValid(this.value, minValue),
|
|
138
|
+
invalidMessage: rangeInvalidMessage || `Input should be bigger than ${minValue}`,
|
|
139
|
+
severity: rangeInvalidSeverity
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
if (minValue === undefined && maxValue !== undefined) {
|
|
143
|
+
return {
|
|
144
|
+
isValid: isMaxValueValid(this.value, maxValue),
|
|
145
|
+
invalidMessage: rangeInvalidMessage || `Input should be smaller than ${maxValue}`,
|
|
146
|
+
severity: rangeInvalidSeverity
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
return {
|
|
150
|
+
isValid: isMinValueValid(this.value, minValue) && isMaxValueValid(this.value, maxValue),
|
|
151
|
+
invalidMessage: rangeInvalidMessage || `Input should be between ${minValue} and ${maxValue}`,
|
|
152
|
+
severity: rangeInvalidSeverity
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
validatePattern() {
|
|
156
|
+
const { pattern, patternInvalidMessage, patternInvalidSeverity = "error" } = this.validations;
|
|
157
|
+
if (!pattern) {
|
|
158
|
+
return undefined;
|
|
159
|
+
}
|
|
160
|
+
switch (pattern.toLowerCase()) {
|
|
161
|
+
case "email":
|
|
162
|
+
return {
|
|
163
|
+
isValid: /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/.test(this.value),
|
|
164
|
+
invalidMessage: patternInvalidMessage || "Not a valid email address",
|
|
165
|
+
severity: patternInvalidSeverity
|
|
166
|
+
};
|
|
167
|
+
case "phone":
|
|
168
|
+
return {
|
|
169
|
+
isValid: /^[a-zA-Z0-9#*)(+.\-_&']+$/g.test(this.value),
|
|
170
|
+
invalidMessage: patternInvalidMessage || "Not a valid phone number",
|
|
171
|
+
severity: patternInvalidSeverity
|
|
172
|
+
};
|
|
173
|
+
case "url":
|
|
174
|
+
let url;
|
|
175
|
+
try {
|
|
176
|
+
url = new URL(this.value);
|
|
177
|
+
}
|
|
178
|
+
catch (e) { }
|
|
179
|
+
if (!url || (url.protocol && !["http:", "https:"].includes(url.protocol))) {
|
|
180
|
+
return {
|
|
181
|
+
isValid: false,
|
|
182
|
+
invalidMessage: "Not a valid URL",
|
|
183
|
+
severity: patternInvalidSeverity
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
return {
|
|
187
|
+
isValid: true,
|
|
188
|
+
severity: "valid"
|
|
189
|
+
};
|
|
190
|
+
default: {
|
|
191
|
+
console.warn("Unknown pattern provided");
|
|
192
|
+
return {
|
|
193
|
+
isValid: true,
|
|
194
|
+
severity: "valid"
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
validateRegex() {
|
|
200
|
+
const { regex, regexInvalidMessage, regexInvalidSeverity = "error" } = this.validations;
|
|
201
|
+
if (regex === undefined) {
|
|
202
|
+
return undefined;
|
|
203
|
+
}
|
|
204
|
+
return {
|
|
205
|
+
isValid: isRegexValid(this.value, regex),
|
|
206
|
+
invalidMessage: regexInvalidMessage || "Input is not in the correct format",
|
|
207
|
+
severity: regexInvalidSeverity
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
validateCustom() {
|
|
211
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
212
|
+
if (!this.onValidate) {
|
|
213
|
+
return undefined;
|
|
214
|
+
}
|
|
215
|
+
const validationFnResult = yield this.onValidate(this.value);
|
|
216
|
+
if (typeof validationFnResult === "boolean") {
|
|
217
|
+
return [
|
|
218
|
+
{
|
|
219
|
+
isValid: validationFnResult,
|
|
220
|
+
invalidMessage: "Invalid input",
|
|
221
|
+
severity: "error"
|
|
222
|
+
}
|
|
223
|
+
];
|
|
224
|
+
}
|
|
225
|
+
if (!(0, lodash_es_1.isArray)(validationFnResult)) {
|
|
226
|
+
return [validationFnResult];
|
|
227
|
+
}
|
|
228
|
+
return validationFnResult;
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
function asyncValidate(validations, onValidate, deferredValue) {
|
|
233
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
234
|
+
const validator = new FormItemValidator(validations, onValidate, deferredValue);
|
|
235
|
+
// console.log("calling async validate with ", deferredValue);
|
|
236
|
+
return yield validator.validate();
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
function useValidation(validations, onValidate, value, dispatch, bindTo, throttleWaitInMs = 0) {
|
|
240
|
+
const deferredValue = (0, react_1.useDeferredValue)(value);
|
|
241
|
+
const throttledAsyncValidate = (0, react_1.useMemo)(() => {
|
|
242
|
+
if (throttleWaitInMs !== 0) {
|
|
243
|
+
return (0, misc_1.asyncThrottle)(asyncValidate, throttleWaitInMs, {
|
|
244
|
+
trailing: true,
|
|
245
|
+
leading: true
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
return asyncValidate;
|
|
249
|
+
}, [throttleWaitInMs]);
|
|
250
|
+
(0, react_1.useEffect)(function runAllValidations() {
|
|
251
|
+
const validator = new FormItemValidator(validations, onValidate, deferredValue);
|
|
252
|
+
let ignore = false;
|
|
253
|
+
const partialResult = validator.preValidate();
|
|
254
|
+
if (!ignore) {
|
|
255
|
+
dispatch((0, formActions_1.fieldValidated)(bindTo, partialResult));
|
|
256
|
+
if (partialResult.partial) {
|
|
257
|
+
(() => __awaiter(this, void 0, void 0, function* () {
|
|
258
|
+
const result = yield throttledAsyncValidate(validations, onValidate, deferredValue);
|
|
259
|
+
if (!ignore) {
|
|
260
|
+
// console.log(`async validation result for ${bindTo}`, result);
|
|
261
|
+
dispatch((0, formActions_1.fieldValidated)(bindTo, result));
|
|
262
|
+
}
|
|
263
|
+
}))();
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
return () => {
|
|
267
|
+
ignore = true;
|
|
268
|
+
};
|
|
269
|
+
}, [bindTo, deferredValue, dispatch, onValidate, throttledAsyncValidate, validations]);
|
|
270
|
+
}
|
|
271
|
+
function useValidationDisplay(bindTo, value, validationResult, validationMode = "errorLate") {
|
|
272
|
+
const interactionFlags = (0, FormContext_1.useFormContextPart)(value => value.interactionFlags[bindTo]) || constants_1.EMPTY_OBJECT;
|
|
273
|
+
const forceShowValidationResult = interactionFlags.forceShowValidationResult;
|
|
274
|
+
const focused = interactionFlags.focused;
|
|
275
|
+
const isValidLostFocus = interactionFlags.isValidLostFocus;
|
|
276
|
+
const isValidOnFocus = interactionFlags.isValidOnFocus;
|
|
277
|
+
const invalidToValid = interactionFlags.invalidToValid;
|
|
278
|
+
const validationInProgress = !validationResult || validationResult.validatedValue !== value;
|
|
279
|
+
const isDirty = interactionFlags.isDirty;
|
|
280
|
+
const isValid = (validationResult === null || validationResult === void 0 ? void 0 : validationResult.isValid) === true;
|
|
281
|
+
let highestValidationSeverity = "none";
|
|
282
|
+
for (const val of (validationResult === null || validationResult === void 0 ? void 0 : validationResult.validations) || []) {
|
|
283
|
+
if (val.isValid) {
|
|
284
|
+
continue;
|
|
285
|
+
}
|
|
286
|
+
if (highestValidationSeverity !== "error" && val.severity === "warning") {
|
|
287
|
+
highestValidationSeverity = "warning";
|
|
288
|
+
}
|
|
289
|
+
if (val.severity === "error") {
|
|
290
|
+
highestValidationSeverity = "error";
|
|
291
|
+
break;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
let isHelperTextShown = false;
|
|
295
|
+
switch (validationMode) {
|
|
296
|
+
case "errorLate":
|
|
297
|
+
isHelperTextShown = isDirty && (focused ? !invalidToValid && !isValidOnFocus : !isValidLostFocus);
|
|
298
|
+
break;
|
|
299
|
+
case "onChanged":
|
|
300
|
+
isHelperTextShown = isDirty;
|
|
301
|
+
break;
|
|
302
|
+
case "onLostFocus":
|
|
303
|
+
isHelperTextShown = isDirty && ((!focused && !isValid) || (!isValidLostFocus && !isValid));
|
|
304
|
+
}
|
|
305
|
+
isHelperTextShown = isHelperTextShown || forceShowValidationResult;
|
|
306
|
+
const [prevStableShown, setPrevStableShown] = (0, react_1.useState)(isHelperTextShown);
|
|
307
|
+
if (prevStableShown !== isHelperTextShown && !validationInProgress) {
|
|
308
|
+
setPrevStableShown(isHelperTextShown);
|
|
309
|
+
}
|
|
310
|
+
if (validationInProgress) {
|
|
311
|
+
isHelperTextShown = prevStableShown;
|
|
312
|
+
}
|
|
313
|
+
return {
|
|
314
|
+
isHelperTextShown,
|
|
315
|
+
validationStatus: isHelperTextShown ? highestValidationSeverity : "none"
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
function parseSeverity(severity) {
|
|
319
|
+
if (severity === undefined) {
|
|
320
|
+
return undefined;
|
|
321
|
+
}
|
|
322
|
+
if (severity === "error" || severity === "warning" || severity === "valid" || severity === "none") {
|
|
323
|
+
return severity;
|
|
324
|
+
}
|
|
325
|
+
return "none";
|
|
326
|
+
}
|
|
327
|
+
function groupInvalidValidationResultsBySeverity(validationResults) {
|
|
328
|
+
const ret = {
|
|
329
|
+
error: [],
|
|
330
|
+
warning: [],
|
|
331
|
+
valid: [],
|
|
332
|
+
none: []
|
|
333
|
+
};
|
|
334
|
+
Object.entries(validationResults).forEach(([field, validationResult]) => {
|
|
335
|
+
validationResult.validations.forEach(singleValidationResult => {
|
|
336
|
+
if (!singleValidationResult.isValid) {
|
|
337
|
+
ret[singleValidationResult.severity] = ret[singleValidationResult.severity] || [];
|
|
338
|
+
ret[singleValidationResult.severity].push(singleValidationResult);
|
|
339
|
+
}
|
|
340
|
+
});
|
|
341
|
+
});
|
|
342
|
+
return ret;
|
|
343
|
+
}
|
|
344
|
+
function pluralize(count, word) {
|
|
345
|
+
return count === 1 ? word : word + "s";
|
|
346
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.formSectionRenderer = void 0;
|
|
4
|
+
exports.formSectionRenderer = {
|
|
5
|
+
name: "FormSection",
|
|
6
|
+
component: {
|
|
7
|
+
type: "VStack",
|
|
8
|
+
props: {
|
|
9
|
+
paddingBottom: "{$props.paddingBottom ?? '1rem'}",
|
|
10
|
+
},
|
|
11
|
+
children: [
|
|
12
|
+
{
|
|
13
|
+
type: "Heading",
|
|
14
|
+
when: "{!!$props.heading}",
|
|
15
|
+
props: {
|
|
16
|
+
marginBottom: "0.5rem",
|
|
17
|
+
level: "{$props.headingLevel ?? 'h3'}",
|
|
18
|
+
fontWeight: "{$props.headingWeight ?? 'bold'}",
|
|
19
|
+
value: "{$props.heading}",
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
type: "Text",
|
|
24
|
+
when: "{!!$props.info}",
|
|
25
|
+
props: {
|
|
26
|
+
fontSize: "{$props.infoFontSize ?? '0.8rem'}",
|
|
27
|
+
paddingBottom: "1.25rem",
|
|
28
|
+
value: "{$props.info}",
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
type: "FlowLayout",
|
|
33
|
+
props: {
|
|
34
|
+
columnGap: "{$props.columnGap ?? '3rem'}",
|
|
35
|
+
rowGap: "{$props.rowGap ?? '1rem'}",
|
|
36
|
+
},
|
|
37
|
+
children: [
|
|
38
|
+
{
|
|
39
|
+
type: "ChildrenSlot",
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
}
|
|
45
|
+
};
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.h6ComponentRenderer = exports.h5ComponentRenderer = exports.h4ComponentRenderer = exports.h3ComponentRenderer = exports.h2ComponentRenderer = exports.h1ComponentRenderer = exports.headingComponentRenderer = exports.Heading = void 0;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const Heading_module_scss_1 = __importDefault(require("./Heading.module.scss"));
|
|
9
|
+
const classnames_1 = __importDefault(require("@components-core/utils/classnames"));
|
|
10
|
+
const renderers_1 = require("@components-core/renderers");
|
|
11
|
+
const descriptorHelper_1 = require("@components-core/descriptorHelper");
|
|
12
|
+
const themeVars_1 = require("@components-core/theming/themeVars");
|
|
13
|
+
const css_utils_1 = require("@components-core/utils/css-utils");
|
|
14
|
+
// =====================================================================================================================
|
|
15
|
+
// React Heading, H1,..., H6 component implementation
|
|
16
|
+
const VALUE_DESC = "The text to display in the component - can be empty";
|
|
17
|
+
const LINE_CLAMP_DESC = "Limits the number of lines the component can use";
|
|
18
|
+
const PRESERVE_DESC = "Allow preserving linebreak information?";
|
|
19
|
+
const NO_ELLIPSIS_DESC = "Indicates if ellipsis should be hidden from the end of the text";
|
|
20
|
+
const LEVEL_DESC = (level) => `Represents a heading level ${level} text`;
|
|
21
|
+
const HeadingLevelKeys = ["h1", "h2", "h3", "h4", "h5", "h6"];
|
|
22
|
+
const Heading = ({ uid, level = "h1", children, sx, layout, title, maxLines = 0, preserveLinebreaks, ellipses = true, className, }) => {
|
|
23
|
+
const Element = level === null || level === void 0 ? void 0 : level.toLowerCase();
|
|
24
|
+
return ((0, jsx_runtime_1.jsx)(Element, { id: uid, title: title, style: Object.assign(Object.assign(Object.assign({}, sx), layout), (0, css_utils_1.getMaxLinesStyle)(maxLines)), className: (0, classnames_1.default)(Heading_module_scss_1.default.heading, Heading_module_scss_1.default[Element], className || "", {
|
|
25
|
+
[Heading_module_scss_1.default.truncateOverflow]: maxLines > 0,
|
|
26
|
+
[Heading_module_scss_1.default.preserveLinebreaks]: preserveLinebreaks,
|
|
27
|
+
[Heading_module_scss_1.default.noEllipsis]: !ellipses,
|
|
28
|
+
}), children: children }));
|
|
29
|
+
};
|
|
30
|
+
exports.Heading = Heading;
|
|
31
|
+
const headingMetadata = {
|
|
32
|
+
displayName: "Heading",
|
|
33
|
+
description: "Represents a heading text",
|
|
34
|
+
props: {
|
|
35
|
+
value: (0, descriptorHelper_1.desc)(VALUE_DESC),
|
|
36
|
+
level: (0, descriptorHelper_1.desc)("The heading level as described in HTML, indicates the heading size and importance"),
|
|
37
|
+
maxLines: (0, descriptorHelper_1.desc)(LINE_CLAMP_DESC),
|
|
38
|
+
ellipses: (0, descriptorHelper_1.desc)(NO_ELLIPSIS_DESC),
|
|
39
|
+
preserveLinebreaks: (0, descriptorHelper_1.desc)(PRESERVE_DESC),
|
|
40
|
+
},
|
|
41
|
+
themeVars: (0, themeVars_1.parseScssVar)(Heading_module_scss_1.default.themeVars),
|
|
42
|
+
defaultThemeVars: {
|
|
43
|
+
"font-family-Heading": "$font-family",
|
|
44
|
+
"color-text-Heading": "inherit",
|
|
45
|
+
"font-weight-Heading": "$font-weight-bold",
|
|
46
|
+
"letter-spacing-Heading": "0",
|
|
47
|
+
light: {
|
|
48
|
+
// --- No light-specific theme vars
|
|
49
|
+
},
|
|
50
|
+
dark: {
|
|
51
|
+
// --- No dark-specific theme vars
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
const h1Metadata = {
|
|
56
|
+
displayName: "H1",
|
|
57
|
+
description: LEVEL_DESC(1),
|
|
58
|
+
props: {
|
|
59
|
+
value: (0, descriptorHelper_1.desc)(VALUE_DESC),
|
|
60
|
+
maxLines: (0, descriptorHelper_1.desc)(LINE_CLAMP_DESC),
|
|
61
|
+
},
|
|
62
|
+
themeVars: (0, themeVars_1.parseScssVar)(Heading_module_scss_1.default.themeVars),
|
|
63
|
+
defaultThemeVars: {
|
|
64
|
+
// letter-spacing
|
|
65
|
+
"font-size-H1": "$font-size-large",
|
|
66
|
+
"line-height-H1": "$line-height-loose",
|
|
67
|
+
"margin-top-H1": "$space-3",
|
|
68
|
+
"margin-bottom-H1": "$space-6",
|
|
69
|
+
light: {
|
|
70
|
+
// --- No light-specific theme vars
|
|
71
|
+
},
|
|
72
|
+
dark: {
|
|
73
|
+
// --- No dark-specific theme vars
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
const h2Metadata = {
|
|
78
|
+
displayName: "H2",
|
|
79
|
+
description: LEVEL_DESC(2),
|
|
80
|
+
props: {
|
|
81
|
+
value: (0, descriptorHelper_1.desc)(VALUE_DESC),
|
|
82
|
+
maxLines: (0, descriptorHelper_1.desc)(LINE_CLAMP_DESC),
|
|
83
|
+
},
|
|
84
|
+
themeVars: (0, themeVars_1.parseScssVar)(Heading_module_scss_1.default.themeVars),
|
|
85
|
+
defaultThemeVars: {
|
|
86
|
+
"font-size-H2": "$font-size-medium",
|
|
87
|
+
"line-height-H2": "$line-height-relaxed",
|
|
88
|
+
"margin-top-H2": "$space-2",
|
|
89
|
+
"margin-bottom-H2": "$space-4",
|
|
90
|
+
light: {
|
|
91
|
+
// --- No light-specific theme vars
|
|
92
|
+
},
|
|
93
|
+
dark: {
|
|
94
|
+
// --- No dark-specific theme vars
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
const h3Metadata = {
|
|
99
|
+
displayName: "H3",
|
|
100
|
+
description: LEVEL_DESC(3),
|
|
101
|
+
props: {
|
|
102
|
+
value: (0, descriptorHelper_1.desc)(VALUE_DESC),
|
|
103
|
+
maxLines: (0, descriptorHelper_1.desc)(LINE_CLAMP_DESC),
|
|
104
|
+
},
|
|
105
|
+
themeVars: (0, themeVars_1.parseScssVar)(Heading_module_scss_1.default.themeVars),
|
|
106
|
+
defaultThemeVars: {
|
|
107
|
+
"font-size-H3": "$font-size-normal",
|
|
108
|
+
"line-height-H3": "$line-height-normal",
|
|
109
|
+
"margin-top-H3": "$space-1_5",
|
|
110
|
+
"margin-bottom-H3": "$space-3",
|
|
111
|
+
light: {
|
|
112
|
+
// --- No light-specific theme vars
|
|
113
|
+
},
|
|
114
|
+
dark: {
|
|
115
|
+
// --- No dark-specific theme vars
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
};
|
|
119
|
+
const h4Metadata = {
|
|
120
|
+
displayName: "H4",
|
|
121
|
+
description: LEVEL_DESC(4),
|
|
122
|
+
props: {
|
|
123
|
+
value: (0, descriptorHelper_1.desc)(VALUE_DESC),
|
|
124
|
+
maxLines: (0, descriptorHelper_1.desc)(LINE_CLAMP_DESC),
|
|
125
|
+
},
|
|
126
|
+
themeVars: (0, themeVars_1.parseScssVar)(Heading_module_scss_1.default.themeVars),
|
|
127
|
+
defaultThemeVars: {
|
|
128
|
+
"font-size-H4": "$font-size-small",
|
|
129
|
+
"line-height-H4": "$line-height-snug",
|
|
130
|
+
"margin-top-H4": "$space-1",
|
|
131
|
+
"margin-bottom-H4": "$space-2",
|
|
132
|
+
light: {
|
|
133
|
+
// --- No light-specific theme vars
|
|
134
|
+
},
|
|
135
|
+
dark: {
|
|
136
|
+
// --- No dark-specific theme vars
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
};
|
|
140
|
+
const h5Metadata = {
|
|
141
|
+
displayName: "H5",
|
|
142
|
+
description: LEVEL_DESC(5),
|
|
143
|
+
props: {
|
|
144
|
+
value: (0, descriptorHelper_1.desc)(VALUE_DESC),
|
|
145
|
+
maxLines: (0, descriptorHelper_1.desc)(LINE_CLAMP_DESC),
|
|
146
|
+
},
|
|
147
|
+
themeVars: (0, themeVars_1.parseScssVar)(Heading_module_scss_1.default.themeVars),
|
|
148
|
+
defaultThemeVars: {
|
|
149
|
+
"font-size-H5": "$font-size-smaller",
|
|
150
|
+
"line-height-H5": "$line-height-tight",
|
|
151
|
+
"margin-top-H5": "$space-0_5",
|
|
152
|
+
"margin-bottom-H5": "$space-1",
|
|
153
|
+
light: {
|
|
154
|
+
// --- No light-specific theme vars
|
|
155
|
+
},
|
|
156
|
+
dark: {
|
|
157
|
+
// --- No dark-specific theme vars
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
};
|
|
161
|
+
const h6Metadata = {
|
|
162
|
+
displayName: "H6",
|
|
163
|
+
description: LEVEL_DESC(6),
|
|
164
|
+
props: {
|
|
165
|
+
value: (0, descriptorHelper_1.desc)(VALUE_DESC),
|
|
166
|
+
maxLines: (0, descriptorHelper_1.desc)(LINE_CLAMP_DESC),
|
|
167
|
+
},
|
|
168
|
+
themeVars: (0, themeVars_1.parseScssVar)(Heading_module_scss_1.default.themeVars),
|
|
169
|
+
defaultThemeVars: {
|
|
170
|
+
"font-size-H6": "$font-size-tiny",
|
|
171
|
+
"line-height-H6": "$line-height-none",
|
|
172
|
+
"margin-top-H6": "$space-0",
|
|
173
|
+
"margin-bottom-H6": "$space-0",
|
|
174
|
+
light: {
|
|
175
|
+
// --- No light-specific theme vars
|
|
176
|
+
},
|
|
177
|
+
dark: {
|
|
178
|
+
// --- No dark-specific theme vars
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
};
|
|
182
|
+
function renderHeading({ node, extractValue, layoutCss, level, renderChild }) {
|
|
183
|
+
var _a;
|
|
184
|
+
return ((0, jsx_runtime_1.jsx)(exports.Heading, { uid: node.uid, level: ((_a = extractValue.asOptionalString(level)) !== null && _a !== void 0 ? _a : "h1"), maxLines: extractValue.asOptionalNumber(node.props.maxLines), preserveLinebreaks: extractValue.asOptionalBoolean(node.props.preserveLinebreaks, false), ellipses: extractValue.asOptionalBoolean(node.props.ellipses, true), layout: layoutCss, children: extractValue.asDisplayText(node.props.value) || renderChild(node.children) }));
|
|
185
|
+
}
|
|
186
|
+
exports.headingComponentRenderer = (0, renderers_1.createComponentRenderer)("Heading", ({ node, extractValue, layoutCss, layoutNonCss, renderChild }) => {
|
|
187
|
+
return renderHeading({ node, extractValue, layoutCss, layoutNonCss, level: node.props.level, renderChild });
|
|
188
|
+
}, headingMetadata);
|
|
189
|
+
exports.h1ComponentRenderer = (0, renderers_1.createComponentRenderer)("H1", ({ node, extractValue, layoutCss, layoutNonCss, renderChild }) => {
|
|
190
|
+
return renderHeading({ node, extractValue, layoutCss, layoutNonCss, level: "h1", renderChild });
|
|
191
|
+
}, h1Metadata);
|
|
192
|
+
exports.h2ComponentRenderer = (0, renderers_1.createComponentRenderer)("H2", ({ node, extractValue, layoutCss, layoutNonCss, renderChild }) => {
|
|
193
|
+
return renderHeading({ node, extractValue, layoutCss, layoutNonCss, level: "h2", renderChild });
|
|
194
|
+
}, h2Metadata);
|
|
195
|
+
exports.h3ComponentRenderer = (0, renderers_1.createComponentRenderer)("H3", ({ node, extractValue, layoutCss, layoutNonCss, renderChild }) => {
|
|
196
|
+
return renderHeading({ node, extractValue, layoutCss, layoutNonCss, level: "h3", renderChild });
|
|
197
|
+
}, h3Metadata);
|
|
198
|
+
exports.h4ComponentRenderer = (0, renderers_1.createComponentRenderer)("H4", ({ node, extractValue, layoutCss, layoutNonCss, renderChild }) => {
|
|
199
|
+
return renderHeading({ node, extractValue, layoutCss, layoutNonCss, level: "h4", renderChild });
|
|
200
|
+
}, h4Metadata);
|
|
201
|
+
exports.h5ComponentRenderer = (0, renderers_1.createComponentRenderer)("H5", ({ node, extractValue, layoutCss, layoutNonCss, renderChild }) => {
|
|
202
|
+
return renderHeading({ node, extractValue, layoutCss, layoutNonCss, level: "h5", renderChild });
|
|
203
|
+
}, h5Metadata);
|
|
204
|
+
exports.h6ComponentRenderer = (0, renderers_1.createComponentRenderer)("H6", ({ node, extractValue, layoutCss, layoutNonCss, renderChild }) => {
|
|
205
|
+
return renderHeading({ node, extractValue, layoutCss, layoutNonCss, level: "h6", renderChild });
|
|
206
|
+
}, h6Metadata);
|