@iyulab/components 0.4.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +44 -0
- package/README.md +42 -236
- package/dist/_virtual/_@oxc-project_runtime@0.122.0/helpers/decorate.js +9 -0
- package/dist/_virtual/_@oxc-project_runtime@0.122.0/helpers/decorateMetadata.js +6 -0
- package/dist/_virtual/_glob-assets_raw/bell-fill.svg.d37c41d9.js +4 -0
- package/dist/_virtual/_glob-assets_raw/check-circle-fill.svg.51c33a2a.js +4 -0
- package/dist/_virtual/_glob-assets_raw/check-lg.svg.371c5e78.js +4 -0
- package/dist/_virtual/_glob-assets_raw/chevron-down.svg.0ccd06ea.js +4 -0
- package/dist/_virtual/_glob-assets_raw/chevron-left.svg.b4601050.js +4 -0
- package/dist/_virtual/_glob-assets_raw/chevron-right.svg.0711bb67.js +4 -0
- package/dist/_virtual/_glob-assets_raw/chevron-up.svg.ed917211.js +4 -0
- package/dist/_virtual/_glob-assets_raw/dark.css.e8ac080d.js +4 -0
- package/dist/_virtual/_glob-assets_raw/dash-lg.svg.b40b8b3a.js +4 -0
- package/dist/_virtual/_glob-assets_raw/exclamation-circle-fill.svg.dc8c523e.js +4 -0
- package/dist/_virtual/_glob-assets_raw/exclamation-triangle-fill.svg.7949d2c7.js +4 -0
- package/dist/_virtual/_glob-assets_raw/eye-slash.svg.240afafa.js +4 -0
- package/dist/_virtual/_glob-assets_raw/eye.svg.2e5e9c4c.js +4 -0
- package/dist/_virtual/_glob-assets_raw/info-circle-fill.svg.6580071d.js +4 -0
- package/dist/_virtual/_glob-assets_raw/light.css.637cb2f8.js +4 -0
- package/dist/_virtual/_glob-assets_raw/plus-lg.svg.294e9073.js +4 -0
- package/dist/_virtual/_glob-assets_raw/search.svg.0ba2012d.js +4 -0
- package/dist/_virtual/_glob-assets_raw/star-fill.svg.f24b5a2d.js +4 -0
- package/dist/_virtual/_glob-assets_raw/star.svg.4af61468.js +4 -0
- package/dist/_virtual/_glob-assets_raw/three-dots-vertical.svg.9fee78c5.js +4 -0
- package/dist/_virtual/_glob-assets_raw/three-dots.svg.6a7a5b23.js +4 -0
- package/dist/_virtual/_glob-assets_raw/x-lg.svg.f34b882c.js +4 -0
- package/dist/components/{UJsonElement.d.ts → UDataElement.d.ts} +3 -5
- package/dist/components/UDataElement.js +101 -0
- package/dist/components/{UJsonElement.styles.js → UDataElement.styles.js} +4 -4
- package/dist/components/UElement.d.ts +18 -23
- package/dist/components/UElement.js +82 -95
- package/dist/components/UElement.styles.js +43 -4
- package/dist/components/UFloatingElement.d.ts +69 -48
- package/dist/components/UFloatingElement.js +236 -193
- package/dist/components/UFloatingElement.styles.d.ts +8 -0
- package/dist/components/UFloatingElement.styles.js +28 -5
- package/dist/components/UFormControlElement.d.ts +57 -0
- package/dist/components/UFormControlElement.js +68 -0
- package/dist/components/UFormControlElement.styles.js +14 -0
- package/dist/components/UOverlayElement.d.ts +66 -0
- package/dist/components/UOverlayElement.js +123 -0
- package/dist/components/UOverlayElement.styles.d.ts +1 -0
- package/dist/components/UOverlayElement.styles.js +35 -0
- package/dist/components/alert/UAlert.d.ts +58 -3
- package/dist/components/alert/UAlert.js +115 -4
- package/dist/components/alert/UAlert.styles.js +73 -48
- package/dist/components/avatar/UAvatar.d.ts +27 -0
- package/dist/components/avatar/UAvatar.js +42 -0
- package/dist/components/avatar/UAvatar.styles.d.ts +1 -0
- package/dist/components/avatar/UAvatar.styles.js +45 -0
- package/dist/components/badge/UBadge.d.ts +28 -0
- package/dist/components/badge/UBadge.js +40 -0
- package/dist/components/badge/UBadge.styles.d.ts +1 -0
- package/dist/components/badge/UBadge.styles.js +113 -0
- package/dist/components/breadcrumb/UBreadcrumb.d.ts +24 -0
- package/dist/components/breadcrumb/UBreadcrumb.js +65 -0
- package/dist/components/breadcrumb/UBreadcrumb.styles.d.ts +1 -0
- package/dist/components/breadcrumb/UBreadcrumb.styles.js +37 -0
- package/dist/components/breadcrumb-item/UBreadcrumbItem.d.ts +30 -0
- package/dist/components/breadcrumb-item/UBreadcrumbItem.js +52 -0
- package/dist/components/breadcrumb-item/UBreadcrumbItem.styles.d.ts +1 -0
- package/dist/components/breadcrumb-item/UBreadcrumbItem.styles.js +41 -0
- package/dist/components/button/UButton.d.ts +46 -3
- package/dist/components/button/UButton.js +104 -4
- package/dist/components/button/UButton.styles.js +121 -48
- package/dist/components/button-group/UButtonGroup.d.ts +28 -0
- package/dist/components/button-group/UButtonGroup.js +93 -0
- package/dist/components/button-group/UButtonGroup.styles.d.ts +1 -0
- package/dist/components/button-group/UButtonGroup.styles.js +34 -0
- package/dist/components/card/UCard.d.ts +30 -3
- package/dist/components/card/UCard.js +61 -4
- package/dist/components/card/UCard.styles.js +13 -12
- package/dist/components/carousel/UCarousel.d.ts +65 -3
- package/dist/components/carousel/UCarousel.js +219 -2
- package/dist/components/carousel/UCarousel.styles.js +17 -17
- package/dist/components/checkbox/UCheckbox.d.ts +39 -0
- package/dist/components/checkbox/UCheckbox.js +88 -0
- package/dist/components/checkbox/UCheckbox.styles.d.ts +1 -0
- package/dist/components/checkbox/UCheckbox.styles.js +211 -0
- package/dist/components/chip/UChip.d.ts +43 -0
- package/dist/components/chip/UChip.js +103 -0
- package/dist/components/chip/UChip.styles.d.ts +1 -0
- package/dist/components/chip/UChip.styles.js +31 -0
- package/dist/components/dialog/UDialog.d.ts +29 -2
- package/dist/components/dialog/UDialog.js +66 -4
- package/dist/components/dialog/UDialog.styles.js +90 -39
- package/dist/components/divider/UDivider.d.ts +27 -2
- package/dist/components/divider/UDivider.js +45 -4
- package/dist/components/divider/UDivider.styles.js +80 -10
- package/dist/components/drawer/UDrawer.d.ts +25 -3
- package/dist/components/drawer/UDrawer.js +54 -4
- package/dist/components/drawer/UDrawer.styles.js +67 -60
- package/dist/components/field/UField.d.ts +31 -0
- package/dist/components/field/UField.js +64 -0
- package/dist/components/field/UField.styles.d.ts +1 -0
- package/dist/components/field/UField.styles.js +47 -0
- package/dist/components/form/UForm.d.ts +38 -2
- package/dist/components/form/UForm.js +105 -4
- package/dist/components/form/UForm.styles.js +5 -5
- package/dist/components/icon/UIcon.d.ts +23 -4
- package/dist/components/icon/UIcon.js +55 -4
- package/dist/components/icon/UIcon.styles.js +5 -5
- package/dist/components/icon-button/UIconButton.d.ts +48 -0
- package/dist/components/icon-button/UIconButton.js +88 -0
- package/dist/components/icon-button/UIconButton.styles.d.ts +1 -0
- package/dist/components/icon-button/UIconButton.styles.js +24 -0
- package/dist/components/input/UInput.d.ts +95 -3
- package/dist/components/input/UInput.js +258 -2
- package/dist/components/input/UInput.styles.js +120 -86
- package/dist/components/menu/UMenu.d.ts +41 -3
- package/dist/components/menu/UMenu.js +178 -4
- package/dist/components/menu/UMenu.styles.js +16 -30
- package/dist/components/menu-item/UMenuItem.d.ts +48 -2
- package/dist/components/menu-item/UMenuItem.js +159 -2
- package/dist/components/menu-item/UMenuItem.styles.js +120 -34
- package/dist/components/option/UOption.d.ts +42 -0
- package/dist/components/option/UOption.js +64 -0
- package/dist/components/option/UOption.styles.d.ts +1 -0
- package/dist/components/option/UOption.styles.js +132 -0
- package/dist/components/panel/UPanel.d.ts +22 -0
- package/dist/components/panel/UPanel.js +36 -0
- package/dist/components/panel/UPanel.styles.d.ts +1 -0
- package/dist/components/panel/UPanel.styles.js +14 -0
- package/dist/components/popover/UPopover.d.ts +69 -0
- package/dist/components/popover/UPopover.js +235 -0
- package/dist/components/popover/UPopover.styles.d.ts +1 -0
- package/dist/components/popover/UPopover.styles.js +9 -0
- package/dist/components/progress-bar/UProgressBar.d.ts +46 -2
- package/dist/components/progress-bar/UProgressBar.js +94 -2
- package/dist/components/progress-bar/UProgressBar.styles.js +110 -36
- package/dist/components/progress-ring/UProgressRing.d.ts +46 -3
- package/dist/components/progress-ring/UProgressRing.js +152 -2
- package/dist/components/progress-ring/UProgressRing.styles.js +88 -25
- package/dist/components/radio/URadio.d.ts +41 -0
- package/dist/components/radio/URadio.js +151 -0
- package/dist/components/radio/URadio.styles.d.ts +1 -0
- package/dist/components/radio/URadio.styles.js +111 -0
- package/dist/components/rating/URating.d.ts +48 -0
- package/dist/components/rating/URating.js +196 -0
- package/dist/components/rating/URating.styles.d.ts +1 -0
- package/dist/components/rating/URating.styles.js +55 -0
- package/dist/components/select/USelect.d.ts +70 -0
- package/dist/components/select/USelect.js +315 -0
- package/dist/components/select/USelect.styles.d.ts +1 -0
- package/dist/components/select/USelect.styles.js +200 -0
- package/dist/components/skeleton/USkeleton.d.ts +27 -3
- package/dist/components/skeleton/USkeleton.js +37 -4
- package/dist/components/skeleton/USkeleton.styles.js +15 -18
- package/dist/components/slider/USlider.d.ts +88 -0
- package/dist/components/slider/USlider.js +286 -0
- package/dist/components/slider/USlider.styles.d.ts +1 -0
- package/dist/components/slider/USlider.styles.js +125 -0
- package/dist/components/spinner/USpinner.d.ts +23 -2
- package/dist/components/spinner/USpinner.js +37 -3
- package/dist/components/spinner/USpinner.styles.js +34 -13
- package/dist/components/split-panel/USplitPanel.d.ts +49 -2
- package/dist/components/split-panel/USplitPanel.js +239 -3
- package/dist/components/split-panel/USplitPanel.styles.js +47 -15
- package/dist/components/switch/USwitch.d.ts +43 -0
- package/dist/components/switch/USwitch.js +80 -0
- package/dist/components/switch/USwitch.styles.d.ts +1 -0
- package/dist/components/switch/USwitch.styles.js +191 -0
- package/dist/components/tab/UTab.d.ts +31 -0
- package/dist/components/tab/UTab.js +68 -0
- package/dist/components/tab/UTab.styles.d.ts +1 -0
- package/dist/components/tab/UTab.styles.js +46 -0
- package/dist/components/tab-panel/UTabPanel.d.ts +45 -0
- package/dist/components/tab-panel/UTabPanel.js +150 -0
- package/dist/components/tab-panel/UTabPanel.styles.d.ts +1 -0
- package/dist/components/tab-panel/UTabPanel.styles.js +201 -0
- package/dist/components/tag/UTag.d.ts +26 -3
- package/dist/components/tag/UTag.js +41 -4
- package/dist/components/tag/UTag.styles.js +206 -60
- package/dist/components/textarea/UTextarea.d.ts +65 -0
- package/dist/components/textarea/UTextarea.js +145 -0
- package/dist/components/textarea/UTextarea.styles.d.ts +1 -0
- package/dist/components/textarea/UTextarea.styles.js +157 -0
- package/dist/components/tooltip/UTooltip.d.ts +28 -2
- package/dist/components/tooltip/UTooltip.js +104 -4
- package/dist/components/tooltip/UTooltip.styles.js +10 -12
- package/dist/components/tree/UTree.d.ts +62 -2
- package/dist/components/tree/UTree.js +308 -3
- package/dist/components/tree/UTree.styles.js +13 -19
- package/dist/components/tree-item/UTreeItem.d.ts +61 -2
- package/dist/components/tree-item/UTreeItem.js +191 -2
- package/dist/components/tree-item/UTreeItem.styles.js +96 -37
- package/dist/events/CheckEvent.d.ts +7 -0
- package/dist/events/CollapseEvent.d.ts +7 -0
- package/dist/events/ExpandEvent.d.ts +7 -0
- package/dist/events/HideEvent.d.ts +7 -0
- package/dist/events/NavigateEvent.d.ts +7 -0
- package/dist/events/PickEvent.d.ts +18 -0
- package/dist/events/RemoveEvent.d.ts +7 -0
- package/dist/events/ShiftEvent.d.ts +16 -0
- package/dist/events/ShowEvent.d.ts +7 -0
- package/dist/index.d.ts +37 -10
- package/dist/index.js +56 -52
- package/dist/react/UAlert.d.ts +13 -0
- package/dist/{react-components → react}/UAlert.js +5 -2
- package/dist/react/UAvatar.d.ts +9 -0
- package/dist/react/UAvatar.js +10 -0
- package/dist/react/UBadge.d.ts +9 -0
- package/dist/react/UBadge.js +10 -0
- package/dist/react/UBreadcrumb.d.ts +9 -0
- package/dist/react/UBreadcrumb.js +10 -0
- package/dist/react/UBreadcrumbItem.d.ts +11 -0
- package/dist/react/UBreadcrumbItem.js +12 -0
- package/dist/{react-components → react}/UButton.d.ts +3 -2
- package/dist/{react-components → react}/UButton.js +2 -2
- package/dist/react/UButtonGroup.d.ts +9 -0
- package/dist/react/UButtonGroup.js +10 -0
- package/dist/{react-components → react}/UCard.d.ts +3 -2
- package/dist/{react-components → react}/UCard.js +2 -2
- package/dist/{react-components → react}/UCarousel.d.ts +3 -2
- package/dist/{react-components → react}/UCarousel.js +2 -2
- package/dist/react/UCheckbox.d.ts +9 -0
- package/dist/react/UCheckbox.js +10 -0
- package/dist/react/UChip.d.ts +13 -0
- package/dist/react/UChip.js +13 -0
- package/dist/{react-components → react}/UDialog.d.ts +3 -2
- package/dist/{react-components → react}/UDialog.js +2 -2
- package/dist/{react-components → react}/UDivider.d.ts +3 -2
- package/dist/{react-components → react}/UDivider.js +2 -2
- package/dist/{react-components → react}/UDrawer.d.ts +3 -2
- package/dist/{react-components → react}/UDrawer.js +2 -2
- package/dist/react/UField.d.ts +9 -0
- package/dist/react/UField.js +10 -0
- package/dist/react/UForm.d.ts +10 -0
- package/dist/{react-components → react}/UForm.js +4 -2
- package/dist/{react-components → react}/UIcon.d.ts +3 -2
- package/dist/{react-components → react}/UIcon.js +2 -2
- package/dist/react/UIconButton.d.ts +9 -0
- package/dist/react/UIconButton.js +10 -0
- package/dist/react/UInput.d.ts +11 -0
- package/dist/{react-components → react}/UInput.js +5 -2
- package/dist/react/UMenu.d.ts +10 -0
- package/dist/{react-components → react}/UMenu.js +4 -2
- package/dist/react/UMenuItem.d.ts +11 -0
- package/dist/{react-components → react}/UMenuItem.js +4 -2
- package/dist/react/UOption.d.ts +9 -0
- package/dist/react/UOption.js +10 -0
- package/dist/react/UPanel.d.ts +9 -0
- package/dist/react/UPanel.js +10 -0
- package/dist/react/UPopover.d.ts +11 -0
- package/dist/react/UPopover.js +13 -0
- package/dist/react/UProgressBar.d.ts +9 -0
- package/dist/{react-components → react}/UProgressBar.js +2 -2
- package/dist/react/UProgressRing.d.ts +9 -0
- package/dist/{react-components → react}/UProgressRing.js +2 -2
- package/dist/react/URadio.d.ts +10 -0
- package/dist/react/URadio.js +12 -0
- package/dist/react/URating.d.ts +10 -0
- package/dist/react/URating.js +12 -0
- package/dist/react/USelect.d.ts +10 -0
- package/dist/react/USelect.js +12 -0
- package/dist/{react-components → react}/USkeleton.d.ts +3 -2
- package/dist/{react-components → react}/USkeleton.js +2 -2
- package/dist/react/USlider.d.ts +10 -0
- package/dist/react/USlider.js +12 -0
- package/dist/{react-components → react}/USpinner.d.ts +3 -2
- package/dist/{react-components → react}/USpinner.js +2 -2
- package/dist/react/USplitPanel.d.ts +13 -0
- package/dist/{react-components → react}/USplitPanel.js +6 -2
- package/dist/react/USwitch.d.ts +10 -0
- package/dist/react/USwitch.js +12 -0
- package/dist/react/UTab.d.ts +11 -0
- package/dist/react/UTab.js +12 -0
- package/dist/react/UTabPanel.d.ts +9 -0
- package/dist/react/UTabPanel.js +10 -0
- package/dist/{react-components → react}/UTag.d.ts +3 -2
- package/dist/{react-components → react}/UTag.js +2 -2
- package/dist/react/UTextarea.d.ts +11 -0
- package/dist/react/UTextarea.js +13 -0
- package/dist/react/UTooltip.d.ts +11 -0
- package/dist/{react-components → react}/UTooltip.js +5 -2
- package/dist/react/UTree.d.ts +10 -0
- package/dist/{react-components → react}/UTree.js +4 -2
- package/dist/react/UTreeItem.d.ts +17 -0
- package/dist/{react-components → react}/UTreeItem.js +7 -2
- package/dist/{react-components → react}/index.d.ts +40 -27
- package/dist/{react-components → react}/index.js +40 -20
- package/dist/{assets/styles → styles}/dark.css +68 -3
- package/dist/{assets/styles → styles}/light.css +68 -3
- package/dist/utilities/BrowserStorage.d.ts +2 -1
- package/dist/utilities/BrowserStorage.js +69 -86
- package/dist/utilities/Dialog.d.ts +83 -0
- package/dist/utilities/Dialog.js +141 -0
- package/dist/utilities/OverlayManager.d.ts +37 -0
- package/dist/utilities/OverlayManager.js +68 -0
- package/dist/utilities/Theme.js +134 -141
- package/dist/utilities/Toast.d.ts +45 -0
- package/dist/utilities/Toast.js +114 -0
- package/dist/utilities/converters.d.ts +44 -1
- package/dist/utilities/converters.js +112 -14
- package/dist/utilities/elements.js +62 -33
- package/dist/utilities/icons.d.ts +67 -0
- package/dist/utilities/icons.js +200 -0
- package/dist/utilities/sanitizers.js +64 -32
- package/package.json +24 -20
- package/plugins/vite-plugin-glob-resolve.d.ts +12 -0
- package/plugins/vite-plugin-glob-resolve.js +66 -0
- package/plugins/vite-plugin-react-wrapper.d.ts +12 -0
- package/plugins/vite-plugin-react-wrapper.js +206 -0
- package/skills/iyulab-components/SKILL.md +138 -0
- package/skills/iyulab-components/references/components/alert.md +74 -0
- package/skills/iyulab-components/references/components/avatar.md +41 -0
- package/skills/iyulab-components/references/components/badge.md +38 -0
- package/skills/iyulab-components/references/components/breadcrumb.md +75 -0
- package/skills/iyulab-components/references/components/button-group.md +38 -0
- package/skills/iyulab-components/references/components/button.md +56 -0
- package/skills/iyulab-components/references/components/card.md +53 -0
- package/skills/iyulab-components/references/components/carousel.md +63 -0
- package/skills/iyulab-components/references/components/checkbox.md +70 -0
- package/skills/iyulab-components/references/components/chip.md +64 -0
- package/skills/iyulab-components/references/components/dialog.md +71 -0
- package/skills/iyulab-components/references/components/divider.md +56 -0
- package/skills/iyulab-components/references/components/drawer.md +63 -0
- package/skills/iyulab-components/references/components/field.md +42 -0
- package/skills/iyulab-components/references/components/form.md +68 -0
- package/skills/iyulab-components/references/components/icon-button.md +56 -0
- package/skills/iyulab-components/references/components/icon.md +49 -0
- package/skills/iyulab-components/references/components/input.md +95 -0
- package/skills/iyulab-components/references/components/menu.md +106 -0
- package/skills/iyulab-components/references/components/option.md +70 -0
- package/skills/iyulab-components/references/components/panel.md +38 -0
- package/skills/iyulab-components/references/components/popover.md +62 -0
- package/skills/iyulab-components/references/components/progress-bar.md +61 -0
- package/skills/iyulab-components/references/components/progress-ring.md +58 -0
- package/skills/iyulab-components/references/components/radio.md +67 -0
- package/skills/iyulab-components/references/components/rating.md +74 -0
- package/skills/iyulab-components/references/components/select.md +86 -0
- package/skills/iyulab-components/references/components/skeleton.md +46 -0
- package/skills/iyulab-components/references/components/slider.md +89 -0
- package/skills/iyulab-components/references/components/spinner.md +47 -0
- package/skills/iyulab-components/references/components/split-panel.md +65 -0
- package/skills/iyulab-components/references/components/switch.md +81 -0
- package/skills/iyulab-components/references/components/tab-panel.md +93 -0
- package/skills/iyulab-components/references/components/tag.md +55 -0
- package/skills/iyulab-components/references/components/textarea.md +67 -0
- package/skills/iyulab-components/references/components/tooltip.md +58 -0
- package/skills/iyulab-components/references/components/tree.md +128 -0
- package/skills/iyulab-components/references/extensions/data.md +60 -0
- package/skills/iyulab-components/references/extensions/element.md +57 -0
- package/skills/iyulab-components/references/extensions/floating.md +60 -0
- package/skills/iyulab-components/references/extensions/form-control.md +79 -0
- package/skills/iyulab-components/references/extensions/overlay.md +76 -0
- package/skills/iyulab-components/references/usage.md +216 -0
- package/skills/iyulab-components/references/utilities/browser-storage.md +54 -0
- package/skills/iyulab-components/references/utilities/converters.md +42 -0
- package/skills/iyulab-components/references/utilities/dialog.md +75 -0
- package/skills/iyulab-components/references/utilities/elements.md +55 -0
- package/skills/iyulab-components/references/utilities/icons.md +53 -0
- package/skills/iyulab-components/references/utilities/overlay-manager.md +34 -0
- package/skills/iyulab-components/references/utilities/sanitizers.md +32 -0
- package/skills/iyulab-components/references/utilities/theme.md +45 -0
- package/skills/iyulab-components/references/utilities/toast.md +58 -0
- package/dist/assets/icons/arrow-down-up.svg.js +0 -3
- package/dist/assets/icons/arrow-down.svg.js +0 -3
- package/dist/assets/icons/arrow-repeat.svg.js +0 -3
- package/dist/assets/icons/arrow-up.svg.js +0 -3
- package/dist/assets/icons/ban.svg.js +0 -3
- package/dist/assets/icons/bell-fill.svg.js +0 -3
- package/dist/assets/icons/box-arrow-up-right.svg.js +0 -3
- package/dist/assets/icons/check-circle-fill.svg.js +0 -3
- package/dist/assets/icons/check-lg.svg.js +0 -3
- package/dist/assets/icons/chevron-down.svg.js +0 -3
- package/dist/assets/icons/chevron-left.svg.js +0 -3
- package/dist/assets/icons/chevron-right.svg.js +0 -3
- package/dist/assets/icons/chevron-up.svg.js +0 -3
- package/dist/assets/icons/code-slash.svg.js +0 -3
- package/dist/assets/icons/copy.svg.js +0 -3
- package/dist/assets/icons/dash-lg.svg.js +0 -3
- package/dist/assets/icons/download.svg.js +0 -3
- package/dist/assets/icons/exclamation-circle-fill.svg.js +0 -3
- package/dist/assets/icons/exclamation-triangle-fill.svg.js +0 -3
- package/dist/assets/icons/eye-slash.svg.js +0 -3
- package/dist/assets/icons/eye.svg.js +0 -3
- package/dist/assets/icons/file-earmark.svg.js +0 -3
- package/dist/assets/icons/flag.svg.js +0 -3
- package/dist/assets/icons/globe.svg.js +0 -3
- package/dist/assets/icons/hand-thumbs-down-fill.svg.js +0 -3
- package/dist/assets/icons/hand-thumbs-down.svg.js +0 -3
- package/dist/assets/icons/hand-thumbs-up-fill.svg.js +0 -3
- package/dist/assets/icons/hand-thumbs-up.svg.js +0 -3
- package/dist/assets/icons/info-circle-fill.svg.js +0 -3
- package/dist/assets/icons/lightbulb-fill.svg.js +0 -3
- package/dist/assets/icons/lightbulb-off.svg.js +0 -3
- package/dist/assets/icons/lightbulb.svg.js +0 -3
- package/dist/assets/icons/mic-fill.svg.js +0 -3
- package/dist/assets/icons/mic-mute-fill.svg.js +0 -3
- package/dist/assets/icons/paperclip.svg.js +0 -3
- package/dist/assets/icons/pencil-square.svg.js +0 -3
- package/dist/assets/icons/plus-lg.svg.js +0 -3
- package/dist/assets/icons/search.svg.js +0 -3
- package/dist/assets/icons/share.svg.js +0 -3
- package/dist/assets/icons/sort-alpha-down.svg.js +0 -3
- package/dist/assets/icons/sort-alpha-up.svg.js +0 -3
- package/dist/assets/icons/stop-circle.svg.js +0 -3
- package/dist/assets/icons/tools.svg.js +0 -3
- package/dist/assets/icons/x-lg.svg.js +0 -3
- package/dist/assets/styles/dark.css.js +0 -3
- package/dist/assets/styles/light.css.js +0 -3
- package/dist/components/UJsonElement.js +0 -93
- package/dist/components/UModalElement.d.ts +0 -70
- package/dist/components/UModalElement.js +0 -144
- package/dist/components/UModalElement.styles.js +0 -29
- package/dist/components/alert/UAlert.component.d.ts +0 -40
- package/dist/components/alert/UAlert.component.js +0 -146
- package/dist/components/button/UButton.component.d.ts +0 -23
- package/dist/components/button/UButton.component.js +0 -72
- package/dist/components/card/UCard.component.d.ts +0 -21
- package/dist/components/card/UCard.component.js +0 -66
- package/dist/components/carousel/UCarousel.component.d.ts +0 -78
- package/dist/components/carousel/UCarousel.component.js +0 -264
- package/dist/components/dialog/UDialog.component.d.ts +0 -17
- package/dist/components/dialog/UDialog.component.js +0 -70
- package/dist/components/divider/UDivider.component.d.ts +0 -10
- package/dist/components/divider/UDivider.component.js +0 -30
- package/dist/components/drawer/UDrawer.component.d.ts +0 -18
- package/dist/components/drawer/UDrawer.component.js +0 -64
- package/dist/components/form/UForm.component.d.ts +0 -24
- package/dist/components/form/UForm.component.js +0 -76
- package/dist/components/icon/UIcon.component.d.ts +0 -29
- package/dist/components/icon/UIcon.component.js +0 -57
- package/dist/components/input/UInput.component.d.ts +0 -92
- package/dist/components/input/UInput.component.js +0 -267
- package/dist/components/menu/UMenu.component.d.ts +0 -67
- package/dist/components/menu/UMenu.component.js +0 -338
- package/dist/components/menu-item/UMenuItem.component.d.ts +0 -25
- package/dist/components/menu-item/UMenuItem.component.js +0 -111
- package/dist/components/progress-bar/UProgressBar.component.d.ts +0 -27
- package/dist/components/progress-bar/UProgressBar.component.js +0 -99
- package/dist/components/progress-ring/UProgressRing.component.d.ts +0 -33
- package/dist/components/progress-ring/UProgressRing.component.js +0 -114
- package/dist/components/skeleton/USkeleton.component.d.ts +0 -22
- package/dist/components/skeleton/USkeleton.component.js +0 -58
- package/dist/components/spinner/USpinner.component.d.ts +0 -9
- package/dist/components/spinner/USpinner.component.js +0 -22
- package/dist/components/split-panel/USplitPanel.component.d.ts +0 -44
- package/dist/components/split-panel/USplitPanel.component.js +0 -185
- package/dist/components/tag/UTag.component.d.ts +0 -23
- package/dist/components/tag/UTag.component.js +0 -72
- package/dist/components/tooltip/UTooltip.component.d.ts +0 -27
- package/dist/components/tooltip/UTooltip.component.js +0 -88
- package/dist/components/tree/UTree.component.d.ts +0 -37
- package/dist/components/tree/UTree.component.js +0 -120
- package/dist/components/tree-item/UTreeItem.component.d.ts +0 -41
- package/dist/components/tree-item/UTreeItem.component.js +0 -161
- package/dist/events/UChangeEvent.d.ts +0 -6
- package/dist/events/UHideEvent.d.ts +0 -6
- package/dist/events/UInputEvent.d.ts +0 -6
- package/dist/events/UResizeEvent.d.ts +0 -6
- package/dist/events/USelectEvent.d.ts +0 -6
- package/dist/events/UShowEvent.d.ts +0 -6
- package/dist/react-components/UAlert.d.ts +0 -8
- package/dist/react-components/UForm.d.ts +0 -8
- package/dist/react-components/UInput.d.ts +0 -8
- package/dist/react-components/UMenu.d.ts +0 -8
- package/dist/react-components/UMenuItem.d.ts +0 -8
- package/dist/react-components/UProgressBar.d.ts +0 -8
- package/dist/react-components/UProgressRing.d.ts +0 -8
- package/dist/react-components/USplitPanel.d.ts +0 -8
- package/dist/react-components/UTooltip.d.ts +0 -8
- package/dist/react-components/UTree.d.ts +0 -8
- package/dist/react-components/UTreeItem.d.ts +0 -8
- package/dist/utilities/IconRegistry.d.ts +0 -40
- package/dist/utilities/IconRegistry.js +0 -134
- package/dist/utilities/Notifier.d.ts +0 -31
- package/dist/utilities/Notifier.js +0 -79
- package/dist/utilities/decorators.d.ts +0 -28
- /package/dist/components/{UJsonElement.styles.d.ts → UDataElement.styles.d.ts} +0 -0
- /package/dist/components/{UModalElement.styles.d.ts → UFormControlElement.styles.d.ts} +0 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# UFormControlElement\<T\>
|
|
2
|
+
|
|
3
|
+
```ts
|
|
4
|
+
import { UFormControlElement } from '@iyulab/components';
|
|
5
|
+
```
|
|
6
|
+
|
|
7
|
+
Abstract base class for all form-associated controls. Enables native `<form>` participation via the [ElementInternals](https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals) API.
|
|
8
|
+
|
|
9
|
+
## When to extend
|
|
10
|
+
|
|
11
|
+
Use when building a custom input that should participate in forms (`formAssociated = true`), support `name`/`value` submission, and integrate with the library's validation pattern.
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import { UFormControlElement } from '@iyulab/components';
|
|
15
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
16
|
+
import { html } from 'lit';
|
|
17
|
+
|
|
18
|
+
@customElement('my-input')
|
|
19
|
+
export class MyInput extends UFormControlElement<string> {
|
|
20
|
+
@property() value = '';
|
|
21
|
+
|
|
22
|
+
render() {
|
|
23
|
+
return html`
|
|
24
|
+
<input
|
|
25
|
+
.value=${this.value}
|
|
26
|
+
?disabled=${this.disabled}
|
|
27
|
+
?readonly=${this.readonly}
|
|
28
|
+
@change=${(e: Event) => {
|
|
29
|
+
this.value = (e.target as HTMLInputElement).value;
|
|
30
|
+
this.fire('change');
|
|
31
|
+
}}
|
|
32
|
+
/>
|
|
33
|
+
`;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
validate(): boolean {
|
|
37
|
+
if (this.required && !this.value) {
|
|
38
|
+
this.invalid = true;
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
this.invalid = false;
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
reset(): void {
|
|
46
|
+
this.value = '';
|
|
47
|
+
this.invalid = false;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Inherited Properties
|
|
53
|
+
|
|
54
|
+
| Property | Type | Default | Reflect | Description |
|
|
55
|
+
|----------|------|---------|---------|-------------|
|
|
56
|
+
| `name` | `string` | — | — | Form field name |
|
|
57
|
+
| `value` | `T` | — | — | Submitted value |
|
|
58
|
+
| `disabled` | `boolean` | `false` | ✓ | Disable the control |
|
|
59
|
+
| `readonly` | `boolean` | `false` | ✓ | Read-only |
|
|
60
|
+
| `required` | `boolean` | `false` | ✓ | Required field |
|
|
61
|
+
| `invalid` | `boolean` | `false` | ✓ | Validation failed state |
|
|
62
|
+
| `novalidate` | `boolean` | `false` | — | Skip automatic validation |
|
|
63
|
+
| `label` | `string` | — | — | Field label |
|
|
64
|
+
| `description` | `string` | — | — | Helper description |
|
|
65
|
+
| `validationMessage` | `string` | — | — | Custom validation error text |
|
|
66
|
+
|
|
67
|
+
## Inherited Getters
|
|
68
|
+
|
|
69
|
+
| Getter | Returns | Description |
|
|
70
|
+
|--------|---------|-------------|
|
|
71
|
+
| `form` | `HTMLFormElement \| null` | Associated form element |
|
|
72
|
+
| `validity` | `ValidityState \| undefined` | Native validity state |
|
|
73
|
+
|
|
74
|
+
## Abstract Methods (must implement)
|
|
75
|
+
|
|
76
|
+
| Method | Returns | Description |
|
|
77
|
+
|--------|---------|-------------|
|
|
78
|
+
| `validate()` | `boolean` | Run validation logic; set `this.invalid` accordingly |
|
|
79
|
+
| `reset()` | `void` | Reset value and clear validation state |
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# UOverlayElement
|
|
2
|
+
|
|
3
|
+
```ts
|
|
4
|
+
import { UOverlayElement } from '@iyulab/components';
|
|
5
|
+
```
|
|
6
|
+
|
|
7
|
+
Abstract base class for full-screen or contained overlays (dialogs, drawers, side sheets). Manages:
|
|
8
|
+
|
|
9
|
+
- **Focus-trap** via `focus-trap` library
|
|
10
|
+
- **Body scroll lock** while open
|
|
11
|
+
- **ESC key** and **backdrop click** close
|
|
12
|
+
- **OverlayManager** z-index stacking
|
|
13
|
+
|
|
14
|
+
## When to extend
|
|
15
|
+
|
|
16
|
+
Use when building a modal-style component that should block interaction with the rest of the page.
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
import { UOverlayElement } from '@iyulab/components';
|
|
20
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
21
|
+
import { html } from 'lit';
|
|
22
|
+
|
|
23
|
+
@customElement('my-modal')
|
|
24
|
+
export class MyModal extends UOverlayElement {
|
|
25
|
+
@property() title = '';
|
|
26
|
+
|
|
27
|
+
render() {
|
|
28
|
+
return html`
|
|
29
|
+
<div class="backdrop" part="backdrop"></div>
|
|
30
|
+
<div class="panel" part="panel">
|
|
31
|
+
<h2>${this.title}</h2>
|
|
32
|
+
<slot></slot>
|
|
33
|
+
<button @click=${() => this.requestClose('button')}>Close</button>
|
|
34
|
+
</div>
|
|
35
|
+
`;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Inherited Properties
|
|
41
|
+
|
|
42
|
+
| Property | Type | Default | Reflect | Description |
|
|
43
|
+
|----------|------|---------|---------|-------------|
|
|
44
|
+
| `open` | `boolean` | `false` | ✓ | Open/closed state |
|
|
45
|
+
| `mode` | `'modal'\|'non-modal'` | `'modal'` | ✓ | `modal` enables focus-trap |
|
|
46
|
+
| `contained` | `boolean` | `false` | ✓ | Use `position: absolute` relative to parent |
|
|
47
|
+
| `closeOn` | `string[]` | `['escape','backdrop','button']` | ✓ | Allowed close trigger sources |
|
|
48
|
+
|
|
49
|
+
## Methods
|
|
50
|
+
|
|
51
|
+
| Method | Returns | Description |
|
|
52
|
+
|--------|---------|-------------|
|
|
53
|
+
| `show()` | `boolean` | Open overlay; returns `false` if cancelled |
|
|
54
|
+
| `hide()` | `boolean` | Close overlay; returns `false` if cancelled |
|
|
55
|
+
| `requestClose(source)` | `void` | Request close from a source string; respects `closeOn` policy |
|
|
56
|
+
|
|
57
|
+
## Events
|
|
58
|
+
|
|
59
|
+
| Event | Cancelable | Description |
|
|
60
|
+
|-------|------------|-------------|
|
|
61
|
+
| `show` | ✓ | Before overlay opens |
|
|
62
|
+
| `hide` | ✓ | Before overlay closes |
|
|
63
|
+
|
|
64
|
+
## Custom close policy
|
|
65
|
+
|
|
66
|
+
Override `requestClose` to add custom logic before closing:
|
|
67
|
+
|
|
68
|
+
```ts
|
|
69
|
+
override requestClose(source: string) {
|
|
70
|
+
if (source === 'backdrop' && this.hasUnsavedChanges) {
|
|
71
|
+
// show a confirmation prompt instead
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
super.requestClose(source);
|
|
75
|
+
}
|
|
76
|
+
```
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
# Usage Guide
|
|
2
|
+
|
|
3
|
+
## Installation
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm install @iyulab/components
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Importing Components
|
|
12
|
+
|
|
13
|
+
### All at once
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import '@iyulab/components';
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### Individual (tree-shakable)
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
import '@iyulab/components/dist/components/button/UButton.js';
|
|
23
|
+
import '@iyulab/components/dist/components/input/UInput.js';
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### React wrappers
|
|
27
|
+
|
|
28
|
+
React wrappers are generated via `@lit/react` and live under the `react` sub-export.
|
|
29
|
+
|
|
30
|
+
```ts
|
|
31
|
+
import { UButton, UInput, USelect } from '@iyulab/components/react';
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## Theme Setup
|
|
37
|
+
|
|
38
|
+
Call `Theme.init()` once at application startup (before rendering):
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
import { Theme } from '@iyulab/components';
|
|
42
|
+
|
|
43
|
+
await Theme.init({
|
|
44
|
+
default: 'system', // 'system' | 'light' | 'dark'
|
|
45
|
+
useBuiltIn: true, // load bundled CSS variables (default: true)
|
|
46
|
+
store: { // persist theme preference in localStorage (optional)
|
|
47
|
+
type: 'localStorage',
|
|
48
|
+
key: 'app-theme'
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Switching themes at runtime
|
|
54
|
+
|
|
55
|
+
```ts
|
|
56
|
+
import { Theme } from '@iyulab/components';
|
|
57
|
+
|
|
58
|
+
Theme.set('dark');
|
|
59
|
+
Theme.set('light');
|
|
60
|
+
Theme.set('system');
|
|
61
|
+
|
|
62
|
+
const current = Theme.get(); // 'system' | 'light' | 'dark' | undefined
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## Icon Setup
|
|
68
|
+
|
|
69
|
+
### Built-in icons
|
|
70
|
+
|
|
71
|
+
Built-in icons are bundled at build time and served from `/assets/icons/` by default.
|
|
72
|
+
If you serve static assets from a different path, update the base URL:
|
|
73
|
+
|
|
74
|
+
```ts
|
|
75
|
+
import { setDefaultBaseUrl } from '@iyulab/components';
|
|
76
|
+
|
|
77
|
+
setDefaultBaseUrl('/static/icons/');
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Using a third-party icon library
|
|
81
|
+
|
|
82
|
+
Third-party libraries are loaded on-demand from CDN. Supported libraries:
|
|
83
|
+
|
|
84
|
+
| `lib` value | Source | Notes |
|
|
85
|
+
|---|---|---|
|
|
86
|
+
| `internal` | Bundled SVGs | Default, no network |
|
|
87
|
+
| `tabler` | [tabler.io/icons](https://tabler.io/icons) | `name` or `name:filled` |
|
|
88
|
+
| `heroicons` | [heroicons.com](https://heroicons.com) | `name` or `name:solid` |
|
|
89
|
+
| `lucide` | [lucide.dev](https://lucide.dev) | Only outline style |
|
|
90
|
+
| `bootstrap` | [icons.getbootstrap.com](https://icons.getbootstrap.com) | outline / filled |
|
|
91
|
+
|
|
92
|
+
```html
|
|
93
|
+
<u-icon lib="tabler" name="home"></u-icon>
|
|
94
|
+
<u-icon lib="tabler" name="home:filled"></u-icon>
|
|
95
|
+
<u-icon lib="heroicons" name="academic-cap:solid"></u-icon>
|
|
96
|
+
<u-icon lib="lucide" name="activity"></u-icon>
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Registering a custom icon library
|
|
100
|
+
|
|
101
|
+
```ts
|
|
102
|
+
import { IconRegistry } from '@iyulab/components';
|
|
103
|
+
|
|
104
|
+
IconRegistry.register('my-icons', async (name) => {
|
|
105
|
+
const res = await fetch(`/icons/${name}.svg`);
|
|
106
|
+
if (!res.ok) return undefined;
|
|
107
|
+
return res.text();
|
|
108
|
+
});
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
```html
|
|
112
|
+
<u-icon lib="my-icons" name="logo"></u-icon>
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Unregistering
|
|
116
|
+
|
|
117
|
+
```ts
|
|
118
|
+
IconRegistry.unregister('my-icons');
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## CSS Custom Properties
|
|
124
|
+
|
|
125
|
+
Components expose `--` CSS custom properties for visual customization. Apply them on a wrapping element or `:root`:
|
|
126
|
+
|
|
127
|
+
```css
|
|
128
|
+
:root {
|
|
129
|
+
--alert-background-color: #1a1a2e;
|
|
130
|
+
--spinner-indicator-color: royalblue;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
u-button {
|
|
134
|
+
--btn-radius: 999px;
|
|
135
|
+
}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## CSS `part` Styling
|
|
141
|
+
|
|
142
|
+
Shadow DOM internals are exposed via `::part()`:
|
|
143
|
+
|
|
144
|
+
```css
|
|
145
|
+
u-input::part(input) {
|
|
146
|
+
font-size: 1rem;
|
|
147
|
+
letter-spacing: 0.02em;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
u-dialog::part(panel) {
|
|
151
|
+
border-radius: 1rem;
|
|
152
|
+
box-shadow: 0 8px 32px rgba(0,0,0,0.3);
|
|
153
|
+
}
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
## Form Integration
|
|
159
|
+
|
|
160
|
+
All form control components (`u-input`, `u-select`, `u-checkbox`, etc.) use the native [ElementInternals](https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals) API (`formAssociated = true`) and work inside standard `<form>` elements.
|
|
161
|
+
|
|
162
|
+
```html
|
|
163
|
+
<form id="my-form">
|
|
164
|
+
<u-input name="email" type="email" required></u-input>
|
|
165
|
+
<u-select name="role">
|
|
166
|
+
<u-option value="admin">Admin</u-option>
|
|
167
|
+
<u-option value="viewer">Viewer</u-option>
|
|
168
|
+
</u-select>
|
|
169
|
+
<u-button type="submit">Submit</u-button>
|
|
170
|
+
</form>
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### Validating programmatically
|
|
174
|
+
|
|
175
|
+
```ts
|
|
176
|
+
const input = document.querySelector('u-input');
|
|
177
|
+
input.validate(); // returns boolean, sets `invalid` attribute
|
|
178
|
+
input.reset(); // clears value and validation state
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### Using `u-form` for model binding
|
|
182
|
+
|
|
183
|
+
```ts
|
|
184
|
+
import { UForm } from '@iyulab/components';
|
|
185
|
+
|
|
186
|
+
const form = document.querySelector('u-form') as UForm;
|
|
187
|
+
form.model = { email: 'user@example.com', role: 'admin' };
|
|
188
|
+
|
|
189
|
+
form.addEventListener('change', () => {
|
|
190
|
+
console.log(form.model); // updated model
|
|
191
|
+
});
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
## Overlay / Dialog Utilities
|
|
197
|
+
|
|
198
|
+
Open dialogs and toasts programmatically without creating elements manually:
|
|
199
|
+
|
|
200
|
+
```ts
|
|
201
|
+
import { Dialog, Toast } from '@iyulab/components';
|
|
202
|
+
|
|
203
|
+
// Alert
|
|
204
|
+
await Dialog.alert('Operation completed.');
|
|
205
|
+
|
|
206
|
+
// Confirm
|
|
207
|
+
const confirmed = await Dialog.confirm('Delete this item?');
|
|
208
|
+
|
|
209
|
+
// Prompt
|
|
210
|
+
const name = await Dialog.prompt('Enter your name:', { default: 'Alice' });
|
|
211
|
+
|
|
212
|
+
// Toast
|
|
213
|
+
Toast.success('Saved!');
|
|
214
|
+
Toast.error('Something went wrong.', { duration: 5000 });
|
|
215
|
+
Toast.message('Hello world', { position: 'bottom-center' });
|
|
216
|
+
```
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# BrowserStorage
|
|
2
|
+
|
|
3
|
+
```ts
|
|
4
|
+
import { BrowserStorage } from '@iyulab/components';
|
|
5
|
+
```
|
|
6
|
+
|
|
7
|
+
Unified key-value storage API over `localStorage` or browser cookies.
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
// localStorage
|
|
13
|
+
const storage = new BrowserStorage({ type: 'localStorage' });
|
|
14
|
+
|
|
15
|
+
await storage.set('theme', 'dark');
|
|
16
|
+
const theme = await storage.get('theme'); // 'dark'
|
|
17
|
+
await storage.remove('theme');
|
|
18
|
+
|
|
19
|
+
// Cookie
|
|
20
|
+
const cookieStorage = new BrowserStorage({
|
|
21
|
+
type: 'cookie',
|
|
22
|
+
path: '/',
|
|
23
|
+
maxAge: 60 * 60 * 24 * 30 // 30 days
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
await cookieStorage.set('session', 'abc123');
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## API
|
|
30
|
+
|
|
31
|
+
| Method | Returns | Description |
|
|
32
|
+
|--------|---------|-------------|
|
|
33
|
+
| `set(key, value)` | `Promise<void>` | Store a string value |
|
|
34
|
+
| `get(key)` | `Promise<string \| null>` | Retrieve a value |
|
|
35
|
+
| `remove(key)` | `Promise<void>` | Delete a value |
|
|
36
|
+
|
|
37
|
+
## Types
|
|
38
|
+
|
|
39
|
+
```ts
|
|
40
|
+
type BrowserStorageOptions = LocalStorageOptions | CookieOptions;
|
|
41
|
+
|
|
42
|
+
interface LocalStorageOptions {
|
|
43
|
+
type: 'localStorage';
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
interface CookieOptions {
|
|
47
|
+
type: 'cookie';
|
|
48
|
+
path?: string;
|
|
49
|
+
domain?: string;
|
|
50
|
+
maxAge?: number;
|
|
51
|
+
sameSite?: 'strict' | 'lax' | 'none';
|
|
52
|
+
secure?: boolean;
|
|
53
|
+
}
|
|
54
|
+
```
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# converters
|
|
2
|
+
|
|
3
|
+
```ts
|
|
4
|
+
import { arrayAttrConverter, jsonAttrConverter, booleanAttrConverter, dateAttrConverter, urlAttrConverter } from '@iyulab/components';
|
|
5
|
+
```
|
|
6
|
+
|
|
7
|
+
Lit `@property` attribute converter factory functions. Pass these to the `converter` option to handle non-primitive attribute types automatically.
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
import { property } from 'lit/decorators.js';
|
|
13
|
+
import { arrayAttrConverter, jsonAttrConverter } from '@iyulab/components';
|
|
14
|
+
|
|
15
|
+
class MyElement extends LitElement {
|
|
16
|
+
@property({ converter: arrayAttrConverter() })
|
|
17
|
+
tags: string[] = [];
|
|
18
|
+
|
|
19
|
+
@property({ converter: jsonAttrConverter<{ x: number }>() })
|
|
20
|
+
config?: { x: number };
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
```html
|
|
25
|
+
<!-- Array: comma-separated string ↔ string[] -->
|
|
26
|
+
<my-element tags="a,b,c"></my-element>
|
|
27
|
+
|
|
28
|
+
<!-- JSON: JSON string ↔ object -->
|
|
29
|
+
<my-element config='{"x":42}'></my-element>
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## API
|
|
33
|
+
|
|
34
|
+
| Function | Converts | Description |
|
|
35
|
+
|----------|----------|-------------|
|
|
36
|
+
| `arrayAttrConverter(parser?, separator?)` | `string ↔ T[]` | Comma-separated (or custom separator) string to array |
|
|
37
|
+
| `jsonAttrConverter(parser?)` | `string ↔ T` | JSON string to object |
|
|
38
|
+
| `booleanAttrConverter()` | `string ↔ boolean` | Empty string / null to boolean |
|
|
39
|
+
| `dateAttrConverter(parser?)` | `string ↔ Date` | ISO 8601 string to `Date` |
|
|
40
|
+
| `urlAttrConverter(parser?)` | `string ↔ URL` | URL string to `URL` object |
|
|
41
|
+
|
|
42
|
+
All converters accept an optional `parser` function for custom transformation logic.
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Dialog (utility)
|
|
2
|
+
|
|
3
|
+
```ts
|
|
4
|
+
import { Dialog } from '@iyulab/components';
|
|
5
|
+
```
|
|
6
|
+
|
|
7
|
+
Programmatically open alert, confirm, and prompt dialogs without manually creating `u-dialog` elements.
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
// Alert — await until dismissed
|
|
13
|
+
await Dialog.alert('Operation completed.');
|
|
14
|
+
|
|
15
|
+
// Confirm — returns true/false
|
|
16
|
+
const confirmed = await Dialog.confirm('Delete this item?');
|
|
17
|
+
if (confirmed) deleteItem();
|
|
18
|
+
|
|
19
|
+
// Prompt — returns entered string or null if cancelled
|
|
20
|
+
const name = await Dialog.prompt('Enter your name:', { default: 'Alice' });
|
|
21
|
+
|
|
22
|
+
// Custom dialog with action buttons
|
|
23
|
+
const result = await Dialog.show({
|
|
24
|
+
title: 'Choose an option',
|
|
25
|
+
content: 'Which plan do you want?',
|
|
26
|
+
actions: [
|
|
27
|
+
{ label: 'Free', value: 'free' },
|
|
28
|
+
{ label: 'Pro', value: 'pro', variant: 'solid' }
|
|
29
|
+
]
|
|
30
|
+
});
|
|
31
|
+
// result = 'free' | 'pro' | null (if closed without selecting)
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## API
|
|
35
|
+
|
|
36
|
+
| Method | Returns | Description |
|
|
37
|
+
|--------|---------|-------------|
|
|
38
|
+
| `Dialog.alert(message, options?)` | `Promise<void>` | Informational alert |
|
|
39
|
+
| `Dialog.confirm(message, options?)` | `Promise<boolean>` | Confirm / Cancel dialog |
|
|
40
|
+
| `Dialog.prompt(message, options?)` | `Promise<string \| null>` | Text input dialog |
|
|
41
|
+
| `Dialog.show(options)` | `Promise<string \| null>` | Custom dialog; resolves with clicked action `value` |
|
|
42
|
+
|
|
43
|
+
## Types
|
|
44
|
+
|
|
45
|
+
```ts
|
|
46
|
+
interface DialogOptions {
|
|
47
|
+
target?: HTMLElement;
|
|
48
|
+
title?: string;
|
|
49
|
+
closable?: boolean;
|
|
50
|
+
placement?: DialogPlacement;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
interface ConfirmDialogOptions extends DialogOptions {
|
|
54
|
+
confirmLabel?: string;
|
|
55
|
+
cancelLabel?: string;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
interface PromptDialogOptions extends DialogOptions {
|
|
59
|
+
default?: string;
|
|
60
|
+
placeholder?: string;
|
|
61
|
+
confirmLabel?: string;
|
|
62
|
+
cancelLabel?: string;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
interface CustomDialogOptions extends DialogOptions {
|
|
66
|
+
content?: string | HTMLElement | TemplateResult;
|
|
67
|
+
actions?: DialogAction[];
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
interface DialogAction {
|
|
71
|
+
label: string;
|
|
72
|
+
value: string;
|
|
73
|
+
variant?: ButtonVariant;
|
|
74
|
+
}
|
|
75
|
+
```
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# elements
|
|
2
|
+
|
|
3
|
+
```ts
|
|
4
|
+
import { getParentElement, querySelectorWithin, querySelectorAllWithin, buildElementHTML } from '@iyulab/components';
|
|
5
|
+
```
|
|
6
|
+
|
|
7
|
+
Shadow-DOM-aware DOM utility helpers.
|
|
8
|
+
|
|
9
|
+
## Functions
|
|
10
|
+
|
|
11
|
+
### `getParentElement(element)`
|
|
12
|
+
|
|
13
|
+
Traverses up the DOM, crossing shadow root boundaries.
|
|
14
|
+
Returns the host element of a shadow root when the parent is a `ShadowRoot`.
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
const parent = getParentElement(myElement);
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
### `querySelectorWithin(element, selector)`
|
|
23
|
+
|
|
24
|
+
Queries within the same root (shadow root or document) as `element`.
|
|
25
|
+
Avoids leaking queries across shadow boundaries.
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
const btn = querySelectorWithin(this, '#submit');
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
### `querySelectorAllWithin(element, selector)`
|
|
34
|
+
|
|
35
|
+
Same as `querySelectorWithin` but returns all matches.
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
const inputs = querySelectorAllWithin(this, 'u-input');
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
### `buildElementHTML(tag, attrs, content?)`
|
|
44
|
+
|
|
45
|
+
Builds an XSS-safe custom element HTML string. All attribute values and content are sanitized.
|
|
46
|
+
|
|
47
|
+
```ts
|
|
48
|
+
const html = buildElementHTML('u-alert', {
|
|
49
|
+
status: 'success',
|
|
50
|
+
open: '',
|
|
51
|
+
}, 'File saved.');
|
|
52
|
+
// → '<u-alert status="success" open="">File saved.</u-alert>'
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
> Use this when dynamically constructing HTML strings for `innerHTML` or server-side rendering.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# IconRegistry
|
|
2
|
+
|
|
3
|
+
```ts
|
|
4
|
+
import { IconRegistry, getDefaultBaseUrl, setDefaultBaseUrl } from '@iyulab/components';
|
|
5
|
+
```
|
|
6
|
+
|
|
7
|
+
Manages icon library resolvers. Built-in libraries (`internal`, `tabler`, `heroicons`, `lucide`, `bootstrap`) are pre-registered.
|
|
8
|
+
|
|
9
|
+
## Base URL
|
|
10
|
+
|
|
11
|
+
Icons served from the file system use a configurable base path (default: `/assets/icons/`).
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
setDefaultBaseUrl('/static/icons/'); // change base URL
|
|
15
|
+
getDefaultBaseUrl(); // get current base URL
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Register a custom library
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
IconRegistry.register('my-icons', async (name: string) => {
|
|
22
|
+
const res = await fetch(`/icons/${name}.svg`);
|
|
23
|
+
return res.ok ? res.text() : undefined;
|
|
24
|
+
});
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## API
|
|
28
|
+
|
|
29
|
+
| Method | Description |
|
|
30
|
+
|--------|-------------|
|
|
31
|
+
| `IconRegistry.register(lib, resolver)` | Register an icon library |
|
|
32
|
+
| `IconRegistry.unregister(lib)` | Remove a library |
|
|
33
|
+
| `IconRegistry.has(lib)` | Check if a library is registered |
|
|
34
|
+
| `IconRegistry.resolve(lib, name)` | `Promise<string \| undefined>` — resolve SVG source |
|
|
35
|
+
|
|
36
|
+
## Built-in Libraries
|
|
37
|
+
|
|
38
|
+
| `lib` | Style variants | CDN version |
|
|
39
|
+
|-------|----------------|-------------|
|
|
40
|
+
| `internal` | (bundled) | — |
|
|
41
|
+
| `tabler` | `name` / `name:filled` | 3.40.0 |
|
|
42
|
+
| `heroicons` | `name` / `name:solid` | 2.2.0 |
|
|
43
|
+
| `lucide` | `name` | 0.503.0 |
|
|
44
|
+
| `bootstrap` | `name` / `name:filled` | 1.11.3 |
|
|
45
|
+
|
|
46
|
+
## Caching
|
|
47
|
+
|
|
48
|
+
Resolved SVGs are cached by `lib:name` key. The cache persists for the lifetime of the page.
|
|
49
|
+
|
|
50
|
+
```ts
|
|
51
|
+
// Internal cache is managed automatically; manual access is rarely needed.
|
|
52
|
+
// IconCache.clear(); // clears all cached entries
|
|
53
|
+
```
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# OverlayManager
|
|
2
|
+
|
|
3
|
+
```ts
|
|
4
|
+
import { OverlayManager } from '@iyulab/components';
|
|
5
|
+
```
|
|
6
|
+
|
|
7
|
+
Internal static manager for the overlay stack. Used by `UOverlayElement` (`u-dialog`, `u-drawer`) to track open overlays, assign z-index, and manage body scroll locking.
|
|
8
|
+
|
|
9
|
+
> **Note:** You generally do not need to use `OverlayManager` directly. It is called automatically by overlay components. Only use it if you are building a custom overlay component that extends `UOverlayElement`.
|
|
10
|
+
|
|
11
|
+
## API
|
|
12
|
+
|
|
13
|
+
| Member | Type / Returns | Description |
|
|
14
|
+
|--------|----------------|-------------|
|
|
15
|
+
| `OverlayManager.add(overlay, lockBody?)` | `void` | Register an overlay; increments z-index; optionally locks body scroll |
|
|
16
|
+
| `OverlayManager.remove(overlay, lockBody?)` | `void` | Unregister an overlay; releases scroll lock if no overlays remain |
|
|
17
|
+
| `OverlayManager.isTopmost(overlay)` | `boolean` | Returns `true` if the overlay is the topmost in the stack (used for ESC key handling) |
|
|
18
|
+
| `OverlayManager.size` | `number` | Number of currently open overlays |
|
|
19
|
+
| `OverlayManager.trapStack` | `FocusTrap[]` | Shared focus-trap stack (used internally by focus-trap library) |
|
|
20
|
+
|
|
21
|
+
## Example (custom overlay)
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
import { UOverlayElement } from '@iyulab/components';
|
|
25
|
+
|
|
26
|
+
class MyOverlay extends UOverlayElement {
|
|
27
|
+
// UOverlayElement already calls OverlayManager.add/remove internally
|
|
28
|
+
// Override requestClose() if you need custom close logic
|
|
29
|
+
override requestClose(source: string) {
|
|
30
|
+
if (source === 'backdrop' && this.hasUnsavedChanges) return;
|
|
31
|
+
super.requestClose(source);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
```
|