@surfnet/curve-angular 0.2.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/.postcssrc.json +7 -0
- package/.storybook/main.ts +9 -0
- package/.storybook/manager.ts +3 -0
- package/.storybook/preview.ts +28 -0
- package/.storybook/tsconfig.json +8 -0
- package/.turbo/turbo-build.log +32 -0
- package/CHANGELOG.md +29 -0
- package/angular.json +52 -0
- package/components.json +5 -0
- package/dist/fesm2022/surfnet-curve-angular.mjs +4237 -0
- package/dist/fesm2022/surfnet-curve-angular.mjs.map +1 -0
- package/dist/files/geist-cyrillic-ext-wght-italic.woff2 +0 -0
- package/dist/files/geist-cyrillic-ext-wght-normal.woff2 +0 -0
- package/dist/files/geist-cyrillic-wght-italic.woff2 +0 -0
- package/dist/files/geist-cyrillic-wght-normal.woff2 +0 -0
- package/dist/files/geist-latin-ext-wght-italic.woff2 +0 -0
- package/dist/files/geist-latin-ext-wght-normal.woff2 +0 -0
- package/dist/files/geist-latin-wght-italic.woff2 +0 -0
- package/dist/files/geist-latin-wght-normal.woff2 +0 -0
- package/dist/files/geist-vietnamese-wght-italic.woff2 +0 -0
- package/dist/files/geist-vietnamese-wght-normal.woff2 +0 -0
- package/dist/styles.css +2 -0
- package/dist/types/surfnet-curve-angular.d.ts +1017 -0
- package/ng-package.json +20 -0
- package/package.json +73 -0
- package/scripts/copy-font-files.ts +15 -0
- package/scripts/rewrite-helm-imports.ts +60 -0
- package/src/foundations/design-tokens.stories.ts +198 -0
- package/src/lib/ui/avatar/src/index.ts +22 -0
- package/src/lib/ui/avatar/src/lib/hlm-avatar-badge.ts +19 -0
- package/src/lib/ui/avatar/src/lib/hlm-avatar-fallback.ts +20 -0
- package/src/lib/ui/avatar/src/lib/hlm-avatar-group-count.ts +17 -0
- package/src/lib/ui/avatar/src/lib/hlm-avatar-group.ts +17 -0
- package/src/lib/ui/avatar/src/lib/hlm-avatar-image.ts +19 -0
- package/src/lib/ui/avatar/src/lib/hlm-avatar.stories.ts +107 -0
- package/src/lib/ui/avatar/src/lib/hlm-avatar.ts +32 -0
- package/src/lib/ui/breadcrumb/src/index.ts +30 -0
- package/src/lib/ui/breadcrumb/src/lib/hlm-breadcrumb-ellipsis.ts +36 -0
- package/src/lib/ui/breadcrumb/src/lib/hlm-breadcrumb-item.ts +14 -0
- package/src/lib/ui/breadcrumb/src/lib/hlm-breadcrumb-link.ts +36 -0
- package/src/lib/ui/breadcrumb/src/lib/hlm-breadcrumb-list.ts +17 -0
- package/src/lib/ui/breadcrumb/src/lib/hlm-breadcrumb-page.ts +17 -0
- package/src/lib/ui/breadcrumb/src/lib/hlm-breadcrumb-separator.ts +27 -0
- package/src/lib/ui/breadcrumb/src/lib/hlm-breadcrumb.stories.ts +81 -0
- package/src/lib/ui/breadcrumb/src/lib/hlm-breadcrumb.ts +13 -0
- package/src/lib/ui/button/src/index.ts +6 -0
- package/src/lib/ui/button/src/lib/hlm-button.stories.ts +170 -0
- package/src/lib/ui/button/src/lib/hlm-button.token.ts +22 -0
- package/src/lib/ui/button/src/lib/hlm-button.ts +76 -0
- package/src/lib/ui/card/src/index.ts +25 -0
- package/src/lib/ui/card/src/lib/hlm-card-action.ts +12 -0
- package/src/lib/ui/card/src/lib/hlm-card-content.ts +12 -0
- package/src/lib/ui/card/src/lib/hlm-card-description.ts +12 -0
- package/src/lib/ui/card/src/lib/hlm-card-footer.ts +14 -0
- package/src/lib/ui/card/src/lib/hlm-card-header.ts +15 -0
- package/src/lib/ui/card/src/lib/hlm-card-title.ts +12 -0
- package/src/lib/ui/card/src/lib/hlm-card.stories.ts +105 -0
- package/src/lib/ui/card/src/lib/hlm-card.token.ts +19 -0
- package/src/lib/ui/card/src/lib/hlm-card.ts +22 -0
- package/src/lib/ui/checkbox/src/index.ts +5 -0
- package/src/lib/ui/checkbox/src/lib/hlm-checkbox.stories.ts +78 -0
- package/src/lib/ui/checkbox/src/lib/hlm-checkbox.ts +160 -0
- package/src/lib/ui/data-table/src/index.ts +14 -0
- package/src/lib/ui/data-table/src/lib/hlm-data-table-content.ts +87 -0
- package/src/lib/ui/data-table/src/lib/hlm-data-table-pagination.ts +62 -0
- package/src/lib/ui/data-table/src/lib/hlm-data-table-toolbar.ts +16 -0
- package/src/lib/ui/data-table/src/lib/hlm-data-table.stories.ts +479 -0
- package/src/lib/ui/data-table/src/lib/inject-data-table.ts +86 -0
- package/src/lib/ui/dropdown-menu/src/index.ts +45 -0
- package/src/lib/ui/dropdown-menu/src/lib/hlm-dropdown-menu-checkbox-indicator.ts +20 -0
- package/src/lib/ui/dropdown-menu/src/lib/hlm-dropdown-menu-checkbox.ts +36 -0
- package/src/lib/ui/dropdown-menu/src/lib/hlm-dropdown-menu-group.ts +16 -0
- package/src/lib/ui/dropdown-menu/src/lib/hlm-dropdown-menu-item-sub-indicator.ts +17 -0
- package/src/lib/ui/dropdown-menu/src/lib/hlm-dropdown-menu-item.ts +41 -0
- package/src/lib/ui/dropdown-menu/src/lib/hlm-dropdown-menu-label.ts +20 -0
- package/src/lib/ui/dropdown-menu/src/lib/hlm-dropdown-menu-radio-indicator.ts +20 -0
- package/src/lib/ui/dropdown-menu/src/lib/hlm-dropdown-menu-radio.ts +36 -0
- package/src/lib/ui/dropdown-menu/src/lib/hlm-dropdown-menu-separator.ts +14 -0
- package/src/lib/ui/dropdown-menu/src/lib/hlm-dropdown-menu-shortcut.ts +14 -0
- package/src/lib/ui/dropdown-menu/src/lib/hlm-dropdown-menu-sub.ts +58 -0
- package/src/lib/ui/dropdown-menu/src/lib/hlm-dropdown-menu-token.ts +26 -0
- package/src/lib/ui/dropdown-menu/src/lib/hlm-dropdown-menu-trigger.ts +49 -0
- package/src/lib/ui/dropdown-menu/src/lib/hlm-dropdown-menu.stories.ts +125 -0
- package/src/lib/ui/dropdown-menu/src/lib/hlm-dropdown-menu.ts +62 -0
- package/src/lib/ui/field/src/index.ts +34 -0
- package/src/lib/ui/field/src/lib/hlm-field-content.ts +12 -0
- package/src/lib/ui/field/src/lib/hlm-field-description.ts +53 -0
- package/src/lib/ui/field/src/lib/hlm-field-error.ts +100 -0
- package/src/lib/ui/field/src/lib/hlm-field-group.ts +15 -0
- package/src/lib/ui/field/src/lib/hlm-field-label.ts +17 -0
- package/src/lib/ui/field/src/lib/hlm-field-legend.ts +17 -0
- package/src/lib/ui/field/src/lib/hlm-field-separator.ts +24 -0
- package/src/lib/ui/field/src/lib/hlm-field-set.ts +15 -0
- package/src/lib/ui/field/src/lib/hlm-field-title.ts +15 -0
- package/src/lib/ui/field/src/lib/hlm-field.stories.ts +117 -0
- package/src/lib/ui/field/src/lib/hlm-field.ts +49 -0
- package/src/lib/ui/icon/src/index.ts +7 -0
- package/src/lib/ui/icon/src/lib/hlm-icon.token.ts +20 -0
- package/src/lib/ui/icon/src/lib/hlm-icon.ts +42 -0
- package/src/lib/ui/input/src/index.ts +5 -0
- package/src/lib/ui/input/src/lib/hlm-input.stories.ts +94 -0
- package/src/lib/ui/input/src/lib/hlm-input.ts +20 -0
- package/src/lib/ui/input-group/src/index.ts +22 -0
- package/src/lib/ui/input-group/src/lib/hlm-input-group-addon.ts +40 -0
- package/src/lib/ui/input-group/src/lib/hlm-input-group-button.ts +47 -0
- package/src/lib/ui/input-group/src/lib/hlm-input-group-input.ts +17 -0
- package/src/lib/ui/input-group/src/lib/hlm-input-group-text.ts +14 -0
- package/src/lib/ui/input-group/src/lib/hlm-input-group-textarea.ts +17 -0
- package/src/lib/ui/input-group/src/lib/hlm-input-group.stories.ts +133 -0
- package/src/lib/ui/input-group/src/lib/hlm-input-group.ts +18 -0
- package/src/lib/ui/label/src/index.ts +5 -0
- package/src/lib/ui/label/src/lib/hlm-label.stories.ts +55 -0
- package/src/lib/ui/label/src/lib/hlm-label.ts +17 -0
- package/src/lib/ui/select/src/index.ts +52 -0
- package/src/lib/ui/select/src/lib/hlm-select-content.ts +44 -0
- package/src/lib/ui/select/src/lib/hlm-select-group.ts +14 -0
- package/src/lib/ui/select/src/lib/hlm-select-item.ts +36 -0
- package/src/lib/ui/select/src/lib/hlm-select-label.ts +14 -0
- package/src/lib/ui/select/src/lib/hlm-select-multiple.ts +45 -0
- package/src/lib/ui/select/src/lib/hlm-select-placeholder.ts +17 -0
- package/src/lib/ui/select/src/lib/hlm-select-portal.ts +8 -0
- package/src/lib/ui/select/src/lib/hlm-select-scroll-down.ts +22 -0
- package/src/lib/ui/select/src/lib/hlm-select-scroll-up.ts +22 -0
- package/src/lib/ui/select/src/lib/hlm-select-separator.ts +14 -0
- package/src/lib/ui/select/src/lib/hlm-select-trigger.ts +59 -0
- package/src/lib/ui/select/src/lib/hlm-select-value-template.ts +5 -0
- package/src/lib/ui/select/src/lib/hlm-select-value.ts +18 -0
- package/src/lib/ui/select/src/lib/hlm-select-values-content.ts +9 -0
- package/src/lib/ui/select/src/lib/hlm-select-values.ts +5 -0
- package/src/lib/ui/select/src/lib/hlm-select.stories.ts +105 -0
- package/src/lib/ui/select/src/lib/hlm-select.ts +45 -0
- package/src/lib/ui/separator/src/index.ts +5 -0
- package/src/lib/ui/separator/src/lib/hlm-separator.stories.ts +88 -0
- package/src/lib/ui/separator/src/lib/hlm-separator.ts +19 -0
- package/src/lib/ui/sheet/src/index.ts +34 -0
- package/src/lib/ui/sheet/src/lib/hlm-sheet-close.ts +9 -0
- package/src/lib/ui/sheet/src/lib/hlm-sheet-content.ts +66 -0
- package/src/lib/ui/sheet/src/lib/hlm-sheet-description.ts +14 -0
- package/src/lib/ui/sheet/src/lib/hlm-sheet-footer.ts +12 -0
- package/src/lib/ui/sheet/src/lib/hlm-sheet-header.ts +12 -0
- package/src/lib/ui/sheet/src/lib/hlm-sheet-overlay.ts +27 -0
- package/src/lib/ui/sheet/src/lib/hlm-sheet-portal.ts +8 -0
- package/src/lib/ui/sheet/src/lib/hlm-sheet-title.ts +14 -0
- package/src/lib/ui/sheet/src/lib/hlm-sheet-trigger.ts +9 -0
- package/src/lib/ui/sheet/src/lib/hlm-sheet.ts +29 -0
- package/src/lib/ui/sidebar/src/index.ts +75 -0
- package/src/lib/ui/sidebar/src/lib/hlm-sidebar-content.ts +18 -0
- package/src/lib/ui/sidebar/src/lib/hlm-sidebar-footer.ts +15 -0
- package/src/lib/ui/sidebar/src/lib/hlm-sidebar-group-action.ts +18 -0
- package/src/lib/ui/sidebar/src/lib/hlm-sidebar-group-content.ts +15 -0
- package/src/lib/ui/sidebar/src/lib/hlm-sidebar-group-label.ts +18 -0
- package/src/lib/ui/sidebar/src/lib/hlm-sidebar-group.ts +15 -0
- package/src/lib/ui/sidebar/src/lib/hlm-sidebar-header.ts +15 -0
- package/src/lib/ui/sidebar/src/lib/hlm-sidebar-input.ts +17 -0
- package/src/lib/ui/sidebar/src/lib/hlm-sidebar-inset.ts +15 -0
- package/src/lib/ui/sidebar/src/lib/hlm-sidebar-menu-action.ts +24 -0
- package/src/lib/ui/sidebar/src/lib/hlm-sidebar-menu-badge.ts +18 -0
- package/src/lib/ui/sidebar/src/lib/hlm-sidebar-menu-button.ts +97 -0
- package/src/lib/ui/sidebar/src/lib/hlm-sidebar-menu-item.ts +15 -0
- package/src/lib/ui/sidebar/src/lib/hlm-sidebar-menu-skeleton.ts +33 -0
- package/src/lib/ui/sidebar/src/lib/hlm-sidebar-menu-sub-button.ts +41 -0
- package/src/lib/ui/sidebar/src/lib/hlm-sidebar-menu-sub-item.ts +15 -0
- package/src/lib/ui/sidebar/src/lib/hlm-sidebar-menu-sub.ts +18 -0
- package/src/lib/ui/sidebar/src/lib/hlm-sidebar-menu.ts +15 -0
- package/src/lib/ui/sidebar/src/lib/hlm-sidebar-rail.ts +34 -0
- package/src/lib/ui/sidebar/src/lib/hlm-sidebar-separator.ts +17 -0
- package/src/lib/ui/sidebar/src/lib/hlm-sidebar-trigger.ts +35 -0
- package/src/lib/ui/sidebar/src/lib/hlm-sidebar-wrapper.ts +24 -0
- package/src/lib/ui/sidebar/src/lib/hlm-sidebar.service.ts +136 -0
- package/src/lib/ui/sidebar/src/lib/hlm-sidebar.stories.ts +177 -0
- package/src/lib/ui/sidebar/src/lib/hlm-sidebar.token.ts +33 -0
- package/src/lib/ui/sidebar/src/lib/hlm-sidebar.ts +139 -0
- package/src/lib/ui/skeleton/src/index.ts +5 -0
- package/src/lib/ui/skeleton/src/lib/hlm-skeleton.ts +14 -0
- package/src/lib/ui/table/src/index.ts +25 -0
- package/src/lib/ui/table/src/lib/hlm-table.stories.ts +70 -0
- package/src/lib/ui/table/src/lib/hlm-table.ts +129 -0
- package/src/lib/ui/textarea/src/index.ts +5 -0
- package/src/lib/ui/textarea/src/lib/hlm-textarea.stories.ts +72 -0
- package/src/lib/ui/textarea/src/lib/hlm-textarea.ts +21 -0
- package/src/lib/ui/tooltip/src/index.ts +5 -0
- package/src/lib/ui/tooltip/src/lib/hlm-tooltip.ts +44 -0
- package/src/lib/ui/utils/src/index.ts +1 -0
- package/src/lib/ui/utils/src/lib/hlm.ts +313 -0
- package/src/public-api.ts +24 -0
- package/src/styles.css +43 -0
- package/tsconfig.json +45 -0
- package/tsconfig.lib.json +11 -0
- package/tsconfig.lib.prod.json +9 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { HlmSidebar } from './lib/hlm-sidebar';
|
|
2
|
+
import { HlmSidebarContent } from './lib/hlm-sidebar-content';
|
|
3
|
+
import { HlmSidebarFooter } from './lib/hlm-sidebar-footer';
|
|
4
|
+
import { HlmSidebarGroup } from './lib/hlm-sidebar-group';
|
|
5
|
+
import { HlmSidebarGroupAction } from './lib/hlm-sidebar-group-action';
|
|
6
|
+
import { HlmSidebarGroupContent } from './lib/hlm-sidebar-group-content';
|
|
7
|
+
import { HlmSidebarGroupLabel } from './lib/hlm-sidebar-group-label';
|
|
8
|
+
import { HlmSidebarHeader } from './lib/hlm-sidebar-header';
|
|
9
|
+
import { HlmSidebarInput } from './lib/hlm-sidebar-input';
|
|
10
|
+
import { HlmSidebarInset } from './lib/hlm-sidebar-inset';
|
|
11
|
+
import { HlmSidebarMenu } from './lib/hlm-sidebar-menu';
|
|
12
|
+
import { HlmSidebarMenuAction } from './lib/hlm-sidebar-menu-action';
|
|
13
|
+
import { HlmSidebarMenuBadge } from './lib/hlm-sidebar-menu-badge';
|
|
14
|
+
import { HlmSidebarMenuButton } from './lib/hlm-sidebar-menu-button';
|
|
15
|
+
import { HlmSidebarMenuItem } from './lib/hlm-sidebar-menu-item';
|
|
16
|
+
import { HlmSidebarMenuSkeleton } from './lib/hlm-sidebar-menu-skeleton';
|
|
17
|
+
import { HlmSidebarMenuSub } from './lib/hlm-sidebar-menu-sub';
|
|
18
|
+
import { HlmSidebarMenuSubButton } from './lib/hlm-sidebar-menu-sub-button';
|
|
19
|
+
import { HlmSidebarMenuSubItem } from './lib/hlm-sidebar-menu-sub-item';
|
|
20
|
+
import { HlmSidebarRail } from './lib/hlm-sidebar-rail';
|
|
21
|
+
import { HlmSidebarSeparator } from './lib/hlm-sidebar-separator';
|
|
22
|
+
import { HlmSidebarTrigger } from './lib/hlm-sidebar-trigger';
|
|
23
|
+
import { HlmSidebarWrapper } from './lib/hlm-sidebar-wrapper';
|
|
24
|
+
|
|
25
|
+
export * from './lib/hlm-sidebar';
|
|
26
|
+
export * from './lib/hlm-sidebar-content';
|
|
27
|
+
export * from './lib/hlm-sidebar-footer';
|
|
28
|
+
export * from './lib/hlm-sidebar-group';
|
|
29
|
+
export * from './lib/hlm-sidebar-group-action';
|
|
30
|
+
export * from './lib/hlm-sidebar-group-content';
|
|
31
|
+
export * from './lib/hlm-sidebar-group-label';
|
|
32
|
+
export * from './lib/hlm-sidebar-header';
|
|
33
|
+
export * from './lib/hlm-sidebar-input';
|
|
34
|
+
export * from './lib/hlm-sidebar-inset';
|
|
35
|
+
export * from './lib/hlm-sidebar-menu';
|
|
36
|
+
export * from './lib/hlm-sidebar-menu-action';
|
|
37
|
+
export * from './lib/hlm-sidebar-menu-badge';
|
|
38
|
+
export * from './lib/hlm-sidebar-menu-button';
|
|
39
|
+
export * from './lib/hlm-sidebar-menu-item';
|
|
40
|
+
export * from './lib/hlm-sidebar-menu-skeleton';
|
|
41
|
+
export * from './lib/hlm-sidebar-menu-sub';
|
|
42
|
+
export * from './lib/hlm-sidebar-menu-sub-button';
|
|
43
|
+
export * from './lib/hlm-sidebar-menu-sub-item';
|
|
44
|
+
export * from './lib/hlm-sidebar-rail';
|
|
45
|
+
export * from './lib/hlm-sidebar-separator';
|
|
46
|
+
export * from './lib/hlm-sidebar-trigger';
|
|
47
|
+
export * from './lib/hlm-sidebar-wrapper';
|
|
48
|
+
export * from './lib/hlm-sidebar.service';
|
|
49
|
+
export * from './lib/hlm-sidebar.token';
|
|
50
|
+
|
|
51
|
+
export const HlmSidebarImports = [
|
|
52
|
+
HlmSidebar,
|
|
53
|
+
HlmSidebarContent,
|
|
54
|
+
HlmSidebarFooter,
|
|
55
|
+
HlmSidebarGroup,
|
|
56
|
+
HlmSidebarGroupAction,
|
|
57
|
+
HlmSidebarGroupContent,
|
|
58
|
+
HlmSidebarGroupLabel,
|
|
59
|
+
HlmSidebarHeader,
|
|
60
|
+
HlmSidebarInput,
|
|
61
|
+
HlmSidebarInset,
|
|
62
|
+
HlmSidebarMenu,
|
|
63
|
+
HlmSidebarMenuSkeleton,
|
|
64
|
+
HlmSidebarMenuAction,
|
|
65
|
+
HlmSidebarMenuBadge,
|
|
66
|
+
HlmSidebarMenuButton,
|
|
67
|
+
HlmSidebarMenuItem,
|
|
68
|
+
HlmSidebarMenuSub,
|
|
69
|
+
HlmSidebarMenuSubButton,
|
|
70
|
+
HlmSidebarRail,
|
|
71
|
+
HlmSidebarSeparator,
|
|
72
|
+
HlmSidebarTrigger,
|
|
73
|
+
HlmSidebarWrapper,
|
|
74
|
+
HlmSidebarMenuSubItem,
|
|
75
|
+
] as const;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Directive } from '@angular/core';
|
|
2
|
+
import { classes } from '../../../utils/src';
|
|
3
|
+
|
|
4
|
+
@Directive({
|
|
5
|
+
selector: '[hlmSidebarContent],hlm-sidebar-content',
|
|
6
|
+
host: {
|
|
7
|
+
'data-slot': 'sidebar-content',
|
|
8
|
+
'data-sidebar': 'content',
|
|
9
|
+
},
|
|
10
|
+
})
|
|
11
|
+
export class HlmSidebarContent {
|
|
12
|
+
constructor() {
|
|
13
|
+
classes(
|
|
14
|
+
() =>
|
|
15
|
+
'no-scrollbar gap-2 flex min-h-0 flex-1 flex-col overflow-auto group-data-[collapsible=icon]:overflow-hidden',
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Directive } from '@angular/core';
|
|
2
|
+
import { classes } from '../../../utils/src';
|
|
3
|
+
|
|
4
|
+
@Directive({
|
|
5
|
+
selector: '[hlmSidebarFooter],hlm-sidebar-footer',
|
|
6
|
+
host: {
|
|
7
|
+
'data-slot': 'sidebar-footer',
|
|
8
|
+
'data-sidebar': 'footer',
|
|
9
|
+
},
|
|
10
|
+
})
|
|
11
|
+
export class HlmSidebarFooter {
|
|
12
|
+
constructor() {
|
|
13
|
+
classes(() => 'gap-2 p-2 flex flex-col');
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Directive } from '@angular/core';
|
|
2
|
+
import { classes } from '../../../utils/src';
|
|
3
|
+
|
|
4
|
+
@Directive({
|
|
5
|
+
selector: 'button[hlmSidebarGroupAction]',
|
|
6
|
+
host: {
|
|
7
|
+
'data-slot': 'sidebar-group-action',
|
|
8
|
+
'data-sidebar': 'group-action',
|
|
9
|
+
},
|
|
10
|
+
})
|
|
11
|
+
export class HlmSidebarGroupAction {
|
|
12
|
+
constructor() {
|
|
13
|
+
classes(
|
|
14
|
+
() =>
|
|
15
|
+
'text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground absolute end-3 top-3.5 w-5 rounded-md p-0 focus-visible:ring-2 [&>ng-icon]:text-[calc(var(--spacing)*4)] flex aspect-square items-center justify-center outline-hidden transition-transform group-data-[collapsible=icon]:hidden after:absolute after:-inset-2 md:after:hidden [&>ng-icon]:shrink-0',
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Directive } from '@angular/core';
|
|
2
|
+
import { classes } from '../../../utils/src';
|
|
3
|
+
|
|
4
|
+
@Directive({
|
|
5
|
+
selector: 'div[hlmSidebarGroupContent]',
|
|
6
|
+
host: {
|
|
7
|
+
'data-slot': 'sidebar-group-content',
|
|
8
|
+
'data-sidebar': 'group-content',
|
|
9
|
+
},
|
|
10
|
+
})
|
|
11
|
+
export class HlmSidebarGroupContent {
|
|
12
|
+
constructor() {
|
|
13
|
+
classes(() => 'text-sm w-full');
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Directive } from '@angular/core';
|
|
2
|
+
import { classes } from '../../../utils/src';
|
|
3
|
+
|
|
4
|
+
@Directive({
|
|
5
|
+
selector: 'div[hlmSidebarGroupLabel], button[hlmSidebarGroupLabel]',
|
|
6
|
+
host: {
|
|
7
|
+
'data-slot': 'sidebar-group-label',
|
|
8
|
+
'data-sidebar': 'group-label',
|
|
9
|
+
},
|
|
10
|
+
})
|
|
11
|
+
export class HlmSidebarGroupLabel {
|
|
12
|
+
constructor() {
|
|
13
|
+
classes(
|
|
14
|
+
() =>
|
|
15
|
+
'text-sidebar-foreground/70 ring-sidebar-ring h-8 rounded-md px-2 text-xs font-medium transition-[margin,opacity] duration-200 ease-linear group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 focus-visible:ring-2 [&>ng-icon]:text-[calc(var(--spacing)*4)] flex shrink-0 items-center outline-hidden [&>ng-icon]:shrink-0',
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Directive } from '@angular/core';
|
|
2
|
+
import { classes } from '../../../utils/src';
|
|
3
|
+
|
|
4
|
+
@Directive({
|
|
5
|
+
selector: '[hlmSidebarGroup],hlm-sidebar-group',
|
|
6
|
+
host: {
|
|
7
|
+
'data-slot': 'sidebar-group',
|
|
8
|
+
'data-sidebar': 'group',
|
|
9
|
+
},
|
|
10
|
+
})
|
|
11
|
+
export class HlmSidebarGroup {
|
|
12
|
+
constructor() {
|
|
13
|
+
classes(() => 'p-2 relative flex w-full min-w-0 flex-col');
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Directive } from '@angular/core';
|
|
2
|
+
import { classes } from '../../../utils/src';
|
|
3
|
+
|
|
4
|
+
@Directive({
|
|
5
|
+
selector: '[hlmSidebarHeader],hlm-sidebar-header',
|
|
6
|
+
host: {
|
|
7
|
+
'data-slot': 'sidebar-header',
|
|
8
|
+
'data-sidebar': 'header',
|
|
9
|
+
},
|
|
10
|
+
})
|
|
11
|
+
export class HlmSidebarHeader {
|
|
12
|
+
constructor() {
|
|
13
|
+
classes(() => 'gap-2 p-2 flex flex-col');
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Directive } from '@angular/core';
|
|
2
|
+
import { HlmInput } from '../../../input/src';
|
|
3
|
+
import { classes } from '../../../utils/src';
|
|
4
|
+
|
|
5
|
+
@Directive({
|
|
6
|
+
selector: 'input[hlmSidebarInput]',
|
|
7
|
+
hostDirectives: [HlmInput],
|
|
8
|
+
host: {
|
|
9
|
+
'data-slot': 'sidebar-input',
|
|
10
|
+
'data-sidebar': 'input',
|
|
11
|
+
},
|
|
12
|
+
})
|
|
13
|
+
export class HlmSidebarInput {
|
|
14
|
+
constructor() {
|
|
15
|
+
classes(() => 'bg-background h-8 w-full shadow-none');
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Directive } from '@angular/core';
|
|
2
|
+
import { classes } from '../../../utils/src';
|
|
3
|
+
|
|
4
|
+
@Directive({
|
|
5
|
+
selector: 'main[hlmSidebarInset]',
|
|
6
|
+
host: { 'data-slot': 'sidebar-inset' },
|
|
7
|
+
})
|
|
8
|
+
export class HlmSidebarInset {
|
|
9
|
+
constructor() {
|
|
10
|
+
classes(
|
|
11
|
+
() =>
|
|
12
|
+
'bg-background md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ms-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ms-2 relative flex w-full flex-1 flex-col',
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type BooleanInput } from '@angular/cdk/coercion';
|
|
2
|
+
import { booleanAttribute, Directive, input } from '@angular/core';
|
|
3
|
+
import { classes } from '../../../utils/src';
|
|
4
|
+
|
|
5
|
+
@Directive({
|
|
6
|
+
selector: 'button[hlmSidebarMenuAction]',
|
|
7
|
+
host: {
|
|
8
|
+
'data-slot': 'sidebar-menu-action',
|
|
9
|
+
'data-sidebar': 'menu-action',
|
|
10
|
+
},
|
|
11
|
+
})
|
|
12
|
+
export class HlmSidebarMenuAction {
|
|
13
|
+
public readonly showOnHover = input<boolean, BooleanInput>(false, {
|
|
14
|
+
transform: booleanAttribute,
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
constructor() {
|
|
18
|
+
classes(() => [
|
|
19
|
+
'text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground peer-hover/menu-button:text-sidebar-accent-foreground absolute end-1 top-1.5 aspect-square w-5 rounded-md p-0 peer-data-[size=default]/menu-button:top-1.5 peer-data-[size=lg]/menu-button:top-2.5 peer-data-[size=sm]/menu-button:top-1 focus-visible:ring-2 [&>ng-icon]:text-[calc(var(--spacing)*4)] flex items-center justify-center outline-hidden transition-transform group-data-[collapsible=icon]:hidden after:absolute after:-inset-2 md:after:hidden [&>ng-icon]:shrink-0',
|
|
20
|
+
this.showOnHover() &&
|
|
21
|
+
'peer-data-active/menu-button:text-sidebar-accent-foreground group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 aria-expanded:opacity-100 md:opacity-0',
|
|
22
|
+
]);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Directive } from '@angular/core';
|
|
2
|
+
import { classes } from '../../../utils/src';
|
|
3
|
+
|
|
4
|
+
@Directive({
|
|
5
|
+
selector: '[hlmSidebarMenuBadge],hlm-sidebar-menu-badge',
|
|
6
|
+
host: {
|
|
7
|
+
'data-slot': 'sidebar-menu-badge',
|
|
8
|
+
'data-sidebar': 'menu-badge',
|
|
9
|
+
},
|
|
10
|
+
})
|
|
11
|
+
export class HlmSidebarMenuBadge {
|
|
12
|
+
constructor() {
|
|
13
|
+
classes(
|
|
14
|
+
() =>
|
|
15
|
+
'text-sidebar-foreground peer-hover/menu-button:text-sidebar-accent-foreground peer-data-active/menu-button:text-sidebar-accent-foreground pointer-events-none absolute end-1 h-5 min-w-5 rounded-md px-1 text-xs font-medium peer-data-[size=default]/menu-button:top-1.5 peer-data-[size=lg]/menu-button:top-2.5 peer-data-[size=sm]/menu-button:top-1 flex items-center justify-center tabular-nums select-none group-data-[collapsible=icon]:hidden',
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { type BooleanInput } from '@angular/cdk/coercion';
|
|
2
|
+
import { booleanAttribute, computed, Directive, effect, inject, input } from '@angular/core';
|
|
3
|
+
import {
|
|
4
|
+
BrnTooltip,
|
|
5
|
+
BrnTooltipPosition,
|
|
6
|
+
provideBrnTooltipDefaultOptions,
|
|
7
|
+
} from '@spartan-ng/brain/tooltip';
|
|
8
|
+
import { classes, hlm } from '../../../utils/src';
|
|
9
|
+
import type {
|
|
10
|
+
SidebarMenuButtonSizeName,
|
|
11
|
+
SidebarMenuButtonVariantName,
|
|
12
|
+
} from '@surfnet/curve-contracts';
|
|
13
|
+
import { cva } from 'class-variance-authority';
|
|
14
|
+
import { HlmSidebarService } from './hlm-sidebar.service';
|
|
15
|
+
import { injectHlmSidebarConfig } from './hlm-sidebar.token';
|
|
16
|
+
import {
|
|
17
|
+
DEFAULT_TOOLTIP_CONTENT_CLASSES,
|
|
18
|
+
DEFAULT_TOOLTIP_SVG_CLASS,
|
|
19
|
+
tooltipPositionVariants,
|
|
20
|
+
} from '../../../tooltip/src';
|
|
21
|
+
|
|
22
|
+
const sidebarMenuButtonVariants = cva(
|
|
23
|
+
'ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:text-sidebar-accent-foreground data-open:hover:bg-sidebar-accent data-open:hover:text-sidebar-accent-foreground gap-2 rounded-md p-2 text-start text-sm transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pe-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! focus-visible:ring-2 data-active:font-medium peer/menu-button group/menu-button flex w-full items-center overflow-hidden outline-hidden disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&_ng-icon]:shrink-0 [&_ng-icon]:text-[calc(var(--spacing)*4)] [&>span:last-child]:truncate',
|
|
24
|
+
{
|
|
25
|
+
variants: {
|
|
26
|
+
variant: {
|
|
27
|
+
default: 'hover:bg-sidebar-accent hover:text-sidebar-accent-foreground',
|
|
28
|
+
outline:
|
|
29
|
+
'bg-background hover:bg-sidebar-accent hover:text-sidebar-accent-foreground shadow-[0_0_0_1px_var(--sidebar-border)] hover:shadow-[0_0_0_1px_var(--sidebar-accent)]',
|
|
30
|
+
} satisfies Record<SidebarMenuButtonVariantName, string>,
|
|
31
|
+
size: {
|
|
32
|
+
default: 'h-8 text-sm',
|
|
33
|
+
sm: 'h-7 text-xs',
|
|
34
|
+
lg: 'h-12 text-sm group-data-[collapsible=icon]:p-0!',
|
|
35
|
+
} satisfies Record<SidebarMenuButtonSizeName, string>,
|
|
36
|
+
},
|
|
37
|
+
defaultVariants: {
|
|
38
|
+
variant: 'default',
|
|
39
|
+
size: 'default',
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
@Directive({
|
|
45
|
+
selector: 'button[hlmSidebarMenuButton], a[hlmSidebarMenuButton]',
|
|
46
|
+
providers: [
|
|
47
|
+
provideBrnTooltipDefaultOptions({
|
|
48
|
+
showDelay: 150,
|
|
49
|
+
hideDelay: 0,
|
|
50
|
+
tooltipContentClasses: DEFAULT_TOOLTIP_CONTENT_CLASSES,
|
|
51
|
+
svgClasses: DEFAULT_TOOLTIP_SVG_CLASS,
|
|
52
|
+
arrowClasses: (position: BrnTooltipPosition) => hlm(tooltipPositionVariants({ position })),
|
|
53
|
+
position: 'right',
|
|
54
|
+
}),
|
|
55
|
+
],
|
|
56
|
+
hostDirectives: [
|
|
57
|
+
{
|
|
58
|
+
directive: BrnTooltip,
|
|
59
|
+
inputs: ['brnTooltip: tooltip'],
|
|
60
|
+
},
|
|
61
|
+
],
|
|
62
|
+
host: {
|
|
63
|
+
'data-slot': 'sidebar-menu-button',
|
|
64
|
+
'data-sidebar': 'menu-button',
|
|
65
|
+
'[attr.data-size]': 'size()',
|
|
66
|
+
'[attr.data-active]': 'isActive()',
|
|
67
|
+
'(click)': 'onClick()',
|
|
68
|
+
},
|
|
69
|
+
})
|
|
70
|
+
export class HlmSidebarMenuButton {
|
|
71
|
+
private readonly _config = injectHlmSidebarConfig();
|
|
72
|
+
private readonly _sidebarService = inject(HlmSidebarService);
|
|
73
|
+
private readonly _brnTooltip = inject(BrnTooltip);
|
|
74
|
+
|
|
75
|
+
public readonly variant = input<SidebarMenuButtonVariantName>('default');
|
|
76
|
+
public readonly size = input<SidebarMenuButtonSizeName>('default');
|
|
77
|
+
public readonly isActive = input<boolean, BooleanInput>(false, { transform: booleanAttribute });
|
|
78
|
+
public readonly closeMobileSidebarOnClick = input<boolean, BooleanInput>(
|
|
79
|
+
this._config.closeMobileSidebarOnMenuButtonClick,
|
|
80
|
+
{ transform: booleanAttribute },
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
protected readonly _isTooltipHidden = computed(
|
|
84
|
+
() => this._sidebarService.state() !== 'collapsed' || this._sidebarService.isMobile(),
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
constructor() {
|
|
88
|
+
classes(() => sidebarMenuButtonVariants({ variant: this.variant(), size: this.size() }));
|
|
89
|
+
effect(() => this._brnTooltip.mutableTooltipDisabled.set(this._isTooltipHidden()));
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
protected onClick(): void {
|
|
93
|
+
if (this.closeMobileSidebarOnClick()) {
|
|
94
|
+
this._sidebarService.setOpenMobile(false);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Directive } from '@angular/core';
|
|
2
|
+
import { classes } from '../../../utils/src';
|
|
3
|
+
|
|
4
|
+
@Directive({
|
|
5
|
+
selector: 'li[hlmSidebarMenuItem]',
|
|
6
|
+
host: {
|
|
7
|
+
'data-slot': 'sidebar-menu-item',
|
|
8
|
+
'data-sidebar': 'menu-item',
|
|
9
|
+
},
|
|
10
|
+
})
|
|
11
|
+
export class HlmSidebarMenuItem {
|
|
12
|
+
constructor() {
|
|
13
|
+
classes(() => 'group/menu-item relative');
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type BooleanInput } from '@angular/cdk/coercion';
|
|
2
|
+
import { booleanAttribute, ChangeDetectionStrategy, Component, input } from '@angular/core';
|
|
3
|
+
import { HlmSkeletonImports } from '../../../skeleton/src';
|
|
4
|
+
import { classes } from '../../../utils/src';
|
|
5
|
+
|
|
6
|
+
@Component({
|
|
7
|
+
selector: 'hlm-sidebar-menu-skeleton,div[hlmSidebarMenuSkeleton]',
|
|
8
|
+
imports: [HlmSkeletonImports],
|
|
9
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
10
|
+
host: {
|
|
11
|
+
'data-slot': 'sidebar-menu-skeleton',
|
|
12
|
+
'data-sidebar': 'menu-skeleton',
|
|
13
|
+
},
|
|
14
|
+
template: `
|
|
15
|
+
@if (showIcon()) {
|
|
16
|
+
<hlm-skeleton data-sidebar="menu-skeleton-icon" class="size-4 rounded-md" />
|
|
17
|
+
} @else {
|
|
18
|
+
<hlm-skeleton
|
|
19
|
+
data-sidebar="menu-skeleton-text"
|
|
20
|
+
class="h-4 max-w-(--skeleton-width) flex-1"
|
|
21
|
+
[style.--skeleton-width]="_width"
|
|
22
|
+
/>
|
|
23
|
+
}
|
|
24
|
+
`,
|
|
25
|
+
})
|
|
26
|
+
export class HlmSidebarMenuSkeleton {
|
|
27
|
+
public readonly showIcon = input<boolean, BooleanInput>(false, { transform: booleanAttribute });
|
|
28
|
+
protected readonly _width = `${Math.floor(Math.random() * 40) + 50}%`;
|
|
29
|
+
|
|
30
|
+
constructor() {
|
|
31
|
+
classes(() => 'h-8 gap-2 rounded-md px-2 flex items-center');
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type BooleanInput } from '@angular/cdk/coercion';
|
|
2
|
+
import { booleanAttribute, Directive, inject, input } from '@angular/core';
|
|
3
|
+
import { classes } from '../../../utils/src';
|
|
4
|
+
import { HlmSidebarService } from './hlm-sidebar.service';
|
|
5
|
+
import { injectHlmSidebarConfig } from './hlm-sidebar.token';
|
|
6
|
+
|
|
7
|
+
@Directive({
|
|
8
|
+
selector: 'a[hlmSidebarMenuSubButton], button[hlmSidebarMenuSubButton]',
|
|
9
|
+
host: {
|
|
10
|
+
'data-slot': 'sidebar-menu-sub-button',
|
|
11
|
+
'data-sidebar': 'menu-sub-button',
|
|
12
|
+
'[attr.data-active]': 'isActive()',
|
|
13
|
+
'[attr.data-size]': 'size()',
|
|
14
|
+
'(click)': 'onClick()',
|
|
15
|
+
},
|
|
16
|
+
})
|
|
17
|
+
export class HlmSidebarMenuSubButton {
|
|
18
|
+
private readonly _sidebarService = inject(HlmSidebarService);
|
|
19
|
+
private readonly _config = injectHlmSidebarConfig();
|
|
20
|
+
|
|
21
|
+
public readonly closeMobileSidebarOnClick = input<boolean, BooleanInput>(
|
|
22
|
+
this._config.closeMobileSidebarOnMenuButtonClick,
|
|
23
|
+
{ transform: booleanAttribute },
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
public readonly size = input<'sm' | 'md'>('md');
|
|
27
|
+
public readonly isActive = input<boolean, BooleanInput>(false, { transform: booleanAttribute });
|
|
28
|
+
|
|
29
|
+
constructor() {
|
|
30
|
+
classes(
|
|
31
|
+
() =>
|
|
32
|
+
'text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground [&>svg]:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:text-sidebar-accent-foreground h-7 gap-2 rounded-md px-2 focus-visible:ring-2 data-[size=md]:text-sm data-[size=sm]:text-xs [&>ng-icon]:text-[calc(var(--spacing)*4)] flex min-w-0 -translate-x-px items-center overflow-hidden outline-hidden group-data-[collapsible=icon]:hidden disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>ng-icon]:shrink-0 [&>span:last-child]:truncate',
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
protected onClick(): void {
|
|
37
|
+
if (this.closeMobileSidebarOnClick()) {
|
|
38
|
+
this._sidebarService.setOpenMobile(false);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Directive } from '@angular/core';
|
|
2
|
+
import { classes } from '../../../utils/src';
|
|
3
|
+
|
|
4
|
+
@Directive({
|
|
5
|
+
selector: 'li[hlmSidebarMenuSubItem]',
|
|
6
|
+
host: {
|
|
7
|
+
'data-slot': 'sidebar-menu-sub-item',
|
|
8
|
+
'data-sidebar': 'menu-sub-item',
|
|
9
|
+
},
|
|
10
|
+
})
|
|
11
|
+
export class HlmSidebarMenuSubItem {
|
|
12
|
+
constructor() {
|
|
13
|
+
classes(() => 'group/menu-sub-item relative');
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Directive } from '@angular/core';
|
|
2
|
+
import { classes } from '../../../utils/src';
|
|
3
|
+
|
|
4
|
+
@Directive({
|
|
5
|
+
selector: 'ul[hlmSidebarMenuSub]',
|
|
6
|
+
host: {
|
|
7
|
+
'data-slot': 'sidebar-menu-sub',
|
|
8
|
+
'data-sidebar': 'menu-sub',
|
|
9
|
+
},
|
|
10
|
+
})
|
|
11
|
+
export class HlmSidebarMenuSub {
|
|
12
|
+
constructor() {
|
|
13
|
+
classes(
|
|
14
|
+
() =>
|
|
15
|
+
'border-sidebar-border mx-3.5 translate-x-px gap-1 border-s px-2.5 py-0.5 group-data-[collapsible=icon]:hidden rtl:-translate-x-px flex min-w-0 flex-col',
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Directive } from '@angular/core';
|
|
2
|
+
import { classes } from '../../../utils/src';
|
|
3
|
+
|
|
4
|
+
@Directive({
|
|
5
|
+
selector: 'ul[hlmSidebarMenu]',
|
|
6
|
+
host: {
|
|
7
|
+
'data-slot': 'sidebar-menu',
|
|
8
|
+
'data-sidebar': 'menu',
|
|
9
|
+
},
|
|
10
|
+
})
|
|
11
|
+
export class HlmSidebarMenu {
|
|
12
|
+
constructor() {
|
|
13
|
+
classes(() => 'gap-1 flex w-full min-w-0 flex-col');
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Directive, inject, input } from '@angular/core';
|
|
2
|
+
import { classes } from '../../../utils/src';
|
|
3
|
+
import { HlmSidebarService } from './hlm-sidebar.service';
|
|
4
|
+
|
|
5
|
+
@Directive({
|
|
6
|
+
selector: 'button[hlmSidebarRail]',
|
|
7
|
+
host: {
|
|
8
|
+
'data-sidebar': 'rail',
|
|
9
|
+
'data-slot': 'sidebar-rail',
|
|
10
|
+
'[attr.aria-label]': 'ariaLabel()',
|
|
11
|
+
tabindex: '-1',
|
|
12
|
+
'(click)': 'onClick()',
|
|
13
|
+
},
|
|
14
|
+
})
|
|
15
|
+
export class HlmSidebarRail {
|
|
16
|
+
private readonly _sidebarService = inject(HlmSidebarService);
|
|
17
|
+
|
|
18
|
+
public readonly ariaLabel = input<string>('Toggle Sidebar', { alias: 'aria-label' });
|
|
19
|
+
|
|
20
|
+
constructor() {
|
|
21
|
+
classes(() => [
|
|
22
|
+
'hover:after:bg-sidebar-border absolute inset-y-0 z-20 hidden w-4 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:start-1/2 after:w-[2px] sm:flex ltr:-translate-x-1/2 rtl:-translate-x-1/2',
|
|
23
|
+
'in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize',
|
|
24
|
+
'[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize',
|
|
25
|
+
'hover:group-data-[collapsible=offcanvas]:bg-sidebar group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full',
|
|
26
|
+
'[[data-side=left][data-collapsible=offcanvas]_&]:-right-2',
|
|
27
|
+
'[[data-side=right][data-collapsible=offcanvas]_&]:-left-2',
|
|
28
|
+
]);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
protected onClick(): void {
|
|
32
|
+
this._sidebarService.toggleSidebar();
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Directive } from '@angular/core';
|
|
2
|
+
import { HlmSeparator } from '../../../separator/src';
|
|
3
|
+
import { classes } from '../../../utils/src';
|
|
4
|
+
|
|
5
|
+
@Directive({
|
|
6
|
+
selector: '[hlmSidebarSeparator],hlm-sidebar-separator',
|
|
7
|
+
hostDirectives: [HlmSeparator],
|
|
8
|
+
host: {
|
|
9
|
+
'data-slot': 'sidebar-separator',
|
|
10
|
+
'data-sidebar': 'separator',
|
|
11
|
+
},
|
|
12
|
+
})
|
|
13
|
+
export class HlmSidebarSeparator {
|
|
14
|
+
constructor() {
|
|
15
|
+
classes(() => 'bg-sidebar-border mx-2 w-auto');
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component, inject, input } from '@angular/core';
|
|
2
|
+
import { NgIcon, provideIcons } from '@ng-icons/core';
|
|
3
|
+
import { phosphorSidebarSimple } from '@ng-icons/phosphor-icons/regular';
|
|
4
|
+
import { HlmButton, provideBrnButtonConfig } from '../../../button/src';
|
|
5
|
+
import { HlmSidebarService } from './hlm-sidebar.service';
|
|
6
|
+
|
|
7
|
+
@Component({
|
|
8
|
+
// eslint-disable-next-line @angular-eslint/component-selector
|
|
9
|
+
selector: 'button[hlmSidebarTrigger]',
|
|
10
|
+
imports: [NgIcon],
|
|
11
|
+
providers: [
|
|
12
|
+
provideIcons({ phosphorSidebarSimple }),
|
|
13
|
+
provideBrnButtonConfig({ variant: 'ghost', size: 'icon-sm' }),
|
|
14
|
+
],
|
|
15
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
16
|
+
hostDirectives: [{ directive: HlmButton, inputs: ['variant', 'size'] }],
|
|
17
|
+
host: {
|
|
18
|
+
'data-slot': 'sidebar-trigger',
|
|
19
|
+
'data-sidebar': 'trigger',
|
|
20
|
+
'(click)': '_onClick()',
|
|
21
|
+
},
|
|
22
|
+
template: `
|
|
23
|
+
<ng-icon name="phosphorSidebarSimple" />
|
|
24
|
+
<span class="sr-only">{{ srOnlyText() }}</span>
|
|
25
|
+
`,
|
|
26
|
+
})
|
|
27
|
+
export class HlmSidebarTrigger {
|
|
28
|
+
private readonly _sidebarService = inject(HlmSidebarService);
|
|
29
|
+
|
|
30
|
+
public readonly srOnlyText = input('Toggle Sidebar');
|
|
31
|
+
|
|
32
|
+
protected _onClick(): void {
|
|
33
|
+
this._sidebarService.toggleSidebar();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Directive, input } from '@angular/core';
|
|
2
|
+
import { classes } from '../../../utils/src';
|
|
3
|
+
import { injectHlmSidebarConfig } from './hlm-sidebar.token';
|
|
4
|
+
|
|
5
|
+
@Directive({
|
|
6
|
+
selector: '[hlmSidebarWrapper],hlm-sidebar-wrapper',
|
|
7
|
+
host: {
|
|
8
|
+
'data-slot': 'sidebar-wrapper',
|
|
9
|
+
'[style.--sidebar-width]': 'sidebarWidth()',
|
|
10
|
+
'[style.--sidebar-width-icon]': 'sidebarWidthIcon()',
|
|
11
|
+
},
|
|
12
|
+
})
|
|
13
|
+
export class HlmSidebarWrapper {
|
|
14
|
+
private readonly _config = injectHlmSidebarConfig();
|
|
15
|
+
|
|
16
|
+
public readonly sidebarWidth = input<string>(this._config.sidebarWidth);
|
|
17
|
+
public readonly sidebarWidthIcon = input<string>(this._config.sidebarWidthIcon);
|
|
18
|
+
|
|
19
|
+
constructor() {
|
|
20
|
+
classes(
|
|
21
|
+
() => 'group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full',
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
}
|