@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.
Files changed (189) hide show
  1. package/.postcssrc.json +7 -0
  2. package/.storybook/main.ts +9 -0
  3. package/.storybook/manager.ts +3 -0
  4. package/.storybook/preview.ts +28 -0
  5. package/.storybook/tsconfig.json +8 -0
  6. package/.turbo/turbo-build.log +32 -0
  7. package/CHANGELOG.md +29 -0
  8. package/angular.json +52 -0
  9. package/components.json +5 -0
  10. package/dist/fesm2022/surfnet-curve-angular.mjs +4237 -0
  11. package/dist/fesm2022/surfnet-curve-angular.mjs.map +1 -0
  12. package/dist/files/geist-cyrillic-ext-wght-italic.woff2 +0 -0
  13. package/dist/files/geist-cyrillic-ext-wght-normal.woff2 +0 -0
  14. package/dist/files/geist-cyrillic-wght-italic.woff2 +0 -0
  15. package/dist/files/geist-cyrillic-wght-normal.woff2 +0 -0
  16. package/dist/files/geist-latin-ext-wght-italic.woff2 +0 -0
  17. package/dist/files/geist-latin-ext-wght-normal.woff2 +0 -0
  18. package/dist/files/geist-latin-wght-italic.woff2 +0 -0
  19. package/dist/files/geist-latin-wght-normal.woff2 +0 -0
  20. package/dist/files/geist-vietnamese-wght-italic.woff2 +0 -0
  21. package/dist/files/geist-vietnamese-wght-normal.woff2 +0 -0
  22. package/dist/styles.css +2 -0
  23. package/dist/types/surfnet-curve-angular.d.ts +1017 -0
  24. package/ng-package.json +20 -0
  25. package/package.json +73 -0
  26. package/scripts/copy-font-files.ts +15 -0
  27. package/scripts/rewrite-helm-imports.ts +60 -0
  28. package/src/foundations/design-tokens.stories.ts +198 -0
  29. package/src/lib/ui/avatar/src/index.ts +22 -0
  30. package/src/lib/ui/avatar/src/lib/hlm-avatar-badge.ts +19 -0
  31. package/src/lib/ui/avatar/src/lib/hlm-avatar-fallback.ts +20 -0
  32. package/src/lib/ui/avatar/src/lib/hlm-avatar-group-count.ts +17 -0
  33. package/src/lib/ui/avatar/src/lib/hlm-avatar-group.ts +17 -0
  34. package/src/lib/ui/avatar/src/lib/hlm-avatar-image.ts +19 -0
  35. package/src/lib/ui/avatar/src/lib/hlm-avatar.stories.ts +107 -0
  36. package/src/lib/ui/avatar/src/lib/hlm-avatar.ts +32 -0
  37. package/src/lib/ui/breadcrumb/src/index.ts +30 -0
  38. package/src/lib/ui/breadcrumb/src/lib/hlm-breadcrumb-ellipsis.ts +36 -0
  39. package/src/lib/ui/breadcrumb/src/lib/hlm-breadcrumb-item.ts +14 -0
  40. package/src/lib/ui/breadcrumb/src/lib/hlm-breadcrumb-link.ts +36 -0
  41. package/src/lib/ui/breadcrumb/src/lib/hlm-breadcrumb-list.ts +17 -0
  42. package/src/lib/ui/breadcrumb/src/lib/hlm-breadcrumb-page.ts +17 -0
  43. package/src/lib/ui/breadcrumb/src/lib/hlm-breadcrumb-separator.ts +27 -0
  44. package/src/lib/ui/breadcrumb/src/lib/hlm-breadcrumb.stories.ts +81 -0
  45. package/src/lib/ui/breadcrumb/src/lib/hlm-breadcrumb.ts +13 -0
  46. package/src/lib/ui/button/src/index.ts +6 -0
  47. package/src/lib/ui/button/src/lib/hlm-button.stories.ts +170 -0
  48. package/src/lib/ui/button/src/lib/hlm-button.token.ts +22 -0
  49. package/src/lib/ui/button/src/lib/hlm-button.ts +76 -0
  50. package/src/lib/ui/card/src/index.ts +25 -0
  51. package/src/lib/ui/card/src/lib/hlm-card-action.ts +12 -0
  52. package/src/lib/ui/card/src/lib/hlm-card-content.ts +12 -0
  53. package/src/lib/ui/card/src/lib/hlm-card-description.ts +12 -0
  54. package/src/lib/ui/card/src/lib/hlm-card-footer.ts +14 -0
  55. package/src/lib/ui/card/src/lib/hlm-card-header.ts +15 -0
  56. package/src/lib/ui/card/src/lib/hlm-card-title.ts +12 -0
  57. package/src/lib/ui/card/src/lib/hlm-card.stories.ts +105 -0
  58. package/src/lib/ui/card/src/lib/hlm-card.token.ts +19 -0
  59. package/src/lib/ui/card/src/lib/hlm-card.ts +22 -0
  60. package/src/lib/ui/checkbox/src/index.ts +5 -0
  61. package/src/lib/ui/checkbox/src/lib/hlm-checkbox.stories.ts +78 -0
  62. package/src/lib/ui/checkbox/src/lib/hlm-checkbox.ts +160 -0
  63. package/src/lib/ui/data-table/src/index.ts +14 -0
  64. package/src/lib/ui/data-table/src/lib/hlm-data-table-content.ts +87 -0
  65. package/src/lib/ui/data-table/src/lib/hlm-data-table-pagination.ts +62 -0
  66. package/src/lib/ui/data-table/src/lib/hlm-data-table-toolbar.ts +16 -0
  67. package/src/lib/ui/data-table/src/lib/hlm-data-table.stories.ts +479 -0
  68. package/src/lib/ui/data-table/src/lib/inject-data-table.ts +86 -0
  69. package/src/lib/ui/dropdown-menu/src/index.ts +45 -0
  70. package/src/lib/ui/dropdown-menu/src/lib/hlm-dropdown-menu-checkbox-indicator.ts +20 -0
  71. package/src/lib/ui/dropdown-menu/src/lib/hlm-dropdown-menu-checkbox.ts +36 -0
  72. package/src/lib/ui/dropdown-menu/src/lib/hlm-dropdown-menu-group.ts +16 -0
  73. package/src/lib/ui/dropdown-menu/src/lib/hlm-dropdown-menu-item-sub-indicator.ts +17 -0
  74. package/src/lib/ui/dropdown-menu/src/lib/hlm-dropdown-menu-item.ts +41 -0
  75. package/src/lib/ui/dropdown-menu/src/lib/hlm-dropdown-menu-label.ts +20 -0
  76. package/src/lib/ui/dropdown-menu/src/lib/hlm-dropdown-menu-radio-indicator.ts +20 -0
  77. package/src/lib/ui/dropdown-menu/src/lib/hlm-dropdown-menu-radio.ts +36 -0
  78. package/src/lib/ui/dropdown-menu/src/lib/hlm-dropdown-menu-separator.ts +14 -0
  79. package/src/lib/ui/dropdown-menu/src/lib/hlm-dropdown-menu-shortcut.ts +14 -0
  80. package/src/lib/ui/dropdown-menu/src/lib/hlm-dropdown-menu-sub.ts +58 -0
  81. package/src/lib/ui/dropdown-menu/src/lib/hlm-dropdown-menu-token.ts +26 -0
  82. package/src/lib/ui/dropdown-menu/src/lib/hlm-dropdown-menu-trigger.ts +49 -0
  83. package/src/lib/ui/dropdown-menu/src/lib/hlm-dropdown-menu.stories.ts +125 -0
  84. package/src/lib/ui/dropdown-menu/src/lib/hlm-dropdown-menu.ts +62 -0
  85. package/src/lib/ui/field/src/index.ts +34 -0
  86. package/src/lib/ui/field/src/lib/hlm-field-content.ts +12 -0
  87. package/src/lib/ui/field/src/lib/hlm-field-description.ts +53 -0
  88. package/src/lib/ui/field/src/lib/hlm-field-error.ts +100 -0
  89. package/src/lib/ui/field/src/lib/hlm-field-group.ts +15 -0
  90. package/src/lib/ui/field/src/lib/hlm-field-label.ts +17 -0
  91. package/src/lib/ui/field/src/lib/hlm-field-legend.ts +17 -0
  92. package/src/lib/ui/field/src/lib/hlm-field-separator.ts +24 -0
  93. package/src/lib/ui/field/src/lib/hlm-field-set.ts +15 -0
  94. package/src/lib/ui/field/src/lib/hlm-field-title.ts +15 -0
  95. package/src/lib/ui/field/src/lib/hlm-field.stories.ts +117 -0
  96. package/src/lib/ui/field/src/lib/hlm-field.ts +49 -0
  97. package/src/lib/ui/icon/src/index.ts +7 -0
  98. package/src/lib/ui/icon/src/lib/hlm-icon.token.ts +20 -0
  99. package/src/lib/ui/icon/src/lib/hlm-icon.ts +42 -0
  100. package/src/lib/ui/input/src/index.ts +5 -0
  101. package/src/lib/ui/input/src/lib/hlm-input.stories.ts +94 -0
  102. package/src/lib/ui/input/src/lib/hlm-input.ts +20 -0
  103. package/src/lib/ui/input-group/src/index.ts +22 -0
  104. package/src/lib/ui/input-group/src/lib/hlm-input-group-addon.ts +40 -0
  105. package/src/lib/ui/input-group/src/lib/hlm-input-group-button.ts +47 -0
  106. package/src/lib/ui/input-group/src/lib/hlm-input-group-input.ts +17 -0
  107. package/src/lib/ui/input-group/src/lib/hlm-input-group-text.ts +14 -0
  108. package/src/lib/ui/input-group/src/lib/hlm-input-group-textarea.ts +17 -0
  109. package/src/lib/ui/input-group/src/lib/hlm-input-group.stories.ts +133 -0
  110. package/src/lib/ui/input-group/src/lib/hlm-input-group.ts +18 -0
  111. package/src/lib/ui/label/src/index.ts +5 -0
  112. package/src/lib/ui/label/src/lib/hlm-label.stories.ts +55 -0
  113. package/src/lib/ui/label/src/lib/hlm-label.ts +17 -0
  114. package/src/lib/ui/select/src/index.ts +52 -0
  115. package/src/lib/ui/select/src/lib/hlm-select-content.ts +44 -0
  116. package/src/lib/ui/select/src/lib/hlm-select-group.ts +14 -0
  117. package/src/lib/ui/select/src/lib/hlm-select-item.ts +36 -0
  118. package/src/lib/ui/select/src/lib/hlm-select-label.ts +14 -0
  119. package/src/lib/ui/select/src/lib/hlm-select-multiple.ts +45 -0
  120. package/src/lib/ui/select/src/lib/hlm-select-placeholder.ts +17 -0
  121. package/src/lib/ui/select/src/lib/hlm-select-portal.ts +8 -0
  122. package/src/lib/ui/select/src/lib/hlm-select-scroll-down.ts +22 -0
  123. package/src/lib/ui/select/src/lib/hlm-select-scroll-up.ts +22 -0
  124. package/src/lib/ui/select/src/lib/hlm-select-separator.ts +14 -0
  125. package/src/lib/ui/select/src/lib/hlm-select-trigger.ts +59 -0
  126. package/src/lib/ui/select/src/lib/hlm-select-value-template.ts +5 -0
  127. package/src/lib/ui/select/src/lib/hlm-select-value.ts +18 -0
  128. package/src/lib/ui/select/src/lib/hlm-select-values-content.ts +9 -0
  129. package/src/lib/ui/select/src/lib/hlm-select-values.ts +5 -0
  130. package/src/lib/ui/select/src/lib/hlm-select.stories.ts +105 -0
  131. package/src/lib/ui/select/src/lib/hlm-select.ts +45 -0
  132. package/src/lib/ui/separator/src/index.ts +5 -0
  133. package/src/lib/ui/separator/src/lib/hlm-separator.stories.ts +88 -0
  134. package/src/lib/ui/separator/src/lib/hlm-separator.ts +19 -0
  135. package/src/lib/ui/sheet/src/index.ts +34 -0
  136. package/src/lib/ui/sheet/src/lib/hlm-sheet-close.ts +9 -0
  137. package/src/lib/ui/sheet/src/lib/hlm-sheet-content.ts +66 -0
  138. package/src/lib/ui/sheet/src/lib/hlm-sheet-description.ts +14 -0
  139. package/src/lib/ui/sheet/src/lib/hlm-sheet-footer.ts +12 -0
  140. package/src/lib/ui/sheet/src/lib/hlm-sheet-header.ts +12 -0
  141. package/src/lib/ui/sheet/src/lib/hlm-sheet-overlay.ts +27 -0
  142. package/src/lib/ui/sheet/src/lib/hlm-sheet-portal.ts +8 -0
  143. package/src/lib/ui/sheet/src/lib/hlm-sheet-title.ts +14 -0
  144. package/src/lib/ui/sheet/src/lib/hlm-sheet-trigger.ts +9 -0
  145. package/src/lib/ui/sheet/src/lib/hlm-sheet.ts +29 -0
  146. package/src/lib/ui/sidebar/src/index.ts +75 -0
  147. package/src/lib/ui/sidebar/src/lib/hlm-sidebar-content.ts +18 -0
  148. package/src/lib/ui/sidebar/src/lib/hlm-sidebar-footer.ts +15 -0
  149. package/src/lib/ui/sidebar/src/lib/hlm-sidebar-group-action.ts +18 -0
  150. package/src/lib/ui/sidebar/src/lib/hlm-sidebar-group-content.ts +15 -0
  151. package/src/lib/ui/sidebar/src/lib/hlm-sidebar-group-label.ts +18 -0
  152. package/src/lib/ui/sidebar/src/lib/hlm-sidebar-group.ts +15 -0
  153. package/src/lib/ui/sidebar/src/lib/hlm-sidebar-header.ts +15 -0
  154. package/src/lib/ui/sidebar/src/lib/hlm-sidebar-input.ts +17 -0
  155. package/src/lib/ui/sidebar/src/lib/hlm-sidebar-inset.ts +15 -0
  156. package/src/lib/ui/sidebar/src/lib/hlm-sidebar-menu-action.ts +24 -0
  157. package/src/lib/ui/sidebar/src/lib/hlm-sidebar-menu-badge.ts +18 -0
  158. package/src/lib/ui/sidebar/src/lib/hlm-sidebar-menu-button.ts +97 -0
  159. package/src/lib/ui/sidebar/src/lib/hlm-sidebar-menu-item.ts +15 -0
  160. package/src/lib/ui/sidebar/src/lib/hlm-sidebar-menu-skeleton.ts +33 -0
  161. package/src/lib/ui/sidebar/src/lib/hlm-sidebar-menu-sub-button.ts +41 -0
  162. package/src/lib/ui/sidebar/src/lib/hlm-sidebar-menu-sub-item.ts +15 -0
  163. package/src/lib/ui/sidebar/src/lib/hlm-sidebar-menu-sub.ts +18 -0
  164. package/src/lib/ui/sidebar/src/lib/hlm-sidebar-menu.ts +15 -0
  165. package/src/lib/ui/sidebar/src/lib/hlm-sidebar-rail.ts +34 -0
  166. package/src/lib/ui/sidebar/src/lib/hlm-sidebar-separator.ts +17 -0
  167. package/src/lib/ui/sidebar/src/lib/hlm-sidebar-trigger.ts +35 -0
  168. package/src/lib/ui/sidebar/src/lib/hlm-sidebar-wrapper.ts +24 -0
  169. package/src/lib/ui/sidebar/src/lib/hlm-sidebar.service.ts +136 -0
  170. package/src/lib/ui/sidebar/src/lib/hlm-sidebar.stories.ts +177 -0
  171. package/src/lib/ui/sidebar/src/lib/hlm-sidebar.token.ts +33 -0
  172. package/src/lib/ui/sidebar/src/lib/hlm-sidebar.ts +139 -0
  173. package/src/lib/ui/skeleton/src/index.ts +5 -0
  174. package/src/lib/ui/skeleton/src/lib/hlm-skeleton.ts +14 -0
  175. package/src/lib/ui/table/src/index.ts +25 -0
  176. package/src/lib/ui/table/src/lib/hlm-table.stories.ts +70 -0
  177. package/src/lib/ui/table/src/lib/hlm-table.ts +129 -0
  178. package/src/lib/ui/textarea/src/index.ts +5 -0
  179. package/src/lib/ui/textarea/src/lib/hlm-textarea.stories.ts +72 -0
  180. package/src/lib/ui/textarea/src/lib/hlm-textarea.ts +21 -0
  181. package/src/lib/ui/tooltip/src/index.ts +5 -0
  182. package/src/lib/ui/tooltip/src/lib/hlm-tooltip.ts +44 -0
  183. package/src/lib/ui/utils/src/index.ts +1 -0
  184. package/src/lib/ui/utils/src/lib/hlm.ts +313 -0
  185. package/src/public-api.ts +24 -0
  186. package/src/styles.css +43 -0
  187. package/tsconfig.json +45 -0
  188. package/tsconfig.lib.json +11 -0
  189. package/tsconfig.lib.prod.json +9 -0
@@ -0,0 +1,59 @@
1
+ import type { BooleanInput } from '@angular/cdk/coercion';
2
+ import {
3
+ booleanAttribute,
4
+ ChangeDetectionStrategy,
5
+ Component,
6
+ computed,
7
+ input,
8
+ } from '@angular/core';
9
+ import { NgIcon, provideIcons } from '@ng-icons/core';
10
+ import { phosphorCaretUpDown } from '@ng-icons/phosphor-icons/regular';
11
+ import { BrnFieldControlDescribedBy } from '@spartan-ng/brain/field';
12
+ import { BrnSelectTrigger } from '@spartan-ng/brain/select';
13
+ import { hlm } from '../../../utils/src';
14
+ import type { SelectTriggerSizeName } from '@surfnet/curve-contracts';
15
+ import type { ClassValue } from 'clsx';
16
+
17
+ @Component({
18
+ selector: 'hlm-select-trigger',
19
+ imports: [NgIcon, BrnSelectTrigger, BrnFieldControlDescribedBy],
20
+ providers: [provideIcons({ phosphorCaretUpDown })],
21
+ changeDetection: ChangeDetectionStrategy.OnPush,
22
+ template: `
23
+ <button
24
+ brnSelectTrigger
25
+ brnFieldControlDescribedBy
26
+ [forceInvalid]="forceInvalid()"
27
+ [id]="buttonId()"
28
+ [class]="_computedClass()"
29
+ [attr.data-size]="size()"
30
+ data-slot="select-trigger"
31
+ >
32
+ <ng-content />
33
+ <ng-icon
34
+ name="phosphorCaretUpDown"
35
+ class="text-muted-foreground text-[calc(var(--spacing)*4)] ms-auto"
36
+ />
37
+ </button>
38
+ `,
39
+ })
40
+ export class HlmSelectTrigger {
41
+ private static _id = 0;
42
+
43
+ public readonly userClass = input<ClassValue>('', { alias: 'class' });
44
+ protected readonly _computedClass = computed(() =>
45
+ hlm(
46
+ 'border-input data-placeholder:text-muted-foreground dark:bg-input/30 dark:hover:bg-input/50 focus-visible:border-ring focus-visible:ring-ring/50 data-[matches-spartan-invalid=true]:ring-destructive/20 dark:data-[matches-spartan-invalid=true]:ring-destructive/40 data-[matches-spartan-invalid=true]:border-destructive dark:data-[matches-spartan-invalid=true]:border-destructive/50 gap-1.5 rounded-md border bg-transparent py-2 ps-2.5 pe-2 text-sm shadow-xs transition-[color,box-shadow] focus-visible:ring-3 data-[matches-spartan-invalid=true]:ring-3 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:gap-1.5 flex w-fit items-center justify-between whitespace-nowrap outline-none disabled:cursor-not-allowed disabled:opacity-50 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center [&_ng-icon]:pointer-events-none [&_ng-icon]:shrink-0',
47
+ this.userClass(),
48
+ ),
49
+ );
50
+
51
+ public readonly buttonId = input<string>(`hlm-select-trigger-${HlmSelectTrigger._id++}`);
52
+
53
+ public readonly size = input<SelectTriggerSizeName>('default');
54
+
55
+ /** Whether to force the trigger into an invalid state. */
56
+ public readonly forceInvalid = input<boolean, BooleanInput>(false, {
57
+ transform: booleanAttribute,
58
+ });
59
+ }
@@ -0,0 +1,5 @@
1
+ import { Directive } from '@angular/core';
2
+ import { BrnSelectValueTemplate } from '@spartan-ng/brain/select';
3
+
4
+ @Directive({ selector: '[hlmSelectValueTemplate]', hostDirectives: [BrnSelectValueTemplate] })
5
+ export class HlmSelectValueTemplate {}
@@ -0,0 +1,18 @@
1
+ import { Directive, inject } from '@angular/core';
2
+ import { BrnSelectValue } from '@spartan-ng/brain/select';
3
+ import { classes } from '../../../utils/src';
4
+
5
+ @Directive({
6
+ selector: '[hlmSelectValue],hlm-select-value',
7
+ hostDirectives: [{ directive: BrnSelectValue, inputs: ['placeholder'] }],
8
+ host: { '[attr.data-slot]': '!_hidden() ? "select-value" : null' },
9
+ })
10
+ export class HlmSelectValue {
11
+ private readonly _brnSelectValue = inject(BrnSelectValue);
12
+
13
+ protected readonly _hidden = this._brnSelectValue.hidden;
14
+
15
+ constructor() {
16
+ classes(() => 'data-hidden:hidden');
17
+ }
18
+ }
@@ -0,0 +1,9 @@
1
+ import { Directive } from '@angular/core';
2
+ import { classes } from '../../../utils/src';
3
+
4
+ @Directive({ selector: '[hlmSelectValuesContent],hlm-select-values-content' })
5
+ export class HlmSelectValuesContent {
6
+ constructor() {
7
+ classes(() => 'gap-2 flex');
8
+ }
9
+ }
@@ -0,0 +1,5 @@
1
+ import { Directive } from '@angular/core';
2
+ import { BrnSelectValues } from '@spartan-ng/brain/select';
3
+
4
+ @Directive({ selector: '[hlmSelectValues]', hostDirectives: [BrnSelectValues] })
5
+ export class HlmSelectValues {}
@@ -0,0 +1,105 @@
1
+ import { moduleMetadata, type Meta, type StoryObj } from '@storybook/angular';
2
+ import { selectContract } from '@surfnet/curve-contracts';
3
+ import { HlmSelect } from './hlm-select';
4
+ import { HlmSelectImports } from '..';
5
+
6
+ const meta: Meta<HlmSelect> = {
7
+ title: 'Components/Select',
8
+ component: HlmSelect,
9
+ decorators: [
10
+ moduleMetadata({
11
+ imports: [HlmSelectImports],
12
+ }),
13
+ ],
14
+ parameters: {
15
+ docs: {
16
+ description: {
17
+ component: selectContract.docs.description,
18
+ },
19
+ },
20
+ },
21
+ };
22
+
23
+ export default meta;
24
+ type Story = StoryObj<HlmSelect>;
25
+
26
+ /** A select with a placeholder until a value is chosen. */
27
+ export const Default: Story = {
28
+ render: () => ({
29
+ template: `
30
+ <hlm-select>
31
+ <hlm-select-trigger class="w-56">
32
+ <hlm-select-value placeholder="Category: All" />
33
+ </hlm-select-trigger>
34
+ <hlm-select-content *hlmSelectPortal>
35
+ <hlm-select-item value="all">All</hlm-select-item>
36
+ <hlm-select-item value="identity">Identity</hlm-select-item>
37
+ <hlm-select-item value="storage">Storage</hlm-select-item>
38
+ <hlm-select-item value="marketplace">Marketplace</hlm-select-item>
39
+ </hlm-select-content>
40
+ </hlm-select>
41
+ `,
42
+ }),
43
+ };
44
+
45
+ /** A pre-selected value with grouped, labelled options. */
46
+ export const Grouped: Story = {
47
+ render: () => ({
48
+ template: `
49
+ <hlm-select value="identity">
50
+ <hlm-select-trigger class="w-56">
51
+ <hlm-select-value placeholder="Pick a category" />
52
+ </hlm-select-trigger>
53
+ <hlm-select-content *hlmSelectPortal>
54
+ <hlm-select-group>
55
+ <hlm-select-label>Categories</hlm-select-label>
56
+ <hlm-select-item value="identity">Identity</hlm-select-item>
57
+ <hlm-select-item value="storage">Storage</hlm-select-item>
58
+ <hlm-select-item value="marketplace">Marketplace</hlm-select-item>
59
+ </hlm-select-group>
60
+ </hlm-select-content>
61
+ </hlm-select>
62
+ `,
63
+ }),
64
+ };
65
+
66
+ /** Disabled trigger. */
67
+ export const Disabled: Story = {
68
+ render: () => ({
69
+ template: `
70
+ <hlm-select disabled>
71
+ <hlm-select-trigger class="w-56">
72
+ <hlm-select-value placeholder="Category: All" />
73
+ </hlm-select-trigger>
74
+ <hlm-select-content *hlmSelectPortal>
75
+ <hlm-select-item value="all">All</hlm-select-item>
76
+ </hlm-select-content>
77
+ </hlm-select>
78
+ `,
79
+ }),
80
+ };
81
+
82
+ /** Every trigger size declared in the contract. */
83
+ export const Sizes: Story = {
84
+ render: () => ({
85
+ template: `
86
+ <div class="flex items-center gap-3">
87
+ ${selectContract.props.sizes
88
+ .map(
89
+ (size) => `
90
+ <hlm-select key="${size}" value="all">
91
+ <hlm-select-trigger class="w-40" size="${size}">
92
+ <hlm-select-value />
93
+ </hlm-select-trigger>
94
+ <hlm-select-content *hlmSelectPortal>
95
+ <hlm-select-item value="all" selected>All</hlm-select-item>
96
+ <hlm-select-item value="identity">Identity</hlm-select-item>
97
+ </hlm-select-content>
98
+ </hlm-select>
99
+ `,
100
+ )
101
+ .join('')}
102
+ </div>
103
+ `,
104
+ }),
105
+ };
@@ -0,0 +1,45 @@
1
+ import { Directive } from '@angular/core';
2
+ import { provideBrnDialogDefaultOptions } from '@spartan-ng/brain/dialog';
3
+ import { BrnPopover, provideBrnPopoverConfig } from '@spartan-ng/brain/popover';
4
+ import { BrnSelect } from '@spartan-ng/brain/select';
5
+ import { classes } from '../../../utils/src';
6
+
7
+ @Directive({
8
+ selector: '[hlmSelect],hlm-select',
9
+ providers: [
10
+ provideBrnPopoverConfig({
11
+ align: 'start',
12
+ sideOffset: 6,
13
+ }),
14
+ provideBrnDialogDefaultOptions({
15
+ autoFocus: 'first-heading',
16
+ }),
17
+ ],
18
+ hostDirectives: [
19
+ {
20
+ directive: BrnSelect,
21
+ inputs: ['disabled', 'value', 'isItemEqualToValue', 'itemToString'],
22
+ outputs: ['valueChange'],
23
+ },
24
+ {
25
+ directive: BrnPopover,
26
+ inputs: [
27
+ 'align',
28
+ 'autoFocus',
29
+ 'closeDelay',
30
+ 'closeOnOutsidePointerEvents',
31
+ 'sideOffset',
32
+ 'state',
33
+ 'offsetX',
34
+ 'restoreFocus',
35
+ ],
36
+ outputs: ['stateChanged', 'closed'],
37
+ },
38
+ ],
39
+ host: { 'data-slot': 'select' },
40
+ })
41
+ export class HlmSelect {
42
+ constructor() {
43
+ classes(() => 'block');
44
+ }
45
+ }
@@ -0,0 +1,5 @@
1
+ import { HlmSeparator } from './lib/hlm-separator';
2
+
3
+ export * from './lib/hlm-separator';
4
+
5
+ export const HlmSeparatorImports = [HlmSeparator] as const;
@@ -0,0 +1,88 @@
1
+ import { type Meta, type StoryObj, argsToTemplate, moduleMetadata } from '@storybook/angular';
2
+ import { separatorContract } from '@surfnet/curve-contracts';
3
+ import { HlmSeparator, HlmSeparatorImports } from '..';
4
+
5
+ const meta: Meta<HlmSeparator> = {
6
+ title: 'Components/Separator',
7
+ component: HlmSeparator,
8
+ decorators: [
9
+ moduleMetadata({
10
+ imports: [HlmSeparatorImports],
11
+ }),
12
+ ],
13
+ parameters: {
14
+ docs: {
15
+ description: {
16
+ component: separatorContract.docs.description,
17
+ },
18
+ },
19
+ },
20
+ argTypes: {
21
+ orientation: {
22
+ control: 'inline-radio',
23
+ options: separatorContract.props.orientations,
24
+ description: separatorContract.props.orientations
25
+ .map(
26
+ (orientation) =>
27
+ `\`${orientation}\` — ${separatorContract.docs.orientations[orientation]}`,
28
+ )
29
+ .join('\n\n'),
30
+ table: {
31
+ defaultValue: { summary: separatorContract.defaults.orientations },
32
+ },
33
+ },
34
+ },
35
+ args: {
36
+ orientation: separatorContract.defaults.orientations,
37
+ },
38
+ };
39
+
40
+ export default meta;
41
+ type Story = StoryObj<HlmSeparator>;
42
+
43
+ /** Interactive playground — flip `orientation` in the controls to see both directions. */
44
+ export const Default: Story = {
45
+ render: ({ ...args }) => ({
46
+ props: args,
47
+ template: `
48
+ <div class="
49
+ {{orientation === 'vertical'
50
+ ? 'flex h-5 items-center gap-3 text-sm'
51
+ : 'flex w-72 flex-col gap-3 text-sm'
52
+ }}"
53
+ >
54
+ <span>One</span>
55
+ <hlm-separator ${argsToTemplate(args)} />
56
+ <span>Two</span>
57
+ </div>
58
+ `,
59
+ }),
60
+ };
61
+
62
+ /** A horizontal divider between stacked blocks of text. */
63
+ export const Horizontal: Story = {
64
+ render: () => ({
65
+ template: `
66
+ <div class="w-72">
67
+ <p class="text-sm">Curve</p>
68
+ <hlm-separator orientation="horizontal" class="my-3" />
69
+ <p class="text-sm text-muted-foreground">Components for React and Angular.</p>
70
+ </div>
71
+ `,
72
+ }),
73
+ };
74
+
75
+ /** A vertical divider between inline items. */
76
+ export const Vertical: Story = {
77
+ render: () => ({
78
+ template: `
79
+ <div class="flex h-5 items-center gap-3 text-sm">
80
+ <span>Docs</span>
81
+ <hlm-separator orientation="vertical" />
82
+ <span>Source</span>
83
+ <hlm-separator orientation="vertical" />
84
+ <span>Storybook</span>
85
+ </div>
86
+ `,
87
+ }),
88
+ };
@@ -0,0 +1,19 @@
1
+ import { Directive } from '@angular/core';
2
+ import { BrnSeparator } from '@spartan-ng/brain/separator';
3
+ import { classes } from '../../../utils/src';
4
+
5
+ export const hlmSeparatorClass =
6
+ 'inline-flex shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch';
7
+
8
+ @Directive({
9
+ selector: '[hlmSeparator],hlm-separator',
10
+ hostDirectives: [{ directive: BrnSeparator, inputs: ['orientation', 'decorative'] }],
11
+ host: {
12
+ 'data-slot': 'separator',
13
+ },
14
+ })
15
+ export class HlmSeparator {
16
+ constructor() {
17
+ classes(() => hlmSeparatorClass);
18
+ }
19
+ }
@@ -0,0 +1,34 @@
1
+ import { HlmSheet } from './lib/hlm-sheet';
2
+ import { HlmSheetClose } from './lib/hlm-sheet-close';
3
+ import { HlmSheetContent } from './lib/hlm-sheet-content';
4
+ import { HlmSheetDescription } from './lib/hlm-sheet-description';
5
+ import { HlmSheetFooter } from './lib/hlm-sheet-footer';
6
+ import { HlmSheetHeader } from './lib/hlm-sheet-header';
7
+ import { HlmSheetOverlay } from './lib/hlm-sheet-overlay';
8
+ import { HlmSheetPortal } from './lib/hlm-sheet-portal';
9
+ import { HlmSheetTitle } from './lib/hlm-sheet-title';
10
+ import { HlmSheetTrigger } from './lib/hlm-sheet-trigger';
11
+
12
+ export * from './lib/hlm-sheet';
13
+ export * from './lib/hlm-sheet-close';
14
+ export * from './lib/hlm-sheet-content';
15
+ export * from './lib/hlm-sheet-description';
16
+ export * from './lib/hlm-sheet-footer';
17
+ export * from './lib/hlm-sheet-header';
18
+ export * from './lib/hlm-sheet-overlay';
19
+ export * from './lib/hlm-sheet-portal';
20
+ export * from './lib/hlm-sheet-title';
21
+ export * from './lib/hlm-sheet-trigger';
22
+
23
+ export const HlmSheetImports = [
24
+ HlmSheet,
25
+ HlmSheetClose,
26
+ HlmSheetContent,
27
+ HlmSheetDescription,
28
+ HlmSheetFooter,
29
+ HlmSheetHeader,
30
+ HlmSheetOverlay,
31
+ HlmSheetPortal,
32
+ HlmSheetTitle,
33
+ HlmSheetTrigger,
34
+ ] as const;
@@ -0,0 +1,9 @@
1
+ import { Directive } from '@angular/core';
2
+ import { BrnSheetClose } from '@spartan-ng/brain/sheet';
3
+
4
+ @Directive({
5
+ selector: 'button[hlmSheetClose]',
6
+ hostDirectives: [{ directive: BrnSheetClose, inputs: ['delay'] }],
7
+ host: { 'data-slot': 'sheet-close' },
8
+ })
9
+ export class HlmSheetClose {}
@@ -0,0 +1,66 @@
1
+ import type { BooleanInput } from '@angular/cdk/coercion';
2
+ import {
3
+ booleanAttribute,
4
+ ChangeDetectionStrategy,
5
+ Component,
6
+ effect,
7
+ ElementRef,
8
+ inject,
9
+ input,
10
+ Renderer2,
11
+ signal,
12
+ } from '@angular/core';
13
+ import { provideIcons } from '@ng-icons/core';
14
+ import { phosphorX } from '@ng-icons/phosphor-icons/regular';
15
+ import { injectExposedSideProvider, injectExposesStateProvider } from '@spartan-ng/brain/core';
16
+ import { HlmButton } from '../../../button/src';
17
+ import { HlmIconImports } from '../../../icon/src';
18
+ import { classes } from '../../../utils/src';
19
+ import { HlmSheetClose } from './hlm-sheet-close';
20
+
21
+ @Component({
22
+ selector: 'hlm-sheet-content',
23
+ imports: [HlmIconImports, HlmButton, HlmSheetClose],
24
+ providers: [provideIcons({ phosphorX })],
25
+ changeDetection: ChangeDetectionStrategy.OnPush,
26
+ host: {
27
+ 'data-slot': 'sheet-content',
28
+ '[attr.data-side]': '_sideProvider.side()',
29
+ '[attr.data-state]': 'state()',
30
+ },
31
+ template: `
32
+ <ng-content />
33
+
34
+ @if (showCloseButton()) {
35
+ <button hlmBtn variant="ghost" size="icon-sm" class="absolute end-4 top-4" hlmSheetClose>
36
+ <span class="sr-only">Close</span>
37
+ <ng-icon hlm size="sm" name="phosphorX" />
38
+ </button>
39
+ }
40
+ `,
41
+ })
42
+ export class HlmSheetContent {
43
+ private readonly _stateProvider = injectExposesStateProvider({ host: true });
44
+ protected readonly _sideProvider = injectExposedSideProvider({ host: true });
45
+ public readonly state = this._stateProvider.state ?? signal('closed');
46
+ private readonly _renderer = inject(Renderer2);
47
+ private readonly _element = inject(ElementRef);
48
+
49
+ public readonly showCloseButton = input<boolean, BooleanInput>(true, {
50
+ transform: booleanAttribute,
51
+ });
52
+
53
+ constructor() {
54
+ classes(() => [
55
+ 'bg-popover text-popover-foreground fixed flex flex-col gap-4 bg-clip-padding text-sm shadow-lg transition duration-200 ease-in-out data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm',
56
+ 'data-open:animate-in data-closed:animate-out',
57
+ 'data-[side=top]:data-closed:slide-out-to-top data-[side=top]:data-open:slide-in-from-top',
58
+ 'data-[side=bottom]:data-closed:slide-out-to-bottom data-[side=bottom]:data-open:slide-in-from-bottom',
59
+ 'data-[side=left]:data-closed:slide-out-to-left data-[side=left]:data-open:slide-in-from-left',
60
+ 'data-[side=right]:data-closed:slide-out-to-right data-[side=right]:data-open:slide-in-from-right',
61
+ ]);
62
+ effect(() => {
63
+ this._renderer.setAttribute(this._element.nativeElement, 'data-state', this.state());
64
+ });
65
+ }
66
+ }
@@ -0,0 +1,14 @@
1
+ import { Directive } from '@angular/core';
2
+ import { BrnSheetDescription } from '@spartan-ng/brain/sheet';
3
+ import { classes } from '../../../utils/src';
4
+
5
+ @Directive({
6
+ selector: '[hlmSheetDescription]',
7
+ hostDirectives: [BrnSheetDescription],
8
+ host: { 'data-slot': 'sheet-description' },
9
+ })
10
+ export class HlmSheetDescription {
11
+ constructor() {
12
+ classes(() => 'text-muted-foreground text-sm');
13
+ }
14
+ }
@@ -0,0 +1,12 @@
1
+ import { Directive } from '@angular/core';
2
+ import { classes } from '../../../utils/src';
3
+
4
+ @Directive({
5
+ selector: '[hlmSheetFooter],hlm-sheet-footer',
6
+ host: { 'data-slot': 'sheet-footer' },
7
+ })
8
+ export class HlmSheetFooter {
9
+ constructor() {
10
+ classes(() => 'gap-2 p-4 mt-auto flex flex-col');
11
+ }
12
+ }
@@ -0,0 +1,12 @@
1
+ import { Directive } from '@angular/core';
2
+ import { classes } from '../../../utils/src';
3
+
4
+ @Directive({
5
+ selector: '[hlmSheetHeader],hlm-sheet-header',
6
+ host: { 'data-slot': 'sheet-header' },
7
+ })
8
+ export class HlmSheetHeader {
9
+ constructor() {
10
+ classes(() => 'gap-1.5 p-4 flex flex-col');
11
+ }
12
+ }
@@ -0,0 +1,27 @@
1
+ import { Directive, computed, effect, input, untracked } from '@angular/core';
2
+ import { injectCustomClassSettable } from '@spartan-ng/brain/core';
3
+ import { BrnSheetOverlay } from '@spartan-ng/brain/sheet';
4
+ import { hlm } from '../../../utils/src';
5
+ import type { ClassValue } from 'clsx';
6
+
7
+ @Directive({
8
+ selector: '[hlmSheetOverlay],hlm-sheet-overlay',
9
+ hostDirectives: [BrnSheetOverlay],
10
+ })
11
+ export class HlmSheetOverlay {
12
+ private readonly _classSettable = injectCustomClassSettable({ optional: true, host: true });
13
+ public readonly userClass = input<ClassValue>('', { alias: 'class' });
14
+ protected readonly _computedClass = computed(() =>
15
+ hlm(
16
+ 'bg-black/10 supports-backdrop-filter:backdrop-blur-xs transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0',
17
+ this.userClass(),
18
+ ),
19
+ );
20
+
21
+ constructor() {
22
+ effect(() => {
23
+ const classValue = this._computedClass();
24
+ untracked(() => this._classSettable?.setClassToCustomElement(classValue));
25
+ });
26
+ }
27
+ }
@@ -0,0 +1,8 @@
1
+ import { Directive } from '@angular/core';
2
+ import { BrnSheetContent } from '@spartan-ng/brain/sheet';
3
+
4
+ @Directive({
5
+ selector: '[hlmSheetPortal]',
6
+ hostDirectives: [{ directive: BrnSheetContent, inputs: ['context', 'class'] }],
7
+ })
8
+ export class HlmSheetPortal {}
@@ -0,0 +1,14 @@
1
+ import { Directive } from '@angular/core';
2
+ import { BrnSheetTitle } from '@spartan-ng/brain/sheet';
3
+ import { classes } from '../../../utils/src';
4
+
5
+ @Directive({
6
+ selector: '[hlmSheetTitle]',
7
+ hostDirectives: [BrnSheetTitle],
8
+ host: { 'data-slot': 'sheet-title' },
9
+ })
10
+ export class HlmSheetTitle {
11
+ constructor() {
12
+ classes(() => 'text-foreground font-medium');
13
+ }
14
+ }
@@ -0,0 +1,9 @@
1
+ import { Directive } from '@angular/core';
2
+ import { BrnSheetTrigger } from '@spartan-ng/brain/sheet';
3
+
4
+ @Directive({
5
+ selector: 'button[hlmSheetTrigger]',
6
+ hostDirectives: [{ directive: BrnSheetTrigger, inputs: ['id', 'side', 'type'] }],
7
+ host: { 'data-slot': 'sheet-trigger' },
8
+ })
9
+ export class HlmSheetTrigger {}
@@ -0,0 +1,29 @@
1
+ import { ChangeDetectionStrategy, Component, forwardRef } from '@angular/core';
2
+ import { BrnDialog, provideBrnDialogDefaultOptions } from '@spartan-ng/brain/dialog';
3
+ import { BrnSheet } from '@spartan-ng/brain/sheet';
4
+ import { HlmSheetOverlay } from './hlm-sheet-overlay';
5
+
6
+ @Component({
7
+ selector: 'hlm-sheet',
8
+ exportAs: 'hlmSheet',
9
+ imports: [HlmSheetOverlay],
10
+ providers: [
11
+ {
12
+ provide: BrnDialog,
13
+ useExisting: forwardRef(() => BrnSheet),
14
+ },
15
+ {
16
+ provide: BrnSheet,
17
+ useExisting: forwardRef(() => HlmSheet),
18
+ },
19
+ provideBrnDialogDefaultOptions({
20
+ // add custom options here
21
+ }),
22
+ ],
23
+ changeDetection: ChangeDetectionStrategy.OnPush,
24
+ template: `
25
+ <hlm-sheet-overlay />
26
+ <ng-content />
27
+ `,
28
+ })
29
+ export class HlmSheet extends BrnSheet {}