pdm-ui-kit 0.1.0 → 0.1.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.
Files changed (245) hide show
  1. package/README.md +115 -59
  2. package/esm2020/lib/components/accordion/accordion.component.mjs +42 -0
  3. package/esm2020/lib/components/alert/alert.component.mjs +35 -0
  4. package/esm2020/lib/components/alert-dialog/alert-dialog.component.mjs +69 -0
  5. package/esm2020/lib/components/aspect-ratio/aspect-ratio.component.mjs +31 -0
  6. package/esm2020/lib/components/avatar/avatar.component.mjs +46 -0
  7. package/esm2020/lib/components/badge/badge.component.mjs +23 -0
  8. package/esm2020/lib/components/breadcrumb/breadcrumb.component.mjs +29 -0
  9. package/esm2020/lib/components/button/button.component.mjs +82 -0
  10. package/esm2020/lib/components/button-group/button-group.component.mjs +23 -0
  11. package/esm2020/lib/components/calendar/calendar.component.mjs +71 -0
  12. package/esm2020/lib/components/card/card.component.mjs +65 -0
  13. package/esm2020/lib/components/carousel/carousel.component.mjs +97 -0
  14. package/esm2020/lib/components/chart/chart.component.mjs +174 -0
  15. package/esm2020/lib/components/checkbox/checkbox.component.mjs +47 -0
  16. package/esm2020/lib/components/collapsible/collapsible.component.mjs +43 -0
  17. package/esm2020/lib/components/combobox/combobox.component.mjs +51 -0
  18. package/esm2020/lib/components/command/command.component.mjs +75 -0
  19. package/esm2020/lib/components/context-menu/context-menu.component.mjs +78 -0
  20. package/esm2020/lib/components/data-table/data-table.component.mjs +89 -0
  21. package/esm2020/lib/components/date-picker/date-picker.component.mjs +63 -0
  22. package/esm2020/lib/components/dialog/dialog.component.mjs +90 -0
  23. package/esm2020/lib/components/drawer/drawer.component.mjs +72 -0
  24. package/esm2020/lib/components/dropdown-menu/dropdown-menu.component.mjs +120 -0
  25. package/esm2020/lib/components/empty/empty.component.mjs +58 -0
  26. package/esm2020/lib/components/field/field.component.mjs +52 -0
  27. package/esm2020/lib/components/hover-card/hover-card.component.mjs +44 -0
  28. package/esm2020/lib/components/icon/icon.component.mjs +94 -0
  29. package/esm2020/lib/components/input/input.component.mjs +65 -0
  30. package/esm2020/lib/components/input-group/input-group.component.mjs +54 -0
  31. package/esm2020/lib/components/input-otp/input-otp.component.mjs +140 -0
  32. package/esm2020/lib/components/input-password/input-password.component.mjs +72 -0
  33. package/esm2020/lib/components/item/item.component.mjs +23 -0
  34. package/esm2020/lib/components/kbd/kbd.component.mjs +17 -0
  35. package/esm2020/lib/components/label/label.component.mjs +23 -0
  36. package/esm2020/lib/components/menubar/menubar.component.mjs +31 -0
  37. package/esm2020/lib/components/native-select/native-select.component.mjs +42 -0
  38. package/esm2020/lib/components/navigation-menu/navigation-menu.component.mjs +20 -0
  39. package/esm2020/lib/components/pagination/pagination.component.mjs +47 -0
  40. package/esm2020/lib/components/popover/popover.component.mjs +58 -0
  41. package/esm2020/lib/components/progress/progress.component.mjs +33 -0
  42. package/esm2020/lib/components/radio-group/radio-group.component.mjs +38 -0
  43. package/esm2020/lib/components/scroll-area/scroll-area.component.mjs +20 -0
  44. package/esm2020/lib/components/select/select.component.mjs +38 -0
  45. package/esm2020/lib/components/separator/separator.component.mjs +26 -0
  46. package/esm2020/lib/components/sheet/sheet.component.mjs +39 -0
  47. package/esm2020/lib/components/sidebar/sidebar.component.mjs +20 -0
  48. package/esm2020/lib/components/skeleton/skeleton.component.mjs +17 -0
  49. package/esm2020/lib/components/slider/slider.component.mjs +46 -0
  50. package/esm2020/lib/components/sonner/sonner.component.mjs +39 -0
  51. package/esm2020/lib/components/spinner/spinner.component.mjs +20 -0
  52. package/esm2020/lib/components/switch/switch.component.mjs +35 -0
  53. package/esm2020/lib/components/table/table.component.mjs +17 -0
  54. package/esm2020/lib/components/tabs/tabs.component.mjs +31 -0
  55. package/esm2020/lib/components/textarea/textarea.component.mjs +59 -0
  56. package/esm2020/lib/components/toggle/toggle.component.mjs +41 -0
  57. package/esm2020/lib/components/toggle-group/toggle-group.component.mjs +31 -0
  58. package/esm2020/lib/components/tooltip/tooltip.component.mjs +33 -0
  59. package/esm2020/lib/pdm-ui-kit.module.mjs +245 -0
  60. package/esm2020/pdm-ui-kit.mjs +5 -0
  61. package/esm2020/public-api.mjs +59 -0
  62. package/fesm2015/pdm-ui-kit.mjs +2959 -0
  63. package/fesm2015/pdm-ui-kit.mjs.map +1 -0
  64. package/fesm2020/pdm-ui-kit.mjs +2954 -0
  65. package/fesm2020/pdm-ui-kit.mjs.map +1 -0
  66. package/index.d.ts +5 -0
  67. package/lib/components/accordion/accordion.component.d.ts +19 -0
  68. package/lib/components/alert/alert.component.d.ts +13 -0
  69. package/lib/components/alert-dialog/alert-dialog.component.d.ts +21 -0
  70. package/lib/components/aspect-ratio/aspect-ratio.component.d.ts +10 -0
  71. package/lib/components/avatar/avatar.component.d.ts +20 -0
  72. package/lib/components/badge/badge.component.d.ts +9 -0
  73. package/lib/components/breadcrumb/breadcrumb.component.d.ts +10 -0
  74. package/lib/components/button/button.component.d.ts +24 -0
  75. package/lib/components/button-group/button-group.component.d.ts +9 -0
  76. package/lib/components/calendar/calendar.component.d.ts +28 -0
  77. package/lib/components/card/card.component.d.ts +24 -0
  78. package/lib/components/carousel/carousel.component.d.ts +25 -0
  79. package/lib/components/chart/chart.component.d.ts +41 -0
  80. package/lib/components/checkbox/checkbox.component.d.ts +17 -0
  81. package/lib/components/collapsible/collapsible.component.d.ts +14 -0
  82. package/lib/components/combobox/combobox.component.d.ts +18 -0
  83. package/lib/components/command/command.component.d.ts +33 -0
  84. package/lib/components/context-menu/context-menu.component.d.ts +26 -0
  85. package/lib/components/data-table/data-table.component.d.ts +36 -0
  86. package/lib/components/date-picker/date-picker.component.d.ts +23 -0
  87. package/lib/components/dialog/dialog.component.d.ts +30 -0
  88. package/lib/components/drawer/drawer.component.d.ts +27 -0
  89. package/lib/components/dropdown-menu/dropdown-menu.component.d.ts +34 -0
  90. package/lib/components/empty/empty.component.d.ts +19 -0
  91. package/lib/components/field/field.component.d.ts +18 -0
  92. package/lib/components/hover-card/hover-card.component.d.ts +14 -0
  93. package/lib/components/icon/icon.component.d.ts +18 -0
  94. package/lib/components/input/input.component.d.ts +23 -0
  95. package/lib/components/input-group/input-group.component.d.ts +19 -0
  96. package/lib/components/input-otp/input-otp.component.d.ts +26 -0
  97. package/lib/components/input-password/input-password.component.d.ts +25 -0
  98. package/lib/components/item/item.component.d.ts +8 -0
  99. package/lib/components/kbd/kbd.component.d.ts +6 -0
  100. package/lib/components/label/label.component.d.ts +8 -0
  101. package/lib/components/menubar/menubar.component.d.ts +17 -0
  102. package/lib/components/native-select/native-select.component.d.ts +20 -0
  103. package/lib/components/navigation-menu/navigation-menu.component.d.ts +12 -0
  104. package/lib/components/pagination/pagination.component.d.ts +13 -0
  105. package/lib/components/popover/popover.component.d.ts +17 -0
  106. package/lib/components/progress/progress.component.d.ts +10 -0
  107. package/lib/components/radio-group/radio-group.component.d.ts +19 -0
  108. package/lib/components/scroll-area/scroll-area.component.d.ts +7 -0
  109. package/lib/components/select/select.component.d.ts +19 -0
  110. package/lib/components/separator/separator.component.d.ts +9 -0
  111. package/lib/components/sheet/sheet.component.d.ts +13 -0
  112. package/lib/components/sidebar/sidebar.component.d.ts +7 -0
  113. package/lib/components/skeleton/skeleton.component.d.ts +6 -0
  114. package/lib/components/slider/slider.component.d.ts +15 -0
  115. package/lib/components/sonner/sonner.component.d.ts +13 -0
  116. package/lib/components/spinner/spinner.component.d.ts +7 -0
  117. package/lib/components/switch/switch.component.d.ts +13 -0
  118. package/lib/components/table/table.component.d.ts +6 -0
  119. package/lib/components/tabs/tabs.component.d.ts +16 -0
  120. package/lib/components/textarea/textarea.component.d.ts +21 -0
  121. package/lib/components/toggle/toggle.component.d.ts +14 -0
  122. package/lib/components/toggle-group/toggle-group.component.d.ts +16 -0
  123. package/lib/components/tooltip/tooltip.component.d.ts +10 -0
  124. package/lib/pdm-ui-kit.module.d.ts +64 -0
  125. package/package.json +25 -10
  126. package/FIGMA_COMPONENT_AUDIT.md +0 -154
  127. package/ng-package.json +0 -7
  128. package/src/lib/components/accordion/accordion.component.html +0 -34
  129. package/src/lib/components/accordion/accordion.component.ts +0 -38
  130. package/src/lib/components/alert/alert.component.html +0 -52
  131. package/src/lib/components/alert/alert.component.ts +0 -25
  132. package/src/lib/components/alert-dialog/alert-dialog.component.html +0 -41
  133. package/src/lib/components/alert-dialog/alert-dialog.component.ts +0 -45
  134. package/src/lib/components/aspect-ratio/aspect-ratio.component.html +0 -11
  135. package/src/lib/components/aspect-ratio/aspect-ratio.component.ts +0 -18
  136. package/src/lib/components/avatar/avatar.component.html +0 -21
  137. package/src/lib/components/avatar/avatar.component.ts +0 -32
  138. package/src/lib/components/badge/badge.component.html +0 -28
  139. package/src/lib/components/badge/badge.component.ts +0 -23
  140. package/src/lib/components/breadcrumb/breadcrumb.component.html +0 -39
  141. package/src/lib/components/breadcrumb/breadcrumb.component.ts +0 -26
  142. package/src/lib/components/button/button.component.html +0 -15
  143. package/src/lib/components/button/button.component.ts +0 -84
  144. package/src/lib/components/button-group/button-group.component.html +0 -39
  145. package/src/lib/components/button-group/button-group.component.ts +0 -15
  146. package/src/lib/components/calendar/calendar.component.html +0 -73
  147. package/src/lib/components/calendar/calendar.component.ts +0 -78
  148. package/src/lib/components/card/card.component.html +0 -77
  149. package/src/lib/components/card/card.component.ts +0 -39
  150. package/src/lib/components/carousel/carousel.component.html +0 -86
  151. package/src/lib/components/carousel/carousel.component.ts +0 -100
  152. package/src/lib/components/chart/chart.component.html +0 -143
  153. package/src/lib/components/chart/chart.component.ts +0 -147
  154. package/src/lib/components/checkbox/checkbox.component.html +0 -38
  155. package/src/lib/components/checkbox/checkbox.component.ts +0 -32
  156. package/src/lib/components/collapsible/collapsible.component.html +0 -26
  157. package/src/lib/components/collapsible/collapsible.component.ts +0 -29
  158. package/src/lib/components/combobox/combobox.component.html +0 -42
  159. package/src/lib/components/combobox/combobox.component.ts +0 -32
  160. package/src/lib/components/command/command.component.html +0 -55
  161. package/src/lib/components/command/command.component.ts +0 -67
  162. package/src/lib/components/context-menu/context-menu.component.html +0 -47
  163. package/src/lib/components/context-menu/context-menu.component.ts +0 -67
  164. package/src/lib/components/data-table/data-table.component.html +0 -63
  165. package/src/lib/components/data-table/data-table.component.ts +0 -78
  166. package/src/lib/components/date-picker/date-picker.component.html +0 -38
  167. package/src/lib/components/date-picker/date-picker.component.ts +0 -34
  168. package/src/lib/components/dialog/dialog.component.html +0 -78
  169. package/src/lib/components/dialog/dialog.component.ts +0 -55
  170. package/src/lib/components/drawer/drawer.component.html +0 -56
  171. package/src/lib/components/drawer/drawer.component.ts +0 -43
  172. package/src/lib/components/dropdown-menu/dropdown-menu.component.html +0 -56
  173. package/src/lib/components/dropdown-menu/dropdown-menu.component.ts +0 -126
  174. package/src/lib/components/empty/empty.component.html +0 -29
  175. package/src/lib/components/empty/empty.component.ts +0 -35
  176. package/src/lib/components/field/field.component.html +0 -22
  177. package/src/lib/components/field/field.component.ts +0 -28
  178. package/src/lib/components/hover-card/hover-card.component.html +0 -24
  179. package/src/lib/components/hover-card/hover-card.component.ts +0 -36
  180. package/src/lib/components/icon/icon.component.html +0 -286
  181. package/src/lib/components/icon/icon.component.ts +0 -133
  182. package/src/lib/components/input/input.component.html +0 -22
  183. package/src/lib/components/input/input.component.ts +0 -33
  184. package/src/lib/components/input-group/input-group.component.html +0 -31
  185. package/src/lib/components/input-group/input-group.component.ts +0 -26
  186. package/src/lib/components/input-otp/input-otp.component.html +0 -25
  187. package/src/lib/components/input-otp/input-otp.component.ts +0 -146
  188. package/src/lib/components/input-password/input-password.component.html +0 -64
  189. package/src/lib/components/input-password/input-password.component.ts +0 -46
  190. package/src/lib/components/item/item.component.html +0 -10
  191. package/src/lib/components/item/item.component.ts +0 -12
  192. package/src/lib/components/kbd/kbd.component.html +0 -3
  193. package/src/lib/components/kbd/kbd.component.ts +0 -10
  194. package/src/lib/components/label/label.component.html +0 -7
  195. package/src/lib/components/label/label.component.ts +0 -12
  196. package/src/lib/components/menubar/menubar.component.html +0 -16
  197. package/src/lib/components/menubar/menubar.component.ts +0 -29
  198. package/src/lib/components/native-select/native-select.component.html +0 -17
  199. package/src/lib/components/native-select/native-select.component.ts +0 -28
  200. package/src/lib/components/navigation-menu/navigation-menu.component.html +0 -15
  201. package/src/lib/components/navigation-menu/navigation-menu.component.ts +0 -17
  202. package/src/lib/components/pagination/pagination.component.html +0 -30
  203. package/src/lib/components/pagination/pagination.component.ts +0 -37
  204. package/src/lib/components/popover/popover.component.html +0 -6
  205. package/src/lib/components/popover/popover.component.ts +0 -40
  206. package/src/lib/components/progress/progress.component.html +0 -9
  207. package/src/lib/components/progress/progress.component.ts +0 -20
  208. package/src/lib/components/radio-group/radio-group.component.html +0 -25
  209. package/src/lib/components/radio-group/radio-group.component.ts +0 -30
  210. package/src/lib/components/scroll-area/scroll-area.component.html +0 -5
  211. package/src/lib/components/scroll-area/scroll-area.component.ts +0 -11
  212. package/src/lib/components/select/select.component.html +0 -14
  213. package/src/lib/components/select/select.component.ts +0 -27
  214. package/src/lib/components/separator/separator.component.html +0 -5
  215. package/src/lib/components/separator/separator.component.ts +0 -16
  216. package/src/lib/components/sheet/sheet.component.html +0 -10
  217. package/src/lib/components/sheet/sheet.component.ts +0 -28
  218. package/src/lib/components/sidebar/sidebar.component.html +0 -3
  219. package/src/lib/components/sidebar/sidebar.component.ts +0 -11
  220. package/src/lib/components/skeleton/skeleton.component.html +0 -1
  221. package/src/lib/components/skeleton/skeleton.component.ts +0 -10
  222. package/src/lib/components/slider/slider.component.html +0 -15
  223. package/src/lib/components/slider/slider.component.ts +0 -31
  224. package/src/lib/components/sonner/sonner.component.html +0 -10
  225. package/src/lib/components/sonner/sonner.component.ts +0 -25
  226. package/src/lib/components/spinner/spinner.component.html +0 -6
  227. package/src/lib/components/spinner/spinner.component.ts +0 -11
  228. package/src/lib/components/switch/switch.component.html +0 -14
  229. package/src/lib/components/switch/switch.component.ts +0 -20
  230. package/src/lib/components/table/table.component.html +0 -5
  231. package/src/lib/components/table/table.component.ts +0 -10
  232. package/src/lib/components/tabs/tabs.component.html +0 -21
  233. package/src/lib/components/tabs/tabs.component.ts +0 -26
  234. package/src/lib/components/textarea/textarea.component.html +0 -21
  235. package/src/lib/components/textarea/textarea.component.ts +0 -28
  236. package/src/lib/components/toggle/toggle.component.html +0 -16
  237. package/src/lib/components/toggle/toggle.component.ts +0 -29
  238. package/src/lib/components/toggle-group/toggle-group.component.html +0 -17
  239. package/src/lib/components/toggle-group/toggle-group.component.ts +0 -26
  240. package/src/lib/components/tooltip/tooltip.component.html +0 -6
  241. package/src/lib/components/tooltip/tooltip.component.ts +0 -20
  242. package/src/lib/pdm-ui-kit.module.ts +0 -126
  243. package/tsconfig.lib.json +0 -17
  244. package/tsconfig.lib.prod.json +0 -9
  245. /package/{src/public-api.ts → public-api.d.ts} +0 -0
@@ -1,133 +0,0 @@
1
- import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
2
-
3
- export type PdmIconLibrary = 'lucide' | 'tabler' | 'hugeicons' | 'phosphor' | 'remix';
4
-
5
- export type PdmIconName =
6
- | 'command'
7
- | 'check'
8
- | 'check-circle'
9
- | 'circle'
10
- | 'dot'
11
- | 'x'
12
- | 'alert-circle'
13
- | 'info'
14
- | 'loader-2'
15
- | 'menu'
16
- | 'search'
17
- | 'calendar'
18
- | 'panel-left'
19
- | 'monitor'
20
- | 'laptop'
21
- | 'sun'
22
- | 'moon'
23
- | 'chevron-down'
24
- | 'chevron-up'
25
- | 'chevron-left'
26
- | 'chevron-right'
27
- | 'chevrons-left'
28
- | 'chevrons-right'
29
- | 'chevrons-up-down'
30
- | 'arrow-up-down'
31
- | 'ellipsis'
32
- | 'filter'
33
- | 'sort-asc'
34
- | 'sort-desc'
35
- | 'plus'
36
- | 'minus'
37
- | 'copy'
38
- | 'pencil'
39
- | 'trash-2'
40
- | 'download'
41
- | 'upload'
42
- | 'home'
43
- | 'mail'
44
- | 'phone'
45
- | 'log-in'
46
- | 'log-out'
47
- | 'user'
48
- | 'settings'
49
- | 'credit-card'
50
- | 'smile'
51
- | 'calculator'
52
- | 'external-link'
53
- | 'folder'
54
- | 'arrow-up-right';
55
-
56
- @Component({
57
- selector: 'pdm-icon',
58
- templateUrl: './icon.component.html',
59
- changeDetection: ChangeDetectionStrategy.OnPush
60
- })
61
- export class PdmIconComponent {
62
- @Input() name: PdmIconName | string = 'check';
63
- @Input() library: PdmIconLibrary = 'lucide';
64
- @Input() assetUrl: string | null = null;
65
- @Input() size = 16;
66
- @Input() strokeWidth = 1.5;
67
- @Input() className = '';
68
- @Input() ariaLabel: string | null = null;
69
- @Input() decorative = false;
70
-
71
- get resolvedStrokeWidth(): number {
72
- if (this.strokeWidth) {
73
- return this.strokeWidth;
74
- }
75
-
76
- if (this.library === 'phosphor') {
77
- return 1.6;
78
- }
79
-
80
- if (this.library === 'tabler') {
81
- return 1.8;
82
- }
83
-
84
- return 1.5;
85
- }
86
-
87
- get iconKey(): string {
88
- const raw = `${this.name || ''}`.trim();
89
- if (!raw) {
90
- return 'circle';
91
- }
92
-
93
- const trimmed = raw.replace(/^(lucide|tabler|hugeicons|phosphor|remix)\//, '');
94
- const aliases = this.aliasMapByLibrary[this.library] ?? {};
95
- return aliases[trimmed] ?? trimmed;
96
- }
97
-
98
- private readonly aliasMapByLibrary: Record<PdmIconLibrary, Record<string, string>> = {
99
- lucide: {},
100
- tabler: {
101
- 'alert-triangle': 'alert-circle',
102
- 'chevron-down': 'chevron-down',
103
- 'chevron-right': 'chevron-right',
104
- 'user-circle': 'user',
105
- 'settings-2': 'settings',
106
- 'external-link': 'external-link'
107
- },
108
- hugeicons: {
109
- 'alert-02': 'alert-circle',
110
- 'user-circle': 'user',
111
- 'search-01': 'search',
112
- 'settings-01': 'settings',
113
- 'arrow-right-01': 'chevron-right',
114
- 'arrow-down-01': 'chevron-down'
115
- },
116
- phosphor: {
117
- 'warning-circle': 'alert-circle',
118
- 'caret-down': 'chevron-down',
119
- 'caret-right': 'chevron-right',
120
- 'user-circle': 'user',
121
- gear: 'settings',
122
- 'arrow-square-out': 'external-link'
123
- },
124
- remix: {
125
- 'alert-line': 'alert-circle',
126
- 'arrow-right-line': 'chevron-right',
127
- 'arrow-down-s-line': 'chevron-down',
128
- 'external-link-line': 'external-link',
129
- 'user-line': 'user',
130
- 'settings-3-line': 'settings'
131
- }
132
- };
133
- }
@@ -1,22 +0,0 @@
1
- <div [ngClass]="['grid w-full gap-2', className]">
2
- <label *ngIf="label" [attr.for]="id" class="text-sm font-medium leading-5 text-foreground">{{ label }}</label>
3
- <input
4
- [id]="id"
5
- [type]="type"
6
- [value]="value"
7
- [placeholder]="placeholder"
8
- [disabled]="disabled"
9
- [readonly]="readonly"
10
- [required]="required"
11
- [attr.aria-invalid]="invalid"
12
- [ngClass]="[
13
- 'flex h-9 w-full rounded-[8px] border bg-background px-3 py-2 text-sm leading-5 text-foreground shadow-[0_1px_2px_rgba(0,0,0,0.1)] outline-none ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus:outline-none focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary/30 disabled:cursor-not-allowed disabled:opacity-50',
14
- invalid ? 'border-destructive' : 'border-input',
15
- inputClassName
16
- ]"
17
- (input)="onInput($event)"
18
- (blur)="onBlur($event)"
19
- />
20
- <p *ngIf="!invalid && helperText" class="text-sm leading-5 text-muted-foreground">{{ helperText }}</p>
21
- <p *ngIf="invalid && errorText" class="text-sm leading-5 text-destructive">{{ errorText }}</p>
22
- </div>
@@ -1,33 +0,0 @@
1
- import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output } from '@angular/core';
2
-
3
- @Component({
4
- selector: 'pdm-input',
5
- templateUrl: './input.component.html',
6
- changeDetection: ChangeDetectionStrategy.OnPush
7
- })
8
- export class PdmInputComponent {
9
- @Input() id = '';
10
- @Input() type = 'text';
11
- @Input() value = '';
12
- @Input() placeholder = '';
13
- @Input() disabled = false;
14
- @Input() readonly = false;
15
- @Input() required = false;
16
- @Input() invalid = false;
17
- @Input() className = '';
18
- @Input() inputClassName = '';
19
- @Input() label = '';
20
- @Input() helperText = '';
21
- @Input() errorText = '';
22
-
23
- @Output() valueChange = new EventEmitter<string>();
24
- @Output() blurred = new EventEmitter<FocusEvent>();
25
-
26
- onInput(event: Event): void {
27
- this.valueChange.emit((event.target as HTMLInputElement).value);
28
- }
29
-
30
- onBlur(event: FocusEvent): void {
31
- this.blurred.emit(event);
32
- }
33
- }
@@ -1,31 +0,0 @@
1
- <div
2
- [ngClass]="[
3
- 'flex h-9 w-full items-center rounded-[8px] border bg-[hsl(var(--background))] text-sm shadow-[0_1px_2px_rgba(0,0,0,0.1)] ring-offset-[hsl(var(--background))] focus-within:ring-1 focus-within:ring-[hsl(var(--foreground))]',
4
- invalid ? 'border-[hsl(var(--destructive))]' : 'border-[hsl(var(--input))]',
5
- disabled ? 'opacity-50' : '',
6
- className
7
- ]"
8
- >
9
- <div *ngIf="prefixText || prefixIcon" class="inline-flex h-full items-center gap-2 border-r border-[hsl(var(--input))] pl-3 pr-2 text-[hsl(var(--muted-foreground))]">
10
- <pdm-icon *ngIf="prefixIcon" [name]="prefixIcon" [size]="16"></pdm-icon>
11
- <span *ngIf="prefixText" class="text-sm leading-5">{{ prefixText }}</span>
12
- <ng-content select="[pdmInputGroupPrefix]"></ng-content>
13
- </div>
14
-
15
- <input
16
- [id]="id"
17
- [type]="type"
18
- [value]="value"
19
- [placeholder]="placeholder"
20
- [disabled]="disabled"
21
- [attr.aria-invalid]="invalid"
22
- class="h-full min-w-0 flex-1 border-0 bg-transparent px-2 py-2 text-sm leading-5 outline-none placeholder:text-[hsl(var(--muted-foreground))]"
23
- (input)="onInput($event)"
24
- />
25
-
26
- <div *ngIf="suffixText || suffixIcon" class="inline-flex h-full items-center gap-2 border-l border-[hsl(var(--input))] pl-2 pr-3 text-[hsl(var(--muted-foreground))]">
27
- <pdm-icon *ngIf="suffixIcon" [name]="suffixIcon" [size]="16"></pdm-icon>
28
- <span *ngIf="suffixText" class="text-sm font-medium leading-5">{{ suffixText }}</span>
29
- <ng-content select="[pdmInputGroupSuffix]"></ng-content>
30
- </div>
31
- </div>
@@ -1,26 +0,0 @@
1
- import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output } from '@angular/core';
2
-
3
- @Component({
4
- selector: 'pdm-input-group',
5
- templateUrl: './input-group.component.html',
6
- changeDetection: ChangeDetectionStrategy.OnPush
7
- })
8
- export class PdmInputGroupComponent {
9
- @Input() id = '';
10
- @Input() type = 'text';
11
- @Input() value = '';
12
- @Input() placeholder = '';
13
- @Input() disabled = false;
14
- @Input() invalid = false;
15
- @Input() prefixText = '';
16
- @Input() suffixText = '';
17
- @Input() prefixIcon = '';
18
- @Input() suffixIcon = '';
19
- @Input() className = '';
20
-
21
- @Output() valueChange = new EventEmitter<string>();
22
-
23
- onInput(event: Event): void {
24
- this.valueChange.emit((event.target as HTMLInputElement).value);
25
- }
26
- }
@@ -1,25 +0,0 @@
1
- <div [ngClass]="['inline-flex items-center justify-center', className]" (paste)="onPaste($event)">
2
- <ng-container *ngFor="let value of values; let index = index; trackBy: trackByIndex">
3
- <input
4
- #otpInput
5
- [class]="getInputClasses(index)"
6
- [value]="value"
7
- [disabled]="disabled"
8
- inputmode="numeric"
9
- maxlength="1"
10
- [attr.name]="'otp-digit-' + index"
11
- autocomplete="off"
12
- autocapitalize="off"
13
- spellcheck="false"
14
- [attr.aria-invalid]="invalid"
15
- [attr.aria-label]="'OTP digit ' + (index + 1)"
16
- (input)="onInput(index, $event)"
17
- (keydown)="onKeyDown(index, $event)"
18
- />
19
- <span
20
- *ngIf="shouldShowSeparator(index)"
21
- class="mx-2 mt-[-1px] h-px w-6 bg-foreground opacity-80"
22
- aria-hidden="true"
23
- ></span>
24
- </ng-container>
25
- </div>
@@ -1,146 +0,0 @@
1
- import { ChangeDetectionStrategy, Component, ElementRef, EventEmitter, Input, Output, QueryList, ViewChildren } from '@angular/core';
2
-
3
- @Component({
4
- selector: 'pdm-input-otp',
5
- templateUrl: './input-otp.component.html',
6
- changeDetection: ChangeDetectionStrategy.OnPush
7
- })
8
- export class PdmInputOtpComponent {
9
- @Input() length = 6;
10
- @Input() groupSize = 3;
11
- @Input() disabled = false;
12
- @Input() invalid = false;
13
- @Input() className = '';
14
-
15
- @Output() valueChange = new EventEmitter<string>();
16
- @Output() completed = new EventEmitter<string>();
17
-
18
- @ViewChildren('otpInput') private readonly inputs?: QueryList<ElementRef<HTMLInputElement>>;
19
-
20
- values: string[] = Array.from({ length: this.length }, () => '');
21
-
22
- ngOnChanges(): void {
23
- if (this.values.length !== this.length) {
24
- this.values = Array.from({ length: this.length }, (_, index) => this.values[index] ?? '');
25
- }
26
- }
27
-
28
- trackByIndex(index: number): number {
29
- return index;
30
- }
31
-
32
- onInput(index: number, event: Event): void {
33
- const input = event.target as HTMLInputElement;
34
- const char = (input.value || '').replace(/\D+/g, '').slice(-1);
35
-
36
- this.values[index] = char;
37
- input.value = char;
38
- this.emit();
39
-
40
- if (char) {
41
- this.focusInput(index + 1, true);
42
- }
43
- }
44
-
45
- onKeyDown(index: number, event: KeyboardEvent): void {
46
- if (event.key === 'Backspace' && !this.values[index]) {
47
- this.focusInput(index - 1);
48
- return;
49
- }
50
-
51
- if (event.key === 'ArrowLeft') {
52
- event.preventDefault();
53
- this.focusInput(index - 1);
54
- return;
55
- }
56
-
57
- if (event.key === 'ArrowRight') {
58
- event.preventDefault();
59
- this.focusInput(index + 1);
60
- }
61
- }
62
-
63
- onPaste(event: ClipboardEvent): void {
64
- event.preventDefault();
65
-
66
- const pastedText = (event.clipboardData?.getData('text') ?? '').replace(/\D+/g, '').slice(0, this.length);
67
-
68
- if (!pastedText) {
69
- return;
70
- }
71
-
72
- this.values = Array.from({ length: this.length }, (_, index) => pastedText[index] ?? '');
73
- this.emit();
74
-
75
- const nextIndex = Math.min(pastedText.length, this.length - 1);
76
- this.focusInput(nextIndex);
77
- }
78
-
79
- getInputClasses(index: number): string {
80
- const classes = [
81
- 'h-9 w-9 appearance-none border bg-background text-center text-sm font-normal text-foreground outline-none transition focus:outline-none focus-visible:outline-none',
82
- 'shadow-[0_1px_2px_0_rgba(0,0,0,0.1)]',
83
- 'focus:border-input focus:ring-1 focus:ring-primary/30',
84
- 'disabled:cursor-not-allowed disabled:opacity-50',
85
- ];
86
-
87
- if (this.invalid) {
88
- classes.push('border-destructive focus:border-destructive focus:ring-destructive');
89
- } else {
90
- classes.push('border-input');
91
- }
92
-
93
- if (this.isGroupStart(index)) {
94
- classes.push('rounded-l-md border-l');
95
- } else {
96
- classes.push('border-l-0');
97
- }
98
-
99
- if (this.isGroupEnd(index)) {
100
- classes.push('rounded-r-md');
101
- }
102
-
103
- return classes.join(' ');
104
- }
105
-
106
- shouldShowSeparator(index: number): boolean {
107
- return this.groupSize > 0 && (index + 1) % this.groupSize === 0 && index < this.length - 1;
108
- }
109
-
110
- private isGroupStart(index: number): boolean {
111
- return this.groupSize <= 0 || index % this.groupSize === 0;
112
- }
113
-
114
- private isGroupEnd(index: number): boolean {
115
- if (this.groupSize <= 0) {
116
- return index === this.length - 1;
117
- }
118
- return (index + 1) % this.groupSize === 0 || index === this.length - 1;
119
- }
120
-
121
- private emit(): void {
122
- const value = this.values.join('');
123
- this.valueChange.emit(value);
124
-
125
- if (value.length === this.length && !this.values.includes('')) {
126
- this.completed.emit(value);
127
- }
128
- }
129
-
130
- private focusInput(index: number, deferred = false): void {
131
- if (deferred) {
132
- requestAnimationFrame(() => this.focusInput(index, false));
133
- return;
134
- }
135
-
136
- if (!this.inputs || index < 0 || index >= this.length) {
137
- return;
138
- }
139
-
140
- const input = this.inputs.get(index)?.nativeElement;
141
- if (input) {
142
- input.focus();
143
- input.select();
144
- }
145
- }
146
- }
@@ -1,64 +0,0 @@
1
- <div [ngClass]="['grid w-full gap-2', className]">
2
- <label *ngIf="label" [attr.for]="id" class="text-sm font-medium leading-5 text-foreground">{{ label }}</label>
3
- <div class="relative">
4
- <input
5
- [id]="id"
6
- [type]="inputType"
7
- [value]="value"
8
- [placeholder]="placeholder"
9
- [disabled]="disabled"
10
- [readonly]="readonly"
11
- [required]="required"
12
- [attr.aria-invalid]="invalid"
13
- [ngClass]="[
14
- 'flex h-9 w-full rounded-[8px] border bg-background px-3 py-2 pr-10 text-sm leading-5 text-foreground shadow-[0_1px_2px_rgba(0,0,0,0.1)] outline-none ring-offset-background placeholder:text-muted-foreground focus:outline-none focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary/30 disabled:cursor-not-allowed disabled:opacity-50',
15
- invalid ? 'border-destructive' : 'border-input',
16
- inputClassName
17
- ]"
18
- (input)="onInput($event)"
19
- (blur)="onBlur($event)"
20
- />
21
- <button
22
- type="button"
23
- class="absolute right-2 top-1/2 inline-flex h-6 w-6 -translate-y-1/2 items-center justify-center rounded border-0 bg-transparent p-0 text-muted-foreground outline-none transition-colors hover:text-foreground focus:outline-none focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-60"
24
- [disabled]="disabled"
25
- [attr.aria-label]="showPassword ? 'Hide password' : 'Show password'"
26
- (click)="toggleVisibility()"
27
- >
28
- <svg
29
- *ngIf="!showPassword"
30
- aria-hidden="true"
31
- xmlns="http://www.w3.org/2000/svg"
32
- viewBox="0 0 24 24"
33
- fill="none"
34
- stroke="currentColor"
35
- stroke-width="2"
36
- stroke-linecap="round"
37
- stroke-linejoin="round"
38
- class="h-4 w-4"
39
- >
40
- <path d="M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"></path>
41
- <circle cx="12" cy="12" r="3"></circle>
42
- </svg>
43
- <svg
44
- *ngIf="showPassword"
45
- aria-hidden="true"
46
- xmlns="http://www.w3.org/2000/svg"
47
- viewBox="0 0 24 24"
48
- fill="none"
49
- stroke="currentColor"
50
- stroke-width="2"
51
- stroke-linecap="round"
52
- stroke-linejoin="round"
53
- class="h-4 w-4"
54
- >
55
- <path d="M3 3l18 18"></path>
56
- <path d="M10.58 10.58a2 2 0 1 0 2.83 2.83"></path>
57
- <path d="M9.88 5.09A10.94 10.94 0 0 1 12 4.91c5.05 0 9.27 3.11 10.6 7.09a1 1 0 0 1 0 .64 11.9 11.9 0 0 1-1.84 3.2"></path>
58
- <path d="M6.61 6.61A11.81 11.81 0 0 0 1.4 12a1 1 0 0 0 0 .64 11.83 11.83 0 0 0 8.79 7.54"></path>
59
- </svg>
60
- </button>
61
- </div>
62
- <p *ngIf="!invalid && helperText" class="text-sm leading-5 text-muted-foreground">{{ helperText }}</p>
63
- <p *ngIf="invalid && errorText" class="text-sm leading-5 text-destructive">{{ errorText }}</p>
64
- </div>
@@ -1,46 +0,0 @@
1
- import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output } from '@angular/core';
2
-
3
- @Component({
4
- selector: 'pdm-input-password',
5
- templateUrl: './input-password.component.html',
6
- changeDetection: ChangeDetectionStrategy.OnPush
7
- })
8
- export class PdmInputPasswordComponent {
9
- @Input() id = '';
10
- @Input() value = '';
11
- @Input() placeholder = '';
12
- @Input() disabled = false;
13
- @Input() readonly = false;
14
- @Input() required = false;
15
- @Input() invalid = false;
16
- @Input() className = '';
17
- @Input() inputClassName = '';
18
- @Input() label = '';
19
- @Input() helperText = '';
20
- @Input() errorText = '';
21
-
22
- @Output() valueChange = new EventEmitter<string>();
23
- @Output() blurred = new EventEmitter<FocusEvent>();
24
-
25
- showPassword = false;
26
-
27
- get inputType(): 'text' | 'password' {
28
- return this.showPassword ? 'text' : 'password';
29
- }
30
-
31
- onInput(event: Event): void {
32
- this.valueChange.emit((event.target as HTMLInputElement).value);
33
- }
34
-
35
- onBlur(event: FocusEvent): void {
36
- this.blurred.emit(event);
37
- }
38
-
39
- toggleVisibility(): void {
40
- if (this.disabled) {
41
- return;
42
- }
43
-
44
- this.showPassword = !this.showPassword;
45
- }
46
- }
@@ -1,10 +0,0 @@
1
- <div
2
- [ngClass]="[
3
- 'relative flex w-full select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors',
4
- selected ? 'bg-[hsl(var(--accent))] text-[hsl(var(--accent-foreground))]' : 'text-[hsl(var(--foreground))]',
5
- disabled ? 'pointer-events-none opacity-50' : 'hover:bg-[hsl(var(--accent))] hover:text-[hsl(var(--accent-foreground))]',
6
- className
7
- ]"
8
- >
9
- <ng-content></ng-content>
10
- </div>
@@ -1,12 +0,0 @@
1
- import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
2
-
3
- @Component({
4
- selector: 'pdm-item',
5
- templateUrl: './item.component.html',
6
- changeDetection: ChangeDetectionStrategy.OnPush
7
- })
8
- export class PdmItemComponent {
9
- @Input() className = '';
10
- @Input() disabled = false;
11
- @Input() selected = false;
12
- }
@@ -1,3 +0,0 @@
1
- <kbd [ngClass]="['inline-flex h-6 min-w-[24px] items-center justify-center rounded-md border border-[hsl(var(--border))] bg-[hsl(var(--muted))] px-1.5 font-mono text-xs font-medium text-[hsl(var(--muted-foreground))]', className]">
2
- <ng-content></ng-content>
3
- </kbd>
@@ -1,10 +0,0 @@
1
- import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
2
-
3
- @Component({
4
- selector: 'pdm-kbd',
5
- templateUrl: './kbd.component.html',
6
- changeDetection: ChangeDetectionStrategy.OnPush
7
- })
8
- export class PdmKbdComponent {
9
- @Input() className = '';
10
- }
@@ -1,7 +0,0 @@
1
- <label
2
- [attr.for]="forId"
3
- [ngClass]="['text-sm font-medium leading-5 text-[hsl(var(--foreground))] peer-disabled:cursor-not-allowed peer-disabled:opacity-70', className]"
4
- >
5
- <ng-content></ng-content>
6
- <span *ngIf="required" class="ml-1 text-[hsl(var(--destructive))]">*</span>
7
- </label>
@@ -1,12 +0,0 @@
1
- import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
2
-
3
- @Component({
4
- selector: 'pdm-label',
5
- templateUrl: './label.component.html',
6
- changeDetection: ChangeDetectionStrategy.OnPush
7
- })
8
- export class PdmLabelComponent {
9
- @Input() forId = '';
10
- @Input() required = false;
11
- @Input() className = '';
12
- }
@@ -1,16 +0,0 @@
1
- <nav role="menubar" [ngClass]="['inline-flex h-9 items-center gap-0.5 rounded-md border border-[hsl(var(--border))] bg-[hsl(var(--background))] p-1 shadow-[0_1px_2px_rgba(0,0,0,0.1)]', className]">
2
- <div *ngFor="let menu of menus; let i = index" class="relative">
3
- <button type="button" class="inline-flex h-7 items-center rounded-sm px-3 text-sm leading-5 text-[hsl(var(--foreground))] hover:bg-[hsl(var(--accent))]" (click)="toggle(i)">{{ menu.label }}</button>
4
- <div *ngIf="openIndex === i" class="absolute left-0 top-full z-50 mt-1 min-w-[12rem] rounded-md border border-[hsl(var(--border))] bg-[hsl(var(--popover))] p-1 text-[hsl(var(--popover-foreground))] shadow-[0_4px_6px_rgba(0,0,0,0.09)]">
5
- <button
6
- *ngFor="let item of menu.items"
7
- type="button"
8
- [disabled]="item.disabled"
9
- class="relative flex w-full cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm leading-5 outline-none hover:bg-[hsl(var(--accent))] disabled:pointer-events-none disabled:opacity-50"
10
- (click)="select(item.value)"
11
- >
12
- {{ item.label }}
13
- </button>
14
- </div>
15
- </div>
16
- </nav>
@@ -1,29 +0,0 @@
1
- import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output } from '@angular/core';
2
- import { PdmMenuItem } from '../dropdown-menu/dropdown-menu.component';
3
-
4
- export interface PdmMenubarItem {
5
- label: string;
6
- items: PdmMenuItem[];
7
- }
8
-
9
- @Component({
10
- selector: 'pdm-menubar',
11
- templateUrl: './menubar.component.html',
12
- changeDetection: ChangeDetectionStrategy.OnPush
13
- })
14
- export class PdmMenubarComponent {
15
- @Input() menus: PdmMenubarItem[] = [];
16
- @Input() className = '';
17
- @Output() itemSelect = new EventEmitter<string>();
18
-
19
- openIndex = -1;
20
-
21
- toggle(index: number): void {
22
- this.openIndex = this.openIndex === index ? -1 : index;
23
- }
24
-
25
- select(value: string): void {
26
- this.itemSelect.emit(value);
27
- this.openIndex = -1;
28
- }
29
- }
@@ -1,17 +0,0 @@
1
- <div class="relative" [ngClass]="className">
2
- <select
3
- [id]="id"
4
- [value]="value"
5
- [disabled]="disabled"
6
- [attr.aria-invalid]="invalid"
7
- (change)="onChange($event)"
8
- [ngClass]="[
9
- 'flex h-9 w-full appearance-none rounded-[8px] border bg-[hsl(var(--background))] px-3 py-2 pr-9 text-sm leading-5 shadow-[0_1px_2px_rgba(0,0,0,0.1)] ring-offset-[hsl(var(--background))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[hsl(var(--foreground))] disabled:cursor-not-allowed disabled:opacity-50',
10
- invalid ? 'border-[hsl(var(--destructive))]' : 'border-[hsl(var(--input))]'
11
- ]"
12
- >
13
- <option value="" disabled>{{ placeholder }}</option>
14
- <option *ngFor="let option of options" [value]="option.value" [disabled]="option.disabled">{{ option.label }}</option>
15
- </select>
16
- <pdm-icon className="pointer-events-none absolute right-3 top-1/2 -translate-y-1/2 text-[hsl(var(--muted-foreground))]" name="chevron-down" [size]="16"></pdm-icon>
17
- </div>