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,11 +1,26 @@
|
|
|
1
|
-
import BaseComponent from
|
|
2
|
-
import DebugManager from
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* @
|
|
1
|
+
import BaseComponent from '../BaseComponent';
|
|
2
|
+
import DebugManager from '../../core/utils/debug-manager';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Displays a user avatar with image, initials, or icon fallback. Supports status indicators, badges, shape, and size variants.
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* const avatar = new Avatar('https://example.com/photo.jpg')
|
|
10
|
+
* .alt('Jane Doe')
|
|
11
|
+
* .name('Jane Doe')
|
|
12
|
+
* .size('large')
|
|
13
|
+
* .shape('circle')
|
|
14
|
+
* .status('online')
|
|
15
|
+
* .statusAtTopTrailing();
|
|
16
|
+
*
|
|
17
|
+
* Avatar.use((description, instance) => {
|
|
18
|
+
* return Img({ src: description.src, alt: description.alt });
|
|
19
|
+
* });
|
|
20
|
+
*
|
|
21
|
+
* @constructor
|
|
22
|
+
* @param {string|Observable<string>} [source]
|
|
23
|
+
* @param {GlobalAttributes} [props={}]
|
|
9
24
|
*/
|
|
10
25
|
export default function Avatar(source, props = {}) {
|
|
11
26
|
if (!(this instanceof Avatar)) {
|
|
@@ -25,7 +40,7 @@ export default function Avatar(source, props = {}) {
|
|
|
25
40
|
textColor: null,
|
|
26
41
|
status: null,
|
|
27
42
|
render: null,
|
|
28
|
-
props
|
|
43
|
+
props,
|
|
29
44
|
};
|
|
30
45
|
}
|
|
31
46
|
|
|
@@ -33,14 +48,33 @@ BaseComponent.extends(Avatar);
|
|
|
33
48
|
|
|
34
49
|
Avatar.defaultTemplate = null;
|
|
35
50
|
|
|
51
|
+
|
|
36
52
|
/**
|
|
37
|
-
*
|
|
38
|
-
* @param {
|
|
53
|
+
* Registers the render template for Avatar.
|
|
54
|
+
* @param {(description: {
|
|
55
|
+
* src: Observable<string>|null,
|
|
56
|
+
* alt: string|null,
|
|
57
|
+
* name: string|null,
|
|
58
|
+
* initials: string|null,
|
|
59
|
+
* icon: NdChild|null,
|
|
60
|
+
* size: 'extra-small'|'small'|'medium'|'large'|'extra-large'|string|number,
|
|
61
|
+
* shape: 'circle'|'square'|'rounded',
|
|
62
|
+
* variant: string|null,
|
|
63
|
+
* color: string|null,
|
|
64
|
+
* textColor: string|null,
|
|
65
|
+
* status: Observable<string>|string|null,
|
|
66
|
+
* render: ((desc: *, instance: Avatar) => NdChild)|null,
|
|
67
|
+
* props: GlobalAttributes,
|
|
68
|
+
* }, instance: Avatar) => NdChild} template
|
|
39
69
|
*/
|
|
40
70
|
Avatar.use = function(template) {
|
|
41
71
|
Avatar.defaultTemplate = template;
|
|
42
72
|
};
|
|
43
73
|
|
|
74
|
+
/**
|
|
75
|
+
* @param {string} name
|
|
76
|
+
* @param {(a: Avatar) => Avatar} callback
|
|
77
|
+
*/
|
|
44
78
|
Avatar.preset = function(name, callback) {
|
|
45
79
|
if (Avatar.prototype[name] || Avatar[name]) {
|
|
46
80
|
DebugManager.warn(`Warning: the ${name} method already exists in Avatar.`);
|
|
@@ -49,6 +83,9 @@ Avatar.preset = function(name, callback) {
|
|
|
49
83
|
Avatar[name] = (label, props) => callback(new Avatar(label, props));
|
|
50
84
|
};
|
|
51
85
|
|
|
86
|
+
/**
|
|
87
|
+
* @param {Record<string, (a: Avatar) => Avatar>} presets
|
|
88
|
+
*/
|
|
52
89
|
Avatar.presets = function(presets) {
|
|
53
90
|
for (const name in presets) {
|
|
54
91
|
Avatar.preset(name, presets[name]);
|
|
@@ -256,7 +293,7 @@ Avatar.prototype.warning = function() {
|
|
|
256
293
|
*/
|
|
257
294
|
Avatar.prototype.info = function() {
|
|
258
295
|
return this.variant('info');
|
|
259
|
-
}
|
|
296
|
+
};
|
|
260
297
|
|
|
261
298
|
/**
|
|
262
299
|
* Sets the background color of the avatar
|
|
@@ -1,6 +1,23 @@
|
|
|
1
|
-
import BaseComponent from
|
|
2
|
-
|
|
1
|
+
import BaseComponent from '../BaseComponent';
|
|
3
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Renders a group of overlapping Avatar components with a "+N" overflow indicator.
|
|
5
|
+
*
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* const group = new AvatarGroup()
|
|
9
|
+
* .items([
|
|
10
|
+
* new Avatar('user1.jpg').name('Alice'),
|
|
11
|
+
* new Avatar('user2.jpg').name('Bob'),
|
|
12
|
+
* new Avatar('user3.jpg').name('Carol'),
|
|
13
|
+
* ])
|
|
14
|
+
* .max(3)
|
|
15
|
+
* .overlap(8)
|
|
16
|
+
* .onMoreClick((count) => console.log(\`\${count} more users\`));
|
|
17
|
+
*
|
|
18
|
+
* @constructor
|
|
19
|
+
* @param {GlobalAttributes} [props]
|
|
20
|
+
*/
|
|
4
21
|
export default function AvatarGroup(props = {}) {
|
|
5
22
|
if(!(this instanceof AvatarGroup)) {
|
|
6
23
|
return new AvatarGroup(props);
|
|
@@ -19,30 +36,61 @@ export default function AvatarGroup(props = {}) {
|
|
|
19
36
|
BaseComponent.extends(AvatarGroup);
|
|
20
37
|
|
|
21
38
|
AvatarGroup.defaultTemplate = null;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Registers the render template for AvatarGroup.
|
|
42
|
+
* @param {(description: {
|
|
43
|
+
* items: Avatar[],
|
|
44
|
+
* overlap: number,
|
|
45
|
+
* max: number,
|
|
46
|
+
* onMoreClick: ((count: number) => void)|null,
|
|
47
|
+
* props: GlobalAttributes,
|
|
48
|
+
* }, instance: AvatarGroup) => NdChild} template
|
|
49
|
+
*/
|
|
22
50
|
AvatarGroup.use = function(template) {
|
|
23
51
|
AvatarGroup.defaultTemplate = template;
|
|
24
52
|
};
|
|
25
53
|
|
|
54
|
+
/**
|
|
55
|
+
* @param {Avatar[]} items
|
|
56
|
+
* @returns {this}
|
|
57
|
+
*/
|
|
26
58
|
AvatarGroup.prototype.items = function(items) {
|
|
27
59
|
this.$description.items = items;
|
|
28
60
|
return this;
|
|
29
61
|
};
|
|
30
62
|
|
|
63
|
+
/**
|
|
64
|
+
* @param {Avatar} item
|
|
65
|
+
* @returns {this}
|
|
66
|
+
*/
|
|
31
67
|
AvatarGroup.prototype.item = function(item) {
|
|
32
68
|
this.$description.items.push(item);
|
|
33
69
|
return this;
|
|
34
70
|
};
|
|
35
71
|
|
|
72
|
+
/**
|
|
73
|
+
* @param {number} value
|
|
74
|
+
* @returns {this}
|
|
75
|
+
*/
|
|
36
76
|
AvatarGroup.prototype.overlap = function(value) {
|
|
37
77
|
this.$description.overlap = value;
|
|
38
78
|
return this;
|
|
39
79
|
};
|
|
40
80
|
|
|
81
|
+
/**
|
|
82
|
+
* @param {number} max
|
|
83
|
+
* @returns {this}
|
|
84
|
+
*/
|
|
41
85
|
AvatarGroup.prototype.max = function(max) {
|
|
42
86
|
this.$description.max = max;
|
|
43
87
|
return this;
|
|
44
88
|
};
|
|
45
89
|
|
|
90
|
+
/**
|
|
91
|
+
* @param {(count: number) => void} handler
|
|
92
|
+
* @returns {this}
|
|
93
|
+
*/
|
|
46
94
|
AvatarGroup.prototype.onMoreClick = function(handler) {
|
|
47
95
|
this.$description.onMoreClick = handler;
|
|
48
96
|
return this;
|
|
@@ -0,0 +1,74 @@
|
|
|
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 AvatarDescription = {
|
|
7
|
+
src: ObservableItem<string> | null;
|
|
8
|
+
alt: string | null;
|
|
9
|
+
name: string | null;
|
|
10
|
+
initials: string | null;
|
|
11
|
+
icon: ValidChild | null;
|
|
12
|
+
size: 'extra-small' | 'small' | 'medium' | 'large' | 'extra-large' | string | number;
|
|
13
|
+
shape: 'circle' | 'square' | 'rounded';
|
|
14
|
+
variant: string | null;
|
|
15
|
+
color: string | null;
|
|
16
|
+
textColor: string | null;
|
|
17
|
+
status: ObservableItem<string> | string | null;
|
|
18
|
+
render: ((desc: AvatarDescription, instance: AvatarInterface) => ValidChild) | null;
|
|
19
|
+
props: GlobalAttributes;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export interface AvatarInterface extends BaseComponent {
|
|
23
|
+
onError(handler: (error: Error, avatar: AvatarInterface) => void): this;
|
|
24
|
+
src(src: string | ObservableItem<string>): this;
|
|
25
|
+
alt(alt: string): this;
|
|
26
|
+
name(name: string): this;
|
|
27
|
+
initials(initials: string): this;
|
|
28
|
+
icon(icon: ValidChild): this;
|
|
29
|
+
size(size: 'extra-small' | 'small' | 'medium' | 'large' | 'extra-large' | string | number): this;
|
|
30
|
+
extraSmall(): this;
|
|
31
|
+
small(): this;
|
|
32
|
+
medium(): this;
|
|
33
|
+
large(): this;
|
|
34
|
+
extraLarge(): this;
|
|
35
|
+
shape(shape: 'circle' | 'square' | 'rounded'): this;
|
|
36
|
+
circle(): this;
|
|
37
|
+
square(): this;
|
|
38
|
+
rounded(): this;
|
|
39
|
+
variant(variant: string): this;
|
|
40
|
+
primary(): this;
|
|
41
|
+
secondary(): this;
|
|
42
|
+
success(): this;
|
|
43
|
+
danger(): this;
|
|
44
|
+
warning(): this;
|
|
45
|
+
info(): this;
|
|
46
|
+
color(color: string): this;
|
|
47
|
+
textColor(color: string): this;
|
|
48
|
+
status(status: string | ObservableItem<string>): this;
|
|
49
|
+
statusPosition(position: 'top-leading' | 'top-trailing' | 'bottom-leading' | 'bottom-trailing'): this;
|
|
50
|
+
statusAtTopLeading(): this;
|
|
51
|
+
statusAtBottomLeading(): this;
|
|
52
|
+
statusAtTopTrailing(): this;
|
|
53
|
+
statusAtBottomTrailing(): this;
|
|
54
|
+
showStatus(show?: boolean): this;
|
|
55
|
+
badge(content: ValidChild): this;
|
|
56
|
+
badgePosition(position: 'top-leading' | 'top-trailing' | 'bottom-leading' | 'bottom-trailing'): this;
|
|
57
|
+
badgeAtTopLeading(): this;
|
|
58
|
+
badgeAtBottomLeading(): this;
|
|
59
|
+
badgeAtTopTrailing(): this;
|
|
60
|
+
badgeAtBottomTrailing(): this;
|
|
61
|
+
render(template: (description: AvatarDescription, instance: AvatarInterface) => ValidChild): this;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
export declare function Avatar(source?: string | ObservableItem<string>, props?: Record<string, unknown>): AvatarInterface;
|
|
66
|
+
export declare namespace Avatar {
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
function use(template: (description: AvatarDescription, instance: AvatarInterface) => ValidChild): void;
|
|
70
|
+
function preset(name: string, callback: (instance: AvatarInterface) => AvatarInterface): void;
|
|
71
|
+
function presets(presets: Record<string, (instance: AvatarInterface) => AvatarInterface>): void;
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { ValidChild } from '../../../../types/elements';
|
|
2
|
+
import type { ObservableItem } from '../../../../types/observable';
|
|
3
|
+
import type { BaseComponent } from '../../BaseComponent';
|
|
4
|
+
import type { AvatarInterface } from './Avatar';
|
|
5
|
+
import type { GlobalAttributes } from '../../../../types/globals';
|
|
6
|
+
|
|
7
|
+
export type AvatarGroupDescription = {
|
|
8
|
+
items: AvatarInterface[];
|
|
9
|
+
overlap: number;
|
|
10
|
+
max: number;
|
|
11
|
+
onMoreClick: ((count: number) => void) | null;
|
|
12
|
+
props: GlobalAttributes;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export interface AvatarGroupInterface extends BaseComponent {
|
|
16
|
+
items(items: AvatarInterface[]): this;
|
|
17
|
+
item(item: AvatarInterface): this;
|
|
18
|
+
overlap(value: number): this;
|
|
19
|
+
max(max: number): this;
|
|
20
|
+
onMoreClick(handler: (count: number) => void): this;
|
|
21
|
+
render(template: (description: AvatarGroupDescription, instance: AvatarGroupInterface) => ValidChild): this;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
export declare function AvatarGroup(props?: Record<string, unknown>): AvatarGroupInterface;
|
|
26
|
+
export declare namespace AvatarGroup {
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
function use(template: (description: AvatarGroupDescription, instance: AvatarGroupInterface) => ValidChild): void;
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
}
|
|
@@ -1,7 +1,25 @@
|
|
|
1
|
-
import BaseComponent from
|
|
2
|
-
import DebugManager from
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import BaseComponent from '../BaseComponent';
|
|
2
|
+
import DebugManager from '../../core/utils/debug-manager';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Small label for status, count, or category. Supports variants, shapes (rounded/pill/circle), and appearance (filled/outline/bordered).
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* const badge = new Badge(Span('New'))
|
|
10
|
+
* .variant('primary')
|
|
11
|
+
* .pill()
|
|
12
|
+
* .filled()
|
|
13
|
+
* .onClick((e) => console.log('clicked'));
|
|
14
|
+
*
|
|
15
|
+
* Badge.use((description, instance) => {
|
|
16
|
+
* return Span({ class: \`badge badge--\${description.variant}\` }, description.content);
|
|
17
|
+
* });
|
|
18
|
+
*
|
|
19
|
+
* @constructor
|
|
20
|
+
* @param {NdChild} content
|
|
21
|
+
* @param {GlobalAttributes} [props={}]
|
|
22
|
+
*/
|
|
5
23
|
export default function Badge(content, props = {}) {
|
|
6
24
|
if(!(this instanceof Badge)) {
|
|
7
25
|
return new Badge(content, props);
|
|
@@ -16,7 +34,7 @@ export default function Badge(content, props = {}) {
|
|
|
16
34
|
size: 'medium',
|
|
17
35
|
onClick: null,
|
|
18
36
|
content,
|
|
19
|
-
props
|
|
37
|
+
props,
|
|
20
38
|
};
|
|
21
39
|
}
|
|
22
40
|
|
|
@@ -24,10 +42,26 @@ BaseComponent.extends(Badge);
|
|
|
24
42
|
|
|
25
43
|
Badge.defaultTemplate = null;
|
|
26
44
|
|
|
45
|
+
/**
|
|
46
|
+
* Registers the render template for Badge.
|
|
47
|
+
* @param {(description: {
|
|
48
|
+
* appearance: 'filled'|'outline'|'bordered',
|
|
49
|
+
* borderRadiusType: 'pill'|'rounded'|'circle'|null,
|
|
50
|
+
* variant: string,
|
|
51
|
+
* size: 'small'|'medium'|'large'|string,
|
|
52
|
+
* onClick: ((event: MouseEvent) => void)|null,
|
|
53
|
+
* content: NdChild,
|
|
54
|
+
* props: GlobalAttributes,
|
|
55
|
+
* }, instance: Badge) => NdChild} template
|
|
56
|
+
*/
|
|
27
57
|
Badge.use = function(template) {
|
|
28
58
|
Badge.defaultTemplate = template;
|
|
29
59
|
};
|
|
30
60
|
|
|
61
|
+
/**
|
|
62
|
+
* @param {string} name
|
|
63
|
+
* @param {(b: Badge) => Badge} callback
|
|
64
|
+
*/
|
|
31
65
|
Badge.preset = function(name, callback) {
|
|
32
66
|
if (Badge.prototype[name] || Badge[name]) {
|
|
33
67
|
DebugManager.warn(`Warning: the ${name} method already exists in Badge.`);
|
|
@@ -36,89 +70,175 @@ Badge.preset = function(name, callback) {
|
|
|
36
70
|
Badge[name] = (content, props) => callback(new Badge(content, props));
|
|
37
71
|
};
|
|
38
72
|
|
|
73
|
+
/**
|
|
74
|
+
* @param {Record<string, (b: Badge) => Badge>} presets
|
|
75
|
+
*/
|
|
39
76
|
Badge.presets = function(presets) {
|
|
40
77
|
for (const name in presets) {
|
|
41
78
|
Badge.preset(name, presets[name]);
|
|
42
79
|
}
|
|
43
80
|
};
|
|
44
81
|
|
|
82
|
+
/**
|
|
83
|
+
* @param {string} variant
|
|
84
|
+
* @returns {this}
|
|
85
|
+
*/
|
|
45
86
|
Badge.prototype.variant = function(variant) {
|
|
46
87
|
this.$description.variant = variant;
|
|
47
88
|
return this;
|
|
48
89
|
};
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* @returns {this}
|
|
93
|
+
*/
|
|
49
94
|
Badge.prototype.primary = function() {
|
|
50
95
|
return this.variant('primary');
|
|
51
96
|
};
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* @returns {this}
|
|
100
|
+
*/
|
|
52
101
|
Badge.prototype.secondary = function() {
|
|
53
102
|
return this.variant('secondary');
|
|
54
103
|
};
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* @returns {this}
|
|
107
|
+
*/
|
|
55
108
|
Badge.prototype.success = function() {
|
|
56
109
|
return this.variant('success');
|
|
57
110
|
};
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* @returns {this}
|
|
114
|
+
*/
|
|
58
115
|
Badge.prototype.danger = function() {
|
|
59
116
|
return this.variant('danger');
|
|
60
117
|
};
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* @returns {this}
|
|
121
|
+
*/
|
|
61
122
|
Badge.prototype.warning = function() {
|
|
62
123
|
return this.variant('warning');
|
|
63
124
|
};
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* @returns {this}
|
|
128
|
+
*/
|
|
64
129
|
Badge.prototype.info = function() {
|
|
65
130
|
return this.variant('info');
|
|
66
131
|
};
|
|
67
132
|
|
|
133
|
+
/**
|
|
134
|
+
* @param {number} size
|
|
135
|
+
* @returns {this}
|
|
136
|
+
*/
|
|
68
137
|
Badge.prototype.size = function(size) {
|
|
69
138
|
this.$description.size = size;
|
|
70
139
|
return this;
|
|
71
140
|
};
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* @returns {this}
|
|
144
|
+
*/
|
|
72
145
|
Badge.prototype.small = function() {
|
|
73
146
|
return this.size('small');
|
|
74
147
|
};
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* @returns {this}
|
|
151
|
+
*/
|
|
75
152
|
Badge.prototype.medium = function() {
|
|
76
153
|
return this.size('medium');
|
|
77
154
|
};
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* @returns {this}
|
|
158
|
+
*/
|
|
78
159
|
Badge.prototype.large = function() {
|
|
79
160
|
return this.size('large');
|
|
80
161
|
};
|
|
81
162
|
|
|
163
|
+
/**
|
|
164
|
+
* @param {string} shape
|
|
165
|
+
* @returns {this}
|
|
166
|
+
*/
|
|
82
167
|
Badge.prototype.shape = function(shape) {
|
|
83
168
|
this.$description.borderRadiusType = shape;
|
|
84
169
|
return this;
|
|
85
170
|
};
|
|
86
171
|
|
|
172
|
+
/**
|
|
173
|
+
* @returns {this}
|
|
174
|
+
*/
|
|
87
175
|
Badge.prototype.rounded = function() {
|
|
88
176
|
this.$description.borderRadiusType = 'rounded';
|
|
89
177
|
return this;
|
|
90
178
|
};
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* @returns {this}
|
|
182
|
+
*/
|
|
91
183
|
Badge.prototype.pill = function() {
|
|
92
184
|
this.$description.borderRadiusType = 'pill';
|
|
93
185
|
return this;
|
|
94
186
|
};
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* @returns {this}
|
|
190
|
+
*/
|
|
95
191
|
Badge.prototype.circle = function() {
|
|
96
192
|
this.$description.borderRadiusType = 'circle';
|
|
97
193
|
return this;
|
|
98
194
|
};
|
|
99
195
|
|
|
196
|
+
/**
|
|
197
|
+
* @param {string} appearance
|
|
198
|
+
* @returns {this}
|
|
199
|
+
*/
|
|
100
200
|
Badge.prototype.appearance = function(appearance) {
|
|
101
201
|
this.$description.appearance = appearance;
|
|
102
202
|
return this;
|
|
103
203
|
};
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* @returns {this}
|
|
207
|
+
*/
|
|
104
208
|
Badge.prototype.outline = function() {
|
|
105
209
|
this.$description.appearance = 'outline';
|
|
106
210
|
return this;
|
|
107
211
|
};
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* @returns {this}
|
|
215
|
+
*/
|
|
108
216
|
Badge.prototype.filled = function() {
|
|
109
217
|
this.$description.appearance = 'filled';
|
|
110
218
|
return this;
|
|
111
219
|
};
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* @returns {this}
|
|
223
|
+
*/
|
|
112
224
|
Badge.prototype.bordered = function() {
|
|
113
225
|
this.$description.appearance = 'bordered';
|
|
114
226
|
return this;
|
|
115
227
|
};
|
|
116
228
|
|
|
229
|
+
/**
|
|
230
|
+
* @param {NdChild} content
|
|
231
|
+
* @returns {this}
|
|
232
|
+
*/
|
|
117
233
|
Badge.prototype.content = function(content) {
|
|
118
234
|
this.$description.content = content;
|
|
119
235
|
return this;
|
|
120
236
|
};
|
|
121
237
|
|
|
238
|
+
/**
|
|
239
|
+
* @param {Function} handler
|
|
240
|
+
* @returns {this}
|
|
241
|
+
*/
|
|
122
242
|
Badge.prototype.onClick = function(handler) {
|
|
123
243
|
this.$description.onClick = handler;
|
|
124
244
|
return this;
|
|
@@ -0,0 +1,51 @@
|
|
|
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 BadgeDescription = {
|
|
7
|
+
appearance: 'filled' | 'outline' | 'bordered';
|
|
8
|
+
borderRadiusType: 'pill' | 'rounded' | 'circle' | null;
|
|
9
|
+
variant: string;
|
|
10
|
+
size: 'small' | 'medium' | 'large' | string;
|
|
11
|
+
onClick: ((event: MouseEvent) => void) | null;
|
|
12
|
+
content: ValidChild;
|
|
13
|
+
props: GlobalAttributes;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export interface BadgeInterface extends BaseComponent {
|
|
17
|
+
variant(variant: string): this;
|
|
18
|
+
primary(): this;
|
|
19
|
+
secondary(): this;
|
|
20
|
+
success(): this;
|
|
21
|
+
danger(): this;
|
|
22
|
+
warning(): this;
|
|
23
|
+
info(): this;
|
|
24
|
+
size(size: 'small' | 'medium' | 'large' | string): this;
|
|
25
|
+
small(): this;
|
|
26
|
+
medium(): this;
|
|
27
|
+
large(): this;
|
|
28
|
+
shape(shape: 'rounded' | 'pill' | 'circle'): this;
|
|
29
|
+
rounded(): this;
|
|
30
|
+
pill(): this;
|
|
31
|
+
circle(): this;
|
|
32
|
+
appearance(appearance: 'filled' | 'outline' | 'bordered'): this;
|
|
33
|
+
outline(): this;
|
|
34
|
+
filled(): this;
|
|
35
|
+
bordered(): this;
|
|
36
|
+
content(content: ValidChild): this;
|
|
37
|
+
onClick(handler: (event: MouseEvent) => void): this;
|
|
38
|
+
render(template: (description: BadgeDescription, instance: BadgeInterface) => ValidChild): this;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
export declare function Badge(content: ValidChild, props?: Record<string, unknown>): BadgeInterface;
|
|
43
|
+
export declare namespace Badge {
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
function use(template: (description: BadgeDescription, instance: BadgeInterface) => ValidChild): void;
|
|
47
|
+
function preset(name: string, callback: (instance: BadgeInterface) => BadgeInterface): void;
|
|
48
|
+
function presets(presets: Record<string, (instance: BadgeInterface) => BadgeInterface>): void;
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
}
|