@cahyo-dimas/freeday 3.5.0 → 3.7.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 (59) hide show
  1. package/CHANGELOG.md +130 -0
  2. package/COMPONENTS.md +251 -8
  3. package/README.id.md +19 -6
  4. package/README.md +17 -5
  5. package/USAGE.md +42 -0
  6. package/adapters/blazor/FdyDateRange.razor.cs +10 -0
  7. package/adapters/blazor/FdyTable.razor +6 -2
  8. package/adapters/blazor/FdyTable.razor.cs +21 -0
  9. package/adapters/blazor/TableTypes.cs +4 -0
  10. package/adapters/react/components/FdyDateRange.tsx +8 -2
  11. package/adapters/react/components/FdyTable.tsx +24 -3
  12. package/adapters/react/index.d.ts +1 -1
  13. package/adapters/vue/components/FdyDateRange.vue +11 -5
  14. package/adapters/vue/components/FdyTable.vue +18 -2
  15. package/dist/freeday-confirm.js +101 -0
  16. package/dist/freeday-copy.js +58 -0
  17. package/dist/freeday-datepicker.js +17 -2
  18. package/dist/freeday-form.js +30 -1
  19. package/dist/freeday-search.js +77 -0
  20. package/dist/freeday.bundle.css +544 -122
  21. package/dist/freeday.css +241 -118
  22. package/dist/freeday.d.ts +17 -2
  23. package/dist/freeday.js +286 -3
  24. package/dist/freeday.tokens.css +303 -4
  25. package/docs/agent-onboarding.md +8 -0
  26. package/docs/getting-started.md +1 -1
  27. package/package.json +2 -2
  28. package/src/base.css +1 -1
  29. package/src/components/accordion.css +1 -1
  30. package/src/components/alert.css +5 -5
  31. package/src/components/app-shell.css +2 -2
  32. package/src/components/appbar.css +3 -3
  33. package/src/components/avatar.css +17 -9
  34. package/src/components/badge.css +18 -14
  35. package/src/components/breadcrumb.css +1 -1
  36. package/src/components/button.css +21 -13
  37. package/src/components/card.css +7 -0
  38. package/src/components/carousel.css +3 -3
  39. package/src/components/cascade.css +4 -4
  40. package/src/components/chip.css +33 -15
  41. package/src/components/combo.css +5 -5
  42. package/src/components/composition.css +36 -0
  43. package/src/components/datepicker.css +8 -8
  44. package/src/components/description-list.css +11 -1
  45. package/src/components/file-upload.css +9 -4
  46. package/src/components/input-group.css +2 -2
  47. package/src/components/input.css +2 -2
  48. package/src/components/menu.css +3 -3
  49. package/src/components/pagination.css +1 -1
  50. package/src/components/selection.css +8 -2
  51. package/src/components/skeleton.css +1 -1
  52. package/src/components/states.css +7 -0
  53. package/src/components/stepper.css +1 -1
  54. package/src/components/table.css +25 -11
  55. package/src/components/tabs.css +1 -1
  56. package/src/components/timepicker.css +3 -3
  57. package/src/components/toast.css +1 -1
  58. package/src/components/tree.css +1 -1
  59. package/tokens/tokens.json +57 -4
@@ -0,0 +1,77 @@
1
+ /* Freeday, list search enhancer (optional, zero-dependency). Note #061.
2
+ * Turns an .fdy-input-group into a search box that searches while the reader pauses, at once on
3
+ * Enter, and has a clear button. All three paths end in ONE bubbling event on the group,
4
+ * "fdy-search" {term}, so an app listens once instead of wiring keyup, a timer and a click.
5
+ *
6
+ * Markup (the group, not a new block; the clear button is yours, so is its aria-label):
7
+ * <div class="fdy-input-group" data-fdy-search [data-fdy-search-delay="400"]>
8
+ * <span class="fdy-input-group__addon fdy-input-group__addon--icon">…svg…</span>
9
+ * <input class="fdy-input" type="text" aria-label="Search orders">
10
+ * <button type="button" class="fdy-input-group__btn" data-fdy-search-clear aria-label="Clear search">×</button>
11
+ * </div>
12
+ *
13
+ * type="text", not "search": WebKit's own × is unthemed and fires no Enter, which is what made
14
+ * clearing a field leave the old rows on screen until somebody pressed Enter on an empty box.
15
+ * The clear button is hidden while the box is empty. Clearing writes through the native value
16
+ * setter and fires a native `input`, so v-model, a React onChange and Blazor @bind all follow.
17
+ * `term` is trimmed; "" means "show everything again". Exposes window.FreedaySearch.
18
+ */
19
+ (function () {
20
+ 'use strict';
21
+
22
+ var DEFAULT_DELAY = 400;
23
+ var nativeValue = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, 'value').set;
24
+
25
+ function initSearch(root) {
26
+ if (root.dataset.fdySearchReady === '1') return;
27
+ var input = root.querySelector('input');
28
+ if (!input) return;
29
+ root.dataset.fdySearchReady = '1';
30
+ var clearBtn = root.querySelector('[data-fdy-search-clear]');
31
+ var delayAttr = parseInt(root.getAttribute('data-fdy-search-delay'), 10);
32
+ var delay = isNaN(delayAttr) ? DEFAULT_DELAY : delayAttr;
33
+ var timer = null;
34
+
35
+ function cancel() { if (timer !== null) { clearTimeout(timer); timer = null; } }
36
+ function emit() {
37
+ cancel();
38
+ root.dispatchEvent(new CustomEvent('fdy-search', { bubbles: true, detail: { term: input.value.trim() } }));
39
+ }
40
+ function syncClear() { if (clearBtn) clearBtn.hidden = input.value === ''; }
41
+
42
+ input.addEventListener('input', function () {
43
+ syncClear();
44
+ cancel();
45
+ timer = setTimeout(emit, delay);
46
+ });
47
+ input.addEventListener('keydown', function (e) {
48
+ if (e.key !== 'Enter') return;
49
+ e.preventDefault(); // inside a <form>, Enter would submit it as well
50
+ emit();
51
+ });
52
+ if (clearBtn) {
53
+ clearBtn.addEventListener('click', function () {
54
+ nativeValue.call(input, '');
55
+ input.dispatchEvent(new Event('input', { bubbles: true }));
56
+ emit(); // at once, and it cancels the pause the input event just started
57
+ input.focus();
58
+ });
59
+ }
60
+ syncClear();
61
+ }
62
+
63
+ function initAll(context) {
64
+ var root = context || document;
65
+ /* root included: querySelectorAll never matches its own root, and a framework ref often sits ON the widget. */
66
+ if (root.matches && root.matches('[data-fdy-search]')) initSearch(root);
67
+ Array.prototype.forEach.call(root.querySelectorAll('[data-fdy-search]'), initSearch);
68
+ }
69
+
70
+ if (document.readyState === 'loading') {
71
+ document.addEventListener('DOMContentLoaded', function () { initAll(); });
72
+ } else {
73
+ initAll();
74
+ }
75
+
76
+ window.FreedaySearch = { init: initSearch, initAll: initAll };
77
+ })();