shared-lib-web 0.0.0-stage → 0.0.2
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/CODING_RULES.md +118 -0
- package/LICENSE +21 -0
- package/README.md +630 -2
- package/dist/components/app-brand.d.ts +9 -0
- package/dist/components/app-brand.d.ts.map +1 -0
- package/dist/components/app-brand.js +23 -0
- package/dist/components/app-brand.js.map +1 -0
- package/dist/components/branch-switcher.d.ts +7 -0
- package/dist/components/branch-switcher.d.ts.map +1 -0
- package/dist/components/branch-switcher.js +37 -0
- package/dist/components/branch-switcher.js.map +1 -0
- package/dist/components/coming-soon.d.ts +6 -0
- package/dist/components/coming-soon.d.ts.map +1 -0
- package/dist/components/coming-soon.js +19 -0
- package/dist/components/coming-soon.js.map +1 -0
- package/dist/components/empty-state.d.ts +15 -0
- package/dist/components/empty-state.d.ts.map +1 -0
- package/dist/components/empty-state.js +14 -0
- package/dist/components/empty-state.js.map +1 -0
- package/dist/components/language-switcher.d.ts +8 -0
- package/dist/components/language-switcher.d.ts.map +1 -0
- package/dist/components/language-switcher.js +48 -0
- package/dist/components/language-switcher.js.map +1 -0
- package/dist/components/page-loader.d.ts +2 -0
- package/dist/components/page-loader.d.ts.map +1 -0
- package/dist/components/page-loader.js +8 -0
- package/dist/components/page-loader.js.map +1 -0
- package/dist/components/page-not-found.d.ts +2 -0
- package/dist/components/page-not-found.d.ts.map +1 -0
- package/dist/components/page-not-found.js +18 -0
- package/dist/components/page-not-found.js.map +1 -0
- package/dist/components/permission-denied.d.ts +2 -0
- package/dist/components/permission-denied.d.ts.map +1 -0
- package/dist/components/permission-denied.js +12 -0
- package/dist/components/permission-denied.js.map +1 -0
- package/dist/components/require-access.d.ts +11 -0
- package/dist/components/require-access.d.ts.map +1 -0
- package/dist/components/require-access.js +15 -0
- package/dist/components/require-access.js.map +1 -0
- package/dist/components/scroll-to-top.d.ts +12 -0
- package/dist/components/scroll-to-top.d.ts.map +1 -0
- package/dist/components/scroll-to-top.js +42 -0
- package/dist/components/scroll-to-top.js.map +1 -0
- package/dist/components/settings-menu.d.ts +17 -0
- package/dist/components/settings-menu.d.ts.map +1 -0
- package/dist/components/settings-menu.js +102 -0
- package/dist/components/settings-menu.js.map +1 -0
- package/dist/components/theme-switcher.d.ts +5 -0
- package/dist/components/theme-switcher.d.ts.map +1 -0
- package/dist/components/theme-switcher.js +33 -0
- package/dist/components/theme-switcher.js.map +1 -0
- package/dist/components/toast-container.d.ts +5 -0
- package/dist/components/toast-container.d.ts.map +1 -0
- package/dist/components/toast-container.js +51 -0
- package/dist/components/toast-container.js.map +1 -0
- package/dist/components/top-progress.d.ts +2 -0
- package/dist/components/top-progress.d.ts.map +1 -0
- package/dist/components/top-progress.js +14 -0
- package/dist/components/top-progress.js.map +1 -0
- package/dist/components/user-menu.d.ts +26 -0
- package/dist/components/user-menu.d.ts.map +1 -0
- package/dist/components/user-menu.js +85 -0
- package/dist/components/user-menu.js.map +1 -0
- package/dist/context/ui-context.d.ts +5 -0
- package/dist/context/ui-context.d.ts.map +1 -0
- package/dist/context/ui-context.js +16 -0
- package/dist/context/ui-context.js.map +1 -0
- package/dist/context/use-ui.d.ts +3 -0
- package/dist/context/use-ui.d.ts.map +1 -0
- package/dist/context/use-ui.js +39 -0
- package/dist/context/use-ui.js.map +1 -0
- package/dist/i18n/default-messages.d.ts +5 -0
- package/dist/i18n/default-messages.d.ts.map +1 -0
- package/dist/i18n/default-messages.js +64 -0
- package/dist/i18n/default-messages.js.map +1 -0
- package/dist/i18n/direction.d.ts +10 -0
- package/dist/i18n/direction.d.ts.map +1 -0
- package/dist/i18n/direction.js +35 -0
- package/dist/i18n/direction.js.map +1 -0
- package/dist/i18n/locale-service.d.ts +36 -0
- package/dist/i18n/locale-service.d.ts.map +1 -0
- package/dist/i18n/locale-service.js +163 -0
- package/dist/i18n/locale-service.js.map +1 -0
- package/dist/i18n/translator.d.ts +14 -0
- package/dist/i18n/translator.d.ts.map +1 -0
- package/dist/i18n/translator.js +81 -0
- package/dist/i18n/translator.js.map +1 -0
- package/dist/index.d.ts +106 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +119 -0
- package/dist/index.js.map +1 -0
- package/dist/interfaces/app-types.d.ts +137 -0
- package/dist/interfaces/app-types.d.ts.map +1 -0
- package/dist/interfaces/app-types.js +5 -0
- package/dist/interfaces/app-types.js.map +1 -0
- package/dist/interfaces/toast.d.ts +9 -0
- package/dist/interfaces/toast.d.ts.map +1 -0
- package/dist/interfaces/toast.js +4 -0
- package/dist/interfaces/toast.js.map +1 -0
- package/dist/interfaces/ui-config.d.ts +172 -0
- package/dist/interfaces/ui-config.d.ts.map +1 -0
- package/dist/interfaces/ui-config.js +6 -0
- package/dist/interfaces/ui-config.js.map +1 -0
- package/dist/interfaces/ui-context.d.ts +37 -0
- package/dist/interfaces/ui-context.d.ts.map +1 -0
- package/dist/interfaces/ui-context.js +4 -0
- package/dist/interfaces/ui-context.js.map +1 -0
- package/dist/layout.d.ts +10 -0
- package/dist/layout.d.ts.map +1 -0
- package/dist/layout.js +22 -0
- package/dist/layout.js.map +1 -0
- package/dist/layouts/app-layout.d.ts +23 -0
- package/dist/layouts/app-layout.d.ts.map +1 -0
- package/dist/layouts/app-layout.js +52 -0
- package/dist/layouts/app-layout.js.map +1 -0
- package/dist/layouts/article-layout.d.ts +7 -0
- package/dist/layouts/article-layout.d.ts.map +1 -0
- package/dist/layouts/article-layout.js +8 -0
- package/dist/layouts/article-layout.js.map +1 -0
- package/dist/layouts/aside-layout.d.ts +27 -0
- package/dist/layouts/aside-layout.d.ts.map +1 -0
- package/dist/layouts/aside-layout.js +70 -0
- package/dist/layouts/aside-layout.js.map +1 -0
- package/dist/layouts/auth-layout.d.ts +7 -0
- package/dist/layouts/auth-layout.d.ts.map +1 -0
- package/dist/layouts/auth-layout.js +20 -0
- package/dist/layouts/auth-layout.js.map +1 -0
- package/dist/layouts/content-layout.d.ts +3 -0
- package/dist/layouts/content-layout.d.ts.map +1 -0
- package/dist/layouts/content-layout.js +10 -0
- package/dist/layouts/content-layout.js.map +1 -0
- package/dist/layouts/float-layout.d.ts +3 -0
- package/dist/layouts/float-layout.d.ts.map +1 -0
- package/dist/layouts/float-layout.js +10 -0
- package/dist/layouts/float-layout.js.map +1 -0
- package/dist/layouts/grid-layout.d.ts +3 -0
- package/dist/layouts/grid-layout.d.ts.map +1 -0
- package/dist/layouts/grid-layout.js +10 -0
- package/dist/layouts/grid-layout.js.map +1 -0
- package/dist/layouts/head-layout.d.ts +16 -0
- package/dist/layouts/head-layout.d.ts.map +1 -0
- package/dist/layouts/head-layout.js +36 -0
- package/dist/layouts/head-layout.js.map +1 -0
- package/dist/layouts/header.d.ts +18 -0
- package/dist/layouts/header.d.ts.map +1 -0
- package/dist/layouts/header.js +26 -0
- package/dist/layouts/header.js.map +1 -0
- package/dist/layouts/layout-constants.d.ts +3 -0
- package/dist/layouts/layout-constants.d.ts.map +1 -0
- package/dist/layouts/layout-constants.js +5 -0
- package/dist/layouts/layout-constants.js.map +1 -0
- package/dist/layouts/mega-menu.d.ts +3 -0
- package/dist/layouts/mega-menu.d.ts.map +1 -0
- package/dist/layouts/mega-menu.js +104 -0
- package/dist/layouts/mega-menu.js.map +1 -0
- package/dist/layouts/navigation.d.ts +11 -0
- package/dist/layouts/navigation.d.ts.map +1 -0
- package/dist/layouts/navigation.js +41 -0
- package/dist/layouts/navigation.js.map +1 -0
- package/dist/layouts/rail-flyout.d.ts +5 -0
- package/dist/layouts/rail-flyout.d.ts.map +1 -0
- package/dist/layouts/rail-flyout.js +49 -0
- package/dist/layouts/rail-flyout.js.map +1 -0
- package/dist/layouts/rail-tooltip.d.ts +8 -0
- package/dist/layouts/rail-tooltip.d.ts.map +1 -0
- package/dist/layouts/rail-tooltip.js +60 -0
- package/dist/layouts/rail-tooltip.js.map +1 -0
- package/dist/layouts/sidebar.d.ts +38 -0
- package/dist/layouts/sidebar.d.ts.map +1 -0
- package/dist/layouts/sidebar.js +137 -0
- package/dist/layouts/sidebar.js.map +1 -0
- package/dist/markdown.d.ts +4 -0
- package/dist/markdown.d.ts.map +1 -0
- package/dist/markdown.js +12 -0
- package/dist/markdown.js.map +1 -0
- package/dist/providers/provider-effects.d.ts +9 -0
- package/dist/providers/provider-effects.d.ts.map +1 -0
- package/dist/providers/provider-effects.js +26 -0
- package/dist/providers/provider-effects.js.map +1 -0
- package/dist/providers/register-config.d.ts +4 -0
- package/dist/providers/register-config.d.ts.map +1 -0
- package/dist/providers/register-config.js +28 -0
- package/dist/providers/register-config.js.map +1 -0
- package/dist/providers/shared-web-ui-provider.d.ts +31 -0
- package/dist/providers/shared-web-ui-provider.d.ts.map +1 -0
- package/dist/providers/shared-web-ui-provider.js +54 -0
- package/dist/providers/shared-web-ui-provider.js.map +1 -0
- package/dist/providers/theme-provider.d.ts +6 -0
- package/dist/providers/theme-provider.d.ts.map +1 -0
- package/dist/providers/theme-provider.js +11 -0
- package/dist/providers/theme-provider.js.map +1 -0
- package/dist/providers/translation-provider.d.ts +8 -0
- package/dist/providers/translation-provider.d.ts.map +1 -0
- package/dist/providers/translation-provider.js +21 -0
- package/dist/providers/translation-provider.js.map +1 -0
- package/dist/query/page-link.d.ts +20 -0
- package/dist/query/page-link.d.ts.map +1 -0
- package/dist/query/page-link.js +53 -0
- package/dist/query/page-link.js.map +1 -0
- package/dist/query/page-path.d.ts +5 -0
- package/dist/query/page-path.d.ts.map +1 -0
- package/dist/query/page-path.js +24 -0
- package/dist/query/page-path.js.map +1 -0
- package/dist/query/query-param.d.ts +63 -0
- package/dist/query/query-param.d.ts.map +1 -0
- package/dist/query/query-param.js +215 -0
- package/dist/query/query-param.js.map +1 -0
- package/dist/query/use-query-param.d.ts +5 -0
- package/dist/query/use-query-param.d.ts.map +1 -0
- package/dist/query/use-query-param.js +21 -0
- package/dist/query/use-query-param.js.map +1 -0
- package/dist/skeleton/skeleton-article.d.ts +2 -0
- package/dist/skeleton/skeleton-article.d.ts.map +1 -0
- package/dist/skeleton/skeleton-article.js +7 -0
- package/dist/skeleton/skeleton-article.js.map +1 -0
- package/dist/skeleton/skeleton-auth-form.d.ts +6 -0
- package/dist/skeleton/skeleton-auth-form.d.ts.map +1 -0
- package/dist/skeleton/skeleton-auth-form.js +9 -0
- package/dist/skeleton/skeleton-auth-form.js.map +1 -0
- package/dist/skeleton/skeleton-cards.d.ts +6 -0
- package/dist/skeleton/skeleton-cards.d.ts.map +1 -0
- package/dist/skeleton/skeleton-cards.js +16 -0
- package/dist/skeleton/skeleton-cards.js.map +1 -0
- package/dist/skeleton/skeleton-chat.d.ts +2 -0
- package/dist/skeleton/skeleton-chat.d.ts.map +1 -0
- package/dist/skeleton/skeleton-chat.js +17 -0
- package/dist/skeleton/skeleton-chat.js.map +1 -0
- package/dist/skeleton/skeleton-dashboard.d.ts +2 -0
- package/dist/skeleton/skeleton-dashboard.d.ts.map +1 -0
- package/dist/skeleton/skeleton-dashboard.js +16 -0
- package/dist/skeleton/skeleton-dashboard.js.map +1 -0
- package/dist/skeleton/skeleton-float.d.ts +2 -0
- package/dist/skeleton/skeleton-float.d.ts.map +1 -0
- package/dist/skeleton/skeleton-float.js +7 -0
- package/dist/skeleton/skeleton-float.js.map +1 -0
- package/dist/skeleton/skeleton-form.d.ts +10 -0
- package/dist/skeleton/skeleton-form.d.ts.map +1 -0
- package/dist/skeleton/skeleton-form.js +16 -0
- package/dist/skeleton/skeleton-form.js.map +1 -0
- package/dist/skeleton/skeleton-menu.d.ts +2 -0
- package/dist/skeleton/skeleton-menu.d.ts.map +1 -0
- package/dist/skeleton/skeleton-menu.js +16 -0
- package/dist/skeleton/skeleton-menu.js.map +1 -0
- package/dist/skeleton/skeleton-page.d.ts +2 -0
- package/dist/skeleton/skeleton-page.d.ts.map +1 -0
- package/dist/skeleton/skeleton-page.js +9 -0
- package/dist/skeleton/skeleton-page.js.map +1 -0
- package/dist/skeleton/skeleton-table.d.ts +2 -0
- package/dist/skeleton/skeleton-table.d.ts.map +1 -0
- package/dist/skeleton/skeleton-table.js +16 -0
- package/dist/skeleton/skeleton-table.js.map +1 -0
- package/dist/state/auth-service.d.ts +28 -0
- package/dist/state/auth-service.d.ts.map +1 -0
- package/dist/state/auth-service.js +92 -0
- package/dist/state/auth-service.js.map +1 -0
- package/dist/state/branch-service.d.ts +42 -0
- package/dist/state/branch-service.d.ts.map +1 -0
- package/dist/state/branch-service.js +193 -0
- package/dist/state/branch-service.js.map +1 -0
- package/dist/state/document-sync.d.ts +7 -0
- package/dist/state/document-sync.d.ts.map +1 -0
- package/dist/state/document-sync.js +39 -0
- package/dist/state/document-sync.js.map +1 -0
- package/dist/state/language-service.d.ts +16 -0
- package/dist/state/language-service.d.ts.map +1 -0
- package/dist/state/language-service.js +73 -0
- package/dist/state/language-service.js.map +1 -0
- package/dist/state/menu-service.d.ts +20 -0
- package/dist/state/menu-service.d.ts.map +1 -0
- package/dist/state/menu-service.js +59 -0
- package/dist/state/menu-service.js.map +1 -0
- package/dist/state/navigation-service.d.ts +37 -0
- package/dist/state/navigation-service.d.ts.map +1 -0
- package/dist/state/navigation-service.js +131 -0
- package/dist/state/navigation-service.js.map +1 -0
- package/dist/state/preference-sync.d.ts +15 -0
- package/dist/state/preference-sync.d.ts.map +1 -0
- package/dist/state/preference-sync.js +85 -0
- package/dist/state/preference-sync.js.map +1 -0
- package/dist/state/progress-service.d.ts +3 -0
- package/dist/state/progress-service.d.ts.map +1 -0
- package/dist/state/progress-service.js +17 -0
- package/dist/state/progress-service.js.map +1 -0
- package/dist/state/screen-access.d.ts +15 -0
- package/dist/state/screen-access.d.ts.map +1 -0
- package/dist/state/screen-access.js +60 -0
- package/dist/state/screen-access.js.map +1 -0
- package/dist/state/sidebar-service.d.ts +8 -0
- package/dist/state/sidebar-service.d.ts.map +1 -0
- package/dist/state/sidebar-service.js +18 -0
- package/dist/state/sidebar-service.js.map +1 -0
- package/dist/state/signals.d.ts +84 -0
- package/dist/state/signals.d.ts.map +1 -0
- package/dist/state/signals.js +137 -0
- package/dist/state/signals.js.map +1 -0
- package/dist/state/toast-service.d.ts +9 -0
- package/dist/state/toast-service.d.ts.map +1 -0
- package/dist/state/toast-service.js +36 -0
- package/dist/state/toast-service.js.map +1 -0
- package/dist/styles.css +15 -0
- package/dist/theme/dark-themes.d.ts +2 -0
- package/dist/theme/dark-themes.d.ts.map +1 -0
- package/dist/theme/dark-themes.js +20 -0
- package/dist/theme/dark-themes.js.map +1 -0
- package/dist/theme/logo.d.ts +4 -0
- package/dist/theme/logo.d.ts.map +1 -0
- package/dist/theme/logo.js +10 -0
- package/dist/theme/logo.js.map +1 -0
- package/dist/theme/theme-service.d.ts +21 -0
- package/dist/theme/theme-service.d.ts.map +1 -0
- package/dist/theme/theme-service.js +69 -0
- package/dist/theme/theme-service.js.map +1 -0
- package/dist/types/class-names.d.ts +9 -0
- package/dist/types/class-names.d.ts.map +1 -0
- package/dist/types/class-names.js +45 -0
- package/dist/types/class-names.js.map +1 -0
- package/dist/types/field-error.d.ts +5 -0
- package/dist/types/field-error.d.ts.map +1 -0
- package/dist/types/field-error.js +16 -0
- package/dist/types/field-error.js.map +1 -0
- package/dist/types/field-props.d.ts +20 -0
- package/dist/types/field-props.d.ts.map +1 -0
- package/dist/types/field-props.js +4 -0
- package/dist/types/field-props.js.map +1 -0
- package/dist/types/field-registry.d.ts +11 -0
- package/dist/types/field-registry.d.ts.map +1 -0
- package/dist/types/field-registry.js +18 -0
- package/dist/types/field-registry.js.map +1 -0
- package/dist/types/field-wrapper.d.ts +13 -0
- package/dist/types/field-wrapper.d.ts.map +1 -0
- package/dist/types/field-wrapper.js +16 -0
- package/dist/types/field-wrapper.js.map +1 -0
- package/dist/types/lang-field.d.ts +15 -0
- package/dist/types/lang-field.d.ts.map +1 -0
- package/dist/types/lang-field.js +68 -0
- package/dist/types/lang-field.js.map +1 -0
- package/dist/types/markdown-color-mode.d.ts +7 -0
- package/dist/types/markdown-color-mode.d.ts.map +1 -0
- package/dist/types/markdown-color-mode.js +11 -0
- package/dist/types/markdown-color-mode.js.map +1 -0
- package/dist/types/media-service.d.ts +24 -0
- package/dist/types/media-service.d.ts.map +1 -0
- package/dist/types/media-service.js +41 -0
- package/dist/types/media-service.js.map +1 -0
- package/dist/types/media-viewer.d.ts +2 -0
- package/dist/types/media-viewer.d.ts.map +1 -0
- package/dist/types/media-viewer.js +23 -0
- package/dist/types/media-viewer.js.map +1 -0
- package/dist/types/type.button.d.ts +36 -0
- package/dist/types/type.button.d.ts.map +1 -0
- package/dist/types/type.button.js +27 -0
- package/dist/types/type.button.js.map +1 -0
- package/dist/types/type.checkbox.d.ts +5 -0
- package/dist/types/type.checkbox.d.ts.map +1 -0
- package/dist/types/type.checkbox.js +26 -0
- package/dist/types/type.checkbox.js.map +1 -0
- package/dist/types/type.confirm.d.ts +19 -0
- package/dist/types/type.confirm.d.ts.map +1 -0
- package/dist/types/type.confirm.js +15 -0
- package/dist/types/type.confirm.js.map +1 -0
- package/dist/types/type.date.d.ts +16 -0
- package/dist/types/type.date.d.ts.map +1 -0
- package/dist/types/type.date.js +65 -0
- package/dist/types/type.date.js.map +1 -0
- package/dist/types/type.drawer.d.ts +20 -0
- package/dist/types/type.drawer.d.ts.map +1 -0
- package/dist/types/type.drawer.js +31 -0
- package/dist/types/type.drawer.js.map +1 -0
- package/dist/types/type.dropdown.d.ts +23 -0
- package/dist/types/type.dropdown.d.ts.map +1 -0
- package/dist/types/type.dropdown.js +34 -0
- package/dist/types/type.dropdown.js.map +1 -0
- package/dist/types/type.filter.d.ts +17 -0
- package/dist/types/type.filter.d.ts.map +1 -0
- package/dist/types/type.filter.js +28 -0
- package/dist/types/type.filter.js.map +1 -0
- package/dist/types/type.icon.d.ts +21 -0
- package/dist/types/type.icon.d.ts.map +1 -0
- package/dist/types/type.icon.js +24 -0
- package/dist/types/type.icon.js.map +1 -0
- package/dist/types/type.image.d.ts +34 -0
- package/dist/types/type.image.d.ts.map +1 -0
- package/dist/types/type.image.js +46 -0
- package/dist/types/type.image.js.map +1 -0
- package/dist/types/type.input.d.ts +13 -0
- package/dist/types/type.input.d.ts.map +1 -0
- package/dist/types/type.input.js +29 -0
- package/dist/types/type.input.js.map +1 -0
- package/dist/types/type.lang-md.d.ts +10 -0
- package/dist/types/type.lang-md.d.ts.map +1 -0
- package/dist/types/type.lang-md.js +56 -0
- package/dist/types/type.lang-md.js.map +1 -0
- package/dist/types/type.lang.d.ts +11 -0
- package/dist/types/type.lang.d.ts.map +1 -0
- package/dist/types/type.lang.js +56 -0
- package/dist/types/type.lang.js.map +1 -0
- package/dist/types/type.list.d.ts +13 -0
- package/dist/types/type.list.d.ts.map +1 -0
- package/dist/types/type.list.js +42 -0
- package/dist/types/type.list.js.map +1 -0
- package/dist/types/type.mdv.d.ts +10 -0
- package/dist/types/type.mdv.d.ts.map +1 -0
- package/dist/types/type.mdv.js +22 -0
- package/dist/types/type.mdv.js.map +1 -0
- package/dist/types/type.mdx.d.ts +10 -0
- package/dist/types/type.mdx.d.ts.map +1 -0
- package/dist/types/type.mdx.js +30 -0
- package/dist/types/type.mdx.js.map +1 -0
- package/dist/types/type.modal.d.ts +18 -0
- package/dist/types/type.modal.d.ts.map +1 -0
- package/dist/types/type.modal.js +30 -0
- package/dist/types/type.modal.js.map +1 -0
- package/dist/types/type.otp.d.ts +8 -0
- package/dist/types/type.otp.d.ts.map +1 -0
- package/dist/types/type.otp.js +48 -0
- package/dist/types/type.otp.js.map +1 -0
- package/dist/types/type.search.d.ts +16 -0
- package/dist/types/type.search.d.ts.map +1 -0
- package/dist/types/type.search.js +48 -0
- package/dist/types/type.search.js.map +1 -0
- package/dist/types/type.select.d.ts +14 -0
- package/dist/types/type.select.d.ts.map +1 -0
- package/dist/types/type.select.js +53 -0
- package/dist/types/type.select.js.map +1 -0
- package/dist/types/type.switch.d.ts +8 -0
- package/dist/types/type.switch.d.ts.map +1 -0
- package/dist/types/type.switch.js +26 -0
- package/dist/types/type.switch.js.map +1 -0
- package/dist/types/type.table.d.ts +28 -0
- package/dist/types/type.table.d.ts.map +1 -0
- package/dist/types/type.table.js +72 -0
- package/dist/types/type.table.js.map +1 -0
- package/dist/types/type.text-area.d.ts +9 -0
- package/dist/types/type.text-area.d.ts.map +1 -0
- package/dist/types/type.text-area.js +26 -0
- package/dist/types/type.text-area.js.map +1 -0
- package/dist/types/type.time.d.ts +9 -0
- package/dist/types/type.time.d.ts.map +1 -0
- package/dist/types/type.time.js +34 -0
- package/dist/types/type.time.js.map +1 -0
- package/dist/types/type.upload.d.ts +45 -0
- package/dist/types/type.upload.d.ts.map +1 -0
- package/dist/types/type.upload.js +90 -0
- package/dist/types/type.upload.js.map +1 -0
- package/dist/types/type.video.d.ts +19 -0
- package/dist/types/type.video.d.ts.map +1 -0
- package/dist/types/type.video.js +33 -0
- package/dist/types/type.video.js.map +1 -0
- package/dist/types/upload-service.d.ts +47 -0
- package/dist/types/upload-service.d.ts.map +1 -0
- package/dist/types/upload-service.js +191 -0
- package/dist/types/upload-service.js.map +1 -0
- package/dist/utils/app-config.d.ts +6 -0
- package/dist/utils/app-config.d.ts.map +1 -0
- package/dist/utils/app-config.js +17 -0
- package/dist/utils/app-config.js.map +1 -0
- package/dist/utils/app-http.d.ts +49 -0
- package/dist/utils/app-http.d.ts.map +1 -0
- package/dist/utils/app-http.js +229 -0
- package/dist/utils/app-http.js.map +1 -0
- package/dist/utils/app-storage.d.ts +56 -0
- package/dist/utils/app-storage.d.ts.map +1 -0
- package/dist/utils/app-storage.js +236 -0
- package/dist/utils/app-storage.js.map +1 -0
- package/dist/utils/crypto-util.d.ts +15 -0
- package/dist/utils/crypto-util.d.ts.map +1 -0
- package/dist/utils/crypto-util.js +76 -0
- package/dist/utils/crypto-util.js.map +1 -0
- package/dist/utils/event-util.d.ts +16 -0
- package/dist/utils/event-util.d.ts.map +1 -0
- package/dist/utils/event-util.js +51 -0
- package/dist/utils/event-util.js.map +1 -0
- package/dist/utils/file-util.d.ts +30 -0
- package/dist/utils/file-util.d.ts.map +1 -0
- package/dist/utils/file-util.js +165 -0
- package/dist/utils/file-util.js.map +1 -0
- package/dist/utils/lang-util.d.ts +12 -0
- package/dist/utils/lang-util.d.ts.map +1 -0
- package/dist/utils/lang-util.js +53 -0
- package/dist/utils/lang-util.js.map +1 -0
- package/dist/utils/language-util.d.ts +21 -0
- package/dist/utils/language-util.d.ts.map +1 -0
- package/dist/utils/language-util.js +96 -0
- package/dist/utils/language-util.js.map +1 -0
- package/dist/utils/leave-guard.d.ts +5 -0
- package/dist/utils/leave-guard.d.ts.map +1 -0
- package/dist/utils/leave-guard.js +24 -0
- package/dist/utils/leave-guard.js.map +1 -0
- package/dist/utils/lucide-icon.d.ts +10 -0
- package/dist/utils/lucide-icon.d.ts.map +1 -0
- package/dist/utils/lucide-icon.js +48 -0
- package/dist/utils/lucide-icon.js.map +1 -0
- package/dist/utils/menu-util.d.ts +33 -0
- package/dist/utils/menu-util.d.ts.map +1 -0
- package/dist/utils/menu-util.js +151 -0
- package/dist/utils/menu-util.js.map +1 -0
- package/dist/utils/option-util.d.ts +21 -0
- package/dist/utils/option-util.d.ts.map +1 -0
- package/dist/utils/option-util.js +101 -0
- package/dist/utils/option-util.js.map +1 -0
- package/dist/utils/session-id.d.ts +5 -0
- package/dist/utils/session-id.d.ts.map +1 -0
- package/dist/utils/session-id.js +44 -0
- package/dist/utils/session-id.js.map +1 -0
- package/dist/utils/shared-regexp.d.ts +31 -0
- package/dist/utils/shared-regexp.d.ts.map +1 -0
- package/dist/utils/shared-regexp.js +17 -0
- package/dist/utils/shared-regexp.js.map +1 -0
- package/dist/utils/storage-keys.d.ts +68 -0
- package/dist/utils/storage-keys.d.ts.map +1 -0
- package/dist/utils/storage-keys.js +75 -0
- package/dist/utils/storage-keys.js.map +1 -0
- package/package.json +101 -4
- package/src/components/app-brand.tsx +37 -0
- package/src/components/branch-switcher.tsx +74 -0
- package/src/components/coming-soon.tsx +35 -0
- package/src/components/empty-state.tsx +42 -0
- package/src/components/language-switcher.tsx +77 -0
- package/src/components/page-loader.tsx +11 -0
- package/src/components/page-not-found.tsx +42 -0
- package/src/components/permission-denied.tsx +21 -0
- package/src/components/require-access.tsx +30 -0
- package/src/components/scroll-to-top.tsx +62 -0
- package/src/components/settings-menu.tsx +224 -0
- package/src/components/theme-switcher.tsx +72 -0
- package/src/components/toast-container.tsx +73 -0
- package/src/components/top-progress.tsx +14 -0
- package/src/components/user-menu.tsx +179 -0
- package/src/context/ui-context.ts +20 -0
- package/src/context/use-ui.ts +42 -0
- package/src/i18n/default-messages.ts +67 -0
- package/src/i18n/direction.ts +43 -0
- package/src/i18n/locale-service.ts +187 -0
- package/src/i18n/translator.ts +88 -0
- package/src/index.ts +341 -0
- package/src/interfaces/app-types.ts +154 -0
- package/src/interfaces/toast.ts +12 -0
- package/src/interfaces/ui-config.ts +189 -0
- package/src/interfaces/ui-context.ts +43 -0
- package/src/layout.ts +29 -0
- package/src/layouts/app-layout.tsx +103 -0
- package/src/layouts/article-layout.tsx +16 -0
- package/src/layouts/aside-layout.tsx +118 -0
- package/src/layouts/auth-layout.tsx +41 -0
- package/src/layouts/content-layout.tsx +11 -0
- package/src/layouts/float-layout.tsx +11 -0
- package/src/layouts/grid-layout.tsx +11 -0
- package/src/layouts/head-layout.tsx +61 -0
- package/src/layouts/header.tsx +74 -0
- package/src/layouts/layout-constants.ts +5 -0
- package/src/layouts/mega-menu.tsx +203 -0
- package/src/layouts/navigation.ts +45 -0
- package/src/layouts/rail-flyout.tsx +77 -0
- package/src/layouts/rail-tooltip.tsx +77 -0
- package/src/layouts/sidebar.tsx +296 -0
- package/src/markdown.ts +12 -0
- package/src/providers/provider-effects.ts +30 -0
- package/src/providers/register-config.ts +30 -0
- package/src/providers/shared-web-ui-provider.tsx +98 -0
- package/src/providers/theme-provider.tsx +15 -0
- package/src/providers/translation-provider.tsx +28 -0
- package/src/query/page-link.tsx +84 -0
- package/src/query/page-path.ts +26 -0
- package/src/query/query-param.ts +263 -0
- package/src/query/use-query-param.ts +23 -0
- package/src/skeleton/skeleton-article.tsx +11 -0
- package/src/skeleton/skeleton-auth-form.tsx +20 -0
- package/src/skeleton/skeleton-cards.tsx +35 -0
- package/src/skeleton/skeleton-chat.tsx +34 -0
- package/src/skeleton/skeleton-dashboard.tsx +34 -0
- package/src/skeleton/skeleton-float.tsx +10 -0
- package/src/skeleton/skeleton-form.tsx +45 -0
- package/src/skeleton/skeleton-menu.tsx +30 -0
- package/src/skeleton/skeleton-page.tsx +18 -0
- package/src/skeleton/skeleton-table.tsx +25 -0
- package/src/state/auth-service.ts +104 -0
- package/src/state/branch-service.ts +217 -0
- package/src/state/document-sync.ts +43 -0
- package/src/state/language-service.ts +80 -0
- package/src/state/menu-service.ts +67 -0
- package/src/state/navigation-service.ts +160 -0
- package/src/state/preference-sync.ts +93 -0
- package/src/state/progress-service.ts +18 -0
- package/src/state/screen-access.ts +70 -0
- package/src/state/sidebar-service.ts +22 -0
- package/src/state/signals.ts +183 -0
- package/src/state/toast-service.ts +45 -0
- package/src/styles.css +15 -0
- package/src/theme/dark-themes.ts +20 -0
- package/src/theme/logo.ts +12 -0
- package/src/theme/theme-service.ts +82 -0
- package/src/types/class-names.ts +53 -0
- package/src/types/field-error.ts +19 -0
- package/src/types/field-props.ts +23 -0
- package/src/types/field-registry.ts +27 -0
- package/src/types/field-wrapper.tsx +42 -0
- package/src/types/lang-field.ts +71 -0
- package/src/types/markdown-color-mode.ts +13 -0
- package/src/types/media-service.ts +61 -0
- package/src/types/media-viewer.tsx +57 -0
- package/src/types/type.button.tsx +108 -0
- package/src/types/type.checkbox.tsx +49 -0
- package/src/types/type.confirm.tsx +50 -0
- package/src/types/type.date.tsx +97 -0
- package/src/types/type.drawer.tsx +86 -0
- package/src/types/type.dropdown.tsx +81 -0
- package/src/types/type.filter.tsx +64 -0
- package/src/types/type.icon.ts +53 -0
- package/src/types/type.image.tsx +115 -0
- package/src/types/type.input.tsx +57 -0
- package/src/types/type.lang-md.tsx +129 -0
- package/src/types/type.lang.tsx +156 -0
- package/src/types/type.list.tsx +97 -0
- package/src/types/type.mdv.tsx +35 -0
- package/src/types/type.mdx.tsx +54 -0
- package/src/types/type.modal.tsx +77 -0
- package/src/types/type.otp.tsx +82 -0
- package/src/types/type.search.tsx +87 -0
- package/src/types/type.select.tsx +87 -0
- package/src/types/type.switch.tsx +52 -0
- package/src/types/type.table.tsx +152 -0
- package/src/types/type.text-area.tsx +51 -0
- package/src/types/type.time.tsx +61 -0
- package/src/types/type.upload.tsx +294 -0
- package/src/types/type.video.tsx +119 -0
- package/src/types/upload-service.ts +229 -0
- package/src/utils/app-config.ts +21 -0
- package/src/utils/app-http.ts +255 -0
- package/src/utils/app-storage.ts +259 -0
- package/src/utils/crypto-util.ts +88 -0
- package/src/utils/event-util.ts +58 -0
- package/src/utils/file-util.ts +186 -0
- package/src/utils/lang-util.ts +60 -0
- package/src/utils/language-util.ts +107 -0
- package/src/utils/leave-guard.ts +26 -0
- package/src/utils/lucide-icon.ts +55 -0
- package/src/utils/menu-util.ts +165 -0
- package/src/utils/option-util.ts +108 -0
- package/src/utils/session-id.ts +48 -0
- package/src/utils/shared-regexp.ts +18 -0
- package/src/utils/storage-keys.ts +80 -0
package/README.md
CHANGED
|
@@ -1,3 +1,631 @@
|
|
|
1
|
-
#
|
|
1
|
+
# shared-lib-web
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A shared **React 19 component library** for DesignForFeature apps, shipped as one npm package.
|
|
4
|
+
Open source under the [MIT license](./LICENSE): free for anybody to use.
|
|
5
|
+
|
|
6
|
+
| Entry | Required? | What |
|
|
7
|
+
| --- | --- | --- |
|
|
8
|
+
| `shared-lib-web` | **yes** | Provider, all Type* controls, page blocks, menus, switchers, overlays, skeletons, states, i18n, themes, AppHttp / AppStorage |
|
|
9
|
+
| `shared-lib-web/layout` | optional | Ready-made app shell: one **single layout** (`AppLayout`, `AsideLayout`, `AuthLayout`) or its **individual parts** (`Header`, `Sidebar`, `SidebarNav`, `MegaMenuBar`, `MegaMenuPanel`, `RailFlyout`) |
|
|
10
|
+
| `shared-lib-web/markdown` | optional | `TypeMdx`, `TypeMdv`, `TypeLangMd` (needs `@uiw/react-md-editor`) |
|
|
11
|
+
|
|
12
|
+
The project decides the layout: use `AppLayout` as it is, turn off / replace its parts, build an own layout from the
|
|
13
|
+
single parts, or skip `shared-lib-web/layout` completely and write the whole layout itself.
|
|
14
|
+
|
|
15
|
+
An app keeps **only**:
|
|
16
|
+
|
|
17
|
+
1. `config.ts` – app name, default language + locale loader, themes, logos, layout and http
|
|
18
|
+
(no menu, no language list)
|
|
19
|
+
2. two backend inputs passed to the provider, `null` first and the reply later:
|
|
20
|
+
`nav` (the menu) and `lang` (the languages)
|
|
21
|
+
3. `locales/{code}.json` – its texts (`en-US.json`, `ar-SA.json` …)
|
|
22
|
+
4. its pages / modules
|
|
23
|
+
|
|
24
|
+
Everything else lives in the library: components and (optionally) layouts, header, sidebar (with icon rail),
|
|
25
|
+
full-width mega menu, pages by query parameter (no router), DaisyUI light/dark themes, lightweight i18n, RTL/LTR, permissions,
|
|
26
|
+
localStorage persistence, toasts, skeletons, overlays and `react-hook-form` controls.
|
|
27
|
+
|
|
28
|
+
Stack: React 19 · TypeScript (strict) · Vite · Tailwind CSS 4 · DaisyUI 5 · `@preact/signals-react` ·
|
|
29
|
+
`lucide-react` (through `TypeIcon`) · `react-hook-form` · `dff-util`.
|
|
30
|
+
**No router (no react-router-dom), no AG Grid.** Markdown fields are an optional extra entry (`shared-lib-web/markdown`).
|
|
31
|
+
|
|
32
|
+
The source follows strict readability rules (no nested functions, no `abcd(xyz())`, no chained calls,
|
|
33
|
+
lowercase file names) – see [CODING_RULES.md](./CODING_RULES.md). AI agents: read `.agent/skills/` in the repository.
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Install
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
npm install shared-lib-web dff-util react react-dom @preact/signals-react lucide-react react-hook-form
|
|
41
|
+
npm install -D tailwindcss daisyui # + your bundler's Tailwind plugin, e.g. @tailwindcss/vite or @tailwindcss/postcss
|
|
42
|
+
# optional, only for shared-lib-web/markdown
|
|
43
|
+
npm install @uiw/react-md-editor
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## CSS
|
|
47
|
+
|
|
48
|
+
```css
|
|
49
|
+
/* src/index.css */
|
|
50
|
+
@import "tailwindcss";
|
|
51
|
+
@import "shared-lib-web/styles.css"; /* lets Tailwind find the classes used inside the library */
|
|
52
|
+
@plugin "daisyui" {
|
|
53
|
+
themes: light --default, dark --prefersdark, corporate, dracula;
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Every theme in `config.themes` must also be enabled in `@plugin "daisyui"` (or defined as a custom theme), and the
|
|
58
|
+
dark ones listed in `config.darkThemes` (dark logo, dark markdown editor). Use `themes: all` or list the ones you need.
|
|
59
|
+
|
|
60
|
+
Custom themes use DaisyUI's theme plugin, one file per theme in a `theme/` folder (the example has
|
|
61
|
+
`example/src/theme/org-light.css` and `org-dark.css`, and the theme names in `example/src/theme/themes.ts`):
|
|
62
|
+
|
|
63
|
+
```css
|
|
64
|
+
/* src/index.css */
|
|
65
|
+
@import "tailwindcss";
|
|
66
|
+
@import "./theme/org-light.css";
|
|
67
|
+
@import "./theme/org-dark.css";
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
```css
|
|
71
|
+
/* src/theme/org-dark.css */
|
|
72
|
+
@plugin "daisyui/theme" {
|
|
73
|
+
name: "org-dark";
|
|
74
|
+
default: false;
|
|
75
|
+
color-scheme: dark;
|
|
76
|
+
--color-base-100: oklch(22% 0.03 264);
|
|
77
|
+
--color-base-content: oklch(92% 0.015 264);
|
|
78
|
+
--color-primary: oklch(70% 0.16 277);
|
|
79
|
+
/* ... all --color-*, --radius-*, --size-*, --border, --depth, --noise variables */
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
```ts
|
|
84
|
+
// src/theme/themes.ts → config.ts: themes: THEMES, darkThemes: DARK_THEMES
|
|
85
|
+
export const THEMES: Theme[] = ["org-light", "org-dark", "light", "dark", /* ... */];
|
|
86
|
+
export const DARK_THEMES: Theme[] = ["org-dark", "dark", /* ... */];
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
The theme dropdown, the ⚙ settings dialog and the example Settings page show **Light themes** and **Dark themes**
|
|
90
|
+
as two groups (split by `config.darkThemes`). In your own UI: `const { lightThemes, darkThemes } = useUi();`
|
|
91
|
+
or `splitThemesByMode(themes)`, `isDarkThemeName(theme)`. Texts: `ui.lightThemes`, `ui.darkThemes`.
|
|
92
|
+
|
|
93
|
+
## App bundler (Vite example)
|
|
94
|
+
|
|
95
|
+
The library itself has no bundler. Your **app** uses its own (Vite, Next.js, webpack …).
|
|
96
|
+
`dff-util` uses packages that expect Node's `global`, so define it — with Vite:
|
|
97
|
+
|
|
98
|
+
```ts
|
|
99
|
+
export default defineConfig({
|
|
100
|
+
plugins: [reactPlugin, tailwindPlugin],
|
|
101
|
+
define: { global: "globalThis" },
|
|
102
|
+
});
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## 1. config.ts
|
|
108
|
+
|
|
109
|
+
```ts
|
|
110
|
+
import { readEnvData, toAbsoluteUrl, type LocaleModule, type UiConfig } from "shared-lib-web";
|
|
111
|
+
|
|
112
|
+
const APP_NAME_KEY = "ORG";
|
|
113
|
+
|
|
114
|
+
// window.env.REACT_APP_ORG_API_BASE_URL (env.js), else the default
|
|
115
|
+
const envBaseUrl = readEnvData(APP_NAME_KEY, "API_BASE_URL");
|
|
116
|
+
const API_BASE_URL = toAbsoluteUrl(envBaseUrl ?? "https://api.example.com/api");
|
|
117
|
+
|
|
118
|
+
// Service URLs are PROJECT level (not part of AppHttp)
|
|
119
|
+
export const MsUrl = {
|
|
120
|
+
api: `${API_BASE_URL}/xxx-api`,
|
|
121
|
+
main: `${API_BASE_URL}/xxx-api`,
|
|
122
|
+
sor: `${API_BASE_URL}/xxx-sor`,
|
|
123
|
+
events: `${API_BASE_URL}/xxx-events`,
|
|
124
|
+
tms: `${API_BASE_URL}/xxx-tms`,
|
|
125
|
+
utils: `${API_BASE_URL}/xxx-util`,
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
/** locales/{code}.json, loaded only when that language is used: "en-US" -> locales/en-US.json */
|
|
129
|
+
function loadLocale(languageCode: string): Promise<LocaleModule> {
|
|
130
|
+
return import(`./locales/${languageCode}.json`);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export const config: UiConfig = {
|
|
134
|
+
appNameKey: APP_NAME_KEY, // key: storage ORG-TOKEN, env REACT_APP_ORG_API_BASE_URL
|
|
135
|
+
appName: "app.name", // label: t("app.name") (default: appNameKey)
|
|
136
|
+
logoUrl: "/logo-light.svg",
|
|
137
|
+
logoDarkUrl: "/logo-dark.svg",
|
|
138
|
+
defaultLanguage: "en-US", // shown before the backend list arrives
|
|
139
|
+
loadLocale: loadLocale,
|
|
140
|
+
defaultTheme: "light",
|
|
141
|
+
themes: ["light", "dark", "corporate", "dracula"],
|
|
142
|
+
darkThemes: ["dark", "dracula"],
|
|
143
|
+
layout: { menuMode: "sidebar", isSidebarCollapsible: true },
|
|
144
|
+
http: { baseUrl: API_BASE_URL, logoutUrl: "/login" },
|
|
145
|
+
};
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
| Setting | What it does |
|
|
149
|
+
| --- | --- |
|
|
150
|
+
| `defaultLanguage`, `fallbackLanguage` | Optional language codes like `en-US` (default `"en-US"`). The default is shown before the `lang` list arrives (and when a file is missing). Without `defaultLanguage`, `languages`, `loadLocale` and `lang` the app runs in en-US with the library's built-in English texts and no language switcher. |
|
|
151
|
+
| `loadLocale(code)` | Loads `locales/{code}.json` lazily for any language code. |
|
|
152
|
+
| `languages` | Not needed: the list comes from `lang` (below). Only for apps with a fixed list (`{ code, label, flag?, direction?, load? }`). |
|
|
153
|
+
| `themes`, `darkThemes` | Listed by the theme switcher. Dark themes switch to `logoDarkUrl` and dark markdown. |
|
|
154
|
+
| `layout.headerSettings` | `"inline"` (language + theme switchers in the header) or `"menu"` (one ⚙ button opening a settings dialog with language, theme and navigation style). |
|
|
155
|
+
| `layout.toastPosition`, `layout.showScrollToTop` | Toast corner (`top-end` …) and the scroll-to-top button. |
|
|
156
|
+
| `layout.showMenu` | Menu shown at start (default `true`); switch at runtime with `setMenuVisible()` / `toggleMenuVisible()`. |
|
|
157
|
+
| `layout.menuMode` | `"sidebar"` (drawer + collapsible icon rail) or `"megamenu"` (top bar + full-width panels). Users can switch with `changeNavigationMode()`; the choice is saved. |
|
|
158
|
+
| `homePath`, `layout.pageParam` | The page shown when `?page` is missing (default `/`) and the name of the page parameter (default `page`). |
|
|
159
|
+
| `http.baseUrl` | API base URL of `AppHttp` (`window.env.REACT_APP_<APPNAMEKEY>_API_BASE_URL` wins when set; a relative `/api` becomes absolute). |
|
|
160
|
+
| `http.logoutUrl` | Where the browser goes after `endSession()` (log out), for example `/login` or an SSO logout URL. `endSession(keepKeys, false)` stays on the page. |
|
|
161
|
+
| `http.tokenKey`, `http.headers`, `http.loadUrl`, `http.showProgress` | Optional: AppStorage key of the token (default `TOKEN`), extra headers, `AppHttp.Load` URL (default base + `/load`), progress bar (default `true`). |
|
|
162
|
+
| `appNameKey` | Key of the app (`ENV_BASE_NAME`): prefix of every AppStorage key (`ORG-TOKEN`, `ORG-LANG`) and of the `window.env` names (`REACT_APP_ORG_…`). The key names are fixed constants — no `storage` / `languageKey` / `themeKey` settings. |
|
|
163
|
+
| `appName` | Label shown in header, sidebar and login: `t(config.appName)` (plain text or a translation key). Default: `appNameKey`. |
|
|
164
|
+
|
|
165
|
+
| `navigation` | Not needed: the menu comes from `nav` (below). Only for apps with a fixed menu and no backend (`NavItem[]`). |
|
|
166
|
+
| `navOptions` | How the backend menu is converted: `rootMenuIds` (default: groups named "Root" or ids ending in `_ROOT`), `isRootFlattened` (default `true`). |
|
|
167
|
+
|
|
168
|
+
### Second config: `nav` (menu from the backend)
|
|
169
|
+
|
|
170
|
+
The menu is passed separately from `config` and can change at any time (login, persona switch, refresh).
|
|
171
|
+
Pass the backend reply as it is — `{ data: [...], meta }` or only the list:
|
|
172
|
+
|
|
173
|
+
```tsx
|
|
174
|
+
const menuResponse = await AppHttp.Get(menuUrl); // { data: [...], meta: {...} }
|
|
175
|
+
|
|
176
|
+
<SharedWebUiProvider config={config} nav={menuResponse}> // null = skeleton, then the reply
|
|
177
|
+
<App />
|
|
178
|
+
</SharedWebUiProvider>
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
Typical flow — the value starts as `null` and the reply arrives later:
|
|
182
|
+
|
|
183
|
+
```tsx
|
|
184
|
+
// nav.service.ts
|
|
185
|
+
export const navSignal = signal<MenuSource | null>(null); // null = menu skeleton
|
|
186
|
+
|
|
187
|
+
export async function loadNav(): Promise<void> {
|
|
188
|
+
navSignal.value = null;
|
|
189
|
+
const reply = await AppHttp.Get(menuUrl);
|
|
190
|
+
navSignal.value = reply; // menu appears; a new reply replaces it
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// root.tsx
|
|
194
|
+
export function Root() {
|
|
195
|
+
useSignals();
|
|
196
|
+
const nav = navSignal.value;
|
|
197
|
+
return (
|
|
198
|
+
<SharedWebUiProvider config={config} nav={nav}>
|
|
199
|
+
<App />
|
|
200
|
+
</SharedWebUiProvider>
|
|
201
|
+
);
|
|
202
|
+
}
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
On an API error set `[]` (empty menu), otherwise the skeleton stays. On logout set `null` again.
|
|
206
|
+
Without the prop: `setMenuLoading()` → `setMenu(menuResponse)`; `clearMenu()` on logout.
|
|
207
|
+
|
|
208
|
+
What happens to the reply (`MenuAccessType`: `id`, `name`, `nameLang`, `href`, `icon`, `type`, `priority`,
|
|
209
|
+
`read/create/update/delete` or `permissions`, `active`, `children`):
|
|
210
|
+
|
|
211
|
+
- the children of the **Root** group (`ADMIN_ROOT`) move to the top level, in the place of the group;
|
|
212
|
+
- sorted by `priority`; the same priority keeps the backend order; `active: false` is removed;
|
|
213
|
+
- icons like `layout-dashboard`, `users`, `User-Round-Key` become lucide names (unknown → `Circle`);
|
|
214
|
+
- `nameLang` `{ "en-US": "..." }` is used for `en`, `en-US`, … (`trans()`), else `name`;
|
|
215
|
+
- `read: false` hides the item and blocks the page; `create/update/delete` feed `canAccess()`.
|
|
216
|
+
|
|
217
|
+
`toNavigation(menuResponse, options)` does the conversion if you need the `NavItem[]` yourself.
|
|
218
|
+
|
|
219
|
+
### Third input: `lang` (languages from the backend)
|
|
220
|
+
|
|
221
|
+
Passed the same way as `nav`: `null` first, the reply later. Texts come from `locales/{code}.json` via `loadLocale`.
|
|
222
|
+
|
|
223
|
+
```tsx
|
|
224
|
+
// lang.service.ts
|
|
225
|
+
export const langSignal = signal<LangSource | null>(null);
|
|
226
|
+
|
|
227
|
+
export async function loadLanguages(): Promise<void> {
|
|
228
|
+
const reply = await AppHttp.Get(languagesUrl); // { data: [{ code: "en-US", name: "English", isDefault: true }, ...] }
|
|
229
|
+
langSignal.value = reply;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
// root.tsx
|
|
233
|
+
<SharedWebUiProvider config={config} nav={navSignal.value} lang={langSignal.value}>
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
- Row fields: `code` (or `langCode` / `languageCode` / `id`), `name` or `label`, `flag`, `direction` or `dir`,
|
|
237
|
+
`isDefault` (or `default`), `active` (false hides it), `priority`. RTL is automatic for `ar`, `he`, `fa`, `ur`.
|
|
238
|
+
- While `lang` is `null`: `defaultLanguage` (or the language the user saved) is shown; the switchers have no list yet.
|
|
239
|
+
- When the list arrives: the user's saved language stays if it is listed; otherwise the row with `isDefault`
|
|
240
|
+
(else `defaultLanguage`, else the first) is loaded. Only a language the user picks is saved to localStorage.
|
|
241
|
+
- `TypeLang` / `TypeLangMd` fields get one entry per listed language: `{ "en-US": "...", "ar-SA": "..." }`;
|
|
242
|
+
backend `nameLang` with the same codes is shown by `trans()` and the menu.
|
|
243
|
+
- Without the prop: `setLanguages(reply)`. Conversion only: `toLanguageOptions(reply)`, `readDefaultLanguageCode(reply)`.
|
|
244
|
+
|
|
245
|
+
### AppStorage and AppHttp
|
|
246
|
+
|
|
247
|
+
The same helpers the apps had in `utils/services/app.storage.ts` and `app.http.ts`, now in the library:
|
|
248
|
+
|
|
249
|
+
```ts
|
|
250
|
+
import { AppHttp, AppStorage, BRANCH_ID, LANG, THEME, TOKEN } from "shared-lib-web";
|
|
251
|
+
|
|
252
|
+
AppStorage.setData(BRANCH_ID, branchId); // sessionStorage "ORG-BRANCH_ID"
|
|
253
|
+
const token = AppStorage.getData(TOKEN); // objects come back parsed
|
|
254
|
+
AppStorage.getText(THEME); // localStorage "ORG-THEME"
|
|
255
|
+
AppStorage.removeData(BRANCH_ID); // from both storages
|
|
256
|
+
AppStorage.clearData(); // log out: keeps the localStorage preferences
|
|
257
|
+
AppStorage.envData("API_BASE_URL"); // window.env.REACT_APP_ORG_API_BASE_URL (env.js of the deployed app)
|
|
258
|
+
|
|
259
|
+
// MsUrl comes from the project's config.ts (see section 1)
|
|
260
|
+
const rows = await AppHttp.Get(`${MsUrl.main}/profile/search`, params);
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
**Which storage:** decided only by the key (no argument).
|
|
264
|
+
|
|
265
|
+
| localStorage (preferences, kept on log out) | sessionStorage (everything else) |
|
|
266
|
+
| --- | --- |
|
|
267
|
+
| `LANG`, `THEME`, `LAYOUT_CHOICE`, `MENU_MODE`, `SIDEBAR_COLLAPSED`, `REMEMBER_ME` + `config.localStorageKeys` | `TOKEN`, `ACTIVE_SESSION_ID` (tab id, sent as `x-session-id`), `AUTH_USER`, `SESSION_INFO`, `SCREEN_ACCESS`, `SCREEN_ACTION`, `NAV`, `TRANS`, `DIR`, `OTP_ID`, `BRANCH_ID`, `BRANCH_NAME`, `REGEN_EXPIRES_AT`, project keys |
|
|
268
|
+
|
|
269
|
+
`startSession(token, user, isRemembered)` keeps the token in sessionStorage; `isRemembered` only saves `REMEMBER_ME`.
|
|
270
|
+
On start the provider removes old app values from localStorage that are not preferences (`AppStorage.cleanLocalStorage()`).
|
|
271
|
+
Saving a preference (`THEME`, `LANG` …) also fires the window event `PREFERENCE_EVENT`; every copy of the library on the
|
|
272
|
+
page (microfrontends) and every other tab applies the new theme / language at once.
|
|
273
|
+
|
|
274
|
+
Key constants (also as `StorageKeys.*`): `TOKEN`, `AUTH_USER`, `SESSION_INFO`, `SCREEN_ACCESS`, `SCREEN_ACTION`, `NAV`,
|
|
275
|
+
`REMEMBER_ME`, `TRANS`, `DIR`, `LANG`, `THEME`, `LAYOUT_CHOICE`, `MENU_MODE`, `SIDEBAR_COLLAPSED`, `OTP_ID`, `BRANCH_ID`, `BRANCH_NAME`,
|
|
276
|
+
`REGEN_EXPIRES_AT`. The library saves the chosen language in `LANG`, the theme in `THEME`, the navigation style in
|
|
277
|
+
`MENU_MODE` and the rail state in `SIDEBAR_COLLAPSED`.
|
|
278
|
+
|
|
279
|
+
AppHttp headers on every request: `Content-Type`, `Authorization: Bearer <TOKEN>`, `x-session-id` (per-tab id, saved as `ORG-ACTIVE_SESSION_ID`),
|
|
280
|
+
`x-branch-id` (AppStorage `BRANCH_ID`, `""` when no branch), `http.headers` and `AppHttp.setHeader(name, value)`.
|
|
281
|
+
Pick the branch with `setBranch(branch.id, branch.name)` (saved as `BRANCH_ID` / `BRANCH_NAME`, read back with
|
|
282
|
+
`readBranchId()` or `branchIdSignal`); `clearBranch()` removes it and `endSession()` clears it too.
|
|
283
|
+
|
|
284
|
+
**Branch switcher** – pass the user's branches like `lang` (null first, the reply later); the default and disabled
|
|
285
|
+
branches come with the rows:
|
|
286
|
+
|
|
287
|
+
```tsx
|
|
288
|
+
<SharedWebUiProvider config={config} nav={nav} lang={lang} branch={branchReply}>
|
|
289
|
+
// config.branchLabel = "branch.title" -> title of the switcher, shown with t() (default "ui.branch" = "Branch")
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
- Rows: `{ id | branchId | code, name | branchName | label, nameLang?, isDefault?, disabled?, active?, priority? }`, as `{ data: [...] }` or the list.
|
|
293
|
+
- `disabled: true` shows the branch greyed out; it can not be selected. `active: false` hides it.
|
|
294
|
+
- Selected when the list arrives: the saved `BRANCH_ID` (if listed and not disabled) → the row with `isDefault` → the first one that is not disabled.
|
|
295
|
+
- Shown as a dropdown in the `Header` and as the first section of the settings dialog. `null` or `[]` = no switcher.
|
|
296
|
+
- `setBranches(reply)` does the same without the provider (call it before the menu request so it already
|
|
297
|
+
sends `x-branch-id`). Own layouts: `<BranchSwitcher />`. Helpers: `toBranchOptions`, `pickBranch`, `branchesSignal`.
|
|
298
|
+
The token is read from AppStorage (`TOKEN`, sessionStorage then localStorage).
|
|
299
|
+
|
|
300
|
+
`AppHttp` and `AppStorage` use no signals: they read the config saved by `<SharedWebUiProvider>`.
|
|
301
|
+
Code that runs before the provider (for example at module load) calls `setAppConfig(config)` first, in `main.tsx`.
|
|
302
|
+
|
|
303
|
+
## 2. locales/en-US.json
|
|
304
|
+
|
|
305
|
+
```json
|
|
306
|
+
{
|
|
307
|
+
"app": { "name": "My App" },
|
|
308
|
+
"nav": { "dashboard": "Dashboard", "users": "Users", "usersText": "Everyone who uses the app" },
|
|
309
|
+
"greeting": "Hello {{name}}",
|
|
310
|
+
"REQUIRED": "This field is required"
|
|
311
|
+
}
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
Lookup order: current language → `fallbackLanguage` → library defaults (`ui.*` and dff-util `ConstMessages`) → the key.
|
|
315
|
+
Shell texts to translate: `ui.language, theme, openMenu, expandMenu, collapseMenu, home, loading, close, noData,
|
|
316
|
+
selectOption, search, navigation, account, logout, confirm, cancel, translate, permissionDenied,
|
|
317
|
+
permissionDeniedText, pageNotFound, pageNotFoundText, backToHome, goBack, reloadPage, comingSoon, comingSoonText,
|
|
318
|
+
openPreview, playVideo, mediaError`.
|
|
319
|
+
|
|
320
|
+
## 3. main.tsx and app.tsx
|
|
321
|
+
|
|
322
|
+
```tsx
|
|
323
|
+
// root.tsx – the three inputs: static config + two backend replies (null first)
|
|
324
|
+
export function Root() {
|
|
325
|
+
useSignals();
|
|
326
|
+
const nav = navSignal.value;
|
|
327
|
+
const lang = langSignal.value;
|
|
328
|
+
return (
|
|
329
|
+
<SharedWebUiProvider config={config} nav={nav} lang={lang}>
|
|
330
|
+
<App />
|
|
331
|
+
</SharedWebUiProvider>
|
|
332
|
+
);
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
// main.tsx
|
|
336
|
+
const root = createRoot(rootElement);
|
|
337
|
+
root.render(<Root />);
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
```tsx
|
|
341
|
+
// app.tsx – ONE component holds all pages; ?page picks which one is shown
|
|
342
|
+
import { AppLayout, AuthLayout } from "shared-lib-web/layout"; // optional, see "Layout" below
|
|
343
|
+
|
|
344
|
+
const PAGE_ELEMENTS: Record<string, ReactElement> = {
|
|
345
|
+
"/": <DashboardPage />,
|
|
346
|
+
"/profiles": <UserPage />, // keys = the menu hrefs
|
|
347
|
+
"/app-settings": <SettingsPage />,
|
|
348
|
+
};
|
|
349
|
+
|
|
350
|
+
function readPageElement(page: string): ReactElement {
|
|
351
|
+
return PAGE_ELEMENTS[page] ?? <PageNotFound />;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
export function App() {
|
|
355
|
+
const page = useCurrentPage(); // "/profiles" from ?page=profiles (re-renders on change)
|
|
356
|
+
if (!isLoggedIn.value) {
|
|
357
|
+
return (
|
|
358
|
+
<AuthLayout>
|
|
359
|
+
<LoginPage />
|
|
360
|
+
</AuthLayout>
|
|
361
|
+
);
|
|
362
|
+
}
|
|
363
|
+
const pageElement = readPageElement(page);
|
|
364
|
+
return (
|
|
365
|
+
<AppLayout headerEnd={<UserMenu name={userName} email={email} onLogout={handleLogout} />}>
|
|
366
|
+
<RequireAccess key={page}>{pageElement}</RequireAccess>
|
|
367
|
+
</AppLayout>
|
|
368
|
+
);
|
|
369
|
+
}
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
### Layout: single, parts or own (optional)
|
|
373
|
+
|
|
374
|
+
```tsx
|
|
375
|
+
import { AppLayout, AsideLayout, AuthLayout, Header, Sidebar, SidebarNav } from "shared-lib-web/layout";
|
|
376
|
+
|
|
377
|
+
// 1. Single layout – everything ready-made
|
|
378
|
+
<AppLayout headerEnd={<UserMenu ... />} sidebarFooter="v1.0">{page}</AppLayout>
|
|
379
|
+
|
|
380
|
+
// 2. Single layout with options
|
|
381
|
+
<AppLayout showSidebar={false}>{page}</AppLayout> // header + page only
|
|
382
|
+
<AppLayout showHeader={false}>{page}</AppLayout> // sidebar + page only
|
|
383
|
+
<AppLayout header={<MyHeader />} sidebar={<MySidebar />} footer={<MyFooter />}>{page}</AppLayout>
|
|
384
|
+
|
|
385
|
+
// 2b. AsideLayout – no top header, only the side menu and the page
|
|
386
|
+
<AsideLayout sidebarUser={<UserMenu isInSidebar ... />}>{page}</AsideLayout>
|
|
387
|
+
// desktop: collapsible to an icon rail (button at the bottom, tooltips on the rail)
|
|
388
|
+
// small screens: always the icon rail (no drawer, no menu button)
|
|
389
|
+
// no mega menu: menuMode is ignored and hidden in the settings dialog
|
|
390
|
+
// the user at the bottom of the sidebar; HeadLayout sticks at top-0
|
|
391
|
+
// options: sidebarFooter, showSettings (settings button at the bottom, default false), showSidebar, sidebar, footer
|
|
392
|
+
// signals: isAsideLayoutSignal, isSmallScreenSignal, isRailEverywhereSignal
|
|
393
|
+
|
|
394
|
+
// 3. MainLayout: the project's own layout from the individual parts (any markup around them)
|
|
395
|
+
<div className="flex min-h-screen flex-col">
|
|
396
|
+
<Header endContent={<UserMenu ... />} isStandalone /> {/* brand always shown on desktop */}
|
|
397
|
+
<div className="flex flex-1">
|
|
398
|
+
<aside className="w-64"><SidebarNav isAlwaysExpanded /></aside> {/* only the menu */}
|
|
399
|
+
<main>{page}</main>
|
|
400
|
+
</div>
|
|
401
|
+
</div>
|
|
402
|
+
|
|
403
|
+
// 4. No layout entry at all – the project writes everything with the main entry:
|
|
404
|
+
// AppBrand, UserMenu, LanguageSwitcher, ThemeSwitcher, SettingsMenu, PageLink, toggleSidebar ...
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
**Menu on / off at runtime** (works with `AppLayout`, `Header`, `SidebarNav` and the mega menu):
|
|
408
|
+
|
|
409
|
+
```ts
|
|
410
|
+
setMenuVisible(false); // hide the sidebar / rail / mega menu bar and the menu buttons, e.g. a full-screen page
|
|
411
|
+
setMenuVisible(true); // show it again
|
|
412
|
+
toggleMenuVisible(); // switch
|
|
413
|
+
isMenuVisibleSignal.value // current state (re-renders components)
|
|
414
|
+
// start value: config.layout.showMenu (default true)
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
| Part | Options |
|
|
418
|
+
| --- | --- |
|
|
419
|
+
| `AppLayout` | `headerEnd`, `sidebarFooter`, `showHeader`, `showSidebar` (default: `isMenuVisibleSignal`), `header`, `sidebar`, `footer` |
|
|
420
|
+
| `Header` | `endContent`, `startContent`, `showMenuButtons`, `showSwitchers`, `isStandalone` |
|
|
421
|
+
| `Sidebar` | `footer`, `showBrand` |
|
|
422
|
+
| `SidebarNav` | `className`, `isAlwaysExpanded`, `isAlwaysShown` (menu list only, follows permissions and the menu on/off switch, skeleton while `nav` is `null`) |
|
|
423
|
+
|
|
424
|
+
The example app shows both: Settings → *App layout* switches between `AppLayout` and
|
|
425
|
+
`MainLayout` in `example/src/layout/main-layout.tsx`.
|
|
426
|
+
|
|
427
|
+
### No router: query parameters
|
|
428
|
+
|
|
429
|
+
There is no router and nothing redirects. A menu click only sets `?page=<menu href>` with the History API
|
|
430
|
+
(no reload); the app shows the component for that value. Back / forward work.
|
|
431
|
+
|
|
432
|
+
**Path mode:** `layout: { pageMode: "path" }` puts the page in the path instead — `http://host/profiles` rather than
|
|
433
|
+
`http://host/?page=profiles`. Menu links, `openPage`, `PageLink`, `useCurrentPage` and back / forward all follow it;
|
|
434
|
+
other query parameters still work (`/profiles?userId=7`). The server must answer every path with `index.html`
|
|
435
|
+
(Vite dev does). For code outside React (for example single-spa `activeWhen`) use `readPageFromLocation(location)`,
|
|
436
|
+
which reads the page in either mode.
|
|
437
|
+
|
|
438
|
+
| Function | What it does |
|
|
439
|
+
| --- | --- |
|
|
440
|
+
| `openPage("/profiles")` | Sets `?page=profiles` (no leading slash in the address bar; inside the app pages stay menu hrefs like `"/profiles"`; old `?page=/profiles` links still work; helpers `toPageParamValue` / `toPagePath`), removes the old page's parameters, closes menus, scrolls up. `openPage(page, { userId: "42" })` adds values; `{ isKeepingOtherParams: true }` keeps the old ones. |
|
|
441
|
+
| `setQueryParam("userId", "42")` | Adds or changes one parameter: `?page=profiles&userId=42`. `undefined` / `""` removes it. `{ isReplace: true }` replaces the history entry. |
|
|
442
|
+
| `setQueryParams({ userId: "42", mode: "edit" })` | Several at once. |
|
|
443
|
+
| `removeQueryParam("userId")` | Removes one. |
|
|
444
|
+
| `readQueryParam("userId")`, `readQueryParams()` | Read values (outside components or in handlers). |
|
|
445
|
+
| `useQueryParam("userId")`, `useCurrentPage()` | Read values in a component and re-render when they change. |
|
|
446
|
+
| `<PageLink page="/profiles">` | A link that calls `openPage` (Ctrl/Cmd-click opens a new tab). |
|
|
447
|
+
|
|
448
|
+
Example (users page): row click → `setQueryParams({ userId, mode: "view" })`; on load
|
|
449
|
+
`readQueryParams()` reopens the drawer, so a refresh or a shared link shows the same user.
|
|
450
|
+
|
|
451
|
+
## 4. Pages
|
|
452
|
+
|
|
453
|
+
```tsx
|
|
454
|
+
const { locale, theme, direction, t, changeLanguage, changeTheme } = useUi();
|
|
455
|
+
```
|
|
456
|
+
|
|
457
|
+
Permissions: wrap the page in `<RequireAccess>` (shows `PermissionDenied` when the menu item of the current `?page` has `read: false`) and use
|
|
458
|
+
`canAccess("update")` / `canAccess("delete")` for buttons.
|
|
459
|
+
|
|
460
|
+
## 5. Icons – TypeIcon
|
|
461
|
+
|
|
462
|
+
```tsx
|
|
463
|
+
<TypeIcon name="Users" />
|
|
464
|
+
<TypeIcon name="Pencil" size={16} title="Edit" onPress={handleEditClick} />
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
All icons (navigation, buttons, library) use lucide names from https://lucide.dev/icons.
|
|
468
|
+
|
|
469
|
+
## 6. Forms – react-hook-form
|
|
470
|
+
|
|
471
|
+
Every control takes `{ control, name, label, rules }` and translates its error message
|
|
472
|
+
(use dff-util `ConstKeys` as messages and `RegExp` as patterns).
|
|
473
|
+
|
|
474
|
+
| Control | Value |
|
|
475
|
+
| --- | --- |
|
|
476
|
+
| `TypeInput`, `TypeTextArea` | text |
|
|
477
|
+
| `TypeSelect` | option key (dff-util `OptionType`, `option.lang[locale]` shown) |
|
|
478
|
+
| `TypeSwitch`, `TypeCheckbox` | boolean |
|
|
479
|
+
| `TypeDate` (`isDateTime`) | `"2026-11-05"` / `"2026-11-05T14:30"` |
|
|
480
|
+
| `TypeTime` | `"14:30"` |
|
|
481
|
+
| `TypeOtp` (`length`) | `"123456"` |
|
|
482
|
+
| `TypeList` (`selectionMode`) | `string[]` or `string` |
|
|
483
|
+
| `TypeLang` (`type="text" | "textarea"`) | `TranslationType` `{ en: "...", fr: "..." }` for every config language, with translate buttons (dff-util `CallLangText`) |
|
|
484
|
+
| `TypeMdx` (from `shared-lib-web/markdown`) | markdown text (editor) |
|
|
485
|
+
| `TypeLangMd` (from `shared-lib-web/markdown`) | markdown per language `{ en: "...", fr: "..." }` with translate buttons |
|
|
486
|
+
|
|
487
|
+
`TypeMdv` (from `shared-lib-web/markdown`) shows markdown, or the current language of `textByLanguage`. All three follow light/dark themes.
|
|
488
|
+
|
|
489
|
+
```tsx
|
|
490
|
+
import { TypeLangMd, TypeMdv, TypeMdx } from "shared-lib-web/markdown";
|
|
491
|
+
|
|
492
|
+
<TypeLang control={control} name="title" label={t("page.title")} rules={pageValidation.title} />
|
|
493
|
+
<TypeLangMd control={control} name="body" label={t("page.body")} height={250} />
|
|
494
|
+
<TypeMdv textByLanguage={page.body} />
|
|
495
|
+
```
|
|
496
|
+
|
|
497
|
+
### File upload – TypeUpload
|
|
498
|
+
|
|
499
|
+
```tsx
|
|
500
|
+
<TypeUpload control={control} name="csvFile" label={t("product.csv")} fileType="csv" maxSize="10MB" rules={rules.csvFile} />
|
|
501
|
+
<TypeUpload control={control} name="photos" label={t("product.photos")} fileType={["png", "jpg"]} maxSize="5MB" isMultiple totalSize="20MB" />
|
|
502
|
+
<TypeUploadBox name="import" fileType="csv" maxSize={10} value={importFile.value} onChange={handleImportFileChange} />
|
|
503
|
+
```
|
|
504
|
+
|
|
505
|
+
Drag & drop or browse, type and size checks (per file and total), warning banner + toast, file list with remove.
|
|
506
|
+
Value: `File` (single) or `File[]` (`isMultiple`). Then upload with:
|
|
507
|
+
|
|
508
|
+
```ts
|
|
509
|
+
const signed = await AppHttp.Post(`${MsUrl.utils}/s3/upload-url`, { fileName: file.name });
|
|
510
|
+
const uploaded = await uploadToSignedUrl(file, signed.data.upload, signed.data.download); // FileType
|
|
511
|
+
```
|
|
512
|
+
|
|
513
|
+
Helpers: `parseSizeToBytes`, `formatBytes`, `normalizeFileTypes`, `isFileTypeAllowed`, `readFileIconName`, `setLeaveGuard`.
|
|
514
|
+
|
|
515
|
+
Option lists from dff-util data: `readCountryOptions()`, `readTelCodeOptions()` (+ `readTelCode("IN")` → `"+91"`), `readLanguageOptions()`.
|
|
516
|
+
|
|
517
|
+
## 7. Other components
|
|
518
|
+
|
|
519
|
+
### Sticky page header (HeadLayout)
|
|
520
|
+
|
|
521
|
+
```tsx
|
|
522
|
+
const headActions = (
|
|
523
|
+
<>
|
|
524
|
+
<TypeButton action="ghost" icon="X" label={t("user.cancel")} onPress={handleUserCancel} />
|
|
525
|
+
<TypeButton type="submit" form="user-form" icon="Save" label={t("user.save")} />
|
|
526
|
+
</>
|
|
527
|
+
);
|
|
528
|
+
|
|
529
|
+
<HeadLayout title={t("user.editTitle")} actions={headActions} />
|
|
530
|
+
<form id="user-form" onSubmit={onSubmit}>...</form>
|
|
531
|
+
```
|
|
532
|
+
|
|
533
|
+
- Put it first in the page. It sticks at `top-16` (under the 4rem app `Header`); `isBelowHeader={false}` sticks at `top-0`.
|
|
534
|
+
- `isFullWidth` (default true) stretches it over the `<main>` padding (`p-4 lg:p-6`) to both edges; `false` gives a rounded card.
|
|
535
|
+
- The buttons sit outside the `<form>`, so give the form an `id` and pass it to `TypeButton form="..."`.
|
|
536
|
+
- Optional `children` add a row under the title (filters, tabs).
|
|
537
|
+
|
|
538
|
+
| Export | What it is |
|
|
539
|
+
| --- | --- |
|
|
540
|
+
| `AppLayout`, `AuthLayout` (from `shared-lib-web/layout`) | Optional single layouts (children = page) |
|
|
541
|
+
| `Header`, `Sidebar`, `SidebarNav`, `SidebarCollapseButton`, `MegaMenuBar`, `MegaMenuPanel`, `RailFlyout` (from `shared-lib-web/layout`) | Optional individual layout parts. The collapse / expand button sits fixed at the bottom of `Sidebar` (desktop, sidebar mode); `<Sidebar showCollapseButton={false} />` hides it, `SidebarCollapseButton` places it in an own layout. User at the bottom of the side menu: `<AppLayout sidebarUser={<UserMenu isInSidebar ... />}>` (avatar + name + email; avatar only on the collapsed rail, menu opens next to it). On the collapsed rail every icon (links, groups, user, expand button) shows a tooltip with its label (`RailTooltip`, rendered by AppLayout; own layouts render `<RailTooltip />` once; any element can opt in with `data-rail-tip="Label"`) |
|
|
542
|
+
| `AppBrand`, `PageLink` | Navigation pieces for any layout (main entry) |
|
|
543
|
+
| `HeadLayout` | Sticky page header (h-16, same height as the logo box): one-line title on the start side, actions (Cancel, Submit) on the end side; stays under the app header while the page scrolls |
|
|
544
|
+
| `ArticleLayout`, `ContentLayout`, `GridLayout`, `FloatLayout` | Page sections |
|
|
545
|
+
| `TypeButton`, `TypeTable` (+ `readRowKey`), `TypeDropdown` (+ `readDataValue`) | Actions and lists |
|
|
546
|
+
| `TypeSearch` (`onChange` live or `onSearch` on Enter + `readSearchText`), `TypeFilter` | List filters (not form fields) |
|
|
547
|
+
| `TypeImage`, `TypeVideo` | Media thumbnails: skeleton while loading, error icon if the file fails; a click opens one shared popup (`MediaViewer`, rendered by the provider) with the full image, or the video playing with controls. `<TypeImage src alt previewSrc? fit? className? width? height? isPreviewable? />`, `<TypeVideo src title poster? className? width? height? isPreviewable? />` (optional `width` / `height`: number = px, string = any CSS size such as `"12rem"` or `"100%"`; only a height keeps the 16:9 shape) (no poster = first frame; `isPreviewable={false}` plays inline). `openMediaPreview({ type, src, title, poster })` / `closeMediaPreview()` open it from code |
|
|
548
|
+
| `TypeModal`, `TypeDrawer`, `TypeConfirm` | Overlays (Escape, backdrop and ✕ close them) |
|
|
549
|
+
| `UserMenu`, `LanguageSwitcher`, `ThemeSwitcher`, `SettingsMenu` | Header menus |
|
|
550
|
+
| `ShowProgress(true/false)`, `TopProgress`, `ScrollToTop` | Request progress bar and scroll-to-top button |
|
|
551
|
+
| `EmptyState`, `PermissionDenied`, `RequireAccess`, `PageNotFound`, `ComingSoon`, `PageLoader` | States and pages |
|
|
552
|
+
| `SkeletonArticle`, `SkeletonTable`, `SkeletonForm`, `SkeletonCards`, `SkeletonDashboard`, `SkeletonChat`, `SkeletonMenu`, `SkeletonAuthForm`, `SkeletonPage`, `SkeletonFloat` | Loading placeholders |
|
|
553
|
+
| `ShowToast(message, type)` | Toasts |
|
|
554
|
+
| `trans(textByLanguage, defaultText)` | Pick a backend translation for the current language |
|
|
555
|
+
| `AppStorage.getData / getText / setData / removeData / clearData / envData`, `TOKEN`, `LANG`, `THEME`, `BRANCH_ID` … `StorageKeys` | Prefixed session/local storage, shared key constants, `window.env` settings |
|
|
556
|
+
| `openPage`, `setQueryParam(s)`, `removeQueryParam`, `readQueryParam(s)`, `useQueryParam`, `useCurrentPage`, `PageLink`, `currentPageSignal`, `queryParamsSignal` | Pages and query parameters (no router) |
|
|
557
|
+
| `setLanguages(reply)`, `toLanguageOptions(reply)`, `languagesSignal`, `LangSource`, `LanguageRowType`, `setMenu(reply)`, `setMenuLoading()`, `clearMenu()`, `toNavigation(reply)`, `toNavItems(menus)`, `unwrapRootMenu(menus, "ADMIN_ROOT")`, `MenuAccessType`, `MenuResponseType`, `MenuSource`, `MenuOptions`, `ScreenAccessType`, `TranslationType`, `AuthUser` | Backend menus and shared app types (menu icons are fixed with `resolveLucideIcon`) |
|
|
558
|
+
| `AppHttp.Get / Post / Put / Patch / Delete / Load / CloudUpload (uploadFile) / DownloadFile`, `AppHttp.BaseUrl()`, `AppHttp.setHeader`, `readEnvData(appNameKey, key)`, `uploadToSignedUrl`, `setAppConfig` / `readAppConfig` | HTTP client on dff-util `Http`: bearer token, session id, branch, extra headers, progress bar |
|
|
559
|
+
| `setBranch(id, name)`, `readBranchId()`, `clearBranch()`, `branchIdSignal`, `branchNameSignal` | Selected branch, sent as `x-branch-id` |
|
|
560
|
+
| `startSession(token, user, isRemembered)`, `restoreSession()`, `endSession(keepKeys)`, `authUserSignal`, `isAuthenticatedSignal` | Login state (restored on reload) |
|
|
561
|
+
| `toOptionTypes(rows)`, `readResponseRows(response)` | Backend option rows → `OptionType[]` |
|
|
562
|
+
| `resolveLucideIcon("user-round-key")` | Backend icon names → lucide names |
|
|
563
|
+
| `encryptPayload`, `decryptResponse` | AES-GCM payload encryption (key passed in) |
|
|
564
|
+
| `SharedRegExp` | dff-util `RegExp` + `MOBILE_10`, `PERSON_NAME`, `ADDRESS_TEXT`, `UPPER_ALPHA_NUMERIC` |
|
|
565
|
+
| `canAccessPath(action, path)` | Permission check for any path |
|
|
566
|
+
| Signals | `localeSignal`, `themeSignal`, `directionSignal`, `translationSignal`, `isDarkThemeSignal`, `navigationSignal`, `navigationModeSignal`, `pathnameSignal`, `screenAccessSignal` … |
|
|
567
|
+
|
|
568
|
+
Every component uses DaisyUI theme colours (`base-*`, `primary` …), so all themes – light and dark – work.
|
|
569
|
+
|
|
570
|
+
---
|
|
571
|
+
|
|
572
|
+
## Example apps
|
|
573
|
+
|
|
574
|
+
There are two examples, each its own small Vite app that uses the library source directly:
|
|
575
|
+
|
|
576
|
+
| Folder | Port | Shows |
|
|
577
|
+
| --- | --- | --- |
|
|
578
|
+
| `example-basic/` | 5174 | **One language** (en-US, `defaultLanguage` + `loadLocale`, no `lang`) and **no branches** (no `branch`): login, dashboard, users CRUD, settings (theme, menu mode, menu on/off). The smallest real setup to copy. |
|
|
579
|
+
| `example-mfe/` | 5175 | **Microfrontends**: 4 separate Vite projects — `shell` (the only `AppLayout`, login, single-spa routing from `env.mfe.js`, event-based menu after a session) and 3 MFEs `settings`, `forms`, `profile` (page layouts only; theme and language from localStorage, kept in sync between bundles). See `example-mfe/README.md`. |
|
|
580
|
+
| `example/` | 5173 | **11 languages** (`lang` from the backend, 4 RTL) and **stores** (`branch` from the backend, `isDefault` / `disabled`), plus every component, 3 layouts and all themes. |
|
|
581
|
+
|
|
582
|
+
```bash
|
|
583
|
+
npm run example-basic:install
|
|
584
|
+
npm run example-basic:dev # http://localhost:5174
|
|
585
|
+
```
|
|
586
|
+
|
|
587
|
+
### Full example
|
|
588
|
+
|
|
589
|
+
`example/` is its own small app package (Vite is used only there — an app needs a bundler; the library does not).
|
|
590
|
+
It shows login, dashboard, users CRUD (drawer + confirm + permissions), a **Components** section with every control,
|
|
591
|
+
upload, overlay, skeleton and state, and settings for language (11, including 4 RTL and Telugu, Kannada, Tamil), theme (all 35 DaisyUI themes + custom `org-light` / `org-dark`) and navigation style.
|
|
592
|
+
All pages live in one `App` component (`example/src/app.tsx`) and are picked by `?page`; the menu (`nav`) and the
|
|
593
|
+
languages (`lang`) come from fake backend replies. It uses the library source directly, so changes show up without a build.
|
|
594
|
+
|
|
595
|
+
```bash
|
|
596
|
+
npm run example:install
|
|
597
|
+
npm run example:dev # http://localhost:5173 – log in with any email and a 6+ character password
|
|
598
|
+
```
|
|
599
|
+
|
|
600
|
+
## Development
|
|
601
|
+
|
|
602
|
+
The library has **no bundler and no Vite**: `tsc` compiles `src/` file by file into `dist/` (readable ES modules + `.d.ts`),
|
|
603
|
+
and the tests run on Node's built-in test runner (`node:test` + `jsdom`, setup in `scripts/test-setup.mjs`).
|
|
604
|
+
|
|
605
|
+
```bash
|
|
606
|
+
npm install
|
|
607
|
+
npm run verify # typecheck + code style + tests + build
|
|
608
|
+
npm run build # tsc -> dist/, fix .d.ts import paths, copy styles.css
|
|
609
|
+
npm run check:style # readability rules only
|
|
610
|
+
npm test # tsc -> build-test/, then Node's built-in test runner (node --test) with jsdom
|
|
611
|
+
```
|
|
612
|
+
|
|
613
|
+
Inside `src/`, relative imports use the real file extension (`./type.icon.ts`); `tsc` rewrites them to `.js` in `dist/`.
|
|
614
|
+
|
|
615
|
+
## Publishing
|
|
616
|
+
|
|
617
|
+
```bash
|
|
618
|
+
npm login
|
|
619
|
+
npm version minor
|
|
620
|
+
npm publish
|
|
621
|
+
```
|
|
622
|
+
|
|
623
|
+
Or use `github-workflows/publish.yml` (move it to `.github/workflows/` and add the `NPM_TOKEN` secret).
|
|
624
|
+
|
|
625
|
+
## License
|
|
626
|
+
|
|
627
|
+
[MIT](./LICENSE) © 2026 DesignForFeature.
|
|
628
|
+
|
|
629
|
+
Anybody can use this library for free, in personal or commercial projects: use it, copy it, change it, merge it,
|
|
630
|
+
publish it, share it and sell software built with it. The only condition is to keep the copyright and license notice
|
|
631
|
+
(the `LICENSE` file) with copies of the library. It comes "as is", without warranty.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface AppBrandProps {
|
|
2
|
+
/** Hide the app name text (logo only). */
|
|
3
|
+
isNameHidden?: boolean;
|
|
4
|
+
/** Extra classes for the app name, for example "lg:hidden". */
|
|
5
|
+
nameClassName?: string;
|
|
6
|
+
className?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function AppBrand(props: AppBrandProps): import("react").JSX.Element;
|
|
9
|
+
//# sourceMappingURL=app-brand.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-brand.d.ts","sourceRoot":"","sources":["../../src/components/app-brand.tsx"],"names":[],"mappings":"AASA,MAAM,WAAW,aAAa;IAC5B,0CAA0C;IAC1C,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,+DAA+D;IAC/D,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,+BAmB5C"}
|