@keenmate/pure-admin-core 2.9.0-rc03 → 2.9.0-rc05

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 (35) hide show
  1. package/README.md +55 -13
  2. package/dist/css/main.css +554 -7
  3. package/package.json +3 -1
  4. package/snippets/buttons.html +51 -0
  5. package/snippets/cards.html +132 -47
  6. package/snippets/comparison.html +26 -22
  7. package/snippets/manifest.json +180 -115
  8. package/snippets/range-group.html +125 -0
  9. package/snippets/splitter.html +44 -38
  10. package/snippets/statistics.html +31 -0
  11. package/src/js/btn-split-auto-absorb.js +327 -0
  12. package/src/js/command-palette.js +472 -0
  13. package/src/js/file-selector.js +1275 -0
  14. package/src/js/internal/logging.js +121 -0
  15. package/src/js/logic-tree-renderer.js +303 -0
  16. package/src/js/modal-dialogs.js +460 -0
  17. package/src/js/overflow.js +371 -0
  18. package/src/js/pa-stat-fit.js +184 -0
  19. package/src/js/range-group.js +663 -0
  20. package/src/js/search-autocomplete-v2.js +907 -0
  21. package/src/js/search-autocomplete.js +434 -0
  22. package/src/js/settings-panel.js +245 -0
  23. package/src/js/split-button.js +141 -0
  24. package/src/js/splitter.js +1323 -0
  25. package/src/js/toast-service.js +302 -0
  26. package/src/js/tooltips-popovers.js +275 -0
  27. package/src/js/virtual-scroll.js +143 -0
  28. package/src/js/virtual-textbox.js +803 -0
  29. package/src/scss/_core.scss +7 -0
  30. package/src/scss/core-components/_buttons.scss +44 -0
  31. package/src/scss/core-components/_cards.scss +95 -6
  32. package/src/scss/core-components/_overflow.scss +50 -0
  33. package/src/scss/core-components/_range-group.scss +474 -0
  34. package/src/scss/core-components/_statistics.scss +163 -0
  35. package/src/scss/variables/_components.scss +41 -2
@@ -0,0 +1,141 @@
1
+ /**
2
+ * Pure Admin Split Button
3
+ * Dropdown positioning via Floating UI
4
+ * Menus are moved to document.body to avoid overflow clipping
5
+ */
6
+
7
+ (function() {
8
+ 'use strict';
9
+
10
+ const { computePosition, flip, shift, offset, autoUpdate } = window.FloatingUIDOM;
11
+
12
+ // Track active menu, its container, and cleanup
13
+ let activeMenu = null;
14
+ let activeContainer = null;
15
+ let activeCleanup = null;
16
+
17
+ /**
18
+ * Toggle a split button menu open/closed
19
+ * @param {Event} event - Click event from the toggle button
20
+ */
21
+ function toggleSplitMenu(event) {
22
+ event.stopPropagation();
23
+
24
+ const splitContainer = event.currentTarget.closest('.pa-btn-split');
25
+
26
+ // If this container's menu is already open, close it
27
+ if (activeContainer === splitContainer) {
28
+ closeSplitMenu();
29
+ return;
30
+ }
31
+
32
+ // Close any other open menu
33
+ closeSplitMenu();
34
+
35
+ const menu = splitContainer.querySelector('.pa-btn-split__menu');
36
+ if (!menu) return;
37
+
38
+ // Read placement from container (default: bottom-end)
39
+ const placement = splitContainer.dataset.placement || 'bottom-end';
40
+
41
+ // Mark container as open (for chevron rotation)
42
+ splitContainer.classList.add('pa-btn-split--open');
43
+
44
+ // Move menu to body for rendering outside overflow containers
45
+ menu._originalParent = splitContainer;
46
+ document.body.appendChild(menu);
47
+ menu.classList.add('pa-btn-split__menu--open');
48
+ activeMenu = menu;
49
+ activeContainer = splitContainer;
50
+
51
+ // Use autoUpdate so menu follows the button on scroll/resize
52
+ activeCleanup = autoUpdate(splitContainer, menu, () => {
53
+ positionMenu(splitContainer, menu, placement);
54
+ });
55
+ }
56
+
57
+ /**
58
+ * Position menu using Floating UI
59
+ */
60
+ async function positionMenu(reference, menu, placement) {
61
+ const { x, y } = await computePosition(reference, menu, {
62
+ placement: placement,
63
+ strategy: 'fixed',
64
+ middleware: [
65
+ offset(6),
66
+ flip(),
67
+ shift({ padding: 8 })
68
+ ]
69
+ });
70
+
71
+ Object.assign(menu.style, {
72
+ position: 'fixed',
73
+ left: `${x}px`,
74
+ top: `${y}px`,
75
+ minWidth: `${reference.offsetWidth}px`
76
+ });
77
+ }
78
+
79
+ /**
80
+ * Close the active split menu and return it to its original parent
81
+ */
82
+ function closeSplitMenu() {
83
+ if (!activeMenu) return;
84
+
85
+ // Stop auto-updating position
86
+ if (activeCleanup) {
87
+ activeCleanup();
88
+ activeCleanup = null;
89
+ }
90
+
91
+ activeMenu.classList.remove('pa-btn-split__menu--open');
92
+
93
+ // Remove open state from container (chevron rotation)
94
+ if (activeContainer) {
95
+ activeContainer.classList.remove('pa-btn-split--open');
96
+ }
97
+
98
+ // Move menu back to its original parent
99
+ if (activeMenu._originalParent) {
100
+ activeMenu._originalParent.appendChild(activeMenu);
101
+ delete activeMenu._originalParent;
102
+ }
103
+
104
+ // Reset inline styles from Floating UI
105
+ activeMenu.style.position = '';
106
+ activeMenu.style.left = '';
107
+ activeMenu.style.top = '';
108
+ activeMenu.style.minWidth = '';
109
+
110
+ activeMenu = null;
111
+ activeContainer = null;
112
+ }
113
+
114
+ // Close menus when clicking outside the active menu / on a different split
115
+ // button, OR when picking a menu item.
116
+ document.addEventListener('click', function(event) {
117
+ if (!activeMenu) return;
118
+ // Clicked a menu item → dismiss like any dropdown. The item's own click
119
+ // handler has already run (this fires as the event bubbles up to
120
+ // document), so it's safe to close here.
121
+ if (activeMenu.contains(event.target) && event.target.closest('.pa-btn-split__item')) {
122
+ closeSplitMenu();
123
+ return;
124
+ }
125
+ // Clicked dead space inside the open menu (padding, etc.) → keep it open.
126
+ if (activeMenu.contains(event.target)) return;
127
+ if (activeContainer && activeContainer.contains(event.target)) return;
128
+ closeSplitMenu();
129
+ });
130
+
131
+ // Close on Escape
132
+ document.addEventListener('keydown', function(event) {
133
+ if (event.key === 'Escape' && activeMenu) {
134
+ closeSplitMenu();
135
+ }
136
+ });
137
+
138
+ // Expose globally
139
+ window.toggleSplitMenu = toggleSplitMenu;
140
+ window.closeSplitMenu = closeSplitMenu;
141
+ })();