@dodlhuat/basix 1.2.0 → 1.2.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 (93) hide show
  1. package/README.md +266 -6
  2. package/css/accordion.scss +86 -87
  3. package/css/alert.scss +137 -137
  4. package/css/button.scss +48 -0
  5. package/css/calendar.scss +957 -0
  6. package/css/card.scss +65 -65
  7. package/css/chart.scss +270 -157
  8. package/css/chat-bubbles.scss +134 -68
  9. package/css/chips.scss +109 -19
  10. package/css/colors.scss +32 -32
  11. package/css/datepicker.scss +336 -336
  12. package/css/defaults.scss +90 -90
  13. package/css/docs.scss +529 -0
  14. package/css/editor.scss +36 -0
  15. package/css/file-uploader.scss +1 -1
  16. package/css/flyout-menu.scss +361 -361
  17. package/css/form.scss +0 -15
  18. package/css/gallery.scss +65 -6
  19. package/css/grid.scss +41 -40
  20. package/css/group-picker.scss +345 -0
  21. package/css/guitar-chords.css +250 -250
  22. package/css/icons.scss +330 -330
  23. package/css/parameters.scss +3 -3
  24. package/css/placeholder.scss +33 -33
  25. package/css/popover.scss +206 -0
  26. package/css/progress.scss +76 -32
  27. package/css/properties.scss +51 -36
  28. package/css/push-menu.scss +302 -174
  29. package/css/reset.scss +39 -39
  30. package/css/scrollbar.scss +62 -5
  31. package/css/sidebar-nav.scss +92 -0
  32. package/css/spinner.scss +65 -65
  33. package/css/stepper.scss +48 -12
  34. package/css/style.css +3155 -254
  35. package/css/style.css.map +1 -1
  36. package/css/style.min.css +1 -1
  37. package/css/style.scss +51 -45
  38. package/css/table.scss +199 -199
  39. package/css/tabs.scss +154 -123
  40. package/css/timeline.scss +83 -38
  41. package/css/timepicker.scss +100 -5
  42. package/css/toast.scss +81 -81
  43. package/css/virtual-dropdown.scss +35 -29
  44. package/js/calendar.js +532 -0
  45. package/js/calendar.ts +706 -0
  46. package/js/chart.js +573 -257
  47. package/js/chart.ts +692 -0
  48. package/js/code-viewer.js +10 -10
  49. package/js/code-viewer.ts +188 -188
  50. package/js/datepicker.ts +627 -627
  51. package/js/docs-nav.js +204 -0
  52. package/js/dropdown.ts +179 -179
  53. package/js/editor.js +50 -6
  54. package/js/editor.ts +483 -444
  55. package/js/file-uploader.js +1 -0
  56. package/js/file-uploader.ts +1 -0
  57. package/js/flyout-menu.js +14 -14
  58. package/js/flyout-menu.ts +249 -249
  59. package/js/form-builder.js +106 -106
  60. package/js/gallery.js +14 -8
  61. package/js/gallery.ts +245 -236
  62. package/js/group-picker.js +342 -0
  63. package/js/group-picker.ts +447 -0
  64. package/js/guitar-chords.js +268 -268
  65. package/js/lazy-loader.js +121 -121
  66. package/js/modal.ts +166 -166
  67. package/js/popover.js +163 -0
  68. package/js/popover.ts +219 -0
  69. package/js/position.js +108 -0
  70. package/js/position.ts +111 -0
  71. package/js/push-menu.js +113 -0
  72. package/js/push-menu.ts +284 -145
  73. package/js/request.js +50 -50
  74. package/js/scroll.ts +47 -47
  75. package/js/scrollbar.js +13 -0
  76. package/js/scrollbar.ts +324 -307
  77. package/js/select.ts +216 -216
  78. package/js/sidebar-nav.js +41 -0
  79. package/js/sidebar-nav.ts +66 -0
  80. package/js/table.ts +452 -452
  81. package/js/tabs.ts +279 -279
  82. package/js/theme.js +17 -6
  83. package/js/theme.ts +234 -224
  84. package/js/toast.ts +137 -137
  85. package/js/tooltip.js +6 -60
  86. package/js/tooltip.ts +184 -251
  87. package/js/tsconfig.json +18 -18
  88. package/js/utils.ts +83 -83
  89. package/js/virtual-dropdown.js +25 -25
  90. package/js/virtual-dropdown.ts +365 -365
  91. package/package.json +37 -39
  92. package/js/index.js +0 -816
  93. package/js/index.ts +0 -987
package/js/request.js CHANGED
@@ -1,51 +1,51 @@
1
- class Request {
2
- constructor(url, parameters, success, error) {
3
- this.url = url;
4
- this.parameters = parameters;
5
- this.success = success;
6
- this.error = error;
7
- }
8
-
9
- get() {
10
- const checked = this.#checkSuccessError(this.success, this.error);
11
- if (this.parameters.data !== undefined) {
12
- this.url += '?' + new URLSearchParams(this.parameters.data);
13
- }
14
- fetch(this.url)
15
- .then(function(response) {
16
- return response.json();
17
- })
18
- .then(checked.success)
19
- .catch(checked.error);
20
- }
21
- post() {
22
- const checked = this.#checkSuccessError(this.success, this.error);
23
- fetch(this.url,
24
- {
25
- method: 'post',
26
- headers: {
27
- 'Accept': 'application/json',
28
- 'Content-Type': 'application/json'
29
- },
30
- body: JSON.stringify(this.parameters.data)
31
- })
32
- .then(checked.success)
33
- .catch(checked.error);
34
- }
35
-
36
- #checkSuccessError(success, error) {
37
- if (success === undefined) {
38
- success = function(data) {
39
- console.log(data);
40
- };
41
- }
42
- if (error === undefined) {
43
- error = function(error) {
44
- console.error(error);
45
- }
46
- }
47
- return {success, error};
48
- }
49
- }
50
-
1
+ class Request {
2
+ constructor(url, parameters, success, error) {
3
+ this.url = url;
4
+ this.parameters = parameters;
5
+ this.success = success;
6
+ this.error = error;
7
+ }
8
+
9
+ get() {
10
+ const checked = this.#checkSuccessError(this.success, this.error);
11
+ if (this.parameters.data !== undefined) {
12
+ this.url += '?' + new URLSearchParams(this.parameters.data);
13
+ }
14
+ fetch(this.url)
15
+ .then(function(response) {
16
+ return response.json();
17
+ })
18
+ .then(checked.success)
19
+ .catch(checked.error);
20
+ }
21
+ post() {
22
+ const checked = this.#checkSuccessError(this.success, this.error);
23
+ fetch(this.url,
24
+ {
25
+ method: 'post',
26
+ headers: {
27
+ 'Accept': 'application/json',
28
+ 'Content-Type': 'application/json'
29
+ },
30
+ body: JSON.stringify(this.parameters.data)
31
+ })
32
+ .then(checked.success)
33
+ .catch(checked.error);
34
+ }
35
+
36
+ #checkSuccessError(success, error) {
37
+ if (success === undefined) {
38
+ success = function(data) {
39
+ console.log(data);
40
+ };
41
+ }
42
+ if (error === undefined) {
43
+ error = function(error) {
44
+ console.error(error);
45
+ }
46
+ }
47
+ return {success, error};
48
+ }
49
+ }
50
+
51
51
  export {Request}
package/js/scroll.ts CHANGED
@@ -1,47 +1,47 @@
1
- interface ScrollOptions {
2
- behavior?: ScrollBehavior;
3
- offset?: number;
4
- block?: ScrollLogicalPosition;
5
- }
6
-
7
- class Scroll {
8
- public static to(target: string | Element, options: ScrollOptions = {}): void {
9
- const fixed_header = document.querySelector('.main-header') as HTMLElement | null;
10
- const offset = fixed_header ? fixed_header.offsetHeight : 0;
11
-
12
- const settings: Required<ScrollOptions> = {
13
- behavior: "smooth",
14
- offset: offset,
15
- block: "start",
16
- ...options
17
- };
18
-
19
- let el: Element | null = target instanceof Element ? target : null;
20
-
21
- if (typeof target === "string") {
22
- el = document.querySelector(target);
23
- }
24
-
25
- if (!el) return;
26
-
27
- const rect = el.getBoundingClientRect();
28
- const scrollTop = window.scrollY;
29
- const offsetTop = rect.top + scrollTop - settings.offset;
30
-
31
- window.scrollTo({
32
- top: offsetTop,
33
- behavior: settings.behavior
34
- });
35
- }
36
- }
37
-
38
- declare global {
39
- interface Window {
40
- Scroll: typeof Scroll;
41
- }
42
- }
43
-
44
- window.Scroll = Scroll;
45
-
46
- export { Scroll };
47
- export type { ScrollOptions };
1
+ interface ScrollOptions {
2
+ behavior?: ScrollBehavior;
3
+ offset?: number;
4
+ block?: ScrollLogicalPosition;
5
+ }
6
+
7
+ class Scroll {
8
+ public static to(target: string | Element, options: ScrollOptions = {}): void {
9
+ const fixed_header = document.querySelector('.main-header') as HTMLElement | null;
10
+ const offset = fixed_header ? fixed_header.offsetHeight : 0;
11
+
12
+ const settings: Required<ScrollOptions> = {
13
+ behavior: "smooth",
14
+ offset: offset,
15
+ block: "start",
16
+ ...options
17
+ };
18
+
19
+ let el: Element | null = target instanceof Element ? target : null;
20
+
21
+ if (typeof target === "string") {
22
+ el = document.querySelector(target);
23
+ }
24
+
25
+ if (!el) return;
26
+
27
+ const rect = el.getBoundingClientRect();
28
+ const scrollTop = window.scrollY;
29
+ const offsetTop = rect.top + scrollTop - settings.offset;
30
+
31
+ window.scrollTo({
32
+ top: offsetTop,
33
+ behavior: settings.behavior
34
+ });
35
+ }
36
+ }
37
+
38
+ declare global {
39
+ interface Window {
40
+ Scroll: typeof Scroll;
41
+ }
42
+ }
43
+
44
+ window.Scroll = Scroll;
45
+
46
+ export { Scroll };
47
+ export type { ScrollOptions };
package/js/scrollbar.js CHANGED
@@ -31,6 +31,7 @@ class Scrollbar {
31
31
  this.boundTrackClick = this.handleTrackClick.bind(this);
32
32
  this.boundViewportScroll = this.updateThumb.bind(this);
33
33
  this.boundUpdateThumb = this.updateThumb.bind(this);
34
+ this.boundContainerWheel = this.handleContainerWheel.bind(this);
34
35
  // Setup ResizeObserver
35
36
  this.ro = new ResizeObserver(this.boundUpdateThumb);
36
37
  // Initialize
@@ -80,6 +81,7 @@ class Scrollbar {
80
81
  this.viewport.addEventListener('scroll', this.boundViewportScroll, { passive: true });
81
82
  this.thumb.addEventListener('pointerdown', this.boundThumbPointerDown);
82
83
  this.track.addEventListener('click', this.boundTrackClick);
84
+ this.container.addEventListener('wheel', this.boundContainerWheel, { passive: false });
83
85
  // Observe size changes
84
86
  this.ro.observe(this.viewport);
85
87
  this.ro.observe(this.content);
@@ -182,11 +184,22 @@ class Scrollbar {
182
184
  const scrollTop = scrollRatio * (maxScroll || 0);
183
185
  this.viewport.scrollTo({ top: scrollTop, behavior: 'smooth' });
184
186
  }
187
+ handleContainerWheel(e) {
188
+ const { scrollTop, scrollHeight, clientHeight } = this.viewport;
189
+ const scrollable = scrollHeight > clientHeight;
190
+ const atTop = scrollTop === 0 && e.deltaY < 0;
191
+ const atBottom = scrollTop + clientHeight >= scrollHeight - 1 && e.deltaY > 0;
192
+ if (scrollable && !atTop && !atBottom) {
193
+ e.preventDefault();
194
+ }
195
+ this.viewport.scrollTop += e.deltaY;
196
+ }
185
197
  destroy() {
186
198
  // Remove event listeners
187
199
  this.viewport.removeEventListener('scroll', this.boundViewportScroll);
188
200
  this.thumb.removeEventListener('pointerdown', this.boundThumbPointerDown);
189
201
  this.track.removeEventListener('click', this.boundTrackClick);
202
+ this.container.removeEventListener('wheel', this.boundContainerWheel);
190
203
  window.removeEventListener('resize', this.boundUpdateThumb);
191
204
  // Disconnect observer
192
205
  this.ro.disconnect();