native-document 1.0.165 → 1.0.168
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/.vitepress/config.js +166 -0
- package/CHANGELOG.md +153 -0
- package/components.d.ts +2 -0
- package/components.js +2 -1
- package/devtools/widget.js +1 -1
- package/dist/native-document.components.min.js +11589 -2983
- package/dist/native-document.dev.js +2280 -396
- package/dist/native-document.dev.js.map +1 -1
- package/dist/native-document.min.js +1 -1
- package/docs/advanced-components.md +213 -608
- package/docs/anchor.md +173 -312
- package/docs/cache.md +95 -803
- package/docs/cli.md +179 -0
- package/docs/components/accordion.md +172 -0
- package/docs/components/alert.md +99 -0
- package/docs/components/avatar.md +160 -0
- package/docs/components/badge.md +102 -0
- package/docs/components/breadcrumb.md +89 -0
- package/docs/components/button.md +183 -0
- package/docs/components/card.md +69 -0
- package/docs/components/context-menu.md +118 -0
- package/docs/components/data-table.md +345 -0
- package/docs/components/dropdown.md +214 -0
- package/docs/components/form/autocomplete-field.md +81 -0
- package/docs/components/form/checkbox-field.md +41 -0
- package/docs/components/form/checkbox-group-field.md +54 -0
- package/docs/components/form/color-field.md +64 -0
- package/docs/components/form/date-field.md +92 -0
- package/docs/components/form/field-collection.md +63 -0
- package/docs/components/form/file-field.md +203 -0
- package/docs/components/form/form-control.md +87 -0
- package/docs/components/form/image-field.md +90 -0
- package/docs/components/form/index.md +115 -0
- package/docs/components/form/number-field.md +65 -0
- package/docs/components/form/radio-field.md +51 -0
- package/docs/components/form/select-field.md +123 -0
- package/docs/components/form/slider.md +136 -0
- package/docs/components/form/string-field.md +134 -0
- package/docs/components/form/textarea-field.md +65 -0
- package/docs/components/form-fields.md +372 -0
- package/docs/components/getting-started.md +264 -0
- package/docs/components/index.md +337 -0
- package/docs/components/layout.md +279 -0
- package/docs/components/list.md +73 -0
- package/docs/components/menu.md +215 -0
- package/docs/components/modal.md +156 -0
- package/docs/components/pagination.md +95 -0
- package/docs/components/popover.md +131 -0
- package/docs/components/progress.md +111 -0
- package/docs/components/shortcut-manager.md +221 -0
- package/docs/components/simple-table.md +107 -0
- package/docs/components/skeleton.md +155 -0
- package/docs/components/spinner.md +100 -0
- package/docs/components/splitter.md +133 -0
- package/docs/components/stepper.md +163 -0
- package/docs/components/switch.md +113 -0
- package/docs/components/tabs.md +153 -0
- package/docs/components/toast.md +119 -0
- package/docs/components/tooltip.md +151 -0
- package/docs/components/traits.md +261 -0
- package/docs/conditional-rendering.md +170 -588
- package/docs/contributing.md +300 -25
- package/docs/core-concepts.md +205 -374
- package/docs/elements.md +251 -367
- package/docs/extending-native-document-element.md +192 -207
- package/docs/filters.md +153 -1122
- package/docs/getting-started.md +193 -267
- package/docs/i18n.md +241 -0
- package/docs/index.md +76 -0
- package/docs/lifecycle-events.md +143 -75
- package/docs/list-rendering.md +227 -852
- package/docs/memory-management.md +134 -47
- package/docs/native-document-element.md +337 -186
- package/docs/native-fetch.md +99 -630
- package/docs/observable-resource.md +364 -0
- package/docs/observables.md +592 -526
- package/docs/routing.md +244 -653
- package/docs/state-management.md +134 -241
- package/docs/svg-elements.md +231 -0
- package/docs/theming.md +409 -0
- package/docs/validation.md +95 -97
- package/docs/vitepress-conventions.md +219 -0
- package/eslint.config.js +28 -33
- package/i18n.js +1 -1
- package/i18n.ts +2 -0
- package/index.js +3 -0
- package/package.json +36 -14
- package/readme.md +269 -89
- 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 +204 -32
- package/src/components/card/index.js +4 -4
- 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/HasListItem.js +171 -0
- package/src/components/list/List.js +85 -67
- package/src/components/list/ListDivider.js +39 -0
- package/src/components/list/ListGroup.js +105 -38
- package/src/components/list/ListItem.js +158 -49
- package/src/components/list/index.js +8 -6
- 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 +53 -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 +12 -3
- 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 +118 -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 +35 -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/card/CardRender.js +133 -0
- package/src/ui/components/card/card.css +169 -0
- package/src/ui/components/contextmenu/ContextmenuRender.js +6 -6
- 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/list/ListRender.js +18 -0
- package/src/ui/components/list/divider/ListDividerRender.js +10 -0
- package/src/ui/components/list/divider/list-divider.css +12 -0
- package/src/ui/components/list/group/ListGroupRender.js +61 -0
- package/src/ui/components/list/group/list-group.css +62 -0
- package/src/ui/components/list/item/ListItemRender.js +238 -0
- package/src/ui/components/list/item/list-item.css +191 -0
- package/src/ui/components/list/list.css +24 -0
- 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/spacer/SpacerRender.js +10 -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 +44 -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/SkeletonList.js +0 -0
- package/src/components/skeleton/SkeletonParagraph.js +0 -0
- package/src/components/skeleton/SkeletonTable.js +0 -0
- /package/{src/components/skeleton/SkeletonCard.js → docs/tutorials/.gitkeep} +0 -0
package/docs/cli.md
ADDED
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: CLI
|
|
3
|
+
description: The official NativeDocument CLI for scaffolding projects, pages, components, and services
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# CLI
|
|
7
|
+
|
|
8
|
+
The official NativeDocument CLI scaffolds projects, pages, components, and services so you can focus on building.
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install -g @native-document/cli
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Verify:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
nd --help
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
> Source: [github.com/afrocodeur/native-document-cli](https://github.com/afrocodeur/native-document-cli)
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## `nd create` - New Project
|
|
27
|
+
|
|
28
|
+
### Default structure
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
nd create MyApp
|
|
32
|
+
cd MyApp
|
|
33
|
+
npm install
|
|
34
|
+
npm start
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Feature-based structure
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
nd create MyApp --feature
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Use `--feature` when you want to organize code by domain feature rather than by file type.
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Project Structures
|
|
48
|
+
|
|
49
|
+
### Default
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
src/
|
|
53
|
+
├── main.js
|
|
54
|
+
├── index.css
|
|
55
|
+
├── core/
|
|
56
|
+
│ ├── lang/
|
|
57
|
+
│ │ ├── lang.js
|
|
58
|
+
│ │ └── locales/
|
|
59
|
+
│ │ ├── en.json
|
|
60
|
+
│ │ └── fr.json
|
|
61
|
+
│ ├── middlewares/
|
|
62
|
+
│ └── services/
|
|
63
|
+
├── routes/
|
|
64
|
+
│ ├── routes.js
|
|
65
|
+
│ └── layouts/
|
|
66
|
+
│ └── DefaultLayout/
|
|
67
|
+
├── components/
|
|
68
|
+
├── pages/
|
|
69
|
+
│ ├── home/
|
|
70
|
+
│ │ ├── HomePage.js
|
|
71
|
+
│ │ └── home.css
|
|
72
|
+
│ └── not-found/
|
|
73
|
+
│ ├── NotFoundPage.js
|
|
74
|
+
│ └── not-found.css
|
|
75
|
+
└── services/
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Feature-based (`--feature`)
|
|
79
|
+
|
|
80
|
+
Same root structure, plus a `src/features/` folder. Each feature is self-contained:
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
src/features/auth/
|
|
84
|
+
├── components/
|
|
85
|
+
├── services/
|
|
86
|
+
│ └── AuthService/
|
|
87
|
+
│ └── AuthService.js
|
|
88
|
+
├── utils/
|
|
89
|
+
└── index.js # public API - import from here
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Import from a feature via its public API:
|
|
93
|
+
|
|
94
|
+
```javascript
|
|
95
|
+
import { AuthService } from '@/features/auth';
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## Generator Commands
|
|
101
|
+
|
|
102
|
+
### `nd create:page`
|
|
103
|
+
|
|
104
|
+
Scaffold a new page:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
nd create:page dashboard
|
|
108
|
+
nd create:page user/profile # nested page
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Generates a page folder with component and CSS file inside `src/pages/`.
|
|
112
|
+
|
|
113
|
+
### `nd create:component`
|
|
114
|
+
|
|
115
|
+
Scaffold a reusable component:
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
nd create:component UserCard
|
|
119
|
+
nd create:component ui/Button # nested component
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Generates a component folder inside `src/components/`.
|
|
123
|
+
|
|
124
|
+
### `nd create:service`
|
|
125
|
+
|
|
126
|
+
Scaffold a service (business logic + observables):
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
nd create:service AuthService
|
|
130
|
+
nd create:service api/UserService
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Generates a service folder inside `src/services/`.
|
|
134
|
+
|
|
135
|
+
### `nd create:feature` (feature mode only)
|
|
136
|
+
|
|
137
|
+
Scaffold a complete feature module:
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
nd create:feature auth
|
|
141
|
+
nd create:feature cart
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Generates a feature folder inside `src/features/` with its own components, services, and `index.js`.
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## Available Scripts
|
|
149
|
+
|
|
150
|
+
After creating a project:
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
npm start # start development server (Vite)
|
|
154
|
+
npm run build # build for production
|
|
155
|
+
npm run preview # preview the production build
|
|
156
|
+
npm run lint # run ESLint
|
|
157
|
+
npm run i18n:scan # scan for missing translation keys
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
## Aliases
|
|
163
|
+
|
|
164
|
+
The `@` alias points to `src/` and is pre-configured in Vite:
|
|
165
|
+
|
|
166
|
+
```javascript
|
|
167
|
+
import { AuthService } from '@/services/AuthService';
|
|
168
|
+
import { UserCard } from '@/components/UserCard';
|
|
169
|
+
import { AuthService } from '@/features/auth'; // feature mode
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
## Next Steps
|
|
175
|
+
|
|
176
|
+
- **[Getting Started](./getting-started.md)** - First steps after `nd create`
|
|
177
|
+
- **[Routing](./routing.md)** - Define routes in `src/routes/routes.js`
|
|
178
|
+
- **[State Management](./state-management.md)** - Organize state with Store groups
|
|
179
|
+
- **[i18n & Formatting](./i18n.md)** - Set up translations and locale formatting
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Accordion
|
|
3
|
+
description: Headless Accordion component with multiple expand, variants, and item management
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Accordion
|
|
7
|
+
|
|
8
|
+
```javascript
|
|
9
|
+
import { Accordion, AccordionItem } from 'native-document/components';
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
```javascript
|
|
13
|
+
Accordion(props?)
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## Default Renderers
|
|
18
|
+
|
|
19
|
+
```javascript
|
|
20
|
+
import { AccordionRender, AccordionItemRender } from 'native-document/ui';
|
|
21
|
+
|
|
22
|
+
Accordion.use(AccordionRender);
|
|
23
|
+
AccordionItem.use(AccordionItemRender);
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## `$description`
|
|
29
|
+
|
|
30
|
+
```javascript
|
|
31
|
+
{
|
|
32
|
+
items: [], // AccordionItem[]
|
|
33
|
+
multiple: null, // boolean - allow multiple open at once
|
|
34
|
+
variant: null, // string
|
|
35
|
+
renderContent: null, // (item) => element - custom content renderer
|
|
36
|
+
renderIndicator: null, // (item) => element - custom indicator renderer
|
|
37
|
+
props: {} // HTML attributes for the root element
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Methods
|
|
42
|
+
|
|
43
|
+
### Adding items
|
|
44
|
+
|
|
45
|
+
```javascript
|
|
46
|
+
// Add by title + content
|
|
47
|
+
Accordion()
|
|
48
|
+
.item('Section 1', Div('Content 1'))
|
|
49
|
+
.item('Section 2', Div('Content 2'), { expanded: true, disabled: false })
|
|
50
|
+
|
|
51
|
+
// Add AccordionItem instance
|
|
52
|
+
Accordion()
|
|
53
|
+
.item(
|
|
54
|
+
AccordionItem()
|
|
55
|
+
.title('Section')
|
|
56
|
+
.content(Div('Content'))
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
// Add multiple at once
|
|
60
|
+
Accordion()
|
|
61
|
+
.items([
|
|
62
|
+
{ title: 'A', content: Div('Content A') },
|
|
63
|
+
{ title: 'B', content: Div('Content B') }
|
|
64
|
+
])
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Behavior
|
|
68
|
+
|
|
69
|
+
```javascript
|
|
70
|
+
.multiple() // allow multiple panels open at once
|
|
71
|
+
.multiple(false) // only one panel at a time (default)
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Variants
|
|
75
|
+
|
|
76
|
+
```javascript
|
|
77
|
+
.bordered() // adds borders
|
|
78
|
+
.separated() // space between items
|
|
79
|
+
.flush() // no borders, no padding
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Expand / Collapse
|
|
83
|
+
|
|
84
|
+
```javascript
|
|
85
|
+
.expanded(key, true) // expand item by key
|
|
86
|
+
.expanded(key, false) // collapse item by key
|
|
87
|
+
.expandAll()
|
|
88
|
+
.collapseAll()
|
|
89
|
+
.isExpanded(key) // returns boolean
|
|
90
|
+
.getByKey(key) // returns AccordionItem
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Remove items
|
|
94
|
+
|
|
95
|
+
```javascript
|
|
96
|
+
.removeItemById(id)
|
|
97
|
+
.remove(item => item.id === 'my-id') // filter function
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Events
|
|
101
|
+
|
|
102
|
+
```javascript
|
|
103
|
+
Accordion()
|
|
104
|
+
.onExpand((item) => console.log('Expanded:', item.title))
|
|
105
|
+
.onCollapse((item) => console.log('Collapsed:', item.title))
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Custom renderers
|
|
109
|
+
|
|
110
|
+
```javascript
|
|
111
|
+
.renderContent(($item) => Div({ class: 'custom-body' }, $item.content))
|
|
112
|
+
.renderIndicator(($item) => $item.expanded.transform(e => e ? '-' : '+'))
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## `AccordionItem`
|
|
116
|
+
|
|
117
|
+
```javascript
|
|
118
|
+
AccordionItem()
|
|
119
|
+
.identifyBy('item-1')
|
|
120
|
+
.title('Section Title')
|
|
121
|
+
.content(Div('Content'))
|
|
122
|
+
.icon(InfoIcon)
|
|
123
|
+
.expanded()
|
|
124
|
+
.collapsible()
|
|
125
|
+
.disabled()
|
|
126
|
+
.showIndicator()
|
|
127
|
+
.renderHeader(($item) => Div({ class: 'header' }, $item.title))
|
|
128
|
+
.renderContent(($item) => Div({ class: 'body' }, $item.content))
|
|
129
|
+
.renderIndicator(($item) => $item.expanded.transform(e => e ? '-' : '+'))
|
|
130
|
+
.onExpand(() => console.log('Expanded'))
|
|
131
|
+
.onCollapse(() => console.log('Collapsed'))
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## Example
|
|
135
|
+
|
|
136
|
+
```javascript
|
|
137
|
+
const faq = Accordion()
|
|
138
|
+
.bordered()
|
|
139
|
+
.item('What is NativeDocument?',
|
|
140
|
+
P('A reactive JavaScript framework without Virtual DOM.')
|
|
141
|
+
)
|
|
142
|
+
.item('How do I install it?',
|
|
143
|
+
Div([
|
|
144
|
+
P('Use the CLI:'),
|
|
145
|
+
Pre('nd create my-app')
|
|
146
|
+
]),
|
|
147
|
+
{ expanded: true }
|
|
148
|
+
)
|
|
149
|
+
.item('Is it free?', P('Yes, MIT licensed.'))
|
|
150
|
+
.onExpand(item => trackFAQ(item.id))
|
|
151
|
+
|
|
152
|
+
document.body.appendChild(faq)
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
## Theming
|
|
158
|
+
|
|
159
|
+
```css
|
|
160
|
+
:root {
|
|
161
|
+
--accordion-border: var(--gray-lite-3);
|
|
162
|
+
--accordion-radius: var(--radius-card);
|
|
163
|
+
--accordion-font-size: var(--description-size);
|
|
164
|
+
--accordion-header-padding: var(--space-comfortable);
|
|
165
|
+
--accordion-content-padding: var(--space-comfortable);
|
|
166
|
+
--accordion-header-color: var(--text-color);
|
|
167
|
+
--accordion-header-color-hover: var(--text-color);
|
|
168
|
+
--accordion-header-bg-hover: var(--gray-lite-5);
|
|
169
|
+
--accordion-indicator-color: var(--gray);
|
|
170
|
+
--accordion-transition: 0.2s ease;
|
|
171
|
+
}
|
|
172
|
+
```
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Alert
|
|
3
|
+
description: Contextual message component with title, icon, actions, and auto-dismiss
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Alert
|
|
7
|
+
|
|
8
|
+
```javascript
|
|
9
|
+
import { Alert } from 'native-document/components';
|
|
10
|
+
|
|
11
|
+
Alert(content, props?)
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Displays a contextual message with optional title, icon, and actions.
|
|
15
|
+
|
|
16
|
+
## Default Renderer
|
|
17
|
+
|
|
18
|
+
```javascript
|
|
19
|
+
import { AlertRender } from 'native-document/ui';
|
|
20
|
+
import { ButtonRender } from 'native-document/ui';
|
|
21
|
+
|
|
22
|
+
Alert.use(AlertRender);
|
|
23
|
+
Button.use(ButtonRender); // required - actions are rendered as buttons
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Methods
|
|
27
|
+
|
|
28
|
+
```javascript
|
|
29
|
+
// Type
|
|
30
|
+
.info()
|
|
31
|
+
.success()
|
|
32
|
+
.warning()
|
|
33
|
+
.error()
|
|
34
|
+
.danger()
|
|
35
|
+
|
|
36
|
+
// Appearance
|
|
37
|
+
.filled()
|
|
38
|
+
.bordered()
|
|
39
|
+
.outline()
|
|
40
|
+
|
|
41
|
+
// Content
|
|
42
|
+
.title('Alert title')
|
|
43
|
+
.content(Div('Updated content'))
|
|
44
|
+
.icon(InfoIcon)
|
|
45
|
+
.showIcon()
|
|
46
|
+
.closable()
|
|
47
|
+
.dismissible()
|
|
48
|
+
.autoDismiss(3000)
|
|
49
|
+
|
|
50
|
+
// Actions
|
|
51
|
+
.action('Undo', () => undo())
|
|
52
|
+
.action('Retry', retryFn)
|
|
53
|
+
.clearActions()
|
|
54
|
+
|
|
55
|
+
// Events
|
|
56
|
+
.onClose(() => console.log('Closed'))
|
|
57
|
+
.onShow(() => console.log('Shown'))
|
|
58
|
+
|
|
59
|
+
// Programmatic
|
|
60
|
+
.close()
|
|
61
|
+
.show()
|
|
62
|
+
|
|
63
|
+
// Custom renderers
|
|
64
|
+
.renderTitle(($description) => Strong($description.title))
|
|
65
|
+
.renderContent(($description) => P($description.content))
|
|
66
|
+
.renderFooter(($description) => Div($description.actions))
|
|
67
|
+
.layout(($description) => Div([$description.title, $description.content, $description.footer]))
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Example
|
|
71
|
+
|
|
72
|
+
```javascript
|
|
73
|
+
Alert('Your changes have been saved successfully.')
|
|
74
|
+
.success()
|
|
75
|
+
.filled()
|
|
76
|
+
.title('Saved!')
|
|
77
|
+
.icon(CheckIcon)
|
|
78
|
+
.action('Undo', () => undo())
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## Theming
|
|
84
|
+
|
|
85
|
+
```css
|
|
86
|
+
:root {
|
|
87
|
+
--alert-padding: var(--space-comfortable);
|
|
88
|
+
--alert-radius: var(--radius-card);
|
|
89
|
+
--alert-gap: var(--space-cozy);
|
|
90
|
+
--alert-font-size: var(--description-size);
|
|
91
|
+
--alert-title-size: var(--text-size);
|
|
92
|
+
--alert-title-weight: 600;
|
|
93
|
+
--alert-border-width: 1px;
|
|
94
|
+
--alert-color-info: var(--color-info);
|
|
95
|
+
--alert-color-success: var(--color-success);
|
|
96
|
+
--alert-color-warning: var(--color-warning);
|
|
97
|
+
--alert-color-danger: var(--color-danger);
|
|
98
|
+
}
|
|
99
|
+
```
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Avatar
|
|
3
|
+
description: Avatar and AvatarGroup components for displaying user profile pictures, initials, or icons
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Avatar
|
|
7
|
+
|
|
8
|
+
```javascript
|
|
9
|
+
import { Avatar, AvatarGroup } from 'native-document/components';
|
|
10
|
+
|
|
11
|
+
Avatar(source?, props?)
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Default Renderer
|
|
15
|
+
|
|
16
|
+
```javascript
|
|
17
|
+
import { AvatarRender, AvatarGroupRender } from 'native-document/ui';
|
|
18
|
+
|
|
19
|
+
Avatar.use(AvatarRender);
|
|
20
|
+
AvatarGroup.use(AvatarGroupRender);
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## `$description`
|
|
24
|
+
|
|
25
|
+
```javascript
|
|
26
|
+
{
|
|
27
|
+
src: null, // string | Observable<string>
|
|
28
|
+
alt: null,
|
|
29
|
+
name: null, // full name - initials auto-generated
|
|
30
|
+
initials: null, // explicit initials override
|
|
31
|
+
icon: null, // DOM element fallback
|
|
32
|
+
size: 'medium', // 'xs' | 'small' | 'medium' | 'large' | 'xl'
|
|
33
|
+
shape: 'circle', // 'circle' | 'square' | 'rounded'
|
|
34
|
+
variant: null, // background color variant
|
|
35
|
+
color: null, // custom background color
|
|
36
|
+
textColor: null,
|
|
37
|
+
status: null, // 'online' | 'offline' | 'busy' | 'away'
|
|
38
|
+
props: {} // HTML attributes for the root element
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Methods
|
|
43
|
+
|
|
44
|
+
```javascript
|
|
45
|
+
// Source
|
|
46
|
+
.src('/images/alice.jpg')
|
|
47
|
+
.src(Observable('/api/user/avatar')) // reactive
|
|
48
|
+
.alt('Alice Johnson')
|
|
49
|
+
|
|
50
|
+
// Name & initials
|
|
51
|
+
.name('Alice Johnson') // auto-generates initials 'AJ'
|
|
52
|
+
.initials('AJ') // explicit initials
|
|
53
|
+
|
|
54
|
+
// Fallback when no src
|
|
55
|
+
.icon(UserIcon)
|
|
56
|
+
|
|
57
|
+
// Size
|
|
58
|
+
.extraSmall()
|
|
59
|
+
.small()
|
|
60
|
+
.medium()
|
|
61
|
+
.large()
|
|
62
|
+
.extraLarge()
|
|
63
|
+
|
|
64
|
+
// Shape
|
|
65
|
+
.circle()
|
|
66
|
+
.square()
|
|
67
|
+
.rounded()
|
|
68
|
+
|
|
69
|
+
// Color (for initials/icon fallback)
|
|
70
|
+
.primary()
|
|
71
|
+
.success()
|
|
72
|
+
.danger()
|
|
73
|
+
.warning()
|
|
74
|
+
.info()
|
|
75
|
+
.color('#6366f1')
|
|
76
|
+
.textColor('#fff')
|
|
77
|
+
|
|
78
|
+
// Status indicator
|
|
79
|
+
.status('online') // green dot
|
|
80
|
+
.status('offline') // gray dot
|
|
81
|
+
.status('busy') // red dot
|
|
82
|
+
.status('away') // yellow dot
|
|
83
|
+
.statusAtTopLeading()
|
|
84
|
+
.statusAtBottomLeading()
|
|
85
|
+
.statusAtTopTrailing()
|
|
86
|
+
.statusAtBottomTrailing()
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Example
|
|
90
|
+
|
|
91
|
+
```javascript
|
|
92
|
+
Avatar(user.avatar)
|
|
93
|
+
.name(user.name)
|
|
94
|
+
.status(user.status)
|
|
95
|
+
.large()
|
|
96
|
+
|
|
97
|
+
// With initials fallback
|
|
98
|
+
Avatar()
|
|
99
|
+
.name('Alice Johnson')
|
|
100
|
+
.primary()
|
|
101
|
+
.circle()
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## `AvatarGroup`
|
|
107
|
+
|
|
108
|
+
```javascript
|
|
109
|
+
AvatarGroup(props?)
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Displays a stack of overlapping avatars.
|
|
113
|
+
|
|
114
|
+
### Methods
|
|
115
|
+
|
|
116
|
+
```javascript
|
|
117
|
+
.item(avatar) // add an Avatar instance
|
|
118
|
+
.items([avatar1, avatar2]) // add multiple
|
|
119
|
+
.max(5) // show max N avatars, then "+N more"
|
|
120
|
+
.overlap(12) // overlap in px
|
|
121
|
+
.onMoreClick((count) => showAll()) // callback when "+N" is clicked
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Example
|
|
125
|
+
|
|
126
|
+
```javascript
|
|
127
|
+
AvatarGroup()
|
|
128
|
+
.item(Avatar(user1.avatar).name(user1.name))
|
|
129
|
+
.item(Avatar(user2.avatar).name(user2.name))
|
|
130
|
+
.item(Avatar(user3.avatar).name(user3.name))
|
|
131
|
+
.max(5)
|
|
132
|
+
.overlap(12)
|
|
133
|
+
.onMoreClick((count) => showAllMembers())
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
## Theming
|
|
139
|
+
|
|
140
|
+
```css
|
|
141
|
+
:root {
|
|
142
|
+
--avatar-size-extra-small: 24px;
|
|
143
|
+
--avatar-size-small: 32px;
|
|
144
|
+
--avatar-size-medium: 40px;
|
|
145
|
+
--avatar-size-large: 56px;
|
|
146
|
+
--avatar-size-extra-large: 72px;
|
|
147
|
+
--avatar-status-size: 10px;
|
|
148
|
+
--avatar-status-offset: 1px;
|
|
149
|
+
--avatar-color-primary: var(--color-primary);
|
|
150
|
+
--avatar-color-secondary: var(--color-secondary);
|
|
151
|
+
--avatar-color-success: var(--color-success);
|
|
152
|
+
--avatar-color-danger: var(--color-danger);
|
|
153
|
+
--avatar-color-warning: var(--color-warning);
|
|
154
|
+
--avatar-color-info: var(--color-info);
|
|
155
|
+
/* AvatarGroup */
|
|
156
|
+
--avatar-group-overlap: -15px;
|
|
157
|
+
--avatar-group-more-text-color: var(--white);
|
|
158
|
+
--avatar-group-more-background-color: var(--gray-lite-4);
|
|
159
|
+
}
|
|
160
|
+
```
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Badge
|
|
3
|
+
description: Small inline label for status, count, or category
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Badge
|
|
7
|
+
|
|
8
|
+
```javascript
|
|
9
|
+
import { Badge } from 'native-document/components';
|
|
10
|
+
|
|
11
|
+
Badge(content, props?)
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
A small inline label for status, count, or category.
|
|
15
|
+
|
|
16
|
+
## Default Renderer
|
|
17
|
+
|
|
18
|
+
```javascript
|
|
19
|
+
import { BadgeRender } from 'native-document/ui';
|
|
20
|
+
|
|
21
|
+
Badge.use(BadgeRender);
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## `$description`
|
|
25
|
+
|
|
26
|
+
```javascript
|
|
27
|
+
{
|
|
28
|
+
appearance: 'filled', // 'filled' | 'outlined' | 'ghost'
|
|
29
|
+
borderRadiusType: 'pill',
|
|
30
|
+
variant: 'primary',
|
|
31
|
+
size: 'medium',
|
|
32
|
+
content: null,
|
|
33
|
+
icon: null,
|
|
34
|
+
iconPosition: 'leading',
|
|
35
|
+
props: {} // HTML attributes for the root element
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Methods
|
|
40
|
+
|
|
41
|
+
```javascript
|
|
42
|
+
// Variants
|
|
43
|
+
.primary()
|
|
44
|
+
.secondary()
|
|
45
|
+
.success()
|
|
46
|
+
.danger()
|
|
47
|
+
.warning()
|
|
48
|
+
.info()
|
|
49
|
+
|
|
50
|
+
// Appearance
|
|
51
|
+
.filled()
|
|
52
|
+
.outlined()
|
|
53
|
+
.ghost()
|
|
54
|
+
|
|
55
|
+
// Size
|
|
56
|
+
.small()
|
|
57
|
+
.medium()
|
|
58
|
+
.large()
|
|
59
|
+
|
|
60
|
+
// Shape
|
|
61
|
+
.rounded()
|
|
62
|
+
.pill()
|
|
63
|
+
.circle()
|
|
64
|
+
|
|
65
|
+
// Icon
|
|
66
|
+
.icon(element, position?)
|
|
67
|
+
|
|
68
|
+
// Event
|
|
69
|
+
.onClick(handler)
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Example
|
|
73
|
+
|
|
74
|
+
```javascript
|
|
75
|
+
Badge('New').primary().pill()
|
|
76
|
+
Badge(count).danger()
|
|
77
|
+
Badge('Beta').outlined().warning()
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## Theming
|
|
83
|
+
|
|
84
|
+
```css
|
|
85
|
+
:root {
|
|
86
|
+
--badge-height-small: 18px;
|
|
87
|
+
--badge-height-medium: 22px;
|
|
88
|
+
--badge-height-large: 28px;
|
|
89
|
+
--badge-padding-small: 0 var(--space-cozy);
|
|
90
|
+
--badge-padding-medium: 0 var(--space-cozy-comfortable);
|
|
91
|
+
--badge-padding-large: 0 var(--space-comfortable);
|
|
92
|
+
--badge-font-size-small: var(--diablo-size);
|
|
93
|
+
--badge-font-size-medium: var(--note-size);
|
|
94
|
+
--badge-font-size-large: var(--description-size);
|
|
95
|
+
--badge-color-primary: var(--color-primary);
|
|
96
|
+
--badge-color-secondary: var(--color-secondary);
|
|
97
|
+
--badge-color-success: var(--color-success);
|
|
98
|
+
--badge-color-danger: var(--color-danger);
|
|
99
|
+
--badge-color-warning: var(--color-warning);
|
|
100
|
+
--badge-color-info: var(--color-info);
|
|
101
|
+
}
|
|
102
|
+
```
|