native-document 1.0.165 → 1.0.166
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/components.d.ts +2 -0
- package/devtools/widget.js +1 -1
- package/dist/native-document.components.min.js +11074 -2735
- package/dist/native-document.dev.js +2269 -392
- package/dist/native-document.dev.js.map +1 -1
- package/dist/native-document.min.js +1 -1
- package/eslint.config.js +28 -33
- package/i18n.js +1 -1
- package/i18n.ts +2 -0
- package/index.js +3 -0
- package/package.json +3 -2
- package/src/components/$traits/has-draggable/HasDraggable.d.ts +4 -0
- package/src/components/$traits/has-draggable/HasDraggable.js +13 -0
- package/src/components/$traits/has-items/HasItems.d.ts +9 -0
- package/src/components/$traits/has-items/HasItems.js +6 -6
- package/src/components/$traits/has-position/HasFullPosition.d.ts +14 -0
- package/src/components/$traits/has-position/HasFullPosition.js +44 -0
- package/src/components/$traits/has-position/HasPosition.d.ts +7 -0
- package/src/components/$traits/has-position/HasPosition.js +23 -1
- package/src/components/$traits/has-resizable/HasResizable.d.ts +13 -0
- package/src/components/$traits/has-resizable/HasResizable.js +9 -0
- package/src/components/$traits/has-validation/HasValidation.d.ts +17 -0
- package/src/components/$traits/has-validation/HasValidation.js +54 -7
- package/src/components/BaseComponent.d.ts +32 -0
- package/src/components/BaseComponent.js +65 -9
- package/src/components/accordion/Accordion.js +39 -14
- package/src/components/accordion/AccordionItem.js +45 -14
- package/src/components/accordion/index.js +2 -2
- package/src/components/accordion/types/Accordion.d.ts +47 -0
- package/src/components/accordion/types/AccordionItem.d.ts +48 -0
- package/src/components/alert/Alert.js +70 -38
- package/src/components/alert/index.js +2 -2
- package/src/components/alert/types/Alert.d.ts +62 -0
- package/src/components/avatar/Avatar.js +49 -12
- package/src/components/avatar/AvatarGroup.js +50 -2
- package/src/components/avatar/index.js +2 -2
- package/src/components/avatar/types/Avatar.d.ts +74 -0
- package/src/components/avatar/types/AvatarGroup.d.ts +32 -0
- package/src/components/badge/Badge.js +125 -5
- package/src/components/badge/index.js +2 -2
- package/src/components/badge/types/Badge.d.ts +51 -0
- package/src/components/breadcrumb/BreadCrumb.js +61 -5
- package/src/components/breadcrumb/index.js +2 -2
- package/src/components/breadcrumb/types/BreadCrumb.d.ts +42 -0
- package/src/components/button/Button.js +164 -9
- package/src/components/button/index.js +1 -1
- package/src/components/button/types/Button.d.ts +62 -0
- package/src/components/card/Card.js +128 -10
- package/src/components/card/index.js +3 -3
- package/src/components/card/types/Card.d.ts +42 -0
- package/src/components/context-menu/ContextMenu.js +49 -5
- package/src/components/context-menu/ContextMenuGroup.js +15 -2
- package/src/components/context-menu/ContextMenuItem.js +14 -2
- package/src/components/context-menu/index.js +5 -5
- package/src/components/context-menu/types/ContextMenu.d.ts +30 -0
- package/src/components/context-menu/types/ContextMenuGroup.d.ts +18 -0
- package/src/components/context-menu/types/ContextMenuItem.d.ts +18 -0
- package/src/components/divider/Divider.js +120 -4
- package/src/components/divider/index.js +3 -3
- package/src/components/divider/types/Divider.d.ts +55 -0
- package/src/components/dropdown/Dropdown.js +239 -16
- package/src/components/dropdown/DropdownDivider.js +22 -2
- package/src/components/dropdown/DropdownGroup.js +44 -5
- package/src/components/dropdown/DropdownItem.js +76 -3
- package/src/components/dropdown/DropdownTrigger.js +49 -20
- package/src/components/dropdown/helpers.js +1 -1
- package/src/components/dropdown/index.js +6 -6
- package/src/components/dropdown/types/Dropdown.d.ts +88 -0
- package/src/components/dropdown/types/DropdownDivider.d.ts +20 -0
- package/src/components/dropdown/types/DropdownGroup.d.ts +25 -0
- package/src/components/dropdown/types/DropdownItem.d.ts +41 -0
- package/src/components/dropdown/types/DropdownTrigger.d.ts +32 -0
- package/src/components/form/FormControl.js +156 -13
- package/src/components/form/field/Field.js +172 -9
- package/src/components/form/field/FieldCollection.js +116 -12
- package/src/components/form/field/types/AutocompleteField.js +92 -2
- package/src/components/form/field/types/CheckboxField.js +43 -2
- package/src/components/form/field/types/CheckboxGroupField.js +83 -6
- package/src/components/form/field/types/ColorField.js +56 -3
- package/src/components/form/field/types/DateField.js +155 -4
- package/src/components/form/field/types/EmailField.js +54 -4
- package/src/components/form/field/types/FileField.js +140 -6
- package/src/components/form/field/types/HiddenField.js +27 -1
- package/src/components/form/field/types/ImageField.js +82 -3
- package/src/components/form/field/types/NumberField.js +97 -4
- package/src/components/form/field/types/PasswordField.js +103 -7
- package/src/components/form/field/types/RadioField.js +75 -4
- package/src/components/form/field/types/RangeField.js +67 -1
- package/src/components/form/field/types/SearchField.js +41 -2
- package/src/components/form/field/types/SelectField.js +133 -4
- package/src/components/form/field/types/StringField.js +91 -2
- package/src/components/form/field/types/TelField.js +55 -4
- package/src/components/form/field/types/TextAreaField.js +76 -2
- package/src/components/form/field/types/TimeField.js +120 -5
- package/src/components/form/field/types/UrlField.js +59 -4
- package/src/components/form/field/types/file-field-mode/FileAvatarMode.js +83 -4
- package/src/components/form/field/types/file-field-mode/FileDropzoneMode.js +61 -3
- package/src/components/form/field/types/file-field-mode/FileItemPreview.js +79 -3
- package/src/components/form/field/types/file-field-mode/FileNativeMode.js +24 -2
- package/src/components/form/field/types/file-field-mode/FileUploadButtonMode.js +64 -3
- package/src/components/form/field/types/file-field-mode/FileWallMode.js +56 -3
- package/src/components/form/index.js +28 -28
- package/src/components/form/types/Field.d.ts +73 -0
- package/src/components/form/types/FieldCollection.d.ts +53 -0
- package/src/components/form/types/FormControl.d.ts +64 -0
- package/src/components/form/types/fields/AutocompleteField.d.ts +48 -0
- package/src/components/form/types/fields/CheckboxField.d.ts +33 -0
- package/src/components/form/types/fields/CheckboxGroupField.d.ts +49 -0
- package/src/components/form/types/fields/ColorField.d.ts +37 -0
- package/src/components/form/types/fields/DateField.d.ts +70 -0
- package/src/components/form/types/fields/EmailField.d.ts +35 -0
- package/src/components/form/types/fields/FileAvatarMode.d.ts +46 -0
- package/src/components/form/types/fields/FileDropzoneMode.d.ts +28 -0
- package/src/components/form/types/fields/FileField.d.ts +56 -0
- package/src/components/form/types/fields/FileItemPreview.d.ts +35 -0
- package/src/components/form/types/fields/FileNativeMode.d.ts +21 -0
- package/src/components/form/types/fields/FileUploadButtonMode.d.ts +34 -0
- package/src/components/form/types/fields/FileWallMode.d.ts +32 -0
- package/src/components/form/types/fields/HiddenField.d.ts +26 -0
- package/src/components/form/types/fields/ImageField.d.ts +45 -0
- package/src/components/form/types/fields/NumberField.d.ts +48 -0
- package/src/components/form/types/fields/PasswordField.d.ts +46 -0
- package/src/components/form/types/fields/RadioField.d.ts +48 -0
- package/src/components/form/types/fields/RangeField.d.ts +44 -0
- package/src/components/form/types/fields/SearchField.d.ts +34 -0
- package/src/components/form/types/fields/SelectField.d.ts +71 -0
- package/src/components/form/types/fields/StringField.d.ts +48 -0
- package/src/components/form/types/fields/TelField.d.ts +37 -0
- package/src/components/form/types/fields/TextAreaField.d.ts +44 -0
- package/src/components/form/types/fields/TimeField.d.ts +51 -0
- package/src/components/form/types/fields/UrlField.d.ts +35 -0
- package/src/components/form/validation/Validation.js +54 -54
- package/src/components/index.d.ts +160 -0
- package/src/components/list/List.js +99 -15
- package/src/components/list/ListGroup.js +58 -8
- package/src/components/list/ListItem.js +79 -18
- package/src/components/list/index.js +5 -5
- package/src/components/list/types/List.d.ts +43 -0
- package/src/components/list/types/ListGroup.d.ts +37 -0
- package/src/components/list/types/ListItem.d.ts +42 -0
- package/src/components/menu/HasMenuItem.js +55 -6
- package/src/components/menu/Menu.js +113 -22
- package/src/components/menu/MenuDivider.js +18 -2
- package/src/components/menu/MenuGroup.js +61 -6
- package/src/components/menu/MenuItem.js +95 -11
- package/src/components/menu/MenuLink.js +27 -2
- package/src/components/menu/index.js +6 -6
- package/src/components/menu/types/Menu.d.ts +60 -0
- package/src/components/menu/types/MenuDivider.d.ts +19 -0
- package/src/components/menu/types/MenuGroup.d.ts +44 -0
- package/src/components/menu/types/MenuItem.d.ts +46 -0
- package/src/components/menu/types/MenuLink.d.ts +16 -0
- package/src/components/modal/Modal.js +258 -17
- package/src/components/modal/index.js +3 -3
- package/src/components/modal/types/Modal.d.ts +94 -0
- package/src/components/pagination/Pagination.js +155 -7
- package/src/components/pagination/index.js +3 -3
- package/src/components/pagination/types/Pagination.d.ts +68 -0
- package/src/components/popover/Popover.js +198 -11
- package/src/components/popover/PopoverFooter.js +33 -9
- package/src/components/popover/PopoverHeader.js +33 -8
- package/src/components/popover/index.js +4 -4
- package/src/components/popover/types/Popover.d.ts +83 -0
- package/src/components/popover/types/PopoverFooter.d.ts +24 -0
- package/src/components/popover/types/PopoverHeader.d.ts +26 -0
- package/src/components/progress/Progress.js +182 -13
- package/src/components/progress/index.js +3 -3
- package/src/components/progress/types/Progress.d.ts +77 -0
- package/src/components/skeleton/Skeleton.js +117 -49
- package/src/components/skeleton/index.js +3 -3
- package/src/components/skeleton/types/Skeleton.d.ts +55 -0
- package/src/components/slider/Slider.js +207 -10
- package/src/components/slider/index.js +2 -2
- package/src/components/slider/types/Slider.d.ts +82 -0
- package/src/components/spacer/Spacer.js +11 -2
- package/src/components/spacer/index.js +2 -2
- package/src/components/spacer/types/Spacer.d.ts +19 -0
- package/src/components/spinner/Spinner.js +180 -9
- package/src/components/spinner/index.js +3 -3
- package/src/components/spinner/types/Spinner.d.ts +71 -0
- package/src/components/splitter/Splitter.js +76 -13
- package/src/components/splitter/SplitterGutter.js +67 -5
- package/src/components/splitter/SplitterPanel.js +69 -2
- package/src/components/splitter/index.js +5 -5
- package/src/components/splitter/types/Splitter.d.ts +38 -0
- package/src/components/splitter/types/SplitterGutter.d.ts +38 -0
- package/src/components/splitter/types/SplitterPanel.d.ts +41 -0
- package/src/components/stacks/AbsoluteStack.js +23 -3
- package/src/components/stacks/FixedStack.js +23 -3
- package/src/components/stacks/HStack.js +24 -3
- package/src/components/stacks/PositionStack.js +111 -3
- package/src/components/stacks/RelativeStack.js +23 -3
- package/src/components/stacks/Stack.js +73 -2
- package/src/components/stacks/VStack.js +24 -4
- package/src/components/stacks/index.js +7 -7
- package/src/components/stacks/types/AbsoluteStack.d.ts +16 -0
- package/src/components/stacks/types/FixedStack.d.ts +16 -0
- package/src/components/stacks/types/HStack.d.ts +16 -0
- package/src/components/stacks/types/PositionStack.d.ts +54 -0
- package/src/components/stacks/types/RelativeStack.d.ts +17 -0
- package/src/components/stacks/types/Stack.d.ts +39 -0
- package/src/components/stacks/types/VStack.d.ts +16 -0
- package/src/components/stepper/Stepper.js +152 -12
- package/src/components/stepper/StepperStep.js +104 -3
- package/src/components/stepper/index.js +4 -4
- package/src/components/stepper/types/Stepper.d.ts +68 -0
- package/src/components/stepper/types/StepperStep.d.ts +54 -0
- package/src/components/switch/Switch.js +143 -6
- package/src/components/switch/index.js +1 -1
- package/src/components/switch/types/Switch.d.ts +55 -0
- package/src/components/table/Column.js +105 -6
- package/src/components/table/ColumnGroup.js +48 -3
- package/src/components/table/DataTable.js +256 -19
- package/src/components/table/SimpleTable.js +58 -4
- package/src/components/table/index.js +2 -2
- package/src/components/table/types/Column.d.ts +49 -0
- package/src/components/table/types/ColumnGroup.d.ts +28 -0
- package/src/components/table/types/DataTable.d.ts +97 -0
- package/src/components/table/types/SimpleTable.d.ts +40 -0
- package/src/components/tabs/Tabs.js +192 -5
- package/src/components/tabs/index.js +3 -3
- package/src/components/tabs/types/Tabs.d.ts +78 -0
- package/src/components/toast/Toast.js +133 -5
- package/src/components/toast/index.js +3 -3
- package/src/components/toast/types/Toast.d.ts +57 -0
- package/src/components/toast/types/ToastError.d.ts +7 -0
- package/src/components/toast/types/ToastInfo.d.ts +7 -0
- package/src/components/toast/types/ToastSuccess.d.ts +7 -0
- package/src/components/toast/types/ToastWarning.d.ts +7 -0
- package/src/components/tooltip/Tooltip.js +157 -13
- package/src/components/tooltip/index.js +2 -2
- package/src/components/tooltip/prototypes.js +1 -1
- package/src/components/tooltip/types/Tooltip.d.ts +65 -0
- package/src/core/data/MemoryManager.js +2 -2
- package/src/core/data/Observable.js +15 -18
- package/src/core/data/ObservableArray.js +118 -46
- package/src/core/data/ObservableChecker.js +2 -2
- package/src/core/data/ObservableItem.js +135 -21
- package/src/core/data/ObservableObject.js +126 -35
- package/src/core/data/ObservableResource.js +113 -3
- package/src/core/data/Store.js +142 -26
- package/src/core/data/observable-helpers/observable.is-to.js +196 -1
- package/src/core/data/observable-helpers/observable.prototypes.js +33 -8
- package/src/core/elements/anchor/anchor-with-sentinel.js +23 -2
- package/src/core/elements/anchor/anchor.js +16 -7
- package/src/core/elements/anchor/one-child-anchor-overwriting.js +2 -2
- package/src/core/elements/content-formatter.js +1 -1
- package/src/core/elements/control/for-each-array.js +9 -9
- package/src/core/elements/control/for-each.js +14 -14
- package/src/core/elements/control/show-if.js +11 -11
- package/src/core/elements/control/show-when.js +5 -5
- package/src/core/elements/control/switch.js +14 -14
- package/src/core/elements/description-list.js +1 -1
- package/src/core/elements/form.js +2 -2
- package/src/core/elements/fragment.js +1 -1
- package/src/core/elements/html5-semantics.js +1 -1
- package/src/core/elements/img.js +3 -3
- package/src/core/elements/interactive.js +1 -1
- package/src/core/elements/list.js +1 -1
- package/src/core/elements/medias.js +1 -1
- package/src/core/elements/meta-data.js +1 -1
- package/src/core/elements/svg.js +1 -1
- package/src/core/elements/table.js +1 -1
- package/src/core/errors/ArgTypesError.js +1 -1
- package/src/core/utils/HasEventEmitter.js +36 -2
- package/src/core/utils/args-types.js +9 -9
- package/src/core/utils/cache.js +1 -1
- package/src/core/utils/callback-handler.js +29 -0
- package/src/core/utils/debug-manager.js +6 -6
- package/src/core/utils/events.js +139 -139
- package/src/core/utils/filters/date.js +84 -3
- package/src/core/utils/filters/standard.js +136 -11
- package/src/core/utils/filters/strings.js +34 -2
- package/src/core/utils/filters/utils.js +40 -4
- package/src/core/utils/formatters.js +4 -4
- package/src/core/utils/helpers.js +39 -7
- package/src/core/utils/localstorage.js +11 -11
- package/src/core/utils/memoize.js +56 -3
- package/src/core/utils/plugins-manager.js +3 -3
- package/src/core/utils/property-accumulator.js +6 -6
- package/src/core/utils/prototypes.js +26 -1
- package/src/core/utils/shortcut-manager.js +2 -2
- package/src/core/utils/validator.js +8 -8
- package/src/core/wrappers/AttributesWrapper.js +32 -22
- package/src/core/wrappers/DocumentObserver.js +3 -3
- package/src/core/wrappers/ElementCreator.js +5 -5
- package/src/core/wrappers/HtmlElementWrapper.js +38 -12
- package/src/core/wrappers/NDElement.js +328 -22
- package/src/core/wrappers/NdPrototype.js +60 -16
- package/src/core/wrappers/SingletonView.js +50 -2
- package/src/core/wrappers/SvgElementWrapper.js +1 -1
- package/src/core/wrappers/constants.js +35 -2
- package/src/core/wrappers/prototypes/attributes-extensions.js +7 -7
- package/src/core/wrappers/prototypes/nd-element-extensions.js +72 -6
- package/src/core/wrappers/prototypes/nd-element.transition.extensions.js +42 -2
- package/src/core/wrappers/template-cloner/NodeCloner.js +53 -8
- package/src/core/wrappers/template-cloner/TemplateCloner.js +75 -6
- package/src/core/wrappers/template-cloner/attributes-hydrator.js +58 -2
- package/src/core/wrappers/template-cloner/utils.js +42 -6
- package/src/fetch/NativeFetch.js +3 -3
- package/src/i18n/bin/scan.js +6 -6
- package/src/i18n/index.d.ts +2 -0
- package/src/i18n/service/I18nService.d.ts +27 -0
- package/src/i18n/service/I18nService.js +5 -5
- package/src/i18n/service/functions.d.ts +22 -0
- package/src/i18n/service/functions.js +2 -2
- package/src/router/Route.js +3 -3
- package/src/router/RouteGroupHelper.js +2 -2
- package/src/router/Router.js +15 -15
- package/src/router/RouterComponent.js +33 -7
- package/src/router/link.js +4 -4
- package/src/router/modes/HashRouter.js +2 -2
- package/src/router/modes/HistoryRouter.js +2 -2
- package/src/router/modes/MemoryRouter.js +1 -1
- package/src/ui/components/accordion/AccordionItemRender.js +3 -3
- package/src/ui/components/accordion/AccordionRender.js +1 -1
- package/src/ui/components/alert/AlertRender.js +10 -10
- package/src/ui/components/avatar/avata-group/AvatarGroupRender.js +1 -1
- package/src/ui/components/avatar/avatar/AvatarRender.js +1 -1
- package/src/ui/components/breadcrumb/BreadcrumbRender.js +2 -2
- package/src/ui/components/button/ButtonRender.js +1 -1
- package/src/ui/components/contextmenu/ContextmenuRender.js +5 -5
- package/src/ui/components/dropdown/DropdownRender.js +8 -8
- package/src/ui/components/dropdown/group/DropdownGroupRender.js +2 -2
- package/src/ui/components/dropdown/item/DropdownItemRender.js +1 -1
- package/src/ui/components/form/FieldCollectionRender.js +2 -2
- package/src/ui/components/form/FormControlRender.js +5 -5
- package/src/ui/components/form/fields/AutocompleteFieldRender.js +3 -3
- package/src/ui/components/form/fields/CheckboxFieldRender.js +1 -1
- package/src/ui/components/form/fields/CheckboxGroupFieldRender.js +1 -1
- package/src/ui/components/form/fields/DateFieldRender.js +7 -7
- package/src/ui/components/form/fields/EmailFieldRender.js +1 -1
- package/src/ui/components/form/fields/FieldRender.js +4 -4
- package/src/ui/components/form/fields/FileFieldRender.js +1 -1
- package/src/ui/components/form/fields/PasswordFieldRender.js +2 -2
- package/src/ui/components/form/fields/RadioFieldRender.js +1 -1
- package/src/ui/components/form/fields/RangeFieldRender.js +1 -1
- package/src/ui/components/form/fields/SelectFieldRender.js +2 -2
- package/src/ui/components/form/fields/SliderFieldRender.js +6 -6
- package/src/ui/components/form/fields/StringFieldRender.js +1 -1
- package/src/ui/components/form/fields/TelFieldRender.js +1 -1
- package/src/ui/components/form/fields/TextAreaFieldRender.js +1 -1
- package/src/ui/components/form/fields/TimeFieldRender.js +3 -3
- package/src/ui/components/form/fields/UrlFieldRender.js +1 -1
- package/src/ui/components/form/file-upload-mode/FileAvatarModeRender.js +1 -1
- package/src/ui/components/form/file-upload-mode/FileDropzoneModeRender.js +2 -2
- package/src/ui/components/form/file-upload-mode/FileUploadButtonModeRender.js +2 -2
- package/src/ui/components/form/file-upload-mode/FileWallModeRender.js +1 -1
- package/src/ui/components/form/helpers.js +8 -8
- package/src/ui/components/form/index.js +27 -27
- package/src/ui/components/menu/MenuDividerRender.js +1 -1
- package/src/ui/components/menu/MenuGroupRender.js +3 -3
- package/src/ui/components/menu/MenuItemRender.js +2 -2
- package/src/ui/components/menu/MenuLinkRender.js +3 -3
- package/src/ui/components/menu/helpers.js +4 -4
- package/src/ui/components/modal/ModalRender.js +4 -4
- package/src/ui/components/pagination/PaginationRender.js +9 -9
- package/src/ui/components/popover/PopoverRender.js +7 -7
- package/src/ui/components/progress/ProgressRender.js +12 -12
- package/src/ui/components/skeleton/SkeletonRender.js +56 -0
- package/src/ui/components/splitter/SplitterGutterRender.js +1 -1
- package/src/ui/components/splitter/SplitterPanelRender.js +2 -2
- package/src/ui/components/stacks/PositionStackRender.js +1 -1
- package/src/ui/components/stacks/StackRender.js +1 -1
- package/src/ui/components/stacks/absolute-stack/AbsoluteStackRender.js +1 -1
- package/src/ui/components/stacks/fixed-stack/FixedStackRender.js +1 -1
- package/src/ui/components/stacks/h-stack/HStackRender.js +1 -1
- package/src/ui/components/stacks/index.js +5 -5
- package/src/ui/components/stacks/relative-stack/RelativeStackRender.js +1 -1
- package/src/ui/components/stacks/v-stack/VStackRender.js +1 -1
- package/src/ui/components/stepper/StepperRender.js +2 -2
- package/src/ui/components/stepper/StepperStepRender.js +4 -4
- package/src/ui/components/switch/SwitchRender.js +4 -4
- package/src/ui/components/table/data-table/DataTableRender.js +5 -5
- package/src/ui/components/table/data-table/bulk-actions.js +7 -7
- package/src/ui/components/table/data-table/pagination.js +6 -6
- package/src/ui/components/table/data-table/tables.js +25 -25
- package/src/ui/components/table/data-table/toolbar.js +3 -3
- package/src/ui/components/table/simple-table/SimpleTableRender.js +8 -8
- package/src/ui/components/tabs/TabsRender.js +11 -11
- package/src/ui/components/toast/ToastRender.js +3 -3
- package/src/ui/components/tooltip/TooltipRender.js +1 -1
- package/src/ui/index.js +36 -36
- package/types/elements.d.ts +163 -1037
- package/types/forms.d.ts +16 -20
- package/types/globals.d.ts +543 -0
- package/types/images.d.ts +2 -2
- package/types/observable-resource.d.ts +3 -0
- package/types/property-accumulator.d.ts +4 -4
- package/types/store.d.ts +26 -2
- package/types/validator.ts +3 -3
- package/ui.js +1 -0
- package/src/components/form/field/DefaultRender.js +0 -77
- package/src/components/form/field/FieldFactory.js +0 -107
- package/src/components/skeleton/SkeletonCard.js +0 -0
- package/src/components/skeleton/SkeletonList.js +0 -0
- package/src/components/skeleton/SkeletonParagraph.js +0 -0
- package/src/components/skeleton/SkeletonTable.js +0 -0
|
@@ -1,7 +1,28 @@
|
|
|
1
|
-
import BaseComponent from
|
|
2
|
-
import HasEventEmitter from
|
|
3
|
-
import {Observable} from
|
|
1
|
+
import BaseComponent from '../BaseComponent';
|
|
2
|
+
import HasEventEmitter from '../../core/utils/HasEventEmitter';
|
|
3
|
+
import {Observable} from '../../core/data/Observable';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Non-blocking notification toast. Supports type variants, duration, pause-on-hover, actions, and positioning.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* const toast = new Toast(Span('File saved successfully'))
|
|
10
|
+
* .success()
|
|
11
|
+
* .duration(4000)
|
|
12
|
+
* .closable(true)
|
|
13
|
+
* .pauseOnHover(true)
|
|
14
|
+
* .atTopTrailing()
|
|
15
|
+
* .action('View', () => navigate('/files'))
|
|
16
|
+
* .onClose(() => console.log('dismissed'));
|
|
17
|
+
*
|
|
18
|
+
* Toast.use((description, instance) => {
|
|
19
|
+
* return Div({ class: \`toast toast--\${description.type}\` }, description.content);
|
|
20
|
+
* });
|
|
21
|
+
*
|
|
22
|
+
* @constructor
|
|
23
|
+
* @param {NdChild} content
|
|
24
|
+
* @param {GlobalAttributes} [props={}]
|
|
25
|
+
*/
|
|
5
26
|
export default function Toast(content, props = {}) {
|
|
6
27
|
if (!(this instanceof Toast)) {
|
|
7
28
|
return new Toast(content, props);
|
|
@@ -22,7 +43,7 @@ export default function Toast(content, props = {}) {
|
|
|
22
43
|
position: 'top-trailing',
|
|
23
44
|
actions: [],
|
|
24
45
|
render: null,
|
|
25
|
-
props
|
|
46
|
+
props,
|
|
26
47
|
};
|
|
27
48
|
}
|
|
28
49
|
|
|
@@ -30,91 +51,194 @@ BaseComponent.extends(Toast);
|
|
|
30
51
|
BaseComponent.use(Toast, HasEventEmitter);
|
|
31
52
|
|
|
32
53
|
Toast.defaultTemplate = null;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Registers the render template for Toast.
|
|
57
|
+
* @param {(description: {
|
|
58
|
+
* visibility: Observable<boolean>,
|
|
59
|
+
* type: 'info'|'success'|'warning'|'error'|string|null,
|
|
60
|
+
* title: NdChild|null,
|
|
61
|
+
* content: NdChild,
|
|
62
|
+
* icon: NdChild|null,
|
|
63
|
+
* showIcon: boolean,
|
|
64
|
+
* duration: number,
|
|
65
|
+
* closable: boolean,
|
|
66
|
+
* pauseOnHover: boolean,
|
|
67
|
+
* position: 'top-leading'|'top-trailing'|'top-center'|'bottom-leading'|'bottom-trailing'|'bottom-center',
|
|
68
|
+
* actions: Array<{ label: NdChild, handler: Function|null, variant: string|null }>,
|
|
69
|
+
* render: ((desc: *, instance: Toast) => NdChild)|null,
|
|
70
|
+
* props: GlobalAttributes,
|
|
71
|
+
* }, instance: Toast) => NdChild} template
|
|
72
|
+
*/
|
|
33
73
|
Toast.use = function(template) {
|
|
34
74
|
Toast.defaultTemplate = template;
|
|
35
75
|
};
|
|
36
76
|
|
|
37
77
|
// Types
|
|
78
|
+
/**
|
|
79
|
+
* @param {string} type
|
|
80
|
+
* @returns {this}
|
|
81
|
+
*/
|
|
38
82
|
Toast.prototype.type = function(type) {
|
|
39
83
|
this.$description.type = type;
|
|
40
84
|
return this;
|
|
41
85
|
};
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* @returns {this}
|
|
89
|
+
*/
|
|
42
90
|
Toast.prototype.info = function() {
|
|
43
91
|
this.$description.type = 'info';
|
|
44
92
|
return this;
|
|
45
93
|
};
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* @returns {this}
|
|
97
|
+
*/
|
|
46
98
|
Toast.prototype.success = function() {
|
|
47
99
|
this.$description.type = 'success';
|
|
48
100
|
return this;
|
|
49
101
|
};
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* @returns {this}
|
|
105
|
+
*/
|
|
50
106
|
Toast.prototype.warning = function() {
|
|
51
107
|
this.$description.type = 'warning';
|
|
52
108
|
return this;
|
|
53
109
|
};
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* @returns {this}
|
|
113
|
+
*/
|
|
54
114
|
Toast.prototype.error = function() {
|
|
55
115
|
this.$description.type = 'error';
|
|
56
116
|
return this;
|
|
57
117
|
};
|
|
58
118
|
|
|
59
|
-
|
|
119
|
+
/**
|
|
120
|
+
* @param {NdChild} title
|
|
121
|
+
* @returns {this}
|
|
122
|
+
*/
|
|
60
123
|
Toast.prototype.title = function(title) {
|
|
61
124
|
this.$description.title = title;
|
|
62
125
|
return this;
|
|
63
126
|
};
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* @param {NdChild} content
|
|
130
|
+
* @returns {this}
|
|
131
|
+
*/
|
|
64
132
|
Toast.prototype.content = function(content) {
|
|
65
133
|
this.$description.content = content;
|
|
66
134
|
return this;
|
|
67
135
|
};
|
|
68
136
|
|
|
137
|
+
/**
|
|
138
|
+
* @param {NdChild} icon
|
|
139
|
+
* @returns {this}
|
|
140
|
+
*/
|
|
69
141
|
Toast.prototype.icon = function(icon) {
|
|
70
142
|
this.$description.icon = icon;
|
|
71
143
|
return this;
|
|
72
144
|
};
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* @param {boolean} [show]
|
|
148
|
+
* @returns {this}
|
|
149
|
+
*/
|
|
73
150
|
Toast.prototype.showIcon = function(show = true) {
|
|
74
151
|
this.$description.showIcon = show;
|
|
75
152
|
return this;
|
|
76
153
|
};
|
|
77
154
|
|
|
78
155
|
// Behavior
|
|
156
|
+
/**
|
|
157
|
+
* @param {number} ms
|
|
158
|
+
* @returns {this}
|
|
159
|
+
*/
|
|
79
160
|
Toast.prototype.duration = function(ms) {
|
|
80
161
|
this.$description.duration = ms;
|
|
81
162
|
return this;
|
|
82
163
|
};
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* @param {boolean} [closable]
|
|
167
|
+
* @returns {this}
|
|
168
|
+
*/
|
|
83
169
|
Toast.prototype.closable = function(closable = true) {
|
|
84
170
|
this.$description.closable = closable;
|
|
85
171
|
return this;
|
|
86
172
|
};
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* @param {*} [pauseOnHover]
|
|
176
|
+
* @returns {this}
|
|
177
|
+
*/
|
|
87
178
|
Toast.prototype.pauseOnHover = function(pauseOnHover = true) {
|
|
88
179
|
this.$description.pauseOnHover = pauseOnHover;
|
|
89
180
|
return this;
|
|
90
181
|
};
|
|
91
182
|
|
|
92
183
|
// Position
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* @param {'top-leading'|'top-trailing'|'top-center'|'bottom-leading'|'bottom-trailing'|'bottom-center'} position
|
|
187
|
+
* @returns {this}
|
|
188
|
+
*/
|
|
93
189
|
Toast.prototype.position = function(position) {
|
|
94
190
|
this.$description.position = position;
|
|
95
191
|
return this;
|
|
96
192
|
};
|
|
97
193
|
|
|
194
|
+
/**
|
|
195
|
+
* @returns {this}
|
|
196
|
+
*/
|
|
98
197
|
Toast.prototype.atTopLeading = function() {
|
|
99
198
|
return this.position('top-leading');
|
|
100
199
|
};
|
|
101
200
|
|
|
201
|
+
/**
|
|
202
|
+
* @returns {this}
|
|
203
|
+
*/
|
|
102
204
|
Toast.prototype.atTopTrailing = function() {
|
|
103
205
|
return this.position('top-trailing');
|
|
104
206
|
};
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* @returns {this}
|
|
210
|
+
*/
|
|
105
211
|
Toast.prototype.atBottomLeading = function() {
|
|
106
212
|
return this.position('bottom-leading');
|
|
107
213
|
};
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* @returns {this}
|
|
217
|
+
*/
|
|
108
218
|
Toast.prototype.atBottomTrailing = function() {
|
|
109
219
|
return this.position('bottom-trailing');
|
|
110
220
|
};
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* @returns {this}
|
|
224
|
+
*/
|
|
111
225
|
Toast.prototype.atTopCenter = function() {
|
|
112
226
|
return this.position('top-center');
|
|
113
227
|
};
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* @returns {this}
|
|
231
|
+
*/
|
|
114
232
|
Toast.prototype.atBottomCenter = function() {
|
|
115
233
|
return this.position('bottom-center');
|
|
116
234
|
};
|
|
117
235
|
|
|
236
|
+
/**
|
|
237
|
+
* @param {NdChild} label
|
|
238
|
+
* @param {(() => void)} [handler]
|
|
239
|
+
* @param {string|null} [variant=null]
|
|
240
|
+
* @returns {this}
|
|
241
|
+
*/
|
|
118
242
|
Toast.prototype.action = function(label, handler, variant = null) {
|
|
119
243
|
handler = handler || (() => this.close());
|
|
120
244
|
this.$description.actions.push({ label, handler, variant });
|
|
@@ -126,6 +250,10 @@ Toast.prototype.close = function() {
|
|
|
126
250
|
this.emit('close');
|
|
127
251
|
};
|
|
128
252
|
|
|
253
|
+
/**
|
|
254
|
+
* @param {Function} handler
|
|
255
|
+
* @returns {this}
|
|
256
|
+
*/
|
|
129
257
|
Toast.prototype.onClose = function(handler) {
|
|
130
258
|
this.on('close', handler);
|
|
131
259
|
return this;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { ValidChild } from '../../../../types/elements';
|
|
2
|
+
import type { ObservableItem } from '../../../../types/observable';
|
|
3
|
+
import type { BaseComponent } from '../../BaseComponent';
|
|
4
|
+
import type { GlobalAttributes } from '../../../../types/globals';
|
|
5
|
+
|
|
6
|
+
export type ToastDescription = {
|
|
7
|
+
visibility: ObservableItem<boolean>;
|
|
8
|
+
type: 'info' | 'success' | 'warning' | 'error' | string | null;
|
|
9
|
+
title: ValidChild | null;
|
|
10
|
+
content: ValidChild;
|
|
11
|
+
icon: ValidChild | null;
|
|
12
|
+
showIcon: boolean;
|
|
13
|
+
duration: number;
|
|
14
|
+
closable: boolean;
|
|
15
|
+
pauseOnHover: boolean;
|
|
16
|
+
position: 'top-leading' | 'top-trailing' | 'top-center' | 'bottom-leading' | 'bottom-trailing' | 'bottom-center';
|
|
17
|
+
actions: Array<{ label: ValidChild; handler: (() => void) | null; variant: string | null }>;
|
|
18
|
+
render: ((desc: ToastDescription, instance: ToastInterface) => ValidChild) | null;
|
|
19
|
+
props: GlobalAttributes;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export interface ToastInterface extends BaseComponent {
|
|
23
|
+
type(type: 'info' | 'success' | 'warning' | 'error' | string): this;
|
|
24
|
+
info(): this;
|
|
25
|
+
success(): this;
|
|
26
|
+
warning(): this;
|
|
27
|
+
error(): this;
|
|
28
|
+
title(title: ValidChild): this;
|
|
29
|
+
content(content: ValidChild): this;
|
|
30
|
+
icon(icon: ValidChild): this;
|
|
31
|
+
showIcon(show?: boolean): this;
|
|
32
|
+
duration(ms: number): this;
|
|
33
|
+
closable(closable?: boolean): this;
|
|
34
|
+
pauseOnHover(pauseOnHover?: boolean): this;
|
|
35
|
+
position(position: 'top-leading' | 'top-trailing' | 'top-center' | 'bottom-leading' | 'bottom-trailing' | 'bottom-center'): this;
|
|
36
|
+
atTopLeading(): this;
|
|
37
|
+
atTopTrailing(): this;
|
|
38
|
+
atTopCenter(): this;
|
|
39
|
+
atBottomLeading(): this;
|
|
40
|
+
atBottomTrailing(): this;
|
|
41
|
+
atBottomCenter(): this;
|
|
42
|
+
render(renderFn: (desc: ToastDescription, instance: ToastInterface) => ValidChild): this;
|
|
43
|
+
action(label: ValidChild, handler?: () => void, variant?: string | null): this;
|
|
44
|
+
close(): void;
|
|
45
|
+
show(): void;
|
|
46
|
+
onClose(handler: () => void): this;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
export declare function Toast(content: ValidChild, props?: Record<string, unknown>): ToastInterface;
|
|
51
|
+
export declare namespace Toast {
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
function use(template: (description: ToastDescription, instance: ToastInterface) => ValidChild): void;
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ValidChild } from '../../../../types/elements';
|
|
2
|
+
import type { ToastInterface } from './Toast';
|
|
3
|
+
|
|
4
|
+
export interface ToastErrorInterface extends ToastInterface {}
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
export declare function ToastError(content: ValidChild, props?: Record<string, unknown>): ToastErrorInterface;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ValidChild } from '../../../../types/elements';
|
|
2
|
+
import type { ToastInterface } from './Toast';
|
|
3
|
+
|
|
4
|
+
export interface ToastInfoInterface extends ToastInterface {}
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
export declare function ToastInfo(content: ValidChild, props?: Record<string, unknown>): ToastInfoInterface;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ValidChild } from '../../../../types/elements';
|
|
2
|
+
import type { ToastInterface } from './Toast';
|
|
3
|
+
|
|
4
|
+
export interface ToastSuccessInterface extends ToastInterface {}
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
export declare function ToastSuccess(content: ValidChild, props?: Record<string, unknown>): ToastSuccessInterface;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ValidChild } from '../../../../types/elements';
|
|
2
|
+
import type { ToastInterface } from './Toast';
|
|
3
|
+
|
|
4
|
+
export interface ToastWarningInterface extends ToastInterface {}
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
export declare function ToastWarning(content: ValidChild, props?: Record<string, unknown>): ToastWarningInterface;
|
|
@@ -1,12 +1,29 @@
|
|
|
1
|
+
import {Observable} from '../../core/data/Observable';
|
|
2
|
+
import {NDElement} from '../../core/wrappers/NDElement';
|
|
3
|
+
import BaseComponent from '../BaseComponent';
|
|
4
|
+
import HasEventEmitter from '../../core/utils/HasEventEmitter';
|
|
5
|
+
import DebugManager from '../../core/utils/debug-manager';
|
|
6
|
+
|
|
1
7
|
/**
|
|
2
|
-
*
|
|
8
|
+
* Contextual tooltip anchored to a trigger element. Supports hover/click/focus interactions, position, arrow, and interactive mode.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* const tooltip = new Tooltip(Span('This is a helpful hint'))
|
|
12
|
+
* .trigger(iconEl)
|
|
13
|
+
* .onHovered()
|
|
14
|
+
* .position('top')
|
|
15
|
+
* .arrow(true)
|
|
16
|
+
* .hideDelay(200)
|
|
17
|
+
* .info();
|
|
18
|
+
*
|
|
19
|
+
* Tooltip.use((description, instance) => {
|
|
20
|
+
* return Div({ class: 'tooltip' }, description.title, description.content);
|
|
21
|
+
* });
|
|
22
|
+
*
|
|
23
|
+
* @constructor
|
|
24
|
+
* @param {NdChild} content
|
|
25
|
+
* @param {GlobalAttributes} [props={}]
|
|
3
26
|
*/
|
|
4
|
-
import {Observable} from "../../core/data/Observable";
|
|
5
|
-
import {NDElement} from "../../core/wrappers/NDElement";
|
|
6
|
-
import BaseComponent from "../BaseComponent";
|
|
7
|
-
import HasEventEmitter from "../../core/utils/HasEventEmitter";
|
|
8
|
-
import DebugManager from "../../core/utils/debug-manager";
|
|
9
|
-
|
|
10
27
|
export default function Tooltip(content, props = {}) {
|
|
11
28
|
if (!(this instanceof Tooltip)) {
|
|
12
29
|
return new Tooltip(content, props);
|
|
@@ -37,6 +54,26 @@ BaseComponent.use(Tooltip, HasEventEmitter);
|
|
|
37
54
|
|
|
38
55
|
Tooltip.defaultTemplate = null;
|
|
39
56
|
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Registers the render template for Tooltip.
|
|
60
|
+
* @param {(description: {
|
|
61
|
+
* trigger: HTMLElement|NDElement|null,
|
|
62
|
+
* interaction: 'hover'|'click'|'focus',
|
|
63
|
+
* content: NdChild,
|
|
64
|
+
* position: 'top'|'bottom'|'left'|'right',
|
|
65
|
+
* title: NdChild|null,
|
|
66
|
+
* isOpen: Observable<boolean>,
|
|
67
|
+
* offset: number,
|
|
68
|
+
* shift: Record<string, number>,
|
|
69
|
+
* hideDelay: number,
|
|
70
|
+
* arrow: boolean,
|
|
71
|
+
* interactive: boolean,
|
|
72
|
+
* variant: string|null,
|
|
73
|
+
* updatePositionOn: Observable<*>|null,
|
|
74
|
+
* props: GlobalAttributes,
|
|
75
|
+
* }, instance: Tooltip) => NdChild} template
|
|
76
|
+
*/
|
|
40
77
|
Tooltip.use = function(template) {
|
|
41
78
|
Tooltip.defaultTemplate = template;
|
|
42
79
|
if(!NDElement.prototype.tooltip) {
|
|
@@ -61,6 +98,10 @@ Tooltip.use = function(template) {
|
|
|
61
98
|
}
|
|
62
99
|
};
|
|
63
100
|
|
|
101
|
+
/**
|
|
102
|
+
* @param {string} name
|
|
103
|
+
* @param {(t: Tooltip) => Tooltip} callback
|
|
104
|
+
*/
|
|
64
105
|
Tooltip.preset = function(name, callback) {
|
|
65
106
|
if (Tooltip.prototype[name] || Tooltip[name]) {
|
|
66
107
|
DebugManager.warn(`Warning: the ${name} method already exist in Tooltip.`);
|
|
@@ -69,146 +110,249 @@ Tooltip.preset = function(name, callback) {
|
|
|
69
110
|
Tooltip[name] = (content, props) => callback(new Tooltip(content, props));
|
|
70
111
|
};
|
|
71
112
|
|
|
113
|
+
/**
|
|
114
|
+
* @param {Record<string, (t: Tooltip) => Tooltip>} presets
|
|
115
|
+
*/
|
|
72
116
|
Tooltip.presets = function(presets) {
|
|
73
117
|
for (const name in presets) {
|
|
74
118
|
Tooltip.preset(name, presets[name]);
|
|
75
119
|
}
|
|
76
120
|
};
|
|
77
121
|
|
|
122
|
+
/**
|
|
123
|
+
* @param {HTMLElement|NDElement} trigger
|
|
124
|
+
* @returns {this}
|
|
125
|
+
*/
|
|
78
126
|
Tooltip.prototype.trigger = function(trigger) {
|
|
79
127
|
this.$description.trigger = trigger;
|
|
80
128
|
return this;
|
|
81
129
|
};
|
|
82
130
|
|
|
131
|
+
/**
|
|
132
|
+
* @param {NdChild} title
|
|
133
|
+
* @returns {this}
|
|
134
|
+
*/
|
|
83
135
|
Tooltip.prototype.title = function(title) {
|
|
84
136
|
this.$description.title = title;
|
|
85
137
|
return this;
|
|
86
138
|
};
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* @param {NdChild} content
|
|
142
|
+
* @returns {this}
|
|
143
|
+
*/
|
|
87
144
|
Tooltip.prototype.content = function(content) {
|
|
88
145
|
this.$description.content = content;
|
|
89
146
|
return this;
|
|
90
147
|
};
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* @param {string} variant
|
|
151
|
+
* @returns {this}
|
|
152
|
+
*/
|
|
91
153
|
Tooltip.prototype.variant = function(variant) {
|
|
92
154
|
this.$description.variant = variant;
|
|
93
155
|
return this;
|
|
94
156
|
};
|
|
95
157
|
|
|
158
|
+
/**
|
|
159
|
+
* @returns {this}
|
|
160
|
+
*/
|
|
96
161
|
Tooltip.prototype.primary = function() {
|
|
97
162
|
this.$description.variant = 'primary';
|
|
98
163
|
return this;
|
|
99
164
|
};
|
|
100
165
|
|
|
166
|
+
/**
|
|
167
|
+
* @returns {this}
|
|
168
|
+
*/
|
|
101
169
|
Tooltip.prototype.success = function() {
|
|
102
170
|
this.$description.variant = 'success';
|
|
103
171
|
return this;
|
|
104
172
|
};
|
|
105
173
|
|
|
174
|
+
/**
|
|
175
|
+
* @returns {this}
|
|
176
|
+
*/
|
|
106
177
|
Tooltip.prototype.warning = function() {
|
|
107
178
|
this.$description.variant = 'warning';
|
|
108
179
|
return this;
|
|
109
180
|
};
|
|
110
181
|
|
|
182
|
+
/**
|
|
183
|
+
* @returns {this}
|
|
184
|
+
*/
|
|
111
185
|
Tooltip.prototype.danger = function() {
|
|
112
186
|
this.$description.variant = 'danger';
|
|
113
187
|
return this;
|
|
114
188
|
};
|
|
115
189
|
|
|
190
|
+
/**
|
|
191
|
+
* @returns {this}
|
|
192
|
+
*/
|
|
116
193
|
Tooltip.prototype.info = function() {
|
|
117
194
|
this.$description.variant = 'info';
|
|
118
195
|
return this;
|
|
119
196
|
};
|
|
120
197
|
|
|
198
|
+
/**
|
|
199
|
+
* @param {'top'|'bottom'|'left'|'right'} position
|
|
200
|
+
* @returns {this}
|
|
201
|
+
*/
|
|
121
202
|
Tooltip.prototype.position = function(position) {
|
|
122
203
|
this.$description.position = position;
|
|
123
204
|
return this;
|
|
124
205
|
};
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* @returns {this}
|
|
209
|
+
*/
|
|
125
210
|
Tooltip.prototype.atTop = function() {
|
|
126
211
|
this.$description.position = 'top';
|
|
127
212
|
return this;
|
|
128
213
|
};
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* @returns {this}
|
|
217
|
+
*/
|
|
129
218
|
Tooltip.prototype.atBottom = function() {
|
|
130
219
|
this.$description.position = 'bottom';
|
|
131
220
|
return this;
|
|
132
221
|
};
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* @returns {this}
|
|
225
|
+
*/
|
|
133
226
|
Tooltip.prototype.atLeft = function() {
|
|
134
227
|
this.$description.position = 'left';
|
|
135
228
|
return this;
|
|
136
229
|
};
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* @returns {this}
|
|
233
|
+
*/
|
|
137
234
|
Tooltip.prototype.atRight = function() {
|
|
138
235
|
this.$description.position = 'right';
|
|
139
236
|
return this;
|
|
140
237
|
};
|
|
141
238
|
|
|
239
|
+
/**
|
|
240
|
+
* @returns {this}
|
|
241
|
+
*/
|
|
142
242
|
Tooltip.prototype.onClicked = function() {
|
|
143
243
|
this.$description.interaction = 'click';
|
|
144
244
|
return this;
|
|
145
245
|
};
|
|
146
246
|
|
|
247
|
+
/**
|
|
248
|
+
* @returns {this}
|
|
249
|
+
*/
|
|
147
250
|
Tooltip.prototype.onHovered = function() {
|
|
148
251
|
this.$description.interaction = 'hover';
|
|
149
252
|
return this;
|
|
150
253
|
};
|
|
151
254
|
|
|
255
|
+
/**
|
|
256
|
+
* @returns {this}
|
|
257
|
+
*/
|
|
152
258
|
Tooltip.prototype.onFocused = function() {
|
|
153
259
|
this.$description.interaction = 'focus';
|
|
154
260
|
return this;
|
|
155
261
|
};
|
|
156
262
|
|
|
263
|
+
/**
|
|
264
|
+
* @param {number} ms
|
|
265
|
+
* @returns {this}
|
|
266
|
+
*/
|
|
157
267
|
Tooltip.prototype.hideDelay = function(ms) {
|
|
158
268
|
this.$description.hideDelay = ms;
|
|
159
269
|
return this;
|
|
160
270
|
};
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* @param {*} [enabled]
|
|
274
|
+
* @returns {this}
|
|
275
|
+
*/
|
|
161
276
|
Tooltip.prototype.arrow = function(enabled = true) {
|
|
162
277
|
this.$description.arrow = enabled;
|
|
163
278
|
return this;
|
|
164
279
|
};
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* @param {boolean} [isInteractive=true]
|
|
283
|
+
* @returns {this}
|
|
284
|
+
*/
|
|
165
285
|
Tooltip.prototype.interactive = function(isInteractive = true) {
|
|
166
286
|
this.$description.interactive = isInteractive;
|
|
167
287
|
return this;
|
|
168
|
-
}
|
|
288
|
+
};
|
|
169
289
|
|
|
290
|
+
/**
|
|
291
|
+
* @returns {this}
|
|
292
|
+
*/
|
|
170
293
|
Tooltip.prototype.open = function() {
|
|
171
294
|
this.$description.isOpen.set(true);
|
|
172
295
|
this.emit('open');
|
|
173
296
|
return this;
|
|
174
297
|
};
|
|
175
298
|
|
|
299
|
+
/**
|
|
300
|
+
* @returns {this}
|
|
301
|
+
*/
|
|
176
302
|
Tooltip.prototype.close = function() {
|
|
177
303
|
this.$description.isOpen.set(false);
|
|
178
304
|
this.emit('close');
|
|
179
305
|
return this;
|
|
180
306
|
};
|
|
181
307
|
|
|
308
|
+
/**
|
|
309
|
+
* @returns {this}
|
|
310
|
+
*/
|
|
182
311
|
Tooltip.prototype.toggle = function() {
|
|
183
312
|
this.$description.isOpen.val() ? this.close() : this.open();
|
|
184
313
|
return this;
|
|
185
314
|
};
|
|
186
315
|
|
|
316
|
+
/**
|
|
317
|
+
* @param {Function} handler
|
|
318
|
+
* @returns {this}
|
|
319
|
+
*/
|
|
187
320
|
Tooltip.prototype.onOpen = function(handler) {
|
|
188
321
|
this.on('open', handler);
|
|
189
322
|
return this;
|
|
190
323
|
};
|
|
191
324
|
|
|
325
|
+
/**
|
|
326
|
+
* @param {Function} handler
|
|
327
|
+
* @returns {this}
|
|
328
|
+
*/
|
|
192
329
|
Tooltip.prototype.onClose = function(handler) {
|
|
193
330
|
this.on('close', handler);
|
|
194
331
|
return this;
|
|
195
332
|
};
|
|
196
333
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
334
|
+
/**
|
|
335
|
+
* @param {number} offset
|
|
336
|
+
* @returns {this}
|
|
337
|
+
*/
|
|
202
338
|
Tooltip.prototype.offset = function(offset) {
|
|
203
339
|
this.$description.offset = offset;
|
|
204
340
|
return this;
|
|
205
341
|
};
|
|
206
342
|
|
|
343
|
+
/**
|
|
344
|
+
* @param {*} shift
|
|
345
|
+
* @returns {this}
|
|
346
|
+
*/
|
|
207
347
|
Tooltip.prototype.shift = function(shift) {
|
|
208
348
|
this.$description.shift = shift;
|
|
209
349
|
return this;
|
|
210
350
|
};
|
|
211
351
|
|
|
352
|
+
/**
|
|
353
|
+
* @param {*} updatePositionOn
|
|
354
|
+
* @returns {this}
|
|
355
|
+
*/
|
|
212
356
|
Tooltip.prototype.updatePositionOn = function(updatePositionOn) {
|
|
213
357
|
this.$description.updatePositionOn = updatePositionOn;
|
|
214
358
|
return this;
|