@nanahoshi/mona-ui 0.1.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 (134) hide show
  1. package/README.md +25 -0
  2. package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +590 -0
  3. package/fesm2022/nanahoshi-mona-ui-avatar.mjs +168 -0
  4. package/fesm2022/nanahoshi-mona-ui-breadcrumb.mjs +220 -0
  5. package/fesm2022/nanahoshi-mona-ui-button-group.mjs +225 -0
  6. package/fesm2022/nanahoshi-mona-ui-button.mjs +497 -0
  7. package/fesm2022/nanahoshi-mona-ui-calendar.mjs +1569 -0
  8. package/fesm2022/nanahoshi-mona-ui-check-box.mjs +339 -0
  9. package/fesm2022/nanahoshi-mona-ui-chip.mjs +453 -0
  10. package/fesm2022/nanahoshi-mona-ui-circular-progress-bar.mjs +200 -0
  11. package/fesm2022/nanahoshi-mona-ui-color-gradient.mjs +853 -0
  12. package/fesm2022/nanahoshi-mona-ui-color-palette.mjs +923 -0
  13. package/fesm2022/nanahoshi-mona-ui-color-picker.mjs +495 -0
  14. package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +686 -0
  15. package/fesm2022/nanahoshi-mona-ui-common.mjs +642 -0
  16. package/fesm2022/nanahoshi-mona-ui-contextmenu.mjs +485 -0
  17. package/fesm2022/nanahoshi-mona-ui-date-input.mjs +132 -0
  18. package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +460 -0
  19. package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +659 -0
  20. package/fesm2022/nanahoshi-mona-ui-dialog.mjs +828 -0
  21. package/fesm2022/nanahoshi-mona-ui-dropdown-button.mjs +523 -0
  22. package/fesm2022/nanahoshi-mona-ui-dropdown-list.mjs +615 -0
  23. package/fesm2022/nanahoshi-mona-ui-dropdowns.mjs +701 -0
  24. package/fesm2022/nanahoshi-mona-ui-editor.mjs +1400 -0
  25. package/fesm2022/nanahoshi-mona-ui-expansion-panel.mjs +245 -0
  26. package/fesm2022/nanahoshi-mona-ui-fieldset.mjs +170 -0
  27. package/fesm2022/nanahoshi-mona-ui-filter.mjs +680 -0
  28. package/fesm2022/nanahoshi-mona-ui-grid-grid-footer-cell.component-B9SQH5N-.mjs +105 -0
  29. package/fesm2022/nanahoshi-mona-ui-grid-grid-footer-table-cell.directive-DlLwcCFT.mjs +42 -0
  30. package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-Dgea-O0X.mjs +130 -0
  31. package/fesm2022/nanahoshi-mona-ui-grid-grid-toggle.component-DIUutx9s.mjs +773 -0
  32. package/fesm2022/nanahoshi-mona-ui-grid-grid-virtual-list.component-DRHycGIh.mjs +240 -0
  33. package/fesm2022/nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-C3eZIaJK.mjs +5374 -0
  34. package/fesm2022/nanahoshi-mona-ui-grid.mjs +2 -0
  35. package/fesm2022/nanahoshi-mona-ui-internal-filter-input.mjs +87 -0
  36. package/fesm2022/nanahoshi-mona-ui-internal-indicator-icon.mjs +154 -0
  37. package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +1356 -0
  38. package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +2263 -0
  39. package/fesm2022/nanahoshi-mona-ui-internal.mjs +379 -0
  40. package/fesm2022/nanahoshi-mona-ui-list-box.mjs +630 -0
  41. package/fesm2022/nanahoshi-mona-ui-list-view.mjs +527 -0
  42. package/fesm2022/nanahoshi-mona-ui-list.mjs +4 -0
  43. package/fesm2022/nanahoshi-mona-ui-menubar.mjs +966 -0
  44. package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +641 -0
  45. package/fesm2022/nanahoshi-mona-ui-notification.mjs +536 -0
  46. package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +597 -0
  47. package/fesm2022/nanahoshi-mona-ui-pager.mjs +790 -0
  48. package/fesm2022/nanahoshi-mona-ui-placeholder.mjs +83 -0
  49. package/fesm2022/nanahoshi-mona-ui-popover.mjs +325 -0
  50. package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +1559 -0
  51. package/fesm2022/nanahoshi-mona-ui-popup.mjs +1321 -0
  52. package/fesm2022/nanahoshi-mona-ui-progress-bar.mjs +294 -0
  53. package/fesm2022/nanahoshi-mona-ui-query.mjs +175 -0
  54. package/fesm2022/nanahoshi-mona-ui-radio-button.mjs +339 -0
  55. package/fesm2022/nanahoshi-mona-ui-scroll-view.mjs +565 -0
  56. package/fesm2022/nanahoshi-mona-ui-slider.mjs +1049 -0
  57. package/fesm2022/nanahoshi-mona-ui-split-button.mjs +636 -0
  58. package/fesm2022/nanahoshi-mona-ui-splitter.mjs +843 -0
  59. package/fesm2022/nanahoshi-mona-ui-stepper.mjs +537 -0
  60. package/fesm2022/nanahoshi-mona-ui-switch.mjs +308 -0
  61. package/fesm2022/nanahoshi-mona-ui-tabs.mjs +664 -0
  62. package/fesm2022/nanahoshi-mona-ui-text-area.mjs +111 -0
  63. package/fesm2022/nanahoshi-mona-ui-text-box.mjs +369 -0
  64. package/fesm2022/nanahoshi-mona-ui-theme.mjs +314 -0
  65. package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +450 -0
  66. package/fesm2022/nanahoshi-mona-ui-time-selector.mjs +723 -0
  67. package/fesm2022/nanahoshi-mona-ui-tooltip.mjs +716 -0
  68. package/fesm2022/nanahoshi-mona-ui-tree-view.mjs +733 -0
  69. package/fesm2022/nanahoshi-mona-ui-window.mjs +1329 -0
  70. package/fesm2022/nanahoshi-mona-ui.mjs +9 -0
  71. package/package.json +289 -0
  72. package/types/nanahoshi-mona-ui-auto-complete.d.ts +223 -0
  73. package/types/nanahoshi-mona-ui-avatar.d.ts +642 -0
  74. package/types/nanahoshi-mona-ui-breadcrumb.d.ts +70 -0
  75. package/types/nanahoshi-mona-ui-button-group.d.ts +77 -0
  76. package/types/nanahoshi-mona-ui-button.d.ts +111 -0
  77. package/types/nanahoshi-mona-ui-calendar.d.ts +262 -0
  78. package/types/nanahoshi-mona-ui-check-box.d.ts +133 -0
  79. package/types/nanahoshi-mona-ui-chip.d.ts +130 -0
  80. package/types/nanahoshi-mona-ui-circular-progress-bar.d.ts +113 -0
  81. package/types/nanahoshi-mona-ui-color-gradient.d.ts +201 -0
  82. package/types/nanahoshi-mona-ui-color-palette.d.ts +102 -0
  83. package/types/nanahoshi-mona-ui-color-picker.d.ts +156 -0
  84. package/types/nanahoshi-mona-ui-combo-box.d.ts +232 -0
  85. package/types/nanahoshi-mona-ui-common.d.ts +386 -0
  86. package/types/nanahoshi-mona-ui-contextmenu.d.ts +129 -0
  87. package/types/nanahoshi-mona-ui-date-input.d.ts +60 -0
  88. package/types/nanahoshi-mona-ui-date-picker.d.ts +177 -0
  89. package/types/nanahoshi-mona-ui-datetime-picker.d.ts +199 -0
  90. package/types/nanahoshi-mona-ui-dialog.d.ts +261 -0
  91. package/types/nanahoshi-mona-ui-dropdown-button.d.ts +159 -0
  92. package/types/nanahoshi-mona-ui-dropdown-list.d.ts +219 -0
  93. package/types/nanahoshi-mona-ui-dropdowns.d.ts +176 -0
  94. package/types/nanahoshi-mona-ui-editor.d.ts +113 -0
  95. package/types/nanahoshi-mona-ui-expansion-panel.d.ts +87 -0
  96. package/types/nanahoshi-mona-ui-fieldset.d.ts +68 -0
  97. package/types/nanahoshi-mona-ui-filter.d.ts +115 -0
  98. package/types/nanahoshi-mona-ui-grid.d.ts +1114 -0
  99. package/types/nanahoshi-mona-ui-internal-filter-input.d.ts +25 -0
  100. package/types/nanahoshi-mona-ui-internal-indicator-icon.d.ts +28 -0
  101. package/types/nanahoshi-mona-ui-internal-list.d.ts +269 -0
  102. package/types/nanahoshi-mona-ui-internal-tree.d.ts +391 -0
  103. package/types/nanahoshi-mona-ui-internal.d.ts +136 -0
  104. package/types/nanahoshi-mona-ui-list-box.d.ts +225 -0
  105. package/types/nanahoshi-mona-ui-list-view.d.ts +188 -0
  106. package/types/nanahoshi-mona-ui-list.d.ts +1 -0
  107. package/types/nanahoshi-mona-ui-menubar.d.ts +198 -0
  108. package/types/nanahoshi-mona-ui-multi-select.d.ts +247 -0
  109. package/types/nanahoshi-mona-ui-notification.d.ts +106 -0
  110. package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +161 -0
  111. package/types/nanahoshi-mona-ui-pager.d.ts +238 -0
  112. package/types/nanahoshi-mona-ui-placeholder.d.ts +35 -0
  113. package/types/nanahoshi-mona-ui-popover.d.ts +130 -0
  114. package/types/nanahoshi-mona-ui-popup-menu.d.ts +412 -0
  115. package/types/nanahoshi-mona-ui-popup.d.ts +485 -0
  116. package/types/nanahoshi-mona-ui-progress-bar.d.ts +139 -0
  117. package/types/nanahoshi-mona-ui-query.d.ts +89 -0
  118. package/types/nanahoshi-mona-ui-radio-button.d.ts +128 -0
  119. package/types/nanahoshi-mona-ui-scroll-view.d.ts +166 -0
  120. package/types/nanahoshi-mona-ui-slider.d.ts +305 -0
  121. package/types/nanahoshi-mona-ui-split-button.d.ts +182 -0
  122. package/types/nanahoshi-mona-ui-splitter.d.ts +70 -0
  123. package/types/nanahoshi-mona-ui-stepper.d.ts +173 -0
  124. package/types/nanahoshi-mona-ui-switch.d.ts +125 -0
  125. package/types/nanahoshi-mona-ui-tabs.d.ts +158 -0
  126. package/types/nanahoshi-mona-ui-text-area.d.ts +42 -0
  127. package/types/nanahoshi-mona-ui-text-box.d.ts +164 -0
  128. package/types/nanahoshi-mona-ui-theme.d.ts +23 -0
  129. package/types/nanahoshi-mona-ui-time-picker.d.ts +184 -0
  130. package/types/nanahoshi-mona-ui-time-selector.d.ts +143 -0
  131. package/types/nanahoshi-mona-ui-tooltip.d.ts +130 -0
  132. package/types/nanahoshi-mona-ui-tree-view.d.ts +274 -0
  133. package/types/nanahoshi-mona-ui-window.d.ts +295 -0
  134. package/types/nanahoshi-mona-ui.d.ts +2 -0
@@ -0,0 +1,923 @@
1
+ import * as i0 from '@angular/core';
2
+ import { inject, ElementRef, computed, signal, input, output, model, Component } from '@angular/core';
3
+ import { ThemeService } from '@nanahoshi/mona-ui/theme';
4
+ import { count } from '@mirei/ts-collections';
5
+ import { cva } from 'class-variance-authority';
6
+
7
+ const colorPaletteBaseVariants = cva(`
8
+ grid gap-0.125 p-0.0625
9
+ data-[disabled='true']:cursor-not-allowed
10
+ data-[disabled='true']:opacity-50
11
+ data-[disabled='true']:pointer-events-none
12
+ data-[readonly='true']:cursor-default
13
+ data-[invalid='true']:border
14
+ data-[invalid='true']:border-error
15
+ data-[invalid='true']:ring-1
16
+ data-[invalid='true']:ring-error
17
+ `);
18
+ const colorPaletteItemVariants = cva(`
19
+ cursor-pointer
20
+ data-[readonly='true']:cursor-default
21
+ data-[selected='true']:border
22
+ data-[selected='true']:border-border
23
+ data-[selected='true']:outline
24
+ data-[selected='true']:outline-2
25
+ data-[selected='true']:outline-foreground
26
+ data-[selected='true']:scale-90
27
+ hover:border hover:border-border
28
+
29
+ focus:not-data-[selected='true']:border
30
+ focus:not-data-[selected='true']:border-foreground
31
+ focus:not-data-[selected='true']:outline-none
32
+ focus:not-data-[selected='true']:z-1
33
+ `, {
34
+ variants: {
35
+ rounded: {
36
+ none: "rounded-none",
37
+ small: "rounded-sm",
38
+ medium: "rounded",
39
+ large: "rounded-lg",
40
+ full: "rounded-full"
41
+ }
42
+ }
43
+ });
44
+
45
+ const colorPaletteBaseThemeVariants = (theme) => {
46
+ switch (theme) {
47
+ case "mona":
48
+ return colorPaletteBaseVariants;
49
+ default:
50
+ return colorPaletteBaseVariants;
51
+ }
52
+ };
53
+ const colorPaletteItemThemeVariants = (theme) => {
54
+ switch (theme) {
55
+ case "mona":
56
+ return colorPaletteItemVariants;
57
+ default:
58
+ return colorPaletteItemVariants;
59
+ }
60
+ };
61
+
62
+ const flatColorScheme = {
63
+ name: "flat",
64
+ columns: 20,
65
+ colors: [
66
+ "#F9EBEA",
67
+ "#FDEDEC",
68
+ "#F5EEF8",
69
+ "#F4ECF7",
70
+ "#EAF2F8",
71
+ "#EBF5FB",
72
+ "#E8F8F5",
73
+ "#E8F6F3",
74
+ "#E9F7EF",
75
+ "#EAFAF1",
76
+ "#FEF9E7",
77
+ "#FEF5E7",
78
+ "#FDF2E9",
79
+ "#FBEEE6",
80
+ "#FDFEFE",
81
+ "#F8F9F9",
82
+ "#F4F6F6",
83
+ "#F2F4F4",
84
+ "#EBEDEF",
85
+ "#EAECEE",
86
+ "#F2D7D5",
87
+ "#FADBD8",
88
+ "#EBDEF0",
89
+ "#E8DAEF",
90
+ "#D4E6F1",
91
+ "#D6EAF8",
92
+ "#D1F2EB",
93
+ "#D0ECE7",
94
+ "#D4EFDF",
95
+ "#D5F5E3",
96
+ "#FCF3CF",
97
+ "#FDEBD0",
98
+ "#FAE5D3",
99
+ "#F6DDCC",
100
+ "#FBFCFC",
101
+ "#F2F3F4",
102
+ "#EAEDED",
103
+ "#E5E8E8",
104
+ "#D6DBDF",
105
+ "#D5D8DC",
106
+ "#E6B0AA",
107
+ "#F5B7B1",
108
+ "#D7BDE2",
109
+ "#D2B4DE",
110
+ "#A9CCE3",
111
+ "#AED6F1",
112
+ "#A3E4D7",
113
+ "#A2D9CE",
114
+ "#A9DFBF",
115
+ "#ABEBC6",
116
+ "#F9E79F",
117
+ "#FAD7A0",
118
+ "#F5CBA7",
119
+ "#EDBB99",
120
+ "#F7F9F9",
121
+ "#E5E7E9",
122
+ "#D5DBDB",
123
+ "#CCD1D1",
124
+ "#AEB6BF",
125
+ "#ABB2B9",
126
+ "#D98880",
127
+ "#F1948A",
128
+ "#C39BD3",
129
+ "#BB8FCE",
130
+ "#7FB3D5",
131
+ "#85C1E9",
132
+ "#76D7C4",
133
+ "#73C6B6",
134
+ "#7DCEA0",
135
+ "#82E0AA",
136
+ "#F7DC6F",
137
+ "#F8C471",
138
+ "#F0B27A",
139
+ "#E59866",
140
+ "#F4F6F7",
141
+ "#D7DBDD",
142
+ "#BFC9CA",
143
+ "#B2BABB",
144
+ "#85929E",
145
+ "#808B96",
146
+ "#CD6155",
147
+ "#EC7063",
148
+ "#AF7AC5",
149
+ "#A569BD",
150
+ "#5499C7",
151
+ "#5DADE2",
152
+ "#48C9B0",
153
+ "#45B39D",
154
+ "#52BE80",
155
+ "#58D68D",
156
+ "#F4D03F",
157
+ "#F5B041",
158
+ "#EB984E",
159
+ "#DC7633",
160
+ "#F0F3F4",
161
+ "#CACFD2",
162
+ "#AAB7B8",
163
+ "#99A3A4",
164
+ "#5D6D7E",
165
+ "#566573",
166
+ "#C0392B",
167
+ "#E74C3C",
168
+ "#9B59B6",
169
+ "#8E44AD",
170
+ "#2980B9",
171
+ "#3498DB",
172
+ "#1ABC9C",
173
+ "#16A085",
174
+ "#27AE60",
175
+ "#2ECC71",
176
+ "#F1C40F",
177
+ "#F39C12",
178
+ "#E67E22",
179
+ "#D35400",
180
+ "#ECF0F1",
181
+ "#BDC3C7",
182
+ "#95A5A6",
183
+ "#7F8C8D",
184
+ "#34495E",
185
+ "#2C3E50",
186
+ "#A93226",
187
+ "#CB4335",
188
+ "#884EA0",
189
+ "#7D3C98",
190
+ "#2471A3",
191
+ "#2E86C1",
192
+ "#17A589",
193
+ "#138D75",
194
+ "#229954",
195
+ "#28B463",
196
+ "#D4AC0D",
197
+ "#D68910",
198
+ "#CA6F1E",
199
+ "#BA4A00",
200
+ "#D0D3D4",
201
+ "#A6ACAF",
202
+ "#839192",
203
+ "#707B7C",
204
+ "#2E4053",
205
+ "#273746",
206
+ "#922B21",
207
+ "#B03A2E",
208
+ "#76448A",
209
+ "#6C3483",
210
+ "#1F618D",
211
+ "#2874A6",
212
+ "#148F77",
213
+ "#117A65",
214
+ "#1E8449",
215
+ "#239B56",
216
+ "#B7950B",
217
+ "#B9770E",
218
+ "#AF601A",
219
+ "#A04000",
220
+ "#B3B6B7",
221
+ "#909497",
222
+ "#717D7E",
223
+ "#616A6B",
224
+ "#283747",
225
+ "#212F3D",
226
+ "#7B241C",
227
+ "#943126",
228
+ "#633974",
229
+ "#5B2C6F",
230
+ "#1A5276",
231
+ "#21618C",
232
+ "#117864",
233
+ "#0E6655",
234
+ "#196F3D",
235
+ "#1D8348",
236
+ "#9A7D0A",
237
+ "#9C640C",
238
+ "#935116",
239
+ "#873600",
240
+ "#979A9A",
241
+ "#797D7F",
242
+ "#5F6A6A",
243
+ "#515A5A",
244
+ "#212F3C",
245
+ "#1C2833",
246
+ "#641E16",
247
+ "#78281F",
248
+ "#512E5F",
249
+ "#4A235A",
250
+ "#154360",
251
+ "#1B4F72",
252
+ "#0E6251",
253
+ "#0B5345",
254
+ "#145A32",
255
+ "#186A3B",
256
+ "#7D6608",
257
+ "#7E5109",
258
+ "#784212",
259
+ "#6E2C00",
260
+ "#7B7D7D",
261
+ "#626567",
262
+ "#4D5656",
263
+ "#424949",
264
+ "#1B2631",
265
+ "#17202A"
266
+ ]
267
+ };
268
+ const materialColorScheme = {
269
+ name: "material",
270
+ columns: 19,
271
+ colors: [
272
+ "#FFEBEE",
273
+ "#FCE4EC",
274
+ "#F3E5F5",
275
+ "#EDE7F6",
276
+ "#E8EAF6",
277
+ "#E3F2FD",
278
+ "#E1F5FE",
279
+ "#E0F7FA",
280
+ "#E0F2F1",
281
+ "#E8F5E9",
282
+ "#F1F8E9",
283
+ "#F9FBE7",
284
+ "#FFFDE7",
285
+ "#FFF8E1",
286
+ "#FFF3E0",
287
+ "#FBE9E7",
288
+ "#EFEBE9",
289
+ "#FAFAFA",
290
+ "#ECEFF1",
291
+ "#FFCDD2",
292
+ "#F8BBD0",
293
+ "#E1BEE7",
294
+ "#D1C4E9",
295
+ "#C5CAE9",
296
+ "#BBDEFB",
297
+ "#B3E5FC",
298
+ "#B2EBF2",
299
+ "#B2DFDB",
300
+ "#C8E6C9",
301
+ "#DCEDC8",
302
+ "#F0F4C3",
303
+ "#FFF9C4",
304
+ "#FFECB3",
305
+ "#FFE0B2",
306
+ "#FFCCBC",
307
+ "#D7CCC8",
308
+ "#F5F5F5",
309
+ "#CFD8DC",
310
+ "#EF9A9A",
311
+ "#F48FB1",
312
+ "#CE93D8",
313
+ "#B39DDB",
314
+ "#9FA8DA",
315
+ "#90CAF9",
316
+ "#81D4FA",
317
+ "#80DEEA",
318
+ "#80CBC4",
319
+ "#A5D6A7",
320
+ "#C5E1A5",
321
+ "#E6EE9C",
322
+ "#FFF59D",
323
+ "#FFE082",
324
+ "#FFCC80",
325
+ "#FFAB91",
326
+ "#BCAAA4",
327
+ "#EEEEEE",
328
+ "#B0BEC5",
329
+ "#E57373",
330
+ "#F06292",
331
+ "#BA68C8",
332
+ "#9575CD",
333
+ "#7986CB",
334
+ "#64B5F6",
335
+ "#4FC3F7",
336
+ "#4DD0E1",
337
+ "#4DB6AC",
338
+ "#81C784",
339
+ "#AED581",
340
+ "#DCE775",
341
+ "#FFF176",
342
+ "#FFD54F",
343
+ "#FFB74D",
344
+ "#FF8A65",
345
+ "#A1887F",
346
+ "#E0E0E0",
347
+ "#90A4AE",
348
+ "#EF5350",
349
+ "#EC407A",
350
+ "#AB47BC",
351
+ "#7E57C2",
352
+ "#5C6BC0",
353
+ "#42A5F5",
354
+ "#29B6F6",
355
+ "#26C6DA",
356
+ "#26A69A",
357
+ "#66BB6A",
358
+ "#9CCC65",
359
+ "#D4E157",
360
+ "#FFEE58",
361
+ "#FFCA28",
362
+ "#FFA726",
363
+ "#FF7043",
364
+ "#8D6E63",
365
+ "#BDBDBD",
366
+ "#78909C",
367
+ "#F44336",
368
+ "#E91E63",
369
+ "#9C27B0",
370
+ "#673AB7",
371
+ "#3F51B5",
372
+ "#2196F3",
373
+ "#03A9F4",
374
+ "#00BCD4",
375
+ "#009688",
376
+ "#4CAF50",
377
+ "#8BC34A",
378
+ "#CDDC39",
379
+ "#FFEB3B",
380
+ "#FFC107",
381
+ "#FF9800",
382
+ "#FF5722",
383
+ "#795548",
384
+ "#9E9E9E",
385
+ "#607D8B",
386
+ "#E53935",
387
+ "#D81B60",
388
+ "#8E24AA",
389
+ "#5E35B1",
390
+ "#3949AB",
391
+ "#1E88E5",
392
+ "#039BE5",
393
+ "#00ACC1",
394
+ "#00897B",
395
+ "#43A047",
396
+ "#7CB342",
397
+ "#C0CA33",
398
+ "#FDD835",
399
+ "#FFB300",
400
+ "#FB8C00",
401
+ "#F4511E",
402
+ "#6D4C41",
403
+ "#757575",
404
+ "#546E7A",
405
+ "#D32F2F",
406
+ "#C2185B",
407
+ "#7B1FA2",
408
+ "#512DA8",
409
+ "#303F9F",
410
+ "#1976D2",
411
+ "#0288D1",
412
+ "#0097A7",
413
+ "#00796B",
414
+ "#388E3C",
415
+ "#689F38",
416
+ "#AFB42B",
417
+ "#FBC02D",
418
+ "#FFA000",
419
+ "#F57C00",
420
+ "#E64A19",
421
+ "#5D4037",
422
+ "#616161",
423
+ "#455A64",
424
+ "#C62828",
425
+ "#AD1457",
426
+ "#6A1B9A",
427
+ "#4527A0",
428
+ "#283593",
429
+ "#1565C0",
430
+ "#0277BD",
431
+ "#00838F",
432
+ "#00695C",
433
+ "#2E7D32",
434
+ "#558B2F",
435
+ "#9E9D24",
436
+ "#F9A825",
437
+ "#FF8F00",
438
+ "#EF6C00",
439
+ "#D84315",
440
+ "#4E342E",
441
+ "#424242",
442
+ "#37474F",
443
+ "#B71C1C",
444
+ "#880E4F",
445
+ "#4A148C",
446
+ "#311B92",
447
+ "#1A237E",
448
+ "#0D47A1",
449
+ "#01579B",
450
+ "#006064",
451
+ "#004D40",
452
+ "#1B5E20",
453
+ "#33691E",
454
+ "#827717",
455
+ "#F57F17",
456
+ "#FF6F00",
457
+ "#E65100",
458
+ "#BF360C",
459
+ "#3E2723",
460
+ "#212121",
461
+ "#263238"
462
+ ]
463
+ };
464
+ const websafeColorScheme = {
465
+ name: "websafe",
466
+ columns: 18,
467
+ colors: [
468
+ "#CCFF00",
469
+ "#CCCC00",
470
+ "#CC9900",
471
+ "#CC6600",
472
+ "#CC3300",
473
+ "#CC0000",
474
+ "#660000",
475
+ "#663300",
476
+ "#666600",
477
+ "#669900",
478
+ "#66CC00",
479
+ "#66FF00",
480
+ "#00FF00",
481
+ "#00CC00",
482
+ "#009900",
483
+ "#006600",
484
+ "#003300",
485
+ "#000000",
486
+ "#CCFF33",
487
+ "#CCCC33",
488
+ "#CC9933",
489
+ "#CC6633",
490
+ "#CC3333",
491
+ "#CC0033",
492
+ "#660033",
493
+ "#663333",
494
+ "#666633",
495
+ "#669933",
496
+ "#66CC33",
497
+ "#66FF33",
498
+ "#00FF33",
499
+ "#00CC33",
500
+ "#009933",
501
+ "#006633",
502
+ "#003333",
503
+ "#000033",
504
+ "#CCFF66",
505
+ "#CCCC66",
506
+ "#CC9966",
507
+ "#CC6666",
508
+ "#CC3366",
509
+ "#CC0066",
510
+ "#660066",
511
+ "#663366",
512
+ "#666666",
513
+ "#669966",
514
+ "#66CC66",
515
+ "#66FF66",
516
+ "#00FF66",
517
+ "#00CC66",
518
+ "#009966",
519
+ "#006666",
520
+ "#003366",
521
+ "#000066",
522
+ "#CCFF99",
523
+ "#CCCC99",
524
+ "#CC9999",
525
+ "#CC6699",
526
+ "#CC3399",
527
+ "#CC0099",
528
+ "#660099",
529
+ "#663399",
530
+ "#666699",
531
+ "#669999",
532
+ "#66CC99",
533
+ "#66FF99",
534
+ "#00FF99",
535
+ "#00CC99",
536
+ "#009999",
537
+ "#006699",
538
+ "#003399",
539
+ "#000099",
540
+ "#CCFFCC",
541
+ "#CCCCCC",
542
+ "#CC99CC",
543
+ "#CC66CC",
544
+ "#CC33CC",
545
+ "#CC00CC",
546
+ "#6600CC",
547
+ "#6633CC",
548
+ "#6666CC",
549
+ "#6699CC",
550
+ "#66CCCC",
551
+ "#66FFCC",
552
+ "#00FFCC",
553
+ "#00CCCC",
554
+ "#0099CC",
555
+ "#0066CC",
556
+ "#0033CC",
557
+ "#0000CC",
558
+ "#CCFFFF",
559
+ "#CCCCFF",
560
+ "#CC99FF",
561
+ "#CC66FF",
562
+ "#CC33FF",
563
+ "#CC00FF",
564
+ "#6600FF",
565
+ "#6633FF",
566
+ "#6666FF",
567
+ "#6699FF",
568
+ "#66CCFF",
569
+ "#66FFFF",
570
+ "#00FFFF",
571
+ "#00CCFF",
572
+ "#0099FF",
573
+ "#0066FF",
574
+ "#0033FF",
575
+ "#0000FF",
576
+ "#FFFFFF",
577
+ "#FFCCFF",
578
+ "#FF99FF",
579
+ "#FF66FF",
580
+ "#FF33FF",
581
+ "#FF00FF",
582
+ "#9900FF",
583
+ "#9933FF",
584
+ "#9966FF",
585
+ "#9999FF",
586
+ "#99CCFF",
587
+ "#99FFFF",
588
+ "#33FFFF",
589
+ "#33CCFF",
590
+ "#3399FF",
591
+ "#3366FF",
592
+ "#3333FF",
593
+ "#3300FF",
594
+ "#FFFFCC",
595
+ "#FFCCCC",
596
+ "#FF99CC",
597
+ "#FF66CC",
598
+ "#FF33CC",
599
+ "#FF00CC",
600
+ "#9900CC",
601
+ "#9933CC",
602
+ "#9966CC",
603
+ "#9999CC",
604
+ "#99CCCC",
605
+ "#99FFCC",
606
+ "#33FFCC",
607
+ "#33CCCC",
608
+ "#3399CC",
609
+ "#3366CC",
610
+ "#3333CC",
611
+ "#3300CC",
612
+ "#FFFF99",
613
+ "#FFCC99",
614
+ "#FF9999",
615
+ "#FF6699",
616
+ "#FF3399",
617
+ "#FF0099",
618
+ "#990099",
619
+ "#993399",
620
+ "#996699",
621
+ "#999999",
622
+ "#99CC99",
623
+ "#99FF99",
624
+ "#33FF99",
625
+ "#33CC99",
626
+ "#339999",
627
+ "#336699",
628
+ "#333399",
629
+ "#330099",
630
+ "#FFFF66",
631
+ "#FFCC66",
632
+ "#FF9966",
633
+ "#FF6666",
634
+ "#FF3366",
635
+ "#FF0066",
636
+ "#990066",
637
+ "#993366",
638
+ "#996666",
639
+ "#999966",
640
+ "#99CC66",
641
+ "#99FF66",
642
+ "#33FF66",
643
+ "#33CC66",
644
+ "#339966",
645
+ "#336666",
646
+ "#333366",
647
+ "#330066",
648
+ "#FFFF33",
649
+ "#FFCC33",
650
+ "#FF9933",
651
+ "#FF6633",
652
+ "#FF3333",
653
+ "#FF0033",
654
+ "#990033",
655
+ "#993333",
656
+ "#996633",
657
+ "#999933",
658
+ "#99CC33",
659
+ "#99FF33",
660
+ "#33FF33",
661
+ "#33CC33",
662
+ "#339933",
663
+ "#336633",
664
+ "#333333",
665
+ "#330033",
666
+ "#FFFF00",
667
+ "#FFCC00",
668
+ "#FF9900",
669
+ "#FF6600",
670
+ "#FF3300",
671
+ "#FF0000",
672
+ "#990000",
673
+ "#993300",
674
+ "#996600",
675
+ "#999900",
676
+ "#99CC00",
677
+ "#99FF00",
678
+ "#33FF00",
679
+ "#33CC00",
680
+ "#339900",
681
+ "#336600",
682
+ "#333300",
683
+ "#330000"
684
+ ]
685
+ };
686
+
687
+ class ColorPaletteComponent {
688
+ constructor() {
689
+ this.#elementRef = inject((ElementRef));
690
+ this.#themeService = inject(ThemeService);
691
+ this.baseClasses = computed(() => {
692
+ const theme = this.#themeService.theme();
693
+ return colorPaletteBaseThemeVariants(theme)();
694
+ }, /* @ts-ignore */
695
+ ...(ngDevMode ? [{ debugName: "baseClasses" }] : /* istanbul ignore next */ []));
696
+ this.colorScheme = computed(() => {
697
+ const palette = this.palette();
698
+ const columns = this.columns();
699
+ if (typeof palette === "string") {
700
+ return this.getColorScheme(palette);
701
+ }
702
+ else {
703
+ const paletteArray = Array.from(palette);
704
+ if (paletteArray.length === 0) {
705
+ return flatColorScheme;
706
+ }
707
+ }
708
+ const maxColumns = Math.min(count(palette), columns);
709
+ return {
710
+ colors: [...palette],
711
+ columns: maxColumns,
712
+ name: "custom"
713
+ };
714
+ }, /* @ts-ignore */
715
+ ...(ngDevMode ? [{ debugName: "colorScheme" }] : /* istanbul ignore next */ []));
716
+ this.paletteItemClasses = computed(() => {
717
+ const theme = this.#themeService.theme();
718
+ const rounded = this.rounded();
719
+ return colorPaletteItemThemeVariants(theme)({ rounded });
720
+ }, /* @ts-ignore */
721
+ ...(ngDevMode ? [{ debugName: "paletteItemClasses" }] : /* istanbul ignore next */ []));
722
+ this.colorRows = computed(() => {
723
+ const { colors, columns } = this.colorScheme();
724
+ const rows = [];
725
+ for (let i = 0; i < colors.length; i += columns) {
726
+ rows.push(colors.slice(i, i + columns));
727
+ }
728
+ return rows;
729
+ }, /* @ts-ignore */
730
+ ...(ngDevMode ? [{ debugName: "colorRows" }] : /* istanbul ignore next */ []));
731
+ this.focusedColorIndex = signal(-1, /* @ts-ignore */
732
+ ...(ngDevMode ? [{ debugName: "focusedColorIndex" }] : /* istanbul ignore next */ []));
733
+ this.activeColorIndex = computed(() => this.focusedColorIndex() === -1 ? 0 : this.focusedColorIndex(), /* @ts-ignore */
734
+ ...(ngDevMode ? [{ debugName: "activeColorIndex" }] : /* istanbul ignore next */ []));
735
+ this.invalidState = computed(() => this.invalid() || (this.required() && this.touched() && !this.value()), /* @ts-ignore */
736
+ ...(ngDevMode ? [{ debugName: "invalidState" }] : /* istanbul ignore next */ []));
737
+ /**
738
+ * @description The number of columns in the color palette grid.
739
+ * Only applicable when using a custom palette.
740
+ * @default 10
741
+ */
742
+ this.columns = input(10, /* @ts-ignore */
743
+ ...(ngDevMode ? [{ debugName: "columns" }] : /* istanbul ignore next */ []));
744
+ /**
745
+ * @description Renders the component with reduced visual emphasis and removes pointer interaction.
746
+ * @default false
747
+ */
748
+ this.disabled = input(false, /* @ts-ignore */
749
+ ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
750
+ /**
751
+ * @description Marks the color palette as invalid. When bound to a signal form field via `[formField]`,
752
+ * this is written by the `FormField` directive.
753
+ * @default false
754
+ */
755
+ this.invalid = input(false, /* @ts-ignore */
756
+ ...(ngDevMode ? [{ debugName: "invalid" }] : /* istanbul ignore next */ []));
757
+ /**
758
+ * @description The palette to display — one of the built-in `"flat"`, `"material"`, or `"websafe"` schemes, or a
759
+ * custom iterable of color strings. An empty custom palette falls back to the flat scheme.
760
+ * @default []
761
+ */
762
+ this.palette = input([], /* @ts-ignore */
763
+ ...(ngDevMode ? [{ debugName: "palette" }] : /* istanbul ignore next */ []));
764
+ /**
765
+ * @description Prevents value changes while preserving the component's visual state. When bound to a signal
766
+ * form field via `[formField]`, this is written by the `FormField` directive.
767
+ * @default false
768
+ */
769
+ this.readonly = input(false, /* @ts-ignore */
770
+ ...(ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []));
771
+ /**
772
+ * @description Border-radius preset applied to the color palette items.
773
+ * @default "none"
774
+ */
775
+ this.rounded = input("none", /* @ts-ignore */
776
+ ...(ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []));
777
+ /**
778
+ * @description Sets whether the color palette is required. When bound to a signal form field via `[formField]`,
779
+ * this is written by the `FormField` directive.
780
+ * @default false
781
+ */
782
+ this.required = input(false, /* @ts-ignore */
783
+ ...(ngDevMode ? [{ debugName: "required" }] : /* istanbul ignore next */ []));
784
+ /**
785
+ * @description The size of each tile in the color palette grid.
786
+ * @default 18
787
+ */
788
+ this.tileSize = input(18, /* @ts-ignore */
789
+ ...(ngDevMode ? [{ debugName: "tileSize" }] : /* istanbul ignore next */ []));
790
+ /**
791
+ * @description Emitted when the color palette is interacted with on blur or color selection.
792
+ * The `FormField` directive listens to this to mark the field as touched.
793
+ */
794
+ this.touch = output();
795
+ /**
796
+ * @description Sets the touched state of the color palette. When bound to a signal form field via `[formField]`,
797
+ * this is written by the `FormField` directive.
798
+ * @default false
799
+ */
800
+ this.touched = input(false, /* @ts-ignore */
801
+ ...(ngDevMode ? [{ debugName: "touched" }] : /* istanbul ignore next */ []));
802
+ /**
803
+ * @description Two-way bindable current color value.
804
+ * @default null
805
+ */
806
+ this.value = model(null, /* @ts-ignore */
807
+ ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
808
+ }
809
+ #elementRef;
810
+ #themeService;
811
+ focusColorTile(index) {
812
+ setTimeout(() => {
813
+ const colorTiles = this.#elementRef.nativeElement.querySelectorAll("[data-color-index]");
814
+ const targetTile = colorTiles[index];
815
+ if (targetTile) {
816
+ targetTile.focus();
817
+ }
818
+ });
819
+ }
820
+ onColorBlur() {
821
+ this.touch.emit();
822
+ }
823
+ onColorFocus(index) {
824
+ this.focusedColorIndex.set(index);
825
+ }
826
+ onColorSelect(color) {
827
+ if (this.disabled() || this.readonly()) {
828
+ return;
829
+ }
830
+ const resultColor = this.value() === color ? null : color;
831
+ this.value.set(resultColor);
832
+ this.touch.emit();
833
+ }
834
+ onKeyDown(event, colorIndex) {
835
+ if (this.disabled()) {
836
+ return;
837
+ }
838
+ const colors = this.colorScheme().colors;
839
+ const columns = this.colorScheme().columns;
840
+ let newIndex = colorIndex;
841
+ let handled = false;
842
+ switch (event.key) {
843
+ case "ArrowLeft":
844
+ newIndex = Math.max(0, colorIndex - 1);
845
+ handled = true;
846
+ break;
847
+ case "ArrowRight":
848
+ newIndex = Math.min(colors.length - 1, colorIndex + 1);
849
+ handled = true;
850
+ break;
851
+ case "ArrowUp":
852
+ newIndex = Math.max(0, colorIndex - columns);
853
+ handled = true;
854
+ break;
855
+ case "ArrowDown":
856
+ newIndex = Math.min(colors.length - 1, colorIndex + columns);
857
+ handled = true;
858
+ break;
859
+ case "Home":
860
+ newIndex = 0;
861
+ handled = true;
862
+ break;
863
+ case "End":
864
+ newIndex = colors.length - 1;
865
+ handled = true;
866
+ break;
867
+ case "Enter":
868
+ case " ":
869
+ if (!this.readonly()) {
870
+ this.onColorSelect(colors[colorIndex]);
871
+ }
872
+ handled = true;
873
+ break;
874
+ }
875
+ if (handled) {
876
+ event.preventDefault();
877
+ event.stopPropagation();
878
+ this.focusedColorIndex.set(newIndex);
879
+ this.focusColorTile(newIndex);
880
+ }
881
+ }
882
+ getColorScheme(paletteType) {
883
+ switch (paletteType) {
884
+ case "flat":
885
+ return flatColorScheme;
886
+ case "material":
887
+ return materialColorScheme;
888
+ case "websafe":
889
+ return websafeColorScheme;
890
+ }
891
+ }
892
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ColorPaletteComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
893
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: ColorPaletteComponent, isStandalone: true, selector: "mona-color-palette", inputs: { columns: { classPropertyName: "columns", publicName: "columns", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, palette: { classPropertyName: "palette", publicName: "palette", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, tileSize: { classPropertyName: "tileSize", publicName: "tileSize", isSignal: true, isRequired: false, transformFunction: null }, touched: { classPropertyName: "touched", publicName: "touched", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { touch: "touch", value: "valueChange" }, host: { properties: { "class": "baseClasses()", "style.grid-template-columns": "'repeat('+colorScheme().columns+', minmax('+tileSize()+'px, 1fr))'", "style.grid-auto-rows": "tileSize()+'px'", "attr.data-disabled": "disabled()", "attr.data-invalid": "invalidState() || null", "attr.data-readonly": "readonly()", "attr.data-required": "required() || null", "attr.role": "'grid'", "attr.aria-label": "'Color palette'", "attr.aria-disabled": "disabled()", "attr.aria-invalid": "invalidState() ? 'true' : null", "attr.aria-readonly": "readonly()", "attr.aria-required": "required()" } }, ngImport: i0, template: "@for (row of colorRows(); track $index; let rowIndex = $index) {\n <div class=\"contents\" role=\"row\">\n @for (color of row; track $index; let colIndex = $index) {\n @let i = rowIndex * colorScheme().columns + colIndex;\n <div\n [class]=\"paletteItemClasses()\"\n [attr.data-selected]=\"color === value()\"\n [attr.data-color-index]=\"i\"\n [attr.data-readonly]=\"readonly()\"\n [attr.tabindex]=\"disabled() ? -1 : i === activeColorIndex() ? 0 : -1\"\n [attr.role]=\"'gridcell'\"\n [attr.aria-label]=\"'Color ' + color\"\n [attr.aria-disabled]=\"disabled()\"\n [attr.aria-readonly]=\"readonly()\"\n [attr.aria-selected]=\"color === value()\"\n [style.background-color]=\"color\"\n (click)=\"onColorSelect(color)\"\n (keydown)=\"onKeyDown($event, i)\"\n (focus)=\"onColorFocus(i)\"\n (blur)=\"onColorBlur()\"></div>\n }\n </div>\n}\n" }); }
894
+ }
895
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ColorPaletteComponent, decorators: [{
896
+ type: Component,
897
+ args: [{ selector: "mona-color-palette", host: {
898
+ "[class]": "baseClasses()",
899
+ "[style.grid-template-columns]": "'repeat('+colorScheme().columns+', minmax('+tileSize()+'px, 1fr))'",
900
+ "[style.grid-auto-rows]": "tileSize()+'px'",
901
+ "[attr.data-disabled]": "disabled()",
902
+ "[attr.data-invalid]": "invalidState() || null",
903
+ "[attr.data-readonly]": "readonly()",
904
+ "[attr.data-required]": "required() || null",
905
+ "[attr.role]": "'grid'",
906
+ "[attr.aria-label]": "'Color palette'",
907
+ "[attr.aria-disabled]": "disabled()",
908
+ "[attr.aria-invalid]": "invalidState() ? 'true' : null",
909
+ "[attr.aria-readonly]": "readonly()",
910
+ "[attr.aria-required]": "required()"
911
+ }, template: "@for (row of colorRows(); track $index; let rowIndex = $index) {\n <div class=\"contents\" role=\"row\">\n @for (color of row; track $index; let colIndex = $index) {\n @let i = rowIndex * colorScheme().columns + colIndex;\n <div\n [class]=\"paletteItemClasses()\"\n [attr.data-selected]=\"color === value()\"\n [attr.data-color-index]=\"i\"\n [attr.data-readonly]=\"readonly()\"\n [attr.tabindex]=\"disabled() ? -1 : i === activeColorIndex() ? 0 : -1\"\n [attr.role]=\"'gridcell'\"\n [attr.aria-label]=\"'Color ' + color\"\n [attr.aria-disabled]=\"disabled()\"\n [attr.aria-readonly]=\"readonly()\"\n [attr.aria-selected]=\"color === value()\"\n [style.background-color]=\"color\"\n (click)=\"onColorSelect(color)\"\n (keydown)=\"onKeyDown($event, i)\"\n (focus)=\"onColorFocus(i)\"\n (blur)=\"onColorBlur()\"></div>\n }\n </div>\n}\n" }]
912
+ }], propDecorators: { columns: [{ type: i0.Input, args: [{ isSignal: true, alias: "columns", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], palette: [{ type: i0.Input, args: [{ isSignal: true, alias: "palette", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], tileSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "tileSize", required: false }] }], touch: [{ type: i0.Output, args: ["touch"] }], touched: [{ type: i0.Input, args: [{ isSignal: true, alias: "touched", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }] } });
913
+
914
+ /*
915
+ * Public API Surface of @nanahoshi/mona-ui/color-palette
916
+ */
917
+
918
+ /**
919
+ * Generated bundle index. Do not edit.
920
+ */
921
+
922
+ export { ColorPaletteComponent };
923
+ //# sourceMappingURL=nanahoshi-mona-ui-color-palette.mjs.map